|
|
@@ -523,6 +523,7 @@ public class u8 extends Controller {
|
|
|
ArrayList<String> sqlList = new ArrayList<>();
|
|
|
RowsMap invbalsRowsMap = SQLFactory.createQuerySQL(dbConnect, "st_invbal").setWhere("siteid", siteid).setWhere("itemid", rows.toArrayList("itemid")).query().toRowsMap("itemid");
|
|
|
RowsMap invbalsTotalRowsMap = SQLFactory.createQuerySQL(dbConnect, "st_invbal_total").setWhere("siteid", siteid).setWhere("itemid", rows.toArrayList("itemid")).query().toRowsMap("itemid");
|
|
|
+ RowsMap invbalsSaleRowsMap = SQLFactory.createQuerySQL(dbConnect, "st_invbal_sale").setWhere("siteid", siteid).setWhere("itemid", rows.toArrayList("itemid")).query().toRowsMap("itemid");
|
|
|
int i = 0;
|
|
|
for (Row row : rows) {
|
|
|
long itemid =row.getLong("itemid");
|
|
|
@@ -543,11 +544,30 @@ public class u8 extends Controller {
|
|
|
invbalUpdate.setWhere("siteid", siteid);
|
|
|
sqlList.add(invbalUpdate.getSQL());
|
|
|
}
|
|
|
- //是否纳入总仓
|
|
|
-
|
|
|
- if (SQLFactory.getRow(this,"st_stock", stockid).getBoolean("isintotalstock")) {
|
|
|
- if (!invbalsTotalRowsMap.containsKey(String.valueOf(itemid))) {
|
|
|
- InsertSQL invbalInsert = SQLFactory.createInsertSQL(this, "st_invbal_total");
|
|
|
+// //是否纳入总仓
|
|
|
+//
|
|
|
+// if (SQLFactory.getRow(this,"st_stock", stockid).getBoolean("isintotalstock")) {
|
|
|
+// if (!invbalsTotalRowsMap.containsKey(String.valueOf(itemid))) {
|
|
|
+// InsertSQL invbalInsert = SQLFactory.createInsertSQL(this, "st_invbal_total");
|
|
|
+// invbalInsert.setValue("siteid", siteid);
|
|
|
+// invbalInsert.setValue("itemid", itemid);
|
|
|
+// invbalInsert.setValue("cansaleqty", qty.doubleValue());//可销售数量
|
|
|
+// invbalInsert.setValue("candispatchqty", qty.doubleValue());//可发货数量
|
|
|
+// invbalInsert.setValue("qty", qty.doubleValue());//库存数量
|
|
|
+// sqlList.add(invbalInsert.getSQL());
|
|
|
+// } else {
|
|
|
+// UpdateSQL invbalUpdate = SQLFactory.createUpdateSQL(this, "st_invbal_total");
|
|
|
+// invbalUpdate.addValue("qty", invbalsTotalRowsMap.get(String.valueOf(itemid)).get(0).getBigDecimal("qty").add(qty));//库存数量
|
|
|
+// invbalUpdate.setWhere("itemid", itemid);
|
|
|
+// invbalUpdate.setWhere("siteid", siteid);
|
|
|
+// sqlList.add(invbalUpdate.getSQL());
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ //是否为销售仓库
|
|
|
+ if (SQLFactory.getRow(this, "st_stock", stockid).getBoolean("issalestock")) {
|
|
|
+ if (!invbalsSaleRowsMap.containsKey(String.valueOf(itemid))) {
|
|
|
+ InsertSQL invbalInsert = SQLFactory.createInsertSQL(this, "st_invbal_sale");
|
|
|
invbalInsert.setValue("siteid", siteid);
|
|
|
invbalInsert.setValue("itemid", itemid);
|
|
|
invbalInsert.setValue("cansaleqty", qty.doubleValue());//可销售数量
|
|
|
@@ -555,12 +575,13 @@ public class u8 extends Controller {
|
|
|
invbalInsert.setValue("qty", qty.doubleValue());//库存数量
|
|
|
sqlList.add(invbalInsert.getSQL());
|
|
|
} else {
|
|
|
- UpdateSQL invbalUpdate = SQLFactory.createUpdateSQL(this, "st_invbal_total");
|
|
|
- invbalUpdate.addValue("qty", invbalsTotalRowsMap.get(String.valueOf(itemid)).get(0).getBigDecimal("qty").add(qty));//库存数量
|
|
|
+ UpdateSQL invbalUpdate = SQLFactory.createUpdateSQL(this, "st_invbal_sale");
|
|
|
+ invbalUpdate.addValue("qty", invbalsSaleRowsMap.get(String.valueOf(itemid)).get(0).getBigDecimal("qty").add(qty));//库存数量
|
|
|
invbalUpdate.setWhere("itemid", itemid);
|
|
|
invbalUpdate.setWhere("siteid", siteid);
|
|
|
sqlList.add(invbalUpdate.getSQL());
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|