Browse Source

Merge branch 'dev_DY_CC' of http://dev.ccwin-in.com:3000/BoXu.Zheng/WZC2 into dev_DY_CC

dev_DY_CC
赵新宇 1 year ago
parent
commit
1a82c87af6
  1. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs
  2. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs
  3. 14
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/DeliverNotes/DeliverNoteAppService.cs
  4. 49
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryInitialNotes/InventoryInitialNoteAppService.cs
  5. 23
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs
  6. 8
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs
  7. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/AssembleIssueRequests/AssembleIssueRequestManager.cs
  8. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/CoatingIssuelRequests/CoatingIssueRequestManager.cs
  9. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/InjectionIssueRequests/InjectionIssueRequestManager.cs
  10. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/SparePartIssueRequests/SparePartIssueRequestManager.cs
  11. 105
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleIssueNoteAutoMapperProfile.cs
  12. 51
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleNoteAutoMapperProfile.cs
  13. 65
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs
  14. 14
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/TransferLibJobEventHandler.cs
  15. 34
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs
  16. 25
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferLibRequestEventHandler.cs

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@ -35,4 +36,5 @@ public interface IDeliverNoteAppService :
Task<IActionResult> ExportForRAWAsync(SfsExportRequestInput requestInput); Task<IActionResult> ExportForRAWAsync(SfsExportRequestInput requestInput);
Task SumPrintAsync(string number); Task SumPrintAsync(string number);
Task<List<DeliverNoteDTO>> CreateManyAsync(List<DeliverNoteEditInput> inputs);
} }

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs

@ -219,6 +219,11 @@ public class TransferLibJobAppService
var balanceDto=await _balanceAppService.GetByPackingCodeAsync(detail.HandledToPackingCode).ConfigureAwait(false); var balanceDto=await _balanceAppService.GetByPackingCodeAsync(detail.HandledToPackingCode).ConfigureAwait(false);
if (balanceDto == null)
{
throw new UserFriendlyException($"箱码{detail.HandledToPackingCode}没有找到库存");
}
var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.HandledFromLocationCode) var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.HandledFromLocationCode)
.ConfigureAwait(false); .ConfigureAwait(false);
var toLocationDto = var toLocationDto =

14
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/DeliverNotes/DeliverNoteAppService.cs

@ -13,6 +13,7 @@ using Win_in.Sfs.Wms.Store.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application; namespace Win_in.Sfs.Wms.Store.Application;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain;
@ -50,7 +51,20 @@ public class DeliverNoteAppService :
var dto = ObjectMapper.Map<DeliverNote, DeliverNoteDTO>(entity); var dto = ObjectMapper.Map<DeliverNote, DeliverNoteDTO>(entity);
return dto; return dto;
} }
/// <summary>
/// 新增接口
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("create-many")]
public async Task<List<DeliverNoteDTO>> CreateManyAsync(List<DeliverNoteEditInput> inputs)
{
var entitys = ObjectMapper.Map<List<DeliverNoteEditInput>, List<DeliverNote>>(inputs);
await _deliverNoteManager.CreateManyAsync(entitys).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<DeliverNote>, List<DeliverNoteDTO>>(entitys);
return dtos;
}
/// <summary> /// <summary>
/// 新增接口 /// 新增接口
/// </summary> /// </summary>

49
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryInitialNotes/InventoryInitialNoteAppService.cs

