lvzb 2 years ago
parent
commit
4ad2cb7a72
  1. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/EosAgentModule.cs
  2. 4
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/FawtygAutoMapperProfile.cs
  3. 28
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/EosIncomingBackgroundWorker.cs
  4. 57
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ShipConverter.cs
  5. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/BackFluConverter.cs
  6. 2
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs
  7. 58
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs
  8. 52
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs
  9. 121
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ItemTransformRequests/ItemTransformRequestAppService.cs
  10. 24
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs
  11. 85
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs
  12. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/SupplierAsns/SupplierAsnManager.cs
  13. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/MaterialRequestManager.cs
  14. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs
  15. 23
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ProductReceiptNoteEventHandler.cs

2
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/EosAgentModule.cs

@ -166,7 +166,7 @@ public class EosAgentModule : AbpModule
{
context.AddBackgroundWorkerAsync<EosIncomingBackgroundWorker>();
context.AddBackgroundWorkerAsync<EosOutgoingBackgroundWorker>();
//context.AddBackgroundWorkerAsync<EosOutgoingBackgroundWorker>();
}
}

4
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/FawtygAutoMapperProfile.cs

@ -9,6 +9,7 @@ using Win_in.Sfs.Wms.DataExchange.WMS.ItemPack;
using Win_in.Sfs.Wms.DataExchange.WMS.PurchaseOrder;
using Win_in.Sfs.Wms.DataExchange.WMS.PurchaseReceipt;
using Win_in.Sfs.Wms.DataExchange.WMS.PurchaseReturn;
using Win_in.Sfs.Wms.DataExchange.WMS.PutawayNote;
using Win_in.Sfs.Wms.DataExchange.WMS.SuppplierAsn;
using Win_in.Sfs.Wms.Store.Application.Contracts;
@ -23,6 +24,9 @@ public class FawtygAutoMapperProfile : Profile
CreateMap<OutgoingFromWms, ArchivedOutgoingFromWms>();
CreateMap<OutgoingToExternal, ArchivedOutgoingToExternal>();
CreateMap<PutawayNoteDTO, PutawayNoteExchangeDto>();
CreateMap<PutawayNoteDetailDTO, PutawayNoteDetailExchangeDto>();
CreateMap<PurchaseReceiptNoteDTO, PurchaseReceiptNoteExchangeDto>()
.Ignore(x => x.Detail);
CreateMap<PurchaseReceiptNoteDetailDTO, PurchaseReceiptNoteDetailExchangeDto>();

28
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/EosIncomingBackgroundWorker.cs

@ -35,13 +35,13 @@ public class EosIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
return;
}
Logger.LogInformation($"Read Plan");
var planReader = workerContext.ServiceProvider.GetRequiredService<PlanReader>();
var planConverter = workerContext.ServiceProvider.GetRequiredService<PlanConverter>();
//读取并保存Plan
var plansFromExternalList = await planReader.ReadAsync().ConfigureAwait(false);
//转换Plan
await planConverter.ConvertAsync(plansFromExternalList).ConfigureAwait(false);
//Logger.LogInformation($"Read Plan");
//var planReader = workerContext.ServiceProvider.GetRequiredService<PlanReader>();
//var planConverter = workerContext.ServiceProvider.GetRequiredService<PlanConverter>();
////读取并保存Plan
//var plansFromExternalList = await planReader.ReadAsync().ConfigureAwait(false);
////转换Plan
//await planConverter.ConvertAsync(plansFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Read Ship");
var shipHandleService = workerContext.ServiceProvider.GetRequiredService<ShipReader>();
@ -51,13 +51,13 @@ public class EosIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
//转换Ship
await shipConverter.ConvertAsync(shipsFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Read Product");
var productHandleService = workerContext.ServiceProvider.GetRequiredService<ProductReader>();
var productConverter = workerContext.ServiceProvider.GetRequiredService<ProductConverter>();
//读取并保持Product
var productsFromExternalList = await productHandleService.ReadAsync().ConfigureAwait(false);
// 转换Product
await productConverter.ConvertAsync(productsFromExternalList).ConfigureAwait(false);
//Logger.LogInformation($"Read Product");
//var productHandleService = workerContext.ServiceProvider.GetRequiredService<ProductReader>();
//var productConverter = workerContext.ServiceProvider.GetRequiredService<ProductConverter>();
////读取并保持Product
//var productsFromExternalList = await productHandleService.ReadAsync().ConfigureAwait(false);
//// 转换Product
//await productConverter.ConvertAsync(productsFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Completed: Handling {Incoming}");
}

57
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ShipConverter.cs

