From b5ef65d0103a71dc7af2b9be6d2ac43aca5bb726 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期二, 27 八月 2024 08:59:57 +0800
Subject: [PATCH] 代码提交 bug解决

---
 ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionZyglServiceImpl.java |  399 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 397 insertions(+), 2 deletions(-)

diff --git a/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionZyglServiceImpl.java b/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionZyglServiceImpl.java
index 7f582f4..9da41b0 100644
--- a/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionZyglServiceImpl.java
+++ b/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionZyglServiceImpl.java
@@ -1,10 +1,30 @@
 package com.ruoyi.management.service.impl;
 
-import com.ruoyi.management.domain.SlVolumeProductionZygl;
-import com.ruoyi.management.mapper.SlVolumeProductionZyglMapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.utils.page.BeanUtils;
+import com.ruoyi.common.core.utils.page.PageDTO;
+import com.ruoyi.common.security.utils.SecurityUtils;
+import com.ruoyi.management.domain.*;
+import com.ruoyi.management.domain.dto.ManagementimgVolumeProductionZyQuery;
+import com.ruoyi.management.domain.dto.SlVolumeProductionZyDTO;
+import com.ruoyi.management.domain.dto.SlVolumeProductionZyQuery;
+import com.ruoyi.management.domain.vo.*;
+import com.ruoyi.management.mapper.*;
 import com.ruoyi.management.service.SlVolumeProductionZyglService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.system.api.domain.SysUser;
