From 341b25b2f75450e2fc575beba21517260c3ae079 Mon Sep 17 00:00:00 2001 From: geh <1923421292@qq.com> Date: Sun, 1 Mar 2026 17:28:30 +0800 Subject: [PATCH] 1 --- .../HSSE/APIHazardRegisterSyncService.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/SGGL/BLL/DataShare/HSSE/APIHazardRegisterSyncService.cs b/SGGL/BLL/DataShare/HSSE/APIHazardRegisterSyncService.cs index d7b8f895..edd27e1a 100644 --- a/SGGL/BLL/DataShare/HSSE/APIHazardRegisterSyncService.cs +++ b/SGGL/BLL/DataShare/HSSE/APIHazardRegisterSyncService.cs @@ -171,7 +171,7 @@ public class APIHazardRegisterSyncService JsonConvert.DeserializeObject>(obj["data"].ToString()); if (getData.Count() > 0) { - ProcessHazardRegisterData(getData, project.ProjectId, unitId, WebUrl); + ProcessHazardRegisterData(getData, project.ProjectId, unitId, WebUrl,"pull"); } message = "获取成功:同步安全检查数" + getData.Count().ToString() + "条"; } @@ -293,7 +293,7 @@ public class APIHazardRegisterSyncService } else { - ProcessHazardRegisterData(items.Items, ProjectId, unit.UnitId, UnitDomain); + ProcessHazardRegisterData(items.Items, ProjectId, unit.UnitId, UnitDomain,"push"); message = "数据推送成功!"; } } @@ -324,7 +324,7 @@ public class APIHazardRegisterSyncService /// 单位ID /// Web地址 private static void ProcessHazardRegisterData(List getData, string projectId, - string unitId, string WebUrl) + string unitId, string WebUrl, string type) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { @@ -379,8 +379,11 @@ public class APIHazardRegisterSyncService Requirements = item.Requirements, Risk_Level = item.Risk_Level, //ControlId = item.ControlId, - DataSource = item.DataSource, }; + if (type == "pull") + { + newModel.DataSource = item.DataSource; + } db.HSSE_Hazard_HazardRegister.InsertOnSubmit(newModel); db.SubmitChanges(); } @@ -429,7 +432,10 @@ public class APIHazardRegisterSyncService model.Requirements = item.Requirements; model.Risk_Level = item.Risk_Level; //model.ControlId = item.ControlId; - model.DataSource = item.DataSource; + if (type == "pull") + { + model.DataSource = item.DataSource; + } db.SubmitChanges(); }