@ -13,10 +13,15 @@ namespace Win_in.Sfs.Wms.Store.Application;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
using System.Linq;
using Volo.Abp;
using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Basedata.Application.Contracts;
/// <summary> /// <summary>
/// 计划外入库记录 /// 库存初始化记录
/// </summary> /// </summary>
[Authorize] [Authorize]
[Route($"{StoreConsts.RootPath}inventory-initial-note")] [Route($"{StoreConsts.RootPath}inventory-initial-note")]
@ -26,15 +31,54 @@ public class InventoryInitialNoteAppService :
{ {
private readonly IInventoryInitialNoteManager _inventoryInitialNoteManager; private readonly IInventoryInitialNoteManager _inventoryInitialNoteManager;
private readonly IInventoryLabelAppService _inventoryLabelService; private readonly IInventoryLabelAppService _inventoryLabelService;
private readonly IItemBasicAppService _itemBasicAppService;
public InventoryInitialNoteAppService( public InventoryInitialNoteAppService(
IInventoryInitialNoteRepository repository IInventoryInitialNoteRepository repository
, IInventoryInitialNoteManager inventoryInitialNoteManager , IInventoryInitialNoteManager inventoryInitialNoteManager
, IInventoryLabelAppService inventoryLabelService , IInventoryLabelAppService inventoryLabelService,
IItemBasicAppService itemBasicAppService
) : base(repository) ) : base(repository)
{ {
_inventoryInitialNoteManager = inventoryInitialNoteManager; _inventoryInitialNoteManager = inventoryInitialNoteManager;
_inventoryLabelService = inventoryLabelService; _inventoryLabelService = inventoryLabelService;
_itemBasicAppService = itemBasicAppService;
}
/// <summary>
/// 数据加工
/// </summary>
/// <param name="dictionary"></param>
/// <returns></returns>
protected override async Task<Dictionary<InventoryInitialNote, EntityState>> ImportProcessingEntityAsync(Dictionary<InventoryInitialNote, EntityState> dictionary)
{
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key);
foreach (var request in addList)
{
request.Worker = CurrentUser.GetUserName();
request.CreatorId = CurrentUser.Id;
request.Remark = "库存初始化";
request.ActiveDate = DateTime.Now;
foreach (var detail in request.Details)
{
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
CheckItemBasic(itemBasicDto, detail.ItemCode);
detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2 = itemBasicDto.Desc2;
detail.ItemName = itemBasicDto.Name;
detail.Uom = itemBasicDto.BasicUom;
detail.StdPackQty = itemBasicDto.StdPackQty;
}
}
return dictionary;
}
private static void CheckItemBasic(ItemBasicDTO itemcBasicDto, string itemCode)
{
if (itemcBasicDto == null)
{
throw new UserFriendlyException($"ERP料号为【{itemCode}】不存在");
}
} }
[HttpPost("")] [HttpPost("")]
@ -49,6 +93,7 @@ public class InventoryInitialNoteAppService :
return dto; return dto;
} }
protected virtual async Task ImportDataAsync(List<InventoryInitialNote> entites, List<InventoryInitialNote> deleteEntities) protected virtual async Task ImportDataAsync(List<InventoryInitialNote> entites, List<InventoryInitialNote> deleteEntities)
{ {
await _inventoryInitialNoteManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); await _inventoryInitialNoteManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false);

23
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs

@ -32,6 +32,7 @@ public class PurchaseOrderAppService :
private readonly IItemBasicAppService _itemBasicAppService; private readonly IItemBasicAppService _itemBasicAppService;
private readonly ILocationAppService _locationAppService; private readonly ILocationAppService _locationAppService;
public readonly IPurchasePriceSheetAppService _purchasePriceSheetAppService; public readonly IPurchasePriceSheetAppService _purchasePriceSheetAppService;
public readonly ISupplierItemAppService _supplierItemAppService;
public PurchaseOrderAppService( public PurchaseOrderAppService(
IPurchaseOrderRepository repository, IPurchaseOrderRepository repository,
@ -39,7 +40,8 @@ public class PurchaseOrderAppService :
ISupplierAppService supplierAppService, ISupplierAppService supplierAppService,
IItemBasicAppService itemBasicAppService IItemBasicAppService itemBasicAppService
, ILocationAppService locationAppService, , ILocationAppService locationAppService,
IPurchasePriceSheetAppService purchasePriceSheetAppService) : base(repository) IPurchasePriceSheetAppService purchasePriceSheetAppService,
ISupplierItemAppService supplierItemAppService) : base(repository)
{ {
_repository = repository; _repository = repository;
_purchaseOrderManager = purchaseOrderManager; _purchaseOrderManager = purchaseOrderManager;
@ -50,6 +52,7 @@ IPurchasePriceSheetAppService purchasePriceSheetAppService) : base(repository)
base.UpdatePolicyName = PurchaseOrderPermissions.Update; base.UpdatePolicyName = PurchaseOrderPermissions.Update;
base.DeletePolicyName = PurchaseOrderPermissions.Delete; base.DeletePolicyName = PurchaseOrderPermissions.Delete;
_purchasePriceSheetAppService = purchasePriceSheetAppService; _purchasePriceSheetAppService = purchasePriceSheetAppService;
_supplierItemAppService = supplierItemAppService;
} }
#region 东阳使用 #region 东阳使用
@ -126,8 +129,20 @@ IPurchasePriceSheetAppService purchasePriceSheetAppService) : base(repository)
return dictionary; return dictionary;
} }
/// <summary>
/// 检验重写
/// </summary>
/// <param name="model"></param>
/// <param name="validationRresult"></param>
/// <returns></returns>
protected override async Task ValidateImportModelAsync(PurchaseOrderImportInput model, List<ValidationResult> validationRresult)
{
var item = await _supplierItemAppService.GetBySupplierCodeAndItemCodeAsync(model.SupplierCode,model.ItemCode).ConfigureAwait(false);
if (item == null)
{
validationRresult.Add(new ValidationResult($"供应商代码【{model.SupplierCode}】与明细-ERP料号【{model.ItemCode}】对应关系不存在"));
}
}
/// <summary> /// <summary>
/// 【创建】采购订单 /// 【创建】采购订单
@ -232,7 +247,7 @@ IPurchasePriceSheetAppService purchasePriceSheetAppService) : base(repository)
var isprice = await _purchasePriceSheetAppService.CheckPurPriceAsync(supplierCode, itemCode).ConfigureAwait(false); var isprice = await _purchasePriceSheetAppService.CheckPurPriceAsync(supplierCode, itemCode).ConfigureAwait(false);
if (isprice) if (isprice)
{ {
throw new UserFriendlyException($"供应商【{supplierCode}】物品名称【{itemCode}】无采购价格无法执行采购上架!"); throw new UserFriendlyException($"供应商【{supplierCode}】物品名称【{itemCode}】无采购价格无法导入采购订单!");
} }
} }
private async Task<List<LocationDTO>> CheckErpLocationCodeAsync(List<string> erpLocationCodes) private async Task<List<LocationDTO>> CheckErpLocationCodeAsync(List<string> erpLocationCodes)

