From 6c696606a420be0b99f820807045b2f21b05266e Mon Sep 17 00:00:00 2001
From: rentaiming <806181062@qq.com>
Date: 星期日, 21 七月 2024 15:38:36 +0800
Subject: [PATCH] 森林防火 供应商管理

---
 ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/InventoriesSuppliesInfoServiceImpl.java |   30 +++++++++++++++++++++++-------
 1 files changed, 23 insertions(+), 7 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..47f122c 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
@@ -10,6 +10,7 @@
 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.ManagementGoodsMaterialsMapper;
 import com.ruoyi.management.mapper.SlGoodsMaterialsMapper;
 import com.ruoyi.management.mapper.SlVolumeProductionRkMapper;
 import com.ruoyi.management.service.InventoriesSuppliesInfoService;
@@ -38,12 +39,15 @@
 
     @Resource
     private SlGoodsMaterialsMapper slGoodsMaterialsMapper;
+
+    @Resource
+    private ManagementGoodsMaterialsMapper managementGoodsMaterialsMapper;
     @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,6 +58,7 @@
             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());
@@ -64,7 +69,7 @@
 
     @Override
     public void addInventoriesSuppliesInfo(InventoriesSuppliesInfoDTO inventoriesSuppliesInfoDTO) {
-        if (inventoriesSuppliesInfoDTO.getId()==0){
+        if (inventoriesSuppliesInfoDTO.getId()==null){
             InventoriesSuppliesInfo inventoriesSuppliesInf=new InventoriesSuppliesInfo();
             inventoriesSuppliesInf.setSuppliesId(inventoriesSuppliesInfoDTO.getSuppliesId());
             inventoriesSuppliesInf.setRkId(inventoriesSuppliesInfoDTO.getRkId());
@@ -83,8 +88,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 +98,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 +113,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