@ -5,13 +5,16 @@ using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Volo.Abp.Data;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Label.Application.Contracts;
using Win_in.Sfs.Label.Domain.Shared;
using Win_in.Sfs.Wms.DataExchange.Domain;
using Win_in.Sfs.Wms.DataExchange.Domain.Shared;
using Win_in.Sfs.Wms.DataExchange.WMS.SuppplierAsn;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent;
@ -24,6 +27,9 @@ public class ShipConverter : IIncomingConverter
private readonly IItemPackAppService _itemPackAppService;
private readonly ILogger<ShipConverter> _logger;
private readonly IConfiguration _configuration;
private readonly ISupplierAppService _supplierAppService;
private readonly ISupplierItemAppService _supplierItemAppService;
public ShipConverter(
IIncomingToWmsManager incomingToWmsManager
, IObjectMapper objectMapper
@ -31,8 +37,9 @@ public class ShipConverter : IIncomingConverter
, IItemPackAppService itemPackAppService
, ILogger<ShipConverter> logger,
IConfiguration configuration,
IIncomingFromExternalManager incomingFromExternalManager
)
IIncomingFromExternalManager incomingFromExternalManager,
ISupplierAppService supplierAppService,
ISupplierItemAppService supplierItemAppService)
{
_incomingFromExternalManager = incomingFromExternalManager;
_incomingToWmsManager = incomingToWmsManager;
@ -41,6 +48,8 @@ public class ShipConverter : IIncomingConverter
_itemPackAppService = itemPackAppService;
_logger = logger;
_configuration = configuration;
_supplierAppService = supplierAppService;
_supplierItemAppService = supplierItemAppService;
}
public virtual async Task ConvertAsync(List<IncomingFromExternal> incomingFromExternalList)
@ -95,13 +104,55 @@ public class ShipConverter : IIncomingConverter
{
purchaseLabel.ItemName = item.Name;
purchaseLabel.ItemDesc1 = item.Desc1;
purchaseLabel.Uom = item.BasicUom;
purchaseLabel.ItemDesc2 = item.Desc2;
}
else
{
purchaseLabel.ItemName = "";
purchaseLabel.ItemDesc1 = "";
purchaseLabel.Uom = "";
purchaseLabel.ItemDesc2 = "";
}
purchaseLabel.LabelType = EnumLabelType.PurchaseLabel;
var supplierDto = await _supplierAppService.GetByCodeAsync(exchangeAsn.SupplierCode).ConfigureAwait(false);
purchaseLabel.SupplierCode = exchangeAsn.SupplierCode;
purchaseLabel.PoNumber = exchangeAsn.PoNumber;
purchaseLabel.Qty = exchangeAsn.Detail.Qty;
var supplierItemDTO=await _supplierItemAppService.GetBySupplierCodeAndItemCodeAsync(exchangeAsn.SupplierCode, purchaseLabel.ItemCode).ConfigureAwait(false);
purchaseLabel.ProduceDate = exchangeAsn.Detail.ProduceDate;
purchaseLabel.ArriveDate = exchangeAsn.Detail.ArriveDate;
purchaseLabel.FullBarcodeString = exchangeAsn.Detail.PackingCode;
purchaseLabel.LocationErpCode = exchangeAsn.Detail.LocationErpCode;
purchaseLabel.Lot = exchangeAsn.Detail.Lot;
purchaseLabel.RecommendLocationCode = exchangeAsn.Detail.LocationErpCode;
purchaseLabel.Remark = exchangeAsn.Detail.Remark;
purchaseLabel.Code = exchangeAsn.Detail.PackingCode;
purchaseLabel.PlanArriveDate = exchangeAsn.PlanArriveDate;
purchaseLabel.SupplierItemCode = supplierItemDTO.SupplierItemCode;
purchaseLabel.SupplierItemName = supplierItemDTO.ItemName;
purchaseLabel.ExpireDate = DateTime.Now.AddDays(item.GetValidateDays());
purchaseLabel.ExtraProperties = new ExtraPropertyDictionary();
purchaseLabel.LabelStatus = LabelStatus.Enable;
purchaseLabel.Specifications = item.Color;
purchaseLabel.StdPackQty = item.StdPackQty;
purchaseLabel.SupplierName = supplierDto.Name;
purchaseLabel.SupplierSimpleName = supplierDto.ShortName;
purchaseLabel.Team = string.Empty;
purchaseLabel.ProdLine = string.Empty;
purchaseLabel.QLevel = string.Empty;
purchaseLabel.QualityFile = string.Empty;
purchaseLabel.Shift = string.Empty;
purchaseLabel.ContainerCode = string.Empty;
purchaseLabel.RpNumber = string.Empty;
purchaseLabel.SupplierBatch = string.Empty;
return purchaseLabel;
}

2
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/BackFluConverter.cs

