Просмотр исходного кода

区域经理查询订单服务申请单及工单

hu 2 месяцев назад
Родитель
Сommit
c3eca1dfbc

+ 17 - 0
src/custom/restcontroller/sale/serviceorder/serviceorder.java

@@ -3,6 +3,7 @@ package restcontroller.sale.serviceorder;
 import beans.datacontrllog.DataContrlLog;
 import beans.dataextend.DataExtend;
 import beans.datatag.DataTag;
+import beans.salearea.SaleArea;
 import com.alibaba.fastjson2.JSONObject;
 import common.Controller;
 import common.YosException;
@@ -12,6 +13,7 @@ import common.annotation.CACHEING_CLEAN;
 import common.data.*;
 import org.apache.commons.lang.StringUtils;
 import restcontroller.R;
+import restcontroller.sale.promotion.promotion;
 import restcontroller.webmanage.executorService.Executor;
 import utility.sms.Sms;
 
@@ -35,6 +37,21 @@ public class serviceorder extends Controller {
     @CACHEING
     public String queryserviceorderList() throws YosException {
         StringBuffer where = new StringBuffer(" 1=1 ");
+        Rows userrows = dbConnect.runSqlQuery("select t2.usertype from sys_usersite t2 where t2.siteid = 'md' and t2.userid="+userid);
+        if(userrows.isNotEmpty()){
+            if(userrows.get(0).getString("usertype").equals("2")){
+                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_service in (select sys_enterpriseid from sys_enterprise_tradefield where sa_saleareaid in " + arrayList + ")";
+                sql = sql.replace("[", "(").replace("]", ")");
+                where.append(sql);
+            }
+        }
         if (content.containsKey("where")) {
             JSONObject whereObject = content.getJSONObject("where");
             if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {

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

@@ -1819,6 +1819,7 @@ public class Order extends Controller {
     @API(title = "批量一键出库_配件", apiversion = R.ID2025110515173403.v1.class)
     public String oneClickcreateStockbills_pj() throws YosException {
         JSONArray sa_orderids =content.getJSONArray("sa_orderids");
+//        JSONArray noneeddeliverys =content.getJSONArray("noneeddeliverys");
 //        String outplace=content.getString("outplace");
         ArrayList<String> sqlList = new ArrayList<>();
         QuerySQL orderQuerySQL = SQLFactory.createQuerySQL(this, "sa_order","sa_orderid","sys_enterpriseid","sys_enterprise_financeid","rec_contactsid","logisticsmethod");
@@ -1958,6 +1959,9 @@ public class Order extends Controller {
         RowsMap deliveryrowsMap = orderRows_result.toRowsMap("delivery");
         Set<String> enterpriseSet = enterpriserowsMap.keySet();
         Set<String>  deliverySet = deliveryrowsMap.keySet();
+//        for(Object object :noneeddeliverys){
+//            deliverySet.remove((String)object);
+//        }
         int stockbillcount=0;
 
         QuerySQL accountbalanceQuerySQL = SQLFactory.createQuerySQL(this, "sa_accountbalance","*");

+ 18 - 0
src/custom/restcontroller/webmanage/sale/workorder/workorder.java

@@ -4,6 +4,7 @@ import beans.brand.Brand;
 import beans.datacontrllog.DataContrlLog;
 import beans.datateam.DataTeam;
 import beans.itemprice.ItemPrice;
+import beans.salearea.SaleArea;
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
@@ -15,6 +16,7 @@ import common.annotation.CACHEING_CLEAN;
 import common.data.*;
 import org.apache.commons.lang.StringUtils;
 import restcontroller.R;
+import restcontroller.sale.promotion.promotion;
 import restcontroller.webmanage.executorService.Executor;
 import restcontroller.webmanage.sale.bom.SortByNum;
 import restcontroller.webmanage.sale.serviceorder.serviceorder;
@@ -415,6 +417,22 @@ public class workorder extends Controller {
             where.append(" and t2.sys_enterpriseid_service ='").append(sys_enterpriseid).append("'");
         }
 
+        Rows usertyperows = dbConnect.runSqlQuery("select t2.usertype from sys_usersite t2 where t2.siteid = 'md' and t2.userid="+userid);
+        if(usertyperows.isNotEmpty()){
+            if(usertyperows.get(0).getString("usertype").equals("2")){
+                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 t2.sys_enterpriseid_service in (select sys_enterpriseid from sys_enterprise_tradefield where sa_saleareaid in " + arrayList + ")";
+                sql = sql.replace("[", "(").replace("]", ")");
+                where.append(sql);
+            }
+        }
+
         if (content.containsKey("where")) {
             JSONObject whereObject = content.getJSONObject("where");
             if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {