소스 검색

谈桥立体仓库优化

shenjingwei 4 달 전
부모
커밋
3c7bcfcc40
1개의 변경된 파일16개의 추가작업 그리고 3개의 파일을 삭제
  1. 16 3
      src/custom/beans/wms/Wms.java

+ 16 - 3
src/custom/beans/wms/Wms.java

@@ -1,5 +1,6 @@
 package beans.wms;
 
+import camundajar.impl.scala.Int;
 import common.BaseClass;
 import common.Controller;
 import common.YosException;
@@ -7,6 +8,7 @@ import common.data.*;
 import common.data.db.DBConnect;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 
 /**
  * 立体仓库对接
@@ -110,9 +112,20 @@ public class Wms {
         Rows rows = tqwms.runSqlQuery("select top(1) OutPlanID from TOutInt where BillNo='" + billno + "' order by CreateDate desc ");
         long OutPlanID = rows.get(0).getLong("OutPlanID");
 
+        HashMap<String, Integer> itemMap = new HashMap<>();
+        for (Row stockbillitemsRow : stockbillitemsRows) {
+            String itemno = stockbillitemsRow.getString("itemno");
+            int qty = stockbillitemsRow.getInteger("qty");
+            if (itemMap.containsKey(itemno)) {
+                itemMap.put(itemno, itemMap.get(itemno) + qty);
+            } else {
+                itemMap.put(itemno, qty);
+            }
+        }
+
         String createdate = BaseClass.getDateTime_Str();
         ArrayList<String> sqlist = new ArrayList<>();
-        for (Row stockbillitemsRow : stockbillitemsRows) {
+        for (String itemno : itemMap.keySet()) {
             SQL = "insert into TOutDetailInt(OutPlanID,BillNo,CreateDate,IsDeleted,OutDate,MaterialCode,PlanOutQuantity,OutQuantity,Status)";
             SQL = SQL + " select ";
             SQL = SQL + " '" + OutPlanID + "',";// 对应出库通知单主表ID
@@ -120,8 +133,8 @@ public class Wms {
             SQL = SQL + " '" + createdate + "',";// 创建日期
             SQL = SQL + " 0,";// 是否删除
             SQL = SQL + " '" + billdate + "',";// 出库日期
-            SQL = SQL + " '" + stockbillitemsRow.getString("itemno") + "',";// 品号
-            SQL = SQL + " " + stockbillitemsRow.getString("qty") + ",";// 出库数量
+            SQL = SQL + " '" + itemno + "',";// 品号
+            SQL = SQL + " " + itemMap.get(itemno) + ",";// 出库数量
             SQL = SQL + " 0,";// 已出库数量
             SQL = SQL + " 0";// 状态:0:WMS未处理 1:WMS正在出库 2:WMS出库完成 10:ERP出库完成
             sqlist.add(SQL);