|
|
@@ -26,6 +26,7 @@ import restcontroller.webmanage.sale.aftersalesmag.twriteoffbill_orderchange;
|
|
|
import restcontroller.webmanage.sale.rebate.Rebate;
|
|
|
import restcontroller.webmanage.sale.toolbill.ToolBilItem;
|
|
|
import restcontroller.webmanage.sale.toolbill.ToolBill;
|
|
|
+import utility.ERPDocking;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
@@ -347,9 +348,42 @@ public class OrderItems extends Controller {
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
ArrayList<Long> ids = rows.toArrayList("itemid", new ArrayList<>());
|
|
|
+ RowsMap rowsMap =rows.toRowsMap("itemno");
|
|
|
+
|
|
|
+ SQLFactory sqlFactory1 =new SQLFactory(this,"商品发货数量汇总");
|
|
|
+ sqlFactory1.addParameter("siteid", siteid);
|
|
|
+ Rows sumQtyRows = dbConnect.runSqlQuery(sqlFactory1);
|
|
|
+ RowsMap sumQtyRowsMap= sumQtyRows.toRowsMap("itemno");
|
|
|
+
|
|
|
+ ERPDocking erpDocking =new ERPDocking();
|
|
|
+ JSONArray jsonArray =new JSONArray();
|
|
|
+ if(rows.toJsonArray("itemno").size()!=0){
|
|
|
+ if (Parameter.get("system.ccerp_dockswitch").equalsIgnoreCase("true")) {
|
|
|
+ jsonArray=erpDocking.getErpIcinvbalRows(200000, 1,rows.toJsonArray("itemno"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!jsonArray.isEmpty()){
|
|
|
+ for (Object object:jsonArray) {
|
|
|
+ JSONObject jsonObject =(JSONObject)object;
|
|
|
+ if(rowsMap.containsKey(jsonObject.getString("fitemno"))){
|
|
|
+ if(rowsMap.get(jsonObject.getString("fitemno")).isNotEmpty()){
|
|
|
+ rowsMap.get(jsonObject.getString("fitemno")).get(0).put("invbalqty", jsonObject.getBigDecimalValue("fqty"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//查询附件
|
|
|
RowsMap attinfoRowsMap = getAttachmentUrl("plm_item", ids);
|
|
|
for (Row row : rows) {
|
|
|
+ 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(!row.containsKey("invbalqty")){
|
|
|
+ row.put("invbalqty",BigDecimal.ZERO);
|
|
|
+ }
|
|
|
row.put("attinfos", attinfoRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
|
|
|
row.put("contractprice", 0);
|
|
|
}
|