|
|
@@ -93,21 +93,26 @@ public class XSCK extends BasicBill {
|
|
|
sqlList.add("update st_stockbill_items set wmsuploadflag2=1 where st_stockbill_itemsid=" + row.getLong("st_stockbill_itemsid"));
|
|
|
}
|
|
|
}
|
|
|
+ sqlList.addAll(updateAccountbalance_freez(isInStock(ischeck)));
|
|
|
} else {
|
|
|
-// for(Row row :rowsdetail){
|
|
|
-// String itemid= row.getString("itemid");
|
|
|
-// long stockid=row.getLong("stockid");
|
|
|
-// if(stockRowsMap.containsKey(itemid)){
|
|
|
-// for(Row row1 :stockRowsMap.get(itemid)){
|
|
|
-// if(row1.getLong("stockid")==stockid){
|
|
|
-// sqlList.add("update st_stock set qty="+row1.getBigDecimal("qty").subtract(row.getBigDecimal("qty"))+" where stockid="+stockid);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// // String batchno = row.getString("batchno");
|
|
|
-// }
|
|
|
+ if (order_paymentnode.equals("3")) {
|
|
|
+ CashbillEntity entity = getCashbillEntity(billRow.getBigDecimal("payamount").negate(), billRow.getBigDecimal("paydiscountamount").negate(), st_stockbillid, "销售出库单审核", billno, "由销售出库单" + billno + "审核时生成");
|
|
|
+ JSONObject createCashbillPay = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
|
|
|
+ sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
|
|
|
+ }
|
|
|
+ Rows rowsOrderDetail = dbConnect.runSqlQuery("select t1.undeliqty,t1.deliedqty,t1.qty,t1.sa_orderitemsid from sa_orderitems t1 where t1.sa_orderitemsid in (select sa_orderitemsid from st_stockbill_items where sa_orderitemsid>0 and st_stockbillid=" + st_stockbillid + ")");
|
|
|
+ RowsMap rowsMap = rowsOrderDetail.toRowsMap("sa_orderitemsid");
|
|
|
+ Rows rowsDispatchDetailGroup = dbConnect.runSqlQuery("select sum(t1.qty) qty,t1.sa_orderitemsid,t1.siteid from st_stockbill_items t1 where t1.sa_orderitemsid>0 and t1.st_stockbillid=" + st_stockbillid + " group by t1.sa_orderitemsid,t1.siteid");
|
|
|
+ for (Row row : rowsDispatchDetailGroup) {
|
|
|
+ sqlList.add("update sa_orderitems set undeliqty=" + rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("undeliqty").add(row.getBigDecimal("qty")) + ",deliedqty=" + (rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("deliedqty").subtract(row.getBigDecimal("qty"))) + " where sa_orderitemsid=" + row.getLong("sa_orderitemsid"));
|
|
|
+ }
|
|
|
+ for (Row row : itemRows) {
|
|
|
+ if (row.getBoolean("skucontrol")) {
|
|
|
+ sqlList.add("update st_stockbill_items set wmsuploadflag2=0 where st_stockbill_itemsid=" + row.getLong("st_stockbill_itemsid"));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- sqlList.addAll(updateAccountbalance_freez(isInStock(ischeck)));
|
|
|
+
|
|
|
|
|
|
} else {
|
|
|
Rows accountbalancerows = dbConnect.runSqlQuery("select * from sa_accountbalance t1 inner join sa_accountclass t2 on t1.sa_accountclassid=t2.sa_accountclassid and t1.siteid=t2.siteid where t2.accountname='现金账户' and t1.sys_enterpriseid=" + sys_enterpriseid);
|
|
|
@@ -129,10 +134,24 @@ public class XSCK extends BasicBill {
|
|
|
sqlList.add("update st_stockbill_items set wmsuploadflag2=0 where st_stockbill_itemsid=" + row.getLong("st_stockbill_itemsid"));
|
|
|
}
|
|
|
}
|
|
|
+ sqlList.addAll(updateAccountbalance_freez(isInStock(ischeck)));
|
|
|
} else {
|
|
|
-
|
|
|
+ if (order_paymentnode.equals("3")) {
|
|
|
+ CashbillEntity entity = getCashbillEntity(billRow.getBigDecimal("payamount"), billRow.getBigDecimal("paydiscountamount"), st_stockbillid, "销售出库单反审核", billno, "由销售出库单" + billno + "反审核时生成");
|
|
|
+ JSONObject createCashbillPay = Accountbalance.createCashbillPay(dbConnect, userInfo, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
|
|
|
+ sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
|
|
|
+ }
|
|
|
+ Rows rowsDispatchDetailGroup = dbConnect.runSqlQuery("select sum(t1.qty) qty,t1.sa_orderitemsid,t1.siteid from st_stockbill_items t1 where t1.sa_orderitemsid>0 and t1.st_stockbillid=" + st_stockbillid + " group by t1.sa_orderitemsid,t1.siteid");
|
|
|
+ for (Row row : rowsDispatchDetailGroup) {
|
|
|
+ sqlList.add("update sa_orderitems set undeliqty=undeliqty-" + row.getDouble("qty") + ",deliedqty=deliedqty+" + row.getDouble("qty") + ",offstatus=if(billingstatus='保内收费','待核销','不可核销'),offdate=CURRENT_TIME where sa_orderitemsid=" + row.getLong("sa_orderitemsid"));
|
|
|
+ }
|
|
|
+ for (Row row : itemRows) {
|
|
|
+ if (row.getBoolean("skucontrol")) {
|
|
|
+ sqlList.add("update st_stockbill_items set wmsuploadflag2=1 where st_stockbill_itemsid=" + row.getLong("st_stockbill_itemsid"));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- sqlList.addAll(updateAccountbalance_freez(isInStock(ischeck)));
|
|
|
+
|
|
|
}
|
|
|
return sqlList;
|
|
|
}
|
|
|
@@ -164,7 +183,6 @@ public class XSCK extends BasicBill {
|
|
|
if (accountbalancefreezrows.isNotEmpty()) {
|
|
|
sqllist.add("update sa_accountbalance_freez set amount=amount+" + amount + " where sa_accountbalance_freezid=" + accountbalancefreezrows.get(0).getLong("sa_accountbalance_freezid"));
|
|
|
} else {
|
|
|
-
|
|
|
InsertSQL insertSQL = SQLFactory.createInsertSQL(dbConnect, "sa_accountbalance_freez");
|
|
|
insertSQL.setSiteid(siteid);
|
|
|
insertSQL.setValue("sa_accountbalanceid", sa_accountbalanceid);
|