|
@@ -505,27 +505,41 @@ public class OrderItems extends Controller {
|
|
|
Long sa_orderid = content.getLong("sa_orderid");
|
|
Long sa_orderid = content.getLong("sa_orderid");
|
|
|
Long sa_orderitemsid = content.getLong("sa_orderitemsid");
|
|
Long sa_orderitemsid = content.getLong("sa_orderitemsid");
|
|
|
BigDecimal canoffqty = content.getBigDecimal("canoffqty");
|
|
BigDecimal canoffqty = content.getBigDecimal("canoffqty");
|
|
|
|
|
+ JSONArray sa_tpartreimbursementids = new JSONArray();
|
|
|
|
|
+ if (content.containsKey("sa_tpartreimbursementids")) {
|
|
|
|
|
+ sa_tpartreimbursementids = content.getJSONArray("sa_tpartreimbursementids");
|
|
|
|
|
+ }
|
|
|
Rows orderRows = dbConnect.runSqlQuery("SELECT status,sonum,type from sa_order WHERE sa_orderid=" + sa_orderid + " and siteid='" + siteid + "'");
|
|
Rows orderRows = dbConnect.runSqlQuery("SELECT status,sonum,type from sa_order WHERE sa_orderid=" + sa_orderid + " and siteid='" + siteid + "'");
|
|
|
- Rows orderitemsRows = dbConnect.runSqlQuery("SELECT sa_orderitemsid,qty,billingstatus,rowno from sa_orderitems WHERE sa_orderid=" + sa_orderid + " and sa_orderitemsid='" + sa_orderitemsid + "'");
|
|
|
|
|
|
|
+ Rows orderitemsRows = dbConnect.runSqlQuery("SELECT sa_orderitemsid,qty,billingstatus,rowno,itemname,canoffqty from sa_orderitems WHERE sa_orderid=" + sa_orderid + " and sa_orderitemsid='" + sa_orderitemsid + "'");
|
|
|
if (orderRows.isEmpty()) {
|
|
if (orderRows.isEmpty()) {
|
|
|
return getErrReturnObject().setErrMsg("配件订单不存在").toString();
|
|
return getErrReturnObject().setErrMsg("配件订单不存在").toString();
|
|
|
}
|
|
}
|
|
|
- if (!orderRows.get(0).getString("type").equals("配件订单")) {
|
|
|
|
|
|
|
+ Row orderRow = orderRows.get(0);
|
|
|
|
|
+ if (!orderRow.getString("type").equals("配件订单")) {
|
|
|
return getErrReturnObject().setErrMsg("非配件订单无法更新可核销数").toString();
|
|
return getErrReturnObject().setErrMsg("非配件订单无法更新可核销数").toString();
|
|
|
}
|
|
}
|
|
|
- if (orderRows.get(0).getString("status").equals("审核")) {
|
|
|
|
|
- return getErrReturnObject().setErrMsg("配件订单【" + orderRows.get(0).getString("sonum") + "】已审核,无法更新可核销数").toString();
|
|
|
|
|
|
|
+ if (orderRow.getString("status").equals("审核")) {
|
|
|
|
|
+ return getErrReturnObject().setErrMsg("配件订单【" + orderRow.getString("sonum") + "】已审核,无法更新可核销数").toString();
|
|
|
}
|
|
}
|
|
|
if (orderitemsRows.isEmpty()) {
|
|
if (orderitemsRows.isEmpty()) {
|
|
|
return getErrReturnObject().setErrMsg("订单明细不存在").toString();
|
|
return getErrReturnObject().setErrMsg("订单明细不存在").toString();
|
|
|
}
|
|
}
|
|
|
- if (!orderitemsRows.get(0).getString("billingstatus").equals("保内收费")) {
|
|
|
|
|
- //return getErrReturnObject().setErrMsg("行号【"+orderitemsRows.get(0).getString("rowno")+"】为非保内收费配件,无法更新可核销数").toString();
|
|
|
|
|
- }
|
|
|
|
|
- if (orderitemsRows.get(0).getBigDecimal("qty").compareTo(canoffqty) < 0) {
|
|
|
|
|
|
|
+ Row orderitemsRow = orderitemsRows.get(0);
|
|
|
|
|
+ if (orderitemsRow.getBigDecimal("qty").compareTo(canoffqty) < 0) {
|
|
|
return getErrReturnObject().setErrMsg("可核销数不可大于商品明细行数量").toString();
|
|
return getErrReturnObject().setErrMsg("可核销数不可大于商品明细行数量").toString();
|
|
|
}
|
|
}
|
|
|
|
|
+ String itemname = orderitemsRow.getString("itemname");
|
|
|
|
|
+ BigDecimal canoffqty_old = orderitemsRow.getBigDecimal("canoffqty");
|
|
|
|
|
+
|
|
|
dbConnect.runSqlUpdate("update sa_orderitems set canoffqty=" + canoffqty + " where sa_orderitemsid=" + sa_orderitemsid);
|
|
dbConnect.runSqlUpdate("update sa_orderitems set canoffqty=" + canoffqty + " where sa_orderitemsid=" + sa_orderitemsid);
|
|
|
|
|
+
|
|
|
|
|
+ DataContrlLog.createLog(this, "sa_order", sa_orderid, "更新可核销数", "【" + itemname + "】可核销数量 由" + canoffqty_old + " 变更为 " + canoffqty).insert();
|
|
|
|
|
+ for (Object obj : sa_tpartreimbursementids) {
|
|
|
|
|
+ Long sa_tpartreimbursementid = Long.parseLong(obj.toString());
|
|
|
|
|
+ DataContrlLog.createLog(this, "sa_tpartreimbursement", sa_tpartreimbursementid, "更新可核销数", "【" + itemname + "】可核销数量 由" + canoffqty_old + " 变更为 " + canoffqty).insert();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
return getSucReturnObject().toString();
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -996,6 +1010,11 @@ public class OrderItems extends Controller {
|
|
|
Rows itempriceRows = dbConnect.runSqlQuery(sqlFactory3);
|
|
Rows itempriceRows = dbConnect.runSqlQuery(sqlFactory3);
|
|
|
RowsMap itempriceRowsMap = itempriceRows.toRowsMap("itemno");
|
|
RowsMap itempriceRowsMap = itempriceRows.toRowsMap("itemno");
|
|
|
|
|
|
|
|
|
|
+ QuerySQL tpartreimbursement = SQLFactory.createQuerySQL(this, "sa_tpartreimbursementdetail", "sa_tpartreimbursementid", "sa_orderitemsid").setTableAlias("t1");
|
|
|
|
|
+ tpartreimbursement.addJoinTable(JOINTYPE.inner, "sa_tpartreimbursement", "t2", "t2.sa_tpartreimbursementid=t1.sa_tpartreimbursementid", "billno");
|
|
|
|
|
+ tpartreimbursement.setWhere("t1.sa_orderitemsid", rows.toArrayList("sa_orderitemsid"));
|
|
|
|
|
+ RowsMap tpartreimbursementRowsMap = tpartreimbursement.query().toRowsMap("sa_orderitemsid");
|
|
|
|
|
+
|
|
|
|
|
|
|
|
//查询附件
|
|
//查询附件
|
|
|
RowsMap attinfoRowsMap = getAttachmentUrl("plm_item", ids);
|
|
RowsMap attinfoRowsMap = getAttachmentUrl("plm_item", ids);
|
|
@@ -1010,19 +1029,6 @@ public class OrderItems extends Controller {
|
|
|
} else {
|
|
} else {
|
|
|
row.put("originalprice", BigDecimal.ZERO);
|
|
row.put("originalprice", BigDecimal.ZERO);
|
|
|
}
|
|
}
|
|
|
-// if (sumQtyRowsMap.get(row.getString("itemno")).isNotEmpty()) {
|
|
|
|
|
-// row.put("unsoldqty", sumQtyRowsMap.get(row.getString("itemno")).get(0).getBigDecimal("qty"));
|
|
|
|
|
-// } else {
|
|
|
|
|
-// row.put("unsoldqty", BigDecimal.ZERO);
|
|
|
|
|
-// }
|
|
|
|
|
-// if (sumUnQtyRowsMap.get(row.getString("itemno")).isNotEmpty()) {
|
|
|
|
|
-// row.put("undeliqtysum", sumUnQtyRowsMap.get(row.getString("itemno")).get(0).getBigDecimal("undeliqty"));
|
|
|
|
|
-// } else {
|
|
|
|
|
-// row.put("undeliqtysum", BigDecimal.ZERO);
|
|
|
|
|
-// }
|
|
|
|
|
-// if (!row.containsKey("invbalqty")) {
|
|
|
|
|
-// row.put("invbalqty", BigDecimal.ZERO);
|
|
|
|
|
-// }
|
|
|
|
|
row.put("attinfos", attinfoRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
|
|
row.put("attinfos", attinfoRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
|
|
|
row.put("contractprice", 0);
|
|
row.put("contractprice", 0);
|
|
|
//处理日期字段空的情况
|
|
//处理日期字段空的情况
|
|
@@ -1038,6 +1044,9 @@ public class OrderItems extends Controller {
|
|
|
row.put("cover", "");
|
|
row.put("cover", "");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ Long sa_orderitemsid = row.getLong("sa_orderitemsid");
|
|
|
|
|
+ row.put("tpartreimbursement", tpartreimbursementRowsMap.getOrDefault(sa_orderitemsid, new Rows()));
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
}
|