55 changed files with 1868 additions and 30 deletions
@ -0,0 +1,41 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
/// <summary>
|
|||
/// 线边调整-实体DTO
|
|||
/// </summary>
|
|||
public class WipWarehouseAdjustNoteDTO : SfsStoreDTOBase<WipWarehouseAdjustNoteDetailDTO>, IHasNumber |
|||
{ |
|||
/// <summary>
|
|||
/// 线边仓调整申请单号
|
|||
/// </summary>
|
|||
[Display(Name = "线边仓调整申请单号")] |
|||
public string RequestNumber { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 任务ID
|
|||
/// </summary>
|
|||
[Display(Name = "任务ID")] |
|||
public string JobNumber { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调整类型
|
|||
/// </summary>
|
|||
[Display(Name = "调整类型")] |
|||
public string Type { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 已确认
|
|||
/// </summary>
|
|||
[Display(Name = "已确认")] |
|||
public bool Confirmed { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 确认时间
|
|||
/// </summary>
|
|||
[Display(Name = "确认时间")] |
|||
public DateTime? ConfirmTime { get; set; } |
|||
|
|||
} |
@ -0,0 +1,24 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
/// <summary>
|
|||
/// 线边调整记录-明细表
|
|||
/// </summary>
|
|||
public class WipWarehouseAdjustNoteDetailDTO : SfsStoreDetailWithFromToDTOBase |
|||
{ |
|||
/// <summary>
|
|||
/// 原因
|
|||
/// </summary>
|
|||
[Display(Name = "调整原因")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string Reason { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调整代码
|
|||
/// </summary>
|
|||
[Display(Name = "原因代码")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string ReasonCode { get; set; } |
|||
} |
@ -0,0 +1,17 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
public interface IWipWarehouseAdjustNoteAppService : |
|||
ISfsStoreMasterReadOnlyAppServiceBase<WipWarehouseAdjustNoteDTO, SfsStoreRequestInputBase, |
|||
WipWarehouseAdjustNoteDetailDTO, SfsStoreRequestInputBase> |
|||
{ |
|||
Task<WipWarehouseAdjustNoteDTO> ConfirmAsync(Guid id); |
|||
|
|||
/// <summary>
|
|||
/// 新增实体
|
|||
/// </summary>
|
|||
/// <param name="input">CreateInput</param>
|
|||
Task<WipWarehouseAdjustNoteDTO> CreateAsync(WipWarehouseAdjustNoteEditInput input); |
|||
} |
@ -0,0 +1,24 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
/// <summary>
|
|||
/// 线边仓调整-明细表DTO
|
|||
/// </summary>
|
|||
public class WipWarehouseAdjustNoteDetailInput : SfsStoreDetailWithFromToInputBase |
|||
{ |
|||
/// <summary>
|
|||
/// 原因
|
|||
/// </summary>
|
|||
[Display(Name = "调整原因")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string Reason { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调整代码
|
|||
/// </summary>
|
|||
[Display(Name = "原因代码")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string ReasonCode { get; set; } |
|||
} |
@ -0,0 +1,48 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
/// <summary>
|
|||
/// 新增和更新基础DTO
|
|||
/// </summary>
|
|||
public class WipWarehouseAdjustNoteEditInput : SfsStoreCreateOrUpdateInputBase |
|||
{ |
|||
#region Base
|
|||
/// <summary>
|
|||
/// 已确认
|
|||
/// </summary>
|
|||
[Display(Name = "已确认")] |
|||
public bool Confirmed { get; set; } |
|||
#endregion
|
|||
|
|||
#region Update
|
|||
/// <summary>
|
|||
/// 确认时间
|
|||
/// </summary>
|
|||
[Display(Name = "确认时间")] |
|||
public DateTime? ConfirmTime { get; set; } |
|||
#endregion
|
|||
|
|||
/// <summary>
|
|||
/// 线边仓调整申请单号
|
|||
/// </summary>
|
|||
[Display(Name = "线边仓调整申请单号")] |
|||
public string RequestNumber { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 任务ID
|
|||
/// </summary>
|
|||
[Display(Name = "任务ID")] |
|||
public string JobNumber { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调拨类型
|
|||
/// </summary>
|
|||
[Display(Name = "调整类型")] |
|||
public string Type { get; set; } |
|||
|
|||
[Display(Name = "详情")] |
|||
public List<WipWarehouseAdjustNoteDetailInput> Details { get; set; } = new List<WipWarehouseAdjustNoteDetailInput>(); |
|||
} |
@ -0,0 +1,71 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using DocumentFormat.OpenXml.Drawing; |
|||
using Win_in.Sfs.Shared.Application.Contracts; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
public class WipWarehouseAdjustNoteImportInput : SfsStoreImportInputBase |
|||
{ |
|||
/// <summary>
|
|||
/// 调拨类型
|
|||
/// </summary>
|
|||
[Display(Name = "调拨类型")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
[ImporterHeader(Name = "调拨类型")] |
|||
[ExporterHeader(DisplayName = "调拨类型")] |
|||
[ValueMapping("区域内调拨(储位内移库)", EnumTransSubType.Transfer_Inside)] |
|||
public string Type { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 已确认
|
|||
/// </summary>
|
|||
[Display(Name = "已确认")] |
|||
[ImporterHeader(IsIgnore = true)] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public bool Confirmed { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 物料号
|
|||
/// </summary>
|
|||
[Display(Name = "物料号")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string ItemCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调拨数量
|
|||
/// </summary>
|
|||
[Display(Name = "调拨数量")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public decimal Qty { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调出库位
|
|||
/// </summary>
|
|||
[Display(Name = "调出库位")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string FromLocationCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调入库位
|
|||
/// </summary>
|
|||
[Display(Name = "调入库位")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string ToLocationCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 箱码
|
|||
/// </summary>
|
|||
[Display(Name = "箱码")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string PackingCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 状态
|
|||
/// </summary>
|
|||
[Display(Name = "状态")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public EnumInventoryStatus Status { get; set; } |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
public static class WipWarehouseAdjustNotePermissions |
|||
{ |
|||
public const string Default = StorePermissions.GroupName + "." + nameof(WipWarehouseAdjustNote); |
|||
public const string Create = Default + "." + StorePermissions.CreateStr; |
|||
public const string Update = Default + "." + StorePermissions.UpdateStr; |
|||
public const string Delete = Default + "." + StorePermissions.DeleteStr; |
|||
|
|||
public static void AddWipWarehouseAdjustNotePermission(this PermissionGroupDefinition permissionGroup) |
|||
{ |
|||
var WipWarehouseAdjustNotePermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(WipWarehouseAdjustNote))); |
|||
WipWarehouseAdjustNotePermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); |
|||
WipWarehouseAdjustNotePermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); |
|||
WipWarehouseAdjustNotePermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); |
|||
|
|||
} |
|||
} |
@ -0,0 +1,15 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
/// <summary>
|
|||
/// 线边调整-实体DTO
|
|||
/// </summary>
|
|||
public class WipWarehouseAdjustRequestDTO : SfsStoreRequestDTOBase<WipWarehouseAdjustRequestDetailDTO>, IHasNumber |
|||
{ |
|||
/// <summary>
|
|||
/// 调整类型
|
|||
/// </summary>
|
|||
[Display(Name = "调整类型")] |
|||
public string Type { get; set; } |
|||
} |
@ -0,0 +1,24 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
/// <summary>
|
|||
/// 线边调整-明细表
|
|||
/// </summary>
|
|||
public class WipWarehouseAdjustRequestDetailDTO : SfsStoreDetailWithFromToDTOBase |
|||
{ |
|||
/// <summary>
|
|||
/// 原因
|
|||
/// </summary>
|
|||
[Display(Name = "调整原因")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string Reason { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调整代码
|
|||
/// </summary>
|
|||
[Display(Name = "原因代码")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string ReasonCode { get; set; } |
|||
} |
@ -0,0 +1,7 @@ |
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
public interface IWipWarehouseAdjustRequestAppService |
|||
: ISfsStoreRequestMasterAppServiceBase<WipWarehouseAdjustRequestDTO, SfsStoreRequestInputBase, |
|||
WipWarehouseAdjustRequestEditInput, WipWarehouseAdjustRequestDetailDTO, SfsStoreRequestInputBase> |
|||
{ |
|||
} |
@ -0,0 +1,24 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
/// <summary>
|
|||
/// 库存转移记录-明细表
|
|||
/// </summary>
|
|||
public class WipWarehouseAdjustRequestDetailInput : SfsStoreDetailWithFromToInputBase |
|||
{ |
|||
/// <summary>
|
|||
/// 原因
|
|||
/// </summary>
|
|||
[Display(Name = "调整原因")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string Reason { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调整代码
|
|||
/// </summary>
|
|||
[Display(Name = "原因代码")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string ReasonCode { get; set; } |
|||
} |
@ -0,0 +1,26 @@ |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
/// <summary>
|
|||
/// 新增和更新基础DTO
|
|||
/// </summary>
|
|||
public class WipWarehouseAdjustRequestEditInput : SfsStoreRequestCreateOrUpdateInputBase |
|||
{ |
|||
#region Base
|
|||
|
|||
/// <summary>
|
|||
/// 调拨类型
|
|||
/// </summary>
|
|||
[Display(Name = "调整类型")] |
|||
public string Type { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 明细列表
|
|||
/// </summary>
|
|||
[Display(Name = "明细列表")] |
|||
public List<WipWarehouseAdjustRequestDetailInput> Details { get; set; } |
|||
|
|||
#endregion
|
|||
} |
@ -0,0 +1,54 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Shared.Application.Contracts; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
public class WipWarehouseAdjustRequestImportInput : SfsStoreImportInputBase |
|||
{ |
|||
/// <summary>
|
|||
/// 调整类型
|
|||
/// </summary>
|
|||
[Display(Name = "调整类型")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
[ImporterHeader(Name = "调整类型")] |
|||
[ExporterHeader(DisplayName = "调整类型")] |
|||
[ValueMapping("线边仓调整", EnumTransSubType.CountAdjust_WIP)] |
|||
public string Type { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 物品编号
|
|||
/// </summary>
|
|||
[Display(Name = "物料号")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string ItemCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调整数量
|
|||
/// </summary>
|
|||
[Display(Name = "调拨数量")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public decimal Qty { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调整库位
|
|||
/// </summary>
|
|||
[Display(Name = "调整库位")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string FromLocationCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 原因
|
|||
/// </summary>
|
|||
[Display(Name = "调整原因")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string Reason { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调整代码
|
|||
/// </summary>
|
|||
[Display(Name = "原因代码")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string ReasonCode { get; set; } |
|||
} |
@ -0,0 +1,24 @@ |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
public static class WipWarehouseAdjustRequestPermissions |
|||
{ |
|||
public const string Default = StorePermissions.GroupName + "." + nameof(WipWarehouseAdjustRequest); |
|||
public const string Create = Default + "." + StorePermissions.CreateStr; |
|||
public const string Update = Default + "." + StorePermissions.UpdateStr; |
|||
public const string Delete = Default + "." + StorePermissions.DeleteStr; |
|||
|
|||
public static void AddWipWarehouseAdjustRequestPermission(this PermissionGroupDefinition permissionGroup) |
|||
{ |
|||
var WipWarehouseAdjustRequestPermission = permissionGroup.AddPermission(Default, |
|||
StorePermissionDefinitionProvider.L(nameof(WipWarehouseAdjustRequest))); |
|||
WipWarehouseAdjustRequestPermission.AddChild(Create, |
|||
StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); |
|||
WipWarehouseAdjustRequestPermission.AddChild(Update, |
|||
StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); |
|||
WipWarehouseAdjustRequestPermission.AddChild(Delete, |
|||
StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); |
|||
} |
|||
} |
@ -0,0 +1,136 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Win_in.Sfs.Basedata.Application.Contracts; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
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; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application; |
|||
|
|||
/// <summary>
|
|||
/// 线边调整记录
|
|||
/// </summary>
|
|||
[Authorize] |
|||
[Route($"{StoreConsts.RootPath}wip-warehouse-adjust-note")] |
|||
public class WipWarehouseAdjustNoteAppService : SfsStoreWithDetailsAppServiceBase |
|||
<WipWarehouseAdjustNote, WipWarehouseAdjustNoteDTO, SfsStoreRequestInputBase, WipWarehouseAdjustNoteEditInput, WipWarehouseAdjustNoteDetail, |
|||
WipWarehouseAdjustNoteDetailDTO, SfsStoreRequestInputBase, WipWarehouseAdjustNoteImportInput>, |
|||
IWipWarehouseAdjustNoteAppService |
|||
{ |
|||
private readonly IWipWarehouseAdjustNoteManager _WipWarehouseAdjustNoteManager; |
|||
private readonly IBalanceAppService _balanceAppService; |
|||
private readonly ILocationAppService _locationAppService; |
|||
|
|||
public WipWarehouseAdjustNoteAppService( |
|||
IWipWarehouseAdjustNoteRepository repository, |
|||
IWipWarehouseAdjustNoteManager WipWarehouseAdjustNoteManager, |
|||
IBalanceAppService balanceAppService, |
|||
ILocationAppService locationAppService) : base(repository) |
|||
{ |
|||
_WipWarehouseAdjustNoteManager = WipWarehouseAdjustNoteManager; |
|||
_balanceAppService = balanceAppService; |
|||
_locationAppService = locationAppService; |
|||
} |
|||
|
|||
#region 东阳使用
|
|||
|
|||
/// <summary>
|
|||
/// 用来重写 导入数据时可以加工数据
|
|||
/// </summary>
|
|||
/// <param name="dictionary"></param>
|
|||
/// <returns></returns>
|
|||
protected override async Task<Dictionary<WipWarehouseAdjustNote, EntityState>> ImportProcessingEntityAsync( |
|||
Dictionary<WipWarehouseAdjustNote, EntityState> dictionary) |
|||
{ |
|||
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); |
|||
|
|||
foreach (var WipWarehouseAdjustNote in addList) |
|||
{ |
|||
if (WipWarehouseAdjustNote.Type == EnumTransSubType.Transfer_Inside.GetDisplayName()) //储位内调拨
|
|||
{ |
|||
WipWarehouseAdjustNote.Type = EnumTransSubType.Transfer_Inside.ToString();//重点 需要转换
|
|||
foreach (var detail in WipWarehouseAdjustNote.Details) |
|||
{ |
|||
var balanceDto = await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode, |
|||
detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false); |
|||
var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); |
|||
|
|||
detail.ItemCode = balanceDto.ItemCode; |
|||
detail.ArriveDate = balanceDto.ArriveDate; |
|||
detail.ItemDesc1 = balanceDto.ItemDesc1; |
|||
detail.ItemDesc2 = balanceDto.ItemDesc2; |
|||
detail.ItemName = balanceDto.ItemName; |
|||
detail.ProduceDate = balanceDto.ProduceDate; |
|||
detail.Qty = balanceDto.Qty; |
|||
detail.Uom = balanceDto.Uom; |
|||
detail.ExpireDate = balanceDto.ExpireDate; |
|||
detail.StdPackQty = balanceDto.StdPackQty; |
|||
detail.SupplierBatch = balanceDto.SupplierBatch; |
|||
|
|||
detail.FromLocationArea = balanceDto.LocationArea; |
|||
detail.FromContainerCode = balanceDto.ContainerCode; |
|||
detail.FromLocationErpCode = balanceDto.LocationErpCode; |
|||
detail.FromLocationGroup = balanceDto.LocationGroup; |
|||
detail.FromPackingCode = balanceDto.PackingCode; |
|||
detail.FromLocationArea = balanceDto.LocationArea; |
|||
detail.FromStatus = balanceDto.Status; |
|||
detail.FromWarehouseCode = balanceDto.WarehouseCode; |
|||
detail.FromLot = balanceDto.Lot; |
|||
|
|||
detail.ToLocationArea = toLocationDto.AreaCode; |
|||
detail.ToLocationErpCode = toLocationDto.LocationGroupCode; |
|||
detail.ToLocationGroup = toLocationDto.LocationGroupCode; |
|||
detail.ToWarehouseCode = toLocationDto.WarehouseCode; |
|||
detail.ToContainerCode = balanceDto.ContainerCode; |
|||
detail.ToPackingCode = balanceDto.PackingCode; |
|||
detail.ToLocationArea = balanceDto.LocationArea; |
|||
detail.ToStatus = balanceDto.Status; |
|||
detail.ToLot = balanceDto.Lot; |
|||
} |
|||
} |
|||
} |
|||
|
|||
return dictionary; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 确认对应的记录单
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("confirm/{id}")] |
|||
public virtual async Task<WipWarehouseAdjustNoteDTO> ConfirmAsync(Guid id) |
|||
{ |
|||
var entity = await _WipWarehouseAdjustNoteManager.ConfirmAsync(id).ConfigureAwait(false); |
|||
var dto = ObjectMapper.Map<WipWarehouseAdjustNote, WipWarehouseAdjustNoteDTO>(entity); |
|||
return dto; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 新增实体
|
|||
/// </summary>
|
|||
/// <param name="input">CreateInput</param>
|
|||
[HttpPost("")] |
|||
public override async Task<WipWarehouseAdjustNoteDTO> CreateAsync(WipWarehouseAdjustNoteEditInput input) |
|||
{ |
|||
var entity = ObjectMapper.Map<WipWarehouseAdjustNoteEditInput, WipWarehouseAdjustNote>(input); |
|||
|
|||
entity=await _WipWarehouseAdjustNoteManager.CreateAsync(entity).ConfigureAwait(false); |
|||
|
|||
var dto = ObjectMapper.Map<WipWarehouseAdjustNote, WipWarehouseAdjustNoteDTO>(entity); |
|||
|
|||
return dto; |
|||
} |
|||
|
|||
#endregion
|
|||
} |
@ -0,0 +1,88 @@ |
|||
using AutoMapper; |
|||
using Volo.Abp.AutoMapper; |
|||
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
using Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application; |
|||
|
|||
public partial class StoreApplicationAutoMapperProfile : Profile |
|||
{ |
|||
private void WipWarehouseAdjustNoteMapperProfile() |
|||
{ |
|||
CreateMap<WipWarehouseAdjustNote, WipWarehouseAdjustNoteDTO>() |
|||
.ReverseMap(); |
|||
|
|||
CreateMap<WipWarehouseAdjustNoteEditInput, WipWarehouseAdjustNote>() |
|||
.IgnoreAuditedObjectProperties() |
|||
; |
|||
|
|||
CreateMap<WipWarehouseAdjustNoteDetailInput, WipWarehouseAdjustNoteDetail>() |
|||
.IgnoreAuditedObjectProperties() |
|||
; |
|||
|
|||
CreateMap<WipWarehouseAdjustNoteDetailDTO, WipWarehouseAdjustNoteDetail>(); |
|||
|
|||
CreateMap<WipWarehouseAdjustNoteDetail, WipWarehouseAdjustNoteDetailDTO>(); |
|||
|
|||
CreateMap<WipWarehouseAdjustNoteEditInput, WipWarehouseAdjustNote>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x => x.Id) |
|||
.Ignore(x => x.ExtraProperties) |
|||
.Ignore(x => x.Remark) |
|||
.Ignore(x => x.TenantId) |
|||
.Ignore(x => x.ConcurrencyStamp) |
|||
; |
|||
|
|||
CreateMap<WipWarehouseAdjustNoteDetailInput, WipWarehouseAdjustNoteDetail>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x => x.MasterID) |
|||
.Ignore(x => x.TenantId) |
|||
.Ignore(x => x.Number) |
|||
.Ignore(x => x.Id); |
|||
|
|||
CreateMap<WipWarehouseAdjustNoteImportInput, WipWarehouseAdjustNote>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x => x.ConfirmTime) |
|||
.Ignore(x => x.RequestNumber) |
|||
.Ignore(x => x.JobNumber) |
|||
.Ignore(x => x.ActiveDate) |
|||
.Ignore(x => x.Remark) |
|||
.Ignore(x => x.ExtraProperties) |
|||
.Ignore(x => x.ConcurrencyStamp) |
|||
.Ignore(x => x.Details) |
|||
.Ignore(x => x.TenantId) |
|||
.Ignore(x => x.Number) |
|||
.Ignore(x => x.Id); |
|||
|
|||
CreateMap<WipWarehouseAdjustNoteImportInput, WipWarehouseAdjustNoteDetail>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.ForMember(x => x.ToPackingCode, y => y.MapFrom(d => d.PackingCode)) |
|||
.ForMember(x => x.FromPackingCode, y => y.MapFrom(d => d.PackingCode)) |
|||
.ForMember(x => x.FromStatus, y => y.MapFrom(d => d.Status)) |
|||
.ForMember(x => x.ToStatus, y => y.MapFrom(d => d.Status)) |
|||
.Ignore(x => x.FromLocationGroup) |
|||
.Ignore(x => x.FromLocationArea) |
|||
.Ignore(x => x.FromLocationErpCode) |
|||
.Ignore(x => x.FromWarehouseCode) |
|||
.Ignore(x => x.ToLocationArea) |
|||
.Ignore(x => x.ToLocationGroup) |
|||
.Ignore(x => x.ToLocationErpCode) |
|||
.Ignore(x => x.ToWarehouseCode) |
|||
.Ignore(x => x.Reason) |
|||
.Ignore(x => x.SupplierBatch).Ignore(x => x.ArriveDate).Ignore(x => x.ProduceDate).Ignore(x => x.ExpireDate) |
|||
.Ignore(x => x.Remark) |
|||
.Ignore(x => x.ItemName) |
|||
.Ignore(x => x.ItemDesc1) |
|||
.Ignore(x => x.ItemDesc2) |
|||
.Ignore(x => x.FromContainerCode) |
|||
.Ignore(x => x.ToContainerCode) |
|||
.Ignore(x => x.FromLot) |
|||
.Ignore(x => x.ToLot) |
|||
.Ignore(x => x.StdPackQty) |
|||
.Ignore(x => x.Uom) |
|||
.Ignore(x => x.MasterID) |
|||
.Ignore(x => x.TenantId) |
|||
.Ignore(x => x.Number) |
|||
.Ignore(x => x.Id); |
|||
} |
|||
} |
@ -0,0 +1,148 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Domain.Entities; |
|||
using Volo.Abp.ObjectMapping; |
|||
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.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; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application; |
|||
|
|||
/// <summary>
|
|||
/// 调拨转移记录
|
|||
/// </summary>
|
|||
[Authorize] |
|||
[Route($"{StoreConsts.RootPath}wip-warehouse-adjust-request")] |
|||
public class WipWarehouseAdjustRequestAppService : SfsStoreRequestAppServiceBase |
|||
<WipWarehouseAdjustRequest, |
|||
WipWarehouseAdjustRequestDTO, |
|||
SfsStoreRequestInputBase, |
|||
WipWarehouseAdjustRequestEditInput, |
|||
WipWarehouseAdjustRequestDetail, |
|||
WipWarehouseAdjustRequestDetailDTO, |
|||
SfsStoreRequestInputBase, |
|||
WipWarehouseAdjustRequestImportInput>, |
|||
IWipWarehouseAdjustRequestAppService |
|||
{ |
|||
private readonly IWipWarehouseAdjustRequestManager _WipWarehouseAdjustRequestManager; |
|||
private readonly IBalanceAppService _balanceAppService; |
|||
private readonly ILocationAppService _locationAppService; |
|||
private readonly IItemBasicAppService _itemBasicAppService; |
|||
|
|||
public WipWarehouseAdjustRequestAppService( |
|||
IWipWarehouseAdjustRequestRepository repository, |
|||
IWipWarehouseAdjustRequestManager WipWarehouseAdjustRequestManager, |
|||
IBalanceAppService balanceAppService, |
|||
ILocationAppService locationAppService, |
|||
IItemBasicAppService itemBasicAppService) : base(repository, WipWarehouseAdjustRequestManager) |
|||
{ |
|||
_WipWarehouseAdjustRequestManager = WipWarehouseAdjustRequestManager; |
|||
_balanceAppService = balanceAppService; |
|||
_locationAppService = locationAppService; |
|||
_itemBasicAppService = itemBasicAppService; |
|||
} |
|||
|
|||
#region 东阳使用
|
|||
|
|||
/// <summary>
|
|||
/// 用来重写 导入数据时可以加工数据
|
|||
/// </summary>
|
|||
/// <param name="dictionary"></param>
|
|||
/// <returns></returns>
|
|||
protected override async Task<Dictionary<WipWarehouseAdjustRequest, EntityState>> ImportProcessingEntityAsync( |
|||
Dictionary<WipWarehouseAdjustRequest, EntityState> dictionary) |
|||
{ |
|||
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); |
|||
|
|||
foreach (var WipWarehouseAdjustRequest in addList) |
|||
{ |
|||
WipWarehouseAdjustRequest.Worker = CurrentUser.GetUserName(); |
|||
WipWarehouseAdjustRequest.CreatorId = CurrentUser.Id; |
|||
|
|||
await SetEntityPropertiesAsync(WipWarehouseAdjustRequest, EnumTransSubType.CountAdjust_WIP).ConfigureAwait(false); |
|||
foreach (var detail in WipWarehouseAdjustRequest.Details) |
|||
{ |
|||
detail.ToLocationCode = detail.FromLocationCode;//调整库位一致
|
|||
|
|||
var itemBasicDto =await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
|||
var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode) |
|||
.ConfigureAwait(false); |
|||
var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.FromLocationCode) |
|||
.ConfigureAwait(false); |
|||
|
|||
detail.ItemCode = itemBasicDto.Code; |
|||
detail.ItemDesc1 = itemBasicDto.Desc1; |
|||
detail.ItemDesc2 = itemBasicDto.Desc2; |
|||
detail.ItemName = itemBasicDto.Name; |
|||
|
|||
detail.Uom = itemBasicDto.BasicUom; |
|||
detail.StdPackQty = itemBasicDto.StdPackQty; |
|||
|
|||
detail.Qty = detail.Qty; |
|||
|
|||
detail.FromLocationErpCode = fromLocationDto.ErpLocationCode; |
|||
detail.FromLocationGroup = fromLocationDto.LocationGroupCode; |
|||
detail.FromLocationArea = fromLocationDto.AreaCode; |
|||
detail.FromWarehouseCode = fromLocationDto.WarehouseCode; |
|||
|
|||
detail.ToLocationErpCode = toLocationDto.ErpLocationCode; |
|||
detail.ToLocationGroup = toLocationDto.LocationGroupCode; |
|||
detail.ToLocationArea = toLocationDto.AreaCode; |
|||
detail.ToWarehouseCode = toLocationDto.WarehouseCode; |
|||
|
|||
detail.FromPackingCode = string.Empty; |
|||
detail.FromContainerCode = string.Empty; |
|||
detail.ToPackingCode = string.Empty; |
|||
detail.ToContainerCode = string.Empty; |
|||
detail.FromStatus = EnumInventoryStatus.OK; |
|||
detail.ToStatus = EnumInventoryStatus.OK; |
|||
detail.FromLot = string.Empty; |
|||
detail.ToLot = string.Empty; |
|||
} |
|||
} |
|||
|
|||
return dictionary; |
|||
} |
|||
|
|||
private async Task SetEntityPropertiesAsync(WipWarehouseAdjustRequest entity, EnumTransSubType subType) |
|||
{ |
|||
var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Adjust, subType) |
|||
.ConfigureAwait(false); |
|||
entity.Worker = CurrentUser.GetUserName(); |
|||
|
|||
entity.AutoCompleteJob = tranType.AutoCompleteJob; |
|||
entity.AutoSubmit = tranType.AutoSubmitRequest; |
|||
entity.AutoAgree = tranType.AutoAgreeRequest; |
|||
entity.AutoHandle = tranType.AutoHandleRequest; |
|||
entity.DirectCreateNote = tranType.DirectCreateNote; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 新增实体
|
|||
/// </summary>
|
|||
/// <param name="input">CreateInput</param>
|
|||
public override async Task<WipWarehouseAdjustRequestDTO> CreateAsync(WipWarehouseAdjustRequestEditInput input) |
|||
{ |
|||
var entity = ObjectMapper.Map<WipWarehouseAdjustRequestEditInput, WipWarehouseAdjustRequest>(input); |
|||
|
|||
await _WipWarehouseAdjustRequestManager.CreateAsync(entity).ConfigureAwait(false); |
|||
|
|||
var dto = ObjectMapper.Map<WipWarehouseAdjustRequest, WipWarehouseAdjustRequestDTO>(entity); |
|||
return dto; |
|||
} |
|||
|
|||
#endregion
|
|||
} |
@ -0,0 +1,77 @@ |
|||
using AutoMapper; |
|||
using Volo.Abp.AutoMapper; |
|||
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
using Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application; |
|||
|
|||
public partial class StoreApplicationAutoMapperProfile : Profile |
|||
{ |
|||
private void WipWarehouseAdjustRequestMapperProfile() |
|||
{ |
|||
CreateMap<WipWarehouseAdjustRequest, WipWarehouseAdjustRequestDTO>() |
|||
.ReverseMap(); |
|||
|
|||
CreateMap<WipWarehouseAdjustRequestDetailDTO, WipWarehouseAdjustRequestDetail>(); |
|||
|
|||
CreateMap<WipWarehouseAdjustRequestDetail, WipWarehouseAdjustRequestDetailDTO>(); |
|||
|
|||
CreateMap<WipWarehouseAdjustRequestDetailInput, WipWarehouseAdjustRequestDetail>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x => x.MasterID) |
|||
.Ignore(x => x.TenantId) |
|||
.Ignore(x => x.Number) |
|||
.Ignore(x => x.Id); |
|||
|
|||
CreateMap<WipWarehouseAdjustRequestImportInput, WipWarehouseAdjustRequest>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x => x.ActiveDate) |
|||
.Ignore(x => x.Remark) |
|||
.Ignore(x => x.ExtraProperties) |
|||
.Ignore(x => x.ConcurrencyStamp) |
|||
.Ignore(x => x.RequestStatus) |
|||
.Ignore(x => x.Details) |
|||
.Ignore(x => x.TenantId) |
|||
.Ignore(x => x.Number) |
|||
.Ignore(x => x.Id); |
|||
|
|||
CreateMap<WipWarehouseAdjustRequestImportInput, WipWarehouseAdjustRequestDetail>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x=>x.ToPackingCode) |
|||
.Ignore(x => x.FromPackingCode) |
|||
.Ignore(x => x.FromStatus) |
|||
.Ignore(x => x.ToStatus) |
|||
.Ignore(x => x.FromLocationGroup) |
|||
.Ignore(x => x.FromLocationArea) |
|||
.Ignore(x => x.FromLocationErpCode) |
|||
.Ignore(x => x.FromWarehouseCode) |
|||
.Ignore(x => x.ToLocationArea) |
|||
.Ignore(x => x.ToLocationGroup) |
|||
.Ignore(x => x.ToLocationErpCode) |
|||
.Ignore(x => x.ToWarehouseCode) |
|||
.Ignore(x => x.SupplierBatch).Ignore(x => x.ArriveDate).Ignore(x => x.ProduceDate).Ignore(x => x.ExpireDate) |
|||
.Ignore(x => x.Remark) |
|||
.Ignore(x => x.ItemName) |
|||
.Ignore(x => x.ItemDesc1) |
|||
.Ignore(x => x.ItemDesc2) |
|||
.Ignore(x => x.FromContainerCode) |
|||
.Ignore(x => x.ToContainerCode) |
|||
.Ignore(x => x.FromLot) |
|||
.Ignore(x => x.ToLot) |
|||
.Ignore(x => x.StdPackQty) |
|||
.Ignore(x => x.Uom) |
|||
.Ignore(x => x.MasterID) |
|||
.Ignore(x => x.TenantId) |
|||
.Ignore(x => x.Number) |
|||
.Ignore(x => x.Id); |
|||
|
|||
CreateMap<WipWarehouseAdjustRequestEditInput, WipWarehouseAdjustRequest>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x => x.Id) |
|||
.Ignore(x => x.Number) |
|||
.Ignore(x => x.ExtraProperties) |
|||
.Ignore(x => x.Remark) |
|||
.Ignore(x => x.TenantId) |
|||
; |
|||
} |
|||
} |
@ -0,0 +1,11 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
public interface IWipWarehouseAdjustNoteManager : |
|||
ISfsStoreManager<WipWarehouseAdjustNote, WipWarehouseAdjustNoteDetail>, IBulkImportService<WipWarehouseAdjustNote> |
|||
{ |
|||
Task<WipWarehouseAdjustNote> ConfirmAsync(Guid id); |
|||
} |
@ -0,0 +1,8 @@ |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
public interface IWipWarehouseAdjustNoteRepository : ISfsStoreRepositoryBase<WipWarehouseAdjustNote>, |
|||
ISfsBulkRepositoryBase<WipWarehouseAdjustNote> |
|||
{ |
|||
} |
@ -0,0 +1,65 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Volo.Abp; |
|||
using Win_in.Sfs.Shared.Domain.Entities; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
/// <summary>
|
|||
/// 盘点差异调整记录
|
|||
/// </summary>
|
|||
public class WipWarehouseAdjustNote : SfsStoreAggregateRootBase<WipWarehouseAdjustNoteDetail>, IHasJobNumber |
|||
{ |
|||
/// <summary>
|
|||
/// 调整类型
|
|||
/// </summary>
|
|||
[Display(Name = "调整类型")] |
|||
public string Type { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 任务ID
|
|||
/// </summary>
|
|||
[IgnoreUpdate] |
|||
public string RequestNumber { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 任务ID
|
|||
/// </summary>
|
|||
[IgnoreUpdate] |
|||
public string JobNumber { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 明细列表
|
|||
/// </summary>
|
|||
[IgnoreUpdate] |
|||
public override List<WipWarehouseAdjustNoteDetail> Details { get; set; } = new(); |
|||
|
|||
/// <summary>
|
|||
/// 已确认
|
|||
/// </summary>
|
|||
[Display(Name = "已确认")] |
|||
public bool Confirmed { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 确认时间
|
|||
/// </summary>
|
|||
[Display(Name = "确认时间")] |
|||
[IgnoreUpdate] |
|||
public DateTime? ConfirmTime { get; set; } |
|||
|
|||
public void Confirm(DateTime confirmTime) |
|||
{ |
|||
CheckStatus(Confirmed); |
|||
Confirmed = true; |
|||
ConfirmTime = confirmTime; |
|||
} |
|||
|
|||
private static void CheckStatus(bool confirmed) |
|||
{ |
|||
if (confirmed) |
|||
{ |
|||
throw new UserFriendlyException("当前状态为 【已确认】 ,无法再次确认!"); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,24 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
/// <summary>
|
|||
/// 盘点差异调整记录-明细表
|
|||
/// </summary>
|
|||
public class WipWarehouseAdjustNoteDetail : SfsStoreDetailWithFromToEntityBase |
|||
{ |
|||
/// <summary>
|
|||
/// 原因
|
|||
/// </summary>
|
|||
[Display(Name = "调整原因")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string Reason { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调整代码
|
|||
/// </summary>
|
|||
[Display(Name = "原因代码")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string ReasonCode { get; set; } |
|||
} |
@ -0,0 +1,118 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.Logging; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Uow; |
|||
using Win_in.Sfs.Shared.Event; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
public class WipWarehouseAdjustNoteManager : SfsStoreManagerBase<WipWarehouseAdjustNote, WipWarehouseAdjustNoteDetail>, |
|||
IWipWarehouseAdjustNoteManager |
|||
{ |
|||
private readonly IWipWarehouseAdjustNoteRepository _repository; |
|||
|
|||
public WipWarehouseAdjustNoteManager( |
|||
IWipWarehouseAdjustNoteRepository repository |
|||
) : base(repository) |
|||
{ |
|||
_repository = repository; |
|||
} |
|||
|
|||
[UnitOfWork] |
|||
public virtual async Task<WipWarehouseAdjustNote> ConfirmAsync(Guid id) |
|||
{ |
|||
var entity = await Repository.FindAsync(id).ConfigureAwait(false); |
|||
Check.NotNull(entity, EntityClassName); |
|||
entity.Confirm(Clock.Now); |
|||
await PublishConfirmedAsync(entity).ConfigureAwait(false); |
|||
return await Repository.UpdateAsync(entity).ConfigureAwait(false); |
|||
} |
|||
|
|||
private async Task PublishConfirmedAsync(WipWarehouseAdjustNote entity) |
|||
{ |
|||
try |
|||
{ |
|||
await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData<WipWarehouseAdjustNote>(entity), false) |
|||
.ConfigureAwait(false); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
Logger.LogDebug($"{nameof(WipWarehouseAdjustNote)} Confirmed Event:{ex.Message}", null); |
|||
Console.WriteLine(ex.Source); |
|||
throw; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 执行导入
|
|||
/// </summary>
|
|||
public virtual async Task ImportDataAsync(List<WipWarehouseAdjustNote> mergeEntities, |
|||
List<WipWarehouseAdjustNote> deleteEntities = null) |
|||
{ |
|||
if (deleteEntities != null && deleteEntities.Count > 0) |
|||
{ |
|||
await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); |
|||
} |
|||
|
|||
foreach (var entity in mergeEntities) |
|||
{ |
|||
entity.SetIdAndNumberWithDetails(GuidGenerator, |
|||
await GenerateNumberAsync(nameof(WipWarehouseAdjustNote), Clock.Now).ConfigureAwait(false)); |
|||
} |
|||
|
|||
await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false); |
|||
|
|||
var insertDetails = new List<WipWarehouseAdjustNoteDetail>(); |
|||
|
|||
foreach (var item in mergeEntities) |
|||
{ |
|||
await SetDetailAsync(item.Details).ConfigureAwait(false); |
|||
|
|||
insertDetails.AddRange(item.Details); |
|||
} |
|||
|
|||
await _repository.BulkInsertAsync(insertDetails).ConfigureAwait(false); |
|||
} |
|||
|
|||
private async Task SetDetailAsync(List<WipWarehouseAdjustNoteDetail> details) |
|||
{ |
|||
foreach (var detail in details) |
|||
{ |
|||
var item = await ItemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
|||
Check.NotNull(item, "物品代码", $"物品 {detail.ItemCode} 不存在"); |
|||
|
|||
if (item != null) |
|||
{ |
|||
detail.ItemName = item.Name; |
|||
detail.ItemDesc1 = item.Desc1; |
|||
detail.ItemDesc2 = item.Desc2; |
|||
} |
|||
|
|||
var balance = await BalanceAppService.GetByItemLocationPackingAndStatusAsync(detail.FromPackingCode, |
|||
detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); |
|||
|
|||
Check.NotNull(balance, "库存", |
|||
$"不存在箱码为{detail.FromPackingCode},零件编码为{detail.ItemCode},库位为{detail.FromLocationCode},状态为{detail.FromStatus}的库存!"); |
|||
|
|||
detail.SupplierBatch = balance.SupplierBatch; |
|||
detail.ArriveDate = balance.ArriveDate; |
|||
detail.ProduceDate = balance.ProduceDate; |
|||
detail.ExpireDate = balance.ExpireDate; |
|||
|
|||
//通过箱码和库位获取库存信息
|
|||
detail.FromStatus = balance.Status; |
|||
|
|||
detail.FromLot = balance.Lot; |
|||
detail.FromWarehouseCode = balance.WarehouseCode; |
|||
detail.FromContainerCode = balance.ContainerCode; |
|||
|
|||
detail.ToLot = balance.Lot; |
|||
detail.ToWarehouseCode = balance.WarehouseCode; |
|||
detail.ToContainerCode = balance.ContainerCode; |
|||
|
|||
detail.ToStatus = balance.Status; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,9 @@ |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
public interface IWipWarehouseAdjustRequestManager : |
|||
ISfsStoreRequestManager<WipWarehouseAdjustRequest, WipWarehouseAdjustRequestDetail>, |
|||
IBulkImportService<WipWarehouseAdjustRequest> |
|||
{ |
|||
} |
@ -0,0 +1,9 @@ |
|||
using System; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Domain |
|||
{ |
|||
public interface IWipWarehouseAdjustRequestRepository : ISfsStoreRepositoryBase<WipWarehouseAdjustRequest>, ISfsBulkRepositoryBase<WipWarehouseAdjustRequest> |
|||
{ |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Shared.Domain.Entities; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
/// <summary>
|
|||
/// 调拨申请
|
|||
/// </summary>
|
|||
public class WipWarehouseAdjustRequest : SfsStoreRequestAggregateRootBase<WipWarehouseAdjustRequestDetail> |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 调整类型
|
|||
/// </summary>
|
|||
[Display(Name = "调整类型")] |
|||
public string Type { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 明细列表
|
|||
/// </summary>
|
|||
[IgnoreUpdate] |
|||
public override List<WipWarehouseAdjustRequestDetail> Details { get; set; } = new List<WipWarehouseAdjustRequestDetail>(); |
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Text.Json; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
/// <summary>
|
|||
/// 线边库存调整调整明细
|
|||
/// </summary>
|
|||
public class WipWarehouseAdjustRequestDetail : SfsStoreDetailWithFromToEntityBase |
|||
{ |
|||
/// <summary>
|
|||
/// 原因
|
|||
/// </summary>
|
|||
[Display(Name = "调整原因")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string Reason { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 调整代码
|
|||
/// </summary>
|
|||
[Display(Name = "原因代码")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string ReasonCode { get; set; } |
|||
|
|||
public override string ToString() |
|||
{ |
|||
return JsonSerializer.Serialize(this); |
|||
} |
|||
} |
@ -0,0 +1,80 @@ |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
public class WipWarehouseAdjustRequestManager : |
|||
SfsStoreRequestManagerBase<WipWarehouseAdjustRequest, WipWarehouseAdjustRequestDetail>, |
|||
IWipWarehouseAdjustRequestManager |
|||
{ |
|||
private readonly IWipWarehouseAdjustRequestRepository _repository; |
|||
|
|||
public WipWarehouseAdjustRequestManager( |
|||
IWipWarehouseAdjustRequestRepository repository |
|||
) : base(repository) |
|||
{ |
|||
_repository = repository; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 执行导入
|
|||
/// </summary>
|
|||
public virtual async Task ImportDataAsync(List<WipWarehouseAdjustRequest> WipWarehouseAdjustRequests, |
|||
List<WipWarehouseAdjustRequest> deleteEntities = null) |
|||
{ |
|||
if (deleteEntities != null && deleteEntities.Count > 0) |
|||
{ |
|||
await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); |
|||
} |
|||
|
|||
_ = new List<WipWarehouseAdjustRequestDetail>(); |
|||
|
|||
foreach (var item in WipWarehouseAdjustRequests) |
|||
{ |
|||
await BuildDetailAsync(item.Details).ConfigureAwait(false); |
|||
} |
|||
|
|||
await CreateManyAsync(WipWarehouseAdjustRequests).ConfigureAwait(false); |
|||
} |
|||
|
|||
private async Task BuildDetailAsync(List<WipWarehouseAdjustRequestDetail> details) |
|||
{ |
|||
foreach (var detail in details) |
|||
{ |
|||
var item = await ItemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
|||
Check.NotNull(item, "物品代码", $"物品 {detail.ItemCode} 不存在"); |
|||
|
|||
if (item != null) |
|||
{ |
|||
detail.ItemName = item.Name; |
|||
detail.ItemDesc1 = item.Desc1; |
|||
detail.ItemDesc2 = item.Desc2; |
|||
} |
|||
|
|||
var balance = await BalanceAppService.GetByItemLocationPackingAndStatusAsync(detail.FromPackingCode, |
|||
detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); |
|||
|
|||
Check.NotNull(balance, "库存", |
|||
$"不存在箱码为{detail.FromPackingCode},零件编码为{detail.ItemCode},库位为{detail.FromLocationCode},状态为{detail.FromStatus}的库存!"); |
|||
|
|||
detail.SupplierBatch = balance.SupplierBatch; |
|||
detail.ArriveDate = balance.ArriveDate; |
|||
detail.ProduceDate = balance.ProduceDate; |
|||
detail.ExpireDate = balance.ExpireDate; |
|||
|
|||
//通过箱码和库位获取库存信息
|
|||
detail.FromStatus = balance.Status; |
|||
|
|||
detail.FromLot = balance.Lot; |
|||
detail.FromWarehouseCode = balance.WarehouseCode; |
|||
detail.FromContainerCode = balance.ContainerCode; |
|||
|
|||
detail.ToLot = balance.Lot; |
|||
detail.ToWarehouseCode = balance.WarehouseCode; |
|||
detail.ToContainerCode = balance.ContainerCode; |
|||
|
|||
detail.ToStatus = balance.Status; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,52 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore.Modeling; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; |
|||
|
|||
public static class WipWarehouseAdjustNoteDbContextModelCreatingExtensions |
|||
{ |
|||
public static void ConfigureWipWarehouseAdjustNote(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) |
|||
{ |
|||
builder.Entity<WipWarehouseAdjustNote>(b => |
|||
{ |
|||
//Configure table & schema name
|
|||
b.ToTable(options.TablePrefix + nameof(WipWarehouseAdjustNote), options.Schema); |
|||
//Configure ABP properties
|
|||
b.ConfigureByConvention(); |
|||
//Configure Sfs base properties
|
|||
b.ConfigureSfsStoreBase(); |
|||
//Properties
|
|||
b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength); |
|||
|
|||
//Relations
|
|||
b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); |
|||
|
|||
//Indexes
|
|||
b.HasIndex(q => new { q.Number }).IsUnique(); |
|||
}); |
|||
|
|||
builder.Entity<WipWarehouseAdjustNoteDetail>(b => |
|||
{ |
|||
//Configure table & schema name
|
|||
b.ToTable(options.TablePrefix + nameof(WipWarehouseAdjustNoteDetail), options.Schema); |
|||
//Configure ABP properties
|
|||
b.ConfigureByConvention(); |
|||
//Configure Sfs base properties
|
|||
b.ConfigureSfsStoreBase(); |
|||
//Configure Sfs store detail properties
|
|||
b.ConfigureSfsStoreDetailBase(); |
|||
|
|||
//Properties
|
|||
b.Property(q => q.Reason).HasMaxLength(SfsPropertyConst.CodeLength); |
|||
b.Property(q => q.FromStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
|||
b.Property(q => q.ToStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
|||
|
|||
//Relations
|
|||
|
|||
//Indexes
|
|||
b.HasIndex(q => new { q.Number, q.FromPackingCode, q.FromLocationCode, q.ToLocationCode, q.FromStatus, q.ToStatus }).IsUnique(); |
|||
}); |
|||
} |
|||
} |
@ -0,0 +1,11 @@ |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; |
|||
|
|||
public class WipWarehouseAdjustNoteEfCoreRepository : SfsStoreEfCoreRepositoryBase<StoreDbContext, WipWarehouseAdjustNote>, IWipWarehouseAdjustNoteRepository |
|||
{ |
|||
public WipWarehouseAdjustNoteEfCoreRepository(IDbContextProvider<StoreDbContext> dbContextProvider) : base(dbContextProvider) |
|||
{ |
|||
} |
|||
} |
@ -0,0 +1,52 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore.Modeling; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; |
|||
|
|||
public static class WipWarehouseAdjustRequestDbContextModelCreatingExtensions |
|||
{ |
|||
public static void ConfigureWipWarehouseAdjustRequest(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) |
|||
{ |
|||
builder.Entity<WipWarehouseAdjustRequest>(b => |
|||
{ |
|||
//Configure table & schema name
|
|||
b.ToTable(options.TablePrefix + nameof(WipWarehouseAdjustRequest), options.Schema); |
|||
//Configure ABP properties
|
|||
b.ConfigureByConvention(); |
|||
//Configure Sfs base properties
|
|||
b.ConfigureSfsStoreBase(); |
|||
//Properties
|
|||
b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength); |
|||
b.Property(q => q.RequestStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
|||
|
|||
//Relations
|
|||
b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); |
|||
|
|||
//Indexes
|
|||
b.HasIndex(q => new { q.Number }).IsUnique(); |
|||
}); |
|||
|
|||
builder.Entity<WipWarehouseAdjustRequestDetail>(b => |
|||
{ |
|||
//Configure table & schema name
|
|||
b.ToTable(options.TablePrefix + nameof(WipWarehouseAdjustRequestDetail), options.Schema); |
|||
//Configure ABP properties
|
|||
b.ConfigureByConvention(); |
|||
//Configure Sfs base properties
|
|||
b.ConfigureSfsStoreBase(); |
|||
//Configure Sfs store detail properties
|
|||
b.ConfigureSfsStoreDetailBase(); |
|||
|
|||
//Properties
|
|||
b.Property(q => q.FromStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
|||
b.Property(q => q.ToStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
|||
|
|||
//Relations
|
|||
|
|||
//Indexes
|
|||
|
|||
}); |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; |
|||
|
|||
public class WipWarehouseAdjustRequestEfCoreRepository : |
|||
SfsStoreEfCoreRepositoryBase<StoreDbContext, WipWarehouseAdjustRequest>, IWipWarehouseAdjustRequestRepository |
|||
{ |
|||
public WipWarehouseAdjustRequestEfCoreRepository(IDbContextProvider<StoreDbContext> dbContextProvider) : base( |
|||
dbContextProvider) |
|||
{ |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
using System; |
|||
using AutoMapper; |
|||
using Volo.Abp.AutoMapper; |
|||
using Win_in.Sfs.Shared.Application; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
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 WipWarehouseAdjustNoteAutoMapperProfile() |
|||
{ |
|||
CreateMap<WipWarehouseAdjustNoteDetail, TransferLogEditInput>() |
|||
.Ignore(x => x.ExtraProperties) |
|||
.Ignore(x => x.DocNumber) |
|||
.Ignore(x => x.JobNumber) |
|||
.Ignore(x => x.Worker) |
|||
.Ignore(x => x.TransType) |
|||
.Ignore(x => x.TransSubType) |
|||
; |
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,24 @@ |
|||
using AutoMapper; |
|||
using Volo.Abp.AutoMapper; |
|||
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 WipWarehouseAdjustRequestAutoMapperProfile() |
|||
{ |
|||
CreateMap<WipWarehouseAdjustRequest, WipWarehouseAdjustNoteEditInput>() |
|||
.IgnoreAllPropertiesWithAnInaccessibleSetter() |
|||
.ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.Number)) |
|||
.Ignore(x => x.JobNumber) |
|||
.Ignore(x => x.Confirmed) |
|||
.Ignore(x => x.ConfirmTime) |
|||
; |
|||
|
|||
CreateMap<WipWarehouseAdjustRequestDetail, WipWarehouseAdjustNoteDetailInput>() |
|||
.IgnoreAllPropertiesWithAnInaccessibleSetter() |
|||
; |
|||
} |
|||
} |
@ -0,0 +1,95 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using DocumentFormat.OpenXml.Bibliography; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Volo.Abp.Uow; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
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; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; |
|||
|
|||
public class WipWarehouseAdjustRequestEventHandler |
|||
: StoreEventHandlerBase |
|||
, ILocalEventHandler<SfsCreatedEntityEventData<WipWarehouseAdjustRequest>> |
|||
, ILocalEventHandler<SfsCreatedEntityEventData<List<WipWarehouseAdjustRequest>>> |
|||
, ILocalEventHandler<SfsHandledEntityEventData<WipWarehouseAdjustRequest>> |
|||
|
|||
{ |
|||
private readonly IWipWarehouseAdjustNoteAppService _wipWarehouseAdjustNoteAppService; |
|||
private readonly IWipWarehouseAdjustRequestManager _wipWarehouseAdjustRequestManager; |
|||
private readonly IBalanceAppService _balanceAppService; |
|||
|
|||
public WipWarehouseAdjustRequestEventHandler( |
|||
IWipWarehouseAdjustNoteAppService wipWarehouseAdjustNoteAppService, IBalanceAppService balanceAppService, IWipWarehouseAdjustRequestManager wipWarehouseAdjustRequestManager) |
|||
{ |
|||
_wipWarehouseAdjustNoteAppService = wipWarehouseAdjustNoteAppService; |
|||
_balanceAppService = balanceAppService; |
|||
_wipWarehouseAdjustRequestManager = wipWarehouseAdjustRequestManager; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 创建后
|
|||
/// </summary>
|
|||
/// <param name="eventData">Event data</param>
|
|||
public async Task HandleEventAsync(SfsCreatedEntityEventData<WipWarehouseAdjustRequest> eventData) |
|||
{ |
|||
var entity = eventData.Entity; |
|||
|
|||
if (entity.AutoSubmit) |
|||
{ |
|||
await _wipWarehouseAdjustRequestManager.SubmitAsync(entity).ConfigureAwait(false); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 批量创建后
|
|||
/// </summary>
|
|||
/// <param name="eventData">Event data</param>
|
|||
public async Task HandleEventAsync(SfsCreatedEntityEventData<List<WipWarehouseAdjustRequest>> eventData) |
|||
{ |
|||
var entitys = eventData.Entity; |
|||
|
|||
foreach (var entity in entitys) |
|||
{ |
|||
if (entity.AutoSubmit) |
|||
{ |
|||
await _wipWarehouseAdjustRequestManager.SubmitAsync(entity).ConfigureAwait(false); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 审批后
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsHandledEntityEventData<WipWarehouseAdjustRequest> eventData) |
|||
{ |
|||
var entity = eventData.Entity; |
|||
if (entity.DirectCreateNote) |
|||
{ |
|||
var note = await BuildCountAdjustNoteCreateInputAsync(entity).ConfigureAwait(false); |
|||
await _wipWarehouseAdjustNoteAppService.CreateAsync(note).ConfigureAwait(false); |
|||
} |
|||
} |
|||
|
|||
#region 私有
|
|||
|
|||
private async Task<WipWarehouseAdjustNoteEditInput> BuildCountAdjustNoteCreateInputAsync( |
|||
WipWarehouseAdjustRequest entity) |
|||
{ |
|||
var createInput = ObjectMapper.Map<WipWarehouseAdjustRequest, WipWarehouseAdjustNoteEditInput>(entity); |
|||
createInput.JobNumber = string.Empty; |
|||
createInput.RequestNumber = entity.Number; |
|||
createInput.ActiveDate = Clock.Now; |
|||
return createInput; |
|||
} |
|||
|
|||
#endregion
|
|||
} |
@ -0,0 +1,128 @@ |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.Uow; |
|||
using Win_in.Sfs.Basedata.Application.Contracts; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
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.Event.Transaction; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Event.BusinessNote; |
|||
|
|||
public class WipWarehouseAdjustNoteEventHandler |
|||
: StoreInventoryEventHandlerBase |
|||
, ILocalEventHandler<SfsCreatedEntityEventData<WipWarehouseAdjustNote>> |
|||
, ILocalEventHandler<SfsCreatedEntityEventData<List<WipWarehouseAdjustNote>>> |
|||
{ |
|||
private const EnumTransType TransType = EnumTransType.Adjust; |
|||
private const EnumTransSubType TransSubType = EnumTransSubType.CountAdjust_WIP; |
|||
|
|||
private readonly IWipWarehouseAdjustRequestAppService _wipWarehouseAdjustRequestApp; |
|||
private readonly IItemBasicAppService _itemBasicAppService; |
|||
|
|||
public WipWarehouseAdjustNoteEventHandler( |
|||
IWipWarehouseAdjustRequestAppService wipWarehouseAdjustRequestApp, IItemBasicAppService itemBasicAppService) |
|||
{ |
|||
_wipWarehouseAdjustRequestApp = wipWarehouseAdjustRequestApp; |
|||
_itemBasicAppService = itemBasicAppService; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 批量创建后
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<WipWarehouseAdjustNote>> eventData) |
|||
{ |
|||
var entities = eventData.Entity; |
|||
await AddTransactionsAsync(entities).ConfigureAwait(false); |
|||
|
|||
foreach (var entity in entities.Where(entity => !string.IsNullOrEmpty(entity.RequestNumber))) |
|||
{ |
|||
await _wipWarehouseAdjustRequestApp.CompleteByNumberAsync(entity.RequestNumber).ConfigureAwait(false); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 创建后
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<WipWarehouseAdjustNote> eventData) |
|||
{ |
|||
var entities = new List<WipWarehouseAdjustNote> { eventData.Entity }; |
|||
await AddTransactionsAsync(entities).ConfigureAwait(false); |
|||
|
|||
foreach (var entity in entities.Where(entity => !string.IsNullOrEmpty(entity.RequestNumber))) |
|||
{ |
|||
await _wipWarehouseAdjustRequestApp.CompleteByNumberAsync(entity.RequestNumber).ConfigureAwait(false); |
|||
} |
|||
} |
|||
|
|||
#region 库存操作
|
|||
|
|||
private async Task AddTransactionsAsync(List<WipWarehouseAdjustNote> countAdjustNotes) |
|||
{ |
|||
var transactions = new List<TransactionEditInput>(); |
|||
//如果要做库存事务汇总,可以修改此处
|
|||
foreach (var countAdjustNote in countAdjustNotes) |
|||
{ |
|||
transactions.AddRange(await BuildTransactions(countAdjustNote).ConfigureAwait(false)); |
|||
} |
|||
|
|||
await TransactionAppService.AddManyAsync(transactions).ConfigureAwait(false); |
|||
} |
|||
|
|||
private async Task<IEnumerable<TransactionEditInput>> BuildTransactions(WipWarehouseAdjustNote countAdjustNote) |
|||
{ |
|||
var transactions = new List<TransactionEditInput>(); |
|||
|
|||
foreach (var detail in countAdjustNote.Details) |
|||
{ |
|||
var itemBasicDto= await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
|||
|
|||
var transaction = new TransactionEditInput(); |
|||
|
|||
transaction.TransType = TransType; |
|||
transaction.TransSubType = TransSubType; |
|||
|
|||
transaction.TransInOut = detail.Qty > 0 ? EnumTransInOut.In : EnumTransInOut.Out; |
|||
|
|||
transaction.Worker = countAdjustNote.Worker; |
|||
transaction.DocNumber = countAdjustNote.Number; |
|||
transaction.JobNumber = string.Empty; |
|||
|
|||
transaction.ItemCode = detail.ItemCode; |
|||
transaction.ItemDesc1=detail.ItemDesc1; |
|||
transaction.ItemDesc2=detail.ItemDesc2; |
|||
transaction.ItemName = detail.ItemName; |
|||
transaction.StdPackQty = detail.StdPackQty; |
|||
transaction.DocNumber = detail.Number; |
|||
transaction.Uom=detail.Uom; |
|||
transaction.PackingCode = detail.ToPackingCode; |
|||
transaction.Lot = detail.ToLot; |
|||
transaction.Qty=detail.Qty; |
|||
transaction.Status = detail.ToStatus; |
|||
transaction.LocationCode = detail.ToLocationCode; |
|||
transaction.LocationGroup = detail.ToLocationGroup; |
|||
transaction.LocationArea = detail.ToLocationArea; |
|||
transaction.LocationErpCode = detail.ToLocationErpCode; |
|||
transaction.LocationCode=detail.ToLocationCode; |
|||
transaction.ContainerCode = detail.ToContainerCode; |
|||
transaction.ManageType = itemBasicDto.ManageType; |
|||
transaction.WarehouseCode = detail.ToWarehouseCode; |
|||
|
|||
transactions.Add(transaction); |
|||
} |
|||
|
|||
return transactions; |
|||
} |
|||
|
|||
#endregion
|
|||
} |
Loading…
Reference in new issue