huangxiaoqiang
2 天以前 2d9272bdcdbdbca81396a61493e4ef6a822dcf4a
ÏîÄ¿´úÂë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob/CommonRGVJob.cs
@@ -82,12 +82,6 @@
                CommonRGV commonRGV = (CommonRGV)context.JobDetail.JobDataMap.Get("JobParams");
                if (commonRGV != null)
                {
                    //if (!commonRGV.IsEventSubscribed)
                    //{
                    //    commonRGV.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订阅任务完成事件
                    //}
                    //commonRGV.CheckStackerCraneTaskCompleted();//防止任务完成事件监测超时,再手动触发一次
                    if (commonRGV.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.WorkCompleted))
                    {
                        var x = commonRGV.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum);
@@ -146,16 +140,7 @@
            }
            return Task.CompletedTask;
        }
        /// <summary>
        /// ä»»åŠ¡å®Œæˆäº‹ä»¶è®¢é˜…çš„æ–¹æ³•
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CommonStackerCrane_StackerCraneTaskCompletedEventHandler(object? sender, WIDESEAWCS_QuartzJob.StackerCrane.StackerCraneTaskCompletedEventArgs e)
        {
            CommonRGV? commonRGV = sender as CommonRGV;
        }
        public void RGVTaskFinish(CommonRGV commonRGV, int TaskNum)
        {
@@ -182,7 +167,9 @@
                            if (device != null)
                            {
                                CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
                                //var x = conveyorLine.Communicator.Read<string>("DB1103.16");
                                Thread.Sleep(100);
                                var Barcode = conveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.ConveyorLineBarcode, stationManager.stationChildCode);
                                if (Barcode == null)
@@ -195,6 +182,25 @@
                    }
                    else
                    {
                        if (task.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting)
                        {
                            Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress&&x.stationType==7);
                            if (stationManager != null)
                            {
                                IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManager.stationPLC);
                                if (device != null)
                                {
                                    CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
                                    Thread.Sleep(100);
                                    var Barcode = conveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.ConveyorLineBarcode, stationManager.stationChildCode);
                                    conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, Convert.ToInt16(stationManager.stationNextChildCode), stationManager.stationChildCode);
                                    Thread.Sleep(100);
                                    conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTaskNum, Convert.ToInt16(1000), stationManager.stationChildCode);
                                    Thread.Sleep(100);
                                    conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, Convert.ToSByte(2), stationManager.stationChildCode);
                                }
                            }
                        }
                        var content = _taskService.RGVTaskCompleted(TaskNum);
                    }
                }