From f6139f54342c92601a060947cfa19ebca72e8b4a Mon Sep 17 00:00:00 2001
From: xiaogang <905166056@qq.com>
Date: 星期四, 24 二月 2022 11:36:22 +0800
Subject: [PATCH] 1、优化线上实际仓库使用中的bug 2、优化页面展示问题

---
 service-store/src/main/java/com/java110/store/api/PurchaseApi.java |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/service-store/src/main/java/com/java110/store/api/PurchaseApi.java b/service-store/src/main/java/com/java110/store/api/PurchaseApi.java
index 7c9f768..252f7a1 100755
--- a/service-store/src/main/java/com/java110/store/api/PurchaseApi.java
+++ b/service-store/src/main/java/com/java110/store/api/PurchaseApi.java
@@ -107,6 +107,13 @@
     @RequestMapping(value = "/resourceEnter", method = RequestMethod.POST)
     public ResponseEntity<String> resourceEnter(@RequestBody JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "applyOrderId", "璁㈠崟ID涓虹┖");
+        PurchaseApplyDto purchaseApplyDto = new PurchaseApplyDto();
+        purchaseApplyDto.setApplyOrderId(reqJson.getString("applyOrderId"));
+        purchaseApplyDto.setStatusCd("0");
+        List<PurchaseApplyDto> purchaseApplyDtoList = purchaseApplyInnerServiceSMOImpl.queryPurchaseApplys(purchaseApplyDto);
+        if(purchaseApplyDtoList!=null && PurchaseApplyDto.STATE_AUDITED.equals(purchaseApplyDtoList.get(0).getState())){
+            throw new IllegalArgumentException("璇ヨ鍗曞凡缁忓鐞嗭紝璇峰埛鏂扮‘璁よ鍗曠姸鎬侊紒");
+        }
         JSONArray purchaseApplyDetails = reqJson.getJSONArray("purchaseApplyDetailVo");
         List<PurchaseApplyDetailPo> purchaseApplyDetailPos = new ArrayList<>();
         for (int detailIndex = 0; detailIndex < purchaseApplyDetails.size(); detailIndex++) {
@@ -248,13 +255,6 @@
         //鑾峰彇閲囪喘鐗╁搧淇℃伅
         JSONArray resourceStores = reqJson.getJSONArray("resourceStores");
         List<PurchaseApplyDetailPo> purchaseApplyDetailPos = new ArrayList<>();
-        //鏌ヨ褰撳墠灏忓尯鐨勫皬鍖轰粨搴�
-        StorehouseDto storehouseDto = new StorehouseDto();
-        storehouseDto.setShObjId(reqJson.getString("communityId"));
-        storehouseDto.setShType(StorehouseDto.SH_TYPE_COMMUNITY);//灏忓尯浠撳簱
-        //鑾峰彇褰撳墠灏忓尯鐨勫皬鍖轰粨搴�
-        List<StorehouseDto> storehouseDtos = storehouseInnerServiceSMOImpl.queryStorehouses(storehouseDto);
-        //Assert.listOnlyOne(storehouseDtos, "娌℃湁鏌ヨ鍒板綋鍓嶅皬鍖轰粨搴撴垨鏌ヨ鍑哄涓皬鍖轰粨搴擄紒");
         for (int resourceStoreIndex = 0; resourceStoreIndex < resourceStores.size(); resourceStoreIndex++) {
             JSONObject resourceStore = resourceStores.getJSONObject(resourceStoreIndex);
             PurchaseApplyDetailPo purchaseApplyDetailPo = BeanConvertUtil.covertBean(resourceStore, PurchaseApplyDetailPo.class);
@@ -267,7 +267,7 @@
             //鏌ヨ褰撳墠灏忓尯浠撳簱涓嬭鐗╁搧淇℃伅
             ResourceStoreDto resourceStoreDto = new ResourceStoreDto();
             resourceStoreDto.setResCode(resourceStore.getString("resCode"));
-            resourceStoreDto.setShId(storehouseDtos.get(0).getShId());
+            resourceStoreDto.setShId(resourceStore.getString("shzId"));//灏忓尯鐩爣浠撳簱
             List<ResourceStoreDto> resourceStoreDtos = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStoreDto);
             //璋冩暣闆嗗洟浠撳簱鐗╁搧淇℃伅
             ResourceStorePo resourceStorePo = new ResourceStorePo();
@@ -283,7 +283,7 @@
                 allocationStorehouseDto.setAsId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_allocationStorehouseId));
                 allocationStorehouseDto.setbId("-1");
                 allocationStorehouseDto.setShIda(resourceStore.getString("shId"));
-                allocationStorehouseDto.setShIdz(storehouseDtos.get(0).getShId());
+                allocationStorehouseDto.setShIdz(resourceStore.getString("shzId"));//灏忓尯浠撳簱
                 allocationStorehouseDto.setResId(resourceStoreDtos.get(0).getResId());
                 allocationStorehouseDto.setResName(resourceStoreDtos.get(0).getResName());
                 allocationStorehouseDto.setStoreId(storeId);
@@ -351,7 +351,7 @@
                 allocationStorehouseDto.setAsId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_allocationStorehouseId));
                 allocationStorehouseDto.setbId("-1");
                 allocationStorehouseDto.setShIda(resourceStore.getString("shId"));
-                allocationStorehouseDto.setShIdz(storehouseDtos.get(0).getShId());
+                allocationStorehouseDto.setShIdz(resourceStore.getString("shzId"));//灏忓尯鐩爣浠撳簱
                 allocationStorehouseDto.setResId(resourceStore.getString("resId"));
                 allocationStorehouseDto.setResName(resourceStore.getString("resName"));
                 allocationStorehouseDto.setStoreId(storeId);
@@ -386,7 +386,7 @@
                 List<ResourceStoreDto> resourceStoreDtoList = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStoreDto2);
                 ResourceStoreDto resourceStoreDto1 = BeanConvertUtil.covertBean(resourceStoreDtoList.get(0), ResourceStoreDto.class);
                 resourceStoreDto1.setResId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_resId));
-                resourceStoreDto1.setShId(storehouseDtos.get(0).getShId());
+                resourceStoreDto1.setShId(resourceStore.getString("shzId"));
                 resourceStoreDto1.setbId("-1");
                 resourceStoreDto1.setStock(purchaseApplyDetailPo.getQuantity());
                 resourceStoreDto1.setCreateTime(new Date());

--
Gitblit v1.8.0