ÏîÄ¿´úÂë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -64,7 +64,6 @@
        {
            try
            {
                CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams");
                if (commonStackerCrane != null)
                {
@@ -88,9 +87,10 @@
                                    bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
                                    if (sendFlag)
                                    {
                                        var isWorkType = commonStackerCrane.Communicator.WriteNoRead("DB100.18.0", Convert.ToInt16(1));
                                        commonStackerCrane.LastTaskType = task.TaskType;
                                        _taskService.UpdateTaskStatusToNext(task.TaskNum);
                                        Thread.Sleep(1000);
                                        Thread.Sleep(2000);
                                    }
                                }
                            }
@@ -243,38 +243,35 @@
                        commonStackerCrane.SetValue(StackerCraneDBName.FinishConfirm, 1);
                        return;
                    }
                    string WorkStatus = $"【{commonStackerCrane.StackerCraneWorkStatusValue}】";
                    bool IsWrite = false;
                    var content = _taskService.StackCraneTaskCompleted(e.TaskNum);
                    if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                    {
                        CommonConveyorLine? conveyorLine = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1001") as CommonConveyorLine;
                        if (conveyorLine != null)
                        {
                            short InteractiveSignal = conveyorLine.GetValue<ConveyorLineDBName, short>(ConveyorLineDBName.InteractiveSignal, "LK001");
                            var structs = BitConverter.GetBytes(InteractiveSignal).Reverse().ToArray().ToBoolArray();
                            if (structs[0])
                            {
                                IsWrite = conveyorLine.Communicator.WriteNoRead("DB100.0", 0);
                                Thread.Sleep(1000);
                                IsWrite = conveyorLine.Communicator.WriteNoRead("DB100.0", 9999);
                                if (!IsWrite)
                                {
                                    return;
                                }
                            }
                        }
                    #region
                    //if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                    //{
                    //    CommonConveyorLine? conveyorLine = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1001") as CommonConveyorLine;
                    //    if (conveyorLine != null)
                    //    {
                    //        short InteractiveSignal = conveyorLine.GetValue<ConveyorLineDBName, short>(ConveyorLineDBName.InteractiveSignal, "LK001");
                    //        var structs = BitConverter.GetBytes(InteractiveSignal).Reverse().ToArray().ToBoolArray();
                    //        if (structs[0])
                    //        {
                    //            IsWrite = conveyorLine.Communicator.WriteNoRead("DB100.0", Convert.ToInt32(9999));
                    //            conveyorLine.Communicator.WriteNoRead("DB100.4", Convert.ToInt16(task.TaskNum));
                    //            if (!IsWrite)
                    //            {
                    //                return;
                    //            }
                    //        }
                    //    }
                        _taskService.UpdateTaskStatusToNext(task.TaskNum);
                    }
                    //    _taskService.UpdateTaskStatusToNext(task.TaskNum);
                    //}
                    #endregion
                    //var isWorkType = commonStackerCrane.SetValue(StackerCraneDBName.FinishConfirm, 1);
                    var isWorkType = commonStackerCrane.Communicator.WriteNoRead("DB100.0", 1);
                    var isWorkType = commonStackerCrane.Communicator.WriteNoRead("DB100.0", Convert.ToInt16(1));
                    str = $"{commonStackerCrane.DeviceName}】WMS|WCS任务完成:【{content.Status}{content.Message}】,堆垛机完成信号写入:【{isWorkType}】,任务号:【{e.TaskNum}】时间【{DateTime.Now}】输送线写入{IsWrite}";
                    WriteInfo(commonStackerCrane.DeviceName, str + WorkStatus);
                    str = $"{commonStackerCrane.DeviceName}】WMS|WCS任务完成:【{content.Status}{content.Message}】,堆垛机完成信号写入:【{isWorkType}】,任务号:【{e.TaskNum}】时间【{DateTime.Now}】";
                    WriteInfo(commonStackerCrane.DeviceName, str);
                    ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue);
                }
            }
@@ -288,6 +285,11 @@
        private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane)
        {
            Dt_Task task;
            if (_taskService.QueryExecutingTask(commonStackerCrane.DeviceCode) != null)
            {
                return null;
            }
            task = _taskService.QueryRelocationTask(commonStackerCrane.DeviceCode);
            if (task != null)
            {
@@ -317,11 +319,12 @@
            if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
            {
                var InTask = _taskRepository.QueryFirst(x => x.TaskState > (int)TaskInStatusEnum.InNew && x.TaskState< (int)TaskInStatusEnum.SC_InExecuting);
                var InTask = _taskRepository.QueryFirst(x => x.TaskState > (int)TaskInStatusEnum.InNew && x.TaskState < (int)TaskInStatusEnum.SC_InExecuting);
                var OutTask = _taskRepository.QueryFirst(x => x.TaskState > (int)TaskOutStatusEnum.OutNew && x.TaskState < (int)TaskOutStatusEnum.AGV_OutExecuting);
                if (InTask != null)
                {
                    return null;
                    task= _taskRepository.QueryFirst(x => x.TaskState == (int)TaskInStatusEnum.Line_InFinish && x.Roadway == commonStackerCrane.DeviceCode);
                    return task;
                }
                else if (OutTask != null)
                {
@@ -365,8 +368,16 @@
                        if (taskDTO.TaskNum != task.TaskNum)
                        {
                            _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
                            return _taskRepository.QueryFirst(x => x.TaskNum == taskDTO.TaskNum);
                            var taskNew=_taskRepository.QueryFirst(x=>x.PalletCode==taskDTO.PalletCode);
                            if (taskNew != null)
                            {
                                task = taskNew;
                            }
                            else
                            {
                                _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
                                task = _taskRepository.QueryFirst(x => x.TaskNum == taskDTO.TaskNum);
                            }
                        }
                    }
@@ -375,24 +386,33 @@
                    {
                        short InteractiveSignal = conveyorLine.GetValue<ConveyorLineDBName, short>(ConveyorLineDBName.InteractiveSignal, "LK001");
                        var structs = BitConverter.GetBytes(InteractiveSignal).Reverse().ToArray().ToBoolArray();
                        if (structs[1])
                        {
                            task.ExceptionMessage = "输送线有货暂不下发出库任务";
                            _taskRepository.UpdateData(task);
                            return null;
                        }
                        if (structs[0] && !structs[2] && !structs[1])
                        {
                            conveyorLine.Communicator.WriteNoRead("DB100.0", 9990);
                            conveyorLine.Communicator.Write("DB100.0", 9990);
                        }
                        if (structs[0] && structs[2])
                        {
                            conveyorLine.Communicator.WriteNoRead("DB100.0", 9990);
                            conveyorLine.Communicator.Write("DB100.0", 9990);
                            return task;
                        }
                        else
                        {
                            task.ExceptionMessage = "请检查输送线是否是自动模式或已经移动到出库口";
                            _taskRepository.UpdateData(task);
                            return null;
                        }
                    }
                    else
                    {
                        task.ExceptionMessage = "输送线设备断开连接";
                        _taskRepository.UpdateData(task);
                        return null;
                    }
                }   
@@ -483,7 +503,6 @@
            stackerCraneTaskCommand.TaskNum = Convert.ToInt16(task.TaskNum);
            stackerCraneTaskCommand.WorkType = Convert.ToInt16(1);
            stackerCraneTaskCommand.StartCommand = Convert.ToInt16(1);
            if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//判断是否是入库任务
            {
                var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.stationChildCode == task.CurrentAddress);