|
|
@ -3,16 +3,21 @@ using System.ComponentModel.DataAnnotations; |
|
|
|
using System.Linq; |
|
|
|
using System.Text.Json; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using DocumentFormat.OpenXml.Office2010.ExcelAc; |
|
|
|
using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Caching; |
|
|
|
using Volo.Abp.ObjectMapping; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Basedata.Domain; |
|
|
|
using Win_in.Sfs.Basedata.Domain.Shared; |
|
|
|
using Win_in.Sfs.Shared.Domain; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; |
|
|
|
using static Win_in.Sfs.Basedata.Domain.BasedataSettings; |
|
|
|
|
|
|
|
namespace Win_in.Sfs.Basedata.Application; |
|
|
|
|
|
|
@ -41,16 +46,58 @@ public class ProductionLineItemAppService : |
|
|
|
var entity = ObjectMapper.Map<ProductionLineItemEditInput, ProductionLineItem>(input); |
|
|
|
await _repository.UpdateAsync(entity).ConfigureAwait(false); |
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|
/// 用来重写 导入数据时可以加工数据
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="dictionary"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
protected override async Task<Dictionary<ProductionLineItem, EntityState>> ImportProcessingEntityAsync(Dictionary<ProductionLineItem, EntityState> dictionary) |
|
|
|
{ |
|
|
|
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); |
|
|
|
|
|
|
|
foreach (var list in addList) |
|
|
|
{ |
|
|
|
if (!string.IsNullOrEmpty(list.RawLocationCodeListJson)) |
|
|
|
{ |
|
|
|
var rawlocationcodelist = list.RawLocationCodeListJson.Split(","); |
|
|
|
list.RawLocationCodeListJson = JsonSerializer.Serialize(rawlocationcodelist); |
|
|
|
} |
|
|
|
if (!string.IsNullOrEmpty(list.ProductLocationCodeListJson)) |
|
|
|
{ |
|
|
|
var productlocationcodelist = list.ProductLocationCodeListJson.Split(","); |
|
|
|
list.ProductLocationCodeListJson = JsonSerializer.Serialize(productlocationcodelist); |
|
|
|
} |
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(list.WipLocationCodeListJson)) |
|
|
|
{ |
|
|
|
var wiplocationcodelist = list.WipLocationCodeListJson.Split(","); |
|
|
|
list.WipLocationCodeListJson = JsonSerializer.Serialize(wiplocationcodelist); |
|
|
|
} |
|
|
|
} |
|
|
|
return dictionary; |
|
|
|
} |
|
|
|
protected override async Task ValidateImportModelAsync(ProductionLineItemImportInput importInput, |
|
|
|
List<ValidationResult> validationRresult) |
|
|
|
{ |
|
|
|
await base.ValidateImportModelAsync(importInput, validationRresult).ConfigureAwait(false); |
|
|
|
await CheckItemBasicItemCodeAsync(importInput.ItemCode, validationRresult).ConfigureAwait(false); |
|
|
|
await CheckProductionLineProdLineCodeAsync(importInput.ProdLineCode, validationRresult).ConfigureAwait(false); |
|
|
|
CheckProductionLineProdLineCodeJsonAsync(importInput.RawLocationCodeListJson, validationRresult); |
|
|
|
CheckProductionLineProdLineCodeJsonAsync(importInput.ProductLocationCodeListJson, validationRresult); |
|
|
|
CheckProductionLineProdLineCodeJsonAsync(importInput.WipLocationCodeListJson, validationRresult); |
|
|
|
} |
|
|
|
|
|
|
|
private void CheckProductionLineProdLineCodeJsonAsync(string locationCodeList, List<ValidationResult> validationRresult) |
|
|
|
{ |
|
|
|
if(!string.IsNullOrEmpty(locationCodeList)) |
|
|
|
{ |
|
|
|
if (!locationCodeList.Contains(',')) |
|
|
|
{ |
|
|
|
validationRresult.Add(new ValidationResult($"维护的库位{locationCodeList}不包含,号", new string[] { "库位" })); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
[HttpPost("get-by-product")] |
|
|
|
public virtual async Task<List<ProductionLineItemDTO>> GetByProductLineCodeAsync(string productLineCode) |
|
|
|
{ |
|
|
|