|
|
@ -77,6 +77,21 @@ public class InventoryInitialNoteAppService : |
|
|
|
return dictionary; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 验证导入数据
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="importInput"></param>
|
|
|
|
/// <param name="validationRresult"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
protected override async Task ValidateImportModelAsync(InventoryInitialNoteImportInput importInput, List<ValidationResult> validationRresult) |
|
|
|
{ |
|
|
|
await CheckItemBasicAsync(importInput, validationRresult).ConfigureAwait(false); |
|
|
|
await CheckLocationAsync(importInput, validationRresult).ConfigureAwait(false); |
|
|
|
await CheckStatusAsync(importInput, validationRresult).ConfigureAwait(false); |
|
|
|
await CheckPackingAsync(importInput, validationRresult).ConfigureAwait(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private static void CheckItemBasic(ItemBasicDTO itemcBasicDto, string itemCode) |
|
|
|
{ |
|
|
|
if (itemcBasicDto == null) |
|
|
@ -121,14 +136,25 @@ public class InventoryInitialNoteAppService : |
|
|
|
{ |
|
|
|
if (string.IsNullOrWhiteSpace(importInput.PackingCode)) |
|
|
|
{ |
|
|
|
return; |
|
|
|
if(!string.IsNullOrWhiteSpace(importInput.Lot)) |
|
|
|
{ |
|
|
|
validationRresult.Add("箱码", $"箱码和批次应该都为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var label = await _inventoryLabelService.GetByCodeAsync(importInput.PackingCode).ConfigureAwait(false); |
|
|
|
if (label == null) |
|
|
|
else |
|
|
|
{ |
|
|
|
validationRresult.Add("标签码", $"标签码{importInput.PackingCode}不存在"); |
|
|
|
if (string.IsNullOrWhiteSpace(importInput.Lot)) |
|
|
|
{ |
|
|
|
validationRresult.Add("批次", $"箱码不为空,批次也不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
var label = await _inventoryLabelService.GetByCodeAsync(importInput.PackingCode).ConfigureAwait(false); |
|
|
|
if (label == null) |
|
|
|
{ |
|
|
|
validationRresult.Add("箱码", $"箱码{importInput.PackingCode}不存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private static async Task CheckStatusAsync(InventoryInitialNoteImportInput importInput, List<ValidationResult> validationRresult) |
|
|
@ -156,6 +182,21 @@ public class InventoryInitialNoteAppService : |
|
|
|
{ |
|
|
|
validationRresult.Add("库位代码", $"库位代码{importInput.LocationCode}不存在"); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if(location.Type == EnumLocationType.RAW) |
|
|
|
{ |
|
|
|
if (string.IsNullOrWhiteSpace(importInput.PackingCode)) |
|
|
|
{ |
|
|
|
validationRresult.Add("箱码", $"库位代码{importInput.LocationCode}为原料库,箱码不能为空"); |
|
|
|
} |
|
|
|
if (string.IsNullOrWhiteSpace(importInput.Lot)) |
|
|
|
{ |
|
|
|
validationRresult.Add("批次", $"库位代码{importInput.LocationCode}为原料库,批次不能为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|