public ArrayList InputCustSnForCQ(string custsn, string pdLine, string editor, string station, string customer) { logger.Debug("(PodLabelCheckImpl)InputCustSnForCQ start, custsn:" + custsn + "pdLine:" + pdLine + "editor:" + editor + "station:" + station + "customer:" + customer); FisException ex; List<string> erpara = new List<string>(); ArrayList retArr = new ArrayList(); string label = ""; try { var currentProduct = CommonImpl.GetProductByInput(custsn, CommonImpl.InputTypeEnum.CustSN); string sessionKey = currentProduct.ProId; Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, Session.SessionType.Product); CommonImpl2 cm2 = new CommonImpl2(); label = cm2.CheckPodLabel(custsn); if (label == "") { label = cm2.CheckConfigLabel(custsn); } if (string.IsNullOrEmpty(label)) { throw new FisException("SFC013", new string[] { }); } if (currentSession == null) { currentSession = new Session(sessionKey, Session.SessionType.Product, editor, station, pdLine, 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", pdLine); wfArguments.Add("Customer", customer); wfArguments.Add("SessionType", Session.SessionType.Product); string wfName, rlName; RouteManagementUtils.GetWorkflow(station, "PodLabelCheck.xoml", "PodLabelCheck.rules", out wfName, out rlName); WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments); currentSession.AddValue(Session.SessionKeys.CustSN, custsn); currentSession.AddValue(Session.SessionKeys.Product, currentProduct); currentSession.AddValue(Session.SessionKeys.IsComplete, false); currentSession.SetInstance(instance); if (!SessionManager.GetInstance.AddSession(currentSession)) { currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists."); erpara.Add(sessionKey); ex = new FisException("CHK020", erpara); throw ex; } currentSession.WorkflowInstance.Start(); currentSession.SetHostWaitOne(); } else { 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; } CommonImpl cmi = new CommonImpl(); IList<ConstValueInfo> lstConst = cmi.GetConstValueListByType("PODModel", "Name").Where(y => y.value != "").ToList(); string countryCode = currentProduct.Model.Substring(9, 2); var s = lstConst.Where(x => x.name == countryCode).Select(x => x.value).ToList(); IList<string> codeLst = null; List<string> modelLst = new List<string>(); if (s.Count > 0) { string code = s[0]; codeLst = code.Split('~').Where(x=>x.Trim()!="").ToList(); foreach (string m in codeLst) { modelLst.Add(currentProduct.Model+m.Trim()); } } string NoNeedScanMAC = ""; IList<ConstValueTypeInfo> typeinfo = cmi.GetConstValueTypeListByType("ConfigNoCheckMAC").ToList(); if (typeinfo.Where(x => x.value == currentProduct.Family).Any()) { NoNeedScanMAC = "NoNeed"; } currentSession.AddValue(Session.SessionKeys.ifElseBranch, label); retArr.Add(currentProduct.ProId); retArr.Add(currentProduct.Model); retArr.Add(label); retArr.Add(modelLst); retArr.Add(NoNeedScanMAC);//0001583: 86站POD Label check修改 return retArr; } catch (FisException e) { //logger.Error(e.mErrmsg, e); //throw new Exception(e.mErrmsg); logger.Error(e.mErrmsg, e); if (e.mErrcode == "CHK020") //序號已被刷入 { throw e; } throw new Exception(e.mErrmsg); } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("(PodLabelCheckImpl)InputCustSnForCQ end, custsn:" + custsn + "pdLine:" + pdLine + "editor:" + editor + "station:" + station + "customer:" + customer); } }
/// <summary> /// 刷uutSn,启动工作流,检查输入的uutSn,卡站,获取ProductModel /// </summary> /// <param name="uutSn"></param> /// <param name="line"></param> /// <param name="editor"></param> /// <param name="station"></param> /// <param name="customer"></param> /// <returns>ProductModel</returns> public ArrayList InputSN(string uutSn, string line, string editor, string station, string customer) { logger.Debug("(PAQCOutputImpl)InputSN start, uutSn:" + uutSn); try { var currentProduct = CommonImpl.GetProductByInput(uutSn, CommonImpl.InputTypeEnum.CustSN); //****** add by Benson at 2013/05/10 for Unit Weight当Non BT 产品时,只能由Pass Ship to Station(95) 进入 /* Move the logic form SP [IMES_SFC_Product] to here * else if (@CurrentStation ='PO'and @PreStation ='85') begin if (@NeedPODLabel ='Y' OR @NeedConfigLabel ='Y') begin select 'SFC014',@Key return end end */ string site = IMES.Infrastructure.Utility.Common.CommonUti.GetSite(); if (site != "ICC") { IList<ProductLog> lstLog = currentProduct.ProductLogs.OrderByDescending(x => x.Cdt).ToList(); string preStation = lstLog[0].Station; string label = ""; if (station == "PO" && preStation == "85") { CommonImpl2 cm2 = new CommonImpl2(); label = cm2.CheckPodLabel(uutSn); if (label == "") { label = cm2.CheckConfigLabel(uutSn); } if (string.IsNullOrEmpty(label)) { throw new FisException("SFC014", new string[] { }); } } } //****** add by Benson at 2013/05/10 string sessionKey = currentProduct.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, "043PAQCOutput.xoml", "043PAQCOutput.rules", out wfName, out rlName); WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments); currentSession.AddValue(Session.SessionKeys.IsComplete, false); 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 { 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(); //Get infomation Product curProduct = (Product)currentSession.GetValue(Session.SessionKeys.Product); IMES.DataModel.ProductModel currentModel = new IMES.DataModel.ProductModel(); //a. 如果Product 在QCStatus 中不存在记录,则报告错误:“此Product 在QCStatus 中不存在记录,请联系相关人员” if (curProduct.QCStatus.Count == 0) { SessionManager.GetInstance.RemoveSession(currentSession); FisException ex; List<string> erpara = new List<string>(); erpara.Add(sessionKey); ex = new FisException("PAK110", erpara);//此Product 在QCStatus 中不存在记录,请联系相关人员 throw ex; } currentModel.CustSN = curProduct.CUSTSN; currentModel.ProductID = curProduct.ProId; currentModel.Model = curProduct.Model; retList.Add(currentModel); //select b.Line + ' ' + b.Descr from ProductStatus a (nolock), Line b (nolock) //WHERE a.ProductID = @ProductId //AND a.Line = b.Line ILineRepository lineRepository = RepositoryFactory.GetInstance().GetRepository<ILineRepository, Line>(); Line pdline = lineRepository.Find(curProduct.Status.Line); string strline = ""; strline = pdline.Id + " " + pdline.Descr; retList.Add(strline); //=============================================================================== 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("(PAQCOutputImpl)InputSN end, uutSn:" + uutSn); } }
/// <summary> /// 根据刷入的Customer S/N,SFC,获得 Product ID,Customer P/N 信息 /// Product ID: Product.ProductID; /// Customer P/N: Product.Model对应的Model.CustPN /// </summary> ProductModel IPodLabelCheck.InputCustSnOnCooLabel(string custsn, string pdLine, string editor, string station, string customer, out string custpn , out MRPLabelDef MRP,out string BoxID) { logger.Debug("(PodLabelCheckImpl)InputCustSNOnCooLabel start, custsn:" + custsn + "pdLine:" + pdLine + "editor:" + editor + "station:" + station + "customer:" + customer); FisException ex; List<string> erpara = new List<string>(); try { var currentProduct = CommonImpl.GetProductByInput (custsn, CommonImpl.InputTypeEnum.CustSN); string sessionKey = currentProduct.ProId; CommonImpl2 cm2 = new CommonImpl2(); string label = ""; label = cm2.CheckPodLabel(custsn); if (label == "") { label = cm2.CheckConfigLabel(custsn); } if (string.IsNullOrEmpty(label)) { throw new FisException("SFC013", new string[] { }); } Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, Session.SessionType.Product); if (currentSession == null) { currentSession = new Session(sessionKey, Session.SessionType.Product, editor, station, pdLine, 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", pdLine); wfArguments.Add("Customer", customer); wfArguments.Add("SessionType", Session.SessionType.Product); string wfName, rlName; RouteManagementUtils.GetWorkflow(station, "PodLabelCheck.xoml", "PodLabelCheck.rules", out wfName, out rlName); WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments); currentSession.AddValue(Session.SessionKeys.CustSN, custsn); currentSession.AddValue(Session.SessionKeys.Product, currentProduct); currentSession.AddValue(Session.SessionKeys.IsComplete, false); currentSession.SetInstance(instance); if (!SessionManager.GetInstance.AddSession(currentSession)) { currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists."); erpara.Add(sessionKey); ex = new FisException("CHK020", erpara); throw ex; } currentSession.WorkflowInstance.Start(); currentSession.SetHostWaitOne(); } else { 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; } ProductModel currentProductModel = new ProductModel(); currentProductModel.CustSN = currentProduct.CUSTSN; currentProductModel.Model = currentProduct.Model; currentProductModel.ProductID = currentProduct.ProId; custpn = string.Empty; //custpn = currentProduct.ModelObj.CustPN; //if (String.IsNullOrEmpty(custpn)) //{ // erpara.Add(custsn); // ex = new FisException("CHK043", erpara); // throw ex; //} //UC Revision: 7294: CustPN 修改为Model //Revision: 9810: 修改列印Config Label 的条件为非BT currentSession.AddValue(Session.SessionKeys.ifElseBranch, ""); IDeliveryRepository iDeliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>(); string printlabeltype1 = string.Empty; // Config Label string printlabeltype2 = string.Empty; // POD Label string delievery = string.Empty; // currentDeliveryNo string pno = string.Empty; // currentModel delievery = currentProduct.DeliveryNo; if (!currentProduct.IsBT) { string BTRegId =(string) iDeliveryRepository.GetDeliveryInfoValue(delievery, "RegId"); if (BTRegId != null && BTRegId.Length == 3) { BTRegId = BTRegId.Substring(1, 2); } else { BTRegId = ""; } string BTShipTp = iDeliveryRepository.GetDeliveryInfoValue(delievery, "ShipTp"); string BTCountry = iDeliveryRepository.GetDeliveryInfoValue(delievery, "Country"); if (!string.IsNullOrEmpty(BTRegId) && !string.IsNullOrEmpty(BTShipTp) && !string.IsNullOrEmpty(BTCountry)) { //ITC-1360-1527:RegId 为'SNE'时,未能打印CONFIG LABEL //if ((BTRegId == "CN" || BTRegId == "AF" || BTRegId == "NE" || BTRegId == "CE") && (BTShipTp == "CTO") && (BTCountry != "JAPAN")) if ((ActivityCommonImpl.Instance.CheckDomesticDN(BTRegId) || BTRegId == "AF" || BTRegId == "NE" || BTRegId == "CE") && (BTShipTp == "CTO") && (BTCountry != "JAPAN")) { printlabeltype1 = "ConfigLabel"; currentSession.AddValue(Session.SessionKeys.ifElseBranch, printlabeltype1); currentProductModel.CustSN = printlabeltype1; } } } // Print =====如果IMES_PAK..PODLabelPart中有维护PartNo等于Model的前几位字符的记录 and (Model的第7位不是数字),则需要列印POD Label==== pno = currentProduct.Model; IList<PODLabelPartDef> podLabelPartLst = new List<PODLabelPartDef>(); podLabelPartLst = ipartRepository.GetPODLabelPartListByPartNo(pno); if (podLabelPartLst.Count > 0) { string number = "0123456789"; string modelbit = currentProduct.Model.Substring(6, 1); if (!number.Contains(modelbit)) //Model的第7位不是数字 { printlabeltype2 = "PODLabel"; currentSession.AddValue(Session.SessionKeys.ifElseBranch, printlabeltype2); //如果列印PodLabel,则需要再记录一次ProductLog (Station = 'PD',Line = 'POD Label Print') currentProductModel.CustSN = printlabeltype2; } } MRP = new MRPLabelDef(); MRP = iDeliveryRepository.GetMRPLabel(delievery); if (MRP == null) { MRP = new MRPLabelDef(); MRP.IndiaPrice = ""; MRP.IndiaPriceDescr = ""; MRP.IndiaPriceID = ""; } BoxID = iProductRepository.GetProductInfoValue(currentProduct.ProId, "BoxId"); if (BoxID == null) { BoxID = ""; } return currentProductModel; } catch (FisException e) { //logger.Error(e.mErrmsg, e); //throw new Exception(e.mErrmsg); logger.Error(e.mErrmsg, e); if (e.mErrcode == "CHK020") //序號已被刷入 { throw e; } throw new Exception(e.mErrmsg); } catch (Exception e) { logger.Error(e.Message, e); throw new SystemException(e.Message); } finally { logger.Debug("(PodLabelCheckImpl)InputCustSNOnCooLabel end, custsn:" + custsn + "pdLine:" + pdLine + "editor:" + editor + "station:" + station + "customer:" + customer); } }