public AutoShipControl() { Command = new FAECInfo.AUTO_SHIP_REQ(); InitializeComponent(); }
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(); }); }