60 changed files with 3428 additions and 0 deletions
@ -0,0 +1,46 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 三方库库移任务
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "三方库库移任务")] |
||||
|
public class ThirdLocationJobDTO : SfsJobDTOBase<ThirdLocationJobDetailDTO> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 叫料请求类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "叫料请求类型")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string RequestType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "生产线")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 要货申请单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "要货申请单号")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string RequestNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "车间")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Workshop { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 使用在途库
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "使用在途库")] |
||||
|
public bool UseOnTheWayLocation { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,112 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationJobDetailDTO : SfsJobRecommendFromDetailDTOBase, IHasToLocation |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 请求库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "请求库位")] |
||||
|
public string RequestLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到库位")] |
||||
|
public string ToLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库区
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到库区")] |
||||
|
public string ToLocationArea { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库位组
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到库位组")] |
||||
|
public string ToLocationGroup { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到ERP库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到ERP库位")] |
||||
|
public string ToLocationErpCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到仓库
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到仓库")] |
||||
|
public string ToWarehouseCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 在途库库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "在途库库位")] |
||||
|
public string OnTheWayLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "生产线")] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工作中心
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "工作中心")] |
||||
|
public string WorkStation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 过期时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "过期时间")] |
||||
|
public DateTime ExpiredTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工序
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "工序")] |
||||
|
public string Operation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 配送方式
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "配送方式")] |
||||
|
public EnumDistributionType DistributionType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 取整方式
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "取整方式")] |
||||
|
public EnumTruncType TruncType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 取整后数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "取整后数量")] |
||||
|
public decimal RoundedQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划拆分规则
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划拆分规则")] |
||||
|
public EnumPlannedSplitRule PlannedSplitRule { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划开始时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划开始时间")] |
||||
|
public DateTime PlanBeginTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 每次配送数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "每次配送数量")] |
||||
|
public decimal DeliveryQty { get; set; } |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public interface IThirdLocationJobAppService |
||||
|
: ISfsJobAppServiceBase<ThirdLocationJobDTO, SfsJobRequestInputBase, ThirdLocationJobCheckInput, ThirdLocationJobEditInput> |
||||
|
{ |
||||
|
Task<List<ThirdLocationJobDTO>> CheckJobExistByItemCodeAndLocationCode(string itemCode, string locationCode); |
||||
|
|
||||
|
Task CancelByMaterialRequestAsync(string thirdLocationNumber); |
||||
|
|
||||
|
Task<PagedResultDto<ThirdLocationJobDTO>> GetListByTypeAsync(SfsJobRequestInputBase requestInput, string requestType, |
||||
|
bool includeDetails = false, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
Task<List<ThirdLocationJobDTO>> GetByRequestNumberAsync(string requestNumber); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 保存拆箱时涉及的明细修改
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
Task<ThirdLocationJobDTO> SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input); |
||||
|
|
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationJobCheckInput : SfsJobCheckInputBase |
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,134 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationJobDetailInput : SfsJobRecommendFromDetailInputBase, IHasToLocation |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 请求库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "请求库位")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string RequestLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到库位")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ToLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库区
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到库区")] |
||||
|
public string ToLocationArea { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库位组
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到库位组")] |
||||
|
public string ToLocationGroup { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到ERP库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到ERP库位")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ToLocationErpCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到仓库
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到仓库")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ToWarehouseCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 在途库库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "在途库库位")] |
||||
|
public string OnTheWayLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "生产线")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工作中心
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "工作中心")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string WorkStation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 过期时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "过期时间")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public DateTime ExpiredTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工序
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "工序")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Operation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 配送方式
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "配送方式")] |
||||
|
public EnumDistributionType DistributionType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 取整方式
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "取整方式")] |
||||
|
public EnumTruncType TruncType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 取整后数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "取整后数量")] |
||||
|
public decimal RoundedQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划拆分规则
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划拆分规则")] |
||||
|
public EnumPlannedSplitRule PlannedSplitRule { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划开始时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划开始时间")] |
||||
|
public DateTime PlanBeginTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 每次配送数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "每次配送数量")] |
||||
|
public decimal DeliveryQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 位置码
|
||||
|
/// </summary>
|
||||
|
public string PositionCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 推荐类型
|
||||
|
/// </summary>
|
||||
|
public EnumRecommendType RecommendType { get; set; } |
||||
|
} |
@ -0,0 +1,82 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCreateInput<ThirdLocationJobDetailInput> |
||||
|
{ |
||||
|
#region Create
|
||||
|
/// <summary>
|
||||
|
/// 上游任务编号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "上游任务编号")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string UpStreamJobNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 要货单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "要货单号")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string RequestNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 叫料请求类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "叫料请求类型")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string RequestType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 任务类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "任务类型")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public EnumJobType JobType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否自动完成
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "是否自动完成")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public bool IsAutoComplete { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 过期时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "过期时间")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public DateTime ExpiredTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 任务明细
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "任务明细")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public List<ThirdLocationJobDetailInput> Details { get; set; } = new(); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "车间")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Workshop { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "生产线")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 使用在途库
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "使用在途库")] |
||||
|
public bool UseOnTheWayLocation { get; set; } |
||||
|
#endregion
|
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public static class ThirdLocationJobPermissions |
||||
|
{ |
||||
|
|
||||
|
public const string Default = StorePermissions.GroupName + "." + nameof(ThirdLocationJob); |
||||
|
public const string Create = Default + "." + StorePermissions.CreateStr; |
||||
|
public const string Update = Default + "." + StorePermissions.UpdateStr; |
||||
|
public const string Delete = Default + "." + StorePermissions.DeleteStr; |
||||
|
|
||||
|
//自动发料任务
|
||||
|
public const string AutoThirdLocationJob = StorePermissions.GroupName + "." + nameof(AutoThirdLocationJob); |
||||
|
|
||||
|
public static void AddThirdLocationJobPermission(this PermissionGroupDefinition permissionGroup) |
||||
|
{ |
||||
|
var thirdLocationJobPermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(ThirdLocationJob))); |
||||
|
thirdLocationJobPermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); |
||||
|
thirdLocationJobPermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); |
||||
|
thirdLocationJobPermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); |
||||
|
|
||||
|
permissionGroup.AddPermission(AutoThirdLocationJob, StorePermissionDefinitionProvider.L(nameof(AutoThirdLocationJob))); |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationNoteDTO : SfsStoreDTOBase<ThirdLocationNoteDetailDTO>, IHasJobNumber, IHasRequestNumber |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 任务ID
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "任务ID")] |
||||
|
public string JobNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "车间")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Workshop { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 请求代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "请求代码")] |
||||
|
public string RequestNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 叫料请求类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "叫料请求类型")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string RequestType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 使用在途库
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "使用在途库")] |
||||
|
public bool UseOnTheWayLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已确认
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "已确认")] |
||||
|
public bool Confirmed { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 确认时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "确认时间")] |
||||
|
public DateTime? ConfirmTime { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationNoteDetailDTO : SfsStoreRecommendFromDetailWithFromToDTOBase |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发料时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "发料时间")] |
||||
|
public DateTime IssueTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 过期时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "过期时间")] |
||||
|
public DateTime ExpiredTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "生产线")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工作中心
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "工作中心")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string WorkStation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 在途库库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "在途库库位")] |
||||
|
public string OnTheWayLocationCode { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public interface IThirdLocationNoteAppService : ISfsStoreMasterReadOnlyAppServiceBase<ThirdLocationNoteDTO, SfsStoreRequestInputBase, ThirdLocationNoteDetailDTO, SfsStoreRequestInputBase> |
||||
|
{ |
||||
|
Task<ThirdLocationNoteDTO> CreateAsync(ThirdLocationNoteEditInput input); |
||||
|
|
||||
|
Task<ThirdLocationNoteDTO> ConfirmAsync(Guid id); |
||||
|
|
||||
|
Task<ThirdLocationNoteDTO> ConfirmAsync(string number); |
||||
|
|
||||
|
Task<PagedResultDto<ThirdLocationNoteDTO>> GetListByTypeAsync(SfsStoreRequestInputBase requestInput, |
||||
|
string requestType, bool includeDetails = false, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
Task<List<ThirdLocationNoteDTO>> GetListUnConfirmedByTypeAsync(string requestType); |
||||
|
} |
@ -0,0 +1,53 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationNoteDetailInput : SfsStoreRecommendFromDetailWithFromToInputBase |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发料时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "发料时间")] |
||||
|
public DateTime IssueTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 过期时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "过期时间")] |
||||
|
public DateTime ExpiredTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "生产线")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工作中心
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "工作中心")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string WorkStation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 在途库库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "在途库库位")] |
||||
|
public string OnTheWayLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 位置码
|
||||
|
/// </summary>
|
||||
|
public string PositionCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 推荐类型
|
||||
|
/// </summary>
|
||||
|
public EnumRecommendType RecommendType { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,63 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationNoteEditInput : SfsStoreCreateOrUpdateInputBase |
||||
|
{ |
||||
|
#region Base
|
||||
|
/// <summary>
|
||||
|
/// 已确认
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "已确认")] |
||||
|
public bool Confirmed { get; set; } |
||||
|
#endregion
|
||||
|
|
||||
|
#region Create
|
||||
|
/// <summary>
|
||||
|
/// 发料记录号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "发料记录号")] |
||||
|
public string Number { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 任务ID
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "任务ID")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public string JobNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "车间")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Workshop { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 明细列表
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "明细列表")] |
||||
|
public List<ThirdLocationNoteDetailInput> Details { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 请求号码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "请求号码")] |
||||
|
public string RequestNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 叫料请求类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "叫料请求类型")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string RequestType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 使用在途库
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "使用在途库")] |
||||
|
public bool UseOnTheWayLocation { get; set; } |
||||
|
#endregion
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationNoteImportInput : SfsStoreImportInputBase, IHasJobNumber, IHasRequestNumber |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 任务ID
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "任务ID")] |
||||
|
public string JobNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "车间")] |
||||
|
public string Workshop { get; set; } |
||||
|
|
||||
|
public string RequestNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 叫料请求类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "叫料请求类型")] |
||||
|
public string RequestType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 使用在途库
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "使用在途库")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public bool UseOnTheWayLocation { get; set; } |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public static class ThirdLocationNotePermissions |
||||
|
{ |
||||
|
|
||||
|
public const string Default = StorePermissions.GroupName + "." + nameof(ThirdLocationNote); |
||||
|
public const string Create = Default + "." + StorePermissions.CreateStr; |
||||
|
public const string Update = Default + "." + StorePermissions.UpdateStr; |
||||
|
public const string Delete = Default + "." + StorePermissions.DeleteStr; |
||||
|
|
||||
|
//自动发料记录
|
||||
|
public const string AutoThirdLocationNote = StorePermissions.GroupName + "." + nameof(AutoThirdLocationNote); |
||||
|
|
||||
|
//直接发料
|
||||
|
public const string DirectThirdLocationNote = StorePermissions.GroupName + "." + nameof(DirectThirdLocationNote); |
||||
|
|
||||
|
public static void AddThirdLocationNotePermission(this PermissionGroupDefinition permissionGroup) |
||||
|
{ |
||||
|
var thirdLocationNotePermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(ThirdLocationNote))); |
||||
|
thirdLocationNotePermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); |
||||
|
thirdLocationNotePermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); |
||||
|
thirdLocationNotePermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); |
||||
|
|
||||
|
permissionGroup.AddPermission(AutoThirdLocationNote, StorePermissionDefinitionProvider.L(nameof(AutoThirdLocationNote))); |
||||
|
permissionGroup.AddPermission(DirectThirdLocationNote, StorePermissionDefinitionProvider.L(nameof(DirectThirdLocationNote))); |
||||
|
} |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationRequestDTO : SfsStoreRequestDTOBase<ThirdLocationRequestDetailDTO>, IHasNumber |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 叫料类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "叫料类型")] |
||||
|
public string Type { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "生产线")] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否使用在途库
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "是否使用在途库")] |
||||
|
public bool IsUseOnTheWayLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 可用来源库位Json集合
|
||||
|
/// </summary>
|
||||
|
public string FromLocationCodeJsonList { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 叫料库位
|
||||
|
/// </summary>
|
||||
|
public string ToLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 目标ERP储位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "目标ERP储位")] |
||||
|
public string ToLocationErpCode { get; set; } |
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationRequestDetailDTO : SfsStoreDetailWithQtyDTOBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 已发数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "已发数量")] |
||||
|
public decimal IssuedQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已收数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "已收数量")] |
||||
|
public decimal ReceivedQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 明细状态
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "明细状态")] |
||||
|
public EnumStatus Status { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 请求未发
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "请求未发")] |
||||
|
[NotMapped] |
||||
|
public decimal ToBeIssuedQty => Qty - IssuedQty; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已发未收
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "已发未收")] |
||||
|
[NotMapped] |
||||
|
public decimal ToBeReceivedQty => IssuedQty - ReceivedQty; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 请求未收
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "请求未收")] |
||||
|
[NotMapped] |
||||
|
public decimal NotFinishQty => Qty - ReceivedQty; |
||||
|
|
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public interface IThirdLocationRequestAppService |
||||
|
: ISfsStoreRequestMasterAppServiceBase<ThirdLocationRequestDTO, SfsStoreRequestInputBase, ThirdLocationRequestEditInput, ThirdLocationRequestDetailDTO, SfsStoreRequestInputBase> |
||||
|
|
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,85 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationRequestDetailInput : SfsStoreDetailWithQtyInputBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 目标库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "目标库位")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ToLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 来源库区
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "来源库区")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string FromLocationArea { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "生产线")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工作中心
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "工作中心")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string WorkStation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 过期时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "过期时间")] |
||||
|
public DateTime ExpiredTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 状态
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "状态")] |
||||
|
public EnumRequestStatus RequestStatus { get; set; } = EnumRequestStatus.New; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// ERP储位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "ERP储位")] |
||||
|
public string ToLocationErpCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已发数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "已发数量")] |
||||
|
public decimal IssuedQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已收数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "已收数量")] |
||||
|
public decimal ReceivedQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 明细状态
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "明细状态")] |
||||
|
public EnumStatus Status { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 位置码
|
||||
|
/// </summary>
|
||||
|
public string PositionCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 推荐类型
|
||||
|
/// </summary>
|
||||
|
public EnumRecommendType RecommendType { get; set; } |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationRequestEditInput : SfsStoreRequestCreateOrUpdateInputBase |
||||
|
{ |
||||
|
#region Base
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "生产线")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 使用在途库
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "使用在途库")] |
||||
|
public bool UseOnTheWayLocation { get; set; } |
||||
|
#endregion
|
||||
|
|
||||
|
#region Create
|
||||
|
/// <summary>
|
||||
|
/// 要货单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "要货单号")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Number { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 叫料类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "叫料类型")] |
||||
|
public string Type { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 明细列表
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "明细列表")] |
||||
|
public List<ThirdLocationRequestDetailInput> Details { get; set; } = new List<ThirdLocationRequestDetailInput>(); |
||||
|
#endregion
|
||||
|
} |
@ -0,0 +1,53 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
[Display(Name = "三方库叫料申请")] |
||||
|
public class ThirdLocationRequestImportInput : SfsStoreImportInputBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 叫料类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "叫料类型")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[ImporterHeader(Name = "叫料类型")] |
||||
|
[ExporterHeader(DisplayName = "叫料类型")] |
||||
|
[ValueMapping("人工拉动", EnumMaterialRequestType.Issue_Manual)] |
||||
|
public string Type { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 物品代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "物品代码")] |
||||
|
[Required] |
||||
|
public string ItemCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 目标库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "目标库位")] |
||||
|
[Required] |
||||
|
public string ToLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 来源库区
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "调出库区")] |
||||
|
[Required] |
||||
|
public string FromLocationArea { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "数量")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public decimal Qty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 备注
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "备注")] |
||||
|
public string Remark { get; set; } |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public static class ThirdLocationRequestPermissions |
||||
|
{ |
||||
|
|
||||
|
public const string Default = StorePermissions.GroupName + "." + nameof(ThirdLocationRequest); |
||||
|
public const string Create = Default + "." + StorePermissions.CreateStr; |
||||
|
public const string Update = Default + "." + StorePermissions.UpdateStr; |
||||
|
public const string Delete = Default + "." + StorePermissions.DeleteStr; |
||||
|
|
||||
|
//自动叫料申请
|
||||
|
public const string AutoThirdLocationRequest = StorePermissions.GroupName + "." + nameof(AutoThirdLocationRequest); |
||||
|
|
||||
|
public static void AddThirdLocationRequestPermission(this PermissionGroupDefinition permissionGroup) |
||||
|
{ |
||||
|
var thirdLocationRequestPermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(ThirdLocationRequest))); |
||||
|
thirdLocationRequestPermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); |
||||
|
thirdLocationRequestPermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); |
||||
|
thirdLocationRequestPermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); |
||||
|
|
||||
|
permissionGroup.AddPermission(AutoThirdLocationRequest, StorePermissionDefinitionProvider.L(nameof(AutoThirdLocationRequest))); |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,144 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Linq.Expressions; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.ObjectMapping; |
||||
|
using Win_in.Sfs.Basedata.Domain.Shared; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
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; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application; |
||||
|
|
||||
|
[Authorize] |
||||
|
[Route($"{StoreConsts.RootPath}third-location-job")] |
||||
|
public class ThirdLocationJobAppService |
||||
|
: SfsJobAppServiceBase<ThirdLocationJob, ThirdLocationJobDetail, ThirdLocationJobDTO, SfsJobRequestInputBase, ThirdLocationJobCheckInput, ThirdLocationJobEditInput>, |
||||
|
IThirdLocationJobAppService |
||||
|
{ |
||||
|
private readonly IThirdLocationJobManager _thirdLocationJobManager; |
||||
|
|
||||
|
public ThirdLocationJobAppService( |
||||
|
IThirdLocationJobRepository repository, IThirdLocationJobManager thirdLocationJobManager |
||||
|
) : base(repository, thirdLocationJobManager) |
||||
|
{ |
||||
|
_thirdLocationJobManager = thirdLocationJobManager; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据物品和库位 检查是否存在发料任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="itemCode"></param>
|
||||
|
/// <param name="locationCode"></param>
|
||||
|
/// <returns></returns>
|
||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||
|
[Authorize] |
||||
|
[HttpGet("check-job-exist")] |
||||
|
public virtual async Task<List<ThirdLocationJobDTO>> CheckJobExistByItemCodeAndLocationCode(string itemCode, |
||||
|
string locationCode) |
||||
|
{ |
||||
|
var entities = await _repository.GetListAsync(c => |
||||
|
c.Details.Any(p => |
||||
|
(p.ItemCode == itemCode && p.RecommendFromLocationCode == locationCode) || |
||||
|
(p.ItemCode == itemCode && p.ToLocationCode == locationCode)) |
||||
|
&& (c.JobStatus == EnumJobStatus.Open || c.JobStatus == EnumJobStatus.Doing), true).ConfigureAwait(false); |
||||
|
var dtos = ObjectMapper.Map<List<ThirdLocationJob>, List<ThirdLocationJobDTO>>(entities); |
||||
|
return dtos; |
||||
|
} |
||||
|
|
||||
|
[HttpPost("cancel-by-request/{assembleNumber}")] |
||||
|
public virtual async Task CancelByMaterialRequestAsync(string assembleNumber) |
||||
|
{ |
||||
|
var entities = await _repository.GetListAsync(p => p.RequestNumber == assembleNumber).ConfigureAwait(false); |
||||
|
foreach (var entity in entities) |
||||
|
{ |
||||
|
await _thirdLocationJobManager.CancelAsync(entity).ConfigureAwait(false); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
[HttpPost("invalid")] |
||||
|
public override async Task CancelAsync(Guid id) |
||||
|
{ |
||||
|
var thirdLocationJob = await _repository.GetAsync(id).ConfigureAwait(false); |
||||
|
if (thirdLocationJob == null) |
||||
|
{ |
||||
|
throw new UserFriendlyException($"未找到ID为 {id} 的任务"); |
||||
|
} |
||||
|
|
||||
|
await _thirdLocationJobManager.CancelAsync(thirdLocationJob).ConfigureAwait(false); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据叫料请求类型获取发料任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="requestInput"></param>
|
||||
|
/// <param name="requestType">
|
||||
|
/// 叫料请求类型:
|
||||
|
/// 人工拉动:Issue_Manual;
|
||||
|
/// 线边拉动:Issue_WIP;
|
||||
|
/// </param>
|
||||
|
/// <param name="includeDetails"></param>
|
||||
|
/// <param name="cancellationToken"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("by-type/{requestType}")] |
||||
|
public virtual async Task<PagedResultDto<ThirdLocationJobDTO>> GetListByTypeAsync(SfsJobRequestInputBase requestInput, |
||||
|
string requestType, bool includeDetails = false, CancellationToken cancellationToken = default) |
||||
|
{ |
||||
|
Expression<Func<ThirdLocationJob, bool>> expression = p => p.RequestType == requestType; |
||||
|
if (requestInput.Condition.Filters?.Count > 0) |
||||
|
{ |
||||
|
expression = expression.And(requestInput.Condition.Filters.ToLambda<ThirdLocationJob>()); |
||||
|
} |
||||
|
|
||||
|
return await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount, |
||||
|
requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
[HttpPost("by-request-number/{requestNumber}")] |
||||
|
public virtual async Task<List<ThirdLocationJobDTO>> GetByRequestNumberAsync(string requestNumber) |
||||
|
{ |
||||
|
var entitys = await _repository.GetListAsync(p => p.RequestNumber == requestNumber).ConfigureAwait(false); |
||||
|
return ObjectMapper.Map<List<ThirdLocationJob>, List<ThirdLocationJobDTO>>(entitys); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 保存拆箱时涉及的明细修改
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("save-detail-split-packing")] |
||||
|
public virtual async Task<ThirdLocationJobDTO> SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input) |
||||
|
{ |
||||
|
var job = await _repository.FindAsync(p => p.Number == input.Number).ConfigureAwait(false); |
||||
|
ThirdLocationJobDetail detail = job.Details.FirstOrDefault(p => p.RecommendPackingCode == input.FromPackingCode ); /*&& p.HandledQty == input.FromQty*/ |
||||
|
if (detail == null) |
||||
|
{ |
||||
|
//throw new UserFriendlyException($"根据HandledPackingCode={input.FromPackingCode}取ThirdLocationJobDetail表为空!");
|
||||
|
throw new UserFriendlyException($"根据RecommendPackingCode={input.FromPackingCode}取ThirdLocationJobDetail表为空!"); |
||||
|
} |
||||
|
//插入目标箱
|
||||
|
var newDetail = CommonHelper.CloneObj(detail); |
||||
|
newDetail.SetId(GuidGenerator.Create()); |
||||
|
newDetail.RecommendPackingCode = input.ToPackingCode; |
||||
|
newDetail.RecommendQty = input.ToQty; |
||||
|
newDetail.HandledPackingCode = detail.HandledPackingCode.HasValue() ? input.ToPackingCode : null; //源实际实际箱码有值,则新记录实际箱码有值
|
||||
|
newDetail.HandledQty = detail.HandledQty > 0 ? input.ToQty : 0; |
||||
|
//newDetail.CreationTime = CommonHelper.CurTime;
|
||||
|
job.Details.Add(newDetail); |
||||
|
//修改源箱
|
||||
|
detail.RecommendQty = input.FromQty - input.ToQty; |
||||
|
detail.HandledQty = detail.HandledQty > 0 ? input.FromQty - input.ToQty : 0; |
||||
|
var entity = await _repository.UpdateAsync(job).ConfigureAwait(false); |
||||
|
var ret = ObjectMapper.Map<ThirdLocationJob, ThirdLocationJobDTO>(entity); |
||||
|
return ret; |
||||
|
} |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
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 ThirdLocationJobAutoMapperProfile() |
||||
|
{ |
||||
|
CreateMap<ThirdLocationJob, ThirdLocationJobDTO>() |
||||
|
.ReverseMap(); |
||||
|
|
||||
|
CreateMap<ThirdLocationJobDetail, ThirdLocationJobDetailDTO>() |
||||
|
; |
||||
|
|
||||
|
CreateMap<ThirdLocationJobDetailDTO, ThirdLocationJobDetail>() |
||||
|
; |
||||
|
|
||||
|
CreateMap<ThirdLocationJobDetailInput, ThirdLocationJobDetail>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.MasterID) |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.Number) |
||||
|
.Ignore(x => x.Id); |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,108 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Linq.Expressions; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Event; |
||||
|
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; |
||||
|
|
||||
|
[Authorize] |
||||
|
[Route($"{StoreConsts.RootPath}third-location-note")] |
||||
|
public class ThirdLocationNoteAppService : |
||||
|
SfsStoreWithDetailsAppServiceBase<ThirdLocationNote, ThirdLocationNoteDTO, SfsStoreRequestInputBase, ThirdLocationNoteEditInput, ThirdLocationNoteDetail, |
||||
|
ThirdLocationNoteDetailDTO, SfsStoreRequestInputBase, ThirdLocationNoteImportInput>, |
||||
|
IThirdLocationNoteAppService |
||||
|
{ |
||||
|
private readonly IThirdLocationNoteManager _thirdLocationNoteManager; |
||||
|
|
||||
|
public ThirdLocationNoteAppService( |
||||
|
IThirdLocationNoteRepository repository, |
||||
|
IThirdLocationNoteManager thirdLocationNoteManager |
||||
|
) : base(repository) |
||||
|
{ |
||||
|
_thirdLocationNoteManager = thirdLocationNoteManager; |
||||
|
} |
||||
|
|
||||
|
[HttpPost("")] |
||||
|
//[Authorize(ThirdLocationNotePermissions.Create)]
|
||||
|
public override async Task<ThirdLocationNoteDTO> CreateAsync(ThirdLocationNoteEditInput input) |
||||
|
{ |
||||
|
var entity = ObjectMapper.Map<ThirdLocationNoteEditInput, ThirdLocationNote>(input); |
||||
|
await _thirdLocationNoteManager.CreateAsync(entity).ConfigureAwait(false); |
||||
|
var dto = ObjectMapper.Map<ThirdLocationNote, ThirdLocationNoteDTO>(entity); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 确认对应的记录单
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("confirm/{id}")] |
||||
|
public virtual async Task<ThirdLocationNoteDTO> ConfirmAsync(Guid id) |
||||
|
{ |
||||
|
var thirdLocationNote= await _repository.GetAsync(id).ConfigureAwait(false); |
||||
|
thirdLocationNote.Confirmed = true; |
||||
|
thirdLocationNote=await _repository.UpdateAsync(thirdLocationNote).ConfigureAwait(false); |
||||
|
await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData<ThirdLocationNote>(thirdLocationNote), false).ConfigureAwait(false); |
||||
|
return ObjectMapper.Map<ThirdLocationNote, ThirdLocationNoteDTO>(thirdLocationNote); |
||||
|
} |
||||
|
|
||||
|
[HttpPost("confirm-by-number/{number}")] |
||||
|
public virtual async Task<ThirdLocationNoteDTO> ConfirmAsync(string number) |
||||
|
{ |
||||
|
var entity = await _repository.FindAsync(p => p.Number == number).ConfigureAwait(false); |
||||
|
Check.NotNull(entity, nameof(ThirdLocationNote)); |
||||
|
var result = await _thirdLocationNoteManager.ConfirmAsync(entity.Id).ConfigureAwait(false); |
||||
|
var dto = ObjectMapper.Map<ThirdLocationNote, ThirdLocationNoteDTO>(result); |
||||
|
return dto; |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// 根据叫料请求类型获取发料记录
|
||||
|
/// </summary>
|
||||
|
/// <param name="requestInput"></param>
|
||||
|
/// <param name="requestType">
|
||||
|
/// 叫料请求类型:
|
||||
|
/// 人工拉动:Issue_Manual;
|
||||
|
/// 线边拉动:Issue_WIP;
|
||||
|
/// </param>
|
||||
|
/// <param name="includeDetails"></param>
|
||||
|
/// <param name="cancellationToken"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("by-type/{requestType}")] |
||||
|
public virtual async Task<PagedResultDto<ThirdLocationNoteDTO>> GetListByTypeAsync(SfsStoreRequestInputBase requestInput, |
||||
|
string requestType, bool includeDetails = false, CancellationToken cancellationToken = default) |
||||
|
{ |
||||
|
Expression<Func<ThirdLocationNote, bool>> expression = p => p.RequestType == requestType; |
||||
|
if (requestInput.Condition.Filters?.Count > 0) |
||||
|
{ |
||||
|
expression = expression.And(requestInput.Condition.Filters.ToLambda<ThirdLocationNote>()); |
||||
|
} |
||||
|
|
||||
|
return await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount, |
||||
|
requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
[HttpGet("list/un-confirmed/{requestType}")] |
||||
|
public virtual async Task<List<ThirdLocationNoteDTO>> GetListUnConfirmedByTypeAsync(string requestType) |
||||
|
{ |
||||
|
var entities = await _repository.GetListAsync(c => !c.Confirmed && c.RequestType == requestType) |
||||
|
.ConfigureAwait(false); |
||||
|
|
||||
|
var dtos = ObjectMapper.Map<List<ThirdLocationNote>, List<ThirdLocationNoteDTO>>(entities); |
||||
|
|
||||
|
return dtos; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
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 ThirdLocationNoteAutoMapperProfile() |
||||
|
{ |
||||
|
CreateMap<ThirdLocationNote, ThirdLocationNoteDTO>() |
||||
|
.ReverseMap(); |
||||
|
|
||||
|
CreateMap<ThirdLocationNoteDetail, ThirdLocationNoteDetailDTO>(); |
||||
|
|
||||
|
CreateMap<ThirdLocationNoteDetailInput, ThirdLocationNoteDetail>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.MasterID) |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.Number) |
||||
|
.Ignore(x => x.Id); |
||||
|
|
||||
|
CreateMap<ThirdLocationNoteEditInput, ThirdLocationNote>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.Number) |
||||
|
.Ignore(x => x.Id); |
||||
|
; |
||||
|
} |
||||
|
} |
@ -0,0 +1,302 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Linq.Expressions; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using DocumentFormat.OpenXml.Office.PowerPoint.Y2021.M06.Main; |
||||
|
using IdentityModel; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Volo.Abp.ObjectMapping; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
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; |
||||
|
using Win_in.Sfs.Wms.Store.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 三方库库移
|
||||
|
/// </summary>
|
||||
|
[Authorize] |
||||
|
[Route($"{StoreConsts.RootPath}third-location-request")] |
||||
|
public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<ThirdLocationRequest, ThirdLocationRequestDTO, |
||||
|
SfsStoreRequestInputBase, ThirdLocationRequestEditInput, ThirdLocationRequestDetail, ThirdLocationRequestDetailDTO, |
||||
|
SfsStoreRequestInputBase, ThirdLocationRequestImportInput>, |
||||
|
IThirdLocationRequestAppService |
||||
|
{ |
||||
|
private readonly IThirdLocationRequestManager _thirdLocationRequestManager; |
||||
|
private readonly IItemStoreRelationAppService _itemStoreRelationApp; |
||||
|
private readonly IAreaAppService _areaApp; |
||||
|
private readonly ILocationAppService _locationAppService; |
||||
|
private readonly IItemBasicAppService _itemBasicAppService; |
||||
|
private readonly IProductionLineAppService _productionLineAppService; |
||||
|
private readonly IInjectionJobAppService _issueJobAppService; |
||||
|
public ThirdLocationRequestAppService( |
||||
|
IThirdLocationRequestRepository repository, |
||||
|
IThirdLocationRequestManager thirdLocationRequestManager, |
||||
|
IPreparationPlanManager preparationPlanManager, |
||||
|
IItemStoreRelationAppService itemStoreRelationApp, |
||||
|
IAreaAppService areaApp, |
||||
|
ILocationAppService locationAppService, |
||||
|
IItemBasicAppService itemBasicAppService, |
||||
|
IProductionLineAppService productionLineAppService, |
||||
|
IInjectionJobAppService issueJobAppService) |
||||
|
: base(repository, thirdLocationRequestManager) |
||||
|
{ |
||||
|
_thirdLocationRequestManager = thirdLocationRequestManager; |
||||
|
_itemStoreRelationApp = itemStoreRelationApp; |
||||
|
_areaApp = areaApp; |
||||
|
_locationAppService = locationAppService; |
||||
|
_itemBasicAppService = itemBasicAppService; |
||||
|
_productionLineAppService = productionLineAppService; |
||||
|
_issueJobAppService = issueJobAppService; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
#region 东阳V2
|
||||
|
|
||||
|
public override async Task<ThirdLocationRequestDTO> HandleAsync(Guid id) |
||||
|
{ |
||||
|
var entity = await _repository.GetAsync(id).ConfigureAwait(false); |
||||
|
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<ThirdLocationRequest>(entity), false).ConfigureAwait(false); |
||||
|
return ObjectMapper.Map<ThirdLocationRequest, ThirdLocationRequestDTO>(entity); |
||||
|
} |
||||
|
|
||||
|
[HttpPost("")] |
||||
|
//[Authorize(ThirdLocationRequestPermissions.Create)]
|
||||
|
public override async Task<ThirdLocationRequestDTO> CreateAsync(ThirdLocationRequestEditInput input) |
||||
|
{ |
||||
|
foreach (var item in input.Details) |
||||
|
{ |
||||
|
if (item.Qty <= 0) |
||||
|
{ |
||||
|
throw new UserFriendlyException($"{item.ItemCode} 物料的需求量必须大于0"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
foreach (var detailInput in input.Details) //赋值生产线
|
||||
|
{ |
||||
|
var toLocationDto = await _locationAppService.GetByCodeAsync(detailInput.ToLocationCode).ConfigureAwait(false); |
||||
|
CheckLocation(toLocationDto, detailInput.ToLocationCode); |
||||
|
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detailInput.ItemCode).ConfigureAwait(false); |
||||
|
CheckItemBasic(itemBasicDto, detailInput.ItemCode); |
||||
|
|
||||
|
detailInput.ProdLine = detailInput.ToLocationCode; |
||||
|
detailInput.ToLocationErpCode = toLocationDto.ErpLocationCode; |
||||
|
} |
||||
|
|
||||
|
input.AutoSubmit = true; |
||||
|
input.AutoAgree = true; |
||||
|
input.AutoHandle = true; |
||||
|
input.AutoCompleteJob = false; |
||||
|
input.DirectCreateNote = false; |
||||
|
|
||||
|
var entity = ObjectMapper.Map<ThirdLocationRequestEditInput, ThirdLocationRequest>(input); |
||||
|
|
||||
|
var result = await _thirdLocationRequestManager.CreateAsync(entity).ConfigureAwait(false); |
||||
|
|
||||
|
var dto = ObjectMapper.Map<ThirdLocationRequest, ThirdLocationRequestDTO>(result); |
||||
|
|
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
//[Authorize(ThirdLocationRequestPermissions.Create)]
|
||||
|
[HttpPost("create-and-handle")] |
||||
|
public async Task<ThirdLocationRequestDTO> CreateAndHandleAsync(ThirdLocationRequestEditInput input) |
||||
|
{ |
||||
|
var thirdLocationRequestDto = await CreateAsync(input).ConfigureAwait(false); |
||||
|
|
||||
|
await HandleAsync(thirdLocationRequestDto.Id).ConfigureAwait(false); |
||||
|
|
||||
|
return thirdLocationRequestDto; |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据类型 获取叫料申请
|
||||
|
/// </summary>
|
||||
|
/// <param name="type"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("list/by-type/{type}")] |
||||
|
public virtual async Task<List<ThirdLocationRequestDTO>> GetListByTypeAsync(string type) |
||||
|
{ |
||||
|
var entities = await _repository.GetListAsync(c => c.Type == type).ConfigureAwait(false); |
||||
|
|
||||
|
var dtos = ObjectMapper.Map<List<ThirdLocationRequest>, List<ThirdLocationRequestDTO>>(entities); |
||||
|
|
||||
|
return dtos; |
||||
|
} |
||||
|
|
||||
|
#region 导入
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 用来重写 导入数据时可以加工数据
|
||||
|
/// </summary>
|
||||
|
/// <param name="dictionary"></param>
|
||||
|
/// <returns></returns>
|
||||
|
protected override async Task<Dictionary<ThirdLocationRequest, EntityState>> ImportProcessingEntityAsync( |
||||
|
Dictionary<ThirdLocationRequest, EntityState> dictionary) |
||||
|
{ |
||||
|
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); |
||||
|
|
||||
|
foreach (var thirdLocationRequest in addList) |
||||
|
{ |
||||
|
thirdLocationRequest.Worker = CurrentUser.GetUserName(); |
||||
|
thirdLocationRequest.CreatorId = CurrentUser.Id; |
||||
|
if (thirdLocationRequest.Type == EnumTransSubType.Issue_Manual.GetDisplayName()) |
||||
|
{ |
||||
|
thirdLocationRequest.Type = EnumTransSubType.Issue_Manual.ToString(); |
||||
|
} |
||||
|
|
||||
|
foreach (var detail in thirdLocationRequest.Details) |
||||
|
{ |
||||
|
var locationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); |
||||
|
CheckLocation(locationDto, detail.ToLocationCode); |
||||
|
|
||||
|
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
||||
|
CheckItemBasic(itemBasicDto, detail.ItemCode); |
||||
|
|
||||
|
detail.ToLocationArea = locationDto.AreaCode; |
||||
|
detail.ToLocationErpCode = locationDto.ErpLocationCode; |
||||
|
detail.ToLocationGroup = locationDto.LocationGroupCode; |
||||
|
detail.ToWarehouseCode = locationDto.WarehouseCode; |
||||
|
detail.ItemDesc1 = itemBasicDto.Desc1; |
||||
|
detail.ItemDesc2 = itemBasicDto.Desc2; |
||||
|
detail.ItemName = itemBasicDto.Name; |
||||
|
detail.Uom = itemBasicDto.BasicUom; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return dictionary; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 导入验证
|
||||
|
/// </summary>
|
||||
|
/// <param name="model"></param>
|
||||
|
/// <param name="validationRresult"></param>
|
||||
|
/// <returns></returns>
|
||||
|
protected override async Task ValidateImportModelAsync(ThirdLocationRequestImportInput model, |
||||
|
List<ValidationResult> validationRresult) |
||||
|
{ |
||||
|
_ = new Dictionary<string, string>(); |
||||
|
_ = await CheckItemBasicAsync(model, validationRresult).ConfigureAwait(false); |
||||
|
_ = await CheckLocationAsync(model, validationRresult).ConfigureAwait(false); |
||||
|
await CheckAreaAsync(model, validationRresult).ConfigureAwait(false); |
||||
|
await CheckStoreRelationAsync(model, validationRresult).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
#region 校验
|
||||
|
|
||||
|
protected override async Task<bool> ValidateImportEntities(Dictionary<ThirdLocationRequest, EntityState> dict) |
||||
|
{ |
||||
|
foreach (var entity in dict.Keys) |
||||
|
{ |
||||
|
var tranType = await TransactionTypeAclService |
||||
|
.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false); |
||||
|
|
||||
|
Check.NotNull(tranType, "事务类型", "事务类型不存在"); |
||||
|
|
||||
|
entity.AutoCompleteJob = tranType.AutoCompleteJob; |
||||
|
entity.AutoSubmit = tranType.AutoSubmitRequest; |
||||
|
entity.AutoAgree = tranType.AutoAgreeRequest; |
||||
|
entity.AutoHandle = tranType.AutoHandleRequest; |
||||
|
entity.DirectCreateNote = tranType.DirectCreateNote; |
||||
|
} |
||||
|
|
||||
|
return await base.ValidateImportEntities(dict).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
protected async Task<ItemBasicDTO> CheckItemBasicAsync(ThirdLocationRequestImportInput importInput, |
||||
|
List<ValidationResult> validationRresult) |
||||
|
{ |
||||
|
var item = await _itemBasicAppService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false); |
||||
|
if (item == null) |
||||
|
{ |
||||
|
validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}不存在", new[] { "物品代码" })); |
||||
|
} |
||||
|
else if (item.StdPackQty == 0) |
||||
|
{ |
||||
|
validationRresult.Add( |
||||
|
new ValidationResult($"物品代码{importInput.ItemCode}的物品信息中标准包装等于0或不存在", new[] { "标准包装" })); |
||||
|
} |
||||
|
|
||||
|
return item; |
||||
|
} |
||||
|
|
||||
|
protected async Task<LocationDTO> CheckLocationAsync(ThirdLocationRequestImportInput importInput, |
||||
|
List<ValidationResult> validationRresult) |
||||
|
{ |
||||
|
var location = await _locationAppService.GetByCodeAsync(importInput.ToLocationCode).ConfigureAwait(false); |
||||
|
if (location == null) |
||||
|
{ |
||||
|
validationRresult.Add(new ValidationResult($"目标库位{importInput.ToLocationCode}不存在", new[] { "目标库位" })); |
||||
|
} |
||||
|
|
||||
|
return location; |
||||
|
} |
||||
|
|
||||
|
protected async Task CheckAreaAsync(ThirdLocationRequestImportInput importInput, |
||||
|
List<ValidationResult> validationRresult) |
||||
|
{ |
||||
|
var area = await _areaApp.GetByCodeAsync(importInput.FromLocationArea).ConfigureAwait(false); |
||||
|
if (area == null) |
||||
|
{ |
||||
|
validationRresult.Add(new ValidationResult($"调出库区{importInput.FromLocationArea}不存在", new[] { "调出库区" })); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
protected async Task CheckStoreRelationAsync(ThirdLocationRequestImportInput importInput, |
||||
|
List<ValidationResult> validationRresult) |
||||
|
{ |
||||
|
var itemStoreRelation = await _itemStoreRelationApp |
||||
|
.GetFirstAsync(importInput.ItemCode, importInput.ToLocationCode).ConfigureAwait(false); |
||||
|
if (itemStoreRelation == null) |
||||
|
{ |
||||
|
validationRresult.Add(new ValidationResult( |
||||
|
$"物品代码{importInput.ItemCode}与目标库位{importInput.ToLocationCode}不存在对应关", new[] { "物品库位对应关系" })); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region 校验
|
||||
|
|
||||
|
private void CheckItemBasic(ItemBasicDTO ItemBasicDto, string itemCode) |
||||
|
{ |
||||
|
if (ItemBasicDto == null) |
||||
|
{ |
||||
|
throw new UserFriendlyException($"物品代码为【{itemCode}】不存在"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void CheckLocation(LocationDTO LocationDto, string LocationCode) |
||||
|
{ |
||||
|
if (LocationDto == null) |
||||
|
{ |
||||
|
throw new UserFriendlyException($"库位代码为【{LocationCode}】不存在"); |
||||
|
} |
||||
|
|
||||
|
if (LocationDto.Type != EnumLocationType.WIP) |
||||
|
{ |
||||
|
throw new UserFriendlyException($"库位代码【{LocationCode}】不是【{EnumLocationType.WIP.GetDisplayName()}】类型"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
#endregion
|
||||
|
} |
@ -0,0 +1,72 @@ |
|||||
|
using AutoMapper; |
||||
|
using Volo.Abp.AutoMapper; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
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 ThirdLocationRequestAutoMapperProfile() |
||||
|
{ |
||||
|
CreateMap<ThirdLocationRequest, ThirdLocationRequestDTO>() |
||||
|
.ReverseMap(); |
||||
|
|
||||
|
CreateMap<ThirdLocationRequestDetail, ThirdLocationRequestDetailDTO>() |
||||
|
.ReverseMap(); |
||||
|
|
||||
|
CreateMap<ThirdLocationRequestDetailInput, ThirdLocationRequestDetail>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.ToLocationArea) |
||||
|
.Ignore(x => x.ToLocationGroup) |
||||
|
.Ignore(x => x.ToWarehouseCode) |
||||
|
.Ignore(x => x.MasterID) |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.Number) |
||||
|
.Ignore(x => x.Id); |
||||
|
|
||||
|
CreateMap<ThirdLocationRequestImportInput, ThirdLocationRequest>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.ForMember(x => x.Type, y => y.MapFrom(t => t.Type.ToString())) |
||||
|
.Ignore(x => x.ProdLine) |
||||
|
.Ignore(x => x.UseOnTheWayLocation) |
||||
|
.Ignore(x => x.Details) |
||||
|
.Ignore(x => x.Remark) |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.Number) |
||||
|
.Ignore(x => x.RequestStatus) |
||||
|
.Ignore(x => x.ConcurrencyStamp) |
||||
|
.Ignore(x => x.ExtraProperties) |
||||
|
.Ignore(x => x.ActiveDate) |
||||
|
.Ignore(x => x.Remark); |
||||
|
|
||||
|
CreateMap<ThirdLocationRequestImportInput, ThirdLocationRequestDetail>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.ForMember(x => x.Status, y => y.MapFrom(t => EnumStatus.Open)) |
||||
|
.Ignore(x => x.ToLocationErpCode) |
||||
|
.Ignore(x => x.ToWarehouseCode) |
||||
|
.Ignore(x => x.ToLocationArea) |
||||
|
.Ignore(x => x.ToLocationGroup) |
||||
|
.Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2) |
||||
|
.Ignore(x => x.ProdLine) |
||||
|
.Ignore(x => x.WorkStation) |
||||
|
.Ignore(x => x.ExpiredTime) |
||||
|
.Ignore(x => x.IssuedQty) |
||||
|
.Ignore(x => x.ReceivedQty) |
||||
|
.Ignore(x => x.ToBeIssuedQty) |
||||
|
.Ignore(x => x.ToBeReceivedQty) |
||||
|
.Ignore(x => x.NotFinishQty) |
||||
|
.Ignore(x => x.StdPackQty) |
||||
|
.Ignore(x => x.Uom) |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.MasterID) |
||||
|
.Ignore(x => x.Number) |
||||
|
.Ignore(x => x.Id) |
||||
|
.Ignore(x => x.Remark); |
||||
|
CreateMap<ThirdLocationRequestEditInput, ThirdLocationRequest>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.RequestStatus) |
||||
|
.Ignore(x => x.ConcurrencyStamp).Ignore(x => x.Id); |
||||
|
} |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
using System; |
||||
|
using System.Linq.Expressions; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public interface IThirdLocationJobManager : IJobManager<ThirdLocationJob> |
||||
|
{ |
||||
|
Task<ThirdLocationJob> GetAsync(Expression<Func<ThirdLocationJob, bool>> expression); |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public interface IThirdLocationJobRepository : ISfsJobRepositoryBase<ThirdLocationJob> |
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,84 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win_in.Sfs.Shared.Domain.Entities; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 三方库库移任务
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "三方库库移任务")] |
||||
|
public class ThirdLocationJob : SfsJobAggregateRootBase<ThirdLocationJobDetail> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 叫料请求类型
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public string RequestType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 请求单号
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public string RequestNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车间
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public string Workshop { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 使用在途库
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "使用在途库")] |
||||
|
[IgnoreUpdate] |
||||
|
public bool UseOnTheWayLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 任务明细
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public override List<ThirdLocationJobDetail> Details { get; set; } = new List<ThirdLocationJobDetail>(); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 设置任务明细的实际库位和实际数量
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="handledLocationCode"></param>
|
||||
|
/// <param name="handledLocationErpCode"></param>
|
||||
|
/// <param name="handledWarehouseCode"></param>
|
||||
|
/// <param name="handledQty"></param>
|
||||
|
/// <param name="handledBatch"></param>
|
||||
|
/// <param name="handledContainerCode"></param>
|
||||
|
/// <param name="handledLot"></param>
|
||||
|
/// <param name="handledPackingCode"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public virtual async Task BuildDetail(Guid id, string handledLocationCode, string handledLocationErpCode, |
||||
|
string handledWarehouseCode, decimal handledQty, string handledSupplierBatch, DateTime handledArriveDate, DateTime handledProduceDate, DateTime handledExpireDate, |
||||
|
string handledContainerCode, string handledLot, string handledPackingCode) |
||||
|
{ |
||||
|
var detail = GetDetail(id); |
||||
|
detail.HandledFromLocationCode = handledLocationCode; |
||||
|
detail.HandledFromLocationErpCode = handledLocationErpCode; |
||||
|
detail.HandledFromWarehouseCode = handledWarehouseCode; |
||||
|
detail.HandledQty = handledQty; |
||||
|
detail.HandledSupplierBatch = handledSupplierBatch; |
||||
|
detail.HandledArriveDate = handledArriveDate; |
||||
|
detail.HandledProduceDate = handledProduceDate; |
||||
|
detail.HandledExpireDate = handledExpireDate; |
||||
|
detail.HandledContainerCode = handledContainerCode; |
||||
|
detail.HandledLot = handledLot; |
||||
|
detail.HandledPackingCode = handledPackingCode; |
||||
|
await Task.CompletedTask.ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,108 @@ |
|||||
|
using System; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public class ThirdLocationJobDetail : SfsJobRecommendFromDetailEntityBase, IHasToLocation |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 请求库位
|
||||
|
/// </summary>
|
||||
|
public string RequestLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库位
|
||||
|
/// </summary>
|
||||
|
public string ToLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库区
|
||||
|
/// </summary>
|
||||
|
public string ToLocationArea { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库位组
|
||||
|
/// </summary>
|
||||
|
public string ToLocationGroup { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到ERP库位
|
||||
|
/// </summary>
|
||||
|
public string ToLocationErpCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到仓库
|
||||
|
/// </summary>
|
||||
|
public string ToWarehouseCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 在途库库位
|
||||
|
/// </summary>
|
||||
|
public string OnTheWayLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工作中心
|
||||
|
/// </summary>
|
||||
|
public string WorkStation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 过期时间
|
||||
|
/// </summary>
|
||||
|
public DateTime ExpiredTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工序
|
||||
|
/// </summary>
|
||||
|
public string Operation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 配送方式
|
||||
|
/// </summary>
|
||||
|
public EnumDistributionType DistributionType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 取整方式
|
||||
|
/// </summary>
|
||||
|
public EnumTruncType TruncType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 取整后数量
|
||||
|
/// </summary>
|
||||
|
public decimal RoundedQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划拆分规则
|
||||
|
/// </summary>
|
||||
|
public EnumPlannedSplitRule PlannedSplitRule { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划开始时间
|
||||
|
/// </summary>
|
||||
|
public DateTime PlanBeginTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 每次配送数量
|
||||
|
/// </summary>
|
||||
|
public decimal DeliveryQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 位置码
|
||||
|
/// </summary>
|
||||
|
public string PositionCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 推荐类型
|
||||
|
/// </summary>
|
||||
|
public EnumRecommendType RecommendType { get; set; } |
||||
|
|
||||
|
public void SetId(Guid id) |
||||
|
{ |
||||
|
this.Id = id; |
||||
|
} |
||||
|
} |
@ -0,0 +1,82 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Linq.Expressions; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Users; |
||||
|
using Volo.Abp.Validation; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public class ThirdLocationJobManager : SfsJobManagerBase<ThirdLocationJob, ThirdLocationJobDetail>, IThirdLocationJobManager |
||||
|
{ |
||||
|
|
||||
|
public ThirdLocationJobManager( |
||||
|
IThirdLocationJobRepository repository |
||||
|
) : base(repository) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 执行任务 发料任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <param name="user"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<ThirdLocationJob> CompleteAsync(ThirdLocationJob input, ICurrentUser user) |
||||
|
{ |
||||
|
var entity = await Repository.FindAsync(input.Id).ConfigureAwait(false); |
||||
|
|
||||
|
foreach (var detail in input.Details) |
||||
|
{ |
||||
|
//发料子任务 赋值实际转移
|
||||
|
await entity.BuildDetail(detail.Id, |
||||
|
detail.HandledFromLocationCode, |
||||
|
detail.HandledFromLocationErpCode, |
||||
|
detail.HandledFromWarehouseCode, |
||||
|
detail.HandledQty, |
||||
|
detail.HandledSupplierBatch, |
||||
|
detail.HandledArriveDate, |
||||
|
detail.HandledProduceDate, |
||||
|
detail.HandledExpireDate, |
||||
|
detail.HandledContainerCode, |
||||
|
detail.HandledLot, |
||||
|
detail.HandledPackingCode).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
return await base.CompleteAsync(entity, user).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
public override void CheckDetails(ThirdLocationJob entity, AbpValidationResult result) |
||||
|
{ |
||||
|
var details = entity.Details; |
||||
|
foreach (var detail in details) |
||||
|
{ |
||||
|
if (detail.HandledFromLocationCode == null) |
||||
|
{ |
||||
|
result.Errors.Add(new ValidationResult($"{detail.HandledFromLocationCode} 不能为空")); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public override async Task<List<ThirdLocationJob>> GetWorkingListByPackingAsync(string packingCode) |
||||
|
{ |
||||
|
return await Repository.GetListAsync(c => c.Details.Any(p => p.RecommendPackingCode == packingCode) && c.JobStatus != EnumJobStatus.Closed && c.JobStatus != EnumJobStatus.Cancelled, true).ConfigureAwait(false); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public override async Task<List<ThirdLocationJob>> GetWorkingListByContainerAsync(string containerCode) |
||||
|
{ |
||||
|
return await Repository.GetListAsync(c => c.Details.Any(p => p.RecommendContainerCode == containerCode) && c.JobStatus != EnumJobStatus.Closed && c.JobStatus != EnumJobStatus.Cancelled, true).ConfigureAwait(false); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public async Task<ThirdLocationJob> GetAsync(Expression<Func<ThirdLocationJob, bool>> expression) |
||||
|
{ |
||||
|
return await Repository.FindAsync(expression).ConfigureAwait(false); |
||||
|
} |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public interface IThirdLocationNoteManager : ISfsStoreManager<ThirdLocationNote, ThirdLocationNoteDetail> |
||||
|
{ |
||||
|
Task<ThirdLocationNote> ConfirmAsync(Guid id); |
||||
|
|
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public interface IThirdLocationNoteRepository : ISfsStoreRepositoryBase<ThirdLocationNote> |
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,77 @@ |
|||||
|
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 ThirdLocationNote : SfsStoreAggregateRootBase<ThirdLocationNoteDetail>, IHasJobNumber, IHasRequestNumber |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 任务ID
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public string JobNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车间
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public string Workshop { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 明细列表
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public override List<ThirdLocationNoteDetail> Details { get; set; } = new List<ThirdLocationNoteDetail>(); |
||||
|
|
||||
|
[IgnoreUpdate] |
||||
|
public string RequestNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 叫料请求类型
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public string RequestType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 使用在途库
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public bool UseOnTheWayLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 确认时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "确认时间")] |
||||
|
[IgnoreUpdate] |
||||
|
public DateTime? ConfirmTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已确认
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "已确认")] |
||||
|
public bool Confirmed { 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,43 @@ |
|||||
|
using System; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public class ThirdLocationNoteDetail : SfsStoreRecommendFromDetailWithFromToEntityBase |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发料时间
|
||||
|
/// </summary>
|
||||
|
public DateTime IssueTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 过期时间
|
||||
|
/// </summary>
|
||||
|
public DateTime ExpiredTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工作中心
|
||||
|
/// </summary>
|
||||
|
public string WorkStation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 在途库库位
|
||||
|
/// </summary>
|
||||
|
public string OnTheWayLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 位置码
|
||||
|
/// </summary>
|
||||
|
public string PositionCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 推荐类型
|
||||
|
/// </summary>
|
||||
|
public EnumRecommendType RecommendType { get; set; } |
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
using System; |
||||
|
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 ThirdLocationNoteManager : SfsStoreManagerBase<ThirdLocationNote, ThirdLocationNoteDetail>, IThirdLocationNoteManager |
||||
|
{ |
||||
|
|
||||
|
public ThirdLocationNoteManager( |
||||
|
IThirdLocationNoteRepository repository |
||||
|
) : base(repository) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
[UnitOfWork] |
||||
|
public virtual async Task<ThirdLocationNote> 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(ThirdLocationNote entity) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData<ThirdLocationNote>(entity), false).ConfigureAwait(false); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
Logger.LogDebug($"{nameof(ThirdLocationNote)} Confirmed Event:{ex.Message}", null); |
||||
|
Console.WriteLine(ex.Source); |
||||
|
throw; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
public interface IThirdLocationRequestManager : ISfsStoreRequestManager<ThirdLocationRequest, ThirdLocationRequestDetail>, |
||||
|
IBulkImportService<ThirdLocationRequest> |
||||
|
{ |
||||
|
|
||||
|
Task UpdateDetailsAsync(ThirdLocationRequest entity); |
||||
|
|
||||
|
Task CompleteAsync(string number); |
||||
|
|
||||
|
Task<ThirdLocationRequest> CreateBynNumberAsync(ThirdLocationRequest entity); |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public interface IThirdLocationRequestRepository : ISfsStoreRepositoryBase<ThirdLocationRequest>, |
||||
|
ISfsBulkRepositoryBase<ThirdLocationRequest> |
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
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 ThirdLocationRequest : SfsStoreRequestAggregateRootBase<ThirdLocationRequestDetail> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 叫料类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "叫料类型")] |
||||
|
[IgnoreUpdate] |
||||
|
public string Type { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 使用在途库
|
||||
|
/// </summary>
|
||||
|
public bool UseOnTheWayLocation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 明细列表
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public override List<ThirdLocationRequestDetail> Details { get; set; } = new List<ThirdLocationRequestDetail>(); |
||||
|
} |
@ -0,0 +1,105 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 三方库申请明细
|
||||
|
/// </summary>
|
||||
|
public class ThirdLocationRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasToLocation |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 到库位
|
||||
|
/// </summary>
|
||||
|
public string ToLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库区
|
||||
|
/// </summary>
|
||||
|
public string ToLocationArea { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库位组
|
||||
|
/// </summary>
|
||||
|
public string ToLocationGroup { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到ERP库位
|
||||
|
/// </summary>
|
||||
|
public string ToLocationErpCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到仓库
|
||||
|
/// </summary>
|
||||
|
public string ToWarehouseCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 来源库区
|
||||
|
/// </summary>
|
||||
|
public string FromLocationArea { get; set; } |
||||
|
|
||||
|
// /// <summary>
|
||||
|
// /// 在途库库位
|
||||
|
// /// </summary>
|
||||
|
// public string OnTheWayLocationCode { get; set; }
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工作中心
|
||||
|
/// </summary>
|
||||
|
public string WorkStation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 过期时间
|
||||
|
/// </summary>
|
||||
|
public DateTime ExpiredTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已发数量
|
||||
|
/// </summary>
|
||||
|
public decimal IssuedQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已收数量
|
||||
|
/// </summary>
|
||||
|
public decimal ReceivedQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 明细状态
|
||||
|
/// </summary>
|
||||
|
public EnumStatus Status { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 请求未发 还未发送的数量
|
||||
|
/// </summary>
|
||||
|
[NotMapped] |
||||
|
public decimal ToBeIssuedQty => Qty - IssuedQty; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已发未收
|
||||
|
/// </summary>
|
||||
|
[NotMapped] |
||||
|
public decimal ToBeReceivedQty => IssuedQty - ReceivedQty; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 请求未收
|
||||
|
/// </summary>
|
||||
|
[NotMapped] |
||||
|
public decimal NotFinishQty => Qty - ReceivedQty; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 位置码
|
||||
|
/// </summary>
|
||||
|
public string PositionCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 推荐类型
|
||||
|
/// </summary>
|
||||
|
public EnumRecommendType RecommendType { get; set; } |
||||
|
} |
@ -0,0 +1,147 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using DocumentFormat.OpenXml.Math; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
using Win_in.Sfs.Shared.Event; |
||||
|
using static Win_in.Sfs.Wms.Store.Domain.Shared.StoreSettings; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public class ThirdLocationRequestManager |
||||
|
: SfsStoreRequestManagerBase<ThirdLocationRequest, ThirdLocationRequestDetail> |
||||
|
, IThirdLocationRequestManager |
||||
|
{ |
||||
|
private readonly IThirdLocationRequestRepository _repository; |
||||
|
private readonly IIssueJobRepository _issueJobRepository; |
||||
|
|
||||
|
public ThirdLocationRequestManager( |
||||
|
IThirdLocationRequestRepository repository |
||||
|
, IIssueJobRepository issueJobRepository |
||||
|
) : base(repository) |
||||
|
{ |
||||
|
_repository = repository; |
||||
|
_issueJobRepository = issueJobRepository; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
#region 东阳V2
|
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建
|
||||
|
/// </summary>
|
||||
|
/// <param name="entity"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public virtual async Task<ThirdLocationRequest> CreateBynNumberAsync(ThirdLocationRequest entity) |
||||
|
{ |
||||
|
var number = string.IsNullOrEmpty(entity.Number) ? await GenerateNumberAsync(nameof(ThirdLocationRequest), entity.ActiveDate).ConfigureAwait(false) : entity.Number; |
||||
|
entity.SetIdAndNumberWithDetails(GuidGenerator, number); |
||||
|
entity.Submit(); |
||||
|
entity.Agree(); |
||||
|
entity.RequestStatus = EnumRequestStatus.Partial; |
||||
|
await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<ThirdLocationRequest>(entity), false) |
||||
|
.ConfigureAwait(false); |
||||
|
await _repository.InsertAsync(entity).ConfigureAwait(false); |
||||
|
return entity; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task UpdateDetailsAsync(ThirdLocationRequest newEntity) |
||||
|
{ |
||||
|
var oldEntity = await Repository.FindAsync(newEntity.Id, true).ConfigureAwait(false); |
||||
|
if(oldEntity!=null) |
||||
|
{ |
||||
|
foreach (var newDetail in newEntity.Details) |
||||
|
{ |
||||
|
oldEntity.ReplaceDetail(newDetail.Id, newDetail); |
||||
|
} |
||||
|
|
||||
|
foreach (var detail in oldEntity.Details) |
||||
|
{ |
||||
|
SetMaterialRequestDetailStatus(detail); |
||||
|
} |
||||
|
|
||||
|
await SetMaterialRequestStatusAsync(oldEntity).ConfigureAwait(false); |
||||
|
|
||||
|
await Repository.UpdateAsync(oldEntity).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private void SetMaterialRequestDetailStatus(ThirdLocationRequestDetail detail) |
||||
|
{ |
||||
|
if (detail.ReceivedQty >= detail.Qty)//执行的时候 实际收料 多余 要料数
|
||||
|
{ |
||||
|
detail.Status = EnumStatus.Close; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
detail.Status = EnumStatus.Open; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private async Task SetMaterialRequestStatusAsync(ThirdLocationRequest materialRequest) |
||||
|
{ |
||||
|
if (materialRequest.Details.All(p => p.Status == EnumStatus.Close)) |
||||
|
{ |
||||
|
materialRequest.RequestStatus = EnumRequestStatus.Completed; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
var issueJobs = await _issueJobRepository.GetListAsync(t => t.MaterialRequestNumber == materialRequest.Number).ConfigureAwait(false); |
||||
|
if (issueJobs.Count > 0) |
||||
|
{ |
||||
|
if (issueJobs.All(t => t.JobStatus is EnumJobStatus.Done or EnumJobStatus.Closed or EnumJobStatus.Cancelled)) |
||||
|
{ |
||||
|
if (materialRequest.Details.All(p => p.ReceivedQty >= p.Qty)) |
||||
|
{ |
||||
|
materialRequest.RequestStatus = EnumRequestStatus.Completed; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
materialRequest.RequestStatus = EnumRequestStatus.Partial; |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
materialRequest.RequestStatus = EnumRequestStatus.Partial; |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
materialRequest.RequestStatus = EnumRequestStatus.Partial; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public virtual async Task CompleteAsync(string number) |
||||
|
{ |
||||
|
var entity = await GetByNumberAsync(number).ConfigureAwait(false); |
||||
|
if (entity != null && !entity.Details.Any(p => p.ToBeIssuedQty > 0)) |
||||
|
{ |
||||
|
await CompleteAsync(entity).ConfigureAwait(false); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
#region 导入
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 执行导入
|
||||
|
/// </summary>
|
||||
|
public virtual async Task ImportDataAsync(List<ThirdLocationRequest> mergeEntities, List<ThirdLocationRequest> deleteEntities = null) |
||||
|
{ |
||||
|
if (deleteEntities != null && deleteEntities.Count > 0) |
||||
|
{ |
||||
|
await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
await CreateManyAsync(mergeEntities).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
} |
@ -0,0 +1,69 @@ |
|||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore.Modeling; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
using Win_in.Sfs.Shared.EntityFrameworkCore; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; |
||||
|
|
||||
|
public static class ThirdLocationJobDbContextModelCreatingExtensions |
||||
|
{ |
||||
|
public static void ConfigureThirdLocationJob(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) |
||||
|
{ |
||||
|
builder.Entity<ThirdLocationJob>(b => |
||||
|
{ |
||||
|
//Configure table & schema name
|
||||
|
b.ToTable(StoreDbProperties.JobDbTablePrefix + nameof(ThirdLocationJob), options.Schema); |
||||
|
//Configure ABP properties
|
||||
|
b.ConfigureByConvention(); |
||||
|
//Configure Sfs base properties
|
||||
|
b.ConfigureSfsBase(); |
||||
|
//Configure Job base properties
|
||||
|
b.ConfigureJob<ThirdLocationJob, ThirdLocationJobDetail>(); |
||||
|
//Properties
|
||||
|
b.Property(q => q.RequestType).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.RequestNumber).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.Workshop).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.ProdLine).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<ThirdLocationJobDetail>(b => |
||||
|
{ |
||||
|
//Configure table & schema name
|
||||
|
b.ToTable(StoreDbProperties.JobDbTablePrefix + nameof(ThirdLocationJobDetail), options.Schema); |
||||
|
//Configure ABP properties
|
||||
|
b.ConfigureByConvention(); |
||||
|
//Configure Sfs base properties
|
||||
|
b.ConfigureSfsBase(); |
||||
|
//Configure Job base properties
|
||||
|
b.ConfigureJobRecommendFromDetail(); |
||||
|
//Properties
|
||||
|
b.Property(q => q.ExpiredTime).IsRequired(); |
||||
|
b.Property(q => q.ToLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.ToLocationErpCode).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.ToWarehouseCode).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.ToLocationArea).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.ToLocationGroup).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.RequestLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.WorkStation).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.Operation).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.DistributionType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
||||
|
b.Property(q => q.TruncType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
||||
|
b.Property(q => q.PlannedSplitRule).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
||||
|
b.Property(q => q.OnTheWayLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.RecommendType).HasMaxLength(SfsPropertyConst.CodeLength).HasConversion<string>(); |
||||
|
|
||||
|
//Relations
|
||||
|
//None
|
||||
|
|
||||
|
//Indexes
|
||||
|
//b.HasIndex(q => new { q.PackingCode }).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 ThirdLocationJobEfCoreRepository : SfsJobEfCoreRepositoryBase<StoreDbContext, ThirdLocationJob>, IThirdLocationJobRepository |
||||
|
{ |
||||
|
public ThirdLocationJobEfCoreRepository(IDbContextProvider<StoreDbContext> dbContextProvider) : base(dbContextProvider) |
||||
|
{ |
||||
|
} |
||||
|
} |
@ -0,0 +1,63 @@ |
|||||
|
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 ThirdLocationNoteDbContextModelCreatingExtensions |
||||
|
{ |
||||
|
public static void ConfigureThirdLocationNote(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) |
||||
|
{ |
||||
|
builder.Entity<ThirdLocationNote>(b => |
||||
|
{ |
||||
|
//Configure table & schema name
|
||||
|
b.ToTable(options.TablePrefix + nameof(ThirdLocationNote), options.Schema); |
||||
|
//Configure ABP properties
|
||||
|
b.ConfigureByConvention(); |
||||
|
//Configure Sfs base properties
|
||||
|
b.ConfigureSfsStoreBase(); |
||||
|
|
||||
|
//Properties
|
||||
|
b.Property(q => q.RequestNumber).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.RequestType).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.Workshop).HasMaxLength(SfsPropertyConst.NameLength); |
||||
|
b.Property(q => q.Remark).HasMaxLength(SfsPropertyConst.RemarkLength); |
||||
|
|
||||
|
//Relations
|
||||
|
b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); |
||||
|
|
||||
|
//Indexes
|
||||
|
b.HasIndex(q => new { q.Number }).IsUnique(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<ThirdLocationNoteDetail>(b => |
||||
|
{ |
||||
|
//Configure table & schema name
|
||||
|
b.ToTable(options.TablePrefix + nameof(ThirdLocationNoteDetail), 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.IssueTime).IsRequired(); |
||||
|
b.Property(q => q.ExpiredTime).IsRequired(); |
||||
|
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.NameLength); |
||||
|
b.Property(q => q.WorkStation).HasMaxLength(SfsPropertyConst.NameLength); |
||||
|
b.Property(q => q.OnTheWayLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.FromStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
||||
|
b.Property(q => q.ToStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
||||
|
b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.RecommendType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
||||
|
|
||||
|
//Relations
|
||||
|
|
||||
|
//Indexes
|
||||
|
b.HasIndex(q => new { q.Number, q.FromPackingCode, q.FromLocationCode, q.ToLocationCode }).IsUnique(); |
||||
|
b.HasIndex(q => new { q.FromPackingCode }); |
||||
|
}); |
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; |
||||
|
|
||||
|
public class ThirdLocationNoteEfCoreRepository : SfsStoreEfCoreRepositoryBase<StoreDbContext, ThirdLocationNote>, IThirdLocationNoteRepository |
||||
|
{ |
||||
|
public ThirdLocationNoteEfCoreRepository(IDbContextProvider<StoreDbContext> dbContextProvider) : base(dbContextProvider) |
||||
|
{ |
||||
|
} |
||||
|
} |
@ -0,0 +1,65 @@ |
|||||
|
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 ThirdLocationRequestDbContextModelCreatingExtensions |
||||
|
{ |
||||
|
public static void ConfigureThirdLocationRequest(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) |
||||
|
{ |
||||
|
builder.Entity<ThirdLocationRequest>(b => |
||||
|
{ |
||||
|
//Configure table & schema name
|
||||
|
b.ToTable(options.TablePrefix + nameof(ThirdLocationRequest), 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.ProdLine).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<ThirdLocationRequestDetail>(b => |
||||
|
{ |
||||
|
//Configure table & schema name
|
||||
|
b.ToTable(options.TablePrefix + nameof(ThirdLocationRequestDetail), 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.ToLocationCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.ToLocationErpCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.ToWarehouseCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.ToLocationArea).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.ToLocationGroup).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.ExpiredTime).IsRequired(); |
||||
|
b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.WorkStation).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.IssuedQty).HasPrecision(18, 6); |
||||
|
b.Property(q => q.ReceivedQty).HasPrecision(18, 6); |
||||
|
b.Property(q => q.Status).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
||||
|
b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.RecommendType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
||||
|
|
||||
|
//Relations
|
||||
|
|
||||
|
//Indexes
|
||||
|
b.HasIndex(q => new { q.Number, q.ItemCode, q.ToLocationCode }).IsUnique(); |
||||
|
b.HasIndex(q => new { q.ItemCode }); |
||||
|
}); |
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; |
||||
|
|
||||
|
public class ThirdLocationRequestEfCoreRepository : SfsStoreEfCoreRepositoryBase<StoreDbContext, ThirdLocationRequest>, IThirdLocationRequestRepository |
||||
|
{ |
||||
|
public ThirdLocationRequestEfCoreRepository(IDbContextProvider<StoreDbContext> dbContextProvider) : base(dbContextProvider) |
||||
|
{ |
||||
|
} |
||||
|
} |
@ -0,0 +1,92 @@ |
|||||
|
using System; |
||||
|
using AutoMapper; |
||||
|
using Volo.Abp.AutoMapper; |
||||
|
using Win_in.Sfs.Shared.Application; |
||||
|
using Win_in.Sfs.Wms.Inventory.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Event; |
||||
|
|
||||
|
public partial class StoreEventAutoMapperProfile : Profile |
||||
|
{ |
||||
|
private void ThirdLocationJobAutoMapperProfile() |
||||
|
{ |
||||
|
|
||||
|
CreateMap<ThirdLocationJob, ThirdLocationNote>() |
||||
|
.ForMember(x => x.JobNumber, y => y.MapFrom(d => d.Number)) |
||||
|
.ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.RequestNumber)) |
||||
|
.ForMember(x => x.ActiveDate, y => y.MapFrom(d => DateTime.Now)) |
||||
|
.ForMember(x => x.Worker, y => y.MapFrom(d => d.CompleteUserName)) |
||||
|
.Ignore(x => x.Confirmed) |
||||
|
.Ignore(x => x.Number) |
||||
|
.Ignore(x => x.ConfirmTime); |
||||
|
|
||||
|
CreateMap<ThirdLocationJobDetail, ThirdLocationNoteDetail>() |
||||
|
.ForMember(x => x.FromPackingCode, y => y.MapFrom(d => d.HandledPackingCode)) |
||||
|
.ForMember(x => x.ToPackingCode, y => y.MapFrom(d => d.HandledPackingCode)) |
||||
|
.ForMember(x => x.SupplierBatch, y => y.MapFrom(d => d.HandledSupplierBatch)) |
||||
|
.ForMember(x => x.ArriveDate, y => y.MapFrom(d => d.HandledArriveDate)) |
||||
|
.ForMember(x => x.ProduceDate, y => y.MapFrom(d => d.HandledProduceDate)) |
||||
|
.ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.HandledExpireDate)) |
||||
|
.ForMember(x => x.FromLot, y => y.MapFrom(d => d.HandledLot)) |
||||
|
.ForMember(x => x.ToLot, y => y.MapFrom(d => d.HandledLot)) |
||||
|
.ForMember(x => x.ToContainerCode, y => y.MapFrom(d => d.HandledContainerCode)) |
||||
|
.ForMember(x => x.FromContainerCode, y => y.MapFrom(d => d.HandledContainerCode)) |
||||
|
.ForMember(x => x.FromStatus, y => y.MapFrom(d => d.Status)) |
||||
|
.ForMember(x => x.ToStatus, y => y.MapFrom(d => d.Status)) |
||||
|
.ForMember(x => x.Qty, y => y.MapFrom(d => d.HandledQty)) |
||||
|
.ForMember(x => x.IssueTime, y => y.MapFrom(d => DateTime.Now)) |
||||
|
.ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.HandledFromLocationCode)) |
||||
|
.ForMember(x => x.FromLocationArea, y => y.MapFrom(d => d.HandledFromLocationArea)) |
||||
|
.ForMember(x => x.FromLocationGroup, y => y.MapFrom(d => d.HandledFromLocationGroup)) |
||||
|
.ForMember(x => x.FromLocationErpCode, y => y.MapFrom(d => d.HandledFromLocationErpCode)) |
||||
|
.ForMember(x => x.FromWarehouseCode, y => y.MapFrom(d => d.HandledFromWarehouseCode)) |
||||
|
.ForMember(x => x.ToLocationCode, y => y.MapFrom(d => d.ToLocationCode)) |
||||
|
.Ignore(x => x.ToLocationArea) |
||||
|
.Ignore(x => x.ToLocationGroup) |
||||
|
.Ignore(x => x.ToLocationErpCode) |
||||
|
; |
||||
|
|
||||
|
CreateMap<ThirdLocationJobDetail, ExpectInEditInput>() |
||||
|
.MapExpectInOutFrom() |
||||
|
.Ignore(x => x.Worker) |
||||
|
.Ignore(x => x.SerialNumber) |
||||
|
.Ignore(x => x.ExtraProperties) |
||||
|
; |
||||
|
|
||||
|
CreateMap<ThirdLocationJobDetail, ExpectOutEditInput>() |
||||
|
.MapExpectInOutFrom() |
||||
|
.Ignore(x => x.Worker) |
||||
|
.Ignore(x => x.SerialNumber) |
||||
|
.Ignore(x => x.ExtraProperties); |
||||
|
|
||||
|
CreateMap<ThirdLocationJob, ThirdLocationNoteEditInput>() |
||||
|
.ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.RequestNumber)) |
||||
|
.Ignore(x => x.Confirmed) |
||||
|
.Ignore(x => x.JobNumber) |
||||
|
.Ignore(x => x.ActiveDate) |
||||
|
; |
||||
|
CreateMap<ThirdLocationJobDetail, ThirdLocationNoteDetailInput>() |
||||
|
.ForMember(x => x.Qty, y => y.MapFrom(d => d.HandledQty)) |
||||
|
.ForMember(x => x.IssueTime, y => y.MapFrom(d => DateTime.Now)) |
||||
|
.ForMember(x => x.FromPackingCode, y => y.MapFrom(d => d.HandledPackingCode)) |
||||
|
.ForMember(x => x.ToPackingCode, y => y.MapFrom(d => d.HandledPackingCode)) |
||||
|
.ForMember(x => x.FromContainerCode, y => y.MapFrom(d => d.HandledContainerCode)) |
||||
|
.ForMember(x => x.ToContainerCode, y => y.MapFrom(d => d.HandledContainerCode)) |
||||
|
.ForMember(x => x.FromLot, y => y.MapFrom(d => d.HandledLot)) |
||||
|
.ForMember(x => x.ToLot, y => y.MapFrom(d => d.HandledLot)) |
||||
|
.ForMember(x => x.SupplierBatch, y => y.MapFrom(d => d.HandledSupplierBatch)) |
||||
|
.ForMember(x => x.ArriveDate, y => y.MapFrom(d => d.HandledArriveDate)) |
||||
|
.ForMember(x => x.ProduceDate, y => y.MapFrom(d => d.HandledProduceDate)) |
||||
|
.ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.ExpiredTime)) |
||||
|
.ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.HandledFromLocationCode)) |
||||
|
.ForMember(x => x.FromLocationArea, y => y.MapFrom(d => d.HandledFromLocationArea)) |
||||
|
.ForMember(x => x.FromLocationGroup, y => y.MapFrom(d => d.HandledFromLocationGroup)) |
||||
|
.ForMember(x => x.FromLocationErpCode, y => y.MapFrom(d => d.HandledFromLocationErpCode)) |
||||
|
.ForMember(x => x.FromWarehouseCode, y => y.MapFrom(d => d.HandledFromWarehouseCode)) |
||||
|
.ForMember(x => x.FromStatus, y => y.MapFrom(d => d.Status)) |
||||
|
.ForMember(x => x.ToStatus, y => y.MapFrom(d => d.Status)) |
||||
|
; |
||||
|
} |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
using AutoMapper; |
||||
|
using Volo.Abp.AutoMapper; |
||||
|
using Win_in.Sfs.Wms.Inventory.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Event; |
||||
|
|
||||
|
public partial class StoreEventAutoMapperProfile : Profile |
||||
|
{ |
||||
|
private void ThirdLocationNoteAutoMapperProfile() |
||||
|
{ |
||||
|
CreateMap<ThirdLocationNoteDetail, TransferLogEditInput>() |
||||
|
.Ignore(x => x.DocNumber) |
||||
|
.Ignore(x => x.JobNumber) |
||||
|
.Ignore(x => x.Worker) |
||||
|
.Ignore(x => x.TransType) |
||||
|
.Ignore(x => x.ExtraProperties) |
||||
|
.Ignore(x => x.TransSubType) |
||||
|
; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,135 @@ |
|||||
|
using AutoMapper; |
||||
|
using Volo.Abp.AutoMapper; |
||||
|
using Win_in.Sfs.Shared.Application; |
||||
|
using Win_in.Sfs.Wms.Inventory.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Event; |
||||
|
|
||||
|
public partial class StoreEventAutoMapperProfile : Profile |
||||
|
{ |
||||
|
private void ThirdLocationRequestAutoMapperProfile() |
||||
|
{ |
||||
|
CreateMap<ThirdLocationRequest, ThirdLocationJobEditInput>() |
||||
|
.ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.Number)) |
||||
|
.ForMember(x => x.RequestType, y => y.MapFrom(d => d.Type)) |
||||
|
.Ignore(x => x.WarehouseCode) |
||||
|
.Ignore(x => x.Workshop) |
||||
|
.Ignore(x => x.UpStreamJobNumber) |
||||
|
.Ignore(x => x.JobType) |
||||
|
.Ignore(x => x.IsAutoComplete) |
||||
|
.Ignore(x => x.ExpiredTime) |
||||
|
.Ignore(x => x.JobDescription) |
||||
|
.Ignore(x => x.JobStatus) |
||||
|
.Ignore(x => x.WorkGroupCode) |
||||
|
.Ignore(x => x.Priority) |
||||
|
.Ignore(x => x.PriorityIncrement) |
||||
|
.Ignore(x => x.AcceptUserId) |
||||
|
.Ignore(x => x.AcceptTime) |
||||
|
.Ignore(x => x.AcceptUserName) |
||||
|
.Ignore(x => x.CompleteUserId) |
||||
|
.Ignore(x => x.CompleteUserName) |
||||
|
.Ignore(x => x.CompleteTime) |
||||
|
.Ignore(x => x.Details) |
||||
|
; |
||||
|
|
||||
|
CreateMap<ThirdLocationRequestDetail, ThirdLocationJobDetailInput>() |
||||
|
.ForMember(x => x.RequestLocationCode, y => y.MapFrom(d => d.ToLocationCode)) |
||||
|
.Ignore(x => x.RecommendFromLocationArea) |
||||
|
.Ignore(x => x.RecommendFromLocationGroup) |
||||
|
.Ignore(x => x.HandledFromLocationArea) |
||||
|
.Ignore(x => x.HandledFromLocationGroup) |
||||
|
.Ignore(x => x.RecommendFromWarehouseCode) |
||||
|
.Ignore(x => x.HandledFromWarehouseCode) |
||||
|
.Ignore(x => x.OnTheWayLocationCode) |
||||
|
.Ignore(x => x.DistributionType) |
||||
|
.Ignore(x => x.RoundedQty) |
||||
|
.Ignore(x => x.Operation) |
||||
|
.Ignore(x => x.ExpiredTime) |
||||
|
.Ignore(x => x.TruncType) |
||||
|
.Ignore(x => x.PlanBeginTime) |
||||
|
.Ignore(x => x.PlannedSplitRule) |
||||
|
.Ignore(x => x.DeliveryQty) |
||||
|
.Ignore(x => x.Status) |
||||
|
.Ignore(x => x.RecommendContainerCode) |
||||
|
.Ignore(x => x.StdPackQty) |
||||
|
.Ignore(x => x.RecommendPackingCode) |
||||
|
.Ignore(x => x.HandledContainerCode) |
||||
|
.Ignore(x => x.HandledPackingCode) |
||||
|
.Ignore(x => x.RecommendSupplierBatch) |
||||
|
.Ignore(x => x.RecommendProduceDate) |
||||
|
.Ignore(x => x.RecommendArriveDate) |
||||
|
.Ignore(x => x.RecommendExpireDate) |
||||
|
.Ignore(x => x.HandledFromLocationCode) |
||||
|
.Ignore(x => x.HandledFromLocationErpCode) |
||||
|
.Ignore(x => x.HandledUom) |
||||
|
.Ignore(x => x.RecommendFromLocationErpCode) |
||||
|
.Ignore(x => x.HandledExpireDate) |
||||
|
.Ignore(x => x.HandledLot) |
||||
|
.Ignore(x => x.HandledArriveDate) |
||||
|
.Ignore(x => x.HandledProduceDate) |
||||
|
.Ignore(x => x.HandledQty) |
||||
|
.Ignore(x => x.RecommendQty) |
||||
|
.Ignore(x => x.Uom) |
||||
|
.Ignore(x => x.HandledSupplierBatch) |
||||
|
.Ignore(x => x.RecommendFromLocationCode) |
||||
|
.Ignore(x => x.RecommendLot) |
||||
|
.IgnoreIHasRecommendAndHandledFrom(); |
||||
|
|
||||
|
CreateMap<BalanceDTO, ThirdLocationJobDetailInput>() |
||||
|
.ForMember(x => x.RecommendArriveDate, y => y.MapFrom(d => d.ArriveDate)) |
||||
|
.ForMember(x => x.RecommendContainerCode, y => y.MapFrom(d => d.ContainerCode)) |
||||
|
.ForMember(x => x.RecommendExpireDate, y => y.MapFrom(d => d.ExpireDate)) |
||||
|
.ForMember(x => x.RecommendFromLocationCode, y => y.MapFrom(d => d.LocationCode)) |
||||
|
.ForMember(x => x.RecommendFromLocationErpCode, y => y.MapFrom(d => d.LocationErpCode)) |
||||
|
.ForMember(x => x.RecommendFromWarehouseCode, y => y.MapFrom(d => d.WarehouseCode)) |
||||
|
.ForMember(x => x.RecommendFromLocationArea, y => y.MapFrom(d => d.LocationArea)) |
||||
|
.ForMember(x => x.RecommendFromLocationGroup, y => y.MapFrom(d => d.LocationGroup)) |
||||
|
.ForMember(x => x.RecommendLot, y => y.MapFrom(d => d.Lot)) |
||||
|
.ForMember(x => x.RecommendPackingCode, y => y.MapFrom(d => d.PackingCode)) |
||||
|
.ForMember(x => x.RecommendProduceDate, y => y.MapFrom(d => d.ProduceDate)) |
||||
|
.ForMember(x => x.RecommendQty, y => y.MapFrom(d => d.Qty)) |
||||
|
.ForMember(x => x.RecommendSupplierBatch, y => y.MapFrom(d => d.SupplierBatch)) |
||||
|
.ForMember(x => x.Uom, y => y.MapFrom(d => d.Uom)).Ignore(x => x.HandledArriveDate) |
||||
|
.Ignore(x => x.HandledFromLocationArea) |
||||
|
.Ignore(x => x.HandledFromLocationGroup) |
||||
|
.Ignore(x => x.ToLocationErpCode) |
||||
|
.Ignore(x => x.ToWarehouseCode) |
||||
|
.Ignore(x => x.ToLocationArea) |
||||
|
.Ignore(x => x.ToLocationGroup) |
||||
|
.Ignore(x => x.HandledFromWarehouseCode) |
||||
|
.Ignore(x => x.RequestLocationCode) |
||||
|
.Ignore(x => x.ToLocationCode) |
||||
|
.Ignore(x => x.ProdLine) |
||||
|
.Ignore(x => x.WorkStation) |
||||
|
.Ignore(x => x.HandledContainerCode) |
||||
|
.Ignore(x => x.HandledExpireDate) |
||||
|
.Ignore(x => x.HandledFromLocationCode) |
||||
|
.Ignore(x => x.HandledFromLocationErpCode) |
||||
|
.Ignore(x => x.HandledLot) |
||||
|
.Ignore(x => x.HandledPackingCode) |
||||
|
.Ignore(x => x.HandledProduceDate) |
||||
|
.Ignore(x => x.HandledQty) |
||||
|
.Ignore(x => x.HandledSupplierBatch) |
||||
|
.Ignore(x => x.HandledUom) |
||||
|
.Ignore(x => x.Remark) |
||||
|
.Ignore(x => x.OnTheWayLocationCode) |
||||
|
.Ignore(x => x.DistributionType) |
||||
|
.Ignore(x => x.RoundedQty) |
||||
|
.Ignore(x => x.Operation) |
||||
|
.Ignore(x => x.ExpiredTime) |
||||
|
.Ignore(x => x.TruncType) |
||||
|
.Ignore(x => x.PlanBeginTime) |
||||
|
.Ignore(x => x.PlannedSplitRule) |
||||
|
.Ignore(x => x.DeliveryQty) |
||||
|
.Ignore(x => x.RequestLocationCode) |
||||
|
.Ignore(x => x.ToLocationCode) |
||||
|
.Ignore(x => x.ProdLine) |
||||
|
.Ignore(x => x.WorkStation) |
||||
|
.Ignore(x => x.PositionCode) |
||||
|
.Ignore(x => x.RecommendType) |
||||
|
.IgnoreIHasRecommendAndHandledFrom(); |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,130 @@ |
|||||
|
using System; |
||||
|
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.Store.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
using Win_in.Sfs.Wms.Store.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Event.BusinessJob; |
||||
|
|
||||
|
public class ThirdLocationJobEventHandler : |
||||
|
StoreEventHandlerBase |
||||
|
, ILocalEventHandler<SfsCompletedEntityEventData<ThirdLocationJob>> |
||||
|
{ |
||||
|
private const EnumTransType TransType = EnumTransType.Issue; |
||||
|
|
||||
|
private readonly IThirdLocationNoteAppService _thirdLocationNoteAppService; |
||||
|
private readonly ILocationAppService _locationAppService; |
||||
|
|
||||
|
public ThirdLocationJobEventHandler(IThirdLocationNoteAppService thirdLocationNoteAppService, ILocationAppService locationAppService) |
||||
|
{ |
||||
|
_thirdLocationNoteAppService = thirdLocationNoteAppService; |
||||
|
_locationAppService = locationAppService; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 执行后
|
||||
|
/// </summary>
|
||||
|
/// <param name="eventData"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCompletedEntityEventData<ThirdLocationJob> eventData) |
||||
|
{ |
||||
|
var entity = eventData.Entity; |
||||
|
var thirdLocationNote = await BuildThirdLocationNoteAsync(entity).ConfigureAwait(false); |
||||
|
await _thirdLocationNoteAppService.CreateAsync(thirdLocationNote).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
#region 私有
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建补料记录实体
|
||||
|
/// </summary>
|
||||
|
/// <param name="entity"></param>
|
||||
|
/// <returns></returns>
|
||||
|
private async Task<ThirdLocationNoteEditInput> BuildThirdLocationNoteAsync(ThirdLocationJob entity) |
||||
|
{ |
||||
|
var thirdLocationNoteCreateInput = ObjectMapper.Map<ThirdLocationJob, ThirdLocationNoteEditInput>(entity); |
||||
|
thirdLocationNoteCreateInput.JobNumber = entity.Number; |
||||
|
var locationCodes = thirdLocationNoteCreateInput.Details.Select(p => p.ToLocationCode).Distinct().ToList(); |
||||
|
var locations = await _locationAppService.GetByCodesAsync(locationCodes).ConfigureAwait(false); |
||||
|
|
||||
|
thirdLocationNoteCreateInput.Details.RemoveAll(p => p.Qty == 0); |
||||
|
|
||||
|
foreach (var detail in thirdLocationNoteCreateInput.Details) |
||||
|
{ |
||||
|
var location = locations.First(p => p.Code == detail.ToLocationCode); |
||||
|
await RemovePackingCodeAndContainerCodeAndLotAsync(detail, location.Type).ConfigureAwait(false); //去箱 去托 去批
|
||||
|
|
||||
|
detail.ToLocationArea = location.AreaCode; |
||||
|
detail.ToLocationGroup = location.LocationGroupCode; |
||||
|
detail.ToLocationErpCode = location.ErpLocationCode; |
||||
|
detail.ToWarehouseCode = location.WarehouseCode; |
||||
|
} |
||||
|
|
||||
|
return thirdLocationNoteCreateInput; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 去除箱码 托码 批次
|
||||
|
/// </summary>
|
||||
|
private async Task RemovePackingCodeAndContainerCodeAndLotAsync(ThirdLocationNoteDetailInput thirdLocationNoteDetail, |
||||
|
EnumLocationType locationType) |
||||
|
{ |
||||
|
switch (locationType) |
||||
|
{ |
||||
|
case EnumLocationType.WIP: |
||||
|
{ |
||||
|
//用开关控制 发料到线边后去除箱码和托码 ???
|
||||
|
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemovePackingCode) |
||||
|
.ConfigureAwait(false)) |
||||
|
{ |
||||
|
thirdLocationNoteDetail.ToPackingCode = ""; |
||||
|
} |
||||
|
|
||||
|
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveContainerCode) |
||||
|
.ConfigureAwait(false)) |
||||
|
{ |
||||
|
thirdLocationNoteDetail.ToContainerCode = ""; |
||||
|
} |
||||
|
|
||||
|
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveLot).ConfigureAwait(false)) |
||||
|
{ |
||||
|
thirdLocationNoteDetail.ToLot = ""; |
||||
|
} |
||||
|
|
||||
|
break; |
||||
|
} |
||||
|
case EnumLocationType.SEMI: |
||||
|
{ |
||||
|
//用开关控制 发料到后去除箱码和托码 ???
|
||||
|
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemovePackingCode) |
||||
|
.ConfigureAwait(false)) |
||||
|
{ |
||||
|
thirdLocationNoteDetail.ToPackingCode = ""; |
||||
|
} |
||||
|
|
||||
|
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveContainerCode) |
||||
|
.ConfigureAwait(false)) |
||||
|
{ |
||||
|
thirdLocationNoteDetail.ToContainerCode = ""; |
||||
|
} |
||||
|
|
||||
|
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveLot).ConfigureAwait(false)) |
||||
|
{ |
||||
|
thirdLocationNoteDetail.ToLot = ""; |
||||
|
} |
||||
|
|
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
} |
@ -0,0 +1,283 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using FluentValidation.Validators; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.EventBus; |
||||
|
using Volo.Abp.SettingManagement; |
||||
|
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.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; |
||||
|
|
||||
|
public class ThirdLocationRequestEventHandler |
||||
|
: StoreEventHandlerBase |
||||
|
, ILocalEventHandler<SfsHandledEntityEventData<ThirdLocationRequest>> |
||||
|
, ILocalEventHandler<SfsAbortedEntityEventData<ThirdLocationRequest>> |
||||
|
, ILocalEventHandler<SfsCompletedEntityEventData<ThirdLocationRequest>> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<ThirdLocationRequest>> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<List<ThirdLocationRequest>>> |
||||
|
{ |
||||
|
private readonly IThirdLocationJobAppService _thirdLocationJobAppService; |
||||
|
private readonly IProductionLineAppService _productionLineAppService; |
||||
|
private readonly IThirdLocationRequestManager _assembleRequestManager; |
||||
|
private readonly ILocationAppService _locationAppService; |
||||
|
private readonly IBalanceAppService _balanceAppService; |
||||
|
|
||||
|
public ThirdLocationRequestEventHandler( |
||||
|
IThirdLocationJobAppService thirdLocationJobAppService |
||||
|
, IProductionLineAppService productionLineAppService |
||||
|
, IThirdLocationRequestManager assembleRequestManager |
||||
|
, ILocationAppService locationAppService |
||||
|
, IBalanceAppService balanceAppService) |
||||
|
{ |
||||
|
_thirdLocationJobAppService = thirdLocationJobAppService; |
||||
|
_productionLineAppService = productionLineAppService; |
||||
|
_assembleRequestManager = assembleRequestManager; |
||||
|
_locationAppService = locationAppService; |
||||
|
_balanceAppService = balanceAppService; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建后
|
||||
|
/// </summary>
|
||||
|
/// <param name="eventData">Event data</param>
|
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<ThirdLocationRequest> eventData) |
||||
|
{ |
||||
|
var entity = eventData.Entity; |
||||
|
|
||||
|
//if (entity.AutoSubmit)
|
||||
|
//{
|
||||
|
// await _assembleRequestManager.SubmitAsync(entity).ConfigureAwait(false);
|
||||
|
//}
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 批量创建后
|
||||
|
/// </summary>
|
||||
|
/// <param name="eventData">Event data</param>
|
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<ThirdLocationRequest>> eventData) |
||||
|
{ |
||||
|
var entitys = eventData.Entity; |
||||
|
foreach (var entity in entitys) |
||||
|
{ |
||||
|
if (entity.AutoSubmit) |
||||
|
{ |
||||
|
await _assembleRequestManager.SubmitAsync(entity).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 执行后
|
||||
|
/// </summary>
|
||||
|
/// <param name="eventData"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public virtual async Task HandleEventAsync(SfsHandledEntityEventData<ThirdLocationRequest> eventData) |
||||
|
{ |
||||
|
var entity = eventData.Entity; |
||||
|
var thirdLocationJobs = await BuildThirdLocationJobAsync(entity).ConfigureAwait(false); |
||||
|
if (thirdLocationJobs.Any()) |
||||
|
{ |
||||
|
await _thirdLocationJobAppService.CreateManyAsync(thirdLocationJobs).ConfigureAwait(false); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 驳回后
|
||||
|
/// </summary>
|
||||
|
/// <param name="eventData"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<ThirdLocationRequest> eventData) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 完成后
|
||||
|
/// </summary>
|
||||
|
/// <param name="eventData"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public virtual async Task HandleEventAsync(SfsCompletedEntityEventData<ThirdLocationRequest> eventData) |
||||
|
{ |
||||
|
_ = eventData.Entity; |
||||
|
// await _thirdLocationJobAppService.CompleteByThirdLocationRequestAsync(entity.Number);
|
||||
|
|
||||
|
await Task.CompletedTask.ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
#region 私有
|
||||
|
|
||||
|
private async Task<List<ThirdLocationJobEditInput>> BuildThirdLocationJobAsync |
||||
|
(ThirdLocationRequest assembleRequest) |
||||
|
{ |
||||
|
var jobs = new List<ThirdLocationJobEditInput>(); |
||||
|
|
||||
|
var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false);//库存事务
|
||||
|
|
||||
|
var toLocationCodes = assembleRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList();//所有发送库位的集合
|
||||
|
var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false);//所有库位的集合
|
||||
|
|
||||
|
var assembleRequestDetails = assembleRequest.Details.Where(p => p.ToBeIssuedQty > 0);//所有还没发送物品的集合
|
||||
|
foreach (var assembleRequestDetail in assembleRequestDetails)//如果有还有剩余未叫料的数量 则创建新的任务
|
||||
|
{ |
||||
|
var toLocation = toLocations.FirstOrDefault(p => p.Code == assembleRequestDetail.ToLocationCode);//判断目标库位是否存在
|
||||
|
Check.NotNull(toLocation, "库位代码", $"库位 {assembleRequestDetail.ToLocationCode} 不存在"); |
||||
|
|
||||
|
//创建详情
|
||||
|
var jobDetails = await BuildThirdLocationJobDetailInputsAsync(assembleRequest, assembleRequestDetail, transactionType, toLocation.LocationGroupCode).ConfigureAwait(false); |
||||
|
if (!jobDetails.Any()) |
||||
|
{ |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
var fromLocationCode = jobDetails[0].RecommendFromLocationCode; |
||||
|
var fromLocation = await _locationAppService.GetByCodeAsync(fromLocationCode).ConfigureAwait(false); |
||||
|
var job = jobs.FirstOrDefault(p => p.WorkGroupCode == fromLocation?.WorkGroupCode); |
||||
|
if (job == null || job.Details.Any(p => p.ToLocationCode != assembleRequestDetail.ToLocationCode)) |
||||
|
{ |
||||
|
job = BuildThirdLocationJobCreateInput(assembleRequest, fromLocation); |
||||
|
jobs.Add(job); |
||||
|
} |
||||
|
job.Details.AddRange(jobDetails); |
||||
|
if (assembleRequestDetail.ToBeIssuedQty < 0) |
||||
|
{ |
||||
|
assembleRequestDetail.Status = EnumStatus.Close; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
jobs = jobs.Where(p => p.Details.Any()).ToList(); |
||||
|
|
||||
|
var openRequestDetails = |
||||
|
assembleRequest.Details.Where(p => p.Status != EnumStatus.Close).ToList(); |
||||
|
|
||||
|
if (!openRequestDetails.Any()) |
||||
|
{ |
||||
|
return jobs; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
var enableMultipleCreateThirdLocationJob = await SettingManager.IsTrueAsync(StoreSettings.MaterialRequest.EnableMultipleCreateIssueJob).ConfigureAwait(false); |
||||
|
if (enableMultipleCreateThirdLocationJob) |
||||
|
{ |
||||
|
|
||||
|
//assembleRequest.Partial();
|
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
var sb = new StringBuilder(); |
||||
|
foreach (var openRequestDetail in openRequestDetails) |
||||
|
{ |
||||
|
sb.AppendLine($"{openRequestDetail.ItemCode}请求数量 {openRequestDetail.Qty},可用库存数量 {openRequestDetail.IssuedQty}"); |
||||
|
} |
||||
|
throw new UserFriendlyException($"{sb} 可用库存数量不足, 无法生成发料任务"); |
||||
|
} |
||||
|
return jobs; |
||||
|
} |
||||
|
|
||||
|
private ThirdLocationJobEditInput BuildThirdLocationJobCreateInput(ThirdLocationRequest assembleRequest, LocationDTO fromLocation) |
||||
|
{ |
||||
|
ThirdLocationJobEditInput job; |
||||
|
job = ObjectMapper.Map<ThirdLocationRequest, ThirdLocationJobEditInput>(assembleRequest); |
||||
|
job.JobType = EnumJobType.IssueJob; |
||||
|
job.JobStatus = EnumJobStatus.Open; |
||||
|
job.WorkGroupCode = fromLocation.WorkGroupCode; |
||||
|
job.WarehouseCode = fromLocation.WarehouseCode; |
||||
|
job.ProdLine = fromLocation.LocationGroupCode; |
||||
|
job.Worker = assembleRequest.Worker; |
||||
|
if (string.IsNullOrEmpty(job.Worker)) |
||||
|
{ |
||||
|
job.Worker = "admin"; |
||||
|
} |
||||
|
job.RequestNumber = assembleRequest.Number; |
||||
|
return job; |
||||
|
} |
||||
|
|
||||
|
private async Task<List<ThirdLocationJobDetailInput>> BuildThirdLocationJobDetailInputsAsync(ThirdLocationRequest assembleRequest, |
||||
|
ThirdLocationRequestDetail assembleRequestDetail, TransactionTypeDTO transactionType, string toLocationGroupCode) |
||||
|
{ |
||||
|
var jobDetails = new List<ThirdLocationJobDetailInput>(); |
||||
|
var input = new RecommendBalanceRequestInput() |
||||
|
{ |
||||
|
ItemCode = assembleRequestDetail.ItemCode, |
||||
|
Qty = assembleRequestDetail.ToBeIssuedQty, |
||||
|
LocationTypes = transactionType.OutLocationTypes, |
||||
|
LocationAreas = new List<string> { assembleRequestDetail.FromLocationArea }, |
||||
|
Statuses = transactionType.OutInventoryStatuses, |
||||
|
}; |
||||
|
//获取推荐库存
|
||||
|
var recommendList = await _balanceAppService.GetRecommendBalancesAsync(input).ConfigureAwait(false); |
||||
|
//没有推荐库存时 跳过此明细 不生成任务
|
||||
|
if (recommendList.Count != 0) |
||||
|
{ |
||||
|
foreach (var recommend in recommendList) |
||||
|
{ |
||||
|
//拿走需求量
|
||||
|
var detail = await BuildThirdLocationJobDetailAsync(assembleRequestDetail, recommend, toLocationGroupCode).ConfigureAwait(false); |
||||
|
if (assembleRequest.UseOnTheWayLocation) |
||||
|
{ |
||||
|
//获取在途库
|
||||
|
var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false); |
||||
|
|
||||
|
detail.OnTheWayLocationCode = locationDto.Code; |
||||
|
} |
||||
|
|
||||
|
jobDetails.Add(detail); |
||||
|
assembleRequestDetail.IssuedQty += recommend.Qty; |
||||
|
|
||||
|
//await _assembleRequestManager.UpdateDetailsAsync(assembleRequest).ConfigureAwait(false);
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
return jobDetails; |
||||
|
} |
||||
|
|
||||
|
private async Task<ThirdLocationJobDetailInput> BuildThirdLocationJobDetailAsync(ThirdLocationRequestDetail assembleRequestDetail, BalanceDTO balance, string toLocationGroupCode) |
||||
|
{ |
||||
|
|
||||
|
//ProductionLineDTO prodLine = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationGroupCode).ConfigureAwait(false);
|
||||
|
|
||||
|
var detail = ObjectMapper.Map<BalanceDTO, ThirdLocationJobDetailInput>(balance); |
||||
|
detail.RequestLocationCode = assembleRequestDetail.ToLocationCode; |
||||
|
detail.WorkStation = assembleRequestDetail.WorkStation; |
||||
|
detail.ExpiredTime = assembleRequestDetail.ExpiredTime; |
||||
|
detail.PositionCode = assembleRequestDetail.PositionCode; |
||||
|
detail.RecommendType = assembleRequestDetail.RecommendType; |
||||
|
|
||||
|
detail.RecommendPackingCode = balance.PackingCode; |
||||
|
detail.RecommendContainerCode = balance.ContainerCode; |
||||
|
detail.RecommendSupplierBatch = balance.SupplierBatch; |
||||
|
detail.RecommendProduceDate = balance.ProduceDate; |
||||
|
detail.RecommendExpireDate = balance.ExpireDate; |
||||
|
detail.RecommendLot = balance.Lot; |
||||
|
detail.RecommendProduceDate = balance.ProduceDate; |
||||
|
detail.RecommendArriveDate = balance.ArriveDate; |
||||
|
detail.RecommendFromLocationArea = balance.LocationArea; |
||||
|
detail.RecommendFromLocationCode = balance.LocationCode; |
||||
|
detail.RecommendFromLocationErpCode = balance.LocationErpCode; |
||||
|
detail.RecommendFromLocationGroup = balance.LocationGroup; |
||||
|
detail.RecommendFromWarehouseCode = balance.WarehouseCode; |
||||
|
detail.RecommendQty = balance.Qty; |
||||
|
detail.Uom = balance.Uom; |
||||
|
|
||||
|
detail.ToLocationCode = assembleRequestDetail.ToLocationCode; |
||||
|
detail.ToLocationErpCode = assembleRequestDetail.ToLocationErpCode; |
||||
|
detail.ToLocationArea = assembleRequestDetail.ToLocationArea; |
||||
|
detail.ToWarehouseCode = assembleRequestDetail.ToWarehouseCode; |
||||
|
|
||||
|
//detail.ProdLine = prodLine == null ? toLocationGroupCode : prodLine.Code;
|
||||
|
detail.ProdLine = toLocationGroupCode; |
||||
|
await Task.CompletedTask.ConfigureAwait(false); |
||||
|
return detail; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
} |
Loading…
Reference in new issue