From be1b426b7d765a546f4a26b60e80aa49a57079b9 Mon Sep 17 00:00:00 2001
From: xiaogang <905166056@qq.com>
Date: 星期六, 13 一月 2024 16:25:11 +0800
Subject: [PATCH] 1、优化采购模块数量不能为小数点问题2、新增客服巡查巡楼记录功能模块3、新增页面导出功能4、优化记录查询条件新增时间段查询条件5、其他界面性调整

---
 service-store/src/main/java/com/java110/store/bmo/allocation/impl/AllocationBMOImpl.java |   58 ++++++++++++++++++++++++----------------------------------
 1 files changed, 24 insertions(+), 34 deletions(-)

diff --git a/service-store/src/main/java/com/java110/store/bmo/allocation/impl/AllocationBMOImpl.java b/service-store/src/main/java/com/java110/store/bmo/allocation/impl/AllocationBMOImpl.java
index 90cb6a9..97b237b 100644
--- a/service-store/src/main/java/com/java110/store/bmo/allocation/impl/AllocationBMOImpl.java
+++ b/service-store/src/main/java/com/java110/store/bmo/allocation/impl/AllocationBMOImpl.java
@@ -4,22 +4,24 @@
 import com.java110.dto.purchase.AllocationStorehouseDto;
 import com.java110.dto.resource.ResourceStoreDto;
 import com.java110.dto.resource.ResourceStoreTimesDto;
-import com.java110.intf.common.IAllocationStorehouseUserInnerServiceSMO;
+import com.java110.dto.store.StorehouseDto;
 import com.java110.intf.store.*;
 import com.java110.po.purchase.ResourceStorePo;
 import com.java110.po.resource.ResourceStoreTimesPo;
 import com.java110.store.bmo.allocation.IAllocationBMO;
