From a27eea4e50aad8c7aa03b970c6da9bce90f98c75 Mon Sep 17 00:00:00 2001 From: songguoqiang <765017469@qq.com> Date: Mon, 27 May 2024 13:58:17 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=98=E7=82=B9=E8=B0=83=E6=95=B4=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E5=A2=9E=E5=8A=A0=E5=88=A0=E9=99=A4=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CountadjustPlanServiceImpl.java | 62 ++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/countadjustPlan/CountadjustPlanServiceImpl.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/countadjustPlan/CountadjustPlanServiceImpl.java index 8db1f3e..61c922d 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/countadjustPlan/CountadjustPlanServiceImpl.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/countadjustPlan/CountadjustPlanServiceImpl.java @@ -8,12 +8,20 @@ import com.win.module.eam.controller.countadjustPlan.vo.CountadjustPlanExportReq import com.win.module.eam.controller.countadjustPlan.vo.CountadjustPlanPageReqVO; import com.win.module.eam.controller.countadjustPlan.vo.CountadjustPlanUpdateReqVO; import com.win.module.eam.convert.countadjustPlan.CountadjustPlanConvert; +import com.win.module.eam.dal.dataobject.adjustRecord.AdjustRecordDetailDO; +import com.win.module.eam.dal.dataobject.adjustRecord.AdjustRecordMainDO; import com.win.module.eam.dal.dataobject.countJobDetail.CountJobDetailDO; import com.win.module.eam.dal.dataobject.countJobMain.CountJobMainDO; +import com.win.module.eam.dal.dataobject.countRecord.CountRecordDetailDO; +import com.win.module.eam.dal.dataobject.countRecord.CountRecordMainDO; import com.win.module.eam.dal.dataobject.countadjustPlan.CountadjustPlanDO; import com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO; +import com.win.module.eam.dal.mysql.adjustRecord.AdjustRecordDetailMapper; +import com.win.module.eam.dal.mysql.adjustRecord.AdjustRecordMainMapper; import com.win.module.eam.dal.mysql.countJobMain.CountJobDetailMapper; import com.win.module.eam.dal.mysql.countJobMain.CountJobMainMapper; +import com.win.module.eam.dal.mysql.countRecord.CountRecordDetailMapper; +import com.win.module.eam.dal.mysql.countRecord.CountRecordMainMapper; import com.win.module.eam.dal.mysql.countadjustPlan.CountadjustPlanMapper; import com.win.module.eam.dal.mysql.itemaccounts.ItemAccountsMapper; import com.win.module.eam.enums.basic.BooleanTypeEnum; @@ -49,6 +57,17 @@ public class CountadjustPlanServiceImpl implements CountadjustPlanService { @Resource private SerialNumberApi serialNumberApi; + @Resource + private CountRecordMainMapper countRecordMainMapper; + @Resource + private CountRecordDetailMapper countRecordDetailMapper; + + @Resource + private AdjustRecordMainMapper adjustRecordMainMapper; + @Resource + private AdjustRecordDetailMapper adjustRecordDetailMapper; + + @Override @Transactional(rollbackFor = Exception.class) public Long createCountadjustPlan(CountadjustPlanCreateReqVO createReqVO) { @@ -94,9 +113,50 @@ public class CountadjustPlanServiceImpl implements CountadjustPlanService { } @Override + @Transactional public Integer deleteCountadjustPlan(Long id) { // 校验存在 - validateCountadjustPlanExists(id); + CountadjustPlanDO countadjustPlanDO = countadjustPlanMapper.selectById(id); + if (countadjustPlanDO == null) { + throw exception(COUNTADJUST_PLAN_NOT_EXISTS); + } + QueryWrapper jobMainDO = new QueryWrapper<>(); + jobMainDO.eq("number",countadjustPlanDO.getNumber()); + CountJobMainDO countJobMainDO = countJobMainMapper.selectOne(jobMainDO);//盘点工单主 + if(countJobMainDO!=null){//有关联删除 + countJobMainMapper.deleteById(countJobMainDO.getId());//删除关联工单 + QueryWrapper jobDetailsDO = new QueryWrapper<>(); + jobDetailsDO.eq("master_id",countJobMainDO.getId()); + List countJobDetailDOS = countJobDetailMapper.selectList(jobDetailsDO);//盘点工单子 + for(CountJobDetailDO en:countJobDetailDOS){//删除工单子表 + countJobDetailMapper.deleteById(en.getId()); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("job_number",countJobMainDO.getNumber()); + CountRecordMainDO countRecordMainDO = countRecordMainMapper.selectOne(queryWrapper);//盘点记录主 + if(countRecordMainDO!=null){//盘点记录 + countRecordMainMapper.deleteById(countRecordMainDO.getId()); + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("master_id",countJobMainDO.getId()); + List countRecordDetailDOS = countRecordDetailMapper.selectList(queryWrapper1);//盘点记录子 + for(CountRecordDetailDO en:countRecordDetailDOS){ + countRecordDetailMapper.deleteById(en.getId()); + } + } + QueryWrapper queryAdjustMain = new QueryWrapper<>(); + queryAdjustMain.eq("plan_number",countadjustPlanDO.getNumber()); + AdjustRecordMainDO adjustRecordMainDO = adjustRecordMainMapper.selectOne(queryAdjustMain);//盘点调整记录主 + if(adjustRecordMainDO!=null){ + adjustRecordMainMapper.deleteById(adjustRecordMainDO.getId()); + QueryWrapper queryAdjustDetails = new QueryWrapper<>(); + queryAdjustDetails.eq("master_id",adjustRecordMainDO.getId()); + List adjustRecordDetailDOS = adjustRecordDetailMapper.selectList(queryAdjustDetails);//盘点调整记录子 + for(AdjustRecordDetailDO en:adjustRecordDetailDOS){ + adjustRecordDetailMapper.deleteById(en.getId()); + } + } + + } // 删除 return countadjustPlanMapper.deleteById(id); }