8
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs

@ -163,10 +163,10 @@ IItemBasicAppService itemBasicAppService)
public virtual async Task<List<DeliverRequestDTO>> HandleListAsync(List<Guid> ids) public virtual async Task<List<DeliverRequestDTO>> HandleListAsync(List<Guid> ids)
{ {
var entitys = await _repository.GetListAsync(r=> ids.Contains(r.Id),true).ConfigureAwait(false); var entitys = await _repository.GetListAsync(r=> ids.Contains(r.Id),true).ConfigureAwait(false);
if (entitys.Select(r => r.CustomerCode).Distinct().Count()>1) //if (entitys.Select(r => r.CustomerCode).Distinct().Count()>1)
{ //{
throw new UserFriendlyException($"所选申请涉及多个客户不能创建为一个发货单,请重新选择!"); // throw new UserFriendlyException($"所选申请涉及多个客户不能创建为一个发货单,请重新选择!");
} //}
Check.NotNull(entitys, typeof(DeliverRequest).Name); Check.NotNull(entitys, typeof(DeliverRequest).Name);
var result = await _deliverRequestManager.HandleListAsync(entitys).ConfigureAwait(false); var result = await _deliverRequestManager.HandleListAsync(entitys).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<DeliverRequest>, List<DeliverRequestDTO>>(entitys); var dtos = ObjectMapper.Map<List<DeliverRequest>, List<DeliverRequestDTO>>(entitys);

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/AssembleIssueRequests/AssembleIssueRequestManager.cs

@ -36,7 +36,7 @@ public class AssembleIssueRequestManager
entity.Submit(); entity.Submit();
entity.Agree(); entity.Agree();
entity.RequestStatus = EnumRequestStatus.Partial; entity.RequestStatus = EnumRequestStatus.Partial;
await _repository.InsertAsync(entity).ConfigureAwait(false); await _repository.InsertAsync(entity,true).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<AssembleIssueRequest>(entity), false) await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<AssembleIssueRequest>(entity), false)
.ConfigureAwait(false); .ConfigureAwait(false);

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/CoatingIssuelRequests/CoatingIssueRequestManager.cs

@ -33,7 +33,7 @@ public class CoatingIssueRequestManager
entity.Submit(); entity.Submit();
entity.Agree(); entity.Agree();
entity.RequestStatus = EnumRequestStatus.Partial; entity.RequestStatus = EnumRequestStatus.Partial;
await _repository.InsertAsync(entity).ConfigureAwait(false); await _repository.InsertAsync(entity, true).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<CoatingIssueRequest>(entity), false) await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<CoatingIssueRequest>(entity), false)
.ConfigureAwait(false); .ConfigureAwait(false);

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/InjectionIssueRequests/InjectionIssueRequestManager.cs

@ -33,7 +33,7 @@ public class InjectionIssueRequestManager
entity.Submit(); entity.Submit();
entity.Agree(); entity.Agree();
entity.RequestStatus = EnumRequestStatus.Partial; entity.RequestStatus = EnumRequestStatus.Partial;
await _repository.InsertAsync(entity).ConfigureAwait(false); await _repository.InsertAsync(entity, true).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<InjectionIssueRequest>(entity), false) await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<InjectionIssueRequest>(entity), false)
.ConfigureAwait(false); .ConfigureAwait(false);

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/SparePartIssueRequests/SparePartIssueRequestManager.cs

