浏览代码

e订单区域经理-发退明细,物流单模块

hu 1 年之前
父节点
当前提交
6f45edaab5

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

@@ -5338,6 +5338,14 @@ public class R {
         public static class v1 {
         }
     }
+    public static class ID20231030091403 {
+        public static class v1 {
+        }
+    }
+    public static class ID20231030093503 {
+        public static class v1 {
+        }
+    }
 
 }
 

+ 49 - 0
src/custom/restcontroller/webmanage/sale/dispatch/SQL/工厂发货及退货明细(区域经理).sql

@@ -0,0 +1,49 @@
+select t.* from (SELECT t1.st_stockbill_itemsid detailid,
+       t4.st_stockbillid id,
+       t1.sa_orderitemsid,
+       t4.billno,
+       t4.status,
+       t8.sa_orderid,
+       t8.sonum,
+       '发货' type,
+			 t4.checkdate date,
+       t2.itemno,
+       t2.itemname,
+       t3.unitname,
+       ifnull(t1.qty, 0) qty,
+       t1.price,
+       t1.amount,
+			 t2.packageqty,
+       t1.remarks
+FROM st_stockbill_items t1
+         left join plm_item t2 on t1.itemid = t2.itemid and t1.siteid = t2.siteid
+         LEFT JOIN plm_unit t3 ON t3.unitid = t2.unitid AND t3.siteid = t2.siteid
+         LEFT JOIN st_stockbill t4 ON t4.st_stockbillid = t1.st_stockbillid AND t4.siteid = t1.siteid
+         left join sa_order t8 on t8.sa_orderid=t1.sa_orderid and t8.siteid=t1.siteid
+         left join plm_itemextend t6 on t2.siteid = t6.siteid and t2.itemid = t6.itemid
+where t4.rb=1 and t1.siteid = $siteid$ and t4.sys_enterpriseid in (select sys_enterpriseid from sys_enterprise_tradefield where sa_saleareaid in $sa_saleareaids$)
+union all
+SELECT t1.st_stockbill_itemsid detailid,
+       t4.st_stockbillid id,
+       t1.sa_orderitemsid,
+       t4.billno,
+       t4.status,
+       t8.sa_orderid,
+       t8.sonum,
+       '退货' type,
+			 t4.checkdate date,
+       t2.itemno,
+       t2.itemname,
+       t3.unitname,
+       t1.qty,
+       t1.price,
+       t1.amount,
+			 t2.packageqty,
+       t1.remarks
+FROM st_stockbill_items t1
+         left join plm_item t2 on t1.itemid = t2.itemid and t1.siteid = t2.siteid
+         LEFT JOIN plm_unit t3 ON t3.unitid = t2.unitid AND t3.siteid = t2.siteid
+         LEFT JOIN st_stockbill t4 ON t4.st_stockbillid = t1.st_stockbillid AND t4.siteid = t1.siteid
+         left join sa_order t8 on t8.sa_orderid=t1.sa_orderid and t8.siteid=t1.siteid
+         left join plm_itemextend t6 on t2.siteid = t6.siteid and t2.itemid = t6.itemid
+where t4.rb=0 and  t1.siteid = $siteid$ and t4.sys_enterpriseid in (select sys_enterpriseid from sys_enterprise_tradefield where sa_saleareaid in $sa_saleareaids$)) t where $where$

+ 78 - 0
src/custom/restcontroller/webmanage/sale/dispatch/dispatchItems.java

@@ -3,6 +3,7 @@ package restcontroller.webmanage.sale.dispatch;
 import beans.data.BatchDeleteErr;
 import beans.dispatch.Dispatch;
 import beans.parameter.Parameter;
+import beans.salearea.SaleArea;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import common.Controller;
@@ -18,6 +19,7 @@ import org.apache.poi.xssf.usermodel.XSSFCellStyle;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import restcontroller.R;
+import restcontroller.sale.promotion.promotion;
 import restcontroller.webmanage.sale.order.Order;
 import restcontroller.webmanage.sale.order.OrderItems;
 import utility.ERPDocking;
