This commit is contained in:
geh
2026-07-20 12:08:16 +08:00
parent e7354bed93
commit 4fd1a440f7
26 changed files with 2648 additions and 368 deletions
+3 -2
View File
@@ -69,8 +69,8 @@
<Reference Include="ICSharpCode.SharpZipLib, Version=1.3.3.11, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.3.3\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\lib\net461\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
@@ -471,6 +471,7 @@
<Compile Include="Customization\ZJ\HSSE\HiddenInspection\UnitHSSE_Hazard_HazardRegisterService.cs" />
<Compile Include="Customization\ZJ\LotAPIService.cs" />
<Compile Include="DataGovernance\DataGovernanceService.cs" />
<Compile Include="DataGovernance\PreProjectApplyService.cs" />
<Compile Include="DataShare\APIDataShareSyncService.cs" />
<Compile Include="DataShare\CQMS\APICheckControlSyncService.cs" />
<Compile Include="DataShare\CQMS\APICqmsMeetingSyncService.cs" />
@@ -0,0 +1,128 @@
using Model;
using System.Linq;
namespace BLL
{
/// <summary>
/// 项目申请预立项
/// </summary>
public static class PreProjectApplyService
{
/// <summary>
/// 根据主键Id查询申请预立项数据
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public static Model.DataGovernance_PreProjectApply GetPreProjectApplyById(string Id)
{
return Funs.DB.DataGovernance_PreProjectApply.FirstOrDefault(e => e.Id == Id);
}
/// <summary>
/// 根据项目名称查询申请预立项数据
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public static Model.DataGovernance_PreProjectApply GetPreProjectApplyByProjectName(string projectName)
{
return Funs.DB.DataGovernance_PreProjectApply.FirstOrDefault(e => e.ProjectName == projectName);
}
/// <summary>
/// 删除申请
/// </summary>
/// <param name="Id"></param>
public static void DeletePreProjectApply(string Id)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
DataGovernance_PreProjectApply apply = db.DataGovernance_PreProjectApply.FirstOrDefault(e => e.Id == Id);
if (apply != null)
{
db.DataGovernance_PreProjectApply.DeleteOnSubmit(apply);
db.SubmitChanges();
}
}
}
/// <summary>
/// 添加项目申请预立项
/// </summary>
/// <param name="model"></param>
public static void AddPreProjectApply(Model.DataGovernance_PreProjectApply model)
{
Model.SUBQHSEDB db = Funs.DB;
Model.DataGovernance_PreProjectApply newModel = new Model.DataGovernance_PreProjectApply();
newModel.Id = model.Id;
newModel.UnitId = model.UnitId;
newModel.UnitName = model.UnitName;
newModel.ProjectName = model.ProjectName;
newModel.ApplyType = model.ApplyType;
newModel.ApplyUserId = model.ApplyUserId;
newModel.ApplyUserName = model.ApplyUserName;
newModel.ApplyDescription = model.ApplyDescription;
newModel.ApplyDate = model.ApplyDate;
newModel.ApproverUserId = model.ApproverUserId;
newModel.ApproverUserName = model.ApproverUserName;
//newModel.ApprovalDescription = model.ApprovalDescription;
//newModel.ApprovalDate = model.ApprovalDate;
newModel.State = model.State;
db.DataGovernance_PreProjectApply.InsertOnSubmit(newModel);
db.SubmitChanges();
}
/// <summary>
/// 修改项目申请预立项
/// </summary>
/// <param name="model"></param>
public static void UpdatePreProjectApply(Model.DataGovernance_PreProjectApply model)
{
using (var db = new Model.SUBQHSEDB(Funs.ConnString))
{
Model.DataGovernance_PreProjectApply newModel = db.DataGovernance_PreProjectApply.First(e => e.Id == model.Id);
newModel.UnitId = model.UnitId;
newModel.UnitName = model.UnitName;
newModel.ProjectName = model.ProjectName;
newModel.ApplyType = model.ApplyType;
newModel.ApplyUserId = model.ApplyUserId;
newModel.ApplyUserName = model.ApplyUserName;
newModel.ApplyDescription = model.ApplyDescription;
//newModel.ApplyDate = model.ApplyDate;
newModel.ApproverUserId = model.ApproverUserId;
newModel.ApproverUserName = model.ApproverUserName;
//newModel.ApprovalDescription = model.ApprovalDescription;
//newModel.ApprovalDate = model.ApprovalDate;
newModel.State = model.State;
db.SubmitChanges();
}
}
/// <summary>
/// 审核
/// </summary>
/// <param name="model"></param>
public static void ApprovalPreProjectApply(Model.DataGovernance_PreProjectApply model)
{
using (var db = new Model.SUBQHSEDB(Funs.ConnString))
{
Model.DataGovernance_PreProjectApply newModel = db.DataGovernance_PreProjectApply.First(e => e.Id == model.Id);
//newModel.UnitId = model.UnitId;
//newModel.UnitName = model.UnitName;
//newModel.ProjectName = model.ProjectName;
//newModel.ApplyType = model.ApplyType;
//newModel.ApplyUserId = model.ApplyUserId;
//newModel.ApplyUserName = model.ApplyUserName;
//newModel.ApplyDescription = model.ApplyDescription;
//newModel.ApplyDate = model.ApplyDate;
newModel.ApproverUserId = model.ApproverUserId;
newModel.ApproverUserName = model.ApproverUserName;
newModel.ApprovalDescription = model.ApprovalDescription;
newModel.ApprovalDate = model.ApprovalDate;
newModel.State = model.State;
db.SubmitChanges();
}
}
}
}
@@ -54,11 +54,13 @@ namespace BLL
Id = model.Id,
CollCropCode = model.CollCropCode,
UnitId = model.UnitId,
Total = model.Total,
YiShangXian = model.YiShangXian,
WeiShangXian = model.WeiShangXian,
ShenQingGuanBi = model.ShenQingGuanBi,
OnlineRate = model.OnlineRate,
ReportDate = model.ReportDate,
DataDate = model.DataDate,
Total = model.Total,
MasterTotal = model.MasterTotal,
QHSETotal = model.QHSETotal,
ZhengChang = model.ZhengChang,
@@ -66,9 +68,9 @@ namespace BLL
BuYong = model.BuYong,
BuYongYiWanGong = model.BuYongYiWanGong,
BuYongTingHuanJian = model.BuYongTingHuanJian,
BuYongBuShiYong = model.BuYongBuShiYong,
BuYongTJShouXian = model.BuYongTJShouXian,
YuLiXiang = model.YuLiXiang,
//ZiJian = model.ZiJian,
CreateUser = model.CreateUser,
ThisMonActiveUserNum = model.ThisMonActiveUserNum,
DailyAvg = model.DailyAvg,
@@ -93,9 +95,11 @@ namespace BLL
//newModel.UnitId = model.UnitId;
//newModel.ReportDate = model.ReportDate;
//newModel.DataDate = model.DataDate;
newModel.YiShangXian = model.YiShangXian;
newModel.OnlineRate = model.OnlineRate;
newModel.Total = model.Total;
newModel.YiShangXian = model.YiShangXian;
newModel.WeiShangXian = model.WeiShangXian;
newModel.ShenQingGuanBi = model.ShenQingGuanBi;
newModel.OnlineRate = model.OnlineRate;
newModel.MasterTotal = model.MasterTotal;
newModel.QHSETotal = model.QHSETotal;
newModel.ZhengChang = model.ZhengChang;
@@ -104,8 +108,8 @@ namespace BLL
newModel.BuYongYiWanGong = model.BuYongYiWanGong;
newModel.BuYongTingHuanJian = model.BuYongTingHuanJian;
newModel.BuYongTJShouXian = model.BuYongTJShouXian;
newModel.BuYongBuShiYong = model.BuYongBuShiYong;
newModel.YuLiXiang = model.YuLiXiang;
//newModel.ZiJian = model.ZiJian;
newModel.ThisMonActiveUserNum = model.ThisMonActiveUserNum;
newModel.DailyAvg = model.DailyAvg;
newModel.TianBao = model.TianBao;
@@ -177,7 +181,7 @@ namespace BLL
from pro in proGroup.DefaultIfEmpty()
join use in db.Project_MasterDataUsage on x.Pro_id equals use.Pro_id into useGroup
from use in useGroup.DefaultIfEmpty()
where pro == null && (use == null || (use != null && (use.Reason == null || use.Reason == "")))
where pro == null && (use == null || (use != null && use.ReasonType == null))
select x).Count();
//3、申请不用
var buYongList = (from x in masterProDatas
@@ -185,24 +189,31 @@ namespace BLL
from pro in proGroup.DefaultIfEmpty()
join use in db.Project_MasterDataUsage on x.Pro_id equals use.Pro_id into useGroup
from use in useGroup.DefaultIfEmpty()
where pro == null && use != null && use.Is_use == false && use.Reason != null && use.Reason != ""
where pro == null && use != null && use.Is_use == false && use.ReasonType != null
select new { reason = use.Reason, reasonType = use.ReasonType }).ToList();
//申请不用总数
int buYong = buYongList.Count();
//申请不用——已完工
int buYongYiWanGong = buYongList.Where(x => x.reasonType == "已完工").Count();
int buYongYiWanGong = buYongList.Where(x => x.reasonType == "已完工/撤场").Count();
//申请不用——停缓建
int buYongTingHuanJian = buYongList.Where(x => x.reasonType == "停缓建").Count();
//申请不用——不适用
int buYongBuShiYong = buYongList.Where(x => x.reasonType == "不适用").Count();
//申请不用——条件受限(其他)
int buYongTJShouXian = buYong - buYongYiWanGong - buYongTingHuanJian;
int buYongTJShouXian = buYongList.Where(x => x.reasonType == "条件受限").Count();
//int buYongTJShouXian = buYong - buYongYiWanGong - buYongTingHuanJian - buYongBuShiYong;
//4、预立项
int yuLiXiang = (from x in projects where x.MasterSysId == null select x).Count();
//应使用项目数=主数据项目+预立项-已完工-停缓建
int beUsedProNum = masterTotal + yuLiXiang - buYongYiWanGong - buYongTingHuanJian;
//已上线项目=已关联+预立项;
//应使用项目数主数据项目+预立项-已完工-不适用
int beUsedProNum = masterTotal + yuLiXiang - buYongYiWanGong - buYongBuShiYong;
//已上线项目已关联+预立项;
int yiShangXian = zhengChang + yuLiXiang;
//未上线总数:待上线+停缓建+条件受限;
int weiShangXian = daiJian + buYongTingHuanJian + buYongTJShouXian;
//申请关闭总数:已完工/撤场+不适用;
int shenQingGuanBi = buYongYiWanGong + buYongBuShiYong;
//上线率=100*已上线/应使用项目数
var onlineRate = (decimal)Math.Round((100.0 * yiShangXian / beUsedProNum), 2);
onlineRate = onlineRate > 100 ? 100 : onlineRate;
@@ -238,7 +249,9 @@ namespace BLL
UnitId = thisUnit.UnitId,
ReportDate = now.Date,
DataDate = now,
YiShangXian= yiShangXian,
YiShangXian = yiShangXian,
WeiShangXian = weiShangXian,
ShenQingGuanBi = shenQingGuanBi,
OnlineRate = onlineRate,
Total = beUsedProNum,
MasterTotal = masterTotal,
@@ -248,6 +261,7 @@ namespace BLL
BuYong = buYong,
BuYongYiWanGong = buYongYiWanGong,
BuYongTingHuanJian = buYongTingHuanJian,
BuYongBuShiYong = buYongBuShiYong,
BuYongTJShouXian = buYongTJShouXian,
YuLiXiang = yuLiXiang,
CreateUser = userName,