private void MakeLowerPrinterCharging(FASequence seq, VT5080.SubUnits.FAPrinterUnit printerUnit, FALabelPrinterModule printerModule) { seq.AddWatcher( delegate { if (seq.IsStartable()) { if (printerUnit.LowerPrinterDoorLock.Status == printerUnit.LowerPrinterDoorLock.StatusList.Lock) printerUnit.LowerDoorOpenSwitchLamp.DoTurnOff(this); else printerUnit.LowerDoorOpenSwitchLamp.DoTurnOn(this); } else return; if (VT5080Equipment.State == VT5080Equipment.StateStop || VT5080Equipment.State == VT5080Equipment.StateRun || VT5080Equipment.State == VT5080Equipment.StateRundown) { if (printerUnit.LowerDoorOpenSwitch.IsOn || printerModule.LowerPrinterStatus == FALabelPrinterModule.PrinterStatus.ChargingPaper) { seq.Start(); } } }); seq.Steps.Add("ConfirmChargingable", new StepInfo()); seq.Steps.Add("ConfirmDoorOpenCheck", new StepInfo()); seq.Steps["ConfirmChargingable"].StepIndex = seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (printerModule.PrintLabel.IsStartable() || printerModule.LowerPrinterStatus == FALabelPrinterModule.PrinterStatus.ChargingPaper) { printerModule.LowerPrinterStatus = FALabelPrinterModule.PrinterStatus.ChargingPaper; printerUnit.LowerDoorOpenSwitchLamp.DoTurnOn(actor); printerUnit.LowerPrinterDoorLock.DoTurnOff(actor); printerUnit.LowerPrinterStackerLock.DoTurnOff(actor); actor.NextStep(); } else if (TimeBlinkLampTime.Time < time) { if (printerUnit.LowerDoorOpenSwitchLamp.IsOn) printerUnit.LowerDoorOpenSwitchLamp.DoTurnOff(actor); else printerUnit.LowerDoorOpenSwitchLamp.DoTurnOn(actor); actor.NextStep("ConfirmChargingable"); } }); seq.Steps["ConfirmDoorOpenCheck"].StepIndex = seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (printerUnit.LowerPrinterDoorCloseSensor.IsOff) actor.NextStep(); }); seq.AddItem(new FATime(FATimeType.second, 1)); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (printerUnit.LowerPrinterDoorCloseSensor.IsOn) actor.NextStep(); }); seq.AddItem(new FATime(FATimeType.second, 1)); seq.AddItem( delegate(object obj) { printerUnit.LowerPrinterDoorLock.DoTurnOn(this); printerUnit.LowerPrinterStackerLock.DoTurnOn(this); }); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (printerUnit.LowerPrinterDoorLock.Status == printerUnit.LowerPrinterDoorLock.StatusList.Lock && printerUnit.LowerPrinterStackerLock.Status == printerUnit.LowerPrinterStackerLock.StatusList.Lock) { printerModule.LowerPrinterStatus = FALabelPrinterModule.PrinterStatus.None; actor.NextStep(); } else if (TimeDoorLockTimeout.Time < time) { int alarm = 0; if (printerUnit.LowerPrinterDoorLock.Status != printerUnit.LowerPrinterDoorLock.StatusList.Lock) alarm = AlarmLowerPrinterDoorLockFail; else alarm = AlarmLowerPrinterStackerLockFail; printerUnit.LowerPrinterDoorLock.DoTurnOff(actor); printerUnit.LowerPrinterStackerLock.DoTurnOff(actor); string windowName = string.Empty; var alarmObj = Utility.AlarmUtility.GetAlarm(alarm, "DOOR WARNING"); Manager.MessageWindowManager.Instance.Show(Equipment, "DOOR WARNING", out windowName, alarmObj, printerModule.Name, false); actor.NextStep("ConfirmDoorOpenCheck"); } }); }
protected void AddDebugLogToSequence(FASequence seq) { seq.OnStart += delegate { WriteDebugLog(string.Format("Start {0}.{1}", Name, seq.Name)); }; seq.OnStop += delegate { WriteDebugLog(string.Format("Stop {0}.{1}", Name, seq.Name)); }; seq.OnTerminate += delegate { WriteDebugLog(string.Format("Terminate {0}.{1}", Name, seq.Name)); seq.Stop(); seq.ClearState(); seq.Start(); }; }