@@ -529,6 +531,82 @@ public class dispatchItems extends Controller {
         Rows rows = dbConnect.runSqlQuery(sqlFactory);
 
 
+//        if (isExport) {
+//            //去除不需要导出项
+//            rows.getFieldList().remove("sa_dispatch_itemsid");
+//            rows.getFieldList().remove("sa_dispatchid");
+//            rows.getFieldList().remove("sa_orderitemsid");
+//            rows.getFieldList().remove("sa_orderid");
+//            rows.getFieldList().remove("sys_enterpriseid");
+//            rows.getFieldList().remove("isclose");
+//            rows.getFieldList().remove("rowno");
+//            rows.getFieldList().remove("itemid");
+//            rows.getFieldList().remove("batchno");
+//            Rows rowsrolename= dbConnect.runSqlQuery("select * from sys_userrole t1 inner join sys_role t2 on t1.roleid=t2.roleid and t1.siteid=t2.siteid where t2.rolename='经销商员工' and t1.userid="+userid);
+//            if(!rowsrolename.isEmpty()){
+//                rows.getFieldList().remove("price");
+//                rows.getFieldList().remove("amount");
+//            }
+//            rows.getFieldList().remove("undeliqty");
+//            rows.getFieldList().remove("deliedqty");
+//            rows.getFieldList().remove("outwarehousedate");
+//            Rows uploadRows = uploadExcelToObs("dispatch", "发货单明细列表", rows, getTitleMap());
+//            return getSucReturnObject().setData(uploadRows).toString();
+//       }
+        return getSucReturnObject().setData(rows).toString();
+    }
+
+    @API(title = "工厂发货/退货明细(区域经理)", apiversion = R.ID20231030091403.v1.class)
+    @CACHEING
+    public String queryDispatchAndAftersalesmagItemsManagerList() throws YosException, IOException {
+        /*
+         * 过滤条件设置
+         */
+        StringBuffer where = new StringBuffer(" 1=1 ");
+
+
+        if (content.containsKey("where")) {
+            JSONObject whereObject = content.getJSONObject("where");
+            if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
+                where.append(" and(");
+                where.append("t.sonum like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t.itemno like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t.itemname like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t.remarks like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append(")");
+            }
+            if (whereObject.containsKey("type") && !"".equals(whereObject.getString("type"))) {
+                where.append(" and(");
+                where.append("t.type ='").append(whereObject.getString("type")).append("' ");
+                where.append(")");
+            }
+            if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
+                where.append(" and DATE_FORMAT(t.date, '%Y-%m-%d') >='").append(whereObject.getString("begindate")).append("' ");
+            }
+            if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
+                where.append(" and DATE_FORMAT(t.date, '%Y-%m-%d') <='").append(whereObject.getString("enddate")).append("' ");
+            }
+            if (whereObject.containsKey("status") && !"".equals(whereObject.getString("status"))) {
+                where.append(" and t.status ='").append(whereObject.getString("status")).append("' ");
+            }
+        }
+        boolean isExport = content.getBooleanValue("isExport");
+
+
+        SQLFactory areasqlFactory = new SQLFactory(new promotion(content), "区域经理查询下属营销区域");
+        areasqlFactory.addParameter("siteid", siteid);
+        areasqlFactory.addParameter("hrid", hrid);
+        Rows arearows = dbConnect.runSqlQuery(areasqlFactory);
+        ArrayList<Long> arrayList =arearows.toArrayList("sa_saleareaid", new ArrayList<Long>());
+        arrayList.addAll(SaleArea.getSubSaleAreaIds(this, arrayList));
+
+        SQLFactory sqlFactory = new SQLFactory(this, "工厂发货及退货明细(区域经理)", pageSize, pageNumber, pageSorting);
+        sqlFactory.addParameter_in("sa_saleareaids", arrayList);
+        sqlFactory.addParameter_SQL("where", where);
+        sqlFactory.addParameter("siteid", siteid);
+        Rows rows = dbConnect.runSqlQuery(sqlFactory);
+
+
 //        if (isExport) {
 //            //去除不需要导出项
 //            rows.getFieldList().remove("sa_dispatch_itemsid");

+ 61 - 0
src/custom/restcontroller/webmanage/sale/logistics/LSALogistics.java