@ -33,7 +33,7 @@ public class SparePartIssueRequestManager
entity.Submit(); entity.Submit();
entity.Agree(); entity.Agree();
entity.RequestStatus = EnumRequestStatus.Partial; entity.RequestStatus = EnumRequestStatus.Partial;
await _repository.InsertAsync(entity).ConfigureAwait(false); await _repository.InsertAsync(entity, true).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<SparePartIssueRequest>(entity),false) await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<SparePartIssueRequest>(entity),false)
.ConfigureAwait(false); .ConfigureAwait(false);
return entity; return entity;

105
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleIssueNoteAutoMapperProfile.cs

@ -0,0 +1,105 @@
using AutoMapper;
using Microsoft.OpenApi.Extensions;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Event;
public partial class StoreEventAutoMapperProfile : Profile
{
private void AssembleIssueNoteAutoMapperProfile()
{
CreateMap<AssembleIssueNoteDetail, TransferLogEditInput>()
.Ignore(x => x.DocNumber)
.Ignore(x => x.JobNumber)
.Ignore(x => x.Worker)
.Ignore(x => x.TransType)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.TransSubType)
.ForMember(x => x.Qty, y => y.MapFrom(t => t.HandledToQty))
.ForMember(x => x.SupplierBatch, y => y.MapFrom(t => t.HandledFromSupplierBatch))
.ForMember(x => x.ArriveDate, y => y.MapFrom(t => t.HandledFromArriveDate))
.ForMember(x => x.ProduceDate, y => y.MapFrom(t => t.HandledFromProduceDate))
.ForMember(x => x.ExpireDate, y => y.MapFrom(t => t.HandledFromExpireDate))
.ForMember(x => x.FromPackingCode, y => y.MapFrom(t => t.HandledFromPackingCode))
.ForMember(x => x.FromContainerCode, y => y.MapFrom(t => t.HandledFromContainerCode))
.ForMember(x => x.FromLot, y => y.MapFrom(t => t.HandledFromLot))
.ForMember(x => x.FromStatus, y => y.MapFrom(t => t.Status))
.ForMember(x => x.FromLocationCode, y => y.MapFrom(t => t.HandledFromLocationCode))
.ForMember(x => x.FromLocationGroup, y => y.MapFrom(t => t.HandledFromLocationGroup))
.ForMember(x => x.FromLocationArea, y => y.MapFrom(t => t.HandledFromLocationArea))
.ForMember(x => x.FromLocationErpCode, y => y.MapFrom(t => t.HandledFromLocationErpCode))
.ForMember(x => x.FromWarehouseCode, y => y.MapFrom(t => t.HandledFromWarehouseCode))
.ForMember(x => x.ToLot, y => y.MapFrom(t => t.HandledToLot))
.ForMember(x => x.ToStatus, y => y.MapFrom(t => t.Status))
.ForMember(x => x.ToPackingCode, y => y.MapFrom(t => t.HandledToPackingCode))
.ForMember(x => x.ToContainerCode, y => y.MapFrom(t => t.HandledToContainerCode))
.ForMember(x => x.ToLocationCode, y => y.MapFrom(t => t.HandledToLocationCode))
.ForMember(x => x.ToLocationGroup, y => y.MapFrom(t => t.HandledToLocationGroup))
.ForMember(x => x.ToLocationArea, y => y.MapFrom(t => t.HandledToLocationArea))
.ForMember(x => x.ToLocationErpCode, y => y.MapFrom(t => t.HandledToLocationErpCode))
.ForMember(x => x.ToWarehouseCode, y => y.MapFrom(t => t.HandledToWarehouseCode))
;
CreateMap<AssembleIssueNote, IssueNoteDTO>()
.ForMember(x => x.RequestType, y => y.MapFrom(t => t.IssueRequestType.GetDisplayName()))
.Ignore(x => x.Workshop)
;
CreateMap<AssembleIssueNoteDetail, IssueNoteDetailDTO>()
.ForMember(x => x.IssueTime, y => y.MapFrom(t => t.CreationTime))
.ForMember(x => x.WorkStation, y => y.MapFrom(t => t.ProdLine))
.ForMember(x => x.RecommendQty, y => y.MapFrom(t => t.RecommendFromQty))
.ForMember(x => x.RecommendContainerCode, y => y.MapFrom(t => t.RecommendFromContainerCode))
.ForMember(x => x.RecommendPackingCode, y => y.MapFrom(t => t.RecommendFromPackingCode))
.ForMember(x => x.RecommendSupplierBatch, y => y.MapFrom(t => t.RecommendFromSupplierBatch))
.ForMember(x => x.RecommendArriveDate, y => y.MapFrom(t => t.RecommendFromArriveDate))
.ForMember(x => x.RecommendProduceDate, y => y.MapFrom(t => t.RecommendFromProduceDate))
.ForMember(x => x.RecommendExpireDate, y => y.MapFrom(t => t.RecommendFromExpireDate))
.ForMember(x => x.RecommendLot, y => y.MapFrom(t => t.RecommendFromLot))
.ForMember(x => x.HandledContainerCode, y => y.MapFrom(t => t.HandledToContainerCode))
.ForMember(x => x.HandledPackingCode, y => y.MapFrom(t => t.HandledToPackingCode))
.ForMember(x => x.HandledSupplierBatch, y => y.MapFrom(t => t.HandledToSupplierBatch))
.ForMember(x => x.HandledArriveDate, y => y.MapFrom(t => t.HandledToArriveDate))
.ForMember(x => x.HandledProduceDate, y => y.MapFrom(t => t.HandledToProduceDate))
.ForMember(x => x.HandledExpireDate, y => y.MapFrom(t => t.HandledToExpireDate))
.ForMember(x => x.HandledLot, y => y.MapFrom(t => t.HandledToLot))
.ForMember(x => x.HandledQty, y => y.MapFrom(t => t.HandledToQty))
.ForMember(x => x.FromPackingCode, y => y.MapFrom(t => t.HandledFromPackingCode))
.ForMember(x => x.ToPackingCode, y => y.MapFrom(t => t.HandledToPackingCode))
.ForMember(x => x.FromContainerCode, y => y.MapFrom(t => t.HandledFromContainerCode))
.ForMember(x => x.ToContainerCode, y => y.MapFrom(t => t.HandledToContainerCode))
.ForMember(x => x.FromLot, y => y.MapFrom(t => t.HandledFromLot))
.ForMember(x => x.ToLot, y => y.MapFrom(t => t.HandledToLot))
.ForMember(x => x.SupplierBatch, y => y.MapFrom(t => t.HandledToSupplierBatch))
.ForMember(x => x.ArriveDate, y => y.MapFrom(t => t.HandledToArriveDate))
.ForMember(x => x.ProduceDate, y => y.MapFrom(t => t.HandledToProduceDate))
.ForMember(x => x.ExpireDate, y => y.MapFrom(t => t.HandledToExpireDate))
.ForMember(x => x.FromLocationCode, y => y.MapFrom(t => t.HandledFromLocationCode))
.ForMember(x => x.FromLocationArea, y => y.MapFrom(t => t.HandledFromLocationArea))
.ForMember(x => x.FromLocationGroup, y => y.MapFrom(t => t.HandledFromLocationGroup))
.ForMember(x => x.FromLocationErpCode, y => y.MapFrom(t => t.HandledFromLocationErpCode))
.ForMember(x => x.FromWarehouseCode, y => y.MapFrom(t => t.HandledFromWarehouseCode))
.ForMember(x => x.ToLocationCode, y => y.MapFrom(t => t.HandledToLocationCode))
.ForMember(x => x.ToLocationArea, y => y.MapFrom(t => t.HandledToLocationArea))
.ForMember(x => x.ToLocationGroup, y => y.MapFrom(t => t.HandledToLocationGroup))
.ForMember(x => x.ToLocationErpCode, y => y.MapFrom(t => t.HandledToLocationErpCode))
.ForMember(x => x.ToWarehouseCode, y => y.MapFrom(t => t.HandledToWarehouseCode))
.ForMember(x => x.FromStatus, y => y.MapFrom(t => t.Status))
.ForMember(x => x.ToStatus, y => y.MapFrom(t => t.Status))
.ForMember(x => x.Qty, y => y.MapFrom(t => t.HandledToQty))
.ForMember(x => x.ItemCode, y => y.MapFrom(t => t.ItemCode))
.Ignore(x => x.ExpiredTime)
;
}
}

