|
|
@@ -887,7 +887,7 @@ public class databoard extends Controller {
|
|
|
*/
|
|
|
StringBuffer where = new StringBuffer(" 1=1 ");
|
|
|
if (sys_enterpriseid > 0) {
|
|
|
- where.append(" and t3.sys_enterpriseid=" + sys_enterpriseid);
|
|
|
+ where.append(" and t1.sys_enterpriseid=" + sys_enterpriseid);
|
|
|
|
|
|
}
|
|
|
if (content.containsKey("where")) {
|
|
|
@@ -900,17 +900,39 @@ public class databoard extends Controller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- SQLFactory factory = new SQLFactory(this, "工厂待发明细查询");
|
|
|
+ SQLFactory factory = new SQLFactory(this, "工厂待发订单明细查询");
|
|
|
factory.addParameter("siteid", siteid);
|
|
|
factory.addParameter_SQL("where", where);
|
|
|
Rows rows = dbConnect.runSqlQuery(factory.getSQL(false));
|
|
|
|
|
|
- SQLFactory sumfactory = new SQLFactory(this, "工厂待发合计金额及数量查询");
|
|
|
+ SQLFactory sumfactory = new SQLFactory(this, "工厂待发发货明细查询");
|
|
|
sumfactory.addParameter("siteid", siteid);
|
|
|
- sumfactory.addParameter_SQL("where", where);
|
|
|
+ sumfactory.addParameter_in("sa_orderitemsids", rows.toArrayList("sa_orderitemsid",new ArrayList<Long>()));
|
|
|
Rows sumrows = dbConnect.runSqlQuery(sumfactory.getSQL(false));
|
|
|
+ RowsMap sumrowsMap =sumrows.toRowsMap("sa_orderitemsid");
|
|
|
+ BigDecimal sumundeliqty=BigDecimal.ZERO;
|
|
|
+ BigDecimal sumundeliamount=BigDecimal.ZERO;
|
|
|
+ for (Row row :rows) {
|
|
|
+ if(sumrowsMap.containsKey(row.getString("sa_orderitemsid"))){
|
|
|
+ row.put("undeliqty", row.getBigDecimal("qty").subtract(sumrowsMap.get(row.getString("sa_orderitemsid")).get(0).getBigDecimal("sumoutwarehouseqty")));
|
|
|
+ row.put("undeliamount", (row.getBigDecimal("qty").subtract(sumrowsMap.get(row.getString("sa_orderitemsid")).get(0).getBigDecimal("sumoutwarehouseqty"))).multiply(row.getBigDecimal("price")));
|
|
|
+ sumundeliqty=sumundeliqty.add(row.getBigDecimal("qty").subtract(sumrowsMap.get(row.getString("sa_orderitemsid")).get(0).getBigDecimal("sumoutwarehouseqty")));
|
|
|
+ sumundeliamount=sumundeliamount.add((row.getBigDecimal("qty").subtract(sumrowsMap.get(row.getString("sa_orderitemsid")).get(0).getBigDecimal("sumoutwarehouseqty"))).multiply(row.getBigDecimal("price")));
|
|
|
+ }else{
|
|
|
+ row.put("undeliqty",row.getBigDecimal("qty"));
|
|
|
+ row.put("undeliamount",row.getBigDecimal("amount"));
|
|
|
+ sumundeliqty=sumundeliqty.add(row.getBigDecimal("qty"));
|
|
|
+ sumundeliamount=sumundeliamount.add(row.getBigDecimal("amount"));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
if (rows.isNotEmpty()) {
|
|
|
- rows.get(0).put("sumrows", sumrows);
|
|
|
+ Rows sumrowstotal= new Rows();
|
|
|
+ Row row =new Row();
|
|
|
+ row.put("sumundeliqty",sumundeliqty);
|
|
|
+ row.put("sumundeliamount",sumundeliamount);
|
|
|
+ sumrowstotal.add(row);
|
|
|
+ rows.get(0).put("sumrows", sumrowstotal);
|
|
|
}
|
|
|
|
|
|
return getSucReturnObject().setData(rows).toString();
|