private void buttonSend_Click(object sender, RoutedEventArgs e) { try { FAExtendECPart.ECResult result = new FAExtendECPart.ECResult(); Part.AddCommand(Command, result); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.ToString()); } }
private void buttonSend_Click(object sender, RoutedEventArgs e) { FAExtendECPart.ECResult result = new FAExtendECPart.ECResult(); Part.AddCommand(Command, result); }
private void MakeProcess() { FAExtendECPart.ECResult ecResult = new FAExtendECPart.ECResult(); var seq = Process; seq.Steps.Add("LoadJob", new StepInfo()); seq.Steps.Add("RequestLabelIssue", new StepInfo()); seq.Steps.Add("MovePusherToStandbyPos", new StepInfo()); seq.Steps.Add("AddWork", new StepInfo()); seq.AddItem( delegate(object obj) { if (ProductInfo.VT5080ProductInfo.IsEmptyBox == false) SmallBoxList.Add(ProductInfo.VT5080ProductInfo.SmallBoxID); }); seq.AddItem( delegate(object sender) { if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.DRY_RUN || Equipment.RunMode == FAFramework.Equipment.RunModeTypes.COLD_RUN) { ProductInfo.ECInfo.PackingMasterInfo.LOT_ID = "TEST LOT"; ProductInfo.ECInfo.PackingMasterInfo.PART_ID = "BRAND_BOX"; ProductInfo.ECInfo.PackingMasterInfo.S_BOX_MOQ = 10; ProductInfo.ECInfo.PackingMasterInfo.L_BOX_MOQ = 6; } }); seq.Steps["LoadJob"].StepIndex = //seq.AddItem(LoadJob); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (IsPreStackTerminated() == true) actor.NextStep(); else { SkipPassToNextMachine = true; actor.NextTerminate(); } }); seq.AddItem(PushSmallBoxes); seq.AddItem( delegate(object obj) { StackCount++; PreStackCount = 0; }); seq.AddItem(ConfirmStackCount); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.HOT_RUN) actor.NextStep(); else actor.NextStep("AddWork"); }); seq.Steps["RequestLabelIssue"].StepIndex = seq.AddItem( delegate(object obj) { FAECInfo.LBOX_ISSUE_REQ command = new FAECInfo.LBOX_ISSUE_REQ(); string[] serials = null; if (SmallBoxList.Count > 0) serials = SmallBoxList.Select(x => x).Where(x => string.IsNullOrEmpty(x) == false).ToArray(); if (serials != null) command.S_BOX_LABEL_SERIAL = string.Join(",", serials); else command.S_BOX_LABEL_SERIAL = string.Empty; command.GATE = CurrentLotInfo.GATE; command.LOT_ID = CurrentLotInfo.LOT_ID; command.S_BOX_CNT = serials.Count(); TurnkeyBoxCount = command.S_BOX_CNT * CurrentLotInfo.S_BOX_MOQ; ecResult.Clear(); InterfaceUnit.ECPart.AddCommand(command, ecResult); }); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (ecResult.ReceiveOk) { if (ecResult.ParsingSuccess) { if (ecResult.ECInfo.LargeBoxIssue.RESULT == FAECInfo.FAECResult.PASS) { ecResult.ECInfo.LargeBoxIssue.CopyTo(ProductInfo.ECInfo.LargeBoxIssue); actor.NextStep(); } else { RaiseAlarm(actor, AlarmLargeBoxIssueFail, string.Format("LARGE BOX ISSUE RESULT FAIL. MSG = {0}, Fail Message = {1}", ecResult.ECInfo.LargeBoxIssue.MSG, ecResult.ParsingFailMessage)); actor.NextStep("RequestLabelIssue"); } } else { RaiseAlarm(actor, AlarmLargeBoxIssueFail, string.Format("LARGE BOX ISSUE RESULT FAIL. MSG = {0}, Fail Message = {1}", ecResult.ECInfo.LargeBoxIssue.MSG, ecResult.ParsingFailMessage)); actor.NextStep("RequestLabelIssue"); } } else if (ecResult.LastAlarmNo != 0) { RaiseAlarm(actor, AlarmLargeBoxIssueFail, string.Format("Data Not Received From EC Server")); actor.NextStep("RequestLabelIssue"); } }); seq.Steps["AddWork"].StepIndex = seq.AddItem( delegate(object obj) { if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.DRY_RUN || Equipment.RunMode == FAFramework.Equipment.RunModeTypes.COLD_RUN) { CuttingPrinterModule.AddWork( new FALabelPrinterModule.ActionInfo(false, ConfigClasses.GlobalConst.TEST_LABEL_FORMAT, LargeBoxIndex, ProductInfo.ECInfo.PackingMasterInfo.LOT_ID)); NormalPrinterModule.AddWork( new FALabelPrinterModule.ActionInfo(false, ConfigClasses.GlobalConst.TEST_LABEL_FORMAT, LargeBoxIndex, ProductInfo.ECInfo.PackingMasterInfo.LOT_ID)); } else if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.HOT_RUN) { bool cuttingLabelSkip = false; if (ProductInfo.ECInfo.LargeBoxIssue.LABEL_CNT == 1) cuttingLabelSkip = true; CuttingPrinterModule.AddWork( new FALabelPrinterModule.ActionInfo(cuttingLabelSkip, ProductInfo.ECInfo.LargeBoxIssue.FORMAT02, LargeBoxIndex, ProductInfo.ECInfo.PackingMasterInfo.LOT_ID)); NormalPrinterModule.AddWork( new FALabelPrinterModule.ActionInfo(false, ProductInfo.ECInfo.LargeBoxIssue.FORMAT01, LargeBoxIndex, ProductInfo.ECInfo.PackingMasterInfo.LOT_ID)); } }); seq.AddItem( delegate(object obj) { ProductInfo.VT5080ProductInfo.SmallBoxList.Clear(); foreach (var item in SmallBoxList) ProductInfo.VT5080ProductInfo.SmallBoxList.Add(item); }); seq.AddItem(Unloading); seq.Steps["MovePusherToStandbyPos"].StepIndex = seq.AddItem(SmallBoxPreStackUnit.SmallBoxPushServo.MoveStandbyPos.Sequence); }
private void MakeProcess() { FAExtendECPart.ECResult ecResult = new FAExtendECPart.ECResult(); bool qcTarget = false; var seq = Process; seq.Steps.Add("Terminate", new StepInfo()); seq.AddItem( delegate(object obj) { var VT5080Equipment = Equipment as VT5080.SubEquipment; if (VT5080Equipment.GlobalConfigModule.UseGEMCommunication) { GEM.GEMFuncWrapper.PackingLargeBox(Equipment.Name, ProductInfo.ECInfo.PackingMasterInfo.LOT_ID, ProductInfo.ECInfo.PackingMasterInfo.LOT_QTY, ProductInfo.ECInfo.PackingMasterInfo.PART_ID, ProductInfo.ECInfo.PackingMasterInfo.LOT_QTY, DateTime.Now); } }); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (ProductInfo.VT5080ProductInfo.LargeBoxIndex == VT5080ProductInfo.FIRST_LARGE_BOX_INDEX) LargeBoxIDs = string.Empty; if (ProductInfo.VT5080ProductInfo.LargeBoxIndex == VT5080ProductInfo.FIRST_LARGE_BOX_INDEX) LargeBoxIDs = string.Concat(LargeBoxIDs, ProductInfo.ECInfo.LargeBoxIssue.L_BOX_ID); else LargeBoxIDs = string.Concat(LargeBoxIDs, ",", ProductInfo.ECInfo.LargeBoxIssue.L_BOX_ID); // line AutoShip if (ProductInfo.VT5080ProductInfo.LoadingLine == ELoadingLine.Line1) { if (Line1UseAutoShip && ProductInfo.VT5080ProductInfo.IsLastLargeBox) { WriteTraceLog(string.Format("Lane1 Auto Ship : {0}, {1}", ProductInfo.ECInfo.PackingMasterInfo.LOT_ID, ProductInfo.VT5080ProductInfo.IsLastLargeBox)); actor.NextStep(); } else { actor.NextStep("Terminate"); } } else if (ProductInfo.VT5080ProductInfo.LoadingLine == ELoadingLine.Line2) { if (Line2UseAutoShip && ProductInfo.VT5080ProductInfo.IsLastLargeBox) { WriteTraceLog(string.Format("Lane2 Auto Ship : {0}, {1}", ProductInfo.ECInfo.PackingMasterInfo.LOT_ID, ProductInfo.VT5080ProductInfo.IsLastLargeBox)); actor.NextStep(); } else { actor.NextStep("Terminate"); } } }); seq.AddItem( delegate(FASequence actor, TimeSpan time) { qcTarget = false; var now = DateTime.Now; var elapsedTime = now - LastUnloadingTime; if (ShiftFirstProductQCMode) { if (elapsedTime.Ticks > TimeSpan.TicksPerDay || FAFramework.Equipment.MainEquipment.GetShift(now.TimeOfDay) != FAFramework.Equipment.MainEquipment.GetShift(LastUnloadingTime.TimeOfDay)) qcTarget = true; } if (QCRequest) qcTarget = true; if (qcTarget) { if (QCRequest) WriteTraceLog("Manual QC Unloading"); else WriteTraceLog("Shift First Product QC Unloading"); ProductInfo.VT5080ProductInfo.ProductStatus.ProductStatus = EProductStatus.QC; actor.NextStep("Terminate"); } else { FAECInfo.AUTO_SHIP_REQ command = new FAECInfo.AUTO_SHIP_REQ(); command.LOT_ID = ProductInfo.ECInfo.PackingMasterInfo.LOT_ID; command.L_BOX_ID = LargeBoxIDs; ecResult.Clear(); InterfaceUnit.ECPart.AddCommand(command, ecResult); actor.NextStep(); } }); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (ecResult.ReceiveOk) { if (ecResult.ParsingSuccess) { if (ecResult.ECInfo.AutoShip.RESULT == FAECInfo.FAECResult.PASS) { var VT5080Equipment = Equipment as VT5080.SubEquipment; if (VT5080Equipment.GlobalConfigModule.UseGEMCommunication) { GEM.GEMFuncWrapper.AutoShip(Equipment.Name, ProductInfo.ECInfo.PackingMasterInfo.LOT_ID, ProductInfo.ECInfo.PackingMasterInfo.PART_ID, DateTime.Now); } ecResult.ECInfo.AutoShip.CopyTo(ProductInfo.ECInfo.AutoShip); WriteTraceLog(string.Format("{0} Auto Ship Pass",ProductInfo.VT5080ProductInfo.LoadingLine)); actor.NextStep(); } else { WriteTraceLog(string.Concat("AUTO SHIP FAIL. EC ALARM NO : ", ecResult.LastAlarmNo.ToString())); ProductInfo.VT5080ProductInfo.ProductStatus.ProductStatus = EProductStatus.Fail; actor.NextStep(); } } else { WriteTraceLog(string.Concat("AUTO SHIP FAIL. EC ALARM NO : ", ecResult.LastAlarmNo.ToString())); ProductInfo.VT5080ProductInfo.ProductStatus.ProductStatus = EProductStatus.Fail; actor.NextStep(); } } else if (ecResult.LastAlarmNo != 0) { WriteTraceLog(string.Concat("AUTO SHIP FAIL. EC ALARM NO : ", ecResult.LastAlarmNo.ToString())); ProductInfo.VT5080ProductInfo.ProductStatus.ProductStatus = EProductStatus.Fail; actor.NextStep(); } }); seq.Steps["Terminate"].StepIndex = seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (ProductInfo.VT5080ProductInfo.IsLastLargeBox) { if (qcTarget) { Manager.MessageWindowManager.Instance.Show(Equipment, "QC Unloading", string.Format("QC Unloading Completed. {0}", ProductInfo.ECInfo.PackingMasterInfo.LOT_ID)); } QCRequest = false; WriteTraceLog(string.Format("LOT END : {0}", ProductInfo.ECInfo.PackingMasterInfo.LOT_ID)); ProductInfo.VT5080ProductInfo.ProductStatus.LotEnd = true; LastUnloadingTime = DateTime.Now; } actor.NextStep(); }); }
private void MakeScanBarcode() { FAExtendECPart.ECResult ecResult = new FAExtendECPart.ECResult(); var seq = ScanBarcode; seq.OnStart += delegate { RetryInfoBarcodeScan.ClearCount(); }; seq.Steps.Add("Start", new StepInfo()); seq.Steps.Add("AddLoadingCount", new StepInfo()); seq.Steps.Add("RequestPackingMasterInfo", new StepInfo()); seq.Steps.Add("RequestSmallBoxInfo", new StepInfo()); seq.Steps["Start"].StepIndex = seq.AddItem(SmallBoxLoadingUnit.Scanner.TriggerOn); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.DRY_RUN || Equipment.RunMode == FAFramework.Equipment.RunModeTypes.COLD_RUN) { ProductInfo.ECInfo.PackingMasterInfo.LOT_ID = "TEST LOT"; ProductInfo.ECInfo.PackingMasterInfo.PART_ID = "BRAND_BOX"; ProductInfo.ECInfo.PackingMasterInfo.S_BOX_MOQ = 10; ProductInfo.ECInfo.PackingMasterInfo.L_BOX_MOQ = MAX_SMALLBOX_COUNT; ProductInfo.ECInfo.PackingMasterInfo.LOT_QTY = 30; ProductInfo.VT5080ProductInfo.Gate = Gate; InputCount++; if (GlobalConfigModule.RobotWorkType == ERobotWorkType.StartAtScanedFirstSmallBox) { if (InputCount == 1) { RobotControlModule.AddWork(ProductInfo); } } else if (GlobalConfigModule.RobotWorkType == ERobotWorkType.StartAtScanedLastSmallBox) { if (InputCount == MAX_SMALLBOX_COUNT) { RobotControlModule.AddWork(ProductInfo); } } if (InputCount == MAX_SMALLBOX_COUNT) InputCount = 0; actor.NextTerminate(); } else { if (IsEmptyBox(LoadingCount)) { if (TimeScanTimeout.Time < time) { CurrentLotInfo.CopyTo(ProductInfo.ECInfo.PackingMasterInfo); WriteTraceLog("Scan Success Empty Box"); actor.NextStep("AddLoadingCount"); } else if (string.IsNullOrEmpty(SmallBoxLoadingUnit.Scanner.Barcode.Barcode) == false) { if (RetryInfoBarcodeScan.IncreaseCount() == false) RaiseAlarm(actor, AlarmBarcodeDetectedOnAEmptyBox); actor.NextStep("Start"); } } else { if (string.IsNullOrEmpty(SmallBoxLoadingUnit.Scanner.Barcode.Barcode) == false) { LotID = SmallBoxLoadingUnit.Scanner.Barcode.Barcode; ProductInfo.VT5080ProductInfo.SmallBoxID = LotID; WriteTraceLog("Barcode Scan Success : " + LotID); actor.NextStep(); } else if (TimeScanTimeout.Time < time) { if (RetryInfoBarcodeScan.IncreaseCount() == false) RaiseAlarm(actor, AlarmBarcodeScanFail); actor.NextStep("Start"); } } } }); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.DRY_RUN || Equipment.RunMode == FAFramework.Equipment.RunModeTypes.COLD_RUN) actor.NextTerminate(); else if (Equipment.RunMode == FAFramework.Equipment.RunModeTypes.HOT_RUN) { actor.NextStep(); } }); seq.Steps["RequestPackingMasterInfo"].StepIndex = seq.AddItem( delegate(FASequence actor, TimeSpan time) { bool exception = false; if (string.IsNullOrEmpty(LotID) == false && LotID.Length >= 10) { try { FAECInfo.PACKING_MASTER_INFO_REQ command = new FAECInfo.PACKING_MASTER_INFO_REQ(); command.LOT_ID = LotID.Substring(0, 10); ecResult.Clear(); InterfaceUnit.ECPart.AddCommand(command, ecResult); } catch (Exception e) { exception = true; RaiseAlarm(actor, AlarmLotIDParsingFail, e.ToString()); } if (exception == false) actor.NextStep(); } }); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (ecResult.ReceiveOk) { if (ecResult.ParsingSuccess) { if (ecResult.ECInfo.PackingMasterInfo.RESULT == FAECInfo.FAECResult.PASS) { ecResult.ECInfo.PackingMasterInfo.CopyTo(ProductInfo.ECInfo.PackingMasterInfo); actor.NextStep(); } else { RaiseAlarm(actor, ecResult.LastAlarmNo); actor.NextStep("RequestPackingMasterInfo"); } } else { RaiseAlarm(actor, ecResult.LastAlarmNo); actor.NextStep("RequestPackingMasterInfo"); } } else if (ecResult.LastAlarmNo != 0) { RaiseAlarm(actor, ecResult.LastAlarmNo); actor.NextStep("RequestPackingMasterInfo"); } }); seq.Steps["RequestSmallBoxInfo"].StepIndex = seq.AddItem( delegate(object obj) { string temp = LotID; FAECInfo.SBOX_INFO_REQ command = new FAECInfo.SBOX_INFO_REQ(); command.SBOX_ID = temp; command.EQP_ID = Equipment.Config.SystemID; command.GATE = ProductInfo.ECInfo.PackingMasterInfo.GATE; ecResult.Clear(); InterfaceUnit.ECPart.AddCommand(command, ecResult); }); seq.AddItem( delegate(FASequence actor, TimeSpan time) { if (ecResult.ReceiveOk) { if (ecResult.ParsingSuccess) { if (ecResult.ECInfo.SBoxInfo.RESULT == FAECInfo.FAECResult.PASS) { ecResult.ECInfo.SBoxInfo.CopyTo(ProductInfo.ECInfo.SBoxInfo); actor.NextStep(); } else { RaiseAlarm(actor, ecResult.LastAlarmNo); actor.NextStep("RequestSmallBoxInfo"); } } else { RaiseAlarm(actor, ecResult.LastAlarmNo); actor.NextStep("RequestSmallBoxInfo"); } } else if (ecResult.LastAlarmNo != 0) { RaiseAlarm(actor, ecResult.LastAlarmNo); actor.NextStep("RequestSmallBoxInfo"); } }); seq.Steps["AddLoadingCount"].StepIndex = seq.AddItem( delegate(FASequence actor, TimeSpan time) { bool changedLot = false; if (AddLoadingCount(ProductInfo.ECInfo.PackingMasterInfo, out changedLot) == true) { if (changedLot) { FARobotControlModule.RobotWork work = new FARobotControlModule.RobotWork(); ProductInfo.VT5080ProductInfo.ProductStatus = new VT5080ProductInfo.ProductStatusInfo(); ProductInfo.VT5080ProductInfo.Gate = Gate; RobotControlModule.AddWork(ProductInfo); } actor.NextStep(); } else { RaiseAlarm(actor, AlarmNotSameLotIDProductInput); actor.NextStep("Start"); } }); seq.AddItem( delegate(object obj) { var smallBoxCount = CurrentLotLargeBoxCount() * CurrentLotInfo.L_BOX_MOQ; ProductInfo.VT5080ProductInfo.SmallBoxIndex = LoadingCount - 1; if (smallBoxCount == LoadingCount) { CurrentLotInfo.Clear(); LoadingCount = 0; } }); seq.AddTerminate(); }