@ -50,7 +50,7 @@ public class BackFluConverter : IIncomingConverter
var incomingToWmsDataList = await BuildIncomingToWmsOfPurchaseOrderAsync(incomingFromExternalList).ConfigureAwait(false);
await _incomingToWmsManager.CreateManyAsync(incomingToWmsDataList).ConfigureAwait(false);
//归档
await _incomingFromExternalManager.ArchiveBulkAsync(incomingFromExternalList).ConfigureAwait(false);
await _incomingFromExternalManager.ArchiveManyAsync(incomingFromExternalList).ConfigureAwait(false);
}

2
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs

@ -150,7 +150,7 @@ public static class IncomingToWmsExtensions
{
var inventoryLabel = JsonSerializer.Deserialize<InventoryLabelEditInput>(incomingConverted.DataContent);
var inventoryLabelAppService = workerContext.ServiceProvider.GetRequiredService<IInventoryLabelAppService>();
await inventoryLabelAppService.CreateAsync(inventoryLabel).ConfigureAwait(false);
await inventoryLabelAppService.CreateManyByNoCodeAsync(new List<InventoryLabelEditInput> { inventoryLabel }).ConfigureAwait(false);
}
public static async Task HandleBackFlushsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{

58
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs

@ -8,7 +8,6 @@ using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.Domain.Repositories;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Application.Contracts;
@ -22,7 +21,6 @@ namespace Win_in.Sfs.Wms.Store.Application;
/// </summary>
[Authorize]
[Route($"{StoreConsts.RootPath}count-note")]
public class CountNoteAppService :
SfsStoreWithDetailsAppServiceBase<CountNote,
CountNoteDTO,
@ -41,7 +39,6 @@ public class CountNoteAppService :
public CountNoteAppService(
ICountNoteRepository repository,
ICountNoteManager countNoteManager,
ICountPlanAppService countPlanAppService,
ILocationAppService locationAppService,
@ -60,7 +57,8 @@ public class CountNoteAppService :
/// </summary>
/// <param name="dictionary"></param>
/// <returns></returns>
protected override async Task<Dictionary<CountNote, EntityState>> ImportProcessingEntityAsync(Dictionary<CountNote, EntityState> dictionary)
protected override async Task<Dictionary<CountNote, EntityState>> ImportProcessingEntityAsync(
Dictionary<CountNote, EntityState> dictionary)
{
var dataList = dictionary.Select(p => p.Key); //查询所有的导入盘点数据
var resultDictionary = new Dictionary<CountNote, EntityState>();
@ -70,10 +68,8 @@ public class CountNoteAppService :
foreach (var countPlanNumber in allCountPlanNumbersList)
{
var countPlanDto = await _countPlanAppService.GetByNumberAsync(countPlanNumber).ConfigureAwait(false);
if (countPlanDto.RequestType != CountPlanRequestType.Import)
{
throw new UserFriendlyException("非Excel盘点执行方式不能使用导入");
}
CheckCountPlanNumber(countPlanDto, countPlanNumber);
CheckCountPlanRequestType(countPlanDto);
await _repository.DeleteAsync(p => p.CountPlanNumber == countPlanNumber).ConfigureAwait(false);
}
@ -91,6 +87,8 @@ public class CountNoteAppService :
var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false);
var itemcBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
CheckLocation(locationDto, detail);
CheckItemBasic(itemcBasicDto, detail);
detail.CountLabel = Guid.NewGuid().ToString();
detail.LocationArea = locationDto.AreaCode;
@ -111,6 +109,42 @@ public class CountNoteAppService :
return resultDictionary;
}
#region 校验
private static void CheckItemBasic(ItemBasicDTO itemcBasicDto, CountNoteDetail detail)
{
if (itemcBasicDto == null)
{
throw new UserFriendlyException($"物品代码为【{detail.LocationCode}】不存在");
}
}
private static void CheckLocation(LocationDTO locationDto, CountNoteDetail detail)
{
if (locationDto == null)
{
throw new UserFriendlyException($"库位代码为【{detail.LocationCode}】不存在");
}
}
private static void CheckCountPlanRequestType(CountPlanDTO countPlanDto)
{
if (countPlanDto.RequestType != CountPlanRequestType.Import)
{
throw new UserFriendlyException("非Excel盘点执行方式不能使用导入");
}
}
private static void CheckCountPlanNumber(CountPlanDTO countPlanDto, string countPlanNumber)
{
if (countPlanDto == null)
{
throw new UserFriendlyException($"盘点计划单号为【{countPlanNumber}】不存在");
}
}
#endregion
#endregion
/// <summary>
@ -150,11 +184,13 @@ public class CountNoteAppService :
protected override async Task<CountNote> GetEntityAsync(CountNoteImportInput importInput)
{
var countNote = await _repository.FirstOrDefaultAsync(t => t.CountPlanNumber == importInput.CountPlanNumber).ConfigureAwait(false);
var countNote = await _repository.FirstOrDefaultAsync(t => t.CountPlanNumber == importInput.CountPlanNumber)
.ConfigureAwait(false);
if (countNote != null) //特殊处理 因为盘点记录可以重复导入 所以每次导入前删除调原有记录
{
var countplan = await _countPlanAppService.GetByNumberAsync(countNote.CountPlanNumber).ConfigureAwait(false);
var countplan = await _countPlanAppService.GetByNumberAsync(countNote.CountPlanNumber)
.ConfigureAwait(false);
if (countplan != null)
{
@ -178,7 +214,7 @@ public class CountNoteAppService :
{
var groups = entites.Select(p => p.CountPlanNumber).GroupBy(p => p);
if (entites.Any(p => p.Adjusted == true))
if (entites.Any(p => p.Adjusted))
{
throw new UserFriendlyException("库存已调整,不能导入");
}

52
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs

@ -86,6 +86,8 @@ public class DeliverRequestFisAppService :
foreach (var detail in itemTransformRequest.Details)
{
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
CheckItemBasic(itemBasicDto, detail.ItemCode);
var transactionType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.Deliver,
EnumTransSubType.Deliver_FIS)
.ConfigureAwait(false);
@ -100,8 +102,28 @@ public class DeliverRequestFisAppService :
Statuses = transactionType.OutInventoryStatuses
}).ConfigureAwait(false);
CheckBalances(balances, transactionType, itemBasicDto, detail);
var balanceSumQty = balances.Sum(t => t.Qty);
CheckBalancesSumQty(balanceSumQty, detail, transactionType);
detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2 = itemBasicDto.Desc2;
detail.ItemName = itemBasicDto.Name;
detail.Uom = itemBasicDto.BasicUom;
detail.StdPackQty=itemBasicDto.StdPackQty;
}
}
return dictionary;
}
#region 校验
private static void CheckBalancesSumQty(decimal balanceSumQty, DeliverRequestDetail detail,
TransactionTypeDTO transactionType)
{
if (balanceSumQty < detail.Qty)
{
throw new UserFriendlyException($"物料号 {detail.ItemCode} " +
@ -110,17 +132,35 @@ public class DeliverRequestFisAppService :
$"状态 {transactionType.OutInventoryStatuses.JoinAsString(",")}" +
$"库存余额 {balanceSumQty} 小于 {detail.Qty}。");
}
}
detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2 = itemBasicDto.Desc2;
detail.ItemName = itemBasicDto.Name;
detail.Uom = itemBasicDto.BasicUom;
detail.StdPackQty=itemBasicDto.StdPackQty;
private static void CheckBalances(List<BalanceDTO> balances, TransactionTypeDTO transactionType, ItemBasicDTO itemBasicDto,
DeliverRequestDetail detail)
{
if (balances == null)
{
var sbLocationTypes = string.Empty;
transactionType.OutLocationTypes.ForEach(p => sbLocationTypes += " " + p.GetDisplayName() + " ");
var sbStatuses = string.Empty;
transactionType.OutInventoryStatuses.ForEach(p => sbLocationTypes += " " + p.GetDisplayName() + " ");
throw new UserFriendlyException(
$"没有物品代码为【{itemBasicDto.Code}】," +
$"数量为【{detail.Qty}】," +
$"出库库位类型为【{sbLocationTypes}】," +
$"区域为【{detail.AreaCode}】," +
$"出库可用状态为【{sbStatuses}】的可用的库存。");
}
}
return dictionary;
private static void CheckItemBasic(ItemBasicDTO itemcBasicDto, string itemCode)
{
if (itemcBasicDto == null)
{
throw new UserFriendlyException($"物品代码为【{itemCode}】不存在");
}
}
#endregion
#endregion

