Browse Source

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

dev_DY_CC
lvzb 1 year ago
parent
commit
62c45f5c13
  1. 9
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductionReturnRequestController .cs
  2. 6
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/CustomerReturnNoteController.cs
  3. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ErpLocationItems/DTOs/ErpLocationItemDTO.cs
  4. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ErpLocationItems/Inputs/ErpLocationItemEditInput.cs
  5. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ErpLocationItems/Inputs/ErpLocationItemImportInput.cs
  6. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Bases/SfsBaseDataAppServiceBase.cs
  7. 27
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ErpLocationItems/ErpLocationItemAppService.cs
  8. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ErpLocationItems/ErpLocationItemAutoMapperProfile.cs
  9. 5
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs
  10. 49
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Caches/Cache.cs
  11. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs
  12. 43
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAppService.cs
  13. 85
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAppService.cs
  14. 31
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/CustomerProductionReturnNoteAutoMapperProfile.cs
  15. 15
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ProductionReturnJobEventHandler.cs
  16. 116
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductionReturnRequestEventHandler.cs
  17. 86
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/CustomerProductionReturnNoteEventHandler.cs
  18. 3
      build/src/docker/publish/conf/settings/appsettings.Development.json

9
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductionReturnRequestController .cs

@ -23,6 +23,7 @@ public class ProductionReturnRequestController : AbpController
{
private readonly IProductionReturnJobAppService _productionReturnJobAppService;
private readonly IProductionReturnRequestAppService _productionReturnRequestAppService;
private readonly ICustomerProductionReturnNoteAppService _customerReturnAppService;
private readonly IUserWorkGroupAppService _userWorkGroupAppService;
@ -38,9 +39,11 @@ public class ProductionReturnRequestController : AbpController
IProductionReturnJobAppService productionReturnJobAppService
, IUserWorkGroupAppService userWorkGroupAppService
, ILocationAppService locationApp
, IProductionReturnRequestAppService productionReturnRequestAppService
, IProductionReturnRequestAppService productionReturnRequestAppService,
ICustomerProductionReturnNoteAppService customerReturnAppService
)
{
_customerReturnAppService = customerReturnAppService;
_productionReturnRequestAppService = productionReturnRequestAppService;
_userWorkGroupAppService = userWorkGroupAppService;
this._productionReturnJobAppService = productionReturnJobAppService;
@ -62,9 +65,9 @@ public class ProductionReturnRequestController : AbpController
[HttpPost("")]
public virtual async Task<ProductionReturnRequestDTO> CreateAsync(ProductionReturnRequestEditInput input)
public virtual async Task<CustomerProductionReturnNoteDTO> CreateAsync(CustomerProductionReturnNoteEditInput input)
{
return await _productionReturnRequestAppService.CreateAsync(input).ConfigureAwait(false);
return await _customerReturnAppService.CreateAsync(input).ConfigureAwait(false);
}

6
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/CustomerReturnNoteController.cs

@ -12,14 +12,14 @@ namespace Win_in.Sfs.Wms.Pda.Controllers.Stores;
[Route($"{PdaHostConst.ROOT_ROUTE}store/return-from-customer")]
public class CustomerReturnNoteController : AbpController
{
private readonly ICustomerReturnNoteAppService _customerReturnNoteAppService;
private readonly ICustomerProductionReturnNoteAppService _customerReturnNoteAppService;
/// <summary>
///
/// </summary>
/// <param name="customerReturnNoteAppService"></param>
public CustomerReturnNoteController(
ICustomerReturnNoteAppService customerReturnNoteAppService)
ICustomerProductionReturnNoteAppService customerReturnNoteAppService)
{
_customerReturnNoteAppService = customerReturnNoteAppService;
}
@ -30,7 +30,7 @@ public class CustomerReturnNoteController : AbpController
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("")]
public virtual async Task<CustomerReturnNoteDTO> CreateAsync(CustomerReturnNoteEditInput input)
public virtual async Task<CustomerProductionReturnNoteDTO> CreateAsync(CustomerProductionReturnNoteEditInput input)
{
return await _customerReturnNoteAppService.CreateAsync(input).ConfigureAwait(false);
}

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ErpLocationItems/DTOs/ErpLocationItemDTO.cs

