|
|
@@ -515,218 +515,218 @@ public class stockbill extends Controller {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public String xsckcheck(Long st_stockbillid, boolean isinstock) throws YosException {
|
|
|
- Rows rows = dbConnect.runSqlQuery("select * from st_stockbill where st_stockbillid ='"
|
|
|
- + st_stockbillid + "' and siteid='" + siteid + "'");
|
|
|
- Rows rowsdetail = dbConnect.runSqlQuery("select t1.*,t2.skucontrol from st_stockbill_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.st_stockbillid ='"
|
|
|
- + st_stockbillid + "' and t1.siteid='" + siteid + "'");
|
|
|
- long sys_enterpriseid = rows.get(0).getLong("sys_enterpriseid");
|
|
|
-
|
|
|
- if (rows.isEmpty()) {
|
|
|
- return "该出入库单不存在";
|
|
|
- } else {
|
|
|
- if (!rows.get(0).getString("status").equals("新建")) {
|
|
|
- return "单号为:【" + rows.get(0).getString("billno") + "】的出入库单为非新建状态,无法审核";
|
|
|
- }
|
|
|
- }
|
|
|
- for (Row row : rowsdetail) {
|
|
|
- if (row.getBigDecimal("qty").compareTo(BigDecimal.ZERO) < 1) {
|
|
|
- return "表体数量不能小于0";
|
|
|
- }
|
|
|
- }
|
|
|
- if (rows.get(0).getBigDecimal("payamount").compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
- return "扣款金额需大于0";
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(rows.get(0).getString("outplace"))) {
|
|
|
- return "发货地不可为空";
|
|
|
- }
|
|
|
- if ((rows.get(0).getBigDecimal("payamount").add(rows.get(0).getBigDecimal("paydiscountamount"))).compareTo(rowsdetail.sum("amount")) != 0) {
|
|
|
- return "扣款金额与应扣金额不符,不能审核";
|
|
|
- }
|
|
|
- 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);
|
|
|
- if (accountbalancerows.isNotEmpty()) {
|
|
|
- BigDecimal discountamount = accountbalancerows.get(0).getBigDecimal("discountamount");
|
|
|
- if (rows.get(0).getBigDecimal("paydiscountamount").compareTo(discountamount) > 0) {
|
|
|
- return "优惠金额不能大于可用优惠金额";
|
|
|
- }
|
|
|
- } else {
|
|
|
- return "账户不存在";
|
|
|
- }
|
|
|
- ArrayList<String> sqlList = new ArrayList<>();
|
|
|
-// Rows stockRows= dbConnect.runSqlQuery("select * from st_stock where siteid='"+siteid+"'");
|
|
|
-// RowsMap stockRowsMap =stockRows.toRowsMap("itemid");
|
|
|
-
|
|
|
- String order_paymentnode = Parameter.getString(siteid, "order_paymentnode");
|
|
|
- if (rows.get(0).getBoolean("rb")) {
|
|
|
- if (rows.get(0).getString("type").equals("销售出库")) {
|
|
|
- if (order_paymentnode.equals("3")) {
|
|
|
- if (Accountbalance.judgeBalance(this, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), rowsdetail.sum("amount"))) {
|
|
|
- CashbillEntity entity = getCashbillEntity(rows.get(0).getBigDecimal("payamount"), rows.get(0).getBigDecimal("paydiscountamount"), st_stockbillid, "销售出库单审核", rows.get(0).getString("billno"), "由销售出库单" + rows.get(0).getString("billno") + "审核时生成");
|
|
|
- JSONObject createCashbillPay = Accountbalance.createCashbillPay(this, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
|
|
|
- sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
|
|
|
- } else {
|
|
|
- return "账户余额不足,还差" + Accountbalance.InsufficientBalance(this, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), rowsdetail.sum("amount")) + "元!";
|
|
|
- }
|
|
|
- }
|
|
|
- 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 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.st_stockbillid=" + st_stockbillid + " group by t1.sa_orderitemsid,t1.siteid");
|
|
|
- Rows rowsjudge = dbConnect.runSqlQuery("select * from (select sa_orderitemsid,sum(qty) qty from st_stockbill_items where st_stockbillid ='" + st_stockbillid + "' group by sa_orderitemsid) t1 inner join sa_orderitems t2 on t1.sa_orderitemsid=t2.sa_orderitemsid where t1.qty>t2.undeliqty");
|
|
|
- if (rowsjudge.isNotEmpty()) {
|
|
|
- return "存在商品已完全出库,无法审核";
|
|
|
- }
|
|
|
- for (Row row : rowsDispatchDetailGroup) {
|
|
|
- sqlList.add("update sa_orderitems set undeliqty=" + rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("undeliqty").subtract(row.getBigDecimal("qty")) + ",deliedqty=" + (row.getBigDecimal("qty").add(rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("deliedqty"))) + " where sa_orderitemsid=" + row.getLong("sa_orderitemsid"));
|
|
|
- }
|
|
|
- for (Row row : rowsdetail) {
|
|
|
- if (row.getBoolean("skucontrol")) {
|
|
|
- sqlList.add("update st_stockbill_items set wmsuploadflag2=1 where st_stockbill_itemsid=" + row.getLong("st_stockbill_itemsid"));
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-// 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").add(row.getBigDecimal("qty"))+" where stockid="+stockid);
|
|
|
-// }
|
|
|
+// public String xsckcheck(Long st_stockbillid, boolean isinstock) throws YosException {
|
|
|
+// Rows rows = dbConnect.runSqlQuery("select * from st_stockbill where st_stockbillid ='"
|
|
|
+// + st_stockbillid + "' and siteid='" + siteid + "'");
|
|
|
+// Rows rowsdetail = dbConnect.runSqlQuery("select t1.*,t2.skucontrol from st_stockbill_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.st_stockbillid ='"
|
|
|
+// + st_stockbillid + "' and t1.siteid='" + siteid + "'");
|
|
|
+// long sys_enterpriseid = rows.get(0).getLong("sys_enterpriseid");
|
|
|
+//
|
|
|
+// if (rows.isEmpty()) {
|
|
|
+// return "该出入库单不存在";
|
|
|
+// } else {
|
|
|
+// if (!rows.get(0).getString("status").equals("新建")) {
|
|
|
+// return "单号为:【" + rows.get(0).getString("billno") + "】的出入库单为非新建状态,无法审核";
|
|
|
+// }
|
|
|
+// }
|
|
|
+// for (Row row : rowsdetail) {
|
|
|
+// if (row.getBigDecimal("qty").compareTo(BigDecimal.ZERO) < 1) {
|
|
|
+// return "表体数量不能小于0";
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (rows.get(0).getBigDecimal("payamount").compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
+// return "扣款金额需大于0";
|
|
|
+// }
|
|
|
+// if (StringUtils.isBlank(rows.get(0).getString("outplace"))) {
|
|
|
+// return "发货地不可为空";
|
|
|
+// }
|
|
|
+// if ((rows.get(0).getBigDecimal("payamount").add(rows.get(0).getBigDecimal("paydiscountamount"))).compareTo(rowsdetail.sum("amount")) != 0) {
|
|
|
+// return "扣款金额与应扣金额不符,不能审核";
|
|
|
+// }
|
|
|
+// 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);
|
|
|
+// if (accountbalancerows.isNotEmpty()) {
|
|
|
+// BigDecimal discountamount = accountbalancerows.get(0).getBigDecimal("discountamount");
|
|
|
+// if (rows.get(0).getBigDecimal("paydiscountamount").compareTo(discountamount) > 0) {
|
|
|
+// return "优惠金额不能大于可用优惠金额";
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// return "账户不存在";
|
|
|
+// }
|
|
|
+// ArrayList<String> sqlList = new ArrayList<>();
|
|
|
+//// Rows stockRows= dbConnect.runSqlQuery("select * from st_stock where siteid='"+siteid+"'");
|
|
|
+//// RowsMap stockRowsMap =stockRows.toRowsMap("itemid");
|
|
|
+//
|
|
|
+// String order_paymentnode = Parameter.getString(siteid, "order_paymentnode");
|
|
|
+// if (rows.get(0).getBoolean("rb")) {
|
|
|
+// if (rows.get(0).getString("type").equals("销售出库")) {
|
|
|
+// if (order_paymentnode.equals("3")) {
|
|
|
+// if (Accountbalance.judgeBalance(this, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), rowsdetail.sum("amount"))) {
|
|
|
+// CashbillEntity entity = getCashbillEntity(rows.get(0).getBigDecimal("payamount"), rows.get(0).getBigDecimal("paydiscountamount"), st_stockbillid, "销售出库单审核", rows.get(0).getString("billno"), "由销售出库单" + rows.get(0).getString("billno") + "审核时生成");
|
|
|
+// JSONObject createCashbillPay = Accountbalance.createCashbillPay(this, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
|
|
|
+// sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
|
|
|
+// } else {
|
|
|
+// return "账户余额不足,还差" + Accountbalance.InsufficientBalance(this, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), rowsdetail.sum("amount")) + "元!";
|
|
|
// }
|
|
|
// }
|
|
|
-// // String batchno = row.getString("batchno");
|
|
|
-// }
|
|
|
- } 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);
|
|
|
-// }
|
|
|
+// 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 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.st_stockbillid=" + st_stockbillid + " group by t1.sa_orderitemsid,t1.siteid");
|
|
|
+// Rows rowsjudge = dbConnect.runSqlQuery("select * from (select sa_orderitemsid,sum(qty) qty from st_stockbill_items where st_stockbillid ='" + st_stockbillid + "' group by sa_orderitemsid) t1 inner join sa_orderitems t2 on t1.sa_orderitemsid=t2.sa_orderitemsid where t1.qty>t2.undeliqty");
|
|
|
+// if (rowsjudge.isNotEmpty()) {
|
|
|
+// return "存在商品已完全出库,无法审核";
|
|
|
+// }
|
|
|
+// for (Row row : rowsDispatchDetailGroup) {
|
|
|
+// sqlList.add("update sa_orderitems set undeliqty=" + rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("undeliqty").subtract(row.getBigDecimal("qty")) + ",deliedqty=" + (row.getBigDecimal("qty").add(rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("deliedqty"))) + " where sa_orderitemsid=" + row.getLong("sa_orderitemsid"));
|
|
|
+// }
|
|
|
+// for (Row row : rowsdetail) {
|
|
|
+// if (row.getBoolean("skucontrol")) {
|
|
|
+// sqlList.add("update st_stockbill_items set wmsuploadflag2=1 where st_stockbill_itemsid=" + row.getLong("st_stockbill_itemsid"));
|
|
|
// }
|
|
|
+//
|
|
|
// }
|
|
|
-// // String batchno = row.getString("batchno");
|
|
|
// }
|
|
|
- }
|
|
|
-// Rows stockbillitems = dbConnect.runSqlQuery("select t2.sa_orderid,sum(t2.price*t1.qty) amount from st_stockbill_items t1 inner join sa_orderitems t2 on t1.siteid=t2.siteid and t1.sa_orderitemsid=t2.sa_orderitemsid where t1.siteid='"+siteid+"'and t1.st_stockbillid="+st_stockbillid+" group by t2.sa_orderid");
|
|
|
-// Rows orderRows =dbConnect.runSqlQuery("select * from sa_order where sa_orderid in(select t2.sa_orderid from st_stockbill_items t1 inner join sa_orderitems t2 on t1.siteid=t2.siteid and t1.sa_orderitemsid=t2.sa_orderitemsid where t1.st_stockbillid='"+st_stockbillid+"')");
|
|
|
-// RowsMap orderRowsMap =orderRows.toRowsMap("sa_orderid");
|
|
|
-
|
|
|
- sqlList.addAll(updateAccountbalance_freez(st_stockbillid, isinstock));
|
|
|
-
|
|
|
- dbConnect.runSqlUpdate(sqlList);
|
|
|
-// Accountbalance.remindSend(this, sys_enterpriseid, sa_cashbillid);
|
|
|
- return "success";
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public String unxsckcheck(Long st_stockbillid, boolean isinstock) throws YosException {
|
|
|
-
|
|
|
-
|
|
|
- Rows rows = dbConnect.runSqlQuery("select * from st_stockbill where st_stockbillid ='"
|
|
|
- + st_stockbillid + "' and siteid='" + siteid + "'");
|
|
|
- Rows rowsdetail = dbConnect.runSqlQuery("select t1.*,t2.skucontrol from st_stockbill_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.st_stockbillid ='"
|
|
|
- + st_stockbillid + "' and t1.siteid='" + siteid + "'");
|
|
|
- long sys_enterpriseid = rows.get(0).getLong("sys_enterpriseid");
|
|
|
-
|
|
|
- if (rows.isEmpty()) {
|
|
|
- return "该出入库单不存在";
|
|
|
- } else {
|
|
|
- if (!rows.get(0).getString("status").equals("审核")) {
|
|
|
- return "单号为:【" + rows.get(0).getString("billno") + "】的出入库单为非审核状态,无法反审核";
|
|
|
- }
|
|
|
- }
|
|
|
- for (Row row : rowsdetail) {
|
|
|
- if (row.getBigDecimal("qty").compareTo(BigDecimal.ZERO) < 1) {
|
|
|
- return "表体数量不能小于0";
|
|
|
- }
|
|
|
- }
|
|
|
- if (rows.get(0).getBigDecimal("paydiscountamount").compareTo(BigDecimal.ZERO) < 0) {
|
|
|
- return "优惠金额不能小于0";
|
|
|
- }
|
|
|
- if (rows.get(0).getBigDecimal("payamount").compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
- return "扣款金额需大于0";
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(rows.get(0).getString("outplace"))) {
|
|
|
- return "发货地不可为空";
|
|
|
- }
|
|
|
- if ((rows.get(0).getBigDecimal("payamount").add(rows.get(0).getBigDecimal("paydiscountamount"))).compareTo(rowsdetail.sum("amount")) != 0) {
|
|
|
- return "扣款金额与应扣金额不符,不能反审核";
|
|
|
- }
|
|
|
- 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);
|
|
|
- if (accountbalancerows.isEmpty()) {
|
|
|
- return "账户不存在";
|
|
|
- }
|
|
|
- if (rows.get(0).getString("type").equals("销售出库") && rows.get(0).getBoolean("isreceiver")) {
|
|
|
- return "经销商已经确认收货,不可进行反审核";
|
|
|
- }
|
|
|
- ArrayList<String> sqlList = new ArrayList<>();
|
|
|
-// Rows stockRows= dbConnect.runSqlQuery("select * from st_stock where siteid='"+siteid+"'");
|
|
|
-// RowsMap stockRowsMap =stockRows.toRowsMap("itemid");
|
|
|
-
|
|
|
- String order_paymentnode = Parameter.getString(siteid, "order_paymentnode");
|
|
|
- if (rows.get(0).getBoolean("rb")) {
|
|
|
- if (rows.get(0).getString("type").equals("销售出库")) {
|
|
|
- if (order_paymentnode.equals("3")) {
|
|
|
- if (Accountbalance.judgeBalance(this, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), rowsdetail.sum("amount").negate())) {
|
|
|
- CashbillEntity entity = getCashbillEntity(rows.get(0).getBigDecimal("payamount").negate(), rows.get(0).getBigDecimal("paydiscountamount").negate(), st_stockbillid, "销售出库单反审核", rows.get(0).getString("billno"), "由销售出库单" + rows.get(0).getString("billno") + "反审核时生成");
|
|
|
- JSONObject createCashbillPay = Accountbalance.createCashbillPay(this, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
|
|
|
- sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
|
|
|
- } else {
|
|
|
- return "账户余额不足,还差" + Accountbalance.InsufficientBalance(this, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), rowsdetail.sum("amount")) + "元!";
|
|
|
- }
|
|
|
- }
|
|
|
- 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 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.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 : rowsdetail) {
|
|
|
- if (row.getBoolean("skucontrol")) {
|
|
|
- sqlList.add("update st_stockbill_items set wmsuploadflag2=0 where st_stockbill_itemsid=" + row.getLong("st_stockbill_itemsid"));
|
|
|
- }
|
|
|
+//// 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").add(row.getBigDecimal("qty"))+" where stockid="+stockid);
|
|
|
+//// }
|
|
|
+//// }
|
|
|
+//// }
|
|
|
+//// // String batchno = row.getString("batchno");
|
|
|
+//// }
|
|
|
+// } 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");
|
|
|
+//// }
|
|
|
+// }
|
|
|
+//// Rows stockbillitems = dbConnect.runSqlQuery("select t2.sa_orderid,sum(t2.price*t1.qty) amount from st_stockbill_items t1 inner join sa_orderitems t2 on t1.siteid=t2.siteid and t1.sa_orderitemsid=t2.sa_orderitemsid where t1.siteid='"+siteid+"'and t1.st_stockbillid="+st_stockbillid+" group by t2.sa_orderid");
|
|
|
+//// Rows orderRows =dbConnect.runSqlQuery("select * from sa_order where sa_orderid in(select t2.sa_orderid from st_stockbill_items t1 inner join sa_orderitems t2 on t1.siteid=t2.siteid and t1.sa_orderitemsid=t2.sa_orderitemsid where t1.st_stockbillid='"+st_stockbillid+"')");
|
|
|
+//// RowsMap orderRowsMap =orderRows.toRowsMap("sa_orderid");
|
|
|
+//
|
|
|
+// sqlList.addAll(updateAccountbalance_freez(st_stockbillid, isinstock));
|
|
|
+//
|
|
|
+// dbConnect.runSqlUpdate(sqlList);
|
|
|
+//// Accountbalance.remindSend(this, sys_enterpriseid, sa_cashbillid);
|
|
|
+// return "success";
|
|
|
+//
|
|
|
+// }
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
-// 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);
|
|
|
-// }
|
|
|
+// public String unxsckcheck(Long st_stockbillid, boolean isinstock) throws YosException {
|
|
|
+//
|
|
|
+//
|
|
|
+// Rows rows = dbConnect.runSqlQuery("select * from st_stockbill where st_stockbillid ='"
|
|
|
+// + st_stockbillid + "' and siteid='" + siteid + "'");
|
|
|
+// Rows rowsdetail = dbConnect.runSqlQuery("select t1.*,t2.skucontrol from st_stockbill_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.st_stockbillid ='"
|
|
|
+// + st_stockbillid + "' and t1.siteid='" + siteid + "'");
|
|
|
+// long sys_enterpriseid = rows.get(0).getLong("sys_enterpriseid");
|
|
|
+//
|
|
|
+// if (rows.isEmpty()) {
|
|
|
+// return "该出入库单不存在";
|
|
|
+// } else {
|
|
|
+// if (!rows.get(0).getString("status").equals("审核")) {
|
|
|
+// return "单号为:【" + rows.get(0).getString("billno") + "】的出入库单为非审核状态,无法反审核";
|
|
|
+// }
|
|
|
+// }
|
|
|
+// for (Row row : rowsdetail) {
|
|
|
+// if (row.getBigDecimal("qty").compareTo(BigDecimal.ZERO) < 1) {
|
|
|
+// return "表体数量不能小于0";
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (rows.get(0).getBigDecimal("paydiscountamount").compareTo(BigDecimal.ZERO) < 0) {
|
|
|
+// return "优惠金额不能小于0";
|
|
|
+// }
|
|
|
+// if (rows.get(0).getBigDecimal("payamount").compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
+// return "扣款金额需大于0";
|
|
|
+// }
|
|
|
+// if (StringUtils.isBlank(rows.get(0).getString("outplace"))) {
|
|
|
+// return "发货地不可为空";
|
|
|
+// }
|
|
|
+// if ((rows.get(0).getBigDecimal("payamount").add(rows.get(0).getBigDecimal("paydiscountamount"))).compareTo(rowsdetail.sum("amount")) != 0) {
|
|
|
+// return "扣款金额与应扣金额不符,不能反审核";
|
|
|
+// }
|
|
|
+// 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);
|
|
|
+// if (accountbalancerows.isEmpty()) {
|
|
|
+// return "账户不存在";
|
|
|
+// }
|
|
|
+// if (rows.get(0).getString("type").equals("销售出库") && rows.get(0).getBoolean("isreceiver")) {
|
|
|
+// return "经销商已经确认收货,不可进行反审核";
|
|
|
+// }
|
|
|
+// ArrayList<String> sqlList = new ArrayList<>();
|
|
|
+//// Rows stockRows= dbConnect.runSqlQuery("select * from st_stock where siteid='"+siteid+"'");
|
|
|
+//// RowsMap stockRowsMap =stockRows.toRowsMap("itemid");
|
|
|
+//
|
|
|
+// String order_paymentnode = Parameter.getString(siteid, "order_paymentnode");
|
|
|
+// if (rows.get(0).getBoolean("rb")) {
|
|
|
+// if (rows.get(0).getString("type").equals("销售出库")) {
|
|
|
+// if (order_paymentnode.equals("3")) {
|
|
|
+// if (Accountbalance.judgeBalance(this, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), rowsdetail.sum("amount").negate())) {
|
|
|
+// CashbillEntity entity = getCashbillEntity(rows.get(0).getBigDecimal("payamount").negate(), rows.get(0).getBigDecimal("paydiscountamount").negate(), st_stockbillid, "销售出库单反审核", rows.get(0).getString("billno"), "由销售出库单" + rows.get(0).getString("billno") + "反审核时生成");
|
|
|
+// JSONObject createCashbillPay = Accountbalance.createCashbillPay(this, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), entity, true);
|
|
|
+// sqlList.addAll(createCashbillPay.getJSONArray("sqlList").toJavaList(String.class));
|
|
|
+// } else {
|
|
|
+// return "账户余额不足,还差" + Accountbalance.InsufficientBalance(this, sys_enterpriseid, accountbalancerows.get(0).getLong("sa_accountclassid"), rowsdetail.sum("amount")) + "元!";
|
|
|
// }
|
|
|
// }
|
|
|
-// // String batchno = row.getString("batchno");
|
|
|
-// }
|
|
|
- } 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").add(row.getBigDecimal("qty"))+" where stockid="+stockid);
|
|
|
-// }
|
|
|
+// 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 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.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 : rowsdetail) {
|
|
|
+// if (row.getBoolean("skucontrol")) {
|
|
|
+// sqlList.add("update st_stockbill_items set wmsuploadflag2=0 where st_stockbill_itemsid=" + row.getLong("st_stockbill_itemsid"));
|
|
|
// }
|
|
|
+//
|
|
|
// }
|
|
|
-// // String batchno = row.getString("batchno");
|
|
|
// }
|
|
|
- }
|
|
|
-// Rows stockbillitems = dbConnect.runSqlQuery("select t2.sa_orderid,sum(t2.price*t1.qty) amount from st_stockbill_items t1 inner join sa_orderitems t2 on t1.siteid=t2.siteid and t1.sa_orderitemsid=t2.sa_orderitemsid where t1.siteid='"+siteid+"'and t1.st_stockbillid="+st_stockbillid+" group by t2.sa_orderid");
|
|
|
-// Rows orderRows =dbConnect.runSqlQuery("select * from sa_order where sa_orderid in(select t2.sa_orderid from st_stockbill_items t1 inner join sa_orderitems t2 on t1.siteid=t2.siteid and t1.sa_orderitemsid=t2.sa_orderitemsid where t1.st_stockbillid='"+st_stockbillid+"')");
|
|
|
-// RowsMap orderRowsMap =orderRows.toRowsMap("sa_orderid");
|
|
|
- sqlList.addAll(updateAccountbalance_freez(st_stockbillid, isinstock));
|
|
|
- dbConnect.runSqlUpdate(sqlList);
|
|
|
-
|
|
|
-// Accountbalance.remindSend(this, sys_enterpriseid, sa_cashbillid);
|
|
|
- return "success";
|
|
|
- }
|
|
|
+//// 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");
|
|
|
+//// }
|
|
|
+// } 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").add(row.getBigDecimal("qty"))+" where stockid="+stockid);
|
|
|
+//// }
|
|
|
+//// }
|
|
|
+//// }
|
|
|
+//// // String batchno = row.getString("batchno");
|
|
|
+//// }
|
|
|
+// }
|
|
|
+//// Rows stockbillitems = dbConnect.runSqlQuery("select t2.sa_orderid,sum(t2.price*t1.qty) amount from st_stockbill_items t1 inner join sa_orderitems t2 on t1.siteid=t2.siteid and t1.sa_orderitemsid=t2.sa_orderitemsid where t1.siteid='"+siteid+"'and t1.st_stockbillid="+st_stockbillid+" group by t2.sa_orderid");
|
|
|
+//// Rows orderRows =dbConnect.runSqlQuery("select * from sa_order where sa_orderid in(select t2.sa_orderid from st_stockbill_items t1 inner join sa_orderitems t2 on t1.siteid=t2.siteid and t1.sa_orderitemsid=t2.sa_orderitemsid where t1.st_stockbillid='"+st_stockbillid+"')");
|
|
|
+//// RowsMap orderRowsMap =orderRows.toRowsMap("sa_orderid");
|
|
|
+// sqlList.addAll(updateAccountbalance_freez(st_stockbillid, isinstock));
|
|
|
+// dbConnect.runSqlUpdate(sqlList);
|
|
|
+//
|
|
|
+//// Accountbalance.remindSend(this, sys_enterpriseid, sa_cashbillid);
|
|
|
+// return "success";
|
|
|
+// }
|
|
|
|
|
|
@API(title = "仓库确认", apiversion = R.ID2025050709505703.v1.class)
|
|
|
public String confirm() throws YosException {
|