|
|
@ -8,6 +8,8 @@ using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Caching; |
|
|
|
using Volo.Abp.Domain.Repositories; |
|
|
|
using Volo.Abp.ObjectMapping; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Basedata.Domain; |
|
|
|
using Win_in.Sfs.Basedata.Domain.Shared; |
|
|
@ -44,18 +46,26 @@ public class ErpLocationItemAppService |
|
|
|
/// <param name="itemCode"></param>
|
|
|
|
/// <param name="erpLocationCode"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
[HttpGet("check-item-erplocation-is-available")] |
|
|
|
public virtual async Task<bool> CheckItemErpLocationIsAvailable(string itemCode,string erpLocationCode) |
|
|
|
public virtual async Task<ErpLocationItemDTO> CheckItemErpLocationIsAvailable(string itemCode,string erpLocationCode) |
|
|
|
{ |
|
|
|
var entity = await _repository.FindAsync(p => p.ItemCode == itemCode && p.ErpLocationCode== erpLocationCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
var entity = await _repository.FirstOrDefaultAsync(p => p.ItemCode == itemCode && p.ErpLocationCode== erpLocationCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (entity == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"未找到物料代码为 {itemCode} 和储位代码 {erpLocationCode} 的对应关系"); |
|
|
|
} |
|
|
|
if (await SettingManager.IsTrueAsync(BasedataSettings.ErpLocationItem.NotFoundReturnInfinity).ConfigureAwait(false)) |
|
|
|
{ |
|
|
|
|
|
|
|
return true; |
|
|
|
entity = new ErpLocationItem() |
|
|
|
{ |
|
|
|
ItemCode = itemCode, |
|
|
|
ErpLocationCode= erpLocationCode |
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
var dto = ObjectMapper.Map<ErpLocationItem, ErpLocationItemDTO>(entity); |
|
|
|
return dto; |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("upsert")] |
|
|
|