소스 검색

2021年12月20日13:45:38

hu 4 년 전
부모
커밋
fc67a8cb2d

+ 35 - 0
src/rest/openapi/restcontroller/hyworkorder/webapp/workorder/HyWorkOrder.java

@@ -65,6 +65,41 @@ public class HyWorkOrder extends Controller {
 		}
 		return getReturnObject_err("缺少where参数").toString();
 	}
+	/** 服务管理查询工单列表 **/
+	public String list_manage() {
+		if (StringUtils.isBlank(hrid))
+			return getReturnObject_err("hrid为空").toString();
+//        if(StringUtils.isBlank(fagentnum))return getReturnObject_err("fagentnum为空").toString();
+		if (StringUtils.isBlank(siteid))
+			return getReturnObject_err("siteid为空").toString();
+		JSONObject where = content.getJSONObject("where");
+		String wherestr = "1=1";
+		String s[] = { "fstatus" };
+		for (String s1 : s) {
+			if (!where.containsKey(s1) && !StringUtils.isBlank(where.getString(s1)))
+				return getReturnObject_err("缺少" + s1 + "参数").toString();
+		}
+		if (where != null) {
+			DBConnect dbConnect = new DBConnect();
+			if (where.containsKey("fstatus") && !StringUtils.isBlank(where.getString("fstatus"))) {
+				wherestr += " and t.fstatus ='" + where.getString("fstatus") + "' ";
+			}
+
+			SQLFactory factory = new SQLFactory(this, "服务管理工单列表查询", pageSize, pageNumber, "t.createdate desc");
+			//factory.addParameter("hrid", hrid);
+			factory.addParameter("siteid", siteid);
+			factory.addParameter_SQL("where", wherestr);
+			SQLFactory factory2 = new SQLFactory(this, "服务管理工单状态统计");
+			//factory2.addParameter("hrid", hrid);
+			factory2.addParameter("siteid", siteid);
+			Rows rows_total = dbConnect.runSqlQuery(factory2.getSQL());
+			Rows rows = dbConnect.runSqlQuery(factory.getSQL());
+			if (!rows_total.isEmpty())
+				returnObject.put("rows_total", rows_total.get(0));
+			return getReturnObject_suc_page(rows, false, 0).toString();
+		}
+		return getReturnObject_err("缺少where参数").toString();
+	}
 
 	/** 工单详情 **/
 	public String detail() {

+ 7 - 0
src/rest/openapi/restcontroller/hyworkorder/webapp/workorder/SQL/服务管理工单列表查询.sql

@@ -0,0 +1,7 @@
+select t.fworknum,t.fstatus,t.ftype,t.faddress,convert(varchar,t.createdate,120)createdate,t.progress,
+(
+  select top 1 isnull(t1.oneprocessname,'')+isnull(t1.twoprocessname,'')  from hyordernode t1 where t1.fparentid=t.hyWorkorderid and t1.isconfirm=0 and t1.ischilden=0 order by t1.FROWNUM
+)curcontent
+from hyWorkorder t
+where EXISTS(select 1 from hyworkorder_team t1 where t1.fparentid=t.hyWorkorderid) and t.siteid=$siteid$ and t.fstatus<>'×÷·Ï'
+and $where$

+ 24 - 0
src/rest/openapi/restcontroller/hyworkorder/webapp/workorder/SQL/服务管理工单状态统计.sql

@@ -0,0 +1,24 @@
+DECLARE @siteid nvarchar(20)=$siteid$,@tostart int =0,@starting int=0,@complete int=0,@qualitycard int=0,@tostop int=0
+
+select @tostart=count(1)
+from hyWorkorder t
+where EXISTS(select 1 from hyworkorder_team t1 where  t1.fparentid=t.hyWorkorderid) and t.siteid=@siteid
+  and t.fstatus='待开始'
+select @starting=count(1)
+from hyWorkorder t
+where EXISTS(select 1 from hyworkorder_team t1 where  t1.fparentid=t.hyWorkorderid) and t.siteid=@siteid
+  and t.fstatus='进行中'
+select @complete=count(1)
+from hyWorkorder t
+where EXISTS(select 1 from hyworkorder_team t1 where  t1.fparentid=t.hyWorkorderid) and t.siteid=@siteid
+  and t.fstatus='已完成'
+select @tostop=count(1)
+from hyWorkorder t
+where EXISTS(select 1 from hyworkorder_team t1 where  t1.fparentid=t.hyWorkorderid) and t.siteid=@siteid
+  and t.fstatus='暂停'
+select @qualitycard=count(1)
+from hyWorkorder t
+where EXISTS(select 1 from hyworkorder_team t1 where  t1.fparentid=t.hyWorkorderid) and t.siteid=@siteid
+  and t.fstatus='质保卡审批'
+
+select @tostart tostart,@starting starting,@complete complete,@tostop tostop,@qualitycard qualitycard