Browse Source

出库单bug修复(测试)

hu 2 years ago
parent
commit
5aebbad9dd
1 changed files with 20 additions and 5 deletions
  1. 20 5
      src/custom/restcontroller/webmanage/lsak3/stockbill/stockbill.java

+ 20 - 5
src/custom/restcontroller/webmanage/lsak3/stockbill/stockbill.java

@@ -264,14 +264,29 @@ public class stockbill extends Controller {
             if(stockbillrows.isNotEmpty()){
                 Rows stockbilldetailrows =dbConnect.runSqlQuery("select t1.sa_dispatch_itemsid,sum(t1.qty) qty,t2.sa_dispatchid from st_stockbill_items t1 inner join  sa_dispatch_items t2 on t1.sa_dispatch_itemsid=t2.sa_dispatch_itemsid and t1.siteid=t2.siteid where t1.st_stockbillid = "+stockbillrows.get(0).getLong("st_stockbillid")+" and t1.siteid='lsa1986' group by t1.sa_dispatch_itemsid");
                 if(stockbillrows.get(0).getString("status").equals("审核")){
-                    for (Row row :stockbilldetailrows) {
-                        sqldispatchitems.add("update sa_dispatch_items set outwarehousedate=CURRENT_TIME,outwarehouseqty=outwarehouseqty+"+row.getBigDecimal("qty")+" where siteid='lsa1986' and sa_dispatch_itemsid="+row.getLong("sa_dispatch_itemsid"));
+                    if(stockbillrows.get(0).getString("rb").equals("1")){
+                        for (Row row :stockbilldetailrows) {
+                            sqldispatchitems.add("update sa_dispatch_items set outwarehousedate=CURRENT_TIME,outwarehouseqty=outwarehouseqty+"+row.getBigDecimal("qty")+" where siteid='lsa1986' and sa_dispatch_itemsid="+row.getLong("sa_dispatch_itemsid"));
+                        }
+                    }else{
+                        for (Row row :stockbilldetailrows) {
+                            sqldispatchitems.add("update sa_dispatch_items set outwarehousedate=CURRENT_TIME,outwarehouseqty=outwarehouseqty-"+row.getBigDecimal("qty")+" where siteid='lsa1986' and sa_dispatch_itemsid="+row.getLong("sa_dispatch_itemsid"));
+                            sqldispatchitems.add("update sa_dispatch set closedate=null,closeby='',status='复核' where siteid='lsa1986' and sa_dispatchid="+row.getLong("sa_dispatchid"));
+                        }
                     }
+
                 }else{
-                    for (Row row :stockbilldetailrows) {
-                        sqldispatchitems.add("update sa_dispatch_items set outwarehousedate=CURRENT_TIME,outwarehouseqty=outwarehouseqty-"+row.getBigDecimal("qty")+" where siteid='lsa1986' and sa_dispatch_itemsid="+row.getLong("sa_dispatch_itemsid"));
-                        sqldispatchitems.add("update sa_dispatch set closedate=null,closeby='',status='复核' where siteid='lsa1986' and sa_dispatchid="+row.getLong("sa_dispatchid"));
+                    if(stockbillrows.get(0).getString("rb").equals("1")){
+                        for (Row row :stockbilldetailrows) {
+                            sqldispatchitems.add("update sa_dispatch_items set outwarehousedate=CURRENT_TIME,outwarehouseqty=outwarehouseqty-"+row.getBigDecimal("qty")+" where siteid='lsa1986' and sa_dispatch_itemsid="+row.getLong("sa_dispatch_itemsid"));
+                            sqldispatchitems.add("update sa_dispatch set closedate=null,closeby='',status='复核' where siteid='lsa1986' and sa_dispatchid="+row.getLong("sa_dispatchid"));
+                        }
+                    }else{
+                        for (Row row :stockbilldetailrows) {
+                            sqldispatchitems.add("update sa_dispatch_items set outwarehousedate=CURRENT_TIME,outwarehouseqty=outwarehouseqty+"+row.getBigDecimal("qty")+" where siteid='lsa1986' and sa_dispatch_itemsid="+row.getLong("sa_dispatch_itemsid"));
+                        }
                     }
+
                 }
             }
             dbConnect.runSqlUpdate(sqldispatchitems);