コード例 #1
0
        public void NotifyOpcJobFinished(RollPosition roll)
        {
            try {
                switch (roll.PnlState)
                {
                case PanelState.HalfFull:
                    FrmMain.logOpt.Write($"{roll.RealLocation}: 半满板信号发出。slot: ", LogType.ROBOT_STACK);
                    break;

                case PanelState.Full:
                    FrmMain.logOpt.Write($"{roll.RealLocation}: 满板信号发出。slot: ", LogType.ROBOT_STACK);

                    LableCode.SetPanelFinished(roll.PanelNo);

                    lock (TaskQueues.LOCK_LOCHELPER) {
                        TaskQueues.lochelper.OnFull(roll.RealLocation);
                    }
                    break;

                case PanelState.LessHalf:
                    break;

                default:
                    FrmMain.logOpt.Write($"!板状态不明,不发信号, {roll.PnlState}", LogType.ROBOT_STACK);
                    break;
                }
                if (roll.Status == (int)LableState.FloorLastRoll && roll.PnlState != PanelState.Full)
                {
                    BadShape(roll);
                }

#if DEBUG
                var panel = LableCode.GetPanel(roll.PanelNo);
                if (roll.Status == (int)LableState.FloorLastRoll && roll.PnlState != PanelState.Full && roll.Floor == panel.MaxFloor)
                {
                    throw new Exception($"板满状态不一致。{roll.LabelCode}, {roll.ToLocation}/{roll.RealLocation}");
                    roll.PnlState = PanelState.Full;
                    LableCode.SetPanelFinished(roll.PanelNo);

                    lock (TaskQueues.LOCK_LOCHELPER) {
                        TaskQueues.lochelper.OnFull(roll.RealLocation);
                    }
                }
#endif
            } catch (Exception ex) {
                FrmMain.logOpt.Write($"!来源: {nameof(NotifyOpcJobFinished)}, {ex}", LogType.ROBOT_STACK);
            }
        }
コード例 #2
0
        public void NotifyOpcJobFinished(RollPosition roll)
        {
            try {
                switch (roll.PnlState)
                {
                case PanelState.HalfFull:
                    lock (client) {
                        client.TryWrite(param.BAreaFloorFinish[roll.RealLocation], true);
                    }
                    log($"{roll.RealLocation}: 半板信号发出。slot: {param.BAreaFloorFinish[roll.RealLocation]}", LogType.ROBOT_STACK);
                    break;

                case PanelState.Full:
                    string msg;
                    ErpHelper.NotifyPanelEnd(erpapi, roll.PanelNo, roll.RealLocation, out msg);
                    log(msg, LogType.ROBOT_STACK);

                    LableCode.SetPanelFinished(roll.PanelNo);

                    lock (TaskQueues.LOCK_LOCHELPER) {
                        TaskQueues.lochelper.OnFull(roll.RealLocation);
                    }

                    lock (client) {
                        PlcHelper.NotifyFullPanel(client, param, roll.RealLocation);
                    }

                    break;

                case PanelState.LessHalf:
                    break;

                default:
                    log($"!板状态不明,不发信号, {roll.PnlState}", LogType.ROBOT_STACK);
                    break;
                }

                if (roll.Status == (int)LableState.FloorLastRoll && roll.PnlState != PanelState.Full)
                {
                    BadShape(roll);
                }

                var panel = LableCode.GetPanel(roll.PanelNo);
                if (roll.Status == (int)LableState.FloorLastRoll && roll.PnlState != PanelState.Full && roll.Floor == panel.MaxFloor)
                {
                    log("!---异常板满状态处理---", LogType.ROBOT_STACK);
                    roll.PnlState = PanelState.Full;
                    string msg;
                    ErpHelper.NotifyPanelEnd(erpapi, roll.PanelNo, roll.RealLocation, out msg);
                    client.TryWrite(param.BAreaPanelFinish[roll.RealLocation], true);

                    log($"{roll.RealLocation}: 异常满板信号发出。slot: {param.BAreaPanelFinish[roll.RealLocation]}", LogType.ROBOT_STACK);
                    log(msg, LogType.ROBOT_STACK);

                    LableCode.SetPanelFinished(roll.PanelNo);

                    lock (TaskQueues.LOCK_LOCHELPER) {
                        TaskQueues.lochelper.OnFull(roll.RealLocation);
                    }

                    const int SIGNAL_3 = 3;
                    client.TryWrite(param.BAreaPanelState[roll.RealLocation], SIGNAL_3);
                    log($"{roll.RealLocation}: 异常板状态信号发出,状态值: {SIGNAL_3}。slot: {param.BAreaPanelState[roll.RealLocation]}", LogType.ROBOT_STACK);
                }
            } catch (Exception ex) {
                log($"!来源: {nameof(NotifyOpcJobFinished)}, {ex}", LogType.ROBOT_STACK);
            }
        }