|
|
@@ -296,19 +296,54 @@ public class sendplandetail extends Controller {
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t5", "t5.siteid = t4.siteid and t5.sys_enterpriseid = t4.sys_enterpriseid", "enterprisename", "abbreviation");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "plm_item", "t6", "t6.siteid = t3.siteid and t6.itemid = t3.itemid", "itemno", "itemname", "model", "itemid","topclassnum");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, sqlFactory, "t7", "t7.sa_orderitemsid = t3.sa_orderitemsid", "undeliqty");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "st_invbal", "t8", "t8.itemid = t3.itemid and t8.stockid in(select t.stockid from st_stock t where stockno='101')");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "st_invbal", "t9", "t9.itemid = t3.itemid and t9.stockid in(select t.stockid from st_stock t where stockno='103')");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "st_invbal", "t10", "t10.itemid = t3.itemid and t10.stockid in(select t.stockid from st_stock t where stockno='109')");
|
|
|
querySQL.addQueryFields("willoutqty_jh", "t7.willoutqty");
|
|
|
- querySQL.addQueryFields("qty_xs", "t8.qty");
|
|
|
- querySQL.addQueryFields("qty_tq", "t9.qty");
|
|
|
- querySQL.addQueryFields("qty_mq", "t10.qty");
|
|
|
querySQL.addQueryFields("sendqty_canzhao", "t1.sendqty");
|
|
|
querySQL.setSiteid(siteid);
|
|
|
querySQL.setCondition("t1.outplace", "t2.sonum", "t4.agentnum", "t5.enterprisename");
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
querySQL.setWhere("sa_sendplanid", sa_sendplanid);
|
|
|
Rows rows = querySQL.query();
|
|
|
+
|
|
|
+
|
|
|
+ QuerySQL querySQL_ck=SQLFactory.createQuerySQL(this,"st_invbal","itemid","qty");
|
|
|
+ querySQL_ck.setTableAlias("t1");
|
|
|
+ querySQL_ck.addJoinTable(JOINTYPE.left, "st_stock", "t2", "t1.siteid = t2.siteid and t1.stockid = t2.stockid", "stockno");
|
|
|
+ querySQL_ck.setSiteid(siteid);
|
|
|
+ querySQL_ck.setWhere("t1.itemid", rows.toArrayList("itemid"));
|
|
|
+ Rows rows_ck = querySQL_ck.query();
|
|
|
+ RowsMap rowsCkRowsMap =rows_ck.toRowsMap("stockno");
|
|
|
+ for(Row row :rows){
|
|
|
+ if(rowsCkRowsMap.containsKey("101")){
|
|
|
+ if(rowsCkRowsMap.get("101").toRowsMap("itemid").containsKey(row.getString("itemid"))){
|
|
|
+ row.put("qty_xs",rowsCkRowsMap.get("101").toRowsMap("itemid").get(row.getString("itemid")).get(0).getBigDecimal("qty"));
|
|
|
+ }else{
|
|
|
+ row.put("qty_xs",0);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ row.put("qty_xs",0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(rowsCkRowsMap.containsKey("103")){
|
|
|
+ if(rowsCkRowsMap.get("103").toRowsMap("itemid").containsKey(row.getString("itemid"))){
|
|
|
+ row.put("qty_tq",rowsCkRowsMap.get("103").toRowsMap("itemid").get(row.getString("itemid")).get(0).getBigDecimal("qty"));
|
|
|
+ }else{
|
|
|
+ row.put("qty_tq",0);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ row.put("qty_tq",0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(rowsCkRowsMap.containsKey("109")){
|
|
|
+ if(rowsCkRowsMap.get("109").toRowsMap("itemid").containsKey(row.getString("itemid"))){
|
|
|
+ row.put("qty_mq",rowsCkRowsMap.get("109").toRowsMap("itemid").get(row.getString("itemid")).get(0).getBigDecimal("qty"));
|
|
|
+ }else{
|
|
|
+ row.put("qty_mq",0);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ row.put("qty_mq",0);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
|