@ -21,5 +21,5 @@ public class ErpLocationItemDTO : SfsBaseDataDTOBase
[Display(Name = "储位代码")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ErpLoactionCode { get; set; }
public string ErpLocationCode { get; set; }
}

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ErpLocationItems/Inputs/ErpLocationItemEditInput.cs

@ -19,7 +19,7 @@ public class ErpLocationItemEditInput : SfsBaseDataCreateOrUpdateInputBase
[Display(Name = "储位代码")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ErpLoactionCode { get; set; }
public string ErpLocationCode { get; set; }

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ErpLocationItems/Inputs/ErpLocationItemImportInput.cs

@ -21,7 +21,7 @@ public class ErpLocationItemImportInput : SfsBaseDataImportInputBase
/// </summary>
[Display(Name = "储位代码")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string ErpLoactionCode { get; set; }
public string ErpLocationCode { get; set; }
}

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Bases/SfsBaseDataAppServiceBase.cs

@ -27,6 +27,7 @@ public abstract class SfsBaseDataAppServiceBase<TEntity, TEntityDto, TRequestInp
{
protected IItemBasicAppService ItemBasicAppService => LazyServiceProvider.LazyGetRequiredService<IItemBasicAppService>();
protected ILocationAppService LocationAppService => LazyServiceProvider.LazyGetRequiredService<ILocationAppService>();
protected IErpLocationAppService ErpLocationAppService => LazyServiceProvider.LazyGetRequiredService<IErpLocationAppService>();
protected IWarehouseAppService WarehouseAppService => LazyServiceProvider.LazyGetRequiredService<IWarehouseAppService>();
protected ISupplierAppService SupplierAppService => LazyServiceProvider.LazyGetRequiredService<ISupplierAppService>();
protected IAreaAppService AreaAppService => LazyServiceProvider.LazyGetRequiredService<IAreaAppService>();

27
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ErpLocationItems/ErpLocationItemAppService.cs

@ -10,6 +10,7 @@ using Volo.Abp;
using Volo.Abp.Caching;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Domain;
using Win_in.Sfs.Basedata.Domain.Shared;
@ -40,6 +41,32 @@ public class ErpLocationItemAppService
_manager = manager;
}
/// <summary>
/// 用来重写 新增实体
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[HttpPost("")]
[UnitOfWork]
public override async Task<ErpLocationItemDTO> CreateAsync(ErpLocationItemEditInput input)
{
var itemBasic = await ItemBasicAppService.GetByCodeAsync(input.ItemCode).ConfigureAwait(false);
Check.NotNull(itemBasic, "物品代码", $"物品 {input.ItemCode} 不存在");
var erpLocation = await ErpLocationAppService.GetByCodeAsync(input.ErpLocationCode).ConfigureAwait(false);
Check.NotNull(erpLocation, "储位代码", $"储位 {input.ErpLocationCode} 不存在");
var entity = await _repository.FirstOrDefaultAsync(p => p.ItemCode == input.ItemCode && p.ErpLocationCode == input.ErpLocationCode).ConfigureAwait(false);
if(entity != null)
{
throw new UserFriendlyException($"物品{input.ItemCode}和储位{input.ErpLocationCode} 对应关系已存在");
}
return await base.CreateAsync(input).ConfigureAwait(false);
}
/// <summary>
/// 检查物料和储位对应关系是否存在
/// </summary>

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ErpLocationItems/ErpLocationItemAutoMapperProfile.cs

@ -14,6 +14,7 @@ public partial class BasedataApplicationAutoMapperProfile : Profile
CreateMap<ErpLocationItemImportInput, ErpLocationItem>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.Remark)
.Ignore(x => x.TenantId)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.ConcurrencyStamp)

5
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs

