From 28f9a99446b7c84d1de4e3ba7a083aced0cc337d Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期四, 17 七月 2025 16:21:18 +0800 Subject: [PATCH] 更新 --- 项目代码/WCS/WCSServices/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs | 5 项目代码/WCS/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs | 32 +++ 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/StackerCraneJob_CP.cs | 40 +++- 项目资料/通信协议/龙利得机器人IO通讯表.xlsx | 0 项目资料/通信协议/成品RGV通讯协议.xlsx | 0 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/ConveyorLineJob_CPD.cs | 95 ++++++++++ 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/ConveyorLineJob_CPC.cs | 10 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs | 11 + 项目资料/通信协议/龙利得机器人IO通讯表20250712.xlsx | 0 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/ConveyorLineJob_CPA.cs | 39 ++++ 项目代码/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs | 134 +------------- 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/ConveyorLineJob_CPB.cs | 62 ++++++ 项目资料/项目图纸/纸业物流方案.dwg.lck | 0 项目资料/通信协议/龙利得软件计划表.xlsx | 0 /dev/null | 0 项目资料/通信协议/二楼环线20250715.xlsx | 0 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/RGVJob_CP.cs | 85 ++++++--- 项目资料/通信协议/成品输送线通讯协议_20250707.xlsx | 0 项目代码/WCS/WCSServices/WIDESEAWCS_Common/StationTypeEnum.cs | 12 - 项目资料/通信协议/龙利得设备通讯协议.xls | 0 项目代码/WCS/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 2 21 files changed, 329 insertions(+), 198 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Common/StationTypeEnum.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Common/StationTypeEnum.cs" index e80ef83..9abdd6a 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Common/StationTypeEnum.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Common/StationTypeEnum.cs" @@ -28,16 +28,8 @@ /// </summary> StationType_InStartAndOutEnd = 33, /// <summary> - /// 鎴愬搧鑷姩鍙栫珯鍙� + /// 鍙犵洏鍙枡绔欏彴 /// </summary> - StationType_ProductBackTake = 95, - /// <summary> - /// 鎴愬搧鑷姩琛ユ - /// </summary> - StationType_ProductBack = 98, - /// <summary> - /// 鐮佺洏鏈虹珯鍙� - /// </summary> - StationType_PakcPallet = 99, + StationType_StackingPlates = 91, } } diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" index 9e333cd..f893828 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" @@ -40,6 +40,11 @@ [Description("璋冩嫧鍑哄簱")] OutAllocate = 150, /// <summary> + /// 鍙犵洏鍑哄簱 + /// </summary> + [Description("鍙犵洏鍑哄簱")] + StackingPlates = 160, + /// <summary> /// MES鍑哄簱 /// </summary> [Description("MES鍑哄簱")] diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs" index 2921662..7ffad09 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs" @@ -72,7 +72,7 @@ /// <param name="palletCode">鎵樼洏鍙�</param> /// <param name="sourceAddress">璧峰鍦板潃</param> /// <returns></returns> - WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress); + WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress,int taskType = 630); /// <summary> /// 鍚慦MS鐢宠浠诲姟 diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" index 7e56cfb..2b8260b 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" @@ -2,8 +2,10 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; using WIDESEAWCS_Core.BaseController; +using WIDESEAWCS_Core.Helper; using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; @@ -83,6 +85,36 @@ { return Service.AgvCarrying(row, startColumn, endColumn, layer, targetLayer); } + /// <summary> + /// 娴嬭瘯鍫嗗灈鏈哄嚭搴� + /// </summary> + [HttpPost, HttpGet, Route("SCOUT"), AllowAnonymous] + public WebResponseContent SCCarrying(string sourceAddress, string roadWay, int taskType) + { + WMSTaskDTO taskDTO = new WMSTaskDTO() + { + Id = 1, + SourceAddress = sourceAddress, + TaskNum = DateTime.Now.ToString("mmss").ObjToInt(), + PalletCode= roadWay+ DateTime.Now.ToString("mmss"), + RoadWay = roadWay, + TaskType = taskType, + TaskStatus = TaskStatusEnum.New.ObjToInt(), + TargetAddress = "", + Grade = 0, + WarehouseId = 1, + PalletType = 1 + }; + return Service.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); + } + /// <summary> + /// 娴嬭瘯鍫嗗灈鏈哄叆搴� + /// </summary> + [HttpPost, HttpGet, Route("SCIN"), AllowAnonymous] + public WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress, int taskType = 0) + { + return Service.RequestWMSTaskSimple(palletCode,sourceAddress,taskType); + } //[HttpPost, HttpGet, Route("WebSocketPushMessage"), AllowAnonymous] //public WebResponseContent WebSocketPushMessage(string message) //{ diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" index 8b55db4..c3c168d 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" @@ -30,6 +30,7 @@ using System.Text; using System.Threading.Tasks; using WIDESEA_DTO.Agv; +using WIDESEAWCS_Common; using WIDESEAWCS_Common.APIEnum; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; @@ -215,28 +216,21 @@ if (string.IsNullOrEmpty(item.AGVArea)) { Dt_StationManger stationManger; + //鑾峰彇绔欏彴淇℃伅 if (taskTypeGroup == TaskTypeGroup.InboundGroup) { stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress || x.StationDeviceCode == item.SourceAddress); - //if (stationManger==null && task.TaskType==TaskTypeEnum.InProduct.ObjToInt()) - //{ - // stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode==task.SourceAddress); - // //杞崲鎴愬搧浠撹捣鐐圭珯鍙� - // item.SourceAddress = stationManger.StationCode; - // task.CurrentAddress = stationManger.StationCode; - // task.SourceAddress = stationManger.StationCode; - //} } else { - stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode == item.RoadWay || x.Remark==item.RoadWay); + stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode == item.RoadWay && x.StationType==StationTypeEnum.StationType_OnlyOutbound.ObjToInt()); } if (stationManger == null) { return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃俊鎭�"); } - - List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (item.SourceAddress == x.StartPosi || item.RoadWay == x.StartPosi /*|| item.RoadWay == x.ChildPosiDeviceCode || item.RoadWay == x.ChildPosi*/)); + //鑾峰彇璺敱淇℃伅 + List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (item.SourceAddress == x.StartPosi || item.RoadWay == x.StartPosi)); router = routers.FirstOrDefault(); if (router == null) { @@ -251,122 +245,13 @@ task.NextAddress = router.NextPosi; task.DeviceCode = router.ChildPosiDeviceCode; } - else if (item.TaskType == TaskTypeEnum.MesMatReturn.ObjToInt() && !router.IsEnd) - { - task.NextAddress = router.NextPosi; - task.DeviceCode = router.ChildPosi; - } - else if ((item.TaskType == TaskTypeEnum.MesPalletLargeReturn.ObjToInt() || item.TaskType == TaskTypeEnum.MesPalletSmallReturn.ObjToInt()) && router.IsEnd) - { - task.NextAddress = router.NextPosi; - task.DeviceCode = router.ChildPosi; - } - else if (item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt() || item.TaskType == TaskTypeEnum.MesHandOutbound.ObjToInt() || item.TaskType == TaskTypeEnum.MesHandPickOutbound.ObjToInt() || (item.TaskType == TaskTypeEnum.OutAllocate.ObjToInt() && item.RoadWay.Contains("BC"))) - { - task.NextAddress = router.NextPosi; - task.DeviceCode = stationManger.StackerCraneCode; - if (item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt() && task.TargetAddress== "SCUTL-001") - { - task.TaskState = TaskStatusEnum.MesPending.ObjToInt(); - } - else - { - task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); - } - } - else if (item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt() && item.RoadWay.Contains("ZH")) - { - task.NextAddress = stationManger.StackerCraneStationCode; - task.DeviceCode = stationManger.StackerCraneCode; - task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); - } else { - task.NextAddress = taskTypeGroup == TaskTypeGroup.InboundGroup ? task.TargetAddress : router.NextPosi; - if (item.RoadWay.Contains("AGV_FL")|| (item.RoadWay.Contains("AGV_CP") && taskTypeGroup == TaskTypeGroup.OutbondGroup)) - { - task.DeviceCode = item.RoadWay; - task.AgvTaskNum = item.RoadWay + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; - } - else if(item.RoadWay.Contains("AGV_CP") && taskTypeGroup == TaskTypeGroup.InboundGroup) - { - task.DeviceCode = stationManger.StationDeviceCode; - task.AgvTaskNum = task.Roadway + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; - } - else - { - task.DeviceCode = stationManger.StationDeviceCode; - } - } - } - else - { - if (item.RoadWay=="AGV_CP") - { - Dt_Router routerSelect = _routerRepository.QueryFirst(x => x.InOutType == item.TaskType && item.RoadWay == x.StartPosi && x.NextPosi==item.TargetAddress); - if (routerSelect != null) - { - task.NextAddress = routerSelect.NextPosi; - task.DeviceCode = routerSelect.ChildPosi; - task.AgvTaskNum = item.RoadWay + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; - } - else - { - return content.Error("鏈壘鍒拌矾鐢变俊鎭�"); - } - } - else - { - List<Dt_Router> dt_Routers = _routerService.QueryNextRoutes(item.SourceAddress, item.RoadWay, item.TaskType); - if (dt_Routers != null && dt_Routers.Count > 0) - { - task.NextAddress = dt_Routers.FirstOrDefault().NextPosi; - task.DeviceCode = dt_Routers.FirstOrDefault().ChildPosi; - } - else - { - task.NextAddress = ""; - task.DeviceCode = ""; - } + task.DeviceCode = stationManger.StackerCraneCode; + task.NextAddress = router.NextPosi; } } } - else - { - if (taskTypeGroup == TaskTypeGroup.OutbondGroup) - { - task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; - List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.NextPosi); - if (routers.FirstOrDefault() == null) - { - return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢遍厤缃俊鎭�"); - } - router = routers.FirstOrDefault(); - task.NextAddress = router?.StartPosi ?? ""; - task.DeviceCode = item.RoadWay; - task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); - } - else - { - task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; - List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.StartPosi); - if (routers.FirstOrDefault() == null) - { - return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢遍厤缃俊鎭�"); - } - router = routers.FirstOrDefault(); - Dt_StationManger? stationManger = _stationMangerRepository.QueryData(x => true).FirstOrDefault(x=>x.StationCode== router?.NextPosi); - if (stationManger == null) - { - return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃俊鎭�"); - } - - task.NextAddress = stationManger?.AGVStationCode ?? ""; - task.DeviceCode = stationManger?.Remark ?? ""; - task.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt(); - } - } - tasks.Add(task); } BaseDal.AddData(tasks); @@ -436,7 +321,7 @@ /// <param name="palletCode"></param> /// <param name="sourceAddress"></param> /// <returns></returns> - public WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress) + public WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress, int taskType=630) { WebResponseContent content = new WebResponseContent(); try @@ -459,7 +344,8 @@ TaskNum = DateTime.Now.ToString("mmss").ObjToInt(), PalletCode="", RoadWay="", - TaskType=TaskTypeEnum.InProduct.ObjToInt(), + TaskType= taskType, + PalletType=1, TaskStatus=TaskStatusEnum.New.ObjToInt(), SourceAddress= sourceAddress, TargetAddress="", diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs" index 1dfe14b..184d0b1 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs" @@ -52,6 +52,17 @@ public short StatusPV { get; set; } /// <summary> /// 鍛戒护 + /// 0锛氭棤鍛戒护 + ///1锛氶潪灏辩华锛堜笉鎵ц涓嬪彂鍛戒护锛� + ///2锛氬彇璐х珯鍙板伐浣嶅氨缁紙鏈夋枡锛� + ///3锛氭斁璐х珯鍙板伐浣嶅氨缁紙鏃犳枡锛� + ///4锛氭斁璐х珯鍙板伐浣嶅氨缁紙鏈夋枡锛� + ///5锛氭壂鐮佸伐浣嶅氨缁紙宸叉壂鐮侊紝绛夊緟涓婁綅鏈轰笅鍙戜换鍔″強鍛戒护锛� + ///6锛氫换鍔″伐浣嶅氨缁紙涓婁綅鏈洪�氳繃浠诲姟鍙疯鍙栨墭鐩樹俊鎭苟涓嬪彂浠诲姟锛� + ///7锛氱敵璇锋枡妗� + ///8锛氭枡妗嗗埌浣� + ///9锛氭墽琛屽懡浠や腑 + ///11锛氬紓甯� /// </summary> public short Command { get; set; } /// <summary> diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPA.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPA.cs" index a541310..388a1e3 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPA.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPA.cs" @@ -10,6 +10,7 @@ using WIDESEAWCS_Common; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Communicator; +using WIDESEAWCS_Core; using WIDESEAWCS_IBasicInfoRepository; using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; @@ -74,13 +75,22 @@ if (deviceProRead != null) { R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); - if (conveyorLineInfoRead.Command == 2 && conveyorLineInfoRead.TaskNo > 0) + if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 2 && conveyorLineInfoRead.TaskNo > 0 && item.StationType== StationTypeEnum.StationType_OnlyInbound.ObjToInt()) //浜屾ゼ绾夸綋鍏ュ簱绔欏彴->鍫嗗灈鏈� { + //鑾峰彇鍏ュ簱绔欏彴鏄惁瀛樺湪鍏ュ簱浠诲姟 Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNo && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.DeviceCode == device.DeviceCode); if (task != null) { + string local = ""; //鍒嗛厤璐т綅 - string local = "SC01_CP-001-064-001-01"; + if (task.HeightType==1) + { + local = "SC02_CP-001-064-001-01"; + } + else if (task.HeightType == 2) + { + local = "SC02_CP-001-063-001-01"; + } task.CurrentAddress = item.StackerCraneStationCode; task.TargetAddress= local; task.NextAddress = local; @@ -96,6 +106,31 @@ } } + else if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo <= 0 && item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt()) //浜屾ゼ绾夸綋鍑哄簱绔欏彴 + { + //鑾峰彇鍑哄簱绔欏彴鏄惁瀛樺湪鍑哄簱寰呮墽琛屼换鍔� + Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType) + && x.TaskState ==TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode == device.DeviceCode); + if (task != null) + { + //鑾峰彇璺敱閰嶇疆 + List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && task.CurrentAddress == x.StartPosi); + Dt_Router router = routers.FirstOrDefault(); + if (router == null) + { + WriteError(item.StationName, $"浠诲姟鍙�:{task.TaskNum}鏈壘鍒拌矾鐢遍厤缃俊鎭�"); + return Task.CompletedTask; + } + //鍐欏叆鍑哄簱绾夸綋鍦板潃 + device.SetValue(W_ConveyorLineCPDB.W_TargetAddress, router.NextPosi, item.StationCode); + device.SetValue(W_ConveyorLineCPDB.W_TaskNo, task.TaskNum, item.StationCode); + device.SetValue(W_ConveyorLineCPDB.W_Command, 1, item.StationCode); + //鏇存柊璁惧 + task.DeviceCode = router.ChildPosiDeviceCode; + _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); + WriteError(item.StationName, $"浠诲姟鍙�:{task.TaskNum}杩涜绾夸綋鍑哄簱"); + } + } } else { diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPB.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPB.cs" index bba09d9..73c2e16 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPB.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPB.cs" @@ -11,6 +11,7 @@ using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Communicator; using WIDESEAWCS_Core; +using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_IBasicInfoRepository; using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; @@ -72,16 +73,16 @@ { DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); - if (item.StationType==StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && deviceProRead != null && deviceProWrite!=null) + if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && deviceProRead != null && deviceProWrite != null) { R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); - if (conveyorLineInfoRead.Command == 5 && conveyorLineInfoRead.TaskNo>0 && !string.IsNullOrEmpty(conveyorLineInfoRead.PalletCode)) + if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 5 && conveyorLineInfoRead.TaskNo > 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.PalletCode)) { - Dt_Task task = _taskRepository.QueryFirst(x =>x.TaskNum== conveyorLineInfoRead.TaskNo && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.DeviceCode==device.DeviceCode); + Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNo && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.DeviceCode == device.DeviceCode); if (task != null) { //鍒嗛厤宸烽亾 瀛樺叆鎵樼洏鏁版嵁 - List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, "SC01_CP", task.TaskType); + List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, "SC02_CP", task.TaskType); Dt_Router? router = routers.FirstOrDefault(); if (routers == null || routers.Count == 0 || router == null) { @@ -93,15 +94,15 @@ WriteError(item.StationName, $"璺敱淇℃伅閰嶇疆閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); continue; } - + device.SetValue(W_ConveyorLineCPDB.W_TargetAddress, router.NextPosi, item.StationCode); device.SetValue(W_ConveyorLineCPDB.W_TaskNo, task.TaskNum, item.StationCode); device.SetValue(W_ConveyorLineCPDB.W_Command, 1, item.StationCode); task.CurrentAddress = item.StationCode; - task.NextAddress=router.NextPosi; + task.NextAddress = router.NextPosi; task.PalletType = 1; task.PalletCode = conveyorLineInfoRead.PalletCode; - task.Roadway = "SC01_CP"; + task.Roadway = "SC02_CP"; task.DeviceCode = router.ChildPosiDeviceCode; _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); WriteError(item.StationName, $"浠诲姟鍙穥conveyorLineInfoRead.TaskNo}涓嬩竴姝�"); @@ -118,7 +119,7 @@ else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && deviceProRead != null) { R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); - if (conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo > 0) + if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo > 0) { Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNo && x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode == device.DeviceCode); if (task != null) @@ -149,6 +150,51 @@ } } } + else if (item.StationType == StationTypeEnum.StationType_StackingPlates.ObjToInt() && deviceProRead != null && deviceProWrite != null) + { + R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); + if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 7 && conveyorLineInfoRead.TaskNo <= 0) + { + Dt_Task task = _taskRepository.QueryFirst(x => x.TargetAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType)); + if (task == null) + { + //璇锋眰浠诲姟 + WMSTaskDTO taskDTO = new WMSTaskDTO() + { + Id = 1, + SourceAddress = "SC02_CP-001-064-001-01", + TaskNum = DateTime.Now.ToString("mmss").ObjToInt(), + PalletCode = "" + DateTime.Now.ToString("mmss"), + RoadWay = "SC02_CP", + TaskType = 160, + TaskStatus = TaskStatusEnum.New.ObjToInt(), + TargetAddress = item.StationCode, + Grade = 0, + WarehouseId = 1, + PalletType = 1 + }; + WriteError(item.StationName, $"浠诲姟鍙穥conveyorLineInfoRead.TaskNo}鐢熸垚锛屼笅涓�姝�"); + _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); + //string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, "AGV_CP"); + //if (string.IsNullOrEmpty(locationCode) && task.TaskType != TaskTypeEnum.EmptyProductBack.ObjToInt()) + //{ + // WriteError(item.StationName, $"璇锋眰鍒嗛厤璐т綅杩斿洖淇℃伅閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); + // continue; + //} + + } + } + else if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 8 && conveyorLineInfoRead.TaskNo > 0) + { + Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNo && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.DeviceCode == device.DeviceCode); + if (task != null) + { + //浠诲姟瀹屾垚 + device.SetValue(W_ConveyorLineCPDB.W_Command, 2, item.StationCode); + WriteError(item.StationName, $"浠诲姟鍙穥conveyorLineInfoRead.TaskNo}鍙犵洏浣嶅嚭搴撳畬鎴�"); + } + } + } else { WriteError(item.StationName, $"鏈壘鍒拌澶囧瓙缂栧彿{item.StationCode}鐨勫崗璁俊鎭�"); diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPC.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPC.cs" index b1cc6be..7614e7e 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPC.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPC.cs" @@ -75,19 +75,13 @@ if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && deviceProRead != null) { R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); - if (conveyorLineInfoRead.StatusPV == 2 && conveyorLineInfoRead.Command == 11) + if (conveyorLineInfoRead != null && conveyorLineInfoRead.StatusPV == 2 && conveyorLineInfoRead.Command == 11) { Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && (x.TaskState == TaskStatusEnum.RGV_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.RGV_Executing.ObjToInt() || x.TaskState == TaskStatusEnum.New.ObjToInt())); if (task == null) { - //鑾峰彇绔欏彴 + //鑾峰彇绔欏彴鐢熸垚浠诲姟 WebResponseContent content = _taskService.RequestWMSTaskSimple("", item.StationCode); - //string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, "AGV_CP"); - //if (string.IsNullOrEmpty(locationCode) && task.TaskType != TaskTypeEnum.EmptyProductBack.ObjToInt()) - //{ - // WriteError(item.StationName, $"璇锋眰鍒嗛厤璐т綅杩斿洖淇℃伅閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); - // continue; - //} if (content.Status) { Dt_Task taskNew = _taskRepository.QueryFirst(x => x.SourceAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && (x.TaskState == TaskStatusEnum.New.ObjToInt())); diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPD.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPD.cs" index 1328a57..775af1f 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPD.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPD.cs" @@ -65,12 +65,105 @@ if (flag && value != null) { OtherDevice device = (OtherDevice)value; - List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList(); + List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).Distinct().ToList(); List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode))) { DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); + if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && deviceProRead != null && deviceProWrite != null) + { + R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); + if (conveyorLineInfoRead!=null && conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo <= 0) + { + Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && x.DeviceCode == device.DeviceCode); + if (task != null) + { + //鍒嗛厤宸烽亾 瀛樺叆鎵樼洏鏁版嵁 + List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, "SC02_CP", task.TaskType); + Dt_Router? router = routers.FirstOrDefault(); + if (routers == null || routers.Count == 0 || router == null) + { + WriteError(item.StationName, $"鏈壘鍒板搴旇矾鐢变俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); + continue; + } + if (routers.Count > 1) + { + WriteError(item.StationName, $"璺敱淇℃伅閰嶇疆閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); + continue; + } + //鍐欏叆鍏ュ簱绾夸綋鍦板潃 + device.SetValue(W_ConveyorLineCPDB.W_TargetAddress, router.NextPosi, item.StationCode); + device.SetValue(W_ConveyorLineCPDB.W_TaskNo, task.TaskNum, item.StationCode); + device.SetValue(W_ConveyorLineCPDB.W_Command, 1, item.StationCode); + //鏇存柊浠诲姟淇℃伅 + task.CurrentAddress = item.StationCode; + task.NextAddress = router.NextPosi; + task.PalletType = 1; + task.PalletCode = conveyorLineInfoRead.PalletCode; + task.Roadway = "SC02_CP"; + _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); + WriteError(item.StationName, $"浠诲姟鍙穥conveyorLineInfoRead.TaskNo}涓嬩竴姝�"); + } + } + } + else if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt() && deviceProRead != null) + { + R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); + if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 2 && conveyorLineInfoRead.TaskNo > 0) + { + Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNo && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.DeviceCode == device.DeviceCode); + if (task != null) + { + //鍒嗛厤璐т綅 + string local = "SC02_CP-002-064-001-01"; + task.CurrentAddress = item.StackerCraneStationCode; + task.TargetAddress = local; + task.NextAddress = local; + task.DeviceCode = item.StackerCraneCode; + _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute); + WriteError(item.StationName, $"浠诲姟鍙�:{task.TaskNum}杩涜鍫嗗灈鏈哄叆搴�"); + //string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, "AGV_CP"); + //if (string.IsNullOrEmpty(locationCode) && task.TaskType != TaskTypeEnum.EmptyProductBack.ObjToInt()) + //{ + // WriteError(item.StationName, $"璇锋眰鍒嗛厤璐т綅杩斿洖淇℃伅閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); + // continue; + //} + + } + } + } + else if (item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt() && deviceProRead != null && deviceProWrite != null) + { + R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); + if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo <= 0) + { + //鑾峰彇鍑哄簱绔欏彴鏄惁瀛樺湪鍑哄簱寰呮墽琛屼换鍔� + Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType) + && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode == device.DeviceCode); + if (task != null) + { + //鑾峰彇璺敱閰嶇疆 + List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && task.CurrentAddress == x.StartPosi); + Dt_Router router = routers.FirstOrDefault(); + if (router == null) + { + WriteError(item.StationName, $"浠诲姟鍙�:{task.TaskNum}鏈壘鍒拌矾鐢遍厤缃俊鎭�"); + return Task.CompletedTask; + } + //鍐欏叆鍑哄簱绾夸綋鍦板潃 + device.SetValue(W_ConveyorLineCPDB.W_TargetAddress, router.NextPosi, item.StationCode); + device.SetValue(W_ConveyorLineCPDB.W_TaskNo, task.TaskNum, item.StationCode); + device.SetValue(W_ConveyorLineCPDB.W_Command, 1, item.StationCode); + _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); + WriteError(item.StationName, $"浠诲姟鍙�:{task.TaskNum}杩涜绾夸綋鍑哄簱"); + } + } + } + else + { + WriteError(item.StationName, $"鏈壘鍒拌澶囧瓙缂栧彿{item.StationCode}鐨勫崗璁俊鎭�"); + } } } return Task.CompletedTask; diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/RGVJob_CP.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/RGVJob_CP.cs" index d5ed193..d2a8ad1 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/RGVJob_CP.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/RGVJob_CP.cs" @@ -76,45 +76,68 @@ { R_RGVCPInfo rgvInfoRead = device.Communicator.ReadCustomer<R_RGVCPInfo>(deviceProRead.DeviceProAddress); W_RGVCPInfo rgvInfoWrite = device.Communicator.ReadCustomer<W_RGVCPInfo>(deviceProWrite.DeviceProAddress); - if (rgvInfoRead.Mode==5 && rgvInfoRead.State == 0 && rgvInfoRead.TaskDone==1) + if ((rgvInfoRead.Mode == 5 || rgvInfoRead.Mode == 4) && rgvInfoRead.State == 0 && rgvInfoRead.TaskDone==1) { List<Dt_Task> tasks = _taskRepository.QueryData(x => _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState != TaskStatusEnum.RGV_Execute.ObjToInt() && x.DeviceCode == device.DeviceCode); //鑾峰彇浠诲姟 - Dt_Task? task1 = tasks.FirstOrDefault(x => x.HeightType==1); + Dt_Task? task1 = tasks.FirstOrDefault(x => x.HeightType == 1); Dt_Task? task2 = tasks.FirstOrDefault(x => x.HeightType == 2); Dt_Task? task3 = tasks.FirstOrDefault(x => x.HeightType == 3); - Dt_Task task = _taskRepository.QueryFirst(x => _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.RGV_Execute.ObjToInt() && x.DeviceCode == device.DeviceCode); - if (task != null && task1 == null) + List<Dt_Task> tasksDown = _taskRepository.QueryData(x => _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.RGV_Execute.ObjToInt() && x.DeviceCode == device.DeviceCode).OrderBy(x=>x.CreateDate).Take(3).ToList(); + //鍒嗛厤RGV宸ヤ綅浠诲姟 + if (tasksDown.Count>=2) { - device.SetValue(W_RgvCPDB.WcsTask1, task.TaskNum); device.SetValue(W_RgvCPDB.TaskType, 4); - device.SetValue(W_RgvCPDB.WorkStation, 1); - device.SetValue(W_RgvCPDB.Qu1, task.CurrentAddress); - device.SetValue(W_RgvCPDB.Fang1, task.NextAddress); + //鍗犵敤涓や釜宸ヤ綅 + if (tasksDown.Count==2) + { + device.SetValue(W_RgvCPDB.WorkStation, 4); + if (task1 == null) + { + device.SetValue(W_RgvCPDB.WcsTask1, tasksDown[0].TaskNum); + device.SetValue(W_RgvCPDB.Qu1, tasksDown[0].CurrentAddress); + device.SetValue(W_RgvCPDB.Fang1, tasksDown[0].NextAddress); + tasksDown[0].HeightType = 1; + _taskService.UpdateTask(tasksDown[0], TaskStatusEnum.RGV_Executing); + } + if (task2 == null) + { + device.SetValue(W_RgvCPDB.WcsTask2, tasksDown[1].TaskNum); + device.SetValue(W_RgvCPDB.Qu2, tasksDown[1].CurrentAddress); + device.SetValue(W_RgvCPDB.Fang2, tasksDown[1].NextAddress); + tasksDown[1].HeightType = 2; + _taskService.UpdateTask(tasksDown[1], TaskStatusEnum.RGV_Executing); + } + } + else //鍗犵敤涓変釜宸ヤ綅 + { + device.SetValue(W_RgvCPDB.WorkStation, 7); + if ( task1 == null) + { + device.SetValue(W_RgvCPDB.WcsTask1, tasksDown[0].TaskNum); + device.SetValue(W_RgvCPDB.Qu1, tasksDown[0].CurrentAddress); + device.SetValue(W_RgvCPDB.Fang1, tasksDown[0].NextAddress); + tasksDown[0].HeightType = 1; + _taskService.UpdateTask(tasksDown[0], TaskStatusEnum.RGV_Executing); + } + if (task2 == null) + { + device.SetValue(W_RgvCPDB.WcsTask2, tasksDown[1].TaskNum); + device.SetValue(W_RgvCPDB.Qu2, tasksDown[1].CurrentAddress); + device.SetValue(W_RgvCPDB.Fang2, tasksDown[1].NextAddress); + tasksDown[1].HeightType = 2; + _taskService.UpdateTask(tasksDown[1], TaskStatusEnum.RGV_Executing); + } + if (task3 == null) + { + device.SetValue(W_RgvCPDB.WcsTask3, tasksDown[2].TaskNum); + device.SetValue(W_RgvCPDB.Qu3, tasksDown[2].CurrentAddress); + device.SetValue(W_RgvCPDB.Fang3, tasksDown[2].NextAddress); + tasksDown[2].HeightType = 3; + _taskService.UpdateTask(tasksDown[2], TaskStatusEnum.RGV_Executing); + } + } device.SetValue(W_RgvCPDB.TaskReceivedDone, 1); - task.HeightType = 1; - _taskService.UpdateTask(task, TaskStatusEnum.RGV_Executing); - }else if (task != null && task2 == null) - { - device.SetValue(W_RgvCPDB.WcsTask1, task.TaskNum); - device.SetValue(W_RgvCPDB.TaskType, 4); - device.SetValue(W_RgvCPDB.WorkStation, 1); - device.SetValue(W_RgvCPDB.Qu2, task.CurrentAddress); - device.SetValue(W_RgvCPDB.Fang2, task.NextAddress); - device.SetValue(W_RgvCPDB.TaskReceivedDone, 1); - task.HeightType = 2; - _taskService.UpdateTask(task, TaskStatusEnum.RGV_Executing); - } - else if (task != null && task3 == null) - { - device.SetValue(W_RgvCPDB.WcsTask1, task.TaskNum); - device.SetValue(W_RgvCPDB.TaskType, 4); - device.SetValue(W_RgvCPDB.WorkStation, 1); - device.SetValue(W_RgvCPDB.Qu3, task.CurrentAddress); - device.SetValue(W_RgvCPDB.Fang3, task.NextAddress); - device.SetValue(W_RgvCPDB.TaskReceivedDone, 1); - task.HeightType = 3; - _taskService.UpdateTask(task, TaskStatusEnum.RGV_Executing); } } else if((rgvInfoRead.Mode == 5 || rgvInfoRead.Mode == 4) && rgvInfoRead.TaskDone == 3) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/StackerCraneJob_CP.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/StackerCraneJob_CP.cs" index 067c53d..87c5655 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/StackerCraneJob_CP.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/StackerCraneJob_CP.cs" @@ -22,6 +22,7 @@ using WIDESEAWCS_Core; using SqlSugar.Extensions; using WIDESEAWCS_Tasks.ConveyorLineJob; +using WIDESEAWCS_QuartzJob.Repository; namespace WIDESEAWCS_Tasks { @@ -32,15 +33,17 @@ private readonly ITaskExecuteDetailService _taskExecuteDetailService; private readonly ITaskRepository _taskRepository; private readonly IRouterService _routerService; + private readonly IRouterRepository _routerRepository; private readonly IStationMangerRepository _stationMangerRepository; - public StackerCraneJob_CP(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository) + public StackerCraneJob_CP(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository,IRouterRepository routerRepository) { _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; _taskRepository = taskRepository; _routerService = routerService; _stationMangerRepository = stationMangerRepository; + _routerRepository = routerRepository; } public Task Execute(IJobExecutionContext context) @@ -114,21 +117,31 @@ { if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { - Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneStationCode == task.NextAddress); + Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneStationCode == task.NextAddress && x.StackerCraneCode==deviceCode); if (stationManger == null) { _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"杈撻�佺嚎鍑哄簱绔欑偣鏈厤缃�,{task.NextAddress}"); _taskService.UpdateTaskExceptionMessage(taskNum, $"杈撻�佺嚎鍑哄簱绔欑偣鏈厤缃�,{task.NextAddress}"); return WebResponseContent.Instance.Error($"杈撻�佺嚎鍑哄簱绔欑偣鏈厤缃�,{task.NextAddress}"); } - + Dt_Router router = _routerRepository.QueryFirst(x => x.InOutType == task.TaskType && x.StartPosi == stationManger.StationCode && x.ChildPosi == stationManger.StationDeviceCode); + if (router == null) + { + _taskService.UpdateTaskExceptionMessage(taskNum, $"鏈壘鍒拌矾鐢变俊鎭�,{task.NextAddress}"); + WriteError(deviceCode, $"鏈壘鍒拌矾鐢变俊鎭�,{task.NextAddress}"); + return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢变俊鎭�,{task.NextAddress}"); + } int oldStatus = task.TaskState; task.DeviceCode = stationManger.StationDeviceCode; task.TaskState = TaskStatusEnum.Line_Execute.ObjToInt(); task.CurrentAddress = stationManger.StationCode; + task.NextAddress = router.NextPosi; + task.TargetAddress = router.NextPosi; _taskRepository.UpdateData(task); + //todo 鍫嗗灈鏈哄畬鎴愬畬鎴� + //_taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: router.NextPosi, targetAddress: router.NextPosi); _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"绯荤粺鑷姩娴佺▼,浠诲姟鐘舵�佷粠銆恵oldStatus}銆戣浆鍒般�恵task.TaskState}銆�"); - //todo 瀹屾垚 + WriteInfo(deviceCode, $"鍫嗗灈鏈轰换鍔″畬鎴�,浠诲姟鍙�:{taskNum}"); } else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) { @@ -192,22 +205,23 @@ if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { - if (OutTaskStationIsOccupied(task) != null || true) + if (OutTaskStationIsOccupied(task) == null) { - return task; - } - else - { - List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress).Select(x => x.ChildPosi).ToList(); + bool flag = false; + List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress, task.TaskType).Select(x => x.ChildPosi).ToList(); List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode, otherOutStaionCodes); foreach (var item in tasks) { if (OutTaskStationIsOccupied(task) != null) { - return task; + flag = true; + break; } } - task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); + if (!flag) + { + task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); + } } } @@ -221,7 +235,7 @@ /// <returns>濡傛灉鏈鍗犵敤锛岃繑鍥炰紶鍏ョ殑浠诲姟淇℃伅锛屽惁鍒欙紝杩斿洖null</returns> private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) { - Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.DeviceCode); + Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress && x.StackerCraneCode == task.DeviceCode); if (stationManger != null) { IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\344\272\214\346\245\274\347\216\257\347\272\27720250715.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\344\272\214\346\245\274\347\216\257\347\272\27720250715.xlsx" new file mode 100644 index 0000000..ea4da57 --- /dev/null +++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\344\272\214\346\245\274\347\216\257\347\272\27720250715.xlsx" Binary files differ diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\346\210\220\345\223\201RGV\351\200\232\350\256\257\345\215\217\350\256\256.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\346\210\220\345\223\201RGV\351\200\232\350\256\257\345\215\217\350\256\256.xlsx" new file mode 100644 index 0000000..0393c68 --- /dev/null +++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\346\210\220\345\223\201RGV\351\200\232\350\256\257\345\215\217\350\256\256.xlsx" Binary files differ diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\350\276\223\351\200\201\347\272\277\344\270\216\344\270\212\344\275\215\346\234\272\344\272\244\344\272\222\345\215\217\350\256\256_20250707.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\346\210\220\345\223\201\350\276\223\351\200\201\347\272\277\351\200\232\350\256\257\345\215\217\350\256\256_20250707.xlsx" similarity index 97% rename from "\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\350\276\223\351\200\201\347\272\277\344\270\216\344\270\212\344\275\215\346\234\272\344\272\244\344\272\222\345\215\217\350\256\256_20250707.xlsx" rename to "\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\346\210\220\345\223\201\350\276\223\351\200\201\347\272\277\351\200\232\350\256\257\345\215\217\350\256\256_20250707.xlsx" index 7af063d..77dd887 100644 --- "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\350\276\223\351\200\201\347\272\277\344\270\216\344\270\212\344\275\215\346\234\272\344\272\244\344\272\222\345\215\217\350\256\256_20250707.xlsx" +++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\346\210\220\345\223\201\350\276\223\351\200\201\347\272\277\351\200\232\350\256\257\345\215\217\350\256\256_20250707.xlsx" Binary files differ diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\350\276\223\351\200\201\347\272\277\344\270\216\344\270\212\344\275\215\346\234\272\344\272\244\344\272\222\345\215\217\350\256\256_20250702.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\350\276\223\351\200\201\347\272\277\344\270\216\344\270\212\344\275\215\346\234\272\344\272\244\344\272\222\345\215\217\350\256\256_20250702.xlsx" deleted file mode 100644 index 85af170..0000000 --- "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\350\276\223\351\200\201\347\272\277\344\270\216\344\270\212\344\275\215\346\234\272\344\272\244\344\272\222\345\215\217\350\256\256_20250702.xlsx" +++ /dev/null Binary files differ diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\346\234\272\345\231\250\344\272\272IO\351\200\232\350\256\257\350\241\250.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\346\234\272\345\231\250\344\272\272IO\351\200\232\350\256\257\350\241\250.xlsx" index d19ae9d..bc5f1a0 100644 --- "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\346\234\272\345\231\250\344\272\272IO\351\200\232\350\256\257\350\241\250.xlsx" +++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\346\234\272\345\231\250\344\272\272IO\351\200\232\350\256\257\350\241\250.xlsx" Binary files differ diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\346\234\272\345\231\250\344\272\272IO\351\200\232\350\256\257\350\241\25020250712.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\346\234\272\345\231\250\344\272\272IO\351\200\232\350\256\257\350\241\25020250712.xlsx" new file mode 100644 index 0000000..aba2de6 --- /dev/null +++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\346\234\272\345\231\250\344\272\272IO\351\200\232\350\256\257\350\241\25020250712.xlsx" Binary files differ diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\350\256\276\345\244\207\351\200\232\350\256\257\345\215\217\350\256\256.xls" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\350\256\276\345\244\207\351\200\232\350\256\257\345\215\217\350\256\256.xls" index 32560b2..07f75f1 100644 --- "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\350\256\276\345\244\207\351\200\232\350\256\257\345\215\217\350\256\256.xls" +++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\350\256\276\345\244\207\351\200\232\350\256\257\345\215\217\350\256\256.xls" Binary files differ diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\350\275\257\344\273\266\350\256\241\345\210\222\350\241\250.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\350\275\257\344\273\266\350\256\241\345\210\222\350\241\250.xlsx" index 296786e..77180d8 100644 --- "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\350\275\257\344\273\266\350\256\241\345\210\222\350\241\250.xlsx" +++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\351\276\231\345\210\251\345\276\227\350\275\257\344\273\266\350\256\241\345\210\222\350\241\250.xlsx" Binary files differ diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\241\271\347\233\256\345\233\276\347\272\270/\347\272\270\344\270\232\347\211\251\346\265\201\346\226\271\346\241\210.dwg.lck" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\241\271\347\233\256\345\233\276\347\272\270/\347\272\270\344\270\232\347\211\251\346\265\201\346\226\271\346\241\210.dwg.lck" new file mode 100644 index 0000000..e69de29 --- /dev/null +++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\241\271\347\233\256\345\233\276\347\272\270/\347\272\270\344\270\232\347\211\251\346\265\201\346\226\271\346\241\210.dwg.lck" -- Gitblit v1.9.3