hu hai 5 meses
pai
achega
2731e2c87c

+ 20 - 0
src/custom/restcontroller/R.java

@@ -6901,6 +6901,26 @@ public class R {
         public static class v1 {
         }
     }
+
+    public static class ID2025120608581803 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID2025120609001403 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID2025120609002203 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID2025120609003003 {
+        public static class v1 {
+        }
+    }
 }
 
 

+ 19 - 4
src/custom/restcontroller/sale/stockbill/stockbill.java

@@ -4,10 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
 import common.Controller;
 import common.YosException;
 import common.annotation.API;
-import common.data.QuerySQL;
-import common.data.Rows;
-import common.data.SQLFactory;
-import common.data.UpdateSQL;
+import common.data.*;
 import restcontroller.R;
 import common.annotation.CACHEING;
 
@@ -98,6 +95,24 @@ public class stockbill extends Controller {
                         .toString();
             }
         }
+        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("受序列号管控的商品,到货确认必须有序列号");
+                    }
+                }
+
+            }
+        }
+
         UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "st_stockbill");
         updateSQL.setUniqueid(st_stockbillid);
         updateSQL.setSiteid(siteid);

+ 158 - 0
src/custom/restcontroller/webmanage/sale/agentssales/agentssales.java

@@ -0,0 +1,158 @@
+package restcontroller.webmanage.sale.agentssales;
+
+import beans.data.BatchDeleteErr;
+import beans.datacontrllog.DataContrlLog;
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
+import common.Controller;
+import common.YosException;
+import common.annotation.API;
+import common.annotation.CACHEING;
+import common.annotation.CACHEING_CLEAN;
+import common.data.*;
+import restcontroller.R;
+
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+
+@API(title = "电商销售额表")
+public class agentssales  extends Controller {
+
+    public agentssales(JSONObject content) throws YosException {
+        super(content);
+    }
+
+    @API(title = "新增更新电商销售额信息", apiversion = R.ID2025120608581803.v1.class)
+    public String insertormodify_agentssales() throws YosException {
+        ArrayList<String> sqlList = new ArrayList<>();
+        // 表名
+        String tableName = "sa_agents_sales";
+        Long sa_agents_salesid = content.getLong("sa_agents_salesid");
+        Long sa_agentsid = content.getLong("sa_agentsid");
+        String type =content.getString("type");
+        long year = content.getLong("year");
+        BigDecimal m1 = content.getBigDecimal("m1");
+        BigDecimal m2 = content.getBigDecimal("m2");
+        BigDecimal m3 = content.getBigDecimal("m3");
+        BigDecimal m4 = content.getBigDecimal("m4");
+        BigDecimal m5 = content.getBigDecimal("m5");
+        BigDecimal m6 = content.getBigDecimal("m6");
+        BigDecimal m7 = content.getBigDecimal("m7");
+        BigDecimal m8 = content.getBigDecimal("m8");
+        BigDecimal m9 = content.getBigDecimal("m9");
+        BigDecimal m10 = content.getBigDecimal("m10");
+        BigDecimal m11 = content.getBigDecimal("m11");
+        BigDecimal m12 = content.getBigDecimal("m12");
+        if (sa_agents_salesid <= 0 || dbConnect.runSqlQuery(
+                        "select sa_agents_salesid from sa_agents_sales where sa_agents_salesid=" + sa_agents_salesid)
+                .isEmpty()) {
+            sa_agents_salesid = createTableID(tableName);
+            InsertSQL insertSQL = SQLFactory.createInsertSQL(this, tableName);
+            insertSQL.setUniqueid(sa_agents_salesid);
+            insertSQL.setSiteid(siteid);
+            insertSQL.setValue("sa_agentsid", sa_agentsid);
+            insertSQL.setValue("type", type);
+            insertSQL.setValue("year",year);
+            insertSQL.setValue("m1", m1);
+            insertSQL.setValue("m2", m2);
+            insertSQL.setValue("m3", m3);
+            insertSQL.setValue("m4", m4);
+            insertSQL.setValue("m5", m5);
+            insertSQL.setValue("m6", m6);
+            insertSQL.setValue("m7", m7);
+            insertSQL.setValue("m8", m8);
+            insertSQL.setValue("m9", m9);
+            insertSQL.setValue("m10", m10);
+            insertSQL.setValue("m11", m11);
+            insertSQL.setValue("m12", m12);
+            sqlList.add(insertSQL.getSQL());
+            sqlList.add(
+                    DataContrlLog.createLog(this, "sa_agents_sales", sa_agents_salesid, "新增", "电商销售额信息新增成功").getSQL());
+        } else {
+            Rows rows = dbConnect.runSqlQuery(
+                    "SELECT 1 from sa_agents_sales WHERE sa_agents_salesid = "
+                            + sa_agents_salesid);
+            if (rows.isNotEmpty()) {
+                UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, tableName);
+                updateSQL.setUniqueid(sa_agents_salesid);
+                updateSQL.setSiteid(siteid);
+                updateSQL.setValue("sa_agentsid", sa_agentsid);
+                updateSQL.setValue("type", type);
+                updateSQL.setValue("year",year);
+                updateSQL.setValue("m1", m1);
+                updateSQL.setValue("m2", m2);
+                updateSQL.setValue("m3", m3);
+                updateSQL.setValue("m4", m4);
+                updateSQL.setValue("m5", m5);
+                updateSQL.setValue("m6", m6);
+                updateSQL.setValue("m7", m7);
+                updateSQL.setValue("m8", m8);
+                updateSQL.setValue("m9", m9);
+                updateSQL.setValue("m10", m10);
+                updateSQL.setValue("m11", m11);
+                updateSQL.setValue("m12", m12);
+                sqlList.add(updateSQL.getSQL());
+                sqlList.add(DataContrlLog.createLog(this, "sa_agents_sales", sa_agents_salesid, "更新", "电商销售额信息更新成功")
+                        .getSQL());
+
+            } else {
+                return getErrReturnObject().setErrMsg("该电商销售额信息不存在").toString();
+            }
+
+        }
+        dbConnect.runSqlUpdate(sqlList);
+        content.put("sa_agents_salesid", sa_agents_salesid);
+
+        return queryagents_salesMain();
+    }
+
+
+
+    @API(title = "电商销售额信息详情", apiversion = R.ID2025120609001403.v1.class)
+    @CACHEING
+    public String queryagents_salesMain() throws YosException {
+        Long sa_agents_salesid = content.getLong("sa_agents_salesid");
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_agents_sales", "*");
+        querySQL.setTableAlias("t1");
+        querySQL.setWhere("t1.sa_agents_salesid",sa_agents_salesid);
+        Rows rows = querySQL.query();
+        Row row = rows.isNotEmpty() ? rows.get(0) : new Row();
+        return getSucReturnObject().setData(row).toString();
+    }
+
+
+
+    @API(title = "查询电商销售额信息列表", apiversion = R.ID2025120609002203.v1.class)
+    @CACHEING
+    public String queryagents_salesList() throws YosException {
+        StringBuffer where = new StringBuffer(" 1=1 ");
+        Long sa_agentsid = content.getLong("sa_agentsid");
+
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_agents_sales", "*");
+        querySQL.setTableAlias("t1");
+        querySQL.setSiteid(siteid);
+        querySQL.setWhere(where.toString());
+        querySQL.setWhere("t1.sa_agentsid",sa_agentsid);
+        querySQL.setPage(pageSize, pageNumber);
+        Rows rows = querySQL.query();
+
+        return getSucReturnObject().setData(rows).toString();
+    }
+
+    @API(title = "电商销售额信息删除", apiversion = R.ID2025120609003003.v1.class)
+    @CACHEING_CLEAN(apiClass = {agentssales.class})
+    public String delete() throws YosException {
+        JSONArray sa_agents_salesids = content.getJSONArray("sa_agents_salesids");
+        BatchDeleteErr batchDeleteErr = BatchDeleteErr.create(this, sa_agents_salesids.size());
+        for (Object o : sa_agents_salesids) {
+            long sa_agents_salesid = Long.parseLong(o.toString());
+            dbConnect.runSqlUpdate("delete from sa_agents_sales where siteid='" + siteid + "' and sa_agents_salesid="
+                    + sa_agents_salesid);
+        }
+        return batchDeleteErr.getReturnObject().toString();
+
+    }
+
+
+}