@ -324,6 +324,11 @@ public class BomManager : DomainService, IBomManager
private async Task<List<BomComponent>> GetComponentsByProduct(string product)
{
List<Bom> list=new List<Bom>();
if (Cache.Boms.Count == 0)
{
InitBomComponent();
}
list=Cache.Boms.Count > 0 ? Cache.Boms.Where(p => p.Product == product).ToList() :
await _repository.GetListAsync(p => p.Product == product).ConfigureAwait(false);
List<BomComponent> components = new List<BomComponent>();

49
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Caches/Cache.cs

@ -8,6 +8,53 @@ using Win_in.Sfs.Basedata.Domain;
namespace Win_in.Sfs.Basedata.Caches;
public static class Cache
{
public static List<Bom> Boms = new List<Bom>();
public static List<Bom> Boms = new List<Bom>();
public static async void BomsLifeCycle(int lifetime)
{
var reassigner = new Reassigner(DateTime.Now,new TimeSpan(0,5,0));
await reassigner.RunAsync(() => {
Boms.Clear();
}).ConfigureAwait(false);
}
}
public class Reassigner
{
private readonly TimeSpan _interval;
private DateTime _lasttime;
public Reassigner(DateTime lasttime, TimeSpan interval)
{
_lasttime = lasttime;
_interval = interval;
}
public async Task RunAsync(Action p_action)
{
while (true)
{
// 获取当前时间
var currentTime = DateTime.Now;
// 计算上次重新赋值到现在的时间间隔
var elapsed = currentTime - _lasttime;
// 检查时间间隔是否满足条件
if (elapsed >= _interval)
{
p_action();
// 重新赋值
//_value = await GetValueAsync();
// 更新最后更新时间
_lasttime = currentTime;
}
// 等待下一刻钟
await Task.Delay(_interval);
}
}
}

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CustomerProductionReturnNotes/CustomerProductionReturnNoteAppService.cs

@ -1,6 +1,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
@ -37,6 +38,17 @@ public class CustomerProductionReturnNoteAppService :
public override async Task<CustomerProductionReturnNoteDTO> CreateAsync(CustomerProductionReturnNoteEditInput input)
{
var entity = ObjectMapper.Map<CustomerProductionReturnNoteEditInput, CustomerProductionReturnNote>(input);
foreach (var itm in entity.Details)
{
itm.FromLocationCode = "HOLD";
itm.FromStatus = EnumInventoryStatus.OK;
itm.ToStatus=EnumInventoryStatus.OK;
}
await _CustomerProductionReturnNoteManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<CustomerProductionReturnNote, CustomerProductionReturnNoteDTO>(entity);
return dto;

43
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAppService.cs

@ -1,6 +1,10 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
@ -18,13 +22,19 @@ public class ProductionReturnNoteAppService :
IProductionReturnNoteAppService
{
private readonly IProductionReturnNoteManager _ProductionReturnNoteManager;
private readonly ILocationAppService _locationAppService;
private readonly IItemStoreRelationAppService _itemStoreRelationAppService;
public ProductionReturnNoteAppService(
IProductionReturnNoteRepository repository
, IProductionReturnNoteManager ProductionReturnNoteManager
) : base(repository)
, ILocationAppService locationAppService
, IItemStoreRelationAppService itemStoreRelationAppService
) : base(repository)
{
_ProductionReturnNoteManager = ProductionReturnNoteManager;
_locationAppService = locationAppService;
_itemStoreRelationAppService = itemStoreRelationAppService;
}
/// <summary>
@ -42,6 +52,37 @@ public class ProductionReturnNoteAppService :
return dto;
}
/// <summary>
/// 新增实体(原材料生产退库)
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("create-yl")]
//[Authorize(ProductionReturnNotePermissions.Create)]
public async Task<ProductionReturnNoteDTO> CreateYLAsync(ProductionReturnNoteEditInput input)
{
//校验目标库位
var locCodeLst = input.Details.Select(itm => itm.ToLocationCode).ToList();
var locLst = await _locationAppService.GetByCodesAsync(locCodeLst).ConfigureAwait(false);
bool allIsBCP = locLst.All(itm => itm.Type == EnumLocationType.RAW);
if (allIsBCP == false)
{
throw new UserFriendlyException("目标库位必须是原材料库位,不允许存在其它类型库位!");
}
//校验物料和库存关系
foreach (var item in input.Details)
{
var obj = await _itemStoreRelationAppService.GetFirstAsync(item.ItemCode, item.ToLocationCode).ConfigureAwait(false);
if (obj == null)
{
throw new UserFriendlyException($"物料{item.ItemCode}不能存在目标库位{item.ToLocationCode},物料库存关系表不存在!");
}
}
var entity = ObjectMapper.Map<ProductionReturnNoteEditInput, ProductionReturnNote>(input);
await _ProductionReturnNoteManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<ProductionReturnNote, ProductionReturnNoteDTO>(entity);
return dto;
}
}

85
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAppService.cs

