From 49dd9ee3dea22203cd1a0cc53745cffb6607122c Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期三, 15 十月 2025 18:28:51 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java
index 27daf7c..4da89fe 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java
@@ -13,14 +13,13 @@
 import com.ruoyi.system.dto.InventoryGoodsDto;
 import com.ruoyi.system.mapper.*;
 import com.ruoyi.system.model.*;
-import com.ruoyi.system.query.TClinicGoodsWarehouseQuery;
-import com.ruoyi.system.query.TErpGoodsAdminQuery;
-import com.ruoyi.system.query.TErpGoodsInventoryQuery;
-import com.ruoyi.system.query.TErpGoodsQuery;
+import com.ruoyi.system.query.*;
 import com.ruoyi.system.service.TErpGoodsService;
 import com.ruoyi.system.service.TErpSupplierInventoryGoodsService;
 import com.ruoyi.system.vo.*;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
@@ -151,6 +150,11 @@
     }
 
     @Override
+    public List<TErpGoods> pageAddList(Page<TErpGoods> tErpGoodsPage, String clinicSupplierId, PageAddListQuery query) {
+        return this.baseMapper.pageAddList(tErpGoodsPage, clinicSupplierId, query);
+    }
+
+    @Override
     public List<TErpGoodsVO> listExport(TErpGoodsQuery query, SysUser user) {
         List<TErpGoodsVO> list = this.baseMapper.listExport(query, user);
         if (list.isEmpty()) {
@@ -183,7 +187,7 @@
 
     @Override
     public boolean isExit(String goodsIdCode, String quasiNumber,String id) {
-        Long size = this.baseMapper.selectCount(new LambdaQueryWrapper<>(TErpGoods.class).ne(id!=null,TErpGoods::getId, id).and(q -> q.eq(TErpGoods::getGoodsIdCode, goodsIdCode).or().eq(TErpGoods::getQuasiNumber, quasiNumber)));
+        Long size = this.baseMapper.selectCount(new LambdaQueryWrapper<>(TErpGoods.class).eq(TErpGoods::getGoodsSource,1).ne(id!=null,TErpGoods::getId, id).and(q -> q.eq(TErpGoods::getGoodsIdCode, goodsIdCode).or().eq(TErpGoods::getQuasiNumber, quasiNumber)));
         if (size > 0) {
             return true;
         }
@@ -479,6 +483,7 @@
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
     public void inventoryGoods(InventoryDto dto, SysUser user) {
         Integer roleType = user.getRoleType();
         String supplierClinicId = null;
@@ -520,8 +525,8 @@
                 tErpSupplierWarehousing.setGoodsId(tErpSupplierWarehousing1.getGoodsId());
                 tErpSupplierWarehousing.setGoodsName(erpGoods.getGoodsName());
                 tErpSupplierWarehousing.setGoodsCount(inventoryGoodsDto.getInventoryCount() - inventoryGoodsDto.getNum());
-                tErpSupplierWarehousing.setUnitAmount(erpGoods.getSalesAmount());
-                tErpSupplierWarehousing.setTotalPrice(erpGoods.getSalesAmount().multiply(new BigDecimal(tErpSupplierWarehousing.getGoodsCount())));
+                tErpSupplierWarehousing.setUnitAmount(tErpSupplierWarehousing1.getUnitAmount());
+                tErpSupplierWarehousing.setTotalPrice(tErpSupplierWarehousing1.getUnitAmount().multiply(new BigDecimal(tErpSupplierWarehousing.getGoodsCount())));
                 // 当前年月日时分秒
                 String time = DateUtils.dateTimeNow();
                 tErpSupplierWarehousing.setWarehouseNo("G" + time);
@@ -551,6 +556,9 @@
 
             } else {
 
+                TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch1 = erpSupplierWarehousingBatchMapper.selectById(inventoryGoodsDto.getId());
+                String warehousingId1 = tErpSupplierWarehousingBatch1.getWarehousingId();
+                TErpSupplierWarehousing tErpSupplierWarehousing2 = erpSupplierWarehousingMapper.selectById(warehousingId1);
 
                 TErpSupplierOutbound tErpSupplierOutbound = new TErpSupplierOutbound();
                 tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId());
@@ -558,7 +566,8 @@
                 tErpSupplierOutbound.setOutboundType(6);
                 tErpSupplierOutbound.setOutboundNumber("G" + s);
                 int count = inventoryGoodsDto.getNum() - inventoryGoodsDto.getInventoryCount();
-                tErpSupplierOutbound.setTotalMoney(erpGoods.getSalesAmount().multiply(new BigDecimal(count)));
+                tErpSupplierOutbound.setTotalMoney(tErpSupplierWarehousing1.getUnitAmount().multiply(new BigDecimal(count)));
+                tErpSupplierOutbound.setGoodsId(tErpSupplierWarehousing2.getGoodsId());
                 erpSupplierOutboundMapper.insert(tErpSupplierOutbound);
 
 
@@ -567,7 +576,7 @@
                 tErpSupplierOutboundGoods.setWarehousingId(tErpSupplierWarehousing1.getId());
                 tErpSupplierOutboundGoods.setWarehousingBatchId(tErpSupplierWarehousingBatch.getId());
                 tErpSupplierOutboundGoods.setOutboundCount(count);
-                tErpSupplierOutboundGoods.setTotalPrice(erpGoods.getSalesAmount().multiply(new BigDecimal(count)));
+                tErpSupplierOutboundGoods.setTotalPrice(tErpSupplierWarehousing1.getUnitAmount().multiply(new BigDecimal(count)));
                 erpSupplierOutboundGoodsMapper.insert(tErpSupplierOutboundGoods);
 
 

--
Gitblit v1.7.1