|
|
@ -9,9 +9,11 @@ using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Omu.ValueInjecter; |
|
|
|
using Org.BouncyCastle.Asn1.Ocsp; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Data; |
|
|
|
using Volo.Abp.Domain.Entities; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Volo.Abp.Users; |
|
|
|
using Win_in.Sfs.Auth.Application.Contracts; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
@ -36,13 +38,19 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
private readonly IBalanceAppService _balanceAppService; |
|
|
|
private readonly ILocationAppService _locationAppService; |
|
|
|
private readonly ITransactionTypeAclService _transactionTypeAclService; |
|
|
|
private readonly IUnplannedIssueJobAppService _unplannedIssueJobAppService; |
|
|
|
private readonly IUnitOfWorkManager _unitOfWorkManager; |
|
|
|
private readonly ILogger<UnplannedIssueRequestForDongyangAppService> _logger; |
|
|
|
//private readonly IExportImportService _excelService;
|
|
|
|
|
|
|
|
|
|
|
|
public UnplannedIssueRequestForDongyangAppService(IUnplannedIssueRequestRepository repository, |
|
|
|
IUnplannedIssueRequestManager unplannedIssueRequestManager, |
|
|
|
IDepartmentAppService departmentApp, IBalanceAppService balanceAppService, ILocationAppService locationAppService, IExportImportService excelService, |
|
|
|
ITransactionTypeAclService transactionTypeAclService |
|
|
|
ITransactionTypeAclService transactionTypeAclService, IUnplannedIssueJobAppService unplannedIssueJobAppService, IUnitOfWorkManager unitOfWorkManager |
|
|
|
, ILogger<UnplannedIssueRequestForDongyangAppService> logger |
|
|
|
|
|
|
|
|
|
|
|
) : base( repository, unplannedIssueRequestManager, excelService) |
|
|
|
{ |
|
|
|
_unplannedIssueRequestManager = unplannedIssueRequestManager; |
|
|
@ -50,6 +58,9 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
_balanceAppService = balanceAppService; |
|
|
|
_locationAppService = locationAppService; |
|
|
|
_transactionTypeAclService = transactionTypeAclService; |
|
|
|
_unplannedIssueJobAppService = unplannedIssueJobAppService; |
|
|
|
_unitOfWorkManager = unitOfWorkManager; |
|
|
|
_logger = logger; |
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|
/// OA创建计划外出库申请
|
|
|
@ -86,11 +97,12 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
[HttpPost("import-dongyang")] |
|
|
|
public async Task<IActionResult> ImportDYAsync([FromForm] SfsImportRequestInput requestInput, [Required] IFormFile file) |
|
|
|
public async Task<IActionResult> ImportDYAsync([FromForm] SfsImportRequestInput requestInput, [Required] IFormFile file) |
|
|
|
{ |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
|
|
|
|
using var ms = new MemoryStream(); |
|
|
|
await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false); |
|
|
|
var inputFileBytes = ms.GetAllBytes(); |
|
|
@ -98,14 +110,31 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
await CreateByDYOAsync(importList, EnumUnplannedIssueType.IMPORT).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
//if (errors.Count > 0)
|
|
|
|
//{
|
|
|
|
// var fileContent = _excelService.Export(errors);
|
|
|
|
// return new TestResult(fileContent.FileContents, ExportImportService.ContentType) { FileDownloadName = "错误信息" };
|
|
|
|
//}
|
|
|
|
List<UnplannedIssueRequestImportDto> errorsList = new List<UnplannedIssueRequestImportDto>(); |
|
|
|
|
|
|
|
foreach (var itm in importList) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(itm.CaseCode) |
|
|
|
|| string.IsNullOrEmpty(itm.ItemCode) |
|
|
|
|| itm.Qty == 0 |
|
|
|
|| string.IsNullOrEmpty(itm.ProjCapacityCode) |
|
|
|
|| string.IsNullOrEmpty(itm.LocationErpCode) |
|
|
|
|
|
|
|
) |
|
|
|
{ |
|
|
|
itm.Explain = "此项错误"; |
|
|
|
errorsList.Add(itm); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (errorsList.Count > 0) |
|
|
|
{ |
|
|
|
var fileContent = _excelService.Export(errorsList); |
|
|
|
return new TestResult(fileContent.FileContents, ExportImportService.ContentType) { FileDownloadName =fileContent.FileDownloadName }; |
|
|
|
} |
|
|
|
|
|
|
|
var fileContent1 = _excelService.Export(importList); |
|
|
|
// return new TestResult(fileContent1.FileContents, ExportImportService.ContentType) { FileDownloadName = "Kitting导入文件" };
|
|
|
|
|
|
|
|
return new JsonResult(new { Code = 200, FileDownloadName = fileContent1.FileDownloadName }); |
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
@ -115,6 +144,39 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task SetEntityPropertiesAsync(UnplannedIssueRequest entity) |
|
|
|
{ |
|
|
|
var userName = CurrentUser.GetUserName_New(); |
|
|
|
var name = CurrentUser.GetName(); |
|
|
|
if (userName != null) |
|
|
|
{ |
|
|
|
var department = await _departmentApp.GetByUsernameAsync(userName).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (department != null) |
|
|
|
{ |
|
|
|
entity.DeptCode = department.Code; |
|
|
|
entity.DeptName = department.Name; |
|
|
|
} |
|
|
|
entity.CreatorId = CurrentUser.Id; |
|
|
|
entity.Worker = name; |
|
|
|
} |
|
|
|
|
|
|
|
entity.BuildDate = DateTime.Now; |
|
|
|
|
|
|
|
//await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false);
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// OA接口
|
|
|
|
/// </summary>
|
|
|
@ -124,8 +186,18 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
|
|
|
|
public async Task<UnplannedIssueRequestDTO> CreateByAsync(List<UnplannedIssueRequestImportDto> p_list) |
|
|
|
{ |
|
|
|
UnplannedIssueRequestDTO request = new UnplannedIssueRequestDTO(); |
|
|
|
try |
|
|
|
{ |
|
|
|
return await CreateByDYOAsync(p_list, EnumUnplannedIssueType.OA, true).ConfigureAwait(false); |
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
|
{ |
|
|
|
|
|
|
|
throw new UserFriendlyException(e.Message); |
|
|
|
} |
|
|
|
|
|
|
|
return await CreateByDYOAsync(p_list, EnumUnplannedIssueType.OA, true).ConfigureAwait(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -134,6 +206,9 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
protected async Task<UnplannedIssueRequestDTO> CreateByDYOAsync(List<UnplannedIssueRequestImportDto> p_list, EnumUnplannedIssueType type, bool isAutoSubmit=false) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UnplannedIssueRequest request = new UnplannedIssueRequest(); |
|
|
|
if (p_list.Count == 0) |
|
|
|
{ |
|
|
@ -151,9 +226,9 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
request.DeptCode = first.DeptCode; |
|
|
|
request.DeptName = first.DeptName; |
|
|
|
request.BuildDate= DateTime.Now; |
|
|
|
|
|
|
|
|
|
|
|
request.OANumber=first.OANumber; |
|
|
|
|
|
|
|
await SetEntityPropertiesAsync(request).ConfigureAwait(false); |
|
|
|
List<UnplannedIssueRequestDetail> detailList = new List<UnplannedIssueRequestDetail>(); |
|
|
|
foreach (var itm in p_list) |
|
|
|
{ |
|
|
@ -162,13 +237,10 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
detail.Qty = itm.Qty; |
|
|
|
|
|
|
|
detail.LocationErpCode = itm.LocationErpCode; |
|
|
|
|
|
|
|
detail.LocationCode = "Random"; |
|
|
|
detail.WarehouseCode ="Random"; |
|
|
|
detail.LocationGroup ="Random"; |
|
|
|
detail.LocationArea = "Random"; |
|
|
|
|
|
|
|
|
|
|
|
detail.CaseCode = first.CaseCode; |
|
|
|
detail.ProjCapacityCode = first.ProjCapacityCode; |
|
|
|
detail.OnceBusiCode = first.OnceBusiCode; |
|
|
@ -186,6 +258,22 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
return dto; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("update-status-by-job")] |
|
|
|
public override async Task UpdateStatusByJobAsync(string requestNumber) |
|
|
|
{ |
|
|
|
var flag = await _unplannedIssueJobAppService.IsAllJobOverByRequestNumberAsync(requestNumber).ConfigureAwait(false); |
|
|
|
if (flag) |
|
|
|
{ |
|
|
|
var unplannedReceiptRequest = await _repository.FindAsync(p => p.Number == requestNumber).ConfigureAwait(false); |
|
|
|
unplannedReceiptRequest.RequestStatus = EnumRequestStatus.Completed; |
|
|
|
await _repository.UpdateAsync(unplannedReceiptRequest).ConfigureAwait(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task SetDetailPropertiesAsync(UnplannedIssueRequestDetail detail) |
|
|
|
{ |
|
|
|
var itemBasic = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
|
|
@ -205,16 +293,12 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
|
|
|
|
packingcode =string.IsNullOrEmpty(detail.PackingCode)?"99999999":detail.PackingCode; |
|
|
|
|
|
|
|
detail.PackingCode = packingcode; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
detail.PackingCode = packingcode; |
|
|
|
|
|
|
|
detail.Status = EnumInventoryStatus.OK; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -226,71 +310,39 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
{ |
|
|
|
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); |
|
|
|
|
|
|
|
foreach (var unplannedIssueRequest in addList) |
|
|
|
foreach (var unplannedReceiptRequest in addList) |
|
|
|
{ |
|
|
|
if(unplannedIssueRequest.UnplannedIssueType != EnumUnplannedIssueType.Wip&& unplannedIssueRequest.UnplannedIssueType != EnumUnplannedIssueType.Raw) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"【{unplannedIssueRequest.UnplannedIssueType}】领料类型," + |
|
|
|
$"不是{EnumUnplannedIssueType.Wip.GetDisplayName()}" + |
|
|
|
$"或{EnumUnplannedIssueType.Raw.GetDisplayName()}】"); |
|
|
|
} |
|
|
|
await SetRequestAutoPropertiesAsync(unplannedIssueRequest).ConfigureAwait(false); |
|
|
|
await SetEntityPropertiesAsync(unplannedIssueRequest).ConfigureAwait(false); |
|
|
|
List<UnplannedIssueRequestDetail> newDetails = new List<UnplannedIssueRequestDetail>(); |
|
|
|
foreach (var detail in unplannedIssueRequest.Details) |
|
|
|
{ |
|
|
|
//需要复制一个这个方法 去掉区域参数 换成库位参数
|
|
|
|
RecommendBalanceRequestInput input = new RecommendBalanceRequestInput(); |
|
|
|
if (unplannedIssueRequest.UnplannedIssueType == EnumUnplannedIssueType.Raw) |
|
|
|
{ |
|
|
|
var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); |
|
|
|
if (locationDto.Type != EnumLocationType.RAW && locationDto.Type != EnumLocationType.SEMI && locationDto.Type != EnumLocationType.FG) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"【{detail.LocationCode}】库位类型错误," + |
|
|
|
$"不是{EnumLocationType.RAW.GetDisplayName()}" + |
|
|
|
$"或{EnumLocationType.SEMI.GetDisplayName()}" + |
|
|
|
$"或{EnumLocationType.FG.GetDisplayName()}】"); |
|
|
|
} |
|
|
|
// unplannedIssueRequest.DirectCreateNote = false;
|
|
|
|
input.IsPackingCode = true;//只查询带箱码的推荐
|
|
|
|
} |
|
|
|
if (unplannedIssueRequest.UnplannedIssueType == EnumUnplannedIssueType.Wip) |
|
|
|
{ |
|
|
|
var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); |
|
|
|
if (locationDto.Type != EnumLocationType.WIP) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"【{detail.LocationCode}】库位类型错误," + |
|
|
|
$"不是{EnumLocationType.WIP.GetDisplayName()}】"); |
|
|
|
} |
|
|
|
} |
|
|
|
//if (unplannedReceiptRequest.UnplannedIssueType != EnumUnplannedIssueType.Wip && unplannedReceiptRequest.UnplannedIssueType != EnumUnplannedIssueType.Raw)
|
|
|
|
//{
|
|
|
|
// throw new UserFriendlyException($"【{unplannedReceiptRequest.UnplannedIssueType}】退料料类型," +
|
|
|
|
// $"不是{EnumUnplannedReceiptType.Wip.GetDisplayName()}" +
|
|
|
|
// $"或{EnumUnplannedReceiptType.Raw.GetDisplayName()}】");
|
|
|
|
//}
|
|
|
|
await SetRequestAutoPropertiesAsync(unplannedReceiptRequest).ConfigureAwait(false); |
|
|
|
await SetEntityPropertiesAsync(unplannedReceiptRequest).ConfigureAwait(false); |
|
|
|
|
|
|
|
input.ItemCode = detail.ItemCode; |
|
|
|
input.Locations = new List<string>() { detail.LocationCode }; |
|
|
|
input.Qty = detail.Qty; |
|
|
|
input.Statuses = new List<EnumInventoryStatus> { EnumInventoryStatus.OK }; |
|
|
|
var balanceLst = await _balanceAppService.GetRecommendBalancesByLocationsAsync(input).ConfigureAwait(false); |
|
|
|
if (balanceLst.Count == 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"无推荐库存零件号:{input.ItemCode}库位{input.Locations[0]}!"); |
|
|
|
} |
|
|
|
var sumQty = balanceLst.Sum(itm => itm.Qty); |
|
|
|
if (detail.Qty > sumQty) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"库存数量不足!"); |
|
|
|
} |
|
|
|
foreach (var balance in balanceLst) |
|
|
|
{ |
|
|
|
var newDetail = CreateNewDetail(detail, balance); |
|
|
|
await SetDetailPropertiesAsync(newDetail, unplannedIssueRequest.UnplannedIssueType).ConfigureAwait(false); |
|
|
|
newDetails.Add(newDetail); |
|
|
|
} |
|
|
|
foreach (var detail in unplannedReceiptRequest.Details) |
|
|
|
{ |
|
|
|
await SetDetailPropertiesAsync(detail).ConfigureAwait(false); |
|
|
|
} |
|
|
|
unplannedIssueRequest.Details.Clear();//删除所有明细}
|
|
|
|
unplannedIssueRequest.Details.AddRange(newDetails);//按推荐添加
|
|
|
|
} |
|
|
|
|
|
|
|
return dictionary; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 创建明细
|
|
|
|
/// </summary>
|
|
|
@ -349,29 +401,29 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
detail.LocationArea = location.AreaCode; |
|
|
|
detail.LocationCode = location.Code; |
|
|
|
} |
|
|
|
string packingcode = string.Empty; |
|
|
|
if(type!= EnumUnplannedIssueType.Wip) |
|
|
|
{ |
|
|
|
packingcode = detail.PackingCode; |
|
|
|
} |
|
|
|
var balance = await _balanceAppService.GetByItemLocationAndPackingAsync( |
|
|
|
packingcode, |
|
|
|
detail.ItemCode, |
|
|
|
detail.LocationCode).ConfigureAwait(false); |
|
|
|
//string packingcode = string.Empty;
|
|
|
|
//if(type!= EnumUnplannedIssueType.Wip)
|
|
|
|
//{
|
|
|
|
// packingcode = detail.PackingCode;
|
|
|
|
//}
|
|
|
|
//var balance = await _balanceAppService.GetByItemLocationAndPackingAsync(
|
|
|
|
// packingcode,
|
|
|
|
// detail.ItemCode,
|
|
|
|
// detail.LocationCode).ConfigureAwait(false);
|
|
|
|
|
|
|
|
if (balance != null) |
|
|
|
{ |
|
|
|
detail.SupplierBatch = balance.SupplierBatch; |
|
|
|
detail.ArriveDate = balance.ArriveDate; |
|
|
|
detail.ProduceDate = balance.ProduceDate; |
|
|
|
detail.ExpireDate = balance.ExpireDate; |
|
|
|
|
|
|
|
detail.Lot = balance.Lot; |
|
|
|
detail.ContainerCode = balance.ContainerCode; |
|
|
|
detail.PackingCode = balance.PackingCode; |
|
|
|
detail.Qty = detail.Qty; |
|
|
|
detail.Status = balance.Status; |
|
|
|
} |
|
|
|
//if (balance != null)
|
|
|
|
//{
|
|
|
|
// detail.SupplierBatch = balance.SupplierBatch;
|
|
|
|
// detail.ArriveDate = balance.ArriveDate;
|
|
|
|
// detail.ProduceDate = balance.ProduceDate;
|
|
|
|
// detail.ExpireDate = balance.ExpireDate;
|
|
|
|
|
|
|
|
// detail.Lot = balance.Lot;
|
|
|
|
// detail.ContainerCode = balance.ContainerCode;
|
|
|
|
// detail.PackingCode = balance.PackingCode;
|
|
|
|
// detail.Qty = detail.Qty;
|
|
|
|
// detail.Status = balance.Status;
|
|
|
|
//}
|
|
|
|
|
|
|
|
//if (!string.IsNullOrEmpty(detail))
|
|
|
|
//{
|
|
|
@ -419,33 +471,7 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
//}
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 赋值主记录
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="entity"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task SetEntityPropertiesAsync(UnplannedIssueRequest entity) |
|
|
|
{ |
|
|
|
var userName = CurrentUser.GetUserName_New(); |
|
|
|
var name = CurrentUser.GetName(); |
|
|
|
if (userName != null) |
|
|
|
{ |
|
|
|
var department = await _departmentApp.GetByUsernameAsync(userName).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (department != null) |
|
|
|
{ |
|
|
|
entity.DeptCode = department.Code; |
|
|
|
entity.DeptName = department.Name; |
|
|
|
} |
|
|
|
|
|
|
|
entity.Worker = name; |
|
|
|
entity.CreatorId = CurrentUser.Id; |
|
|
|
} |
|
|
|
|
|
|
|
entity.BuildDate = DateTime.Now; |
|
|
|
|
|
|
|
await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 赋值业务事务
|
|
|
@ -459,13 +485,27 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
|
|
|
|
Check.NotNull(tranType, "事务类型", "事务类型不存在"); |
|
|
|
|
|
|
|
entity.AutoCompleteJob = tranType.AutoCompleteJob; |
|
|
|
entity.AutoSubmit = tranType.AutoSubmitRequest; |
|
|
|
entity.AutoAgree = tranType.AutoAgreeRequest; |
|
|
|
entity.AutoHandle = tranType.AutoHandleRequest; |
|
|
|
entity.DirectCreateNote = tranType.DirectCreateNote; |
|
|
|
entity.AutoCompleteJob = false; |
|
|
|
entity.AutoSubmit = true; |
|
|
|
entity.AutoAgree = false; |
|
|
|
entity.AutoHandle = false; |
|
|
|
entity.DirectCreateNote = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//entity.AutoCompleteJob = tranType.AutoCompleteJob;
|
|
|
|
//entity.AutoSubmit = tranType.AutoSubmitRequest;
|
|
|
|
//entity.AutoAgree = tranType.AutoAgreeRequest;
|
|
|
|
//entity.AutoHandle = tranType.AutoHandleRequest;
|
|
|
|
//entity.DirectCreateNote = tranType.DirectCreateNote;
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 校验
|
|
|
@ -491,11 +531,11 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
var balance = await BalanceAclService.GetByItemLocationAndPackingAsync( |
|
|
|
string.Empty, |
|
|
|
importInput.ItemCode, |
|
|
|
importInput.LocationCode).ConfigureAwait(false); |
|
|
|
importInput.LocationErpCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (balance == null) |
|
|
|
{ |
|
|
|
validationRresult.Add(new ValidationResult($"ERP料号{importInput.ItemCode}在库位{importInput.LocationCode}没有库存记录", new string[] { "库存余额" })); |
|
|
|
validationRresult.Add(new ValidationResult($"ERP料号{importInput.ItemCode}在库位{importInput.LocationErpCode}没有库存记录", new string[] { "库存余额" })); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
@ -543,7 +583,7 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
protected override async Task ValidateImportModelAsync(UnplannedIssueRequestImportInput model, List<ValidationResult> validationRresult) |
|
|
|
{ |
|
|
|
_ = await CheckItemBasicAsync(model, validationRresult).ConfigureAwait(false); |
|
|
|
_ = await CheckLocationAsync(model.LocationCode, validationRresult).ConfigureAwait(false); |
|
|
|
await CheckErpLocationAsync(model.LocationErpCode, validationRresult).ConfigureAwait(false); |
|
|
|
|
|
|
|
await CheckOnceBusiCodeAsync(model, validationRresult).ConfigureAwait(false);//次交易码
|
|
|
|
//await CheckCaseCodeAsync(model, validationRresult).ConfigureAwait(false);//专案代码
|
|
|
@ -566,14 +606,13 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA |
|
|
|
return item; |
|
|
|
} |
|
|
|
|
|
|
|
protected async Task<LocationDTO> CheckLocationAsync(string locationCode, List<ValidationResult> validationRresult) |
|
|
|
protected virtual async Task CheckErpLocationAsync(string locationCode, List<ValidationResult> validationRresult) |
|
|
|
{ |
|
|
|
var location = await LocationAclService.GetByCodeAsync(locationCode).ConfigureAwait(false); |
|
|
|
if (location == null) |
|
|
|
var location = await _locationAppService.GetListByErpLocationCodes(new List<string> { locationCode }).ConfigureAwait(false); |
|
|
|
if (location == null || location.Count == 0) |
|
|
|
{ |
|
|
|
validationRresult.Add(new ValidationResult($"调出库位{locationCode}不存在", new string[] { "调出库位" })); |
|
|
|
validationRresult.Add("调出储位", $"调入出位{locationCode}不存在"); |
|
|
|
} |
|
|
|
return location; |
|
|
|
} |
|
|
|
|
|
|
|
protected async Task CheckOnceBusiCodeAsync(UnplannedIssueRequestImportInput importInput, List<ValidationResult> validationRresult) |
|
|
|