@ -33,7 +33,7 @@ public class ProductionReturnRequestAppService :
private readonly IItemBasicAppService _itemBasicAppService;
private readonly ILocationAppService _locationAppService;
private readonly IBalanceAppService _balanceAppservice;
private readonly IItemStoreRelationAppService _itemStoreRelationAppService;
@ -45,8 +45,7 @@ public class ProductionReturnRequestAppService :
IItemBasicAppService itemBasicAppService,
ILocationAppService locationAppService,
IBalanceAppService _balanceAppservice
,IItemStoreRelationAppService itemStoreRelationAppService
)
: base(repository, productionRequestReturnManager)
{
@ -55,10 +54,13 @@ public class ProductionReturnRequestAppService :
_purchaseOrderApp = purchaseOrderApp;
_itemBasicAppService = itemBasicAppService;
_locationAppService = locationAppService;
_itemStoreRelationAppService = itemStoreRelationAppService;
}
/// <summary>
/// 【创建】生成退料申请
/// 【创建】生成退料申请(半成品生产退库)
/// 立库生产退库调用CreateLiKuAsync
/// 原材料生产退库调用ProductionReturnNote的CreateYLAsync
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@ -66,22 +68,75 @@ public class ProductionReturnRequestAppService :
//[Authorize(ProductionReturnRequestPermissions.Create)]
public override async Task<ProductionReturnRequestDTO> CreateAsync(ProductionReturnRequestEditInput input)
{
//校验目标库位
var locCodeLst = input.Details.Select(itm => itm.ToLocationCode).ToList();
var locLst = await _locationAppService.GetByCodesAsync(locCodeLst).ConfigureAwait(false);
bool allIsBCP = locLst.All(itm => itm.Type == EnumLocationType.SEMI);
if (allIsBCP == false)
{
throw new UserFriendlyException("目标库位必须是半成品库位,不允许存在其它类型库位!");
}
//校验物料和库存关系
foreach (var item in input.Details)
{
var obj = await _itemStoreRelationAppService.GetFirstAsync(item.ItemCode, item.ToLocationCode).ConfigureAwait(false);
if (obj == null)
{
throw new UserFriendlyException($"物料{item.ItemCode}不能存在目标库位{item.ToLocationCode},物料库存关系表不存在!");
}
}
var entity = ObjectMapper.Map<ProductionReturnRequestEditInput, ProductionReturnRequest>(input);
//var subType = Enum.Parse<EnumTransSubType>(input.Type);
//var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.TransferLib, subType).ConfigureAwait(false);
//entity.Type = ((int)subType).ToString();
//entity.AutoCompleteJob = tranType.AutoCompleteJob;
//entity.AutoSubmit = tranType.AutoSubmitRequest;
//entity.AutoAgree = tranType.AutoAgreeRequest;
//entity.AutoHandle = tranType.AutoHandleRequest;
//entity.DirectCreateNote = tranType.DirectCreateNote;
await _productionReturnRequestManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<ProductionReturnRequest, ProductionReturnRequestDTO>(entity);
return dto;
}
//SfsInventoryRequestInputBase sfsRequestInput = new SfsInventoryRequestInputBase();
//sfsRequestInput.Condition
/// <summary>
/// 【创建】生成退料申请(立库生产退库)
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("create-liku")]
//[Authorize(ProductionReturnRequestPermissions.Create)]
public async Task<ProductionReturnRequestDTO> CreateLiKuAsync(ProductionReturnRequestEditInput input)
{
//校验目标库位 //??没有立库类型
//var locCodeLst = input.Details.Select(itm => itm.ToLocationCode).ToList();
//var locLst = await _locationAppService.GetByCodesAsync(locCodeLst).ConfigureAwait(false);
//bool allIsBCP = locLst.All(itm => itm.Type == EnumLocationType.立库);
//if (allIsBCP == false)
//{
// throw new UserFriendlyException("目标库位必须是立库,不允许存在其它类型库位!");
//}
//校验物料和库存关系
foreach (var item in input.Details)
{
var obj = await _itemStoreRelationAppService.GetFirstAsync(item.ItemCode, item.ToLocationCode).ConfigureAwait(false);
if (obj == null)
{
throw new UserFriendlyException($"物料{item.ItemCode}不能存在目标库位{item.ToLocationCode},物料库存关系表不存在!");
}
}
var entity = ObjectMapper.Map<ProductionReturnRequestEditInput, ProductionReturnRequest>(input);
//var subType = Enum.Parse<EnumTransSubType>(input.Type);
//var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.TransferLib, subType).ConfigureAwait(false);
//entity.Type = ((int)subType).ToString();
//entity.AutoCompleteJob = tranType.AutoCompleteJob;
//entity.AutoSubmit = tranType.AutoSubmitRequest;
//entity.AutoAgree = tranType.AutoAgreeRequest;
//entity.AutoHandle = tranType.AutoHandleRequest;
//entity.DirectCreateNote = tranType.DirectCreateNote;
await _productionReturnRequestManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<ProductionReturnRequest, ProductionReturnRequestDTO>(entity);
return dto;
}

