Selaa lähdekoodia

修改订单行折扣判断订单状态及查询Erp库存列表更新

hu 2 vuotta sitten
vanhempi
commit
7f4ff8f79b

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

@@ -3,4 +3,6 @@ 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
          inner join plm_item t3 on t1.siteid = t3.siteid and t1.itemid = t3.itemid
-WHERE t2.STATUS in ('审核','复核') and t1.siteid=$siteid$ group by t3.itemno
+         left join sys_enterprise t5 on t2.sys_enterpriseid=t5.sys_enterpriseid and t2.siteid=t5.siteid
+         left join  sa_agents t6 on t6.sys_enterpriseid=t2.sys_enterpriseid and t2.siteid=t6.siteid
+WHERE t2.STATUS in ('审核','复核') and t1.siteid=$siteid$ and $where$ group by t3.itemno

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

@@ -5,5 +5,7 @@ FROM sa_orderitems t1
          inner join plm_item t2 on t1.siteid = t2.siteid and t1.itemid = t2.itemid
          inner join sa_order t3 on t1.siteid=t3.siteid and t1.sa_orderid=t3.sa_orderid
          left join plm_unit t4 on t2.unitid=t4.unitid and t2.siteid=t4.siteid
-WHERE t3.STATUS in ('提交','审核')
+         left join sys_enterprise t5 on t3.sys_enterpriseid=t5.sys_enterpriseid and t3.siteid=t5.siteid
+         left join  sa_agents t6 on t6.sys_enterpriseid=t3.sys_enterpriseid and t3.siteid=t6.siteid
+WHERE t3.STATUS in ('提交','审核') and $where$
 and  t1.siteid=$siteid$ group by t1.itemno

+ 1 - 1
src/custom/restcontroller/webmanage/sale/invbal/SQL/未发货订单明细列表.sql

@@ -13,7 +13,7 @@ FROM sa_orderitems t1
          inner join plm_item t2 on t1.siteid = t2.siteid and t1.itemid = t2.itemid
          inner join sa_order t3 on t1.siteid=t3.siteid and t1.sa_orderid=t3.sa_orderid
          left join plm_unit t4 on t2.unitid=t4.unitid and t2.siteid=t4.siteid
-         left join sys_enterprise t5 on t3.sys_enterpriseid=t5.sys_enterpriseid and t3.sys_enterpriseid=t5.sys_enterpriseid
+         left join sys_enterprise t5 on t3.sys_enterpriseid=t5.sys_enterpriseid and t3.siteid=t5.siteid
          left join  sa_agents t6 on t6.sys_enterpriseid=t3.sys_enterpriseid and t3.siteid=t6.siteid
 WHERE t3.STATUS in ('提交','审核')
   and ifnull(t1.undeliqty, 0) !=0

+ 10 - 0
src/custom/restcontroller/webmanage/sale/invbal/invbal.java

@@ -163,11 +163,21 @@ public class invbal extends Controller {
 
 		SQLFactory sqlFactory1 =new SQLFactory(this,"商品发货数量汇总");
 		sqlFactory1.addParameter("siteid", siteid);
+		where=" 1=1 ";
+		if(!StringUtils.isBlank(agentinfo)){
+			where=" and t6.agentnum like '%"+agentinfo+"%' or t5.enterprisename like '%"+agentinfo+"%' ";
+		}
+		sqlFactory1.addParameter_SQL("where", where);
 		Rows sumQtyRows = dbConnect.runSqlQuery(sqlFactory1);
 		RowsMap sumQtyRowsMap= sumQtyRows.toRowsMap("itemno");
 
         SQLFactory sqlFactory2 =new SQLFactory(this,"商品未发货数量汇总");
         sqlFactory2.addParameter("siteid", siteid);
+		where=" 1=1 ";
+		if(!StringUtils.isBlank(agentinfo)){
+			where=" and t6.agentnum like '%"+agentinfo+"%' or t5.enterprisename like '%"+agentinfo+"%' ";
+		}
+		sqlFactory2.addParameter_SQL("where", where);
         Rows sumUnQtyRows = dbConnect.runSqlQuery(sqlFactory2);
         RowsMap sumUnQtyRowsMap= sumUnQtyRows.toRowsMap("itemno");
 

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

@@ -395,8 +395,8 @@ public class OrderItems extends Controller {
         JSONArray itemids=content.getJSONArray("itemids");
         Rows orderRows = dbConnect.runSqlQuery("select * from sa_order where sa_orderid=" + sa_orderid + " and siteid='" + siteid + "'");
         if (!orderRows.isEmpty()) {
-            if (!orderRows.get(0).getString("status").equals("新建")) {
-                return getErrReturnObject().setErrMsg("非新建状态无法进行商品行折扣变更").toString();
+            if (!orderRows.get(0).getString("status").equals("新建") && !orderRows.get(0).getString("status").equals("预提交")) {
+                return getErrReturnObject().setErrMsg("非新建或预提交状态无法进行商品行折扣变更").toString();
             }
         } else {
             return getErrReturnObject().setErrMsg("该订单不存在").toString();
@@ -428,8 +428,8 @@ public class OrderItems extends Controller {
         JSONArray itemids=content.getJSONArray("itemids");
         Rows orderRows = dbConnect.runSqlQuery("select * from sa_order where sa_orderid=" + sa_orderid + " and siteid='" + siteid + "'");
         if (!orderRows.isEmpty()) {
-            if (!orderRows.get(0).getString("status").equals("新建")) {
-                return getErrReturnObject().setErrMsg("非新建状态无法进行商品行价格刷新").toString();
+            if (!orderRows.get(0).getString("status").equals("新建") && !orderRows.get(0).getString("status").equals("预提交")) {
+                return getErrReturnObject().setErrMsg("非新建或预提交状态无法进行商品行价格刷新").toString();
             }
         } else {
             return getErrReturnObject().setErrMsg("该订单不存在").toString();