From 7cd93b02f4c08a829c7f3aa14ae715b40f70e77c Mon Sep 17 00:00:00 2001
From: 18516761980 <tqsxp@163.com>
Date: 星期六, 04 二月 2023 09:48:51 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/ints/task/scheduler/ErpDetTbScheduler.java |   30 +++++++++++++++++++++++-------
 src/main/java/com/zy/ints/entity/ErpDetTb.java                  |    6 +++---
 src/main/java/com/zy/common/service/CommonService.java          |    2 +-
 src/main/java/com/zy/ints/entity/ErpDetTbBak.java               |    2 +-
 4 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index c149378..f92cbe4 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -291,7 +291,7 @@
         //20230203娣诲姞  lfd鏂欑搴撴牴鎹緭閫佺嚎绛涢�夊叆搴�
         if (!Cools.isEmpty(locMast) && locMast.getCrnNo()<5){
             int wrkMastsC0 = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", locMast.getCrnNo()).eq("io_type",1));
-            if (wrkMastsC0>3){
+            if (wrkMastsC0>3 && times < rowCount){
                 BasCrnp basCrnp1 = basCrnpService.selectById(1);
                 if (basCrnp1.getInEnable().equals("Y") && basCrnp1.getCrnSts().equals(3)){
                     int wrkMastsC1 = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", 1).eq("io_type",1));
diff --git a/src/main/java/com/zy/ints/entity/ErpDetTb.java b/src/main/java/com/zy/ints/entity/ErpDetTb.java
index c8baf23..2ba895b 100644
--- a/src/main/java/com/zy/ints/entity/ErpDetTb.java
+++ b/src/main/java/com/zy/ints/entity/ErpDetTb.java
@@ -55,7 +55,7 @@
 
     @ApiModelProperty(value = "澧炲噺绗﹀彿:1锛堝姞锛屽叆搴擄級銆�2锛堝噺锛屽嚭搴擄級")
     @TableField("ADD_ID")
-    private int addId2;
+    private Integer addId2;
 
     /**
      * 鏁伴噺
@@ -125,7 +125,7 @@
     public ErpDetTb() {
     }
 
-    public ErpDetTb(String billNo, String prdNo, String iokindid, int itm, int addId2, String addId, Double qty, String prdMark, String wh, Date billdate, Integer status, String temp1, String temp2, String temp3) {
+    public ErpDetTb(String billNo, String prdNo, String iokindid, int itm, Integer addId2, String addId, Double qty, String prdMark, String wh, Date billdate, Integer status, String temp1, String temp2, String temp3) {
         this.billNo = billNo;
         this.prdNo = prdNo;
         this.iokindid = iokindid;
@@ -142,7 +142,7 @@
         this.temp3 = temp3;
     }
 
-    public ErpDetTb(String billNo, String prdNo, int itm, int addId2, Double qty, String prdMark, String wh, Date billdate, Integer status, String temp1, String temp2, String temp3) {
+    public ErpDetTb(String billNo, String prdNo, int itm, Integer addId2, Double qty, String prdMark, String wh, Date billdate, Integer status, String temp1, String temp2, String temp3) {
         this.billNo = billNo;
         this.prdNo = prdNo;
         this.itm = itm;
diff --git a/src/main/java/com/zy/ints/entity/ErpDetTbBak.java b/src/main/java/com/zy/ints/entity/ErpDetTbBak.java
index 77c9f87..fd9cfe4 100644
--- a/src/main/java/com/zy/ints/entity/ErpDetTbBak.java
+++ b/src/main/java/com/zy/ints/entity/ErpDetTbBak.java
@@ -55,7 +55,7 @@
 
     @ApiModelProperty(value = "澧炲噺绗﹀彿:1锛堝姞锛屽叆搴擄級銆�2锛堝噺锛屽嚭搴擄級")
     @TableField("ADD_ID")
-    private int addId2;
+    private Integer addId2;
 
     /**
      * 鏁伴噺
diff --git a/src/main/java/com/zy/ints/task/scheduler/ErpDetTbScheduler.java b/src/main/java/com/zy/ints/task/scheduler/ErpDetTbScheduler.java
index 7fca83c..19d2cd7 100644
--- a/src/main/java/com/zy/ints/task/scheduler/ErpDetTbScheduler.java
+++ b/src/main/java/com/zy/ints/task/scheduler/ErpDetTbScheduler.java
@@ -72,8 +72,13 @@
                     if (status == 0) {
                         Mat mat = matService.selectByMatnr(erpDetTb.getPrdNo());
                         if (Cools.isEmpty(mat)) {
-                            erpSqlServer.update(sqlUpDateErpDetTbTwo + ",Temp1='鍝佸彿淇℃伅鍦ㄧ珛搴撲笉瀛樺湪锛岃鍏堟坊鍔犲晢鍝侊紒锛侊紒'" + "where 1=1 and PRD_NO=" + "'" + erpDetTb.getPrdNo() + "'");
-                            callApiLogSave(erpDetTb, "ERP_DETTB", "鍝佸彿淇℃伅鍦ㄧ珛搴撲笉瀛樺湪锛岃鍏堟坊鍔犲晢鍝侊紒锛侊紒", false);
+                            if(Cools.isEmpty(erpDetTb.getTemp1())){
+                                erpSqlServer.update(sqlUpDateErpDetTbTwo + ",Temp1='鍝佸彿淇℃伅鍦ㄧ珛搴撲笉瀛樺湪锛岃鍏堟坊鍔犲晢鍝侊紒锛侊紒'" + "where 1=1 "
+                                        +" and PRD_NO=" + "'" + erpDetTb.getPrdNo() + "'"
+                                        +" and ITM=" + "'" + erpDetTb.getItm() + "'"
+                                        +" and BIL_NO=" + "'" + erpDetTb.getBillNo() + "'");
+                                callApiLogSave(erpDetTb, "ERP_DETTB", "鍝佸彿淇℃伅鍦ㄧ珛搴撲笉瀛樺湪锛岃鍏堟坊鍔犲晢鍝侊紒锛侊紒", false);
+                            }
                         } else {
                             Order order = orderService.selectByNo(erpDetTb.getBillNo());
                             if (Cools.isEmpty(order)) {
@@ -113,8 +118,8 @@
                                         now,    // 淇敼鏃堕棿
                                         null    // 澶囨敞
                                 );
-                                String InAndOut = erpDetTb.getAddId2()==2 ? "锛堝嚭搴擄級" : "锛堝叆搴擄級";
-                                DocType docType = docTypeService.selectOrAdd("ERP璁㈠崟"+InAndOut, erpDetTb.getAddId2()==1);
+                                String InAndOut = erpDetTb.getAddId2().equals(2) ? "锛堝嚭搴擄級" : "锛堝叆搴擄級";
+                                DocType docType = docTypeService.selectOrAdd("ERP璁㈠崟"+InAndOut, erpDetTb.getAddId2().equals(1));
                                 if (!Cools.isEmpty(docType)) {
                                     order.setDocType(docType.getDocId());
                                     if (!orderService.insert(order)) {
@@ -150,8 +155,13 @@
                                         erpSqlServer.update(sqlUpDateErpDetTbOne + "'" + erpDetTb.getPrdNo() + "'");
                                         callApiLogSave(erpDetTb, "ERP_DETTB", "鎺ユ敹ERP涓嬪彂璁㈠崟鎺ユ敹鎴愬姛锛侊紒", true);
                                     } else {
-                                        erpSqlServer.update(sqlUpDateErpDetTbTwo + ",temp1='娣诲姞璁㈠崟鏄庣粏妗eけ璐ワ紒锛侊紒'" + "where 1=1 and PRD_NO=" + "'" + erpDetTb.getPrdNo() + "'");
-                                        callApiLogSave(erpDetTb, "ERP_DETTB", "ERP涓嬪彂璁㈠崟鎺ユ敹澶辫触锛侊紒", false);
+                                        if (Cools.isEmpty(erpDetTb.getTemp2())){
+                                            erpSqlServer.update(sqlUpDateErpDetTbTwo + ",temp2='娣诲姞璁㈠崟鏄庣粏妗eけ璐ワ紒锛侊紒'" + "where 1=1 "
+                                                    +" and PRD_NO=" + "'" + erpDetTb.getPrdNo() + "'"
+                                                    +" and ITM=" + "'" + erpDetTb.getItm() + "'"
+                                                    +" and BIL_NO=" + "'" + erpDetTb.getBillNo() + "'");
+                                            callApiLogSave(erpDetTb, "ERP_DETTB", "ERP涓嬪彂璁㈠崟鎺ユ敹澶辫触锛侊紒", false);
+                                        }
                                     }
                                 }
                             }
@@ -185,7 +195,13 @@
 //                        callApiLogSave(erpDetTb, "ERP_DETTB", "ERP涓嬪彂璁㈠崟澶囦唤鍚庡垹闄ゆ垚鍔燂紒锛�", true);
 
                     } else {
-                        callApiLogSave(erpDetTb, "ERP_DETTB", "鎺ユ敹ERP涓嬪彂璁㈠崟澶辫触锛侊紒锛佺姸鎬佸紓甯革紒锛侊紒", false);
+                        if (Cools.isEmpty(erpDetTb.getTemp1()) && Cools.isEmpty(erpDetTb.getTemp2()) && Cools.isEmpty(erpDetTb.getTemp3())){
+                            erpSqlServer.update(sqlUpDateErpDetTbTwo + ",Temp1='鎺ユ敹ERP涓嬪彂璁㈠崟澶辫触锛侊紒锛佺姸鎬佸紓甯革紒锛侊紒璇稥RP銆佺珛搴撳弻鏂瑰崗鍔╄В鍐炽��'" + "where 1=1 "
+                                    +" and PRD_NO=" + "'" + erpDetTb.getPrdNo() + "'"
+                                    +" and ITM=" + "'" + erpDetTb.getItm() + "'"
+                                    +" and BIL_NO=" + "'" + erpDetTb.getBillNo() + "'");
+                            callApiLogSave(erpDetTb, "ERP_DETTB", "鎺ユ敹ERP涓嬪彂璁㈠崟澶辫触锛侊紒锛佺姸鎬佸紓甯革紒锛侊紒", false);
+                        }
                     }
                 }
             }

--
Gitblit v1.9.1