31
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/CustomerProductionReturnNoteAutoMapperProfile.cs

@ -1,6 +1,7 @@
using AutoMapper;
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;
@ -10,14 +11,38 @@ public partial class StoreEventAutoMapperProfile : Profile
private void CustomerProductionReturnNoteAutoMapperProfile()
{
CreateMap<CustomerProductionReturnNoteDetail, TransferLogEditInput>()
.Ignore(x => x.Worker)
.Ignore(x => x.TransType)
.Ignore(x => x.DocNumber)
.Ignore(x => x.JobNumber)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.TransSubType)
;
.ForMember(x => x.DocNumber, y => y.MapFrom(t => t.Number))
.Ignore(x => x.JobNumber)
CreateMap<CustomerProductionReturnNoteDetail, TransactionEditInput>()
.ForMember(x => x.PackingCode, y => y.MapFrom(d => d.ToPackingCode))
.ForMember(x => x.ContainerCode, y => y.MapFrom(d => d.ToContainerCode))
.ForMember(x => x.Lot, y => y.MapFrom(d => d.ToLot))
.ForMember(x => x.Status, y => y.MapFrom(d => d.ToStatus))
.ForMember(x => x.LocationCode, y => y.MapFrom(d => d.ToLocationCode))
.ForMember(x => x.LocationArea, y => y.MapFrom(d => d.ToLocationArea))
.ForMember(x => x.LocationGroup, y => y.MapFrom(d => d.ToLocationGroup))
.ForMember(x => x.LocationErpCode, y => y.MapFrom(d => d.ToLocationErpCode))
.ForMember(x => x.WarehouseCode, y => y.MapFrom(d => d.ToWarehouseCode))
.Ignore(x => x.Worker)
.Ignore(x => x.TransType)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.DocNumber)
.Ignore(x => x.JobNumber)
.Ignore(x => x.ManageType)
.Ignore(x => x.TransType)
.Ignore(x => x.TransSubType)
.Ignore(x => x.TransInOut)
;
CreateMap<CustomerProductionReturnNote, CustomerProductionReturnNoteDTO>()
.ReverseMap();
CreateMap<CustomerProductionReturnNoteDetail, CustomerProductionReturnNoteDetailDTO>();
}
}

15
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ProductionReturnJobEventHandler.cs

@ -62,12 +62,23 @@ public class ProductionReturnJobEventHandler :
input.ReturnTime=DateTime.Now;
input.Details = new List<ProductionReturnNoteDetailInput>();
foreach (var detail in entity.Details.Where(detail => detail.HandledQty != 0))
foreach (var detail in entity.Details) //.Where(detail => detail.HandledQty != 0)
{
var inputDetail = ObjectMapper.Map<ProductionReturnJobDetail, ProductionReturnNoteDetailInput>(detail);
inputDetail.FromWarehouseCode = entity.WarehouseCode;
inputDetail.ToWarehouseCode = entity.WarehouseCode;
inputDetail.ToLocationArea = detail.HandledToLocationArea;
inputDetail.ToLocationCode = detail.HandledToLocationCode;
inputDetail.ToLocationErpCode = detail.HandledToLocationErpCode;
inputDetail.ToLocationGroup = detail.HandledToLocationGroup;
inputDetail.ToLot = detail.HandledLot;
inputDetail.ToPackingCode = detail.HandledPackingCode;
inputDetail.ToWarehouseCode = detail.HandledToWarehouseCode;
inputDetail.Qty = detail.HandledQty;
inputDetail.HandledQty = detail.HandledQty;
inputDetail.StdPackQty = detail.StdPackQty;
inputDetail.ToStatus = detail.Status;
input.Details.Add(inputDetail);
}

