|
|
@ -1,5 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Text.Json; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
@ -7,6 +8,7 @@ using Volo.Abp; |
|
|
|
using Volo.Abp.Application.Dtos; |
|
|
|
using Volo.Abp.AspNetCore.Mvc; |
|
|
|
using Win_in.Sfs.Auth.Application.Contracts; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Shared.Domain; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
@ -25,6 +27,8 @@ public class CountJobController : AbpController |
|
|
|
|
|
|
|
private readonly IUserWorkGroupAppService _userWorkGroupAppService; |
|
|
|
|
|
|
|
private readonly IItemBasicAppService _itemBasicAppService; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
@ -32,10 +36,11 @@ public class CountJobController : AbpController |
|
|
|
/// <param name="userWorkGroupAppService"></param>
|
|
|
|
public CountJobController( |
|
|
|
ICountJobAppService countJobAppService |
|
|
|
, IUserWorkGroupAppService userWorkGroupAppService) |
|
|
|
, IUserWorkGroupAppService userWorkGroupAppService, IItemBasicAppService itemBasicAppService) |
|
|
|
{ |
|
|
|
_userWorkGroupAppService = userWorkGroupAppService; |
|
|
|
_countJobAppService = countJobAppService; |
|
|
|
_itemBasicAppService = itemBasicAppService; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -220,6 +225,11 @@ public class CountJobController : AbpController |
|
|
|
[HttpPost("finish/{id}")] |
|
|
|
public virtual async Task FinishAsync(Guid id, [FromBody] CountJobDTO dto) |
|
|
|
{ |
|
|
|
var errors=await Check(dto).ConfigureAwait(false); |
|
|
|
if (errors.Count > 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException(string.Join(',', errors)); |
|
|
|
} |
|
|
|
await _countJobAppService.CompleteAsync(id, dto).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
@ -246,7 +256,45 @@ public class CountJobController : AbpController |
|
|
|
[HttpPost("handle-note")] |
|
|
|
public virtual async Task HandleForNoteAsync(Guid id, CountJobDTO dto) |
|
|
|
{ |
|
|
|
var errors = await Check(dto).ConfigureAwait(false); |
|
|
|
if (errors.Count > 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException(string.Join(',', errors)); |
|
|
|
} |
|
|
|
await _countJobAppService.CompleteAsync(id, dto).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async Task<List<string>> Check(CountJobDTO dto) |
|
|
|
{ |
|
|
|
List<string> errors = new List<string>(); |
|
|
|
foreach (var itm in dto.Details) |
|
|
|
{ |
|
|
|
var item = await _itemBasicAppService.GetByCodeAsync(itm.ItemCode).ConfigureAwait(false); |
|
|
|
if (item == null) |
|
|
|
{ |
|
|
|
errors.Add($"ERP料号{itm.ItemCode}不存在"); |
|
|
|
//validationRresult.Add(new ValidationResult($"ERP料号{importInput.ItemCode}不存在", new[] { "ERP料号" }));
|
|
|
|
} |
|
|
|
else if (item.StdPackQty == 0) |
|
|
|
{ |
|
|
|
errors.Add($"ERP料号{itm.ItemCode}的物品信息中标准包装等于0或不存在"); |
|
|
|
//validationRresult.Add(
|
|
|
|
// new ValidationResult($"ERP料号{importInput.ItemCode}的物品信息中标准包装等于0或不存在", new[] { "标准包装" }));
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
itm.ItemName = item.Name; |
|
|
|
itm.ItemDesc1 = item.Desc1; |
|
|
|
itm.ItemDesc2 = item.Desc2; |
|
|
|
itm.StdPackQty = item.StdPackQty; |
|
|
|
itm.Uom = item.BasicUom; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return errors; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|