Просмотр исходного кода

发货计划明细订单信息刷新接口优化测试

hu 2 месяцев назад
Родитель
Сommit
45897dcaec

+ 19 - 0
src/custom/restcontroller/webmanage/sale/sendplan/SQL/发货计划订单未发货量(新).sql

@@ -0,0 +1,19 @@
+select t1.sa_orderitemsid,t2.itemid,t2.sa_orderid,t6.sa_agentsid,t5.enterprisename,t3.type,t3.billdate,t3.checkdate,t3.submitdate,t6.agentnum,t7.abbreviation,t4.marketingcategory,
+       t3.sonum,t4.itemno,t4.itemname,t4.model,t4.spec,t1.undeliqty,t1.willoutqty,(t1.undeliqty-t1.willoutqty) sendqty,t4.outplace  from
+    (select t.sa_orderitemsid,sum(t.undeliqty)undeliqty,sum(t.willoutqty)willoutqty from
+        (select sa_orderitemsid,undeliqty,0 willoutqty  from sa_orderitems t1
+                                                                 inner join sa_order t2 on t2.sa_orderid=t1.sa_orderid and t1.siteid=t2.siteid
+         where t1.isclose=0 and t1.undeliqty>0 and
+             t2.status='审核' and t1.siteid=$siteid$
+         union all
+         select t2.sa_orderitemsid,0,sum(qty) willoutfqty from st_stockbill t1
+                                                                   inner join st_stockbill_items t2 on t1.st_stockbillid=t2.st_stockbillid and t1.siteid=t2.siteid
+         where t1.status='新建'and t1.type='销售出库'and ifnull(t2.sa_orderitemsid,0)!=0 and t1.siteid=$siteid$
+         group by t2.sa_orderitemsid) t
+     group by t.sa_orderitemsid) t1
+        inner join sa_orderitems t2 on t1.sa_orderitemsid=t2.sa_orderitemsid
+        inner join sa_order t3 on t2.sa_orderid=t3.sa_orderid
+        inner join plm_item t4 on t2.itemid=t4.itemid
+        left join sys_enterprise_finance t5 on t3.sys_enterprise_financeid=t5.sys_enterprise_financeid and t3.siteid=t5.siteid
+        left join sa_agents t6 on t3.sys_enterpriseid=t6.sys_enterpriseid and t3.siteid=t6.siteid
+        left join sys_enterprise t7 on t3.sys_enterpriseid=t7.sys_enterpriseid and t3.siteid=t7.siteid where $where$ order by t2.itemid,t2.sa_orderid desc;

+ 2 - 2
src/custom/restcontroller/webmanage/sale/sendplan/SQL/发货计划订单未发货量.sql

@@ -1,4 +1,4 @@
-select t1.sa_orderitemsid,t2.itemid,t2.sa_orderid,t6.sa_agentsid,t5.enterprisename,t3.type,t3.billdate,t3.checkdate,t3.submitdate,t6.agentnum,t7.abbreviation,t4.marketingcategory,
+select t1.sa_orderitemsid,t2.sa_orderid,t6.sa_agentsid,t5.enterprisename,t3.type,t3.billdate,t3.checkdate,t3.submitdate,t6.agentnum,t7.abbreviation,t4.marketingcategory,
        t3.sonum,t4.itemno,t4.itemname,t4.model,t4.spec,t1.undeliqty,t1.willoutqty,(t1.undeliqty-t1.willoutqty) sendqty,t4.outplace  from
     (select t.sa_orderitemsid,sum(t.undeliqty)undeliqty,sum(t.willoutqty)willoutqty from
         (select sa_orderitemsid,undeliqty,0 willoutqty  from sa_orderitems t1
@@ -16,4 +16,4 @@ select t1.sa_orderitemsid,t2.itemid,t2.sa_orderid,t6.sa_agentsid,t5.enterprisena
         inner join plm_item t4 on t2.itemid=t4.itemid
         left join sys_enterprise_finance t5 on t3.sys_enterprise_financeid=t5.sys_enterprise_financeid and t3.siteid=t5.siteid
         left join sa_agents t6 on t3.sys_enterpriseid=t6.sys_enterpriseid and t3.siteid=t6.siteid
-        left join sys_enterprise t7 on t3.sys_enterpriseid=t7.sys_enterpriseid and t3.siteid=t7.siteid where $where$ order by t2.itemid,t2.sa_orderid desc;
+        left join sys_enterprise t7 on t3.sys_enterpriseid=t7.sys_enterpriseid and t3.siteid=t7.siteid where $where$;

+ 4 - 4
src/custom/restcontroller/webmanage/sale/sendplan/sendplandetail.java

@@ -44,7 +44,7 @@ public class sendplandetail extends Controller {
                 "\t\t\t)\n" +
                 "\t\t))");
 
-        SQLFactory sqlFactory = new SQLFactory(this, "发货计划订单未发货量");
+        SQLFactory sqlFactory = new SQLFactory(this, "发货计划订单未发货量(新)");
         sqlFactory.addParameter_SQL("where", where);
         sqlFactory.addParameter("siteid", siteid);
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
@@ -62,10 +62,11 @@ public class sendplandetail extends Controller {
         long olditemid=0;
         BigDecimal oldcanuseqty=BigDecimal.ZERO;
         BigDecimal oldsendqty=BigDecimal.ZERO;
+        long[] sendplandetailids = createTableID("sa_sendplandetail", rows.size());
+        int i = 0;
         for (Row row : rows) {
             InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sa_sendplandetail");
-            long sa_sendplandetailid=createTableID("sa_sendplandetail");
-            insertSQL.setUniqueid(sa_sendplandetailid);
+            insertSQL.setUniqueid(sendplandetailids[i++]);
             insertSQL.setSiteid(siteid);
             insertSQL.setValue("sa_sendplanid", sa_sendplanid);
             insertSQL.setValue("sa_orderid", row.getLong("sa_orderid"));
@@ -112,7 +113,6 @@ public class sendplandetail extends Controller {
             }
             olditemid=row.getLong("itemid");
             oldsendqty=sendqty;
-
             list.add(insertSQL.getSQL());
         }
         dbConnect.runSqlUpdate(list);