51
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleNoteAutoMapperProfile.cs

@ -1,51 +0,0 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Event;
public partial class StoreEventAutoMapperProfile : Profile
{
private void AssembleIssueNoteAutoMapperProfile()
{
CreateMap<AssembleIssueNoteDetail, TransferLogEditInput>()
.Ignore(x => x.DocNumber)
.Ignore(x => x.JobNumber)
.Ignore(x => x.Worker)
.Ignore(x => x.TransType)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.TransSubType)
.ForMember(x => x.Qty, y => y.MapFrom(t => t.HandledToQty))
.ForMember(x => x.SupplierBatch, y => y.MapFrom(t => t.HandledFromSupplierBatch))
.ForMember(x => x.ArriveDate, y => y.MapFrom(t => t.HandledFromArriveDate))
.ForMember(x => x.ProduceDate, y => y.MapFrom(t => t.HandledFromProduceDate))
.ForMember(x => x.ExpireDate, y => y.MapFrom(t => t.HandledFromExpireDate))
.ForMember(x => x.FromPackingCode, y => y.MapFrom(t => t.HandledFromPackingCode))
.ForMember(x => x.FromContainerCode, y => y.MapFrom(t => t.HandledFromContainerCode))
.ForMember(x => x.FromLot, y => y.MapFrom(t => t.HandledFromLot))
.ForMember(x => x.FromStatus, y => y.MapFrom(t => t.Status))
.ForMember(x => x.FromLocationCode, y => y.MapFrom(t => t.HandledFromLocationCode))
.ForMember(x => x.FromLocationGroup, y => y.MapFrom(t => t.HandledFromLocationGroup))
.ForMember(x => x.FromLocationArea, y => y.MapFrom(t => t.HandledFromLocationArea))
.ForMember(x => x.FromLocationErpCode, y => y.MapFrom(t => t.HandledFromLocationErpCode))
.ForMember(x => x.FromWarehouseCode, y => y.MapFrom(t => t.HandledFromWarehouseCode))
.ForMember(x => x.ToLot, y => y.MapFrom(t => t.HandledToLot))
.ForMember(x => x.ToStatus, y => y.MapFrom(t => t.Status))
.ForMember(x => x.ToPackingCode, y => y.MapFrom(t => t.HandledToPackingCode))
.ForMember(x => x.ToContainerCode, y => y.MapFrom(t => t.HandledToContainerCode))
.ForMember(x => x.ToLocationCode, y => y.MapFrom(t => t.HandledToLocationCode))
.ForMember(x => x.ToLocationGroup, y => y.MapFrom(t => t.HandledToLocationGroup))
.ForMember(x => x.ToLocationArea, y => y.MapFrom(t => t.HandledToLocationArea))
.ForMember(x => x.ToLocationErpCode, y => y.MapFrom(t => t.HandledToLocationErpCode))
.ForMember(x => x.ToWarehouseCode, y => y.MapFrom(t => t.HandledToWarehouseCode))
;
}
}

