From e50a43bb067adff10cd1dcc81349b1aafdfda882 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 22 一月 2026 13:18:44 +0800
Subject: [PATCH] 业务管理:IFS域区分【ZTNS】和【KJNS】

---
 inspect-server/src/main/java/com/ruoyi/inspect/dto/ReportPageDto.java                              |    3 
 inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanVO.java                              |    3 
 inspect-server/src/main/resources/mapper/InsSampleMapper.xml                                       |    2 
 inspect-server/src/main/java/com/ruoyi/inspect/dto/IfsPartPropsRecordDTO.java                      |   11 ++
 inspect-server/src/main/java/com/ruoyi/inspect/vo/IfsOrderVO.java                                  |    6 +
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/FinishProductSpotCheckServiceImpl.java |    2 
 ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java                             |   79 +++++++++++--------
 ruoyi-common/src/main/java/com/ruoyi/common/config/ifs/IfsConfig.java                              |   19 ++++
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java       |    4 
 inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderController.java                  |    2 
 ruoyi-admin-ztns/src/main/resources/application-ztns.yml                                           |   25 ++++-
 ruoyi-common/src/main/java/com/ruoyi/common/config/ifs/IfsProperties.java                          |   23 ++++-
 inspect-server/src/main/resources/mapper/InsOrderMapper.xml                                        |    1 
 inspect-server/src/main/resources/mapper/InsReportMapper.xml                                       |    3 
 inspect-server/src/main/java/com/ruoyi/inspect/task/RawMaterIalSchedule.java                       |    2 
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsPartPropsRecordServiceImpl.java     |    7 -
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java               |   23 ++++-
 ruoyi-admin-ztns/src/main/resources/application-druid.yml                                          |   25 ++++-
 18 files changed, 170 insertions(+), 70 deletions(-)

diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderController.java b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderController.java
index 2fdf20a..ecf318f 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderController.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/controller/InsOrderController.java
@@ -178,7 +178,7 @@
     @GetMapping("/getIfsOrder")
     public Result<?> getIfsOrder() {
         HashMap<String, Object> map = new HashMap<>();
-        map.put("LOCATION_NO", "1302;WG-04-001");
+//        map.put("LOCATION_NO", "1302;WG-04-001");
         map.put("STATE_DB", "To be Inspected");
         insOrderService.getIfsOrder(map, false);
         return Result.success();
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/IfsPartPropsRecordDTO.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/IfsPartPropsRecordDTO.java
index 6d78d3b..ea58580 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/dto/IfsPartPropsRecordDTO.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/IfsPartPropsRecordDTO.java
@@ -6,8 +6,19 @@
 @Data
 public class IfsPartPropsRecordDTO extends IfsPartPropsRecord {
 
+    /**
+     * 闆朵欢鍙�
+     */
     private String partNo;
 
+    /**
+     * 鎵规鍙�
+     */
     private String lotBatchNo;
 
+    /**
+     * IFS鍩�
+     */
+    private String contract;
+
 }
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/ReportPageDto.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/ReportPageDto.java
index 554854b..62ccebc 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/dto/ReportPageDto.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/ReportPageDto.java
@@ -9,6 +9,9 @@
 @Data
 public class ReportPageDto extends InsReport implements Serializable {
 
+    @ApiModelProperty(value = "IFS鍩�")
+    private String contract;
+
     @ApiModelProperty(value = "濮旀墭缂栧彿")
     private String entrustCode;
 
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/FinishProductSpotCheckServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/FinishProductSpotCheckServiceImpl.java
index 357d1c7..d20c20b 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/FinishProductSpotCheckServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/FinishProductSpotCheckServiceImpl.java
@@ -82,7 +82,7 @@
         jresult.put("data", new JSONArray());
         JSONObject jsonObject = new JSONObject();
         generateIfsStockQueryParams(jsonObject, ifsStockQueryDTO, ifsStockQueryDTO.getPage(), ifsStockQueryDTO.getLimit());
-        Result result = ifsApiUtils.getIfsStock(jsonObject.toJSONString());
+        Result result = ifsApiUtils.getIfsStock("ZTNS",jsonObject.toJSONString());
         if (result.getCode() == 200) {
             JSONObject data = (JSONObject) JSON.toJSON(result.getData());
             JSONArray array = new JSONArray();
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsPartPropsRecordServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsPartPropsRecordServiceImpl.java
index 929e993..fe99925 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsPartPropsRecordServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsPartPropsRecordServiceImpl.java
@@ -42,9 +42,6 @@
     @Autowired
     private IfsSplitOrderRecordMapper ifsSplitOrderRecordMapper;
 
-    @Value("${ifs.contract}")
-    public String contract;
-
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean saveOrUpdateProps(IfsPartPropsRecordDTO ifsPartPropsRecord) {
@@ -61,7 +58,7 @@
             inAttrMap.put("SYSCODE", "LIMS");
             inAttrMap.put("SYSMODEL", "搴撳瓨鐗╂枡鎵规灞炴�т慨鏀�");
             HashMap<String, Object> batchInfoMap = new HashMap<>();
-            batchInfoMap.put("CONTRACT",contract);//鍩�
+            batchInfoMap.put("CONTRACT",ifsPartPropsRecord.getContract());//鍩�
             batchInfoMap.put("PART_NO",ifsPartPropsRecord.getPartNo());//闆朵欢鍙�
             batchInfoMap.put("LOT_BATCH_NO",ifsPartPropsRecord.getLotBatchNo());//鎵规鍙�
             batchInfoMap.put("ATTR1",ifsPartPropsRecord.getDrumNo());//杞藉叿缂栧彿
@@ -74,7 +71,7 @@
             batchInfoMap.put("ATTR24","0");//鍒嗗壊棰勭暀鏁伴噺
             batchInfoMap.put("ACTION_TYPE",actionType);//鎿嶄綔绫诲瀷
             inAttrMap.put("BATCH_INFO", Collections.singletonList(batchInfoMap));
-            Result result = ifsApiUtils.importPartLotAttr(JSONUtil.toJsonStr(inAttrMap));
+            Result result = ifsApiUtils.importPartLotAttr(ifsPartPropsRecord.getContract(),JSONUtil.toJsonStr(inAttrMap));
             if(result.getCode()!=200){
                 throw new RuntimeException("搴撳瓨鐗╂枡鎵规灞炴�ф洿鏂板け璐ワ細"+result.getMessage());
             }
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
index bfdb181..5370f98 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
@@ -25,6 +25,7 @@
 import com.ruoyi.basic.pojo.StandardProductList;
 import com.ruoyi.basic.pojo.StructureItemParameter;
 import com.ruoyi.basic.pojo.StructureTestObject;
+import com.ruoyi.common.config.ifs.IfsProperties;
 import com.ruoyi.common.constant.InsOrderTypeConstants;
 import com.ruoyi.common.core.domain.Result;
 import com.ruoyi.common.core.domain.entity.User;
@@ -561,7 +562,7 @@
      */
     @Override
     public void getIfsOrder(Map<String, Object> map, Boolean isSplitOrder) {
-        List<Map<String, Object>> inventory = ifsApiUtils.getInventory(JSONUtil.toJsonStr(map));
+        List<Map<String, Object>> inventory = ifsApiUtils.getInventory(map);
         if (inventory.isEmpty()) {
             return;
         }
@@ -807,6 +808,8 @@
         ifsInventoryQuantity.setIsCopper(1);
         ifsInventoryQuantity.setIsQuarter(0);
         ifsInventoryQuantity.setInspectStatus(0);
+        ifsInventoryQuantity.setOrderType(OrderType.RAW.getValue());
+        ifsInventoryQuantity.setMaterialProp("01Cu");
 
         ifsInventoryQuantity.setQtyArrived(insOrder.getQtyArrived());
         ifsInventoryQuantity.setBuyUnitMeas(insOrder.getBuyUnitMeas());
@@ -1204,7 +1207,7 @@
             resultMap.put("SYSCODE", "LIMS");
             resultMap.put("SYSMODEL", "鐧昏閲囪喘妫�楠岀粨鏋�");
             resultMap.put("BATCH_INFO", resultList);
-            Result result = ifsApiUtils.getProcurementResults(JSONUtil.toJsonStr(resultMap));
+            Result result = ifsApiUtils.getProcurementResults(one.getContract(),JSONUtil.toJsonStr(resultMap));
             if (result.getCode() != 200) {
                 throw new ErrorException("IFS鐧昏閲囪喘妫�楠岀粨鏋滃け璐�: " + result.getMessage());
             }
@@ -1235,8 +1238,14 @@
          * TODO 鍚庣画闇�瑕佽皟鐢↖FS鐨勬帴鍙� 绉诲叆鐨勫簱浣嶅彿 toLocation
          */
         // 妫�楠屽悗绉诲簱
-        //1301:鍘熸潗鏂欏悎鏍煎簱锛孋P-02-001:鎴愬搧搴�
-        toLocation = StringUtils.equals(inventoryQuantity.getOrderType(), OrderType.RAW.getValue()) ? "1301" : "CP-02-001";
+        //1.鏍规嵁ifs鍩熻幏鍙栧搴斿簱浣嶉厤缃�
+        IfsProperties properties = ifsApiUtils.getPropByContract(one.getContract());
+        //2.鍒ゆ柇璁㈠崟绫诲瀷鏄惁涓哄師鏉愭枡
+        if(StringUtils.equals(inventoryQuantity.getOrderType(), OrderType.RAW.getValue())){
+            toLocation = properties.getRawQualifiedLocation();
+        }else{
+            toLocation = properties.getProductQualifiedLocation();
+        }
         Map<String, Object> moveResultMap = new HashMap<>();
         List<Map<String, Object>> moveResultList = new ArrayList<>();
         Map<String, Object> moveMap = new HashMap<>();
@@ -1259,7 +1268,7 @@
         moveResultMap.put("SYSMODEL", "妫�楠屽悗绉诲簱");
         moveResultMap.put("BATCH_INFO", moveResultList);
 
-        Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap));
+        Result result1 = ifsApiUtils.moveReceipt(one.getContract(),JSONUtil.toJsonStr(moveResultMap));
         // 濡傛灉鏈夊繀椤讳负闆朵欢鎸囧畾鎵瑰彿鎶ラ敊闇�瑕侀噸鏂版彁浜ょЩ搴撲俊鎭幓鎸囧畾鎵瑰彿
         if (result1.getCode() != 200) {
             String message = result1.getMessage();
@@ -1309,7 +1318,7 @@
             resultMap.put("SYSMODEL", "淇敼閲囪喘璁㈠崟鎵规鍙�");
             resultMap.put("BATCH_INFO", resultList);
 
-            Result result = ifsApiUtils.updateMoveReceiptLot(JSONUtil.toJsonStr(resultMap));
+            Result result = ifsApiUtils.updateMoveReceiptLot(one.getContract(),JSONUtil.toJsonStr(resultMap));
 
             if (result.getCode() != 200) {
                 throw new ErrorException("IFS淇敼鎵规鍙峰け璐�: " + result.getMessage());
@@ -1341,7 +1350,7 @@
         moveResultMap.put("SYSMODEL", "妫�楠屽悗绉诲簱");
         moveResultMap.put("BATCH_INFO", moveResultList);
 
-        Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap));
+        Result result1 = ifsApiUtils.moveReceipt(one.getContract(),JSONUtil.toJsonStr(moveResultMap));
         if (result1.getCode() != 200) {
             throw new ErrorException("IFS妫�楠屽悗绉诲簱澶辫触: " + result1.getMessage());
         }
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
index da12559..7ae57fc 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
@@ -895,7 +895,7 @@
         inAttrMap.put("BATCH_INFO", batchInfoData);
         String inAttr = JSONObject.toJSONString(inAttrMap);
         //璋冪敤ifs鎺ュ彛
-        Result result = ifsApiUtils.updateMoveReceiptLot(inAttr);
+        Result result = ifsApiUtils.updateMoveReceiptLot(ifsInventoryQuantity.getContract(),inAttr);
         if(result.getCode()!=200){
             throw new RuntimeException("IFS閲囪喘鎺ユ敹鏇存敼鎵瑰彿璇锋眰寮傚父锛�"+result.getMessage());
         }
@@ -917,7 +917,7 @@
         }
         //ifs鏇存敼鎵瑰彿鎺ュ彛璋冪敤鎴愬姛锛屾媺鍙栨柊鎷嗗垎鐨刬fs璁㈠崟骞舵姤妫�
         Map<String, Object> map = new HashMap<>();
-        map.put("LOCATION_NO","1302");
+//        map.put("LOCATION_NO","1302");
         map.put("STATE_DB","To be Inspected");
         map.put("PART_NO",ifsInventoryQuantity.getPartNo());
         map.put("ORDER_NO",ifsInventoryQuantity.getOrderNo());
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/task/RawMaterIalSchedule.java b/inspect-server/src/main/java/com/ruoyi/inspect/task/RawMaterIalSchedule.java
index 95fb08e..9b20551 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/task/RawMaterIalSchedule.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/task/RawMaterIalSchedule.java
@@ -24,7 +24,7 @@
     @Scheduled(fixedDelay = 1200000)
     public void getIfsOrderTiming() {
         Map<String, Object> map = new HashMap<>();
-        map.put("LOCATION_NO","1302");
+//        map.put("LOCATION_NO","1302");
         map.put("STATE_DB","To be Inspected");
         insOrderService.getIfsOrder(map,false);
     }
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/IfsOrderVO.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/IfsOrderVO.java
index 38ae11a..3289eab 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/vo/IfsOrderVO.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/IfsOrderVO.java
@@ -73,4 +73,10 @@
 
     private String lotBatchNo;
 
+    /**
+     * ifs鍩�
+     */
+    private String contract;
+
+
 }
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanVO.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanVO.java
index 65b020d..52d942c 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanVO.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsOrderPlanVO.java
@@ -9,6 +9,9 @@
 
     private Integer id;
 
+    @ApiModelProperty("IFS鍩�")
+    private String contract;
+
     @ApiModelProperty("濮旀墭缂栧彿")
     private String entrustCode;
 
diff --git a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
index d145a9b..256e792 100644
--- a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -510,6 +510,7 @@
     </select>
     <select id="selectOrderInfoById" resultType="com.ruoyi.inspect.vo.IfsOrderVO">
         select  io.*,
+                iiq.contract,
                 iiq.is_split_order,
                 iiq.order_type AS ifs_order_type,
                 iiq.part_no,
diff --git a/inspect-server/src/main/resources/mapper/InsReportMapper.xml b/inspect-server/src/main/resources/mapper/InsReportMapper.xml
index a5bc457..d0350eb 100644
--- a/inspect-server/src/main/resources/mapper/InsReportMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsReportMapper.xml
@@ -22,7 +22,8 @@
         ip.son_laboratory,
         iiq.update_batch_no,
         iiq.part_desc,
-        iiq.supplier_name
+        iiq.supplier_name,
+        iiq.contract
         from ins_report ir
         left join ins_order io on io.id = ir.ins_order_id
         LEFT JOIN ifs_inventory_quantity iiq ON iiq.id = io.ifs_inventory_id
diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
index ff26f13..c361934 100644
--- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -193,7 +193,7 @@
         ira.temp_url_pdf,
         iiq.is_copper,
         iiq.is_split_order,
-
+        iiq.contract,
         CASE
         WHEN io.ifs_inventory_id IS NOT NULL THEN iiq.update_batch_no
         ELSE io.update_batch_no
diff --git a/ruoyi-admin-ztns/src/main/resources/application-druid.yml b/ruoyi-admin-ztns/src/main/resources/application-druid.yml
index c79dc4e..0cf449c 100644
--- a/ruoyi-admin-ztns/src/main/resources/application-druid.yml
+++ b/ruoyi-admin-ztns/src/main/resources/application-druid.yml
@@ -153,12 +153,25 @@
   examiningUrl: # https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=21993616-9966-4fe4-81b0-68e99a40c964
 
 ifs:
-  contract: ZTNS
-  contract-key-get: 4ttDeLKNsZuhstjtROMcRE1USNFXKdFYE7lQ2p1m5Bo=
-  contract-key-post: 4ttDeLKNsZuhstjtROMcRE1USNFXKdFYE7lQ2p1m5Bo=
-  custorder: http://192.168.20.47/PurchService.ashx?
-  custorder-port: http://192.168.20.47:8008/PurchService.ashx?
-  erp-services: http://192.168.20.47:8081
+  props:
+    - contract: ZTNS #涓ぉ鑰愪笣鍩�
+      contract-key-get: 4ttDeLKNsZuhstjtROMcRE1USNFXKdFYE7lQ2p1m5Bo=  #get璇锋眰瀵嗛挜
+      contract-key-post: 4ttDeLKNsZuhstjtROMcRE1USNFXKdFYE7lQ2p1m5Bo= #post璇锋眰瀵嗛挜
+      custorder: http://192.168.20.47/PurchService.ashx?              #get璇锋眰鍦板潃
+      custorder-port: http://192.168.20.47:8008/PurchService.ashx?    #post璇锋眰鍦板潃
+      erp-services: http://192.168.20.47:8081                         #erp璇锋眰鍦板潃
+      tobe-inspected-location: 1302                                   #寰呮搴撲綅
+      raw-qualified-location: 1301                                    #鍘熸潗鏂欏悎鏍煎簱浣�
+      product-qualified-location: CP-02-001                           #鎴愬搧鍚堟牸搴撲綅
+    - contract: KJNS #绉戞妧鑰愪笣鍩�
+      contract-key-get: ueWGmvzoc4iR0y%2FsP6iOMeYn3ohC45KTCl3dZ94WaNk%3D #get璇锋眰瀵嗛挜
+      contract-key-post: ueWGmvzoc4iR0y/sP6iOMeYn3ohC45KTCl3dZ94WaNk=    #post璇锋眰瀵嗛挜
+      custorder: http://192.168.20.50/PurchService.ashx?                 #get璇锋眰鍦板潃
+      custorder-port: http://192.168.20.50:8008/PurchService.ashx?       #post璇锋眰鍦板潃
+      erp-services: http://192.168.20.50:8081                            #erp璇锋眰鍦板潃
+      tobe-inspected-location: A101                                      #寰呮搴撲綅
+      raw-qualified-location: A201                                       #鍘熸潗鏂欏悎鏍煎簱浣�
+      product-qualified-location: C101                                   #鎴愬搧鍚堟牸搴撲綅
 
 mes:
   ztns:
diff --git a/ruoyi-admin-ztns/src/main/resources/application-ztns.yml b/ruoyi-admin-ztns/src/main/resources/application-ztns.yml
index 17b3421..407a01a 100644
--- a/ruoyi-admin-ztns/src/main/resources/application-ztns.yml
+++ b/ruoyi-admin-ztns/src/main/resources/application-ztns.yml
@@ -154,12 +154,25 @@
   person: https://ztt-connector.ztt.cn/api/org/v1/employees/simple/
 
 ifs:
-  contract: ZTNS
-  contract-key-get: NmAkSXwoAeRF2NWF6dnsVc2O+kH2X3XuNVFbfDtnaFU=
-  contract-key-post: NmAkSXwoAeRF2NWF6dnsVc2O+kH2X3XuNVFbfDtnaFU=
-  custorder: http://192.168.20.50/PurchService.ashx?
-  custorder-port: http://192.168.20.50:8008/PurchService.ashx?
-  erp-services: http://192.168.20.50:8081
+  props:
+    - contract: ZTNS #涓ぉ鑰愪笣鍩�
+      contract-key-get: NmAkSXwoAeRF2NWF6dnsVc2O+kH2X3XuNVFbfDtnaFU=  #get璇锋眰瀵嗛挜
+      contract-key-post: NmAkSXwoAeRF2NWF6dnsVc2O+kH2X3XuNVFbfDtnaFU= #post璇锋眰瀵嗛挜
+      custorder: http://192.168.20.50/PurchService.ashx?              #get璇锋眰鍦板潃
+      custorder-port: http://192.168.20.50:8008/PurchService.ashx?    #post璇锋眰鍦板潃
+      erp-services: http://192.168.20.50:8081                         #erp璇锋眰鍦板潃
+      tobe-inspected-location: 1302                                   #寰呮搴撲綅
+      raw-qualified-location: 1301                                    #鍘熸潗鏂欏悎鏍煎簱浣�
+      product-qualified-location: CP-02-001                           #鎴愬搧鍚堟牸搴撲綅
+    - contract: KJNS #绉戞妧鑰愪笣鍩�
+      contract-key-get: ueWGmvzoc4iR0y%2FsP6iOMeYn3ohC45KTCl3dZ94WaNk%3D #get璇锋眰瀵嗛挜
+      contract-key-post: ueWGmvzoc4iR0y/sP6iOMeYn3ohC45KTCl3dZ94WaNk=    #post璇锋眰瀵嗛挜
+      custorder: http://192.168.20.50/PurchService.ashx?                 #get璇锋眰鍦板潃
+      custorder-port: http://192.168.20.50:8008/PurchService.ashx?       #post璇锋眰鍦板潃
+      erp-services: http://192.168.20.50:8081                            #erp璇锋眰鍦板潃
+      tobe-inspected-location: A101                                      #寰呮搴撲綅
+      raw-qualified-location: A201                                       #鍘熸潗鏂欏悎鏍煎簱浣�
+      product-qualified-location: C101                                   #鎴愬搧鍚堟牸搴撲綅
 
 mes:
   ztns:
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/ifs/IfsConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/ifs/IfsConfig.java
new file mode 100644
index 0000000..68d94e7
--- /dev/null
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/ifs/IfsConfig.java
@@ -0,0 +1,19 @@
+package com.ruoyi.common.config.ifs;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.List;
+
+/**
+ * 閰嶇疆鏄犲皠瀹炰綋绫�
+ */
+@Configuration
+@ConfigurationProperties(prefix = "ifs")
+@Data
+public class IfsConfig {
+
+    private List<IfsProperties> props;
+
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/IfsProperties.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/ifs/IfsProperties.java
similarity index 62%
rename from ruoyi-common/src/main/java/com/ruoyi/common/config/IfsProperties.java
rename to ruoyi-common/src/main/java/com/ruoyi/common/config/ifs/IfsProperties.java
index 451f163..91fd30e 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/config/IfsProperties.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/ifs/IfsProperties.java
@@ -1,15 +1,11 @@
-package com.ruoyi.common.config;
+package com.ruoyi.common.config.ifs;
 
 import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
 
 /**
  * @Author zhuo
  * @Date 2024/9/29
  */
-@Configuration
-@ConfigurationProperties(prefix = "ifs")
 @Data
 public class IfsProperties {
 
@@ -22,7 +18,6 @@
      * 绉橀挜-get
      */
     private String contractKeyGet;
-
 
     /**
      * 绉橀挜-post
@@ -43,4 +38,20 @@
      * 8081
      */
     private String erpServices;
+
+    /**
+     * 寰呮搴撲綅
+     */
+    private String tobeInspectedLocation;
+
+    /**
+     * 鍘熸潗鏂欏悎鏍煎簱浣�
+     */
+    private String rawQualifiedLocation;
+
+    /**
+     * 鎴愬搧鍚堟牸搴撲綅
+     */
+    private String productQualifiedLocation;
+
 }
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java
index 70551e6..a5736cc 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/api/IfsApiUtils.java
@@ -6,13 +6,15 @@
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.ruoyi.common.config.ifs.IfsConfig;
 import com.ruoyi.common.core.domain.Result;
-import com.ruoyi.common.config.IfsProperties;
+import com.ruoyi.common.config.ifs.IfsProperties;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.jetbrains.annotations.NotNull;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -25,27 +27,35 @@
 @Component
 public class IfsApiUtils {
 
-    private IfsProperties ifsProperties;
+    private IfsConfig ifsConfig;
 
+    public IfsProperties getPropByContract(String contract){
+        return ifsConfig.getProps().stream().filter(f-> StringUtils.equals(contract,f.getContract())).findFirst().orElse(new IfsProperties());
+    }
 
     /**
      * 鏌ヨ閲囪喘璁㈠崟鏈楠�
      */
-    public List<Map<String, Object>> getInventory(String inAttr) {
-        String procedureName = "QUERY_POL_RECEIPT_STD";
-        JSONObject stockMap = getJsonObject(procedureName, inAttr);
-        String body = HttpRequest.post(ifsProperties.getCustorderPort()).form(stockMap).execute().body();
-        ObjectMapper objectMapper = new ObjectMapper();
-        try {
-            Map map = objectMapper.readValue(body, Map.class);
-            List<Map<String, Object>> maps = objectMapper.readValue(JSONUtil.toJsonStr(map.get("LIST_INFO")), new TypeReference<List<Map<String, Object>>>() {
-            });
-            log.info("鑾峰彇閲囪喘璁㈠崟-->>" + maps);
-            return maps;
-        } catch (JsonProcessingException e) {
-            e.printStackTrace();
-            throw new RuntimeException(e);
-        }
+    public List<Map<String, Object>> getInventory(Map<String,Object> inAttrMap) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        ifsConfig.getProps().forEach(ifsProp->{
+            String procedureName = "QUERY_POL_RECEIPT_STD";
+            inAttrMap.put("LOCATION_NO",ifsProp.getTobeInspectedLocation());
+            String inAttr = JSONUtil.toJsonStr(inAttrMap);
+            JSONObject stockMap = getJsonObject(procedureName, inAttr,ifsProp.getContract(),ifsProp.getContractKeyPost());
+            String body = HttpRequest.post(ifsProp.getCustorderPort()).form(stockMap).execute().body();
+            ObjectMapper objectMapper = new ObjectMapper();
+            try {
+                Map map = objectMapper.readValue(body, Map.class);
+                maps.addAll(objectMapper.readValue(JSONUtil.toJsonStr(map.get("LIST_INFO")), new TypeReference<List<Map<String, Object>>>() {
+                }));
+                log.info("鑾峰彇閲囪喘璁㈠崟-->>" + maps);
+            } catch (JsonProcessingException e) {
+                e.printStackTrace();
+                throw new RuntimeException(e);
+            }
+        });
+        return maps;
     }
 
 
@@ -53,8 +63,8 @@
     /**
      * 鐧昏閲囪喘妫�楠岀粨鏋淪TD
      */
-    public Result getProcurementResults(String inAttr) {
-        return getResult("REGIST_INSPECTION_RESULTS_STD", inAttr, ifsProperties.getCustorder(), "鐧昏閲囪喘妫�楠岀粨鏋�-->");
+    public Result getProcurementResults(String contract,String inAttr) {
+        return getResult(contract,"REGIST_INSPECTION_RESULTS_STD", inAttr, "GET", "鐧昏閲囪喘妫�楠岀粨鏋�-->");
     }
 
 
@@ -64,8 +74,8 @@
      * @param inAttr
      * @return
      */
-    public Result moveReceipt(String inAttr) {
-        return getResult("MOVE_RECEIPT_STD", inAttr, ifsProperties.getCustorder(), "妫�楠屽悗绉诲簱-->");
+    public Result moveReceipt(String contract,String inAttr) {
+        return getResult(contract,"MOVE_RECEIPT_STD", inAttr, "GET", "妫�楠屽悗绉诲簱-->");
     }
 
 
@@ -75,8 +85,8 @@
      * @param inAttr
      * @return
      */
-    public Result updateMoveReceiptLot(String inAttr) {
-        return getResult("MODIFY_PURCH_RECEIPT_LOT_STD", inAttr, ifsProperties.getCustorder(), "淇敼閲囪喘璁㈠崟鎵规鍙�-->");
+    public Result updateMoveReceiptLot(String contract,String inAttr) {
+        return getResult(contract,"MODIFY_PURCH_RECEIPT_LOT_STD", inAttr, "GET", "淇敼閲囪喘璁㈠崟鎵规鍙�-->");
     }
 
 
@@ -87,8 +97,8 @@
      * @param inAttr
      * @return
      */
-    public Result getIfsStock(String inAttr) {
-        return getResult("QUERY_INVENTORY_INFO_STD", inAttr, ifsProperties.getCustorderPort(), "鏌ヨ搴撳瓨淇℃伅-->");
+    public Result getIfsStock(String contract,String inAttr) {
+        return getResult(contract,"QUERY_INVENTORY_INFO_STD", inAttr, "POST", "鏌ヨ搴撳瓨淇℃伅-->");
     }
 
     /**
@@ -97,25 +107,28 @@
      * @param inAttr
      * @return
      */
-    public Result importPartLotAttr(String inAttr) {
-        return getResult("IMPORT_PART_LOT_ATTR_STD", inAttr, ifsProperties.getCustorder(), "搴撳瓨鐗╂枡鎵规灞炴�ф柊澧炰慨鏀规帴鍙�-->");
+    public Result importPartLotAttr(String contract,String inAttr) {
+        return getResult(contract,"IMPORT_PART_LOT_ATTR_STD", inAttr, "GET", "搴撳瓨鐗╂枡鎵规灞炴�ф柊澧炰慨鏀规帴鍙�-->");
     }
 
     /**
      * 閫氱敤鎺ュ彛
+     * @param contract IFS鍩�
      * @param procedureName 鏂规硶鍚�
      * @param inAttr  浼犲弬
-     * @param url 鍦板潃
+     * @param urlType 璇锋眰绫诲瀷锛圙ET/POST锛�
      * @param image 娑堟伅
      * @return
      */
-    private Result<?> getResult(String procedureName, String inAttr, String url, String image) {
+    private Result<?> getResult(String contract,String procedureName, String inAttr, String urlType, String image) {
+        IfsProperties ifsProperties = getPropByContract(contract);
         JSONObject stockMap = new JSONObject();
         stockMap.put("procedureName", procedureName);
         stockMap.put("contract", ifsProperties.getContract());
         stockMap.put("contractKey", ifsProperties.getContractKeyPost());
         stockMap.put("userId", "lims_user");
         stockMap.put("inAttr", inAttr);
+        String url = StringUtils.equals("GET",urlType)?ifsProperties.getCustorder():ifsProperties.getCustorderPort();
         String body = HttpRequest.post(url).form(stockMap).execute().body();
         log.info(image + body);
         ObjectMapper objectMapper = new ObjectMapper();
@@ -139,11 +152,11 @@
      * @param inAttr             璇锋眰鍙傛暟
      * @return
      */
-    private JSONObject getJsonObject(String procedureName, String inAttr) {
+    private JSONObject getJsonObject(String procedureName, String inAttr,String contract,String contractKeyPost) {
         JSONObject stockMap = new JSONObject();
         stockMap.put("procedureName", procedureName);
-        stockMap.put("contract", ifsProperties.getContract());
-        stockMap.put("contractKey", ifsProperties.getContractKeyPost());
+        stockMap.put("contract", contract);
+        stockMap.put("contractKey", contractKeyPost);
         stockMap.put("userId", "lims_user");
         stockMap.put("inAttr", inAttr);
         return stockMap;

--
Gitblit v1.9.3