116
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductionReturnRequestEventHandler.cs

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Forms;
using Omu.ValueInjecter;
using Volo.Abp.EventBus;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
@ -33,68 +34,65 @@ public class ProductionReturnRequestEventHandler
{
var entity = eventData.Entity;
//CreateMap<ProductionReturnRequest, ProductionReturnNoteEditInput>()
// .ForMember(x => x.JobNumber, y => y.MapFrom(d => d.Number))
// .ForMember(x => x.ReturnTime, y => y.MapFrom(d => d.CreationTime))
// .ForMember(x => x.Worker, y => y.MapFrom(d => d.Worker))
// .ForMember(x => x.ActiveDate, y => y.MapFrom(d => DateTime.Now))
// .Ignore(x => x.Number);
//CreateMap<ProductionReturnRequestDetail, ProductionReturnNoteDetailInput>()
// .ForMember(x => x.FromPackingCode, y => y.MapFrom(d => d.FromPackingCode))
// .ForMember(x => x.ToPackingCode, y => y.MapFrom(d => d.ToPackingCode))
// .ForMember(x => x.SupplierBatch, y => y.MapFrom(d => d.SupplierBatch))
// .ForMember(x => x.ArriveDate, y => y.MapFrom(d => d.ArriveDate))
// .ForMember(x => x.ProduceDate, y => y.MapFrom(d => d.ProduceDate))
// .ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.ExpireDate))
// .ForMember(x => x.FromLot, y => y.MapFrom(d => string.Empty))
// .ForMember(x => x.ToLot, y => y.MapFrom(d => d.ToLot))
// .ForMember(x => x.ToContainerCode, y => y.MapFrom(d => d.ToContainerCode))
// .ForMember(x => x.FromContainerCode, y => y.MapFrom(d => d.FromContainerCode))
// .ForMember(x => x.FromStatus, y => y.MapFrom(d => d.FromStatus))
// .ForMember(x => x.ToStatus, y => y.MapFrom(d => d.ToStatus))
// .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty))
// .ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.FromLocationCode))
// .ForMember(x => x.FromLocationArea, y => y.MapFrom(d => d.ToLocationArea))
// .ForMember(x => x.FromLocationGroup, y => y.MapFrom(d => d.ToLocationGroup))
// .ForMember(x => x.FromLocationErpCode, y => y.MapFrom(d => d.ToLocationErpCode))
// .ForMember(x => x.FromWarehouseCode, y => y.MapFrom(d => d.ToWarehouseCode))
// .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty))
// .Ignore(x => x.ArriveDate)
// .Ignore(x => x.ToLocationCode)
// .Ignore(x => x.ToLocationArea)
// .Ignore(x => x.ToLocationGroup)
// .Ignore(x => x.ToLocationErpCode)
// .Ignore(x => x.ToWarehouseCode)
// .Ignore(x => x.HandledContainerCode)
// .Ignore(x => x.HandledPackingCode)
// .Ignore(x => x.HandledToLocationCode)
// .Ignore(x => x.HandledToLocationArea)
// .Ignore(x => x.HandledToLocationGroup)
// .Ignore(x => x.HandledToLocationErpCode)
// .Ignore(x => x.HandledToWarehouseCode)
// .Ignore(x => x.HandledExpireDate)
// .Ignore(x => x.HandledLot)
// .Ignore(x => x.HandledArriveDate)
// .Ignore(x => x.HandledProduceDate)
// .Ignore(x => x.HandledQty)
// .Ignore(x => x.HandledSupplierBatch);
ProductionReturnNoteEditInput input = new ProductionReturnNoteEditInput();
input.InjectFrom(entity);
input.ReturnTime = DateTime.Now;
input.ActiveDate=DateTime.Now;
input.JobNumber = input.Number;
List<ProductionReturnNoteDetailInput> inputdetail = new List<ProductionReturnNoteDetailInput>();
foreach (var itm in entity.Details)
if (entity.DirectCreateNote)
{
ProductionReturnNoteDetailInput detail=new ProductionReturnNoteDetailInput();
detail.InjectFrom(itm);
inputdetail.Add(detail);
ProductionReturnNoteEditInput input = new ProductionReturnNoteEditInput();
input.InjectFrom(entity);
input.ReturnTime = DateTime.Now;
input.ActiveDate = DateTime.Now;
input.JobNumber = input.Number;
List<ProductionReturnNoteDetailInput> inputdetail = new List<ProductionReturnNoteDetailInput>();
foreach (var itm in entity.Details)
{
ProductionReturnNoteDetailInput detail = new ProductionReturnNoteDetailInput();
detail.InjectFrom(itm);
inputdetail.Add(detail);
}
input.Details = inputdetail.ToList();
//插入记录
await _productionReturnNoteApp.CreateAsync(input).ConfigureAwait(false);
}
input.Details = inputdetail.ToList();
else
{
ProductionReturnJobEditInput input = new ProductionReturnJobEditInput();
input.InjectFrom(entity);
input.ProductionReturnRequestNumber = entity.Number;
input.JobType = EnumJobType.ProductionReturnJob;
input.JobStatus = EnumJobStatus.Open;
input.IsAutoComplete = entity.AutoCompleteJob;
List<ProductionReturnJobDetailInput> inputdetail = new List<ProductionReturnJobDetailInput>();
foreach (var itm in entity.Details)
{
ProductionReturnJobDetailInput detail = new ProductionReturnJobDetailInput();
detail.InjectFrom(itm);
await _productionReturnNoteApp.CreateAsync(input).ConfigureAwait(false);
detail.RecommendToLocationArea = itm.ToLocationArea;
detail.RecommendToLocationCode = itm.ToLocationCode;
detail.RecommendToLocationErpCode = itm.ToLocationErpCode;
detail.RecommendToLocationGroup = itm.ToLocationGroup;
detail.RecommendToWarehouseCode = itm.ToWarehouseCode;
detail.RecommendLot = itm.ToLot;
detail.RecommendPackingCode = itm.ToPackingCode;
detail.RecommendQty = itm.Qty;
detail.HandledToLocationArea = itm.ToLocationArea;
detail.HandledToLocationCode = itm.ToLocationCode;
detail.HandledToLocationErpCode = itm.ToLocationErpCode;
detail.HandledToLocationGroup = itm.ToLocationGroup;
detail.HandledToWarehouseCode = itm.ToWarehouseCode;
detail.HandledLot = itm.ToLot;
detail.HandledPackingCode = itm.ToPackingCode;
detail.HandledQty = itm.Qty;
detail.StdPackQty = itm.StdPackQty;
detail.Status = itm.ToStatus;
inputdetail.Add(detail);
}
input.Details = inputdetail.ToList();
input.WarehouseCode = entity.Details.Count > 0 ? entity.Details[0].ToWarehouseCode : " ";
//插入任务
await _productionReturnJobApp.CreateAsync(input).ConfigureAwait(false);
}
entity.Complete();
}
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<ProductionReturnRequest> eventData)

