diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWetMaterialPlanController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWetMaterialPlanController.java index 395b0241..786595a2 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWetMaterialPlanController.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWetMaterialPlanController.java @@ -181,7 +181,7 @@ public class ProWetMaterialPlanController extends BaseController { @Log(title = "湿料计划管理", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable String[] ids) { - return toAjax(proWetMaterialPlanService.deleteProWetMaterialPlanByIds(ids)); + return proWetMaterialPlanService.deleteProWetMaterialPlanByIds(ids); } // /** // * 提交湿料计划同步WCS diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanDetailMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanDetailMapper.java index 7834a1f1..a9aebfe6 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanDetailMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanDetailMapper.java @@ -116,4 +116,10 @@ public interface ProWetMaterialPlanDetailMapper { * @return */ ProWetMaterialPlanDetail selectProWetMaterialPlanDetailByOrderCode(String orderCode); + + /** + * 通过湿料主计划id删除湿料计划性情 + * @param id + */ + void deleteProWetMaterialPlanDetailByPlanId(String id); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/IProWetMaterialPlanService.java b/op-modules/op-plan/src/main/java/com/op/plan/service/IProWetMaterialPlanService.java index f99e2ea9..9b68483c 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/IProWetMaterialPlanService.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/IProWetMaterialPlanService.java @@ -54,7 +54,7 @@ public interface IProWetMaterialPlanService { * @param ids 需要删除的湿料计划管理主键集合 * @return 结果 */ - public int deleteProWetMaterialPlanByIds(String[] ids); + public AjaxResult deleteProWetMaterialPlanByIds(String[] ids); /** * 删除湿料计划管理信息 diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWetMaterialPlanServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWetMaterialPlanServiceImpl.java index 8d7b9c5f..d96fb54d 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWetMaterialPlanServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWetMaterialPlanServiceImpl.java @@ -1,5 +1,6 @@ package com.op.plan.service.impl; +import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -112,8 +113,22 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService */ @Override @DS("#header.poolName") - public int deleteProWetMaterialPlanByIds(String[] ids) { - return proWetMaterialPlanMapper.deleteProWetMaterialPlanByIds(ids); + public AjaxResult deleteProWetMaterialPlanByIds(String[] ids) { + // 已下发计划不允许删除 + for (String id : ids) { + ProWetMaterialPlan plan = proWetMaterialPlanMapper.selectProWetMaterialPlanById(id); + if (plan.getSyncFlag().equals("Y")){ + SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd"); + return error("日期为"+formatDate.format(plan.getPlanTime())+"的计划已下发,不允许删除!"); + } + } + for (String id : ids) { + // 删除主计划 + proWetMaterialPlanMapper.deleteProWetMaterialPlanById(id); + // 删除计划详情 + proWetMaterialPlanDetailMapper.deleteProWetMaterialPlanDetailByPlanId(id); + } + return success(); } /** diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanDetailMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanDetailMapper.xml index 9b9cf85a..dde590f3 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanDetailMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanDetailMapper.xml @@ -234,4 +234,10 @@ set del_flag = '1' where workorder_id = #{workorderId} + + + update pro_wet_material_plan_detail + set del_flag = '1' + where wet_material_plan_id = #{id} +