Procházet zdrojové kódy

出入库审核反审核代码改造

hu před 5 měsíci
rodič
revize
0870a38ca9

+ 9 - 7
src/custom/beans/stockbill/stockbill.java

@@ -16,13 +16,12 @@ import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.ArrayList;
 
 
 public class stockbill extends BaseClass {
 public class stockbill extends BaseClass {
-    public static String checkValidate(Controller controller, long st_stockbillid, boolean ischeck) throws YosException {
+    private static void checkValidate(Controller controller, long st_stockbillid, boolean ischeck) throws YosException {
         Rows rows = controller.dbConnect.runSqlQuery("select * from st_stockbill where st_stockbillid ='"
         Rows rows = controller.dbConnect.runSqlQuery("select * from st_stockbill where st_stockbillid ='"
                 + st_stockbillid + "' and  siteid='" + controller.siteid + "'");
                 + st_stockbillid + "' and  siteid='" + controller.siteid + "'");
         Rows rowsdetail = controller.dbConnect.runSqlQuery("select t1.*,t2.skucontrol from st_stockbill_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.st_stockbillid ='"
         Rows rowsdetail = controller.dbConnect.runSqlQuery("select t1.*,t2.skucontrol from st_stockbill_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.st_stockbillid ='"
                 + st_stockbillid + "' and  t1.siteid='" + controller.siteid + "'");
                 + st_stockbillid + "' and  t1.siteid='" + controller.siteid + "'");
         String type=rows.get(0).getString("type");
         String type=rows.get(0).getString("type");
-        boolean isinstock = isinstock(rows.get(0).getString("type"),rows.get(0).getString("rb"),false);
         String str="success";
         String str="success";
         if(type.equals("销售出库")){
         if(type.equals("销售出库")){
             if(ischeck){
             if(ischeck){
@@ -45,16 +44,19 @@ public class stockbill extends BaseClass {
         } else if (type.equals("返修出库")) {// 云链
         } else if (type.equals("返修出库")) {// 云链
 
 
         }
         }
-        return str;
+        if(!str.equals("success")){
+            throw new YosException(str);
+        }
     }
     }
-    public static ArrayList<String> check(Controller controller, long st_stockbillid, boolean ischeck) throws YosException {
+    public static ArrayList<String> getCheckSql(Controller controller, long st_stockbillid, boolean ischeck) throws YosException {
         Rows rows = controller.dbConnect.runSqlQuery("select * from st_stockbill where st_stockbillid ='"
         Rows rows = controller.dbConnect.runSqlQuery("select * from st_stockbill where st_stockbillid ='"
                 + st_stockbillid + "' and  siteid='" + controller.siteid + "'");
                 + st_stockbillid + "' and  siteid='" + controller.siteid + "'");
         Rows rowsdetail = controller.dbConnect.runSqlQuery("select t1.*,t2.skucontrol from st_stockbill_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.st_stockbillid ='"
         Rows rowsdetail = controller.dbConnect.runSqlQuery("select t1.*,t2.skucontrol from st_stockbill_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.st_stockbillid ='"
                 + st_stockbillid + "' and  t1.siteid='" + controller.siteid + "'");
                 + st_stockbillid + "' and  t1.siteid='" + controller.siteid + "'");
         ArrayList<String> sqlList = new ArrayList<>();
         ArrayList<String> sqlList = new ArrayList<>();
         String type=rows.get(0).getString("type");
         String type=rows.get(0).getString("type");
-        boolean isinstock = isinstock(type,rows.get(0).getString("rb"),true);
+        boolean isinstock = isinstock(type,rows.get(0).getString("rb"),ischeck);
+        checkValidate(controller,st_stockbillid,ischeck);
         if(type.equals("销售出库")){
         if(type.equals("销售出库")){
             if(ischeck){
             if(ischeck){
                 sqlList.addAll(xsckcheck(controller,rows,rowsdetail,isinstock));
                 sqlList.addAll(xsckcheck(controller,rows,rowsdetail,isinstock));
@@ -96,8 +98,8 @@ public class stockbill extends BaseClass {
         return sqlList;
         return sqlList;
     }
     }
 
 
-    public static void checkWithoutSQL(Controller controller, long st_stockbillid, boolean ischeck) throws YosException {
-        controller.dbConnect.runSqlUpdate(check(controller,st_stockbillid,ischeck));
+    public static void check(Controller controller, long st_stockbillid, boolean ischeck) throws YosException {
+        controller.dbConnect.runSqlUpdate(getCheckSql(controller,st_stockbillid,ischeck));
     }
     }
 
 
 
 

+ 2 - 15
src/custom/restcontroller/webmanage/sale/stockbill/stockbill.java

@@ -323,14 +323,7 @@ public class stockbill extends Controller {
     @CACHEING_CLEAN(apiClass = {stockbill.class, stockbillitems.class, Order.class, OrderItems.class,restcontroller.sale.stockbill.stockbill.class})
     @CACHEING_CLEAN(apiClass = {stockbill.class, stockbillitems.class, Order.class, OrderItems.class,restcontroller.sale.stockbill.stockbill.class})
     public String check() throws YosException {
     public String check() throws YosException {
         Long st_stockbillid = content.getLong("st_stockbillid");
         Long st_stockbillid = content.getLong("st_stockbillid");
-        String res = beans.stockbill.stockbill.checkValidate(this,st_stockbillid,true);
-        if(!res.equals("success")){
-            return getErrReturnObject().setErrMsg(res)
-                    .toString();
-        }else {
-            dbConnect.runSqlUpdate(beans.stockbill.stockbill.check(this,st_stockbillid,true));
-        }
-
+        beans.stockbill.stockbill.check(this,st_stockbillid,true);
         return getSucReturnObject().toString();
         return getSucReturnObject().toString();
     }
     }
 
 
@@ -338,13 +331,7 @@ public class stockbill extends Controller {
     @CACHEING_CLEAN(apiClass = {stockbill.class, stockbillitems.class, Order.class, OrderItems.class,stockbill.class,restcontroller.sale.stockbill.stockbill.class})
     @CACHEING_CLEAN(apiClass = {stockbill.class, stockbillitems.class, Order.class, OrderItems.class,stockbill.class,restcontroller.sale.stockbill.stockbill.class})
     public String uncheck() throws YosException {
     public String uncheck() throws YosException {
         Long st_stockbillid = content.getLong("st_stockbillid");
         Long st_stockbillid = content.getLong("st_stockbillid");
-        String res = beans.stockbill.stockbill.checkValidate(this,st_stockbillid,false);
-        if(!res.equals("success")){
-            return getErrReturnObject().setErrMsg(res)
-                    .toString();
-        }else {
-            dbConnect.runSqlUpdate(beans.stockbill.stockbill.check(this,st_stockbillid,false));
-        }
+        beans.stockbill.stockbill.check(this,st_stockbillid,false);
         return getSucReturnObject().toString();
         return getSucReturnObject().toString();
     }
     }