Browse Source

erp储位和零件对应关系修改

dev_DY_CC
lvzb 1 year ago
parent
commit
2a4141f91f
  1. 9
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ErpLocationItems/ErpLocationItemAppService.cs
  2. 8
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ErpLocationItems/ErpLocationItemEfCoreRepository.cs
  3. 7
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs

9
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ErpLocationItems/ErpLocationItemAppService.cs

@ -49,14 +49,5 @@ public class ErpLocationItemAppService
var dtos = ObjectMapper.Map<List<ErpLocationItem>, List<ErpLocationItemDTO>>(entities); var dtos = ObjectMapper.Map<List<ErpLocationItem>, List<ErpLocationItemDTO>>(entities);
return dtos; return dtos;
} }
protected override async Task ValidateImportModelAsync(ErpLocationItemImportInput importInput, List<ValidationResult> validationRresult)
{
await base.CheckItemBasicItemCodeAsync(importInput.ItemCode, validationRresult).ConfigureAwait(false);
}
} }

8
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/ErpLocationItems/ErpLocationItemEfCoreRepository.cs

@ -16,16 +16,10 @@ public class ErpLocationItemEfCoreRepository : SfsBaseDataEfCoreRepositoryBase<B
public virtual async Task UpsertAsync(ErpLocationItem entity) public virtual async Task UpsertAsync(ErpLocationItem entity)
{ {
var dbSet = await GetDbSetAsync().ConfigureAwait(false); var dbSet = await GetDbSetAsync().ConfigureAwait(false);
var exist = await dbSet.FirstOrDefaultAsync(p => p.ItemCode == entity.ItemCode).ConfigureAwait(false); var exist = await dbSet.FirstOrDefaultAsync(p => p.ItemCode == entity.ItemCode&&p.ErpLocationCode == entity.ErpLocationCode).ConfigureAwait(false);
if (exist == null) if (exist == null)
{ {
var insRet = await InsertAsync(entity).ConfigureAwait(false); var insRet = await InsertAsync(entity).ConfigureAwait(false);
} }
else
{
exist.ItemCode = entity.ItemCode;
exist.ErpLocationCode = entity.ErpLocationCode;
}
} }
} }

7
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs

@ -29,6 +29,7 @@ public class BalanceManager : DomainService, IBalanceManager
private readonly IItemBasicAclService _itemBasicAclService; private readonly IItemBasicAclService _itemBasicAclService;
private readonly ILocationAclService _locationAclService; private readonly ILocationAclService _locationAclService;
private readonly IItemStoreRelationAclService _itemStoreRelationAclService; private readonly IItemStoreRelationAclService _itemStoreRelationAclService;
private readonly IErpLocationItemAppService _erpLocationItemAppService;
private readonly ISettingManager _settingManager; private readonly ISettingManager _settingManager;
private readonly IExpectInRepository _expectInRepository; private readonly IExpectInRepository _expectInRepository;
private readonly IExpectOutRepository _expectOutRepository; private readonly IExpectOutRepository _expectOutRepository;
@ -41,6 +42,7 @@ public class BalanceManager : DomainService, IBalanceManager
, IExpectOutRepository expectOutRepository , IExpectOutRepository expectOutRepository
, IItemStoreRelationAclService itemStoreRelationAclService , IItemStoreRelationAclService itemStoreRelationAclService
, ISettingManager settingManager , ISettingManager settingManager
,IErpLocationItemAppService erpLocationItemAppService
) )
{ {
_objectMapper = objectMapper; _objectMapper = objectMapper;
@ -51,6 +53,7 @@ public class BalanceManager : DomainService, IBalanceManager
_itemStoreRelationAclService = itemStoreRelationAclService; _itemStoreRelationAclService = itemStoreRelationAclService;
_settingManager = settingManager; _settingManager = settingManager;
_expectOutRepository = expectOutRepository; _expectOutRepository = expectOutRepository;
_erpLocationItemAppService= erpLocationItemAppService;
} }
#region Modify #region Modify
@ -159,7 +162,9 @@ public class BalanceManager : DomainService, IBalanceManager
/// <exception cref="UserFriendlyException"></exception> /// <exception cref="UserFriendlyException"></exception>
private async Task CheckErpLocationItemAsync(Transaction transaction) private async Task CheckErpLocationItemAsync(Transaction transaction)
{ {
if (transaction == null) var erpLocationItem =await _erpLocationItemAppService.GetFirstAsync(transaction.LocationErpCode, transaction.ItemCode).ConfigureAwait(false);
if (erpLocationItem == null)
{ {
throw new UserFriendlyException($"未找到零件【{transaction.ItemCode}】与ERP储位【{transaction.LocationErpCode}】的开账信息"); throw new UserFriendlyException($"未找到零件【{transaction.ItemCode}】与ERP储位【{transaction.LocationErpCode}】的开账信息");
} }

Loading…
Cancel
Save