From 71ca7c6fb00de749b2ba2180f1cc04e35574eb19 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期一, 21 七月 2025 15:44:12 +0800
Subject: [PATCH] 1

---
 src/main/java/com/zy/third/lk/task/LKInTBScheduler.java |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/zy/third/lk/task/LKInTBScheduler.java b/src/main/java/com/zy/third/lk/task/LKInTBScheduler.java
index 5eb0b41..3fe2ef9 100644
--- a/src/main/java/com/zy/third/lk/task/LKInTBScheduler.java
+++ b/src/main/java/com/zy/third/lk/task/LKInTBScheduler.java
@@ -1,11 +1,11 @@
 package com.zy.third.lk.task;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.core.common.Cools;
 import com.core.common.DateUtils;
 import com.core.exception.CoolException;
 import com.zy.asrs.entity.DocType;
-import com.zy.asrs.entity.Mat;
 import com.zy.asrs.entity.Order;
 import com.zy.asrs.entity.OrderDetl;
 import com.zy.asrs.service.DocTypeService;
@@ -93,11 +93,9 @@
      */
     @Transactional(rollbackFor = Throwable.class)
     public boolean insertInDet(OrderDetl orderDetl) {
-        String sqlInDetTb = "select * from lk_InDetTB where BillNo='" + orderDetl.getOrderNo() + "' and " +
-                " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
+        String sqlInDetTb = "select * from lk_InDetTB where BillNo='" + orderDetl.getOrderNo() + "' and " + " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
         List<InDetTB> inDets = erpSqlServer.select(sqlInDetTb, InDetTB.class);
-        String sqlInDetTbBak = "select * from lk_InDetTB_Bak where BillNo='" + orderDetl.getOrderNo() + "' and " +
-                " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
+        String sqlInDetTbBak = "select * from lk_InDetTB_Bak where BillNo='" + orderDetl.getOrderNo() + "' and " + " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
         List<InDetTBBak> inDetBaks = erpSqlServer.select(sqlInDetTbBak, InDetTBBak.class);
         if (!inDets.isEmpty() || !inDetBaks.isEmpty()) {
             log.error("璇ュ崟鍙锋枡鍙蜂腑闂磋〃琛ㄨ韩宸插瓨鍦�:" + orderDetl.getOrderNo() + "==>>" + orderDetl.getOrderNo());
@@ -111,7 +109,7 @@
             return true;
         } else {
             log.error("鍏ュ簱鍥炰紶澶辫触,瀹炰綋绫绘墦鍗�:{}", content);
-            return false;
+            throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
         }
 
     }
@@ -154,7 +152,7 @@
             return true;
         } else {
             log.error("鍏ュ簱鍗曡〃澶村洖浼犲け璐�:" + content);
-            return false;
+            throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
         }
     }
 
@@ -166,11 +164,9 @@
      */
     @Transactional(rollbackFor = Throwable.class)
     public boolean insertOutDet(OrderDetl orderDetl) {
-        String sqlInDetTb = "select * from lk_OutDetTB where BillNo='" + orderDetl.getOrderNo() + "' and " +
-                " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
+        String sqlInDetTb = "select * from lk_OutDetTB where BillNo='" + orderDetl.getOrderNo() + "' and " + " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
         List<OutDetTB> inDets = erpSqlServer.select(sqlInDetTb, OutDetTB.class);
-        String sqlInDetTbBak = "select * from lk_OutDetTB_Bak where BillNo='" + orderDetl.getOrderNo() + "' and " +
-                " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
+        String sqlInDetTbBak = "select * from lk_OutDetTB_Bak where BillNo='" + orderDetl.getOrderNo() + "' and " + " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
         List<OutDetTBBak> inDetBaks = erpSqlServer.select(sqlInDetTbBak, OutDetTBBak.class);
         if (!inDets.isEmpty() || !inDetBaks.isEmpty()) {
             log.error("璇ュ崟鍙锋枡鍙蜂腑闂磋〃琛ㄨ韩宸插瓨鍦�:" + orderDetl.getOrderNo() + "==>>" + orderDetl.getOrderNo());
@@ -184,7 +180,7 @@
             return true;
         } else {
             log.error("鍏ュ簱鍥炰紶澶辫触,瀹炰綋绫绘墦鍗�:" + content.toString());
-            return false;
+            throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
         }
 
     }
@@ -227,7 +223,7 @@
             return true;
         } else {
             log.error("鍏ュ簱鍗曡〃澶村洖浼犲け璐�:" + content);
-            return false;
+            throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
         }
     }
 
@@ -242,7 +238,14 @@
         if (!Cools.isEmpty(orderDetl.getProType())) content.put("proType", "'" + orderDetl.getProType() + "'");
         if (!Cools.isEmpty(orderDetl.getMemo())) content.put("remark", "'" + orderDetl.getMemo() + "'");
         if (!Cools.isEmpty(orderDetl.getOutOrderNo())) content.put("OrderNo", "'" + orderDetl.getOutOrderNo() + "'");
-        if (!Cools.isEmpty(orderDetl.getQty())) content.put("MainNum", orderDetl.getQty());
+        if (!Cools.isEmpty(orderDetl.getQty())) {
+            if (orderDetl.getQty() > orderDetl.getAnfme() && orderDetl.getQty() > orderDetl.getWorkQty()) {
+                log.info("淇閿欒鏁伴噺锛歿}", JSON.toJSON(orderDetl));
+                content.put("MainNum", orderDetl.getWorkQty());
+            } else {
+                content.put("MainNum", orderDetl.getQty());
+            }
+        }
         if (!Cools.isEmpty(orderDetl.getWareId())) content.put("WareId", "'" + orderDetl.getWareId() + "'");
         if (!Cools.isEmpty(orderDetl.getWareName())) content.put("WareName", "'" + orderDetl.getWareName() + "'");
         if (!Cools.isEmpty(orderDetl.getPacking())) content.put("Packing", "'" + orderDetl.getPacking() + "'");

--
Gitblit v1.9.1