121
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ItemTransformRequests/ItemTransformRequestAppService.cs

@ -3,11 +3,11 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Label.Application.Contracts;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
@ -25,7 +25,9 @@ namespace Win_in.Sfs.Wms.Store.Application;
[Authorize]
[Route($"{StoreConsts.RootPath}item-transform-request")]
public class ItemTransformRequestAppService :
SfsStoreRequestAppServiceBase<ItemTransformRequest, ItemTransformRequestDTO, SfsStoreRequestInputBase, ItemTransformRequestEditInput, ItemTransformRequestDetail, ItemTransformRequestDetailDTO, SfsStoreRequestInputBase, ItemTransformRequestImportInput>,
SfsStoreRequestAppServiceBase<ItemTransformRequest, ItemTransformRequestDTO, SfsStoreRequestInputBase,
ItemTransformRequestEditInput, ItemTransformRequestDetail, ItemTransformRequestDetailDTO,
SfsStoreRequestInputBase, ItemTransformRequestImportInput>,
IItemTransformRequestAppService
{
private const EnumTransSubType SubType = EnumTransSubType.Item_Transform;
@ -45,25 +47,12 @@ public class ItemTransformRequestAppService :
_balanceAppService = balanceAppService;
}
/// <summary>
/// 新增方法
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("")]
public override async Task<ItemTransformRequestDTO> CreateAsync(ItemTransformRequestEditInput input)
{
var entity = ObjectMapper.Map<ItemTransformRequestEditInput, ItemTransformRequest>(input);
await _manager.CreateAsync(entity).ConfigureAwait(false);
#region 东阳
var dto = ObjectMapper.Map<ItemTransformRequest, ItemTransformRequestDTO>(entity);
return dto;
}
protected override async Task<Dictionary<ItemTransformRequest, EntityState>> ImportProcessingEntityAsync(Dictionary<ItemTransformRequest, EntityState> dictionary)
protected override async Task<Dictionary<ItemTransformRequest, EntityState>> ImportProcessingEntityAsync(
Dictionary<ItemTransformRequest, EntityState> dictionary)
{
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key);
@ -73,13 +62,27 @@ public class ItemTransformRequestAppService :
itemTransformRequest.CreatorId = CurrentUser.Id;
foreach (var detail in itemTransformRequest.Details)
{
var fromLocationDto= await LocationAclService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false);
var toLocationDto= await LocationAclService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
var fromLocationDto =
await LocationAclService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false);
CheckLocation(fromLocationDto, detail.FromLocationCode);
var toLocationDto =
await LocationAclService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
CheckLocation(toLocationDto, detail.ToLocationCode);
var fromItemBasicDto = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
CheckItemBasic(fromItemBasicDto, detail.ItemCode);
var toItemBasicDto = await ItemBasicAclService.GetByCodeAsync(detail.ToItemCode).ConfigureAwait(false);
var balanceDto= await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode, detail.ItemCode,
CheckItemBasic(toItemBasicDto, detail.ToItemCode);
var balanceDto = await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode,
detail.ItemCode,
detail.FromLocationCode).ConfigureAwait(false);
var inventoryLabelDto= await _inventoryLabelAppService.GetByCodeAsync(detail.ToPackingCode).ConfigureAwait(false);
var inventoryLabelDto = await _inventoryLabelAppService.GetByCodeAsync(detail.ToPackingCode)
.ConfigureAwait(false);
CheckLabel(inventoryLabelDto, detail);
detail.FromLocationArea = fromLocationDto.AreaCode;
detail.FromLocationErpCode = fromLocationDto.ErpLocationCode;
@ -112,11 +115,58 @@ public class ItemTransformRequestAppService :
}
return dictionary;
}
#region 校验
private void CheckLabel(InventoryLabelDto inventoryLabelDto, ItemTransformRequestDetail detail)
{
if (inventoryLabelDto == null)
{
throw new UserFriendlyException($"标签箱码为【{detail.ToPackingCode}】不存在");
}
}
protected virtual async Task ImportDataAsync(List<ItemTransformRequest> entites, List<ItemTransformRequest> deleteEntities)
private void CheckItemBasic(ItemBasicDTO ItemBasicDto, string itemCode)
{
if (ItemBasicDto == null)
{
throw new UserFriendlyException($"物品代码为【{itemCode}】不存在");
}
}
private void CheckLocation(LocationDTO LocationDto, string LocationCode)
{
if (LocationDto == null)
{
throw new UserFriendlyException($"库位代码为【{LocationCode}】不存在");
}
}
#endregion
#endregion
/// <summary>
/// 新增方法
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("")]
public override async Task<ItemTransformRequestDTO> CreateAsync(ItemTransformRequestEditInput input)
{
var entity = ObjectMapper.Map<ItemTransformRequestEditInput, ItemTransformRequest>(input);
await _manager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<ItemTransformRequest, ItemTransformRequestDTO>(entity);
return dto;
}
protected virtual async Task ImportDataAsync(List<ItemTransformRequest> entites,
List<ItemTransformRequest> deleteEntities)
{
await _manager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false);
}
@ -126,7 +176,9 @@ public class ItemTransformRequestAppService :
return t => t.Worker;
}
protected virtual async Task<(List<ItemTransformRequest> entites, List<ItemTransformRequest> deleteEntities)> BuildImportDataAsync(ImportResult<ItemTransformRequestImportInput> importResult, EnumImportMethod importMethod = EnumImportMethod.Update, bool isAllowPartImport = false)
protected virtual async Task<(List<ItemTransformRequest> entites, List<ItemTransformRequest> deleteEntities)>
BuildImportDataAsync(ImportResult<ItemTransformRequestImportInput> importResult,
EnumImportMethod importMethod = EnumImportMethod.Update, bool isAllowPartImport = false)
{
if (importResult.Data.Any(t => t.ReportStatus == EnumImportReportStatus.Failed))
{
@ -167,18 +219,21 @@ public class ItemTransformRequestAppService :
{
entity.SetId(exist.Id);
}
break;
case EnumImportMethod.Replace:
if (exist != null)
{
deleteEntites.Add(exist);
}
break;
}
foreach (var inputDetail in inputDetails)
{
var detail = ObjectMapper.Map<ItemTransformRequestImportInput, ItemTransformRequestDetail>(inputDetail);
var detail =
ObjectMapper.Map<ItemTransformRequestImportInput, ItemTransformRequestDetail>(inputDetail);
await SetDetailPropertiesAsync(detail, input).ConfigureAwait(false);
entity.AddDetail(detail);
@ -191,7 +246,8 @@ public class ItemTransformRequestAppService :
return (entites, deleteEntites);
}
private async Task SetDetailPropertiesAsync(ItemTransformRequestDetail detail, ItemTransformRequestImportInput input)
private async Task SetDetailPropertiesAsync(ItemTransformRequestDetail detail,
ItemTransformRequestImportInput input)
{
var balanceDTO = await BalanceAclService.GetByPackingCodeAsync(detail.FromPackingCode).ConfigureAwait(false);
var toItemBasicDTO = await ItemBasicAclService.GetByCodeAsync(detail.ToItemCode).ConfigureAwait(false);
@ -223,7 +279,8 @@ public class ItemTransformRequestAppService :
private async Task SetEntityPropertiesAsync(ItemTransformRequest entity, ItemTransformRequestImportInput input)
{
var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Adjust, SubType).ConfigureAwait(false);
var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Adjust, SubType)
.ConfigureAwait(false);
Check.NotNull(tranType, "事务类型", "事务类型不存在");
@ -234,7 +291,8 @@ public class ItemTransformRequestAppService :
entity.DirectCreateNote = tranType.DirectCreateNote;
}
protected virtual async Task CheckImportInputBusinessAsync(ItemTransformRequestImportInput importInput, EnumImportMethod importMethod, List<ValidationResult> validationRresult)
protected virtual async Task CheckImportInputBusinessAsync(ItemTransformRequestImportInput importInput,
EnumImportMethod importMethod, List<ValidationResult> validationRresult)
{
//await base.CheckImportInputBusinessAsync(importInput, importMethod);
@ -298,15 +356,16 @@ public class ItemTransformRequestAppService :
var label = await _inventoryLabelAppService.GetByCodeAsync(packingCode).ConfigureAwait(false);
if (label != null)
{
var inventory = await BalanceAclService.GetListByPackingCodesAsync(new List<string> { packingCode }).ConfigureAwait(false);
var inventory = await BalanceAclService.GetListByPackingCodesAsync(new List<string> { packingCode })
.ConfigureAwait(false);
if (inventory.Count > 0)
{
validationRresult.Add("库存余额已存在", $"库存余额已存在,请重新打印标签并导入。");
validationRresult.Add("库存余额已存在", "库存余额已存在,请重新打印标签并导入。");
}
}
else
{
validationRresult.Add("标签不存在", $"标签不存在,请重新打印标签并导入。");
validationRresult.Add("标签不存在", "标签不存在,请重新打印标签并导入。");
}
}
}