+import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 @Service
 public class AllocationBMOImpl implements IAllocationBMO {
 
     @Autowired
-    private IAllocationStorehouseApplyInnerServiceSMO allocationStorehouseApplyInnerServiceSMOImpl;
+    private IStorehouseInnerServiceSMO storehouseInnerServiceSMOImpl;
 
     @Autowired
     private IResourceStoreTimesV1InnerServiceSMO resourceStoreTimesV1InnerServiceSMOImpl;
@@ -28,34 +30,26 @@
     private IResourceStoreInnerServiceSMO resourceStoreInnerServiceSMOImpl;
 
     @Autowired
-    private IAllocationStorehouseUserInnerServiceSMO allocationStorehouseUserInnerServiceSMOImpl;
-
-    @Autowired
-    private IUserStorehouseInnerServiceSMO userStorehouseInnerServiceSMOImpl;
-
-    @Autowired
-    private IAllocationStorehouseApplyV1InnerServiceSMO allocationStorehouseApplyV1InnerServiceSMOImpl;
-
-    @Autowired
-    private IAllocationStorehouseV1InnerServiceSMO allocationStorehouseV1InnerServiceSMOImpl;
-
-    @Autowired
     private IResourceStoreV1InnerServiceSMO resourceStoreV1InnerServiceSMOImpl;
 
     @Override
-    public void doToAllocationStorehouse(AllocationStorehouseDto tmpAllocationStorehouseDto, int allocationStock) {
+    public void doToAllocationStorehouse(AllocationStorehouseDto tmpAllocationStorehouseDto, double allocationStock) {
+        //鏌ヨz 浠撳簱
+        StorehouseDto storehouseDto = new StorehouseDto();
+        storehouseDto.setShId(tmpAllocationStorehouseDto.getShIdz());
+        List<StorehouseDto> targetStorehouseDtos = storehouseInnerServiceSMOImpl.queryStorehouses(storehouseDto);
+        Assert.listOnlyOne(targetStorehouseDtos, "鐩爣浠撳簱涓嶅瓨鍦�");
 
         // todo -------------------------------------------------鍘熶粨搴撲腑鍋氭墸闄� (start)-----------------------------------------------------//
         // todo 鍘熶粨搴撲腑鎵i櫎 鏁伴噺
         ResourceStoreDto resourceStoreDto = new ResourceStoreDto();
-        resourceStoreDto.setResCode(tmpAllocationStorehouseDto.getResCode());
+        resourceStoreDto.setResId(tmpAllocationStorehouseDto.getResId());
         resourceStoreDto.setShId(tmpAllocationStorehouseDto.getShIda());
         List<ResourceStoreDto> resourceStoreDtoAs = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStoreDto);
         //todo 杩欑鍦烘櫙涓嶅瓨鍦�
         if (resourceStoreDtoAs == null || resourceStoreDtoAs.size() < 1) {
             return;
         }
-
         ResourceStoreTimesDto resourceStoreTimesDto = new ResourceStoreTimesDto();
         resourceStoreTimesDto.setTimesId(tmpAllocationStorehouseDto.getTimesId());
         resourceStoreTimesDto.setShId(tmpAllocationStorehouseDto.getShIda());
@@ -64,9 +58,7 @@
         if (resourceStoreTimesDtoAs == null || resourceStoreTimesDtoAs.size() < 1) {
             return;
         }
-
-        int stockA = Integer.parseInt(resourceStoreDtoAs.get(0).getStock());
-
+        double stockA = Double.parseDouble(resourceStoreDtoAs.get(0).getStock());
         //todo 搴撳瓨涓嶅鏃讹紝鍙兘璋冩嫧 搴撳瓨锛岃繖绉嶅満鏅簲璇ユ墽琛屼笉鍒� 鍓嶆枃鍋氫簡鏍¢獙
         if (stockA < allocationStock) {
             allocationStock = stockA;
@@ -76,14 +68,11 @@
         resourceStorePo.setStoreId(resourceStoreDtoAs.get(0).getStoreId());
         resourceStorePo.setStock(allocationStock * -1 + "");// 杩欓噷鍘绘墸鍑�
         resourceStoreInnerServiceSMOImpl.updateResourceStore(resourceStorePo);
-
-        stockA = Integer.parseInt(resourceStoreTimesDtoAs.get(0).getStock());
-
+        stockA = Double.parseDouble(resourceStoreTimesDtoAs.get(0).getStock());
         //todo 搴撳瓨涓嶅鏃讹紝鍙兘璋冩嫧 搴撳瓨锛岃繖绉嶅満鏅簲璇ユ墽琛屼笉鍒� 鍓嶆枃鍋氫簡鏍¢獙
         if (stockA < allocationStock) {
             allocationStock = stockA;
         }
-
         ResourceStoreTimesPo resourceStoreTimesPo = new ResourceStoreTimesPo();
         resourceStoreTimesPo.setPrice(resourceStoreTimesDtoAs.get(0).getPrice());
         resourceStoreTimesPo.setShId(resourceStoreTimesDtoAs.get(0).getShId());
@@ -96,7 +85,7 @@
         // todo -------------------------------------------------鐩爣浠撳簱涓仛澧炲姞 (start)-----------------------------------------------------//
         //todo 鏌ヨ鐩爣浠撳簱涓� 搴撳瓨
         resourceStoreDto = new ResourceStoreDto();
-        resourceStoreDto.setResCode(tmpAllocationStorehouseDto.getResCode());
+        resourceStoreDto.setResCode(resourceStoreDtoAs.get(0).getResCode());
         resourceStoreDto.setShId(tmpAllocationStorehouseDto.getShIdz());
         List<ResourceStoreDto> resourceStoreDtoZs = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStoreDto);
         //todo 杩欑鍦烘櫙涓嶅瓨鍦�
@@ -106,34 +95,35 @@
             tmpResourceStorePo.setResId(GenerateCodeFactory.getGeneratorId("11"));
             tmpResourceStorePo.setStock(allocationStock + "");
             tmpResourceStorePo.setShId(tmpAllocationStorehouseDto.getShIdz());
+            tmpResourceStorePo.setCommunityId(targetStorehouseDtos.get(0).getCommunityId());
+            BigDecimal miniUnitStock = new BigDecimal(resourceStoreDtoAs.get(0).getMiniUnitStock()); //鑾峰彇鏈�灏忚閲忓崟浣嶆暟閲�
+            BigDecimal stock = new BigDecimal(tmpResourceStorePo.getStock()); //鑾峰彇鐗╁搧搴撳瓨
+            BigDecimal miniStock = miniUnitStock.multiply(stock); //璁$畻鏈�灏忚閲忓崟浣嶆�绘暟
+            tmpResourceStorePo.setMiniStock(String.valueOf(miniStock));
             resourceStoreV1InnerServiceSMOImpl.saveResourceStore(tmpResourceStorePo);
-
             // todo 娣诲姞 times
             ResourceStoreTimesPo tmpResourceStoreTimesPo = BeanConvertUtil.covertBean(resourceStoreTimesDtoAs.get(0), ResourceStoreTimesPo.class);
             tmpResourceStoreTimesPo.setTimesId(GenerateCodeFactory.getGeneratorId("11"));
             tmpResourceStoreTimesPo.setStock(allocationStock + "");
             tmpResourceStoreTimesPo.setShId(tmpAllocationStorehouseDto.getShIdz());
-
+            tmpResourceStoreTimesPo.setCommunityId(targetStorehouseDtos.get(0).getCommunityId());
             resourceStoreTimesV1InnerServiceSMOImpl.saveResourceStoreTimes(tmpResourceStoreTimesPo);
             return;
         }
-
         resourceStorePo = new ResourceStorePo();
         resourceStorePo.setResId(resourceStoreDtoZs.get(0).getResId());
-        resourceStorePo.setStoreId(resourceStoreDtoZs.get(0).getResId());
-        resourceStorePo.setStock(allocationStock + "");// 杩欓噷鍘绘墸鍑�
+        resourceStorePo.setStoreId(resourceStoreDtoZs.get(0).getStoreId());
+        resourceStorePo.setStock(allocationStock + "");// 杩欓噷鍘绘坊鍔犲埌鐩爣浠撳簱
         resourceStoreInnerServiceSMOImpl.updateResourceStore(resourceStorePo);
-
-
         resourceStoreTimesPo = new ResourceStoreTimesPo();
         resourceStoreTimesPo.setPrice(resourceStoreTimesDtoAs.get(0).getPrice());
         resourceStoreTimesPo.setShId(resourceStoreDtoZs.get(0).getShId());
         resourceStoreTimesPo.setResCode(resourceStoreTimesDtoAs.get(0).getResCode());
         resourceStoreTimesPo.setStoreId(resourceStoreTimesDtoAs.get(0).getStoreId());
         resourceStoreTimesPo.setStock(allocationStock + "");// 杩欓噷鍘诲鍔�
+        resourceStoreTimesPo.setCommunityId(resourceStoreDtoZs.get(0).getCommunityId());
+        resourceStoreTimesPo.setApplyOrderId(tmpAllocationStorehouseDto.getApplyId());
         resourceStoreTimesV1InnerServiceSMOImpl.saveOrUpdateResourceStoreTimes(resourceStoreTimesPo);
         // todo -------------------------------------------------鐩爣浠撳簱涓仛澧炲姞 (end)-----------------------------------------------------//
-
-
     }
 }

--
Gitblit v1.8.0