diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/DTOs/AssembleJobDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/DTOs/AssembleJobDTO.cs index 5d1a2a6e9..7f435efd2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/DTOs/AssembleJobDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/DTOs/AssembleJobDTO.cs @@ -28,14 +28,7 @@ public class AssembleJobDTO : SfsJobDTOBase /// [Display(Name = "要货单号")] [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string AssembleIssueRequestsNumber { get; set; } - - /// - /// 车间 - /// - [Display(Name = "车间")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string Workshop { get; set; } + public string AssembleRequestNumber { get; set; } /// /// 使用在途库 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/DTOs/AssembleJobDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/DTOs/AssembleJobDetailDTO.cs index c89aa7d8f..236b30fb3 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/DTOs/AssembleJobDetailDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/DTOs/AssembleJobDetailDTO.cs @@ -1,112 +1,519 @@ using System; using System.ComponentModel.DataAnnotations; -using Win_in.Sfs.Shared.Domain; +using System.ComponentModel.DataAnnotations.Schema; +using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class AssembleJobDetailDTO : SfsJobRecommendFromDetailDTOBase, IHasToLocation +public class AssembleJobDetailDTO : SfsDetailDTOBase { + #region 库存基础信息 /// - /// 请求库位 + /// 物品代码 /// - [Display(Name = "请求库位")] - public string RequestLocationCode { get; set; } + public string ItemCode { get; set; } + + /// + /// 物品名称 + /// + public string ItemName { get; set; } + + /// + /// 物品描述1 + /// + public string ItemDesc1 { get; set; } + + /// + /// 物品描述2 + /// + public string ItemDesc2 { get; set; } + + /// + /// 标包数量 + /// + [Display(Name = "标包数量")] + [Column(TypeName = "decimal(18,6)")] + public decimal StdPackQty { get; set; } + + /// + /// 库存状态 + /// + public EnumInventoryStatus Status { get; set; } /// - /// 到库位 + /// 计量单位 /// - [Display(Name = "到库位")] - public string ToLocationCode { get; set; } + public string Uom { get; set; } + + #endregion + + #region 请求信息 + + /// + /// 请求库位 + /// + public string RequestLocationCode { get; set; } /// - /// 到库区 + /// 到库区 /// - [Display(Name = "到库区")] - public string ToLocationArea { get; set; } + public string RequestLocationArea { get; set; } /// - /// 到库位组 + /// 到库位组 /// - [Display(Name = "到库位组")] - public string ToLocationGroup { get; set; } + public string RequestLocationGroup { get; set; } /// - /// 到ERP库位 + /// 到ERP库位 /// - [Display(Name = "到ERP库位")] - public string ToLocationErpCode { get; set; } + public string RequestLocationErpCode { get; set; } /// - /// 到仓库 + /// 到仓库 /// - [Display(Name = "到仓库")] - public string ToWarehouseCode { get; set; } + public string RequestWarehouseCode { get; set; } /// - /// 在途库库位 + /// 在途库库位 /// - [Display(Name = "在途库库位")] public string OnTheWayLocationCode { get; set; } /// - /// 生产线 + /// 生产线 /// - [Display(Name = "生产线")] public string ProdLine { get; set; } /// - /// 工作中心 + /// 位置码 + /// + public string PositionCode { get; set; } + + /// + /// 推荐的类型 + /// + public EnumRecommendType RecommendType { get; set; } + + /// + /// 需求数量 + /// + public decimal RequestQty { get; set; } + + #endregion + + #region 推荐来源 + + /// + /// 推荐来源托标签 + /// + public string RecommendFromContainerCode { get; set; } + + /// + /// 推荐来源箱标签 + /// + public string RecommendFromPackingCode { get; set; } + + /// + /// 推荐来源批次供应商批次 + /// + public string RecommendFromSupplierBatch { get; set; } + + /// + /// 推荐来源批次到货时间 + /// + public DateTime RecommendFromArriveDate { get; set; } + + /// + /// 推荐来源批次生产时间 + /// + public DateTime RecommendFromProduceDate { get; set; } + + /// + /// 推荐来源批次过期时间 + /// + public DateTime RecommendFromExpireDate { get; set; } + + /// + /// 推荐来源批次排序 + /// + public string RecommendFromLot { get; set; } + + /// + /// 推荐来源库位 + /// + public string RecommendFromLocationCode { get; set; } + + /// + /// 推荐来源库区 + /// + public string RecommendFromLocationArea { get; set; } + + /// + /// 推荐来源库位组 + /// + public string RecommendFromLocationGroup { get; set; } + + /// + /// 推荐来源ERP库位 /// - [Display(Name = "工作中心")] - public string WorkStation { get; set; } + public string RecommendFromLocationErpCode { get; set; } /// - /// 过期时间 + /// 推荐来源仓库 /// - [Display(Name = "过期时间")] - public DateTime ExpiredTime { get; set; } + public string RecommendFromWarehouseCode { get; set; } /// - /// 工序 + /// 推荐来源数量 /// - [Display(Name = "工序")] - public string Operation { get; set; } + public decimal RecommendFromQty { get; set; } + + #endregion + + #region 推荐目标 + + /// + /// 推荐目标托标签 + /// + public string RecommendToContainerCode { get; set; } + + /// + /// 推荐目标箱标签 + /// + public string RecommendToPackingCode { get; set; } + + /// + /// 推荐目标批次供应商批次 + /// + public string RecommendToSupplierBatch { get; set; } + + /// + /// 推荐目标批次到货时间 + /// + public DateTime RecommendToArriveDate { get; set; } + + /// + /// 推荐目标批次生产时间 + /// + public DateTime RecommendToProduceDate { get; set; } + + /// + /// 推荐目标批次过期时间 + /// + public DateTime RecommendToExpireDate { get; set; } + + /// + /// 推荐目标批次排序 + /// + public string RecommendToLot { get; set; } + + /// + /// 推荐目标库位 + /// + public string RecommendToLocationCode { get; set; } + + /// + /// 推荐目标库区 + /// + public string RecommendToLocationArea { get; set; } /// - /// 配送方式 + /// 推荐目标库位组 /// - [Display(Name = "配送方式")] - public EnumDistributionType DistributionType { get; set; } + public string RecommendToLocationGroup { get; set; } /// - /// 取整方式 + /// 推荐目标ERP库位 /// - [Display(Name = "取整方式")] - public EnumTruncType TruncType { get; set; } + public string RecommendToLocationErpCode { get; set; } /// - /// 取整后数量 + /// 推荐目标仓库 /// - [Display(Name = "取整后数量")] - public decimal RoundedQty { get; set; } + public string RecommendToWarehouseCode { get; set; } /// - /// 计划拆分规则 + /// 推荐目标数量 /// - [Display(Name = "计划拆分规则")] - public EnumPlannedSplitRule PlannedSplitRule { get; set; } + public decimal RecommendToQty { get; set; } + + #endregion + + #region 库移来源 /// - /// 计划开始时间 + /// 库移来源托标签 /// - [Display(Name = "计划开始时间")] - public DateTime PlanBeginTime { get; set; } + public string TransferLibFromContainerCode { get; set; } /// - /// 每次配送数量 + /// 库移来源箱标签 /// - [Display(Name = "每次配送数量")] - public decimal DeliveryQty { get; set; } + public string TransferLibFromPackingCode { get; set; } + + /// + /// 库移来源批次供应商批次 + /// + public string TransferLibFromSupplierBatch { get; set; } + + /// + /// 库移来源批次到货时间 + /// + public DateTime TransferLibFromArriveDate { get; set; } + + /// + /// 库移来源批次生产时间 + /// + public DateTime TransferLibFromProduceDate { get; set; } + + /// + /// 库移来源批次过期时间 + /// + public DateTime TransferLibFromExpireDate { get; set; } + + /// + /// 库移来源批次排序 + /// + public string TransferLibFromLot { get; set; } + + /// + /// 库移来源库位 + /// + public string TransferLibFromLocationCode { get; set; } + + /// + /// 库移来源库区 + /// + public string TransferLibFromLocationArea { get; set; } + + /// + /// 库移来源库位组 + /// + public string TransferLibFromLocationGroup { get; set; } + + /// + /// 库移来源ERP库位 + /// + public string TransferLibFromLocationErpCode { get; set; } + + /// + /// 库移来源仓库 + /// + public string TransferLibFromWarehouseCode { get; set; } + + /// + /// 库移来源数量 + /// + public decimal TransferLibFromQty { get; set; } + + #endregion + + #region 库移目标 + + /// + /// 库移目标托标签 + /// + public string TransferLibToContainerCode { get; set; } + + /// + /// 库移目标箱标签 + /// + public string TransferLibToPackingCode { get; set; } + + /// + /// 库移目标批次供应商批次 + /// + public string TransferLibToSupplierBatch { get; set; } + + /// + /// 库移目标批次到货时间 + /// + public DateTime TransferLibToArriveDate { get; set; } + + /// + /// 库移目标批次生产时间 + /// + public DateTime TransferLibToProduceDate { get; set; } + + /// + /// 库移目标批次过期时间 + /// + public DateTime TransferLibToExpireDate { get; set; } + + /// + /// 库移目标批次排序 + /// + public string TransferLibToLot { get; set; } + + /// + /// 库移目标库位 + /// + public string TransferLibToLocationCode { get; set; } + + /// + /// 库移目标库区 + /// + public string TransferLibToLocationArea { get; set; } + + /// + /// 库移目标库位组 + /// + public string TransferLibToLocationGroup { get; set; } + + /// + /// 库移目标ERP库位 + /// + public string TransferLibToLocationErpCode { get; set; } + + /// + /// 库移目标仓库 + /// + public string TransferLibToWarehouseCode { get; set; } + + /// + /// 库移目标数量 + /// + public decimal TransferLibToQty { get; set; } + + #endregion + + #region 实际来源 + + /// + /// 实际目标托标签 + /// + public string HandledFromContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledFromPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledFromSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledFromArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledFromProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledFromExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledFromLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledFromLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledFromLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledFromLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledFromLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledFromWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledFromQty { get; set; } + + #endregion + + #region 实际目标 + + /// + /// 实际目标托标签 + /// + public string HandledToContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledToPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledToSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledToArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledToProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledToExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledToLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledToLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledToLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledToLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledToLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledToWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledToQty { get; set; } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/IAssembleJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/IAssembleJobAppService.cs index fae62f6c7..1051d7cf4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/IAssembleJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/IAssembleJobAppService.cs @@ -8,19 +8,8 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts; public interface IAssembleJobAppService : ISfsJobAppServiceBase { - Task> CheckJobExistByItemCodeAndLocationCode(string itemCode, string locationCode); - Task CancelByMaterialRequestAsync(string assembleNumber); - Task> GetListByTypeAsync(SfsJobRequestInputBase requestInput, string requestType, - bool includeDetails = false, CancellationToken cancellationToken = default); - Task> GetByRequestNumberAsync(string requestNumber); - /// - /// 保存拆箱时涉及的明细修改 - /// - /// - Task SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input); - } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/Inputs/AssembleJobDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/Inputs/AssembleJobDetailInput.cs index 18b59ae9d..903d6df5a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/Inputs/AssembleJobDetailInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AssembleJobs/Inputs/AssembleJobDetailInput.cs @@ -1,134 +1,519 @@ using System; using System.ComponentModel.DataAnnotations; -using Win_in.Sfs.Shared.Domain; +using System.ComponentModel.DataAnnotations.Schema; +using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class AssembleJobDetailInput : SfsJobRecommendFromDetailInputBase, IHasToLocation +public class AssembleJobDetailInput : SfsDetailInputBase { + #region 库存基础信息 /// - /// 请求库位 + /// 物品代码 /// - [Display(Name = "请求库位")] - [Required(ErrorMessage = "{0}是必填项")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string RequestLocationCode { get; set; } + public string ItemCode { get; set; } + + /// + /// 物品名称 + /// + public string ItemName { get; set; } + + /// + /// 物品描述1 + /// + public string ItemDesc1 { get; set; } + + /// + /// 物品描述2 + /// + public string ItemDesc2 { get; set; } + + /// + /// 标包数量 + /// + [Display(Name = "标包数量")] + [Column(TypeName = "decimal(18,6)")] + public decimal StdPackQty { get; set; } + + /// + /// 库存状态 + /// + public EnumInventoryStatus Status { get; set; } /// - /// 到库位 + /// 计量单位 /// - [Display(Name = "到库位")] - [Required(ErrorMessage = "{0}是必填项")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string ToLocationCode { get; set; } + public string Uom { get; set; } + + #endregion + + #region 请求信息 + + /// + /// 请求库位 + /// + public string RequestLocationCode { get; set; } /// - /// 到库区 + /// 到库区 /// - [Display(Name = "到库区")] - public string ToLocationArea { get; set; } + public string RequestLocationArea { get; set; } /// - /// 到库位组 + /// 到库位组 /// - [Display(Name = "到库位组")] - public string ToLocationGroup { get; set; } + public string RequestLocationGroup { get; set; } /// - /// 到ERP库位 + /// 到ERP库位 /// - [Display(Name = "到ERP库位")] - [Required(ErrorMessage = "{0}是必填项")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string ToLocationErpCode { get; set; } + public string RequestLocationErpCode { get; set; } /// - /// 到仓库 + /// 到仓库 /// - [Display(Name = "到仓库")] - [Required(ErrorMessage = "{0}是必填项")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string ToWarehouseCode { get; set; } + public string RequestWarehouseCode { get; set; } /// - /// 在途库库位 + /// 在途库库位 /// - [Display(Name = "在途库库位")] public string OnTheWayLocationCode { get; set; } /// - /// 生产线 + /// 生产线 /// - [Display(Name = "生产线")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] public string ProdLine { get; set; } /// - /// 工作中心 + /// 位置码 + /// + public string PositionCode { get; set; } + + /// + /// 推荐的类型 /// - [Display(Name = "工作中心")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string WorkStation { get; set; } + public EnumRecommendType RecommendType { get; set; } /// - /// 过期时间 + /// 需求数量 /// - [Display(Name = "过期时间")] - [Required(ErrorMessage = "{0}是必填项")] - public DateTime ExpiredTime { get; set; } + public decimal RequestQty { get; set; } + + #endregion + + #region 推荐来源 /// - /// 工序 + /// 推荐来源托标签 /// - [Display(Name = "工序")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string Operation { get; set; } + public string RecommendFromContainerCode { get; set; } /// - /// 配送方式 + /// 推荐来源箱标签 /// - [Display(Name = "配送方式")] - public EnumDistributionType DistributionType { get; set; } + public string RecommendFromPackingCode { get; set; } /// - /// 取整方式 + /// 推荐来源批次供应商批次 /// - [Display(Name = "取整方式")] - public EnumTruncType TruncType { get; set; } + public string RecommendFromSupplierBatch { get; set; } /// - /// 取整后数量 + /// 推荐来源批次到货时间 /// - [Display(Name = "取整后数量")] - public decimal RoundedQty { get; set; } + public DateTime RecommendFromArriveDate { get; set; } /// - /// 计划拆分规则 + /// 推荐来源批次生产时间 /// - [Display(Name = "计划拆分规则")] - public EnumPlannedSplitRule PlannedSplitRule { get; set; } + public DateTime RecommendFromProduceDate { get; set; } /// - /// 计划开始时间 + /// 推荐来源批次过期时间 /// - [Display(Name = "计划开始时间")] - public DateTime PlanBeginTime { get; set; } + public DateTime RecommendFromExpireDate { get; set; } /// - /// 每次配送数量 + /// 推荐来源批次排序 /// - [Display(Name = "每次配送数量")] - public decimal DeliveryQty { get; set; } + public string RecommendFromLot { get; set; } /// - /// 位置码 + /// 推荐来源库位 /// - public string PositionCode { get; set; } + public string RecommendFromLocationCode { get; set; } /// - /// 推荐类型 + /// 推荐来源库区 /// - public EnumRecommendType RecommendType { get; set; } + public string RecommendFromLocationArea { get; set; } + + /// + /// 推荐来源库位组 + /// + public string RecommendFromLocationGroup { get; set; } + + /// + /// 推荐来源ERP库位 + /// + public string RecommendFromLocationErpCode { get; set; } + + /// + /// 推荐来源仓库 + /// + public string RecommendFromWarehouseCode { get; set; } + + /// + /// 推荐来源数量 + /// + public decimal RecommendFromQty { get; set; } + + #endregion + + #region 推荐目标 + + /// + /// 推荐目标托标签 + /// + public string RecommendToContainerCode { get; set; } + + /// + /// 推荐目标箱标签 + /// + public string RecommendToPackingCode { get; set; } + + /// + /// 推荐目标批次供应商批次 + /// + public string RecommendToSupplierBatch { get; set; } + + /// + /// 推荐目标批次到货时间 + /// + public DateTime RecommendToArriveDate { get; set; } + + /// + /// 推荐目标批次生产时间 + /// + public DateTime RecommendToProduceDate { get; set; } + + /// + /// 推荐目标批次过期时间 + /// + public DateTime RecommendToExpireDate { get; set; } + + /// + /// 推荐目标批次排序 + /// + public string RecommendToLot { get; set; } + + /// + /// 推荐目标库位 + /// + public string RecommendToLocationCode { get; set; } + + /// + /// 推荐目标库区 + /// + public string RecommendToLocationArea { get; set; } + + /// + /// 推荐目标库位组 + /// + public string RecommendToLocationGroup { get; set; } + + /// + /// 推荐目标ERP库位 + /// + public string RecommendToLocationErpCode { get; set; } + + /// + /// 推荐目标仓库 + /// + public string RecommendToWarehouseCode { get; set; } + + /// + /// 推荐目标数量 + /// + public decimal RecommendToQty { get; set; } + + #endregion + + #region 库移来源 + + /// + /// 库移来源托标签 + /// + public string TransferLibFromContainerCode { get; set; } + + /// + /// 库移来源箱标签 + /// + public string TransferLibFromPackingCode { get; set; } + + /// + /// 库移来源批次供应商批次 + /// + public string TransferLibFromSupplierBatch { get; set; } + + /// + /// 库移来源批次到货时间 + /// + public DateTime TransferLibFromArriveDate { get; set; } + + /// + /// 库移来源批次生产时间 + /// + public DateTime TransferLibFromProduceDate { get; set; } + + /// + /// 库移来源批次过期时间 + /// + public DateTime TransferLibFromExpireDate { get; set; } + + /// + /// 库移来源批次排序 + /// + public string TransferLibFromLot { get; set; } + + /// + /// 库移来源库位 + /// + public string TransferLibFromLocationCode { get; set; } + + /// + /// 库移来源库区 + /// + public string TransferLibFromLocationArea { get; set; } + + /// + /// 库移来源库位组 + /// + public string TransferLibFromLocationGroup { get; set; } + + /// + /// 库移来源ERP库位 + /// + public string TransferLibFromLocationErpCode { get; set; } + + /// + /// 库移来源仓库 + /// + public string TransferLibFromWarehouseCode { get; set; } + + /// + /// 库移来源数量 + /// + public decimal TransferLibFromQty { get; set; } + + #endregion + + #region 库移目标 + + /// + /// 库移目标托标签 + /// + public string TransferLibToContainerCode { get; set; } + + /// + /// 库移目标箱标签 + /// + public string TransferLibToPackingCode { get; set; } + + /// + /// 库移目标批次供应商批次 + /// + public string TransferLibToSupplierBatch { get; set; } + + /// + /// 库移目标批次到货时间 + /// + public DateTime TransferLibToArriveDate { get; set; } + + /// + /// 库移目标批次生产时间 + /// + public DateTime TransferLibToProduceDate { get; set; } + + /// + /// 库移目标批次过期时间 + /// + public DateTime TransferLibToExpireDate { get; set; } + + /// + /// 库移目标批次排序 + /// + public string TransferLibToLot { get; set; } + + /// + /// 库移目标库位 + /// + public string TransferLibToLocationCode { get; set; } + + /// + /// 库移目标库区 + /// + public string TransferLibToLocationArea { get; set; } + + /// + /// 库移目标库位组 + /// + public string TransferLibToLocationGroup { get; set; } + + /// + /// 库移目标ERP库位 + /// + public string TransferLibToLocationErpCode { get; set; } + + /// + /// 库移目标仓库 + /// + public string TransferLibToWarehouseCode { get; set; } + + /// + /// 库移目标数量 + /// + public decimal TransferLibToQty { get; set; } + + #endregion + + #region 实际来源 + + /// + /// 实际目标托标签 + /// + public string HandledFromContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledFromPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledFromSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledFromArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledFromProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledFromExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledFromLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledFromLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledFromLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledFromLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledFromLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledFromWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledFromQty { get; set; } + + #endregion + + #region 实际目标 + + /// + /// 实际目标托标签 + /// + public string HandledToContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledToPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledToSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledToArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledToProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledToExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledToLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledToLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledToLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledToLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledToLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledToWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledToQty { get; set; } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDTO.cs index 2d61113ec..83ef675d4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDTO.cs @@ -29,14 +29,7 @@ public class CoatingIssueJobDTO : SfsJobDTOBase /// [Display(Name = "要货单号")] [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string MaterialRequestNumber { get; set; } - - /// - /// 车间 - /// - [Display(Name = "车间")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string Workshop { get; set; } + public string MaterialRequestNumber { get; set; } /// /// 使用在途库 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDetailDTO.cs index b8baa0cb7..33d6b2b4d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDetailDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDetailDTO.cs @@ -1,113 +1,519 @@ using System; using System.ComponentModel.DataAnnotations; -using Win_in.Sfs.Shared.Domain; +using System.ComponentModel.DataAnnotations.Schema; +using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; -using Win_in.Sfs.Wms.Store.Application.Contracts; -namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs; +namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class CoatingIssueJobDetailDTO : SfsJobRecommendFromDetailDTOBase, IHasToLocation +public class CoatingIssueJobDetailDTO : SfsDetailDTOBase { + #region 库存基础信息 /// - /// 请求库位 + /// 物品代码 /// - [Display(Name = "请求库位")] - public string RequestLocationCode { get; set; } + public string ItemCode { get; set; } + + /// + /// 物品名称 + /// + public string ItemName { get; set; } + + /// + /// 物品描述1 + /// + public string ItemDesc1 { get; set; } + + /// + /// 物品描述2 + /// + public string ItemDesc2 { get; set; } + + /// + /// 标包数量 + /// + [Display(Name = "标包数量")] + [Column(TypeName = "decimal(18,6)")] + public decimal StdPackQty { get; set; } + + /// + /// 库存状态 + /// + public EnumInventoryStatus Status { get; set; } /// - /// 到库位 + /// 计量单位 /// - [Display(Name = "到库位")] - public string ToLocationCode { get; set; } + public string Uom { get; set; } + + #endregion + + #region 请求信息 + + /// + /// 请求库位 + /// + public string RequestLocationCode { get; set; } /// - /// 到库区 + /// 到库区 /// - [Display(Name = "到库区")] - public string ToLocationArea { get; set; } + public string RequestLocationArea { get; set; } /// - /// 到库位组 + /// 到库位组 /// - [Display(Name = "到库位组")] - public string ToLocationGroup { get; set; } + public string RequestLocationGroup { get; set; } /// - /// 到ERP库位 + /// 到ERP库位 /// - [Display(Name = "到ERP库位")] - public string ToLocationErpCode { get; set; } + public string RequestLocationErpCode { get; set; } /// - /// 到仓库 + /// 到仓库 /// - [Display(Name = "到仓库")] - public string ToWarehouseCode { get; set; } + public string RequestWarehouseCode { get; set; } /// - /// 在途库库位 + /// 在途库库位 /// - [Display(Name = "在途库库位")] public string OnTheWayLocationCode { get; set; } /// - /// 生产线 + /// 生产线 /// - [Display(Name = "生产线")] public string ProdLine { get; set; } /// - /// 工作中心 + /// 位置码 + /// + public string PositionCode { get; set; } + + /// + /// 推荐的类型 + /// + public EnumRecommendType RecommendType { get; set; } + + /// + /// 需求数量 + /// + public decimal RequestQty { get; set; } + + #endregion + + #region 推荐来源 + + /// + /// 推荐来源托标签 + /// + public string RecommendFromContainerCode { get; set; } + + /// + /// 推荐来源箱标签 + /// + public string RecommendFromPackingCode { get; set; } + + /// + /// 推荐来源批次供应商批次 + /// + public string RecommendFromSupplierBatch { get; set; } + + /// + /// 推荐来源批次到货时间 + /// + public DateTime RecommendFromArriveDate { get; set; } + + /// + /// 推荐来源批次生产时间 + /// + public DateTime RecommendFromProduceDate { get; set; } + + /// + /// 推荐来源批次过期时间 + /// + public DateTime RecommendFromExpireDate { get; set; } + + /// + /// 推荐来源批次排序 + /// + public string RecommendFromLot { get; set; } + + /// + /// 推荐来源库位 + /// + public string RecommendFromLocationCode { get; set; } + + /// + /// 推荐来源库区 + /// + public string RecommendFromLocationArea { get; set; } + + /// + /// 推荐来源库位组 + /// + public string RecommendFromLocationGroup { get; set; } + + /// + /// 推荐来源ERP库位 /// - [Display(Name = "工作中心")] - public string WorkStation { get; set; } + public string RecommendFromLocationErpCode { get; set; } /// - /// 过期时间 + /// 推荐来源仓库 /// - [Display(Name = "过期时间")] - public DateTime ExpiredTime { get; set; } + public string RecommendFromWarehouseCode { get; set; } /// - /// 工序 + /// 推荐来源数量 /// - [Display(Name = "工序")] - public string Operation { get; set; } + public decimal RecommendFromQty { get; set; } + + #endregion + + #region 推荐目标 + + /// + /// 推荐目标托标签 + /// + public string RecommendToContainerCode { get; set; } + + /// + /// 推荐目标箱标签 + /// + public string RecommendToPackingCode { get; set; } + + /// + /// 推荐目标批次供应商批次 + /// + public string RecommendToSupplierBatch { get; set; } + + /// + /// 推荐目标批次到货时间 + /// + public DateTime RecommendToArriveDate { get; set; } + + /// + /// 推荐目标批次生产时间 + /// + public DateTime RecommendToProduceDate { get; set; } + + /// + /// 推荐目标批次过期时间 + /// + public DateTime RecommendToExpireDate { get; set; } + + /// + /// 推荐目标批次排序 + /// + public string RecommendToLot { get; set; } + + /// + /// 推荐目标库位 + /// + public string RecommendToLocationCode { get; set; } + + /// + /// 推荐目标库区 + /// + public string RecommendToLocationArea { get; set; } /// - /// 配送方式 + /// 推荐目标库位组 /// - [Display(Name = "配送方式")] - public EnumDistributionType DistributionType { get; set; } + public string RecommendToLocationGroup { get; set; } /// - /// 取整方式 + /// 推荐目标ERP库位 /// - [Display(Name = "取整方式")] - public EnumTruncType TruncType { get; set; } + public string RecommendToLocationErpCode { get; set; } /// - /// 取整后数量 + /// 推荐目标仓库 /// - [Display(Name = "取整后数量")] - public decimal RoundedQty { get; set; } + public string RecommendToWarehouseCode { get; set; } /// - /// 计划拆分规则 + /// 推荐目标数量 /// - [Display(Name = "计划拆分规则")] - public EnumPlannedSplitRule PlannedSplitRule { get; set; } + public decimal RecommendToQty { get; set; } + + #endregion + + #region 库移来源 /// - /// 计划开始时间 + /// 库移来源托标签 /// - [Display(Name = "计划开始时间")] - public DateTime PlanBeginTime { get; set; } + public string TransferLibFromContainerCode { get; set; } /// - /// 每次配送数量 + /// 库移来源箱标签 /// - [Display(Name = "每次配送数量")] - public decimal DeliveryQty { get; set; } + public string TransferLibFromPackingCode { get; set; } + + /// + /// 库移来源批次供应商批次 + /// + public string TransferLibFromSupplierBatch { get; set; } + + /// + /// 库移来源批次到货时间 + /// + public DateTime TransferLibFromArriveDate { get; set; } + + /// + /// 库移来源批次生产时间 + /// + public DateTime TransferLibFromProduceDate { get; set; } + + /// + /// 库移来源批次过期时间 + /// + public DateTime TransferLibFromExpireDate { get; set; } + + /// + /// 库移来源批次排序 + /// + public string TransferLibFromLot { get; set; } + + /// + /// 库移来源库位 + /// + public string TransferLibFromLocationCode { get; set; } + + /// + /// 库移来源库区 + /// + public string TransferLibFromLocationArea { get; set; } + + /// + /// 库移来源库位组 + /// + public string TransferLibFromLocationGroup { get; set; } + + /// + /// 库移来源ERP库位 + /// + public string TransferLibFromLocationErpCode { get; set; } + + /// + /// 库移来源仓库 + /// + public string TransferLibFromWarehouseCode { get; set; } + + /// + /// 库移来源数量 + /// + public decimal TransferLibFromQty { get; set; } + + #endregion + + #region 库移目标 + + /// + /// 库移目标托标签 + /// + public string TransferLibToContainerCode { get; set; } + + /// + /// 库移目标箱标签 + /// + public string TransferLibToPackingCode { get; set; } + + /// + /// 库移目标批次供应商批次 + /// + public string TransferLibToSupplierBatch { get; set; } + + /// + /// 库移目标批次到货时间 + /// + public DateTime TransferLibToArriveDate { get; set; } + + /// + /// 库移目标批次生产时间 + /// + public DateTime TransferLibToProduceDate { get; set; } + + /// + /// 库移目标批次过期时间 + /// + public DateTime TransferLibToExpireDate { get; set; } + + /// + /// 库移目标批次排序 + /// + public string TransferLibToLot { get; set; } + + /// + /// 库移目标库位 + /// + public string TransferLibToLocationCode { get; set; } + + /// + /// 库移目标库区 + /// + public string TransferLibToLocationArea { get; set; } + + /// + /// 库移目标库位组 + /// + public string TransferLibToLocationGroup { get; set; } + + /// + /// 库移目标ERP库位 + /// + public string TransferLibToLocationErpCode { get; set; } + + /// + /// 库移目标仓库 + /// + public string TransferLibToWarehouseCode { get; set; } + + /// + /// 库移目标数量 + /// + public decimal TransferLibToQty { get; set; } + + #endregion + + #region 实际来源 + + /// + /// 实际目标托标签 + /// + public string HandledFromContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledFromPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledFromSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledFromArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledFromProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledFromExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledFromLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledFromLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledFromLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledFromLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledFromLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledFromWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledFromQty { get; set; } + + #endregion + + #region 实际目标 + + /// + /// 实际目标托标签 + /// + public string HandledToContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledToPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledToSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledToArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledToProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledToExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledToLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledToLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledToLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledToLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledToLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledToWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledToQty { get; set; } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDetailInput.cs index 5d0339639..2603292f7 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDetailInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDetailInput.cs @@ -1,135 +1,519 @@ using System; using System.ComponentModel.DataAnnotations; -using Win_in.Sfs.Shared.Domain; +using System.ComponentModel.DataAnnotations.Schema; +using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; -using Win_in.Sfs.Wms.Store.Application.Contracts; -namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs; +namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class CoatingIssueJobDetailInput : SfsJobRecommendFromDetailInputBase, IHasToLocation +public class CoatingIssueJobDetailInput : SfsDetailInputBase { + #region 库存基础信息 /// - /// 请求库位 + /// 物品代码 /// - [Display(Name = "请求库位")] - [Required(ErrorMessage = "{0}是必填项")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string RequestLocationCode { get; set; } + public string ItemCode { get; set; } + + /// + /// 物品名称 + /// + public string ItemName { get; set; } + + /// + /// 物品描述1 + /// + public string ItemDesc1 { get; set; } + + /// + /// 物品描述2 + /// + public string ItemDesc2 { get; set; } + + /// + /// 标包数量 + /// + [Display(Name = "标包数量")] + [Column(TypeName = "decimal(18,6)")] + public decimal StdPackQty { get; set; } + + /// + /// 库存状态 + /// + public EnumInventoryStatus Status { get; set; } /// - /// 到库位 + /// 计量单位 /// - [Display(Name = "到库位")] - [Required(ErrorMessage = "{0}是必填项")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string ToLocationCode { get; set; } + public string Uom { get; set; } + + #endregion + + #region 请求信息 + + /// + /// 请求库位 + /// + public string RequestLocationCode { get; set; } /// - /// 到库区 + /// 到库区 /// - [Display(Name = "到库区")] - public string ToLocationArea { get; set; } + public string RequestLocationArea { get; set; } /// - /// 到库位组 + /// 到库位组 /// - [Display(Name = "到库位组")] - public string ToLocationGroup { get; set; } + public string RequestLocationGroup { get; set; } /// - /// 到ERP库位 + /// 到ERP库位 /// - [Display(Name = "到ERP库位")] - [Required(ErrorMessage = "{0}是必填项")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string ToLocationErpCode { get; set; } + public string RequestLocationErpCode { get; set; } /// - /// 到仓库 + /// 到仓库 /// - [Display(Name = "到仓库")] - [Required(ErrorMessage = "{0}是必填项")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string ToWarehouseCode { get; set; } + public string RequestWarehouseCode { get; set; } /// - /// 在途库库位 + /// 在途库库位 /// - [Display(Name = "在途库库位")] public string OnTheWayLocationCode { get; set; } /// - /// 生产线 + /// 生产线 /// - [Display(Name = "生产线")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] public string ProdLine { get; set; } /// - /// 工作中心 + /// 位置码 + /// + public string PositionCode { get; set; } + + /// + /// 推荐的类型 /// - [Display(Name = "工作中心")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string WorkStation { get; set; } + public EnumRecommendType RecommendType { get; set; } /// - /// 过期时间 + /// 需求数量 /// - [Display(Name = "过期时间")] - [Required(ErrorMessage = "{0}是必填项")] - public DateTime ExpiredTime { get; set; } + public decimal RequestQty { get; set; } + + #endregion + + #region 推荐来源 /// - /// 工序 + /// 推荐来源托标签 /// - [Display(Name = "工序")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string Operation { get; set; } + public string RecommendFromContainerCode { get; set; } /// - /// 配送方式 + /// 推荐来源箱标签 /// - [Display(Name = "配送方式")] - public EnumDistributionType DistributionType { get; set; } + public string RecommendFromPackingCode { get; set; } /// - /// 取整方式 + /// 推荐来源批次供应商批次 /// - [Display(Name = "取整方式")] - public EnumTruncType TruncType { get; set; } + public string RecommendFromSupplierBatch { get; set; } /// - /// 取整后数量 + /// 推荐来源批次到货时间 /// - [Display(Name = "取整后数量")] - public decimal RoundedQty { get; set; } + public DateTime RecommendFromArriveDate { get; set; } /// - /// 计划拆分规则 + /// 推荐来源批次生产时间 /// - [Display(Name = "计划拆分规则")] - public EnumPlannedSplitRule PlannedSplitRule { get; set; } + public DateTime RecommendFromProduceDate { get; set; } /// - /// 计划开始时间 + /// 推荐来源批次过期时间 /// - [Display(Name = "计划开始时间")] - public DateTime PlanBeginTime { get; set; } + public DateTime RecommendFromExpireDate { get; set; } /// - /// 每次配送数量 + /// 推荐来源批次排序 /// - [Display(Name = "每次配送数量")] - public decimal DeliveryQty { get; set; } + public string RecommendFromLot { get; set; } /// - /// 位置码 + /// 推荐来源库位 /// - public string PositionCode { get; set; } + public string RecommendFromLocationCode { get; set; } /// - /// 推荐类型 + /// 推荐来源库区 /// - public EnumRecommendType RecommendType { get; set; } + public string RecommendFromLocationArea { get; set; } + + /// + /// 推荐来源库位组 + /// + public string RecommendFromLocationGroup { get; set; } + + /// + /// 推荐来源ERP库位 + /// + public string RecommendFromLocationErpCode { get; set; } + + /// + /// 推荐来源仓库 + /// + public string RecommendFromWarehouseCode { get; set; } + + /// + /// 推荐来源数量 + /// + public decimal RecommendFromQty { get; set; } + + #endregion + + #region 推荐目标 + + /// + /// 推荐目标托标签 + /// + public string RecommendToContainerCode { get; set; } + + /// + /// 推荐目标箱标签 + /// + public string RecommendToPackingCode { get; set; } + + /// + /// 推荐目标批次供应商批次 + /// + public string RecommendToSupplierBatch { get; set; } + + /// + /// 推荐目标批次到货时间 + /// + public DateTime RecommendToArriveDate { get; set; } + + /// + /// 推荐目标批次生产时间 + /// + public DateTime RecommendToProduceDate { get; set; } + + /// + /// 推荐目标批次过期时间 + /// + public DateTime RecommendToExpireDate { get; set; } + + /// + /// 推荐目标批次排序 + /// + public string RecommendToLot { get; set; } + + /// + /// 推荐目标库位 + /// + public string RecommendToLocationCode { get; set; } + + /// + /// 推荐目标库区 + /// + public string RecommendToLocationArea { get; set; } + + /// + /// 推荐目标库位组 + /// + public string RecommendToLocationGroup { get; set; } + + /// + /// 推荐目标ERP库位 + /// + public string RecommendToLocationErpCode { get; set; } + + /// + /// 推荐目标仓库 + /// + public string RecommendToWarehouseCode { get; set; } + + /// + /// 推荐目标数量 + /// + public decimal RecommendToQty { get; set; } + + #endregion + + #region 库移来源 + + /// + /// 库移来源托标签 + /// + public string TransferLibFromContainerCode { get; set; } + + /// + /// 库移来源箱标签 + /// + public string TransferLibFromPackingCode { get; set; } + + /// + /// 库移来源批次供应商批次 + /// + public string TransferLibFromSupplierBatch { get; set; } + + /// + /// 库移来源批次到货时间 + /// + public DateTime TransferLibFromArriveDate { get; set; } + + /// + /// 库移来源批次生产时间 + /// + public DateTime TransferLibFromProduceDate { get; set; } + + /// + /// 库移来源批次过期时间 + /// + public DateTime TransferLibFromExpireDate { get; set; } + + /// + /// 库移来源批次排序 + /// + public string TransferLibFromLot { get; set; } + + /// + /// 库移来源库位 + /// + public string TransferLibFromLocationCode { get; set; } + + /// + /// 库移来源库区 + /// + public string TransferLibFromLocationArea { get; set; } + + /// + /// 库移来源库位组 + /// + public string TransferLibFromLocationGroup { get; set; } + + /// + /// 库移来源ERP库位 + /// + public string TransferLibFromLocationErpCode { get; set; } + + /// + /// 库移来源仓库 + /// + public string TransferLibFromWarehouseCode { get; set; } + + /// + /// 库移来源数量 + /// + public decimal TransferLibFromQty { get; set; } + + #endregion + + #region 库移目标 + + /// + /// 库移目标托标签 + /// + public string TransferLibToContainerCode { get; set; } + + /// + /// 库移目标箱标签 + /// + public string TransferLibToPackingCode { get; set; } + + /// + /// 库移目标批次供应商批次 + /// + public string TransferLibToSupplierBatch { get; set; } + + /// + /// 库移目标批次到货时间 + /// + public DateTime TransferLibToArriveDate { get; set; } + + /// + /// 库移目标批次生产时间 + /// + public DateTime TransferLibToProduceDate { get; set; } + + /// + /// 库移目标批次过期时间 + /// + public DateTime TransferLibToExpireDate { get; set; } + + /// + /// 库移目标批次排序 + /// + public string TransferLibToLot { get; set; } + + /// + /// 库移目标库位 + /// + public string TransferLibToLocationCode { get; set; } + + /// + /// 库移目标库区 + /// + public string TransferLibToLocationArea { get; set; } + + /// + /// 库移目标库位组 + /// + public string TransferLibToLocationGroup { get; set; } + + /// + /// 库移目标ERP库位 + /// + public string TransferLibToLocationErpCode { get; set; } + + /// + /// 库移目标仓库 + /// + public string TransferLibToWarehouseCode { get; set; } + + /// + /// 库移目标数量 + /// + public decimal TransferLibToQty { get; set; } + + #endregion + + #region 实际来源 + + /// + /// 实际目标托标签 + /// + public string HandledFromContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledFromPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledFromSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledFromArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledFromProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledFromExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledFromLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledFromLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledFromLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledFromLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledFromLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledFromWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledFromQty { get; set; } + + #endregion + + #region 实际目标 + + /// + /// 实际目标托标签 + /// + public string HandledToContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledToPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledToSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledToArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledToProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledToExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledToLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledToLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledToLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledToLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledToLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledToWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledToQty { get; set; } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobPermissions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobPermissions.cs index 7ab1d8458..de9f948ca 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobPermissions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobPermissions.cs @@ -2,7 +2,7 @@ using Volo.Abp.Authorization.Permissions; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; -namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs; +namespace Win_in.Sfs.Wms.Store.Application.Contracts; public static class CoatingIssueJobPermissions { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/ICoatingIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/ICoatingIssueJobAppService.cs index d989cb12e..698d8a199 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/ICoatingIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/CoatingIssueJobs/ICoatingIssueJobAppService.cs @@ -9,19 +9,7 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs; public interface ICoatingIssueJobAppService : ISfsJobAppServiceBase { - Task> CheckJobExistByItemCodeAndLocationCode(string itemCode, string locationCode); - - Task CancelByMaterialRequestAsync(string materialNumber); - - Task> GetListByTypeAsync(SfsJobRequestInputBase requestInput, string requestType, - bool includeDetails = false, CancellationToken cancellationToken = default); + Task CancelByMaterialRequestAsync(string coatingIssueNumber); Task> GetByRequestNumberAsync(string requestNumber); - - /// - /// 保存拆箱时涉及的明细修改 - /// - /// - Task SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input); - } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/DTOs/AssembleNoteDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/DTOs/AssembleNoteDTO.cs index 6db88f8bb..9cb65b1a6 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/DTOs/AssembleNoteDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/DTOs/AssembleNoteDTO.cs @@ -13,13 +13,6 @@ public class AssembleNoteDTO : SfsStoreDTOBase, IHasJobNu [Display(Name = "任务ID")] public string JobNumber { get; set; } - /// - /// 车间 - /// - [Display(Name = "车间")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string Workshop { get; set; } - /// /// 请求代码 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/DTOs/AssembleNoteDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/DTOs/AssembleNoteDetailDTO.cs index cefbe75a5..3e948f556 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/DTOs/AssembleNoteDetailDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/DTOs/AssembleNoteDetailDTO.cs @@ -1,42 +1,519 @@ using System; using System.ComponentModel.DataAnnotations; -using Win_in.Sfs.Shared.Domain; +using System.ComponentModel.DataAnnotations.Schema; +using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class AssembleNoteDetailDTO : SfsStoreRecommendFromDetailWithFromToDTOBase +public class AssembleNoteDetailDTO : SfsDetailDTOBase { + #region 库存基础信息 /// - /// 发料时间 + /// 物品代码 /// - [Display(Name = "发料时间")] - public DateTime IssueTime { get; set; } + public string ItemCode { get; set; } /// - /// 过期时间 + /// 物品名称 /// - [Display(Name = "过期时间")] - public DateTime ExpiredTime { get; set; } + public string ItemName { get; set; } /// - /// 生产线 + /// 物品描述1 /// - [Display(Name = "生产线")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string ProdLine { get; set; } + public string ItemDesc1 { get; set; } + + /// + /// 物品描述2 + /// + public string ItemDesc2 { get; set; } + + /// + /// 标包数量 + /// + [Display(Name = "标包数量")] + [Column(TypeName = "decimal(18,6)")] + public decimal StdPackQty { get; set; } + + /// + /// 库存状态 + /// + public EnumInventoryStatus Status { get; set; } + + /// + /// 计量单位 + /// + public string Uom { get; set; } + + #endregion + + #region 请求信息 + + /// + /// 请求库位 + /// + public string RequestLocationCode { get; set; } /// - /// 工作中心 + /// 到库区 /// - [Display(Name = "工作中心")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string WorkStation { get; set; } + public string RequestLocationArea { get; set; } /// - /// 在途库库位 + /// 到库位组 + /// + public string RequestLocationGroup { get; set; } + + /// + /// 到ERP库位 + /// + public string RequestLocationErpCode { get; set; } + + /// + /// 到仓库 + /// + public string RequestWarehouseCode { get; set; } + + /// + /// 在途库库位 /// - [Display(Name = "在途库库位")] public string OnTheWayLocationCode { get; set; } + /// + /// 生产线 + /// + public string ProdLine { get; set; } + + /// + /// 位置码 + /// + public string PositionCode { get; set; } + + /// + /// 推荐的类型 + /// + public EnumRecommendType RecommendType { get; set; } + + /// + /// 需求数量 + /// + public decimal RequestQty { get; set; } + + #endregion + + #region 推荐来源 + + /// + /// 推荐来源托标签 + /// + public string RecommendFromContainerCode { get; set; } + + /// + /// 推荐来源箱标签 + /// + public string RecommendFromPackingCode { get; set; } + + /// + /// 推荐来源批次供应商批次 + /// + public string RecommendFromSupplierBatch { get; set; } + + /// + /// 推荐来源批次到货时间 + /// + public DateTime RecommendFromArriveDate { get; set; } + + /// + /// 推荐来源批次生产时间 + /// + public DateTime RecommendFromProduceDate { get; set; } + + /// + /// 推荐来源批次过期时间 + /// + public DateTime RecommendFromExpireDate { get; set; } + + /// + /// 推荐来源批次排序 + /// + public string RecommendFromLot { get; set; } + + /// + /// 推荐来源库位 + /// + public string RecommendFromLocationCode { get; set; } + + /// + /// 推荐来源库区 + /// + public string RecommendFromLocationArea { get; set; } + + /// + /// 推荐来源库位组 + /// + public string RecommendFromLocationGroup { get; set; } + + /// + /// 推荐来源ERP库位 + /// + public string RecommendFromLocationErpCode { get; set; } + + /// + /// 推荐来源仓库 + /// + public string RecommendFromWarehouseCode { get; set; } + + /// + /// 推荐来源数量 + /// + public decimal RecommendFromQty { get; set; } + + #endregion + + #region 推荐目标 + + /// + /// 推荐目标托标签 + /// + public string RecommendToContainerCode { get; set; } + + /// + /// 推荐目标箱标签 + /// + public string RecommendToPackingCode { get; set; } + + /// + /// 推荐目标批次供应商批次 + /// + public string RecommendToSupplierBatch { get; set; } + + /// + /// 推荐目标批次到货时间 + /// + public DateTime RecommendToArriveDate { get; set; } + + /// + /// 推荐目标批次生产时间 + /// + public DateTime RecommendToProduceDate { get; set; } + + /// + /// 推荐目标批次过期时间 + /// + public DateTime RecommendToExpireDate { get; set; } + + /// + /// 推荐目标批次排序 + /// + public string RecommendToLot { get; set; } + + /// + /// 推荐目标库位 + /// + public string RecommendToLocationCode { get; set; } + + /// + /// 推荐目标库区 + /// + public string RecommendToLocationArea { get; set; } + + /// + /// 推荐目标库位组 + /// + public string RecommendToLocationGroup { get; set; } + + /// + /// 推荐目标ERP库位 + /// + public string RecommendToLocationErpCode { get; set; } + + /// + /// 推荐目标仓库 + /// + public string RecommendToWarehouseCode { get; set; } + + /// + /// 推荐目标数量 + /// + public decimal RecommendToQty { get; set; } + + #endregion + + #region 库移来源 + + /// + /// 库移来源托标签 + /// + public string TransferLibFromContainerCode { get; set; } + + /// + /// 库移来源箱标签 + /// + public string TransferLibFromPackingCode { get; set; } + + /// + /// 库移来源批次供应商批次 + /// + public string TransferLibFromSupplierBatch { get; set; } + + /// + /// 库移来源批次到货时间 + /// + public DateTime TransferLibFromArriveDate { get; set; } + + /// + /// 库移来源批次生产时间 + /// + public DateTime TransferLibFromProduceDate { get; set; } + + /// + /// 库移来源批次过期时间 + /// + public DateTime TransferLibFromExpireDate { get; set; } + + /// + /// 库移来源批次排序 + /// + public string TransferLibFromLot { get; set; } + + /// + /// 库移来源库位 + /// + public string TransferLibFromLocationCode { get; set; } + + /// + /// 库移来源库区 + /// + public string TransferLibFromLocationArea { get; set; } + + /// + /// 库移来源库位组 + /// + public string TransferLibFromLocationGroup { get; set; } + + /// + /// 库移来源ERP库位 + /// + public string TransferLibFromLocationErpCode { get; set; } + + /// + /// 库移来源仓库 + /// + public string TransferLibFromWarehouseCode { get; set; } + + /// + /// 库移来源数量 + /// + public decimal TransferLibFromQty { get; set; } + + #endregion + + #region 库移目标 + + /// + /// 库移目标托标签 + /// + public string TransferLibToContainerCode { get; set; } + + /// + /// 库移目标箱标签 + /// + public string TransferLibToPackingCode { get; set; } + + /// + /// 库移目标批次供应商批次 + /// + public string TransferLibToSupplierBatch { get; set; } + + /// + /// 库移目标批次到货时间 + /// + public DateTime TransferLibToArriveDate { get; set; } + + /// + /// 库移目标批次生产时间 + /// + public DateTime TransferLibToProduceDate { get; set; } + + /// + /// 库移目标批次过期时间 + /// + public DateTime TransferLibToExpireDate { get; set; } + + /// + /// 库移目标批次排序 + /// + public string TransferLibToLot { get; set; } + + /// + /// 库移目标库位 + /// + public string TransferLibToLocationCode { get; set; } + + /// + /// 库移目标库区 + /// + public string TransferLibToLocationArea { get; set; } + + /// + /// 库移目标库位组 + /// + public string TransferLibToLocationGroup { get; set; } + + /// + /// 库移目标ERP库位 + /// + public string TransferLibToLocationErpCode { get; set; } + + /// + /// 库移目标仓库 + /// + public string TransferLibToWarehouseCode { get; set; } + + /// + /// 库移目标数量 + /// + public decimal TransferLibToQty { get; set; } + + #endregion + + #region 实际来源 + + /// + /// 实际目标托标签 + /// + public string HandledFromContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledFromPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledFromSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledFromArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledFromProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledFromExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledFromLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledFromLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledFromLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledFromLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledFromLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledFromWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledFromQty { get; set; } + + #endregion + + #region 实际目标 + + /// + /// 实际目标托标签 + /// + public string HandledToContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledToPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledToSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledToArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledToProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledToExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledToLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledToLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledToLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledToLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledToLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledToWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledToQty { get; set; } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/Inputs/AssembleNoteDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/Inputs/AssembleNoteDetailInput.cs index 4a194dc44..9f9d71c36 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/Inputs/AssembleNoteDetailInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/Inputs/AssembleNoteDetailInput.cs @@ -1,53 +1,519 @@ using System; using System.ComponentModel.DataAnnotations; -using Win_in.Sfs.Shared.Domain; +using System.ComponentModel.DataAnnotations.Schema; +using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class AssembleNoteDetailInput : SfsStoreRecommendFromDetailWithFromToInputBase +public class AssembleNoteDetailInput : SfsDetailInputBase { + #region 库存基础信息 /// - /// 发料时间 + /// 物品代码 /// - [Display(Name = "发料时间")] - public DateTime IssueTime { get; set; } + public string ItemCode { get; set; } /// - /// 过期时间 + /// 物品名称 /// - [Display(Name = "过期时间")] - public DateTime ExpiredTime { get; set; } + public string ItemName { get; set; } /// - /// 生产线 + /// 物品描述1 /// - [Display(Name = "生产线")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string ProdLine { get; set; } + public string ItemDesc1 { get; set; } + + /// + /// 物品描述2 + /// + public string ItemDesc2 { get; set; } + + /// + /// 标包数量 + /// + [Display(Name = "标包数量")] + [Column(TypeName = "decimal(18,6)")] + public decimal StdPackQty { get; set; } + + /// + /// 库存状态 + /// + public EnumInventoryStatus Status { get; set; } + + /// + /// 计量单位 + /// + public string Uom { get; set; } + + #endregion + + #region 请求信息 + + /// + /// 请求库位 + /// + public string RequestLocationCode { get; set; } /// - /// 工作中心 + /// 到库区 /// - [Display(Name = "工作中心")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string WorkStation { get; set; } + public string RequestLocationArea { get; set; } /// - /// 在途库库位 + /// 到库位组 + /// + public string RequestLocationGroup { get; set; } + + /// + /// 到ERP库位 + /// + public string RequestLocationErpCode { get; set; } + + /// + /// 到仓库 + /// + public string RequestWarehouseCode { get; set; } + + /// + /// 在途库库位 /// - [Display(Name = "在途库库位")] public string OnTheWayLocationCode { get; set; } /// - /// 位置码 + /// 生产线 + /// + public string ProdLine { get; set; } + + /// + /// 位置码 /// public string PositionCode { get; set; } /// - /// 推荐类型 + /// 推荐的类型 /// public EnumRecommendType RecommendType { get; set; } + /// + /// 需求数量 + /// + public decimal RequestQty { get; set; } + + #endregion + + #region 推荐来源 + + /// + /// 推荐来源托标签 + /// + public string RecommendFromContainerCode { get; set; } + + /// + /// 推荐来源箱标签 + /// + public string RecommendFromPackingCode { get; set; } + + /// + /// 推荐来源批次供应商批次 + /// + public string RecommendFromSupplierBatch { get; set; } + + /// + /// 推荐来源批次到货时间 + /// + public DateTime RecommendFromArriveDate { get; set; } + + /// + /// 推荐来源批次生产时间 + /// + public DateTime RecommendFromProduceDate { get; set; } + + /// + /// 推荐来源批次过期时间 + /// + public DateTime RecommendFromExpireDate { get; set; } + + /// + /// 推荐来源批次排序 + /// + public string RecommendFromLot { get; set; } + + /// + /// 推荐来源库位 + /// + public string RecommendFromLocationCode { get; set; } + + /// + /// 推荐来源库区 + /// + public string RecommendFromLocationArea { get; set; } + + /// + /// 推荐来源库位组 + /// + public string RecommendFromLocationGroup { get; set; } + + /// + /// 推荐来源ERP库位 + /// + public string RecommendFromLocationErpCode { get; set; } + + /// + /// 推荐来源仓库 + /// + public string RecommendFromWarehouseCode { get; set; } + + /// + /// 推荐来源数量 + /// + public decimal RecommendFromQty { get; set; } + + #endregion + + #region 推荐目标 + + /// + /// 推荐目标托标签 + /// + public string RecommendToContainerCode { get; set; } + + /// + /// 推荐目标箱标签 + /// + public string RecommendToPackingCode { get; set; } + + /// + /// 推荐目标批次供应商批次 + /// + public string RecommendToSupplierBatch { get; set; } + + /// + /// 推荐目标批次到货时间 + /// + public DateTime RecommendToArriveDate { get; set; } + + /// + /// 推荐目标批次生产时间 + /// + public DateTime RecommendToProduceDate { get; set; } + + /// + /// 推荐目标批次过期时间 + /// + public DateTime RecommendToExpireDate { get; set; } + + /// + /// 推荐目标批次排序 + /// + public string RecommendToLot { get; set; } + + /// + /// 推荐目标库位 + /// + public string RecommendToLocationCode { get; set; } + + /// + /// 推荐目标库区 + /// + public string RecommendToLocationArea { get; set; } + + /// + /// 推荐目标库位组 + /// + public string RecommendToLocationGroup { get; set; } + + /// + /// 推荐目标ERP库位 + /// + public string RecommendToLocationErpCode { get; set; } + + /// + /// 推荐目标仓库 + /// + public string RecommendToWarehouseCode { get; set; } + + /// + /// 推荐目标数量 + /// + public decimal RecommendToQty { get; set; } + + #endregion + + #region 库移来源 + + /// + /// 库移来源托标签 + /// + public string TransferLibFromContainerCode { get; set; } + + /// + /// 库移来源箱标签 + /// + public string TransferLibFromPackingCode { get; set; } + + /// + /// 库移来源批次供应商批次 + /// + public string TransferLibFromSupplierBatch { get; set; } + + /// + /// 库移来源批次到货时间 + /// + public DateTime TransferLibFromArriveDate { get; set; } + + /// + /// 库移来源批次生产时间 + /// + public DateTime TransferLibFromProduceDate { get; set; } + + /// + /// 库移来源批次过期时间 + /// + public DateTime TransferLibFromExpireDate { get; set; } + + /// + /// 库移来源批次排序 + /// + public string TransferLibFromLot { get; set; } + + /// + /// 库移来源库位 + /// + public string TransferLibFromLocationCode { get; set; } + + /// + /// 库移来源库区 + /// + public string TransferLibFromLocationArea { get; set; } + + /// + /// 库移来源库位组 + /// + public string TransferLibFromLocationGroup { get; set; } + + /// + /// 库移来源ERP库位 + /// + public string TransferLibFromLocationErpCode { get; set; } + + /// + /// 库移来源仓库 + /// + public string TransferLibFromWarehouseCode { get; set; } + + /// + /// 库移来源数量 + /// + public decimal TransferLibFromQty { get; set; } + + #endregion + + #region 库移目标 + + /// + /// 库移目标托标签 + /// + public string TransferLibToContainerCode { get; set; } + + /// + /// 库移目标箱标签 + /// + public string TransferLibToPackingCode { get; set; } + + /// + /// 库移目标批次供应商批次 + /// + public string TransferLibToSupplierBatch { get; set; } + + /// + /// 库移目标批次到货时间 + /// + public DateTime TransferLibToArriveDate { get; set; } + + /// + /// 库移目标批次生产时间 + /// + public DateTime TransferLibToProduceDate { get; set; } + + /// + /// 库移目标批次过期时间 + /// + public DateTime TransferLibToExpireDate { get; set; } + + /// + /// 库移目标批次排序 + /// + public string TransferLibToLot { get; set; } + + /// + /// 库移目标库位 + /// + public string TransferLibToLocationCode { get; set; } + + /// + /// 库移目标库区 + /// + public string TransferLibToLocationArea { get; set; } + + /// + /// 库移目标库位组 + /// + public string TransferLibToLocationGroup { get; set; } + + /// + /// 库移目标ERP库位 + /// + public string TransferLibToLocationErpCode { get; set; } + + /// + /// 库移目标仓库 + /// + public string TransferLibToWarehouseCode { get; set; } + + /// + /// 库移目标数量 + /// + public decimal TransferLibToQty { get; set; } + + #endregion + + #region 实际来源 + + /// + /// 实际目标托标签 + /// + public string HandledFromContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledFromPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledFromSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledFromArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledFromProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledFromExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledFromLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledFromLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledFromLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledFromLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledFromLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledFromWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledFromQty { get; set; } + + #endregion + + #region 实际目标 + + /// + /// 实际目标托标签 + /// + public string HandledToContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledToPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledToSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledToArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledToProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledToExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledToLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledToLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledToLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledToLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledToLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledToWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledToQty { get; set; } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/Inputs/AssembleNoteEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/Inputs/AssembleNoteEditInput.cs index b3c23c67f..48447ccf5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/Inputs/AssembleNoteEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/AssembleNotes/Inputs/AssembleNoteEditInput.cs @@ -26,14 +26,7 @@ public class AssembleNoteEditInput : SfsStoreCreateOrUpdateInputBase /// [Display(Name = "任务ID")] [Required(ErrorMessage = "{0}是必填项")] - public string JobNumber { get; set; } - - /// - /// 车间 - /// - [Display(Name = "车间")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string Workshop { get; set; } + public string JobNumber { get; set; } /// /// 明细列表 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDTO.cs index 096f03254..dfadc255f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDTO.cs @@ -7,20 +7,12 @@ namespace Win_in.Sfs.Wms.Store.Notes.IssueNotes; public class CoatingIssueNoteDTO : SfsStoreDTOBase, IHasJobNumber, IHasRequestNumber { - /// /// 任务ID /// [Display(Name = "任务ID")] public string JobNumber { get; set; } - /// - /// 车间 - /// - [Display(Name = "车间")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string Workshop { get; set; } - /// /// 请求代码 /// @@ -51,5 +43,4 @@ public class CoatingIssueNoteDTO : SfsStoreDTOBase, I /// [Display(Name = "确认时间")] public DateTime? ConfirmTime { get; set; } - } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDetailDTO.cs index afbcf4f81..6f8fb1d22 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDetailDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDetailDTO.cs @@ -1,43 +1,519 @@ using System; using System.ComponentModel.DataAnnotations; -using Win_in.Sfs.Shared.Domain; -using Win_in.Sfs.Wms.Store.Application.Contracts; +using System.ComponentModel.DataAnnotations.Schema; +using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; -namespace Win_in.Sfs.Wms.Store.Notes.IssueNotes; +namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class CoatingIssueNoteDetailDTO : SfsStoreRecommendFromDetailWithFromToDTOBase +public class CoatingIssueNoteDetailDTO : SfsDetailDTOBase { + #region 库存基础信息 /// - /// 发料时间 + /// 物品代码 /// - [Display(Name = "发料时间")] - public DateTime IssueTime { get; set; } + public string ItemCode { get; set; } /// - /// 过期时间 + /// 物品名称 /// - [Display(Name = "过期时间")] - public DateTime ExpiredTime { get; set; } + public string ItemName { get; set; } /// - /// 生产线 + /// 物品描述1 /// - [Display(Name = "生产线")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string ProdLine { get; set; } + public string ItemDesc1 { get; set; } + + /// + /// 物品描述2 + /// + public string ItemDesc2 { get; set; } + + /// + /// 标包数量 + /// + [Display(Name = "标包数量")] + [Column(TypeName = "decimal(18,6)")] + public decimal StdPackQty { get; set; } + + /// + /// 库存状态 + /// + public EnumInventoryStatus Status { get; set; } + + /// + /// 计量单位 + /// + public string Uom { get; set; } + + #endregion + + #region 请求信息 + + /// + /// 请求库位 + /// + public string RequestLocationCode { get; set; } /// - /// 工作中心 + /// 到库区 /// - [Display(Name = "工作中心")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string WorkStation { get; set; } + public string RequestLocationArea { get; set; } /// - /// 在途库库位 + /// 到库位组 + /// + public string RequestLocationGroup { get; set; } + + /// + /// 到ERP库位 + /// + public string RequestLocationErpCode { get; set; } + + /// + /// 到仓库 + /// + public string RequestWarehouseCode { get; set; } + + /// + /// 在途库库位 /// - [Display(Name = "在途库库位")] public string OnTheWayLocationCode { get; set; } + /// + /// 生产线 + /// + public string ProdLine { get; set; } + + /// + /// 位置码 + /// + public string PositionCode { get; set; } + + /// + /// 推荐的类型 + /// + public EnumRecommendType RecommendType { get; set; } + + /// + /// 需求数量 + /// + public decimal RequestQty { get; set; } + + #endregion + + #region 推荐来源 + + /// + /// 推荐来源托标签 + /// + public string RecommendFromContainerCode { get; set; } + + /// + /// 推荐来源箱标签 + /// + public string RecommendFromPackingCode { get; set; } + + /// + /// 推荐来源批次供应商批次 + /// + public string RecommendFromSupplierBatch { get; set; } + + /// + /// 推荐来源批次到货时间 + /// + public DateTime RecommendFromArriveDate { get; set; } + + /// + /// 推荐来源批次生产时间 + /// + public DateTime RecommendFromProduceDate { get; set; } + + /// + /// 推荐来源批次过期时间 + /// + public DateTime RecommendFromExpireDate { get; set; } + + /// + /// 推荐来源批次排序 + /// + public string RecommendFromLot { get; set; } + + /// + /// 推荐来源库位 + /// + public string RecommendFromLocationCode { get; set; } + + /// + /// 推荐来源库区 + /// + public string RecommendFromLocationArea { get; set; } + + /// + /// 推荐来源库位组 + /// + public string RecommendFromLocationGroup { get; set; } + + /// + /// 推荐来源ERP库位 + /// + public string RecommendFromLocationErpCode { get; set; } + + /// + /// 推荐来源仓库 + /// + public string RecommendFromWarehouseCode { get; set; } + + /// + /// 推荐来源数量 + /// + public decimal RecommendFromQty { get; set; } + + #endregion + + #region 推荐目标 + + /// + /// 推荐目标托标签 + /// + public string RecommendToContainerCode { get; set; } + + /// + /// 推荐目标箱标签 + /// + public string RecommendToPackingCode { get; set; } + + /// + /// 推荐目标批次供应商批次 + /// + public string RecommendToSupplierBatch { get; set; } + + /// + /// 推荐目标批次到货时间 + /// + public DateTime RecommendToArriveDate { get; set; } + + /// + /// 推荐目标批次生产时间 + /// + public DateTime RecommendToProduceDate { get; set; } + + /// + /// 推荐目标批次过期时间 + /// + public DateTime RecommendToExpireDate { get; set; } + + /// + /// 推荐目标批次排序 + /// + public string RecommendToLot { get; set; } + + /// + /// 推荐目标库位 + /// + public string RecommendToLocationCode { get; set; } + + /// + /// 推荐目标库区 + /// + public string RecommendToLocationArea { get; set; } + + /// + /// 推荐目标库位组 + /// + public string RecommendToLocationGroup { get; set; } + + /// + /// 推荐目标ERP库位 + /// + public string RecommendToLocationErpCode { get; set; } + + /// + /// 推荐目标仓库 + /// + public string RecommendToWarehouseCode { get; set; } + + /// + /// 推荐目标数量 + /// + public decimal RecommendToQty { get; set; } + + #endregion + + #region 库移来源 + + /// + /// 库移来源托标签 + /// + public string TransferLibFromContainerCode { get; set; } + + /// + /// 库移来源箱标签 + /// + public string TransferLibFromPackingCode { get; set; } + + /// + /// 库移来源批次供应商批次 + /// + public string TransferLibFromSupplierBatch { get; set; } + + /// + /// 库移来源批次到货时间 + /// + public DateTime TransferLibFromArriveDate { get; set; } + + /// + /// 库移来源批次生产时间 + /// + public DateTime TransferLibFromProduceDate { get; set; } + + /// + /// 库移来源批次过期时间 + /// + public DateTime TransferLibFromExpireDate { get; set; } + + /// + /// 库移来源批次排序 + /// + public string TransferLibFromLot { get; set; } + + /// + /// 库移来源库位 + /// + public string TransferLibFromLocationCode { get; set; } + + /// + /// 库移来源库区 + /// + public string TransferLibFromLocationArea { get; set; } + + /// + /// 库移来源库位组 + /// + public string TransferLibFromLocationGroup { get; set; } + + /// + /// 库移来源ERP库位 + /// + public string TransferLibFromLocationErpCode { get; set; } + + /// + /// 库移来源仓库 + /// + public string TransferLibFromWarehouseCode { get; set; } + + /// + /// 库移来源数量 + /// + public decimal TransferLibFromQty { get; set; } + + #endregion + + #region 库移目标 + + /// + /// 库移目标托标签 + /// + public string TransferLibToContainerCode { get; set; } + + /// + /// 库移目标箱标签 + /// + public string TransferLibToPackingCode { get; set; } + + /// + /// 库移目标批次供应商批次 + /// + public string TransferLibToSupplierBatch { get; set; } + + /// + /// 库移目标批次到货时间 + /// + public DateTime TransferLibToArriveDate { get; set; } + + /// + /// 库移目标批次生产时间 + /// + public DateTime TransferLibToProduceDate { get; set; } + + /// + /// 库移目标批次过期时间 + /// + public DateTime TransferLibToExpireDate { get; set; } + + /// + /// 库移目标批次排序 + /// + public string TransferLibToLot { get; set; } + + /// + /// 库移目标库位 + /// + public string TransferLibToLocationCode { get; set; } + + /// + /// 库移目标库区 + /// + public string TransferLibToLocationArea { get; set; } + + /// + /// 库移目标库位组 + /// + public string TransferLibToLocationGroup { get; set; } + + /// + /// 库移目标ERP库位 + /// + public string TransferLibToLocationErpCode { get; set; } + + /// + /// 库移目标仓库 + /// + public string TransferLibToWarehouseCode { get; set; } + + /// + /// 库移目标数量 + /// + public decimal TransferLibToQty { get; set; } + + #endregion + + #region 实际来源 + + /// + /// 实际目标托标签 + /// + public string HandledFromContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledFromPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledFromSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledFromArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledFromProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledFromExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledFromLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledFromLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledFromLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledFromLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledFromLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledFromWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledFromQty { get; set; } + + #endregion + + #region 实际目标 + + /// + /// 实际目标托标签 + /// + public string HandledToContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledToPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledToSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledToArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledToProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledToExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledToLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledToLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledToLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledToLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledToLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledToWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledToQty { get; set; } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDetailInput.cs index 41b375822..19689cf4e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDetailInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDetailInput.cs @@ -1,54 +1,519 @@ using System; using System.ComponentModel.DataAnnotations; -using Win_in.Sfs.Shared.Domain; +using System.ComponentModel.DataAnnotations.Schema; +using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; -using Win_in.Sfs.Wms.Store.Application.Contracts; -namespace Win_in.Sfs.Wms.Store.Notes.IssueNotes; +namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class CoatingIssueNoteDetailInput : SfsStoreRecommendFromDetailWithFromToInputBase +public class CoatingIssueNoteDetailInput : SfsDetailInputBase { + #region 库存基础信息 /// - /// 发料时间 + /// 物品代码 /// - [Display(Name = "发料时间")] - public DateTime IssueTime { get; set; } + public string ItemCode { get; set; } /// - /// 过期时间 + /// 物品名称 /// - [Display(Name = "过期时间")] - public DateTime ExpiredTime { get; set; } + public string ItemName { get; set; } /// - /// 生产线 + /// 物品描述1 /// - [Display(Name = "生产线")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string ProdLine { get; set; } + public string ItemDesc1 { get; set; } + + /// + /// 物品描述2 + /// + public string ItemDesc2 { get; set; } + + /// + /// 标包数量 + /// + [Display(Name = "标包数量")] + [Column(TypeName = "decimal(18,6)")] + public decimal StdPackQty { get; set; } + + /// + /// 库存状态 + /// + public EnumInventoryStatus Status { get; set; } + + /// + /// 计量单位 + /// + public string Uom { get; set; } + + #endregion + + #region 请求信息 + + /// + /// 请求库位 + /// + public string RequestLocationCode { get; set; } /// - /// 工作中心 + /// 到库区 /// - [Display(Name = "工作中心")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string WorkStation { get; set; } + public string RequestLocationArea { get; set; } /// - /// 在途库库位 + /// 到库位组 + /// + public string RequestLocationGroup { get; set; } + + /// + /// 到ERP库位 + /// + public string RequestLocationErpCode { get; set; } + + /// + /// 到仓库 + /// + public string RequestWarehouseCode { get; set; } + + /// + /// 在途库库位 /// - [Display(Name = "在途库库位")] public string OnTheWayLocationCode { get; set; } /// - /// 位置码 + /// 生产线 + /// + public string ProdLine { get; set; } + + /// + /// 位置码 /// public string PositionCode { get; set; } /// - /// 推荐类型 + /// 推荐的类型 /// public EnumRecommendType RecommendType { get; set; } + /// + /// 需求数量 + /// + public decimal RequestQty { get; set; } + + #endregion + + #region 推荐来源 + + /// + /// 推荐来源托标签 + /// + public string RecommendFromContainerCode { get; set; } + + /// + /// 推荐来源箱标签 + /// + public string RecommendFromPackingCode { get; set; } + + /// + /// 推荐来源批次供应商批次 + /// + public string RecommendFromSupplierBatch { get; set; } + + /// + /// 推荐来源批次到货时间 + /// + public DateTime RecommendFromArriveDate { get; set; } + + /// + /// 推荐来源批次生产时间 + /// + public DateTime RecommendFromProduceDate { get; set; } + + /// + /// 推荐来源批次过期时间 + /// + public DateTime RecommendFromExpireDate { get; set; } + + /// + /// 推荐来源批次排序 + /// + public string RecommendFromLot { get; set; } + + /// + /// 推荐来源库位 + /// + public string RecommendFromLocationCode { get; set; } + + /// + /// 推荐来源库区 + /// + public string RecommendFromLocationArea { get; set; } + + /// + /// 推荐来源库位组 + /// + public string RecommendFromLocationGroup { get; set; } + + /// + /// 推荐来源ERP库位 + /// + public string RecommendFromLocationErpCode { get; set; } + + /// + /// 推荐来源仓库 + /// + public string RecommendFromWarehouseCode { get; set; } + + /// + /// 推荐来源数量 + /// + public decimal RecommendFromQty { get; set; } + + #endregion + + #region 推荐目标 + + /// + /// 推荐目标托标签 + /// + public string RecommendToContainerCode { get; set; } + + /// + /// 推荐目标箱标签 + /// + public string RecommendToPackingCode { get; set; } + + /// + /// 推荐目标批次供应商批次 + /// + public string RecommendToSupplierBatch { get; set; } + + /// + /// 推荐目标批次到货时间 + /// + public DateTime RecommendToArriveDate { get; set; } + + /// + /// 推荐目标批次生产时间 + /// + public DateTime RecommendToProduceDate { get; set; } + + /// + /// 推荐目标批次过期时间 + /// + public DateTime RecommendToExpireDate { get; set; } + + /// + /// 推荐目标批次排序 + /// + public string RecommendToLot { get; set; } + + /// + /// 推荐目标库位 + /// + public string RecommendToLocationCode { get; set; } + + /// + /// 推荐目标库区 + /// + public string RecommendToLocationArea { get; set; } + + /// + /// 推荐目标库位组 + /// + public string RecommendToLocationGroup { get; set; } + + /// + /// 推荐目标ERP库位 + /// + public string RecommendToLocationErpCode { get; set; } + + /// + /// 推荐目标仓库 + /// + public string RecommendToWarehouseCode { get; set; } + + /// + /// 推荐目标数量 + /// + public decimal RecommendToQty { get; set; } + + #endregion + + #region 库移来源 + + /// + /// 库移来源托标签 + /// + public string TransferLibFromContainerCode { get; set; } + + /// + /// 库移来源箱标签 + /// + public string TransferLibFromPackingCode { get; set; } + + /// + /// 库移来源批次供应商批次 + /// + public string TransferLibFromSupplierBatch { get; set; } + + /// + /// 库移来源批次到货时间 + /// + public DateTime TransferLibFromArriveDate { get; set; } + + /// + /// 库移来源批次生产时间 + /// + public DateTime TransferLibFromProduceDate { get; set; } + + /// + /// 库移来源批次过期时间 + /// + public DateTime TransferLibFromExpireDate { get; set; } + + /// + /// 库移来源批次排序 + /// + public string TransferLibFromLot { get; set; } + + /// + /// 库移来源库位 + /// + public string TransferLibFromLocationCode { get; set; } + + /// + /// 库移来源库区 + /// + public string TransferLibFromLocationArea { get; set; } + + /// + /// 库移来源库位组 + /// + public string TransferLibFromLocationGroup { get; set; } + + /// + /// 库移来源ERP库位 + /// + public string TransferLibFromLocationErpCode { get; set; } + + /// + /// 库移来源仓库 + /// + public string TransferLibFromWarehouseCode { get; set; } + + /// + /// 库移来源数量 + /// + public decimal TransferLibFromQty { get; set; } + + #endregion + + #region 库移目标 + + /// + /// 库移目标托标签 + /// + public string TransferLibToContainerCode { get; set; } + + /// + /// 库移目标箱标签 + /// + public string TransferLibToPackingCode { get; set; } + + /// + /// 库移目标批次供应商批次 + /// + public string TransferLibToSupplierBatch { get; set; } + + /// + /// 库移目标批次到货时间 + /// + public DateTime TransferLibToArriveDate { get; set; } + + /// + /// 库移目标批次生产时间 + /// + public DateTime TransferLibToProduceDate { get; set; } + + /// + /// 库移目标批次过期时间 + /// + public DateTime TransferLibToExpireDate { get; set; } + + /// + /// 库移目标批次排序 + /// + public string TransferLibToLot { get; set; } + + /// + /// 库移目标库位 + /// + public string TransferLibToLocationCode { get; set; } + + /// + /// 库移目标库区 + /// + public string TransferLibToLocationArea { get; set; } + + /// + /// 库移目标库位组 + /// + public string TransferLibToLocationGroup { get; set; } + + /// + /// 库移目标ERP库位 + /// + public string TransferLibToLocationErpCode { get; set; } + + /// + /// 库移目标仓库 + /// + public string TransferLibToWarehouseCode { get; set; } + + /// + /// 库移目标数量 + /// + public decimal TransferLibToQty { get; set; } + + #endregion + + #region 实际来源 + + /// + /// 实际目标托标签 + /// + public string HandledFromContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledFromPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledFromSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledFromArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledFromProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledFromExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledFromLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledFromLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledFromLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledFromLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledFromLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledFromWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledFromQty { get; set; } + + #endregion + + #region 实际目标 + + /// + /// 实际目标托标签 + /// + public string HandledToContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledToPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledToSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledToArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledToProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledToExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledToLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledToLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledToLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledToLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledToLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledToWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledToQty { get; set; } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteEditInput.cs index d1b7307c3..210a1db12 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteEditInput.cs @@ -27,14 +27,7 @@ public class CoatingIssueNoteEditInput : SfsStoreCreateOrUpdateInputBase /// [Display(Name = "任务ID")] [Required(ErrorMessage = "{0}是必填项")] - public string JobNumber { get; set; } - - /// - /// 车间 - /// - [Display(Name = "车间")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string Workshop { get; set; } + public string JobNumber { get; set; } /// /// 明细列表 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs index 520ad0cec..82c83a21f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs @@ -100,6 +100,7 @@ public class StorePermissionDefinitionProvider : PermissionDefinitionProvider storeGroup.AddPutawayJobPermission(); storeGroup.AddIssueJobPermission(); storeGroup.AddInjectionJobPermission(); + storeGroup.AddCoatingIssueJobPermission(); storeGroup.AddAssembleJobPermission(); storeGroup.AddThirdLocationJobPermission(); storeGroup.AddContainerJobPermission(); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/AssembleRequests/Inputs/AssembleRequestEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/AssembleRequests/Inputs/AssembleRequestEditInput.cs index e2ba92350..7b68689e2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/AssembleRequests/Inputs/AssembleRequestEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/AssembleRequests/Inputs/AssembleRequestEditInput.cs @@ -24,7 +24,7 @@ public class AssembleIssueRequestsEditInput : SfsStoreRequestCreateOrUpdateInput /// 明细列表 /// [Display(Name = "明细列表")] - public List Details { get; set; } = new List(); + public List Details { get; set; } = new List(); #endregion #region Create diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestEditInput.cs index 94578eb49..ab7e554b1 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestEditInput.cs @@ -25,7 +25,7 @@ public class CoatingMaterialRequestEditInput : SfsStoreRequestCreateOrUpdateInpu /// 明细列表 /// [Display(Name = "明细列表")] - public List Details { get; set; } = new List(); + public List Details { get; set; } = new List(); #endregion #region Create diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleJobs/AssembleJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleJobs/AssembleJobAppService.cs index ac4126ccb..1a1a6edc9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleJobs/AssembleJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleJobs/AssembleJobAppService.cs @@ -1,69 +1,122 @@ using System; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; +using Castle.Components.DictionaryAdapter; 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.Application.Contracts; 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; +using Win_in.Sfs.Wms.Store.Notes; namespace Win_in.Sfs.Wms.Store.Application; [Authorize] [Route($"{StoreConsts.RootPath}assemble-job")] public class AssembleJobAppService - : SfsJobAppServiceBase, - IAssembleJobAppService + : SfsJobAppServiceBase, + IAssembleJobAppService, ITransferLibCallback { private readonly IAssembleJobManager _assembleJobManager; + private readonly ILocationAppService _locationAppService; + private readonly ITransferLibJobAppService _transferLibJobAppService; public AssembleJobAppService( - IAssembleJobRepository repository, IAssembleJobManager assembleJobManager - ) : base(repository, assembleJobManager) + IAssembleJobRepository repository, IAssembleJobManager assembleJobManager, + ILocationAppService locationAppService, ITransferLibJobAppService transferLibJobAppService) : base(repository, assembleJobManager) { _assembleJobManager = assembleJobManager; + _locationAppService = locationAppService; + _transferLibJobAppService = transferLibJobAppService; + } + + [HttpPost("add-many")] + public override async Task> CreateManyAsync(List inputs) + { + foreach (var input in inputs) + { + await CheckMinRowAndSetStatusAsync(input).ConfigureAwait(false); + } + + return await base.CreateManyAsync(inputs).ConfigureAwait(false); + } + + [HttpPost("")] + public override async Task CreateAsync(AssembleJobEditInput input) + { + await CheckMinRowAndSetStatusAsync(input).ConfigureAwait(false); + + return await base.CreateAsync(input).ConfigureAwait(false); } /// - /// 根据物品和库位 检查是否存在发料任务 + /// 判断是不是在最底层 如果不是则把状态变更为等待 并把库移推荐的From和To赋值 /// - /// - /// + /// /// - /// - [Authorize] - [HttpGet("check-job-exist")] - public virtual async Task> CheckJobExistByItemCodeAndLocationCode(string itemCode, - string locationCode) + private async Task CheckMinRowAndSetStatusAsync(AssembleJobEditInput input) { - 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>(entities); - return dtos; + var jobDetailInputdetail = input.Details.FirstOrDefault(); + + var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) + .ConfigureAwait(false); + + if (loctionDto.RowCode != 1) + { + input.JobStatus = EnumJobStatus.Wait; + + jobDetailInputdetail.TransferLibFromArriveDate = jobDetailInputdetail.RecommendFromArriveDate; + jobDetailInputdetail.TransferLibFromContainerCode = jobDetailInputdetail.RecommendFromContainerCode; + jobDetailInputdetail.TransferLibFromExpireDate = jobDetailInputdetail.RecommendFromExpireDate; + jobDetailInputdetail.TransferLibFromLocationArea = jobDetailInputdetail.RecommendFromLocationArea; + jobDetailInputdetail.TransferLibFromLocationCode = jobDetailInputdetail.RecommendFromLocationCode; + jobDetailInputdetail.TransferLibFromLocationErpCode = jobDetailInputdetail.RecommendFromLocationErpCode; + jobDetailInputdetail.TransferLibFromLocationGroup = jobDetailInputdetail.RecommendFromLocationGroup; + jobDetailInputdetail.TransferLibFromLot = jobDetailInputdetail.RecommendFromLot; + jobDetailInputdetail.TransferLibFromPackingCode = jobDetailInputdetail.RecommendFromPackingCode; + jobDetailInputdetail.TransferLibFromProduceDate = jobDetailInputdetail.RecommendFromProduceDate; + jobDetailInputdetail.TransferLibFromQty = jobDetailInputdetail.RecommendFromQty; + jobDetailInputdetail.TransferLibFromSupplierBatch = jobDetailInputdetail.RecommendFromSupplierBatch; + jobDetailInputdetail.TransferLibFromWarehouseCode = jobDetailInputdetail.RecommendFromWarehouseCode; + + jobDetailInputdetail.TransferLibToArriveDate = jobDetailInputdetail.RecommendToArriveDate; + jobDetailInputdetail.TransferLibToContainerCode = jobDetailInputdetail.RecommendToContainerCode; + jobDetailInputdetail.TransferLibToExpireDate = jobDetailInputdetail.RecommendToExpireDate; + jobDetailInputdetail.TransferLibToLocationArea = jobDetailInputdetail.RecommendToLocationArea; + jobDetailInputdetail.TransferLibToLocationCode = jobDetailInputdetail.RecommendToLocationCode; + jobDetailInputdetail.TransferLibToLocationErpCode = jobDetailInputdetail.RecommendToLocationErpCode; + jobDetailInputdetail.TransferLibToLocationGroup = jobDetailInputdetail.RecommendToLocationGroup; + jobDetailInputdetail.TransferLibToLot = jobDetailInputdetail.RecommendToLot; + jobDetailInputdetail.TransferLibToPackingCode = jobDetailInputdetail.RecommendToPackingCode; + jobDetailInputdetail.TransferLibToProduceDate = jobDetailInputdetail.RecommendToProduceDate; + jobDetailInputdetail.TransferLibToQty = jobDetailInputdetail.RecommendToQty; + jobDetailInputdetail.TransferLibToSupplierBatch = jobDetailInputdetail.RecommendToSupplierBatch; + jobDetailInputdetail.TransferLibToWarehouseCode = jobDetailInputdetail.RecommendToWarehouseCode; + } } - [HttpPost("cancel-by-request/{assembleNumber}")] + [HttpPost("cancel-by-request/{assembleRequestNumber}")] public virtual async Task CancelByMaterialRequestAsync(string assembleNumber) { - var entities = await _repository.GetListAsync(p => p.AssembleIssueRequestsNumber == assembleNumber).ConfigureAwait(false); + var entities = await _repository.GetListAsync(p => p.AssembleRequestNumber == assembleNumber) + .ConfigureAwait(false); foreach (var entity in entities) { await _assembleJobManager.CancelAsync(entity).ConfigureAwait(false); } } - + [HttpPost("invalid")] public override async Task CancelAsync(Guid id) { @@ -71,74 +124,70 @@ public class AssembleJobAppService if (assembleJob == null) { throw new UserFriendlyException($"未找到ID为 {id} 的任务"); - } + } await _assembleJobManager.CancelAsync(assembleJob).ConfigureAwait(false); + } + [HttpPost("by-request-number/{requestNumber}")] + public virtual async Task> GetByRequestNumberAsync(string requestNumber) + { + var entitys = await _repository.GetListAsync(p => p.AssembleRequestNumber == requestNumber) + .ConfigureAwait(false); + return ObjectMapper.Map, List>(entitys); } - /// - /// 根据叫料请求类型获取发料任务 - /// - /// - /// - /// 叫料请求类型: - /// 人工拉动:Issue_Manual; - /// 线边拉动:Issue_WIP; - /// - /// - /// - /// - [HttpPost("by-type/{requestType}")] - public virtual async Task> GetListByTypeAsync(SfsJobRequestInputBase requestInput, - string requestType, bool includeDetails = false, CancellationToken cancellationToken = default) + [HttpPost("Do-Call-Back")] + public async Task DoTransferLibCallbackAsync(TransferLibJobDTO dto) { - Expression> expression = p => p.RequestType == requestType; - if (requestInput.Condition.Filters?.Count > 0) - { - expression = expression.And(requestInput.Condition.Filters.ToLambda()); - } + var job = await _repository.FindAsync(p => p.Number == dto.JobNumber).ConfigureAwait(false); - return await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount, - requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false); + //todo 等云峰写好换成真实的 + var transferLibJobDto = await _transferLibJobAppService.GetByNumberAsync("AAA").ConfigureAwait(false); + var transferLibNote = new TransferLibNote(); - } + var transferLibNoteDetail = transferLibNote.Details.First(); - [HttpPost("by-request-number/{requestNumber}")] - public virtual async Task> GetByRequestNumberAsync(string requestNumber) - { - var entitys = await _repository.GetListAsync(p => p.AssembleIssueRequestsNumber == requestNumber).ConfigureAwait(false); - return ObjectMapper.Map, List>(entitys); + var jobDetail = job.Details.First(); + job.JobStatus = EnumJobStatus.Open; + + jobDetail.TransferLibFromArriveDate = transferLibNoteDetail.HandledFromArriveDate; + jobDetail.TransferLibFromContainerCode = transferLibNoteDetail.HandledFromContainerCode; + jobDetail.TransferLibFromExpireDate = transferLibNoteDetail.HandledFromExpireDate; + jobDetail.TransferLibFromLocationArea = transferLibNoteDetail.HandledFromLocationArea; + jobDetail.TransferLibFromLocationCode = transferLibNoteDetail.HandledFromLocationCode; + jobDetail.TransferLibFromLocationErpCode = transferLibNoteDetail.HandledFromLocationErpCode; + jobDetail.TransferLibFromLocationGroup = transferLibNoteDetail.HandledFromLocationGroup; + jobDetail.TransferLibFromLot = transferLibNoteDetail.HandledFromLot; + jobDetail.TransferLibFromPackingCode = transferLibNoteDetail.HandledFromPackingCode; + jobDetail.TransferLibFromProduceDate = transferLibNoteDetail.HandledFromProduceDate; + jobDetail.TransferLibFromQty = transferLibNoteDetail.HandledFromQty; + jobDetail.TransferLibFromSupplierBatch = transferLibNoteDetail.HandledFromSupplierBatch; + jobDetail.TransferLibFromWarehouseCode = transferLibNoteDetail.HandledFromWarehouseCode; + + jobDetail.TransferLibToArriveDate = transferLibNoteDetail.HandledToArriveDate; + jobDetail.TransferLibToContainerCode = transferLibNoteDetail.HandledToContainerCode; + jobDetail.TransferLibToExpireDate = transferLibNoteDetail.HandledToExpireDate; + jobDetail.TransferLibToLocationArea = transferLibNoteDetail.HandledToLocationArea; + jobDetail.TransferLibToLocationCode = transferLibNoteDetail.HandledToLocationCode; + jobDetail.TransferLibToLocationErpCode = transferLibNoteDetail.HandledToLocationErpCode; + jobDetail.TransferLibToLocationGroup = transferLibNoteDetail.HandledToLocationGroup; + jobDetail.TransferLibToLot = transferLibNoteDetail.HandledToLot; + jobDetail.TransferLibToPackingCode = transferLibNoteDetail.HandledToPackingCode; + jobDetail.TransferLibToProduceDate = transferLibNoteDetail.HandledToProduceDate; + jobDetail.TransferLibToQty = transferLibNoteDetail.HandledToQty; + jobDetail.TransferLibToSupplierBatch = transferLibNoteDetail.HandledToSupplierBatch; + jobDetail.TransferLibToWarehouseCode = transferLibNoteDetail.HandledToWarehouseCode; + + await _repository.UpdateAsync(job).ConfigureAwait(false); + + return; } - /// - /// 保存拆箱时涉及的明细修改 - /// - /// - [HttpPost("save-detail-split-packing")] - public virtual async Task SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input) + [HttpPost("test")] + public virtual async Task Test() { - var job = await _repository.FindAsync(p => p.Number == input.Number).ConfigureAwait(false); - AssembleJobDetail detail = job.Details.FirstOrDefault(p => p.RecommendPackingCode == input.FromPackingCode ); /*&& p.HandledQty == input.FromQty*/ - if (detail == null) - { - //throw new UserFriendlyException($"根据HandledPackingCode={input.FromPackingCode}取AssembleJobDetail表为空!"); - throw new UserFriendlyException($"根据RecommendPackingCode={input.FromPackingCode}取AssembleJobDetail表为空!"); - } - //插入目标箱 - 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(entity); - return ret; + Console.WriteLine("FuAZCZXVZXVXZVZ"); + await Task.CompletedTask; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs index 3d7d19faf..a07a74d69 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs @@ -1,195 +1,194 @@ using System; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; +using Castle.Components.DictionaryAdapter; 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.Application.Contracts; 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; using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; +using Win_in.Sfs.Wms.Store.Jobs.IssueJobs; +using Win_in.Sfs.Wms.Store.Notes; -namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs; +namespace Win_in.Sfs.Wms.Store.Application; [Authorize] -[Route($"{StoreConsts.RootPath}coatingissue-job")] - +[Route($"{StoreConsts.RootPath}coating-issue-job")] public class CoatingIssueJobAppService - : SfsJobAppServiceBase, - ICoatingIssueJobAppService + : SfsJobAppServiceBase, + ICoatingIssueJobAppService, ITransferLibCallback { - private readonly ICoatingIssueJobManager _CoatingIssueJobManager; + private readonly ICoatingIssueJobManager _coatingIssueJobManager; + private readonly ILocationAppService _locationAppService; + private readonly ITransferLibJobAppService _transferLibJobAppService; public CoatingIssueJobAppService( - ICoatingIssueJobRepository repository, ICoatingIssueJobManager CoatingIssueJobManager - ) : base(repository, CoatingIssueJobManager) + ICoatingIssueJobRepository repository, ICoatingIssueJobManager coatingIssueJobManager, + ILocationAppService locationAppService, ITransferLibJobAppService transferLibJobAppService) : base(repository, coatingIssueJobManager) { - _CoatingIssueJobManager = CoatingIssueJobManager; + _coatingIssueJobManager = coatingIssueJobManager; + _locationAppService = locationAppService; + _transferLibJobAppService = transferLibJobAppService; + } + + [HttpPost("add-many")] + public override async Task> CreateManyAsync(List inputs) + { + foreach (var input in inputs) + { + await CheckMinRowAndSetStatusAsync(input).ConfigureAwait(false); + } + + return await base.CreateManyAsync(inputs).ConfigureAwait(false); + } + + [HttpPost("")] + public override async Task CreateAsync(CoatingIssueJobEditInput input) + { + await CheckMinRowAndSetStatusAsync(input).ConfigureAwait(false); + + return await base.CreateAsync(input).ConfigureAwait(false); } /// - /// 根据物品和库位 检查是否存在发料任务 + /// 判断是不是在最底层 如果不是则把状态变更为等待 并把库移推荐的From和To赋值 /// - /// - /// + /// /// - /// - [Authorize] - [HttpGet("check-job-exist")] - public virtual async Task> CheckJobExistByItemCodeAndLocationCode(string itemCode, - string locationCode) + private async Task CheckMinRowAndSetStatusAsync(CoatingIssueJobEditInput input) { - 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>(entities); - return dtos; + var jobDetailInputdetail = input.Details.FirstOrDefault(); + + var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) + .ConfigureAwait(false); + + if (loctionDto.RowCode != 1) + { + input.JobStatus = EnumJobStatus.Wait; + + jobDetailInputdetail.TransferLibFromArriveDate = jobDetailInputdetail.RecommendFromArriveDate; + jobDetailInputdetail.TransferLibFromContainerCode = jobDetailInputdetail.RecommendFromContainerCode; + jobDetailInputdetail.TransferLibFromExpireDate = jobDetailInputdetail.RecommendFromExpireDate; + jobDetailInputdetail.TransferLibFromLocationArea = jobDetailInputdetail.RecommendFromLocationArea; + jobDetailInputdetail.TransferLibFromLocationCode = jobDetailInputdetail.RecommendFromLocationCode; + jobDetailInputdetail.TransferLibFromLocationErpCode = jobDetailInputdetail.RecommendFromLocationErpCode; + jobDetailInputdetail.TransferLibFromLocationGroup = jobDetailInputdetail.RecommendFromLocationGroup; + jobDetailInputdetail.TransferLibFromLot = jobDetailInputdetail.RecommendFromLot; + jobDetailInputdetail.TransferLibFromPackingCode = jobDetailInputdetail.RecommendFromPackingCode; + jobDetailInputdetail.TransferLibFromProduceDate = jobDetailInputdetail.RecommendFromProduceDate; + jobDetailInputdetail.TransferLibFromQty = jobDetailInputdetail.RecommendFromQty; + jobDetailInputdetail.TransferLibFromSupplierBatch = jobDetailInputdetail.RecommendFromSupplierBatch; + jobDetailInputdetail.TransferLibFromWarehouseCode = jobDetailInputdetail.RecommendFromWarehouseCode; + + jobDetailInputdetail.TransferLibToArriveDate = jobDetailInputdetail.RecommendToArriveDate; + jobDetailInputdetail.TransferLibToContainerCode = jobDetailInputdetail.RecommendToContainerCode; + jobDetailInputdetail.TransferLibToExpireDate = jobDetailInputdetail.RecommendToExpireDate; + jobDetailInputdetail.TransferLibToLocationArea = jobDetailInputdetail.RecommendToLocationArea; + jobDetailInputdetail.TransferLibToLocationCode = jobDetailInputdetail.RecommendToLocationCode; + jobDetailInputdetail.TransferLibToLocationErpCode = jobDetailInputdetail.RecommendToLocationErpCode; + jobDetailInputdetail.TransferLibToLocationGroup = jobDetailInputdetail.RecommendToLocationGroup; + jobDetailInputdetail.TransferLibToLot = jobDetailInputdetail.RecommendToLot; + jobDetailInputdetail.TransferLibToPackingCode = jobDetailInputdetail.RecommendToPackingCode; + jobDetailInputdetail.TransferLibToProduceDate = jobDetailInputdetail.RecommendToProduceDate; + jobDetailInputdetail.TransferLibToQty = jobDetailInputdetail.RecommendToQty; + jobDetailInputdetail.TransferLibToSupplierBatch = jobDetailInputdetail.RecommendToSupplierBatch; + jobDetailInputdetail.TransferLibToWarehouseCode = jobDetailInputdetail.RecommendToWarehouseCode; + } } - [HttpPost("cancel-by-request/{materialNumber}")] - public virtual async Task CancelByMaterialRequestAsync(string materialNumber) + [HttpPost("cancel-by-request/{requestNumber}")] + public virtual async Task CancelByMaterialRequestAsync(string requestNumber) { - var entities = await _repository.GetListAsync(p => p.MaterialRequestNumber == materialNumber).ConfigureAwait(false); + var entities = await _repository.GetListAsync(p => p.MaterialRequestNumber == requestNumber) + .ConfigureAwait(false); foreach (var entity in entities) { - await _CoatingIssueJobManager.CancelAsync(entity).ConfigureAwait(false); + await _coatingIssueJobManager.CancelAsync(entity).ConfigureAwait(false); } } - //[Authorize(CoatingIssueJobPermissions.Delete)] - //[HttpDelete("details/{id}")] - //public virtual async Task DeleteDetailAsync(Guid id, Guid detailId) - //{ - // var entity = await _repository.GetAsync(id); - // Check.NotNull(entity, EntityClassName); - - // var input = new CoatingIssueJobCheckInput - // { - // JobStatuses = new List() { EnumJobStatus.Pending, EnumJobStatus.Open }, - // }; - // var result = new AbpValidationResult(); - - // var detail = entity.GetDetail(detailId); - - // _CoatingIssueJobManager.CheckJobStatus(entity, input.JobStatuses, result); - // if (result.Errors.Any()) - // { - // throw new AbpValidationException("任务状态错误,不能进行删除明细操作"); - // } - // entity.RemoveDetail(detailId); - //} - - //[Authorize(CoatingIssueJobPermissions.Delete)] [HttpPost("invalid")] public override async Task CancelAsync(Guid id) { - var CoatingIssueJob = await _repository.GetAsync(id).ConfigureAwait(false); - if (CoatingIssueJob == null) + var coatingIssueJob = await _repository.GetAsync(id).ConfigureAwait(false); + if (coatingIssueJob == null) { throw new UserFriendlyException($"未找到ID为 {id} 的任务"); } - /* - var listLocationCode = new List();//取出所有当前job 影响的库位code - foreach (var detail in CoatingIssueJob.Details) - { - if (detail.HandledLocationCode != null) - { - listLocationCode.Add(detail.HandledLocationCode); - } - if (detail.HandledLocationCode != null) - { - listLocationCode.Add(detail.RecommendLocationCode); - } - if (detail.HandledLocationCode != null) - { - listLocationCode.Add(detail.RequestLocationCode); - } - if (detail.HandledLocationCode != null) - { - listLocationCode.Add(detail.ToLocationCode); - } - } - listLocationCode = listLocationCode.Distinct().ToList(); - */ - - await _CoatingIssueJobManager.CancelAsync(CoatingIssueJob).ConfigureAwait(false); - - } - - /// - /// 根据叫料请求类型获取发料任务 - /// - /// - /// - /// 叫料请求类型: - /// 人工拉动:Issue_Manual; - /// 线边拉动:Issue_WIP; - /// - /// - /// - /// - [HttpPost("by-type/{requestType}")] - public virtual async Task> GetListByTypeAsync(SfsJobRequestInputBase requestInput, - string requestType, bool includeDetails = false, CancellationToken cancellationToken = default) - { - Expression> expression = p => p.RequestType == requestType; - if (requestInput.Condition.Filters?.Count > 0) - { - expression = expression.And(requestInput.Condition.Filters.ToLambda()); - } - - return await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount, - requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false); - + await _coatingIssueJobManager.CancelAsync(coatingIssueJob).ConfigureAwait(false); } [HttpPost("by-request-number/{requestNumber}")] public virtual async Task> GetByRequestNumberAsync(string requestNumber) { - var entitys = await _repository.GetListAsync(p => p.MaterialRequestNumber == requestNumber).ConfigureAwait(false); + var entitys = await _repository.GetListAsync(p => p.MaterialRequestNumber == requestNumber) + .ConfigureAwait(false); return ObjectMapper.Map, List>(entitys); } - /// - /// 保存拆箱时涉及的明细修改 - /// - /// - [HttpPost("save-detail-split-packing")] - public virtual async Task SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input) + [HttpPost("Do-Call-Back")] + public async Task DoTransferLibCallbackAsync(TransferLibJobDTO dto) { - var job = await _repository.FindAsync(p => p.Number == input.Number).ConfigureAwait(false); - var detail = job.Details.FirstOrDefault(p => p.RecommendPackingCode == input.FromPackingCode); /*&& p.HandledQty == input.FromQty*/ - if (detail == null) - { - throw new UserFriendlyException($"根据RecommendPackingCode={input.FromPackingCode}取CoatingIssueJobDetail表为空!"); - } - //插入目标箱 - 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(entity); - return ret; + var job = await _repository.FindAsync(p => p.Number == dto.JobNumber).ConfigureAwait(false); + + //todo 等云峰写好换成真实的 + var transferLibJobDto = await _transferLibJobAppService.GetByNumberAsync("AAA").ConfigureAwait(false); + var transferLibNote = new TransferLibNote(); + + var transferLibNoteDetail = transferLibNote.Details.First(); + + var jobDetail = job.Details.First(); + job.JobStatus = EnumJobStatus.Open; + + jobDetail.TransferLibFromArriveDate = transferLibNoteDetail.HandledFromArriveDate; + jobDetail.TransferLibFromContainerCode = transferLibNoteDetail.HandledFromContainerCode; + jobDetail.TransferLibFromExpireDate = transferLibNoteDetail.HandledFromExpireDate; + jobDetail.TransferLibFromLocationArea = transferLibNoteDetail.HandledFromLocationArea; + jobDetail.TransferLibFromLocationCode = transferLibNoteDetail.HandledFromLocationCode; + jobDetail.TransferLibFromLocationErpCode = transferLibNoteDetail.HandledFromLocationErpCode; + jobDetail.TransferLibFromLocationGroup = transferLibNoteDetail.HandledFromLocationGroup; + jobDetail.TransferLibFromLot = transferLibNoteDetail.HandledFromLot; + jobDetail.TransferLibFromPackingCode = transferLibNoteDetail.HandledFromPackingCode; + jobDetail.TransferLibFromProduceDate = transferLibNoteDetail.HandledFromProduceDate; + jobDetail.TransferLibFromQty = transferLibNoteDetail.HandledFromQty; + jobDetail.TransferLibFromSupplierBatch = transferLibNoteDetail.HandledFromSupplierBatch; + jobDetail.TransferLibFromWarehouseCode = transferLibNoteDetail.HandledFromWarehouseCode; + + jobDetail.TransferLibToArriveDate = transferLibNoteDetail.HandledToArriveDate; + jobDetail.TransferLibToContainerCode = transferLibNoteDetail.HandledToContainerCode; + jobDetail.TransferLibToExpireDate = transferLibNoteDetail.HandledToExpireDate; + jobDetail.TransferLibToLocationArea = transferLibNoteDetail.HandledToLocationArea; + jobDetail.TransferLibToLocationCode = transferLibNoteDetail.HandledToLocationCode; + jobDetail.TransferLibToLocationErpCode = transferLibNoteDetail.HandledToLocationErpCode; + jobDetail.TransferLibToLocationGroup = transferLibNoteDetail.HandledToLocationGroup; + jobDetail.TransferLibToLot = transferLibNoteDetail.HandledToLot; + jobDetail.TransferLibToPackingCode = transferLibNoteDetail.HandledToPackingCode; + jobDetail.TransferLibToProduceDate = transferLibNoteDetail.HandledToProduceDate; + jobDetail.TransferLibToQty = transferLibNoteDetail.HandledToQty; + jobDetail.TransferLibToSupplierBatch = transferLibNoteDetail.HandledToSupplierBatch; + jobDetail.TransferLibToWarehouseCode = transferLibNoteDetail.HandledToWarehouseCode; + + await _repository.UpdateAsync(job).ConfigureAwait(false); + + return; } - - + [HttpPost("test")] + public virtual async Task Test() + { + Console.WriteLine("FuAZCZXVZXVXZVZ"); + await Task.CompletedTask; + } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAutoMapperProfile.cs index 6de2d02e7..3a3a961e5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAutoMapperProfile.cs @@ -1,5 +1,7 @@ using AutoMapper; using Volo.Abp.AutoMapper; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Jobs.IssueJobs; namespace Win_in.Sfs.Wms.Store.Application; @@ -8,9 +10,10 @@ public partial class StoreApplicationAutoMapperProfile : Profile { private void CoatingIssueJobAutoMapperProfile() { - CreateMap(); + CreateMap() + .ReverseMap(); - CreateMap(); + //CreateMap(); CreateMap() ; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteAppService.cs index f95ca5eae..8480c6c88 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteAppService.cs @@ -11,30 +11,28 @@ 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; using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; using Win_in.Sfs.Wms.Store.Notes.IssueNotes; -namespace Win_in.Sfs.Wms.Store.Notes.IssueNotes; +namespace Win_in.Sfs.Wms.Store.Application; [Authorize] -[Route($"{StoreConsts.RootPath}coatingissue-note")] - - +[Route($"{StoreConsts.RootPath}coating-note")] public class CoatingIssueNoteAppService : SfsStoreWithDetailsAppServiceBase, ICoatingIssueNoteAppService { - private readonly ICoatingIssueNoteManager _CoatingIssueNoteManager; + private readonly ICoatingIssueNoteManager _coatingIssueNoteManager; public CoatingIssueNoteAppService( ICoatingIssueNoteRepository repository, - ICoatingIssueNoteManager CoatingIssueNoteManager + ICoatingIssueNoteManager coatingIssueNoteManager ) : base(repository) { - _CoatingIssueNoteManager = CoatingIssueNoteManager; + _coatingIssueNoteManager = coatingIssueNoteManager; } [HttpPost("")] @@ -42,7 +40,7 @@ public class CoatingIssueNoteAppService : public override async Task CreateAsync(CoatingIssueNoteEditInput input) { var entity = ObjectMapper.Map(input); - await _CoatingIssueNoteManager.CreateAsync(entity).ConfigureAwait(false); + await _coatingIssueNoteManager.CreateAsync(entity).ConfigureAwait(false); var dto = ObjectMapper.Map(entity); return dto; } @@ -55,11 +53,11 @@ public class CoatingIssueNoteAppService : [HttpPost("confirm/{id}")] public virtual async Task ConfirmAsync(Guid id) { - var issueNote = await _repository.GetAsync(id).ConfigureAwait(false); - issueNote.Confirmed = true; - issueNote = await _repository.UpdateAsync(issueNote).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData(issueNote), false).ConfigureAwait(false); - return ObjectMapper.Map(issueNote); + var coatingIssueNote = await _repository.GetAsync(id).ConfigureAwait(false); + coatingIssueNote.Confirmed = true; + coatingIssueNote = await _repository.UpdateAsync(coatingIssueNote).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData(coatingIssueNote), false).ConfigureAwait(false); + return ObjectMapper.Map(coatingIssueNote); } [HttpPost("confirm-by-number/{number}")] @@ -67,7 +65,7 @@ public class CoatingIssueNoteAppService : { var entity = await _repository.FindAsync(p => p.Number == number).ConfigureAwait(false); Check.NotNull(entity, nameof(CoatingIssueNote)); - var result = await _CoatingIssueNoteManager.ConfirmAsync(entity.Id).ConfigureAwait(false); + var result = await _coatingIssueNoteManager.ConfirmAsync(entity.Id).ConfigureAwait(false); var dto = ObjectMapper.Map(result); return dto; } @@ -108,26 +106,4 @@ public class CoatingIssueNoteAppService : return dtos; } - //[HttpPost("")] - //[Authorize(IssueNotePermissions.Create)] - //public override Task CreateAsync(IssueNoteCreateInput input) - //{ - // return base.CreateAsync(input); - //} - - //[HttpPut] - //[Route($"{StoreConsts.RootPath}{id}")] - //[Authorize(IssueNotePermissions.Update)] - //public override Task UpdateAsync(Guid id, IssueNoteUpdateInput input) - //{ - // return base.UpdateAsync(id, input); - //} - - //[HttpDelete] - //[Route($"{StoreConsts.RootPath}{id}")] - //[Authorize(IssueNotePermissions.Delete)] - //public override Task DeleteAsync(Guid id) - //{ - // return base.DeleteAsync(id); - //} } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteAutoMapperProfile.cs index d6ce0f0fa..360a0df6d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteAutoMapperProfile.cs @@ -1,5 +1,7 @@ using AutoMapper; using Volo.Abp.AutoMapper; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Notes.IssueNotes; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/AssembleRequests/AssembleRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/AssembleRequests/AssembleRequestAppService.cs index e511d4d21..430ffe889 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/AssembleRequests/AssembleRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/AssembleRequests/AssembleRequestAppService.cs @@ -15,6 +15,7 @@ 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; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; @@ -40,18 +41,20 @@ public class AssembleIssueRequestsAppService : SfsStoreRequestAppServiceBase HandleAsync(Guid id) { - var entity = await _repository.GetAsync(id).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new SfsHandledEntityEventData(entity), false).ConfigureAwait(false); - return ObjectMapper.Map(entity); + await Task.CompletedTask.ConfigureAwait(false); + return null; } [HttpPost("")] - //[Authorize(AssembleIssueRequestsPermissions.Create)] - public override async Task CreateAsync(AssembleIssueRequestsEditInput input) + public override async Task CreateAsync(AssembleRequestEditInput input) { foreach (var item in input.Details) { @@ -87,31 +89,55 @@ public class AssembleIssueRequestsAppService : SfsStoreRequestAppServiceBase(input); + //因为是刚创建的 所以发料数一定是0 + detailInput.IssuedQty = 0; + } - var result = await _assembleRequestManager.CreateAsync(entity).ConfigureAwait(false); + await SetRequestAutoPropertiesAsync(input).ConfigureAwait(false); + var entity = ObjectMapper.Map(input); + + var result = await _assembleRequestManager.CreateByNumberAsync(entity).ConfigureAwait(false); var dto = ObjectMapper.Map(result); return dto; } - //[Authorize(AssembleIssueRequestsPermissions.Create)] + /// + /// 赋值Request业务属性 + /// + /// + /// + private async Task SetRequestAutoPropertiesAsync(AssembleRequestEditInput entity) + { + var tranType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false); + Check.NotNull(tranType, "事务类型", "事务类型不存在"); + entity.AutoSubmit = tranType.AutoSubmitRequest; + entity.AutoAgree = tranType.AutoAgreeRequest; + entity.AutoHandle = tranType.AutoHandleRequest; + entity.AutoCompleteJob = tranType.AutoCompleteJob; + entity.DirectCreateNote = tranType.DirectCreateNote; + } + [HttpPost("create-and-handle")] public async Task CreateAndHandleAsync(AssembleIssueRequestsEditInput input) { @@ -124,21 +150,6 @@ public class AssembleIssueRequestsAppService : SfsStoreRequestAppServiceBase - /// 根据类型 获取叫料申请 - /// - /// - /// - [HttpGet("list/by-type/{type}")] - public virtual async Task> GetListByTypeAsync(string type) - { - var entities = await _repository.GetListAsync(c => c.Type == type).ConfigureAwait(false); - - var dtos = ObjectMapper.Map, List>(entities); - - return dtos; - } - #region 导入 /// @@ -176,6 +187,7 @@ public class AssembleIssueRequestsAppService : SfsStoreRequestAppServiceBase ValidateImportEntities(Dictionary dict) @@ -219,36 +233,7 @@ public class AssembleIssueRequestsAppService : SfsStoreRequestAppServiceBase CheckItemBasicAsync(AssembleIssueRequestsImportInput importInput, - List 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 CheckLocationAsync(AssembleIssueRequestsImportInput importInput, - List 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(AssembleIssueRequestsImportInput importInput, + protected async Task CheckAreaAsync(AssembleRequestImportInput importInput, List validationRresult) { var area = await _areaApp.GetByCodeAsync(importInput.FromLocationArea).ConfigureAwait(false); @@ -270,33 +255,55 @@ public class AssembleIssueRequestsAppService : SfsStoreRequestAppServiceBase CheckItemBasicAsync(AssembleRequestImportInput importInput, + List 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 CheckLocationAsync(AssembleRequestImportInput importInput, + List validationRresult) + { + var location = await _locationAppService.GetByCodeAsync(importInput.ToLocationCode).ConfigureAwait(false); + if (location == null) + { + validationRresult.Add(new ValidationResult($"目标库位{importInput.ToLocationCode}不存在", new[] { "目标库位" })); + } + + return location; + } #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAppService.cs index eb0fd7ac0..8fe68a699 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestAppService.cs @@ -15,226 +15,107 @@ 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; 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; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; +using Win_in.Sfs.Wms.Store.Requests.MaterialRequests; -namespace Win_in.Sfs.Wms.Store.Requests.MaterialRequests.CoatingMaterialRequests; - - - +namespace Win_in.Sfs.Wms.Store.Application; +/// +/// 喷涂叫料 +/// [Authorize] -[Route($"{StoreConsts.RootPath}coatingmaterial-request")] +[Route($"{StoreConsts.RootPath}coating-request")] public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase, ICoatingMaterialRequestAppService { - private readonly ICoatingMaterialRequestManager _materialRequestManager; - - private readonly IPreparationPlanManager _preparationPlanManager; - + private readonly ICoatingMaterialRequestManager _coatingMaterialRequestManager; private readonly IItemStoreRelationAppService _itemStoreRelationApp; - private readonly IAreaAppService _areaApp; - private readonly ILocationAppService _locationAppService; - private readonly IItemBasicAppService _itemBasicAppService; - private readonly IProductionLineAppService _productionLineAppService; - private readonly IIssueJobAppService _issueJobAppService; + private readonly IProductionLineAppService _productionLineAppService; + private readonly ITransactionTypeAppService _transactionTypeAppService; + public CoatingMaterialRequestAppService( ICoatingMaterialRequestRepository repository, - ICoatingMaterialRequestManager CoatingMaterialRequestManager, + ICoatingMaterialRequestManager coatingMaterialRequestManager, IPreparationPlanManager preparationPlanManager, IItemStoreRelationAppService itemStoreRelationApp, IAreaAppService areaApp, ILocationAppService locationAppService, IItemBasicAppService itemBasicAppService, IProductionLineAppService productionLineAppService, - IIssueJobAppService issueJobAppService) - : base(repository, CoatingMaterialRequestManager) + ITransactionTypeAppService transactionTypeAppService + ) + : base(repository, coatingMaterialRequestManager) { - _materialRequestManager = CoatingMaterialRequestManager; - _preparationPlanManager = preparationPlanManager; + _coatingMaterialRequestManager = coatingMaterialRequestManager; _itemStoreRelationApp = itemStoreRelationApp; _areaApp = areaApp; _locationAppService = locationAppService; _itemBasicAppService = itemBasicAppService; - _productionLineAppService = productionLineAppService; - _issueJobAppService = issueJobAppService; + _productionLineAppService = productionLineAppService; + _transactionTypeAppService = transactionTypeAppService; } - #region 东阳使用 - - /// - /// 用来重写 导入数据时可以加工数据 - /// - /// - /// - protected override async Task> ImportProcessingEntityAsync( - Dictionary dictionary) - { - var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); - - foreach (var materialRequest in addList) - { - materialRequest.Worker = CurrentUser.GetUserName(); - materialRequest.CreatorId = CurrentUser.Id; - if (materialRequest.Type == EnumTransSubType.Issue_Manual.GetDisplayName()) - { - materialRequest.Type = EnumTransSubType.Issue_Manual.ToString(); - } - - foreach (var detail in materialRequest.Details) - { - var locationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); - CheckLocation(locationDto, detail.ToLocationCode); - var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - CheckItemBasic(itemBasicDto, detail.ItemCode); - - detail.ToLocationArea = locationDto.AreaCode; - detail.ToLocationErpCode = locationDto.ErpLocationCode; - 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; - } + #region 东阳V2 public override async Task HandleAsync(Guid id) { - var entity = await _repository.GetAsync(id).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new SfsHandledEntityEventData(entity), false).ConfigureAwait(false); - return ObjectMapper.Map(entity); - } - - #region 校验 - - private void CheckItemBasic(ItemBasicDTO ItemBasicDto, string itemCode) - { - if (ItemBasicDto == null) - { - throw new UserFriendlyException($"物品代码为【{itemCode}】不存在"); - } - } - - private void CheckLocation(LocationDTO LocationDto, string LocationCode) - { - if (LocationDto == null) - { - throw new UserFriendlyException($"库位代码为【{LocationCode}】不存在"); - } - - if (LocationDto.Type != EnumLocationType.WIP) - { - throw new UserFriendlyException($"库位代码【{LocationCode}】不是【{EnumLocationType.WIP.GetDisplayName()}】类型"); - } + await Task.CompletedTask.ConfigureAwait(false); + return null; } - - #endregion - - #endregion - [HttpPost("")] - //[Authorize(CoatingMaterialRequestPermissions.Create)] public override async Task CreateAsync(CoatingMaterialRequestEditInput input) { foreach (var item in input.Details) { if (item.Qty <= 0) { - throw new UserFriendlyException($"{item.ItemCode} 物料的需求量必须大于 0"); - } - } - - - foreach (var item in input.Details) //赋值生产线 - { - var location = await LocationAclService.GetByCodeAsync(item.ToLocationCode).ConfigureAwait(false); - item.ProdLine = location.LocationGroupCode; - - } - - var entity = ObjectMapper.Map(input); - - var result = await _materialRequestManager.CreateAsync(entity).ConfigureAwait(false); - - var dto = ObjectMapper.Map(result); - return dto; - } - - /// - /// 创建并且执行叫料请求 - /// - /// - /// - /// - [HttpPost("create-and-handle-api")] - //[Authorize(CoatingMaterialRequestPermissions.Create)] - public virtual async Task CreateAndHandleByAPIAsync(CoatingMaterialRequestEditInput input) - { - foreach (var item in input.Details) - { - if (item.Qty <= 0) - { - throw new UserFriendlyException($"{item.ItemCode} 物料的需求量必须大于 0"); + throw new UserFriendlyException($"{item.ItemCode} 物料的需求量必须大于0"); } } - - input.AutoSubmit = true; - input.AutoAgree = true; - input.AutoHandle = true; - input.AutoCompleteJob = false; - input.DirectCreateNote = false; - - foreach (var detailInput in input.Details) + foreach (var detailInput in input.Details) //赋值生产线 { - var toLocationDto = await _locationAppService.GetByCodeAsync(detailInput.ToLocationCode).ConfigureAwait(false); + 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.ItemDesc1 = itemBasicDto.Desc1; - - //var productionLineDto = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationDto.LocationGroupCode).ConfigureAwait(false); + detailInput.ToLocationArea = toLocationDto.AreaCode; + detailInput.ToLocationGroup = toLocationDto.LocationGroupCode; + detailInput.ToWarehouseCode = toLocationDto.WarehouseCode; + detailInput.ProdLine = detailInput.ToLocationCode; + detailInput.ToLocationErpCode = toLocationDto.ErpLocationCode; - //detailInput.ToLocationCode = toLocationDto.ErpLocationCode; - //if (productionLineDto != null) - //{ - // detailInput.ProdLine = productionLineDto.Code; - //} + detailInput.ItemDesc1 = itemBasicDto.Desc1; + detailInput.ItemDesc2 = itemBasicDto.Desc2; + detailInput.ItemName = itemBasicDto.Name; + detailInput.Uom = itemBasicDto.BasicUom; + detailInput.StdPackQty = itemBasicDto.StdPackQty; + detailInput.Status = EnumStatus.Open; + + //因为是刚创建的 所以发料数一定是0 + detailInput.IssuedQty = 0; } + await SetRequestAutoPropertiesAsync(input).ConfigureAwait(false); var entity = ObjectMapper.Map(input); - foreach (var detail in entity.Details) - { - var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); - //var productionLineDto = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationDto.LocationGroupCode).ConfigureAwait(false); - - detail.ToLocationArea = toLocationDto.AreaCode; - detail.ToLocationErpCode = toLocationDto.ErpLocationCode; - detail.ToLocationGroup = toLocationDto.LocationGroupCode; - detail.ToWarehouseCode = toLocationDto.WarehouseCode; - } - - entity.UseOnTheWayLocation = false; - var result = await _materialRequestManager.CreateBynNumberAsync(entity).ConfigureAwait(false); + var result = await _coatingMaterialRequestManager.CreateByNumberAsync(entity).ConfigureAwait(false); var dto = ObjectMapper.Map(result); @@ -242,98 +123,76 @@ public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase - /// 创建并且执行叫料请求 + /// 赋值Request业务属性 /// - /// + /// /// - /// - [HttpPost("create-and-handle")] - //[Authorize(CoatingMaterialRequestPermissions.Create)] - public virtual async Task CreateAndHandleAsync(CoatingMaterialRequestEditInput input) + private async Task SetRequestAutoPropertiesAsync(CoatingMaterialRequestEditInput entity) { - 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); - - var location = await LocationAclService.GetByCodeAsync(detailInput.ToLocationCode).ConfigureAwait(false); - detailInput.ProdLine = location.LocationGroupCode; - - input.Worker = input.Worker; - } + var tranType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false); + Check.NotNull(tranType, "事务类型", "事务类型不存在"); + entity.AutoSubmit = tranType.AutoSubmitRequest; + entity.AutoAgree = tranType.AutoAgreeRequest; + entity.AutoHandle = tranType.AutoHandleRequest; + entity.AutoCompleteJob = tranType.AutoCompleteJob; + entity.DirectCreateNote = tranType.DirectCreateNote; + } - input.AutoSubmit = true; - input.AutoAgree = true; - input.AutoHandle = true; - input.AutoCompleteJob = false; - input.DirectCreateNote = false; + [HttpPost("create-and-handle")] + public async Task CreateAndHandleAsync(CoatingMaterialRequestEditInput input) + { + var coatingMaterialRequestDto = await CreateAsync(input).ConfigureAwait(false); - var entity = ObjectMapper.Map(input); + await HandleAsync(coatingMaterialRequestDto.Id).ConfigureAwait(false); - var result = await _materialRequestManager.CreateAsync(entity).ConfigureAwait(false); + return coatingMaterialRequestDto; + } - var dto = ObjectMapper.Map(result); + #endregion - return dto; - } + #region 导入 - /// - /// 根据类型获取叫料请求 + /// 用来重写 导入数据时可以加工数据 /// - /// - /// - /// 叫料请求类型: - /// 人工拉动:Issue_Manual; - /// 线边拉动:Issue_WIP; - /// - /// - /// + /// /// - [HttpPost("by-type/{type}")] - public virtual async Task> GetListByTypeAsync( - SfsStoreRequestInputBase requestInput, - string type, - bool includeDetails = false, - CancellationToken cancellationToken = default) + protected override async Task> ImportProcessingEntityAsync( + Dictionary dictionary) { - Expression> expression = p => p.Type == type; - if (requestInput.Condition.Filters?.Count > 0) - { - expression = expression.And(requestInput.Condition.Filters.ToLambda()); - } + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); - return await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount, - requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false); - } + foreach (var coatingMaterialRequest in addList) + { + coatingMaterialRequest.Worker = CurrentUser.GetUserName(); + coatingMaterialRequest.CreatorId = CurrentUser.Id; + if (coatingMaterialRequest.Type == EnumTransSubType.Issue_Manual.GetDisplayName()) + { + coatingMaterialRequest.Type = EnumTransSubType.Issue_Manual.ToString(); + } - #region 导入 + foreach (var detail in coatingMaterialRequest.Details) + { + var locationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + CheckLocation(locationDto, detail.ToLocationCode); - //protected override async Task CheckImportInputBusinessAsync(CoatingMaterialRequestImportInput importInput, EnumImportMethod importMethod) - //{ - // //await base.CheckImportInputBusinessAsync(importInput, importMethod); + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + CheckItemBasic(itemBasicDto, detail.ItemCode); - // var item = await CheckItemBasicAsync(importInput); - // await CheckItemPackAsync(importInput); - // var location = await CheckLocationAsync(importInput); - // await CheckAreaAsync(importInput); - // await CheckStoreRelationAsync(importInput); - // var transactionType = await CheckTransactionTypeAsync(); + 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; + detail.StdPackQty = itemBasicDto.StdPackQty; + } + } - // CheckTransactionType(EnumTransInOut.In, EnumInventoryStatus.OK, transactionType, item, location); - //} + return dictionary; + } /// /// 导入验证 @@ -351,6 +210,8 @@ public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase ValidateImportEntities(Dictionary dict) @@ -372,6 +233,49 @@ public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase validationRresult) + { + var area = await _areaApp.GetByCodeAsync(importInput.FromLocationArea).ConfigureAwait(false); + if (area == null) + { + validationRresult.Add(new ValidationResult($"调出库区{importInput.FromLocationArea}不存在", new[] { "调出库区" })); + } + } + + protected async Task CheckStoreRelationAsync(CoatingMaterialRequestImportInput importInput, + List validationRresult) + { + var itemStoreRelation = await _itemStoreRelationApp + .GetFirstAsync(importInput.ItemCode, importInput.ToLocationCode).ConfigureAwait(false); + if (itemStoreRelation == null) + { + validationRresult.Add(new ValidationResult( + $"物品代码{importInput.ItemCode}与目标库位{importInput.ToLocationCode}不存在对应关", new[] { "物品库位对应关系" })); + } + } + + 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()}】类型"); + } + } + protected async Task CheckItemBasicAsync(CoatingMaterialRequestImportInput importInput, List validationRresult) { @@ -401,44 +305,5 @@ public class CoatingMaterialRequestAppService : SfsStoreRequestAppServiceBase validationRresult) - { - var area = await _areaApp.GetByCodeAsync(importInput.FromLocationArea).ConfigureAwait(false); - if (area == null) - { - validationRresult.Add(new ValidationResult($"调出库区{importInput.FromLocationArea}不存在", new[] { "调出库区" })); - } - } - - protected async Task CheckStoreRelationAsync(CoatingMaterialRequestImportInput importInput, - List 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 - - /// - /// 根据类型 获取叫料申请 - /// - /// - /// - [HttpGet("list/by-type/{type}")] - public virtual async Task> GetListByTypeAsync(string type) - { - var entities = await _repository.GetListAsync(c => c.Type == type).ConfigureAwait(false); - - var dtos = ObjectMapper.Map, List>(entities); - - return dtos; - } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs index cbd5ae7b0..326324c3a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/InjectionRequests/InjectionRequestAppService.cs @@ -26,7 +26,9 @@ using Win_in.Sfs.Wms.Store.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application; -//注塑叫料 +/// +/// 注塑叫料 +/// [Authorize] [Route($"{StoreConsts.RootPath}injection-request")] public class InjectionRequestAppService : SfsStoreRequestAppServiceBase /// 要货单号 /// [IgnoreUpdate] - public string AssembleIssueRequestsNumber { get; set; } - - /// - /// 车间 - /// - [IgnoreUpdate] - public string Workshop { get; set; } + public string AssembleRequestNumber { get; set; } /// /// 使用在途库 @@ -48,37 +42,6 @@ public class AssembleJob : SfsJobAggregateRootBase /// [IgnoreUpdate] public override List Details { get; set; } = new List(); - - /// - /// 设置任务明细的实际库位和实际数量 - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - 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); - } + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/AssembleJobs/AssembleJobDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/AssembleJobs/AssembleJobDetail.cs index 02d48d84f..bba4a3543 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/AssembleJobs/AssembleJobDetail.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/AssembleJobs/AssembleJobDetail.cs @@ -1,40 +1,81 @@ using System; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Domain; -public class AssembleJobDetail : SfsJobRecommendFromDetailEntityBase, IHasToLocation +public class AssembleJobDetail : SfsDetailEntityBase { + + #region 库存基础信息 + /// - /// 请求库位 + /// 物品代码 /// - public string RequestLocationCode { get; set; } + public string ItemCode { get; set; } + + /// + /// 物品名称 + /// + public string ItemName { get; set; } + + /// + /// 物品描述1 + /// + public string ItemDesc1 { get; set; } + + /// + /// 物品描述2 + /// + public string ItemDesc2 { get; set; } + + /// + /// 标包数量 + /// + [Display(Name = "标包数量")] + [Column(TypeName = "decimal(18,6)")] + public decimal StdPackQty { get; set; } /// - /// 到库位 + /// 库存状态 /// - public string ToLocationCode { get; set; } + public EnumInventoryStatus Status { get; set; } + + /// + /// 计量单位 + /// + public string Uom { get; set; } + + #endregion + + #region 请求信息 + + /// + /// 请求库位 + /// + public string RequestLocationCode { get; set; } /// /// 到库区 /// - public string ToLocationArea { get; set; } + public string RequestLocationArea { get; set; } /// /// 到库位组 /// - public string ToLocationGroup { get; set; } + public string RequestLocationGroup { get; set; } /// /// 到ERP库位 /// - public string ToLocationErpCode { get; set; } + public string RequestLocationErpCode { get; set; } /// /// 到仓库 /// - public string ToWarehouseCode { get; set; } + public string RequestWarehouseCode { get; set; } /// /// 在途库库位 @@ -47,59 +88,435 @@ public class AssembleJobDetail : SfsJobRecommendFromDetailEntityBase, IHasToLoca public string ProdLine { get; set; } /// - /// 工作中心 + /// 位置码 /// - public string WorkStation { get; set; } + public string PositionCode { get; set; } /// - /// 过期时间 + /// 推荐的类型 /// - public DateTime ExpiredTime { get; set; } + public EnumRecommendType RecommendType { get; set; } /// - /// 工序 + /// 需求数量 /// - public string Operation { get; set; } + public decimal RequestQty { get; set; } + + #endregion + + #region 推荐来源 /// - /// 配送方式 + /// 推荐来源托标签 /// - public EnumDistributionType DistributionType { get; set; } + public string RecommendFromContainerCode { get; set; } /// - /// 取整方式 + /// 推荐来源箱标签 /// - public EnumTruncType TruncType { get; set; } + public string RecommendFromPackingCode { get; set; } /// - /// 取整后数量 + /// 推荐来源批次供应商批次 /// - public decimal RoundedQty { get; set; } + public string RecommendFromSupplierBatch { get; set; } /// - /// 计划拆分规则 + /// 推荐来源批次到货时间 /// - public EnumPlannedSplitRule PlannedSplitRule { get; set; } + public DateTime RecommendFromArriveDate { get; set; } /// - /// 计划开始时间 + /// 推荐来源批次生产时间 /// - public DateTime PlanBeginTime { get; set; } + public DateTime RecommendFromProduceDate { get; set; } /// - /// 每次配送数量 + /// 推荐来源批次过期时间 /// - public decimal DeliveryQty { get; set; } + public DateTime RecommendFromExpireDate { get; set; } /// - /// 位置码 + /// 推荐来源批次排序 /// - public string PositionCode { get; set; } + public string RecommendFromLot { get; set; } /// - /// 推荐类型 + /// 推荐来源库位 /// - public EnumRecommendType RecommendType { get; set; } + public string RecommendFromLocationCode { get; set; } + + /// + /// 推荐来源库区 + /// + public string RecommendFromLocationArea { get; set; } + + /// + /// 推荐来源库位组 + /// + public string RecommendFromLocationGroup { get; set; } + + /// + /// 推荐来源ERP库位 + /// + public string RecommendFromLocationErpCode { get; set; } + + /// + /// 推荐来源仓库 + /// + public string RecommendFromWarehouseCode { get; set; } + + /// + /// 推荐来源数量 + /// + public decimal RecommendFromQty { get; set; } + + #endregion + + #region 推荐目标 + + /// + /// 推荐目标托标签 + /// + public string RecommendToContainerCode { get; set; } + + /// + /// 推荐目标箱标签 + /// + public string RecommendToPackingCode { get; set; } + + /// + /// 推荐目标批次供应商批次 + /// + public string RecommendToSupplierBatch { get; set; } + + /// + /// 推荐目标批次到货时间 + /// + public DateTime RecommendToArriveDate { get; set; } + + /// + /// 推荐目标批次生产时间 + /// + public DateTime RecommendToProduceDate { get; set; } + + /// + /// 推荐目标批次过期时间 + /// + public DateTime RecommendToExpireDate { get; set; } + + /// + /// 推荐目标批次排序 + /// + public string RecommendToLot { get; set; } + + /// + /// 推荐目标库位 + /// + public string RecommendToLocationCode { get; set; } + + /// + /// 推荐目标库区 + /// + public string RecommendToLocationArea { get; set; } + + /// + /// 推荐目标库位组 + /// + public string RecommendToLocationGroup { get; set; } + + /// + /// 推荐目标ERP库位 + /// + public string RecommendToLocationErpCode { get; set; } + + /// + /// 推荐目标仓库 + /// + public string RecommendToWarehouseCode { get; set; } + + /// + /// 推荐目标数量 + /// + public decimal RecommendToQty { get; set; } + + #endregion + + #region 库移来源 + + /// + /// 库移来源托标签 + /// + public string TransferLibFromContainerCode { get; set; } + + /// + /// 库移来源箱标签 + /// + public string TransferLibFromPackingCode { get; set; } + + /// + /// 库移来源批次供应商批次 + /// + public string TransferLibFromSupplierBatch { get; set; } + + /// + /// 库移来源批次到货时间 + /// + public DateTime TransferLibFromArriveDate { get; set; } + + /// + /// 库移来源批次生产时间 + /// + public DateTime TransferLibFromProduceDate { get; set; } + + /// + /// 库移来源批次过期时间 + /// + public DateTime TransferLibFromExpireDate { get; set; } + + /// + /// 库移来源批次排序 + /// + public string TransferLibFromLot { get; set; } + + /// + /// 库移来源库位 + /// + public string TransferLibFromLocationCode { get; set; } + + /// + /// 库移来源库区 + /// + public string TransferLibFromLocationArea { get; set; } + + /// + /// 库移来源库位组 + /// + public string TransferLibFromLocationGroup { get; set; } + + /// + /// 库移来源ERP库位 + /// + public string TransferLibFromLocationErpCode { get; set; } + + /// + /// 库移来源仓库 + /// + public string TransferLibFromWarehouseCode { get; set; } + + /// + /// 库移来源数量 + /// + public decimal TransferLibFromQty { get; set; } + + #endregion + + #region 库移目标 + + /// + /// 库移目标托标签 + /// + public string TransferLibToContainerCode { get; set; } + + /// + /// 库移目标箱标签 + /// + public string TransferLibToPackingCode { get; set; } + + /// + /// 库移目标批次供应商批次 + /// + public string TransferLibToSupplierBatch { get; set; } + + /// + /// 库移目标批次到货时间 + /// + public DateTime TransferLibToArriveDate { get; set; } + + /// + /// 库移目标批次生产时间 + /// + public DateTime TransferLibToProduceDate { get; set; } + + /// + /// 库移目标批次过期时间 + /// + public DateTime TransferLibToExpireDate { get; set; } + + /// + /// 库移目标批次排序 + /// + public string TransferLibToLot { get; set; } + + /// + /// 库移目标库位 + /// + public string TransferLibToLocationCode { get; set; } + + /// + /// 库移目标库区 + /// + public string TransferLibToLocationArea { get; set; } + + /// + /// 库移目标库位组 + /// + public string TransferLibToLocationGroup { get; set; } + + /// + /// 库移目标ERP库位 + /// + public string TransferLibToLocationErpCode { get; set; } + + /// + /// 库移目标仓库 + /// + public string TransferLibToWarehouseCode { get; set; } + + /// + /// 库移目标数量 + /// + public decimal TransferLibToQty { get; set; } + + #endregion + + #region 实际来源 + + /// + /// 实际目标托标签 + /// + public string HandledFromContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledFromPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledFromSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledFromArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledFromProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledFromExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledFromLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledFromLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledFromLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledFromLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledFromLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledFromWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledFromQty { get; set; } + + #endregion + + #region 实际目标 + + /// + /// 实际目标托标签 + /// + public string HandledToContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledToPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledToSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledToArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledToProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledToExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledToLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledToLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledToLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledToLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledToLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledToWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledToQty { get; set; } + + #endregion public void SetId(Guid id) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/AssembleJobs/AssembleJobManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/AssembleJobs/AssembleJobManager.cs index cd421f475..6ece2c54a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/AssembleJobs/AssembleJobManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/AssembleJobs/AssembleJobManager.cs @@ -4,19 +4,24 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Linq.Expressions; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.Users; using Volo.Abp.Validation; using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; namespace Win_in.Sfs.Wms.Store.Domain; public class AssembleJobManager : SfsJobManagerBase, IAssembleJobManager { + private readonly IBalanceAppService _balanceAppService; + private readonly IExpectOutAppService _expectOutAppService; public AssembleJobManager( - IAssembleJobRepository repository - ) : base(repository) + IAssembleJobRepository repository, IBalanceAppService balanceAppService, IExpectOutAppService expectOutAppService) : base(repository) { + _balanceAppService = balanceAppService; + _expectOutAppService = expectOutAppService; } /// @@ -30,53 +35,88 @@ public class AssembleJobManager : SfsJobManagerBase GetAsync(Expression> expression) { - var details = entity.Details; - foreach (var detail in details) - { - if (detail.HandledFromLocationCode == null) - { - result.Errors.Add(new ValidationResult($"{detail.HandledFromLocationCode} 不能为空")); - } - - } + return await Repository.FindAsync(expression).ConfigureAwait(false); } - public override async Task> 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); + #region 无用 + public override Task> GetWorkingListByPackingAsync(string packingCode) + { + throw new NotImplementedException(); } - public override async Task> GetWorkingListByContainerAsync(string containerCode) + public override Task> 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); - + throw new NotImplementedException(); } - - public async Task GetAsync(Expression> expression) + + public override void CheckDetails(AssembleJob entity, AbpValidationResult result) { - return await Repository.FindAsync(expression).ConfigureAwait(false); + throw new NotImplementedException(); } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJob.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJob.cs index 38ff594ed..9acd01250 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJob.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJob.cs @@ -8,9 +8,9 @@ using Win_in.Sfs.Wms.Store.Domain; namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs; /// -/// 发料任务 +/// 涂装发料任务 /// -[Display(Name = "发料任务")] +[Display(Name = "涂装发料任务")] public class CoatingIssueJob : SfsJobAggregateRootBase { /// @@ -29,13 +29,7 @@ public class CoatingIssueJob : SfsJobAggregateRootBase /// 要货单号 /// [IgnoreUpdate] - public string MaterialRequestNumber { get; set; } - - /// - /// 车间 - /// - [IgnoreUpdate] - public string Workshop { get; set; } + public string MaterialRequestNumber { get; set; } /// /// 使用在途库 @@ -48,38 +42,6 @@ public class CoatingIssueJob : SfsJobAggregateRootBase /// 任务明细 /// [IgnoreUpdate] - public override List Details { get; set; } = new List(); - - /// - /// 设置任务明细的实际库位和实际数量 - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - 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); - } + public override List Details { get; set; } = new List(); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDetail.cs index 4b2c9c832..63e971b43 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDetail.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobDetail.cs @@ -1,41 +1,81 @@ using System; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; -using Win_in.Sfs.Wms.Store.Domain; -namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs; +namespace Win_in.Sfs.Wms.Store.Domain; -public class CoatingIssueJobDetail : SfsJobRecommendFromDetailEntityBase, IHasToLocation +public class CoatingIssueJobDetail : SfsDetailEntityBase { + + #region 库存基础信息 + /// - /// 请求库位 + /// 物品代码 /// - public string RequestLocationCode { get; set; } + public string ItemCode { get; set; } + + /// + /// 物品名称 + /// + public string ItemName { get; set; } + + /// + /// 物品描述1 + /// + public string ItemDesc1 { get; set; } + + /// + /// 物品描述2 + /// + public string ItemDesc2 { get; set; } + + /// + /// 标包数量 + /// + [Display(Name = "标包数量")] + [Column(TypeName = "decimal(18,6)")] + public decimal StdPackQty { get; set; } /// - /// 到库位 + /// 库存状态 /// - public string ToLocationCode { get; set; } + public EnumInventoryStatus Status { get; set; } + + /// + /// 计量单位 + /// + public string Uom { get; set; } + + #endregion + + #region 请求信息 + + /// + /// 请求库位 + /// + public string RequestLocationCode { get; set; } /// /// 到库区 /// - public string ToLocationArea { get; set; } + public string RequestLocationArea { get; set; } /// /// 到库位组 /// - public string ToLocationGroup { get; set; } + public string RequestLocationGroup { get; set; } /// /// 到ERP库位 /// - public string ToLocationErpCode { get; set; } + public string RequestLocationErpCode { get; set; } /// /// 到仓库 /// - public string ToWarehouseCode { get; set; } + public string RequestWarehouseCode { get; set; } /// /// 在途库库位 @@ -48,62 +88,438 @@ public class CoatingIssueJobDetail : SfsJobRecommendFromDetailEntityBase, IHasTo public string ProdLine { get; set; } /// - /// 工作中心 + /// 位置码 /// - public string WorkStation { get; set; } + public string PositionCode { get; set; } /// - /// 过期时间 + /// 推荐的类型 /// - public DateTime ExpiredTime { get; set; } + public EnumRecommendType RecommendType { get; set; } /// - /// 工序 + /// 需求数量 /// - public string Operation { get; set; } + public decimal RequestQty { get; set; } + + #endregion + + #region 推荐来源 /// - /// 配送方式 + /// 推荐来源托标签 /// - public EnumDistributionType DistributionType { get; set; } + public string RecommendFromContainerCode { get; set; } /// - /// 取整方式 + /// 推荐来源箱标签 /// - public EnumTruncType TruncType { get; set; } + public string RecommendFromPackingCode { get; set; } /// - /// 取整后数量 + /// 推荐来源批次供应商批次 /// - public decimal RoundedQty { get; set; } + public string RecommendFromSupplierBatch { get; set; } /// - /// 计划拆分规则 + /// 推荐来源批次到货时间 /// - public EnumPlannedSplitRule PlannedSplitRule { get; set; } + public DateTime RecommendFromArriveDate { get; set; } /// - /// 计划开始时间 + /// 推荐来源批次生产时间 /// - public DateTime PlanBeginTime { get; set; } + public DateTime RecommendFromProduceDate { get; set; } /// - /// 每次配送数量 + /// 推荐来源批次过期时间 /// - public decimal DeliveryQty { get; set; } + public DateTime RecommendFromExpireDate { get; set; } /// - /// 位置码 + /// 推荐来源批次排序 /// - public string PositionCode { get; set; } + public string RecommendFromLot { get; set; } /// - /// 推荐类型 + /// 推荐来源库位 /// - public EnumRecommendType RecommendType { get; set; } + public string RecommendFromLocationCode { get; set; } + + /// + /// 推荐来源库区 + /// + public string RecommendFromLocationArea { get; set; } + + /// + /// 推荐来源库位组 + /// + public string RecommendFromLocationGroup { get; set; } + + /// + /// 推荐来源ERP库位 + /// + public string RecommendFromLocationErpCode { get; set; } + + /// + /// 推荐来源仓库 + /// + public string RecommendFromWarehouseCode { get; set; } + + /// + /// 推荐来源数量 + /// + public decimal RecommendFromQty { get; set; } + + #endregion + + #region 推荐目标 + + /// + /// 推荐目标托标签 + /// + public string RecommendToContainerCode { get; set; } + + /// + /// 推荐目标箱标签 + /// + public string RecommendToPackingCode { get; set; } + + /// + /// 推荐目标批次供应商批次 + /// + public string RecommendToSupplierBatch { get; set; } + + /// + /// 推荐目标批次到货时间 + /// + public DateTime RecommendToArriveDate { get; set; } + + /// + /// 推荐目标批次生产时间 + /// + public DateTime RecommendToProduceDate { get; set; } + + /// + /// 推荐目标批次过期时间 + /// + public DateTime RecommendToExpireDate { get; set; } + + /// + /// 推荐目标批次排序 + /// + public string RecommendToLot { get; set; } + + /// + /// 推荐目标库位 + /// + public string RecommendToLocationCode { get; set; } + + /// + /// 推荐目标库区 + /// + public string RecommendToLocationArea { get; set; } + + /// + /// 推荐目标库位组 + /// + public string RecommendToLocationGroup { get; set; } + + /// + /// 推荐目标ERP库位 + /// + public string RecommendToLocationErpCode { get; set; } + + /// + /// 推荐目标仓库 + /// + public string RecommendToWarehouseCode { get; set; } + + /// + /// 推荐目标数量 + /// + public decimal RecommendToQty { get; set; } + + #endregion + + #region 库移来源 + + /// + /// 库移来源托标签 + /// + public string TransferLibFromContainerCode { get; set; } + + /// + /// 库移来源箱标签 + /// + public string TransferLibFromPackingCode { get; set; } + + /// + /// 库移来源批次供应商批次 + /// + public string TransferLibFromSupplierBatch { get; set; } + + /// + /// 库移来源批次到货时间 + /// + public DateTime TransferLibFromArriveDate { get; set; } + + /// + /// 库移来源批次生产时间 + /// + public DateTime TransferLibFromProduceDate { get; set; } + + /// + /// 库移来源批次过期时间 + /// + public DateTime TransferLibFromExpireDate { get; set; } + + /// + /// 库移来源批次排序 + /// + public string TransferLibFromLot { get; set; } + + /// + /// 库移来源库位 + /// + public string TransferLibFromLocationCode { get; set; } + + /// + /// 库移来源库区 + /// + public string TransferLibFromLocationArea { get; set; } + + /// + /// 库移来源库位组 + /// + public string TransferLibFromLocationGroup { get; set; } + + /// + /// 库移来源ERP库位 + /// + public string TransferLibFromLocationErpCode { get; set; } + + /// + /// 库移来源仓库 + /// + public string TransferLibFromWarehouseCode { get; set; } + + /// + /// 库移来源数量 + /// + public decimal TransferLibFromQty { get; set; } + + #endregion + + #region 库移目标 + + /// + /// 库移目标托标签 + /// + public string TransferLibToContainerCode { get; set; } + + /// + /// 库移目标箱标签 + /// + public string TransferLibToPackingCode { get; set; } + + /// + /// 库移目标批次供应商批次 + /// + public string TransferLibToSupplierBatch { get; set; } + + /// + /// 库移目标批次到货时间 + /// + public DateTime TransferLibToArriveDate { get; set; } + + /// + /// 库移目标批次生产时间 + /// + public DateTime TransferLibToProduceDate { get; set; } + + /// + /// 库移目标批次过期时间 + /// + public DateTime TransferLibToExpireDate { get; set; } + + /// + /// 库移目标批次排序 + /// + public string TransferLibToLot { get; set; } + + /// + /// 库移目标库位 + /// + public string TransferLibToLocationCode { get; set; } + + /// + /// 库移目标库区 + /// + public string TransferLibToLocationArea { get; set; } + + /// + /// 库移目标库位组 + /// + public string TransferLibToLocationGroup { get; set; } + + /// + /// 库移目标ERP库位 + /// + public string TransferLibToLocationErpCode { get; set; } + + /// + /// 库移目标仓库 + /// + public string TransferLibToWarehouseCode { get; set; } + + /// + /// 库移目标数量 + /// + public decimal TransferLibToQty { get; set; } + + #endregion + + #region 实际来源 + + /// + /// 实际目标托标签 + /// + public string HandledFromContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledFromPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledFromSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledFromArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledFromProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledFromExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledFromLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledFromLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledFromLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledFromLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledFromLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledFromWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledFromQty { get; set; } + + #endregion + + #region 实际目标 + + /// + /// 实际目标托标签 + /// + public string HandledToContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledToPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledToSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledToArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledToProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledToExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledToLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledToLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledToLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledToLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledToLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledToWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledToQty { get; set; } + + #endregion public void SetId(Guid id) { - Id = id; + this.Id = id; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobManager.cs index 2e3f2e681..06c89aa07 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobManager.cs @@ -4,20 +4,28 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Linq.Expressions; using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Domain.Repositories; using Volo.Abp.Users; using Volo.Abp.Validation; using Win_in.Sfs.Shared.Domain.Shared; -using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; +using Win_in.Sfs.Wms.Store.Jobs.IssueJobs; -namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs; +namespace Win_in.Sfs.Wms.Store.Domain; public class CoatingIssueJobManager : SfsJobManagerBase, ICoatingIssueJobManager { + private readonly IBalanceAppService _balanceAppService; + private readonly IExpectOutAppService _expectOutAppService; + private readonly ICoatingIssueJobRepository _repository; public CoatingIssueJobManager( - ICoatingIssueJobRepository repository - ) : base(repository) + ICoatingIssueJobRepository repository, IBalanceAppService balanceAppService, IExpectOutAppService expectOutAppService) : base(repository) { + _balanceAppService = balanceAppService; + _expectOutAppService = expectOutAppService; + _repository= repository; } /// @@ -29,76 +37,91 @@ public class CoatingIssueJobManager : SfsJobManagerBase public override async Task CompleteAsync(CoatingIssueJob input, ICurrentUser user) { - var entity = await Repository.FindAsync(input.Id).ConfigureAwait(false); + //var entity = await Repository.FindAsync(input.Id).ConfigureAwait(false); + var entity = await _repository.FirstOrDefaultAsync(p=>p.Id == input.Id).ConfigureAwait(false); - foreach (var detail in input.Details) + var inputDetail = input.Details.First(); + var detail = entity.Details.First(); + + var expectOutDtos = await _expectOutAppService.GetListByItemCodeAndStatusAndPackingCodeAsync(detail.ItemCode, detail.HandledFromLocationCode, detail.HandledFromPackingCode, detail.Status, detail.HandledFromLot).ConfigureAwait(false); + if (expectOutDtos.Any()) { - //发料子任务 赋值实际转移 - 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); + throw new UserFriendlyException($" 箱码:{detail.HandledFromPackingCode}," + + $" 物品代码:{detail.ItemCode}," + + $" 库位代码:{detail.HandledFromLocationCode}," + + $" 状态:{detail.Status}," + + $" 批次:{detail.HandledFromLot}" + + $" 的库存被占用【预计出】"); } - return await base.CompleteAsync(entity, user).ConfigureAwait(false); - } - - public override void CheckDetails(CoatingIssueJob entity, AbpValidationResult result) - { - var details = entity.Details; - foreach (var detail in details) + //var balanceDto = await _balanceAppService.GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(detail.HandledFromPackingCode, detail.ItemCode, detail.HandledFromLocationCode, detail.Status, detail.HandledFromLot).ConfigureAwait(false); + var balanceDto = await _balanceAppService.GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(inputDetail.HandledFromPackingCode, inputDetail.ItemCode, inputDetail.HandledFromLocationCode, inputDetail.Status, inputDetail.HandledFromLot).ConfigureAwait(false); + if (balanceDto.Qty <= 0) { - if (detail.HandledFromLocationCode == null) - { - result.Errors.Add(new ValidationResult($"{detail.HandledFromLocationCode} 不能为空")); - } - + throw new UserFriendlyException($" 箱码:{detail.HandledFromPackingCode}," + + $" 物品代码:{detail.ItemCode}," + + $" 库位代码:{detail.HandledFromLocationCode}," + + $" 状态:{detail.Status}," + + $" 批次:{detail.HandledFromLot}" + + $" 的可用库存不大于0,现在为{balanceDto.Qty},请检查【库存数量】和【预计出】"); } - } - public override async Task> 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); + detail.HandledFromArriveDate = inputDetail.HandledFromArriveDate; + detail.HandledFromContainerCode = inputDetail.HandledFromContainerCode; + detail.HandledFromExpireDate = inputDetail.HandledFromExpireDate; + detail.HandledFromLocationArea = inputDetail.HandledFromLocationArea; + detail.HandledFromLocationCode = inputDetail.HandledFromLocationCode; + detail.HandledFromLocationErpCode = inputDetail.HandledFromLocationErpCode; + detail.HandledFromLocationGroup = inputDetail.HandledFromLocationGroup; + detail.HandledFromLot = inputDetail.HandledFromLot; + detail.HandledFromPackingCode = inputDetail.HandledFromPackingCode; + detail.HandledFromProduceDate = inputDetail.HandledFromProduceDate; + detail.HandledFromQty = inputDetail.HandledFromQty; + detail.HandledFromSupplierBatch = inputDetail.HandledFromSupplierBatch; + detail.HandledFromWarehouseCode = inputDetail.HandledFromWarehouseCode; + + detail.HandledToArriveDate = inputDetail.HandledToArriveDate; + detail.HandledToContainerCode = inputDetail.HandledToContainerCode; + detail.HandledToExpireDate = inputDetail.HandledToExpireDate; + detail.HandledToLocationArea = inputDetail.HandledToLocationArea; + detail.HandledToLocationCode = inputDetail.HandledToLocationCode; + detail.HandledToLocationErpCode = inputDetail.HandledToLocationErpCode; + detail.HandledToLocationGroup = inputDetail.HandledToLocationGroup; + detail.HandledToLot = inputDetail.HandledToLot; + detail.HandledToPackingCode = inputDetail.HandledToPackingCode; + detail.HandledToProduceDate = inputDetail.HandledToProduceDate; + detail.HandledToQty = inputDetail.HandledToQty; + detail.HandledToSupplierBatch = inputDetail.HandledToSupplierBatch; + detail.HandledToWarehouseCode = inputDetail.HandledToWarehouseCode; + + detail.HandledToPackingCode = string.Empty; + detail.HandledToLot = string.Empty; + detail.HandledToContainerCode = string.Empty; + return await base.CompleteAsync(entity, user).ConfigureAwait(false); } - public override async Task> GetWorkingListByContainerAsync(string containerCode) + public async Task GetAsync(Expression> expression) { - return await Repository.GetListAsync(c => c.Details.Any(p => p.RecommendContainerCode == containerCode) && c.JobStatus != EnumJobStatus.Closed && c.JobStatus != EnumJobStatus.Cancelled, true).ConfigureAwait(false); - + return await Repository.FindAsync(expression).ConfigureAwait(false); } - ///// - ///// 临时修改 解决补料无法拿到订阅错误 - ///// - ///// - ///// - //public virtual async Task> AddByEtoAsync(MaterialRequestHandledETO eventData) - //{ - // var CoatingIssueJobs = await BuildCoatingIssueJobByMaterialRequestAsync(eventData); - - // await Repository.InsertManyAsync(CoatingIssueJobs); + #region 无用 - // var expectIns = await BuildExpectInAsync(CoatingIssueJobs); - // await _expectInAppService.AddManyAndCalculationAvailableCapacityAsync(expectIns); + public override Task> GetWorkingListByPackingAsync(string packingCode) + { + throw new NotImplementedException(); + } - // return CoatingIssueJobs; - //} + public override Task> GetWorkingListByContainerAsync(string containerCode) + { + throw new NotImplementedException(); + } - //public virtual async Task TestError() - //{ - // throw new UserFriendlyException("我是测试的异常"); - //} - public async Task GetAsync(Expression> expression) + public override void CheckDetails(CoatingIssueJob entity, AbpValidationResult result) { - return await Repository.FindAsync(expression).ConfigureAwait(false); + throw new NotImplementedException(); } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/IIssueJobRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/IIssueJobRepository.cs index f507ca852..aeeac0878 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/IIssueJobRepository.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/IIssueJobRepository.cs @@ -1,6 +1,6 @@ namespace Win_in.Sfs.Wms.Store.Domain; -public interface IInjectionJobRepository : ISfsJobRepositoryBase +public interface IIssueJobRepository : ISfsJobRepositoryBase { } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionJobs/IInjectionJobRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionJobs/IInjectionJobRepository.cs index aeeac0878..f507ca852 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionJobs/IInjectionJobRepository.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionJobs/IInjectionJobRepository.cs @@ -1,6 +1,6 @@ namespace Win_in.Sfs.Wms.Store.Domain; -public interface IIssueJobRepository : ISfsJobRepositoryBase +public interface IInjectionJobRepository : ISfsJobRepositoryBase { } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionJobs/InjectionJobManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionJobs/InjectionJobManager.cs index 8d953c3a6..8c7956654 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionJobs/InjectionJobManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionJobs/InjectionJobManager.cs @@ -49,7 +49,7 @@ public class InjectionJobManager : SfsJobManagerBase, IHasJ [IgnoreUpdate] public string JobNumber { get; set; } - /// - /// 车间 - /// - [IgnoreUpdate] - public string Workshop { get; set; } - /// /// 明细列表 /// @@ -73,5 +67,4 @@ public class AssembleNote : SfsStoreAggregateRootBase, IHasJ } } - } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/AssembleNotes/AssembleNoteDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/AssembleNotes/AssembleNoteDetail.cs index ee2f8a389..79c0d9b2b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/AssembleNotes/AssembleNoteDetail.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/AssembleNotes/AssembleNoteDetail.cs @@ -1,43 +1,519 @@ 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.Domain; -public class AssembleNoteDetail : SfsStoreRecommendFromDetailWithFromToEntityBase +public class AssembleNoteDetail : SfsStoreDetailEntityBase { + #region 库存基础信息 /// - /// 发料时间 + /// 物品代码 /// - public DateTime IssueTime { get; set; } + public string ItemCode { get; set; } /// - /// 过期时间 + /// 物品名称 /// - public DateTime ExpiredTime { get; set; } + public string ItemName { get; set; } /// - /// 生产线 + /// 物品描述1 /// - public string ProdLine { get; set; } + public string ItemDesc1 { get; set; } + + /// + /// 物品描述2 + /// + public string ItemDesc2 { get; set; } + + /// + /// 标包数量 + /// + [Display(Name = "标包数量")] + [Column(TypeName = "decimal(18,6)")] + public decimal StdPackQty { get; set; } + + /// + /// 库存状态 + /// + public EnumInventoryStatus Status { get; set; } + + /// + /// 计量单位 + /// + public string Uom { get; set; } + + #endregion + + #region 请求信息 + + /// + /// 请求库位 + /// + public string RequestLocationCode { get; set; } /// - /// 工作中心 + /// 到库区 /// - public string WorkStation { get; set; } + public string RequestLocationArea { get; set; } /// - /// 在途库库位 + /// 到库位组 + /// + public string RequestLocationGroup { get; set; } + + /// + /// 到ERP库位 + /// + public string RequestLocationErpCode { get; set; } + + /// + /// 到仓库 + /// + public string RequestWarehouseCode { get; set; } + + /// + /// 在途库库位 /// public string OnTheWayLocationCode { get; set; } /// - /// 位置码 + /// 生产线 + /// + public string ProdLine { get; set; } + + /// + /// 位置码 /// public string PositionCode { get; set; } /// - /// 推荐类型 + /// 推荐的类型 /// public EnumRecommendType RecommendType { get; set; } + + /// + /// 需求数量 + /// + public decimal RequestQty { get; set; } + + #endregion + + #region 推荐来源 + + /// + /// 推荐来源托标签 + /// + public string RecommendFromContainerCode { get; set; } + + /// + /// 推荐来源箱标签 + /// + public string RecommendFromPackingCode { get; set; } + + /// + /// 推荐来源批次供应商批次 + /// + public string RecommendFromSupplierBatch { get; set; } + + /// + /// 推荐来源批次到货时间 + /// + public DateTime RecommendFromArriveDate { get; set; } + + /// + /// 推荐来源批次生产时间 + /// + public DateTime RecommendFromProduceDate { get; set; } + + /// + /// 推荐来源批次过期时间 + /// + public DateTime RecommendFromExpireDate { get; set; } + + /// + /// 推荐来源批次排序 + /// + public string RecommendFromLot { get; set; } + + /// + /// 推荐来源库位 + /// + public string RecommendFromLocationCode { get; set; } + + /// + /// 推荐来源库区 + /// + public string RecommendFromLocationArea { get; set; } + + /// + /// 推荐来源库位组 + /// + public string RecommendFromLocationGroup { get; set; } + + /// + /// 推荐来源ERP库位 + /// + public string RecommendFromLocationErpCode { get; set; } + + /// + /// 推荐来源仓库 + /// + public string RecommendFromWarehouseCode { get; set; } + + /// + /// 推荐来源数量 + /// + public decimal RecommendFromQty { get; set; } + + #endregion + + #region 推荐目标 + + /// + /// 推荐目标托标签 + /// + public string RecommendToContainerCode { get; set; } + + /// + /// 推荐目标箱标签 + /// + public string RecommendToPackingCode { get; set; } + + /// + /// 推荐目标批次供应商批次 + /// + public string RecommendToSupplierBatch { get; set; } + + /// + /// 推荐目标批次到货时间 + /// + public DateTime RecommendToArriveDate { get; set; } + + /// + /// 推荐目标批次生产时间 + /// + public DateTime RecommendToProduceDate { get; set; } + + /// + /// 推荐目标批次过期时间 + /// + public DateTime RecommendToExpireDate { get; set; } + + /// + /// 推荐目标批次排序 + /// + public string RecommendToLot { get; set; } + + /// + /// 推荐目标库位 + /// + public string RecommendToLocationCode { get; set; } + + /// + /// 推荐目标库区 + /// + public string RecommendToLocationArea { get; set; } + + /// + /// 推荐目标库位组 + /// + public string RecommendToLocationGroup { get; set; } + + /// + /// 推荐目标ERP库位 + /// + public string RecommendToLocationErpCode { get; set; } + + /// + /// 推荐目标仓库 + /// + public string RecommendToWarehouseCode { get; set; } + + /// + /// 推荐目标数量 + /// + public decimal RecommendToQty { get; set; } + + #endregion + + #region 库移来源 + + /// + /// 库移来源托标签 + /// + public string TransferLibFromContainerCode { get; set; } + + /// + /// 库移来源箱标签 + /// + public string TransferLibFromPackingCode { get; set; } + + /// + /// 库移来源批次供应商批次 + /// + public string TransferLibFromSupplierBatch { get; set; } + + /// + /// 库移来源批次到货时间 + /// + public DateTime TransferLibFromArriveDate { get; set; } + + /// + /// 库移来源批次生产时间 + /// + public DateTime TransferLibFromProduceDate { get; set; } + + /// + /// 库移来源批次过期时间 + /// + public DateTime TransferLibFromExpireDate { get; set; } + + /// + /// 库移来源批次排序 + /// + public string TransferLibFromLot { get; set; } + + /// + /// 库移来源库位 + /// + public string TransferLibFromLocationCode { get; set; } + + /// + /// 库移来源库区 + /// + public string TransferLibFromLocationArea { get; set; } + + /// + /// 库移来源库位组 + /// + public string TransferLibFromLocationGroup { get; set; } + + /// + /// 库移来源ERP库位 + /// + public string TransferLibFromLocationErpCode { get; set; } + + /// + /// 库移来源仓库 + /// + public string TransferLibFromWarehouseCode { get; set; } + + /// + /// 库移来源数量 + /// + public decimal TransferLibFromQty { get; set; } + + #endregion + + #region 库移目标 + + /// + /// 库移目标托标签 + /// + public string TransferLibToContainerCode { get; set; } + + /// + /// 库移目标箱标签 + /// + public string TransferLibToPackingCode { get; set; } + + /// + /// 库移目标批次供应商批次 + /// + public string TransferLibToSupplierBatch { get; set; } + + /// + /// 库移目标批次到货时间 + /// + public DateTime TransferLibToArriveDate { get; set; } + + /// + /// 库移目标批次生产时间 + /// + public DateTime TransferLibToProduceDate { get; set; } + + /// + /// 库移目标批次过期时间 + /// + public DateTime TransferLibToExpireDate { get; set; } + + /// + /// 库移目标批次排序 + /// + public string TransferLibToLot { get; set; } + + /// + /// 库移目标库位 + /// + public string TransferLibToLocationCode { get; set; } + + /// + /// 库移目标库区 + /// + public string TransferLibToLocationArea { get; set; } + + /// + /// 库移目标库位组 + /// + public string TransferLibToLocationGroup { get; set; } + + /// + /// 库移目标ERP库位 + /// + public string TransferLibToLocationErpCode { get; set; } + + /// + /// 库移目标仓库 + /// + public string TransferLibToWarehouseCode { get; set; } + + /// + /// 库移目标数量 + /// + public decimal TransferLibToQty { get; set; } + + #endregion + + #region 实际来源 + + /// + /// 实际目标托标签 + /// + public string HandledFromContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledFromPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledFromSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledFromArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledFromProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledFromExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledFromLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledFromLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledFromLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledFromLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledFromLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledFromWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledFromQty { get; set; } + + #endregion + + #region 实际目标 + + /// + /// 实际目标托标签 + /// + public string HandledToContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledToPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledToSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledToArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledToProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledToExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledToLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledToLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledToLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledToLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledToLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledToWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledToQty { get; set; } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNote.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNote.cs index 566be6629..360c84095 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNote.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNote.cs @@ -18,12 +18,6 @@ public class CoatingIssueNote : SfsStoreAggregateRootBase - /// 车间 - /// - [IgnoreUpdate] - public string Workshop { get; set; } - /// /// 明细列表 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDetail.cs index 93ba9e706..08f96fca6 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDetail.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/IssueNotes/CoatingIssueNotes/CoatingIssueNoteDetail.cs @@ -1,44 +1,519 @@ using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; -using Win_in.Sfs.Wms.Store.Domain; -namespace Win_in.Sfs.Wms.Store.Notes.IssueNotes; +namespace Win_in.Sfs.Wms.Store.Domain; -public class CoatingIssueNoteDetail : SfsStoreRecommendFromDetailWithFromToEntityBase +public class CoatingIssueNoteDetail : SfsStoreDetailEntityBase { + #region 库存基础信息 /// - /// 发料时间 + /// 物品代码 /// - public DateTime IssueTime { get; set; } + public string ItemCode { get; set; } /// - /// 过期时间 + /// 物品名称 /// - public DateTime ExpiredTime { get; set; } + public string ItemName { get; set; } /// - /// 生产线 + /// 物品描述1 /// - public string ProdLine { get; set; } + public string ItemDesc1 { get; set; } + + /// + /// 物品描述2 + /// + public string ItemDesc2 { get; set; } + + /// + /// 标包数量 + /// + [Display(Name = "标包数量")] + [Column(TypeName = "decimal(18,6)")] + public decimal StdPackQty { get; set; } + + /// + /// 库存状态 + /// + public EnumInventoryStatus Status { get; set; } + + /// + /// 计量单位 + /// + public string Uom { get; set; } + + #endregion + + #region 请求信息 + + /// + /// 请求库位 + /// + public string RequestLocationCode { get; set; } /// - /// 工作中心 + /// 到库区 /// - public string WorkStation { get; set; } + public string RequestLocationArea { get; set; } /// - /// 在途库库位 + /// 到库位组 + /// + public string RequestLocationGroup { get; set; } + + /// + /// 到ERP库位 + /// + public string RequestLocationErpCode { get; set; } + + /// + /// 到仓库 + /// + public string RequestWarehouseCode { get; set; } + + /// + /// 在途库库位 /// public string OnTheWayLocationCode { get; set; } /// - /// 位置码 + /// 生产线 + /// + public string ProdLine { get; set; } + + /// + /// 位置码 /// public string PositionCode { get; set; } /// - /// 推荐类型 + /// 推荐的类型 /// public EnumRecommendType RecommendType { get; set; } + + /// + /// 需求数量 + /// + public decimal RequestQty { get; set; } + + #endregion + + #region 推荐来源 + + /// + /// 推荐来源托标签 + /// + public string RecommendFromContainerCode { get; set; } + + /// + /// 推荐来源箱标签 + /// + public string RecommendFromPackingCode { get; set; } + + /// + /// 推荐来源批次供应商批次 + /// + public string RecommendFromSupplierBatch { get; set; } + + /// + /// 推荐来源批次到货时间 + /// + public DateTime RecommendFromArriveDate { get; set; } + + /// + /// 推荐来源批次生产时间 + /// + public DateTime RecommendFromProduceDate { get; set; } + + /// + /// 推荐来源批次过期时间 + /// + public DateTime RecommendFromExpireDate { get; set; } + + /// + /// 推荐来源批次排序 + /// + public string RecommendFromLot { get; set; } + + /// + /// 推荐来源库位 + /// + public string RecommendFromLocationCode { get; set; } + + /// + /// 推荐来源库区 + /// + public string RecommendFromLocationArea { get; set; } + + /// + /// 推荐来源库位组 + /// + public string RecommendFromLocationGroup { get; set; } + + /// + /// 推荐来源ERP库位 + /// + public string RecommendFromLocationErpCode { get; set; } + + /// + /// 推荐来源仓库 + /// + public string RecommendFromWarehouseCode { get; set; } + + /// + /// 推荐来源数量 + /// + public decimal RecommendFromQty { get; set; } + + #endregion + + #region 推荐目标 + + /// + /// 推荐目标托标签 + /// + public string RecommendToContainerCode { get; set; } + + /// + /// 推荐目标箱标签 + /// + public string RecommendToPackingCode { get; set; } + + /// + /// 推荐目标批次供应商批次 + /// + public string RecommendToSupplierBatch { get; set; } + + /// + /// 推荐目标批次到货时间 + /// + public DateTime RecommendToArriveDate { get; set; } + + /// + /// 推荐目标批次生产时间 + /// + public DateTime RecommendToProduceDate { get; set; } + + /// + /// 推荐目标批次过期时间 + /// + public DateTime RecommendToExpireDate { get; set; } + + /// + /// 推荐目标批次排序 + /// + public string RecommendToLot { get; set; } + + /// + /// 推荐目标库位 + /// + public string RecommendToLocationCode { get; set; } + + /// + /// 推荐目标库区 + /// + public string RecommendToLocationArea { get; set; } + + /// + /// 推荐目标库位组 + /// + public string RecommendToLocationGroup { get; set; } + + /// + /// 推荐目标ERP库位 + /// + public string RecommendToLocationErpCode { get; set; } + + /// + /// 推荐目标仓库 + /// + public string RecommendToWarehouseCode { get; set; } + + /// + /// 推荐目标数量 + /// + public decimal RecommendToQty { get; set; } + + #endregion + + #region 库移来源 + + /// + /// 库移来源托标签 + /// + public string TransferLibFromContainerCode { get; set; } + + /// + /// 库移来源箱标签 + /// + public string TransferLibFromPackingCode { get; set; } + + /// + /// 库移来源批次供应商批次 + /// + public string TransferLibFromSupplierBatch { get; set; } + + /// + /// 库移来源批次到货时间 + /// + public DateTime TransferLibFromArriveDate { get; set; } + + /// + /// 库移来源批次生产时间 + /// + public DateTime TransferLibFromProduceDate { get; set; } + + /// + /// 库移来源批次过期时间 + /// + public DateTime TransferLibFromExpireDate { get; set; } + + /// + /// 库移来源批次排序 + /// + public string TransferLibFromLot { get; set; } + + /// + /// 库移来源库位 + /// + public string TransferLibFromLocationCode { get; set; } + + /// + /// 库移来源库区 + /// + public string TransferLibFromLocationArea { get; set; } + + /// + /// 库移来源库位组 + /// + public string TransferLibFromLocationGroup { get; set; } + + /// + /// 库移来源ERP库位 + /// + public string TransferLibFromLocationErpCode { get; set; } + + /// + /// 库移来源仓库 + /// + public string TransferLibFromWarehouseCode { get; set; } + + /// + /// 库移来源数量 + /// + public decimal TransferLibFromQty { get; set; } + + #endregion + + #region 库移目标 + + /// + /// 库移目标托标签 + /// + public string TransferLibToContainerCode { get; set; } + + /// + /// 库移目标箱标签 + /// + public string TransferLibToPackingCode { get; set; } + + /// + /// 库移目标批次供应商批次 + /// + public string TransferLibToSupplierBatch { get; set; } + + /// + /// 库移目标批次到货时间 + /// + public DateTime TransferLibToArriveDate { get; set; } + + /// + /// 库移目标批次生产时间 + /// + public DateTime TransferLibToProduceDate { get; set; } + + /// + /// 库移目标批次过期时间 + /// + public DateTime TransferLibToExpireDate { get; set; } + + /// + /// 库移目标批次排序 + /// + public string TransferLibToLot { get; set; } + + /// + /// 库移目标库位 + /// + public string TransferLibToLocationCode { get; set; } + + /// + /// 库移目标库区 + /// + public string TransferLibToLocationArea { get; set; } + + /// + /// 库移目标库位组 + /// + public string TransferLibToLocationGroup { get; set; } + + /// + /// 库移目标ERP库位 + /// + public string TransferLibToLocationErpCode { get; set; } + + /// + /// 库移目标仓库 + /// + public string TransferLibToWarehouseCode { get; set; } + + /// + /// 库移目标数量 + /// + public decimal TransferLibToQty { get; set; } + + #endregion + + #region 实际来源 + + /// + /// 实际目标托标签 + /// + public string HandledFromContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledFromPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledFromSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledFromArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledFromProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledFromExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledFromLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledFromLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledFromLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledFromLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledFromLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledFromWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledFromQty { get; set; } + + #endregion + + #region 实际目标 + + /// + /// 实际目标托标签 + /// + public string HandledToContainerCode { get; set; } + + /// + /// 实际箱标签 + /// + public string HandledToPackingCode { get; set; } + + /// + /// 实际批次供应商批次 + /// + public string HandledToSupplierBatch { get; set; } + + /// + /// 实际批次到货时间 + /// + public DateTime HandledToArriveDate { get; set; } + + /// + /// 实际批次生产时间 + /// + public DateTime HandledToProduceDate { get; set; } + + /// + /// 实际批次过期时间 + /// + public DateTime HandledToExpireDate { get; set; } + + /// + /// 实际批次排序 + /// + public string HandledToLot { get; set; } + + /// + /// 实际库位 + /// + public string HandledToLocationCode { get; set; } + + /// + /// 实际库区 + /// + public string HandledToLocationArea { get; set; } + + /// + /// 实际库位组 + /// + public string HandledToLocationGroup { get; set; } + + /// + /// 实际ERP库位 + /// + public string HandledToLocationErpCode { get; set; } + + /// + /// 实际仓库 + /// + public string HandledToWarehouseCode { get; set; } + + /// + /// 实际数量 + /// + public decimal HandledToQty { get; set; } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestManager.cs index 6a11a1746..a6813cbad 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/AssembleRequestManager.cs @@ -34,7 +34,7 @@ public class AssembleIssueRequestsManager /// /// /// - public virtual async Task CreateBynNumberAsync(AssembleIssueRequests entity) + public virtual async Task CreateByNumberAsync(AssembleRequest entity) { var number = string.IsNullOrEmpty(entity.Number) ? await GenerateNumberAsync(nameof(AssembleIssueRequests), entity.ActiveDate).ConfigureAwait(false) : entity.Number; entity.SetIdAndNumberWithDetails(GuidGenerator, number); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/IAssembleRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/IAssembleRequestManager.cs index 0169d13c3..ece4383f9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/IAssembleRequestManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/AssembleRequests/IAssembleRequestManager.cs @@ -9,5 +9,6 @@ public interface IAssembleIssueRequestsManager : ISfsStoreRequestManager CreateBynNumberAsync(AssembleIssueRequests entity); + Task CreateByNumberAsync(AssembleRequest entity); + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestManager.cs index cde7e5cb9..f74b0509c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/CoatingMaterialRequestManager.cs @@ -32,7 +32,7 @@ public class CoatingMaterialRequestManager /// /// /// - public virtual async Task CreateBynNumberAsync(CoatingMaterialRequest entity) + public virtual async Task CreateByNumberAsync(CoatingMaterialRequest entity) { var number = string.IsNullOrEmpty(entity.Number) ? await GenerateNumberAsync(nameof(CoatingMaterialRequest), entity.ActiveDate).ConfigureAwait(false) : entity.Number; entity.SetIdAndNumberWithDetails(GuidGenerator, number); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/ICoatingMaterialRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/ICoatingMaterialRequestManager.cs index 6e85da61a..bfac8b9ef 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/ICoatingMaterialRequestManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/CoatingMaterialRequests/ICoatingMaterialRequestManager.cs @@ -10,5 +10,5 @@ public interface ICoatingMaterialRequestManager : ISfsStoreRequestManager CreateBynNumberAsync(CoatingMaterialRequest entity); + Task CreateByNumberAsync(CoatingMaterialRequest entity); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/ThirdLocationRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/ThirdLocationRequestManager.cs index 1586bfcf3..39543242c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/ThirdLocationRequestManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/ThirdLocationRequestManager.cs @@ -14,15 +14,15 @@ public class ThirdLocationRequestManager , IThirdLocationRequestManager { private readonly IThirdLocationRequestRepository _repository; - private readonly IIssueJobRepository _issueJobRepository; + public ThirdLocationRequestManager( IThirdLocationRequestRepository repository - , IIssueJobRepository issueJobRepository + ) : base(repository) { _repository = repository; - _issueJobRepository = issueJobRepository; + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/AssembleJobs/AssembleJobDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/AssembleJobs/AssembleJobDbContextModelCreatingExtensions.cs index 7588aed51..0a72cedd1 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/AssembleJobs/AssembleJobDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/AssembleJobs/AssembleJobDbContextModelCreatingExtensions.cs @@ -22,9 +22,10 @@ public static class AssembleJobDbContextModelCreatingExtensions b.ConfigureJob(); //Properties b.Property(q => q.RequestType).HasMaxLength(SfsPropertyConst.CodeLength); - b.Property(q => q.AssembleIssueRequestsNumber).HasMaxLength(SfsPropertyConst.CodeLength); - b.Property(q => q.Workshop).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.AssembleRequestNumber).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.JobType).HasConversion(); + b.Property(q => q.JobStatus).HasConversion(); //Relations b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); //Indexes @@ -40,25 +41,17 @@ public static class AssembleJobDbContextModelCreatingExtensions //Configure Sfs base properties b.ConfigureSfsBase(); //Configure Job base properties - b.ConfigureJobRecommendFromDetail(); + //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(); - b.Property(q => q.TruncType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); - b.Property(q => q.PlannedSplitRule).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); b.Property(q => q.OnTheWayLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.OnTheWayLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.CodeLength).IsRequired(false); b.Property(q => q.RecommendType).HasMaxLength(SfsPropertyConst.CodeLength).HasConversion(); - + b.Property(q => q.Status).IsRequired().HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); //Relations //None diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/CoatingIssueJob/CoatingIssueJobDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/CoatingIssueJob/CoatingIssueJobDbContextModelCreatingExtensions.cs index 492703d20..f9abf7d85 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/CoatingIssueJob/CoatingIssueJobDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/CoatingIssueJob/CoatingIssueJobDbContextModelCreatingExtensions.cs @@ -24,8 +24,9 @@ public static class CoatingIssueJobDbContextModelCreatingExtensions //Properties b.Property(q => q.RequestType).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.MaterialRequestNumber).HasMaxLength(SfsPropertyConst.CodeLength); - b.Property(q => q.Workshop).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.JobType).HasConversion(); + b.Property(q => q.JobStatus).HasConversion(); //Relations b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); //Indexes @@ -41,25 +42,17 @@ public static class CoatingIssueJobDbContextModelCreatingExtensions //Configure Sfs base properties b.ConfigureSfsBase(); //Configure Job base properties - b.ConfigureJobRecommendFromDetail(); + //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(); - b.Property(q => q.TruncType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); - b.Property(q => q.PlannedSplitRule).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + b.Property(q => q.OnTheWayLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.OnTheWayLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.CodeLength).IsRequired(false); b.Property(q => q.RecommendType).HasMaxLength(SfsPropertyConst.CodeLength).HasConversion(); - + b.Property(q => q.Status).IsRequired().HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); //Relations //None diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/IssueNotes/AssembleNotes/AssembleNoteDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/IssueNotes/AssembleNotes/AssembleNoteDbContextModelCreatingExtensions.cs index f13daeb61..b739a5680 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/IssueNotes/AssembleNotes/AssembleNoteDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/IssueNotes/AssembleNotes/AssembleNoteDbContextModelCreatingExtensions.cs @@ -21,7 +21,6 @@ public static class AssembleNoteDbContextModelCreatingExtensions //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 @@ -32,32 +31,27 @@ public static class AssembleNoteDbContextModelCreatingExtensions }); builder.Entity(b => - { - //Configure table & schema name - b.ToTable(options.TablePrefix + nameof(AssembleNoteDetail), 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(); - b.Property(q => q.ToStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); - b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.CodeLength); - b.Property(q => q.RecommendType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); - - //Relations - - //Indexes - b.HasIndex(q => new { q.Number, q.FromPackingCode, q.FromLocationCode, q.ToLocationCode }).IsUnique(); - b.HasIndex(q => new { q.FromPackingCode }); - }); + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(AssembleNoteDetail), 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.ProdLine).HasMaxLength(SfsPropertyConst.NameLength); + b.Property(q => q.OnTheWayLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.RecommendType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + + //Relations + + //Indexes + b.HasIndex(q => new { q.Number, q.HandledFromPackingCode, q.HandledFromLocationCode, q.HandledToLocationCode }).IsUnique(); + b.HasIndex(q => new { q.HandledFromPackingCode }); + }); } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/IssueNotes/CoatingIssueNoteDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/IssueNotes/CoatingIssueNoteDbContextModelCreatingExtensions.cs index 11dcd02be..01678828a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/IssueNotes/CoatingIssueNoteDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/IssueNotes/CoatingIssueNoteDbContextModelCreatingExtensions.cs @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.Modeling; using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Notes.IssueNotes; namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; @@ -21,7 +22,6 @@ public static class CoatingIssueNoteDbContextModelCreatingExtensions //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 @@ -32,31 +32,27 @@ public static class CoatingIssueNoteDbContextModelCreatingExtensions }); builder.Entity(b => - { - //Configure table & schema name - b.ToTable(options.TablePrefix + nameof(CoatingIssueNoteDetail), 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(); - b.Property(q => q.ToStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); - b.Property(q => q.RecommendType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); - - //Relations - - //Indexes - b.HasIndex(q => new { q.Number, q.FromPackingCode, q.FromLocationCode, q.ToLocationCode }).IsUnique(); - b.HasIndex(q => new { q.FromPackingCode }); - }); + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(CoatingIssueNoteDetail), 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.ProdLine).HasMaxLength(SfsPropertyConst.NameLength); + b.Property(q => q.OnTheWayLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.RecommendType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + + //Relations + + //Indexes + b.HasIndex(q => new { q.Number, q.HandledFromPackingCode, q.HandledFromLocationCode, q.HandledToLocationCode }).IsUnique(); + b.HasIndex(q => new { q.HandledFromPackingCode }); + }); } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/AssembleJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/AssembleJobAutoMapperProfile.cs index 07defcd9e..d8208d684 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/AssembleJobAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/AssembleJobAutoMapperProfile.cs @@ -23,44 +23,8 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.ConfirmTime); CreateMap() - .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() - .MapExpectInOutFrom() - .Ignore(x => x.Worker) - .Ignore(x => x.SerialNumber) - .Ignore(x => x.ExtraProperties) - ; - - CreateMap() - .MapExpectInOutFrom() - .Ignore(x => x.Worker) - .Ignore(x => x.SerialNumber) - .Ignore(x => x.ExtraProperties); - CreateMap() .ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.AssembleIssueRequestsNumber)) .Ignore(x => x.Confirmed) @@ -68,25 +32,6 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.ActiveDate) ; CreateMap() - .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)) ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/CoatingIssueJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/CoatingIssueJobAutoMapperProfile.cs index bf3a92d55..47e024d74 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/CoatingIssueJobAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/CoatingIssueJobAutoMapperProfile.cs @@ -25,44 +25,8 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.ConfirmTime); CreateMap() - .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() - .MapExpectInOutFrom() - .Ignore(x => x.Worker) - .Ignore(x => x.SerialNumber) - .Ignore(x => x.ExtraProperties) - ; - - CreateMap() - .MapExpectInOutFrom() - .Ignore(x => x.Worker) - .Ignore(x => x.SerialNumber) - .Ignore(x => x.ExtraProperties); - CreateMap() .ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.MaterialRequestNumber)) .Ignore(x => x.Confirmed) @@ -70,25 +34,6 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.ActiveDate) ; CreateMap() - .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)) ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleNoteAutoMapperProfile.cs index 15033a58a..d9e072ec3 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleNoteAutoMapperProfile.cs @@ -16,6 +16,36 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.TransType) .Ignore(x => x.ExtraProperties) .Ignore(x => x.TransSubType) + + .ForMember(x => x.Qty, y => y.MapFrom(t => t.HandledToQty)) + .ForMember(x => x.SupplierBatch, y => y.MapFrom(t => t.HandledFromSupplierBatch)) + .ForMember(x => x.ArriveDate, y => y.MapFrom(t => t.HandledFromArriveDate)) + .ForMember(x => x.ProduceDate, y => y.MapFrom(t => t.HandledFromProduceDate)) + .ForMember(x => x.ExpireDate, y => y.MapFrom(t => t.HandledFromExpireDate)) + + .ForMember(x => x.FromPackingCode, y => y.MapFrom(t => t.HandledFromPackingCode)) + .ForMember(x => x.FromContainerCode, y => y.MapFrom(t => t.HandledFromContainerCode)) + + .ForMember(x => x.FromLot, y => y.MapFrom(t => t.HandledFromLot)) + .ForMember(x => x.FromStatus, y => y.MapFrom(t => t.Status)) + + .ForMember(x => x.FromLocationCode, y => y.MapFrom(t => t.HandledFromLocationCode)) + .ForMember(x => x.FromLocationGroup, y => y.MapFrom(t => t.HandledFromLocationGroup)) + .ForMember(x => x.FromLocationArea, y => y.MapFrom(t => t.HandledFromLocationArea)) + .ForMember(x => x.FromLocationErpCode, y => y.MapFrom(t => t.HandledFromLocationErpCode)) + .ForMember(x => x.FromWarehouseCode, y => y.MapFrom(t => t.HandledFromWarehouseCode)) + + .ForMember(x => x.ToLot, y => y.MapFrom(t => t.HandledToLot)) + .ForMember(x => x.ToStatus, y => y.MapFrom(t => t.Status)) + .ForMember(x => x.ToPackingCode, y => y.MapFrom(t => t.HandledToPackingCode)) + .ForMember(x => x.ToContainerCode, y => y.MapFrom(t => t.HandledToContainerCode)) + + .ForMember(x => x.ToLocationCode, y => y.MapFrom(t => t.HandledToLocationCode)) + .ForMember(x => x.ToLocationGroup, y => y.MapFrom(t => t.HandledToLocationGroup)) + .ForMember(x => x.ToLocationArea, y => y.MapFrom(t => t.HandledToLocationArea)) + .ForMember(x => x.ToLocationErpCode, y => y.MapFrom(t => t.HandledToLocationErpCode)) + .ForMember(x => x.ToWarehouseCode, y => y.MapFrom(t => t.HandledToWarehouseCode)) + ; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/CoatingIssueNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/CoatingIssueNoteAutoMapperProfile.cs index 8f88e2ac7..f8137b8db 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/CoatingIssueNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/CoatingIssueNoteAutoMapperProfile.cs @@ -17,6 +17,36 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.TransType) .Ignore(x => x.ExtraProperties) .Ignore(x => x.TransSubType) + + .ForMember(x => x.Qty, y => y.MapFrom(t => t.HandledToQty)) + .ForMember(x => x.SupplierBatch, y => y.MapFrom(t => t.HandledFromSupplierBatch)) + .ForMember(x => x.ArriveDate, y => y.MapFrom(t => t.HandledFromArriveDate)) + .ForMember(x => x.ProduceDate, y => y.MapFrom(t => t.HandledFromProduceDate)) + .ForMember(x => x.ExpireDate, y => y.MapFrom(t => t.HandledFromExpireDate)) + + .ForMember(x => x.FromPackingCode, y => y.MapFrom(t => t.HandledFromPackingCode)) + .ForMember(x => x.FromContainerCode, y => y.MapFrom(t => t.HandledFromContainerCode)) + + .ForMember(x => x.FromLot, y => y.MapFrom(t => t.HandledFromLot)) + .ForMember(x => x.FromStatus, y => y.MapFrom(t => t.Status)) + + .ForMember(x => x.FromLocationCode, y => y.MapFrom(t => t.HandledFromLocationCode)) + .ForMember(x => x.FromLocationGroup, y => y.MapFrom(t => t.HandledFromLocationGroup)) + .ForMember(x => x.FromLocationArea, y => y.MapFrom(t => t.HandledFromLocationArea)) + .ForMember(x => x.FromLocationErpCode, y => y.MapFrom(t => t.HandledFromLocationErpCode)) + .ForMember(x => x.FromWarehouseCode, y => y.MapFrom(t => t.HandledFromWarehouseCode)) + + .ForMember(x => x.ToLot, y => y.MapFrom(t => t.HandledToLot)) + .ForMember(x => x.ToStatus, y => y.MapFrom(t => t.Status)) + .ForMember(x => x.ToPackingCode, y => y.MapFrom(t => t.HandledToPackingCode)) + .ForMember(x => x.ToContainerCode, y => y.MapFrom(t => t.HandledToContainerCode)) + + .ForMember(x => x.ToLocationCode, y => y.MapFrom(t => t.HandledToLocationCode)) + .ForMember(x => x.ToLocationGroup, y => y.MapFrom(t => t.HandledToLocationGroup)) + .ForMember(x => x.ToLocationArea, y => y.MapFrom(t => t.HandledToLocationArea)) + .ForMember(x => x.ToLocationErpCode, y => y.MapFrom(t => t.HandledToLocationErpCode)) + .ForMember(x => x.ToWarehouseCode, y => y.MapFrom(t => t.HandledToWarehouseCode)) + ; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/AssembleJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/AssembleJobEventHandler.cs index 8834827b7..6b212df3c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/AssembleJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/AssembleJobEventHandler.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -7,25 +6,31 @@ using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; -using Win_in.Sfs.Wms.Store.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Event.BusinessJob; public class AssembleJobEventHandler : StoreEventHandlerBase , ILocalEventHandler> + , ILocalEventHandler> + , ILocalEventHandler>> { - private const EnumTransType TransType = EnumTransType.Issue; - private readonly IAssembleNoteAppService _assembleNoteAppService; + private readonly IExpectOutAppService _expectOutAppService; private readonly ILocationAppService _locationAppService; + private readonly ITransferLibRequestAppService _transferLibRequestAppService; - public AssembleJobEventHandler(IAssembleNoteAppService assembleNoteAppService, ILocationAppService locationAppService) + public AssembleJobEventHandler(IAssembleNoteAppService assembleNoteAppService, + IExpectOutAppService expectOutAppService, + ILocationAppService locationAppService, ITransferLibRequestAppService transferLibRequestAppService) { _assembleNoteAppService = assembleNoteAppService; + _expectOutAppService = expectOutAppService; _locationAppService = locationAppService; + _transferLibRequestAppService = transferLibRequestAppService; } /// @@ -41,8 +46,146 @@ public class AssembleJobEventHandler : await _assembleNoteAppService.CreateAsync(assembleNote).ConfigureAwait(false); } + /// + /// 创建后 + /// + /// + /// + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + + await CreateExpectOutAsync(entity).ConfigureAwait(false); + + await CreateTransferLibAsync(entity).ConfigureAwait(false); + } + + /// + /// 批量创建后 + /// + /// + /// + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entitys = eventData.Entity; + + foreach (var entity in entitys) + { + await CreateExpectOutAsync(entity).ConfigureAwait(false); + + await CreateTransferLibAsync(entity).ConfigureAwait(false); + } + } + #region 私有 + /// + /// 创建预计出 + /// + /// + /// + private async Task CreateExpectOutAsync(AssembleJob entity) + { + var expectOutEditInputs = new List(); + foreach (var detail in entity.Details) + { + var inputoExpectOutEditInput = new ExpectOutEditInput(); + inputoExpectOutEditInput.JobNumber = entity.Number; + inputoExpectOutEditInput.ItemCode = detail.ItemCode; + inputoExpectOutEditInput.Qty = detail.RecommendFromQty; + inputoExpectOutEditInput.LocationCode = detail.RecommendFromLocationCode; + inputoExpectOutEditInput.ArriveDate = detail.RecommendFromArriveDate; + inputoExpectOutEditInput.ContainerCode = detail.RecommendFromContainerCode; + inputoExpectOutEditInput.ExpireDate = detail.RecommendFromExpireDate; + inputoExpectOutEditInput.ItemDesc1 = detail.ItemDesc1; + inputoExpectOutEditInput.ItemDesc2 = detail.ItemDesc2; + inputoExpectOutEditInput.ItemName = detail.ItemName; + inputoExpectOutEditInput.LocationArea = detail.RecommendFromLocationArea; + inputoExpectOutEditInput.LocationGroup = detail.RecommendFromLocationGroup; + inputoExpectOutEditInput.LocationErpCode = detail.RecommendFromLocationErpCode; + inputoExpectOutEditInput.PackingCode = detail.RecommendFromPackingCode; + inputoExpectOutEditInput.Lot = detail.RecommendFromLot; + inputoExpectOutEditInput.ProduceDate = detail.RecommendFromProduceDate; + inputoExpectOutEditInput.Status = detail.Status; + inputoExpectOutEditInput.Uom = detail.Uom; + inputoExpectOutEditInput.SupplierBatch = detail.RecommendFromSupplierBatch; + inputoExpectOutEditInput.WarehouseCode = detail.RecommendFromWarehouseCode; + + expectOutEditInputs.Add(inputoExpectOutEditInput); + } + + await _expectOutAppService.AddManyAsync(expectOutEditInputs).ConfigureAwait(false); + + await Task.CompletedTask.ConfigureAwait(false); + } + + /// + /// 根据是否在 第一层 来创建 是否生成库移任务 + /// + /// + private async Task CreateTransferLibAsync(AssembleJob assembleJob) + { + if (!await IsMinRowAsync(assembleJob).ConfigureAwait(false)) + { + foreach (var detail in assembleJob.Details) + { + var input = new TransferLibRequestEditInput(); + input.CallBusinessType = nameof(IAssembleJobAppService); + input.CallJobNumber = assembleJob.Number; + input.CallRequestNumber = assembleJob.AssembleRequestNumber; + input.CallServerName = "Win_in.Sfs.Wms.Store.Application.AssembleJobAppService"; + input.Type = "Transfer_Warehouse"; + input.UseOnTheWayLocation = true; + + var detailInput = new TransferLibRequestDetailInput(); + detailInput.CallBusinessType = nameof(IAssembleJobAppService); + detailInput.CallRequestNumber = assembleJob.AssembleRequestNumber; + detailInput.CallServerName = "Win_in.Sfs.Wms.Store.Application.AssembleJobAppService"; + detailInput.CallJobNumber = assembleJob.Number; + + detailInput.JobStatus = EnumJobStatus.Open; + detailInput.ItemCode = detail.ItemCode; + detailInput.StdPackQty = detail.StdPackQty; + detailInput.Uom = detail.Uom; + detailInput.Status = detail.Status; + + detailInput.RecommendFromQty = detail.RecommendFromQty; + detailInput.RecommendFromLot = detail.RecommendFromLot; + detailInput.RecommendFromPackingCode = detailInput.RecommendFromPackingCode; + detailInput.RecommendToLot = detail.RecommendToLot; + + detailInput.RecommendFromArriveDate = detail.RecommendFromArriveDate; + detailInput.RecommendFromExpireDate = detail.RecommendFromExpireDate; + detailInput.RecommendFromProduceDate = detail.RecommendFromProduceDate; + detailInput.RecommendFromSupplierBatch = detail.RecommendFromSupplierBatch; + + detailInput.RecommendFromLocationCode = detail.RecommendFromLocationCode; + detailInput.RecommendFromLocationGroup = detail.RecommendFromLocationGroup; + detailInput.RecommendFromLocationArea = detail.RecommendFromLocationArea; + detailInput.RecommendFromLocationErpCode = detail.RecommendFromLocationErpCode; + detailInput.RecommendFromWarehouseCode = detail.RecommendFromWarehouseCode; + + detailInput.RecommendToQty = detail.RecommendToQty; + detailInput.RecommendToLot = detail.RecommendToLot; + detailInput.RecommendToPackingCode = detailInput.RecommendToPackingCode; + detailInput.RecommendToLot = detail.RecommendToLot; + + detailInput.RecommendToArriveDate = detail.RecommendToArriveDate; + detailInput.RecommendToExpireDate = detail.RecommendToExpireDate; + detailInput.RecommendToProduceDate = detail.RecommendToProduceDate; + detailInput.RecommendToSupplierBatch = detail.RecommendToSupplierBatch; + + detailInput.RecommendToLocationCode = detail.RecommendToLocationCode; + detailInput.RecommendToLocationGroup = detail.RecommendToLocationGroup; + detailInput.RecommendToLocationArea = detail.RecommendToLocationArea; + detailInput.RecommendToLocationErpCode = detail.RecommendToLocationErpCode; + detailInput.RecommendToWarehouseCode = detail.RecommendToWarehouseCode; + + await _transferLibRequestAppService.CreateAsync(input).ConfigureAwait(false); + } + } + } + /// /// 创建补料记录实体 /// @@ -52,78 +195,29 @@ public class AssembleJobEventHandler : { var assembleNoteCreateInput = ObjectMapper.Map(entity); assembleNoteCreateInput.JobNumber = entity.Number; - var locationCodes = assembleNoteCreateInput.Details.Select(p => p.ToLocationCode).Distinct().ToList(); - var locations = await _locationAppService.GetByCodesAsync(locationCodes).ConfigureAwait(false); - - assembleNoteCreateInput.Details.RemoveAll(p => p.Qty == 0); - foreach (var detail in assembleNoteCreateInput.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; - } + await Task.CompletedTask.ConfigureAwait(false); return assembleNoteCreateInput; } /// - /// 去除箱码 托码 批次 + /// 判断是不是在最底层 如果不是则把状态变更为等待 /// - private async Task RemovePackingCodeAndContainerCodeAndLotAsync(AssembleNoteDetailInput assembleNoteDetail, - EnumLocationType locationType) + /// + /// + private async Task IsMinRowAsync(AssembleJob assembleJob) { - switch (locationType) + var detail = assembleJob.Details.FirstOrDefault(); + + var loctionDto = await _locationAppService.GetByCodeAsync(detail.RecommendFromLocationCode) + .ConfigureAwait(false); + if (loctionDto.RowCode == 1) { - case EnumLocationType.WIP: - { - //用开关控制 发料到线边后去除箱码和托码 ??? - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemovePackingCode) - .ConfigureAwait(false)) - { - assembleNoteDetail.ToPackingCode = ""; - } - - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveContainerCode) - .ConfigureAwait(false)) - { - assembleNoteDetail.ToContainerCode = ""; - } - - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveLot).ConfigureAwait(false)) - { - assembleNoteDetail.ToLot = ""; - } - - break; - } - case EnumLocationType.SEMI: - { - //用开关控制 发料到后去除箱码和托码 ??? - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemovePackingCode) - .ConfigureAwait(false)) - { - assembleNoteDetail.ToPackingCode = ""; - } - - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveContainerCode) - .ConfigureAwait(false)) - { - assembleNoteDetail.ToContainerCode = ""; - } - - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveLot).ConfigureAwait(false)) - { - assembleNoteDetail.ToLot = ""; - } - - break; - } + return true; } + + return false; } #endregion diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/CoatingIssueJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/CoatingIssueJobEventHandler.cs index 8a82f504c..2bc5bb04d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/CoatingIssueJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/CoatingIssueJobEventHandler.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -7,9 +6,9 @@ using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; -using Win_in.Sfs.Wms.Store.Domain.Shared; using Win_in.Sfs.Wms.Store.Jobs.IssueJobs; using Win_in.Sfs.Wms.Store.Notes.IssueNotes; @@ -18,16 +17,22 @@ namespace Win_in.Sfs.Wms.Store.Event.BusinessJob; public class CoatingIssueJobEventHandler : StoreEventHandlerBase , ILocalEventHandler> + , ILocalEventHandler> + , ILocalEventHandler>> { - private const EnumTransType TransType = EnumTransType.Issue; - - private readonly ICoatingIssueNoteAppService _issueNoteAppService; + private readonly ICoatingIssueNoteAppService _coatingIssueNoteAppService; + private readonly IExpectOutAppService _expectOutAppService; private readonly ILocationAppService _locationAppService; + private readonly ITransferLibRequestAppService _transferLibRequestAppService; - public CoatingIssueJobEventHandler(ICoatingIssueNoteAppService issueNoteAppService, ILocationAppService locationAppService) + public CoatingIssueJobEventHandler(ICoatingIssueNoteAppService coatingIssueNoteAppService, + IExpectOutAppService expectOutAppService, + ILocationAppService locationAppService, ITransferLibRequestAppService transferLibRequestAppService) { - _issueNoteAppService = issueNoteAppService; + _coatingIssueNoteAppService = coatingIssueNoteAppService; + _expectOutAppService = expectOutAppService; _locationAppService = locationAppService; + _transferLibRequestAppService = transferLibRequestAppService; } /// @@ -39,94 +44,183 @@ public class CoatingIssueJobEventHandler : public virtual async Task HandleEventAsync(SfsCompletedEntityEventData eventData) { var entity = eventData.Entity; - var issueNote = await BuildIssueNoteAsync(entity).ConfigureAwait(false); - await _issueNoteAppService.CreateAsync(issueNote).ConfigureAwait(false); + var coatingIssueNote = await BuildCoatingIssueNoteAsync(entity).ConfigureAwait(false); + await _coatingIssueNoteAppService.CreateAsync(coatingIssueNote).ConfigureAwait(false); } - #region 私有 - /// - /// 创建补料记录实体 + /// 创建后 /// - /// + /// /// - private async Task BuildIssueNoteAsync(CoatingIssueJob entity) + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { - var issueNoteCreateInput = ObjectMapper.Map(entity); - issueNoteCreateInput.JobNumber = entity.Number; - var locationCodes = issueNoteCreateInput.Details.Select(p => p.ToLocationCode).Distinct().ToList(); - var locations = await _locationAppService.GetByCodesAsync(locationCodes).ConfigureAwait(false); + var entity = eventData.Entity; - issueNoteCreateInput.Details.RemoveAll(p => p.Qty == 0); + await CreateExpectOutAsync(entity).ConfigureAwait(false); - foreach (var detail in issueNoteCreateInput.Details) + await CreateTransferLibAsync(entity).ConfigureAwait(false); + } + + /// + /// 批量创建后 + /// + /// + /// + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entitys = eventData.Entity; + + foreach (var entity in entitys) { - var location = locations.First(p => p.Code == detail.ToLocationCode); - await RemovePackingCodeAndContainerCodeAndLotAsync(detail, location.Type).ConfigureAwait(false); //去箱 去托 去批 + await CreateExpectOutAsync(entity).ConfigureAwait(false); + + await CreateTransferLibAsync(entity).ConfigureAwait(false); + } + } + + #region 私有 - detail.ToLocationArea = location.AreaCode; - detail.ToLocationGroup = location.LocationGroupCode; - detail.ToLocationErpCode = location.ErpLocationCode; - detail.ToWarehouseCode = location.WarehouseCode; + /// + /// 创建预计出 + /// + /// + /// + private async Task CreateExpectOutAsync(CoatingIssueJob entity) + { + var expectOutEditInputs = new List(); + foreach (var detail in entity.Details) + { + var inputoExpectOutEditInput = new ExpectOutEditInput(); + inputoExpectOutEditInput.JobNumber = entity.Number; + inputoExpectOutEditInput.ItemCode = detail.ItemCode; + inputoExpectOutEditInput.Qty = detail.RecommendFromQty; + inputoExpectOutEditInput.LocationCode = detail.RecommendFromLocationCode; + inputoExpectOutEditInput.ArriveDate = detail.RecommendFromArriveDate; + inputoExpectOutEditInput.ContainerCode = detail.RecommendFromContainerCode; + inputoExpectOutEditInput.ExpireDate = detail.RecommendFromExpireDate; + inputoExpectOutEditInput.ItemDesc1 = detail.ItemDesc1; + inputoExpectOutEditInput.ItemDesc2 = detail.ItemDesc2; + inputoExpectOutEditInput.ItemName = detail.ItemName; + inputoExpectOutEditInput.LocationArea = detail.RecommendFromLocationArea; + inputoExpectOutEditInput.LocationGroup = detail.RecommendFromLocationGroup; + inputoExpectOutEditInput.LocationErpCode = detail.RecommendFromLocationErpCode; + inputoExpectOutEditInput.PackingCode = detail.RecommendFromPackingCode; + inputoExpectOutEditInput.Lot = detail.RecommendFromLot; + inputoExpectOutEditInput.ProduceDate = detail.RecommendFromProduceDate; + inputoExpectOutEditInput.Status = detail.Status; + inputoExpectOutEditInput.Uom = detail.Uom; + inputoExpectOutEditInput.SupplierBatch = detail.RecommendFromSupplierBatch; + inputoExpectOutEditInput.WarehouseCode = detail.RecommendFromWarehouseCode; + + expectOutEditInputs.Add(inputoExpectOutEditInput); } - return issueNoteCreateInput; + await _expectOutAppService.AddManyAsync(expectOutEditInputs).ConfigureAwait(false); + + await Task.CompletedTask.ConfigureAwait(false); } /// - /// 去除箱码 托码 批次 + /// 根据是否在 第一层 来创建 是否生成库移任务 /// - private async Task RemovePackingCodeAndContainerCodeAndLotAsync(CoatingIssueNoteDetailInput issueNoteDetail, - EnumLocationType locationType) + /// + private async Task CreateTransferLibAsync(CoatingIssueJob coatingIssueJob) { - switch (locationType) + if (!await IsMinRowAsync(coatingIssueJob).ConfigureAwait(false)) { - case EnumLocationType.WIP: + foreach (var detail in coatingIssueJob.Details) { - //用开关控制 发料到线边后去除箱码和托码 ??? - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemovePackingCode) - .ConfigureAwait(false)) - { - issueNoteDetail.ToPackingCode = ""; - } - - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveContainerCode) - .ConfigureAwait(false)) - { - issueNoteDetail.ToContainerCode = ""; - } - - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveLot).ConfigureAwait(false)) - { - issueNoteDetail.ToLot = ""; - } - - break; - } - case EnumLocationType.SEMI: - { - //用开关控制 发料到后去除箱码和托码 ??? - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemovePackingCode) - .ConfigureAwait(false)) - { - issueNoteDetail.ToPackingCode = ""; - } - - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveContainerCode) - .ConfigureAwait(false)) - { - issueNoteDetail.ToContainerCode = ""; - } - - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveLot).ConfigureAwait(false)) - { - issueNoteDetail.ToLot = ""; - } - - break; + var input = new TransferLibRequestEditInput(); + input.CallBusinessType = nameof(ICoatingIssueJobAppService); + input.CallJobNumber = coatingIssueJob.Number; + input.CallRequestNumber = coatingIssueJob.MaterialRequestNumber; + input.CallServerName = "Win_in.Sfs.Wms.Store.Application.CoatingIssueJobAppService"; + input.Type = "Transfer_Warehouse"; + input.UseOnTheWayLocation = true; + + var detailInput = new TransferLibRequestDetailInput(); + detailInput.CallBusinessType = nameof(ICoatingIssueJobAppService); + detailInput.CallRequestNumber = coatingIssueJob.MaterialRequestNumber; + detailInput.CallServerName = "Win_in.Sfs.Wms.Store.Application.CoatingIssueJobAppService"; + detailInput.CallJobNumber = coatingIssueJob.Number; + + detailInput.JobStatus = EnumJobStatus.Open; + detailInput.ItemCode = detail.ItemCode; + detailInput.StdPackQty = detail.StdPackQty; + detailInput.Uom = detail.Uom; + detailInput.Status = detail.Status; + + detailInput.RecommendFromQty = detail.RecommendFromQty; + detailInput.RecommendFromLot = detail.RecommendFromLot; + detailInput.RecommendFromPackingCode = detailInput.RecommendFromPackingCode; + detailInput.RecommendToLot = detail.RecommendToLot; + + detailInput.RecommendFromArriveDate = detail.RecommendFromArriveDate; + detailInput.RecommendFromExpireDate = detail.RecommendFromExpireDate; + detailInput.RecommendFromProduceDate = detail.RecommendFromProduceDate; + detailInput.RecommendFromSupplierBatch = detail.RecommendFromSupplierBatch; + + detailInput.RecommendFromLocationCode = detail.RecommendFromLocationCode; + detailInput.RecommendFromLocationGroup = detail.RecommendFromLocationGroup; + detailInput.RecommendFromLocationArea = detail.RecommendFromLocationArea; + detailInput.RecommendFromLocationErpCode = detail.RecommendFromLocationErpCode; + detailInput.RecommendFromWarehouseCode = detail.RecommendFromWarehouseCode; + + detailInput.RecommendToQty = detail.RecommendToQty; + detailInput.RecommendToLot = detail.RecommendToLot; + detailInput.RecommendToPackingCode = detailInput.RecommendToPackingCode; + detailInput.RecommendToLot = detail.RecommendToLot; + + detailInput.RecommendToArriveDate = detail.RecommendToArriveDate; + detailInput.RecommendToExpireDate = detail.RecommendToExpireDate; + detailInput.RecommendToProduceDate = detail.RecommendToProduceDate; + detailInput.RecommendToSupplierBatch = detail.RecommendToSupplierBatch; + + detailInput.RecommendToLocationCode = detail.RecommendToLocationCode; + detailInput.RecommendToLocationGroup = detail.RecommendToLocationGroup; + detailInput.RecommendToLocationArea = detail.RecommendToLocationArea; + detailInput.RecommendToLocationErpCode = detail.RecommendToLocationErpCode; + detailInput.RecommendToWarehouseCode = detail.RecommendToWarehouseCode; + + await _transferLibRequestAppService.CreateAsync(input).ConfigureAwait(false); } } } + /// + /// 创建补料记录实体 + /// + /// + /// + private async Task BuildCoatingIssueNoteAsync(CoatingIssueJob entity) + { + var coatingIssueNoteCreateInput = ObjectMapper.Map(entity); + coatingIssueNoteCreateInput.JobNumber = entity.Number; + + await Task.CompletedTask.ConfigureAwait(false); + + return coatingIssueNoteCreateInput; + } + + /// + /// 判断是不是在最底层 如果不是则把状态变更为等待 + /// + /// + /// + private async Task IsMinRowAsync(CoatingIssueJob coatingIssueJob) + { + var detail = coatingIssueJob.Details.FirstOrDefault(); + + var loctionDto = await _locationAppService.GetByCodeAsync(detail.RecommendFromLocationCode) + .ConfigureAwait(false); + if (loctionDto.RowCode == 1) + { + return true; + } + + return false; + } + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/AssembleRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/AssembleRequestEventHandler.cs index 7e541a66a..e62ac9608 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/AssembleRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/AssembleRequestEventHandler.cs @@ -1,13 +1,14 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.Json; using System.Threading.Tasks; -using FluentValidation.Validators; +using Castle.Components.DictionaryAdapter; 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.Domain.Shared.Enums.Store; using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; @@ -18,72 +19,69 @@ namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; public class AssembleIssueRequestsEventHandler : StoreEventHandlerBase - , ILocalEventHandler> - , ILocalEventHandler> - , ILocalEventHandler> - , ILocalEventHandler> - , ILocalEventHandler>> + , ILocalEventHandler> + , ILocalEventHandler> + , ILocalEventHandler> + , ILocalEventHandler> + , ILocalEventHandler>> { private readonly IAssembleJobAppService _assembleJobAppService; private readonly IProductionLineAppService _productionLineAppService; - private readonly IAssembleIssueRequestsManager _assembleRequestManager; + private readonly IProductionLineItemAppService _productionLineItemAppService; private readonly ILocationAppService _locationAppService; private readonly IBalanceAppService _balanceAppService; - public AssembleIssueRequestsEventHandler( - IAssembleJobAppService assembleJobAppService - , IProductionLineAppService productionLineAppService - , IAssembleIssueRequestsManager assembleRequestManager - , ILocationAppService locationAppService - , IBalanceAppService balanceAppService) + public AssembleRequestEventHandler( + IAssembleJobAppService assembleJobAppService, IProductionLineAppService productionLineAppService, + ILocationAppService locationAppService, + IBalanceAppService balanceAppService, IProductionLineItemAppService productionLineItemAppService) { _assembleJobAppService = assembleJobAppService; _productionLineAppService = productionLineAppService; - _assembleRequestManager = assembleRequestManager; _locationAppService = locationAppService; _balanceAppService = balanceAppService; + _productionLineItemAppService = productionLineItemAppService; } /// - /// 创建后 + /// 创建后 /// /// Event data public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { - var entity = eventData.Entity; - - //if (entity.AutoSubmit) - //{ - // await _assembleRequestManager.SubmitAsync(entity).ConfigureAwait(false); - //} + await Task.CompletedTask.ConfigureAwait(false); } /// - /// 批量创建后 + /// 批量创建后 /// /// Event data public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) { - var entitys = eventData.Entity; - foreach (var entity in entitys) - { - if (entity.AutoSubmit) - { - await _assembleRequestManager.SubmitAsync(entity).ConfigureAwait(false); - } - - } + await Task.CompletedTask.ConfigureAwait(false); } /// - /// 执行后 + /// 执行后 /// /// /// public virtual async Task HandleEventAsync(SfsHandledEntityEventData eventData) { var entity = eventData.Entity; - var assembleJobs = await BuildAssembleJobAsync(entity).ConfigureAwait(false); + + List assembleJobs = new EditableList(); + + switch (entity.Type) + { + case nameof(EnumIssueType.BoxQty): + assembleJobs = await CreateAssembleJobWithBoxQtyTypeAsync(entity).ConfigureAwait(false); + break; + case nameof(EnumIssueType.Qty): + assembleJobs = await CreateAssembleJobWithQtyTypeAsync(entity).ConfigureAwait(false); + break; + } + if (assembleJobs.Any()) { await _assembleJobAppService.CreateManyAsync(assembleJobs).ConfigureAwait(false); @@ -91,17 +89,17 @@ public class AssembleIssueRequestsEventHandler } /// - /// 驳回后 + /// 驳回后 /// /// /// public virtual async Task HandleEventAsync(SfsAbortedEntityEventData eventData) { - + await Task.CompletedTask.ConfigureAwait(false); } /// - /// 完成后 + /// 完成后 /// /// /// @@ -115,24 +113,33 @@ public class AssembleIssueRequestsEventHandler #region 私有 - private async Task> BuildAssembleJobAsync - (AssembleIssueRequests assembleRequest) + #region 按数量叫料 + + /// + /// 创建注塑任务 + /// + /// + /// + /// + private async Task> CreateAssembleJobWithQtyTypeAsync + (AssembleRequest assembleRequest) { var jobs = new List(); - 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 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 assembleRequestDetails = assembleRequest.Details.Where(p => p.ToBeIssuedQty > 0); //所有还没发送物品的集合 + foreach (var assembleRequestDetail in assembleRequestDetails) //如果有还有剩余未叫料的数量 则创建新的任务 { - var toLocation = toLocations.FirstOrDefault(p => p.Code == assembleRequestDetail.ToLocationCode);//判断目标库位是否存在 + var toLocation = + toLocations.FirstOrDefault(p => p.Code == assembleRequestDetail.ToLocationCode); //判断目标库位是否存在 Check.NotNull(toLocation, "库位代码", $"库位 {assembleRequestDetail.ToLocationCode} 不存在"); //创建详情 - var jobDetails = await BuildAssembleJobDetailInputsAsync(assembleRequest, assembleRequestDetail, transactionType, toLocation.LocationGroupCode).ConfigureAwait(false); + var jobDetails = + await CreateAssembleJobDetailInputsWithQtyTypeAsync(assembleRequest, assembleRequestDetail, + toLocation.LocationGroupCode).ConfigureAwait(false); if (!jobDetails.Any()) { continue; @@ -141,11 +148,13 @@ public class AssembleIssueRequestsEventHandler 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)) + if (job == null || job.Details.Any(p => p.RecommendToLocationCode != assembleRequestDetail.ToLocationCode)) { - job = BuildAssembleJobCreateInput(assembleRequest, fromLocation); + job = await BuildAssembleJobCreateInputWithQtyTypeAsync(assembleRequest, fromLocation) + .ConfigureAwait(false); jobs.Add(job); } + job.Details.AddRange(jobDetails); if (assembleRequestDetail.ToBeIssuedQty < 0) { @@ -164,10 +173,10 @@ public class AssembleIssueRequestsEventHandler } - var enableMultipleCreateAssembleJob = await SettingManager.IsTrueAsync(StoreSettings.MaterialRequest.EnableMultipleCreateIssueJob).ConfigureAwait(false); + var enableMultipleCreateAssembleJob = await SettingManager + .IsTrueAsync(StoreSettings.MaterialRequest.EnableMultipleCreateIssueJob).ConfigureAwait(false); if (enableMultipleCreateAssembleJob) { - //assembleRequest.Partial(); } else @@ -175,14 +184,25 @@ public class AssembleIssueRequestsEventHandler var sb = new StringBuilder(); foreach (var openRequestDetail in openRequestDetails) { - sb.AppendLine($"{openRequestDetail.ItemCode}请求数量 {openRequestDetail.Qty},可用库存数量 {openRequestDetail.IssuedQty}"); + sb.AppendLine( + $"{openRequestDetail.ItemCode}请求数量 {openRequestDetail.Qty},可用库存数量 {openRequestDetail.IssuedQty}"); } + throw new UserFriendlyException($"{sb} 可用库存数量不足, 无法生成发料任务"); } + return jobs; } - private AssembleJobEditInput BuildAssembleJobCreateInput(AssembleIssueRequests assembleRequest, LocationDTO fromLocation) + /// + /// 构造注塑任务 + /// + /// + /// + /// + private async Task BuildAssembleJobCreateInputWithQtyTypeAsync( + AssembleRequest assembleRequest, + LocationDTO fromLocation) { AssembleJobEditInput job; job = ObjectMapper.Map(assembleRequest); @@ -190,41 +210,70 @@ public class AssembleIssueRequestsEventHandler job.JobStatus = EnumJobStatus.Open; job.WorkGroupCode = fromLocation.WorkGroupCode; job.WarehouseCode = fromLocation.WarehouseCode; - job.Worker = assembleRequest.Worker; if (string.IsNullOrEmpty(job.Worker)) { job.Worker = "admin"; } - job.AssembleIssueRequestsNumber = assembleRequest.Number; + + job.AssembleRequestNumber = assembleRequest.Number; + + await Task.CompletedTask.ConfigureAwait(false); + return job; } - private async Task> BuildAssembleJobDetailInputsAsync(AssembleIssueRequests assembleRequest, - AssembleIssueRequestsDetail assembleRequestDetail, TransactionTypeDTO transactionType, string toLocationGroupCode) + /// + /// 创建注塑任务明细 + /// + /// + /// + /// + /// + /// + private async Task> CreateAssembleJobDetailInputsWithQtyTypeAsync( + AssembleRequest assembleRequest, + AssembleRequestDetail assembleRequestDetail, string toLocationGroupCode) { var jobDetails = new List(); - var input = new RecommendBalanceRequestInput() + + //获取推荐库存 + var productionLineDto = await _productionLineAppService + .GetByLocationCodeAsync(assembleRequestDetail.ToLocationCode).ConfigureAwait(false); + var productionLineItemDtos = await _productionLineItemAppService + .GetByProductLineCodeAsync(productionLineDto.Code).ConfigureAwait(false); + if (productionLineItemDtos == null) + { + throw new UserFriendlyException($"物品代码【{assembleRequestDetail.ItemCode}】没有对应的【生产线物品关系】"); + } + + var productionLineItemDto = + productionLineItemDtos.FirstOrDefault(p => p.ItemCode == assembleRequestDetail.ItemCode); + var input = new RecommendBalanceRequestInput { ItemCode = assembleRequestDetail.ItemCode, Qty = assembleRequestDetail.ToBeIssuedQty, - LocationTypes = transactionType.OutLocationTypes, - - Statuses = transactionType.OutInventoryStatuses, + //LocationTypes = transactionType.OutLocationTypes, productionLineItemDto.RawLocationCodeListJson + Statuses = new EditableList { EnumInventoryStatus.OK }, + Locations = JsonSerializer.Deserialize>(productionLineItemDto.RawLocationCodeListJson) }; - //获取推荐库存 - var recommendList = await _balanceAppService.GetRecommendBalancesAsync(input).ConfigureAwait(false); + + var recommendList = await _balanceAppService.GetRecommendBalancesByLocationsAsync(input).ConfigureAwait(false); //没有推荐库存时 跳过此明细 不生成任务 if (recommendList.Count != 0) { foreach (var recommend in recommendList) { //拿走需求量 - var detail = await BuildAssembleJobDetailAsync(assembleRequestDetail, recommend, toLocationGroupCode).ConfigureAwait(false); + var detail = + await BuildAssembleJobDetailWithQtyTypeAsync(assembleRequestDetail, recommend, + toLocationGroupCode) + .ConfigureAwait(false); if (assembleRequest.UseOnTheWayLocation) { //获取在途库 - var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false); + var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT) + .ConfigureAwait(false); detail.OnTheWayLocationCode = locationDto.Code; } @@ -233,49 +282,231 @@ public class AssembleIssueRequestsEventHandler assembleRequestDetail.IssuedQty += recommend.Qty; //await _assembleRequestManager.UpdateDetailsAsync(assembleRequest).ConfigureAwait(false); - } } + return jobDetails; } - private async Task BuildAssembleJobDetailAsync(AssembleIssueRequestsDetail assembleRequestDetail, BalanceDTO balance, string toLocationGroupCode) + /// + /// 构造注塑任务明细 + /// + /// + /// + /// + /// + private async Task BuildAssembleJobDetailWithQtyTypeAsync( + AssembleRequestDetail assembleRequestDetail, BalanceDTO balance, string toLocationGroupCode) { - //ProductionLineDTO prodLine = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationGroupCode).ConfigureAwait(false); var detail = ObjectMapper.Map(balance); - detail.RequestLocationCode = assembleRequestDetail.ToLocationCode; + detail.RequestLocationCode = assembleRequestDetail.ToLocationCode; 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.RecommendFromPackingCode = balance.PackingCode; + detail.RecommendFromContainerCode = balance.ContainerCode; + detail.RecommendFromSupplierBatch = balance.SupplierBatch; + detail.RecommendFromProduceDate = balance.ProduceDate; + detail.RecommendFromExpireDate = balance.ExpireDate; + detail.RecommendFromLot = balance.Lot; + detail.RecommendFromProduceDate = balance.ProduceDate; + detail.RecommendFromArriveDate = 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.RecommendFromQty = balance.Qty; detail.Uom = balance.Uom; - detail.ToLocationCode = assembleRequestDetail.ToLocationCode; - detail.ToLocationErpCode = assembleRequestDetail.ToLocationErpCode; - detail.ToLocationArea = assembleRequestDetail.ToLocationArea; - detail.ToWarehouseCode = assembleRequestDetail.ToWarehouseCode; + detail.RecommendToLocationCode = assembleRequestDetail.ToLocationCode; + detail.RecommendToLocationErpCode = assembleRequestDetail.ToLocationErpCode; + detail.RecommendToLocationArea = assembleRequestDetail.ToLocationArea; + detail.RecommendToWarehouseCode = assembleRequestDetail.ToWarehouseCode; //detail.ProdLine = prodLine == null ? toLocationGroupCode : prodLine.Code; detail.ProdLine = toLocationGroupCode; await Task.CompletedTask.ConfigureAwait(false); return detail; + } + + #endregion + + #region 按箱叫料 + + /// + /// 创建注塑任务 + /// + /// + /// + /// + private async Task> CreateAssembleJobWithBoxQtyTypeAsync + (AssembleRequest assembleRequest) + { + var inputJobs = new List(); + var inputExpectOutEditInput = new ExpectOutEditInput(); + //已用的库存的箱码集合 + var useBalanceList = new List(); + + var groupByItemCodeAndLocationCode = + assembleRequest.Details.GroupBy(p => new { p.ItemCode, p.ToLocationCode }); + + foreach (var locationCodeItemCodeGroup in groupByItemCodeAndLocationCode) + { + var inputDetails = assembleRequest.Details.Where(p => + p.ItemCode == locationCodeItemCodeGroup.Key.ItemCode && + p.ToLocationCode == locationCodeItemCodeGroup.Key.ToLocationCode); + var inputDetailTemplate = inputDetails.First(); + //获取请求下 这个零件和这个库位一个需要多少箱 + var sumBoxQty = inputDetails.Sum(p => p.BoxQty); + //获取生产线 + var productionLineDto = await _productionLineAppService + .GetByLocationCodeAsync(inputDetails.First().ToLocationCode).ConfigureAwait(false); + if (productionLineDto == null) + { + throw new UserFriendlyException($"库位【{inputDetailTemplate.ToLocationCode}】没有对应的【生产线】"); + } + + var productLineCodeAndItemCode = await _productionLineItemAppService + .GetByProductLineCodeAndItemCodeAsync(productionLineDto.Code, inputDetailTemplate.ItemCode) + .ConfigureAwait(false); + if (productLineCodeAndItemCode == null) + { + throw new UserFriendlyException( + $"物品代码【{inputDetailTemplate.ItemCode}】在生产线【{productionLineDto.Code}】中没有对应的【生产线物品关系】"); + } + + //获取可用库存 + var input = new RecommendBalanceRequestInput + { + ItemCode = locationCodeItemCodeGroup.Key.ItemCode, + Qty = decimal.MaxValue, + Statuses = new EditableList { EnumInventoryStatus.OK }, + Locations = JsonSerializer.Deserialize>(productLineCodeAndItemCode + .RawLocationCodeListJson) + }; + var usableList = await _balanceAppService.GetUsableListAsync(input).ConfigureAwait(false); + usableList = usableList.Where(p => !useBalanceList.Contains(p.PackingCode)).ToList(); + if (usableList.Any()) + { + for (var i = 0; i < sumBoxQty; i++) + { + var firstUsable = usableList.First(); + useBalanceList.Add(firstUsable.PackingCode); + usableList.Remove(firstUsable); + + var assembleJobEditInput = + await BuildAssembleJobCreateInputWithBoxQtyTypeAsync(assembleRequest, inputDetailTemplate, + firstUsable) + .ConfigureAwait(false); + + inputJobs.Add(assembleJobEditInput); + } + } + } + return inputJobs; } + /// + /// 构造注塑任务 + /// + /// + /// + /// + /// + private async Task BuildAssembleJobCreateInputWithBoxQtyTypeAsync( + AssembleRequest assembleRequest, + AssembleRequestDetail assembleRequestDetail, BalanceDTO balanceDtos) + { + var job = ObjectMapper.Map(assembleRequest); + job.JobType = EnumJobType.IssueJob; + job.JobStatus = EnumJobStatus.Open; + job.WorkGroupCode = assembleRequestDetail.ToLocationGroup; + job.WarehouseCode = assembleRequestDetail.ToWarehouseCode; + job.Worker = assembleRequest.Worker; + job.AssembleRequestNumber = assembleRequest.Number; + + job.Details.Add(await BuildAssembleJobDetailWithBoxQtyTypeAsync(assembleRequestDetail, balanceDtos) + .ConfigureAwait(false)); + + await Task.CompletedTask.ConfigureAwait(false); + + return job; + } + + /// + /// 构造注塑任务明细 + /// + /// + /// + /// + /// + private async Task BuildAssembleJobDetailWithBoxQtyTypeAsync( + AssembleRequestDetail assembleRequestDetail, BalanceDTO balance) + { + var detail = new AssembleJobDetailInput(); + detail.RequestLocationCode = assembleRequestDetail.ToLocationCode; + detail.RequestLocationGroup = assembleRequestDetail.ToLocationGroup; + detail.RequestLocationArea = assembleRequestDetail.ToLocationArea; + detail.RequestLocationErpCode = assembleRequestDetail.ToLocationErpCode; + detail.RequestWarehouseCode = assembleRequestDetail.ToWarehouseCode; + + detail.PositionCode = assembleRequestDetail.PositionCode; + detail.RecommendType = assembleRequestDetail.RecommendType; + detail.ProdLine = assembleRequestDetail.ToLocationCode; + + detail.ItemCode = assembleRequestDetail.ItemCode; + detail.ItemName = assembleRequestDetail.ItemName; + detail.ItemDesc1 = assembleRequestDetail.ItemDesc1; + detail.ItemDesc2 = assembleRequestDetail.ItemDesc2; + + detail.Status = EnumInventoryStatus.OK; + detail.Uom = balance.Uom; + + detail.RecommendFromPackingCode = balance.PackingCode; + detail.RecommendFromContainerCode = balance.ContainerCode; + detail.RecommendFromLot = balance.Lot; + + detail.RecommendFromQty = balance.Qty; + + detail.RecommendFromSupplierBatch = balance.SupplierBatch; + detail.RecommendFromProduceDate = balance.ProduceDate; + detail.RecommendFromExpireDate = balance.ExpireDate; + detail.RecommendFromProduceDate = balance.ProduceDate; + detail.RecommendFromArriveDate = balance.ArriveDate; + + detail.RecommendFromLocationArea = balance.LocationArea; + detail.RecommendFromLocationCode = balance.LocationCode; + detail.RecommendFromLocationErpCode = balance.LocationErpCode; + detail.RecommendFromLocationGroup = balance.LocationGroup; + detail.RecommendFromWarehouseCode = balance.WarehouseCode; + + detail.RecommendToPackingCode = balance.PackingCode; + detail.RecommendToContainerCode = balance.ContainerCode; + detail.RecommendToLot = balance.Lot; + + detail.RecommendToQty = balance.Qty; + + detail.RecommendToSupplierBatch = balance.SupplierBatch; + detail.RecommendToProduceDate = balance.ProduceDate; + detail.RecommendToExpireDate = balance.ExpireDate; + detail.RecommendToProduceDate = balance.ProduceDate; + detail.RecommendToArriveDate = balance.ArriveDate; + + detail.RecommendToLocationCode = assembleRequestDetail.ToLocationCode; + detail.RecommendToLocationErpCode = assembleRequestDetail.ToLocationErpCode; + detail.RecommendToLocationArea = assembleRequestDetail.ToLocationArea; + detail.RecommendToWarehouseCode = assembleRequestDetail.ToWarehouseCode; + detail.RecommendToLocationGroup = assembleRequestDetail.ToLocationGroup; + + await Task.CompletedTask.ConfigureAwait(false); + return detail; + } + + #endregion + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingMaterialRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingMaterialRequestEventHandler.cs index b5fb25d5e..3189a4e5b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingMaterialRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingMaterialRequestEventHandler.cs @@ -1,13 +1,14 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.Json; using System.Threading.Tasks; -using FluentValidation.Validators; +using Castle.Components.DictionaryAdapter; 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.Domain.Shared.Enums.Store; using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; @@ -20,125 +21,127 @@ namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; public class CoatingMaterialRequestEventHandler : StoreEventHandlerBase - , ILocalEventHandler> - , ILocalEventHandler> - , ILocalEventHandler> - , ILocalEventHandler> - , ILocalEventHandler>> + , ILocalEventHandler> + , ILocalEventHandler> + , ILocalEventHandler> + , ILocalEventHandler> + , ILocalEventHandler>> { - private readonly ICoatingIssueJobAppService _issueJobAppService; + private readonly ICoatingIssueJobAppService _coatingIssueJobAppService; private readonly IProductionLineAppService _productionLineAppService; - private readonly ICoatingMaterialRequestManager _CoatingMaterialRequestManager; + private readonly IProductionLineItemAppService _productionLineItemAppService; private readonly ILocationAppService _locationAppService; private readonly IBalanceAppService _balanceAppService; public CoatingMaterialRequestEventHandler( - ICoatingIssueJobAppService issueJobAppService - , IProductionLineAppService productionLineAppService - , ICoatingMaterialRequestManager CoatingMaterialRequestManager - , ILocationAppService locationAppService - , IBalanceAppService balanceAppService) + ICoatingIssueJobAppService coatingIssueJobAppService, IProductionLineAppService productionLineAppService, + ILocationAppService locationAppService, + IBalanceAppService balanceAppService, IProductionLineItemAppService productionLineItemAppService) { - _issueJobAppService = issueJobAppService; + _coatingIssueJobAppService = coatingIssueJobAppService; _productionLineAppService = productionLineAppService; - _CoatingMaterialRequestManager = CoatingMaterialRequestManager; _locationAppService = locationAppService; _balanceAppService = balanceAppService; + _productionLineItemAppService = productionLineItemAppService; } /// - /// 创建后 + /// 创建后 /// /// Event data public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { - var entity = eventData.Entity; - - //if (entity.AutoSubmit) - //{ - // await _CoatingMaterialRequestManager.SubmitAsync(entity).ConfigureAwait(false); - //} + await Task.CompletedTask.ConfigureAwait(false); } /// - /// 批量创建后 + /// 批量创建后 /// /// Event data public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) { - var entitys = eventData.Entity; - foreach (var entity in entitys) - { - if (entity.AutoSubmit) - { - await _CoatingMaterialRequestManager.SubmitAsync(entity).ConfigureAwait(false); - } - if (entity.Type == EnumMaterialRequestType.Issue_WIP.ToString()) - { - await _CoatingMaterialRequestManager.SubmitAsync(entity).ConfigureAwait(false); - } - } + await Task.CompletedTask.ConfigureAwait(false); } /// - /// 执行后 + /// 执行后 /// /// /// public virtual async Task HandleEventAsync(SfsHandledEntityEventData eventData) { var entity = eventData.Entity; - var issueJobs = await BuildIssueJobAsync(entity).ConfigureAwait(false); - if (issueJobs.Any()) + + List coatingIssueJobs = new EditableList(); + + switch (entity.Type) + { + case nameof(EnumIssueType.BoxQty): + coatingIssueJobs = await CreateCoatingIssueJobWithBoxQtyTypeAsync(entity).ConfigureAwait(false); + break; + case nameof(EnumIssueType.Qty): + coatingIssueJobs = await CreateCoatingIssueJobWithQtyTypeAsync(entity).ConfigureAwait(false); + break; + } + + if (coatingIssueJobs.Any()) { - await _issueJobAppService.CreateManyAsync(issueJobs).ConfigureAwait(false); + await _coatingIssueJobAppService.CreateManyAsync(coatingIssueJobs).ConfigureAwait(false); } } /// - /// 驳回后 + /// 驳回后 /// /// /// public virtual async Task HandleEventAsync(SfsAbortedEntityEventData eventData) { - var entity = eventData.Entity; - await _issueJobAppService.CancelByMaterialRequestAsync(entity.Number).ConfigureAwait(false); + await Task.CompletedTask.ConfigureAwait(false); } /// - /// 完成后 + /// 完成后 /// /// /// public virtual async Task HandleEventAsync(SfsCompletedEntityEventData eventData) { _ = eventData.Entity; - // await _issueJobAppService.CompleteByCoatingMaterialRequestAsync(entity.Number); + // await _coatingIssueJobAppService.CompleteByCoatingMaterialRequestAsync(entity.Number); await Task.CompletedTask.ConfigureAwait(false); } #region 私有 - private async Task> BuildIssueJobAsync - (CoatingMaterialRequest CoatingMaterialRequest) + #region 按数量叫料 + + /// + /// 创建注塑任务 + /// + /// + /// + /// + private async Task> CreateCoatingIssueJobWithQtyTypeAsync + (CoatingMaterialRequest coatingMaterialRequest) { var jobs = new List(); - var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false);//库存事务 - - var toLocationCodes = CoatingMaterialRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList();//所有发送库位的集合 - var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false);//所有库位的集合 + var toLocationCodes = coatingMaterialRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList(); //所有发送库位的集合 + var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false); //所有库位的集合 - var CoatingMaterialRequestDetails = CoatingMaterialRequest.Details.Where(p => p.ToBeIssuedQty > 0);//所有还没发送物品的集合 - foreach (var CoatingMaterialRequestDetail in CoatingMaterialRequestDetails)//如果有还有剩余未叫料的数量 则创建新的任务 + var coatingMaterialRequestDetails = coatingMaterialRequest.Details.Where(p => p.ToBeIssuedQty > 0); //所有还没发送物品的集合 + foreach (var coatingMaterialRequestDetail in coatingMaterialRequestDetails) //如果有还有剩余未叫料的数量 则创建新的任务 { - var toLocation = toLocations.FirstOrDefault(p => p.Code == CoatingMaterialRequestDetail.ToLocationCode);//判断目标库位是否存在 - Check.NotNull(toLocation, "库位代码", $"库位 {CoatingMaterialRequestDetail.ToLocationCode} 不存在"); + var toLocation = + toLocations.FirstOrDefault(p => p.Code == coatingMaterialRequestDetail.ToLocationCode); //判断目标库位是否存在 + Check.NotNull(toLocation, "库位代码", $"库位 {coatingMaterialRequestDetail.ToLocationCode} 不存在"); //创建详情 - var jobDetails = await BuildIssueJobDetailInputsAsync(CoatingMaterialRequest, CoatingMaterialRequestDetail, transactionType, toLocation.LocationGroupCode).ConfigureAwait(false); + var jobDetails = + await CreateCoatingIssueJobDetailInputsWithQtyTypeAsync(coatingMaterialRequest, coatingMaterialRequestDetail, + toLocation.LocationGroupCode).ConfigureAwait(false); if (!jobDetails.Any()) { continue; @@ -147,159 +150,365 @@ public class CoatingMaterialRequestEventHandler 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 != CoatingMaterialRequestDetail.ToLocationCode)) + if (job == null || job.Details.Any(p => p.RecommendToLocationCode != coatingMaterialRequestDetail.ToLocationCode)) { - job = BuildIssueJobCreateInput(CoatingMaterialRequest, fromLocation); + job = await BuildCoatingIssueJobCreateInputWithQtyTypeAsync(coatingMaterialRequest, fromLocation) + .ConfigureAwait(false); jobs.Add(job); } + job.Details.AddRange(jobDetails); - if (CoatingMaterialRequestDetail.ToBeIssuedQty < 0) + if (coatingMaterialRequestDetail.ToBeIssuedQty < 0) { - CoatingMaterialRequestDetail.Status = EnumStatus.Close; + coatingMaterialRequestDetail.Status = EnumStatus.Close; } } jobs = jobs.Where(p => p.Details.Any()).ToList(); var openRequestDetails = - CoatingMaterialRequest.Details.Where(p => p.Status != EnumStatus.Close).ToList(); + coatingMaterialRequest.Details.Where(p => p.Status != EnumStatus.Close).ToList(); if (!openRequestDetails.Any()) { return jobs; } - var enableMultipleCreateIssueJob = await SettingManager.IsTrueAsync(StoreSettings.MaterialRequest.EnableMultipleCreateIssueJob).ConfigureAwait(false); - if (enableMultipleCreateIssueJob) + + var enableMultipleCreateCoatingIssueJob = await SettingManager + .IsTrueAsync(StoreSettings.MaterialRequest.EnableMultipleCreateIssueJob).ConfigureAwait(false); + if (enableMultipleCreateCoatingIssueJob) { - CoatingMaterialRequest.Partial(); + //coatingMaterialRequest.Partial(); } else { var sb = new StringBuilder(); foreach (var openRequestDetail in openRequestDetails) { - sb.AppendLine($"{openRequestDetail.ItemCode}请求数量 {openRequestDetail.Qty},可用库存数量 {openRequestDetail.IssuedQty}"); + sb.AppendLine( + $"{openRequestDetail.ItemCode}请求数量 {openRequestDetail.Qty},可用库存数量 {openRequestDetail.IssuedQty}"); } + throw new UserFriendlyException($"{sb} 可用库存数量不足, 无法生成发料任务"); } + return jobs; } - private CoatingIssueJobEditInput BuildIssueJobCreateInput(CoatingMaterialRequest CoatingMaterialRequest, LocationDTO fromLocation) + /// + /// 构造注塑任务 + /// + /// + /// + /// + private async Task BuildCoatingIssueJobCreateInputWithQtyTypeAsync( + CoatingMaterialRequest coatingMaterialRequest, + LocationDTO fromLocation) { CoatingIssueJobEditInput job; - job = ObjectMapper.Map(CoatingMaterialRequest); + job = ObjectMapper.Map(coatingMaterialRequest); job.JobType = EnumJobType.IssueJob; job.JobStatus = EnumJobStatus.Open; job.WorkGroupCode = fromLocation.WorkGroupCode; job.WarehouseCode = fromLocation.WarehouseCode; - - job.Worker = CoatingMaterialRequest.Worker; - job.MaterialRequestNumber = CoatingMaterialRequest.Number; + job.Worker = coatingMaterialRequest.Worker; + if (string.IsNullOrEmpty(job.Worker)) + { + job.Worker = "admin"; + } + + job.MaterialRequestNumber = coatingMaterialRequest.Number; + + await Task.CompletedTask.ConfigureAwait(false); + return job; } - private async Task> BuildIssueJobDetailInputsAsync(CoatingMaterialRequest CoatingMaterialRequest, - CoatingMaterialRequestDetail CoatingMaterialRequestDetail, TransactionTypeDTO transactionType, string toLocationGroupCode) + /// + /// 创建注塑任务明细 + /// + /// + /// + /// + /// + /// + private async Task> CreateCoatingIssueJobDetailInputsWithQtyTypeAsync( + CoatingMaterialRequest coatingMaterialRequest, + CoatingMaterialRequestDetail coatingMaterialRequestDetail, string toLocationGroupCode) { var jobDetails = new List(); - var input = new RecommendBalanceRequestInput() + + //获取推荐库存 + var productionLineDto = await _productionLineAppService + .GetByLocationCodeAsync(coatingMaterialRequestDetail.ToLocationCode).ConfigureAwait(false); + var productionLineItemDtos = await _productionLineItemAppService + .GetByProductLineCodeAsync(productionLineDto.Code).ConfigureAwait(false); + if (productionLineItemDtos == null) { - ItemCode = CoatingMaterialRequestDetail.ItemCode, - Qty = CoatingMaterialRequestDetail.ToBeIssuedQty, - LocationTypes = transactionType.OutLocationTypes, - - Statuses = transactionType.OutInventoryStatuses, + throw new UserFriendlyException($"物品代码【{coatingMaterialRequestDetail.ItemCode}】没有对应的【生产线物品关系】"); + } + + var productionLineItemDto = + productionLineItemDtos.FirstOrDefault(p => p.ItemCode == coatingMaterialRequestDetail.ItemCode); + var input = new RecommendBalanceRequestInput + { + ItemCode = coatingMaterialRequestDetail.ItemCode, + Qty = coatingMaterialRequestDetail.ToBeIssuedQty, + //LocationTypes = transactionType.OutLocationTypes, productionLineItemDto.RawLocationCodeListJson + Statuses = new EditableList { EnumInventoryStatus.OK }, + Locations = JsonSerializer.Deserialize>(productionLineItemDto.RawLocationCodeListJson) }; - //获取推荐库存 - var recommendList = await _balanceAppService.GetRecommendBalancesAsync(input).ConfigureAwait(false); + + var recommendList = await _balanceAppService.GetRecommendBalancesByLocationsAsync(input).ConfigureAwait(false); //没有推荐库存时 跳过此明细 不生成任务 if (recommendList.Count != 0) { foreach (var recommend in recommendList) { //拿走需求量 - var detail = await BuildIssueJobDetailAsync(CoatingMaterialRequestDetail, recommend, toLocationGroupCode).ConfigureAwait(false); - if (CoatingMaterialRequest.UseOnTheWayLocation) + var detail = + await BuildCoatingIssueJobDetailWithQtyTypeAsync(coatingMaterialRequestDetail, recommend, + toLocationGroupCode) + .ConfigureAwait(false); + if (coatingMaterialRequest.UseOnTheWayLocation) { //获取在途库 - var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false); + var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT) + .ConfigureAwait(false); detail.OnTheWayLocationCode = locationDto.Code; } jobDetails.Add(detail); - CoatingMaterialRequestDetail.IssuedQty += recommend.Qty; - + coatingMaterialRequestDetail.IssuedQty += recommend.Qty; + //await _coatingMaterialRequestManager.UpdateDetailsAsync(coatingMaterialRequest).ConfigureAwait(false); } } + return jobDetails; } - private async Task BuildIssueJobDetailAsync(CoatingMaterialRequestDetail CoatingMaterialRequestDetail, BalanceDTO balance, string toLocationGroupCode) + /// + /// 构造注塑任务明细 + /// + /// + /// + /// + /// + private async Task BuildCoatingIssueJobDetailWithQtyTypeAsync( + CoatingMaterialRequestDetail coatingMaterialRequestDetail, BalanceDTO balance, string toLocationGroupCode) { //ProductionLineDTO prodLine = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationGroupCode).ConfigureAwait(false); var detail = ObjectMapper.Map(balance); - detail.RequestLocationCode = CoatingMaterialRequestDetail.ToLocationCode; - detail.PositionCode = CoatingMaterialRequestDetail.PositionCode; - detail.RecommendType = CoatingMaterialRequestDetail.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.RequestLocationCode = coatingMaterialRequestDetail.ToLocationCode; + detail.PositionCode = coatingMaterialRequestDetail.PositionCode; + detail.RecommendType = coatingMaterialRequestDetail.RecommendType; + + detail.RecommendFromPackingCode = balance.PackingCode; + detail.RecommendFromContainerCode = balance.ContainerCode; + detail.RecommendFromSupplierBatch = balance.SupplierBatch; + detail.RecommendFromProduceDate = balance.ProduceDate; + detail.RecommendFromExpireDate = balance.ExpireDate; + detail.RecommendFromLot = balance.Lot; + detail.RecommendFromProduceDate = balance.ProduceDate; + detail.RecommendFromArriveDate = 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.RecommendFromQty = balance.Qty; detail.Uom = balance.Uom; - detail.ToLocationCode = CoatingMaterialRequestDetail.ToLocationCode; - detail.ToLocationErpCode = CoatingMaterialRequestDetail.ToLocationErpCode; - detail.ToLocationArea = CoatingMaterialRequestDetail.ToLocationArea; - detail.ToWarehouseCode = CoatingMaterialRequestDetail.ToWarehouseCode; - detail.ToLocationGroup = CoatingMaterialRequestDetail.ToLocationGroup; - //detail.Operation = //TODO - //detail.DistributionType =//TODO - //detail.TruncType = //TODO - //detail.RoundedQty =//TODO - //detail.PlannedSplitRule = //TODO - //detail.PlanBeginTime = //TODO - //detaiol.DeliveryQty = //TODO - - // var detail = ObjectMapper.Map(CoatingMaterialRequestDetail); - // - // detail.RecommendPackingCode = balance.PackingCode; - // detail.RecommendContainerCode = balance.ContainerCode; - // detail.RecommendLot = balance.Lot; - // detail.RecommendLocationCode = balance.LocationCode; - // detail.RecommendLocationArea = balance.LocationArea; - // detail.RecommendLocationGroup = balance.LocationGroup; - // detail.RecommendLocationErpCode = balance.LocationErpCode; - // detail.WarehouseCode = balance.WarehouseCode; - // detail.Status = balance.Status; - // detail.RecommendSupplierBatch = balance.SupplierBatch; - // detail.RecommendArriveDate = balance.ArriveDate; - // detail.RecommendProduceDate = balance.ProduceDate; - // detail.RecommendExpireDate = balance.ExpireDate; - // detail.RecommendQty = balance.Qty; - // detail.RecommendUom = balance.Uom; - - // detail.ProdLine = prodLine == null ? toLocationGroupCode : prodLine.Code; + detail.RecommendToLocationCode = coatingMaterialRequestDetail.ToLocationCode; + detail.RecommendToLocationErpCode = coatingMaterialRequestDetail.ToLocationErpCode; + detail.RecommendToLocationArea = coatingMaterialRequestDetail.ToLocationArea; + detail.RecommendToWarehouseCode = coatingMaterialRequestDetail.ToWarehouseCode; + + //detail.ProdLine = prodLine == null ? toLocationGroupCode : prodLine.Code; detail.ProdLine = toLocationGroupCode; - await Task.CompletedTask.ConfigureAwait(false); + await Task.CompletedTask.ConfigureAwait(false); return detail; + } + + #endregion + + #region 按箱叫料 + /// + /// 创建注塑任务 + /// + /// + /// + /// + private async Task> CreateCoatingIssueJobWithBoxQtyTypeAsync + (CoatingMaterialRequest coatingMaterialRequest) + { + var inputJobs = new List(); + var inputExpectOutEditInput = new ExpectOutEditInput(); + //已用的库存的箱码集合 + var useBalanceList = new List(); + + var groupByItemCodeAndLocationCode = + coatingMaterialRequest.Details.GroupBy(p => new { p.ItemCode, p.ToLocationCode }); + + foreach (var locationCodeItemCodeGroup in groupByItemCodeAndLocationCode) + { + var inputDetails = coatingMaterialRequest.Details.Where(p => + p.ItemCode == locationCodeItemCodeGroup.Key.ItemCode && + p.ToLocationCode == locationCodeItemCodeGroup.Key.ToLocationCode); + var inputDetailTemplate = inputDetails.First(); + //获取请求下 这个零件和这个库位一个需要多少箱 + var sumBoxQty = inputDetails.Sum(p => p.BoxQty); + //获取生产线 + var productionLineDto = await _productionLineAppService + .GetByLocationCodeAsync(inputDetails.First().ToLocationCode).ConfigureAwait(false); + if (productionLineDto == null) + { + throw new UserFriendlyException($"库位【{inputDetailTemplate.ToLocationCode}】没有对应的【生产线】"); + } + + var productLineCodeAndItemCode = await _productionLineItemAppService + .GetByProductLineCodeAndItemCodeAsync(productionLineDto.Code, inputDetailTemplate.ItemCode) + .ConfigureAwait(false); + if (productLineCodeAndItemCode == null) + { + throw new UserFriendlyException( + $"物品代码【{inputDetailTemplate.ItemCode}】在生产线【{productionLineDto.Code}】中没有对应的【生产线物品关系】"); + } + + //获取可用库存 + var input = new RecommendBalanceRequestInput + { + ItemCode = locationCodeItemCodeGroup.Key.ItemCode, + Qty = decimal.MaxValue, + Statuses = new EditableList { EnumInventoryStatus.OK }, + Locations = JsonSerializer.Deserialize>(productLineCodeAndItemCode + .RawLocationCodeListJson) + }; + var usableList = await _balanceAppService.GetUsableListAsync(input).ConfigureAwait(false); + usableList = usableList.Where(p => !useBalanceList.Contains(p.PackingCode)).ToList(); + if (usableList.Any()) + { + for (var i = 0; i < sumBoxQty; i++) + { + var firstUsable = usableList.First(); + useBalanceList.Add(firstUsable.PackingCode); + usableList.Remove(firstUsable); + + var coatingIssueJobEditInput = + await BuildCoatingIssueJobCreateInputWithBoxQtyTypeAsync(coatingMaterialRequest, inputDetailTemplate, + firstUsable) + .ConfigureAwait(false); + + inputJobs.Add(coatingIssueJobEditInput); + } + } + } + + return inputJobs; } + /// + /// 构造注塑任务 + /// + /// + /// + /// + /// + private async Task BuildCoatingIssueJobCreateInputWithBoxQtyTypeAsync( + CoatingMaterialRequest coatingMaterialRequest, + CoatingMaterialRequestDetail coatingMaterialRequestDetail, BalanceDTO balanceDtos) + { + var job = ObjectMapper.Map(coatingMaterialRequest); + job.JobType = EnumJobType.IssueJob; + job.JobStatus = EnumJobStatus.Open; + job.WorkGroupCode = coatingMaterialRequestDetail.ToLocationGroup; + job.WarehouseCode = coatingMaterialRequestDetail.ToWarehouseCode; + job.Worker = coatingMaterialRequest.Worker; + job.MaterialRequestNumber = coatingMaterialRequest.Number; + + job.Details.Add(await BuildCoatingIssueJobDetailWithBoxQtyTypeAsync(coatingMaterialRequestDetail, balanceDtos) + .ConfigureAwait(false)); + + await Task.CompletedTask.ConfigureAwait(false); + + return job; + } + + /// + /// 构造注塑任务明细 + /// + /// + /// + /// + /// + private async Task BuildCoatingIssueJobDetailWithBoxQtyTypeAsync( + CoatingMaterialRequestDetail coatingMaterialRequestDetail, BalanceDTO balance) + { + var detail = new CoatingIssueJobDetailInput(); + detail.RequestLocationCode = coatingMaterialRequestDetail.ToLocationCode; + detail.RequestLocationGroup = coatingMaterialRequestDetail.ToLocationGroup; + detail.RequestLocationArea = coatingMaterialRequestDetail.ToLocationArea; + detail.RequestLocationErpCode = coatingMaterialRequestDetail.ToLocationErpCode; + detail.RequestWarehouseCode = coatingMaterialRequestDetail.ToWarehouseCode; + + detail.PositionCode = coatingMaterialRequestDetail.PositionCode; + detail.RecommendType = coatingMaterialRequestDetail.RecommendType; + detail.ProdLine = coatingMaterialRequestDetail.ToLocationCode; + + detail.ItemCode = coatingMaterialRequestDetail.ItemCode; + detail.ItemName = coatingMaterialRequestDetail.ItemName; + detail.ItemDesc1 = coatingMaterialRequestDetail.ItemDesc1; + detail.ItemDesc2 = coatingMaterialRequestDetail.ItemDesc2; + + detail.Status = EnumInventoryStatus.OK; + detail.Uom = balance.Uom; + + detail.RecommendFromPackingCode = balance.PackingCode; + detail.RecommendFromContainerCode = balance.ContainerCode; + detail.RecommendFromLot = balance.Lot; + + detail.RecommendFromQty = balance.Qty; + + detail.RecommendFromSupplierBatch = balance.SupplierBatch; + detail.RecommendFromProduceDate = balance.ProduceDate; + detail.RecommendFromExpireDate = balance.ExpireDate; + detail.RecommendFromProduceDate = balance.ProduceDate; + detail.RecommendFromArriveDate = balance.ArriveDate; + + detail.RecommendFromLocationArea = balance.LocationArea; + detail.RecommendFromLocationCode = balance.LocationCode; + detail.RecommendFromLocationErpCode = balance.LocationErpCode; + detail.RecommendFromLocationGroup = balance.LocationGroup; + detail.RecommendFromWarehouseCode = balance.WarehouseCode; + + detail.RecommendToPackingCode = balance.PackingCode; + detail.RecommendToContainerCode = balance.ContainerCode; + detail.RecommendToLot = balance.Lot; + + detail.RecommendToQty = balance.Qty; + + detail.RecommendToSupplierBatch = balance.SupplierBatch; + detail.RecommendToProduceDate = balance.ProduceDate; + detail.RecommendToExpireDate = balance.ExpireDate; + detail.RecommendToProduceDate = balance.ProduceDate; + detail.RecommendToArriveDate = balance.ArriveDate; + + detail.RecommendToLocationCode = coatingMaterialRequestDetail.ToLocationCode; + detail.RecommendToLocationErpCode = coatingMaterialRequestDetail.ToLocationErpCode; + detail.RecommendToLocationArea = coatingMaterialRequestDetail.ToLocationArea; + detail.RecommendToWarehouseCode = coatingMaterialRequestDetail.ToWarehouseCode; + detail.RecommendToLocationGroup = coatingMaterialRequestDetail.ToLocationGroup; + + await Task.CompletedTask.ConfigureAwait(false); + return detail; + } + + #endregion + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/CoatingIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/CoatingIssueNoteEventHandler.cs index d0b3ae53f..c53ed8426 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/CoatingIssueNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/CoatingIssueNoteEventHandler.cs @@ -73,28 +73,28 @@ public class CoatingIssueNoteEventHandler private async Task UpdateReceivedQtyMaterialRequestAsync(CoatingIssueNote entity) { - var receiveQtyGroup = entity.Details - .GroupBy(p => new { p.ItemCode, p.ToLocationCode }) - .Select(p => new { p.Key.ItemCode, p.Key.ToLocationCode, Qty = p.Sum(d => d.Qty) }) - .ToList(); + //var receiveQtyGroup = entity.Details + // .GroupBy(p => new { p.ItemCode, p.ToLocationCode }) + // .Select(p => new { p.Key.ItemCode, p.Key.ToLocationCode, Qty = p.Sum(d => d.Qty) }) + // .ToList(); - var materialRequest = await _materialRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false); + //var materialRequest = await _materialRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false); - if (entity.RequestType != EnumMaterialRequestType.Issue_Direct.ToString()) - { - //更新叫料请求的已收数量 - foreach (var materialRequestDetail in materialRequest.Details) - { - var receiveQty = receiveQtyGroup.FirstOrDefault(p => - p.ItemCode == materialRequestDetail.ItemCode && - p.ToLocationCode == materialRequestDetail.ToLocationCode)?.Qty; - if (receiveQty != null) - { - materialRequestDetail.ReceivedQty += receiveQty.Value; - } - } + //if (entity.RequestType != EnumMaterialRequestType.Issue_Direct.ToString()) + //{ + // //更新叫料请求的已收数量 + // foreach (var materialRequestDetail in materialRequest.Details) + // { + // var receiveQty = receiveQtyGroup.FirstOrDefault(p => + // p.ItemCode == materialRequestDetail.ItemCode && + // p.ToLocationCode == materialRequestDetail.ToLocationCode)?.Qty; + // if (receiveQty != null) + // { + // materialRequestDetail.ReceivedQty += receiveQty.Value; + // } + // } - } + //} } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/AssembleNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/AssembleNoteEventHandler.cs new file mode 100644 index 000000000..e6cffacd5 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/AssembleNoteEventHandler.cs @@ -0,0 +1,88 @@ +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.Shared.Domain.Shared; +using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Event.Transaction; + +namespace Win_in.Sfs.Wms.Store.Event.Transactions; + +public class AssembleNoteEventHandler + : StoreInventoryEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> + , ILocalEventHandler> +{ + private const EnumTransType TransType = EnumTransType.Issue; + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + var transferLogs = new List(); + var route = entity.UseOnTheWayLocation + ? EnumTransferRoute.SourceToOnTheWay + : EnumTransferRoute.SourceToDestination; + transferLogs.AddRange(await BuildTransferLogsAsync(entity).ConfigureAwait(false)); + + await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + } + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + var transferLogs = new List(); + //如果要做库存事务汇总,可以修改此处 + foreach (var issueNote in entities) + { + transferLogs.AddRange(await BuildTransferLogsAsync(issueNote).ConfigureAwait(false)); + } + + await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + } + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsConfirmedEntityEventData eventData) + { + var entity = eventData.Entity; + + var inputList = await BuildTransferLogsAsync(entity) + .ConfigureAwait(false); + await AddTransferLogsAsync(inputList).ConfigureAwait(false); + } + + private async Task AddTransferLogsAsync(List inputList) + { + var transferLogs = new List(); + + transferLogs.AddRange(inputList); + + await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + } + + private async Task> BuildTransferLogsAsync(AssembleNote issueNote) + { + var transferLogs = new List(); + foreach (var detail in issueNote.Details.Where(detail => detail.HandledToQty != 0)) + { + var transferLog = ObjectMapper.Map(detail); + + transferLog.TransSubType = EnumTransSubType.Issue_WIP; + transferLog.TransType = TransType; + transferLog.DocNumber = issueNote.Number; + transferLog.JobNumber = issueNote.JobNumber; + + transferLogs.Add(transferLog); + } + + await Task.CompletedTask.ConfigureAwait(false); + + return transferLogs; + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/CoatingIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/CoatingIssueNoteEventHandler.cs index e6c6f076d..ef46f0c66 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/CoatingIssueNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/CoatingIssueNoteEventHandler.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Threading.Tasks; using Volo.Abp.EventBus; using Volo.Abp.Uow; -using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Inventory.Application.Contracts; @@ -16,19 +15,12 @@ namespace Win_in.Sfs.Wms.Store.Event.Transactions; public class CoatingIssueNoteEventHandler : StoreInventoryEventHandlerBase - , ILocalEventHandler> - , ILocalEventHandler>> - , ILocalEventHandler> + , ILocalEventHandler> + , ILocalEventHandler>> + , ILocalEventHandler> { private const EnumTransType TransType = EnumTransType.Issue; - private readonly ILocationAppService _locationAppService; - - public CoatingIssueNoteEventHandler(ILocationAppService locationAppService) - { - _locationAppService = locationAppService; - } - [UnitOfWork] public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { @@ -37,13 +29,7 @@ public class CoatingIssueNoteEventHandler var route = entity.UseOnTheWayLocation ? EnumTransferRoute.SourceToOnTheWay : EnumTransferRoute.SourceToDestination; - transferLogs.AddRange(await BuildTransferLogsAsync(entity, route).ConfigureAwait(false)); - - //如果是mes拉动 先发到在途 - if (entity.RequestType == EnumMaterialRequestType.Issue_WIP.ToString()) - { - route = EnumTransferRoute.SourceToOnTheWay; - } + transferLogs.AddRange(await BuildTransferLogsAsync(entity).ConfigureAwait(false)); await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); } @@ -54,106 +40,50 @@ public class CoatingIssueNoteEventHandler var entities = eventData.Entity; var transferLogs = new List(); //如果要做库存事务汇总,可以修改此处 - foreach (var CoatingIssueNote in entities) + foreach (var issueNote in entities) { - var route = CoatingIssueNote.UseOnTheWayLocation - ? EnumTransferRoute.SourceToOnTheWay - : EnumTransferRoute.SourceToDestination; - transferLogs.AddRange(await BuildTransferLogsAsync(CoatingIssueNote, route).ConfigureAwait(false)); + transferLogs.AddRange(await BuildTransferLogsAsync(issueNote).ConfigureAwait(false)); } await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); } [UnitOfWork] - public virtual async Task HandleEventAsync(SfsConfirmedEntityEventData eventData) { var entity = eventData.Entity; - var inputList = await BuildTransferLogsAsync(entity, EnumTransferRoute.OnTheWayToDestination).ConfigureAwait(false); + var inputList = await BuildTransferLogsAsync(entity) + .ConfigureAwait(false); await AddTransferLogsAsync(inputList).ConfigureAwait(false); } private async Task AddTransferLogsAsync(List inputList) { - var transferLogs = new List(); + var transferLogs = new List(); transferLogs.AddRange(inputList); await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); - } - private async Task> BuildTransferLogsAsync(CoatingIssueNote CoatingIssueNote, EnumTransferRoute route) + private async Task> BuildTransferLogsAsync(CoatingIssueNote issueNote) { var transferLogs = new List(); - foreach (var detail in CoatingIssueNote.Details.Where(detail => detail.Qty != 0)) + foreach (var detail in issueNote.Details.Where(detail => detail.HandledToQty != 0)) { var transferLog = ObjectMapper.Map(detail); - LocationDTO fromLocationDTO = null; - LocationDTO toLocationDTO = null; - - if (CoatingIssueNote.UseOnTheWayLocation) - { - var location = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); - switch (route) - { - case EnumTransferRoute.SourceToOnTheWay: - fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); - - toLocationDTO = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); - break; - case EnumTransferRoute.OnTheWayToDestination: - fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); - - toLocationDTO = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); - - await RemovePackingCodeAndContainerCodeAndLotAsync(transferLog).ConfigureAwait(false); - break; - case EnumTransferRoute.SourceToDestination: - default: - throw new ArgumentOutOfRangeException(nameof(route), route, null); - } - } - else - { - fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); - toLocationDTO = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); - } - - transferLog.FromLocationCode = fromLocationDTO.Code; - transferLog.FromLocationArea = fromLocationDTO.AreaCode; - transferLog.FromLocationErpCode = fromLocationDTO.ErpLocationCode; - transferLog.FromLocationGroup = fromLocationDTO.LocationGroupCode; - - transferLog.ToLocationCode = toLocationDTO.Code; - transferLog.ToLocationArea = toLocationDTO.AreaCode; - transferLog.ToLocationErpCode = toLocationDTO.ErpLocationCode; - transferLog.ToLocationGroup = toLocationDTO.LocationGroupCode; - transferLog.TransSubType = Enum.Parse(CoatingIssueNote.RequestType); + transferLog.TransSubType = EnumTransSubType.Issue_WIP; transferLog.TransType = TransType; - transferLog.DocNumber = CoatingIssueNote.Number; - transferLog.JobNumber = CoatingIssueNote.JobNumber; + transferLog.DocNumber = issueNote.Number; + transferLog.JobNumber = issueNote.JobNumber; transferLogs.Add(transferLog); } - return transferLogs; - } - - private async Task RemovePackingCodeAndContainerCodeAndLotAsync(TransferLogEditInput transferLogCreateInput) - { - transferLogCreateInput.ToPackingCode = ""; - transferLogCreateInput.ToLot = ""; - transferLogCreateInput.ToContainerCode = ""; - - transferLogCreateInput.FromPackingCode = ""; - transferLogCreateInput.FromLot = ""; - transferLogCreateInput.FromContainerCode = ""; - + await Task.CompletedTask.ConfigureAwait(false); + return transferLogs; } - }