[Authorize] public ActionResult Edit(MBStatus obj) { try { if (ModelState.IsValid) { dbActionResult resultAction = new dbActionResult(); resultAction = db.EditMBStatus(obj); int id = resultAction.intResult; if (id >= 0) { return(RedirectToAction("Index")); } if (id == -1) { db.DetachMBStatus(obj); MBStatus oldObj = db.GetMBStatus(obj.MBStatusID); ModelState.AddModelError("", "Ошибка параллельного доступа к данным. Если проблема повторится, обратитесь к системному администратору."); if (oldObj.Code != obj.Code) { ModelState.AddModelError("Code", "Текущее значение: " + oldObj.Code.ToString()); } if (oldObj.DescriptionEng != obj.DescriptionEng) { ModelState.AddModelError("DescriptionEng", "Текущее значение: " + oldObj.DescriptionEng.ToString()); } if (oldObj.DescriptionRus.ToString() != obj.DescriptionRus.ToString()) { ModelState.AddModelError("DescriptionRus", "Текущее значение: " + oldObj.DescriptionRus.ToString()); } obj.Timestamp = oldObj.Timestamp; } if (id == -2) { ModelState.AddModelError("", resultAction.exData.Message.ToString() + " | " + resultAction.exData.GetType().ToString() + " | " + "Невозможно сохранить изменения. Нажмите обновить страницу и повторить действия. Если проблема повторится, обратитесь к системному администратору."); } } } catch (DataException ex) { ModelState.AddModelError("", ex.Message.ToString() + " | " + ex.GetType().ToString() + " | " + "Невозможно сохранить изменения. Попробуйте повторить действия. Если проблема повторится, обратитесь к системному администратору."); } return(View(obj)); }
[Authorize] public ActionResult Create(MBStatus obj) { try { if (ModelState.IsValid) { int id = db.AddMBStatus(obj); return(RedirectToAction("Index")); } } catch (DataException ex) { ModelState.AddModelError("", ex.Message.ToString() + " Невозможно сохранить изменения. Попробуйте повторить действия. Если проблема повторится, обратитесь к системному администратору."); } return(RedirectToAction("Index")); }
protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { try { IRepairTarget repairTarget = GetRepairTarget(); RepairDefect defect; defect = (RepairDefect)CurrentSession.GetValue(Session.SessionKeys.CurrentRepairdefect); IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product); //bool bSearch = false; bool bLCMType = false; //IList<IProductPart> productParts = product.ProductParts; IList<IProductPart> productParts = (IList<IProductPart>)CurrentSession.GetValue(ExtendSession.SessionKeys.ProductPart); bool isReleaseMB = (bool)CurrentSession.GetValue(ExtendSession.SessionKeys.ReleaseMB); bool isReleasePart = (bool)CurrentSession.GetValue(ExtendSession.SessionKeys.ReleasePart); CurrentSession.AddValue(ExtendSession.SessionKeys.PartType, ""); if (isReleaseMB) //MB { CurrentSession.AddValue(Session.SessionKeys.OldMB, product.PCBID); product.PCBID = ""; defect.PartType = "MB"; product.PCBModel = null; product.MAC = null; product.UUID = null; product.MBECR = null; product.CVSN = null; //解綁MB要同時解綁 BATT //20110615 只要有换MB/LCM/Battery三者中任意一个,都需要把机器原来结合的MB/LCM/Battery解掉,然后重BoardInput(40)站重流 foreach (ProductPart part in productParts) { //if (part.Value.Trim() == defect.OldPartSno.Trim()) // { //CurrentSession.AddValue(ExtendSession.SessionKeys.PartType, part.PartType); /*if (part.PartType.Trim() == "BATT") { product.RemovePart(part.Value, part.PartID); break; }*/ //} product.RemovePart(part.Value, part.PartID); // Dean 20110715 解綁MB要同時解綁 BATT/LCM1/LCM2 } CurrentSession.AddValue(ExtendSession.SessionKeys.PartType, "MB"); } else if (isReleasePart) { // Dean 20110715 解綁LCM1/LCM2/BATT 要同時解綁MB,並且還是更新PCBStatus=30 var mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); var mb = mbRepository.Find(product.PCBID); if (mb == null) { var ex = new FisException("SFC001", new string[] { mb.Sn }); throw ex; } var PCBStatus = new MBStatus(mb.Sn, "30", MBStatusEnum.Pass, this.Editor, mb.MBStatus.Line, mb.MBStatus.Cdt, DateTime.Now); mb.MBStatus = PCBStatus; mbRepository.Update(mb, CurrentSession.UnitOfWork); var mbLog = new MBLog( 0, mb.Sn, mb.Model, "30", 1, mb.MBStatus.Line, this.Editor, DateTime.Now); mb.AddLog(mbLog); mbRepository.Update(mb, CurrentSession.UnitOfWork); product.PCBID = ""; product.PCBModel = null; product.MAC = null; product.UUID = null; product.MBECR = null; product.CVSN = null; foreach (ProductPart part in productParts) { if (part.Value.Trim() == defect.OldPartSno.Trim()) { CurrentSession.AddValue(ExtendSession.SessionKeys.PartType, part.PartType); //if (part.PartType != "MB" && part.PartType != "") /*if (part.PartType.Trim() == "LCM1" || part.PartType.Trim() == "LCM2") { bLCMType = true; } else if (part.PartType.Trim() == "BATT")//先解到BATT本身的 { product.RemovePart(part.Value, part.PartID); } break;*/ foreach (ProductPart part1 in productParts) { product.RemovePart(part1.Value, part1.PartID);// Dean 20110715 解綁LCM1/LCM2要同時解綁 BATT/LCM1/LCM2 } break; } } //remove LCM1 & LCM2 /*if (bLCMType) { foreach (ProductPart part in productParts) { //if (part.PartType === "LCM1" || part.PartType == "LCM2")//若是LCM1/LCM2/BATT,要同時解綁 //解綁LCM1或LCM2要同時解綁LCM1/LCM2/BATT(若是LCM1/LCM2/BATT,要同時解綁) if (part.PartType.Trim() != "MB" && part.PartType != "") { product.RemovePart(part.Value, part.PartID); } } }*/ } #region original 20110527 //if (defect.OldPartSno.Trim() != "") //MB/LCM1/LCM2 //{ // //MB // if (defect.OldPart.Trim() != "" && product.PCBModel.Trim() == defect.OldPart.Trim() || // defect.OldPartSno.Trim() != "" && product.PCBID.Trim() == defect.OldPartSno.Trim()) // { // //Dean 20110516 即當Faulty Part NO ,Faulty Part Sn 和Product_Part中的數據不匹配 // if (defect.OldPart.Trim() != "" && defect.OldPartSno.Trim() != "") // { // if (product.PCBModel == defect.OldPart.Trim() && // product.PCBID.Trim() == defect.OldPartSno.Trim()) // { // CurrentSession.AddValue(Session.SessionKeys.OldMB, product.PCBID); // product.PCBID = ""; // defect.PartType = "MB"; // product.PCBModel = null; // product.MAC = null; // product.UUID = null; // product.MBECR = null; // product.CVSN = null; // CurrentSession.AddValue(ExtendSession.SessionKeys.PartType, "MB"); // //bSearch = true; // } // else//兩個都有欄,但不匹配的ErrorMessage // { // List<string> errpara = new List<string>(); // errpara.Add(defect.OldPartSno); // FisException e = new FisException("MAT010", errpara); // e.stopWF = false; // throw e; // } // } // else //only sn check // { // CurrentSession.AddValue(Session.SessionKeys.OldMB, product.PCBID); // product.PCBID = ""; // defect.PartType = "MB"; // product.PCBModel = null; // product.MAC = null; // product.UUID = null; // product.MBECR = null; // product.CVSN = null; // CurrentSession.AddValue(ExtendSession.SessionKeys.PartType, "MB"); // //bSearch = true; // } // } // else//LCM1/LCM2 // { // foreach (ProductPart part in productParts) // { // if (defect.OldPart.Trim() != "" && part.PartID.Trim() == defect.OldPart.Trim() || // defect.OldPartSno.Trim() != "" && part.Value.Trim() == defect.OldPartSno.Trim()) // { // //Dean 20110516 即當Faulty Part NO ,Faulty Part Sn 和Product_Part中的數據不匹配 // if (defect.OldPart.Trim() != "" && defect.OldPartSno.Trim() != "") // { // if (part.PartID == defect.OldPart.Trim() && // part.Value.Trim() == defect.OldPartSno.Trim()) // { // //product.RemovePart(part.Value, part.PartID); // defect.PartType = part.PartType; // CurrentSession.AddValue(ExtendSession.SessionKeys.PartType, part.PartType); // if (part.PartType == "LCM1" || part.PartType=="LCM2") // { // bLCMType = true; // } // else // { // product.RemovePart(part.Value, part.PartID); // } // //if (!RemoveLCM1 && part.PartType == "LCM1") RemoveLCM1 = true; // //if (!RemoveLCM2 && part.PartType == "LCM2") RemoveLCM2 = true; // bSearch = true; // break; // } // else //兩個都有欄,但不匹配的ErrorMessage // { // List<string> errpara = new List<string>(); // errpara.Add(defect.OldPartSno); // FisException e = new FisException("MAT010", errpara); // e.stopWF = false; // throw e; // } // } // else //only sn check // { // //product.RemovePart(part.Value, part.PartID); // defect.PartType = part.PartType; // CurrentSession.AddValue(ExtendSession.SessionKeys.PartType, part.PartType); // if (part.PartType == "LCM1" || part.PartType == "LCM2") // { // bLCMType = true; // } // else // { // product.RemovePart(part.Value, part.PartID); // } // bSearch = true; // //if (!RemoveLCM1 && part.PartType == "LCM1") RemoveLCM1 = true; // //if (!RemoveLCM2 && part.PartType == "LCM2") RemoveLCM2 = true; // break; // } // } // } // if (!bSearch) // { // List<string> errpara = new List<string>(); // errpara.Add(defect.OldPart); // FisException e = new FisException("CHK027", errpara); // e.stopWF = false; // throw e; // //throw new FisException("CHK027", errpara); // } // else if (bLCMType) // { // foreach (ProductPart part in productParts) // { // if (part.PartType == "LCM1" || part.PartType == "LCM2") // { // product.RemovePart(part.Value, part.PartID); // } // /*if (RemoveLCM1 || RemoveLCM2) // { // if ((RemoveLCM1 && part.PartType == "LCM2") || // (RemoveLCM2 & part.PartType == "LCM1")) // { // product.RemovePart(part.Value, part.PartID); // } // }*/ // } // } // } // #region Remark // /*if (!bSearch) // { // List<string> errpara = new List<string>(); // errpara.Add(defect.OldPart); // FisException e = new FisException("CHK027", errpara); // e.stopWF = false; // throw e; // //throw new FisException("CHK027", errpara); // } // else // { // foreach (ProductPart part in productParts) // { // if (part.PartType == "LCM1" || part.PartType == "LCM2") // { // product.RemovePart(part.Value, part.PartID); // } // } // }*/ //#endregion //} //oldPart=partRep.GetPartByPartNo(defect.OldPartSno); //if (oldPart == null)//Dean 20110427 //{ // List<string> errpara = new List<string>(); // errpara.Add(defect.OldPart); // throw new FisException("CHK027", errpara); //} //if (string.Compare(FaRepairStation, Station, true) == 0) //{ // if (string.Compare(oldPart.Type, "MB", true) == 0) // { // IMBRepository imr = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); // IProduct tempProduct = ((IProduct)repairTarget); // //update Product table // tempProduct.PCBID = null; // //PCBModel, MAC, UUID, MBECR, CVSN 2010-03 // tempProduct.PCBModel = null; // tempProduct.MAC = null; // tempProduct.UUID = null; // tempProduct.MBECR = null; // tempProduct.CVSN = null; // } // else if (string.Compare(oldPart.Type, "LCM1", true) == 0 || string.Compare(oldPart.Type, "LCM2", true) == 0) // { // List<string> partTypeList = new List<string> {"LCM1", "LCM2"}; // productRep.DeleteProductPartByPartTypeDefered(CurrentSession.UnitOfWork, ((IProduct)repairTarget).ProId, partTypeList); // } //} #endregion original 20110527 if (isReleaseMB ||isReleasePart) productRep.Update(product, CurrentSession.UnitOfWork); return base.DoExecute(executionContext); } catch (FisException ex) { throw; } }
/// <summary> /// /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { Session session = CurrentSession; var CurrentMB = (MB)session.GetValue(Session.SessionKeys.MB); string moNo = CurrentMB.SMTMO; string model = CurrentMB.Model; string custSn = string.Empty; string custVer = string.Empty; string cvsn = string.Empty; string uuid = string.Empty; bool IsRCTO = false; if (session.GetValue(Session.SessionKeys.IsRCTO) != null) { IsRCTO = (bool)session.GetValue(Session.SessionKeys.IsRCTO); } string CheckCode = session.GetValue(Session.SessionKeys.CheckCode) as string; string dateCode = session.GetValue(Session.SessionKeys.DCode) as string; string ecr = session.GetValue(Session.SessionKeys.ECR) as string; string iecVer = session.GetValue(Session.SessionKeys.IECVersion) as string; var MACList = (IList<string>)session.GetValue(Session.SessionKeys.MACList); var MBCTList = (IList<string>)session.GetValue(Session.SessionKeys.MBCTList); var EEPList = (IList<string>)session.GetValue(Session.SessionKeys.EEPList); var NewMBSnList = session.GetValue(Session.SessionKeys.MBNOList) as List<string>; var MBNOList = session.GetValue(Session.SessionKeys.MBNOList) as List<string>; if (IsRCTO && CheckCode !="R") { MBNOList = session.GetValue(Session.SessionKeys.RCTOChildMBSnList) as List<string>; } var MBObjectList = new List<IMB>(); session.AddValue(Session.SessionKeys.MBList, MBObjectList); IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); IPrintLogRepository LogRepository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>(); bool hasPCBVer = false; if (session.GetValue(ExtendSession.SessionKeys.HasPCBVer) != null) { hasPCBVer = (bool)session.GetValue(ExtendSession.SessionKeys.HasPCBVer); if (hasPCBVer) { custVer = (string)session.GetValue(ExtendSession.SessionKeys.PCBVer); } } for (int i = 0; i < MBNOList.Count; i++) { string mac = string.Empty; if (MACList != null) { mac = MACList[i]; } MB mb = new MB(MBNOList[i], moNo, custSn, model, dateCode, mac, uuid, ecr, iecVer, custVer, cvsn, DateTime.Now, DateTime.Now); MBStatus mbStatus = new MBStatus(MBNOList[i], this.Station, MBStatusEnum.Pass, this.Editor, this.Line, DateTime.Now, DateTime.Now); mb.MBStatus = mbStatus; if (IsRCTO && CheckCode != "R") { IMES.FisObject.PCA.MB.MBInfo RCTOChangeInfo = new IMES.FisObject.PCA.MB.MBInfo(0, mb.Sn, "RCTOChange", NewMBSnList[i], Editor, DateTime.Now, DateTime.Now); mb.AddMBInfo(RCTOChangeInfo); } if (EEPList != null) { IMES.FisObject.PCA.MB.MBInfo eepInfo = new IMES.FisObject.PCA.MB.MBInfo(0, mb.Sn, "EEPROM", EEPList[i], Editor, DateTime.Now, DateTime.Now); mb.AddMBInfo(eepInfo); } if (MBCTList != null) { IMES.FisObject.PCA.MB.MBInfo mbctInfo = new IMES.FisObject.PCA.MB.MBInfo(0, mb.Sn, "MBCT", MBCTList[i], Editor, DateTime.Now, DateTime.Now); mb.AddMBInfo(mbctInfo); FruDetInfo newFruDet = new FruDetInfo(); newFruDet.sno = MBCTList[i]; newFruDet.snoId = mb.Sn; newFruDet.tp = "VC"; newFruDet.editor = Editor; newFruDet.cdt = DateTime.Now; newFruDet.udt = newFruDet.cdt; mbRepository.InsertFruDetInfoDefered(session.UnitOfWork, newFruDet); MBLog newCTLog = new MBLog(0, mb.Sn, mb.Model, "SH", 1, "SA SHIPPING LABEL", Editor, DateTime.Now); mb.AddLog(newCTLog); } if (session.GetValue("IsPilotMOCheck") != null && (bool)session.GetValue("IsPilotMOCheck")) { string pilotmo = (string)session.GetValue(Session.SessionKeys.PilotMoNo); mb.SetExtendedProperty(ConstName.PCBInfo.PilotMo, pilotmo, this.Editor); } mb.SetExtendedProperty(ConstName.PCBInfo.ParentMBSN, mb.Sn, this.Editor); MBLog newLog = new MBLog(0, mb.Sn, mb.Model, Station, 1, Line, Editor, DateTime.Now); mb.AddLog(newLog); mbRepository.Add(mb, session.UnitOfWork); MBObjectList.Add(mb); var item = new PrintLog { Name = session.GetValue(Session.SessionKeys.PrintLogName).ToString(), BeginNo = MBNOList[i], EndNo = MBNOList[i], Descr = session.GetValue(Session.SessionKeys.PrintLogDescr).ToString(), Editor = this.Editor }; LogRepository.Add(item, session.UnitOfWork); IMES.FisObject.PCA.MB.MBInfo items = new IMES.FisObject.PCA.MB.MBInfo(); items.InfoType = ConstName.PCBInfo.ChildMBSN; items.InfoValue = mb.Sn; items.Editor = this.Editor; CurrentMB.AddMBInfo(items); } return base.DoExecute(executionContext); }
/// <summary> /// a. 生成 MBSno, b. Insert [PCB], c. Insert [PCBStatus] d. Insert [PCBLog] ,e. Update [PCBStatus] ,f. Insert [PCBLog] ,g. Insert [PCBLog] /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { FisException ex; List<string> erpara = new List<string>(); string mbsno = (string)CurrentSession.GetValue(Session.SessionKeys.MBSN).ToString(); IMBRepository imbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); if ((bool)CurrentSession.GetValue(Session.SessionKeys.IsCheckPass)) { //MBCodeDef mbcode = imbRepository.GetMBCode(mbsno.Substring(0, 2)); MBCodeDef mbcode = new MBCodeDef(); if (mbsno.Substring(5, 1) == "M") mbcode = imbRepository.GetMBCode(mbsno.Substring(0, 3)); else mbcode = imbRepository.GetMBCode(mbsno.Substring(0, 2)); if (mbcode == null) { erpara.Add(mbsno); ex = new FisException("PAK080", erpara); //没有找到MBSno %1 对应的PCB! throw ex; } int unitQty = mbcode.Qty; if (unitQty<=0) { erpara.Add(mbsno); ex = new FisException("PAK081", erpara); // MBCode数据维护不全! throw ex; } // a. 生成 MBSno:a. 生成@unitqty[@i=1..@unitqty]个MBSno, @NewMBSno = left([刷入的MBSno],5) + @i + right([刷入的MBSno],4) string PCBModelID=(string)CurrentSession.GetValue(Session.SessionKeys.PCBModelID); string newMBSno = string.Empty; var MBObjectList = new List<IMB>(); CurrentSession.AddValue(Session.SessionKeys.MBList, MBObjectList); var CurrentMB = (MB)CurrentSession.GetValue(Session.SessionKeys.MB); IList<string> newMBSnoList = new List<string>(); for (int i = 1; i <= unitQty; i++) { newMBSno = mbsno.Substring(0, 5) + i.ToString() + mbsno.Substring(mbsno.Length - 4, 4); //b. Insert [PCB], PCBModelID = [Model]: //c. Insert [PCBStatus] For Every New MB, Status=’1’ Station=’09’: string moNo = CurrentMB.SMTMO; string custSn = ""; string model = CurrentMB.Model; string dateCode = CurrentMB.DateCode; string mac = ""; string uuid = ""; string ecr = ""; string iecVer = ""; string custVer = ""; string cvsn = ""; MB mb = new MB(newMBSno, moNo, custSn, model, dateCode, mac, uuid, ecr, iecVer, custVer, cvsn, DateTime.Now, DateTime.Now); MBStatus mbStatus = new MBStatus(newMBSno, this.Station, MBStatusEnum.Pass, this.Editor, this.Line, DateTime.Now, DateTime.Now); mb.MBStatus = mbStatus; imbRepository.Add(mb, CurrentSession.UnitOfWork); MBObjectList.Add(mb); newMBSnoList.Add(newMBSno); } //d. Insert [PCBLog] For Every New MB, Status=’1’,Station=’09’: 调 WriteMBLog, 成批加入 CurrentSession.AddValue(Session.SessionKeys.MBList, MBObjectList); //e. Update [PCBStatus] For Old MB, Status =2,Station = ‘CL’ --Close : 调 UpdateMBStatus //f. Insert [PCBLog] For Old MB, Status =2,Station = ‘CL’ –Close : 调 WriteMBLog, 单条加入 // g. Insert [IMES_GetData..PrintLog]: CurrentSession.AddValue(Session.SessionKeys.PrintLogName, "MB"); CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, MBObjectList[0].Sn); CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, MBObjectList[MBObjectList.Count-1].Sn); CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, this.Line +" "+ PCBModelID); CurrentSession.AddValue(Session.SessionKeys.MBSNOList, newMBSnoList); } else { erpara.Add(mbsno); ex = new FisException("CHK161", erpara); //MB号:%1错误! throw ex; } // CurrentSession.AddValue(Session.SessionKeys. return base.DoExecute(executionContext); }
/// <summary> /// update mb status /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { var mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); var mb = CurrentSession.GetValue(Session.SessionKeys.MB) as IMB; var station = this.Station; if (this.IsPass == MBStatusEnum.CL) { station = "CL"; } if (!string.IsNullOrEmpty(ManualStation)) { string mStation = CurrentSession.GetValue(ManualStation) as string; if (mStation != null) { station = mStation; } } string line = default(string); if (string.IsNullOrEmpty(this.Line)) { line = mb.MBStatus.Line; } else { line = this.Line; } string AllowPass = ""; if (CurrentSession.GetValue(ExtendSession.SessionKeys.AllowPass) != null) { AllowPass = (string)CurrentSession.GetValue(ExtendSession.SessionKeys.AllowPass); } MBStatus status = null; if (AllowPass == "N" && this.IsPass == MBStatusEnum.Fail) { status = new MBStatus(mb.Key.ToString(), station, this.IsPass, 999, this.Editor, line, DateTime.Now, DateTime.Now); } else { status = new MBStatus(mb.Key.ToString(), station, this.IsPass, this.Editor, line, DateTime.Now, DateTime.Now); } #region recode PCBStatusEx for table structure IList<TbProductStatus> preStatusList = mbRepository.GetMBStatus(new List<string>() { mb.Sn }); mbRepository.UpdatePCBPreStationDefered(CurrentSession.UnitOfWork, preStatusList); #endregion #region record previous PCB Status //IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); //System.Data.DataTable preStatus = CreateDataTable.CreateProductStatusTb(); //preStatus.Rows.Add(mb.Sn, // mb.MBStatus.Station, // mb.MBStatus.Status== MBStatusEnum.Pass ? 1 : 0, // "", // mb.MBStatus.Line, // mb.MBStatus.TestFailCount, // mb.MBStatus.Editor, // //mb.MBStatus.Udt.ToString("yyyy-MM-dd HH:mm:ss.fff") // mb.MBStatus.Udt // ); //System.Data.DataTable curStatus = CreateDataTable.CreateProductStatusTb(); //curStatus.Rows.Add(mb.Sn, // status.Station, // status.Status == MBStatusEnum.Pass ? 1 : 0, // "", // status.Line, // status.TestFailCount, // status.Editor, // //status.Udt.ToString("yyyy-MM-dd HH:mm:ss.fff") // status.Udt // ); //SqlParameter para1 = new SqlParameter("PreStatus", System.Data.SqlDbType.Structured); //para1.Direction = System.Data.ParameterDirection.Input; //para1.Value = preStatus; //SqlParameter para2 = new SqlParameter("Status", System.Data.SqlDbType.Structured); //para2.Direction = System.Data.ParameterDirection.Input; //para2.Value = curStatus; //productRepository.ExecSpForNonQueryDefered(CurrentSession.UnitOfWork, // IMES.Infrastructure.Repository._Schema.SqlHelper.ConnectionString_PCA, // "IMES_UpdatePCBStatus", // para1, // para2); #endregion mb.MBStatus = status; mbRepository.Update(mb, CurrentSession.UnitOfWork); return base.DoExecute(executionContext); }
/// <summary> /// /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { Session session = CurrentSession; ActivityCommonImpl utl = ActivityCommonImpl.Instance; IMB parentMB = utl.IsNull<IMB>(session, Session.SessionKeys.MB); IList<String> sbSNList = session.GetValue(ExtendSession.SessionKeys.SmallBoardSNList) as IList<string>; if (sbSNList == null || sbSNList.Count == 0) { return base.DoExecute(executionContext); } IList<String> smallBoardPartNoList = utl.IsNull <IList<String>>(session, ExtendSession.SessionKeys.SmallBoardPartNoList) as IList<string>; IList<String> smallBoardECRList = utl.IsNull <IList<String>>(session, ExtendSession.SessionKeys.SmallBoardECRList) as IList<string>; string moNo = parentMB.SMTMO; string custSn = string.Empty; string custVer = string.Empty; string cvsn = parentMB.Sn; string uuid = string.Empty; string mac = string.Empty; string dateCode = session.GetValue(Session.SessionKeys.DCode) as string; //string ecr = session.GetValue(Session.SessionKeys.ECR) as string; //string iecVer = session.GetValue(Session.SessionKeys.IECVersion) as string; var sbMBList = new List<IMB>(); session.AddValue(ExtendSession.SessionKeys.SmallBoardMBList, sbMBList); IMBRepository mbRep = utl.mbRep; IPrintLogRepository LogRep = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>(); int index=0; foreach (string sn in sbSNList) { string model = smallBoardPartNoList[index]; string[] ecrList = smallBoardECRList[index].Split(GlobalConstName.SlashChar); string ecr = ecrList[0]; string iecVer = ecrList[1]; string[] sbSN = sn.Split(GlobalConstName.SlashChar); MB mb = new MB(sbSN[0], moNo, custSn, model, dateCode, mac, uuid, ecr, iecVer, custVer, cvsn, DateTime.Now, DateTime.Now); MBStatus mbStatus = new MBStatus(sbSN[0], this.Station, MBStatusEnum.Pass, this.Editor, this.Line, DateTime.Now, DateTime.Now); mb.MBStatus = mbStatus; MBLog newLog = new MBLog(0, mb.Sn, mb.Model, Station, 1, Line, Editor, DateTime.Now); mb.AddLog(newLog); if (this.IsSplitMB) { mb.SetExtendedProperty(ConstName.PCBInfo.ChildMBSN, sbSN[1], this.Editor); } else { mb.SetExtendedProperty(ConstName.PCBInfo.ChildMBSN, parentMB.Sn, this.Editor); } mb.SetExtendedProperty(ConstName.PCBInfo.ParentMBSN, parentMB.Sn, this.Editor); mb.SetExtendedProperty(ConstName.PCBInfo.IsSmallBoard, ConstName.Letter.Y, this.Editor); mbRep.Add(mb, session.UnitOfWork); sbMBList.Add(mb); var item = new PrintLog { Name = PrintLogName, BeginNo = sn, EndNo = sn, Station = this.Station, Cdt = DateTime.Now, LabelTemplate = string.Empty, Descr =string.Format(PrintLogDescr,mb.Sn, sbSN[1], sbSN[0]) , Editor = this.Editor }; LogRep.Add(item, session.UnitOfWork); IMES.FisObject.PCA.MB.MBInfo items = new IMES.FisObject.PCA.MB.MBInfo(); items.InfoType = ConstName.PCBInfo.ChildMBSN; items.InfoValue = mb.Sn; items.Editor = this.Editor; parentMB.AddMBInfo(items); index++; } return base.DoExecute(executionContext); }
/// <summary> /// GenerateMBSn /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { string moNo; string model; string dateCode; string custSn; var mbmo = (IMBMO)CurrentSession.GetValue(Session.SessionKeys.MBMO); if (mbmo == null) { var CurrentMB = (MB)CurrentSession.GetValue(Session.SessionKeys.MB); moNo = CurrentMB.SMTMO; model = CurrentMB.Model; dateCode = CurrentMB.DateCode; custSn = ""; //CurrentMB.CustSn; //由于改过Kenel后报错,jiali Add } else { moNo = mbmo.MONo; model = mbmo.Model; dateCode = CurrentSession.GetValue(Session.SessionKeys.DateCode).ToString(); //由于改过Kenel后报错,jiali Add custSn = "";// CurrentSession.Customer; } IList MBNOList = new ArrayList(); MBNOList = (IList)CurrentSession.GetValue(Session.SessionKeys.MBNOList); var MBObjectList = new List<IMB>(); IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); // add check replaceMB case bool isReplaceMB=false; if (CurrentSession.GetValue(ExtendSession.SessionKeys.IsReplaceMB)!=null) { isReplaceMB = (bool)CurrentSession.GetValue(ExtendSession.SessionKeys.IsReplaceMB); } if (!isReplaceMB) { foreach (string item in MBNOList) { string mac = ""; string uuid = ""; string ecr = ""; string iecVer = ""; string custVer = ""; string cvsn = ""; if (this.Station == "VG") { ecr = "00000"; } //由于改过Kenel后报错,jiali Add custSn MB mb = new MB(item, moNo, custSn, model, dateCode, mac, uuid, ecr, iecVer, custVer, cvsn, DateTime.Now, DateTime.Now); MBStatus mbStatus = new MBStatus(item, this.Station, MBStatusEnum.Pass, this.Editor, this.Line, DateTime.Now, DateTime.Now); mb.MBStatus = mbStatus; mbRepository.Add(mb, CurrentSession.UnitOfWork); MBObjectList.Add(mb); } } else { string oldMBSN = (string)CurrentSession.GetValue(Session.SessionKeys.OldMB); string newMBSN = MBNOList[0].ToString(); string reason = (string)CurrentSession.GetValue(ExtendSession.SessionKeys.ChangMBReason); // Change to one Child MB SN for only one //newMBSN = newMBSN.Substring(0, 5) + oldMBSN.Substring(5, 1) + newMBSN.Substring(6, 4); if (newMBSN.Substring(5, 1) == "M" || newMBSN.Substring(5, 1) == "B") { if (oldMBSN.Substring(5, 1) == "M" || oldMBSN.Substring(5, 1) == "B") newMBSN = newMBSN.Substring(0, 6) + oldMBSN.Substring(6, 1) + newMBSN.Substring(7, 4); else newMBSN = newMBSN.Substring(0, 6) + oldMBSN.Substring(5, 1) + newMBSN.Substring(7, 4); } else { if (oldMBSN.Substring(5, 1) == "M" || oldMBSN.Substring(5, 1) == "B") newMBSN = newMBSN.Substring(0, 5) + oldMBSN.Substring(6, 1) + newMBSN.Substring(6, 4); else newMBSN = newMBSN.Substring(0, 5) + oldMBSN.Substring(5, 1) + newMBSN.Substring(6, 4); } MBNOList[0] = newMBSN; //Jiali Add MBChangeLogRepository mbchange = new MBChangeLogRepository(); MBChangeLog mbchangelog = new MBChangeLog(oldMBSN, newMBSN, reason, Editor, DateTime.Now); mbchange.Add(mbchangelog, CurrentSession.UnitOfWork); mbRepository.ReplaceMBSn(oldMBSN, newMBSN); MBObjectList.Add(mbRepository.Find(newMBSN)); } CurrentSession.AddValue(Session.SessionKeys.MBList, MBObjectList); return base.DoExecute(executionContext); }
/// <summary> /// Update SMTMO /// Insert MoDismantleLog /// 删除PCB,更新PCBStatus,Insert PCB Log /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { //FisException ex; //List<string> erpara = new List<string>(); IList<string> mbsnlist = (List<string>)CurrentSession.GetValue(Session.SessionKeys.MBNOList); if (mbsnlist != null && mbsnlist.Count > 0) { IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); //// Update SMTMO IMBMORepository mbmoRepository = RepositoryFactory.GetInstance().GetRepository<IMBMORepository, IMBMO>(); IMBMO mbmoObject = (IMBMO)CurrentSession.GetValue(Session.SessionKeys.MBMO); mbmoObject.PrintedQty = mbmoObject.PrintedQty - mbsnlist.Count; CurrentSession.AddValue(Session.SessionKeys.MBMO, mbmoObject); mbmoRepository.Update(mbmoObject, CurrentSession.UnitOfWork); // Insert MoDismantleLog // Delete PCB/PCBStatus var disReason = CurrentSession.GetValue(Session.SessionKeys.Reason).ToString(); IList<MODismantleLog> modislogs = new List<MODismantleLog>(); IList<IMB> mbs = new List<IMB>(); IList<MBStatus> mbstatuslist=new List<MBStatus>(); IList<MBLog> mbloglist = new List<MBLog>(); foreach (string mbsno in mbsnlist) { IMB mbobject = mbRepository.Find(mbsno); MODismantleLog modisObject = new MODismantleLog(mbsno, "SMTMo", mbobject.SMTMO, disReason, this.Editor, DateTime.Now, 0); MBStatus mbstatus = new MBStatus(mbsno, this.Station, MBStatusEnum.Pass, this.Editor, this.Line, DateTime.Now, DateTime.Now); MBLog mblog = new MBLog(0, mbsno, mbobject.Model, this.Station, 1, this.Line, this.Editor, DateTime.Now); modislogs.Add(modisObject); mbs.Add(mbobject); mbstatuslist.Add(mbstatus); mbloglist.Add(mblog); } IMODismantleLogRepository modismRepository = RepositoryFactory.GetInstance().GetRepository<IMODismantleLogRepository, MODismantleLog>(); modismRepository.AddBatchDefered(CurrentSession.UnitOfWork, modislogs); mbRepository.RemoveBatchDefered(CurrentSession.UnitOfWork, mbs); //<Gao Yongbo> 修改为只删除PCB,更新PCBStatus,Insert PCB Log mbRepository.UpdateMBStatusBatchDefered(CurrentSession.UnitOfWork, mbstatuslist); mbRepository.AddMBLogBatchDefered(CurrentSession.UnitOfWork, mbloglist); } # region "old" // // 针对[Start MB SNo],[End MB SNo] 范围内的每一个MB SNo,都要进行如下操作: // // Update SMTMO // //PrintQty ITC-1103-0148 // IMBMO mbmoObject = (IMBMO)CurrentSession.GetValue(Session.SessionKeys.MBMO); // mbmoObject.PrintedQty = mbmoObject.PrintedQty - 1; // CurrentSession.AddValue(Session.SessionKeys.MBMO, mbmoObject); // mbmoRepository.Update(mbmoObject, CurrentSession.UnitOfWork); // // Insert MoDismantleLog // //参考方法: // //INSERT MoDismantleLog SELECT PCBNo,'SMTMo',SMTMO,@reason,@Editor,GETDATE() FROM PCB (nolock) WHERE PCBNo = @mbsno // IMODismantleLogRepository modismRepository = RepositoryFactory.GetInstance().GetRepository<IMODismantleLogRepository, MODismantleLog>(); // //(string pcbNo, string tp, string smtMo, string reason, string editor, DateTime cdt, int id) //var disReason=CurrentSession .GetValue(Session.SessionKeys.Reason).ToString(); // MODismantleLog modisObject = new MODismantleLog(mbSn, "SMTMo",mbobject.SMTMO,disReason,this.Editor,DateTime.Now,0); // modismRepository.Add(modisObject, CurrentSession.UnitOfWork); // // Delete PCB/PCBStatus // //由于投产的MB 不允许进行Dismantle,因此,没有必要清理PCB_Parts // mbRepository.Remove(mbobject, CurrentSession.UnitOfWork); # endregion return base.DoExecute(executionContext); }
// // GET: /MBStatus/Edit/5 [Authorize] public ActionResult Edit(int id) { MBStatus obj = db.GetMBStatus(id); return(View(obj)); }
/// <summary> /// 执行修改MBStatus的Station,Status,Editor /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { IMB currentMB = (IMB)CurrentSession.GetValue(Session.SessionKeys.MB); MBStatus newMBStatus = new MBStatus(currentMB.Sn, "CL", MBStatusEnum.CL, this.Editor, this.Line, DateTime.Now, DateTime.Now); currentMB.MBStatus = newMBStatus; IMBRepository currentMBRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); currentMBRepository.Update(currentMB, CurrentSession.UnitOfWork); return base.DoExecute(executionContext); }
/// <summary> /// Bind pat to owner: /// A.Product.PCBID=mb sn# ///B.需要修改MB 的PCA..PCBStatus.Station = 32 ///C.记录MB Log Inert PCA..PCBLog ///D.将MB相关信息写入Product表: ///Product.PCBModel=PCA..PCB.PCBModelID ///Product. MAC =PCA..PCB. MAC ///Product. UUID =PCA..PCB. UUID ///Product. MBECR =PCA..PCB. ECR /// </summary> /// <param name="part">part</param> /// <param name="owner">owner</param> public override void BindTo(IProductPart part, IPartOwner owner) { // if (!part.ValueType.Equals(("SN"))) // { // base.BindTo(part, owner); // return; // } var product = (IProduct)owner; Session session = SessionManager.GetInstance.GetSession(product.ProId, Session.SessionType.Product); var productRepoistory = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); var mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); var mb = mbRepository.Find(part.Value); string line = string.IsNullOrEmpty(session.Line) ? product.Status.Line : session.Line; //A product.PCBID = mb.Sn; //B var status = new MBStatus(mb.Key.ToString(), "32", MBStatusEnum.Pass , session.Editor, line, DateTime.Now, DateTime.Now); mb.MBStatus = status; //C var mbLog = new MBLog( 0, mb.Sn, mb.Model, "32", 1, line, session.Editor, DateTime.Now); mb.AddLog(mbLog); //D product.PCBModel = mb.Model; product.MAC = mb.MAC; product.UUID = mb.UUID; product.MBECR = mb.ECR; product.CVSN = mb.CVSN; mbRepository.Update(mb, session.UnitOfWork); productRepoistory.Update(product, session.UnitOfWork); }
/// <summary> /// 檢查QTime 及設定QTime Action /// </summary> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { Session session = CurrentSession; ActivityCommonImpl utl = ActivityCommonImpl.Instance; IProductRepository prodRep = utl.prodRep; //RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); IMBRepository mbRep = utl.mbRep; IQTimeRepository qTimeRep = RepositoryFactory.GetInstance().GetRepository<IQTimeRepository, QTime>(); ILineRepository lineRep = utl.lineRep; //RepositoryFactory.GetInstance().GetRepository<ILineRepository, Line>(); DateTime now=DateTime.MinValue; #region 檢查 Product ,QTime及LineEx 設置資料,若無,則不做 string pdline = this.Line; IProduct prod =null; IMB mb =null; string SN = null; string modelName = null; string familyName = null; DateTime udt = DateTime.Now; string preStation = null; if (this.ProcessType == ProcessTypeEnum.Product) { prod = utl.IsNull<IProduct>(session,Session.SessionKeys.Product); modelName = prod.Model; SN = prod.ProductID; familyName = prod.Family; udt = prod.Status.Udt; preStation = prod.Status.StationId.Trim(); if (string.IsNullOrEmpty(pdline)) { pdline = prod.Status.Line; if (string.IsNullOrEmpty(pdline)) { IList<ProductStatusExInfo> preStatusList = prodRep.GetProductPreStation(new List<string> { prod.ProId }); if (preStatusList.Count > 0) { pdline = preStatusList[0].PreLine; } } } } else { mb = utl.IsNull<IMB>(session, Session.SessionKeys.MB); modelName = mb.Model; SN = mb.Sn; familyName = mb.Family; udt = mb.MBStatus.Udt; preStation = mb.MBStatus.Station; if (string.IsNullOrEmpty(pdline)) { pdline = mb.MBStatus.Line; if (string.IsNullOrEmpty(pdline)) { IList<PCBStatusExInfo> preStatusList = mbRep.GetPCBPreStation(new List<string> { mb.Sn }); if (preStatusList.Count > 0) { pdline = preStatusList[0].PreLine; } } } } Line line = lineRep.Find(pdline); if (prod==null || line == null || line.LineEx == null || string.IsNullOrEmpty(line.LineEx.AliasLine)) { //throw new FisException(); return base.DoExecute(executionContext); } string aliasLine = line.LineEx.AliasLine; //QTime qTime = qTimeRep.Find(new string[] { aliasLine, this.Station, prod.ProId }); QTime qTime = qTimeRep.GetPriorityQTime(aliasLine, this.Station, SN,modelName, familyName); if (qTime == null ) { return base.DoExecute(executionContext); } #endregion #region 檢查QTime.StopTime,計算是否紀錄停線,不做DB事務 if (qTime != null && qTime.StopTime > 0) { LineStationLastProcessTime processTime= qTimeRep.GetLastProcessTime(aliasLine, this.Station); if (processTime != null) { now = processTime.Now; if (processTime.SpeedTime >= qTime.StopTime) { LineStationStopPeriodLog periodLog = new LineStationStopPeriodLog { Line = aliasLine, Station = this.Station, StartTime = processTime.ProcessTime, EndTime = now, Editor = this.Editor }; qTimeRep.AddLineStationStopPeriodLog(periodLog); } } // 沒有最後一次Process Time 不考慮Check TimeOut else { now = SqlHelper.GetDateTime(); } processTime = new LineStationLastProcessTime { Line = aliasLine, Station = this.Station, ProductID = SN, ProcessTime = now, Editor = this.Editor }; qTimeRep.UpdateLineStationLastProcessTime(processTime); //刪除過時的停線紀錄 qTimeRep.RemoveStationStopPeriodLog(aliasLine, this.Station, this.RemainLogDay); } #endregion #region 檢查TimeOut ,計算是否QTime逾時並執行QTime Action IUnitOfWork uow = new UnitOfWork(); bool isDoDefect = false; bool isDoHoldStation = false; string defectStation = this.Station; int timeOut = 0; //int stopTime = 0; bool isCheckTimeOutStation = true; bool isTimeOut = false; //string preStation = prod.Status.StationId.Trim(); TestLog.TestLogStatus defectStatus = TestLog.TestLogStatus.Fail; //檢查TimeOut例外站點 if (!string.IsNullOrEmpty(qTime.ExceptStation)) { string[] exceptStations = qTime.ExceptStation.Split(Delimiter); isCheckTimeOutStation = !exceptStations.Contains(preStation); } if (qTime != null && qTime.TimeOut > 0 && isCheckTimeOutStation) { if (now == DateTime.MinValue) { now = SqlHelper.GetDateTime(); } //計算TimeOut //IList<int> timeOutList = qTimeRep.CalLineStopTime(aliasLine, "69", prod.Status.Udt, now); //stopTime = timeOutList[0]; //timeOut = (timeOutList[1] - timeOutList[0]) ; IList<LineStopLogInfo> logs = qTimeRep.CalLineStopMillionSecond(aliasLine, this.Station, udt, now); double stopMillionSecond = 0; foreach( LineStopLogInfo item in logs) { stopMillionSecond = stopMillionSecond + (item.EndTime - item.StartTime).TotalMilliseconds; } timeOut = (int)(((now - udt).TotalMilliseconds - stopMillionSecond) / 1000); // 判別有沒有TimeOut if ((qTime.Category == QTimeCategoryEnum.Max && timeOut >= qTime.TimeOut) || (qTime.Category == QTimeCategoryEnum.Min && timeOut <= qTime.TimeOut)) { isTimeOut = true; if (!string.IsNullOrEmpty(qTime.DefectCode)) { isDoDefect = true; } if (!string.IsNullOrEmpty(qTime.HoldStation)) { defectStation = qTime.HoldStation; defectStatus = (qTime.HoldStatus == QTimeStationStatusEnum.Fail ? TestLog.TestLogStatus.Fail : TestLog.TestLogStatus.Pass); isDoHoldStation = true; } } //執行QTime Action if (isDoDefect || isDoHoldStation) { if (this.ProcessType == ProcessTypeEnum.Product) { prod.UpdateStatus(new IMES.FisObject.FA.Product.ProductStatus() { Line = pdline, ProId = SN, TestFailCount = 0, ReworkCode = string.Empty, StationId = defectStation, Status = (defectStatus == TestLog.TestLogStatus.Fail ? StationStatus.Fail : StationStatus.Pass), Editor = this.Editor, Udt = now }); IList<IMES.DataModel.TbProductStatus> stationList = prodRep.GetProductStatus(new List<string> { prod.ProId }); prodRep.UpdateProductPreStationDefered(uow, stationList); #region write Productlog ProductLog productLog = new ProductLog { Model = prod.Model, Status = (defectStatus == TestLog.TestLogStatus.Fail ? StationStatus.Fail : StationStatus.Pass), Editor = this.Editor, Line = pdline, Station = defectStation, Cdt = now }; prod.AddLog(productLog); } else { MBStatus mbStatus= new MBStatus(SN, defectStation, (defectStatus == TestLog.TestLogStatus.Fail ? MBStatusEnum.Fail : MBStatusEnum.Pass), this.Editor, pdline, now, now); mb.MBStatus = mbStatus; IList<TbProductStatus> preStatusList = mbRep.GetMBStatus(new List<string>() { SN }); mbRep.UpdatePCBPreStationDefered(uow, preStatusList); #region Write MBlog var mbLog = new MBLog( 0, mb.Sn, mb.Model, defectStation, (defectStatus == TestLog.TestLogStatus.Fail ? 0 : 1), pdline, this.Editor, now); mb.AddLog(mbLog); #endregion } #endregion } //unpack Pizza part if (this.ProcessType == ProcessTypeEnum.Product && isDoHoldStation && defectStation == UnPizzaDefectStation) { utl.UnPack.unPackPizzaPart(session, uow, this.Editor); utl.UnPack.unPackPAKProductPart(session, uow, this.Editor); prodRep.DeleteProductPartByProductIDAndStationDefered(uow, new List<string>() { SN }, UnpackPizzaStationList, this.Editor); } if (isDoDefect) { #region add test log string actionName = qTime.Category.ToString() + QTIMEName; string errorCode = string.Empty; string descr = string.Format(DefectDescrFormat, preStation, this.Station, timeOut.ToString()); //"PreStation:"+preStation+ "~CurStation:"+this.Station +"~TimeOut:"+ timeOut.ToString(); //TestLog testLog = new TestLog(0, prod.ProId, this.Line, "", defectStation, defectStatus, "", this.Editor, "PRD", DateTime.Now); TestLog testLog = new TestLog(0, SN, pdline, string.Empty, defectStation, defectStatus, string.Empty, actionName, errorCode, descr, this.Editor, DefectType, now); if (this.ProcessType == ProcessTypeEnum.Product) { prod.AddTestLog(testLog); //add defect TestLogDefect defectItem = new TestLogDefect(0, 0, qTime.DefectCode, this.Editor, now); testLog.AddTestLogDefect(defectItem); } else { mb.AddTestLog(testLog); TestLogDefect defectItem = new TestLogDefect(0, 0, qTime.DefectCode, this.Editor, now); testLog.AddTestLogDefect(defectItem); } #endregion } if (isDoDefect || isDoHoldStation) { if (this.ProcessType == ProcessTypeEnum.Product) { prodRep.Update(prod, uow); } else { mbRep.Update(mb, uow); } uow.Commit(); if (qTime.Category == QTimeCategoryEnum.Min) { int diffTime = (timeOut - qTime.TimeOut) / 60; throw new FisException("CHK093", new string[] { diffTime.ToString() }); } else { throw new FisException("QTM001", new string[] { SN, qTime.Category.ToString() + QTIMEName, timeOut.ToString() }); } } //Min QTime Warning message nothing to do if (isTimeOut && qTime.Category == QTimeCategoryEnum.Min) { int diffTime = (timeOut - qTime.TimeOut) / 60; throw new FisException("CHK093", new string[]{diffTime.ToString()}); } } #endregion return base.DoExecute(executionContext); }