diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/Types/EnumContainerSpecificationsType.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/Types/EnumContainerSpecificationsType.cs new file mode 100644 index 000000000..46e4df8ac --- /dev/null +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/Types/EnumContainerSpecificationsType.cs @@ -0,0 +1,27 @@ +using System.ComponentModel.DataAnnotations; + +namespace Win_in.Sfs.Shared.Domain.Shared; + +/// +/// 器具规格 +/// +public enum EnumContainerSpecificationsType +{ + /// + /// 空枚举 + /// + [Display(Name = "空枚举")] + None = 0, + + /// + /// 大器具 + /// + [Display(Name = "大器具")] + BigContainer = 1, + + /// + /// 小器具 + /// + [Display(Name = "小器具")] + SmallContainer = 2, +} diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/Types/EnumContainerType.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/Types/EnumContainerType.cs new file mode 100644 index 000000000..6d4644dbd --- /dev/null +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/Types/EnumContainerType.cs @@ -0,0 +1,27 @@ +using System.ComponentModel.DataAnnotations; + +namespace Win_in.Sfs.Shared.Domain.Shared; + +/// +/// 器具类型 +/// +public enum EnumContainerType +{ + /// + /// 空枚举 + /// + [Display(Name = "空枚举")] + None = 0, + + /// + /// 内物流 + /// + [Display(Name = "内物流")] + InLogistics = 1, + + /// + /// 外物流 + /// + [Display(Name = "外物流")] + OutLogistics = 2, +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/ContainerJobPermissions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/ContainerJobPermissions.cs new file mode 100644 index 000000000..56f20cda1 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/ContainerJobPermissions.cs @@ -0,0 +1,27 @@ +using Volo.Abp.Authorization.Permissions; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public static class ContainerJobPermissions +{ + + public const string Default = StorePermissions.GroupName + "." + nameof(ContainerJob); + public const string Create = Default + "." + StorePermissions.CreateStr; + public const string Update = Default + "." + StorePermissions.UpdateStr; + public const string Delete = Default + "." + StorePermissions.DeleteStr; + + //自动发料任务 + public const string AutoContainerJob = StorePermissions.GroupName + "." + nameof(AutoContainerJob); + + public static void AddContainerJobPermission(this PermissionGroupDefinition permissionGroup) + { + var ContainerJobPermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(ContainerJob))); + ContainerJobPermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); + ContainerJobPermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); + ContainerJobPermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); + + permissionGroup.AddPermission(AutoContainerJob, StorePermissionDefinitionProvider.L(nameof(AutoContainerJob))); + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/DTOs/ContainerJobDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/DTOs/ContainerJobDTO.cs new file mode 100644 index 000000000..7da42cbbc --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/DTOs/ContainerJobDTO.cs @@ -0,0 +1,43 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Entities; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 器具呼叫任务 +/// +[Display(Name = "器具呼叫任务")] +public class ContainerJobDTO : SfsJobDTOBase +{ + + /// + /// 器具呼叫号码 + /// + [Display(Name = "器具呼叫号码")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ContainerRequestNumber { get; set; } + + /// + /// 呼叫库位代码 + /// + [Display(Name = "呼叫库位代码")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string RequestLocationCode { get; set; } + + /// + /// 器具类型 + /// + [Display(Name = "器具类型")] + [StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")] + public EnumContainerType ContainerType { get; set; } + + /// + /// 器具规格 + /// + [Display(Name = "器具规格")] + [StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")] + public EnumContainerSpecificationsType SpecificationsType { get; set; } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/DTOs/ContainerJobDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/DTOs/ContainerJobDetailDTO.cs new file mode 100644 index 000000000..af036265e --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/DTOs/ContainerJobDetailDTO.cs @@ -0,0 +1,22 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Entities; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class ContainerJobDetailDTO : SfsJobRecommendFromDetailDTOBase +{ + /// + /// 呼叫库位代码 + /// + [Display(Name = "呼叫库位代码")] + public string ToLocationCode { get; set; } + + /// + /// 来源库位代码 + /// + [Display(Name = "来源库位代码")] + public string FromLocationCode { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/IContainerJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/IContainerJobAppService.cs new file mode 100644 index 000000000..9bfdc589f --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/IContainerJobAppService.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public interface IContainerJobAppService + : ISfsJobAppServiceBase +{ + + + Task> GetByRequestNumberAsync(string requestNumber); + + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/Inputs/ContainerJobCheckInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/Inputs/ContainerJobCheckInput.cs new file mode 100644 index 000000000..29c79d6c2 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/Inputs/ContainerJobCheckInput.cs @@ -0,0 +1,6 @@ +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class ContainerJobCheckInput : SfsJobCheckInputBase +{ + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/Inputs/ContainerJobDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/Inputs/ContainerJobDetailInput.cs new file mode 100644 index 000000000..8622fac74 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/Inputs/ContainerJobDetailInput.cs @@ -0,0 +1,27 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class ContainerJobDetailInput : SfsJobRecommendFromDetailInputBase +{ + + /// + /// 呼叫库位代码 + /// + [Display(Name = "呼叫库位代码")] + [Required(ErrorMessage = "{0}是必填项")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ToLocationCode { get; set; } + + /// + /// 来源库位代码 + /// + [Display(Name = "来源库位代码")] + [Required(ErrorMessage = "{0}是必填项")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string FromLocationCode { get; set; } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/Inputs/ContainerJobEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/Inputs/ContainerJobEditInput.cs new file mode 100644 index 000000000..a212a9112 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ContainerJobs/Inputs/ContainerJobEditInput.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class ContainerJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCreateInput +{ + #region Create + + /// + /// 器具呼叫号码 + /// + [Display(Name = "器具呼叫号码")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + [Required(ErrorMessage = "{0}是必填项")] + public string ContainerRequestNumber { get; set; } + + /// + /// 呼叫库位代码 + /// + [Display(Name = "呼叫库位代码")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string RequestLocationCode { get; set; } + + /// + /// 器具类型 + /// + [Display(Name = "器具类型")] + [StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")] + public EnumContainerType ContainerType { get; set; } + + /// + /// 器具规格 + /// + [Display(Name = "器具规格")] + [StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")] + public EnumContainerSpecificationsType SpecificationsType { get; set; } + + /// + /// 上游任务编号 + /// + [Display(Name = "上游任务编号")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string UpStreamJobNumber { get; set; } + + /// + /// 任务类型 + /// + [Display(Name = "任务类型")] + [Required(ErrorMessage = "{0}是必填项")] + public EnumJobType JobType { get; set; } + + /// + /// 是否自动完成 + /// + [Display(Name = "是否自动完成")] + [Required(ErrorMessage = "{0}是必填项")] + public bool IsAutoComplete { get; set; } + + /// + /// 任务明细 + /// + [Display(Name = "任务明细")] + [Required(ErrorMessage = "{0}是必填项")] + public List Details { get; set; } = new(); + #endregion +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/ContainerNotePermissions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/ContainerNotePermissions.cs new file mode 100644 index 000000000..6b08a7689 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/ContainerNotePermissions.cs @@ -0,0 +1,27 @@ +using Volo.Abp.Authorization.Permissions; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public static class ContainerNotePermissions +{ + public const string Default = StorePermissions.GroupName + "." + nameof(ContainerNote); + public const string Create = Default + "." + StorePermissions.CreateStr; + public const string Update = Default + "." + StorePermissions.UpdateStr; + public const string Delete = Default + "." + StorePermissions.DeleteStr; + + + //器具呼叫记录 + public const string ContainerNote = StorePermissions.GroupName + "." + nameof(ContainerNote); + + public static void AddContainerNotePermission(this PermissionGroupDefinition permissionGroup) + { + var ContainerNotePermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(ContainerNote))); + ContainerNotePermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); + ContainerNotePermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); + ContainerNotePermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); + + permissionGroup.AddPermission(ContainerNote, StorePermissionDefinitionProvider.L(nameof(ContainerNote))); + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/DTOs/ContainerNoteDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/DTOs/ContainerNoteDTO.cs new file mode 100644 index 000000000..fe123a8aa --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/DTOs/ContainerNoteDTO.cs @@ -0,0 +1,50 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class ContainerNoteDTO : SfsStoreDTOBase, IHasJobNumber +{ + + /// + /// 任务ID + /// + [Display(Name = "任务ID")] + public string JobNumber { get; set; } + + /// + /// 呼叫库位代码 + /// + [Display(Name = "呼叫库位代码")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string RequestLocationCode { get; set; } + + /// + /// 器具类型 + /// + [Display(Name = "器具类型")] + [StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")] + public EnumContainerType ContainerType { get; set; } + + /// + /// 器具规格 + /// + [Display(Name = "器具规格")] + [StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")] + public EnumContainerSpecificationsType SpecificationsType { get; set; } + + /// + /// 已确认 + /// + [Display(Name = "已确认")] + public bool Confirmed { get; set; } + + /// + /// 确认时间 + /// + [Display(Name = "确认时间")] + public DateTime? ConfirmTime { get; set; } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/DTOs/ContainerNoteDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/DTOs/ContainerNoteDetailDTO.cs new file mode 100644 index 000000000..8446e5262 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/DTOs/ContainerNoteDetailDTO.cs @@ -0,0 +1,22 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class ContainerNoteDetailDTO : SfsStoreRecommendFromDetailWithFromToDTOBase +{ + + /// + /// 呼叫库位代码 + /// + [Display(Name = "呼叫库位代码")] + public string ToLocationCode { get; set; } + + /// + /// 来源库位代码 + /// + [Display(Name = "来源库位代码")] + public string FromLocationCode { get; set; } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/IContainerNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/IContainerNoteAppService.cs new file mode 100644 index 000000000..dae04b4c4 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/IContainerNoteAppService.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public interface IContainerNoteAppService : ISfsStoreMasterReadOnlyAppServiceBase +{ + Task CreateAsync(ContainerNoteEditInput input); + + Task ConfirmAsync(Guid id); + + Task ConfirmAsync(string number); + + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/Inputs/ContainerNoteDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/Inputs/ContainerNoteDetailInput.cs new file mode 100644 index 000000000..d47dbdcb4 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/Inputs/ContainerNoteDetailInput.cs @@ -0,0 +1,23 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class ContainerNoteDetailInput : SfsStoreRecommendFromDetailWithFromToInputBase +{ + + /// + /// 呼叫库位代码 + /// + [Display(Name = "呼叫库位代码")] + public string ToLocationCode { get; set; } + + /// + /// 来源库位代码 + /// + [Display(Name = "来源库位代码")] + public string FromLocationCode { get; set; } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/Inputs/ContainerNoteEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/Inputs/ContainerNoteEditInput.cs new file mode 100644 index 000000000..2b13c47f2 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/Inputs/ContainerNoteEditInput.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class ContainerNoteEditInput : SfsStoreCreateOrUpdateInputBase +{ + #region Base + /// + /// 已确认 + /// + [Display(Name = "已确认")] + public bool Confirmed { get; set; } + #endregion + + #region Create + + /// + /// 任务ID + /// + [Display(Name = "任务ID")] + [Required(ErrorMessage = "{0}是必填项")] + public string JobNumber { get; set; } + + /// + /// 呼叫库位代码 + /// + [Display(Name = "呼叫库位代码")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string RequestLocationCode { get; set; } + + /// + /// 器具类型 + /// + [Display(Name = "器具类型")] + [StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")] + public EnumContainerType ContainerType { get; set; } + + /// + /// 器具规格 + /// + [Display(Name = "器具规格")] + [StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")] + public EnumContainerSpecificationsType SpecificationsType { get; set; } + + /// + /// 明细列表 + /// + [Display(Name = "明细列表")] + public List Details { get; set; } + + + #endregion +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/Inputs/ContainerNoteImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/Inputs/ContainerNoteImportInput.cs new file mode 100644 index 000000000..0ac078c04 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ContainerNotes/Inputs/ContainerNoteImportInput.cs @@ -0,0 +1,35 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class ContainerNoteImportInput : SfsStoreImportInputBase, IHasJobNumber +{ + /// + /// 任务ID + /// + [Display(Name = "任务ID")] + public string JobNumber { get; set; } + + /// + /// 呼叫库位代码 + /// + [Display(Name = "呼叫库位代码")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string RequestLocationCode { get; set; } + + /// + /// 器具类型 + /// + [Display(Name = "器具类型")] + [StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")] + public EnumContainerType ContainerType { get; set; } + + /// + /// 器具规格 + /// + [Display(Name = "器具规格")] + [StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")] + public EnumContainerSpecificationsType SpecificationsType { 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 f0ef3dfc6..b45ea84a6 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 @@ -26,7 +26,9 @@ public class StorePermissionDefinitionProvider : PermissionDefinitionProvider storeGroup.AddPurchaseReturnNotePermission(); storeGroup.AddPutawayNotePermission(); storeGroup.AddMaterialRequestPermission(); + storeGroup.AddContainerRequestPermission(); storeGroup.AddIssueNotePermission(); + storeGroup.AddContainerNotePermission(); storeGroup.AddUnplannedReceiptNotePermission(); storeGroup.AddUnplannedIssueNotePermission(); storeGroup.AddIsolationNotePermission(); @@ -88,6 +90,7 @@ public class StorePermissionDefinitionProvider : PermissionDefinitionProvider storeGroup.AddInspectJobPermission(); storeGroup.AddPutawayJobPermission(); storeGroup.AddIssueJobPermission(); + storeGroup.AddContainerJobPermission(); storeGroup.AddDeliverJobPermission(); storeGroup.AddPurchaseReturnJobPermission(); storeGroup.AddProductReceiveJobPermission(); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/ContainerRequestPermissions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/ContainerRequestPermissions.cs new file mode 100644 index 000000000..c5884c649 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/ContainerRequestPermissions.cs @@ -0,0 +1,27 @@ +using Volo.Abp.Authorization.Permissions; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public static class ContainerRequestPermissions +{ + + public const string Default = StorePermissions.GroupName + "." + nameof(ContainerRequest); + public const string Create = Default + "." + StorePermissions.CreateStr; + public const string Update = Default + "." + StorePermissions.UpdateStr; + public const string Delete = Default + "." + StorePermissions.DeleteStr; + + //器具呼叫申请 + public const string AutoContainerRequest = StorePermissions.GroupName + "." + nameof(AutoContainerRequest); + + public static void AddContainerRequestPermission(this PermissionGroupDefinition permissionGroup) + { + var ContainerRequestPermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(ContainerRequest))); + ContainerRequestPermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); + ContainerRequestPermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); + ContainerRequestPermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); + + permissionGroup.AddPermission(AutoContainerRequest, StorePermissionDefinitionProvider.L(nameof(AutoContainerRequest))); + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/DTOs/ContainerRequestDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/DTOs/ContainerRequestDTO.cs new file mode 100644 index 000000000..4cc0007cb --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/DTOs/ContainerRequestDTO.cs @@ -0,0 +1,30 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain.Entities; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 器具呼叫DTO +/// +public class ContainerRequestDTO : SfsStoreRequestDTOBase +{ + /// + /// 呼叫库位代码 + /// + [Display(Name = "呼叫库位代码")] + public string RequestLocationCode { get; set; } + + /// + /// 器具类型 + /// + [Display(Name = "器具类型")] + public EnumContainerType ContainerType { get; set; } + + /// + /// 器具规格 + /// + [Display(Name = "器具规格")] + public EnumContainerSpecificationsType SpecificationsType { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/DTOs/ContainerRequestDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/DTOs/ContainerRequestDetailDTO.cs new file mode 100644 index 000000000..3a48d3b1f --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/DTOs/ContainerRequestDetailDTO.cs @@ -0,0 +1,23 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Data; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 器具呼叫明细DTO +/// +public class ContainerRequestDetailDTO : SfsStoreDetailWithQtyDTOBase, IHasExtraProperties +{ + /// + /// 呼叫库位 + /// + [Display(Name = "呼叫库位")] + public string ToLocationCode { get; set; } + + /// + /// 扩展属性 + /// + [Display(Name = "扩展属性")] + + public ExtraPropertyDictionary ExtraProperties { set; get; } = new ExtraPropertyDictionary(); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/IContainerRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/IContainerRequestAppService.cs new file mode 100644 index 000000000..91b383b91 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/IContainerRequestAppService.cs @@ -0,0 +1,11 @@ +using System.Threading.Tasks; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public interface IContainerRequestAppService + : ISfsStoreRequestMasterAppServiceBase + + + +{ +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/Inputs/ContainerRequestDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/Inputs/ContainerRequestDetailInput.cs new file mode 100644 index 000000000..64cb62bb2 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/Inputs/ContainerRequestDetailInput.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Data; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class ContainerRequestDetailInput : SfsStoreDetailWithQtyInputBase, IHasExtraProperties +{ + /// + /// 呼叫库位 + /// + [Display(Name = "呼叫库位")] + public string ToLocationCode { get; set; } + + /// + /// 扩展属性 + /// + [Display(Name = "扩展属性")] + public ExtraPropertyDictionary ExtraProperties { set; get; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/Inputs/ContainerRequestEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/Inputs/ContainerRequestEditInput.cs new file mode 100644 index 000000000..23391aadd --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/Inputs/ContainerRequestEditInput.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 新增和更新基础DTO +/// +public class ContainerRequestEditInput : SfsStoreRequestCreateOrUpdateInputBase +{ + #region Base + + [Display(Name = "呼叫库位代码")] + [Required(ErrorMessage = "{0}是必填项")] + [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string RequestLocationCode { get; set; } + + #endregion + + #region Create + + [Display(Name = "器具类型")] + [Required(ErrorMessage = "{0}是必填项")] + public EnumContainerType ContainerType { get; set; } + + [Display(Name = "器具规格")] + [Required(ErrorMessage = "{0}是必填项")] + public EnumContainerSpecificationsType SpecificationsType { get; set; } + + [Display(Name = "明细列表")] + public List Details { get; set; } + #endregion +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/Inputs/ContainerRequestImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/Inputs/ContainerRequestImportInput.cs new file mode 100644 index 000000000..c3404c177 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ContainerRequests/Inputs/ContainerRequestImportInput.cs @@ -0,0 +1,39 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class ContainerRequestImportInput : SfsStoreImportInputBase +{ + + /// + /// 呼叫库位代码 + /// + [Display(Name = "呼叫库位代码")] + [Required(ErrorMessage = "{0}是必填项")] + [ImporterHeader(Name = "呼叫库位代码")] + [ExporterHeader(DisplayName = "呼叫库位代码")] + public string RequestLocationCode { get; set; } + + /// + /// 器具类型 + /// + [Display(Name = "器具类型")] + [Required(ErrorMessage = "{0}是必填项")] + [ImporterHeader(Name = "器具类型")] + [ExporterHeader(DisplayName = "器具类型")] + public EnumContainerType ContainerType { get; set; } + + /// + /// 器具规格 + /// + [Display(Name = "器具规格")] + [Required(ErrorMessage = "{0}是必填项")] + [ImporterHeader(Name = "器具规格")] + [ExporterHeader(DisplayName = "器具规格")] + public EnumContainerSpecificationsType SpecificationsType { get; set; } + +} + diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ContainerJobs/ContainerJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ContainerJobs/ContainerJobAppService.cs new file mode 100644 index 000000000..76328726a --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ContainerJobs/ContainerJobAppService.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Basedata.Domain.Shared; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application; + +[Authorize] +[Route($"{StoreConsts.RootPath}container-job")] + +public class ContainerJobAppService + : SfsJobAppServiceBase, + IContainerJobAppService +{ + private readonly IContainerJobManager _ContainerJobManager; + + public ContainerJobAppService( + IContainerJobRepository repository, IContainerJobManager ContainerJobManager + ) : base(repository, ContainerJobManager) + { + _ContainerJobManager = ContainerJobManager; + } + + /// + /// 根据库位 检查是否存在任务 + /// + /// + /// + /// + /// + [Authorize] + [HttpGet("check-job-exist")] + public virtual async Task> CheckJobExistByItemCodeAndLocationCode(string itemCode, + string locationCode) + { + var entities = await _repository.GetListAsync(c => + c.Details.Any(p => + (p.ItemCode == itemCode && p.RecommendFromLocationCode == locationCode) || + (p.ItemCode == itemCode && p.ToLocationCode == locationCode)) + && (c.JobStatus == EnumJobStatus.Open || c.JobStatus == EnumJobStatus.Doing), true).ConfigureAwait(false); + var dtos = ObjectMapper.Map, List>(entities); + return dtos; + } + + [HttpPost("by-request-number/{requestNumber}")] + public virtual async Task> GetByRequestNumberAsync(string requestNumber) + { + var entitys = await _repository.GetListAsync(p => p.ContainerRequestNumber == requestNumber).ConfigureAwait(false); + return ObjectMapper.Map, List>(entitys); + } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ContainerJobs/ContainerJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ContainerJobs/ContainerJobAutoMapperProfile.cs new file mode 100644 index 000000000..1c2b4e8e1 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ContainerJobs/ContainerJobAutoMapperProfile.cs @@ -0,0 +1,30 @@ +using AutoMapper; +using Volo.Abp.AutoMapper; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application; + +public partial class StoreApplicationAutoMapperProfile : Profile +{ + private void ContainerJobAutoMapperProfile() + { + CreateMap(); + + CreateMap(); + + CreateMap() + ; + + CreateMap() + ; + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.MasterID) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ContainerNotes/ContainerNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ContainerNotes/ContainerNoteAppService.cs new file mode 100644 index 000000000..40daa772d --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ContainerNotes/ContainerNoteAppService.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application; + +[Authorize] +[Route($"{StoreConsts.RootPath}container-note")] +public class ContainerNoteAppService : + SfsStoreWithDetailsAppServiceBase, + IContainerNoteAppService +{ + private readonly IContainerNoteManager _ContainerNoteManager; + + public ContainerNoteAppService( + IContainerNoteRepository repository, + IContainerNoteManager ContainerNoteManager + ) : base(repository) + { + _ContainerNoteManager = ContainerNoteManager; + } + + [HttpPost("")] + //[Authorize(ContainerNotePermissions.Create)] + public override async Task CreateAsync(ContainerNoteEditInput input) + { + var entity = ObjectMapper.Map(input); + await _ContainerNoteManager.CreateAsync(entity).ConfigureAwait(false); + var dto = ObjectMapper.Map(entity); + return dto; + } + + /// + /// 确认对应的记录单 + /// + /// + /// + [HttpPost("confirm/{id}")] + public virtual async Task ConfirmAsync(Guid id) + { + var ContainerNote= await _repository.GetAsync(id).ConfigureAwait(false); + ContainerNote.Confirmed = true; + ContainerNote=await _repository.UpdateAsync(ContainerNote).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData(ContainerNote), false).ConfigureAwait(false); + return ObjectMapper.Map(ContainerNote); + } + + [HttpPost("confirm-by-number/{number}")] + public virtual async Task ConfirmAsync(string number) + { + var entity = await _repository.FindAsync(p => p.Number == number).ConfigureAwait(false); + Check.NotNull(entity, nameof(ContainerNote)); + var result = await _ContainerNoteManager.ConfirmAsync(entity.Id).ConfigureAwait(false); + var dto = ObjectMapper.Map(result); + return dto; + } + + + + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ContainerNotes/ContainerNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ContainerNotes/ContainerNoteAutoMapperProfile.cs new file mode 100644 index 000000000..6d7d3723a --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ContainerNotes/ContainerNoteAutoMapperProfile.cs @@ -0,0 +1,31 @@ +using AutoMapper; +using Volo.Abp.AutoMapper; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application; + +public partial class StoreApplicationAutoMapperProfile : Profile +{ + private void ContainerNoteAutoMapperProfile() + { + CreateMap() + .ReverseMap(); + + CreateMap(); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.MasterID) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + ; + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ContainerRequests/ContainerRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ContainerRequests/ContainerRequestAppService.cs new file mode 100644 index 000000000..21a0c2e86 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ContainerRequests/ContainerRequestAppService.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application; +[Authorize] +[Route($"{StoreConsts.RootPath}container-request")] + +public class ContainerRequestAppService : + SfsStoreRequestAppServiceBase + , + IContainerRequestAppService +{ + private readonly IContainerRequestManager _containerRequestManager; + private readonly IAreaAppService _areaApp; + private readonly ICustomerAppService _customerApp; + private readonly ICustomerAddressAppService _customerAddressApp; + + public ContainerRequestAppService( + IContainerRequestRepository repository + , IContainerRequestManager containerRequestManager + , IAreaAppService areaApp + , ICustomerAppService customerApp + , ICustomerAddressAppService customerAddressApp) + : base(repository, containerRequestManager) + { + _containerRequestManager = containerRequestManager; + _areaApp = areaApp; + _customerApp = customerApp; + _customerAddressApp = customerAddressApp; + } + + + /// + /// 【创建】器具呼叫申请 + /// + /// + /// + [HttpPost("")] + public override async Task CreateAsync(ContainerRequestEditInput input) + { + var entity = ObjectMapper.Map(input); + + await _containerRequestManager.CreateAsync(entity).ConfigureAwait(false); + + var dto = ObjectMapper.Map(entity); + return dto; + } + + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ContainerRequests/ContainerRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ContainerRequests/ContainerRequestAutoMapperProfile.cs new file mode 100644 index 000000000..95c74b2f6 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ContainerRequests/ContainerRequestAutoMapperProfile.cs @@ -0,0 +1,62 @@ +using AutoMapper; +using Volo.Abp.AutoMapper; +using Volo.Abp.Data; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application; + +using Win_in.Sfs.Shared.Domain.Shared; + +public partial class StoreApplicationAutoMapperProfile : Profile +{ + private void ContainerRequestAutoMapperProfile() + { + CreateMap() + .ReverseMap(); + + CreateMap() + .ReverseMap(); + + CreateMap(); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.MasterID) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + + + CreateMap() + .Ignore(x => x.ActiveDate) + .Ignore(x => x.Details) + .Ignore(x => x.TenantId) + .Ignore(x => x.LastModificationTime) + .Ignore(x => x.LastModifierId) + .Ignore(x => x.CreationTime) + .Ignore(x => x.CreatorId) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.ConcurrencyStamp) + .Ignore(x => x.Number) + .Ignore(x => x.RequestStatus) + .Ignore(x => x.Remark); + + CreateMap() + .Ignore(x => x.Number) + .Ignore(X => X.StdPackQty) + .Ignore(x => x.Uom) + .Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2) + .Ignore(x => x.Remark) + .Ignore(x => x.MasterID) + .Ignore(x => x.LastModificationTime) + .Ignore(x => x.LastModifierId) + .Ignore(x => x.CreationTime) + .Ignore(x => x.CreatorId) + .Ignore(x => x.TenantId) + .Ignore(x => x.Id) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.Remark); + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs index 64fa4bdb4..7fa33e59e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs @@ -10,6 +10,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile PurchaseReceiptRequestAutoMapperProfile(); DeliverRequestAutoMapperProfile(); + ContainerRequestAutoMapperProfile(); InspectRequestAutoMapperProfile(); ItemTransformRequestAutoMapperProfile(); MaterialRequestAutoMapperProfile(); @@ -59,6 +60,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile InventoryTransferNoteMapperProfile(); IsolationNoteAutoMapperProfile(); IssueNoteAutoMapperProfile(); + ContainerNoteAutoMapperProfile(); ItemTransformNoteAutoMapperProfile(); JisDeliverNoteAutoMapperProfile(); JisProductReceiptNoteAutoMapperProfile(); @@ -90,6 +92,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile DeliverJobAutoMapperProfile(); InspectJobAutoMapperProfile(); IssueJobAutoMapperProfile(); + ContainerJobAutoMapperProfile(); JisDeliverJobAutoMapperProfile(); ProductReceiveJobAutoMapperProfile(); ProductRecycleJobAutoMapperProfile(); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Win_in.Sfs.Wms.Store.Application.csproj b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Win_in.Sfs.Wms.Store.Application.csproj index 8baf5221b..314d76f6d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Win_in.Sfs.Wms.Store.Application.csproj +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Win_in.Sfs.Wms.Store.Application.csproj @@ -29,9 +29,7 @@ - - diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/ContainerExtension.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/ContainerExtension.cs new file mode 100644 index 000000000..6c22704f6 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/ContainerExtension.cs @@ -0,0 +1,39 @@ +using Volo.Abp.Timing; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public static class ContainerExtension +{ + + + public static ContainerJob Init(this ContainerJob job) + { + job.JobType = EnumJobType.IssueJob; + job.JobStatus = EnumJobStatus.Open; + return job; + } + + public static ContainerJob SetWorkGroup(this ContainerJob job, string warehouseCode, string workGroupCode, string groupCode) + { + job.WorkGroupCode = workGroupCode; + job.WarehouseCode = warehouseCode; + return job; + } + + public static ContainerJob SetWorker(this ContainerJob job, string worker) + { + job.Worker = worker; + return job; + } + + public static ContainerJob SetPriority(this ContainerJob job, IClock clock) + { + job.Priority = PriorityHelper.GetPriority(clock); + job.PriorityIncrement = 1; + return job; + } + + + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/ContainerJob.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/ContainerJob.cs new file mode 100644 index 000000000..a416b0fce --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/ContainerJob.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Threading.Tasks; +using Win_in.Sfs.Shared.Domain.Entities; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Domain; + +/// +/// 器具呼叫任务 +/// +[Display(Name = "器具呼叫任务")] +public class ContainerJob : SfsJobAggregateRootBase +{ + /// + /// 器具呼叫号码 + /// + [IgnoreUpdate] + public string ContainerRequestNumber { get; set; } + + /// + /// 呼叫库位代码 + /// + [IgnoreUpdate] + public string RequestLocationCode { get; set; } + + /// + /// 器具类型 + /// + [IgnoreUpdate] + public EnumContainerType ContainerType { get; set; } + + /// + /// 器具规格 + /// + [IgnoreUpdate] + public EnumContainerSpecificationsType SpecificationsType { get; set; } + + /// + /// 任务明细 + /// + [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/ContainerJobs/ContainerJobDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/ContainerJobDetail.cs new file mode 100644 index 000000000..78823d40f --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/ContainerJobDetail.cs @@ -0,0 +1,26 @@ +using System; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Entities; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public class ContainerJobDetail : SfsJobRecommendFromDetailEntityBase +{ + /// + /// 呼叫库位代码 + /// + [IgnoreUpdate] + public string ToLocationCode { get; set; } + + /// + /// 来源库位代码 + /// + [IgnoreUpdate] + public string FromLocationCode { get; set; } + + public void SetId(Guid id) + { + this.Id = id; + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/ContainerJobManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/ContainerJobManager.cs new file mode 100644 index 000000000..291fbb30e --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/ContainerJobManager.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Linq.Expressions; +using System.Threading.Tasks; +using Volo.Abp.Users; +using Volo.Abp.Validation; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public class ContainerJobManager : SfsJobManagerBase, IContainerJobManager +{ + + public ContainerJobManager( + IContainerJobRepository repository + ) : base(repository) + { + } + + /// + /// 执行任务 + /// + /// + /// + /// + /// + public override async Task CompleteAsync(ContainerJob input, ICurrentUser user) + { + var entity = await Repository.FindAsync(input.Id).ConfigureAwait(false); + + foreach (var detail in input.Details) + { + //发料子任务 赋值实际转移 + await entity.BuildDetail(detail.Id, + detail.HandledFromLocationCode, + detail.HandledFromLocationErpCode, + detail.HandledFromWarehouseCode, + detail.HandledQty, + detail.HandledSupplierBatch, + detail.HandledArriveDate, + detail.HandledProduceDate, + detail.HandledExpireDate, + detail.HandledContainerCode, + detail.HandledLot, + detail.HandledPackingCode).ConfigureAwait(false); + } + + return await base.CompleteAsync(entity, user).ConfigureAwait(false); + } + + public override void CheckDetails(ContainerJob entity, AbpValidationResult result) + { + var details = entity.Details; + foreach (var detail in details) + { + if (detail.HandledFromLocationCode == null) + { + result.Errors.Add(new ValidationResult($"{detail.HandledFromLocationCode} 不能为空")); + } + + } + } + + public override async Task> GetWorkingListByPackingAsync(string packingCode) + { + return await Repository.GetListAsync(c => c.Details.Any(p => p.RecommendPackingCode == packingCode) && c.JobStatus != EnumJobStatus.Closed && c.JobStatus != EnumJobStatus.Cancelled, true).ConfigureAwait(false); + + } + + public override async Task> GetWorkingListByContainerAsync(string containerCode) + { + return await Repository.GetListAsync(c => c.Details.Any(p => p.RecommendContainerCode == containerCode) && c.JobStatus != EnumJobStatus.Closed && c.JobStatus != EnumJobStatus.Cancelled, true).ConfigureAwait(false); + + } + + + public async Task GetAsync(Expression> expression) + { + return await Repository.FindAsync(expression).ConfigureAwait(false); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/IContainerJobManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/IContainerJobManager.cs new file mode 100644 index 000000000..e642f7997 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/IContainerJobManager.cs @@ -0,0 +1,10 @@ +using System; +using System.Linq.Expressions; +using System.Threading.Tasks; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public interface IContainerJobManager : IJobManager +{ + Task GetAsync(Expression> expression); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/IContainerJobRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/IContainerJobRepository.cs new file mode 100644 index 000000000..935601bee --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ContainerJobs/IContainerJobRepository.cs @@ -0,0 +1,6 @@ +namespace Win_in.Sfs.Wms.Store.Domain; + +public interface IContainerJobRepository : ISfsJobRepositoryBase +{ + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/ContainerNote.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/ContainerNote.cs new file mode 100644 index 000000000..690038660 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/ContainerNote.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using DocumentFormat.OpenXml.Wordprocessing; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain.Entities; +using Win_in.Sfs.Shared.Domain.Shared; +using Volo.Abp; + +namespace Win_in.Sfs.Wms.Store.Domain; + +/// +/// 器具呼叫记录 +/// +public class ContainerNote : SfsStoreAggregateRootBase, IHasJobNumber +{ + /// + /// 任务ID + /// + [IgnoreUpdate] + public string JobNumber { get; set; } + + /// + /// 呼叫库位代码 + /// + [IgnoreUpdate] + public string RequestLocationCode { get; set; } + + /// + /// 器具类型 + /// + [IgnoreUpdate] + public EnumContainerType ContainerType { get; set; } + + /// + /// 器具规格 + /// + [IgnoreUpdate] + public EnumContainerSpecificationsType SpecificationsType { get; set; } + + /// + /// 已确认 + /// + [Display(Name = "已确认")] + public bool Confirmed { get; set; } + + /// + /// 确认时间 + /// + [Display(Name = "确认时间")] + public DateTime? ConfirmTime { get; set; } + + /// + /// 任务明细 + /// + [IgnoreUpdate] + public override List Details { get; set; } = new(); + + public void Confirm(DateTime confirmTime) + { + + CheckStatus(Confirmed); + Confirmed = true; + ConfirmTime = confirmTime; + } + + private static void CheckStatus(bool confirmed) + { + if (confirmed) + { + throw new UserFriendlyException($"当前状态为 【已确认】 ,无法再次确认!"); + } + + } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/ContainerNoteDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/ContainerNoteDetail.cs new file mode 100644 index 000000000..0958ea881 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/ContainerNoteDetail.cs @@ -0,0 +1,16 @@ +using Volo.Abp.Data; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public class ContainerNoteDetail : SfsStoreRecommendFromDetailWithFromToEntityBase, IHasExtraProperties +{ + /// + /// 呼叫库位 + /// + public string ToLocationCode { get; set; } + + /// + /// 扩展属性 + /// + public ExtraPropertyDictionary ExtraProperties { get; set; } = new ExtraPropertyDictionary(); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/ContainerNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/ContainerNoteManager.cs new file mode 100644 index 000000000..2a339ef23 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/ContainerNoteManager.cs @@ -0,0 +1,50 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Volo.Abp; +using Volo.Abp.Uow; +using Win_in.Sfs.Shared.Event; + + +namespace Win_in.Sfs.Wms.Store.Domain; + +public class ContainerNoteManager : SfsStoreManagerBase, IContainerNoteManager +{ + + public ContainerNoteManager( + IContainerNoteRepository repository + ) : base(repository) + { + } + + public override async Task CreateAsync(ContainerNote ContainerNote) + { + ContainerNote = await base.CreateAsync(ContainerNote).ConfigureAwait(false); + return ContainerNote; + } + + [UnitOfWork] + public virtual async Task ConfirmAsync(Guid id) + { + var entity = await Repository.FindAsync(id).ConfigureAwait(false); + Check.NotNull(entity, EntityClassName); + entity.Confirm(Clock.Now); + await PublishConfirmedAsync(entity).ConfigureAwait(false); + return await Repository.UpdateAsync(entity).ConfigureAwait(false); + } + + private async Task PublishConfirmedAsync(ContainerNote entity) + { + try + { + await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData(entity), false).ConfigureAwait(false); + } + catch (Exception ex) + { + Logger.LogDebug($"{nameof(ContainerNote)} Confirmed Event:{ex.Message}", null); + Console.WriteLine(ex.Source); + throw; + } + } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/IContainerNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/IContainerNoteManager.cs new file mode 100644 index 000000000..096785ccd --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/IContainerNoteManager.cs @@ -0,0 +1,9 @@ +using System.Threading.Tasks; +using System; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public interface IContainerNoteManager : ISfsStoreManager +{ + Task ConfirmAsync(Guid id); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/IContainerNoteRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/IContainerNoteRepository.cs new file mode 100644 index 000000000..4b714e856 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ContainerNotes/IContainerNoteRepository.cs @@ -0,0 +1,5 @@ +namespace Win_in.Sfs.Wms.Store.Domain; + +public interface IContainerNoteRepository : ISfsStoreRepositoryBase +{ +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/ContainerRequest.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/ContainerRequest.cs new file mode 100644 index 000000000..081c0ce4a --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/ContainerRequest.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain.Entities; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Domain; + +/// +/// 器具呼叫申请 +/// +public class ContainerRequest : SfsStoreRequestAggregateRootBase +{ + /// + /// 呼叫库位代码 + /// + [IgnoreUpdate] + public string RequestLocationCode { get; set; } + + /// + /// 器具类型 + /// + [IgnoreUpdate] + public EnumContainerType ContainerType { get; set; } + + /// + /// 器具规格 + /// + [IgnoreUpdate] + public EnumContainerSpecificationsType SpecificationsType { get; set; } + + /// + /// 任务明细 + /// + [IgnoreUpdate] + public override List Details { get; set; } = new(); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/ContainerRequestDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/ContainerRequestDetail.cs new file mode 100644 index 000000000..51ea7ee45 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/ContainerRequestDetail.cs @@ -0,0 +1,20 @@ +using Volo.Abp.Data; + +namespace Win_in.Sfs.Wms.Store.Domain; + +/// +/// 器具呼叫申请明细表 +/// +public class ContainerRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasExtraProperties +{ + /// + /// 呼叫库位 + /// + public string ToLocationCode { get; set; } + + /// + /// 扩展属性 + /// + public ExtraPropertyDictionary ExtraProperties { get; set; } = new ExtraPropertyDictionary(); + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/ContainerRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/ContainerRequestManager.cs new file mode 100644 index 000000000..dafd24461 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/ContainerRequestManager.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Uow; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public class ContainerRequestManager : SfsStoreRequestManagerBase, IContainerRequestManager +{ + public readonly IContainerRequestRepository _repository; + + public ContainerRequestManager( + IContainerRequestRepository repository + ) + : base(repository) + { + _repository = repository; + } + public override async Task> CreateManyAsync(List entities) + { + var results = new List(); + foreach (var entity in entities) + { + entity.SetIdAndNumberWithDetails(GuidGenerator, await GenerateNumberAsync(typeof(ContainerRequest).Name, entity.ActiveDate).ConfigureAwait(false)); + ContainerRequest result; + if (entity.AutoSubmit) + { + result = await SubmitAsync(entity).ConfigureAwait(false); + } + else + { + result = await Repository.InsertAsync(entity).ConfigureAwait(false); + } + results.Add(result); + } + return entities; + } + /// + /// 执行导入 + /// + public virtual async Task ImportDataAsync(List mergeEntities, List deleteEntities = null) + { + if (deleteEntities != null && deleteEntities.Count > 0) + { + await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); + } + + await CreateManyAsync(mergeEntities).ConfigureAwait(false); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/IContainerRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/IContainerRequestManager.cs new file mode 100644 index 000000000..4c4817637 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/IContainerRequestManager.cs @@ -0,0 +1,8 @@ +namespace Win_in.Sfs.Wms.Store.Domain; + +using Win_in.Sfs.Shared.Domain; + +public interface IContainerRequestManager : ISfsStoreRequestManager, IBulkImportService +{ + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/IContainerRequestRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/IContainerRequestRepository.cs new file mode 100644 index 000000000..7c928a54f --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ContainerRequests/IContainerRequestRepository.cs @@ -0,0 +1,8 @@ +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public interface IContainerRequestRepository : ISfsStoreRepositoryBase, ISfsBulkRepositoryBase +{ + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Win_in.Sfs.Wms.Store.Domain.csproj b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Win_in.Sfs.Wms.Store.Domain.csproj index 997f37960..7503698cd 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Win_in.Sfs.Wms.Store.Domain.csproj +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Win_in.Sfs.Wms.Store.Domain.csproj @@ -38,10 +38,8 @@ - - diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs index a171f29dc..6ce3b9881 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs @@ -18,6 +18,7 @@ public interface IStoreDbContext : IEfCoreDbContext public DbSet TransferRequests { get; } public DbSet ProductReceiptRequests { get; } public DbSet MaterialRequests { get; } + public DbSet ContainerRequests { get; } public DbSet DeliverRequests { get; } public DbSet InspectRequests { get; } public DbSet PutawayRequest { get; } @@ -68,6 +69,7 @@ public interface IStoreDbContext : IEfCoreDbContext public DbSet InventoryTransferNotes { get; } public DbSet WarehouseTransferNotes { get; } public DbSet IssueNotes { get; } + public DbSet ContainerNotes { get; } public DbSet UnplannedReceiptNotes { get; } public DbSet UnplannedIssueNotes { get; } public DbSet IsolationNotes { get; } @@ -92,6 +94,7 @@ public interface IStoreDbContext : IEfCoreDbContext public DbSet InspectJobs { get; } public DbSet PutawayJobs { get; } public DbSet IssueJobs { get; } + public DbSet ContainerJobs { get; } public DbSet DeliverJobs { get; } public DbSet JisDeliverJobs { get; } public DbSet PurchaseReturnJobs { get; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/ContainerJobs/ContainerJobDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/ContainerJobs/ContainerJobDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..5d6ce01c0 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/ContainerJobs/ContainerJobDbContextModelCreatingExtensions.cs @@ -0,0 +1,56 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Shared.EntityFrameworkCore; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public static class ContainerJobDbContextModelCreatingExtensions +{ + public static void ConfigureContainerJob(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(StoreDbProperties.JobDbTablePrefix + nameof(ContainerJob), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsBase(); + //Configure Job base properties + b.ConfigureJob(); + //Properties + b.Property(q => q.ContainerRequestNumber).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.ContainerType).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.RequestLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.SpecificationsType).HasMaxLength(SfsPropertyConst.CodeLength); + //Relations + b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); + //Indexes + b.HasIndex(q => new { q.Number }).IsUnique(); + }); + + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(StoreDbProperties.JobDbTablePrefix + nameof(ContainerJobDetail), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsBase(); + //Configure Job base properties + b.ConfigureJobRecommendFromDetail(); + //Properties + + b.Property(q => q.ToLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.FromLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); + + //Relations + //None + + //Indexes + //b.HasIndex(q => new { q.PackingCode }).IsUnique(); + }); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/ContainerJobs/ContainerJobEfCoreRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/ContainerJobs/ContainerJobEfCoreRepository.cs new file mode 100644 index 000000000..dc8a63d42 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/ContainerJobs/ContainerJobEfCoreRepository.cs @@ -0,0 +1,11 @@ +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public class ContainerJobEfCoreRepository : SfsJobEfCoreRepositoryBase, IContainerJobRepository +{ + public ContainerJobEfCoreRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ContainerNotes/ContainerNoteDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ContainerNotes/ContainerNoteDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..7b7120af4 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ContainerNotes/ContainerNoteDbContextModelCreatingExtensions.cs @@ -0,0 +1,56 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public static class ContainerNoteDbContextModelCreatingExtensions +{ + public static void ConfigureContainerNote(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(ContainerNote), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsStoreBase(); + + //Properties + b.Property(q => q.JobNumber).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.ContainerType).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.RequestLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.SpecificationsType).HasMaxLength(SfsPropertyConst.CodeLength); + + //Relations + b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); + + //Indexes + b.HasIndex(q => new { q.Number }).IsUnique(); + }); + + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(ContainerNoteDetail), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsStoreBase(); + //Configure Sfs store detail properties + b.ConfigureSfsStoreDetailBase(); + + //Properties + b.Property(q => q.ToLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.FromLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); + + //Relations + + //Indexes + b.HasIndex(q => new { q.Number }).IsUnique(); + + }); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ContainerNotes/ContainerNoteEfCoreRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ContainerNotes/ContainerNoteEfCoreRepository.cs new file mode 100644 index 000000000..247fcffec --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ContainerNotes/ContainerNoteEfCoreRepository.cs @@ -0,0 +1,11 @@ +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public class ContainerNoteEfCoreRepository : SfsStoreEfCoreRepositoryBase, IContainerNoteRepository +{ + public ContainerNoteEfCoreRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ContainerRequests/ContainerRequestDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ContainerRequests/ContainerRequestDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..e31881a8f --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ContainerRequests/ContainerRequestDbContextModelCreatingExtensions.cs @@ -0,0 +1,53 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public static class ContainerRequestDbContextModelCreatingExtensions +{ + public static void ConfigureContainerRequest(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(ContainerRequest), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsStoreBase(); + + //Properties + b.Property(q => q.RequestLocationCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.ContainerType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + b.Property(q => q.SpecificationsType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + b.Property(q => q.RequestStatus).IsRequired().HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + + //Relations + b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); + + //Indexes + b.HasIndex(q => new { q.Number }).IsUnique(); + }); + + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(ContainerRequestDetail), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsStoreBase(); + //Configure Sfs store detail properties + b.ConfigureSfsStoreDetailBase(); + + //Properties + + //Relations + + //Indexes + b.HasIndex(q => new { q.Number }).IsUnique(); + }); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ContainerRequests/ContainerRequestEfCoreRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ContainerRequests/ContainerRequestEfCoreRepository.cs new file mode 100644 index 000000000..07917c6f5 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ContainerRequests/ContainerRequestEfCoreRepository.cs @@ -0,0 +1,11 @@ +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public class ContainerRequestEfCoreRepository : SfsStoreEfCoreRepositoryBase, IContainerRequestRepository +{ + public ContainerRequestEfCoreRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs index f9ed7239c..d33e47fe6 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs @@ -18,6 +18,7 @@ public class StoreDbContext : AbpDbContext, IStoreDbContext public DbSet TransferRequests { get; set; } public DbSet ProductReceiptRequests { get; set; } public DbSet MaterialRequests { get; set; } + public DbSet ContainerRequests { get; set; } public DbSet DeliverRequests { get; set; } public DbSet InspectRequests { get; set; } public DbSet PutawayRequest { get; set; } @@ -68,6 +69,7 @@ public class StoreDbContext : AbpDbContext, IStoreDbContext public DbSet InventoryTransferNotes { get; set; } public DbSet WarehouseTransferNotes { get; set; } public DbSet IssueNotes { get; set; } + public DbSet ContainerNotes { get; set; } public DbSet UnplannedReceiptNotes { get; set; } public DbSet UnplannedIssueNotes { get; set; } public DbSet IsolationNotes { get; set; } @@ -92,6 +94,7 @@ public class StoreDbContext : AbpDbContext, IStoreDbContext public DbSet InspectJobs { get; set; } public DbSet PutawayJobs { get; set; } public DbSet IssueJobs { get; set; } + public DbSet ContainerJobs { get; set; } public DbSet DeliverJobs { get; set; } public DbSet JisDeliverJobs { get; set; } public DbSet PurchaseReturnJobs { get; set; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs index 62d3e058d..7ccb4b4c8 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs @@ -55,6 +55,7 @@ public static class StoreDbContextModelCreatingExtensions builder.ConfigurePurchaseReceiptRequest(options); builder.ConfigureMaterialRequest(options); builder.ConfigureDeliverRequest(options); + builder.ConfigureContainerRequest(options); builder.ConfigureInspectRequest(options); builder.ConfigureUnplannedIssueRequest(options); builder.ConfigureUnplannedReceiptRequest(options); @@ -86,6 +87,7 @@ public static class StoreDbContextModelCreatingExtensions builder.ConfigureInventoryTransferNote(options); builder.ConfigureWarehouseTransferNote(options); builder.ConfigureIssueNote(options); + builder.ConfigureContainerNote(options); builder.ConfigureUnplannedReceiptNote(options); builder.ConfigureUnplannedIssueNote(options); builder.ConfigureIsolationNote(options); @@ -111,6 +113,7 @@ public static class StoreDbContextModelCreatingExtensions builder.ConfigureInspectJob(options); builder.ConfigurePutawayJob(options); builder.ConfigureIssueJob(options); + builder.ConfigureContainerJob(options); builder.ConfigureDeliverJob(options); builder.ConfigureJisDeliverJob(options); builder.ConfigurePurchaseReturnJob(options); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs index 504232437..24dc4c2c4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs @@ -54,7 +54,8 @@ public class StoreEntityFrameworkCoreModule : AbpModule context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); - context.Services.AddTransient(); + context.Services.AddTransient(); + context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); @@ -87,6 +88,7 @@ public class StoreEntityFrameworkCoreModule : AbpModule context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); + context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); @@ -112,6 +114,7 @@ public class StoreEntityFrameworkCoreModule : AbpModule context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); + context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); @@ -171,6 +174,8 @@ public class StoreEntityFrameworkCoreModule : AbpModule orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); options.Entity(orderOptions => orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); + options.Entity(orderOptions => + orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); options.Entity(orderOptions => orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); options.Entity(orderOptions => @@ -217,6 +222,8 @@ public class StoreEntityFrameworkCoreModule : AbpModule orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); options.Entity(orderOptions => orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); + options.Entity(orderOptions => + orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); options.Entity(orderOptions => orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); options.Entity(orderOptions => @@ -286,6 +293,8 @@ public class StoreEntityFrameworkCoreModule : AbpModule orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); options.Entity(orderOptions => orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); + options.Entity(orderOptions => + orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); options.Entity(orderOptions => orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); options.Entity(orderOptions => diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Win_in.Sfs.Wms.Store.EntityFrameworkCore.csproj b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Win_in.Sfs.Wms.Store.EntityFrameworkCore.csproj index cb0cd0733..b0aebac8d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Win_in.Sfs.Wms.Store.EntityFrameworkCore.csproj +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Win_in.Sfs.Wms.Store.EntityFrameworkCore.csproj @@ -39,10 +39,8 @@ - - diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ContainerJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ContainerJobEventHandler.cs new file mode 100644 index 000000000..1cc8b43df --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ContainerJobEventHandler.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.EventBus; +using Volo.Abp.Uow; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Event.BusinessJob; + +public class ContainerJobEventHandler : + StoreEventHandlerBase + , ILocalEventHandler> +{ + + private readonly IContainerNoteAppService _ContainerNoteAppService; + private readonly ILocationAppService _locationAppService; + + public ContainerJobEventHandler(IContainerNoteAppService ContainerNoteAppService, ILocationAppService locationAppService) + { + _ContainerNoteAppService = ContainerNoteAppService; + _locationAppService = locationAppService; + } + + /// + /// 执行后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCompletedEntityEventData eventData) + { + var entity = eventData.Entity; + var ContainerNote = await BuildContainerNoteAsync(entity).ConfigureAwait(false); + await _ContainerNoteAppService.CreateAsync(ContainerNote).ConfigureAwait(false); + } + + #region 私有 + + /// + /// 创建记录实体 + /// + /// + /// + private async Task BuildContainerNoteAsync(ContainerJob entity) + { + var ContainerNoteCreateInput = ObjectMapper.Map(entity); + ContainerNoteCreateInput.JobNumber = entity.Number; + var locationCodes = ContainerNoteCreateInput.Details.Select(p => p.ToLocationCode).Distinct().ToList(); + var locations = await _locationAppService.GetByCodesAsync(locationCodes).ConfigureAwait(false); + + ContainerNoteCreateInput.Details.RemoveAll(p => p.Qty == 0); + + foreach (var detail in ContainerNoteCreateInput.Details) + { + var location = locations.First(p => p.Code == detail.ToLocationCode); + + detail.ToLocationArea = location.AreaCode; + detail.ToLocationGroup = location.LocationGroupCode; + detail.ToLocationErpCode = location.ErpLocationCode; + detail.ToWarehouseCode = location.WarehouseCode; + } + + return ContainerNoteCreateInput; + } + + #endregion +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ContainerRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ContainerRequestEventHandler.cs new file mode 100644 index 000000000..e39f2cf7f --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ContainerRequestEventHandler.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.EventBus; +using Volo.Abp.Uow; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; + +public class ContainerRequestEventHandler + : StoreEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler> + , ILocalEventHandler> + , ILocalEventHandler>> + +{ + + private readonly IContainerJobAppService _ContainerJobApp; + + private readonly IContainerRequestManager _containerRequestManager; + + public ContainerRequestEventHandler( + IContainerJobAppService ContainerJobApp + , IContainerRequestManager containerRequestManager) + { + + _ContainerJobApp = ContainerJobApp; + _containerRequestManager = containerRequestManager; + } + + + /// + /// 创建后 + /// + /// Event data + [UnitOfWork] + public async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + if (entity.AutoSubmit) + { + await _containerRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } + } + + /// + /// 批量创建后 + /// + /// Event data + [UnitOfWork] + public async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entitys = eventData.Entity; + foreach (var entity in entitys) + { + if (entity.AutoSubmit) + { + await _containerRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } + } + } + + /// + /// 审批后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsAbortedEntityEventData eventData) + { + var entity = eventData.Entity; + + //东阳特殊逻辑 + if (!entity.DirectCreateNote) + { + + } + } + + /// + /// 执行后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsHandledEntityEventData eventData) + { + var entity = eventData.Entity; + + //东阳特殊逻辑 + if (entity.DirectCreateNote) + { + + } + else + { + var ContainerJobCreateInputs = await BuildContainerJobsAsync(entity).ConfigureAwait(false); + await _ContainerJobApp.CreateManyAsync(ContainerJobCreateInputs).ConfigureAwait(false); + } + } + + + #region 私有 + + + private async Task> BuildContainerJobsAsync(ContainerRequest request) + { + + var createInput = ObjectMapper.Map(request); + + + createInput.Details = new List(); + + + + return new List { createInput }; + } + + #endregion +} +