86
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/CustomerProductionReturnNoteEventHandler.cs

@ -8,6 +8,7 @@ using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
using Win_in.Sfs.Wms.Store.Event.Transaction;
namespace Win_in.Sfs.Wms.Store.Event.Transactions;
@ -17,78 +18,83 @@ public class CustomerProductionReturnNoteEventHandler
, ILocalEventHandler<SfsCreatedEntityEventData<CustomerProductionReturnNote>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<CustomerProductionReturnNote>>>
{
private const EnumTransType TransType = EnumTransType.CustomerReturn;
private readonly IProductionReturnRequestAppService _productionReturnRequestApp;
public CustomerProductionReturnNoteEventHandler(IProductionReturnRequestAppService productionReturnRequestApp)
{
this._productionReturnRequestApp = productionReturnRequestApp;
}
private const EnumTransInOut TransInOut = EnumTransInOut.In;
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<CustomerProductionReturnNote> eventData)
{
var entity = eventData.Entity;
await AddTransactionsAsync(entity).ConfigureAwait(false);
if (!string.IsNullOrEmpty(entity.ProductionReturnRequestNumber))
{
await _productionReturnRequestApp.CompleteByNumberAsync(entity.ProductionReturnRequestNumber).ConfigureAwait(false);
}
await AddTransactionsAsync(entity).ConfigureAwait(false);
}
private async Task AddTransactionsAsync(CustomerProductionReturnNote CustomerProductionReturnNote)
{
var inboundTransactions = new List<TransferLogEditInput>();
////如果WMS管理客户寄售库,生成库存转移
//if (await SettingManager.IsTrueAsync(StoreSettings.Common.EnableCustomerLocation).ConfigureAwait(false))
//{
inboundTransactions.AddRange(BuildTransferLogs(CustomerProductionReturnNote));
// var transferLogs = BuildTransferLogs(CustomerProductionReturnNote);
// await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false);
await TransferLogAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false);
//}
//else //如果WMS不管理客户寄售库,生成入库
//{
}
var transactions = BuildTransactions(CustomerProductionReturnNote);
await TransactionAppService.AddManyAsync(transactions).ConfigureAwait(false);
//}
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<CustomerProductionReturnNote>> eventData)
{
var entities = eventData.Entity;
await AddTransactionsAsync(entities).ConfigureAwait(false);
}
private async Task AddTransactionsAsync(List<CustomerProductionReturnNote> CustomerProductionReturnNotes)
/// <summary>
/// 构造 库存转移日志实体
/// </summary>
/// <param name="CustomerProductionReturnNote"></param>
/// <returns></returns>
private List<TransferLogEditInput> BuildTransferLogs(CustomerProductionReturnNote CustomerProductionReturnNote)
{
var inboundTransactions = new List<TransferLogEditInput>();
var transferLogCreateInputs = new List<TransferLogEditInput>();
//如果要做库存事务汇总,可以修改此处
foreach (var CustomerProductionReturnNote in CustomerProductionReturnNotes)
foreach (var detail in CustomerProductionReturnNote.Details.Where(detail => detail.Qty != 0))
{
inboundTransactions.AddRange(BuildTransferLogs(CustomerProductionReturnNote));
var transferLog = ObjectMapper.Map<CustomerProductionReturnNoteDetail, TransferLogEditInput>(detail);
transferLog.TransType = TransType;
transferLog.Worker = CustomerProductionReturnNote.Worker;
transferLog.DocNumber = CustomerProductionReturnNote.Number;
transferLog.JobNumber = CustomerProductionReturnNote.JobNumber;
transferLogCreateInputs.Add(transferLog);
}
await TransferLogAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false);
return transferLogCreateInputs;
}
private List<TransferLogEditInput> BuildTransferLogs(CustomerProductionReturnNote CustomerProductionReturnNote)
private List<TransactionEditInput> BuildTransactions(CustomerProductionReturnNote CustomerProductionReturnNote)
{
var transferLogs = new List<TransferLogEditInput>();
foreach (var detail in CustomerProductionReturnNote.Details.Where(detail => detail.Qty != 0))
var transactions = new List<TransactionEditInput>();
foreach (var detail in CustomerProductionReturnNote.Details)
{
var transferLog = ObjectMapper.Map<CustomerProductionReturnNoteDetail, TransferLogEditInput>(detail);
var transaction = ObjectMapper.Map<CustomerProductionReturnNoteDetail, TransactionEditInput>(detail);
transferLog.TransType = TransType;
transaction.TransType = TransType;
transaction.TransInOut = TransInOut;
transferLog.Worker = CustomerProductionReturnNote.Worker;
transferLog.DocNumber = CustomerProductionReturnNote.Number;
transferLog.JobNumber = CustomerProductionReturnNote.JobNumber;
transaction.Worker = CustomerProductionReturnNote.Worker;
transaction.DocNumber = CustomerProductionReturnNote.Number;
transaction.JobNumber = CustomerProductionReturnNote.JobNumber;
transaction.Status = EnumInventoryStatus.OK;
transferLogs.Add(transferLog);
transactions.Add(transaction);
}
return transferLogs;
return transactions;
}
public Task HandleEventAsync(SfsCreatedEntityEventData<List<CustomerProductionReturnNote>> eventData)
{
throw new System.NotImplementedException();
}
}

3
build/src/docker/publish/conf/settings/appsettings.Development.json

@ -114,7 +114,8 @@
"BaseUrl": "http://dev.ccwin-in.com:60083/"
},
"BaseData": {
"BaseUrl": "http://localhost:59094/"
//"BaseUrl": "http://localhost:59094/"
"BaseUrl": "http://dev.ccwin-in.com:60084/"
},
"Default": {
"BaseUrl": "http://dev.ccwin-in.com:60083/"

Loading…
Cancel
Save