|
@@ -177,6 +177,14 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService |
|
|
nowStep=currTask.getLocationName(); |
|
|
nowStep=currTask.getLocationName(); |
|
|
} |
|
|
} |
|
|
allStep=allStep.concat("->").concat(currTask1.getTargetPosition()); |
|
|
allStep=allStep.concat("->").concat(currTask1.getTargetPosition()); |
|
|
|
|
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask1.getId())); |
|
|
|
|
|
if (inStockInfo!=null){ |
|
|
|
|
|
List<InStockInfoVo> inStockInfoVoList=new ArrayList<>(); |
|
|
|
|
|
InStockInfoVo inStockInfoVo=InStockInfoVo.builder().build(); |
|
|
|
|
|
BeanUtils.copyProperties(inStockInfo,inStockInfoVo); |
|
|
|
|
|
inStockInfoVoList.add(inStockInfoVo); |
|
|
|
|
|
currTaskInfoVo.setInStockInfoVoList(inStockInfoVoList); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
// |
|
|
// |
|
|
currTaskInfoVo.setAllStep(allStep); |
|
|
currTaskInfoVo.setAllStep(allStep); |
|
@@ -190,6 +198,14 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService |
|
|
currTaskInfoVo.setNowStep(currTask.getLocationName()); |
|
|
currTaskInfoVo.setNowStep(currTask.getLocationName()); |
|
|
} |
|
|
} |
|
|
currTaskInfoVo.setAutoExeTaskId(currTask.getId()); |
|
|
currTaskInfoVo.setAutoExeTaskId(currTask.getId()); |
|
|
|
|
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId())); |
|
|
|
|
|
if (inStockInfo!=null){ |
|
|
|
|
|
List<InStockInfoVo> inStockInfoVoList=new ArrayList<>(); |
|
|
|
|
|
InStockInfoVo inStockInfoVo=InStockInfoVo.builder().build(); |
|
|
|
|
|
BeanUtils.copyProperties(inStockInfo,inStockInfoVo); |
|
|
|
|
|
inStockInfoVoList.add(inStockInfoVo); |
|
|
|
|
|
currTaskInfoVo.setInStockInfoVoList(inStockInfoVoList); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
//currTaskDet |
|
|
//currTaskDet |
|
|
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId())); |
|
|
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId())); |
|
@@ -205,75 +221,125 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService |
|
|
public R<String> updateCurrTaskStatus(CurrTaskParam param) { |
|
|
public R<String> updateCurrTaskStatus(CurrTaskParam param) { |
|
|
CurrTask currTask = currTaskServiceBiz.getById(param.getId()); |
|
|
CurrTask currTask = currTaskServiceBiz.getById(param.getId()); |
|
|
Integer status = param.getStatus(); |
|
|
Integer status = param.getStatus(); |
|
|
//修改为加工中,多步骤任务修改为加工中,查询缓存区,查询前置任务状态,并修改 |
|
|
|
|
|
if (status==1){ |
|
|
|
|
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId())); |
|
|
|
|
|
if (inStockInfo!=null){ |
|
|
|
|
|
//更新库位状态为未占用 |
|
|
|
|
|
Location location = locationServiceBiz.getById(inStockInfo.getLocationId()); |
|
|
|
|
|
location.setStatus(0); |
|
|
|
|
|
locationServiceBiz.updateById(location); |
|
|
|
|
|
//删除库位缓存 |
|
|
|
|
|
inStockInfoServiceBiz.removeById(inStockInfo); |
|
|
|
|
|
} |
|
|
|
|
|
if (currTask.getIsAuto()==1){ |
|
|
|
|
|
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId()); |
|
|
|
|
|
if (currTask.getId().equals(autoExeTask.getFTaskId())){ |
|
|
|
|
|
//该任务为自动任务第一条,是否有sheetNo,若无上报apms |
|
|
|
|
|
if (currTask.getSheetNo()==null){ |
|
|
|
|
|
try { |
|
|
|
|
|
apmsCreateProcess(currTask); |
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
|
Long kilnId = param.getKilnId(); |
|
|
|
|
|
//修改任务状态 |
|
|
|
|
|
if(!status.equals(currTask.getStatus())){ |
|
|
|
|
|
//修改为加工中,多步骤任务修改为加工中,查询缓存区,查询前置任务状态,并修改 |
|
|
|
|
|
if (status==1){ |
|
|
|
|
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId())); |
|
|
|
|
|
if (inStockInfo!=null){ |
|
|
|
|
|
//更新库位状态为未占用 |
|
|
|
|
|
Location location = locationServiceBiz.getById(inStockInfo.getLocationId()); |
|
|
|
|
|
location.setStatus(0); |
|
|
|
|
|
locationServiceBiz.updateById(location); |
|
|
|
|
|
//删除库位缓存 |
|
|
|
|
|
inStockInfoServiceBiz.removeById(inStockInfo); |
|
|
|
|
|
} |
|
|
|
|
|
if (currTask.getIsAuto()==1){ |
|
|
|
|
|
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId()); |
|
|
|
|
|
if (currTask.getId().equals(autoExeTask.getFTaskId())){ |
|
|
|
|
|
//该任务为自动任务第一条,是否有sheetNo,若无上报apms |
|
|
|
|
|
if (currTask.getSheetNo()==null){ |
|
|
|
|
|
try { |
|
|
|
|
|
apmsCreateProcess(currTask); |
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
if (currTask.getId().equals(autoExeTask.getTTaskId())){ |
|
|
|
|
|
//该任务为自动任务第二条,修改自动任务第一条的状态 |
|
|
|
|
|
CurrTask currTask1 = currTaskServiceBiz.getById(autoExeTask.getFTaskId()); |
|
|
|
|
|
currTask1.setStatus(2); |
|
|
|
|
|
currTask1.setIsIn(2); |
|
|
|
|
|
//99代表该条记录手动修改过 |
|
|
|
|
|
currTask1.setUpdaterId(99); |
|
|
|
|
|
currTask1.setUpdateTime(LocalDateTime.now()); |
|
|
|
|
|
currTaskServiceBiz.updateById(currTask1); |
|
|
|
|
|
}else if (currTask.getId().equals(autoExeTask.getThTaskId())){ |
|
|
|
|
|
//该任务为自动任务第三条,修改自动任务第二条的状态 |
|
|
|
|
|
CurrTask currTask2 = currTaskServiceBiz.getById(autoExeTask.getFTaskId()); |
|
|
|
|
|
currTask2.setStatus(2); |
|
|
|
|
|
currTask2.setIsIn(2); |
|
|
|
|
|
//99代表该条记录手动修改过 |
|
|
|
|
|
currTask2.setUpdaterId(99); |
|
|
|
|
|
currTask2.setUpdateTime(LocalDateTime.now()); |
|
|
|
|
|
currTaskServiceBiz.updateById(currTask2); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
if (currTask.getId().equals(autoExeTask.getTTaskId())){ |
|
|
|
|
|
//该任务为自动任务第二条,修改自动任务第一条的状态 |
|
|
|
|
|
CurrTask currTask1 = currTaskServiceBiz.getById(autoExeTask.getFTaskId()); |
|
|
|
|
|
currTask1.setStatus(2); |
|
|
|
|
|
currTask1.setIsIn(2); |
|
|
|
|
|
//99代表该条记录手动修改过 |
|
|
|
|
|
currTask1.setCreatorId(99); |
|
|
|
|
|
currTaskServiceBiz.updateById(currTask1); |
|
|
|
|
|
}else if (currTask.getId().equals(autoExeTask.getThTaskId())){ |
|
|
|
|
|
//该任务为自动任务第三条,修改自动任务第二条的状态 |
|
|
|
|
|
CurrTask currTask2 = currTaskServiceBiz.getById(autoExeTask.getFTaskId()); |
|
|
|
|
|
currTask2.setStatus(2); |
|
|
|
|
|
currTask2.setIsIn(2); |
|
|
|
|
|
//99代表该条记录手动修改过 |
|
|
|
|
|
currTask2.setCreatorId(99); |
|
|
|
|
|
currTaskServiceBiz.updateById(currTask2); |
|
|
|
|
|
|
|
|
currTask.setStatus(1); |
|
|
|
|
|
currTask.setUpdaterId(99); |
|
|
|
|
|
currTask.setUpdateTime(LocalDateTime.now()); |
|
|
|
|
|
currTask.setBeginTime(LocalDateTime.now()); |
|
|
|
|
|
currTaskServiceBiz.updateById(currTask); |
|
|
|
|
|
logger.info("修改任务"+currTask.getId()+"状态为加工中成功"); |
|
|
|
|
|
} |
|
|
|
|
|
//修改为加工完成,查询缓存,并修改 |
|
|
|
|
|
if (status==2){ |
|
|
|
|
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId())); |
|
|
|
|
|
if (inStockInfo!=null){ |
|
|
|
|
|
//更新库位状态为未占用 |
|
|
|
|
|
Location location = locationServiceBiz.getById(inStockInfo.getLocationId()); |
|
|
|
|
|
location.setStatus(0); |
|
|
|
|
|
locationServiceBiz.updateById(location); |
|
|
|
|
|
//删除库位缓存 |
|
|
|
|
|
inStockInfoServiceBiz.removeById(inStockInfo); |
|
|
} |
|
|
} |
|
|
|
|
|
currTask.setStatus(1); |
|
|
|
|
|
currTask.setCreatorId(99); |
|
|
|
|
|
currTask.setBeginTime(LocalDateTime.now()); |
|
|
|
|
|
currTaskServiceBiz.updateById(currTask); |
|
|
|
|
|
logger.info("修改任务"+currTask.getId()+"状态为加工完成成功"); |
|
|
} |
|
|
} |
|
|
currTask.setStatus(1); |
|
|
|
|
|
|
|
|
currTask.setStatus(status); |
|
|
currTask.setCreatorId(99); |
|
|
currTask.setCreatorId(99); |
|
|
currTask.setBeginTime(LocalDateTime.now()); |
|
|
currTask.setBeginTime(LocalDateTime.now()); |
|
|
currTaskServiceBiz.updateById(currTask); |
|
|
currTaskServiceBiz.updateById(currTask); |
|
|
return successful("修改任务状态为加工中成功"); |
|
|
|
|
|
|
|
|
logger.info("修改任务"+currTask.getId()+"状态为未加工成功"); |
|
|
} |
|
|
} |
|
|
//修改为加工完成,查询缓存,并修改 |
|
|
|
|
|
if (status==2){ |
|
|
|
|
|
|
|
|
//修改目标加工炉 |
|
|
|
|
|
if (!kilnId.equals(currTask.getKilnId())){ |
|
|
|
|
|
KilnInfo kiln = kilnInfoServiceBiz.getById(kilnId); |
|
|
|
|
|
//修改目标加工炉,修改终点 |
|
|
|
|
|
currTask.setKilnId(kilnId); |
|
|
|
|
|
currTask.setTargetPosition(kiln.getCode()); |
|
|
|
|
|
currTask.setUpdaterId(99); |
|
|
|
|
|
currTask.setUpdateTime(LocalDateTime.now()); |
|
|
|
|
|
currTaskServiceBiz.updateById(currTask); |
|
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId())); |
|
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId())); |
|
|
|
|
|
//是否存在缓存 |
|
|
if (inStockInfo!=null){ |
|
|
if (inStockInfo!=null){ |
|
|
//更新库位状态为未占用 |
|
|
|
|
|
Location location = locationServiceBiz.getById(inStockInfo.getLocationId()); |
|
|
|
|
|
location.setStatus(0); |
|
|
|
|
|
locationServiceBiz.updateById(location); |
|
|
|
|
|
//删除库位缓存 |
|
|
|
|
|
inStockInfoServiceBiz.removeById(inStockInfo); |
|
|
|
|
|
|
|
|
//修改缓存后目标加工炉 |
|
|
|
|
|
inStockInfo.setKilnId(kilnId); |
|
|
|
|
|
inStockInfo.setKilnName(kiln.getKilnName()); |
|
|
|
|
|
inStockInfo.setUpdaterId(99); |
|
|
|
|
|
inStockInfo.setUpdateTime(LocalDateTime.now()); |
|
|
|
|
|
inStockInfoServiceBiz.updateById(inStockInfo); |
|
|
|
|
|
} |
|
|
|
|
|
//任务为多步骤任务 |
|
|
|
|
|
if (currTask.getIsAuto()==1){ |
|
|
|
|
|
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId()); |
|
|
|
|
|
//任务为多步骤任务第一步 |
|
|
|
|
|
if (currTask.getId().equals(autoExeTask.getFTaskId())){ |
|
|
|
|
|
//修改多步骤第二步的起点 |
|
|
|
|
|
CurrTask currTask2 = currTaskServiceBiz.getById(autoExeTask.getTTaskId()); |
|
|
|
|
|
currTask2.setStartPosition(kiln.getCode()); |
|
|
|
|
|
currTask2.setUpdateTime(LocalDateTime.now()); |
|
|
|
|
|
currTask2.setUpdaterId(99); |
|
|
|
|
|
currTaskServiceBiz.updateById(currTask2); |
|
|
|
|
|
}else if (currTask.getId().equals(autoExeTask.getTTaskId())){ |
|
|
|
|
|
//任务为多步骤任务第二步且有第三步,修改第三步起点 |
|
|
|
|
|
if (autoExeTask.getProcessFlowType()==2){ |
|
|
|
|
|
CurrTask currTask3 = currTaskServiceBiz.getById(autoExeTask.getThTaskId()); |
|
|
|
|
|
currTask3.setStartPosition(kiln.getCode()); |
|
|
|
|
|
currTask3.setUpdateTime(LocalDateTime.now()); |
|
|
|
|
|
currTask3.setUpdaterId(99); |
|
|
|
|
|
currTaskServiceBiz.updateById(currTask3); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
currTask.setStatus(1); |
|
|
|
|
|
currTask.setCreatorId(99); |
|
|
|
|
|
currTask.setBeginTime(LocalDateTime.now()); |
|
|
|
|
|
currTaskServiceBiz.updateById(currTask); |
|
|
|
|
|
return successful("修改任务状态为加工完成成功"); |
|
|
|
|
|
} |
|
|
} |
|
|
currTask.setStatus(status); |
|
|
|
|
|
currTask.setCreatorId(99); |
|
|
|
|
|
currTask.setBeginTime(LocalDateTime.now()); |
|
|
|
|
|
currTaskServiceBiz.updateById(currTask); |
|
|
|
|
|
return successful("修改任务状态为未加工成功"); |
|
|
|
|
|
|
|
|
return successful("操作成功!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|