@@ -4,6 +4,7 @@ import beans.datacontrllog.DataContrlLog;
 import beans.order.Order;
 import beans.parameter.Parameter;
 import beans.remind.Remind;
+import beans.salearea.SaleArea;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.huaweicloud.sdk.meeting.v1.model.SearchQosHistoryMeetingsRequest;
@@ -14,6 +15,7 @@ import common.annotation.CACHEING;
 import common.annotation.CACHEING_CLEAN;
 import common.data.*;
 import restcontroller.R;
+import restcontroller.sale.promotion.promotion;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -296,6 +298,65 @@ public class LSALogistics extends Controller {
         return getSucReturnObject().setData(rows).toString();
     }
 
+    @API(title = "物流单列表(区域经理)", apiversion = R.ID20231030093503.v1.class)
+    @CACHEING
+    public String selectListManager() throws YosException {
+
+        StringBuffer where = new StringBuffer(" 1=1 ");
+        if (content.containsKey("where")) {
+            JSONObject whereObject = content.getJSONObject("where");
+            if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
+                where.append("and (t1.billno like '%").append(whereObject.getString("condition")).append("%'");
+                where.append("or t1.logisticno like '%").append(whereObject.getString("condition")).append("%'");
+                where.append("or t1.remarks like '%").append(whereObject.getString("condition")).append("%'");
+                where.append("or t3.agentnum like '%").append(whereObject.getString("condition")).append("%'");
+                where.append("or t2.enterprisename like '%").append(whereObject.getString("condition")).append("%')");
+            }
+            if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
+                where.append(" and t1.billdate >='").append(whereObject.getString("begindate")).append(" 00:00:00'");
+            }
+            if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
+                where.append(" and t1.billdate <='").append(whereObject.getString("enddate")).append(" 23:59:59'");
+            }
+            if (whereObject.containsKey("status") && !"".equals(whereObject.getString("status"))) {
+                where.append(" and t1.status = '").append(whereObject.getString("status")).append("'");
+            }
+        }
+        SQLFactory areasqlFactory = new SQLFactory(new promotion(content), "区域经理查询下属营销区域");
+        areasqlFactory.addParameter("siteid", siteid);
+        areasqlFactory.addParameter("hrid", hrid);
+        Rows arearows = dbConnect.runSqlQuery(areasqlFactory);
+        ArrayList<Long> arrayList =arearows.toArrayList("sa_saleareaid", new ArrayList<Long>());
+        arrayList.addAll(SaleArea.getSubSaleAreaIds(this, arrayList));
+
+        String sql = " and t1.sys_enterpriseid in (select sys_enterpriseid from sys_enterprise_tradefield where sa_saleareaid in "+arrayList+")";
+        sql = sql.replace("[", "(").replace("]", ")");
+        where.append(sql);
+
+
+
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_logistics");
+        querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t2", "t2.sys_enterpriseid=t1.sys_enterpriseid and t2.siteid=t1.siteid",
+                "t2.enterprisename");
+        querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t3", "t3.sys_enterpriseid=t2.sys_enterpriseid and t3.siteid=t2.siteid",
+                "t3.agentnum");
+        querySQL.addJoinTable(JOINTYPE.left, "sa_logiscomp", "t4", "t4.sa_logiscompid=t1.sa_logiscompid and t4.siteid=t1.siteid",
+                "t4.kd100id");
+        querySQL.addQueryFields("logiscomp_name", "t4.name");
+        querySQL.setWhere("t1.siteid='" + siteid + "'");
+        querySQL.setWhere(where.toString());
+        querySQL.setPage(pageSize,pageNumber).setOrderBy(pageSorting).setTableAlias("t1");
+        Rows rows = querySQL.query();
+
+        for (Row row : rows) {
+            row.putIfAbsent("billdate", "");
+            row.putIfAbsent("checkdate", "");
+            row.putIfAbsent("receivedate", "");
+        }
+
+        return getSucReturnObject().setData(rows).toString();
+    }
+
 
     @API(title = "收货、取消收货", apiversion = R.ID20230721104302.v1.class)
     @CACHEING_CLEAN(apiClass = {LSALogistics.class})