|
|
@@ -1392,7 +1392,7 @@ public class Order extends Controller {
|
|
|
return getErrReturnObject().setErrMsg("订单不存在").toString();
|
|
|
}
|
|
|
Row row = rows.get(0);
|
|
|
- if(!row.getString("status").equals("提交")){
|
|
|
+ if (!row.getString("status").equals("提交")) {
|
|
|
return getErrReturnObject().setErrMsg("非提交状态无法撤回").toString();
|
|
|
}
|
|
|
Long sa_accountclassid = row.getLong("sa_accountclassid");
|
|
|
@@ -2281,4 +2281,56 @@ public class Order extends Controller {
|
|
|
"select WAREHOUSE,QTY,LOCATION,LOT from v_eso_actual_inventory where FITEMNO = '" + erpitemno + "' and SITEID='" + sid + "' and QTY>=" + qty);
|
|
|
return getSucReturnObject().setData(icrows).toString();
|
|
|
}
|
|
|
+
|
|
|
+ @API(title = "订单手动关闭", apiversion = R.ID20230406155202.v1.class)
|
|
|
+ public String closeOrder() throws YosException {
|
|
|
+ Long sa_orderid = content.getLong("sa_orderid");
|
|
|
+
|
|
|
+ Rows orderRow = getOrderRows(this, sa_orderid);
|
|
|
+ if (orderRow.isEmpty()) {
|
|
|
+ return getErrReturnObject().setErrMsg("订单不存在").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ Long sys_enterpriseid = orderRow.get(0).getLong("sys_enterpriseid");
|
|
|
+ Long sa_accountclassid = orderRow.get(0).getLong("sa_accountclassid");
|
|
|
+
|
|
|
+ ArrayList<String> sqlList = new ArrayList<>();
|
|
|
+ sqlList.add("UPDATE sa_order SET STATUS='关闭' WHERE sa_orderid='" + sa_orderid + "' and siteid = '" + siteid + "'");
|
|
|
+
|
|
|
+ Rows rows = dbConnect.runSqlQuery("SELECT sum(undeliqty*price) totalprice from sa_orderitems WHERE sa_orderid=39798 and siteid = '"+siteid+"'");
|
|
|
+ if (rows.isNotEmpty()) {
|
|
|
+ BigDecimal totalprice = rows.get(0).getBigDecimal("totalprice");
|
|
|
+ if (totalprice.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ sqlList.add("UPDATE sa_accountbalance set balance=" + totalprice + " WHERE sys_enterpriseid=" + sys_enterpriseid + " and sa_accountclassid=" + sa_accountclassid + " and siteid='" + siteid + "'");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ sqlList.add(DataContrlLog.createLog(this, "sa_order", sa_orderid, "订单手动关闭", "订单手动关闭").getSQL());
|
|
|
+
|
|
|
+ dbConnect.runSqlUpdate(sqlList);
|
|
|
+
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @API(title = "发货单手动关闭", apiversion = R.ID20230406155302.v1.class)
|
|
|
+ public String closeDispatch() throws YosException {
|
|
|
+
|
|
|
+ Long sa_dispatchid = content.getLongValue("sa_dispatchid");
|
|
|
+
|
|
|
+ ArrayList<String> sqlList = new ArrayList<>();
|
|
|
+ sqlList.add("UPDATE sa_dispatch SET STATUS='关闭' WHERE sa_dispatchid='" + sa_dispatchid + "' and siteid = '" + siteid + "'");
|
|
|
+ Rows rows = dbConnect.runSqlQuery("SELECT qty,sa_orderitemsid FROM sa_dispatch_items WHERE sa_dispatchid='" + sa_dispatchid + "' and siteid = '" + siteid + "'");
|
|
|
+ for (Row row : rows) {
|
|
|
+ Long sa_orderitemsid = row.getLong("sa_orderitemsid");
|
|
|
+ Long qty = row.getLong("qty");
|
|
|
+ sqlList.add("UPDATE sa_orderitems SET undeliqty=qty-" + qty + " WHERE sa_orderitemsid='" + sa_orderitemsid + "' and siteid = '" + siteid + "'");
|
|
|
+ }
|
|
|
+ sqlList.add(DataContrlLog.createLog(this, "sa_dispatch", sa_dispatchid, "发货单手动关闭", "发货单手动关闭").getSQL());
|
|
|
+
|
|
|
+ dbConnect.runSqlUpdate(sqlList);
|
|
|
+
|
|
|
+
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
}
|