Parcourir la source

订单明细列表优化

eganwu il y a 2 ans
Parent
commit
2cb5e50141

+ 6 - 5
src/custom/restcontroller/webmanage/sale/order/OrderItems.java

@@ -353,8 +353,8 @@ public class OrderItems extends Controller {
         }
         JSONArray jsonArray = new JSONArray();
         BigDecimal orderSumamount = BigDecimal.ZERO;
-        Rows classamountrows = dbConnect.runSqlQuery("select t2.marketingcategory topitemclassid,t1.siteid,sum(ifnull(t1.amount,0)) sumamount  from sa_orderitems t1 inner join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid   where t1.sa_orderid='"+sa_orderid+"' group by t2.marketingcategory,t1.siteid");
-            for (Row classamountrow : classamountrows) {
+        Rows classamountrows = dbConnect.runSqlQuery("select t2.marketingcategory topitemclassid,t1.siteid,sum(ifnull(t1.amount,0)) sumamount  from sa_orderitems t1 inner join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid   where t1.sa_orderid='" + sa_orderid + "' group by t2.marketingcategory,t1.siteid");
+        for (Row classamountrow : classamountrows) {
             orderSumamount = orderSumamount.add(classamountrow.getBigDecimal("sumamount"));
         }
         if (orderSumamount.compareTo(getAmount(this, sa_orderid)) != 0) {
@@ -665,17 +665,18 @@ public class OrderItems extends Controller {
         sqlFactory.addParameter_SQL("where", where);
         Rows rows = dbConnect.runSqlQuery(sqlFactory);
         ArrayList<Long> ids = rows.toArrayList("itemid", new ArrayList<>());
+        ArrayList<Long> itemnos = rows.toArrayList("itemno", new ArrayList<>());
         RowsMap rowsMap = rows.toRowsMap("itemno");
 
         SQLFactory sqlFactory1 = new SQLFactory(this, "商品发货数量汇总");
         sqlFactory1.addParameter("siteid", siteid);
-        sqlFactory1.addParameter_in("itemid", ids);
+        sqlFactory1.addParameter_in("itemnos", itemnos);
         Rows sumQtyRows = dbConnect.runSqlQuery(sqlFactory1);
         RowsMap sumQtyRowsMap = sumQtyRows.toRowsMap("itemno");
 
         SQLFactory sqlFactory2 = new SQLFactory(this, "商品未发货数量汇总");
         sqlFactory2.addParameter("siteid", siteid);
-        sqlFactory2.addParameter_in("itemid", ids);
+        sqlFactory2.addParameter_in("itemnos", itemnos);
         Rows sumUnQtyRows = dbConnect.runSqlQuery(sqlFactory2);
         RowsMap sumUnQtyRowsMap = sumUnQtyRows.toRowsMap("itemno");
 
@@ -783,7 +784,7 @@ public class OrderItems extends Controller {
             if (whereObject.containsKey("isuncheckout") && !"".equals(whereObject.getString("isuncheckout"))) {
                 String begindate = "";
                 String enddate = "";
-                if(whereObject.containsKey("datetype") && !"".equals(whereObject.getString("datetype"))) {
+                if (whereObject.containsKey("datetype") && !"".equals(whereObject.getString("datetype"))) {
                     String datetype = whereObject.getStringValue("datetype");
                     switch (datetype) {
                         case "7":

+ 2 - 2
src/custom/restcontroller/webmanage/sale/order/SQL/商品发货数量汇总.sql

@@ -3,5 +3,5 @@ SELECT  t3.itemno,
 FROM sa_dispatch_items t1
          inner join sa_dispatch t2 on t1.siteid = t2.siteid and t1.sa_dispatchid = t2.sa_dispatchid
          left join plm_item t3 on t1.siteid = t3.siteid and t1.itemid = t3.itemid
-          inner join sa_orderitems t4 on t1.sa_orderitemsid=t4.sa_orderitemsid and t1.siteid = t4.siteid
-WHERE t2.STATUS in ('审核','复核') and t1.siteid=$siteid$ and t1.itemid in $itemid$ group by t3.itemno
+         inner join sa_orderitems t4 on t1.sa_orderitemsid=t4.sa_orderitemsid and t1.siteid = t4.siteid
+WHERE t2.STATUS in ('审核','复核') and t1.siteid=$siteid$ and t3.itemno in $itemnos$ group by t3.itemno

+ 1 - 1
src/custom/restcontroller/webmanage/sale/order/SQL/商品未发货数量汇总.sql

@@ -3,4 +3,4 @@ SELECT t1.itemno,
 FROM sa_orderitems t1
          inner join sa_order t3 on t1.siteid=t3.siteid and t1.sa_orderid=t3.sa_orderid
 WHERE t3.STATUS in ('审核')
-and  t1.siteid=$siteid$ and t1.itemid in $itemid$  group by t1.itemno
+  and  t1.siteid=$siteid$ and t1.itemno in $itemnos$ group by t1.itemno