Explorar o código

订单明细优化调整

hu %!s(int64=2) %!d(string=hai) anos
pai
achega
671c4ee84e

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

@@ -705,7 +705,13 @@ public class OrderItems extends Controller {
                 if (isuncheckout.equals("1")) {
                     where.append(" and t1.sa_orderitemsid in (select t1.sa_orderitemsid from sa_orderitems t1 inner join (select t2.sa_orderitemsid,t2.siteid,sum(outwarehouseqty) sumoutwarehouseqty from sa_dispatch_items t2 inner join sa_dispatch t3 on t2.sa_dispatchid=t3.sa_dispatchid and t2.siteid=t3.siteid GROUP BY sa_orderitemsid,siteid) t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid where t1.qty>t2.sumoutwarehouseqty or t1.undeliqty>0)");
                 } else {
-                    where.append(" and 1=1");
+                    where.append(" and t1.sa_orderitemsid not in (select t1.sa_orderitemsid from sa_orderitems t1 inner join (select t2.sa_orderitemsid,t2.siteid,sum(outwarehouseqty) sumoutwarehouseqty from sa_dispatch_items t2 inner join sa_dispatch t3 on t2.sa_dispatchid=t3.sa_dispatchid and t2.siteid=t3.siteid GROUP BY sa_orderitemsid,siteid) t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid where t1.qty>t2.sumoutwarehouseqty or t1.undeliqty>0)");
+                }
+            }
+            if (whereObject.containsKey("iscancel") && !"".equals(whereObject.getString("iscancel"))) {
+                String iscancel = whereObject.getStringValue("iscancel");
+                if (iscancel.equals("1")) {
+                    where.append(" and t5.status ='手工关闭' and not exists(select 1 from st_stockbill_items s1 inner join st_stockbill s2 on s1.st_stockbillid=s2.st_stockbillid and s1.siteid=s2.siteid where s2.status='审核' and s2.rb=1 and s1.sa_orderitemsid=t1.sa_orderitemsid)");
                 }
             }