From 82e8a6db4ab0f4d3f3828b3b47667012e6f30758 Mon Sep 17 00:00:00 2001 From: "liang.chao" Date: Wed, 24 Apr 2024 14:05:18 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E6=96=99=E5=AE=A1=E6=A0=B8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/controller/BackReceiveController.java | 2 +- .../bonus/sgzb/app/domain/BackApplyInfo.java | 1 + .../sgzb/app/mapper/BackReceiveMapper.java | 2 ++ .../app/mapper/LeaseOutDetailsMapper.java | 2 ++ .../sgzb/app/service/BackReceiveService.java | 2 ++ .../service/impl/BackReceiveServiceImpl.java | 32 +++++++++++++++---- .../impl/LeaseOutDetailsServiceImpl.java | 18 ++++++++--- .../mapper/app/BackReceiveMapper.xml | 26 +++++++++++++++ .../mapper/app/LeaseOutDetailsMapper.xml | 7 ++-- .../material/PurchaseCheckInfoMapper.xml | 4 +-- 10 files changed, 80 insertions(+), 16 deletions(-) diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackReceiveController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackReceiveController.java index 01851002..30394be8 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackReceiveController.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackReceiveController.java @@ -278,7 +278,7 @@ public class BackReceiveController extends BaseController { @PostMapping("backReceiveRecordWeb") public AjaxResult backReceiveRecordWeb(@RequestBody BackApplyInfo record) { try { - List list = backReceiveService.backReceiveRecord(record); + List list = backReceiveService.backReceiveRecordWeb(record); Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); return AjaxResult.success(ListPagingUtil.paging(pageIndex,pageSize, list)); diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/BackApplyInfo.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/BackApplyInfo.java index 4ee721dc..3c108b28 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/BackApplyInfo.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/BackApplyInfo.java @@ -21,6 +21,7 @@ public class BackApplyInfo { */ private String userName; private String badId; + private String[] typeIds; @Excel(name = "退料状态",sort = 9) private String taskName; diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BackReceiveMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BackReceiveMapper.java index a8d6b0e0..1254e837 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BackReceiveMapper.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BackReceiveMapper.java @@ -198,4 +198,6 @@ public interface BackReceiveMapper { int selectNumByTypeId(@Param("parentId")Integer parentId,@Param("typeId") String typeId); int selectTaskStatus(int taskId); + + BackApplyInfo backReceiveRecordWeb(BackApplyInfo record); } \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/LeaseOutDetailsMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/LeaseOutDetailsMapper.java index 47b392e5..89e7e4dc 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/LeaseOutDetailsMapper.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/LeaseOutDetailsMapper.java @@ -99,4 +99,6 @@ public interface LeaseOutDetailsMapper { MachinePart getMachineParts(TmTask typeId); int updateMaTypeStockNumCt(TmTask record); + + int getmaChineByCt(LeaseOutDetails record); } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BackReceiveService.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BackReceiveService.java index 10e057b7..634fc3c9 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BackReceiveService.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BackReceiveService.java @@ -95,4 +95,6 @@ public interface BackReceiveService { List getRecord(TmTask task); int revoke(BackApplyInfo record); + + List backReceiveRecordWeb(BackApplyInfo record); } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java index a04958fd..94058fd7 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java @@ -83,10 +83,6 @@ public class BackReceiveServiceImpl implements BackReceiveService { if (res == 0) { throw new RuntimeException("插入back_check_details异常"); } - /* int insSltInfoNum = insSltInfo(lTask.getAgreementId().toString(), leaseOutDetail); - if (insSltInfoNum < 1) { - return res; - }*/ } catch (Exception e) { throw new RuntimeException(e.getMessage()); } @@ -115,7 +111,7 @@ public class BackReceiveServiceImpl implements BackReceiveService { break; } //根据maId和taskId查询是否已接收 - re = backReceiveMapper.selectCodeByMaIdAndTaskId(arr[i].getMaId(), record.getTaskId()); + re = backReceiveMapper.selectCodeByMaIdAndTaskId(arr[i].getMaId(), record.getTaskId()); if (re > 0) { res = -1; break; @@ -325,6 +321,21 @@ public class BackReceiveServiceImpl implements BackReceiveService { return res; } + @Override + public List backReceiveRecordWeb(BackApplyInfo record) { + String typeId = record.getTypeId(); + String[] split = typeId.split(","); + List backApplyInfoList = new ArrayList<>(); + for (String s : split) { + record.setTypeId(s); + BackApplyInfo backApplyInfo = backReceiveMapper.backReceiveRecordWeb(record); + if (backApplyInfo != null) { + backApplyInfoList.add(backApplyInfo); + } + } + return backApplyInfoList; + } + private int insertRad(int taskId, List wxList) { int result = 0; if (wxList != null) { @@ -452,8 +463,17 @@ public class BackReceiveServiceImpl implements BackReceiveService { //机具状态变为在用 backReceiveMapper.updateMaStatus(s, "16"); } + res = backReceiveMapper.deleteCheckDetails(record); + } else if ("2".equals(manageType)) { + String[] split = record.getTypeIds(); + for (String s : split) { + record.setTypeId(s); + res = backReceiveMapper.deleteCheckDetails(record); + } + } else { + res = backReceiveMapper.deleteCheckDetails(record); } - res = backReceiveMapper.deleteCheckDetails(record); + } return res; diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java index 66052870..e8182fdb 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java @@ -158,7 +158,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { if ((record.getManageType() == 1 || record.getManageType() == 2) && record.getInputNum() != null) { record.setOutNum(record.getInputNum().doubleValue()); } - //2、判断库存是否足够 + //2、判断成套机具出库库存是否足够 if (record.getManageType() == 2) { res = checkStorageNumCt(record); if (res == 0) { @@ -206,8 +206,10 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { // 插入领料出库明细表(lease_out_details) res = leaseOutDetailsMapper.insertSelective(record); if (res > 0) { - if (record.getManageType() == 2){ + if (record.getManageType() == 2) { // 成套机具减少 (ma_type 设备规格表)的库存数量 + res = leaseOutDetailsMapper.updateMaTypeStockNum(record); + // 成套机具减少 (ma_type 设备规格表)配件的库存数量 List typeIds = leaseOutDetailsMapper.getMaTypeDetails(record); typeIds.removeIf(item -> item == null); for (TmTask typeId : typeIds) { @@ -216,7 +218,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { typeId.setNum(machinePart.getNum() - machinePart.getPartNum()); res = leaseOutDetailsMapper.updateMaTypeStockNumCt(typeId); } - }else { + } else { // 普通机具减少 (ma_type 设备规格表)的库存数量 res = leaseOutDetailsMapper.updateMaTypeStockNum(record); } @@ -268,14 +270,20 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { } private int checkStorageNumCt(LeaseOutDetails record) { + int res = 0; double outNum = 0.1; if (StringUtils.isNull(record)) { - return 0; + return res; } if (record.getOutNum() == null || record.getOutNum() < outNum) { record.setOutNum(0.00); } + //先判断成套机具的库存是否足够 + int num = leaseOutDetailsMapper.getmaChineByCt(record); + if (num < record.getOutNum()) { + return res; + } //判断(ma_type 设备规格表)中的库存够不够出库的 List typeIds = leaseOutDetailsMapper.getMaTypeDetails(record); typeIds.removeIf(item -> item == null); @@ -283,7 +291,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId); machinePart.setPartNum((int) (typeId.getPartNum() * record.getOutNum())); if (machinePart.getNum() < machinePart.getPartNum()) { - return 0; + return res; } } return 1; diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackReceiveMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackReceiveMapper.xml index 48ef85a8..62f1348a 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackReceiveMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackReceiveMapper.xml @@ -959,4 +959,30 @@ ) res HAVING backNum > -1 + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/LeaseOutDetailsMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/LeaseOutDetailsMapper.xml index c1f3214f..e476aa13 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/LeaseOutDetailsMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/LeaseOutDetailsMapper.xml @@ -303,7 +303,7 @@ UPDATE ma_type SET - num = num - #{num} ,update_time = NOW() + num = #{num} ,update_time = NOW() WHERE type_id = #{typeId} @@ -412,7 +412,7 @@ SELECT mt.type_name AS typeModelName, mt.unit_name as unitName, - mt.num as num, + ifnull(mt.num , 0) as num, m2.type_name As typeName FROM ma_type mt @@ -420,4 +420,7 @@ WHERE mt.type_id = #{typeId} + \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckInfoMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckInfoMapper.xml index 649bc681..ac6cffa5 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckInfoMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckInfoMapper.xml @@ -330,8 +330,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt.type_id = #{typeId} ) aa ON aa.type_id = mt2.type_id - WHERE mt2.type_name like concat('%', #{keyWord}, '%') + WHERE (mt2.type_name like concat('%', #{keyWord}, '%') + or mt3.type_name like concat('%', #{keyWord}, '%')) - \ No newline at end of file