| | |
| | | SpeStackerCrane speStackerCrane = (SpeStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (speStackerCrane != null) |
| | | { |
| | | var DeviceStatu = speStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.DeviceStatus); |
| | | var StackerCraneStatu = speStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.StackerCraneStatus); |
| | | speStackerCrane.SetValue(StackerCraneDBName.StartRow, 1); |
| | | speStackerCrane.SetValue(StackerCraneDBName.StartColumn, 2); |
| | | speStackerCrane.SetValue(StackerCraneDBName.StartLayer, 3); |
| | | speStackerCrane.SetValue(StackerCraneDBName.EndRow, 4); |
| | | speStackerCrane.SetValue(StackerCraneDBName.EndColumn, 5); |
| | | speStackerCrane.SetValue(StackerCraneDBName.EndLayer, 2); |
| | | |
| | | GetStackerObject getStackerObject = new GetStackerObject(speStackerCrane); |
| | | if (!getStackerObject.IsEventSubscribed) |
| | | { |
| | | getStackerObject.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | | } |
| | | if (getStackerObject.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && getStackerObject.StackerCraneStatusValue == StackerCraneStatus.Ready) |
| | | { |
| | | getStackerObject.CheckStackerCraneTaskCompleted();//æ£æµå åæºä»»å¡å®æäºä»¶ |
| | | |
| | | if (getStackerObject.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | getStackerObject.CheckStackerCraneTaskCompleted();//æ£æµå åæºä»»å¡å®æäºä»¶ |
| | | |
| | | if (getStackerObject.StackerCraneStatusValue == StackerCraneStatus.Ready) |
| | | { |
| | | Dt_Task? task = GetTask(speStackerCrane); |
| | | if (task != null) |
| | | { |
| | | Dt_Task? task = GetTask(speStackerCrane); |
| | | if (task != null) |
| | | bool sendFlag = true; |
| | | //if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskTypeEnum.PalletOutbound.ObjToInt()) |
| | | //{ |
| | | // //åWMSç³è¯·åºå
¥åºå£æ¯å¦æç©ºæç |
| | | // sendFlag = false; |
| | | //} |
| | | if (sendFlag) |
| | | { |
| | | StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); |
| | | if (stackerCraneTaskCommand != null) |
| | | { |
| | | bool sendFlag = getStackerObject.SendCommand(stackerCraneTaskCommand); |
| | | sendFlag = getStackerObject.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | speStackerCrane.SetValue(StackerCraneDBName.CommandSend, 1);//å¯å¨å½ä»¤ |
| | |
| | | SpeStackerCrane? speStackerCrane = sender as SpeStackerCrane; |
| | | if (speStackerCrane != null) |
| | | { |
| | | if (speStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) |
| | | if (speStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.CommandSend) != 2) |
| | | { |
| | | _taskService.StackCraneTaskCompleted(e.TaskNum); |
| | | speStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); |
| | | speStackerCrane.SetValue(StackerCraneDBName.CommandSend, 2); |
| | | _taskService.StackCraneTaskCompleted(e.TaskNum, "å åæº"); |
| | | } |
| | | } |
| | | } |
| | |
| | | private Dt_Task? GetTask(SpeStackerCrane speStackerCrane) |
| | | { |
| | | Dt_Task? task; |
| | | string DeviceCode = speStackerCrane.DeviceCode.Contains("CP") ? "CP" : "FL"; |
| | | if (speStackerCrane.LastTaskType == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneTask(speStackerCrane.DeviceCode); |
| | | task = _taskService.QueryStackerCraneTask(DeviceCode); |
| | | } |
| | | else |
| | | { |
| | | if (speStackerCrane.LastTaskType == TaskTypeEnum.Relocation.ObjToInt()) |
| | | { |
| | | task = _taskService.QueryStackerCraneTask(DeviceCode); |
| | | if (task != null) return task; |
| | | } |
| | | bool flag = speStackerCrane.LastTaskType == TaskTypeEnum.Inbound.ObjToInt() || speStackerCrane.LastTaskType == TaskTypeEnum.PalletInbound.ObjToInt(); |
| | | if (flag == false) |
| | | { |
| | |
| | | |
| | | stackerCraneTaskCommand.Barcode = task.PalletCode; |
| | | stackerCraneTaskCommand.TaskNum = task.TaskNum; |
| | | stackerCraneTaskCommand.WorkType = 1; |
| | | stackerCraneTaskCommand.TrayType = 0; |
| | | if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() || task.TaskType == TaskTypeEnum.PalletInbound.ObjToInt())//夿æ¯å¦æ¯å
¥åºä»»å¡ |
| | | { |
| | | stackerCraneTaskCommand.WorkType = 1; |
| | | if (task.SourceAddress != null && task.TargetAddress != null) |
| | | { |
| | | string[] sourceCodes = task.SourceAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | if (sourceCodes.Length == 5) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]); |
| | |
| | | return null; |
| | | } |
| | | string[] targetCodes = task.TargetAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | if (targetCodes.Length == 5) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]); |
| | |
| | | } |
| | | else if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskTypeEnum.PalletOutbound.ObjToInt()) |
| | | { |
| | | stackerCraneTaskCommand.WorkType = 2; |
| | | if (task.SourceAddress != null && task.TargetAddress != null) |
| | | { |
| | | string[] targetCodes = task.TargetAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | if (targetCodes.Length == 5) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]); |
| | |
| | | return null; |
| | | } |
| | | string[] sourceCodes = task.SourceAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | if (sourceCodes.Length == 5) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]); |
| | |
| | | } |
| | | else if (task.TaskType == TaskTypeEnum.Relocation.ObjToInt()) |
| | | { |
| | | stackerCraneTaskCommand.WorkType = 3; |
| | | if (task.SourceAddress != null && task.TargetAddress != null) |
| | | { |
| | | string[] targetCodes = task.TargetAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | if (targetCodes.Length == 5) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]); |
| | |
| | | return null; |
| | | } |
| | | string[] sourceCodes = task.SourceAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | if (sourceCodes.Length == 5) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]); |