|
@@ -269,7 +269,7 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
|
|
|
// 任务状态: 队列等待 直接删除即可 其他状态 需要请求AMS删除
|
|
|
if (wcsTask.getState() == Constant.TASK_STS.TASK9.getValue().longValue()
|
|
|
|| wcsTask.getState() == Constant.TASK_STS.TASK10.getValue().longValue()) {
|
|
|
- callBack(wcsTask.getTaskNo(), 7, null);
|
|
|
+ return callBack(wcsTask.getTaskNo(), 7, null);
|
|
|
} else {
|
|
|
//请求ams 取消任务
|
|
|
AmsTask amsTaskQuery = new AmsTask();
|
|
@@ -347,13 +347,13 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public void callBack(String taskNo, Integer state, Integer carNo) {
|
|
|
+ public synchronized AjaxResult callBack(String taskNo, Integer state, Integer carNo) {
|
|
|
String updateBy = "NDC";
|
|
|
log.info("agv回传------------->" + taskNo + "," + state);
|
|
|
WcsTask wcsTask = wcsTaskService.selectWcsTaskByTaskNo(taskNo);
|
|
|
if (wcsTask == null) {
|
|
|
log.info("agv回传没有任务记录------------->");
|
|
|
- return;
|
|
|
+ return AjaxResult.error("agv回传没有任务记录------------->");
|
|
|
}
|
|
|
|
|
|
if (state > 1 && state != 7) {
|
|
@@ -362,7 +362,7 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
|
|
|
|
|
|
if (wcsTask.getState() == 2) {
|
|
|
log.info("已完成的任务无需反馈");
|
|
|
- return;
|
|
|
+ return AjaxResult.error("已完成的任务无需反馈");
|
|
|
}
|
|
|
//转发类型任务才回调
|
|
|
if (wcsTask.getTaskType().equals(Constant.TASK_TYPE.FORWARD.getValue())) {
|
|
@@ -372,16 +372,17 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
|
|
|
wcsTask.setStartTime(new Date());
|
|
|
break;
|
|
|
case 2://完成
|
|
|
- if (wcsTask.getState() != 4 && wcsTask.getState() != 7) {
|
|
|
+ if (wcsTask.getState() != 4
|
|
|
+ && (StringUtils.isEmpty(wcsTask.getBeforeTask()) || !wcsTask.getBeforeTask().equals("1"))) {
|
|
|
log.info("任务未取货,不能直接完成!" + taskNo);
|
|
|
- return;
|
|
|
+ return AjaxResult.error("任务未取货,不能直接完成!" + taskNo);
|
|
|
}
|
|
|
if (wcsTask.getState() == 2) {
|
|
|
log.info("不能重复放货," + taskNo);
|
|
|
- return;
|
|
|
+ return AjaxResult.error("不能重复放货," + taskNo);
|
|
|
}
|
|
|
if (wcsTask.getState() == 6) {
|
|
|
- return;
|
|
|
+ return AjaxResult.error("不能重复放货," + taskNo);
|
|
|
}
|
|
|
wcsTask.setEndTime(new Date());
|
|
|
// 解锁终点库位
|
|
@@ -399,8 +400,14 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
|
|
|
case 4:
|
|
|
if (wcsTask.getState() == 4) {
|
|
|
log.info("不能重复取货," + taskNo);
|
|
|
- return;
|
|
|
+ return AjaxResult.error("不能重复取货," + taskNo);
|
|
|
}
|
|
|
+ if (wcsTask.getBeforeTask() != null && wcsTask.getBeforeTask().equals("1")) {
|
|
|
+ log.info("不能重复取货," + taskNo);
|
|
|
+ return AjaxResult.error("不能重复取货," + taskNo);
|
|
|
+ }
|
|
|
+ // 标记已经取货完成
|
|
|
+ wcsTask.setBeforeTask("1");
|
|
|
// 解锁起始库位
|
|
|
baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationFrom())
|
|
|
, Constant.WAREHOUSE_ID, updateBy);
|
|
@@ -415,16 +422,17 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
|
|
|
case 5:
|
|
|
break;
|
|
|
case 6://卸货
|
|
|
- if (wcsTask.getState() != 4 && wcsTask.getState() != 7) {
|
|
|
- log.info("任务未取货,不能直接完成!");
|
|
|
- return;
|
|
|
+ if (wcsTask.getState() != 4
|
|
|
+ && (StringUtils.isEmpty(wcsTask.getBeforeTask())|| !wcsTask.getBeforeTask().equals("1"))) {
|
|
|
+ log.info("任务未取货,不能直接完成!" + taskNo);
|
|
|
+ return AjaxResult.error("任务未取货,不能直接完成!" + taskNo);
|
|
|
}
|
|
|
- if (wcsTask.getState() == 6) {
|
|
|
+ if (wcsTask.getState() == 2) {
|
|
|
log.info("不能重复放货," + taskNo);
|
|
|
- return;
|
|
|
+ return AjaxResult.error("不能重复放货," + taskNo);
|
|
|
}
|
|
|
- if (wcsTask.getState() == 2) {
|
|
|
- return;
|
|
|
+ if (wcsTask.getState() == 6) {
|
|
|
+ return AjaxResult.error("不能重复放货," + taskNo);
|
|
|
}
|
|
|
wcsTask.setEndTime(new Date());
|
|
|
// 解锁终点库位
|
|
@@ -477,6 +485,7 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
|
|
|
wcsTask.setState(state.longValue());
|
|
|
wcsTask.setUpdateDate(new Date());
|
|
|
wcsTaskService.updateWcsTask(wcsTask);
|
|
|
+ return AjaxResult.error("操作成功!");
|
|
|
}
|
|
|
|
|
|
/**
|