This commit is contained in:
2025-12-07 11:07:17 +08:00
110 changed files with 10373 additions and 2653 deletions
+120 -1
View File
@@ -2,6 +2,8 @@
using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Http;
@@ -86,7 +88,27 @@ namespace WebAPI.Controllers
/// <summary>
/// 每天夜间接收OA系统项目设计图纸数据
/// 每天夜间获取OA系统项目设计图纸数据
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ResponeData SynIDPOADesignDrawingData()
{
var responeData = new Model.ResponeData();
try
{
responeData.message = IDPDataService.GetIDPOADesignDrawingData();
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.ToString();
}
return responeData;
}
/// <summary>
/// 每天夜间接收OA系统项目设计图纸数据【2025.11.24弃用】
/// </summary>
/// <returns></returns>
[HttpPost]
@@ -180,5 +202,102 @@ namespace WebAPI.Controllers
}
#endregion
#region
/// <summary>
/// 统计考勤人员考勤数据
/// </summary>
/// <returns></returns>
[HttpPost]
public Model.ReturnData SynSitePersonCheckingStatistics()
{
var responeData = new Model.ReturnData();
responeData.time = DateTime.Now.ToString();
using (SqlConnection Connection = new SqlConnection(Funs.ConnString))
{
try
{
string sql = @"
TRUNCATE TABLE dbo.SitePerson_Checking_Statistics;
INSERT INTO dbo.SitePerson_Checking_Statistics (
ProjectId,
UnitId,
UnitName,
WorkAreaId,
WorkAreaName,
WorkPostId,
WorkPostName,
IntoOutTime,
num
)
SELECT
a.ProjectId,
b.UnitId,
b.UnitName,
b.WorkAreaId,
b.WorkAreaName,
p.WorkPostId,
w.WorkPostName,
CAST(b.IntoOutTime AS DATE) AS IntoOutTime,
COUNT(1) AS num
FROM (
SELECT
PersonId,
CAST(IntoOutTime AS DATE) AS IntoOutTime,
MAX(CheckingId) AS MaxCheckingId,
ProjectId
FROM SitePerson_Checking
GROUP BY PersonId, CAST(IntoOutTime AS DATE), ProjectId
) a
JOIN SitePerson_Checking b ON a.MaxCheckingId = b.CheckingId
LEFT JOIN SitePerson_Person p ON a.PersonId = p.PersonId
LEFT JOIN Base_WorkPost w ON p.WorkPostId = w.WorkPostId
LEFT JOIN Base_Project bp ON a.ProjectId = bp.ProjectId
where bp.ProjectState='1'
GROUP BY
a.ProjectId,
b.UnitId,
b.UnitName,
b.WorkAreaId,
b.WorkAreaName,
p.WorkPostId,
w.WorkPostName,
CAST(b.IntoOutTime AS DATE);";
Connection.Open();
SqlCommand command = new SqlCommand(sql, Connection)
{
CommandTimeout = 0,
CommandType = CommandType.Text
};
int result = command.ExecuteNonQuery();
responeData.message = $"执行成功,共插入 {result} 条记录";
}
catch (SqlException sqlEx)
{
responeData.code = 0;
responeData.message = $"数据库操作失败: {sqlEx.Message}";
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = $"执行失败: {ex.Message}";
}
finally
{
Connection.Close();
}
}
return responeData;
}
#endregion
}
}