/// <summary> /// Update/Insert ForceNWC. /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); IProduct currentProduct = ((Product)CurrentSession.GetValue(Session.SessionKeys.Product)); string retWC = (string)CurrentSession.GetValue(Session.SessionKeys.ReturnStation); ForceNWCInfo item = new ForceNWCInfo(); item.editor = Editor; item.forceNWC = retWC; item.preStation =currentProduct.Status.StationId; ForceNWCInfo cond = new ForceNWCInfo(); cond.productID = currentProduct.ProId; if (partRepository.CheckExistForceNWC(cond)) { partRepository.UpdateForceNWCDefered(CurrentSession.UnitOfWork, item, cond); } else { item.productID = currentProduct.ProId; partRepository.InsertForceNWCDefered(CurrentSession.UnitOfWork, item); } return base.DoExecute(executionContext); }
public List<string> UploadSnForSorting(List<string> snList,string station,string editor,string line,string customer) { string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; logger.DebugFormat("BEGIN: {0}(snList:{1},station:{2},editor:{3},line:{4},customer:{5})", methodName,string.Join(",",snList.ToArray()),station,editor,line,customer); try { List<string> rst = new List<string>(); IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>(); string preStation = ""; int success = 0; int fail = 0; CommonImpl com = new CommonImpl(); List<string> failMsg = new List<string>(); List<IMES.FisObject.FA.Product.IProduct> prdList = new List<IMES.FisObject.FA.Product.IProduct>(); IList<IMES.DataModel.ConstValueTypeInfo> lstConst = partRep.GetConstValueTypeList("AllowSortingStation"); foreach (string sn in snList) { IMES.FisObject.FA.Product.IProduct product = productRepository.GetProductByIdOrSn(sn); if (product == null) { throw new FisException(sn + " is not correct ProductID or CustomerSN!!"); } if (!lstConst.Any(x => x.value.Equals(product.Status.StationId))) { throw new FisException(sn + " has to do pizzakitting before sorting!!"); } prdList.Add(product); } // foreach (string sn in snList) foreach (IMES.FisObject.FA.Product.IProduct prdObj in prdList) { try { // IProduct product = productRepository.GetProductByIdOrSn(sn); if (prdObj != null) { ForceNWCInfo cond = new ForceNWCInfo(); cond.productID = prdObj.ProId; preStation = prdObj.Status.StationId; if (partRep.CheckExistForceNWC(cond)) { partRep.UpdateForceNWCByProductID(station, preStation, prdObj.ProId); } else { ForceNWCInfo newinfo = new ForceNWCInfo(); newinfo.editor = editor; newinfo.forceNWC = station; newinfo.preStation = preStation; newinfo.productID = prdObj.ProId; partRep.InsertForceNWC(newinfo); } success++; } else { rst.Add(prdObj.CUSTSN + " Fail: Product not exist"); fail++; } } catch (Exception e) { failMsg.Add(prdObj.CUSTSN + " error:" + e.Message); } } rst.AddRange(failMsg.ToArray()); rst.Insert(0, "Success: " + success.ToString() + " sn"); if (fail > 0) { rst.Insert(1, "Fail: " + fail.ToString() + " sn"); } return rst; } catch (FisException e) { logger.Error(e.mErrmsg, e); throw new Exception(e.mErrmsg); } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.DebugFormat("END: {0}()", methodName); } }
/// <summary> /// Update/Insert ForceNWC. /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); IProduct currentProduct = ((Product)CurrentSession.GetValue(Session.SessionKeys.Product)); string retWC = (string)CurrentSession.GetValue(Session.SessionKeys.ReturnStation); ForceNWCInfo item = new ForceNWCInfo(); item.editor = Editor; item.forceNWC = retWC; //item.preStation = "RK"; item.preStation = this.PreStation.Trim(); /* * Answer to: ITC-1360-1106 * Description: Use CheckExistForceNWC to check if record exists. */ ForceNWCInfo cond = new ForceNWCInfo(); cond.productID = currentProduct.ProId; if (IsClearForceNWC) { item.forceNWC = ""; item.preStation = ""; cond.forceNWC = this.Station; cond.preStation = (string)CurrentSession.GetValue("ForceNWCPreStation"); partRepository.UpdateForceNWCDefered(CurrentSession.UnitOfWork, item, cond); } else { if (partRepository.CheckExistForceNWC(cond)) { partRepository.UpdateForceNWCDefered(CurrentSession.UnitOfWork, item, cond); } else { item.productID = currentProduct.ProId; partRepository.InsertForceNWCDefered(CurrentSession.UnitOfWork, item); } } return base.DoExecute(executionContext); }
/// <summary> /// 根据Product,删除 ProductInfo表中的IMEI数据 /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { List<string> erpara = new List<string>(); string sKeyParts = (string)CurrentSession.GetValue(Session.SessionKeys.KPType); string sReturnStation = (string)CurrentSession.GetValue(Session.SessionKeys.ReturnStation); var currentProduct = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product); IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); //Update [ForceNWC] [ForceNWC]=ReturnStation# [PreStation]= 'DM' Where [ProductID]= ProductID# //DEBUG ITC-1360-0405 //? DELETE productRepository.DeleteProductInfoByProIdDefered(CurrentSession.UnitOfWork, currentProduct.ProId); //ADD:如果ForceNWC不存在此ProductID的记录,需要执行Insert ForceNWC //Modify UC: [PreStation]= 'DM'->38 -2012/03/09 ForceNWCInfo cond = new ForceNWCInfo(); cond.productID = currentProduct.ProId; bool bExist = false; bExist = partRepository.CheckExistForceNWC(cond); if (bExist == true) { partRepository.UpdateForceNWCByProductIDDefered(CurrentSession.UnitOfWork, sReturnStation, "38", currentProduct.ProId); } else { ForceNWCInfo item = new ForceNWCInfo(); item.editor = this.Editor; item.forceNWC = sReturnStation; item.preStation = "38"; item.productID = currentProduct.ProId; partRepository.InsertForceNWCDefered(CurrentSession.UnitOfWork, item); } string Dismantletype = CurrentSession.GetValue("Dismantletype") as string; if (Dismantletype == "KP" && sKeyParts.ToUpper() == "CPU") { // mantis 538 Session session = CurrentSession; //if (ActivityCommonImpl.Instance.NeedCheckMaterialCpuStatus(currentProduct, currentProduct.CVSN, ref session)) //{ ActivityCommonImpl.Instance.Material.UpdateMaterialCpuStatus(currentProduct.CVSN, "FA Dismantle", "Dismantle", true, false, ref session); //} } //delete 相关信息Delete from Product_Part where ProductID=productID# and PartType=KP# currentProduct.RemovePartsByType(sKeyParts); //ITC-1360-0124 add update method-->Delete from Product_Part where ProductID=productID# and PartType=KP# productRepository.Update(currentProduct, CurrentSession.UnitOfWork); return base.DoExecute(executionContext); }
/// <summary> /// /// </summary> /// <param name="prodList"></param> /// <param name="editor"></param> /// <param name="station"></param> /// <param name="customer"></param> /// <returns></returns> public ArrayList CheckProdList(IList<string> prodList, string editor, string station, string customer) { logger.Debug("(ProductReinputImpl)CheckProdList start"); try { ArrayList retList = new ArrayList(); IList<DataModel.ProductInfo> failList = new List<DataModel.ProductInfo>(); IList<DataModel.ProductInfo> okList = new List<DataModel.ProductInfo>(); IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>(); IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); IStationRepository stationRep = RepositoryFactory.GetInstance().GetRepository<IStationRepository>(); foreach (string node in prodList) { IMES.FisObject.FA.Product.IProduct curProduct = null; DataModel.ProductInfo prod = new DataModel.ProductInfo(); curProduct = productRep.FindOneProductWithProductIDOrCustSN(node); if (curProduct == null) { //[Fail List].Cause = ‘不存在’ prod.customSN = node; prod.id = node; prod.familyId = "不存在"; failList.Add(prod); } else { prod.id = curProduct.ProId; prod.customSN = curProduct.CUSTSN; prod.modelId = curProduct.Status.StationId; prod.familyId =""; switch (curProduct.Status.StationId) { case "73": //若ProductStatus.Station = ‘73’,则在[Fail List]添加显示: //[Fail List].Cause = ‘EPIA抽中,需刷出’ prod.familyId ="EPIA抽中,需刷出"; break; case"71": //若ProductStatus.Station = ‘71,则在[Fail List]添加显示: //[Fail List].ProdId/CustSN = [ProductID]/[CustSN] //[Fail List].Cause = ‘PIA抽中,需刷出’ prod.familyId = "PIA抽中,需刷出"; break; default: break; } //获取@StationS = SysSetting.Value( Condtion: SysSetting.Name = ‘FAReturnStation’), //若ProductStatus.Station不在@StationS中,则在[Fail List]添加显示: //[Fail List].Cause = ‘不在FA’ IList<string> valueList = new List<string>(); valueList = partRep.GetValueFromSysSettingByName("FAReturnStation"); if (!valueList[0].Contains(curProduct.Status.StationId)) { prod.familyId = "不在FA"; } //ProductStatus.Station<>’45’、’76’和’7P’, //则获取@ForceNWC(ForceNWC.ForceNWC Condtion: ForceNWC.PreStation=ProductStatus.Station and ProductID=[ProductID]) //若@ForceNWC不为空,且不为Null,则在[Fail List]添加显示: //[Fail List].Cause = ‘必须去刷 ’+Station.Descr(Station.Station=@ForceNWC) string tmpsta="45,76,7P"; if (tmpsta.IndexOf(curProduct.Status.StationId) < 0) { ForceNWCInfo cond = new ForceNWCInfo(); cond.productID = curProduct.ProId; cond.preStation = curProduct.Status.StationId; IList<ForceNWCInfo> flist = partRep.GetForceNWCListByCondition(cond); if (flist.Count > 0) { IStation curstation = stationRep.Find(flist[0].forceNWC); prod.familyId = "必须去刷 " + curstation.Descr; } } // mantis 1558 if (curProduct.Status.Status.Equals(StationStatus.Fail)) prod.familyId = "存在不良"; if (string.IsNullOrEmpty(prod.familyId)) { okList.Add(prod); } else { failList.Add(prod); } } } retList.Add(okList); retList.Add(failList); return retList; } catch (FisException e) { logger.Error(e.mErrmsg, e); throw new Exception(e.mErrmsg); } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("(ProductReinputImpl)CheckProdList end"); } }
/// <summary> /// 执行根据DeliveryNo修改所有属于该DeliveryNo的Product状态的操作 /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { Product currentProduct = ((Product)CurrentSession.GetValue(Session.SessionKeys.Product)); INumControlRepository numCtrlRepository = RepositoryFactory.GetInstance().GetRepository<INumControlRepository, NumControl>(); string stag =(string) CurrentSession.GetValue(Session.SessionKeys.CN); IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); string sn = currentProduct.CUSTSN; string prodid = currentProduct.ProId; if (stag == "S") { //NumControl nc = new NumControl(-1, "CPQSNO", "", sn, "HP"); // numCtrlRepository.InsertNumControlDefered(CurrentSession.UnitOfWork, nc); string line = default(string); var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); //IMES.FisObject.Common.Station StationStatus status = (StationStatus)(1); line = string.IsNullOrEmpty(this.Line) ? currentProduct.Status.Line : this.Line; var productLog = new ProductLog { Model = currentProduct.Model, Status = status, Editor = Editor, Line = line, Station = "58", Cdt = DateTime.Now }; currentProduct.AddLog(productLog); productRepository.Update(currentProduct, CurrentSession.UnitOfWork); } if (stag == "T") { // void InsertForceNWC(ForceNWCInfo item); // bool CheckExistForceNWC(ForceNWCInfo condition); ForceNWCInfo cond = new ForceNWCInfo(); cond.productID = currentProduct.ProId; bool bExist = partRep.CheckExistForceNWC(cond); if (bExist == true) { partRep.UpdateForceNWCByProductID("58", "59", currentProduct.ProId); } else { ForceNWCInfo newinfo = new ForceNWCInfo(); newinfo.editor = this.Editor; newinfo.forceNWC = "58"; newinfo.preStation = "59"; newinfo.productID = currentProduct.ProId; partRep.InsertForceNWC(newinfo); } } CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, prodid); CurrentSession.AddValue(Session.SessionKeys.PrintLogName, "MasterLabel"); CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, prodid); CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, prodid); return base.DoExecute(executionContext); }
private void SaveForceNWC(IProduct p) { if (p != null) { IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); IList<IMES.DataModel.ConstValueTypeInfo> lstConst = partRep.GetConstValueTypeList("UnitWeightErrorToSortingLine"); string pdline = p.Status.Line; if (!string.IsNullOrEmpty(pdline) && lstConst.Any(x => x.value.Equals(pdline.Substring(0, 1)))) { ForceNWCInfo cond = new ForceNWCInfo(); cond.productID = p.ProId; string preStation = p.Status.StationId; if (partRep.CheckExistForceNWC(cond)) { partRep.UpdateForceNWCByProductID("PKCK", preStation, p.ProId); } else { ForceNWCInfo newinfo = new ForceNWCInfo(); newinfo.editor = this.Editor; newinfo.forceNWC = "PKCK"; newinfo.preStation = preStation; newinfo.productID = p.ProId; partRep.InsertForceNWC(newinfo); } } } }
/// <summary> /// 检查是否满足complete条件, 更新Repair状态 /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { try { IProduct iProductTarget = (IProduct)GetRepairTarget(); IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); string returnStation = (string)CurrentSession.GetValue(Session.SessionKeys.ReturnStation); var product = CurrentSession.GetValue(Session.SessionKeys.Product) as IProduct; if (product == null) { throw new NullReferenceException("Product in session is null"); } string id = product.ProId; #region mark by Vincent //string isReturnProduct = (string)CurrentSession.GetValue("ReturnProduct"); //if (isReturnProduct == "1") //{ // //获取上一站@NextStation // //select top 1 Station from ProductLog where ProductID = @ProductID // // and Station <>'76' and Station <>'7P' and Station<>’45’ order by Cdt desc // var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); // IList<ProductLog> list = new List<ProductLog>(); // ProductLog cond1 = new ProductLog(); // cond1.ProductID = product.ProId; // string[] stationArray = new string[6]; // stationArray[0] = "76"; // stationArray[1] = "7P"; // stationArray[2] = "45"; // //Update 2012/07/23 Add 57 // stationArray[3] = "57"; // stationArray[4] = "66"; // stationArray[5] = "6P"; // list = productRepository.GetProductLogList(cond1, stationArray); // if (list != null && list.Count > 0) // { // returnStation = list[0].Station; // CurrentSession.AddValue(Session.SessionKeys.ReturnStation, returnStation); // } // else // { // //CurrentSession.AddValue(Session.SessionKeys.ReturnStation, "40"); // List<string> errpara = new List<string>(); // errpara.Add(product.ProId); // throw new FisException("CHK925", errpara); // } //} #endregion bool bExist = false; ForceNWCInfo cond = new ForceNWCInfo(); cond.productID = id; bExist = partRep.CheckExistForceNWC(cond); if (bExist == true) { partRep.UpdateForceNWCByProductID(returnStation, this.Station, id); } else { ForceNWCInfo newinfo = new ForceNWCInfo(); newinfo.editor = this.Editor; newinfo.forceNWC = returnStation; newinfo.preStation = this.Station; newinfo.productID = id; partRep.InsertForceNWC(newinfo); } return base.DoExecute(executionContext); } catch (FisException ex) { throw ex; } catch (Exception ex) { throw ex; } }
/// <summary> /// Save Reflow处理 /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { var currenProduct = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product); string returnStation = (string)CurrentSession.GetValue("ReturnStation"); string returnStationText = (string)CurrentSession.GetValue("ReturnStationText"); CurrentSession.AddValue("StationStation", returnStation); CurrentSession.AddValue("StationDescr", returnStationText); if (returnStation == "PO" || returnStation == "6A") { //获取上一站@NextStation /* 2012-8-1, Jessica Liu, 需求变更:增加Return Station 计算逻辑, 修改解DN条件 IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); IStation iStation = null; string[] stationLst = {"76", "7P", "45"}; ProductLog proLog = new ProductLog(); proLog.ProductID = currenProduct.ProId; IList<ProductLog> proLogLst = productRepository.GetProductLogList(proLog, stationLst); if ((proLogLst != null) && (proLogLst.Count != 0)) { string stionid = proLogLst[0].Station; IStationRepository stationRepository = RepositoryFactory.GetInstance().GetRepository<IStationRepository>(); iStation = stationRepository.Find(stionid); } if (iStation != null) { CurrentSession.AddValue("StationStation", iStation.StationId); CurrentSession.AddValue("StationDescr", iStation.Descr); } else { CurrentSession.AddValue("StationStation", Station); CurrentSession.AddValue("StationDescr", ""); } */ IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); //获取QCStatusID //select top 1 @QCStatusID=ID, @PrdQCStatus = Status from QCStatus where ProductID = @ProductID order by Udt desc IList<ProductQCStatus> proQCStatusLst = productRepository.GetQCStatusOrderByUdtDesc(currenProduct.ProId); //int QCStatusId = -1; string PrdQCStatus = null; if ((proQCStatusLst != null) && (proQCStatusLst.Count > 0)) { ProductQCStatus currentStatus = proQCStatusLst[0]; //QCStatusId = proQCStatusLst[0].ID; PrdQCStatus = proQCStatusLst[0].Status; //Update QCStatus //Update QCStatus Status = (@PrdQCStatus=’A’,则为’8’; =’7’,则为’5’;=’4’,则为’2’) Udt = Getdate() Where ID=@QCStatusID if (PrdQCStatus == "A") { currentStatus.Status = "8"; } else if (PrdQCStatus == "7") { currentStatus.Status = "5"; } else if (PrdQCStatus == "4") { currentStatus.Status = "2"; } currenProduct.UpdateQCStatus(currentStatus); productRepository.Update(currenProduct, CurrentSession.UnitOfWork); } else { List<String> erpara = new List<String>(); throw new FisException("CHK932", erpara); } } //跳站 //若ForceNWC存在(ForceNWC.ProductID=@ProductID)则Update ForceNWC 否则Insert ForceNWC //PreStation=@CurrentStation //ForceNWC=@NextStation IPartRepository ipartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); ForceNWCInfo cond = new ForceNWCInfo(); cond.productID = currenProduct.ProId; ForceNWCInfo forceNWCInfo = new ForceNWCInfo(); forceNWCInfo.preStation = Station; /* 2012-8-1, Jessica Liu, 需求变更:增加Return Station 计算逻辑, 修改解DN条件 if (iStation != null) { forceNWCInfo.forceNWC = iStation.StationId; forceNWCInfo.productID = currenProduct.ProId; forceNWCInfo.editor = Editor; } else { List<string> errpara = new List<string>(); errpara.Add(currenProduct.ProId); throw new FisException("CHK925", errpara); } */ forceNWCInfo.forceNWC = returnStation; forceNWCInfo.productID = currenProduct.ProId; forceNWCInfo.editor = Editor; bool bExist = ipartRepository.CheckExistForceNWC(cond); if (bExist == true) { ipartRepository.UpdateForceNWC(forceNWCInfo ,cond); } else { ipartRepository.InsertForceNWC(forceNWCInfo); } return base.DoExecute(executionContext); }
private void checkForceNWC(ProcessTypeEnum processType, string sn, string curStation, string preStation) { CurrentSession.AddValue("IsForceNWC", "N"); if (processType == ProcessTypeEnum.Product && !string.IsNullOrEmpty(sn) && !string.IsNullOrEmpty(preStation) && !string.IsNullOrEmpty(curStation)) { IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); ForceNWCInfo cond = new ForceNWCInfo(); cond.productID = sn; cond.preStation = preStation; cond.forceNWC = curStation; bool bExist = partRep.CheckExistForceNWC(cond); if (bExist) { CurrentSession.AddValue("IsForceNWC", "Y"); } } }