فهرست منبع

立体仓库对接优化

shenjingwei 6 ماه پیش
والد
کامیت
915f4bfd98
3فایلهای تغییر یافته به همراه27 افزوده شده و 4 حذف شده
  1. 2 2
      src/custom/beans/wms/Wms.java
  2. 13 1
      src/custom/service/GetOutCodeFromMQWms.java
  3. 12 1
      src/custom/service/GetOutCodeFromTQWms.java

+ 2 - 2
src/custom/beans/wms/Wms.java

@@ -114,7 +114,7 @@ public class Wms {
             sqlist.add(SQL);
         }
         tqwms.runSqlUpdate(sqlist);
-        SQLFactory.createUpdateSQL(controller, "st_stockbill_items").setValue("wmsuploadflag", 2).setWhere("st_stockbill_itemsid", stockbillitemsRows.toArrayList("st_stockbill_itemsid"));
+        SQLFactory.createUpdateSQL(controller, "st_stockbill_items").setValue("wmsuploadflag", 2).setWhere("st_stockbill_itemsid", stockbillitemsRows.toArrayList("st_stockbill_itemsid")).update();
     }
 
     /**
@@ -146,7 +146,7 @@ public class Wms {
             sqlist.add(SQL);
         }
         mqwms.runSqlUpdate(sqlist);
-        SQLFactory.createUpdateSQL(controller, "st_stockbill_items").setValue("wmsuploadflag", 2).setWhere("st_stockbill_itemsid", stockbillitemsRows.toArrayList("st_stockbill_itemsid"));
+        SQLFactory.createUpdateSQL(controller, "st_stockbill_items").setValue("wmsuploadflag", 2).setWhere("st_stockbill_itemsid", stockbillitemsRows.toArrayList("st_stockbill_itemsid")).update();;
     }
 
 

+ 13 - 1
src/custom/service/GetOutCodeFromMQWms.java

@@ -5,6 +5,7 @@ import common.YosException;
 import common.data.*;
 import common.data.db.DBConnect;
 
+import java.util.ArrayList;
 import java.util.Calendar;
 
 public class GetOutCodeFromMQWms extends ServiceController {
@@ -76,14 +77,25 @@ public class GetOutCodeFromMQWms extends ServiceController {
                 String status = billrow.getString("status");
                 boolean iswx = billrow.getBoolean("iswx");
                 long stockid = entity.equals("实业") ? stockRowsMap.get(coderow.getString("stockno")).get(0).getLong("stockid") : stockRowsMap.get("101").get(0).getLong("stockid");
+                long itemid = coderow.getLong("itemid");
+
+                ArrayList<Long> stockbill_itemsids = dbConnect.runSqlQuery("select t.st_stockbill_itemsid,sum(t.qty)as qty,sum(t.skucount)as skucount from (\n" +
+                        "select st_stockbill_itemsid,qty,0 as skucount from st_stockbill_items t1 where st_stockbillid=" + st_stockbillid + " and wmsuploadflag=2 and itemid=" + itemid + "\n" +
+                        "union all\n" +
+                        "select st_stockbill_itemsid,0,1 as skucount from st_stockbill_items_sku where st_stockbillid=" + st_stockbillid + " and itemid=" + itemid + " and ifnull(st_stockbill_itemsid,0)>0 \n" +
+                        ")t group by t.st_stockbill_itemsid having sum(t.qty)>sum(t.skucount)").toArrayList("st_stockbill_itemsid", new ArrayList<>());
+
 
                 SQLDump sqlDump = new SQLDump();
                 //创建入库单序列号
                 InsertSQL stStockbillItemsSku = SQLFactory.createInsertSQL(dbConnect, "st_stockbill_items_sku");
                 stStockbillItemsSku.setValue("siteid", "MD");
                 stStockbillItemsSku.setValue("createby", "WMS");
-                stStockbillItemsSku.setValue("itemid", coderow.getLong("itemid"));
+                stStockbillItemsSku.setValue("itemid", itemid);
                 stStockbillItemsSku.setValue("st_stockbillid", st_stockbillid);
+                if (!stockbill_itemsids.isEmpty()) {
+                    stStockbillItemsSku.setValue("st_stockbill_itemsid", stockbill_itemsids.get(0));
+                }
                 stStockbillItemsSku.setValue("stockid", stockid);
                 stStockbillItemsSku.setValue("sku", sku);
                 sqlDump.add(stStockbillItemsSku);

+ 12 - 1
src/custom/service/GetOutCodeFromTQWms.java

@@ -70,14 +70,25 @@ public class GetOutCodeFromTQWms extends ServiceController {
                 String status = billrow.getString("status");
                 boolean iswx = billrow.getBoolean("iswx");
                 long stockid = entity.equals("实业") ? stockRowsMap.get(coderow.getString("stockno")).get(0).getLong("stockid") : stockRowsMap.get("101").get(0).getLong("stockid");
+                long itemid = coderow.getLong("itemid");
+
+
+                ArrayList<Long> stockbill_itemsids = dbConnect.runSqlQuery("select t.st_stockbill_itemsid,sum(t.qty)as qty,sum(t.skucount)as skucount from (\n" +
+                        "select st_stockbill_itemsid,qty,0 as skucount from st_stockbill_items t1 where st_stockbillid=" + st_stockbillid + " and wmsuploadflag=2 and itemid=" + itemid + "\n" +
+                        "union all\n" +
+                        "select st_stockbill_itemsid,0,1 as skucount from st_stockbill_items_sku where st_stockbillid=" + st_stockbillid + " and itemid=" + itemid + " and ifnull(st_stockbill_itemsid,0)>0 \n" +
+                        ")t group by t.st_stockbill_itemsid having sum(t.qty)>sum(t.skucount)").toArrayList("st_stockbill_itemsid", new ArrayList<>());
 
                 SQLDump sqlDump = new SQLDump();
                 //创建入库单序列号
                 InsertSQL stStockbillItemsSku = SQLFactory.createInsertSQL(dbConnect, "st_stockbill_items_sku");
                 stStockbillItemsSku.setValue("siteid", "MD");
                 stStockbillItemsSku.setValue("createby", "WMS");
-                stStockbillItemsSku.setValue("itemid", coderow.getLong("itemid"));
+                stStockbillItemsSku.setValue("itemid", itemid);
                 stStockbillItemsSku.setValue("st_stockbillid", st_stockbillid);
+                if (!stockbill_itemsids.isEmpty()) {
+                    stStockbillItemsSku.setValue("st_stockbill_itemsid", stockbill_itemsids.get(0));
+                }
                 stStockbillItemsSku.setValue("stockid", stockid);
                 stStockbillItemsSku.setValue("sku", sku);
                 sqlDump.add(stStockbillItemsSku);