diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs index a55441e4..f0ada4a6 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs @@ -79,13 +79,8 @@ public class MaterialRelationshipAppService : SettleAccountApplicationBase p.ErpMaterialCode == item.ErpMaterialCode && p.BusinessType == EnumBusinessType.BeiJian); - if (entity != null) - { - entity.Update(item.MaterialDesc, item.SettleMaterialCode); - await _repository.UpdateAsync(entity).ConfigureAwait(false); - } - else + var entity = _repository.FirstOrDefault(p => p.ErpMaterialCode == item.ErpMaterialCode && p.BusinessType == EnumBusinessType.BeiJian && p.SettleMaterialCode == item.SettleMaterialCode); + if (entity == null) { item.BusinessType = EnumBusinessType.BeiJian; await _repository.InsertAsync(item).ConfigureAwait(false);