|
|
@@ -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);
|