65
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs

@ -37,44 +37,45 @@ public class AssembleIssueNoteEventHandler
protected override async Task AddExchangeDataAsync(List<AssembleIssueNote> entities) protected override async Task AddExchangeDataAsync(List<AssembleIssueNote> entities)
{ {
var dtos = ObjectMapper.Map<List<AssembleIssueNote>, List<AssembleIssueNoteDTO>>(entities); var dtos = ObjectMapper.Map<List<AssembleIssueNote>, List<IssueNoteDTO>>(entities);
foreach (var detail in dtos.SelectMany(dto => dto.Details)) foreach (var detail in dtos.SelectMany(dto => dto.Details))
{ {
if (string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) await detail.TrySetLocationAsync(LocationAclService).ConfigureAwait(false);
{ //if (string.IsNullOrEmpty(detail.HandledFromLocationErpCode))
var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); //{
if (location != null) // var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false);
{ // if (location != null)
detail.HandledFromLocationErpCode = location.ErpLocationCode; // {
detail.HandledFromLocationGroup = location.LocationGroupCode; // detail.HandledFromLocationErpCode = location.ErpLocationCode;
detail.HandledFromLocationArea = location.AreaCode; // detail.HandledFromLocationGroup = location.LocationGroupCode;
// detail.HandledFromLocationArea = location.AreaCode;
if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) // if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode))
{ // {
detail.HandledFromWarehouseCode = location.WarehouseCode; // detail.HandledFromWarehouseCode = location.WarehouseCode;
} // }
} // }
} //}
if (string.IsNullOrEmpty(detail.HandledToLocationErpCode)) //if (string.IsNullOrEmpty(detail.HandledToLocationErpCode))
{ //{
var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); // var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false);
if (location != null) // if (location != null)
{ // {
detail.HandledToLocationErpCode = location.ErpLocationCode; // detail.HandledToLocationErpCode = location.ErpLocationCode;
detail.HandledToLocationGroup = location.LocationGroupCode; // detail.HandledToLocationGroup = location.LocationGroupCode;
detail.HandledToLocationArea = location.AreaCode; // detail.HandledToLocationArea = location.AreaCode;
if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) // if (string.IsNullOrEmpty(detail.HandledToWarehouseCode))
{ // {
detail.HandledToWarehouseCode = location.WarehouseCode; // detail.HandledToWarehouseCode = location.WarehouseCode;
} // }
} // }
} //}
} }
var toErpDto = new List<AssembleIssueNoteDTO>(); var toErpDto = new List<IssueNoteDTO>();
foreach (var item in dtos) foreach (var item in dtos)
{ {
if (item.Details != null && item.Details.Count != 0) if (item.Details != null && item.Details.Count != 0)
@ -84,10 +85,10 @@ public class AssembleIssueNoteEventHandler
} }
//2023-12-6要求同储位不传入接口 按历史规则 //2023-12-6要求同储位不传入接口 按历史规则
var result = new List<AssembleIssueNoteDTO>(); var result = new List<IssueNoteDTO>();
foreach (var assembleIssueNoteDto in toErpDto) foreach (var assembleIssueNoteDto in toErpDto)
{ {
assembleIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode); assembleIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.ToLocationErpCode);
if (assembleIssueNoteDto.Details.Count > 0) if (assembleIssueNoteDto.Details.Count > 0)
{ {
result.Add(assembleIssueNoteDto); result.Add(assembleIssueNoteDto);

14
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/TransferLibJobEventHandler.cs

@ -61,6 +61,20 @@ public class TransferLibJobEventHandler :
{ {
var createInput = ObjectMapper.Map<TransferLibJob, TransferLibNoteEditInput>(entity); var createInput = ObjectMapper.Map<TransferLibJob, TransferLibNoteEditInput>(entity);
createInput.Confirmed = true;
createInput.ConfirmTime = Clock.Now;
foreach(var item in createInput.Details)
{
if(string.IsNullOrEmpty(item.HandledFromLot))
{
item.HandledFromLot = "";
}
if (string.IsNullOrEmpty(item.HandledToLot))
{
item.HandledToLot = "";
}
}
return createInput; return createInput;
} }
} }

