20250704 项目单位重复

This commit is contained in:
毕文静 2025-07-04 10:49:21 +08:00
parent 3f34ab5da2
commit b9817b23df
1 changed files with 13 additions and 9 deletions

View File

@ -260,17 +260,21 @@ namespace BLL
{ {
foreach (var item in unitItemList) foreach (var item in unitItemList)
{ {
var pUnit = new Model.Project_Unit(); var projectUnit = from x in Funs.DB.Project_Unit where x.ProjectId == projectid && x.UnitId == item.UnitId select x;
pUnit.ProjectUnitId = Guid.NewGuid().ToString(); if (projectUnit == null)
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; 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);
} }
} }
} }