|
@@ -346,15 +346,11 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
|
|
|
wcsTask.setAgvNo(carNo + "");
|
|
|
}
|
|
|
|
|
|
- if (wcsTask.getState() == 2 || wcsTask.getState() == 7) {
|
|
|
+ if (wcsTask.getState() == 2) {
|
|
|
log.info("已完成的任务无需反馈");
|
|
|
return;
|
|
|
}
|
|
|
- if (wcsTask.getState() == 4 && state == 7) {
|
|
|
- log.info("取货完成之后不用反馈取消状态!");
|
|
|
- return;
|
|
|
- }
|
|
|
- //todo 转发类型任务才回调
|
|
|
+ //转发类型任务才回调
|
|
|
if (wcsTask.getTaskType().equals(Constant.TASK_TYPE.FORWARD.getValue())) {
|
|
|
try {
|
|
|
switch (state) {
|
|
@@ -362,26 +358,31 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
|
|
|
wcsTask.setStartTime(new Date());
|
|
|
break;
|
|
|
case 2://完成
|
|
|
- if (wcsTask.getState() != 6) {
|
|
|
- if (wcsTask.getState() == 2) {
|
|
|
- log.info("不能重复放货," + taskNo);
|
|
|
- return;
|
|
|
- }
|
|
|
- wcsTask.setEndTime(new Date());
|
|
|
- // 解锁终点库位
|
|
|
- baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationTo())
|
|
|
- , Constant.WAREHOUSE_ID, updateBy);
|
|
|
- // 将中间缓存位库存移动到终点
|
|
|
- moveMiddleCacheToDestination(wcsTask);
|
|
|
- //释放redis锁
|
|
|
- if (!StringUtils.isEmpty(wcsTask.getExt8())) {
|
|
|
- redisCache.unlockCacheObject(Long.parseLong(wcsTask.getExt8()));
|
|
|
- }
|
|
|
- // 如果是入库任务,任务结束,减去当前AGV任务数量
|
|
|
- subtractTheNumberOfTasks(wcsTask.getLocationTo());
|
|
|
- // 任务完成回调
|
|
|
- callBackTaskComplete(wcsTask);
|
|
|
+ if (wcsTask.getState() != 4 && wcsTask.getState() != 7) {
|
|
|
+ log.info("任务未取货,不能直接完成!" + taskNo);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (wcsTask.getState() == 2) {
|
|
|
+ log.info("不能重复放货," + taskNo);
|
|
|
+ return;
|
|
|
}
|
|
|
+ if (wcsTask.getState() == 6) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ wcsTask.setEndTime(new Date());
|
|
|
+ // 解锁终点库位
|
|
|
+ baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationTo())
|
|
|
+ , Constant.WAREHOUSE_ID, updateBy);
|
|
|
+ // 将中间缓存位库存移动到终点
|
|
|
+ moveMiddleCacheToDestination(wcsTask);
|
|
|
+ //释放redis锁
|
|
|
+ if (!StringUtils.isEmpty(wcsTask.getExt8())) {
|
|
|
+ redisCache.unlockCacheObject(Long.parseLong(wcsTask.getExt8()));
|
|
|
+ }
|
|
|
+ // 如果是入库任务,任务结束,减去当前AGV任务数量
|
|
|
+ subtractTheNumberOfTasks(wcsTask.getLocationTo());
|
|
|
+ // 任务完成回调
|
|
|
+ callBackTaskComplete(wcsTask);
|
|
|
break;
|
|
|
case 3:
|
|
|
break;
|
|
@@ -406,26 +407,31 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
|
|
|
case 5:
|
|
|
break;
|
|
|
case 6://卸货
|
|
|
- if (wcsTask.getState() != 2) {
|
|
|
- if (wcsTask.getState() == 6) {
|
|
|
- log.info("不能重复放货," + taskNo);
|
|
|
- return;
|
|
|
- }
|
|
|
- wcsTask.setEndTime(new Date());
|
|
|
- // 解锁终点库位
|
|
|
- baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationTo())
|
|
|
- , Constant.WAREHOUSE_ID, updateBy);
|
|
|
- // 将中间缓存位库存移动到终点
|
|
|
- moveMiddleCacheToDestination(wcsTask);
|
|
|
- // 释放redis锁
|
|
|
- if (!StringUtils.isEmpty(wcsTask.getExt8())) {
|
|
|
- redisCache.unlockCacheObject(Long.parseLong(wcsTask.getExt8()));
|
|
|
- }
|
|
|
- // 如果是入库任务,任务结束,减去当前AGV任务数量
|
|
|
- subtractTheNumberOfTasks(wcsTask.getLocationTo());
|
|
|
- // 任务完成回调
|
|
|
- callBackTaskComplete(wcsTask);
|
|
|
+ if (wcsTask.getState() != 4 && wcsTask.getState() != 7) {
|
|
|
+ log.info("任务未取货,不能直接完成!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (wcsTask.getState() == 6) {
|
|
|
+ log.info("不能重复放货," + taskNo);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (wcsTask.getState() == 2) {
|
|
|
+ return;
|
|
|
}
|
|
|
+ wcsTask.setEndTime(new Date());
|
|
|
+ // 解锁终点库位
|
|
|
+ baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationTo())
|
|
|
+ , Constant.WAREHOUSE_ID, updateBy);
|
|
|
+ // 将中间缓存位库存移动到终点
|
|
|
+ moveMiddleCacheToDestination(wcsTask);
|
|
|
+ //释放redis锁
|
|
|
+ if (!StringUtils.isEmpty(wcsTask.getExt8())) {
|
|
|
+ redisCache.unlockCacheObject(Long.parseLong(wcsTask.getExt8()));
|
|
|
+ }
|
|
|
+ // 如果是入库任务,任务结束,减去当前AGV任务数量
|
|
|
+ subtractTheNumberOfTasks(wcsTask.getLocationTo());
|
|
|
+ // 任务完成回调
|
|
|
+ callBackTaskComplete(wcsTask);
|
|
|
break;
|
|
|
case 7://取消
|
|
|
wcsTask.setEndTime(new Date());
|