|
@@ -579,25 +579,25 @@ public class dispatch extends Controller {
|
|
|
}
|
|
|
|
|
|
//对接erp生成erp发货单
|
|
|
- if (Parameter.getBoolean("system.ccerp_dockswitch") && !siteid.equalsIgnoreCase("lsa")) {
|
|
|
- ERPDocking erpDocking = new ERPDocking(siteid);
|
|
|
- if (!erpDocking.getUrl().isEmpty()) {
|
|
|
- String result = erpDocking.closeErpSainvoice(rows.get(0).getString("billno"), true, this, sa_dispatchid);
|
|
|
- if (!result.equals("true")) {
|
|
|
- return getErrReturnObject().setErrMsg(result).toString();
|
|
|
- } else {
|
|
|
- JSONArray jsonArray = erpDocking.queryErpSainvoice(rows.get(0).getString("billno"));
|
|
|
- ArrayList<String> dispatchsqlList = new ArrayList<>();
|
|
|
- if (!jsonArray.isEmpty()) {
|
|
|
- for (Object object1 : jsonArray) {
|
|
|
- JSONObject jsonObject = (JSONObject) object1;
|
|
|
- dispatchsqlList.add("update sa_dispatch_items set outwarehouseqty=" + jsonObject.getBigDecimal("fqty1") + " where rowno =" + jsonObject.getIntValue("frownum") + " and sa_dispatchid='" + sa_dispatchid + "' and siteid='" + siteid + "'");
|
|
|
- }
|
|
|
- }
|
|
|
- dbConnect.runSqlUpdate(dispatchsqlList);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// if (Parameter.getBoolean("system.ccerp_dockswitch") && !siteid.equalsIgnoreCase("lsa")) {
|
|
|
+// ERPDocking erpDocking = new ERPDocking(siteid);
|
|
|
+// if (!erpDocking.getUrl().isEmpty()) {
|
|
|
+// String result = erpDocking.closeErpSainvoice(rows.get(0).getString("billno"), true, this, sa_dispatchid);
|
|
|
+// if (!result.equals("true")) {
|
|
|
+// return getErrReturnObject().setErrMsg(result).toString();
|
|
|
+// } else {
|
|
|
+// JSONArray jsonArray = erpDocking.queryErpSainvoice(rows.get(0).getString("billno"));
|
|
|
+// ArrayList<String> dispatchsqlList = new ArrayList<>();
|
|
|
+// if (!jsonArray.isEmpty()) {
|
|
|
+// for (Object object1 : jsonArray) {
|
|
|
+// JSONObject jsonObject = (JSONObject) object1;
|
|
|
+// dispatchsqlList.add("update sa_dispatch_items set outwarehouseqty=" + jsonObject.getBigDecimal("fqty1") + " where rowno =" + jsonObject.getIntValue("frownum") + " and sa_dispatchid='" + sa_dispatchid + "' and siteid='" + siteid + "'");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// dbConnect.runSqlUpdate(dispatchsqlList);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
ArrayList<String> sqlList = new ArrayList<>();
|
|
|
|
|
|
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 sa_dispatch_items where sa_dispatchid=" + sa_dispatchid + ")");
|
|
@@ -688,37 +688,37 @@ public class dispatch extends Controller {
|
|
|
batchDeleteErr.addErr(row.getLong("sa_dispatch_itemsid"), "第" + row.getString("rowno") + "行的发货单明细已关闭,请勿重复关闭");
|
|
|
continue;
|
|
|
}
|
|
|
- if (Parameter.getBoolean("system.ccerp_dockswitch")) {
|
|
|
- ERPDocking erpDocking = new ERPDocking(siteid);
|
|
|
- if (!erpDocking.getUrl().isEmpty()) {
|
|
|
- String result = erpDocking.closeErpSainvoiceRow(row.getString("billno"), this, row.getLong("rowno"), row.getString("itemno"), row.getLong("sa_dispatchid"));
|
|
|
- if (!result.equals("true")) {
|
|
|
- batchDeleteErr.addErr(row.getLong("sa_dispatch_itemsid"), result);
|
|
|
- continue;
|
|
|
- } else {
|
|
|
- sqlList.add("update sa_dispatch_items set isclose=1 where sa_dispatch_itemsid=" + row.getLong("sa_dispatch_itemsid"));
|
|
|
- sqlList.add("update sa_orderitems set undeliqty=" + rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("undeliqty").add(row.getBigDecimal("qty").subtract(row.getBigDecimal("outwarehouseqty"))) + ",deliedqty=" + rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("deliedqty").subtract(row.getBigDecimal("qty").subtract(row.getBigDecimal("outwarehouseqty"))) + " where sa_orderitemsid=" + row.getLong("sa_orderitemsid"));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// if (Parameter.getBoolean("system.ccerp_dockswitch")) {
|
|
|
+// ERPDocking erpDocking = new ERPDocking(siteid);
|
|
|
+// if (!erpDocking.getUrl().isEmpty()) {
|
|
|
+// String result = erpDocking.closeErpSainvoiceRow(row.getString("billno"), this, row.getLong("rowno"), row.getString("itemno"), row.getLong("sa_dispatchid"));
|
|
|
+// if (!result.equals("true")) {
|
|
|
+// batchDeleteErr.addErr(row.getLong("sa_dispatch_itemsid"), result);
|
|
|
+// continue;
|
|
|
+// } else {
|
|
|
+// sqlList.add("update sa_dispatch_items set isclose=1 where sa_dispatch_itemsid=" + row.getLong("sa_dispatch_itemsid"));
|
|
|
+// sqlList.add("update sa_orderitems set undeliqty=" + rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("undeliqty").add(row.getBigDecimal("qty").subtract(row.getBigDecimal("outwarehouseqty"))) + ",deliedqty=" + rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("deliedqty").subtract(row.getBigDecimal("qty").subtract(row.getBigDecimal("outwarehouseqty"))) + " where sa_orderitemsid=" + row.getLong("sa_orderitemsid"));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
dbConnect.runSqlUpdate(sqlList);
|
|
|
|
|
|
Rows sumcountRows = dbConnect.runSqlQuery("select count(1) sumcount from sa_dispatch_items where sa_dispatchid=" + rows.get(0).getLong("sa_dispatchid") + " and siteid='" + siteid + "'");
|
|
|
Rows closecountRows = dbConnect.runSqlQuery("select count(1) closecount from sa_dispatch_items where sa_dispatchid=" + rows.get(0).getLong("sa_dispatchid") + " and siteid='" + siteid + "' and isclose=1");
|
|
|
if (sumcountRows.get(0).getLong("sumcount") == closecountRows.get(0).getLong("closecount")) {
|
|
|
- if (Parameter.getBoolean("system.ccerp_dockswitch")) {
|
|
|
- ERPDocking erpDocking = new ERPDocking(siteid);
|
|
|
- if (!erpDocking.getUrl().isEmpty()) {
|
|
|
- String result = erpDocking.closeErpSainvoice(rows.get(0).getString("billno"), true, this, rows.get(0).getLong("sa_dispatchid"));
|
|
|
- if (!result.equals("true")) {
|
|
|
- return getErrReturnObject().setErrMsg(result).toString();
|
|
|
- } else {
|
|
|
- dbConnect.runSqlUpdate("update sa_dispatch set status='手工关闭',closeby='" + username + "',closedate=CURRENT_TIMESTAMP where sa_dispatchid=" + rows.get(0).getLong("sa_dispatchid"));
|
|
|
- dbConnect.runSqlUpdate(DataContrlLog.createLog(this, "sa_dispatch", rows.get(0).getLong("sa_dispatchid"), "手工关闭", "发货单手工关闭成功").getSQL());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// if (Parameter.getBoolean("system.ccerp_dockswitch")) {
|
|
|
+// ERPDocking erpDocking = new ERPDocking(siteid);
|
|
|
+// if (!erpDocking.getUrl().isEmpty()) {
|
|
|
+// String result = erpDocking.closeErpSainvoice(rows.get(0).getString("billno"), true, this, rows.get(0).getLong("sa_dispatchid"));
|
|
|
+// if (!result.equals("true")) {
|
|
|
+// return getErrReturnObject().setErrMsg(result).toString();
|
|
|
+// } else {
|
|
|
+// dbConnect.runSqlUpdate("update sa_dispatch set status='手工关闭',closeby='" + username + "',closedate=CURRENT_TIMESTAMP where sa_dispatchid=" + rows.get(0).getLong("sa_dispatchid"));
|
|
|
+// dbConnect.runSqlUpdate(DataContrlLog.createLog(this, "sa_dispatch", rows.get(0).getLong("sa_dispatchid"), "手工关闭", "发货单手工关闭成功").getSQL());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
return batchDeleteErr.getReturnObject().toString();
|
|
@@ -975,16 +975,16 @@ public class dispatch extends Controller {
|
|
|
sqlList.add("update sa_dispatch set sa_orderid=" + orderRows.get(0).getLong("sa_orderid") + " where siteid='" + siteid + "' and sa_dispatchid=" + sa_dispatchid);
|
|
|
}
|
|
|
//对接erp生成erp发货单
|
|
|
- if (Parameter.getBoolean("system.ccerp_dockswitch")) {
|
|
|
- ERPDocking erpDocking = new ERPDocking(siteid);
|
|
|
- if (!erpDocking.getUrl().isEmpty()) {
|
|
|
- String result = erpDocking.createErpSainvoice(rows.get(0), rowsdetail, this, sa_dispatchid);
|
|
|
- if (!result.equals("true")) {
|
|
|
- System.out.println(result);
|
|
|
- return getErrReturnObject().setErrMsg(result).toString();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// if (Parameter.getBoolean("system.ccerp_dockswitch")) {
|
|
|
+// ERPDocking erpDocking = new ERPDocking(siteid);
|
|
|
+// if (!erpDocking.getUrl().isEmpty()) {
|
|
|
+// String result = erpDocking.createErpSainvoice(rows.get(0), rowsdetail, this, sa_dispatchid);
|
|
|
+// if (!result.equals("true")) {
|
|
|
+// System.out.println(result);
|
|
|
+// return getErrReturnObject().setErrMsg(result).toString();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
//对接erp成功后统一更新订单数量
|
|
|
for (Row row : rowsDispatchDetailGroup) {
|
|
|
logger.info(new Date() + "复核测试:" + "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"));
|