24
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs

@ -86,7 +86,10 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
foreach (var detail in materialRequest.Details)
{
var locationDto= await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
CheckLocation(locationDto,detail.ToLocationCode);
var itemBasicDto=await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
CheckItemBasic(itemBasicDto,detail.ItemCode);
detail.ToLocationArea = locationDto.AreaCode;
detail.ToLocationErpCode = locationDto.ErpLocationCode;
@ -109,6 +112,27 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
return ObjectMapper.Map<MaterialRequest, MaterialRequestDTO>(entity);
}
#region 校验
private void CheckItemBasic(ItemBasicDTO ItemBasicDto, string itemCode)
{
if (ItemBasicDto == null)
{
throw new UserFriendlyException($"物品代码为【{itemCode}】不存在");
}
}
private void CheckLocation(LocationDTO LocationDto, string LocationCode)
{
if (LocationDto == null)
{
throw new UserFriendlyException($"库位代码为【{LocationCode}】不存在");
}
}
#endregion
#endregion
[HttpPost("")]

85
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs

@ -38,19 +38,22 @@ public class PurchaseReturnRequestAppService :
private readonly ITransactionTypeAppService _transactionTypeAppService;
private readonly IPurchaseReturnRequestManager _purchaseReturnRequestManager;
private readonly IPurchaseOrderAppService _purchaseOrderAppService;
private readonly IBalanceAppService _balanceAppService;
public PurchaseReturnRequestAppService(
IPurchaseReturnRequestRepository repository,
IPurchaseReturnRequestManager purchaseReturnRequestManager,
IInventoryLabelAppService inventoryLabelApp,
ILocationAppService locationAppService,
ITransactionTypeAppService transactionTypeAppService,
IPurchaseOrderAppService purchaseOrderAppService) : base(repository, purchaseReturnRequestManager)
IPurchaseOrderAppService purchaseOrderAppService,
IBalanceAppService balanceAppService) : base(repository, purchaseReturnRequestManager)
{
_purchaseReturnRequestManager = purchaseReturnRequestManager;
_inventoryLabelApp = inventoryLabelApp;
_locationAppService = locationAppService;
_transactionTypeAppService = transactionTypeAppService;
_purchaseOrderAppService = purchaseOrderAppService;
_balanceAppService = balanceAppService;
base.CreatePolicyName = PurchaseReturnRequestPermissions.Create;
base.UpdatePolicyName = PurchaseReturnRequestPermissions.Update;
@ -97,10 +100,17 @@ public class PurchaseReturnRequestAppService :
{
//通过箱标签 查找标签服务 构造其他字段
var labelDto = await _inventoryLabelApp.GetByCodeAsync(detail.PackingCode).ConfigureAwait(false);
var balanceDto = await BalanceAclService.GetByPackingCodeAsync(detail.PackingCode).ConfigureAwait(false);
CheckLabel(labelDto, detail);
var balanceDto = await _balanceAppService.GetByPackingCodeAsync(detail.PackingCode).ConfigureAwait(false);
CheckBalance(balanceDto, detail);
var locationDto= await _locationAppService.GetByCodeAsync(balanceDto.LocationCode).ConfigureAwait(false);
CheckLocation(locationDto, balanceDto);
var purchaseOrderDto = await _purchaseOrderAppService.GetByNumberAsync(labelDto.PoNumber).ConfigureAwait(false);
purchaseOrderDto = await _purchaseOrderAppService.GetAsync(purchaseOrderDto.Id).ConfigureAwait(false);
CheckPurchaseOrder(purchaseOrderDto, labelDto);
purchaseReturnRequest.AsnNumber = labelDto.AsnNumber;
purchaseReturnRequest.RpNumber = labelDto.RpNumber;
@ -182,11 +192,78 @@ public class PurchaseReturnRequestAppService :
if (purchaseOrderDto != null)
{
detail.PoLine =
purchaseOrderDto.Details.FirstOrDefault(p => p.ItemCode == balanceDto.ItemCode && p.Lot == balanceDto.Lot).PoLine;
var purchaseOrderDetailDto=purchaseOrderDto.Details.FirstOrDefault(p => p.ItemCode == balanceDto.ItemCode && p.Lot == balanceDto.Lot);
if (purchaseOrderDetailDto == null)
{
purchaseOrderDetailDto =
purchaseOrderDto.Details.FirstOrDefault(p => p.ItemCode == balanceDto.ItemCode);
}
if (purchaseOrderDetailDto == null)
{
throw new UserFriendlyException($"未找到物品代码为【{balanceDto.ItemCode}】,批次为【{balanceDto.Lot}】的订单详情");
}
detail.PoLine = purchaseOrderDetailDto.PoLine;
}
}
#region 校验
private void CheckPurchaseOrder(PurchaseOrderDTO purchaseOrderDto, InventoryLabelDto labelDto)
{
if (purchaseOrderDto == null)
{
throw new UserFriendlyException($"采购订单编号为【{labelDto.PoNumber}】不存在");
}
}
/// <summary>
/// 校验库位
/// </summary>
/// <param name="locationDto"></param>
/// <param name="balanceDto"></param>
/// <exception cref="UserFriendlyException"></exception>
private void CheckLocation(LocationDTO locationDto, BalanceDTO balanceDto)
{
if (locationDto == null)
{
throw new UserFriendlyException($"库位为【{balanceDto.LocationCode}】不存在");
}
}
/// <summary>
/// 校验库存
/// </summary>
/// <param name="balanceDto"></param>
/// <param name="detail"></param>
/// <exception cref="UserFriendlyException"></exception>
private void CheckBalance(BalanceDTO balanceDto, PurchaseReturnRequestDetail detail)
{
if (balanceDto == null)
{
throw new UserFriendlyException($"箱码为【{detail.PackingCode}】不存在");
}
}
/// <summary>
/// 校验标签
/// </summary>
/// <param name="labelDto"></param>
/// <param name="detail"></param>
/// <exception cref="UserFriendlyException"></exception>
private void CheckLabel(InventoryLabelDto labelDto, PurchaseReturnRequestDetail detail)
{
if (labelDto == null)
{
throw new UserFriendlyException($"标签为【{detail.PackingCode}】不存在");
}
}
#endregion
#endregion
#region 校验

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/SupplierAsns/SupplierAsnManager.cs

@ -1,7 +1,12 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Data;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Label.Application.Contracts;
using Win_in.Sfs.Label.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Domain;
@ -14,10 +19,14 @@ public class SupplierAsnManager : SfsStoreManagerBase<SupplierAsn, SupplierAsnDe
{
_repository = repository;
}
#region 东阳使用
#endregion
[UnitOfWork]
public override async Task<SupplierAsn> CreateAsync(SupplierAsn entity)
{
if (!string.IsNullOrWhiteSpace(entity.Number))//考虑 接口过来的数据是有Number的
if (!string.IsNullOrWhiteSpace(entity.Number))//接口过来的数据是有Number的
{
entity.SetIdAndNumberWithDetails(GuidGenerator, entity.Number);
entity = await Repository.InsertAsync(entity).ConfigureAwait(false);
@ -86,7 +95,6 @@ public class SupplierAsnManager : SfsStoreManagerBase<SupplierAsn, SupplierAsnDe
// await PublishSupplierAsnAsync(entity);
//}
}
private async Task SetDetailAsync(List<SupplierAsnDetail> details)
{
foreach (var detail in details)

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/MaterialRequestManager.cs

@ -85,7 +85,7 @@ public class MaterialRequestManager
var issueJobs = await _issueJobRepository.GetListAsync(t => t.MaterialRequestNumber == materialRequest.Number).ConfigureAwait(false);
if (issueJobs.Count > 0)
{
if (issueJobs.All(t => t.JobStatus == EnumJobStatus.Done || t.JobStatus == EnumJobStatus.Closed || t.JobStatus == EnumJobStatus.Cancelled))
if (issueJobs.All(t => t.JobStatus is EnumJobStatus.Done or EnumJobStatus.Closed or EnumJobStatus.Cancelled))
{
if (materialRequest.Details.All(p => p.ReceivedQty >= p.Qty))
{

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs

@ -267,15 +267,18 @@ public class PurchaseOrderEventHandler
SupplierItemDTO supplierItemDto)
{
if (itemBasicDto == null)
{
throw new UserFriendlyException($"【{itemBasicDto.Code}】物品不存在");
}
if (supplierDto == null)
{
throw new UserFriendlyException($"{supplierAsn.SupplierCode}供应商为空");
throw new UserFriendlyException($"{supplierAsn.SupplierCode}供应商为空");
}
if (supplierItemDto == null)
{
throw new UserFriendlyException($"{supplierAsn.SupplierCode}供应商零件或{itemBasicDto.Code}零件信息为空");
throw new UserFriendlyException($"{supplierAsn.SupplierCode}供应商零件或{itemBasicDto.Code}零件信息为空");
}
var inputLabel = new InventoryLabelEditInput();

23
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ProductReceiptNoteEventHandler.cs

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
@ -76,15 +77,27 @@ public class ProductReceiptNoteEventHandler
var transaction = ObjectMapper.Map<ProductReceiptNoteDetail, TransactionEditInput>(detail);
var itemBasicDto= await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
;
var locationDtos = await _locationAppService.GetListByTypesAndErpCodeAsync(
new List<EnumLocationType> { EnumLocationType.WIP },
detail.LocationErpCode).ConfigureAwait(false);
if (locationDtos == null)
{
throw new UserFriendlyException(
$"Erp储位为【{detail.LocationErpCode}】,库位类型为{EnumLocationType.WIP.GetDisplayName()}的库位不存在。");
}
if (itemBasicDto == null)
{
throw new UserFriendlyException(
$"物品编号为【{detail.ItemCode}】不存在。");
}
detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2 = itemBasicDto.Desc2;
detail.ItemName=itemBasicDto.Name;
detail.StdPackQty=itemBasicDto.StdPackQty;
var erpLocationDtos= await _locationAppService.GetListByTypesAndErpCodeAsync(new List<EnumLocationType> { EnumLocationType.WIP },
detail.LocationErpCode).ConfigureAwait(false);
var erpLocationDto = erpLocationDtos.First();
var erpLocationDto = locationDtos.First();
detail.LocationArea = erpLocationDto.Code;
detail.LocationGroup = erpLocationDto.LocationGroupCode;
detail.LocationErpCode= erpLocationDto.Code;

Loading…
Cancel
Save