From 87e07ac8b8f1868eb4302fac73dfc93c5417f977 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期二, 30 七月 2024 11:06:14 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/ForestFirePrevention

---
 ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/InventoriesSuppliesInfoServiceImpl.java |   54 +++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/InventoriesSuppliesInfoServiceImpl.java b/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/InventoriesSuppliesInfoServiceImpl.java
index b4a13d0..a3ae1be 100644
--- a/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/InventoriesSuppliesInfoServiceImpl.java
+++ b/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/InventoriesSuppliesInfoServiceImpl.java
@@ -9,9 +9,7 @@
 import com.ruoyi.management.domain.dto.InventoriesSuppliesInfoQuery;
 import com.ruoyi.management.domain.vo.InventoriesSuppliesInfoVO;
 import com.ruoyi.management.domain.vo.InventoriesSuppliesVO;
-import com.ruoyi.management.mapper.InventoriesSuppliesInfoMapper;
-import com.ruoyi.management.mapper.SlGoodsMaterialsMapper;
-import com.ruoyi.management.mapper.SlVolumeProductionRkMapper;
+import com.ruoyi.management.mapper.*;
 import com.ruoyi.management.service.InventoriesSuppliesInfoService;
 import org.springframework.stereotype.Service;
 
@@ -38,12 +36,18 @@
 
     @Resource
     private SlGoodsMaterialsMapper slGoodsMaterialsMapper;
+
+    @Resource
+    private ManagementGoodsMaterialsMapper managementGoodsMaterialsMapper;
+
+    @Resource
+    private SlGoodsShelfMapper slGoodsShelfMapper;
     @Override
     public PageDTO<InventoriesSuppliesInfoVO> inventoriesSuppliesInfoService(InventoriesSuppliesInfoQuery inventoriesSuppliesInfoQuery) {
 
         Page<InventoriesSuppliesInfo> page = new Page<>(inventoriesSuppliesInfoQuery.getPageCurr(), inventoriesSuppliesInfoQuery.getPageSize());
         LambdaQueryWrapper< InventoriesSuppliesInfo> wrapper1= Wrappers.lambdaQuery();
-        wrapper1.gt(InventoriesSuppliesInfo::getSuppliesId, inventoriesSuppliesInfoQuery.getSuppliesId());
+        wrapper1.eq(InventoriesSuppliesInfo::getSuppliesId, inventoriesSuppliesInfoQuery.getSuppliesId());
         wrapper1.eq( InventoriesSuppliesInfo::getDelFlag,0);
         wrapper1.orderByDesc(InventoriesSuppliesInfo::getCreateTime);
         wrapper1.orderByDesc(InventoriesSuppliesInfo::getType);
@@ -54,27 +58,32 @@
             SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(sl.getRkId());
             sl.setRkNumber(slVolumeProductionRk.getRkNumber());
             sl.setRkModel(slVolumeProductionRk.getRkModel());
+            sl.setZkNum(slVolumeProductionRk.getRepertoryZhai());
             SlGoodsMaterials slGoodsMaterials = slGoodsMaterialsMapper.selectById(slVolumeProductionRk.getMaterialsId());
             sl.setGoodsMaterialsName(slGoodsMaterials.getGoodsMaterialsName());
             sl.setIsConsume(slGoodsMaterials.getIsConsume());
+            sl.setStoreManagementNumber(slVolumeProductionRk.getStoreManagementNumber());
+            SlGoodsShelf slGoodsShelf = slGoodsShelfMapper.selectById(slVolumeProductionRk.getShelfId());
+            sl.setGoodsShelfName(slGoodsShelf.getGoodsShelfName());
 
         }
         return slGoodsMaterialsVO;
     }
 
     @Override
