From b9817b23dfedcd02bbb7231cd6d3b80f274d9816 Mon Sep 17 00:00:00 2001 From: wendy <408182087@qq.com> Date: Fri, 4 Jul 2025 10:49:21 +0800 Subject: [PATCH] =?UTF-8?q?20250704=20=E9=A1=B9=E7=9B=AE=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SysManage/Sys_UserSettingsService.cs | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/HJGL_DS/BLL/Common/SysManage/Sys_UserSettingsService.cs b/HJGL_DS/BLL/Common/SysManage/Sys_UserSettingsService.cs index 1939117..31a9522 100644 --- a/HJGL_DS/BLL/Common/SysManage/Sys_UserSettingsService.cs +++ b/HJGL_DS/BLL/Common/SysManage/Sys_UserSettingsService.cs @@ -260,17 +260,21 @@ namespace BLL { foreach (var item in unitItemList) { - var pUnit = new Model.Project_Unit(); - pUnit.ProjectUnitId = Guid.NewGuid().ToString(); - pUnit.ProjectId = projectid; - pUnit.UnitId = item.UnitId; - //单位类型 - var bresult = bUnit.FirstOrDefault(x => x.UnitId == item.UnitId && x.UnitType != null && x.UnitType != ""); - if (bresult != null) + var projectUnit = from x in Funs.DB.Project_Unit where x.ProjectId == projectid && x.UnitId == item.UnitId select x; + if (projectUnit == null) { - pUnit.UnitType = bresult.UnitType; + var pUnit = new Model.Project_Unit(); + pUnit.ProjectUnitId = Guid.NewGuid().ToString(); + pUnit.ProjectId = projectid; + pUnit.UnitId = item.UnitId; + //单位类型 + var bresult = bUnit.FirstOrDefault(x => x.UnitId == item.UnitId && x.UnitType != null && x.UnitType != ""); + if (bresult != null) + { + pUnit.UnitType = bresult.UnitType; + } + AddProject_Unit.Add(pUnit); } - AddProject_Unit.Add(pUnit); } } }