+ 4 - 0
src/custom/restcontroller/webmanage/sale/sendrepair/sendrepair.java

@@ -119,6 +119,9 @@ public class sendrepair extends Controller {
         querySQL.setPage(pageSize, pageNumber);
         Rows rows = querySQL.query();
 
+        Rows stockbillrows = dbConnect.runSqlQuery("select * from st_stockbill where sourceid='"+sa_sendrepairid+"' and sourceobject='sa_sendrepair'");
+
+
         QuerySQL querySumSQL = SQLFactory.createQuerySQL(this, "sa_sendrepair_pj", "sa_sendrepairid");
         querySumSQL.setTableAlias("t1");
         querySumSQL.setSiteid(siteid);
@@ -127,6 +130,7 @@ public class sendrepair extends Controller {
         querySumSQL.addGroupBy("sa_sendrepairid");
         RowsMap querySumRowsMap =querySumSQL.query().toRowsMap("sa_sendrepairid");
         for (Row row :rows){
+            row.put("stockbillrows",stockbillrows);
             if(querySumRowsMap.containsKey(row.getString("sa_sendrepairid"))){
                 row.put("ysamount",querySumRowsMap.get(row.getString("sa_sendrepairid")).get(0).getBigDecimal("amount"));
             }

+ 20 - 0
src/custom/restcontroller/webmanage/sale/sendrepair/sendrepair_pj.java

@@ -1,6 +1,7 @@
 package restcontroller.webmanage.sale.sendrepair;
 
 import beans.data.BatchDeleteErr;
+import beans.itemprice.ItemPrice;
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
 import common.Controller;
@@ -12,6 +13,7 @@ import common.data.*;
 import restcontroller.R;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 
 @API(title = "送修单配件")
 public class sendrepair_pj extends Controller {
@@ -23,6 +25,12 @@ public class sendrepair_pj extends Controller {
     @API(title = "送修配件列表查询", apiversion = R.ID2025070414582703.v1.class)
     @CACHEING
     public String queryOrderItemgList() throws YosException {
+        long sa_sendrepairid=content.getLong("sa_sendrepairid");
+        Rows sendrepairrows =dbConnect.runSqlQuery("select sys_enterpriseid from sa_sendrepair where sa_sendrepairid="+sa_sendrepairid);
+        if(sendrepairrows.isEmpty()){
+            return getErrReturnObject().setErrMsg("送修单不存在").toString();
+        }
+        sys_enterpriseid=sendrepairrows.get(0).getLong("sys_enterpriseid");
         /*
          * 过滤条件设置
          */
@@ -48,6 +56,18 @@ public class sendrepair_pj extends Controller {
         querySQL.setPage(pageSize, pageNumber);
         Rows rows = querySQL.query();
 
+
+        HashMap<Long, ItemPrice> itemPriceRowsMap = ItemPrice.getItemPrice(this, sys_enterpriseid,rows.toArrayList("itemid", new ArrayList<>()));
+        for (Row row :rows){
+            if (itemPriceRowsMap.containsKey(row.getString("itemid"))) {
+                row.put("saleprice", itemPriceRowsMap.get(row.getString("itemid")).getPrice());
+            } else {
+                row.put("saleprice", 0);
+            }
+        }
+
+
+
         return getSucReturnObject().setData(rows).toString();
     }
 

+ 3 - 3
src/custom/restcontroller/webmanage/sale/stockbill/stockbillitemssku.java

@@ -99,13 +99,13 @@ public class stockbillitemssku extends Controller {
 
         for (Object o : st_stockbill_items_skuids) {
             long st_stockbill_items_skuid = Long.parseLong(o.toString());
-            Rows RowsStatus = dbConnect.runSqlQuery("select t1.st_stockbill_items_skuid,t2.status,t1.st_stockbillid from st_stockbill_items_sku t1 left join st_stockbill t2 on t1.st_stockbillid=t2.st_stockbillid and t1.siteid=t2.siteid where t1.siteid='"
+            Rows RowsStatus = dbConnect.runSqlQuery("select t1.st_stockbill_items_skuid,t2.status,t2.isreceiver,t1.st_stockbillid from st_stockbill_items_sku t1 left join st_stockbill t2 on t1.st_stockbillid=t2.st_stockbillid and t1.siteid=t2.siteid where t1.siteid='"
                     + siteid + "' and t1.st_stockbill_items_skuid='" + st_stockbill_items_skuid + "'");
 
             if (RowsStatus.isNotEmpty()) {
 
-                if (!RowsStatus.get(0).getString("status").equals("新建")) {
-                    batchDeleteErr.addErr(st_stockbill_items_skuid, "非新建状态的出库单序列号明细无法删除");
+                if (RowsStatus.get(0).getBoolean("isreceiver")) {
+                    batchDeleteErr.addErr(st_stockbill_items_skuid, "到货确认的出库单序列号明细无法删除");
                     continue;
                 }
             }