hu 5 месяцев назад
Родитель
Сommit
6f8e3bf577

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

@@ -6876,6 +6876,11 @@ public class R {
         public static class v1 {
         }
     }
+
+    public static class ID2025112114461803 {
+        public static class v1 {
+        }
+    }
 }
 
 

+ 12 - 2
src/custom/restcontroller/sale/serviceorder/SQL/服务申请单列表查询.sql

@@ -4,7 +4,15 @@ SELECT
 	t2.enterprisename,
 	t2.abbreviation,
 	t2.phonenumber,
-	t5.agentnum
+	t5.agentnum,
+    t8.itemid,
+    t8.sku,
+    t8.cardno,
+    t8.warrantystatus,
+    t9.itemno,
+    t9.itemname,
+    t9.model,
+    t9.spec
 FROM
 	sa_serviceorder t1
 	LEFT JOIN sys_enterprise t2 ON t1.sys_enterpriseid = t2.sys_enterpriseid 
@@ -13,4 +21,6 @@ FROM
 	AND t1.siteid = t3.siteid
 	LEFT JOIN sa_agents t5 ON t1.sys_enterpriseid = t5.sys_enterpriseid 
 	AND t1.siteid = t5.siteid
-	where t1.siteid=$siteid$ and t1.sys_enterpriseid=$sys_enterpriseid$ and $where$
+    left join (SELECT * FROM (SELECT *,ROW_NUMBER() OVER (PARTITION BY sa_serviceorderid ORDER BY sa_serviceorderitemsid ASC) AS rowno FROM sa_serviceorderitems) t WHERE rowno = 1) t8 on t8.sa_serviceorderid=t1.sa_serviceorderid and t8.siteid=t1.siteid
+    left join plm_item t9 on t9.itemid=t8.itemid and t9.siteid=t8.siteid
+    where t1.siteid=$siteid$ and t1.sys_enterpriseid=$sys_enterpriseid$ and $where$

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

@@ -2,6 +2,7 @@ package restcontroller.sale.serviceorder;
 
 import beans.datacontrllog.DataContrlLog;
 import beans.dataextend.DataExtend;
+import beans.datatag.DataTag;
 import com.alibaba.fastjson2.JSONObject;
 import common.Controller;
 import common.YosException;
