/// <summary> ///根据productIDList取得product的详细信息,先将全部ProductID存入一个临时表中,在 ///拿临时表与Product表结合,取出详细信息。 /// </summary> /// <returns></returns> public IList<ProductInfoMaintain> GetProductListByIDList(IList<string> productIDList) { //string userKey = Guid.NewGuid().ToString(); IList<IProduct> productList; IList<ProductInfoMaintain> productInfoMaintainList = new List<ProductInfoMaintain>(); try { //insert ProductIDListForRework(UserKey,ProductID) values(?,?) //productRepository.CreateTempProductIDList(productIDList, userKey); //select b.ProductID,b.CUSTSN,b.Model,b.MO,b.DeliveryNo,c.Station,c.Status //from IMES_GetData.dbo.TempProductID a // join IMES_FA.dbo.Product b on a.ProductID = b.ProductID or a.ProductID = b.CUSTSN // join IMES_FA.dbo.ProductStatus c on c.ProductID=b.ProductID //where a.UserKey=? //order by b.ProductID //productList = productRepository.GetProductListByByUserKey(userKey); productList=productRepository.GetProductListByIdList(productIDList); } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } finally { //delete ProductIDListForRework where UserKey=? //productRepository.DeleteProductIDListByUserKey(userKey); } foreach(Product product in productList) { ProductInfoMaintain productInfoMaintain = new ProductInfoMaintain(); productInfoMaintain.ProductID = product.ProId; productInfoMaintain.Sn = product.CUSTSN; if (product.Status == null) { productInfoMaintain.Station = ""; productInfoMaintain.Status = ""; } else { productInfoMaintain.Station = product.Status.StationId; productInfoMaintain.Status = product.Status.Status.ToString(); } productInfoMaintain.Model = product.Model; productInfoMaintain.Mo = product.MO; productInfoMaintain.Dn = product.DeliveryNo; productInfoMaintainList.Add(productInfoMaintain); } return productInfoMaintainList; }
/// <summary> /// /// </summary> /// <param name="inputSN"></param> /// <param name="model"></param> /// <param name="firstProID"></param> /// <param name="line"></param> /// <param name="editor"></param> /// <param name="station"></param> /// <param name="customer"></param> /// <returns></returns> public ArrayList InputSN(string inputCartonNo, string line, string editor, string station, string customer) { logger.Debug("(CombineCartonInDN)inputCartonNo start, inputCartonNo:" + inputCartonNo); try { ArrayList retLst = new ArrayList(); var productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>(); IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>(); //a. 如果用户录入的[Carton No] 在数据库(CartonStatus.CartonNo)中不存在,则报告错误:“Invalid Carton No!” carton.ICartonSSCCRepository cartRep = RepositoryFactory.GetInstance().GetRepository<carton.ICartonSSCCRepository, IMES.FisObject.PAK.CartonSSCC.CartonSSCC>(); CartonStatusInfo carConf = new CartonStatusInfo(); carConf.cartonNo = inputCartonNo; IList<CartonStatusInfo> carList = cartRep.GetCartonStatusInfo(carConf); if (carList.Count == 0) { List<string> errpara = new List<string>(); errpara.Add(inputCartonNo); throw new FisException("PAK139", errpara);//此Carton 不存在! } //b.如果用户录入的[Carton No] 已经结合了Pallet,则报告错误:“This Carton has combined Pallet!” IProduct eqCondition1 = new Product(); IProduct notNullCondition1 = new Product(); eqCondition1.CartonSN = inputCartonNo; notNullCondition1.PalletNo = ""; IList<IProduct> prodcutlist1 = productRep.GetProductInfoListByConditionsNotNull(eqCondition1, notNullCondition1); if (prodcutlist1.Count != 0) { List<string> errpara = new List<string>(); errpara.Add(inputCartonNo); throw new FisException("PAK159", errpara);//“This Carton has combined Pallet!” } //c.如果用户录入的[Carton No] 已经结合了Delivery,则报告错误:“This Carton has combined Delivery!” IProduct eqCondition2 = new Product(); IProduct notNullCondition2 = new Product(); eqCondition2.CartonSN = inputCartonNo; notNullCondition2.DeliveryNo = ""; IList<IProduct> prodcutlist2 = productRep.GetProductInfoListByConditionsNotNull(eqCondition2, notNullCondition2); if (prodcutlist2.Count != 0) { List<string> errpara = new List<string>(); errpara.Add(inputCartonNo); throw new FisException("PAK160", errpara);//“This Carton has combined Delivery!” } IList<IProduct> prodList = new List<IProduct>(); prodList = productRep.GetProductListByCartonNo(inputCartonNo); if (prodList.Count == 0) { throw new FisException("CHK109", new string[] { }); } IProduct curProduct; curProduct = productRep.Find(prodList[0].ProId); retLst.Add(prodList[0].Model); string sessionKey = prodList[0].ProId; Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, SessionType); if (currentSession == null) { currentSession = new Session(sessionKey, SessionType, editor, station, line, customer); Dictionary<string, object> wfArguments = new Dictionary<string, object>(); wfArguments.Add("Key", sessionKey); wfArguments.Add("Station", station); wfArguments.Add("CurrentFlowSession", currentSession); wfArguments.Add("Editor", editor); wfArguments.Add("PdLine", line); wfArguments.Add("Customer", customer); wfArguments.Add("SessionType", SessionType); string wfName, rlName; RouteManagementUtils.GetWorkflow(station, "CombineCartonInDNForRCTO.xoml", "CombineCartonInDNForRCTO.rules", out wfName, out rlName); WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments); currentSession.AddValue(Session.SessionKeys.IsComplete, false); currentSession.AddValue(Session.SessionKeys.Product, curProduct); currentSession.AddValue(Session.SessionKeys.ProdList, prodList); IList<string> productIDList = new List<string>(); currentSession.AddValue(Session.SessionKeys.NewScanedProductIDList, productIDList); currentSession.SetInstance(instance); if (!SessionManager.GetInstance.AddSession(currentSession)) { currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists."); FisException ex; List<string> erpara = new List<string>(); erpara.Add(sessionKey); ex = new FisException("CHK020", erpara); throw ex; } currentSession.WorkflowInstance.Start(); currentSession.SetHostWaitOne(); } else { currentSession.AddValue(Session.SessionKeys.Product, curProduct); currentSession.Exception = null; currentSession.SwitchToWorkFlow(); /*FisException ex; List<string> erpara = new List<string>(); erpara.Add(sessionKey); ex = new FisException("CHK020", erpara); throw ex;*/ } if (currentSession.Exception != null) { if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null) { currentSession.ResumeWorkFlow(); } throw currentSession.Exception; } //======================================================== ArrayList retList = new ArrayList(); ProductInfoMaintain prodInfo = new ProductInfoMaintain(); if (string.IsNullOrEmpty(curProduct.CUSTSN)) { curProduct.CUSTSN =""; } prodInfo.ProductID = curProduct.ProId; prodInfo.Sn = curProduct.CUSTSN; prodInfo.Model = curProduct.Model; //prodInfo.Station = vendorCT; IList<IProduct> proList = (List<IProduct>)currentSession.GetValue(Session.SessionKeys.ProdList); IList<string> idList = (List<string>)currentSession.GetValue(Session.SessionKeys.NewScanedProductIDList); proList = productRep.GetProductListByCartonNo(inputCartonNo); foreach (IProduct item in proList) { idList.Add(item.ProId); } currentSession.AddValue(Session.SessionKeys.ProdList, proList); currentSession.AddValue(Session.SessionKeys.NewScanedProductIDList, idList); retList.Add(prodInfo); retList.Add(prodList.Count); //======================================================== 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("(CombineCartonInDN)inputCartonNo end, uutSn:" + inputCartonNo); } }
//取得Product的详细信息 public ProductInfoMaintain GetProductInfo(string strProdId) { //select a.ProductID,a.CUSTSN,a.Model,a.MO,a.DeliveryNo,b.Station,b.Status //from Product a // join ProductStatus b on a.ProductID=b.ProductID //where a.ProductID = 'productIdOrSN' or a.CUSTSN = 'productIdOrSN' IProduct product = productRepository.GetProductByIdOrSn(strProdId); ProductInfoMaintain productMaintainInfo = new ProductInfoMaintain(); if (product == null) { return productMaintainInfo; } productMaintainInfo.ProductID = product.ProId; productMaintainInfo.Sn = product.CUSTSN; if (product.Status == null) { productMaintainInfo.Station = ""; productMaintainInfo.Status = ""; } else { productMaintainInfo.Station = product.Status.StationId; productMaintainInfo.Status = product.Status.Status.ToString(); } productMaintainInfo.Model = product.Model; productMaintainInfo.Mo = product.MO; productMaintainInfo.Dn = product.DeliveryNo; return productMaintainInfo; }
/// <summary> /// /// </summary> /// <param name="inputSN"></param> /// <param name="model"></param> /// <param name="firstProID"></param> /// <param name="line"></param> /// <param name="editor"></param> /// <param name="station"></param> /// <param name="customer"></param> /// <returns></returns> public ArrayList InputSN(string inputSN, string model, string firstProID, string line, string editor, string station, string customer) { logger.Debug("(CombinePoInCarton)InputSN start, inputSN:" + inputSN); try { bool newflag = false; if (firstProID == "") { newflag = true; } var productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>(); IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>(); IMBRepository mbRep = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); //[Product Id] – 如果用户录入的数据长度为9,且以字母’C’开头,则可以认定用户录入的数据是[Product Id] //[Vendor CT] – 如果用户录入的数据长度为14,则可以认定用户录入的数据是[Vendor CT] //SELECT ProductID FROM Product_Part NOLOCK WHERE PartSN = @VendorCT IProduct curProduct = null; string vendorCT = ""; if (inputSN.Length == 9 || inputSN.Length == 10) { //curProduct = productRep.Find(inputSN); curProduct = productRep.GetProductByIdOrSn(inputSN); } if (curProduct==null) { vendorCT = inputSN; ProductPart conf = new ProductPart(); conf.PartSn = inputSN; IList<ProductPart> productList = productRep.GetProductPartList(conf); if (productList.Count > 0) { curProduct = productRep.Find(productList[0].ProductID); } else { //b.InfoType = 'MBCT2' AND b.InfoValue = @VendorCT var mcond = new IMES.FisObject.PCA.MB.MBInfo(); mcond.InfoType = "MBCT2"; mcond.InfoValue = vendorCT; IList<IMES.FisObject.PCA.MB.MBInfo> mbList = mbRep.GetPcbInfoByCondition(mcond); if (mbList.Count > 0) { IList<IProduct> pList = productRep.GetProductListByPCBID(mbList[0].PCBID); if (pList.Count > 0) { curProduct = pList[0]; } } else { IList<IMES.FisObject.FA.Product.ProductInfo> productinfolist = productRep.GetProductInfoListByKeyAndValue("ModelCT", vendorCT); { if (productinfolist.Count > 0) { curProduct = productRep.Find(productinfolist[0].ProductID); } else { productinfolist = productRep.GetProductInfoListByKeyAndValue("SleeveCT", vendorCT); if (productinfolist.Count > 0) { curProduct = productRep.Find(productinfolist[0].ProductID); } } } } } } if (null == curProduct) { List<string> errpara = new List<string>(); errpara.Add(inputSN); throw new FisException("SFC002", errpara); } if (model == "") { model = curProduct.Model; } if (firstProID == "") { firstProID = curProduct.ProId; } //检查Product Model (Product.Model) 是否与页面上的[Model] 相同,如果不同,则报告错误:“Model is not match!” if (curProduct.Model != model) { FisException ex; List<string> erpara = new List<string>(); erpara.Add(curProduct.Model); ex = new FisException("PAK131", erpara);//Model is not match! throw ex; } //h. 如果用户刷入的Product Id (可能是直接刷入的,也可能是基于Customer S/N查询到的)已经刷过,则报告错误:“Duplicate data!” if (!string.IsNullOrEmpty(curProduct.CartonSN)) { FisException ex; List<string> erpara = new List<string>(); erpara.Add(curProduct.Model); ex = new FisException("PAK134", erpara);//Duplicate data! throw ex; } CheckPAQC(curProduct);//检查QC抽中未刷出 CheckFRUMBOA3(curProduct.PCBID, curProduct.Model); ArrayList retList = new ArrayList(); string sessionKey = firstProID; Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, SessionType); if (currentSession == null) { if (!newflag) { FisException ex; List<string> erpara = new List<string>(); ex = new FisException("PAK157", erpara); retList.Add("Error"); retList.Add(ex); return retList; } currentSession = new Session(sessionKey, SessionType, editor, station, line, customer); Dictionary<string, object> wfArguments = new Dictionary<string, object>(); wfArguments.Add("Key", sessionKey); wfArguments.Add("Station", station); wfArguments.Add("CurrentFlowSession", currentSession); wfArguments.Add("Editor", editor); wfArguments.Add("PdLine", line); wfArguments.Add("Customer", customer); wfArguments.Add("SessionType", SessionType); string wfName, rlName; RouteManagementUtils.GetWorkflow(station, "CombinePoInCartonForRCTO.xoml", "CombinePoInCartonForRCTO.rules", out wfName, out rlName); WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments); currentSession.AddValue(Session.SessionKeys.IsComplete, false); currentSession.AddValue(Session.SessionKeys.Product, curProduct); IList<IProduct> productList = new List<IProduct>(); currentSession.AddValue(Session.SessionKeys.ProdList, productList); IList<string> productIDList = new List<string>(); currentSession.AddValue(Session.SessionKeys.NewScanedProductIDList, productIDList); currentSession.SetInstance(instance); if (!SessionManager.GetInstance.AddSession(currentSession)) { currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists."); FisException ex; List<string> erpara = new List<string>(); erpara.Add(sessionKey); ex = new FisException("CHK020", erpara); throw ex; } currentSession.WorkflowInstance.Start(); currentSession.SetHostWaitOne(); } else { if (newflag) { FisException ex; List<string> erpara = new List<string>(); erpara.Add(sessionKey); ex = new FisException("CHK020", erpara); throw ex; } currentSession.AddValue(Session.SessionKeys.Product, curProduct); currentSession.Exception = null; currentSession.SwitchToWorkFlow(); /*FisException ex; List<string> erpara = new List<string>(); erpara.Add(sessionKey); ex = new FisException("CHK020", erpara); throw ex;*/ } if (currentSession.Exception != null) { if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null) { currentSession.ResumeWorkFlow(); } throw currentSession.Exception; } //======================================================== ProductInfoMaintain prodInfo = new ProductInfoMaintain(); if (string.IsNullOrEmpty(curProduct.CUSTSN)) { curProduct.CUSTSN = ""; } prodInfo.ProductID = curProduct.ProId; prodInfo.Sn = curProduct.CUSTSN; prodInfo.Model = curProduct.Model; prodInfo.Station = vendorCT; IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>(); Model curModel = modelRep.Find(curProduct.Model); string zmode = ""; zmode = curModel.GetAttribute("ZMODE"); IList<IProduct> proList = (List<IProduct>)currentSession.GetValue(Session.SessionKeys.ProdList); IList<string> idList = (List<string>)currentSession.GetValue(Session.SessionKeys.NewScanedProductIDList); proList.Add(curProduct); idList.Add(curProduct.ProId); currentSession.AddValue(Session.SessionKeys.ProdList, proList); currentSession.AddValue(Session.SessionKeys.NewScanedProductIDList, idList); retList.Add("Success"); retList.Add(prodInfo); retList.Add(zmode); //======================================================== 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("(CombinePoInCarton)InputSN end, uutSn:" + inputSN); } }