diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java index 3b5e235..84e4467 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java @@ -278,6 +278,12 @@ public class CurrTaskController extends BaseController { public R deleteBySheetNo(@Validated @RequestBody CurrTaskQueryParam param) { return currTaskService.deleteBySheetNo(param.getSheetNo()); } + + @PostMapping(value = "deleteById") + @ApiOperation(value = "人工id删除未正式开始的生产单") + public R deleteById(@Validated @RequestBody IdParam param) { + return currTaskService.deleteById(param); + } @PostMapping(value = "runTask") @ApiOperation(value = "执行任务") public R runTask(@Validated @RequestBody IdParam param) throws InterruptedException, IOException { diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java index b632b5d..d4d39a8 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java @@ -84,7 +84,7 @@ public interface CurrTaskService { * @param * @return 结果 */ - R deleteBySheetNo(IdParam idParam); + R deleteById(IdParam idParam); /** * 首页 获取当前执行的任务 diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java index ad18925..ad484a9 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java @@ -80,6 +80,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService KilnInfoServiceBiz kilnInfoServiceBiz; @Autowired LocationServiceBiz locationServiceBiz; + @Autowired + CurrTaskDetServiceBiz currTaskDetServiceBiz; @Override public CurrTaskVo getCurrTask(IdParam idParam) { @@ -230,8 +232,25 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService } @Override - public R deleteBySheetNo(IdParam idParam) { - return null; + public R deleteById(IdParam idParam) { + CurrTask currTask = currTaskServiceBiz.getById(idParam.getId()); + if (currTask.getIsAuto()==1){ + List currTaskList = currTaskServiceBiz.list(new QueryWrapper().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId())); + for (CurrTask currTask1:currTaskList + ) { + if (currTask1.getStatus()!=0){ + return R.failed("该自动任务已有步骤在执行中或执行完成,不能删除!"); + } + } + //能删除 + autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId()); + for (CurrTask currTask1:currTaskList + ) { + currTaskDetServiceBiz.remove(new QueryWrapper().eq(CurrTaskDet.CURR_TASK_ID,currTask1.getId())); + } + } + currTaskServiceBiz.removeById(idParam); + return R.ok(idParam.getId().toString()); } @Override