Procházet zdrojové kódy

出入库单增加批量修改日期 批量审核

hu před 4 měsíci
rodič
revize
5a29c81b12

+ 17 - 12
src/custom/restcontroller/sale/stockbill/stockbill.java

@@ -8,6 +8,8 @@ import common.data.*;
 import restcontroller.R;
 import common.annotation.CACHEING;
 
+import java.math.BigDecimal;
+
 @API(title = "经销商到货确认单")
 public class stockbill extends Controller {
 
@@ -98,18 +100,21 @@ public class stockbill extends Controller {
         Rows itemRows = dbConnect.runSqlQuery("select t1.*,ifnull(t1.sa_orderitemsid,0) sa_orderitemsidnum from st_stockbill_items t1 where t1.st_stockbillid ='" + st_stockbillid + "'");
         Rows codeRows = dbConnect.runSqlQuery("select t1.* from st_stockbill_items_sku t1 where t1.st_stockbillid ='" + st_stockbillid + "'");
         if(isreceiver){
-            RowsMap codeRowsMap = codeRows.toRowsMap("st_stockbill_itemsid");
-            for(Row row:itemRows){
-                if(row.getBoolean("skucontrol")){
-                    if(codeRowsMap.containsKey(row.getString("st_stockbill_itemsid"))){
-                        if(codeRowsMap.get(row.getString("st_stockbill_itemsid")).size()!=row.getInteger("qty")){
-                            throw new YosException("行号:"+row.getString("rowno")+"序列号数量和出库数量不一致,无法到货确认!");
-                        }
-                    }else{
-                        throw new YosException("受序列号管控的商品,到货确认必须有序列号");
-                    }
-                }
-
+//            RowsMap codeRowsMap = codeRows.toRowsMap("st_stockbill_itemsid");
+//            for(Row row:itemRows){
+//                if(row.getBoolean("skucontrol")){
+//                    if(codeRowsMap.containsKey(row.getString("st_stockbill_itemsid"))){
+//                        if(codeRowsMap.get(row.getString("st_stockbill_itemsid")).size()!=row.getInteger("qty")){
+//                            throw new YosException("行号:"+row.getString("rowno")+"序列号数量和出库数量不一致,无法到货确认!");
+//                        }
+//                    }else{
+//                    throw new YosException("受序列号管控的商品,到货确认必须有序列号");
+//                    }
+//                }
+//
+//            }
+            if(BigDecimal.valueOf(codeRows.size()).compareTo(itemRows.toRowsMap("skucontrol").get("1").sum("qty"))!=0){
+                           throw new YosException("序列号数量和出库数量不一致,无法到货确认!");
             }
         }
 

+ 5 - 0
src/custom/restcontroller/webmanage/sale/customer/Customer.java

@@ -979,6 +979,11 @@ public class Customer extends Controller {
                 where.append("t1.name like'%").append(whereObject.getString("condition")).append("%' ");
                 where.append(")");
             }
+            if (whereObject.containsKey("sys_enterpriseid") && !"".equals(whereObject.getString("sys_enterpriseid"))) {
+                where.append(" and(");
+                where.append("t2.sys_enterpriseid ='").append(whereObject.getString("sys_enterpriseid")).append("' ");
+                where.append(")");
+            }
         }
         QuerySQL querySQL;
         querySQL = SQLFactory.createQuerySQL(this, "sa_customers", "sa_customersid","name","phonenumber","province","city","county","address","createdate","sa_agentsid","sa_agentsid_to");

+ 28 - 8
src/custom/restcontroller/webmanage/sale/stockbill/stockbill.java

@@ -245,22 +245,26 @@ public class stockbill extends Controller {
             if(rowsMap.containsKey(st_stockbillid)){
                 if(rowsMap.get(st_stockbillid).get(0).getString("status").equals("审核")){
                     if (periodrowsMap.get("1").toRowsMap("period").containsKey(period)) {
-                        batchDeleteErr.addErr(st_stockbillid, "原单据会计期间已关闭,不可调整");
+                        batchDeleteErr.addErr(rowsMap.get(st_stockbillid).get(0).getString("billno"), "原单据会计期间已关闭,不可调整");
                         continue;
                     }else if(!periodrowsMap.get("0").toRowsMap("period").containsKey(period)){
-                        batchDeleteErr.addErr(st_stockbillid, "原单据会计期间未生成,不可调整");
+                        batchDeleteErr.addErr(rowsMap.get(st_stockbillid).get(0).getString("billno"), "原单据会计期间未生成,不可调整");
                         continue;
                     }
                 }
             }else{
-                batchDeleteErr.addErr(st_stockbillid, "该单据不存在");
+                batchDeleteErr.addErr(String.valueOf(st_stockbillid), "该单据不存在");
                 continue;
             }
             sqlList.add(DataContrlLog.createLog(this, "st_stockbill", st_stockbillid, "更新", "单据日期【"+content.getString("billdate")+"】调整成功").getSQL());
             sqlList.add("update st_stockbill set billdate='"+content.getString("billdate")+"',period='"+period+"' where st_stockbillid="+st_stockbillid);
         }
         dbConnect.runSqlUpdate(sqlList);
-        return batchDeleteErr.getReturnObject().toString();
+        HashMap<String,Object> result=new HashMap<>();
+        String success= "共需"+st_stockbillids.size()+"张单据日期调整,其中失败"+ batchDeleteErr.size()+"张!";
+        result.put("success",success);
+        result.put("errinfo",batchDeleteErr.getReturnObject());
+        return getSucReturnObject().setData(result).toString();
     }
 
 
@@ -506,11 +510,27 @@ public class stockbill extends Controller {
     @CACHEING_CLEAN(apiClass = {stockbill.class, stockbillitems.class, Order.class, OrderItems.class, restcontroller.sale.stockbill.stockbill.class})
     public String check() throws YosException {
         JSONArray st_stockbillids = content.getJSONArray("st_stockbillids");
-        for (Object o : st_stockbillids) {
-            long st_stockbillid = Long.parseLong(o.toString());
-            Stockbill.check(this, st_stockbillid, true);
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "st_stockbill", "billno","st_stockbillid");
+        querySQL.setTableAlias("t1");
+        querySQL.setSiteid(siteid);
+        querySQL.setWhere("t1.st_stockbillid",st_stockbillids);
+        Rows stockbillrows = querySQL.query();
+        BatchDeleteErr batchDeleteErr = BatchDeleteErr.create(this, stockbillrows.size());
+        for (Row row : stockbillrows) {
+            long st_stockbillid =row.getLong("st_stockbillid");
+            String billno=row.getString("billno");
+            try {
+                Stockbill.check(this, st_stockbillid, true);
+            }catch (Exception e){
+                batchDeleteErr.addErr(billno,e.getMessage());
+            }
+
         }
-        return getSucReturnObject().toString();
+        HashMap<String,Object> result=new HashMap<>();
+        String success= "共审核"+st_stockbillids.size()+"张出入库单,其中失败"+ batchDeleteErr.size()+"张!";
+        result.put("success",success);
+        result.put("errinfo",batchDeleteErr.getReturnObject());
+        return getSucReturnObject().setData(result).toString();
     }
 
     @API(title = "反审核", apiversion = R.ID20230719154203.v1.class)

+ 3 - 0
src/custom/restcontroller/webmanage/sale/warrantycard/warrantycard.java

@@ -47,6 +47,9 @@ public class warrantycard extends Controller {
             if (whereObject.containsKey("sku") && !"".equals(whereObject.getString("sku"))) {
                 where.append(" and t1.sku ='" + whereObject.getString("sku") + "' ");
             }
+            if (whereObject.containsKey("sys_enterpriseid") && !"".equals(whereObject.getString("sys_enterpriseid"))) {
+                where.append(" and t3.sys_enterpriseid ='" + whereObject.getString("sys_enterpriseid") + "' ");
+            }
         }
         QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_warrantycard", "*");
         querySQL.setAsyncRowCount(true);//设置为延迟查询总行数