From b09865e3b4e43ec7110ca7472188478fcdb6fb0f Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期三, 22 三月 2023 09:41:32 +0800
Subject: [PATCH] #库存档案同步上报

---
 src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
index 3c49116..0506530 100644
--- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -67,6 +67,8 @@
 
     @Value("${mes.inPath}")
     private String inpath;
+    @Value("${mes.url}")
+    private String mesUrl;
 
     @Override
     @Transactional
@@ -594,11 +596,24 @@
             throw new CoolException("閲嶅鐢宠" + param.getPackNo());
         }
 
-        // 鐢熸垚鍏ュ簱閫氱煡妗�
-//        Mat mat = matService.selectByMatnr(param.getPackName());
-//        if (Cools.isEmpty(mat)) {
+//         鐢熸垚鍏ュ簱閫氱煡妗�
+        Mat mat = matService.selectByMatnr(param.getPackName());
+        if (Cools.isEmpty(mat)) {
+            Tag tag = tagService.selectByName("鍏ㄩ儴", 1);
+            Mat matNew = new Mat();
+            matNew.setTagId(tag.getId());
+            matNew.setMatnr(param.getPackName());
+            matNew.setMaktx(param.getPackName());
+            matNew.setDeadWarn(param.getSettingTimes());
+            matNew.setCreateBy(9999L);//9999琛ㄧずerp涓嬪彂
+            matNew.setCreateTime(new Date());
+            matNew.setUpdateBy(9999L);//9999琛ㄧずerp涓嬪彂
+            matNew.setUpdateTime(new Date());
+            if (!matService.insert(matNew)){
+                throw new CoolException(param.getPackName() + "鍟嗗搧妗f鑷姩鐢熸垚澶辫触");
+            }
 //            throw new CoolException(param.getPackName() + "鍟嗗搧妗f涓嶅瓨鍦�");
-//        }
+        }
         WaitPakin waitPakin = new WaitPakin();
 //        waitPakin.sync(mat);
         waitPakin.setMatnr(param.getPackName());
@@ -700,7 +715,7 @@
                     combParam.setLocNo(locMast.getLocNo());
                     combParam.setPackSts(7);
                     combParam.setRequestTime(DateUtils.convert(new Date()));
-                    new PostMesDataUtils().postMesData(inpath,combParam);
+                    new PostMesDataUtils().postMesData("MES绯荤粺",mesUrl,inpath,combParam);
 
                     if (!locMastService.updateById(locMast)) {
                         throw new CoolException("棰勭害搴撲綅鐘舵�佸け璐ワ紝搴撲綅鍙凤細"+locMast.getLocNo());
@@ -751,7 +766,7 @@
                 combParam.setLocNo(locMast.getLocNo());
                 combParam.setPackSts(2);
                 combParam.setRequestTime(DateUtils.convert(new Date()));
-                new PostMesDataUtils().postMesData(inpath,combParam);
+                new PostMesDataUtils().postMesData("MES绯荤粺",mesUrl,inpath,combParam);
 
                 if (!locMastService.update(locMast,new EntityWrapper<LocMast>().eq("loc_no", review.getLocNo()))){
                     throw new CoolException("鏇存柊浜у搧鐘舵�佸け璐�");
@@ -793,7 +808,7 @@
                 combParam.setLocNo(locMast.getLocNo());
                 combParam.setPackSts(3);
                 combParam.setRequestTime(DateUtils.convert(new Date()));
-                new PostMesDataUtils().postMesData(inpath,combParam);
+                new PostMesDataUtils().postMesData("MES绯荤粺",mesUrl,inpath,combParam);
 
                 if (!locMastService.update(locMast, new EntityWrapper<LocMast>().eq("loc_no", review.getLocNo()))){
                     throw new CoolException("鏇存敼浜у搧鐘舵�佸け璐�");
@@ -834,7 +849,7 @@
                 combParam.setLocNo(locMast.getLocNo());
                 combParam.setPackSts(4);
                 combParam.setRequestTime(DateUtils.convert(new Date()));
-                new PostMesDataUtils().postMesData(inpath,combParam);
+                new PostMesDataUtils().postMesData("MES绯荤粺",mesUrl,inpath,combParam);
 
                 if (!locMastService.update(locMast, new EntityWrapper<LocMast>().eq("loc_no", review.getLocNo()))){
                     throw new CoolException("鏇存敼浜у搧鐘舵�佸け璐�");

--
Gitblit v1.9.1