hxh пре 4 месеци
родитељ
комит
ddf7ad4f50

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

@@ -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$ order by t2.itemid,t3.checkdate asc;

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

@@ -50,9 +50,9 @@ public class sendplandetail extends Controller {
         sqlFactory.addParameter("siteid", siteid);
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
 
-        Rows stockbillrows = dbConnect.runSqlQuery("select t2.itemid,sum(t2.undeliqty) qty from sa_order t1 " +
-                " inner join sa_orderitems t2 on t1.sa_orderid=t2.sa_orderid " +
-                " where t1.status='审核' and t2.isclose=0 and t2.undeliqty>0 and t1.siteid='" + siteid + "' " +
+        Rows stockbillrows = dbConnect.runSqlQuery("select t2.itemid,sum(t2.qty) qty from st_stockbill t1 " +
+                " inner join st_stockbill_items t2 on t1.st_stockbillid=t2.st_stockbillid " +
+                " where t1.status='新建' and t1.type='销售出库' and t1.billdate<='"+sendplanRows.get(0).getString("senddate")+"' and t1.siteid='" + siteid + "' " +
                 " group by t2.itemid ");
         Rows invbalSalerows = dbConnect.runSqlQuery("select itemid,qty from st_invbal_sale");
 
@@ -627,7 +627,7 @@ public class sendplandetail extends Controller {
         querySQL.setCondition("t1.outplace", "t2.sonum", "t4.agentnum", "t5.enterprisename");
         querySQL.setPage(pageSize, pageNumber);
         querySQL.setWhere("sa_sendplanid", sa_sendplanid);
-        querySQL.setOrderBy("t2.sa_orderid desc");
+        querySQL.setOrderBy("t2.checkdate asc");
         Rows rows = querySQL.query();