From 1e0e62187e2b7ff3e1fef23b182a710dc8cd76f8 Mon Sep 17 00:00:00 2001
From: chengf <cgf12138@163.com>
Date: 星期三, 25 三月 2026 18:22:39 +0800
Subject: [PATCH] 采购导入需求

---
 service-store/src/main/java/com/java110/store/smo/impl/ResourceStoreInnerServiceSMOImpl.java |   53 ++++++++++++++++++++++++-----------------------------
 1 files changed, 24 insertions(+), 29 deletions(-)

diff --git a/service-store/src/main/java/com/java110/store/smo/impl/ResourceStoreInnerServiceSMOImpl.java b/service-store/src/main/java/com/java110/store/smo/impl/ResourceStoreInnerServiceSMOImpl.java
old mode 100755
new mode 100644
index e43412a..98326f8
--- a/service-store/src/main/java/com/java110/store/smo/impl/ResourceStoreInnerServiceSMOImpl.java
+++ b/service-store/src/main/java/com/java110/store/smo/impl/ResourceStoreInnerServiceSMOImpl.java
@@ -3,9 +3,9 @@
 import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.dto.PageDto;
 import com.java110.dto.file.FileRelDto;
-import com.java110.dto.purchaseApply.PurchaseApplyDto;
-import com.java110.dto.resourceStore.ResourceStoreDto;
-import com.java110.dto.resourceStoreTimes.ResourceStoreTimesDto;
+import com.java110.dto.purchase.PurchaseApplyDto;
+import com.java110.dto.resource.ResourceStoreDto;
+import com.java110.dto.resource.ResourceStoreTimesDto;
 import com.java110.intf.common.IFileRelInnerServiceSMO;
 import com.java110.intf.store.IResourceStoreInnerServiceSMO;
 import com.java110.intf.store.IResourceStoreTimesV1InnerServiceSMO;
@@ -15,6 +15,7 @@
 import com.java110.utils.lock.DistributedLock;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
@@ -76,30 +77,14 @@
                 resourceStoreDto.setFileUrls(fileUrls);
             }
             resourceStoreDtos.add(resourceStoreDto);
-        }
 
-        if (resourceResourceStores == null || resourceResourceStores.size() < 1 || resourceResourceStores.size() > 15) {
-            return resourceResourceStores;
-        }
 
-        ResourceStoreTimesDto resourceStoreTimesDto = new ResourceStoreTimesDto();
-        resourceStoreTimesDto.setStoreId(resourceResourceStoreDto.getStoreId());
-        resourceStoreTimesDto.setResCodes(resCodes.toArray(new String[resCodes.size()]));
-        List<ResourceStoreTimesDto> resourceStoreTimesDtos = resourceStoreTimesV1InnerServiceSMOImpl.queryResourceStoreTimess(resourceStoreTimesDto);
-
-        if (resourceStoreTimesDtos == null || resourceStoreTimesDtos.size() < 1) {
-            return resourceStoreDtos;
-        }
-
-        List<ResourceStoreTimesDto> times = null;
-        for (ResourceStoreDto resourceStoreDto : resourceResourceStores) {
-            times = new ArrayList<>();
-            for (ResourceStoreTimesDto tmpResourceStoreTimesDto : resourceStoreTimesDtos) {
-                if (resourceStoreDto.getResCode().equals(tmpResourceStoreTimesDto.getResCode())) {
-                    times.add(tmpResourceStoreTimesDto);
-                }
-            }
-            resourceStoreDto.setTimes(times);
+            ResourceStoreTimesDto resourceStoreTimesDto = new ResourceStoreTimesDto();
+            resourceStoreTimesDto.setStoreId(resourceResourceStoreDto.getStoreId());
+            resourceStoreTimesDto.setResCode(resourceStoreDto.getResCode());
+            resourceStoreTimesDto.setShId(resourceStoreDto.getShId());
+//            List<ResourceStoreTimesDto> resourceStoreTimesDtos = resourceStoreTimesV1InnerServiceSMOImpl.queryResourceStoreTimess(resourceStoreTimesDto);
+//            resourceStoreDto.setTimes(resourceStoreTimesDtos);
         }
         return resourceStoreDtos;
     }
@@ -131,8 +116,9 @@
                 throw new IllegalArgumentException("搴撳瓨涓嶈冻锛屽弬鏁版湁璇�");
             }
             //鍏ュ簱鎿嶄綔 瀵圭墿鍝佽繘琛屽姞鏉冨钩鍧�
-            if (resourceStorePo.getResOrderType().equals(PurchaseApplyDto.RES_ORDER_TYPE_ENTER)
-                    || (resourceStorePo.getResOrderType().equals(PurchaseApplyDto.WAREHOUSING_TYPE_URGENT) && resourceStorePo.getOperationType().equals(PurchaseApplyDto.WEIGHTED_MEAN_TRUE))) {
+            if (PurchaseApplyDto.RES_ORDER_TYPE_ENTER.equals(resourceStorePo.getResOrderType())
+                    || (PurchaseApplyDto.WAREHOUSING_TYPE_URGENT.equals(resourceStorePo.getResOrderType())
+                    && PurchaseApplyDto.WEIGHTED_MEAN_TRUE.equals(resourceStorePo.getOperationType()))) {
                 //鑾峰彇鍘熷潎浠�
                 Object averageOldPrice = stores.get(0).get("averagePrice");
                 BigDecimal price = new BigDecimal(0);
@@ -146,15 +132,24 @@
                 BigDecimal averagePrice = averagePriceTotal.divide(totalStock, 2, BigDecimal.ROUND_HALF_UP);
                 resourceStorePo.setAveragePrice(averagePrice.toString());
             }
-            if (resourceStorePo.getResOrderType().equals(PurchaseApplyDto.WAREHOUSING_TYPE_URGENT) && resourceStorePo.getOperationType().equals(PurchaseApplyDto.WEIGHTED_MEAN_TRUE)) {
+            if (PurchaseApplyDto.WAREHOUSING_TYPE_URGENT.equals(resourceStorePo.getResOrderType())
+                    && PurchaseApplyDto.WEIGHTED_MEAN_TRUE.equals(resourceStorePo.getOperationType())) {
                 resourceStorePo.setStock(stock + "");
             } else {
                 resourceStorePo.setStock(totalStock + "");
             }
             resourceStorePo.setStatusCd("0");
+
+            if (StringUtil.isEmpty(resourceStorePo.getAdjustmentType())) {
+                //璁$畻鏈�灏忚閲忔�绘暟
+                BigDecimal miniUnitStock = new BigDecimal(stores.get(0).get("miniUnitStock").toString());//鏈�灏忚閲忓崟浣嶆暟閲�
+                BigDecimal newMiniStock = totalStock.multiply(miniUnitStock);
+                resourceStorePo.setMiniStock(String.valueOf(newMiniStock));
+            }
+
             return resourceResourceStoreServiceDaoImpl.updateResourceStoreInfoInstance(BeanConvertUtil.beanCovertMap(resourceStorePo));
         } finally {
-            DistributedLock.releaseDistributedLock(requestId, key);
+            DistributedLock.releaseDistributedLock(key, requestId);
         }
     }
 

--
Gitblit v1.8.0