删除任务上报apms删除生产单bug修改

This commit is contained in:
lgh 2022-07-09 10:17:50 +08:00
parent 40c4e20949
commit d8e4cb5bfa
2 changed files with 69 additions and 23 deletions

View File

@ -237,6 +237,7 @@ public class CurrTaskController extends BaseController {
//将返回的生产单号写入到主任务中
CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
currTaskById.setSheetNo(sheetNo);
currTaskById.setAutoExeTaskId(autoExeTask.getId());
currTaskService.updateCurrTaskById(currTaskById);
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
//return successful("创建成功,任务添加至等待执行队列。");

View File

@ -104,6 +104,9 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
BeanUtils.copyProperties(param, currTask);
currTask.setTaskType(TaskTypeEnum.WTK.getValue());
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
if (param.getAutoTaskType()==1){
currTask.setIsAuto(1);
}
//根据工艺号查询工艺id以及工艺plc值
CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper<CraftInfo>().eq(CraftInfo.CRAFT_CODE, param.getCraftCode()));
@ -151,34 +154,76 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
@Override
public R<String> deleteBySheetNo(String sheetNo) {
CurrTask byId = currTaskServiceBiz.getOne(new QueryWrapper<CurrTask>().eq(CurrTask.SHEET_NO, sheetNo));
//如果尚未执行状态 0
if (byId.getStatus() == 0)
{
//一个生产单可能对应多个currTask,删除的时候查询是否对应多个如果对应多个自动循环删除所有currTask,当删除最后一条currTask时上报apms
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.SHEET_NO, sheetNo));
if (currTaskList.size()>1){
int i=0;
for (CurrTask currTask:currTaskList
) {
i++;
if(currTask.getStatus()==0){
if (i==currTaskList.size()){
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
if (!apmsStartProcessR.getData().getSuccess()){
return failed(apmsStartProcessR.getData().getMsg());
}
}
Long currTaskId = currTask.getId();
if (currTask.getIsAuto()==1){
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
if (currTaskList2.size()==1){
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
}
}
currTaskServiceBiz.removeById(currTaskId);
currTaskDetService.deleteByCurrTaskId(currTaskId);
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
if (apmsStartProcessR.getData().getSuccess())
{
Long currTaskId = byId.getId();
currTaskServiceBiz.removeById(currTaskId);
currTaskDetService.deleteByCurrTaskId(currTaskId);
if (byId.getIsAuto()==1){
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, byId.getAutoExeTaskId()));
if (currTaskList.size()==0){
autoExeTaskServiceBiz.removeById(byId.getAutoExeTaskId());
}
if (currTask.getStatus()==2){
return failed("无法删除,任务已加工完成。");
}if (currTask.getStatus()==1){
return failed("无法删除,任务正在执行中。");
}
}
return successful(0,"APMS生产单删除成功。","");
}else {
for (CurrTask currTask:currTaskList
) {
if (currTask.getStatus()==0){
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
if (apmsStartProcessR.getData().getSuccess())
{
Long currTaskId = currTask.getId();
if (currTask.getIsAuto()==1){
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
if (currTaskList2.size()==1){
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
}
}
currTaskServiceBiz.removeById(currTaskId);
currTaskDetService.deleteByCurrTaskId(currTaskId);
if (currTask.getIsAuto()==1){
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
if (currTaskList2.size()==0){
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
}
}
return successful(0,"APMS生产单删除成功。","");
}
else
{
return failed(apmsStartProcessR.getData().getMsg());
}
}
return successful("APMS生产单删除成功。");
}
else
{
return failed(apmsStartProcessR.getData().getMsg());
if (currTask.getStatus()==2){
return failed("无法删除,任务已加工完成。");
}if (currTask.getStatus()==1){
return failed("无法删除,任务正在执行中。");
}
}
}
if (byId.getStatus()==2){
return failed("无法删除,任务已加工完成。");
}
return failed("无法删除,任务正在执行中。");
return failed("根据生产单号删除任务失败!");
}