|
|
@@ -710,7 +710,7 @@ public class workorder extends Controller {
|
|
|
ArrayList<String> sqlList = new ArrayList<>();
|
|
|
sqlList.add(
|
|
|
"update sa_workorder set status='进行中',startdate=CURRENT_TIME where sa_workorderid=" + sa_workorderid);
|
|
|
- sqlList.add("update sa_serviceorder set status='进行中' where sa_serviceorderid="
|
|
|
+ sqlList.add("update sa_serviceorder set status='服务中' where sa_serviceorderid="
|
|
|
+ rows.get(0).getLong("sa_serviceorderid"));
|
|
|
sqlList.add(DataContrlLog.createLog(this, "sa_workorder", sa_workorderid, "工单开始", "服务工单开始成功").getSQL());
|
|
|
|
|
|
@@ -826,6 +826,30 @@ public class workorder extends Controller {
|
|
|
}
|
|
|
}
|
|
|
ArrayList<String> sqlList = new ArrayList<>();
|
|
|
+
|
|
|
+ int allcount = 0; // 必须完成工作项数量
|
|
|
+ int count = 0; // 已完成必须完成工作项数量
|
|
|
+ String str = "";
|
|
|
+ Rows noderows = dbConnect.runSqlQuery(
|
|
|
+ "select sa_workorder_nodeid,status,workpresetjson from sa_workorder_node where parentid !=0 and sa_workorderid ='"
|
|
|
+ + sa_workorderid + "' and siteid='" + siteid + "' ");
|
|
|
+ if (!noderows.isEmpty()) {
|
|
|
+ for (Row row : noderows) {
|
|
|
+ workpresetInfo workpresetInfo = JSON.parseObject(row.getString("workpresetjson"), workpresetInfo.class);
|
|
|
+ if (workpresetInfo.getRequired() == 1) {
|
|
|
+ allcount++;
|
|
|
+ if (row.getLong("status") == 1) {
|
|
|
+ count++;
|
|
|
+ } else {
|
|
|
+ str = str + workpresetInfo.getWorkname() + ",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (count != allcount) {
|
|
|
+ return getErrReturnObject().setErrMsg("【" + str.substring(0, str.length() - 1) + "】" + "的工序未完成,无法提交工单!")
|
|
|
+ .toString();
|
|
|
+ }
|
|
|
sqlList.add(
|
|
|
"update sa_workorder set status='提交' where sa_workorderid=" + sa_workorderid);
|
|
|
sqlList.add(DataContrlLog.createLog(this, "sa_workorder", sa_workorderid, "工单提交", "服务工单提交成功").getSQL());
|
|
|
@@ -835,9 +859,7 @@ public class workorder extends Controller {
|
|
|
}
|
|
|
|
|
|
@API(title = "完结工单", apiversion = R.ID20230209144903.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,
|
|
|
- R.ID20230206091703.v1.class, R.ID20230207154203.v1.class, R.ID20230217100703.v1.class, R.ID20230217133003.v1.class})
|
|
|
+ @CACHEING_CLEAN(apiversions = {workorder.class, serviceorder.class})
|
|
|
public String completeorder() throws YosException {
|
|
|
Long sa_workorderid = content.getLong("sa_workorderid");
|
|
|
|
|
|
@@ -851,25 +873,25 @@ public class workorder extends Controller {
|
|
|
} else {
|
|
|
return getErrReturnObject().setErrMsg("该工单不存在").toString();
|
|
|
}
|
|
|
- int allcount = 0; // 必须完成工作项数量
|
|
|
- int count = 0; // 已完成必须完成工作项数量
|
|
|
- String str = "";
|
|
|
- Rows noderows = dbConnect.runSqlQuery(
|
|
|
- "select sa_workorder_nodeid,status,workpresetjson from sa_workorder_node where parentid !=0 and sa_workorderid ='"
|
|
|
- + sa_workorderid + "' and siteid='" + siteid + "' ");
|
|
|
- if (!noderows.isEmpty()) {
|
|
|
- for (Row row : noderows) {
|
|
|
- workpresetInfo workpresetInfo = JSON.parseObject(row.getString("workpresetjson"), workpresetInfo.class);
|
|
|
- if (workpresetInfo.getRequired() == 1) {
|
|
|
- allcount++;
|
|
|
- if (row.getLong("status") == 1) {
|
|
|
- count++;
|
|
|
- } else {
|
|
|
- str = str + workpresetInfo.getWorkname() + ",";
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// int allcount = 0; // 必须完成工作项数量
|
|
|
+// int count = 0; // 已完成必须完成工作项数量
|
|
|
+// String str = "";
|
|
|
+// Rows noderows = dbConnect.runSqlQuery(
|
|
|
+// "select sa_workorder_nodeid,status,workpresetjson from sa_workorder_node where parentid !=0 and sa_workorderid ='"
|
|
|
+// + sa_workorderid + "' and siteid='" + siteid + "' ");
|
|
|
+// if (!noderows.isEmpty()) {
|
|
|
+// for (Row row : noderows) {
|
|
|
+// workpresetInfo workpresetInfo = JSON.parseObject(row.getString("workpresetjson"), workpresetInfo.class);
|
|
|
+// if (workpresetInfo.getRequired() == 1) {
|
|
|
+// allcount++;
|
|
|
+// if (row.getLong("status") == 1) {
|
|
|
+// count++;
|
|
|
+// } else {
|
|
|
+// str = str + workpresetInfo.getWorkname() + ",";
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
ArrayList<String> sqlList = new ArrayList<>();
|
|
|
/** 判断预约单是否可以完成 **/
|
|
|
Rows workorders = dbConnect
|
|
|
@@ -885,15 +907,10 @@ public class workorder extends Controller {
|
|
|
}
|
|
|
}
|
|
|
if (isallcomplete) {
|
|
|
- sqlList.add("update sa_serviceorder set status='已完成' where sa_serviceorderid="
|
|
|
+ sqlList.add("update sa_serviceorder set status='已完结' where sa_serviceorderid="
|
|
|
+ rows.get(0).getLong("sa_serviceorderid"));
|
|
|
}
|
|
|
|
|
|
- if (count != allcount) {
|
|
|
- return getErrReturnObject().setErrMsg("【" + str.substring(0, str.length() - 1) + "】" + "的节点没有完成,无法完结工单")
|
|
|
- .toString();
|
|
|
- }
|
|
|
-
|
|
|
if(rows.get(0).getString("type").equals("安装")){
|
|
|
Rows itemrows =dbConnect.runSqlQuery("select t1.sku,ifnull(t2.warrantyday,0) warrantyday,t4.sa_agentsid from sa_serviceorderitems t1 inner join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.sa_serviceorderid="+rows.get(0).getLong("sa_serviceorderid")+" and t1.siteid='"+siteid+"' left join sa_serviceorder t3 on t1.sa_serviceorderid=t3.sa_serviceorderid and t1.siteid=t3.siteid left join sa_agents t4 on t3.sys_enterpriseid=t4.sys_enterpriseid and t3.siteid=t4.siteid");
|
|
|
if(itemrows.isNotEmpty()){
|