-    public void addInventoriesSuppliesInfo(InventoriesSuppliesInfoDTO inventoriesSuppliesInfoDTO) {
-        if (inventoriesSuppliesInfoDTO.getId()==0){
+    public void addInventoriesSuppliesInfo(List<InventoriesSuppliesInfoDTO> inventoriesSuppliesInfoDTO) {
+        for (InventoriesSuppliesInfoDTO m:inventoriesSuppliesInfoDTO)
+        if (m.getId()==null){
             InventoriesSuppliesInfo inventoriesSuppliesInf=new InventoriesSuppliesInfo();
-            inventoriesSuppliesInf.setSuppliesId(inventoriesSuppliesInfoDTO.getSuppliesId());
-            inventoriesSuppliesInf.setRkId(inventoriesSuppliesInfoDTO.getRkId());
-            SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(inventoriesSuppliesInfoDTO.getRkId());
+            inventoriesSuppliesInf.setSuppliesId(m.getSuppliesId());
+            inventoriesSuppliesInf.setRkId(m.getRkId());
+            SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(m.getRkId());
             inventoriesSuppliesInf.setZkNum(slVolumeProductionRk.getRepertoryZhai());
-            inventoriesSuppliesInf.setSuppliesNum(inventoriesSuppliesInfoDTO.getSuppliesNum());
+            inventoriesSuppliesInf.setSuppliesNum(m.getSuppliesNum());
             this.save(inventoriesSuppliesInf);
         }else{
-            InventoriesSuppliesInfo byId = this.getById(inventoriesSuppliesInfoDTO.getId());
-            byId.setSuppliesNum(inventoriesSuppliesInfoDTO.getSuppliesNum());
+            InventoriesSuppliesInfo byId = this.getById(m.getId());
+            byId.setSuppliesNum(m.getSuppliesNum());
             this.updateById(byId);
 
         }
@@ -83,8 +92,8 @@
     @Override
     public InventoriesSuppliesInfo getInventoriesSuppliesInfo(InventoriesSuppliesInfoDTO inventoriesSuppliesInfoDTO) {
         LambdaQueryWrapper< InventoriesSuppliesInfo> wrapper1= Wrappers.lambdaQuery();
-        wrapper1.gt(InventoriesSuppliesInfo::getSuppliesId, inventoriesSuppliesInfoDTO.getSuppliesId());
-        wrapper1.gt(InventoriesSuppliesInfo::getRkId, inventoriesSuppliesInfoDTO.getSuppliesId());
+        wrapper1.eq(InventoriesSuppliesInfo::getSuppliesId, inventoriesSuppliesInfoDTO.getSuppliesId());
+        wrapper1.eq(InventoriesSuppliesInfo::getRkId, inventoriesSuppliesInfoDTO.getSuppliesId());
         wrapper1.eq( InventoriesSuppliesInfo::getDelFlag,0);
         InventoriesSuppliesInfo page2 = this.getOne(wrapper1);
         return page2;
@@ -93,7 +102,7 @@
     @Override
     public void submitInventoriesSuppliesInfo(InventoriesSuppliesInfoDTO inventoriesSuppliesInfoDTO) {
         LambdaQueryWrapper< InventoriesSuppliesInfo> wrapper1= Wrappers.lambdaQuery();
-        wrapper1.gt(InventoriesSuppliesInfo::getSuppliesId, inventoriesSuppliesInfoDTO.getSuppliesId());
+        wrapper1.eq(InventoriesSuppliesInfo::getSuppliesId, inventoriesSuppliesInfoDTO.getSuppliesId());
         wrapper1.eq( InventoriesSuppliesInfo::getDelFlag,0);
         List<InventoriesSuppliesInfo> page2 = this.list(wrapper1);
         for (InventoriesSuppliesInfo page:page2){
@@ -108,14 +117,25 @@
     public void accomplishInventoriesSuppliesInfo(InventoriesSuppliesInfoDTO inventoriesSuppliesInfoDTO) {
 
         LambdaQueryWrapper< InventoriesSuppliesInfo> wrapper1= Wrappers.lambdaQuery();
-        wrapper1.gt(InventoriesSuppliesInfo::getSuppliesId, inventoriesSuppliesInfoDTO.getSuppliesId());
-        wrapper1.gt(InventoriesSuppliesInfo::getType, 2);
+        wrapper1.eq(InventoriesSuppliesInfo::getSuppliesId, inventoriesSuppliesInfoDTO.getSuppliesId());
+        wrapper1.eq(InventoriesSuppliesInfo::getType, 2);
         wrapper1.eq( InventoriesSuppliesInfo::getDelFlag,0);
         List<InventoriesSuppliesInfo> page2 = this.list(wrapper1);
         for (InventoriesSuppliesInfo page:page2){
             SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(page.getRkId());
             slVolumeProductionRk.setRepertoryZhai(page.getSuppliesNum());
             slVolumeProductionRkMapper.updateById(slVolumeProductionRk);
+
+
+            LambdaQueryWrapper<ManagementGoodsMaterials> wrapper2 = Wrappers.lambdaQuery();
+            wrapper2.eq(ManagementGoodsMaterials::getGoodsMaterialsId,slVolumeProductionRk.getMaterialsId());
+            wrapper2.eq(ManagementGoodsMaterials::getManagementId,slVolumeProductionRk.getManagementId());
+            wrapper2.eq(ManagementGoodsMaterials::getDelFlag, 0);
+            ManagementGoodsMaterials managementGoodsMaterials = managementGoodsMaterialsMapper.selectOne(wrapper2);
+            if (managementGoodsMaterials!=null){
+                managementGoodsMaterials.setRepertoryZhai(page.getSuppliesNum());
+                managementGoodsMaterialsMapper.updateById(managementGoodsMaterials);
+            }
         }
 
     }

--
Gitblit v1.7.1