+import com.ruoyi.system.api.domain.getVolumeProductionRkQuery;
+import com.ruoyi.system.api.feignClient.SysUserClient;
+import com.sun.org.apache.bcel.internal.generic.NEW;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -16,5 +36,380 @@
  */
 @Service
 public class SlVolumeProductionZyglServiceImpl extends ServiceImpl<SlVolumeProductionZyglMapper, SlVolumeProductionZygl> implements SlVolumeProductionZyglService {
+    @Resource
+    private SysUserClient sysUserClient;
 
+    @Resource
+    private SlStoreManagementMapper slStoreManagementMapper;
+
+    @Resource
+    private SlVolumeProductionZyglMapper slVolumeProductionZyglMapper;
+
+    @Resource
+    private SlVolumeProductionRkMapper slVolumeProductionRkMapper;
+
+    @Resource
+    private SlGoodsMaterialsMapper slGoodsMaterialsMapper;
+
+    @Resource
+    private SlGoodsShelfMapper slGoodsShelfMapper;
+
+    @Resource
+    private SlVolumeProductionZyMapper slVolumeProductionZyMapper;
+
+    @Resource
+    private ManagementGoodsMaterialsMapper managementGoodsMaterialsMapper;
+
+    @Override
+    public PageDTO<VolumeProductionzZyglVO> getVolumeProductionzZyglList(SlVolumeProductionZyQuery slVolumeProductionZyQuery) {
+        Page<SlVolumeProductionZygl> page = new Page<>(slVolumeProductionZyQuery.getPageCurr(), slVolumeProductionZyQuery.getPageSize());
+        getVolumeProductionRkQuery getVolume=new getVolumeProductionRkQuery();
+        getVolume.setSupplierPhone(slVolumeProductionZyQuery.getSupplierPhone());
+        getVolume.setSupplierName(slVolumeProductionZyQuery.getSupplierName());
+        List<SysUser> data1 = sysUserClient.getUserSupplierList(getVolume).getData();
+        Set<Long> goodsSkuIdList = null;
+        goodsSkuIdList = data1.stream().map(SysUser::getUserId)
+                .collect(Collectors.toSet());
+        LambdaQueryWrapper< SlVolumeProductionZygl> wrapper1= Wrappers.lambdaQuery();
+        if (slVolumeProductionZyQuery.getPresentState()!=null){
+            wrapper1.eq(SlVolumeProductionZygl::getPresentState,slVolumeProductionZyQuery.getPresentState());
+        }
+        if (slVolumeProductionZyQuery.getAuditStatus()!=null){
+            wrapper1.eq(SlVolumeProductionZygl::getAuditStatus,slVolumeProductionZyQuery.getAuditStatus());
+
+        }
+        if (goodsSkuIdList.size()>0){
+            wrapper1.in(SlVolumeProductionZygl::getSysId,goodsSkuIdList);
+        }
+        wrapper1.eq( SlVolumeProductionZygl::getDelFlag,0);
+//        wrapper1.ne(SlVolumeProductionZygl::getAuditStatus,7);
+        wrapper1.orderByDesc(SlVolumeProductionZygl::getStartiTime);
+        Page<SlVolumeProductionZygl> page2 = this.page(page, wrapper1);
+
+        PageDTO<VolumeProductionzZyglVO> SlGoodsShelfDTO = PageDTO.of(page2, VolumeProductionzZyglVO .class);
+        List<VolumeProductionzZyglVO> list2 = SlGoodsShelfDTO.getList();
+        for(VolumeProductionzZyglVO list:list2){
+            SysUser data = sysUserClient.getSysUser(list.getSysId()).getData();
+            list.setNickName(data.getNickName());
+            list.setPhonenumber(data.getPhonenumber());
+            SlStoreManagement slStoreManagement = slStoreManagementMapper.selectById(list.getManagementId());
+            list.setStoreManagementName(slStoreManagement.getStoreManagementName());
+
+            SlStoreManagement bslStoreManagement = slStoreManagementMapper.selectById(list.getBmanagementId());
+            list.setBstoreManagementName(bslStoreManagement.getStoreManagementName());
+        }
+        return SlGoodsShelfDTO;
+    }
+
+    @Override
+    public String addsVolumeProductionzZygl(SlVolumeProductionZyDTO slVolumeProductionZyDTO) {
+                Long userid = SecurityUtils.getUserId();
+                if (slVolumeProductionZyDTO.getId()==null){
+                    SlVolumeProductionZygl slVolumeProductionZygl=new SlVolumeProductionZygl();
+                    slVolumeProductionZygl.setAttachmentUrl(slVolumeProductionZyDTO.getAttachmentUrl());
+                    slVolumeProductionZygl.setAuthorizationUrl(slVolumeProductionZyDTO.getAuthorization());
+                    slVolumeProductionZygl.setSource(slVolumeProductionZyDTO.getSource());
+                    slVolumeProductionZygl.setManagementId(slVolumeProductionZyDTO.getManagementId());
+                    slVolumeProductionZygl.setBmanagementId(slVolumeProductionZyDTO.getBmanagementId());
+                    slVolumeProductionZygl.setSysId(userid);
+                    slVolumeProductionZygl.setStartiTime(new Date());
+                    slVolumeProductionZygl.setAuditStatus(1);
+                    slVolumeProductionZygl.setPresentState(1);
+                    this.save(slVolumeProductionZygl);
+                    return slVolumeProductionZygl.getId().toString();
+                }else {
+                    SlVolumeProductionZygl byId = this.getById(slVolumeProductionZyDTO.getId());
+                    if (slVolumeProductionZyDTO.getSource()!=null){
+                        byId.setSource(slVolumeProductionZyDTO.getSource());
+                    }
+                    if (slVolumeProductionZyDTO.getAttachmentUrl()!=null){
+                        byId.setAttachmentUrl(slVolumeProductionZyDTO.getAttachmentUrl());
+                    }
+                    if (slVolumeProductionZyDTO.getAuthorization()!=null){
+                        byId.setAuthorizationUrl(slVolumeProductionZyDTO.getAuthorization());
+                    }
+                    this.updateById(byId);
+                    return slVolumeProductionZyDTO.getId().toString();
+                }
+
+    }
+
+    @Override
+    public VolumeProductionZyglInfoVO getVolumeProductionzZyglnfo(ManagementimgVolumeProductionZyQuery managementimgVolumeProductionZyQuery) {
+        SlVolumeProductionZygl byId = this.getById(managementimgVolumeProductionZyQuery.getVolumeProductionzyglId());
+        VolumeProductionZyglInfoVO v= BeanUtils.copyBean(byId, VolumeProductionZyglInfoVO.class);
+        SlStoreManagement slStoreManagement2 = slStoreManagementMapper.selectById(byId.getManagementId());
+        v.setZhuren(slStoreManagement2.getDirectorId());
+        v.setZhuguan(slStoreManagement2.getCompetentId());
+        v.setGuanliyuan(slStoreManagement2.getAdministratorId());
+        SlStoreManagement slStoreManagement = slStoreManagementMapper.selectById(byId.getManagementId());
+        v.setStoreManagementName(slStoreManagement.getStoreManagementName());
+        SlStoreManagement bslStoreManagement = slStoreManagementMapper.selectById(byId.getBmanagementId());
+        v.setBstoreManagementName(bslStoreManagement.getStoreManagementName());
+        SysUser data1 = sysUserClient.getSysUser(Long.valueOf(byId.getSysId())).getData();
+        v.setSysName(data1.getNickName());
+        v.setSysPhone(data1.getPhonenumber());
+        // 查询楼层数据
+        SlStoreManagement slStoreManagement1 = slStoreManagementMapper.selectById(byId.getBmanagementId());
+        List<String> number = new ArrayList<>();
+        for (Integer i = 1; i <= slStoreManagement1.getStoreManagementNumber(); i++) {
+            switch (i){
+                case 1:
+                    number.add("一层");
+                    break;
+                case 2:
+                    number.add("二层");
+                    break;
+                case 3:
+                    number.add("三层");
+                    break;
+            }
+        }
+        v.setNumber(number);
+        if (managementimgVolumeProductionZyQuery.getStoreManagementNumber()==null){
+            managementimgVolumeProductionZyQuery.setStoreManagementNumber(1);
+        }
+        QueryWrapper<SlGoodsShelf> eq = new QueryWrapper<SlGoodsShelf>()
+                .eq("del_flag", "0")
+                .eq("store_management_id", byId.getBmanagementId())
+                .eq("store_management_number",managementimgVolumeProductionZyQuery.getStoreManagementNumber());
+        List<SlGoodsShelf> slGoodsShelves = slGoodsShelfMapper.selectList(eq);
+        v.setGoodsShelfList(slGoodsShelves);
+        // 根据转移id 查询转移数据 收集入库ids
+        LambdaQueryWrapper<SlVolumeProductionZy> wrapper = Wrappers.lambdaQuery();
+        wrapper.eq(SlVolumeProductionZy::getZyglId, byId.getId());
+        wrapper.eq(SlVolumeProductionZy::getDelFlag, 0);
+        if (managementimgVolumeProductionZyQuery.getShelfId()==null){
+            if (!slGoodsShelves.isEmpty()){
+                wrapper.eq(SlVolumeProductionZy::getShelfId,slGoodsShelves.get(0).getId());
+            }
+        }else{
+            wrapper.eq(SlVolumeProductionZy::getShelfId,managementimgVolumeProductionZyQuery.getShelfId());
+        }
+        if (managementimgVolumeProductionZyQuery.getStoreManagementNumber()==null){
+            wrapper.eq(SlVolumeProductionZy::getStoreManagementNumber,1);
+        }else{
+            wrapper.eq(SlVolumeProductionZy::getStoreManagementNumber,managementimgVolumeProductionZyQuery.getStoreManagementNumber());
+        }
+        List<Long> collect = new ArrayList<>();
+
+        if (StringUtils.hasLength(byId.getAuthorizationUrl())){
+            collect = slVolumeProductionZyMapper.selectList(wrapper)
+                    .stream().map(SlVolumeProductionZy::getScrkId).collect(Collectors.toList());
+        }else{
+            collect = slVolumeProductionZyMapper.selectList(wrapper)
+                    .stream().map(SlVolumeProductionZy::getRkId).collect(Collectors.toList());
+        }
+        // 入库ids
+
+        if (collect.isEmpty()){
+            // 如果为空 那么插入-1 不查询数据
+            collect.add(-1L);
+        }
+        // 查询物资列表
+        LambdaQueryWrapper<SlVolumeProductionRk> wrapper2= Wrappers.lambdaQuery();
+        wrapper2.in(SlVolumeProductionRk::getId,collect);
+        wrapper2.eq( SlVolumeProductionRk::getDelFlag,0);
+        wrapper2.orderByDesc(SlVolumeProductionRk::getCreateTime);
+        List<SlVolumeProductionRk> page1 = slVolumeProductionRkMapper.selectList(wrapper2);
+
+        Set<Long> goodsSkuIdList = null;
+        goodsSkuIdList = page1.stream().map(SlVolumeProductionRk::getId)
+                .collect(Collectors.toSet());
+        Page<SlVolumeProductionZy> page = new Page<>(managementimgVolumeProductionZyQuery.getPageCurr(), managementimgVolumeProductionZyQuery.getPageSize());
+        LambdaQueryWrapper< SlVolumeProductionZy> wrapper1= Wrappers.lambdaQuery();
+        wrapper1.eq(SlVolumeProductionZy::getDelFlag,0);
+        wrapper1.eq(SlVolumeProductionZy::getZyglId,managementimgVolumeProductionZyQuery.getVolumeProductionzyglId());
+        if (managementimgVolumeProductionZyQuery.getShelfId()==null){
+            if (!slGoodsShelves.isEmpty()) {
+                wrapper1.eq(SlVolumeProductionZy::getShelfId, slGoodsShelves.get(0).getId());
+            }
+        }else{
+            wrapper1.eq(SlVolumeProductionZy::getShelfId,managementimgVolumeProductionZyQuery.getShelfId());
+        }
+        if (managementimgVolumeProductionZyQuery.getStoreManagementNumber()==null){
+            wrapper1.eq(SlVolumeProductionZy::getStoreManagementNumber,1);
+        }else{
+            wrapper1.eq(SlVolumeProductionZy::getStoreManagementNumber,managementimgVolumeProductionZyQuery.getStoreManagementNumber());
+        }
+
+        if (goodsSkuIdList.isEmpty()){
+            goodsSkuIdList.add(-1L);
+        }
+        // 已经确认了转移
+        if (StringUtils.hasLength(byId.getAuthorizationUrl())){
+            wrapper1.in(SlVolumeProductionZy::getScrkId,goodsSkuIdList);
+
+        }else{
+            wrapper1.in(SlVolumeProductionZy::getRkId,goodsSkuIdList);
+
+        }
+
+
+        wrapper1.eq( SlVolumeProductionZy::getDelFlag,0);
+        wrapper1.orderByDesc(SlVolumeProductionZy::getCreateTime);
+        Page<SlVolumeProductionZy> page2 = slVolumeProductionZyMapper.selectPage(page, wrapper1);
+        PageDTO<com.ruoyi.management.domain.dto.ManagementimgVolumeProductionZyVO> sl = PageDTO.of(page2, com.ruoyi.management.domain.dto.ManagementimgVolumeProductionZyVO.class);
+        List<com.ruoyi.management.domain.dto.ManagementimgVolumeProductionZyVO> list2 = sl.getList();
+        for(com.ruoyi.management.domain.dto.ManagementimgVolumeProductionZyVO list:list2) {
+            SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(list.getRkId());
+            list.setStoreManagementNumber(slVolumeProductionRk.getStoreManagementNumber());
+            list.setRkNumber(slVolumeProductionRk.getRkNumber());
+            list.setRepertoryZhai(slVolumeProductionRk.getRepertoryZhai());
+            SlGoodsMaterials slGoodsMaterials = slGoodsMaterialsMapper.selectById(slVolumeProductionRk.getMaterialsId());
+            list.setGoodsMaterialsName(slGoodsMaterials.getGoodsMaterialsName());
+            list.setIsConsume(slGoodsMaterials.getIsConsume());
+            SlGoodsShelf slGoodsShelf = slGoodsShelfMapper.selectById(list.getShelfId());
+            list.setGoodsShelfName(slGoodsShelf.getGoodsShelfName());
+            list.setShelfId(slGoodsShelf.getId());
+            if(list.getScrkId()!=null){
+                SlVolumeProductionRk slVolumeProductionRk1 = slVolumeProductionRkMapper.selectById(list.getScrkId());
+                list.setStoreManagementNumber(slVolumeProductionRk1.getStoreManagementNumber());
+                list.setZyNumber(slVolumeProductionRk1.getRkNumber());
+            }
+            list.setZkNum(list.getRepertoryZhai());
+        }
+        v.setList(sl);
+
+        return v;
+    }
+
+    @Override
+    public VolumeProductionZyglInventoryVO getVolumeProductionZyglnventory(String id) {
+        SlVolumeProductionZygl byId = this.getById(id);
+        VolumeProductionZyglInventoryVO vo = new VolumeProductionZyglInventoryVO();
+
+
+        SysUser data = sysUserClient.getSysUser(byId.getSysId()).getData();
+        vo.setSysPhone(data.getPhonenumber());
+        vo.setSysName(data.getNickName());
+        vo.setStartiTime(byId.getStartiTime());
+        SlStoreManagement slStoreManagement = slStoreManagementMapper.selectById(byId.getManagementId());
+        vo.setStoreManagementName(slStoreManagement.getStoreManagementName());
+        SlStoreManagement bslStoreManagement = slStoreManagementMapper.selectById(byId.getBmanagementId());
+        vo.setBstoreManagementName(bslStoreManagement.getStoreManagementName());
+        String directorId = slStoreManagement.getDirectorId();
+        List<String> stri = Arrays.asList(directorId.split(","));
+        String str1 = "";
+        if (stri.size() > 0) {
+            for (String str : stri) {
+                SysUser data1 = sysUserClient.getSysUser(Long.valueOf(str)).getData();
+                str1 += data1.getNickName() + ",";
+            }
+        }
+        vo.setDirectorName(str1.substring(0, str1.length() - 1));
+
+        String competentId = slStoreManagement.getCompetentId();
+        List<String> stri1 = Arrays.asList(competentId.split(","));
+        String str11 = "";
+        if (stri1.size() > 0) {
+            for (String str : stri1) {
+                SysUser data1 = sysUserClient.getSysUser(Long.valueOf(str)).getData();
+                str11 += data1.getNickName() + ",";
+            }
+        }
+        vo.setCompetentName(str11.substring(0, str11.length() - 1));
+
+        String administratorId = slStoreManagement.getAdministratorId();
+        List<String> stri11 = Arrays.asList(administratorId.split(","));
+        String str111 = "";
+        if (stri11.size() > 0) {
+            for (String str : stri11) {
+                SysUser data1 = sysUserClient.getSysUser(Long.valueOf(str)).getData();
+                str111 += data1.getNickName() + ",";
+            }
+        }
+        vo.setAdministratorName(str111.substring(0, str111.length() - 1));
+
+
+        LambdaQueryWrapper< SlVolumeProductionZy> wrapper2= Wrappers.lambdaQuery();
+        wrapper2.eq(SlVolumeProductionZy::getZyglId,id);
+        wrapper2.eq( SlVolumeProductionZy::getDelFlag,0);
+        wrapper2.orderByDesc(SlVolumeProductionZy::getCreateTime);
+        List<SlVolumeProductionZy> page2 = slVolumeProductionZyMapper.selectList(wrapper2);
+        List<ManagementimgVolumeProductionZyVO> SlGoodsShelfDTO=new ArrayList<>();
+        for(SlVolumeProductionZy list1:page2) {
+            ManagementimgVolumeProductionZyVO list=new ManagementimgVolumeProductionZyVO();
+            list.setId(list1.getId());
+            list.setZyNum(list1.getZyNum());
+            SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(list1.getRkId());
+            list.setStoreManagementNumber(slVolumeProductionRk.getStoreManagementNumber());
+            list.setRkNumber(slVolumeProductionRk.getRkNumber());
+            list.setRepertoryZhai(slVolumeProductionRk.getRepertoryZhai());
+            SlGoodsMaterials slGoodsMaterials = slGoodsMaterialsMapper.selectById(slVolumeProductionRk.getMaterialsId());
+            list.setGoodsMaterialsName(slGoodsMaterials.getGoodsMaterialsName());
+            list.setIsConsume(slGoodsMaterials.getIsConsume());
+            SlGoodsShelf slGoodsShelf = slGoodsShelfMapper.selectById(slVolumeProductionRk.getShelfId());
+            list.setGoodsShelfName(slGoodsShelf.getGoodsShelfName());
+
+            SlGoodsShelfDTO.add(list);
+        }
+        vo.setManagementimgVolumeProductionCkVOList(SlGoodsShelfDTO);
+        return vo;
+    }
+
+    @Override
+    public void zy(Long id,String authorizationUrl) {
+        SlVolumeProductionZygl byId = this.getById(id);
+        byId.setAuthorizationUrl(authorizationUrl);
+        byId.setAuditStatus(6);
+        byId.setPresentState(4);
+        byId.setEndTime(new Date());
+        this.updateById(byId);
+        LambdaQueryWrapper<SlVolumeProductionZy> wrapper1 = Wrappers.lambdaQuery();
+        wrapper1.eq(SlVolumeProductionZy::getZyglId, id);
+        wrapper1.eq(SlVolumeProductionZy::getDelFlag, 0);
+        wrapper1.orderByDesc(SlVolumeProductionZy::getCreateTime);
+        List<SlVolumeProductionZy> page2 = slVolumeProductionZyMapper.selectList(wrapper1);
+        // 新入库ids
+        List<Long> collect = page2.stream().map(SlVolumeProductionZy::getScrkId).collect(Collectors.toList());
+        for (SlVolumeProductionZy zy : page2) {
+            // 确认转移之后扣库存
+            SlVolumeProductionRk slVolumeProductionRk1 = slVolumeProductionRkMapper.selectById(zy.getRkId());
+            slVolumeProductionRk1.setRepertoryZhai(slVolumeProductionRk1.getRepertoryZhai()-Long.valueOf(zy.getZyNum()));
+            slVolumeProductionRkMapper.updateById(slVolumeProductionRk1);
+            // 给被转移入仓库加库存数量
+            LambdaQueryWrapper<ManagementGoodsMaterials> wrapper2 = Wrappers.lambdaQuery();
+            wrapper2.eq(ManagementGoodsMaterials::getGoodsMaterialsId,zy.getMaterialsId());
+            wrapper2.eq(ManagementGoodsMaterials::getManagementId,byId.getBmanagementId());
+            wrapper2.eq(ManagementGoodsMaterials::getDelFlag, 0);
+            ManagementGoodsMaterials managementGoodsMaterials = managementGoodsMaterialsMapper.selectOne(wrapper2);
+            if (managementGoodsMaterials!=null){
+                Long repertorySum = managementGoodsMaterials.getRepertorySum();
+                Long repertoryZhai = managementGoodsMaterials.getRepertoryZhai();
+                Long re=repertorySum+Long.valueOf(zy.getZyNum());
+                Long re1=repertoryZhai+Long.valueOf(zy.getZyNum());
+                managementGoodsMaterials.setRepertorySum(re);
+                managementGoodsMaterials.setRepertoryZhai(re1);
+                managementGoodsMaterials.setRepertoryChu(0);
+                managementGoodsMaterialsMapper.updateById(managementGoodsMaterials);
+            }else{
+                ManagementGoodsMaterials managementGoodsMaterials1=new ManagementGoodsMaterials();
+                managementGoodsMaterials1.setManagementId(byId.getBmanagementId());
+                managementGoodsMaterials1.setGoodsMaterialsId(zy.getMaterialsId());
+                managementGoodsMaterials1.setRepertoryZhai(Long.valueOf(zy.getZyNum()));
+                managementGoodsMaterials1.setRepertorySum(Long.valueOf(zy.getZyNum()));
+                managementGoodsMaterials1.setRepertoryChu(0);
+                managementGoodsMaterials1.setCreateTime(new Date());
+                managementGoodsMaterialsMapper.insert(managementGoodsMaterials1);
+            }
+            // 给转移仓库减去库存数量
+            LambdaQueryWrapper<ManagementGoodsMaterials> wrapper3 = Wrappers.lambdaQuery();
+            wrapper3.eq(ManagementGoodsMaterials::getGoodsMaterialsId,zy.getMaterialsId());
+            wrapper3.eq(ManagementGoodsMaterials::getManagementId,byId.getManagementId());
+            wrapper3.eq(ManagementGoodsMaterials::getDelFlag, 0);
+            ManagementGoodsMaterials managementGoodsMaterials1 = managementGoodsMaterialsMapper.selectOne(wrapper3);
+            if (managementGoodsMaterials1!=null){
+                Long repertorySum = managementGoodsMaterials1.getRepertorySum();
+                Long repertoryZhai = managementGoodsMaterials1.getRepertoryZhai();
+                Long re=repertorySum-Long.valueOf(zy.getZyNum());
+                Long re1=repertoryZhai-Long.valueOf(zy.getZyNum());
+//                managementGoodsMaterials1.setRepertorySum(re);
+                managementGoodsMaterials1.setRepertoryZhai(re1);
+                managementGoodsMaterials1.setRepertoryChu(managementGoodsMaterials1.getRepertoryChu()+zy.getZyNum());
+                managementGoodsMaterialsMapper.updateById(managementGoodsMaterials1);
+            }
+        }
+
+    }
 }

--
Gitblit v1.7.1