From 1473745cf39e94933179276a6d533bff2ceff79d Mon Sep 17 00:00:00 2001 From: zs <zhousong@weben-smart.com> Date: 周二, 06 5月 2025 16:22:55 +0800 Subject: [PATCH] 任务管理 --- HIAWms/web/src/widgets/WmsTask/Views/Pages/WmsTask/WmsTask.module.scss | 113 + HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskCreateOrUpdateDtoBase.cs | 130 + HIAWms/web/src/widgets/WmsTask/enum.ts | 15 HIAWms/web/src/widgets/WmsTask/Controllers/WmsTaskQueryDrawer.tsx | 308 ++++ HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsTaskAppService.cs | 456 ++++++ HIAWms/server/src/CMS.Plugin.HIAWms.Application/MapperProfiles/WmsTaskAutoMapperProfile.cs | 26 HIAWms/web/src/widgets/WmsTask/Models/WmsTaskQueryDrawer.ts | 44 HIAWms/web/src/widgets/WmsTask/type/type.d.ts | 45 HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskCreateDto.cs | 17 HIAWms/server/src/CMS.Plugin.HIAWms/Controller/WmsTaskController.cs | 188 ++ HIAWms/web/src/widgets/WmsTask/Views/WmsTask.module.scss | 7 HIAWms/web/src/widgets/WmsTask/Views/WmsTask.tsx | 80 + HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTasksImportModel.cs | 33 HIAWms/web/src/widgets/WmsInOutStockRecord/Views/Pages/WmsInOutStockRecord/Config.ts | 122 HIAWms/web/src/config/menu.ts | 40 HIAWms/web/src/widgets/WmsTask/Controllers/WmsTaskDrawer.tsx | 332 +++++ HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskDrawer/WmsTaskDrawer.tsx | 61 HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/GetWmsTaskInput.cs | 311 ++++ HIAWms/web/src/widgets/WmsTask/Models/WmsTask.ts | 41 HIAWms/web/src/widgets/WmsTask/Controllers/WmsTask.ts | 275 ++++ HIAWms/web/src/widgets/WmsTask/Views/config/WmsTask.json | 3 HIAWms/server/src/CMS.Plugin.HIAWms.Domain/WmsTask/IWmsTaskRepository.cs | 53 HIAWms/web/src/widgets/WmsTask/Views/Pages/WmsTask/WmsTask.tsx | 324 ++++ HIAWms/web/src/widgets/WmsTask/Models/Service/WmsTask.ts | 30 HIAWms/web/src/widgets/WmsTask/Models/Service/WmsTaskDrawer.ts | 34 HIAWms/web/src/widgets/WmsTask/Controllers/File.ts | 31 HIAWms/web/src/widgets/WmsTask/index.ts | 14 HIAWms/web/src/widgets/WmsTask/Models/WmsTaskDrawer.ts | 44 HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskQueryDrawer/WmsTaskQueryDrawer.tsx | 71 + HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Services/IWmsTaskAppService.cs | 46 Weben_CMS专用代码生成器/Code/Templete/Web/Controllers/EntityModeQueryDrawer模板.txt | 14 Weben_CMS专用代码生成器/Code/MainForm.cs | 3 HIAWms/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/Repositories/EfCoreWmsTaskRepository.cs | 113 + HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskDrawer/WmsTaskDrawer.module.scss | 3 HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskQueryDrawer/WmsTaskQueryDrawer.module.scss | 3 HIAWms/web/src/widgets/WmsTask/Views/Pages/WmsTask/Config.ts | 97 + HIAWms/web/src/widgets/WmsTask/Models/Service/WmsTaskQueryDrawer.ts | 35 HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskDto.cs | 205 +++ HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskExportModel.cs | 145 ++ HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskUpdateDto.cs | 13 Weben_CMS专用代码生成器/Code/Templete/AppService/AppService模板.txt | 2 41 files changed, 3,836 insertions(+), 91 deletions(-) diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/GetWmsTaskInput.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/GetWmsTaskInput.cs new file mode 100644 index 0000000..a3950c7 --- /dev/null +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/GetWmsTaskInput.cs @@ -0,0 +1,311 @@ +using CmsQueryExtensions.Extension; +using Volo.Abp.Application.Dtos; + +namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsTask; + +/// <summary> +/// Wms浠诲姟绠$悊琛ㄦ煡璇㈠弬鏁� +/// </summary> +public class GetWmsTaskInput : ExtensiblePagedAndSortedResultRequestDto +{ + + #region 鍏抽敭瀛楁煡璇� + + /// <summary> + /// 鍏抽敭瀛楁ā绯婃煡璇紙娉ㄦ剰鏄皬鍐欙紒锛� + /// </summary> + public string searchVal { get; set; } + + /// <summary> + /// 閫氱敤鏌ヨ閰嶇疆 (1:妯$硦鏌ヨ , 2:绮惧噯鏌ヨ)锛堟敞鎰忔槸灏忓啓锛侊級 + /// </summary> + public SearchFilterModeEnum searchVal_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ; + + /// <summary> + /// 瀛愭悳绱㈢粍浠朵紶閫掔殑閫氱敤鏌ヨ閰嶇疆鐨勫睘鎬у悕锛堟敞鎰忔槸灏忓啓锛侊級 + /// </summary> + [NoAutoQuery] + public string str_searchFormInputAttrs { get; set; } + /// <summary> + /// 瀛愭悳绱㈢粍浠朵紶閫掔殑閫氱敤鏌ヨ閰嶇疆鐨勫睘鎬у悕锛堟敞鎰忔槸灏忓啓锛侊級 + /// </summary> + public List<string> searchFormInputAttrs + { + get + { + if (!string.IsNullOrEmpty(str_searchFormInputAttrs)) + { + return str_searchFormInputAttrs.Split(',').ToList(); + } + return new List<string>(); + } + } + + #endregion + + /// <summary> + /// 宸烽亾 + /// </summary> + public int? Aisle { get; set; } + + /// <summary> + /// 宸烽亾-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum Aisle_FilterMode { get; set; }= SearchFilterModeEnum.绮惧噯鏌ヨ; + + /// <summary> + /// 鎵樼洏缂栧彿 + /// </summary> + public string ContainerNo { get; set; } + + /// <summary> + /// 鎵樼洏缂栧彿-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum ContainerNo_FilterMode { get; set; }= SearchFilterModeEnum.妯$硦鏌ヨ; + + /// <summary> + /// + /// </summary> + //琛ㄧず鏄� 楂樼骇鏌ヨ鑼冨洿鏌ヨ鐗规�� + [HighSearchRangeAttribute] + public List<string> CreationTime { get; set; } + + + /// <summary> + /// + /// </summary> + public string CreatorId { get; set; } + + /// <summary> + /// -鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum CreatorId_FilterMode { get; set; }= SearchFilterModeEnum.妯$硦鏌ヨ; + + /// <summary> + /// + /// </summary> + public string DeleterId { get; set; } + + /// <summary> + /// -鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum DeleterId_FilterMode { get; set; }= SearchFilterModeEnum.妯$硦鏌ヨ; + + /// <summary> + /// + /// </summary> + //琛ㄧず鏄� 楂樼骇鏌ヨ鑼冨洿鏌ヨ鐗规�� + [HighSearchRangeAttribute] + public List<string> DeletionTime { get; set; } + + + /// <summary> + /// 鍫嗗灈鏈篒D + /// </summary> + public int? DodeviceId { get; set; } + + /// <summary> + /// 鍫嗗灈鏈篒D-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum DodeviceId_FilterMode { get; set; }= SearchFilterModeEnum.绮惧噯鏌ヨ; + + /// <summary> + /// 璁惧绫诲瀷 + /// </summary> + public int? Dodevicetype { get; set; } + + /// <summary> + /// 璁惧绫诲瀷-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum Dodevicetype_FilterMode { get; set; }= SearchFilterModeEnum.绮惧噯鏌ヨ; + + /// <summary> + /// + /// </summary> + public bool? IsDeleted { get; set; } + + /// <summary> + /// -鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum IsDeleted_FilterMode { get; set; }= SearchFilterModeEnum.绮惧噯鏌ヨ; + + /// <summary> + /// 鏄惁绂佺敤 + /// </summary> + public bool? IsDisabled { get; set; } + + /// <summary> + /// 鏄惁绂佺敤-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum IsDisabled_FilterMode { get; set; }= SearchFilterModeEnum.绮惧噯鏌ヨ; + + /// <summary> + /// 涓嬩釜浠诲姟鏄惁鐢熸垚鎴愬姛 + /// </summary> + public int? IsNextTask { get; set; } + + /// <summary> + /// 涓嬩釜浠诲姟鏄惁鐢熸垚鎴愬姛-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum IsNextTask_FilterMode { get; set; }= SearchFilterModeEnum.绮惧噯鏌ヨ; + + /// <summary> + /// WCS鏄惁鍙互璇诲彇 + /// </summary> + public bool? IsRead { get; set; } + + /// <summary> + /// WCS鏄惁鍙互璇诲彇-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum IsRead_FilterMode { get; set; }= SearchFilterModeEnum.绮惧噯鏌ヨ; + + /// <summary> + /// + /// </summary> + //琛ㄧず鏄� 楂樼骇鏌ヨ鑼冨洿鏌ヨ鐗规�� + [HighSearchRangeAttribute] + public List<string> LastModificationTime { get; set; } + + + /// <summary> + /// + /// </summary> + public string LastModifierId { get; set; } + + /// <summary> + /// -鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum LastModifierId_FilterMode { get; set; }= SearchFilterModeEnum.妯$硦鏌ヨ; + + /// <summary> + /// 鍙彉鍙橀噺1 + /// </summary> + public string MutableParam1 { get; set; } + + /// <summary> + /// 鍙彉鍙橀噺1-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum MutableParam1_FilterMode { get; set; }= SearchFilterModeEnum.妯$硦鏌ヨ; + + /// <summary> + /// 鍙彉鍙橀噺2 + /// </summary> + public string MutableParam2 { get; set; } + + /// <summary> + /// 鍙彉鍙橀噺2-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum MutableParam2_FilterMode { get; set; }= SearchFilterModeEnum.妯$硦鏌ヨ; + + /// <summary> + /// 鍙彉鍙橀噺3 + /// </summary> + public string MutableParam3 { get; set; } + + /// <summary> + /// 鍙彉鍙橀噺3-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum MutableParam3_FilterMode { get; set; }= SearchFilterModeEnum.妯$硦鏌ヨ; + + /// <summary> + /// 瀛愪换鍔$被鍨� + /// </summary> + public int? SonTaskType { get; set; } + + /// <summary> + /// 瀛愪换鍔$被鍨�-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum SonTaskType_FilterMode { get; set; }= SearchFilterModeEnum.绮惧噯鏌ヨ; + + /// <summary> + /// 鎺掑簭 + /// </summary> + public int? Sort { get; set; } + + /// <summary> + /// 鎺掑簭-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum Sort_FilterMode { get; set; }= SearchFilterModeEnum.绮惧噯鏌ヨ; + + /// <summary> + /// 鏉ユ簮鍗曟嵁鍙� + /// </summary> + public string SourceOrderNo { get; set; } + + /// <summary> + /// 鏉ユ簮鍗曟嵁鍙�-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum SourceOrderNo_FilterMode { get; set; }= SearchFilterModeEnum.妯$硦鏌ヨ; + + /// <summary> + /// 璧峰搴撲綅 + /// </summary> + public string SourcePlace { get; set; } + + /// <summary> + /// 璧峰搴撲綅-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum SourcePlace_FilterMode { get; set; }= SearchFilterModeEnum.妯$硦鏌ヨ; + + /// <summary> + /// 璁惧浠诲姟鐘舵�� + /// </summary> + public int? TaskDodeviceStatus { get; set; } + + /// <summary> + /// 璁惧浠诲姟鐘舵��-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum TaskDodeviceStatus_FilterMode { get; set; }= SearchFilterModeEnum.绮惧噯鏌ヨ; + + /// <summary> + /// 浠诲姟绛夌骇 + /// </summary> + public int? TaskLevel { get; set; } + + /// <summary> + /// 浠诲姟绛夌骇-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum TaskLevel_FilterMode { get; set; }= SearchFilterModeEnum.绮惧噯鏌ヨ; + + /// <summary> + /// 浠诲姟鍙� + /// </summary> + public string TaskNo { get; set; } + + /// <summary> + /// 浠诲姟鍙�-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum TaskNo_FilterMode { get; set; }= SearchFilterModeEnum.妯$硦鏌ヨ; + + /// <summary> + /// 浠诲姟鐘舵�� + /// </summary> + public int? TaskStatus { get; set; } + + /// <summary> + /// 浠诲姟鐘舵��-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum TaskStatus_FilterMode { get; set; }= SearchFilterModeEnum.绮惧噯鏌ヨ; + + /// <summary> + /// 浠诲姟绫诲瀷 + /// </summary> + public int? TaskType { get; set; } + + /// <summary> + /// 浠诲姟绫诲瀷-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum TaskType_FilterMode { get; set; }= SearchFilterModeEnum.绮惧噯鏌ヨ; + + /// <summary> + /// 鐩爣搴撲綅 + /// </summary> + public string ToPlace { get; set; } + + /// <summary> + /// 鐩爣搴撲綅-鏌ヨ鍏崇郴杩愮畻绗� + /// </summary> + public SearchFilterModeEnum ToPlace_FilterMode { get; set; }= SearchFilterModeEnum.妯$硦鏌ヨ; + + +} diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskCreateDto.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskCreateDto.cs new file mode 100644 index 0000000..2953541 --- /dev/null +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskCreateDto.cs @@ -0,0 +1,17 @@ +namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsTask; + +/// <summary> +/// Wms浠诲姟绠$悊琛ㄥ垱寤哄弬鏁板璞� +/// </summary> +public class WmsTaskCreateDto : WmsTaskCreateOrUpdateDtoBase +{ + /// <summary> + /// 鎺掑簭 + /// </summary> + public virtual int? Sort { get; set; } + + /// <summary> + /// 鏄惁绂佺敤 + /// </summary> + public bool? IsDisabled { get; set; } = false; +} diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskCreateOrUpdateDtoBase.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskCreateOrUpdateDtoBase.cs new file mode 100644 index 0000000..11a88f6 --- /dev/null +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskCreateOrUpdateDtoBase.cs @@ -0,0 +1,130 @@ +using CMS.Plugin.HIAWms.Domain.Shared.Enums; +using System; +using Volo.Abp.Application.Dtos; + +namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsTask; + +/// <summary> +/// Wms浠诲姟绠$悊琛ㄥ垱寤烘垨鏇存柊鍩虹被 +/// </summary> +public abstract class WmsTaskCreateOrUpdateDtoBase : ExtensibleEntityDto +{ + /// <summary> + /// 宸烽亾 + /// </summary> + public int? Aisle { get; set; } + + /// <summary> + /// 鎵樼洏缂栧彿 + /// </summary> + public string? ContainerNo { get; set; } + + /// <summary> + /// + /// </summary> + public string? CreatorId { get; set; } + + /// <summary> + /// 鍫嗗灈鏈篒D + /// </summary> + public int? DodeviceId { get; set; } + + /// <summary> + /// 璁惧绫诲瀷 + /// </summary> + public int Dodevicetype { get; set; } + + /// <summary> + /// 鏄惁绂佺敤 + /// </summary> + public bool? IsDisabled { get; set; } + + /// <summary> + /// 涓嬩釜浠诲姟鏄惁鐢熸垚鎴愬姛 + /// </summary> + public int? IsNextTask { get; set; } + + /// <summary> + /// WCS鏄惁鍙互璇诲彇 + /// </summary> + public bool IsRead { get; set; } + + /// <summary> + /// + /// </summary> + public string? LastModifierId { get; set; } + + /// <summary> + /// 鍙彉鍙橀噺1 + /// </summary> + public string? MutableParam1 { get; set; } + + /// <summary> + /// 鍙彉鍙橀噺2 + /// </summary> + public string? MutableParam2 { get; set; } + + /// <summary> + /// 鍙彉鍙橀噺3 + /// </summary> + public string? MutableParam3 { get; set; } + + /// <summary> + /// 瀛愪换鍔$被鍨� + /// </summary> + public SonTaskTypeEnum? SonTaskType { get; set; } + + /// <summary> + /// 鎺掑簭 + /// </summary> + public int Sort { get; set; } + + /// <summary> + /// 鏉ユ簮鍗曟嵁鍙� + /// </summary> + public string? SourceOrderNo { get; set; } + + /// <summary> + /// 璧峰搴撲綅 + /// </summary> + public string? SourcePlace { get; set; } + + /// <summary> + /// 璁惧浠诲姟鐘舵�� + /// </summary> + public int TaskDodeviceStatus { get; set; } + + /// <summary> + /// 浠诲姟绛夌骇 + /// </summary> + public int TaskLevel { get; set; } + + /// <summary> + /// 浠诲姟鍙� + /// </summary> + public string TaskNo { get; set; } + + /// <summary> + /// 浠诲姟鐘舵�� + /// </summary> + public WmsTaskStatus TaskStatus { get; set; } + + /// <summary> + /// 浠诲姟绫诲瀷 + /// </summary> + public TaskTypeEnum TaskType { get; set; } + + /// <summary> + /// 鐩爣搴撲綅 + /// </summary> + public string? ToPlace { get; set; } + + + + /// <summary> + /// Initializes a new instance of the <see cref="WmsTaskCreateOrUpdateDtoBase"/> class. + /// </summary> + public WmsTaskCreateOrUpdateDtoBase() : base(false) + { + } +} diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskDto.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskDto.cs new file mode 100644 index 0000000..e5efa21 --- /dev/null +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskDto.cs @@ -0,0 +1,205 @@ +using CMS.Plugin.HIAWms.Domain.Shared.Enums; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Data; +using Volo.Abp.Domain.Entities; + + +namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsTask; + +/// <summary> +/// Wms浠诲姟绠$悊琛ㄦ暟鎹弬鏁板璞� +/// </summary> +public class WmsTaskDto: ExtensibleEntityDto<Guid>, IHasConcurrencyStamp +{ + /// <summary> + /// 宸烽亾 + /// </summary> + public int? Aisle { get; set; } + + /// <summary> + /// + /// </summary> + public string? ConcurrencyStamp { get; set; } + + /// <summary> + /// 鎵樼洏缂栧彿 + /// </summary> + public string? ContainerNo { get; set; } + + /// <summary> + /// + /// </summary> + public DateTime CreationTime { get; set; } + + /// <summary> + /// + /// </summary> + public string? CreatorId { get; set; } + + /// <summary> + /// + /// </summary> + public string? DeleterId { get; set; } + + /// <summary> + /// + /// </summary> + public DateTime? DeletionTime { get; set; } + + /// <summary> + /// 鍫嗗灈鏈篒D + /// </summary> + public int? DodeviceId { get; set; } + + /// <summary> + /// 璁惧绫诲瀷 + /// </summary> + public int Dodevicetype { get; set; } + + /// <summary> + /// + /// </summary> + public ExtraPropertyDictionary? ExtraProperties { get; set; } + + /// <summary> + /// + /// </summary> + public bool IsDeleted { get; set; } + + /// <summary> + /// 鏄惁绂佺敤 + /// </summary> + public bool? IsDisabled { get; set; } + + /// <summary> + /// 涓嬩釜浠诲姟鏄惁鐢熸垚鎴愬姛 + /// </summary> + public int? IsNextTask { get; set; } + + /// <summary> + /// WCS鏄惁鍙互璇诲彇 + /// </summary> + public bool IsRead { get; set; } + + /// <summary> + /// + /// </summary> + public DateTime? LastModificationTime { get; set; } + + /// <summary> + /// + /// </summary> + public string? LastModifierId { get; set; } + + /// <summary> + /// 鍙彉鍙橀噺1 + /// </summary> + public string? MutableParam1 { get; set; } + + /// <summary> + /// 鍙彉鍙橀噺2 + /// </summary> + public string? MutableParam2 { get; set; } + + /// <summary> + /// 鍙彉鍙橀噺3 + /// </summary> + public string? MutableParam3 { get; set; } + + /// <summary> + /// 瀛愪换鍔$被鍨� + /// </summary> + public SonTaskTypeEnum? SonTaskType { get; set; } + + /// <summary> + /// 瀛愪换鍔$被鍨� + /// </summary> + public string? SonTaskTypeDesc + { + get + { + return GetEnumDescriptionUtil.GetEnumDescription(SonTaskType); + } + } + /// <summary> + /// 鎺掑簭 + /// </summary> + public int Sort { get; set; } + + /// <summary> + /// 鏉ユ簮鍗曟嵁鍙� + /// </summary> + public string? SourceOrderNo { get; set; } + + /// <summary> + /// 璧峰搴撲綅 + /// </summary> + public string? SourcePlace { get; set; } + + /// <summary> + /// 璁惧浠诲姟鐘舵�� + /// </summary> + public int TaskDodeviceStatus { get; set; } + + /// <summary> + /// 浠诲姟绛夌骇 + /// </summary> + public int TaskLevel { get; set; } + + /// <summary> + /// 浠诲姟鍙� + /// </summary> + public string TaskNo { get; set; } + + /// <summary> + /// 浠诲姟鐘舵�� + /// </summary> + public WmsTaskStatus TaskStatus { get; set; } + + /// <summary> + /// 浠诲姟鐘舵�� + /// </summary> + public string TaskStatusDesc + { + get + { + return GetEnumDescriptionUtil.GetEnumDescription(TaskStatus); + } + } + /// <summary> + /// 浠诲姟绫诲瀷 + /// </summary> + public TaskTypeEnum TaskType { get; set; } + + /// <summary> + /// 浠诲姟绫诲瀷 + /// </summary> + public string TaskTypeDesc + { + get + { + return GetEnumDescriptionUtil.GetEnumDescription(TaskType); + } + } + /// <summary> + /// 鐩爣搴撲綅 + /// </summary> + public string? ToPlace { get; set; } + + + + /// <summary> + /// Gets the export data. + /// </summary> + /// <returns></returns> + public Dictionary<string, object> GetExportData() + { + var exportData = new Dictionary<string, object>(); + foreach (var property in this.GetType().GetProperties()) + { + exportData.Add(property.Name, property.GetValue(this)); + } + + return exportData; + } +} diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskExportModel.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskExportModel.cs new file mode 100644 index 0000000..2618ddc --- /dev/null +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskExportModel.cs @@ -0,0 +1,145 @@ +using MiniExcelLibs.Attributes; +using System.ComponentModel.DataAnnotations; +using System; +using System.ComponentModel; +using CMS.Plugin.HIAWms.Domain.Shared.Enums; +namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsTask; + +/// <summary> +/// Wms浠诲姟绠$悊琛ㄥ鍑烘ā鍨� +/// </summary> +public class WmsTaskExportModel +{ + /// <summary> + /// 宸烽亾 + /// </summary> + [ExcelColumn(Name = "宸烽亾", Width = 25)] + public int? Aisle { get; set; } + + /// <summary> + /// 鎵樼洏缂栧彿 + /// </summary> + [ExcelColumn(Name = "鎵樼洏缂栧彿", Width = 25)] + public string ContainerNo { get; set; } + + /// <summary> + /// 鍫嗗灈鏈篒D + /// </summary> + [ExcelColumn(Name = "鍫嗗灈鏈篒D", Width = 25)] + public int? DodeviceId { get; set; } + + /// <summary> + /// 璁惧绫诲瀷 + /// </summary> + [ExcelColumn(Name = "璁惧绫诲瀷", Width = 25)] + public int Dodevicetype { get; set; } + + /// <summary> + /// 鏄惁绂佺敤 + /// </summary> + [ExcelColumn(Name = "鏄惁绂佺敤", Width = 25)] + public bool? IsDisabled { get; set; } + + /// <summary> + /// 涓嬩釜浠诲姟鏄惁鐢熸垚鎴愬姛 + /// </summary> + [ExcelColumn(Name = "涓嬩釜浠诲姟鏄惁鐢熸垚鎴愬姛", Width = 25)] + public int? IsNextTask { get; set; } + + /// <summary> + /// WCS鏄惁鍙互璇诲彇 + /// </summary> + [ExcelColumn(Name = "WCS鏄惁鍙互璇诲彇", Width = 25)] + public bool IsRead { get; set; } + + /// <summary> + /// 鍙彉鍙橀噺1 + /// </summary> + [ExcelColumn(Name = "鍙彉鍙橀噺1", Width = 25)] + public string MutableParam1 { get; set; } + + /// <summary> + /// 鍙彉鍙橀噺2 + /// </summary> + [ExcelColumn(Name = "鍙彉鍙橀噺2", Width = 25)] + public string MutableParam2 { get; set; } + + /// <summary> + /// 鍙彉鍙橀噺3 + /// </summary> + [ExcelColumn(Name = "鍙彉鍙橀噺3", Width = 25)] + public string MutableParam3 { get; set; } + + /// <summary> + /// 瀛愪换鍔$被鍨� + /// </summary> + [ExcelColumn(Name = "瀛愪换鍔$被鍨�", Width = 25)] + public SonTaskTypeEnum? SonTaskType { get; set; } + + /// <summary> + /// 鎺掑簭 + /// </summary> + [ExcelColumn(Name = "鎺掑簭", Width = 25)] + public int Sort { get; set; } + + /// <summary> + /// 鏉ユ簮鍗曟嵁鍙� + /// </summary> + [ExcelColumn(Name = "鏉ユ簮鍗曟嵁鍙�", Width = 25)] + public string SourceOrderNo { get; set; } + + /// <summary> + /// 璧峰搴撲綅 + /// </summary> + [ExcelColumn(Name = "璧峰搴撲綅", Width = 25)] + public string SourcePlace { get; set; } + + /// <summary> + /// 璁惧浠诲姟鐘舵�� + /// </summary> + [ExcelColumn(Name = "璁惧浠诲姟鐘舵��", Width = 25)] + public int TaskDodeviceStatus { get; set; } + + /// <summary> + /// 浠诲姟绛夌骇 + /// </summary> + [ExcelColumn(Name = "浠诲姟绛夌骇", Width = 25)] + public int TaskLevel { get; set; } + + /// <summary> + /// 浠诲姟鍙� + /// </summary> + [ExcelColumn(Name = "浠诲姟鍙�", Width = 25)] + public string TaskNo { get; set; } + + /// <summary> + /// 浠诲姟鐘舵�� + /// </summary> + [ExcelColumn(Name = "浠诲姟鐘舵��", Width = 25)] + public WmsTaskStatus TaskStatus { get; set; } + + /// <summary> + /// 浠诲姟绫诲瀷 + /// </summary> + [ExcelColumn(Name = "浠诲姟绫诲瀷", Width = 25)] + public TaskTypeEnum TaskType { get; set; } + + /// <summary> + /// 鐩爣搴撲綅 + /// </summary> + [ExcelColumn(Name = "鐩爣搴撲綅", Width = 25)] + public string ToPlace { get; set; } + + + + public Dictionary<string, object> GetExportData() + { + var exportData = new Dictionary<string, object>(); + foreach (var property in this.GetType().GetProperties()) + { + exportData.Add(property.Name, property.GetValue(this)); + } + + return exportData; + } +} diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskUpdateDto.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskUpdateDto.cs new file mode 100644 index 0000000..9b65406 --- /dev/null +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTaskUpdateDto.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Domain.Entities; +namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsTask; + +/// <summary> +/// Wms浠诲姟绠$悊琛ㄦ洿鏂板弬鏁板璞� +/// </summary> +public class WmsTaskUpdateDto : WmsTaskCreateOrUpdateDtoBase, IHasConcurrencyStamp +{ + /// <summary> + /// 骞跺彂鎴� + /// </summary> + public string ConcurrencyStamp { get; set; } +} diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTasksImportModel.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTasksImportModel.cs new file mode 100644 index 0000000..cb9735b --- /dev/null +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsTask/WmsTasksImportModel.cs @@ -0,0 +1,33 @@ + +namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsTask +{ + /// <summary> + /// Wms浠诲姟绠$悊琛ㄥ鍏ユā鍨� + /// </summary> + public class WmsTasksImportModel + { + private List<WmsTaskImportModel> _WmsTasks = new(); + + public List<WmsTaskImportModel> WmsTasks + { + get => _WmsTasks; + set + { + _WmsTasks = value; + var rowIndex = 2; + _WmsTasks?.ForEach(x => x.RowIndex = rowIndex++); + } + } + + /// <summary> + /// Wms浠诲姟绠$悊琛ㄥ鍏ユā鍨� + /// </summary> + public class WmsTaskImportModel : WmsTaskExportModel + { + /// <summary> + /// 琛屽彿 + /// </summary> + public int RowIndex { get; set; } + } + } +} diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Services/IWmsTaskAppService.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Services/IWmsTaskAppService.cs new file mode 100644 index 0000000..de7f55d --- /dev/null +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Application.Contracts/Services/IWmsTaskAppService.cs @@ -0,0 +1,46 @@ +using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsTask; +using Volo.Abp.Application.Services; + +namespace CMS.Plugin.HIAWms.Application.Contracts.Services; + +/// <summary> +/// Wms浠诲姟绠$悊琛ㄥ簲鐢ㄦ湇鍔℃帴鍙� +/// </summary> +public interface IWmsTaskAppService : ICrudAppService<WmsTaskDto, Guid, GetWmsTaskInput, WmsTaskCreateDto, WmsTaskUpdateDto> +{ + /// <summary> + /// 鍏嬮殕Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="ids"></param> + /// <returns></returns> + Task<List<WmsTaskDto>> CloneAsync(IEnumerable<Guid> ids); + + /// <summary> + /// 鍒犻櫎Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="ids"></param> + /// <returns></returns> + Task DeleteManyAsync(IEnumerable<Guid> ids); + + /// <summary> + /// 璋冩暣鎺掑簭Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="id"></param> + /// <param name="sort"></param> + /// <returns></returns> + Task AdjustSortAsync(Guid id, int sort); + + /// <summary> + /// 瀵煎叆Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + Task ImportAsync(WmsTasksImportModel input); + + /// <summary> + /// 瀵煎嚭Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(GetWmsTaskInput input); +} diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsTaskAppService.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsTaskAppService.cs new file mode 100644 index 0000000..11341f9 --- /dev/null +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsTaskAppService.cs @@ -0,0 +1,456 @@ +using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsTask; +using CMS.Plugin.HIAWms.Application.Contracts.Services; +using CMS.Plugin.HIAWms.Domain.Shared; +using CMS.Plugin.HIAWms.Domain.Shared.Util; +using CMS.Plugin.HIAWms.Domain.WmsTask; +using CmsQueryExtensions.Extension; +using System.Linq.Expressions; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Data; +using Volo.Abp.ObjectExtending; +using Volo.Abp.ObjectMapping; + +namespace CMS.Plugin.HIAWms.Application.Implements; + +/// <summary> +/// Wms浠诲姟绠$悊琛ㄥ簲鐢ㄦ湇鍔� +/// </summary> +public class WmsTaskAppService : CMSPluginAppService, IWmsTaskAppService +{ + private readonly IWmsTaskRepository wmsTaskRepository; + + /// <summary> + /// Initializes a new instance of the <see cref="WmsTaskAppService"/> class. + /// </summary> + /// <param name="WmsTaskRepository">The task job repository.</param> + public WmsTaskAppService(IWmsTaskRepository _WmsTaskRepository) + { + wmsTaskRepository = _WmsTaskRepository; + } + + /// <summary> + /// 鑾峰彇鎸囧畾Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="id"></param> + /// <returns></returns> + public virtual async Task<WmsTaskDto> GetAsync(Guid id) + { + return ObjectMapper.Map<WmsTask, WmsTaskDto>(await wmsTaskRepository.GetAsync(id)); + } + + /// <summary> + /// 鍒嗛〉鑾峰彇Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + public virtual async Task<PagedResultDto<WmsTaskDto>> GetListAsync(GetWmsTaskInput input) + { + Check.NotNull(input, nameof(input)); + + if (input.Sorting.IsNullOrWhiteSpace()) + { + input.Sorting = nameof(WmsTask.Sort); + } + + #region 鍔ㄦ�佹瀯閫犳煡璇㈡潯浠� + + //鍔ㄦ�佹瀯閫犳煡璇㈡潯浠� + var whereConditions = DynamicGetQueryParams(input); + + #endregion + + var count = await wmsTaskRepository.GetCountAsync(whereConditions); + var list = await wmsTaskRepository.GetListAsync(whereConditions, input.Sorting, input.MaxResultCount, input.SkipCount); + + return new PagedResultDto<WmsTaskDto>(count, ObjectMapper.Map<List<WmsTask>, List<WmsTaskDto>>(list)); + } + + /// <summary> + /// 鍔ㄦ�佹瀯閫犳煡璇㈡潯浠� + /// </summary> + /// <param name="input">杈撳叆鍙傛暟</param> + /// <returns></returns> + private FunReturnResultModel<Expression<Func<WmsTask, bool>>> DynamicGetQueryParams(GetWmsTaskInput input) + { + //鍔ㄦ�佹瀯閫犳煡璇㈡潯浠� + var whereConditions = WhereConditionsExtensions.GetWhereConditions<WmsTask, GetWmsTaskInput>(input); + if (!whereConditions.IsSuccess) + { + throw new Exception("鍔ㄦ�佹瀯閫犳煡璇㈡潯浠跺け璐�:" + whereConditions.ErrMsg); + } + + //涔熷彲鍐嶆鑷畾涔夋瀯寤烘煡璇㈡潯浠� + Expression<Func<WmsTask, bool>> extendExpression = a => a.IsDeleted == false; + // 浣跨敤 System.Linq.PredicateBuilder 鐨� And + var pres = (System.Linq.Expressions.Expression<Func<WmsTask, bool>>)(whereConditions.data); + whereConditions.data = System.Linq.PredicateBuilder.And(pres, extendExpression); + + return whereConditions; + } + + /// <summary> + /// 鏂板缓Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + /// <exception cref="UserFriendlyException"></exception> + public virtual async Task<WmsTaskDto> CreateAsync(WmsTaskCreateDto input) + { + await CheckCreateOrUpdateDtoAsync(input); + + var exist = await wmsTaskRepository.NameExistAsync(input.TaskNo); + if (exist) + { + throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.TaskNo]); + } + + var maxSort = await wmsTaskRepository.GetMaxSortAsync(); + var sort = input.Sort ?? maxSort; + + var insertObj = ObjectMapper.Map<WmsTaskCreateDto, WmsTask>(input); + insertObj.Sort = sort; + input.MapExtraPropertiesTo(insertObj, MappingPropertyDefinitionChecks.None); + + await wmsTaskRepository.InsertAsync(insertObj); + + if (input.Sort.HasValue && insertObj.Sort != maxSort) + { + await AdjustSortAsync(insertObj.Id, insertObj.Sort); + } + + return ObjectMapper.Map<WmsTask, WmsTaskDto>(insertObj); + } + + /// <summary> + /// 鏇存柊Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="id"></param> + /// <param name="input"></param> + /// <returns></returns> + /// <exception cref="UserFriendlyException"></exception> + public virtual async Task<WmsTaskDto> UpdateAsync(Guid id, WmsTaskUpdateDto input) + { + await CheckCreateOrUpdateDtoAsync(input); + + var updateObj = await wmsTaskRepository.GetAsync(id); + var exist = await wmsTaskRepository.NameExistAsync(input.TaskNo, updateObj.Id); + if (exist) + { + throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.TaskNo]); + } + + updateObj.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp); + input.MapExtraPropertiesTo(updateObj, MappingPropertyDefinitionChecks.None); + + updateObj.Aisle = input.Aisle; + updateObj.ContainerNo = input.ContainerNo; + updateObj.DodeviceId = input.DodeviceId; + updateObj.Dodevicetype = input.Dodevicetype; + updateObj.IsDisabled = input.IsDisabled; + updateObj.IsNextTask = input.IsNextTask; + updateObj.IsRead = input.IsRead; + updateObj.MutableParam1 = input.MutableParam1; + updateObj.MutableParam2 = input.MutableParam2; + updateObj.MutableParam3 = input.MutableParam3; + updateObj.SonTaskType = input.SonTaskType; + updateObj.SourceOrderNo = input.SourceOrderNo; + updateObj.SourcePlace = input.SourcePlace; + updateObj.TaskDodeviceStatus = input.TaskDodeviceStatus; + updateObj.TaskLevel = input.TaskLevel; + updateObj.TaskNo = input.TaskNo; + updateObj.TaskStatus = input.TaskStatus; + updateObj.TaskType = input.TaskType; + updateObj.ToPlace = input.ToPlace; + + + await wmsTaskRepository.UpdateAsync(updateObj); + + return ObjectMapper.Map<WmsTask, WmsTaskDto>(updateObj); + } + + /// <summary> + /// 鍏嬮殕Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="ids"></param> + /// <returns></returns> + public async Task<List<WmsTaskDto>> CloneAsync(IEnumerable<Guid> ids) + { + //var wmsTasks = new List<WmsTask>(); + //if (ids != null) + //{ + // var sort = await wmsTaskRepository.GetMaxSortAsync(); + // foreach (var id in ids) + // { + // var WmsTask = await wmsTaskRepository.FindAsync(id); + // if (WmsTask != null) + // { + // var name = WmsTask.Name + WmsTaskConsts.CloneTag; + // var notExist = false; + // while (!notExist) + // { + // var exist = await wmsTaskRepository.NameExistAsync(name); + // if (exist || wmsTasks.Any(x => x.Name == name)) + // { + // name += WmsTaskConsts.CloneTag; + // continue; + // } + + // notExist = true; + // } + + // //WmsTask = await wmsTaskRepository.InsertAsync(WmsTask.Clone(GuidGenerator.Create(), name, sort++)); + // wmsTasks.Add(WmsTask); + // } + // } + //} + + //return ObjectMapper.Map<List<WmsTask>, List<WmsTaskDto>>(wmsTasks); + return new List<WmsTaskDto>(); + } + + /// <summary> + /// 鍒犻櫎鍗曚釜Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="id"></param> + /// <returns></returns> + public virtual Task DeleteAsync(Guid id) + { + return wmsTaskRepository.DeleteAsync(id); + } + + /// <summary> + /// 鍒犻櫎澶氫釜Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="ids"></param> + /// <returns></returns> + public async Task DeleteManyAsync(IEnumerable<Guid> ids) + { + foreach (var id in ids) + { + await DeleteAsync(id); + } + } + + /// <summary> + /// 璋冩暣鎺掑簭Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="id"></param> + /// <param name="sort"></param> + /// <returns></returns> + public virtual async Task AdjustSortAsync(Guid id, int sort) + { + var list = await wmsTaskRepository.GetListAsync(null, nameof(WmsTask.Sort)); + if (list != null && list.Any()) + { + var initSort = 1; + list.ForEach(x => x.AdjustSort(initSort++)); + var entity = list.FirstOrDefault(x => x.Id == id); + if (entity != null) + { + if (sort == 1) + { + list.Where(x => x.Id != id).ToList()?.ForEach(x => x.AdjustSort(x.Sort + 1)); + } + else if (entity.Sort > sort) + { + list.Where(x => x.Id != id && x.Sort >= sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort + 1)); + list.Where(x => x.Id != id && x.Sort < sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort - 1)); + } + else if (entity.Sort < sort) + { + list.Where(x => x.Id != id && x.Sort > sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort + 1)); + list.Where(x => x.Id != id && x.Sort <= sort).ToList()?.ForEach(x => x.AdjustSort(x.Sort - 1)); + } + + entity.AdjustSort(sort); + } + } + + await wmsTaskRepository.UpdateManyAsync(list); + } + + /// <summary> + /// 瀵煎叆Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + /// <exception cref="UserFriendlyException"></exception> + public async Task ImportAsync(WmsTasksImportModel input) + { + Check.NotNull(input, nameof(input)); + + var wmsTaskCreateDtos = new List<(int RowIndex, WmsTaskCreateDto Item)>(); + var wmsTaskUpdateDtos = new List<(int RowIndex, Guid Id, WmsTaskUpdateDto Item)>(); + var importItems = input.WmsTasks; + + if (importItems != null && importItems.Any()) + { + #region 瀵煎叆鏍¢獙 + + // 鍒ゆ柇鍚嶇О鏄惁閲嶅锛屽苟杈撳嚭绗嚑琛岄噸澶� + var duplicateWmsTasks = importItems.GroupBy(x => x.TaskNo).Where(x => x.Count() > 1).ToList(); + if (duplicateWmsTasks?.Any() == true) + { + var duplicateWmsTaskMsgs = duplicateWmsTasks.Select(x => $"绗� {string.Join(",", x.Select(x => x.RowIndex))} 琛岋細{x.Key} 鍚嶇О閲嶅"); + var errorMsg = $"瀵煎叆澶辫触锛侀厤缃紝 {string.Join(",", duplicateWmsTaskMsgs)}锛岀粓姝㈠鍏�"; + throw new UserFriendlyException(errorMsg); + } + + #endregion + + foreach (var impItem in importItems) + { + if (impItem.TaskNo.IsNullOrWhiteSpace()) + { + continue; + } + + if (impItem.TaskNo.IsNullOrWhiteSpace()) + { + var errorMsg = $"瀵煎叆澶辫触锛侀厤缃紝绗瑊impItem.RowIndex}琛岋細WmsTask鍚嶇О涓嶈兘涓虹┖"; + throw new UserFriendlyException(errorMsg); + } + + var oldWmsTask = await wmsTaskRepository.FindByNameAsync(impItem.TaskNo); + if (oldWmsTask != null) + { + var wmsTaskUpdateDto = new WmsTaskUpdateDto + { + Aisle = impItem.Aisle, +ContainerNo = impItem.ContainerNo, +DodeviceId = impItem.DodeviceId, +Dodevicetype = impItem.Dodevicetype, +IsDisabled = impItem.IsDisabled, +IsNextTask = impItem.IsNextTask, +IsRead = impItem.IsRead, +MutableParam1 = impItem.MutableParam1, +MutableParam2 = impItem.MutableParam2, +MutableParam3 = impItem.MutableParam3, +SonTaskType = impItem.SonTaskType, +SourceOrderNo = impItem.SourceOrderNo, +SourcePlace = impItem.SourcePlace, +TaskDodeviceStatus = impItem.TaskDodeviceStatus, +TaskLevel = impItem.TaskLevel, +TaskNo = impItem.TaskNo, +TaskStatus = impItem.TaskStatus, +TaskType = impItem.TaskType, +ToPlace = impItem.ToPlace, + + }; + + wmsTaskUpdateDtos.Add((impItem.RowIndex, oldWmsTask.Id, wmsTaskUpdateDto)); + } + else + { + var wmsTaskCreateDto = new WmsTaskCreateDto + { + Aisle = impItem.Aisle, +ContainerNo = impItem.ContainerNo, +DodeviceId = impItem.DodeviceId, +Dodevicetype = impItem.Dodevicetype, +IsDisabled = impItem.IsDisabled, +IsNextTask = impItem.IsNextTask, +IsRead = impItem.IsRead, +MutableParam1 = impItem.MutableParam1, +MutableParam2 = impItem.MutableParam2, +MutableParam3 = impItem.MutableParam3, +SonTaskType = impItem.SonTaskType, +SourceOrderNo = impItem.SourceOrderNo, +SourcePlace = impItem.SourcePlace, +TaskDodeviceStatus = impItem.TaskDodeviceStatus, +TaskLevel = impItem.TaskLevel, +TaskNo = impItem.TaskNo, +TaskStatus = impItem.TaskStatus, +TaskType = impItem.TaskType, +ToPlace = impItem.ToPlace, + + }; + + wmsTaskCreateDtos.Add((impItem.RowIndex, wmsTaskCreateDto)); + } + } + } + + // 鏂板 + foreach (var wmsTaskDto in wmsTaskCreateDtos) + { + try + { + await CreateAsync(wmsTaskDto.Item); + } + catch (Exception e) + { + var errorMsg = $"瀵煎叆澶辫触锛侀厤缃紝绗瑊wmsTaskDto.RowIndex}琛岋細{e.Message}锛岀粓姝㈠鍏�"; + throw new UserFriendlyException(errorMsg); + } + } + + // 鏇存柊 + foreach (var wmsTaskDto in wmsTaskUpdateDtos) + { + try + { + await UpdateAsync(wmsTaskDto.Id, wmsTaskDto.Item); + } + catch (Exception e) + { + var errorMsg = $"瀵煎叆澶辫触锛侀厤缃紝绗瑊wmsTaskDto.RowIndex}琛岋細{e.Message}锛岀粓姝㈠鍏�"; + throw new UserFriendlyException(errorMsg); + } + } + } + + /// <summary> + /// 瀵煎嚭Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + public async Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(GetWmsTaskInput input) + { + Check.NotNull(input, nameof(input)); + + if (input.Sorting.IsNullOrWhiteSpace()) + { + input.Sorting = nameof(WmsTask.Sort); + } + + #region 鍔ㄦ�佹瀯閫犳煡璇㈡潯浠� + + //鍔ㄦ�佹瀯閫犳煡璇㈡潯浠� + var whereConditions = DynamicGetQueryParams(input); + + #endregion + + + var list = await wmsTaskRepository.GetListAsync(whereConditions, input.Sorting, input.MaxResultCount, input.SkipCount, includeDetails: true); + var result = ObjectMapper.Map<List<WmsTask>, List<WmsTaskDto>>(list); + + var sheets = new Dictionary<string, object> + { + ["閰嶇疆"] = ExportHelper.ConvertListToExportData(result), + }; + + var fileName = result.Count > 1 ? "Wms浠诲姟绠$悊琛ㄥ垪琛�" : result.Count == 1 ? result[0]?.TaskNo : "WmsTask妯$増"; + return (sheets, fileName); + } + + /// <summary> + /// 鏍¢獙Wms浠诲姟绠$悊琛紝褰撴柊寤烘垨鏇存柊鏃� + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + protected Task CheckCreateOrUpdateDtoAsync(WmsTaskCreateOrUpdateDtoBase input) + { + Check.NotNull(input, nameof(input)); + Check.NotNull(input.Dodevicetype, "璁惧绫诲瀷"); + Check.NotNull(input.IsRead, "WCS鏄惁鍙互璇诲彇"); + Check.NotNull(input.TaskDodeviceStatus, "璁惧浠诲姟鐘舵��"); + Check.NotNull(input.TaskLevel, "浠诲姟绛夌骇"); + Check.NotNullOrWhiteSpace(input.TaskNo, "浠诲姟鍙�", 50); + Check.NotNull(input.TaskStatus, "浠诲姟鐘舵��"); + Check.NotNull(input.TaskType, "浠诲姟绫诲瀷"); + + return Task.CompletedTask; + } +} diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Application/MapperProfiles/WmsTaskAutoMapperProfile.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Application/MapperProfiles/WmsTaskAutoMapperProfile.cs new file mode 100644 index 0000000..6ade231 --- /dev/null +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Application/MapperProfiles/WmsTaskAutoMapperProfile.cs @@ -0,0 +1,26 @@ +using AutoMapper; +using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsTask; +using CMS.Plugin.HIAWms.Domain.WmsTask; +using Volo.Abp.ObjectExtending; + +namespace CMS.Plugin.HIAWms.Application.MapperProfiles; + +/// <summary> +/// Wms浠诲姟绠$悊琛ˋutoMapper閰嶇疆 +/// </summary> +/// <seealso cref="AutoMapper.Profile" /> +public class WmsTaskAutoMapperProfile : Profile +{ + /// <summary> + /// Initializes a new instance of the <see cref="WmsTaskAutoMapperProfile"/> class. + /// </summary> + public WmsTaskAutoMapperProfile() + { + /* You can configure your AutoMapper mapping configuration here. + * Alternatively, you can split your mapping configurations + * into multiple profile classes for a better organization. */ + CreateMap<WmsTask, WmsTaskDto>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); + CreateMap<WmsTaskCreateDto, WmsTask>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); + CreateMap<GetWmsTaskInput, WmsTask>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); + } +} diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Domain/WmsTask/IWmsTaskRepository.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Domain/WmsTask/IWmsTaskRepository.cs new file mode 100644 index 0000000..89545bb --- /dev/null +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Domain/WmsTask/IWmsTaskRepository.cs @@ -0,0 +1,53 @@ +using CmsQueryExtensions.Extension; +using System.Linq.Expressions; +using Volo.Abp.Domain.Repositories; + +namespace CMS.Plugin.HIAWms.Domain.WmsTask; + +/// <summary> +/// Wms浠诲姟绠$悊琛ㄤ粨鍌� +/// </summary> +public interface IWmsTaskRepository : IBasicRepository<WmsTask, Guid> +{ + /// <summary> + /// 鎸夌収鍚嶇О鏌ユ壘Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="name"></param> + /// <param name="cancellationToken"></param> + /// <returns></returns> + Task<WmsTask> FindByNameAsync(string name, CancellationToken cancellationToken = default); + + /// <summary> + /// 楠岃瘉鍚嶇О鏄惁瀛樺湪Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="name"></param> + /// <param name="id"></param> + /// <returns></returns> + Task<bool> NameExistAsync(string name, Guid? id = null); + + /// <summary> + /// 鑾峰彇鏈�澶ф帓搴廤ms浠诲姟绠$悊琛� + /// </summary> + /// <returns></returns> + Task<int> GetMaxSortAsync(); + + /// <summary> + /// 鑾峰彇鍒嗛〉鍒楄〃Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="whereConditions"></param> + /// <param name="sorting"></param> + /// <param name="maxResultCount"></param> + /// <param name="skipCount"></param> + /// <param name="includeDetails"></param> + /// <param name="cancellationToken"></param> + /// <returns></returns> + Task<List<WmsTask>> GetListAsync(FunReturnResultModel<Expression<Func<WmsTask, bool>>> whereConditions, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, bool includeDetails = false, CancellationToken cancellationToken = default); + + /// <summary> + /// 鑾峰彇鎬绘暟Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="whereConditions"></param> + /// <param name="cancellationToken"></param> + /// <returns></returns> + Task<long> GetCountAsync(FunReturnResultModel<Expression<Func<WmsTask, bool>>> whereConditions, CancellationToken cancellationToken = default); +} diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/Repositories/EfCoreWmsTaskRepository.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/Repositories/EfCoreWmsTaskRepository.cs new file mode 100644 index 0000000..673d314 --- /dev/null +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/Repositories/EfCoreWmsTaskRepository.cs @@ -0,0 +1,113 @@ +using CMS.Plugin.HIAWms.Domain.WmsTask; +using CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions; +using CmsQueryExtensions.Extension; +using Microsoft.EntityFrameworkCore; +using System.Linq.Dynamic.Core; +using System.Linq.Expressions; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + + +namespace CMS.Plugin.HIAWms.EntityFrameworkCore.Repositories; + +/// <summary> +/// Wms浠诲姟绠$悊琛ㄤ粨鍌ㄥ疄鐜� +/// </summary> +public class EfCoreWmsTaskRepository : EfCoreRepository<ICMSPluginDbContext, WmsTask, Guid>, IWmsTaskRepository +{ + /// <summary> + /// Initializes a new instance of the <see cref="EfCoreWmsTaskRepository"/> class. + /// </summary> + /// <param name="dbContextProvider">The database context provider.</param> + public EfCoreWmsTaskRepository(IDbContextProvider<ICMSPluginDbContext> dbContextProvider) + : base(dbContextProvider) + { + } + + /// <summary> + /// 鎸夌収鍚嶇О鏌ユ壘Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="name"></param> + /// <param name="cancellationToken"></param> + /// <returns></returns> + public virtual async Task<WmsTask> FindByNameAsync(string name, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .IncludeDetails() + .Where(x => !x.IsDeleted) + .OrderBy(t => t.Sort) + .FirstOrDefaultAsync(t => t.TaskNo == name, GetCancellationToken(cancellationToken)); + } + + /// <summary> + /// 楠岃瘉鍚嶇О鏄惁瀛樺湪Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="name">鏍¢獙鍊�</param> + /// <param name="id"></param> + /// <returns></returns> + public async Task<bool> NameExistAsync(string name, Guid? id = null) + { + return await (await GetDbSetAsync()).WhereIf(id.HasValue, p => p.Id != id).Where(x => !x.IsDeleted).AnyAsync(x => x.TaskNo == name); + } + + /// <summary> + /// 鑾峰彇鏈�澶ф帓搴廤ms浠诲姟绠$悊琛� + /// </summary> + /// <returns></returns> + public async Task<int> GetMaxSortAsync() + { + var hasAny = await (await GetQueryableAsync()) + .Where(x => !x.IsDeleted).AnyAsync(); + if (!hasAny) + { + return 1; + } + + var sort = await (await GetQueryableAsync()) + .Where(x => !x.IsDeleted).MaxAsync(x => x.Sort); + return sort + 1; + } + + /// <summary> + /// 鑾峰彇鍒嗛〉鍒楄〃Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="whereConditions"></param> + /// <param name="sorting"></param> + /// <param name="maxResultCount"></param> + /// <param name="skipCount"></param> + /// <param name="includeDetails"></param> + /// <param name="cancellationToken"></param> + /// <returns></returns> + public async Task<List<WmsTask>> GetListAsync(FunReturnResultModel<Expression<Func<WmsTask, bool>>> whereConditions, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, bool includeDetails = false, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .IncludeDetails(includeDetails) + .WhereIf(whereConditions != null, whereConditions.data) + .Where(x => !x.IsDeleted) + .OrderBy(sorting.IsNullOrEmpty() ? nameof(WmsTask.Sort) : sorting) + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + /// <summary> + /// 鑾峰彇鎬绘暟Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="whereConditions"></param> + /// <param name="cancellationToken"></param> + /// <returns></returns> + public async Task<long> GetCountAsync(FunReturnResultModel<Expression<Func<WmsTask, bool>>> whereConditions, CancellationToken cancellationToken = default) + { + return await (await GetQueryableAsync()) + .WhereIf(whereConditions != null, whereConditions.data) + .Where(x => !x.IsDeleted) + .CountAsync(cancellationToken: GetCancellationToken(cancellationToken)); + } + + + /// <inheritdoc /> + public override async Task<IQueryable<WmsTask>> WithDetailsAsync() + { + return (await GetQueryableAsync()) + .Where(x => !x.IsDeleted).IncludeDetails(); + } +} diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms/Controller/WmsTaskController.cs b/HIAWms/server/src/CMS.Plugin.HIAWms/Controller/WmsTaskController.cs new file mode 100644 index 0000000..a1f9570 --- /dev/null +++ b/HIAWms/server/src/CMS.Plugin.HIAWms/Controller/WmsTaskController.cs @@ -0,0 +1,188 @@ +using Ao.Lang; +using CMS.Extensions.Abp.AspNetCore.Mvc.Filters; +using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsTask; +using CMS.Plugin.HIAWms.Application.Contracts.Services; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using MiniExcelLibs; +using System.Reflection; +using Volo.Abp; +using Volo.Abp.Application.Dtos; + +namespace CMS.Plugin.HIAWms.Controller +{ + /// <summary> + /// Wms浠诲姟绠$悊琛ㄦ湇鍔� + /// </summary> + [ApiController] + [TypeFilter(typeof(CMSLanguageFilter))] + [TypeFilter(typeof(CMSUowActionFilter))] + [TypeFilter(typeof(CMSAuditActionFilter))] + [TypeFilter(typeof(CMSExceptionFilter))] + [Route("api/v{version:apiVersion}/HIAWms/[controller]")] + public class WmsTaskController : ControllerBase + { + private readonly IWmsTaskAppService _wmsTaskAppService; + + /// <summary> + /// Initializes a new instance of the <see cref="WmsTaskController"/> class. + /// </summary> + /// <param name="wmsTaskAppService">The wmsTask application service.</param> + public WmsTaskController(IWmsTaskAppService wmsTaskAppService) + { + _wmsTaskAppService = wmsTaskAppService; + } + + /// <summary> + /// 鑾峰彇Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="id">鏍囪瘑绗�.</param> + /// <returns></returns> + [HttpGet] + [Route("{id}")] + public virtual Task<WmsTaskDto> GetAsync(Guid id) + { + return _wmsTaskAppService.GetAsync(id); + } + + /// <summary> + /// 鍒嗛〉鑾峰彇Wms浠诲姟绠$悊琛ㄧ殑鍒楄〃. + /// </summary> + /// <param name="input">杈撳叆.</param> + /// <returns></returns> + [HttpGet] + [Route("Page")] + public virtual Task<PagedResultDto<WmsTaskDto>> GetListAsync([FromQuery] GetWmsTaskInput input) + { + return _wmsTaskAppService.GetListAsync(input); + } + + /// <summary> + /// 鍒涘缓Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="input">杈撳叆.</param> + /// <returns></returns> + //[Authorize] + [HttpPost] + public virtual Task<WmsTaskDto> CreateAsync(WmsTaskCreateDto input) + { + return _wmsTaskAppService.CreateAsync(input); + } + + /// <summary> + /// 鏇存柊Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="id">鏍囪瘑绗�.</param> + /// <param name="input">杈撳叆.</param> + /// <returns></returns> + //[Authorize] + [HttpPut] + [Route("{id}")] + public virtual Task<WmsTaskDto> UpdateAsync(Guid id, WmsTaskUpdateDto input) + { + return _wmsTaskAppService.UpdateAsync(id, input); + } + + /// <summary> + /// 鍏嬮殕Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="ids">Id闆嗗悎.</param> + /// <returns></returns> + //[Authorize] + [HttpPost] + [Route("Clone")] + public virtual Task<List<WmsTaskDto>> CloneAsync([FromBody] IEnumerable<Guid> ids) + { + return _wmsTaskAppService.CloneAsync(ids); + } + + /// <summary> + /// 鍒犻櫎Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="id">鏍囪瘑绗�.</param> + /// <returns></returns> + //[Authorize] + [HttpDelete] + [Route("{id}")] + public virtual Task DeleteAsync(Guid id) + { + return _wmsTaskAppService.DeleteAsync(id); + } + + /// <summary> + /// 鎵归噺鍒犻櫎Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="ids">The ids.</param> + /// <returns></returns> + //[Authorize] + [HttpDelete] + public virtual Task DeleteAsync([FromBody] IEnumerable<Guid> ids) + { + return _wmsTaskAppService.DeleteManyAsync(ids); + } + + /// <summary> + /// 璋冩暣鎺掑簭Wms浠诲姟绠$悊琛� + /// </summary> + /// <param name="id">鏍囪瘑绗�.</param> + /// <returns></returns> + [HttpPut] + [Route("{id}/AdjustSort/{sort}")] + public virtual Task AdjustSortAsync(Guid id, int sort) + { + return _wmsTaskAppService.AdjustSortAsync(id, sort); + } + + /// <summary> + /// 瀵煎叆Wms浠诲姟绠$悊琛� + /// </summary> + /// <returns></returns> + [Authorize] + [HttpPost] + [Route("Import")] + public virtual async Task<IActionResult> ImportAsync(IFormFile file) + { + using var stream = new MemoryStream(); + await file.CopyToAsync(stream); + stream.Seek(0L, SeekOrigin.Begin); + + var sheetNames = stream.GetSheetNames(); + var wmsTaskRows = sheetNames.Contains("閰嶇疆") ? MiniExcel.Query<WmsTasksImportModel.WmsTaskImportModel>(stream, sheetName: "閰嶇疆").ToList() : new(); + + if (!wmsTaskRows.Any()) + { + throw new UserFriendlyException("璇锋鏌ュ鍏ョ殑琛ㄦ牸"); + } + + await _wmsTaskAppService.ImportAsync(new WmsTasksImportModel + { + WmsTasks = wmsTaskRows, + }); + + return Ok(); + } + + /// <summary> + /// 瀵煎嚭Wms浠诲姟绠$悊琛� + /// </summary> + /// <returns></returns> + [HttpGet] + [Route("Export")] + public virtual async Task<IActionResult> ExportAsync([FromQuery] GetWmsTaskInput input) + { + input.MaxResultCount = int.MaxValue; + var exportData = await _wmsTaskAppService.ExportAsync(input); + var templatePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"Resources/Templates/WmsTask瀵煎嚭妯℃澘.xlsx"); + if (!System.IO.File.Exists(templatePath)) + { + templatePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty, $"Resources/Templates/WmsTask瀵煎嚭妯℃澘.xlsx"); + } + + var memoryStream = new MemoryStream(); + await memoryStream.SaveAsByTemplateAsync(templatePath, exportData.Sheets); + memoryStream.Seek(0L, SeekOrigin.Begin); + return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") { FileDownloadName = $"{exportData.FileName}_{DateTime.Now:yyyyMMddhhmmss}.xlsx" }; + } + } +} diff --git a/HIAWms/web/src/config/menu.ts b/HIAWms/web/src/config/menu.ts index ec2c187..b303c47 100644 --- a/HIAWms/web/src/config/menu.ts +++ b/HIAWms/web/src/config/menu.ts @@ -1,5 +1,12 @@ export const menu: Record<string,any>[] = [ { + "name": "Wms浠诲姟绠$悊", + "path": "/information-base/WmsTask", + "patchName": "WmsTask", + "icon": "p", + "notPage": false + }, + { "name": "浠撳簱淇℃伅", "path": "/information-base/WmsStoreInfo", "patchName": "WmsStoreInfo", @@ -7,16 +14,16 @@ "notPage": false }, { - "name": "搴撳瓨淇℃伅", - "path": "/information-base/WmsMaterialStock", - "patchName": "WmsMaterialStock", + "name": "鍑哄叆搴撹褰�", + "path": "/information-base/WmsInOutStockRecord", + "patchName": "WmsInOutStockRecord", "icon": "p", "notPage": false }, { - "name": "鍑哄叆搴撹褰�", - "path": "/information-base/WmsInOutStockRecord", - "patchName": "WmsInOutStockRecord", + "name": "搴撳瓨淇℃伅", + "path": "/information-base/WmsMaterialStock", + "patchName": "WmsMaterialStock", "icon": "p", "notPage": false }, @@ -43,6 +50,13 @@ } ]; export const menuMap: Record<string,any> = { + "WmsTask": { + "name": "Wms浠诲姟绠$悊", + "path": "/information-base/WmsTask", + "patchName": "WmsTask", + "icon": "p", + "notPage": false + }, "WmsStoreInfo": { "name": "浠撳簱淇℃伅", "path": "/information-base/WmsStoreInfo", @@ -50,13 +64,6 @@ "icon": "p", "notPage": false }, - "WmsMaterialStock": { - "name": "搴撳瓨淇℃伅", - "path": "/information-base/WmsMaterialStock", - "patchName": "WmsMaterialStock", - "icon": "p", - "notPage": false - }, "WmsInOutStockRecord": { "name": "鍑哄叆搴撹褰�", "path": "/information-base/WmsInOutStockRecord", @@ -64,6 +71,13 @@ "icon": "p", "notPage": false }, + "WmsMaterialStock": { + "name": "搴撳瓨淇℃伅", + "path": "/information-base/WmsMaterialStock", + "patchName": "WmsMaterialStock", + "icon": "p", + "notPage": false + }, "WmsContainer": { "name": "Wms鎵樼洏绠$悊", "path": "/information-base/WmsContainer", diff --git a/HIAWms/web/src/widgets/WmsInOutStockRecord/Views/Pages/WmsInOutStockRecord/Config.ts b/HIAWms/web/src/widgets/WmsInOutStockRecord/Views/Pages/WmsInOutStockRecord/Config.ts index 26cc204..e38457e 100644 --- a/HIAWms/web/src/widgets/WmsInOutStockRecord/Views/Pages/WmsInOutStockRecord/Config.ts +++ b/HIAWms/web/src/widgets/WmsInOutStockRecord/Views/Pages/WmsInOutStockRecord/Config.ts @@ -1,63 +1,59 @@ -export const columns = [ - { - type: 'seq', - width: 60, - title: '搴忓彿', - }, - { - field: 'orderNo', - title: '鍗曟嵁缂栧彿', -}, -{ - field: 'materialName', - title: '鐗╂枡鍚嶇О', -}, -{ - field: 'materialNo', - title: '鐗╂枡浠跺彿', -}, -{ - field: 'stockTypeDesc', - title: '鎿嶄綔绫诲瀷', -}, -{ - field: 'containerNo', - title: '瀹瑰櫒缂栧彿', -}, -{ - field: 'materialModel', - title: '鏈哄瀷', -}, -{ - field: 'operateTime', - title: '鎿嶄綔鏃堕棿', -}, -{ - field: 'remark', - title: '澶囨敞', -}, -{ - field: 'materialId', - title: '鐗╂枡ID', -}, -{ - field: 'taskNo', - title: '浠诲姟鍙�', -}, -{ - field: 'sourcePlace', - title: '璧峰搴撲綅', -}, -{ - field: 'toPlace', - title: '鐩爣搴撲綅', -}, -{ - field: 'creationTime', - title: '', -}, -{ - field: 'deletionTime', - title: '', -}, -] +export const columns = [ + { + type: 'seq', + width: 60, + title: '搴忓彿', + }, + { + field: 'orderNo', + title: '鍗曟嵁缂栧彿', + }, + { + field: 'materialName', + title: '鐗╂枡鍚嶇О', + }, + { + field: 'materialNo', + title: '鐗╂枡浠跺彿', + }, + { + field: 'stockTypeDesc', + title: '鎿嶄綔绫诲瀷', + }, + { + field: 'containerNo', + title: '瀹瑰櫒缂栧彿', + }, + { + field: 'materialModel', + title: '鏈哄瀷', + }, + { + field: 'operateTime', + title: '鎿嶄綔鏃堕棿', + }, + { + field: 'remark', + title: '澶囨敞', + }, + { + field: 'materialId', + title: '鐗╂枡ID', + }, + { + field: 'taskNo', + title: '浠诲姟鍙�', + }, + { + field: 'sourcePlace', + title: '璧峰搴撲綅', + }, + { + field: 'toPlace', + title: '鐩爣搴撲綅', + }, + // { + // field: 'deletionTime', + // title: '', + // }, +] diff --git a/HIAWms/web/src/widgets/WmsTask/Controllers/File.ts b/HIAWms/web/src/widgets/WmsTask/Controllers/File.ts new file mode 100644 index 0000000..9162fef --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Controllers/File.ts @@ -0,0 +1,31 @@ +import { importFileToService, exportFileToClient } from '@/api/file' +import { ElMessage } from 'element-plus' +import { downloadFile } from '@/utils' +import dayjs from 'dayjs' + +export const useFile = () => { + /** + * 瀵煎叆鏂囦欢 + * @param url + */ + const importFile = async (url: string, file: File) => { + const formData = new FormData() + formData.append('file', file) + await importFileToService(url, formData) + ElMessage('瀵煎叆鎴愬姛') + } + /** + * 瀵煎嚭鏂囦欢 + * @param url + */ + const exportFile = async (url: string, params: any, name: string) => { + const res = await exportFileToClient(url, params) + downloadFile(res, `${name}_${dayjs().format('YYYYMMDDHHMMss')}.xlsx`) + ElMessage.success('瀵煎嚭鎴愬姛') + } + + return { + importFile, + exportFile, + } +} diff --git a/HIAWms/web/src/widgets/WmsTask/Controllers/WmsTask.ts b/HIAWms/web/src/widgets/WmsTask/Controllers/WmsTask.ts new file mode 100644 index 0000000..731d5d2 --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Controllers/WmsTask.ts @@ -0,0 +1,275 @@ +import { ref, onMounted, reactive, Ref, nextTick, computed } from 'vue' +import { injectModel } from '@/libs/Provider/Provider' +import { WmsTask } from '../Models/WmsTask' +import { ElMessage } from 'element-plus' +import { ConfirmBox } from '@/components/ConfirmBox/ConfirmBox' +import { useFile } from './File' + +interface CurrentType { + row: any + index: number +} +export const useWmsTask = (props: any, ctx?: any) => { + const wmsTask = injectModel<WmsTask>('wmsTask') + const { exportFile } = useFile() + /** + * 澶撮儴閰嶇疆 + */ + const headers = ref({}) + /** + * 鍔ㄦ�佸垪閰嶇疆 + */ + const wmsTaskColumns = ref<Record<string, any>>([]) + /** + * 鎼滅储鍊� + */ + const search = ref('') + + /** + * 鎺掑簭 + */ + const sort = ref(0) + /** + * 閫夋嫨椤� + */ + const selection = ref([]) + /** + * 褰撳墠閫変腑鐨勮 + */ + const current = ref<any>(null) + /** + * 鏁版嵁婧� + */ + const dataSource: Ref<any[]> = ref([]) + + /** + * 琛ㄦ牸 + */ + const tableRef = ref() + const dialogConfig = reactive({ + visible: false, + title: '', + isAdd: false, + }) + const dialogConfigForQuery = reactive({ + visible: false, + title: '', + isAdd: false, + }) + + + const dialogSettingConfig = reactive({ + visible: false, + title: '', + }) + + /** + * 鍒嗛〉鏁版嵁 + */ + const paginationParams = ref({}) + + /** + * 鎵撳紑璇︽儏 + * @param row + */ + const openDetail = (row: any) => { + current.value = row + dialogConfig.visible = true + dialogConfig.title = row.name + dialogConfig.isAdd = false + sort.value = row.sort + } + + const contextMenu = [ + { + label: '灞曞紑璇︽儏', + fn: (c: CurrentType) => { + current.value = null + sort.value = c.row.sort + nextTick(() => openDetail(c.row)) + }, + divided: true, + icon: 'o', + }, + // { + // label: '鍚戜笂娣诲姞', + // fn: (c: CurrentType, pageNum: number) => { + // current.value = null + // sort.value = c.index + 1 + (pageNum - 1) * 50 + // dialogConfig.visible = true + // dialogConfig.title = '娣诲姞' + // dialogConfig.isAdd = false + // }, + // divided: true, + // icon: 'up', + // }, + // { + // label: '鍚戜笅娣诲姞', + // fn: (c: CurrentType, pageNum: number) => { + // current.value = null + // sort.value = c.index + 2 + (pageNum - 1) * 50 + // dialogConfig.visible = true + // dialogConfig.title = '娣诲姞' + // dialogConfig.isAdd = false + // }, + // divided: true, + // icon: 'down', + // }, + // { + // label: '鍒涘缓鍓湰', + // fn: async ({ row }: CurrentType) => { + // await wmsTask.cloneData([row.id]) + // ElMessage.success('鍒涘缓鍓湰鎴愬姛') + // tableRef.value?.getList() + // }, + // divided: true, + // icon: 'copy', + // }, + { + label: '鍒犻櫎', + fn: async (c: CurrentType) => { + const names = selection.value.map((item: { taskNo: string }) => item.taskNo) + ConfirmBox( + `鏄惁鍒犻櫎${names.length ? names.join(',') : c.row.taskNo}` + ).then(async () => { + const ids = selection.value.map((item: { id: string }) => item.id) + await wmsTask.deleteWmsTasks(ids.length ? ids : [c.row.id]) + ElMessage.success('鍒犻櫎鎴愬姛') + tableRef.value.getList() + }) + }, + icon: 'close', + }, + ] + + const onCheck = (records: any) => { + selection.value = records + } + + const onAddWmsTask = () => { + const params = tableRef.value?.getPaginationParams() + current.value = null + dialogConfig.visible = true + dialogConfig.isAdd = true + dialogConfig.title = '娣诲姞' + sort.value = params.totalCount + 1 + } + + //鐐瑰嚮鎸夐挳銆愰珮绾ф煡璇€�� + const onAdvancedQuery = () => { + const params = tableRef.value?.getPaginationParams() + current.value = null + dialogConfigForQuery.visible = true + dialogConfigForQuery.isAdd = true + dialogConfigForQuery.title = '楂樼骇鏌ヨ' + } + + const onConfirmWmsTask = async () => { + dialogConfig.visible = false + if (dialogConfig.isAdd) { + tableRef.value?.scrollToRow({ + skip: true, + }) + } else { + await tableRef.value?.getList() + } + } + /** + * 琛岀偣鍑绘椂鏇存柊current + */ + const onRowClick = ({ row }: any) => { + if (dialogConfig.visible && current.value) { + current.value = row + } + } + /** + * 瀵煎嚭 + */ + const onExport = (data={}) => { + //const params = tableRef.value?.getParams() + exportFile('/api/v1/HIAWms/wmsTask/export', data, 'HIAWms') + } + + /** + * 鍏抽敭瀛楁悳绱� + */ + const onSearch = () => { + tableRef.value?.getList({ + Filter: search.value, + }) + } + + /** + * 閲嶇疆琛ㄦ牸鏁版嵁 + */ + const reloadList = () => { + tableRef.value?.getList() + } + /** + * 涓婁紶鎴愬姛 + */ + const onSuccess = () => { + tableRef.value?.getList() + ElMessage.success('瀵煎叆鎴愬姛') + } + /** + * 澶辫触 + * @param err + */ + const onError = (err: any) => { + try { + const message = JSON.parse(err.message) + ElMessage.error(message.msg) + } catch (error) { + ElMessage.error('瀵煎叆澶辫触') + } + } + /** + * 涓婁紶閽╁瓙 + */ + const onBeforeUpload = (file: File) => { + const format = ['xlsx', 'xls', 'csv'] + if (!format.includes(file.name.split('.')[1])) { + ElMessage.error('瀵煎叆鏂囦欢鏍煎紡涓嶆纭紝璇峰鍏�.xlsx/.xls涓�.csv鏍煎紡鐨勬枃浠�') + return false + } + return true + } + + onMounted(() => { + headers.value = { + Authorization: `Bearer ${sessionStorage.getItem('Token')}`, + 'X-Project': sessionStorage.getItem('X-Project'), + } + }) + + ctx.expose({ + reloadList, + }) + + return { + dataSource, + contextMenu, + dialogConfig, + dialogConfigForQuery, + dialogSettingConfig, + tableRef, + current, + search, + sort, + wmsTaskColumns, + paginationParams, + headers, + onBeforeUpload, + onError, + onSuccess, + openDetail, + onSearch, + onExport, + onRowClick, + onConfirmWmsTask, + onCheck, + onAddWmsTask, + onAdvancedQuery + } +} diff --git a/HIAWms/web/src/widgets/WmsTask/Controllers/WmsTaskDrawer.tsx b/HIAWms/web/src/widgets/WmsTask/Controllers/WmsTaskDrawer.tsx new file mode 100644 index 0000000..959fe29 --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Controllers/WmsTaskDrawer.tsx @@ -0,0 +1,332 @@ +import { + ref, + onMounted, + reactive, + computed, + Ref, + watch, + SetupContext, + h, +} from 'vue' +import { injectModel } from '@/libs/Provider/Provider' +import { WmsTaskDrawer } from '../Models/WmsTaskDrawer' +import { ElMessage } from 'element-plus' +import isEqual from 'lodash/isEqual' +import { ConfirmBox } from '@/components/ConfirmBox/ConfirmBox' +import { cloneDeep } from 'lodash' + +export const useWmsTaskDrawer = (props: any, ctx?: any) => { + const wmsTaskDrawer = injectModel<WmsTaskDrawer>('wmsTaskDrawer') + /** + * 鐢ㄦ潵瀵规瘮鐨勫垵濮嬪寲鏁版嵁 + */ + const initiateData: Ref<Record<string, any>> = ref({}) + const formData = ref<Record<string, any>>({}) + // ref + const formRef = ref() + + const disabled = ref(false) + + const current = computed(() => { + return props.row || null + }) + + const inputNumber = (attrs) => { + return ( + <el-input-number + min="1" + step="1" + precision="0" + {...attrs} + ></el-input-number> + ) + } + + const visible = computed({ + get() { + return props.modelValue + }, + set(val) { + ctx.emit('update:modelValue', val) + }, + }) + /** + * 娣诲姞鐨刦orm瀛楁 + */ + const formItems = reactive([ + { + label: '宸烽亾', + prop: 'aisle', + //disabled: disabled, + placeholder: '璇疯緭鍏ュ贩閬�', + }, + { + label: '鎵樼洏缂栧彿', + prop: 'containerNo', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ユ墭鐩樼紪鍙�', + }, + { + label: '鍫嗗灈鏈篒D', + prop: 'dodeviceId', + //disabled: disabled, + placeholder: '璇疯緭鍏ュ爢鍨涙満ID', + }, + { + label: '璁惧绫诲瀷', + prop: 'dodevicetype', + //disabled: disabled, + placeholder: '璇疯緭鍏ヨ澶囩被鍨�', + rules: [{required: true, message: '璁惧绫诲瀷涓嶈兘涓虹┖', trigger: 'blur' }], + }, + { + label: '涓嬩釜浠诲姟鏄惁鐢熸垚鎴愬姛', + prop: 'isNextTask', + //disabled: disabled, + placeholder: '璇疯緭鍏ヤ笅涓换鍔℃槸鍚︾敓鎴愭垚鍔�', + }, + { + label: 'WCS鏄惁鍙互璇诲彇', + prop: 'isRead', + el: 'select', + //disabled: disabled, + placeholder: '璇疯緭鍏CS鏄惁鍙互璇诲彇', + rules: [{required: true, message: 'WCS鏄惁鍙互璇诲彇涓嶈兘涓虹┖', trigger: 'blur' }], + }, + { + label: '鍙彉鍙橀噺1', + prop: 'mutableParam1', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ュ彲鍙樺彉閲�1', + }, + { + label: '鍙彉鍙橀噺2', + prop: 'mutableParam2', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ュ彲鍙樺彉閲�2', + }, + { + label: '鍙彉鍙橀噺3', + prop: 'mutableParam3', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ュ彲鍙樺彉閲�3', + }, + { + label: '瀛愪换鍔$被鍨�', + prop: 'sonTaskType', + el: 'select', + //disabled: disabled, + placeholder: '璇疯緭鍏ュ瓙浠诲姟绫诲瀷', + }, + { + label: '鏉ユ簮鍗曟嵁鍙�', + prop: 'sourceOrderNo', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ユ潵婧愬崟鎹彿', + }, + { + label: '璧峰搴撲綅', + prop: 'sourcePlace', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ヨ捣濮嬪簱浣�', + }, + { + label: '璁惧浠诲姟鐘舵��', + prop: 'taskDodeviceStatus', + //disabled: disabled, + placeholder: '璇疯緭鍏ヨ澶囦换鍔$姸鎬�', + rules: [{required: true, message: '璁惧浠诲姟鐘舵�佷笉鑳戒负绌�', trigger: 'blur' }], + }, + { + label: '浠诲姟绛夌骇', + prop: 'taskLevel', + //disabled: disabled, + placeholder: '璇疯緭鍏ヤ换鍔$瓑绾�', + rules: [{required: true, message: '浠诲姟绛夌骇涓嶈兘涓虹┖', trigger: 'blur' }], + }, + { + label: '浠诲姟鍙�', + prop: 'taskNo', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ヤ换鍔″彿', + rules: [{required: true, message: '浠诲姟鍙蜂笉鑳戒负绌�', trigger: 'blur' }], + }, + { + label: '浠诲姟鐘舵��', + prop: 'taskStatus', + el: 'select', + //disabled: disabled, + placeholder: '璇疯緭鍏ヤ换鍔$姸鎬�', + rules: [{required: true, message: '浠诲姟鐘舵�佷笉鑳戒负绌�', trigger: 'blur' }], + }, + { + label: '浠诲姟绫诲瀷', + prop: 'taskType', + el: 'select', + //disabled: disabled, + placeholder: '璇疯緭鍏ヤ换鍔$被鍨�', + rules: [{required: true, message: '浠诲姟绫诲瀷涓嶈兘涓虹┖', trigger: 'blur' }], + }, + { + label: '鐩爣搴撲綅', + prop: 'toPlace', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ョ洰鏍囧簱浣�', + }, + ]) + /** + * 鏍¢獙鏄惁鏈夋暟鎹彉鍖� + */ + const checkIsEqualObject = () => { + const data = { + formData: formData.value, + } + const check = isEqual(initiateData.value, data) + return check + } + + const onClose = (done: () => void) => { + if (visible.value) { + if (checkIsEqualObject()) { + visible.value = false + done && done() + } else { + ConfirmBox('鏄惁淇濆瓨璁剧疆锛�') + .then(() => { + onConfirm() + }) + .catch(() => { + visible.value = false + done && done() + }) + } + } + } + /** + * 淇濆瓨 + */ + const onConfirm = async () => { + await formRef.value?.validate() + const data = { + aisle: formData.value.aisle, +containerNo: formData.value.containerNo, +dodeviceId: formData.value.dodeviceId, +dodevicetype: formData.value.dodevicetype, +isNextTask: formData.value.isNextTask, +isRead: formData.value.isRead, +mutableParam1: formData.value.mutableParam1, +mutableParam2: formData.value.mutableParam2, +mutableParam3: formData.value.mutableParam3, +sonTaskType: formData.value.sonTaskType, +sourceOrderNo: formData.value.sourceOrderNo, +sourcePlace: formData.value.sourcePlace, +taskDodeviceStatus: formData.value.taskDodeviceStatus, +taskLevel: formData.value.taskLevel, +taskNo: formData.value.taskNo, +taskStatus: formData.value.taskStatus, +taskType: formData.value.taskType, +toPlace: formData.value.toPlace, + } + if (!current.value) { + await wmsTaskDrawer.addWmsTask(data) + } else { + const id = current.value.id + await wmsTaskDrawer.updateWmsTask(id, data) + } + ElMessage.success('淇濆瓨鎴愬姛') + ctx.emit('confirm') + } + + const updateCheckData = () => { + initiateData.value = { + formData: { + ...formData.value, + }, + } + } + const updateFormItemOptions = (propName: string, enumData: any[]) => { + const item = formItems.find((item) => item.prop === propName) + if (item && enumData) { + item.options = enumData.map((item) => ({ + label: item.description, + value: item.value, + })) + } + } + /** + * 閫氱敤鏌ヨ鏋氫妇 + */ + const commonQueryEnumForFrom = async () => { + const taskTypeEnumEnum = await wmsTaskDrawer.getWmsEnumData({ + EnumName: 'TaskTypeEnum', +}) +updateFormItemOptions('taskType', taskTypeEnumEnum) +const wmsTaskStatusEnum = await wmsTaskDrawer.getWmsEnumData({ + EnumName: 'WmsTaskStatus', +}) +updateFormItemOptions('taskStatus', wmsTaskStatusEnum) +const sonTaskTypeEnumEnum = await wmsTaskDrawer.getWmsEnumData({ + EnumName: 'SonTaskTypeEnum', +}) +updateFormItemOptions('sonTaskType', sonTaskTypeEnumEnum) + + } + commonQueryEnumForFrom() + /** + * 寮圭獥鎵撳紑鑾峰彇璇︽儏 + */ + const onOpen = async () => { + if (current.value) { + const res = await wmsTaskDrawer.getWmsTaskDetail(current.value) + + formData.value = { + aisle: res.aisle, +containerNo: res.containerNo, +dodeviceId: res.dodeviceId, +dodevicetype: res.dodevicetype, +isNextTask: res.isNextTask, +isRead: res.isRead, +mutableParam1: res.mutableParam1, +mutableParam2: res.mutableParam2, +mutableParam3: res.mutableParam3, +sonTaskType: res.sonTaskType, +sourceOrderNo: res.sourceOrderNo, +sourcePlace: res.sourcePlace, +taskDodeviceStatus: res.taskDodeviceStatus, +taskLevel: res.taskLevel, +taskNo: res.taskNo, +taskStatus: res.taskStatus, +taskType: res.taskType, +toPlace: res.toPlace, + id: res.id, + } + disabled.value = true + updateCheckData() + } else { + formData.value = {} + + disabled.value = false + updateCheckData() + } + } + + watch(() => current.value, onOpen) + + return { + formItems, + formData, + visible, + formRef, + onOpen, + onClose, + onConfirm, + } +} diff --git a/HIAWms/web/src/widgets/WmsTask/Controllers/WmsTaskQueryDrawer.tsx b/HIAWms/web/src/widgets/WmsTask/Controllers/WmsTaskQueryDrawer.tsx new file mode 100644 index 0000000..3edbe21 --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Controllers/WmsTaskQueryDrawer.tsx @@ -0,0 +1,308 @@ +import { + ref, + onMounted, + reactive, + computed, + Ref, + watch, + SetupContext, + h, +} from 'vue' +import { injectModel } from '@/libs/Provider/Provider' +import { WmsTaskDrawer } from '../Models/WmsTaskDrawer' +import { ElMessage } from 'element-plus' +import isEqual from 'lodash/isEqual' +import { ConfirmBox } from '@/components/ConfirmBox/ConfirmBox' +import { cloneDeep } from 'lodash' + +export const useWmsTaskQueryDrawer = (props: any, ctx?: any) => { + const wmsTaskDrawer = injectModel<WmsTaskDrawer>('WmsTaskDrawer') + /** + * 鐢ㄦ潵瀵规瘮鐨勫垵濮嬪寲鏁版嵁 + */ + const initiateData: Ref<Record<string, any>> = ref({}) + const formData = ref<Record<string, any>>({}) + // ref + const formRef = ref() + + const disabled = ref(false) + + const current = computed(() => { + return props.row || null + }) + + const inputNumber = (attrs) => { + return ( + <el-input-number + min="1" + step="1" + precision="0" + {...attrs} + ></el-input-number> + ) + } + + + const visible = computed({ + get() { + return props.modelValue + }, + set(val) { + ctx.emit('update:modelValue', val) + }, + }) + /** + * 娣诲姞鐨刦orm瀛楁 + */ + const formItems = reactive([ + { + label: '宸烽亾', + prop: 'aisle', + //disabled: disabled, + placeholder: '璇疯緭鍏ュ贩閬�', + }, + { + label: '鎵樼洏缂栧彿', + prop: 'containerNo', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ユ墭鐩樼紪鍙�', + }, + { + label: '鍫嗗灈鏈篒D', + prop: 'dodeviceId', + //disabled: disabled, + placeholder: '璇疯緭鍏ュ爢鍨涙満ID', + }, + { + label: '璁惧绫诲瀷', + prop: 'dodevicetype', + //disabled: disabled, + placeholder: '璇疯緭鍏ヨ澶囩被鍨�', + }, + { + label: '涓嬩釜浠诲姟鏄惁鐢熸垚鎴愬姛', + prop: 'isNextTask', + //disabled: disabled, + placeholder: '璇疯緭鍏ヤ笅涓换鍔℃槸鍚︾敓鎴愭垚鍔�', + }, + { + label: 'WCS鏄惁鍙互璇诲彇', + prop: 'isRead', + el: 'select', + //disabled: disabled, + placeholder: '璇疯緭鍏CS鏄惁鍙互璇诲彇', + }, + { + label: '鍙彉鍙橀噺1', + prop: 'mutableParam1', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ュ彲鍙樺彉閲�1', + }, + { + label: '鍙彉鍙橀噺2', + prop: 'mutableParam2', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ュ彲鍙樺彉閲�2', + }, + { + label: '鍙彉鍙橀噺3', + prop: 'mutableParam3', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ュ彲鍙樺彉閲�3', + }, + { + label: '瀛愪换鍔$被鍨�', + prop: 'sonTaskType', + el: 'select', + //disabled: disabled, + placeholder: '璇疯緭鍏ュ瓙浠诲姟绫诲瀷', + }, + { + label: '鏉ユ簮鍗曟嵁鍙�', + prop: 'sourceOrderNo', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ユ潵婧愬崟鎹彿', + }, + { + label: '璧峰搴撲綅', + prop: 'sourcePlace', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ヨ捣濮嬪簱浣�', + }, + { + label: '璁惧浠诲姟鐘舵��', + prop: 'taskDodeviceStatus', + //disabled: disabled, + placeholder: '璇疯緭鍏ヨ澶囦换鍔$姸鎬�', + }, + { + label: '浠诲姟绛夌骇', + prop: 'taskLevel', + //disabled: disabled, + placeholder: '璇疯緭鍏ヤ换鍔$瓑绾�', + }, + { + label: '浠诲姟鍙�', + prop: 'taskNo', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ヤ换鍔″彿', + }, + { + label: '浠诲姟鐘舵��', + prop: 'taskStatus', + el: 'select', + //disabled: disabled, + placeholder: '璇疯緭鍏ヤ换鍔$姸鎬�', + }, + { + label: '浠诲姟绫诲瀷', + prop: 'taskType', + el: 'select', + //disabled: disabled, + placeholder: '璇疯緭鍏ヤ换鍔$被鍨�', + }, + { + label: '鐩爣搴撲綅', + prop: 'toPlace', + el: 'input', + //disabled: disabled, + placeholder: '璇疯緭鍏ョ洰鏍囧簱浣�', + }, + ]) + /** + * 鏍¢獙鏄惁鏈夋暟鎹彉鍖� + */ + const checkIsEqualObject = () => { + const data = { + formData: formData.value, + } + const check = isEqual(initiateData.value, data) + return check + } + const commonGetFormData=()=>{ + const data = { + Aisle: formData.value.Aisle, +ContainerNo: formData.value.ContainerNo, +DodeviceId: formData.value.DodeviceId, +Dodevicetype: formData.value.Dodevicetype, +IsNextTask: formData.value.IsNextTask, +IsRead: formData.value.IsRead, +MutableParam1: formData.value.MutableParam1, +MutableParam2: formData.value.MutableParam2, +MutableParam3: formData.value.MutableParam3, +SonTaskType: formData.value.SonTaskType, +SourceOrderNo: formData.value.SourceOrderNo, +SourcePlace: formData.value.SourcePlace, +TaskDodeviceStatus: formData.value.TaskDodeviceStatus, +TaskLevel: formData.value.TaskLevel, +TaskNo: formData.value.TaskNo, +TaskStatus: formData.value.TaskStatus, +TaskType: formData.value.TaskType, +ToPlace: formData.value.ToPlace, + } + return data; + } + const onClose = (done: () => void) => { + if (visible.value) { + visible.value = false + const data =commonGetFormData(); + ctx.emit('close', data) + } + } + /** + * 纭鏌ヨ + */ + const onConfirmQuery = async () => { + const data =commonGetFormData(); + ctx.emit('confirmQuery', data) + } + /** + * 閲嶇疆鏌ヨ + */ + const onReset = async () => { + formData.value = {} + formData.value.Aisle = '' +formData.value.ContainerNo = '' +formData.value.DodeviceId = '' +formData.value.Dodevicetype = '' +formData.value.IsNextTask = '' +formData.value.IsRead = '' +formData.value.MutableParam1 = '' +formData.value.MutableParam2 = '' +formData.value.MutableParam3 = '' +formData.value.SonTaskType = '' +formData.value.SourceOrderNo = '' +formData.value.SourcePlace = '' +formData.value.TaskDodeviceStatus = '' +formData.value.TaskLevel = '' +formData.value.TaskNo = '' +formData.value.TaskStatus = '' +formData.value.TaskType = '' +formData.value.ToPlace = '' + //鍚戠埗缁勪欢鍙戦�佽嚜瀹氫箟浜嬩欢 + ctx.emit('restQuery'); + } + + const updateCheckData = () => { + initiateData.value = { + formData: { + ...formData.value, + }, + } + } + const updateFormItemOptions = (propName: string, enumData: any[]) => { + const item = formItems.find((item) => item.prop === propName) + if (item && enumData) { + item.options = enumData.map((item) => ({ + label: item.description, + value: item.value, + })) + } + } + /** + * 閫氱敤鏌ヨ鏋氫妇 + */ + const commonQueryEnumForFrom = async () => { + const taskTypeEnumEnum = await wmsTaskDrawer.getWmsEnumData({ + EnumName: 'TaskTypeEnum', +}) +updateFormItemOptions('taskType', taskTypeEnumEnum) +const wmsTaskStatusEnum = await wmsTaskDrawer.getWmsEnumData({ + EnumName: 'WmsTaskStatus', +}) +updateFormItemOptions('taskStatus', wmsTaskStatusEnum) +const sonTaskTypeEnumEnum = await wmsTaskDrawer.getWmsEnumData({ + EnumName: 'SonTaskTypeEnum', +}) +updateFormItemOptions('sonTaskType', sonTaskTypeEnumEnum) + + } + commonQueryEnumForFrom() + /** + * 寮圭獥鎵撳紑鑾峰彇璇︽儏 + */ + const onOpen = async () => { + disabled.value = false + updateCheckData() + } + + watch(() => current.value, onOpen) + + return { + formItems, + formData, + visible, + formRef, + onOpen, + onClose, + onConfirmQuery, + onReset, + } +} diff --git a/HIAWms/web/src/widgets/WmsTask/Models/Service/WmsTask.ts b/HIAWms/web/src/widgets/WmsTask/Models/Service/WmsTask.ts new file mode 100644 index 0000000..c2093dc --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Models/Service/WmsTask.ts @@ -0,0 +1,30 @@ +import { Base } from '@/libs/Base/Base' +const request = Base.request + +/** + * 娣诲姞 + * @returns + */ +export const addWmsTask = (data: any) => { + return request.post('/api/v1/HIAWms/wmsTask', data) +} + +/** + * 鎵归噺鍒犻櫎 + * @returns + */ +export const deleteWmsTasks = (ids: string[]) => { + return request({ + data: ids, + url: '/api/v1/HIAWms/wmsTask', + method: 'delete', + }) +} + +/** + * 鍏嬮殕 + * @returns + */ +export const cloneData = (data: any) => { + return request.post('/api/v1/HIAWms/wmsTask/clone', data) +} diff --git a/HIAWms/web/src/widgets/WmsTask/Models/Service/WmsTaskDrawer.ts b/HIAWms/web/src/widgets/WmsTask/Models/Service/WmsTaskDrawer.ts new file mode 100644 index 0000000..3ccea93 --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Models/Service/WmsTaskDrawer.ts @@ -0,0 +1,34 @@ +import { Base } from '@/libs/Base/Base' +const request = Base.request + +/** + * 娣诲姞 + * @returns + */ +export const addWmsTask = (data: any) => { + return request.post('/api/v1/HIAWms/wmsTask', data) +} + +/** + * 鑾峰彇璇︽儏 + * @returns + */ +export const getWmsTask = (id: string) => { + return request.get(`/api/v1/HIAWms/wmsTask/${id}`) +} + +/** + * 鏇存柊 + * @returns + */ +export const updateWmsTask = (id: string, data: Record<string, any>) => { + return request.put(`/api/v1/HIAWms/wmsTask/${id}`, data) +} + +/** + * 鑾峰彇鏋氫妇 + * @returns + */ +export const getWmsEnumData = (data: any) => { + return request.post('/api/v1/HIAWms/WmsEnum', data) +} diff --git a/HIAWms/web/src/widgets/WmsTask/Models/Service/WmsTaskQueryDrawer.ts b/HIAWms/web/src/widgets/WmsTask/Models/Service/WmsTaskQueryDrawer.ts new file mode 100644 index 0000000..1acc927 --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Models/Service/WmsTaskQueryDrawer.ts @@ -0,0 +1,35 @@ +import { Base } from '@/libs/Base/Base' +const request = Base.request + +/** + * 娣诲姞 + * @returns + */ +export const addWmsTask = (data: any) => { + return request.post('/api/v1/HIAWms/wmsTask', data) +} + +/** + * 鑾峰彇璇︽儏 + * @returns + */ +export const getWmsTask = (id: string) => { + return request.get(`/api/v1/HIAWms/wmsTask/${id}`) +} + +/** + * 鏇存柊 + * @returns + */ +export const updateWmsTask = (id: string, data: Record<string, any>) => { + return request.put(`/api/v1/HIAWms/wmsTask/${id}`, data) +} + +/** + * 鑾峰彇鏋氫妇 + * @returns + */ +export const getWmsEnumData = (data: any) => { + return request.post('/api/v1/HIAWms/WmsEnum', data) +} + diff --git a/HIAWms/web/src/widgets/WmsTask/Models/WmsTask.ts b/HIAWms/web/src/widgets/WmsTask/Models/WmsTask.ts new file mode 100644 index 0000000..8122adf --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Models/WmsTask.ts @@ -0,0 +1,41 @@ +import { Base } from '@/libs/Base/Base' +import { + deleteWmsTasks, + addWmsTask, + cloneData, +} from './Service/WmsTask' + +export class WmsTask extends Base<{ [key: string]: any }> { + constructor() { + super({ + data: [], + }) + } + onMounted() {} + /** + * 鍒犻櫎 + * @param id + * @returns + */ + async deleteWmsTasks(ids: string[]) { + return deleteWmsTasks(ids) + } + + /** + * 娣诲姞鏁版嵁 + * @param data + * @returns + */ + addWmsTask(data: Record<string, any>) { + return addWmsTask(data) + } + + /** + * 鍏嬮殕 + * @param ids + * @returns + */ + cloneData(ids: string[]) { + return cloneData(ids) + } +} diff --git a/HIAWms/web/src/widgets/WmsTask/Models/WmsTaskDrawer.ts b/HIAWms/web/src/widgets/WmsTask/Models/WmsTaskDrawer.ts new file mode 100644 index 0000000..08058db --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Models/WmsTaskDrawer.ts @@ -0,0 +1,44 @@ +import { Base } from '@/libs/Base/Base' +import { + addWmsTask, + getWmsTask, + updateWmsTask, + getWmsEnumData, +} from './Service/WmsTaskDrawer' +import { useGlobalState } from '@/libs/Store/Store' + +export class WmsTaskDrawer extends Base<{ [key: string]: any }> { + constructor() { + super({ + data: [], + wmsTask: {}, + }) + } + + /** + * 娣诲姞 + * @param data + */ + async addWmsTask(data: Record<string, any>) { + return addWmsTask(data) + } + /** + * 鏇存柊 + * @param data + */ + async updateWmsTask(id: string, data: Record<string, any>) { + return updateWmsTask(id, data) + } + + /** + * 鑾峰彇璇︽儏 + */ + async getWmsTaskDetail(current: any, id?: string) { + return getWmsTask(id || current?.id) + } + + // 鑾峰彇鏋氫妇鍊� + async getWmsEnumData(data: Record<string, any>) { + return getWmsEnumData(data) + } +} diff --git a/HIAWms/web/src/widgets/WmsTask/Models/WmsTaskQueryDrawer.ts b/HIAWms/web/src/widgets/WmsTask/Models/WmsTaskQueryDrawer.ts new file mode 100644 index 0000000..11eeb6f --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Models/WmsTaskQueryDrawer.ts @@ -0,0 +1,44 @@ +import { Base } from '@/libs/Base/Base' +import { + addWmsTask, + getWmsTask, + updateWmsTask, + getWmsEnumData, +} from './Service/WmsTaskQueryDrawer' +import { useGlobalState } from '@/libs/Store/Store' + +export class WmsTaskQueryDrawer extends Base<{ [key: string]: any }> { + constructor() { + super({ + data: [], + wmsTask: {}, + }) + } + + /** + * 娣诲姞 + * @param data + */ + async addWmsTask(data: Record<string, any>) { + return addWmsTask(data) + } + /** + * 鏇存柊 + * @param data + */ + async updateWmsTask(id: string, data: Record<string, any>) { + return updateWmsTask(id, data) + } + + /** + * 鑾峰彇璇︽儏 + */ + async getWmsTaskDetail(current: any, id?: string) { + return getWmsTask(id || current?.id) + } + + // 鑾峰彇鏋氫妇鍊� + async getWmsEnumData(data: Record<string, any>) { + return getWmsEnumData(data) + } +} diff --git a/HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskDrawer/WmsTaskDrawer.module.scss b/HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskDrawer/WmsTaskDrawer.module.scss new file mode 100644 index 0000000..177adca --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskDrawer/WmsTaskDrawer.module.scss @@ -0,0 +1,3 @@ +.drawer { + width: 800px; +} diff --git a/HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskDrawer/WmsTaskDrawer.tsx b/HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskDrawer/WmsTaskDrawer.tsx new file mode 100644 index 0000000..6c5e937 --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskDrawer/WmsTaskDrawer.tsx @@ -0,0 +1,61 @@ +import { SetupContext, defineComponent } from 'vue' +import BaseDrawer from '@/components/BaseDrawer/BaseDrawer' +import styles from './WmsTaskDrawer.module.scss' +import { useWmsTaskDrawer } from '../../../../Controllers/WmsTaskDrawer.tsx' +import DyForm from '@/components/DyForm/DyForm' + +// @ts-ignore +export default defineComponent<{ + [key: string]: any +}>({ + name: '寮圭獥', + props: { + modelValue: { + type: Boolean, + default: false, + }, + title: { + type: String, + default: '', + }, + row: { + type: Object, + }, + sort: { + type: Number, + default: 0, + }, + }, + emits: ['update:modelValue', 'close', 'submit', 'confirm'], + setup(props: Record<string, any>, ctx: SetupContext) { + const { + onClose, + onConfirm, + onOpen, + formRef, + visible, + formItems, + formData, + } = useWmsTaskDrawer(props, ctx) + return () => ( + <BaseDrawer + class={styles.drawer} + size="800px" + title={props.title || '娣诲姞'} + v-model={visible.value} + close-on-click-modal={true} + onConfirm={onConfirm} + onOpen={onOpen} + before-close={onClose} + onClose={onClose} + > + <DyForm + ref={formRef} + formData={formData.value} + labelWidth="106px" + formItemProps={formItems} + ></DyForm> + </BaseDrawer> + ) + }, +}) diff --git a/HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskQueryDrawer/WmsTaskQueryDrawer.module.scss b/HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskQueryDrawer/WmsTaskQueryDrawer.module.scss new file mode 100644 index 0000000..177adca --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskQueryDrawer/WmsTaskQueryDrawer.module.scss @@ -0,0 +1,3 @@ +.drawer { + width: 800px; +} diff --git a/HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskQueryDrawer/WmsTaskQueryDrawer.tsx b/HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskQueryDrawer/WmsTaskQueryDrawer.tsx new file mode 100644 index 0000000..418bd82 --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Views/Pages/Dialog/WmsTaskQueryDrawer/WmsTaskQueryDrawer.tsx @@ -0,0 +1,71 @@ +/* + * 鐗╂枡鍩虹淇℃伅鏌ヨ寮瑰嚭妗� +*/ +import { SetupContext, defineComponent } from 'vue' +import BaseQueryDrawer from '@/components/BaseQueryDrawer/BaseQueryDrawer' +import styles from './WmsTaskQueryDrawer.module.scss' +import { useWmsTaskQueryDrawer } from '../../../../Controllers/WmsTaskQueryDrawer.tsx' +import DyForm from '@/components/DyForm/DyForm' + +// @ts-ignore +export default defineComponent<{ + [key: string]: any +}>({ + name: '寮圭獥', + props: { + //鏋氫妇绫诲瀷瀛楀吀 + enumListDict:{ + type: Array as () => Array<{ key: string; value: object }>, // 瀹氫箟鏁扮粍鍏冪礌绫诲瀷 + default: () => [] // 榛樿鍊� + }, + modelValue: { + type: Boolean, + default: false, + }, + title: { + type: String, + default: '', + }, + row: { + type: Object, + }, + sort: { + type: Number, + default: 0, + }, + }, + emits: ['update:modelValue', 'close', 'submit', 'confirmquery1'], + setup(props: Record<string, any>, ctx: SetupContext) { + const { + onClose, + onConfirmQuery, + onOpen, + onReset, + formRef, + visible, + formItems, + formData, + } = useWmsTaskQueryDrawer(props, ctx) + return () => ( + <BaseQueryDrawer + class={styles.drawer} + size="800px" + title={props.title || '楂樼骇鏌ヨ'} + v-model={visible.value} + close-on-click-modal={true} + onReset={onReset} + onConfirmQueryForBase={onConfirmQuery} + onOpen={onOpen} + before-close={onClose} + onClose={onClose} + > + <DyForm + ref={formRef} + formData={formData.value} + labelWidth="106px" + formItemProps={formItems} + ></DyForm> + </BaseQueryDrawer> + ) + }, +}) diff --git a/HIAWms/web/src/widgets/WmsTask/Views/Pages/WmsTask/Config.ts b/HIAWms/web/src/widgets/WmsTask/Views/Pages/WmsTask/Config.ts new file mode 100644 index 0000000..76e143b --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Views/Pages/WmsTask/Config.ts @@ -0,0 +1,97 @@ +export const columns = [ + { + type: 'seq', + width: 60, + title: '搴忓彿', + }, + { + field: 'taskNo', + title: '浠诲姟鍙�', + }, + { + field: 'taskTypeDesc', + title: '浠诲姟绫诲瀷', + }, + { + field: 'taskStatusDesc', + title: '浠诲姟鐘舵��', + }, + { + field: 'containerNo', + title: '鎵樼洏缂栧彿', + }, + { + field: 'sourcePlace', + title: '璧峰搴撲綅', + }, + { + field: 'toPlace', + title: '鐩爣搴撲綅', + }, + { + field: 'aisle', + title: '宸烽亾', + }, + // { + // field: 'dodeviceId', + // title: '鍫嗗灈鏈篒D', + // width: 100, + // }, + { + field: 'taskDodeviceStatus', + title: '璁惧鐘舵��', + }, + { + field: 'isRead', + title: 'WCS鍙', + }, + { + field: 'taskLevel', + title: '浼樺厛绾�', + }, + { + field: 'sonTaskTypeDesc', + title: '瀛愪换鍔$被鍨�', + }, + { + field: 'sourceOrderNo', + title: '鏉ユ簮鍗曞彿', + }, + { + field: 'isNextTask', + title: '鍚庣画浠诲姟', + }, + { + field: 'dodevicetype', + title: '璁惧绫诲瀷', + }, + + { + field: 'creationTime', + title: '鍒涘缓鏃堕棿', + }, + // { + // field: 'sort', + // title: '鎺掑簭', + // width: 80, + // }, + // // 浠ヤ笅涓烘瑕佷俊鎭斁鍦ㄦ渶鍚� + // { + // field: 'mutableParam1', + // title: '鍙橀噺1', + // width: 100, + // showOverflow: true, // 闀挎枃鏈樉绀虹渷鐣ュ彿 + // }, + // { + // field: 'mutableParam2', + // title: '鍙橀噺2', + // width: 100, + // showOverflow: true, + // }, + // { + // field: 'mutableParam3', + // title: '鍙橀噺3', + // width: 100, + // showOverflow: true, + // }, +] diff --git a/HIAWms/web/src/widgets/WmsTask/Views/Pages/WmsTask/WmsTask.module.scss b/HIAWms/web/src/widgets/WmsTask/Views/Pages/WmsTask/WmsTask.module.scss new file mode 100644 index 0000000..af357af --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Views/Pages/WmsTask/WmsTask.module.scss @@ -0,0 +1,113 @@ +.wmsTaskContent { + width: 100%; + height: 100%; + + .wmsTaskList { + width: 100%; + height: calc(100% - 70px); + } + .headerContent { + display: flex; + justify-content: space-between; + align-items: center; + height: 43px; + } + .header { + margin-bottom: 12px; + display: flex; + justify-content: flex-start; + align-items: center; + } +} + +.tagBox { + width: auto; + min-width: 80px; + height: 24px; + background: #ffffff; + border-radius: 19px 19px 19px 19px; + opacity: 1; + border: 1px dashed #bcc4cc; + width: 50px; + height: 20px; + font-size: 14px; + font-family: PingFang SC, PingFang SC; + font-weight: 400; + color: #5a84ff; + display: flex; + justify-content: center; + align-items: center; + // cursor: pointer; +} + +.group { + display: flex; + justify-content: space-between; + align-items: center; +} + +.groupTable { + width: 100%; +} + +.overBox { + width: 100%; + height: calc(100% - 20px); + overflow: auto; + :global(.cs-collapse-item__header) { + background-color: #f1f1f1; + padding: 0 20px; + height: 35px; + font-size: 16px; + font-family: PingFang SC, PingFang SC; + font-weight: 500; + } + :global(.cs-collapse-item__content) { + padding-bottom: 0px; + } +} +.groupHeader { + width: 100%; + height: 30px; + background: #ccc; +} + +.hideBlock { + display: none; +} +.queryForm { + padding: 10px; + background: #f5f7fa; + margin-bottom: 0px; + border-radius: 4px; + + .el-form-item { + margin-right: 20px; + margin-bottom: 0; + + // 缁熶竴杈撳叆妗嗗拰閫夋嫨妗嗙殑瀹藉害 + .el-input, .el-select { + width: 200px; // 璁剧疆缁熶竴鐨勫搴� + } + + // 閫夋嫨妗嗗唴閮ㄨ緭鍏ユ鏍峰紡 + .el-select .el-input__wrapper { + height: 32px; // 涓庤緭鍏ユ楂樺害涓�鑷� + padding: 1px 11px; // 涓庤緭鍏ユ鍐呰竟璺濅竴鑷� + } + + // 鏃ユ湡閫夋嫨鍣ㄥ搴� + .el-date-editor { + width: 220px; + } + } +} + +// 濡傛灉闇�瑕佹洿绮剧‘鐨勬帶鍒讹紝鍙互鍗曠嫭璁剧疆 +.formItem { + width: 200px; + + &.el-input, &.el-select { + width: 100%; + } +} diff --git a/HIAWms/web/src/widgets/WmsTask/Views/Pages/WmsTask/WmsTask.tsx b/HIAWms/web/src/widgets/WmsTask/Views/Pages/WmsTask/WmsTask.tsx new file mode 100644 index 0000000..a299cd0 --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Views/Pages/WmsTask/WmsTask.tsx @@ -0,0 +1,324 @@ +import { computed, defineComponent, onMounted, reactive, ref } from 'vue' +import type { Ref } from 'vue' +import BaseTable from '@/components/Table/Table' +import styles from './WmsTask.module.scss' +import { useWmsTask } from '../../../Controllers/WmsTask' +import IconButton from '@/components/IconButton/IconButton' +import WmsTaskDrawer from '../Dialog/WmsTaskDrawer/WmsTaskDrawer' +import WmsTaskQueryDrawer from '../Dialog/WmsTaskQueryDrawer/WmsTaskQueryDrawer' +import Search from '@/components/Search/Search' +import { columns } from './Config' +import TdButton from '@/components/TdButton/TdButton' +import { vPermission } from '@/libs/Permission/Permission' +import { + getWmsEnumData +} from '@/widgets/WmsTask/Models/Service/WmsTaskDrawer' +import { + ElInput, + ElSelect, + ElOption, + ElDatePicker, + ElForm, + ElFormItem, +} from 'element-plus' +import { injectModel } from '@/libs/Provider/Provider' + +interface RenderTableType { + url?: string + dataSource: Ref<any[]> + isDrag?: boolean + isChecked?: boolean + isHidePagination?: boolean + params?: Record<string, any> + autoHeight?: boolean +} + +export default defineComponent({ + name: 'WmsTask', + directives: { + permission: vPermission, + }, + setup(props, ctx) { + const { + dataSource, + contextMenu, + dialogConfig, + dialogConfigForQuery, + tableRef, + current, + search, + sort, + headers, + onError, + onSearch, + onRowClick, + onConfirmWmsTask, + onCheck, + onAddWmsTask, + onAdvancedQuery, + onExport, + openDetail, + onSuccess, + onBeforeUpload, + } = useWmsTask(props, ctx) + + //瀹氫箟楂樼骇鏌ヨ寮曠敤 + const wmsTaskQueryDrawerRef=ref(null); + // 鏂板鐨勬煡璇㈡潯浠� + const queryForm = ref({ + searchVal: '', + str_searchFormInputAttrs:[] + }) + //瀹氫箟鏁翠綋妯$硦鏌ヨ鐨勫垪鏁扮粍(娉ㄦ剰锛氬繀椤诲ぇ灏忓啓璺熷悗绔殑瀹炰綋绫诲睘鎬у悕涓�鑷达紝鍚﹀垯浼氬鑷村尮閰嶄笉瀵圭殑闂) + const _searchFormInputAttrs = ref([ + 'TaskNo', 'ContainerNo' + ]); + const searchFormInputAttrs_Placeholder = ref('璇疯緭鍏ヤ换鍔$紪鐮�/鎵樼洏缂栫爜'); + + + // 鍔ㄦ�佹灇涓鹃�夐」 + const enumOptions = reactive({ + taskType: [] as Array<{label: string; value: any }>, +taskStatus: [] as Array<{label: string; value: any }>, +sonTaskType: [] as Array<{label: string; value: any }>, + }) + + // 鑾峰彇鏋氫妇鏁版嵁 + const fetchEnumData = async () => { + try { + const taskTypeEnumData = await getWmsEnumData({ + EnumName: 'TaskTypeEnum', +}) +enumOptions.taskType = taskTypeEnumData.map((item) => ({ + label: item.description, + value: item.value, +})) +const wmsTaskStatusData = await getWmsEnumData({ + EnumName: 'WmsTaskStatus', +}) +enumOptions.taskStatus = wmsTaskStatusData.map((item) => ({ + label: item.description, + value: item.value, +})) +const sonTaskTypeEnumData = await getWmsEnumData({ + EnumName: 'SonTaskTypeEnum', +}) +enumOptions.sonTaskType = sonTaskTypeEnumData.map((item) => ({ + label: item.description, + value: item.value, +})) + + } catch (error) { + console.error('鑾峰彇鏋氫妇鏁版嵁澶辫触:', error) + } + } + + // 缁勪欢鎸傝浇鏃惰幏鍙栨灇涓炬暟鎹� + onMounted(() => { + fetchEnumData() + }) + + // 瀹氫箟鍝嶅簲寮忔煡璇㈡暟鎹� + const _curHighQueryData = ref({ searchVal: '',str_searchFormInputAttrs:[] }); + // 鏂扮増鐨勬煡璇㈡柟娉曪紙涓婚〉闈腑鐨勬寜閽�愭煡璇€�戯級 + const handleQueryForMain = async () => { + _curHighQueryData.value.searchVal = queryForm.value.searchVal; + _curHighQueryData.value.str_searchFormInputAttrs = _searchFormInputAttrs.value; + tableRef.value.getList(_curHighQueryData.value) + } + // 鏂扮増鐨勬煡璇㈡柟娉曪紙楂樼骇鏌ヨ涓殑鎸夐挳銆愭煡璇€�戯級 + const handleQuery = async (extraParams = {}) => { + let filteredData = commonGetHighQueryForm(extraParams); + commonSaveCurHighQueryData(filteredData); + tableRef.value.getList(filteredData) + } + // 鏂扮増鐨勬煡璇㈤噸缃� + const resetQuery = () => { + queryForm.value.searchVal = '' + queryForm.value.str_searchFormInputAttrs=_searchFormInputAttrs.value; + } + //鏂扮増鐨勫鍑烘柟娉� + const handleExport=()=>{ + onExport(_curHighQueryData.value); + } + // 鏂扮増鐨勬煡璇㈠脊鍑烘鍏抽棴鏂规硶 + const closeQuery = (extraParams={}) => { + let filteredData = commonGetHighQueryForm(extraParams); + console.log("closeQuery鏂规硶"); + console.log(filteredData); + commonSaveCurHighQueryData(filteredData); + } + //淇濆瓨鏌ヨ鍊� + const commonSaveCurHighQueryData=(filteredData={})=>{ + _curHighQueryData.value = { ..._curHighQueryData.value, ...filteredData }; + _curHighQueryData.value.searchVal = queryForm.value.searchVal + _curHighQueryData.value.str_searchFormInputAttrs =_searchFormInputAttrs.value; + } + //鑾峰彇楂樼骇鏌ヨ寮瑰嚭妗嗙殑鏌ヨ鍊� + const commonGetHighQueryForm=(extraParams={})=>{ + // 杩囨护鎺� undefined 鐨勫�� + let filteredData = Object.assign( + {}, + ...Object.entries(extraParams).map(([key, value]) => + value !== undefined ? { [key]: value } : {} + ) + ) + //缁勫悎妯$硦鏌ヨ + filteredData.searchVal = queryForm.value.searchVal + filteredData.str_searchFormInputAttrs =_searchFormInputAttrs.value; + return filteredData; + } + + + /** + * @returns 琛ㄦ牸 + */ + const RenderBaseTable = (props: RenderTableType) => { + const { + url, + dataSource, + isDrag, + isChecked, + isHidePagination, + params, + autoHeight, + } = props + + return ( + <div + class={{ + [styles.wmsTaskList]: true, + }} + > + <BaseTable + ref={tableRef} + url={url} + sortUrlTpl="/api/v1/HIAWms/wmsTask/{id}/adjustsort/{sort}" + v-model:dataSource={dataSource.value} + columns={columns} + contextMenu={contextMenu} + params={params} + isDrag={isDrag} + isChecked={isChecked} + autoHeight={autoHeight} + onCheck={onCheck} + onRowClick={onRowClick} + isHidePagination={isHidePagination} + pageSize={20} + v-slots={{ + name: ({ row }: any) => { + return row?.name ? ( + <TdButton + onClick={() => openDetail(row)} + text={<span style="color:#5a84ff">璇︽儏</span>} + icon="scale" + tip={row?.name} + hover + > + {row?.name} + </TdButton> + ) : ( + '-' + ) + }, + }} + ></BaseTable> + </div> + ) + } + + return () => { + return ( + <div class={styles.wmsTaskContent}> + {/* 娣诲姞/缂栬緫 */} + <WmsTaskDrawer + v-model={dialogConfig.visible} + title={dialogConfig.title} + row={current.value} + sort={sort.value} + onConfirm={onConfirmWmsTask} + /> + {/* 楂樼骇鏌ヨ */} + <WmsTaskQueryDrawer + ref="wmsTaskQueryDrawerRef" + v-model={dialogConfigForQuery.visible} + title={dialogConfigForQuery.title} + row={current.value} + sort={sort.value} + onConfirmQuery={handleQuery} + onRestQuery={resetQuery} + onClose={closeQuery} + /> + + <div class={styles.headerContent}> + <div class={styles.header}> + <IconButton + v-permission="wmsTask-add" + icon="add-p" + onClick={onAddWmsTask} + type="primary" + > + 娣诲姞 + </IconButton> + <el-divider direction="vertical" /> + + <el-divider direction="vertical" /> + <el-upload + v-permission="wmsTask-import" + name="file" + accept=".xlsx,.xls,.csv" + show-file-list={false} + onError={onError} + onSuccess={onSuccess} + before-upload={onBeforeUpload} + headers={headers.value} + action="/api/v1/HIAWms/wmsTask/import" + > + <IconButton icon="in">瀵煎叆</IconButton> + </el-upload> + + <IconButton + v-permission="wmsTask-output" + icon="out" + onClick={handleExport} + > + 瀵煎嚭 + </IconButton> + </div> + <ElFormItem style={{ marginTop: '15px' }}> + <ElFormItem label="鍏抽敭瀛�"> + <ElInput + v-model={queryForm.value.searchVal} + placeholder={searchFormInputAttrs_Placeholder.value} + clearable + class={styles.formItem} + /> + </ElFormItem> + <IconButton type="primary" icon="search" onClick={handleQueryForMain}> + 鏌ヨ + </IconButton> + {/* <IconButton style="" icon="refresh" onClick={resetQuery}> + 閲嶇疆 + </IconButton> */} + <IconButton + v-permission="wmsTask-add" + icon="search" + onClick={onAdvancedQuery} + type="primary" + > + 楂樼骇鏌ヨ + </IconButton> + </ElFormItem> + </div> + + <RenderBaseTable + url="/api/v1/HIAWms/wmsTask/page" + dataSource={dataSource} + isChecked={true} + isDrag={true} + /> + </div> + ) + } + }, +}) diff --git a/HIAWms/web/src/widgets/WmsTask/Views/WmsTask.module.scss b/HIAWms/web/src/widgets/WmsTask/Views/WmsTask.module.scss new file mode 100644 index 0000000..904ed0d --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Views/WmsTask.module.scss @@ -0,0 +1,7 @@ +.WmsTask { + background-color: #fff; + border-radius: 5px 5px 0 0; + width: 100%; + height: 100%; + border: 1px solid #dbdbdb; +} diff --git a/HIAWms/web/src/widgets/WmsTask/Views/WmsTask.tsx b/HIAWms/web/src/widgets/WmsTask/Views/WmsTask.tsx new file mode 100644 index 0000000..f90d911 --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Views/WmsTask.tsx @@ -0,0 +1,80 @@ +import { + Component, + DefineComponent, + defineComponent, + markRaw, + ref, + SetupContext, + onMounted, +} from 'vue' +import styles from './WmsTask.module.scss' +import Tab from '@/components/Tab/Tab' +import { useProvideModels } from '@/libs/Provider/app' +import { usePermission } from '@/libs/Permission/Permission' +import { permissionCodes } from '../enum' +import { ModuleType, TabItem } from '../type/Type' +import { getEntityNames } from '@/hooks/hook' +import TabPane from '@/components/Tab/TabPane' + +const Models: ModuleType = import.meta.glob('./config/*.json', { + eager: true, +}) + +const entityNames = getEntityNames(Models) + +const nameToLabelMap = [{ name: 'WmsTask', label: 'Wms浠诲姟绠$悊' }] + +export default defineComponent({ + name: 'WmsTask', + + setup(props, ctx: SetupContext) { + useProvideModels() + usePermission(props, permissionCodes) + + const rf = ref<{ + [key: string]: any + }>({}) + + const tabData = ref<TabItem[]>([]) + + const onTabChange = (v: string) => { + rf.value?.[v]?.reloadList() + } + + const initTableData = async () => { + for (const i in entityNames) { + const name = entityNames[i] + const module = await import(`./Pages/${name}/${name}.tsx`) + const WmsTask = markRaw(module.default) + const foundLabel = + nameToLabelMap.find((item) => item.name === name)?.label || name + tabData.value.push({ + label: foundLabel, + name, + component: WmsTask, + }) + } + } + + initTableData() + + return () => { + return ( + <div class={styles.WmsTask}> + <Tab data={tabData.value} type="list" onTab={onTabChange}> + {tabData.value.map((widgetInfo) => { + const Widget: any = widgetInfo.component + return ( + <TabPane label={widgetInfo.label} name={widgetInfo.name}> + <Widget + ref={(r: any) => (rf.value['WmsTask'] = r)} + ></Widget> + </TabPane> + ) + })} + </Tab> + </div> + ) + } + }, +}) diff --git a/HIAWms/web/src/widgets/WmsTask/Views/config/WmsTask.json b/HIAWms/web/src/widgets/WmsTask/Views/config/WmsTask.json new file mode 100644 index 0000000..0434987 --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/Views/config/WmsTask.json @@ -0,0 +1,3 @@ +{ + "name": "WmsTask" +} diff --git a/HIAWms/web/src/widgets/WmsTask/enum.ts b/HIAWms/web/src/widgets/WmsTask/enum.ts new file mode 100644 index 0000000..f9eacd7 --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/enum.ts @@ -0,0 +1,15 @@ +export interface TabType { + label: string + name: string + columns?: any[] + data?: any[] + isFooter: boolean + [key: string]: any +} + +export const permissionCodes = { + 'wmsTask-list': '鍒楄〃-鍒楄〃', + 'wmsTask-add': '鍒楄〃-娣诲姞', + 'wmsTask-import': '鍒楄〃-瀵煎叆', + 'wmsTask-output': '鍒楄〃-杈撳嚭', +} diff --git a/HIAWms/web/src/widgets/WmsTask/index.ts b/HIAWms/web/src/widgets/WmsTask/index.ts new file mode 100644 index 0000000..f96508c --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/index.ts @@ -0,0 +1,14 @@ +import WmsTask from './Views/WmsTask' +import Setting from '@/components/Setting/Setting' +import { provider } from '@/provider/index' +import p from '../../assets/svg/p.svg' + +export default { + is: 'WmsTask', + name: 'Wms浠诲姟绠$悊', + category: 'run', + icon: p, + authorizationRequired: false, + canvasView: provider(WmsTask), + settingsView: Setting, +} diff --git a/HIAWms/web/src/widgets/WmsTask/type/type.d.ts b/HIAWms/web/src/widgets/WmsTask/type/type.d.ts new file mode 100644 index 0000000..2f7f7a9 --- /dev/null +++ b/HIAWms/web/src/widgets/WmsTask/type/type.d.ts @@ -0,0 +1,45 @@ +import { Component } from 'vue' + +export interface DataItemType { + id?: string + name?: string + code?: string + description?: string + label?: string + value?: string | number +} + +export interface WmsTaskBaseType { + id?: string + name?: string + code?: string + value?: number + description?: string + options?: Array<DataItemType> + abilityValue?: number | string + data?: DataItemType + defaultValue?: string | number + flow: string +} + +export interface FlowDefinitionType { + id?: string + name?: string + code?: string + description?: string +} + +export type ModuleType = Record< + string, + { + default: Record<string, string> + name: string + } +> + +export interface TabItem { + name: string + label: string + component: Component + hidden?: boolean +} diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs" index 8821053..4742b52 100644 --- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs" +++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.cs" @@ -236,6 +236,9 @@ var str_enumList = this.tb_EnumList.Text.Trim(); if (str_enumList.IndexOf(',') > -1) { + str_enumList = str_enumList.Replace("\n",""); + str_enumList = str_enumList.Replace("\t", ""); + str_enumList = str_enumList.Replace("\r", ""); var arr_enumList = str_enumList.Split(','); foreach (var item in arr_enumList) { diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/AppService/AppService\346\250\241\346\235\277.txt" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/AppService/AppService\346\250\241\346\235\277.txt" index cfc066a..3f5faca 100644 --- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/AppService/AppService\346\250\241\346\235\277.txt" +++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/AppService/AppService\346\250\241\346\235\277.txt" @@ -282,7 +282,7 @@ foreach (var impItem in importItems) { - if (impItem.$ValidateRepeatName$.IsNullOrWhiteSpace() && impItem.MaterialName.IsNullOrWhiteSpace()) + if (impItem.$ValidateRepeatName$.IsNullOrWhiteSpace()) { continue; } diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/Web/Controllers/EntityModeQueryDrawer\346\250\241\346\235\277.txt" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/Web/Controllers/EntityModeQueryDrawer\346\250\241\346\235\277.txt" index eb91ad8..2631a02 100644 --- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/Web/Controllers/EntityModeQueryDrawer\346\250\241\346\235\277.txt" +++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/Web/Controllers/EntityModeQueryDrawer\346\250\241\346\235\277.txt" @@ -93,20 +93,6 @@ const onReset = async () => { formData.value = {} $Save_PageAddFormAttributes_Query_Clear$ - formData.value.materialCode = '' - formData.value.materialName = '' - formData.value.purchaseType = '' - formData.value.materialType = '' - formData.value.primaryUnit = '' - formData.value.standard = '' - formData.value.outerDiameter = '' - formData.value.wallThickness = '' - formData.value.materialQuality = '' - formData.value.length = '' - formData.value.isMainBranch = '' - formData.value.factory = '' - formData.value.certification = '' - formData.value.remark = '' //向父组件发送自定义事件 ctx.emit('restQuery'); } -- Gitblit v1.9.3