From 5be086f36d5fbcde9aaa6f775961f292aaae6ec1 Mon Sep 17 00:00:00 2001 From: hutongqing <hutongqing@hnkhzn.com> Date: 星期日, 22 十二月 2024 22:53:31 +0800 Subject: [PATCH] 1 --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs | 6 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 59 -- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskFlowConfig/Dt_TaskFlow.cs | 20 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 63 -- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs | 29 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/油墨仓/StackerCraneJob_YM.cs | 29 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs | 9 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs | 125 ++++ 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskFlowConfig/Dt_TaskFlowStep.cs | 20 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs | 156 ++++- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPCheckModel.cs | 3 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs | 71 ++ 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/BasicInfo/RouterController.cs | 72 +- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/油墨仓/CommonHoisterJob.cs | 190 +++++++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPReceiveModel.cs | 3 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 274 --------- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPInboundModel.cs | 3 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj | 2 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP仓/StackerCraneJob_PP.cs | 4 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs | 47 + 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/4cef1081-0412-49a6-a284-ce73df6b1458.vsidx | 0 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 4 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs | 9 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/WIDESEAWCS_Tasks.csproj | 4 项目资料/接口文档/MES业务流程图V1.0.xlsx | 0 代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/46d6cd41-4a65-4d05-9f72-66a9e3980a0c.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs | 44 + 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPIssueModel.cs | 127 ++++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 137 ---- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs | 1 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskFlowConfig/Dt_TaskType.cs | 21 /dev/null | 0 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/干膜仓/StackerCraneJob_GM.cs | 4 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderDetailService.cs | 7 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs | 18 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPBaseModel.cs | 16 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/WIDESEA_OutboundService.csproj | 1 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/油墨仓/HoisterDBName.cs | 0 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/板材仓/StackerCraneJob_BC.cs | 4 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/阻焊仓/StackerCraneJob_ZH.cs | 4 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs | 16 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/测试架仓/StackerCraneJob_CSJ.cs | 4 42 files changed, 979 insertions(+), 627 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/46d6cd41-4a65-4d05-9f72-66a9e3980a0c.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/46d6cd41-4a65-4d05-9f72-66a9e3980a0c.vsidx" new file mode 100644 index 0000000..cd5b5c7 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/46d6cd41-4a65-4d05-9f72-66a9e3980a0c.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/f7067496-52ad-4a4a-bf3f-ed83b0bf130d.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/f7067496-52ad-4a4a-bf3f-ed83b0bf130d.vsidx" deleted file mode 100644 index 6101c24..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/f7067496-52ad-4a4a-bf3f-ed83b0bf130d.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/read.lock" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/read.lock" deleted file mode 100644 index e69de29..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/read.lock" +++ /dev/null diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs" index 17162b0..efd2b07 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs" @@ -19,9 +19,9 @@ InNew = 200, /// <summary> - /// 鍫嗗灈鏈哄緟鎵ц + /// 鍫嗗灈鏈哄叆搴撳緟鎵ц /// </summary> - [Description("鍫嗗灈鏈哄緟鎵ц")] + [Description("鍫嗗灈鏈哄叆搴撳緟鎵ц")] SC_InExecute = 225, /// <summary> @@ -41,6 +41,12 @@ /// </summary> [Description("鍏ュ簱浠诲姟瀹屾垚")] InFinish = 290, + + /// <summary> + /// 鍏ュ簱浠诲姟鎸傝捣 + /// </summary> + [Description("鍏ュ簱浠诲姟鎸傝捣")] + InPending = 297, /// <summary> /// 鍏ュ簱浠诲姟鍙栨秷 @@ -91,6 +97,12 @@ OutFinish = 190, /// <summary> + /// 鍑哄簱浠诲姟鎸傝捣 + /// </summary> + [Description("鍑哄簱浠诲姟鎸傝捣")] + OutPending = 197, + + /// <summary> /// 鍑哄簱浠诲姟鍙栨秷 /// </summary> [Description("鍑哄簱浠诲姟鍙栨秷")] @@ -100,6 +112,6 @@ /// 鍑哄簱浠诲姟寮傚父 /// </summary> [Description("鍑哄簱浠诲姟寮傚父")] - OutException = 199 + OutException = 199, } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" index aad8fe0..675e229 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" @@ -63,29 +63,7 @@ /// <returns></returns> WebResponseContent RequestWMSTask(string palletCode, string sourceAddress); - /// <summary> - /// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎鏈墽琛岀殑浠诲姟 - /// </summary> - /// <param name="deviceNo">璁惧缂栧彿</param> - /// <param name="currentAddress">褰撳墠鍦板潃</param> - /// <returns></returns> - Dt_Task QueryConveyorLineTask(string deviceNo, string currentAddress); - - /// <summary> - /// 鏍规嵁浠诲姟鍙枫�佷笅涓�鍦板潃鏌ヨ杈撻�佺嚎鎵ц涓殑浠诲姟 - /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> - /// <param name="nextAddress">涓嬩竴鍦板潃</param> - /// <returns></returns> - Dt_Task QueryExecutingConveyorLineTask(int taskNum, string nextAddress); - - /// <summary> - /// 鏍规嵁浠诲姟鍙枫�佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎瀹屾垚鐨勪换鍔� - /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> - /// <param name="currentAddress">褰撳墠鍦板潃</param> - /// <returns></returns> - Dt_Task QueryCompletedConveyorLineTask(int taskNum, string currentAddress); + string? RequestAssignLocation(int taskNum, string roadwayNo); /// <summary> /// 鏍规嵁璁惧缂栧彿銆佷换鍔$被鍨嬪垎缁�(鍙��)鎸夌収浼樺厛绾т互鍙婂垱寤烘椂闂存帓搴忔煡璇换鍔℃睜鏂板鐨勪换鍔� @@ -133,41 +111,6 @@ /// <param name="taskNum">浠诲姟鍙�</param> /// <param name="message">寮傚父淇℃伅</param> WebResponseContent UpdateTaskExceptionMessage(int taskNum, string message); - - /// <summary> - /// 鏇存柊浠诲姟鐘舵�佷俊鎭紝骞跺悓姝ヨ嚦WMS - /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> - /// <param name="status">浠诲姟鐘舵��</param> - void UpdateTaskStatus(int taskNum, int status); - - /// <summary> - /// 灏嗕换鍔$姸鎬佷慨鏀逛负涓嬩竴涓姸鎬� - /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> - WebResponseContent UpdateTaskStatusToNext(int taskNum); - - /// <summary> - /// 灏嗕换鍔$姸鎬佷慨鏀逛负涓嬩竴涓姸鎬� - /// </summary> - /// <param name="task">浠诲姟瀹炰綋瀵硅薄</param> - /// <returns></returns> - WebResponseContent UpdateTaskStatusToNext([NotNull] Dt_Task task); - - /// <summary> - /// 鏍规嵁浠诲姟鍙枫�佸綋鍓嶅湴鍧�鏇存柊浠诲姟浣嶇疆淇℃伅 - /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> - /// <param name="currentAddress">褰撳墠鍦板潃</param> - /// <returns></returns> - Dt_Task? UpdatePosition(int taskNum, string currentAddress); - - /// <summary> - /// 浠诲姟瀹屾垚 - /// </summary> - /// <param name="taskNum">浠诲姟缂栧彿</param> - /// <returns>杩斿洖澶勭悊缁撴灉</returns> - WebResponseContent StackCraneTaskCompleted(int taskNum); /// <summary> /// 鎭㈠鎸傝捣浠诲姟 diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskFlowConfig/Dt_TaskFlow.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskFlowConfig/Dt_TaskFlow.cs" new file mode 100644 index 0000000..4ba8898 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskFlowConfig/Dt_TaskFlow.cs" @@ -0,0 +1,20 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WIDESEAWCS_Core.DB.Models; + +namespace WIDESEAWCS_Model.Models.TaskFlowConfig +{ + public class Dt_TaskFlow : BaseEntity + { + public int TaskFlowId { get; set; } + + public int TaskTypeId { get; set; } + + public string TaskFlowName { get; set; } + + public string TaskFlowDescription { get; set; } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskFlowConfig/Dt_TaskFlowStep.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskFlowConfig/Dt_TaskFlowStep.cs" new file mode 100644 index 0000000..d08789b --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskFlowConfig/Dt_TaskFlowStep.cs" @@ -0,0 +1,20 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WIDESEAWCS_Core.DB.Models; + +namespace WIDESEAWCS_Model.Models.TaskFlowConfig +{ + public class Dt_TaskFlowStep : BaseEntity + { + public int StepId { get; set; } + + public int TaskFlowId { get; set; } + + public int NextStepId { get; set; } + + public int SequenceOrder { get; set; } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskFlowConfig/Dt_TaskType.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskFlowConfig/Dt_TaskType.cs" new file mode 100644 index 0000000..44f9f41 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskFlowConfig/Dt_TaskType.cs" @@ -0,0 +1,21 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WIDESEAWCS_Core.DB.Models; + +namespace WIDESEAWCS_Model.Models.TaskFlowConfig +{ + + public class Dt_TaskType : BaseEntity + { + public int TaskTypeId { get; set; } + + public string TaskType { get; set; } + + public string TaskTypeName { get; set; } + + public string TaskTypeDescription { get; set; } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs" index f52d6c9..839d637 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs" @@ -61,6 +61,12 @@ public int PalletType { get; set; } /// <summary> + /// 璁惧缂栧彿 + /// </summary> + [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "璁惧缂栧彿")] + public string DeviceCode { get; set; } + + /// <summary> /// 宸烽亾鍙� /// </summary> [ImporterHeader(Name = "宸烽亾鍙�")] diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj" index 027e104..e4e80a5 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj" @@ -8,7 +8,7 @@ <ItemGroup> <PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" /> - <PackageReference Include="WIDESEAWCS_Core" Version="1.0.7" /> + <PackageReference Include="WIDESEAWCS_Core" Version="1.0.9" /> </ItemGroup> <ItemGroup> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/BasicInfo/RouterController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/BasicInfo/RouterController.cs" index c76f27c..ca38702 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/BasicInfo/RouterController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/BasicInfo/RouterController.cs" @@ -61,48 +61,48 @@ } return content; } - [HttpPost, Route("GetBaseRouterInfo"), AllowAnonymous] - public WebResponseContent GetBaseRouterInfo() - { - try - { - #region 鑾峰彇璺敱绫诲瀷 - List<object> routerTypes = new List<object>(); - Type routerType = typeof(RouterInOutType); - List<int> routerIndexs = Enum.GetValues(typeof(RouterInOutType)).Cast<int>().ToList(); - int routerIndex = 0; - foreach (var item in routerIndexs) - { - FieldInfo? fieldInfo = routerType.GetField(((RouterInOutType)item).ToString()); - DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); - if (description != null) - { - routerTypes.Add(new { key = item.ToString(), value = description.Description }); - } - else - { - routerTypes.Add(new { key = item.ToString(), value = item.ToString() }); - } - routerIndex++; - } - #endregion + //[HttpPost, Route("GetBaseRouterInfo"), AllowAnonymous] + //public WebResponseContent GetBaseRouterInfo() + //{ + // try + // { + // #region 鑾峰彇璺敱绫诲瀷 + // List<object> routerTypes = new List<object>(); + // Type routerType = typeof(RouterInOutType); + // List<int> routerIndexs = Enum.GetValues(typeof(RouterInOutType)).Cast<int>().ToList(); + // int routerIndex = 0; + // foreach (var item in routerIndexs) + // { + // FieldInfo? fieldInfo = routerType.GetField(((RouterInOutType)item).ToString()); + // DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); + // if (description != null) + // { + // routerTypes.Add(new { key = item.ToString(), value = description.Description }); + // } + // else + // { + // routerTypes.Add(new { key = item.ToString(), value = item.ToString() }); + // } + // routerIndex++; + // } + // #endregion - #region 鑾峰彇璁惧缂栧彿 - object deviceCodes = _deviceProtocolRepository.QueryData(x => true).GroupBy(x => x.DeviceChildCode).Select(x => new { key = x.Key, value = x.Key }).ToList(); + // #region 鑾峰彇璁惧缂栧彿 + // object deviceCodes = _deviceProtocolRepository.QueryData(x => true).GroupBy(x => x.DeviceChildCode).Select(x => new { key = x.Key, value = x.Key }).ToList(); - object areaInfos = Enum.GetNames(typeof(AreaInfo)).Select(x => new { key = x, value = x }).ToList(); + // object areaInfos = Enum.GetNames(typeof(AreaInfo)).Select(x => new { key = x, value = x }).ToList(); - #endregion + // #endregion - return WebResponseContent.Instance.OK(data: new { routerTypes, deviceCodes, areaInfos }); - } - catch (Exception ex) - { - return WebResponseContent.Instance.Error(ex.Message); - } + // return WebResponseContent.Instance.OK(data: new { routerTypes, deviceCodes, areaInfos }); + // } + // catch (Exception ex) + // { + // return WebResponseContent.Instance.Error(ex.Message); + // } - } + //} [HttpPost, Route("AddRouters"), AllowAnonymous] public WebResponseContent AddRouters([FromBody] List<RoutersAddDTO> routersAddDTOs, int routerType) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" index fc5ab5c..aab8236 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" @@ -25,17 +25,23 @@ return Service.ReceiveWMSTask(taskDTOs); } + [HttpPost, HttpGet, Route("RequestAssignLocation"), AllowAnonymous] + public string? RequestAssignLocation(int taskNum, string roadwayNo) + { + return Service.RequestAssignLocation(taskNum, roadwayNo); + } + [HttpPost, HttpGet, Route("UpdateTaskExceptionMessage")] public WebResponseContent UpdateTaskExceptionMessage(int taskNum, string message) { return Service.UpdateTaskExceptionMessage(taskNum, message); } - [HttpPost, HttpGet, Route("UpdateTaskStatusToNext")] - public WebResponseContent UpdateTaskStatusToNext(int taskNum) - { - return Service.UpdateTaskStatusToNext(taskNum); - } + //[HttpPost, HttpGet, Route("UpdateTaskStatusToNext")] + //public WebResponseContent UpdateTaskStatusToNext(int taskNum) + //{ + // return Service.UpdateTaskStatusToNext(taskNum); + //} [HttpPost, HttpGet, Route("TaskStatusRecovery")] public WebResponseContent TaskStatusRecovery(int taskNum) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" index 8fbf76e..633738c 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" @@ -16,6 +16,7 @@ #endregion << 鐗� 鏈� 娉� 閲� >> using AutoMapper; +using Newtonsoft.Json; using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using SqlSugar; using System; @@ -30,6 +31,7 @@ using WIDESEAWCS_Core; using WIDESEAWCS_Core.BaseServices; using WIDESEAWCS_Core.Enums; +using WIDESEAWCS_Core.Helper; using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; @@ -145,37 +147,17 @@ return content; } - /// <summary> - /// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎鏈墽琛岀殑浠诲姟 - /// </summary> - /// <param name="deviceNo">璁惧缂栧彿</param> - /// <param name="currentAddress">褰撳墠鍦板潃</param> - /// <returns></returns> - public Dt_Task QueryConveyorLineTask(string deviceNo, string currentAddress) + public string? RequestAssignLocation(int taskNum, string roadwayNo) { - return BaseDal.QueryFirst(x => (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.InNew || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish) && x.CurrentAddress == currentAddress, TaskOrderBy); - } + string responseStr = HttpHelper.Get($"http://127.0.0.1:9293/api/Task/AssignInboundTaskLocation?taskNum={taskNum}&roadwayNo={roadwayNo}"); - /// <summary> - /// 鏍规嵁浠诲姟鍙枫�佷笅涓�鍦板潃鏌ヨ杈撻�佺嚎鎵ц涓殑浠诲姟 - /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> - /// <param name="nextAddress">涓嬩竴鍦板潃</param> - /// <returns></returns> - public Dt_Task QueryExecutingConveyorLineTask(int taskNum, string nextAddress) - { - return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.NextAddress == nextAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy); - } + WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); + if (responseContent != null && responseContent.Status && responseContent.Data != null) + { + return responseContent.Data.ToString(); + } - /// <summary> - /// 鏍规嵁浠诲姟鍙枫�佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎瀹屾垚鐨勪换鍔� - /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> - /// <param name="currentAddress">褰撳墠鍦板潃</param> - /// <returns></returns> - public Dt_Task QueryCompletedConveyorLineTask(int taskNum, string currentAddress) - { - return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InFinish || x.TaskState == (int)TaskOutStatusEnum.Line_OutFinish), TaskOrderBy); + return ""; } /// <summary> @@ -187,11 +169,11 @@ public Dt_Task? QuertStackerCraneTask(string deviceNo, TaskTypeGroup? taskTypeGroup = null) { if (taskTypeGroup == null) - return BaseDal.QueryFirst(x => x.Roadway == deviceNo && (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.Line_InFinish || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew), TaskOrderBy); + return BaseDal.QueryFirst(x => x.Roadway == deviceNo && (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.SC_InExecute || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew), TaskOrderBy); if (taskTypeGroup.Value == TaskTypeGroup.InboundGroup) - return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.Line_InFinish, TaskOrderBy); + return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.SC_InExecute, TaskOrderBy); if (taskTypeGroup.Value == TaskTypeGroup.OutbondGroup) - return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew, TaskOrderBy); + return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutExecute, TaskOrderBy); return null; } @@ -204,9 +186,9 @@ public Dt_Task QueryStackerCraneTask(string deviceNo, string currentAddress = "") { if (string.IsNullOrEmpty(currentAddress)) - return BaseDal.QueryFirst(x => x.Roadway == deviceNo && (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.Line_InFinish || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew), TaskOrderBy); + return BaseDal.QueryFirst(x => x.Roadway == deviceNo && (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.SC_InExecute || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew), TaskOrderBy); else - return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.CurrentAddress == currentAddress && (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.Line_InFinish || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew), TaskOrderBy); + return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.CurrentAddress == currentAddress && (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.SC_InExecute || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutExecute), TaskOrderBy); } /// <summary> @@ -218,9 +200,9 @@ public Dt_Task QueryStackerCraneInTask(string deviceNo, string currentAddress = "") { if (string.IsNullOrEmpty(currentAddress)) - return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.Line_InFinish, TaskOrderBy); + return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.SC_InExecute, TaskOrderBy); else - return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.Line_InFinish && x.CurrentAddress == currentAddress, TaskOrderBy); + return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.SC_InExecute && x.CurrentAddress == currentAddress, TaskOrderBy); } /// <summary> @@ -232,9 +214,9 @@ public Dt_Task QueryStackerCraneOutTask(string deviceNo, string currentAddress = "") { if (string.IsNullOrEmpty(currentAddress)) - return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew, TaskOrderBy); + return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutExecute, TaskOrderBy); else - return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew && x.CurrentAddress == currentAddress, TaskOrderBy); + return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutExecute && x.CurrentAddress == currentAddress, TaskOrderBy); } /// <summary> @@ -245,14 +227,9 @@ /// <returns>杩斿洖浠诲姟瀹炰綋瀵硅薄闆嗗悎锛屽彲鑳戒负null</returns> public List<Dt_Task> QueryStackerCraneOutTasks(string deviceNo, List<string> outStationCodes) { - return BaseDal.QueryData(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew && outStationCodes.Contains(x.CurrentAddress), TaskOrderBy); + return BaseDal.QueryData(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutExecute && outStationCodes.Contains(x.CurrentAddress), TaskOrderBy); } - /// <summary> - /// 鏇存柊浠诲姟寮傚父淇℃伅鏄剧ず - /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> - /// <param name="message">寮傚父淇℃伅</param> public WebResponseContent UpdateTaskExceptionMessage(int taskNum, string message) { WebResponseContent content = new WebResponseContent(); @@ -279,217 +256,6 @@ catch (Exception ex) { content = WebResponseContent.Instance.Error(ex.Message); - } - return content; - } - - /// <summary> - /// 鏇存柊浠诲姟鐘舵�佷俊鎭紝骞跺悓姝ヨ嚦WMS - /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> - /// <param name="status">浠诲姟鐘舵��</param> - public void UpdateTaskStatus(int taskNum, int status) - { - Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); - if (task == null) return; - task.TaskState = status; - task.ModifyDate = DateTime.Now; - BaseDal.UpdateData(task); - } - - /// <summary> - /// 灏嗕换鍔$姸鎬佷慨鏀逛负涓嬩竴涓姸鎬� - /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> - public WebResponseContent UpdateTaskStatusToNext(int taskNum) - { - WebResponseContent content = new WebResponseContent(); - try - { - Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); - if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�"); - return UpdateTaskStatusToNext(task); - } - catch (Exception ex) - { - content = WebResponseContent.Instance.Error(ex.Message); - } - return content; - } - - /// <summary> - /// 灏嗕换鍔$姸鎬佷慨鏀逛负涓嬩竴涓姸鎬� - /// </summary> - /// <param name="task">浠诲姟瀹炰綋瀵硅薄</param> - /// <returns></returns> - public WebResponseContent UpdateTaskStatusToNext([NotNull] Dt_Task task) - { - WebResponseContent content = new WebResponseContent(); - try - { - int oldState = task.TaskState; - if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) - { - if (task.TaskState >= (int)TaskOutStatusEnum.OutFinish) - { - return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�"); - } - - int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>(); - - task.TaskState = nextStatus; - } - else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) - { - if (task.TaskState >= (int)TaskInStatusEnum.InFinish) - { - return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�"); - } - - int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>(); - task.TaskState = nextStatus; - - if (task.TaskState == (int)TaskInStatusEnum.Line_InFinish) - { - Random random = new Random(); - task.CurrentAddress = task.NextAddress; - task.NextAddress = $"{random.Next(1, 100).ToString().PadLeft(3, '0')}-{random.Next(1, 100).ToString().PadLeft(3, '0')}-{random.Next(1, 100).ToString().PadLeft(3, '0')}"; - task.TargetAddress = task.NextAddress; - } - } - else - { - throw new Exception($"浠诲姟绫诲瀷閿欒,鏈壘鍒拌浠诲姟绫诲瀷,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟绫诲瀷:銆恵task.TaskType}銆�"); - } - - if (task.TaskState <= 0) - { - return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�"); - } - - task.ModifyDate = DateTime.Now; - task.Modifier = "System"; - BaseDal.UpdateData(task); - - _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, App.User.UserId > 0 ? $"浜哄伐鎵嬪姩灏嗕换鍔$姸鎬佷粠銆恵oldState}銆戣烦杞埌銆恵task.TaskState}銆�" : $"绯荤粺鑷姩娴佺▼锛屼换鍔$姸鎬佷粠銆恵oldState}銆戣浆鍒般�恵task.TaskState}銆�"); - - content = WebResponseContent.Instance.OK(); - } - catch (Exception ex) - { - content = WebResponseContent.Instance.Error(ex.Message); - } - return content; - } - - /// <summary> - /// 鏍规嵁浠诲姟鍙枫�佸綋鍓嶅湴鍧�鏇存柊浠诲姟浣嶇疆淇℃伅 - /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> - /// <param name="currentAddress">褰撳墠鍦板潃</param> - /// <returns></returns> - public Dt_Task? UpdatePosition(int taskNum, string currentAddress) - { - try - { - Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress); - if (task == null) throw new Exception($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�"); - - string oldCurrentPos = task.CurrentAddress; - string oldNextPos = task.NextAddress; - - List<Dt_Router> routers = _routerService.QueryNextRoutes(task.NextAddress, task.TargetAddress); - if (!routers.Any()) throw new Exception($"鏈壘鍒拌澶囪矾鐢变俊鎭�"); - - task.CurrentAddress = task.NextAddress; - task.NextAddress = routers.FirstOrDefault().ChildPosi; - - task.ModifyDate = DateTime.Now; - task.Modifier = "System"; - BaseDal.UpdateData(task); - - _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"绯荤粺鑷姩娴佺▼锛屾洿鏂板綋鍓嶄綅缃�恵oldCurrentPos} ----> {task.CurrentAddress}銆戝拰涓嬩竴浣嶇疆銆恵oldNextPos} ----> {task.NextAddress}銆�"); - return task; - } - catch (Exception ex) - { - } - return null; - } - - /// <summary> - /// 浠诲姟瀹屾垚 - /// </summary> - /// <param name="taskNum">浠诲姟缂栧彿</param> - /// <returns>杩斿洖澶勭悊缁撴灉</returns> - public WebResponseContent StackCraneTaskCompleted(int taskNum) - { - WebResponseContent content = new WebResponseContent(); - try - { - Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); - if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�"); - - if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting) - { - List<Dt_Router> routers = _routerService.QueryNextRoutes(task.NextAddress, task.TargetAddress); - if (!routers.Any()) return WebResponseContent.Instance.Error($"鏈壘鍒拌澶囪矾鐢变俊鎭�"); - - int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>(); - task.TaskState = nextStatus; - task.CurrentAddress = task.NextAddress; - task.NextAddress = routers.FirstOrDefault().ChildPosi; - task.ModifyDate = DateTime.Now; - task.Modifier = "System"; - BaseDal.UpdateData(task); - - _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�"); - //todo 鍚屾鍒癢MS - - //鏆備笉鑰冭檻澶氫釜鍑哄簱鍙� - } - else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup && task.TaskState == (int)TaskInStatusEnum.SC_InExecuting) - { - //todo - int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>(); - task.TaskState = nextStatus; - task.ModifyDate = DateTime.Now; - task.Modifier = "System"; - BaseDal.UpdateData(task); - _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄叆搴撳畬鎴�"); - - //WMSTaskDTO taskDTO = new WMSTaskDTO() - //{ - // TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")), - // Grade = 1, - // PalletCode = task.PalletCode + "S", - // RoadWay = "SC01", - // SourceAddress = task.TargetAddress, - // TargetAddress = "CLOutAreaA", - // TaskState = (int)TaskOutStatusEnum.OutNew, - // Id = 0, - // TaskType = (int)TaskOutboundTypeEnum.Outbound - //}; - - //content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); - } - else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) - { - //todo 璋冪敤WMS绉诲簱瀹屾垚 - } - else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OtherGroup) - { - - } - else - { - throw new Exception($"浠诲姟绫诲瀷閿欒,鏈壘鍒拌浠诲姟绫诲瀷,浠诲姟鍙�:銆恵taskNum}銆�,浠诲姟绫诲瀷:銆恵task.TaskType}銆�"); - } - content = WebResponseContent.Instance.OK(); - } - catch (Exception ex) - { - content = WebResponseContent.Instance.Error($"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆�"); } return content; } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" index e66cafa..b2902c0 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" @@ -91,18 +91,7 @@ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param> public void RequestInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode) { - if (_taskService.RequestWMSTask(command.Barcode, childDeviceCode).Status) - { - Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); - if (task != null) - { - ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task); - taskCommand.InteractiveSignal = command.InteractiveSignal; - conveyorLine.SendCommand(taskCommand, childDeviceCode); - - _taskService.UpdateTaskStatusToNext(task); - } - } + } /// <summary> @@ -113,17 +102,7 @@ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param> public void RequestInNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode) { - Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); - if (task != null) - { - Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress); - if (newTask != null) - { - ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(newTask); - taskCommand.InteractiveSignal = command.InteractiveSignal; - conveyorLine.SendCommand(taskCommand, childDeviceCode); - } - } + } /// <summary> @@ -134,13 +113,7 @@ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param> public void ConveyorLineInFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode) { - Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); - if (task != null) - { - //conveyorLine.SetValue(R_ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode); - WebResponseContent content = _taskService.UpdateTaskStatusToNext(task); - Console.Out.WriteLine(content.Serialize()); - } + } /// <summary> @@ -151,15 +124,7 @@ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param> public void RequestOutbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode) { - Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); - if (task != null) - { - ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task); - taskCommand.InteractiveSignal = command.InteractiveSignal; - conveyorLine.SendCommand(taskCommand, childDeviceCode); - - _taskService.UpdateTaskStatusToNext(task); - } + } /// <summary> @@ -170,17 +135,7 @@ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param> public void RequestOutNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode) { - Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); - if (task != null) - { - Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress); - if (newTask != null) - { - ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(newTask); - taskCommand.InteractiveSignal = command.InteractiveSignal; - conveyorLine.SendCommand(taskCommand, childDeviceCode); - } - } + } /// <summary> @@ -191,13 +146,7 @@ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param> public void ConveyorLineOutFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode) { - Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); - if (task != null) - { - //conveyorLine.SetValue(R_ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode); - WebResponseContent content = _taskService.UpdateTaskStatusToNext(task); - Console.Out.WriteLine(content.Serialize()); - } + } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/HoisterJob/CommonHoisterJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/HoisterJob/CommonHoisterJob.cs" deleted file mode 100644 index 6b42abd..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/HoisterJob/CommonHoisterJob.cs" +++ /dev/null @@ -1,90 +0,0 @@ -锘縰sing Quartz; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using WIDESEAWCS_Common.TaskEnum; -using WIDESEAWCS_ITaskInfoRepository; -using WIDESEAWCS_ITaskInfoService; -using WIDESEAWCS_QuartzJob; -using WIDESEAWCS_QuartzJob.Service; -using WIDESEAWCS_TaskInfoService; -using WIDESEAWCS_Tasks.HoisterJob; - -namespace WIDESEAWCS_Tasks -{ - [DisallowConcurrentExecution] - public class CommonHoisterJob : JobBase, IJob - { - private readonly ITaskService _taskService; - private readonly ITaskExecuteDetailService _taskExecuteDetailService; - private readonly ITaskRepository _taskRepository; - private readonly IRouterService _routerService; - - public CommonHoisterJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService) - { - _taskService = taskService; - _taskExecuteDetailService = taskExecuteDetailService; - _taskRepository = taskRepository; - _routerService = routerService; - } - public Task Execute(IJobExecutionContext context) - { - try - { - OtherDevice Hoister = (OtherDevice)context.JobDetail.JobDataMap.Get("JobParams"); - if (Hoister != null) - { - foreach (var HoisterJob in Hoister.DeviceProDTOs.GroupBy(x => x.DeviceChildCode)) - { - var Tray = Hoister.GetValue<HoisterDBName, bool>(HoisterDBName.Tray, HoisterJob.Key); - var Leisure = Hoister.GetValue<HoisterDBName, bool>(HoisterDBName.Leisure, HoisterJob.Key); - if (Tray) - { - #region 鏌ヨ缁勭洏淇℃伅 - //鍚慦MS鐢宠鏌ヨ褰撳墠鎻愬崌鏈哄彛鐨勭粍鐩樹俊鎭紝瀛樺湪缁勭洏淇℃伅杩斿洖鍏ュ簱浠诲姟骞跺彂鍑哄叆搴撶敵璇� - var task = _taskService.QueryExecutingConveyorLineTask(1, HoisterJob.Key); - if (Leisure && task != null) - Hoister.SetValue(HoisterDBName.RequestIn, true, HoisterJob.Key); - - #endregion - var Inbounding = Hoister.GetValue<HoisterDBName, bool>(HoisterDBName.Inbounding, HoisterJob.Key); - if (Inbounding && task != null) - { - task.TaskState = (int)TaskInStatusEnum.Line_InFinish; - task.NextAddress = "001-003-001"; - _taskService.UpdateData(task); - //鏇存柊浠诲姟鐘舵�佸苟鍙栨秷鍏ュ簱鐢宠 - Hoister.SetValue(HoisterDBName.RequestIn, false, HoisterJob.Key); - } - } - else - { - //鏌ヨ鍑哄簱浠诲姟,瀛樺湪鍑哄簱浠诲姟鍙戝嚭鍑哄簱鐢宠 - var task = _taskService.QueryExecutingConveyorLineTask(2, HoisterJob.Key); - if (task != null && Leisure) - Hoister.SetValue(HoisterDBName.RequestOut, true, HoisterJob.Key); - var Outbounding = Hoister.GetValue<HoisterDBName, bool>(HoisterDBName.Outbounding, HoisterJob.Key); - if (Outbounding && task != null) - { - task.NextAddress = HoisterJob.Key; - task.TargetAddress = HoisterJob.Key; - task.TaskState = (int)TaskOutStatusEnum.OutNew; - _taskService.UpdateData(task); - //鏇存柊浠诲姟鐘舵�佸苟鍙栨秷鍑哄簱鐢宠 - Hoister.SetValue(HoisterDBName.RequestOut, false, HoisterJob.Key); - } - } - - } - } - } - catch (Exception ex) - { - - } - return Task.CompletedTask; - } - } -} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/StackerCraneJob_PP.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/StackerCraneJob_PP.cs" index b8b06cd..2345f90 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/StackerCraneJob_PP.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/StackerCraneJob_PP.cs" @@ -69,7 +69,7 @@ if (sendFlag) { commonStackerCrane.LastTaskType = task.TaskType; - _taskService.UpdateTaskStatusToNext(task.TaskNum); + // _taskService.UpdateTaskStatusToNext(task.TaskNum); } } } @@ -97,7 +97,7 @@ if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) { Console.Out.WriteLine("TaskCompleted" + e.TaskNum); - _taskService.StackCraneTaskCompleted(e.TaskNum); + // _taskService.StackCraneTaskCompleted(e.TaskNum); commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" index dced94b..4d8b471 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" @@ -65,7 +65,7 @@ if (sendFlag) { commonStackerCrane.LastTaskType = task.TaskType; - _taskService.UpdateTaskStatusToNext(task.TaskNum); + //_taskService.UpdateTaskStatusToNext(task.TaskNum); } } } @@ -93,7 +93,7 @@ if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) { Console.Out.WriteLine("TaskCompleted" + e.TaskNum); - _taskService.StackCraneTaskCompleted(e.TaskNum); + // _taskService.StackCraneTaskCompleted(e.TaskNum); commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TestJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TestJob.cs" deleted file mode 100644 index 089b050..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TestJob.cs" +++ /dev/null @@ -1,84 +0,0 @@ -锘縰sing HslCommunication; -using HslCommunication.Core; -using Microsoft.VisualBasic.FileIO; -using Quartz; -using SixLabors.ImageSharp.PixelFormats; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using WIDESEAWCS_Communicator; -using WIDESEAWCS_Core.Helper; -using WIDESEAWCS_QuartzJob; -using WIDESEAWCS_QuartzJob.DeviceBase; -using WIDESEAWCS_QuartzJob.StackerCrane.Enum; - -namespace WIDESEAWCS_Tasks -{ - [DisallowConcurrentExecution] - public class TestJob : IJob - { - public Task Execute(IJobExecutionContext context) - { - try - { - CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); - - Console.Out.WriteLine(commonStackerCrane.DeviceName + "鐘舵��:" + commonStackerCrane.StackerCraneStatusDes); - - Console.Out.WriteLine(commonStackerCrane.DeviceName + "鎵嬭嚜鍔ㄧ姸鎬�:" + commonStackerCrane.StackerCraneAutoStatusDes); - - Console.Out.WriteLine(commonStackerCrane.DeviceName + "浣滀笟鐘舵��:" + commonStackerCrane.StackerCraneWorkStatusDes); - - //Console.Out.WriteLine(commonStackerCrane.DeviceName + "褰撳墠浠诲姟鍙�:" + commonStackerCrane.GetValue<StackerCraneDBName, int>(StackerCraneDBName.CurrentTaskNum)); - - //commonStackerCrane.SetValue(StackerCraneDBName.CurrentTaskNum, DateTime.Now.Second); - - //OperateResult<TimeSpan> operateResult = commonStackerCrane.Communicator.Wait("DB1.18", 1000, 60000, 1); - //Console.Out.WriteLine(operateResult.Serialize()); - - byte[] bytes = commonStackerCrane.Communicator.Read("DB1.1", 2); - Console.Out.WriteLine(bytes.ToBoolArray().ToList().Serialize()); - - bool[] bools = new bool[] { true, false, true }; - byte[] bytes1 = bools.ToByteArray(); - Console.Out.WriteLine(bytes1.ToList().Serialize()); - - //StackerCraneCommand stackerCraneCommand = new StackerCraneCommand() - //{ - // TaskNum = 999, - // WorkType = 1, - // TrayType = 2, - // StartRow = 12, - // StartColumn = 13, - // StartLayer = 14, - // EndRow = 22, - // EndColumn = 23, - // EndLayer = 24, - //}; - - //bool flag = commonStackerCrane.SendCommand(stackerCraneCommand); - //Console.Out.WriteLine(flag); - - //StackerCraneCommand stackerCraneCommand2 = new StackerCraneCommand(); - //stackerCraneCommand2 = commonStackerCrane.Communicator.ReadCustomer<StackerCraneCommand>("DB2.2"); - //Console.Out.WriteLine(stackerCraneCommand2.Serialize()); - - Console.Out.WriteLine(DateTime.Now); - - Console.Out.WriteLine(); - } - catch (Exception ex) - { - Console.Out.WriteLine(nameof(TestJob) + ":" + ex.Message); - } - - return Task.CompletedTask; - } - } - - -} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/WIDESEAWCS_Tasks.csproj" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/WIDESEAWCS_Tasks.csproj" index ed70cc3..92c4c9d 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/WIDESEAWCS_Tasks.csproj" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/WIDESEAWCS_Tasks.csproj" @@ -14,4 +14,8 @@ <ProjectReference Include="..\WIDESEAWCS_TaskInfoService\WIDESEAWCS_TaskInfoService.csproj" /> </ItemGroup> + <ItemGroup> + <Folder Include="HoisterJob\" /> + </ItemGroup> + </Project> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/StackerCraneJob_GM.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/StackerCraneJob_GM.cs" index 003e20b..424425e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/StackerCraneJob_GM.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/StackerCraneJob_GM.cs" @@ -69,7 +69,7 @@ if (sendFlag) { commonStackerCrane.LastTaskType = task.TaskType; - _taskService.UpdateTaskStatusToNext(task.TaskNum); + // _taskService.UpdateTaskStatusToNext(task.TaskNum); } } } @@ -97,7 +97,7 @@ if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) { Console.Out.WriteLine("TaskCompleted" + e.TaskNum); - _taskService.StackCraneTaskCompleted(e.TaskNum); + // _taskService.StackCraneTaskCompleted(e.TaskNum); commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/StackerCraneJob_BC.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/StackerCraneJob_BC.cs" index 2f537f9..eba2492 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/StackerCraneJob_BC.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/StackerCraneJob_BC.cs" @@ -69,7 +69,7 @@ if (sendFlag) { commonStackerCrane.LastTaskType = task.TaskType; - _taskService.UpdateTaskStatusToNext(task.TaskNum); + // _taskService.UpdateTaskStatusToNext(task.TaskNum); } } } @@ -97,7 +97,7 @@ if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) { Console.Out.WriteLine("TaskCompleted" + e.TaskNum); - _taskService.StackCraneTaskCompleted(e.TaskNum); + // _taskService.StackCraneTaskCompleted(e.TaskNum); commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/CommonHoisterJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/CommonHoisterJob.cs" new file mode 100644 index 0000000..6152060 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/CommonHoisterJob.cs" @@ -0,0 +1,190 @@ +锘縰sing Quartz; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WIDESEAWCS_Common.TaskEnum; +using WIDESEAWCS_Core.Helper; +using WIDESEAWCS_IBasicInfoRepository; +using WIDESEAWCS_ITaskInfoRepository; +using WIDESEAWCS_ITaskInfoService; +using WIDESEAWCS_Model.Models; +using WIDESEAWCS_QuartzJob; +using WIDESEAWCS_QuartzJob.Service; +using WIDESEAWCS_TaskInfoService; +using WIDESEAWCS_Tasks.HoisterJob; + +namespace WIDESEAWCS_Tasks +{ + /// <summary> + /// 娌瑰ⅷ浠撴彁鍗囨満 + /// </summary> + [DisallowConcurrentExecution] + public class CommonHoisterJob : JobBase, IJob + { + private readonly ITaskService _taskService; + private readonly ITaskExecuteDetailService _taskExecuteDetailService; + private readonly ITaskRepository _taskRepository; + private readonly IRouterService _routerService; + private readonly IStationMangerRepository _stationMangerRepository; + + public CommonHoisterJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository) + { + _taskService = taskService; + _taskExecuteDetailService = taskExecuteDetailService; + _taskRepository = taskRepository; + _routerService = routerService; + _stationMangerRepository = stationMangerRepository; + } + + public Task Execute(IJobExecutionContext context) + { + OtherDevice hoister = (OtherDevice)context.JobDetail.JobDataMap.Get("JobParams"); + try + { + if (hoister != null) + { + List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == hoister.DeviceCode); + if (stationMangers == null || stationMangers.Count == 0) + { + WriteInfo(hoister.DeviceName, "鏈壘鍒板搴旂珯鍙颁俊鎭�"); + + return Task.CompletedTask; + } + + foreach (string deviceChildCode in hoister.DeviceProDTOs.GroupBy(x => x.DeviceChildCode).Select(x => x.Key)) + { + bool tray = hoister.GetValue<HoisterDBName, bool>(HoisterDBName.Tray, deviceChildCode); + bool leisure = hoister.GetValue<HoisterDBName, bool>(HoisterDBName.Leisure, deviceChildCode); + bool requestIn = hoister.GetValue<HoisterDBName, bool>(HoisterDBName.RequestIn, deviceChildCode); + bool requestOut = hoister.GetValue<HoisterDBName, bool>(HoisterDBName.RequestOut, deviceChildCode); + bool inbounding = hoister.GetValue<HoisterDBName, bool>(HoisterDBName.Inbounding, deviceChildCode); + bool outbounding = hoister.GetValue<HoisterDBName, bool>(HoisterDBName.Outbounding, deviceChildCode); + + if (leisure && tray && !requestIn && !inbounding && !requestOut && !outbounding) + { + Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskInStatusEnum.InNew.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == deviceChildCode); + if (task != null) + { + bool isWrite = hoister.SetValue(HoisterDBName.RequestIn, true, deviceChildCode); + WriteInfo(hoister.DeviceName, $"璇锋眰鍏ュ簱,璁惧缂栧彿:{deviceChildCode},浠诲姟鍙�:{task.TaskNum}"); + } + } + else if (!leisure && tray && requestIn && inbounding && !requestOut && !outbounding) + { + Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskInStatusEnum.InNew.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == deviceChildCode); + if (task != null) + { + Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationDeviceCode == deviceChildCode); + if (stationManger == null) + { + WriteInfo(hoister.DeviceName, $"鏈壘鍒板搴旂珯鍙颁俊鎭�,璁惧缂栧彿:{deviceChildCode},浠诲姟鍙�:{task.TaskNum}"); + break; + } + string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode); + if (string.IsNullOrEmpty(locationCode)) + { + WriteInfo(hoister.DeviceName, $"璇锋眰鍒嗛厤璐т綅杩斿洖淇℃伅閿欒,璁惧缂栧彿:{deviceChildCode},浠诲姟鍙�:{task.TaskNum}"); + break; + } + + task.TargetAddress = locationCode; + task.NextAddress = locationCode; + task.Roadway = stationManger.StackerCraneCode; + task.TaskState = TaskInStatusEnum.SC_InExecute.ObjToInt(); + _taskRepository.UpdateData(task); + + bool isWrite = hoister.SetValue(HoisterDBName.RequestIn, false, deviceChildCode); + } + else + { + WriteInfo(hoister.DeviceName, $"鏈壘鍒板搴旂珯鍙颁俊鎭�,{deviceChildCode}"); + } + } + else if (leisure && !tray && !requestIn && !inbounding && !requestOut && !outbounding) + { + Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskOutStatusEnum.OutNew.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress)); + if (task != null) + { + bool isWrite = hoister.SetValue(HoisterDBName.RequestOut, true, deviceChildCode); + WriteInfo(hoister.DeviceName, $"璇锋眰鍑哄簱,璁惧缂栧彿:{deviceChildCode},浠诲姟鍙�:{task.TaskNum}"); + } + } + else if (!leisure && !tray && !requestIn && !inbounding && requestOut && outbounding) + { + Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskInStatusEnum.InNew.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == deviceChildCode); + if (task != null) + { + Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationDeviceCode == deviceChildCode); + if (stationManger == null) + { + WriteInfo(hoister.DeviceName, $"鏈壘鍒板搴旂珯鍙颁俊鎭�,璁惧缂栧彿:{deviceChildCode},浠诲姟鍙�:{task.TaskNum}"); + break; + } + + task.TargetAddress = deviceChildCode; + task.NextAddress = deviceChildCode; + task.Roadway = stationManger.StackerCraneCode; + task.TaskState = TaskInStatusEnum.SC_InExecute.ObjToInt(); + _taskRepository.UpdateData(task); + + bool isWrite = hoister.SetValue(HoisterDBName.RequestIn, false, deviceChildCode); + } + else + { + WriteInfo(hoister.DeviceName, $"鏈壘鍒板搴旂珯鍙颁俊鎭�,{deviceChildCode}"); + } + } + + + //if (tray && leisure) + //{ + //#region 鏌ヨ缁勭洏淇℃伅 + //鍚慦MS鐢宠鏌ヨ褰撳墠鎻愬崌鏈哄彛鐨勭粍鐩樹俊鎭紝瀛樺湪缁勭洏淇℃伅杩斿洖鍏ュ簱浠诲姟骞跺彂鍑哄叆搴撶敵璇� + //var task = _taskService.QueryExecutingConveyorLineTask(1, deviceChildCode); + //if (Leisure && task != null) + // Hoister.SetValue(HoisterDBName.RequestIn, true, deviceChildCode); + + //#endregion + //var Inbounding = Hoister.GetValue<HoisterDBName, bool>(HoisterDBName.Inbounding, deviceChildCode); + //if (Inbounding && task != null) + //{ + // task.TaskState = (int)TaskInStatusEnum.SC_InExecute; + // task.NextAddress = "001-003-001"; + // _taskService.UpdateData(task); + // //鏇存柊浠诲姟鐘舵�佸苟鍙栨秷鍏ュ簱鐢宠 + // Hoister.SetValue(HoisterDBName.RequestIn, false, deviceChildCode); + //} + //} + //else + //{ + + + //鏌ヨ鍑哄簱浠诲姟,瀛樺湪鍑哄簱浠诲姟鍙戝嚭鍑哄簱鐢宠 + //var task = _taskService.QueryExecutingConveyorLineTask(2, deviceChildCode); + //if (task != null && Leisure) + // Hoister.SetValue(HoisterDBName.RequestOut, true, deviceChildCode); + //var Outbounding = Hoister.GetValue<HoisterDBName, bool>(HoisterDBName.Outbounding, deviceChildCode); + //if (Outbounding && task != null) + //{ + // task.NextAddress = deviceChildCode; + // task.TargetAddress = deviceChildCode; + // task.TaskState = (int)TaskOutStatusEnum.OutNew; + // _taskService.UpdateData(task); + // //鏇存柊浠诲姟鐘舵�佸苟鍙栨秷鍑哄簱鐢宠 + // Hoister.SetValue(HoisterDBName.RequestOut, false, deviceChildCode); + //} + //} + + } + } + } + catch (Exception ex) + { + WriteError(hoister.DeviceName, "", ex); + } + return Task.CompletedTask; + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/HoisterJob/HoisterDBName.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/HoisterDBName.cs" similarity index 100% rename from "\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/HoisterJob/HoisterDBName.cs" rename to "\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/HoisterDBName.cs" diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/StackerCraneJob_YM.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/StackerCraneJob_YM.cs" index 0b1a496..53ed581 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/StackerCraneJob_YM.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\262\271\345\242\250\344\273\223/StackerCraneJob_YM.cs" @@ -7,7 +7,9 @@ using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Common.TaskEnum; +using WIDESEAWCS_Core; using WIDESEAWCS_Core.Enums; +using WIDESEAWCS_Core.Helper; using WIDESEAWCS_IBasicInfoRepository; using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; @@ -23,6 +25,9 @@ namespace WIDESEAWCS_Tasks { + /// <summary> + /// 娌瑰ⅷ浠撳爢鍨涙満 + /// </summary> [DisallowConcurrentExecution] public class StackerCraneJob_YM : JobBase, IJob { @@ -69,7 +74,17 @@ if (sendFlag) { commonStackerCrane.LastTaskType = task.TaskType; - _taskService.UpdateTaskStatusToNext(task.TaskNum); + int oldState = task.TaskState; + if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) + { + task.TaskState = TaskInStatusEnum.SC_InExecuting.ObjToInt(); + } + else + { + task.TaskState = TaskOutStatusEnum.SC_OutExecuting.ObjToInt(); + } + _taskRepository.UpdateData(task); + _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"绯荤粺鑷姩娴佺▼锛屼换鍔$姸鎬佷粠銆恵oldState}銆戣浆鍒般�恵task.TaskState}銆�"); } } } @@ -94,10 +109,18 @@ CommonStackerCrane? commonStackerCrane = sender as CommonStackerCrane; if (commonStackerCrane != null) { + WriteInfo(commonStackerCrane.DeviceName, $"璇诲彇鍒颁换鍔″畬鎴愪俊鍙�,{e.TaskNum}"); if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) { - Console.Out.WriteLine("TaskCompleted" + e.TaskNum); - _taskService.StackCraneTaskCompleted(e.TaskNum); + Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum); + if (task != null) + { + + } + else + { + WriteInfo(commonStackerCrane.DeviceName, $"璇诲彇鍒颁换鍔″畬鎴愪俊鍙�,鏈壘鍒板搴旂殑浠诲姟淇℃伅,{e.TaskNum}"); + } commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/StackerCraneJob_CSJ.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/StackerCraneJob_CSJ.cs" index 9951ece..b66585d 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/StackerCraneJob_CSJ.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/StackerCraneJob_CSJ.cs" @@ -69,7 +69,7 @@ if (sendFlag) { commonStackerCrane.LastTaskType = task.TaskType; - _taskService.UpdateTaskStatusToNext(task.TaskNum); + // _taskService.UpdateTaskStatusToNext(task.TaskNum); } } } @@ -97,7 +97,7 @@ if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) { Console.Out.WriteLine("TaskCompleted" + e.TaskNum); - _taskService.StackCraneTaskCompleted(e.TaskNum); + // _taskService.StackCraneTaskCompleted(e.TaskNum); commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/StackerCraneJob_ZH.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/StackerCraneJob_ZH.cs" index 1a0f5f3..dd8c979 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/StackerCraneJob_ZH.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/StackerCraneJob_ZH.cs" @@ -69,7 +69,7 @@ if (sendFlag) { commonStackerCrane.LastTaskType = task.TaskType; - _taskService.UpdateTaskStatusToNext(task.TaskNum); + // _taskService.UpdateTaskStatusToNext(task.TaskNum); } } } @@ -97,7 +97,7 @@ if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) { Console.Out.WriteLine("TaskCompleted" + e.TaskNum); - _taskService.StackCraneTaskCompleted(e.TaskNum); + // _taskService.StackCraneTaskCompleted(e.TaskNum); commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/44ca8512-2c9c-4084-8306-4da22284d9a3.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/44ca8512-2c9c-4084-8306-4da22284d9a3.vsidx" deleted file mode 100644 index bf783c7..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/44ca8512-2c9c-4084-8306-4da22284d9a3.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/4cef1081-0412-49a6-a284-ce73df6b1458.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/4cef1081-0412-49a6-a284-ce73df6b1458.vsidx" new file mode 100644 index 0000000..5f25c44 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/4cef1081-0412-49a6-a284-ce73df6b1458.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/659246e0-feaf-49b5-8c49-7456594f6dd5.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/659246e0-feaf-49b5-8c49-7456594f6dd5.vsidx" deleted file mode 100644 index 5604aac..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/659246e0-feaf-49b5-8c49-7456594f6dd5.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/72845575-fd42-4ccb-9a0b-52ec01d5a35a.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/72845575-fd42-4ccb-9a0b-52ec01d5a35a.vsidx" deleted file mode 100644 index 5c6fded..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/72845575-fd42-4ccb-9a0b-52ec01d5a35a.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/bfff5ce4-43fc-42d6-bbfb-5b2b395f1cc1.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/bfff5ce4-43fc-42d6-bbfb-5b2b395f1cc1.vsidx" deleted file mode 100644 index 1a2203f..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/bfff5ce4-43fc-42d6-bbfb-5b2b395f1cc1.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock" deleted file mode 100644 index e69de29..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/read.lock" +++ /dev/null diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs" index ccfdf9b..fc1a9f0 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs" @@ -15,11 +15,13 @@ { public static async Task<string> GetAsync(string serviceAddress, string contentType = "application/json", Dictionary<string, string>? headers = null) { + string result = string.Empty; + DateTime beginDate = DateTime.Now; try { - string result = string.Empty; using HttpClient httpClient = new HttpClient(); httpClient.Timeout = new TimeSpan(0, 0, 60); + if (headers != null) { foreach (var header in headers) @@ -31,21 +33,26 @@ } catch (Exception e) { - Console.WriteLine(e.Message); + throw new Exception(e.Message); } - return null; + finally + { + Logger.Add(serviceAddress, "", result, beginDate); + } } - public static async Task<string> PostAsync(string serviceAddress, string requestJson = null, string contentType = "application/json", Dictionary<string, string>? headers = null) + public static async Task<string?> PostAsync(string serviceAddress, string requestJson = null, string contentType = "application/json", Dictionary<string, string>? headers = null) { + string result = string.Empty; + DateTime beginDate = DateTime.Now; try { - string result = string.Empty; using (HttpContent httpContent = new StringContent(requestJson)) { httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); using HttpClient httpClient = new HttpClient(); httpClient.Timeout = new TimeSpan(0, 0, 60); + if (headers != null) { foreach (var header in headers) @@ -58,18 +65,23 @@ } catch (Exception e) { - Console.WriteLine(e.Message); + throw new Exception(e.Message); } - return null; + finally + { + Logger.Add(serviceAddress, requestJson == null ? "" : requestJson, result, beginDate); + } } public static string Get(string serviceAddress, string contentType = "application/json", Dictionary<string, string>? headers = null) { + string result = string.Empty; + DateTime beginDate = DateTime.Now; try { - string result = string.Empty; using HttpClient httpClient = new HttpClient(); httpClient.Timeout = new TimeSpan(0, 0, 60); + if (headers != null) { foreach (var header in headers) @@ -81,16 +93,20 @@ } catch (Exception e) { - Console.WriteLine(e.Message); + throw new Exception(e.Message); } - return null; + finally + { + Logger.Add(serviceAddress, "", result, beginDate); + } } public static string Post(string serviceAddress, string requestJson = null, string contentType = "application/json", Dictionary<string, string>? headers = null) { + string result = string.Empty; + DateTime beginDate = DateTime.Now; try { - string result = string.Empty; using (HttpContent httpContent = new StringContent(requestJson)) { httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); @@ -103,20 +119,18 @@ httpClient.DefaultRequestHeaders.Add(header.Key, header.Value); } - result = httpClient.PostAsync(serviceAddress, httpContent).Result.Content.ReadAsStringAsync().Result; } return result; } catch (Exception e) { - Console.WriteLine(e.Message); + throw new Exception(e.Message); } finally { - + Logger.Add(serviceAddress, requestJson == null ? "" : requestJson, result, beginDate); } - return null; } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs" index 3f5cc23..627af8b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs" @@ -187,6 +187,53 @@ loggerQueueData.Enqueue(log); } + public static void Add(string url, string requestParameter, string responseParameter, DateTime beginDate) + { + dynamic? log = null; + try + { + //鑾峰彇褰撳墠鐢ㄦ埛 + IUser? user = App.User; + //鍒涘缓鏃ュ織瀵硅薄 + log = new + { + //璇锋眰寮�濮嬫椂闂� + BeginDate = beginDate, + //璇锋眰缁撴潫鏃堕棿 + EndDate = DateTime.Now, + //璇锋眰鍙傛暟 + RequestParam = requestParameter, + //鍝嶅簲鍙傛暟 + ResponseParam = responseParameter, + //璇锋眰URL + Url = url, + //瀹㈡埛绔疘P + UserIP = "", + //鐢ㄦ埛ID + UserId = user?.UserId, + //鐢ㄦ埛鍚� + UserName = user?.UserName + }; + } + catch (Exception exception) + { + //濡傛灉鍙戠敓寮傚父锛屽垯鍒涘缓鏃ュ織瀵硅薄 + log = log ?? new + { + //璇锋眰寮�濮嬫椂闂� + BeginDate = DateTime.Now, + //璇锋眰缁撴潫鏃堕棿 + EndDate = DateTime.Now, + //璇锋眰鍙傛暟 + RequestParam = requestParameter, + //鍝嶅簲鍙傛暟 + ResponseParam = responseParameter, + }; + } + //娣诲姞绯荤粺鏃ュ織 + loggerQueueData.Enqueue(log); + } + public static string GetClientIP(HttpContext context) { // 鑾峰彇璇锋眰澶翠腑鐨刋-Forwarded-For瀛楁锛屽苟灏嗗叾杞崲涓哄瓧绗︿覆 diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPBaseModel.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPBaseModel.cs" index 4a10e94..ec462f3 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPBaseModel.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPBaseModel.cs" @@ -6,14 +6,30 @@ namespace WIDESEA_External.Model { + /// <summary> + /// ERP鎺ュ彛璋冪敤鍩虹妯″瀷 + /// </summary> + /// <typeparam name="T"></typeparam> public class ERPBaseModel<T> { + /// <summary> + /// 鍗曟嵁绫诲瀷 + /// </summary> public string Type { get; set; } + /// <summary> + /// 璇存槑 + /// </summary> public string Desc { get; set; } + /// <summary> + /// ERP瀹夊叏鐮� + /// </summary> public string SecurityCode { get; set; } + /// <summary> + /// 鏁版嵁瀵硅薄 + /// </summary> public T Data { get; set; } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPCheckModel.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPCheckModel.cs" index a65a6dc..415d4a3 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPCheckModel.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPCheckModel.cs" @@ -6,6 +6,9 @@ namespace WIDESEA_External.Model { + /// <summary> + /// 璐ㄦ鍗曞洖浼燛RP + /// </summary> public class ERPCheckModel { /// <summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPInboundModel.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPInboundModel.cs" index 1acd7db..bc5abf7 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPInboundModel.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPInboundModel.cs" @@ -6,6 +6,9 @@ namespace WIDESEA_External.Model { + /// <summary> + /// 鍏ュ簱鍗曞洖浼燛RP + /// </summary> public class ERPInboundModel { /// <summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPIssueModel.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPIssueModel.cs" new file mode 100644 index 0000000..259daf2 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPIssueModel.cs" @@ -0,0 +1,127 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WIDESEA_External.Model +{ + /// <summary> + /// 棰嗘枡鍑哄簱閫氱煡鍗曞洖浼燛RP + /// </summary> + public class ERPIssueModel + { + /// <summary> + /// 涓婚敭 + /// </summary> + public string UniqueTag { get; set; } + + /// <summary> + /// 鍙戞枡鍗曞彿 + /// </summary> + public string Code { get; set; } + + /// <summary> + /// 浠撳簱浠g爜 + /// </summary> + public string WarehouseCode { get; set; } + + /// <summary> + /// 閮ㄩ棬浠g爜 + /// </summary> + public string DetNo { get; set; } + + /// <summary> + /// 閮ㄩ棬鍚嶇О + /// </summary> + public string DetName { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + public string DecRemark { get; set; } + + /// <summary> + /// 鏃ユ湡 + /// </summary> + public string CreateTime { get; set; } + + /// <summary> + /// 浜哄憳 + /// </summary> + public string CreateUser { get; set; } + + /// <summary> + /// 鐮斿彂 + /// </summary> + public int IsDev { get; set; } + + /// <summary> + /// 璇︽儏 + /// </summary> + public List<ERPIssueItemModel> IssItem { get; set; } + } + + /// <summary> + /// 棰嗘枡鍑哄簱閫氱煡鍗曡鎯� + /// </summary> + public class ERPIssueItemModel + { + /// <summary> + /// 棰嗘枡鍗曞彿 + /// </summary> + public string PickCode { get; set; } + + /// <summary> + /// 鍙戞斁璇︽儏 + /// </summary> + public List<ERPPickModel> PickItem { get; set; } + } + + /// <summary> + /// 鍙戞斁璇︽儏 + /// </summary> + public class ERPPickModel + { + /// <summary> + /// 鍙戞枡鏄庣粏琛屽彿 + /// </summary> + public int RowIndex { get; set; } + + /// <summary> + /// 鐗╂枡缂栫爜 + /// </summary> + public string Material { get; set; } + + /// <summary> + /// 鏁伴噺 + /// </summary> + public string Qty { get; set; } + + /// <summary> + /// 搴撳瓨璇︽儏 + /// </summary> + public List<ERPPickItemModel> DataItem { get; set; } + } + + /// <summary> + /// 搴撳瓨璇︽儏 + /// </summary> + public class ERPPickItemModel + { + /// <summary> + /// 鎵规鍙� + /// </summary> + public string LotNo { get; set; } + + /// <summary> + /// 鏁伴噺 + /// </summary> + public string Qty { get; set; } + + /// <summary> + /// 鍌ㄤ綅 浠撳簱缂栧彿 + /// </summary> + public string Location { get; set; } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPReceiveModel.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPReceiveModel.cs" index 2da8833..fcba4e3 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPReceiveModel.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPReceiveModel.cs" @@ -6,6 +6,9 @@ namespace WIDESEA_External.Model { + /// <summary> + /// 鏀惰揣鍗曞洖浼燛RP + /// </summary> public class ERPReceiveModel { /// <summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderDetailService.cs" index 5a8c324..389c745 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderDetailService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderDetailService.cs" @@ -34,6 +34,13 @@ (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(Dt_OutboundOrderDetail outboundOrderDetail, List<StockSelectViewDTO> stockSelectViews); /// <summary> + /// 鍒嗛厤搴撳瓨鍑哄簱閫昏緫 + /// </summary> + /// <param name="outboundOrderDetails"></param> + /// <returns></returns> + (List<Dt_StockInfo>, List<Dt_OutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(List<Dt_OutboundOrderDetail> outboundOrderDetails); + + /// <summary> /// 閿佸畾鍑哄簱搴撳瓨 /// </summary> /// <param name="orderDetailId">鍑哄簱鍗曟槑缁咺d</param> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" index 26e345a..f44093e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" @@ -149,7 +149,7 @@ } /// <summary> - /// + /// 鍗曚釜鍑哄簱鍗曟槑缁嗗簱瀛樺垎閰� /// </summary> /// <param name="outboundOrderDetail"></param> /// <param name="stockSelectViews"></param> @@ -206,6 +206,75 @@ } /// <summary> + /// + /// </summary> + /// <param name="outboundOrderDetails"></param> + /// <returns></returns> + public (List<Dt_StockInfo>, List<Dt_OutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(List<Dt_OutboundOrderDetail> outboundOrderDetails) + { + if (!outboundOrderDetails.Any()) + { + throw new Exception($"鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅"); + } + + if (outboundOrderDetails.GroupBy(x => x.OrderId).Count() > 1) + { + throw new Exception($"璇峰嬁鍚屾椂鎿嶄綔澶氫釜鍗曟嵁鏄庣粏"); + } + Dt_OutboundOrder outboundOrder = _outboundRepository.OutboundOrderRepository.QueryFirst(x => x.Id == outboundOrderDetails.FirstOrDefault().OrderId); + List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>(); + List<Dt_OutboundOrderDetail> groupDetails = outboundOrderDetails.GroupBy(x => new { x.MaterielCode, x.BatchNo }).Select(x => new Dt_OutboundOrderDetail { OrderQuantity = x.Sum(v => v.OrderQuantity) - x.Sum(v => v.LockQuantity), MaterielCode = x.Key.MaterielCode, BatchNo = x.Key.BatchNo, }).ToList(); + + List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); + List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); + foreach (var item in groupDetails) + { + float originalNeedQuantity = item.OrderQuantity; + + float needQuantity = originalNeedQuantity; + + List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterielCode, item.BatchNo, outboundOrder.WarehouseId); + List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, item.MaterielCode, needQuantity, out float residueQuantity); + item.LockQuantity += needQuantity - residueQuantity; + outStocks.AddRange(autoAssignStocks); + float assignQuantity = needQuantity - residueQuantity; + //for (int i = 0; i < outboundOrderDetails.Count; i++) + //{ + // for (int j = 0; j < outStocks.Count; j++) + // { + // if(assignQuantity > 0) + // { + // if (outboundOrderDetails[i].OrderQuantity - outboundOrderDetails[i].LockQuantity >= outStocks[j].) + // { + + // } + // } + // } + + // if (assignQuantity > 0 && outboundOrderDetails[i].LockQuantity < outboundOrderDetails[i].OrderQuantity) + // { + // outStockLockInfos.AddRange(_outStockLockInfoService.GetOutStockLockInfos(outboundOrder, outboundOrderDetails[i], outStocks)); + // if (outboundOrderDetails[i].OrderQuantity - outboundOrderDetails[i].LockQuantity >= assignQuantity) + // { + // outboundOrderDetails[i].LockQuantity += assignQuantity; + // break; + // } + // else + // { + // assignQuantity -= (outboundOrderDetails[i].OrderQuantity - outboundOrderDetails[i].LockQuantity); + // outboundOrderDetails[i].LockQuantity = outboundOrderDetails[i].OrderQuantity; + // } + // } + //} + locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList())); + } + + + + return (outStocks, outboundOrderDetails, outStockLockInfos, locationInfos); + } + + /// <summary> /// 閿佸畾搴撳瓨锛岀敱浜哄伐鎸囧畾锛屾垨鍔犱笂绯荤粺鍒嗛厤(鍖呭惈閫昏緫杩愮畻锛屼笖淇敼鏁版嵁搴撴暟鎹�) /// </summary> /// <param name="orderDetailId"></param> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs" index 26ac858..ceab71b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs" @@ -18,6 +18,7 @@ using WIDESEA_DTO.ERP; using WIDESEA_DTO.Inbound; using WIDESEA_DTO.Outbound; +using WIDESEA_External.Model; using WIDESEA_IBasicService; using WIDESEA_IOutboundRepository; using WIDESEA_IOutboundService; @@ -189,30 +190,10 @@ } } - public WebResponseContent ReleaseOutOrder(int id) - { - try - { - Dt_OutboundOrder outboundOrder = Db.Queryable<Dt_OutboundOrder>().Where(x => x.Id == id).Includes(x => x.Details).First(); - if (outboundOrder == null) - { - return WebResponseContent.Instance.Error($"鏈壘鍒拌鍑哄簱鍗�"); - } - if(outboundOrder.Details == null || outboundOrder.Details.Count == 0) - { - return WebResponseContent.Instance.Error($"鏈壘鍒版槑缁嗕俊鎭�"); - } - foreach (var item in outboundOrder.Details) - { - } - - return WebResponseContent.Instance.OK(); - } - catch (Exception ex) - { - return WebResponseContent.Instance.Error(ex.Message); - } - } + //public WebResponseContent FeedbackOutbondIssue(List<Dt_OutStockLockInfo> outStockLockInfos) + //{ + // ERPPickItemModel + //} } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/WIDESEA_OutboundService.csproj" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/WIDESEA_OutboundService.csproj" index b11d170..0bdf0b1 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/WIDESEA_OutboundService.csproj" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/WIDESEA_OutboundService.csproj" @@ -7,6 +7,7 @@ </PropertyGroup> <ItemGroup> + <ProjectReference Include="..\WIDESEA_External\WIDESEA_External.csproj" /> <ProjectReference Include="..\WIDESEA_IBasicService\WIDESEA_IBasicService.csproj" /> <ProjectReference Include="..\WIDESEA_IOutboundService\WIDESEA_IOutboundService.csproj" /> <ProjectReference Include="..\WIDESEA_IRecordService\WIDESEA_IRecordService.csproj" /> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs" index de0c465..67d7666 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/StockInfoRepository.cs" @@ -67,7 +67,14 @@ public List<Dt_StockInfo> GetStockInfos(string materielCode, string lotNo, List<string> locationCodes) { - return Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode)).Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode && v.BatchNo == lotNo)).ToList(); + if (!string.IsNullOrEmpty(lotNo)) + { + return Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode)).Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode && v.BatchNo == lotNo)).ToList(); + } + else + { + return Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode)).Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)).ToList(); + } //ISugarQueryable<Dt_LocationInfo> sugarQueryable = Db.Queryable<Dt_LocationInfo>().Where(x => locationCodes.Contains(x.LocationCode)); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs" index de66c45..13e2579 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs" @@ -119,6 +119,15 @@ return null; } } + + /// <summary> + /// + /// </summary> + /// <param name="stockInfos"></param> + /// <param name="materielCode"></param> + /// <param name="needQuantity"></param> + /// <param name="residueQuantity"></param> + /// <returns></returns> public List<Dt_StockInfo> GetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode, float needQuantity, out float residueQuantity) { List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>(); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" index 311d139..6a05e7a 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" @@ -22,6 +22,7 @@ using System.Threading.Tasks; using WIDESEA_Common.CommonEnum; using WIDESEA_Common.LocationEnum; +using WIDESEA_Common.OrderEnum; using WIDESEA_Common.StockEnum; using WIDESEA_Common.TaskEnum; using WIDESEA_Core; @@ -103,114 +104,6 @@ } /// <summary> - /// 鐢宠鍏ュ簱浠诲姟(PDA浣跨敤锛屼粎鎵樼洏缁戝畾鍏ュ簱绔欏彴锛屼笉鍒嗛厤璐т綅) - /// </summary> - /// <param name="palletCode">鎵樼洏鍙�</param> - /// <param name="stationCode">绔欏彴鍙�</param> - /// <returns></returns> - public WebResponseContent RequestInboundTask(string palletCode, string stationCode) - { - try - { - Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode); - if (task != null) - { - return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡鐢熸垚浠诲姟"); - } - - if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskInStatusEnum.InNew.ObjToInt()) != null) - { - return WebResponseContent.Instance.Error($"璇ョ珯鐐瑰凡鏈夋湭鎵ц鐨勪换鍔�"); - } - - Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); - if (stockInfo == null) - { - return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�"); - } - if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt()) - { - return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱"); - } - if (!string.IsNullOrEmpty(stockInfo.LocationCode)) - { - return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡缁戝畾璐т綅"); - } - - Dt_Task newTask = new Dt_Task() - { - CurrentAddress = stationCode, - Grade = 0, - NextAddress = "", - PalletCode = palletCode, - Roadway = "", - SourceAddress = stationCode, - TargetAddress = "", - TaskType = TaskInboundTypeEnum.Inbound.ObjToInt(), - TaskStatus = TaskInStatusEnum.SC_InExecute.ObjToInt(), - }; - - stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); - - _unitOfWorkManage.BeginTran(); - int taskId = BaseDal.AddData(newTask); - newTask.TaskId = taskId; - _stockRepository.StockInfoRepository.UpdateData(stockInfo); - _unitOfWorkManage.CommitTran(); - - return WebResponseContent.Instance.OK(data: newTask); - } - catch (Exception ex) - { - _unitOfWorkManage.RollbackTran(); - return WebResponseContent.Instance.Error(ex.Message); - } - } - - /// <summary> - /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅 - /// </summary> - /// <param name="taskNum">浠诲姟鍙�</param> - /// <param name="roadwayNo">宸烽亾鍙�</param> - /// <param name="palletType">鎵樼洏绫诲瀷</param> - /// <returns></returns> - public WebResponseContent AssignInboundTaskLocation(int taskNum, string roadwayNo) - { - try - { - Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); - if (task == null) - { - return WebResponseContent.Instance.Error($"鏈壘鍒拌鍏ュ簱浠诲姟"); - } - - Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(roadwayNo, (PalletTypeEnum)task.PalletType, task.WarehouseId); - if (locationInfo == null) - { - return WebResponseContent.Instance.Error($"璐т綅鍒嗛厤澶辫触,鏈壘鍒板彲鍒嗛厤璐т綅"); - } - - task.Roadway = roadwayNo; - task.TargetAddress = locationInfo.LocationCode; - task.TaskStatus = TaskInStatusEnum.SC_InExecute.ObjToInt(); - - LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; - - _unitOfWorkManage.BeginTran(); - _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.InboundAssignLocation); - _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)task.PalletType, LocationStatusEnum.Lock, task.WarehouseId); - BaseDal.UpdateData(task); - _unitOfWorkManage.CommitTran(); - return WebResponseContent.Instance.OK(); - } - catch (Exception ex) - { - _unitOfWorkManage.RollbackTran(); - return WebResponseContent.Instance.Error(ex.Message); - } - } - - /// <summary> /// 鍏ュ簱浠诲姟瀹屾垚 /// </summary> /// <param name="taskNum">浠诲姟鍙�</param> @@ -279,6 +172,7 @@ _stockRepository.StockInfoRepository.UpdateData(stockInfo); _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.InboundCompleted); + _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, stockInfo.Details.Sum(x => x.StockQuantity), stockInfo.Details.Sum(x => x.StockQuantity), StockChangeTypeEnum.Inbound, taskNum); _unitOfWorkManage.CommitTran(); return WebResponseContent.Instance.OK(); } @@ -316,24 +210,30 @@ return WebResponseContent.Instance.Error($"鏈壘鍒拌揣浣嶄俊鎭�"); } - Dt_OutStockLockInfo outStockLockInfo = _outboundService.OutboundStockLockInfoService.Repository.QueryFirst(x => x.TaskNum == taskNum); - if (outStockLockInfo == null) + List<Dt_OutStockLockInfo> outStockLockInfos = _outboundService.OutboundStockLockInfoService.Repository.QueryData(x => x.TaskNum == taskNum); + if (outStockLockInfos == null || outStockLockInfos.Count == 0) { return WebResponseContent.Instance.Error($"鏈壘鍒板嚭搴撹鎯呬俊鎭�"); } - //todo 鏇存柊鍗曟嵁淇℃伅 - Dt_OutboundOrder outboundOrder = Db.Queryable<Dt_OutboundOrder>().Where(x => x.OrderNo == outStockLockInfo.OrderNo).Includes(x => x.Details).First(); - if (outboundOrder == null) + List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>(); + for (int i = 0; i < outStockLockInfos.Count; i++) { - return WebResponseContent.Instance.Error($"鏈壘鍒板嚭搴撳崟淇℃伅"); - } - if (!outboundOrder.Details.Any()) - { - return WebResponseContent.Instance.Error($"鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅"); + Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == outStockLockInfos[i].OrderDetailId); + if (outboundOrderDetail != null) + { + outboundOrderDetail.OverOutQuantity = outboundOrderDetail.LockQuantity; + if (outboundOrderDetail.LockQuantity == outboundOrderDetail.OrderQuantity) + { + outboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); + } + outboundOrderDetails.Add(outboundOrderDetail); + } } _unitOfWorkManage.BeginTran(); + _outboundService.OutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails); + stockInfo.LocationCode = locationInfo.LocationCode; stockInfo.StockStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt(); _stockService.StockInfoService.Repository.UpdateData(stockInfo); @@ -354,5 +254,6 @@ return WebResponseContent.Instance.Error(ex.Message); } } + } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" new file mode 100644 index 0000000..42c290b --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" @@ -0,0 +1,125 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WIDESEA_Common.CommonEnum; +using WIDESEA_Common.LocationEnum; +using WIDESEA_Common.StockEnum; +using WIDESEA_Common.TaskEnum; +using WIDESEA_Core; +using WIDESEA_Core.Helper; +using WIDESEA_Model.Models; + +namespace WIDESEA_TaskInfoService +{ + public partial class TaskService + { + /// <summary> + /// 鐢宠鍏ュ簱浠诲姟(PDA浣跨敤锛屼粎鎵樼洏缁戝畾鍏ュ簱绔欏彴锛屼笉鍒嗛厤璐т綅) + /// </summary> + /// <param name="palletCode">鎵樼洏鍙�</param> + /// <param name="stationCode">绔欏彴鍙�</param> + /// <returns></returns> + public WebResponseContent RequestInboundTask(string palletCode, string stationCode) + { + try + { + Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode); + if (task != null) + { + return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡鐢熸垚浠诲姟"); + } + + if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskInStatusEnum.InNew.ObjToInt()) != null) + { + return WebResponseContent.Instance.Error($"璇ョ珯鐐瑰凡鏈夋湭鎵ц鐨勪换鍔�"); + } + + Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); + if (stockInfo == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�"); + } + if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt()) + { + return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱"); + } + if (!string.IsNullOrEmpty(stockInfo.LocationCode)) + { + return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡缁戝畾璐т綅"); + } + + Dt_Task newTask = new Dt_Task() + { + CurrentAddress = stationCode, + Grade = 0, + NextAddress = "", + PalletCode = palletCode, + Roadway = "", + SourceAddress = stationCode, + TargetAddress = "", + TaskType = TaskInboundTypeEnum.Inbound.ObjToInt(), + TaskStatus = TaskInStatusEnum.InNew.ObjToInt(), + }; + + stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); + + _unitOfWorkManage.BeginTran(); + int taskId = BaseDal.AddData(newTask); + newTask.TaskId = taskId; + _stockRepository.StockInfoRepository.UpdateData(stockInfo); + _unitOfWorkManage.CommitTran(); + + return WebResponseContent.Instance.OK(data: newTask); + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + return WebResponseContent.Instance.Error(ex.Message); + } + } + + /// <summary> + /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅 + /// </summary> + /// <param name="taskNum">浠诲姟鍙�</param> + /// <param name="roadwayNo">宸烽亾鍙�</param> + /// <returns></returns> + public WebResponseContent AssignInboundTaskLocation(int taskNum, string roadwayNo) + { + try + { + Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); + if (task == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒拌鍏ュ簱浠诲姟"); + } + + Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(roadwayNo, (PalletTypeEnum)task.PalletType, task.WarehouseId); + if (locationInfo == null) + { + return WebResponseContent.Instance.Error($"璐т綅鍒嗛厤澶辫触,鏈壘鍒板彲鍒嗛厤璐т綅"); + } + + task.Roadway = roadwayNo; + task.TargetAddress = locationInfo.LocationCode; + task.TaskStatus = TaskInStatusEnum.SC_InExecute.ObjToInt(); + + LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; + + _unitOfWorkManage.BeginTran(); + _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.InboundAssignLocation); + _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)task.PalletType, LocationStatusEnum.Lock, task.WarehouseId); + BaseDal.UpdateData(task); + _unitOfWorkManage.CommitTran(); + return WebResponseContent.Instance.OK(data: locationInfo.LocationCode); + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + return WebResponseContent.Instance.Error(ex.Message); + } + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs" index e26a402..9e6af5c 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs" @@ -34,22 +34,25 @@ if (stockInfo != null) { Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); - Dt_Task task = new() + if (!tasks.Exists(x => x.PalletCode == stockInfo.PalletCode)) { - CurrentAddress = stockInfo.LocationCode, - Grade = 0, - PalletCode = stockInfo.PalletCode, - NextAddress = "", - Roadway = locationInfo.RoadwayNo, - SourceAddress = stockInfo.LocationCode, - TargetAddress = "", - TaskStatus = TaskOutStatusEnum.OutNew.ObjToInt(), - TaskType = TaskOutboundTypeEnum.Outbound.ObjToInt(), - TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), - PalletType = stockInfo.PalletType, - WarehouseId = stockInfo.WarehouseId, - }; - tasks.Add(task); + Dt_Task task = new() + { + CurrentAddress = stockInfo.LocationCode, + Grade = 0, + PalletCode = stockInfo.PalletCode, + NextAddress = "", + Roadway = locationInfo.RoadwayNo, + SourceAddress = stockInfo.LocationCode, + TargetAddress = "", + TaskStatus = TaskOutStatusEnum.OutNew.ObjToInt(), + TaskType = TaskOutboundTypeEnum.Outbound.ObjToInt(), + TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), + PalletType = stockInfo.PalletType, + WarehouseId = stockInfo.WarehouseId, + }; + tasks.Add(task); + } } } return tasks; @@ -113,6 +116,65 @@ } return (tasks, stockInfos, orderDetail == null ? null : new List<Dt_OutboundOrderDetail> { orderDetail }, outStockLockInfos, locationInfos); + } + + /// <summary> + /// 鍑哄簱浠诲姟鏁版嵁澶勭悊 + /// </summary> + /// <param name="orderDetailId"></param> + /// <param name="stockSelectViews"></param> + /// <returns></returns> + /// <exception cref="Exception"></exception> + public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutboundTaskDataHandle(int[] keys) + { + List<Dt_Task> tasks = new List<Dt_Task>(); + List<Dt_OutboundOrderDetail> outboundOrderDetails = _outboundService.OutboundOrderDetailService.Repository.QueryData(x => keys.Contains(x.Id)); + + if (outboundOrderDetails == null || outboundOrderDetails.Count == 0) + { + throw new Exception("鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅"); + } + + List<Dt_StockInfo>? stockInfos = null; + List<Dt_OutboundOrderDetail>? orderDetails = null; + List<Dt_OutStockLockInfo>? outStockLockInfos = null; + List<Dt_LocationInfo>? locationInfos = null; + //if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) + { + (List<Dt_StockInfo>, List<Dt_OutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrderDetails); + if (result.Item1 != null && result.Item1.Count > 0) + { + tasks = GetTasks(result.Item1); + result.Item2.ForEach(x => + { + x.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); + }); + result.Item3.ForEach(x => + { + x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt(); + }); + + stockInfos = result.Item1; + orderDetails = result.Item2; + outStockLockInfos = result.Item3; + locationInfos = result.Item4; + } + else + { + throw new Exception("鏃犲簱瀛�"); + } + } + //else + //{ + // List<Dt_OutStockLockInfo> stockLockInfos = _outboundService.OutboundStockLockInfoService.GetByOrderDetailId(outboundOrderDetail.OrderId, OutLockStockStatusEnum.宸插垎閰�); + // if (stockLockInfos != null && stockLockInfos.Count > 0) + // { + // List<Dt_StockInfo> stocks = _stockService.StockInfoService.Repository.GetStockInfosByPalletCodes(stockLockInfos.Select(x => x.PalletCode).Distinct().ToList()); + // tasks = GetTasks(stocks); + // } + //} + + return (tasks, stockInfos, orderDetails, outStockLockInfos, locationInfos); } /// <summary> @@ -190,7 +252,7 @@ /// <summary> /// 鐢熸垚鍑哄簱浠诲姟 /// </summary> - /// <param name="keys"></param> + /// <param name="keys">鍑哄簱鍗曟槑缁嗕富閿�</param> /// <returns></returns> public WebResponseContent GenerateOutboundTask(int[] keys) { @@ -202,29 +264,27 @@ List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>(); List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); - foreach (int key in keys) + + (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(keys); + if (result.Item2 != null && result.Item2.Count > 0) { - (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(key, stockSelectViews); - if (result.Item2 != null && result.Item2.Count > 0) - { - stockInfos.AddRange(result.Item2); - } - if (result.Item3 != null && result.Item3.Count > 0) - { - outboundOrderDetails.AddRange(result.Item3); - } - if (result.Item4 != null && result.Item4.Count > 0) - { - outStockLockInfos.AddRange(result.Item4); - } - if (result.Item5 != null && result.Item5.Count > 0) - { - locationInfos.AddRange(result.Item5); - } - if (result.Item1 != null && result.Item1.Count > 0) - { - tasks.AddRange(result.Item1); - } + stockInfos.AddRange(result.Item2); + } + if (result.Item3 != null && result.Item3.Count > 0) + { + outboundOrderDetails.AddRange(result.Item3); + } + if (result.Item4 != null && result.Item4.Count > 0) + { + outStockLockInfos.AddRange(result.Item4); + } + if (result.Item5 != null && result.Item5.Count > 0) + { + locationInfos.AddRange(result.Item5); + } + if (result.Item1 != null && result.Item1.Count > 0) + { + tasks.AddRange(result.Item1); } WebResponseContent content = GenerateOutboundTaskDataUpdate(tasks, stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos); @@ -236,5 +296,25 @@ return WebResponseContent.Instance.Error(ex.Message); } } + + /// <summary> + /// 鐢熸垚鍑哄簱浠诲姟 + /// </summary> + /// <param name="outboundId">鍑哄簱鍗曚富閿�</param> + /// <returns></returns> + public WebResponseContent GenerateOutboundTaskByHeadId(int outboundId) + { + try + { + List<int> keys = _outboundService.OutboundOrderDetailService.Repository.QueryData(x => x.Id, x => x.OrderId == outboundId); + + return GenerateOutboundTask(keys.ToArray()); + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + return WebResponseContent.Instance.Error(ex.Message); + } + } } } \ No newline at end of file diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" index c82f6bb..30aaf39 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" @@ -45,7 +45,6 @@ /// </summary> /// <param name="taskNum">浠诲姟鍙�</param> /// <param name="roadwayNo">宸烽亾鍙�</param> - /// <param name="palletType">鎵樼洏绫诲瀷</param> /// <returns></returns> [HttpPost, HttpGet, Route("AssignInboundTaskLocation"), AllowAnonymous] public WebResponseContent AssignInboundTaskLocation(int taskNum, string roadwayNo) diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\346\216\245\345\217\243\346\226\207\346\241\243/MES\344\270\232\345\212\241\346\265\201\347\250\213\345\233\276V1.0.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\346\216\245\345\217\243\346\226\207\346\241\243/MES\344\270\232\345\212\241\346\265\201\347\250\213\345\233\276V1.0.xlsx" index 59f5196..164de36 100644 --- "a/\351\241\271\347\233\256\350\265\204\346\226\231/\346\216\245\345\217\243\346\226\207\346\241\243/MES\344\270\232\345\212\241\346\265\201\347\250\213\345\233\276V1.0.xlsx" +++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\346\216\245\345\217\243\346\226\207\346\241\243/MES\344\270\232\345\212\241\346\265\201\347\250\213\345\233\276V1.0.xlsx" Binary files differ -- Gitblit v1.9.3