代码更新:
1. 增加锁定解锁站台的功能 2. 增加创建工作的时间限制
This commit is contained in:
parent
87998c0a28
commit
63387d35e3
|
|
@ -23,6 +23,8 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
import static com.wms.config.InitLocalConfig.configMap;
|
import static com.wms.config.InitLocalConfig.configMap;
|
||||||
import static com.wms.utils.StringUtils.convertJsonString;
|
import static com.wms.utils.StringUtils.convertJsonString;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -138,6 +140,11 @@ public class JobComponent {
|
||||||
if (StringUtils.isEmpty(createWork) || !createWork.equals("1")) {
|
if (StringUtils.isEmpty(createWork) || !createWork.equals("1")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 判断当前时间是否在7:40到23:40之间
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
if (now.isBefore(LocalDateTime.of(now.toLocalDate(), LocalTime.of(7, 40))) || now.isAfter(LocalDateTime.of(now.toLocalDate(), LocalTime.of(23, 40)))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 轮询工作站台,判断是否需要下发任务
|
// 轮询工作站台,判断是否需要下发任务
|
||||||
List<Stand> stands = standService.list(new LambdaQueryWrapper<Stand>()
|
List<Stand> stands = standService.list(new LambdaQueryWrapper<Stand>()
|
||||||
.eq(Stand::getIsLock, 0).eq(Stand::getStandStatus, 0)
|
.eq(Stand::getIsLock, 0).eq(Stand::getStandStatus, 0)
|
||||||
|
|
|
||||||
|
|
@ -1885,9 +1885,19 @@ public class TaskController {
|
||||||
}
|
}
|
||||||
String finishResult = workService.finishWork(standId);
|
String finishResult = workService.finishWork(standId);
|
||||||
if (Objects.equals(finishResult, "")) {
|
if (Objects.equals(finishResult, "")) {
|
||||||
|
// 锁定当前站台
|
||||||
|
String lockMessage;
|
||||||
|
if (standService.update(new LambdaUpdateWrapper<Stand>()
|
||||||
|
.set(Stand::getStandStatus, 1)
|
||||||
|
.eq(Stand::getStandId, standId))) {
|
||||||
|
lockMessage = "锁定站台成功,整理完大盒子请点击整理结束按钮解锁。";
|
||||||
|
} else {
|
||||||
|
lockMessage = "锁定站台失败,请手动锁定。";
|
||||||
|
}
|
||||||
|
|
||||||
// 工作完成成功
|
// 工作完成成功
|
||||||
response.setCode(ResponseCode.OK.getCode());
|
response.setCode(ResponseCode.OK.getCode());
|
||||||
response.setMessage("确认成功,请至收盒子界面完成后续操作。");
|
response.setMessage("确认成功,请至收盒子界面完成后续操作。" + lockMessage);
|
||||||
} else {
|
} else {
|
||||||
// 工作完成失败
|
// 工作完成失败
|
||||||
response.setCode(ResponseCode.ERROR.getCode());
|
response.setCode(ResponseCode.ERROR.getCode());
|
||||||
|
|
@ -2898,4 +2908,53 @@ public class TaskController {
|
||||||
return convertJsonString(response);
|
return convertJsonString(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求整理盒子
|
||||||
|
*
|
||||||
|
* @param sortBoxRequest 请求信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/finishSortBox")
|
||||||
|
@ResponseBody
|
||||||
|
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||||
|
@MyLog(logTitle = "整理盒子结束", logMethod = "finishSortBox")
|
||||||
|
public String finishSortBox(@RequestBody SortBoxRequest sortBoxRequest) {
|
||||||
|
logger.info("整理盒子结束:{},ip地址:{}", convertJsonString(sortBoxRequest), HttpUtils.getIpAddr(servletRequest));
|
||||||
|
ResponseEntity response = new ResponseEntity();
|
||||||
|
try {
|
||||||
|
// 获取站台号
|
||||||
|
Stand targetStand;
|
||||||
|
if (StringUtils.isNotEmpty(sortBoxRequest.getStandId())) {
|
||||||
|
// 站台号从请求参数中获取
|
||||||
|
targetStand = standService.getById(sortBoxRequest.getStandId());
|
||||||
|
} else {
|
||||||
|
// 站台号从ip获取
|
||||||
|
targetStand = standService.getOne(new LambdaQueryWrapper<Stand>()
|
||||||
|
.eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest))
|
||||||
|
.eq(Stand::getStandType, 2)
|
||||||
|
.last("limit 1"));
|
||||||
|
}
|
||||||
|
if (targetStand == null) {
|
||||||
|
logger.error("查询拣选站台错误。");
|
||||||
|
response.setCode(ResponseCode.ERROR.getCode());
|
||||||
|
response.setMessage("查询拣选站台错误。");
|
||||||
|
return convertJsonString(response);
|
||||||
|
}
|
||||||
|
// 更新站台为可用状态
|
||||||
|
targetStand.setStandStatus(0);
|
||||||
|
standService.updateById(targetStand);
|
||||||
|
logger.info("整理大盒子结束,解锁站台成功。");
|
||||||
|
response.setCode(ResponseCode.OK.getCode());
|
||||||
|
response.setMessage("整理大盒子结束,解锁站台成功。");
|
||||||
|
return convertJsonString(response);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 回滚事务
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
logger.error("整理大盒子结束,解锁站台异常,{}", convertJsonString(e));
|
||||||
|
response.setCode(ResponseCode.ERROR.getCode());
|
||||||
|
response.setMessage("整理大盒子结束,解锁站台异常。");
|
||||||
|
return convertJsonString(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -566,10 +566,6 @@ public class WmsJobServiceImplements implements IWmsJobService {
|
||||||
.set(PickTask::getPickStatus, PickTaskStatusEnum.SEND.getCode())
|
.set(PickTask::getPickStatus, PickTaskStatusEnum.SEND.getCode())
|
||||||
.in(PickTask::getVehicleId, vehicleAndStansMap.keySet())
|
.in(PickTask::getVehicleId, vehicleAndStansMap.keySet())
|
||||||
.eq(PickTask::getPickStatus, PickTaskStatusEnum.NEW.getCode()));
|
.eq(PickTask::getPickStatus, PickTaskStatusEnum.NEW.getCode()));
|
||||||
pickTaskService.update(new LambdaUpdateWrapper<PickTask>()
|
|
||||||
.set(PickTask::getPickStatus, PickTaskStatusEnum.NEW.getCode())
|
|
||||||
.in(PickTask::getVehicleId, vehicleAndStansMap.keySet())
|
|
||||||
.eq(PickTask::getPickStatus, PickTaskStatusEnum.TEMP.getCode()));
|
|
||||||
} else {
|
} else {
|
||||||
logger.error("发送拣选任务错误:{}", convertJsonString(result));
|
logger.error("发送拣选任务错误:{}", convertJsonString(result));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user