Files
CleanMachine/CleanMachine.DAL/ZBK/DayReportDAL.cs

73 lines
2.6 KiB
C#
Raw Normal View History

2022-05-16 13:54:26 +08:00
using LeadDataBaseUtility;
using System;
using System.Collections.Generic;
using System.Text;
namespace CleanMachine.DAL.ZBK
{
public class DayReportDAL
{
2022-05-16 16:06:44 +08:00
public IEnumerable<Model.ZBK.OperatorReport> GetOPReport(string strWhere, object Params = null)
{
string strSql = $@"
2022-05-17 09:53:25 +08:00
select * from (SELECT a.*,b.Scrap,(EndValue-StartValue)/3600.0 as MachineHours,c.StartTime,c.EndTime from
2022-05-16 16:06:44 +08:00
(SELECT date(INPUT_TIME) as date, USER_NAME as Operator ,SUM(CURRENT_NUMBER) as cleaned from VW_WORKING_PALLET_MSG WHERE CLEAN_MODE_CODE='SortedCleaned'
GROUP BY date(INPUT_TIME),USER_NAME) as a
LEFT JOIN
(
SELECT date(INPUT_TIME) as date,USER_NAME as Operator,SUM(CURRENT_NUMBER) as scrap from VW_WORKING_PALLET_MSG WHERE CLEAN_MODE_CODE<>'SortedCleaned'
GROUP BY date(INPUT_TIME),USER_NAME
) as b on a.date=b.date and a.Operator=b.Operator
2022-05-17 09:53:25 +08:00
left join CM_DayWorkTime as c on a.date=date(c.date) and a.Operator=c.UserName
2022-05-16 16:06:44 +08:00
) as tbl
";
if (strWhere.Trim() != "")
{
strSql += $" WHERE {strWhere}";
}
return LeadDbHelperSQLite.Query<Model.ZBK.OperatorReport>(strSql, Params);
}
2022-05-16 13:54:26 +08:00
public IEnumerable<Model.ZBK.DayReport> GetReport(string strWhere,object Params=null)
{
string strSql = $@"
2022-05-17 09:53:25 +08:00
select * from (SELECT a.*,b.Scrap,c.MachineHours,c.StartTime,c.EndTime from
2022-05-16 16:06:44 +08:00
(SELECT date(INPUT_TIME) as date,SUM(CURRENT_NUMBER) as cleaned,GROUP_CONCAT(DISTINCT USER_NAME) as operators from VW_WORKING_PALLET_MSG WHERE CLEAN_MODE_CODE='SortedCleaned'
2022-05-16 13:54:26 +08:00
GROUP BY date(INPUT_TIME)) as a
LEFT JOIN
(
SELECT date(INPUT_TIME) as date,SUM(CURRENT_NUMBER) as scrap from VW_WORKING_PALLET_MSG WHERE CLEAN_MODE_CODE<>'SortedCleaned'
GROUP BY date(INPUT_TIME)
) as b on a.date=b.date
2022-05-17 09:53:25 +08:00
LEFT JOIN
(SELECT date(date) as date,SUM(EndValue-StartValue)/3600.0 as MachineHours, MIN(StartTime) as StartTime,MAX(EndTime) as EndTime from
CM_DayWorkTime GROUP BY date(date) ) as c on a.date=date(c.date)
2022-05-16 13:54:26 +08:00
) as tbl
";
if (strWhere.Trim() != "")
{
strSql += $" WHERE {strWhere}";
}
return LeadDbHelperSQLite.Query<Model.ZBK.DayReport>(strSql, Params);
}
}
}