From f10feb72cae8d10d2e05ca8919b791a8f38dd763 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期四, 03 十一月 2022 18:01:51 +0800
Subject: [PATCH] 安灯报表报错问题修改 设备点检标准导入,模板验证、数据验证接口开发
---
VueWebApi/DLL/DAL/ReportManagerDAL.cs | 68 ++++++++++++++++++++--------------
1 files changed, 40 insertions(+), 28 deletions(-)
diff --git a/VueWebApi/DLL/DAL/ReportManagerDAL.cs b/VueWebApi/DLL/DAL/ReportManagerDAL.cs
index 3769371..a9d1acb 100644
--- a/VueWebApi/DLL/DAL/ReportManagerDAL.cs
+++ b/VueWebApi/DLL/DAL/ReportManagerDAL.cs
@@ -1004,7 +1004,7 @@
{
if (wkshopcode != "" && wkshopcode != null)
{
- search += "and A.wkshp_code=@style ";
+ search += "and A.wkshp_code=@wkshopcode ";
dynamicParams.Add("@wkshopcode", wkshopcode);
}
if (calltypecode != "" && calltypecode != null)
@@ -1049,7 +1049,7 @@
{
search = "and 1=1 ";
}
- search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
// --------------鏌ヨ鎸囧畾鏁版嵁--------------
var total = 0; //鎬绘潯鏁�
var sql = @"select A.wkshp_code,T.org_name as wkshp_name,A.eqp_code,E.name as eqp_name,Y.name as typename,
@@ -1058,7 +1058,7 @@
+ CAST(CAST(datediff(second,A.start_date,A.resp_date) % 86400 / 3600 AS INT) AS VARCHAR) + '灏忔椂'
+ CAST(CAST(datediff(second,A.start_date,A.resp_date) % 3600 / 60 AS INT) AS VARCHAR) + '鍒�'
+ CAST(CAST(datediff(second,A.start_date,A.resp_date) % 60 AS INT) AS VARCHAR) + '绉�' AS respondcont,
- (case when A.resp_user is null then '寰呭搷搴�' else '浠ュ搷搴�' end) as status
+ (case when A.resp_user is null then '寰呭搷搴�' else '宸插搷搴�' end) as status
from TAnDon_Task_Info A
left join TOrganization T on A.wkshp_code=T.org_code
left join TEqpInfo E on A.eqp_code=E.code
@@ -1090,7 +1090,7 @@
{
if (wkshopcode != "" && wkshopcode != null)
{
- search += "and A.wkshp_code=@style ";
+ search += "and A.wkshp_code=@wkshopcode ";
dynamicParams.Add("@wkshopcode", wkshopcode);
}
if (calltypecode != "" && calltypecode != null)
@@ -1135,7 +1135,7 @@
{
search = "and 1=1 ";
}
- search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
// --------------鏌ヨ鎸囧畾鏁版嵁--------------
var total = 0; //鎬绘潯鏁�
var sql = @"select A.wkshp_code as 杞﹂棿缂栫爜,T.org_name as 杞﹂棿鍚嶇О,A.eqp_code as 璁惧缂栫爜,E.name as 璁惧鍚嶇О,Y.name as 鍛煎彨绫诲瀷,
@@ -1144,7 +1144,7 @@
+ CAST(CAST(datediff(second,A.start_date,A.resp_date) % 86400 / 3600 AS INT) AS VARCHAR) + '灏忔椂'
+ CAST(CAST(datediff(second,A.start_date,A.resp_date) % 3600 / 60 AS INT) AS VARCHAR) + '鍒�'
+ CAST(CAST(datediff(second,A.start_date,A.resp_date) % 60 AS INT) AS VARCHAR) + '绉�' AS 鍝嶅簲鏃堕暱,
- (case when A.resp_user is null then '寰呭搷搴�' else '浠ュ搷搴�' end) as 鐘舵��
+ (case when A.resp_user is null then '寰呭搷搴�' else '宸插搷搴�' end) as 鐘舵��
from TAnDon_Task_Info A
left join TOrganization T on A.wkshp_code=T.org_code
left join TEqpInfo E on A.eqp_code=E.code
@@ -1171,7 +1171,7 @@
#region[瀹夌伅鎶ヨ〃姹囨�籡
- public static ToMessage AnDonReportSumSearch(string wkshopcode, string calltypecode, string callopendate, string callclosedate, string respondopendate, string respondclosedate, int startNum, int endNum, string prop, string order)
+ public static ToMessage AnDonReportSumSearch(string wkshopcode,string eqpcode, string calltypecode, string callopendate, string callclosedate, string respondopendate, string respondclosedate, int startNum, int endNum, string prop, string order)
{
var dynamicParams = new DynamicParameters();
string search = "";
@@ -1179,8 +1179,13 @@
{
if (wkshopcode != "" && wkshopcode != null)
{
- search += "and A.wkshp_code=@style ";
+ search += "and A.wkshp_code=@wkshopcode ";
dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and A.eqp_code=@eqpcode ";
+ dynamicParams.Add("@eqpcode", eqpcode);
}
if (calltypecode != "" && calltypecode != null)
{
@@ -1204,17 +1209,18 @@
{
search = "and 1=1 ";
}
- search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
// --------------鏌ヨ鎸囧畾鏁版嵁--------------
var total = 0; //鎬绘潯鏁�
- var sql = @"select T.org_name as wkshp_name,Y.name as calltypename,
- (select count(*) callcount from TAnDon_Task_Info AA where AA.wkshp_code=A.wkshp_code and AA.type=A.type) as callcount,
- (select count(*) repondcount from TAnDon_Task_Info BB where BB.wkshp_code=A.wkshp_code and BB.type=A.type and BB.status='CLOSED') as repondcount,
- (select CAST(DATEDIFF(ss, start_date,resp_date)/60 as INT) from TAnDon_Task_Info CC where CC.wkshp_code=A.wkshp_code and CC.type=A.type and CC.status='CLOSED') as repondtime
- from TAnDon_Task_Info A
- left join TOrganization T on A.wkshp_code=T.org_code
- left join TAnDonType Y on A.type=Y.code
- where T.description='W' "+search+" group by A.wkshp_code,T.org_name,A.type,Y.name ";
+ var sql = @"select top 100 percent T.org_name as wkshp_name,A.eqp_code,E.name as eqp_name,Y.name as calltypename,
+ (select count(*) callcount from TAnDon_Task_Info AA where AA.wkshp_code=A.wkshp_code and AA.type=A.type) as callcount,
+ (select count(*) repondcount from TAnDon_Task_Info BB where BB.wkshp_code=A.wkshp_code and BB.type=A.type and BB.status='CLOSED') as repondcount,
+ (select ISNULL(SUM(CAST(DATEDIFF(ss, CC.start_date,CC.resp_date)/60 as INT)),0) from TAnDon_Task_Info CC where CC.wkshp_code=A.wkshp_code and CC.eqp_code=A.eqp_code and CC.type=A.type) as repondtime
+ from TAnDon_Task_Info A
+ left join TOrganization T on A.wkshp_code=T.org_code
+ left join TAnDonType Y on A.type=Y.code
+ left join TEqpInfo E on A.eqp_code=E.code
+ where T.description='W' " + search+" group by A.wkshp_code,T.org_name,A.type,Y.name,A.eqp_code,E.name order by T.org_name,A.eqp_code ";
var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
mes.code = "200";
mes.Message = "鏌ヨ鎴愬姛!";
@@ -1233,7 +1239,7 @@
#endregion
#region[瀹夌伅鎶ヨ〃姹囨�诲鍑篯
- public static ToMessage AnDonReportSumExcelSearch(string wkshopcode, string calltypecode, string callopendate, string callclosedate, string respondopendate, string respondclosedate)
+ public static ToMessage AnDonReportSumExcelSearch(string wkshopcode,string eqpcode, string calltypecode, string callopendate, string callclosedate, string respondopendate, string respondclosedate)
{
var dynamicParams = new DynamicParameters();
string search = "";
@@ -1241,8 +1247,13 @@
{
if (wkshopcode != "" && wkshopcode != null)
{
- search += "and A.wkshp_code=@style ";
+ search += "and A.wkshp_code=@wkshopcode ";
dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and A.eqp_code=@eqpcode ";
+ dynamicParams.Add("@eqpcode", eqpcode);
}
if (calltypecode != "" && calltypecode != null)
{
@@ -1266,17 +1277,18 @@
{
search = "and 1=1 ";
}
- search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
// --------------鏌ヨ鎸囧畾鏁版嵁--------------
var total = 0; //鎬绘潯鏁�
- var sql = @"select T.org_name as 鐢熶骇杞﹂棿,Y.name as 鍛煎彨绫诲瀷,
- (select count(*) callcount from TAnDon_Task_Info AA where AA.wkshp_code=A.wkshp_code and AA.type=A.type) as 鍛煎彨娆℃暟,
- (select count(*) repondcount from TAnDon_Task_Info BB where BB.wkshp_code=A.wkshp_code and BB.type=A.type and BB.status='CLOSED') as 鍝嶅簲娆℃暟,
- (select CAST(DATEDIFF(ss, start_date,resp_date)/60 as INT) from TAnDon_Task_Info CC where CC.wkshp_code=A.wkshp_code and CC.type=A.type and CC.status='CLOSED') as 鍝嶅簲鏃堕暱(鍒�)
- from TAnDon_Task_Info A
- left join TOrganization T on A.wkshp_code=T.org_code
- left join TAnDonType Y on A.type=Y.code
- where T.description='W' " + search + " group by A.wkshp_code,T.org_name,A.type,Y.name ";
+ var sql = @"select top 100 percent T.org_name as 鐢熶骇杞﹂棿,E.name as 璁惧鍚嶇О,Y.name as 鍛煎彨绫诲瀷,
+ (select count(*) callcount from TAnDon_Task_Info AA where AA.wkshp_code=A.wkshp_code and AA.eqp_code=A.eqp_code and AA.type=A.type) as 鎬诲懠鍙鏁�,
+ (select count(*) repondcount from TAnDon_Task_Info BB where BB.wkshp_code=A.wkshp_code and BB.eqp_code=A.eqp_code and BB.type=A.type and BB.status='CLOSED') as 鎬诲搷搴旀鏁�,
+ (select ISNULL(SUM(CAST(DATEDIFF(ss, CC.start_date,CC.resp_date)/60 as INT)),0) from TAnDon_Task_Info CC where CC.wkshp_code=A.wkshp_code and CC.eqp_code=A.eqp_code and CC.type=A.type) 鎬诲搷搴旀椂闀�
+ from TAnDon_Task_Info A
+ left join TOrganization T on A.wkshp_code=T.org_code
+ left join TAnDonType Y on A.type=Y.code
+ left join TEqpInfo E on A.eqp_code=E.code
+ where T.description='W' " + search+" group by A.wkshp_code,T.org_name,A.type,Y.name,A.eqp_code,E.name order by T.org_name,A.eqp_code ";
DataTable data = DapperHelper.selectdata(sql, dynamicParams);
data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
string msg = DownLoad.DataTableToExcel(data, "瀹夌伅姹囨�绘姤琛�");
--
Gitblit v1.9.3