@@ -15,6 +16,8 @@ import restcontroller.webmanage.executorService.Executor;
 import utility.sms.Sms;
 
 import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
 
 /**
  * 服务申请单
@@ -99,6 +102,17 @@ public class serviceorder extends Controller {
         querySQL.setOrderBy("case when t1.status='新建' then 1 when t1.status='提交' then 2 when t1.status='待分配' then 3 when t1.status='待受理' then 4 when t1.status='拒绝受理' then 5 when t1.status='待服务' then 6  when t1.status='服务中' then 7 when t1.status='已完结' then 8 else 9 end,t1.createdate desc");
         querySQL.setPage(pageSize, pageNumber);
         Rows rows = querySQL.query();
+
+        ArrayList<Long> ids = rows.toArrayList("sa_serviceorderid", new ArrayList<>());
+        HashMap<Long, ArrayList<String>> tagRows = DataTag.queryTag(this, "sa_serviceorder", ids, true);
+        for (Row row : rows) {
+            if (tagRows.get(row.getLong("sa_serviceorderid")) != null) {
+                row.put("tag", tagRows.get(row.getLong("sa_serviceorderid")));
+            } else {
+                row.put("tag", new ArrayList<String>());
+            }
+
+        }
         return getSucReturnObject().setData(rows).toString();
     }
 
@@ -134,6 +148,20 @@ public class serviceorder extends Controller {
             sqlFactoryupdate = new SQLFactory(this, "服务申请单提交");
             sqlList.add(
                     DataContrlLog.createLog(this, "sa_serviceorder", sa_serviceorderid, "提交", "服务申请单提交成功").getSQL());
+            Rows rowsdetails = dbConnect
+                    .runSqlQuery("select t1.sa_serviceorderitemsid,t1.cardno,t3.begdate,t3.enddate from sa_serviceorderitems t1 left join sa_warrantycard t3 on t1.cardno=t3.cardno and t1.siteid=t3.siteid and t3.isvoid=0 and t3.deleted=0  where t1.sa_serviceorderid ='"
+                            + sa_serviceorderid + "' and t1.siteid='" + siteid + "'");
+            for(Row row :rowsdetails){
+                if(StringUtils.isNotBlank(row.getString("cardno"))){
+                    Date date = new Date();
+                    if (date.before(row.getDate("enddate"))) {
+                        sqlList.add("update sa_serviceorderitems set warrantystatus='保内' where sa_serviceorderitemsid="+row.getLong("sa_serviceorderitemsid"));
+                    }else{
+                        sqlList.add("update sa_serviceorderitems set warrantystatus='保外' where sa_serviceorderitemsid="+row.getLong("sa_serviceorderitemsid"));
+                    }
+                }
+            }
+
         } else {
             sqlFactoryupdate = new SQLFactory(this, "服务申请单反提交");
             sqlList.add(
@@ -286,6 +314,8 @@ public class serviceorder extends Controller {
                 }
             }
             Executor.sendEml(this, "serviceordersub", sa_serviceorderid, siteid);
+
+
         }
 
         dbConnect.runSqlUpdate(sqlList);

+ 7 - 1
src/custom/restcontroller/webmanage/sale/accessoryorder/accessoryorder.java

@@ -415,6 +415,8 @@ public class accessoryorder extends Controller {
         Rows rows = querySQL.query();
         ArrayList<Long> ids = rows.toArrayList("itemid", new ArrayList<>());
         ids.add(0l);
+        // 默认商品图片
+        Rows defaultImageRows = beans.Item.Item.getItemdefaultImage(this);
         //查询附件
         RowsMap attinfoRowsMap = getAttachmentUrl("plm_item", ids);
         //商品领域
@@ -424,7 +426,11 @@ public class accessoryorder extends Controller {
         //价格
         HashMap<Long, ItemPrice> itemPriceRowsMap = ItemPrice.getItemPrice(this, sys_enterpriseid, ids);
         for (Row row : rows) {
-            row.put("attinfos", attinfoRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
+            if (attinfoRowsMap.getOrDefault(row.getString("itemid"), new Rows()).isNotEmpty()) {
+                row.put("attinfos", attinfoRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
+            } else {
+                row.put("attinfos", defaultImageRows);
+            }
             row.put("tradefield", tradefieldRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
             row.put("brand", brandRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
             if (itemPriceRowsMap.containsKey(row.getLong("itemid"))) {

+ 2 - 0
src/custom/restcontroller/webmanage/sale/order/OrderItems.java

@@ -272,6 +272,8 @@ public class OrderItems extends Controller {
                             price = BigDecimal.ZERO;
                             amount = BigDecimal.ZERO;
                         }
+                    }else{
+                        billingstatus = "保外收费";
                     }
                 }
                 if(!billingstatus.equals("保内收费")){

+ 1 - 0
src/custom/restcontroller/webmanage/sale/serviceorder/SQL/服务申请单列表查询.sql

@@ -12,6 +12,7 @@ SELECT
     t8.itemid,
     t8.sku,
     t8.cardno,
+    t8.warrantystatus,
     t9.itemno,
     t9.itemname,
     t9.model,

+ 1 - 0
src/custom/restcontroller/webmanage/sale/serviceorder/SQL/服务申请单列表查询2.sql

@@ -12,6 +12,7 @@ SELECT
     t8.itemid,
     t8.sku,
     t8.cardno,
+    t8.warrantystatus,
     t9.itemno,
     t9.itemname,
     t9.model,

+ 1 - 0
src/custom/restcontroller/webmanage/sale/serviceorder/SQL/服务申请单详情查询.sql

@@ -12,6 +12,7 @@ SELECT
     t8.itemid,
     t8.sku,
     t8.cardno,
+    t8.warrantystatus,
     t9.itemno,
     t9.itemname,
     t9.model,

+ 1 - 0
src/custom/restcontroller/webmanage/sale/serviceorder/SQL/服务申请单详情查询2.sql

@@ -12,6 +12,7 @@ SELECT
     t8.itemid,
     t8.sku,
     t8.cardno,
+    t8.warrantystatus,
     t9.itemno,
     t9.itemname,
     t9.model,

+ 26 - 2
src/custom/restcontroller/webmanage/sale/serviceorder/serviceorder.java

@@ -2,6 +2,7 @@ package restcontroller.webmanage.sale.serviceorder;
 
 import beans.data.BatchDeleteErr;
 import beans.datacontrllog.DataContrlLog;
+import beans.datatag.DataTag;
 import beans.datateam.DataTeam;
 import beans.parameter.Parameter;
 import beans.salearea.SaleArea;
@@ -66,7 +67,6 @@ public class serviceorder extends Controller {
         String begdate = content.getStringValue("begdate");
         String enddate = content.getStringValue("enddate");
         long saler_hrid = content.getLongValue("saler_hrid");
-        long sa_customersid = content.getLongValue("sa_customersid");
 
         String sku = content.getStringValue("sku");
         String cardno = content.getStringValue("cardno");
@@ -79,7 +79,8 @@ public class serviceorder extends Controller {
                     return getErrReturnObject().setErrMsg("安装服务单需添加序列号").toString();
                 }
                 if (dbConnect.runSqlQuery("select * from sa_warrantycard where sku='" + sku + "' and siteid='" + siteid + "'").isNotEmpty()) {
-                    return getErrReturnObject().setErrMsg("该序列号已安装,无法再次安装").toString();
+                    DataTag.createSystemTag(this, "sa_serviceorder", sa_serviceorderid, "重复安装");
+                    //return getErrReturnObject().setErrMsg("该序列号已安装,无法再次安装").toString();
                 }
             }
         }
@@ -305,6 +306,18 @@ public class serviceorder extends Controller {
         sqlFactory.addParameter("sa_serviceorderid", sa_serviceorderid);
         sqlFactory.addParameter("siteid", siteid);
         Rows rows = dbConnect.runSqlQuery(sqlFactory);
+
+        ArrayList<Long> ids = rows.toArrayList("sa_serviceorderid", new ArrayList<>());
+        HashMap<Long, ArrayList<String>> tagRows = DataTag.queryTag(this, "sa_serviceorder", ids, true);
+        for (Row row : rows) {
+            if (tagRows.get(row.getLong("sa_serviceorderid")) != null) {
+                row.put("tag", tagRows.get(row.getLong("sa_serviceorderid")));
+            } else {
+                row.put("tag", new ArrayList<String>());
+            }
+
+        }
+
         Row row = rows.isNotEmpty() ? rows.get(0) : new Row();
 //		if(!row.isEmpty()) {
 //			//服务申请单关联物料查询
@@ -325,6 +338,7 @@ public class serviceorder extends Controller {
             row.put("backreason", "");
         }
 
+
         return getSucReturnObject().setData(row).toString();
     }
 
@@ -479,6 +493,16 @@ public class serviceorder extends Controller {
         querySQL.setPage(pageSize, pageNumber);
         Rows rows = querySQL.query();
 
+        ArrayList<Long> ids = rows.toArrayList("sa_serviceorderid", new ArrayList<>());
+        HashMap<Long, ArrayList<String>> tagRows = DataTag.queryTag(this, "sa_serviceorder", ids, true);
+        for (Row row : rows) {
+            if (tagRows.get(row.getLong("sa_serviceorderid")) != null) {
+                row.put("tag", tagRows.get(row.getLong("sa_serviceorderid")));
+            } else {
+                row.put("tag", new ArrayList<String>());
+            }
+
+        }
         return getSucReturnObject().setData(rows).toString();
     }
 

+ 2 - 0
src/custom/restcontroller/webmanage/sale/workorder/SQL/服务工单节点更新.sql

@@ -7,6 +7,8 @@ SET
     textcontent=$textcontent$,
     confirm_value = $confirm_value$,
     amount=$amount$,
+    dooramount=$dooramount$,
+    accessoryamount=$accessoryamount$,
     questionoption=$questionoption$,
     questionedit=$questionedit$,
     passcheck=$passcheck$

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

@@ -747,6 +747,16 @@ public class workorder extends Controller {
             } else {
                 updateNodesqlFactory.addParameter("amount", 0);
             }
+            if (content.containsKey("dooramount") && content.getDouble("dooramount") > 0) {
+                updateNodesqlFactory.addParameter("dooramount", content.getBigDecimal("dooramount"));
+            } else {
+                updateNodesqlFactory.addParameter("dooramount", 0);
+            }
+            if (content.containsKey("accessoryamount") && content.getDouble("accessoryamount") > 0) {
+                updateNodesqlFactory.addParameter("accessoryamount", content.getBigDecimal("accessoryamount"));
+            } else {
+                updateNodesqlFactory.addParameter("accessoryamount", 0);
+            }
             sqlList.add(updateNodesqlFactory.getSQL());
             dbConnect.runSqlUpdate(sqlList);
 
@@ -780,6 +790,14 @@ public class workorder extends Controller {
         return getSucReturnObject().toString();
     }
 
+    @API(title = "查询工单所选新配件金额", apiversion = R.ID2025112114461803.v1.class)
+    public String querynewitemamount() throws YosException {
+        Long sa_workorderid = content.getLong("sa_workorderid");
+        Rows amountrows = dbConnect.runSqlQuery("select ROUND(t1.qty*ifnull(t2.marketprice,1), 2) amount from sa_workorder_node_items t1 inner join plm_item t2 on t1.itemid=t2.itemid where t1.isnew=1 and  t1.sa_workorderid="+sa_workorderid);
+        return getSucReturnObject().setData(amountrows.sum("amount")).toString();
+    }
+
+
     @API(title = "工单接单", apiversion = R.ID20230210101103.v1.class)
     @CACHEING_CLEAN(apiversions = {R.ID20230208140103.v1.class, R.ID20230208140203.v1.class,
             R.ID20230209091103.v1.class, R.ID20230206091603.v1.class, R.ID20230206101303.v1.class,