From 1ea41a22eadfb3eef3d434bef7d2efff3bae331c Mon Sep 17 00:00:00 2001
From: ytfl <ytfl@qq.com>
Date: 星期日, 15 六月 2025 17:18:27 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/ReportToThirdServiceImpl.java |   85 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 72 insertions(+), 13 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/ReportToThirdServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/ReportToThirdServiceImpl.java
index 101437c..507c554 100644
--- a/src/main/java/com/zy/asrs/service/impl/ReportToThirdServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/ReportToThirdServiceImpl.java
@@ -16,6 +16,7 @@
 import com.zy.asrs.service.StoreTypeService;
 import com.zy.nc.SendUtil;
 import com.zy.nc.entity.*;
+import com.zy.nc.service.NccSaleXsfhmxWmsService;
 import com.zy.nc.service.NccScPcdaWmsService;
 import com.zy.nc.util.NcResultMessage;
 import com.zy.nc.vo.*;
@@ -44,6 +45,9 @@
 
     @Autowired
     private NccScPcdaWmsService nccScPcdaWmsService;
+
+    @Autowired
+    private NccSaleXsfhmxWmsService nccSaleXsfhmxWmsService;
 
     @Value("${NYNC.ip}")
     private String nyncIp;
@@ -114,17 +118,19 @@
                     }
                     break;
                 case "閲囪喘鍒拌揣":
-                    process1 = processCGDH(orderDetls);
-                    List<Object> cg = new ArrayList<>();
-                    cg.add(process1);
-                    //鍙戦�佽姹�
-                    response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, purchasein, JSONObject.toJSONString(cg));
-                    if (!Cools.isEmpty(response) && response.isSuccess()) {
-                        log.info("閲囪喘鍒拌揣response:{}", response);
-                        step = 10;
-                    } else {
-                        remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100);
-                    }
+                    //涓嶉渶瑕佷笂鎶ヤ簡
+                    step = 10;
+//                    process1 = processCGDH(orderDetls);
+//                    List<Object> cg = new ArrayList<>();
+//                    cg.add(process1);
+//                    //鍙戦�佽姹�
+//                    response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, purchasein, JSONObject.toJSONString(cg));
+//                    if (!Cools.isEmpty(response) && response.isSuccess()) {
+//                        log.info("閲囪喘鍒拌揣response:{}", response);
+//                        step = 10;
+//                    } else {
+//                        remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100);
+//                    }
                     break;
                 case "杞簱-鍑哄簱":
                     if (step == 1) {
@@ -198,6 +204,20 @@
 
     }
 
+    @Override
+    public boolean reportTkrk(String matnr, String batch, String orderNo, Double anfme) {
+        Object process1 = processTKRK(matnr, batch, orderNo, anfme);
+        //鍙戦�佽姹�
+        NcResultMessage response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(process1));
+        log.info("閫�搴撳叆搴搑esponse:{}", response);
+        if (!Cools.isEmpty(response) && response.isSuccess()) {
+            log.info("閫�搴撳叆搴搑esponse:{}", response);
+            return true;
+        } else {
+//            remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100);
+            return false;
+        }
+    }
 
     private Object processXSFH(List<OrderDetl> orderDetls, Boolean flag) {
         //缁勮瀵硅薄鏁版嵁
@@ -233,6 +253,44 @@
             saleOutBodyVO.setNnum(flag ? -orderDetl.getQty() : orderDetl.getQty());
             saleOutBodyVOList.add(saleOutBodyVO);
         }
+        data.put("SaleOutHeadVO", saleOutHeadVO);
+        data.put("SaleOutBodyVO", saleOutBodyVOList);
+        return data;
+    }
+
+    private Object processTKRK(String matnr,String batch, String orderNo, Double anfme) {
+//        EntityWrapper<NccXsckmxTkWms> wrapper = new EntityWrapper<>();
+//        wrapper.eq("VBATCHCODE", batch).eq("VSOURCEBILLCODE", orderNo);
+//        NccXsckmxTkWms nccXsckmxTkWms = nccXsckmxTkWmsService.selectOne(wrapper);
+//        if (null == nccXsckmxTkWms) {
+//            throw new CoolException("鏈壘鍒版鏉$爜");
+//        }
+
+        NccSaleXsfhmxWms nccSaleXsfhmxWms = nccSaleXsfhmxWmsService.selectOne(new EntityWrapper<NccSaleXsfhmxWms>()
+                .eq("VBILLCODE", orderNo)
+                .eq("WLBM", matnr)
+        );
+        if(null == nccSaleXsfhmxWms) {
+            throw new CoolException("鏈壘鍒伴攢鍞崟鎹�");
+        }
+
+        //缁勮瀵硅薄鏁版嵁
+        Map<String, Object> data = new HashMap<String, Object>();
+        SaleOutHeadVO saleOutHeadVO = new SaleOutHeadVO();
+        saleOutHeadVO.setPk_org("FYT");
+        SaleOutBodyVO saleOutBodyVO = null;
+        List<SaleOutBodyVO> saleOutBodyVOList = new ArrayList<>();
+
+        saleOutBodyVO = new SaleOutBodyVO();
+        saleOutBodyVO.setCsourcetype("4331");
+        saleOutBodyVO.setCsourcebillbid(nccSaleXsfhmxWms.getCdeliverybid());
+        saleOutBodyVO.setCsourcebillhid(nccSaleXsfhmxWms.getCdeliveryid());
+        saleOutHeadVO.setCwarehouseid(nccSaleXsfhmxWms.getFhckbm());
+
+        saleOutBodyVO.setVbatchcode(batch);
+        saleOutBodyVO.setNnum(anfme * -1);
+        saleOutBodyVOList.add(saleOutBodyVO);
+
         data.put("SaleOutHeadVO", saleOutHeadVO);
         data.put("SaleOutBodyVO", saleOutBodyVOList);
         return data;
@@ -345,7 +403,7 @@
             }
 
             whsTransBillBodyVO = new WhsTransBillBodyVO();
-            whsTransBillBodyVO.setCstateid(nccScPcdaWms.getVcode());
+            whsTransBillBodyVO.setCstateid(nccScPcdaWms.getPkBatchcode());
 
             String remark = orderDetl.getRemark();
             //if (!Cools.isEmpty(remark)) {
@@ -403,7 +461,8 @@
             generalout_b.setCotherwhid(rukucangku);
             generalout_b.setCothercalbodyvid(storeType2.getDepartmentId());
 
-            generalout_b.setNshouldassistnum(orderDetl.getQty());
+            //generalout_b.setNshouldassistnum(orderDetl.getQty());
+            generalout_b.setNnum(orderDetl.getQty());
             generalout_b.setVbatchcode(orderDetl.getBatch());
             ic_purchasein_bs.add(generalout_b);
         }

--
Gitblit v1.9.1