34
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs

@ -119,36 +119,32 @@ public class DeliverRequestEventHandler
//东阳特殊逻辑 //东阳特殊逻辑
if (entitys.First().DirectCreateNote) if (entitys.First().DirectCreateNote)
{ {
var noteCreateInput = await BuildDeliverNoteAsync(entitys).ConfigureAwait(false); var noteCreateInputs = await BuildDeliverNotesAsync(entitys).ConfigureAwait(false);
await _deliverNoteApp.CreateAsync(noteCreateInput).ConfigureAwait(false); await _deliverNoteApp.CreateManyAsync(noteCreateInputs).ConfigureAwait(false);
} }
} }
#region 私有 #region 私有
private async Task<DeliverNoteEditInput> BuildDeliverNoteAsync(List<DeliverRequest> requests) private async Task<List<DeliverNoteEditInput>> BuildDeliverNotesAsync(List<DeliverRequest> requests)
{ {
var transactionType = await TransactionTypeAclService List<DeliverNoteEditInput> createInputs = new List<DeliverNoteEditInput>();
.GetByTransTypeAsync(EnumTransType.Deliver, EnumTransSubType.None).ConfigureAwait(false); var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Deliver, EnumTransSubType.None).ConfigureAwait(false);
foreach (var request in requests)
if (requests.First().DeliverRequestType == EnumDeliverRequestType.Normal) {
if (request.DeliverRequestType == EnumDeliverRequestType.Normal)
{ {
transactionType = await TransactionTypeAclService.GetByTransTypeAsync( transactionType = await TransactionTypeAclService.GetByTransTypeAsync(
EnumTransType.Deliver, EnumTransType.Deliver,
EnumTransSubType.Deliver_Standard).ConfigureAwait(false); EnumTransSubType.Deliver_Standard).ConfigureAwait(false);
} }
else if (requests.First().DeliverRequestType == EnumDeliverRequestType.FIS) else if (request.DeliverRequestType == EnumDeliverRequestType.FIS)
{ {
transactionType = await TransactionTypeAclService.GetByTransTypeAsync( transactionType = await TransactionTypeAclService.GetByTransTypeAsync(
EnumTransType.Deliver, EnumTransType.Deliver,
EnumTransSubType.Deliver_FIS).ConfigureAwait(false); EnumTransSubType.Deliver_FIS).ConfigureAwait(false);
} }
var createInput = ObjectMapper.Map<DeliverRequest, DeliverNoteEditInput>(request);
var createInput = ObjectMapper.Map<DeliverRequest, DeliverNoteEditInput>(requests.First()); var customerAddress = (await _customerAddressApp.GetByCustomerCodeAsync(createInput.CustomerCode).ConfigureAwait(false)).FirstOrDefault();
var customerAddress =
(await _customerAddressApp.GetByCustomerCodeAsync(createInput.CustomerCode).ConfigureAwait(false))
.FirstOrDefault();
LocationDTO toLocation = null; LocationDTO toLocation = null;
if (customerAddress != null && !string.IsNullOrEmpty(customerAddress.LocationCode)) if (customerAddress != null && !string.IsNullOrEmpty(customerAddress.LocationCode))
{ {
@ -156,10 +152,9 @@ public class DeliverRequestEventHandler
Check.NotNull(toLocation, $"客户库位 {customerAddress.LocationCode} 不存在"); Check.NotNull(toLocation, $"客户库位 {customerAddress.LocationCode} 不存在");
} }
createInput.Details = new List<DeliverNoteDetailInput>(); createInput.Details = new List<DeliverNoteDetailInput>();
List<BalanceDTO> oldBalances = new List<BalanceDTO>(); List<BalanceDTO> oldBalances = new List<BalanceDTO>();
foreach (var detail in requests.SelectMany(r=>r.Details)) foreach (var detail in request.Details)
{ {
var locations = await _locationAppService.GetListByTypesAndErpCodeAsync(transactionType.OutLocationTypes, detail.AreaCode).ConfigureAwait(false); var locations = await _locationAppService.GetListByTypesAndErpCodeAsync(transactionType.OutLocationTypes, detail.AreaCode).ConfigureAwait(false);
if (locations.Count <= 0) if (locations.Count <= 0)
@ -209,7 +204,10 @@ public class DeliverRequestEventHandler
createInput.Details.Add(inputDetail); createInput.Details.Add(inputDetail);
} }
} }
return createInput;
createInputs.Add(createInput);
}
return createInputs;
} }
private async Task<DeliverNoteEditInput> BuildDeliverNoteAsync(DeliverRequest request) private async Task<DeliverNoteEditInput> BuildDeliverNoteAsync(DeliverRequest request)
{ {

25
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferLibRequestEventHandler.cs

@ -26,18 +26,20 @@ public class TransferLibRequestEventHandler
{ {
private readonly ITransferLibNoteManager _transferLibNoteManager; private readonly ITransferLibNoteManager _transferLibNoteManager;
private readonly ILocationAppService _locationAppService; private readonly ILocationAppService _locationAppService;
private readonly IItemBasicAppService _itemBasicAppService;
private readonly ITransferLibRequestManager _transferLibRequestManager; private readonly ITransferLibRequestManager _transferLibRequestManager;
private readonly ITransferLibJobManager _transferLibJobManager; private readonly ITransferLibJobManager _transferLibJobManager;
protected ILocalEventBus LocalEventBus => LazyServiceProvider.LazyGetRequiredService<ILocalEventBus>(); protected ILocalEventBus LocalEventBus => LazyServiceProvider.LazyGetRequiredService<ILocalEventBus>();
public TransferLibRequestEventHandler( public TransferLibRequestEventHandler(
ITransferLibNoteManager transferLibNoteManager, ILocationAppService locationAppService, ITransferLibRequestManager transferLibRequestManager, ITransferLibJobManager transferLibJobManager) ITransferLibNoteManager transferLibNoteManager, ILocationAppService locationAppService, IItemBasicAppService itemBasicAppService, ITransferLibRequestManager transferLibRequestManager, ITransferLibJobManager transferLibJobManager)
{ {
_transferLibNoteManager = transferLibNoteManager; _transferLibNoteManager = transferLibNoteManager;
_locationAppService = locationAppService; _locationAppService = locationAppService;
_transferLibRequestManager = transferLibRequestManager; _transferLibRequestManager = transferLibRequestManager;
_transferLibJobManager = transferLibJobManager; _transferLibJobManager = transferLibJobManager;
_itemBasicAppService = itemBasicAppService;
} }
@ -81,6 +83,27 @@ public class TransferLibRequestEventHandler
var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT) var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT)
.ConfigureAwait(false); .ConfigureAwait(false);
foreach(var item in input.Details)
{
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(item.ItemCode).ConfigureAwait(false);
if(itemBasicDto!=null)
{
item.ItemDesc1 = itemBasicDto.Desc1;
item.ItemDesc2 = itemBasicDto.Desc2;
item.ItemName = itemBasicDto.Name;
item.Uom = itemBasicDto.BasicUom;
item.StdPackQty = itemBasicDto.StdPackQty;
}
else
{
throw new UserFriendlyException($"未找到此物品{item.ItemCode}的信息");
}
}
//var transferOnTheWayLocation = //var transferOnTheWayLocation =
// await SettingManager.GetOrNullGlobalAsync(StoreSettings.Common.TransferOnTheWayLocation) // await SettingManager.GetOrNullGlobalAsync(StoreSettings.Common.TransferOnTheWayLocation)
// .ConfigureAwait(false); // .ConfigureAwait(false);

Loading…
Cancel
Save