/// <summary> /// input mbSno for MB reinput /// </summary> /// <returns>MBInfo</returns> public MBInfo MBReinputInputMBSno(string mbSno, string editor, string line, string station, string customer) { _logger.Debug("(ICTInput)MBReinputInputMBSno start, MB_SNo:" + mbSno); try { var mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository>(); var prodRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>(); var mb = mbRepository.Find(mbSno); if (mb == null || mb.MBStatus == null) { var ex = new FisException("SFC001", new[] { mbSno }); throw ex; } //b. 检查MB SNo第六位,若为“R”,则是RCTO的板子不予通过 if (mb.IsRCTO) { var ex = new FisException("CHK856", new string[] { }); throw ex; } //e. 检查MB的当前状态(PCBStatus.Status),若为“0”,则报错:“该MB有Fail,请先修复后再重流” if (mb.MBStatus.Status == MBStatusEnum.Fail) { var ex = new FisException("ICT019", new string[] { }); throw ex; } //f. 检查MB的当前站(PCBStatus.Station),若为“S9、20、21、22、23”,则报错:“修复中,请修复完毕后再重流 // 若为“CL”,则报错:“该MB的生命周期已结束”; // 若为“28”,则报错:“该MB已经报废,不能再使用”。 // 若为“P0、09”,则报错:“未经过ICT测试,不能重流 if (mb.MBStatus.Station == "S9" || mb.MBStatus.Station == "20" || mb.MBStatus.Station == "21" || mb.MBStatus.Station == "22" || mb.MBStatus.Station == "23" ) { var ex = new FisException("CHK854", new string[] { }); throw ex; } if (mb.MBStatus.Station == "CL") { var ex = new FisException("ICT011", new string[] { }); throw ex; } if (mb.MBStatus.Station == "28") { var ex = new FisException("ICT012", new string[] { }); throw ex; } if (mb.MBStatus.Station == "P0" || mb.MBStatus.Station == "09" ) { var ex = new FisException("ICT020", new string[] { }); throw ex; } //g. 检查MB是否已经结合,若存在,则报错:“该MB已经结合,不能重投” var productByMBSn = prodRepository.GetProductByMBSn(mbSno); if (productByMBSn != null) { var ex = new FisException("CHK855", new string[] { }); throw ex; } //c. 检查MB 是否不良 if (null != mb.GetCurrentRepair()) { var ex = new FisException("BOR005", new string[] { }); throw ex; } var properties = new Dictionary<string, string>(); properties.Add("MBCT", (string)mb.GetExtendedProperty("MBCT")); var ret = new MBInfo(); ret.id = mbSno; ret.ecr = mb.ECR; ret.mac = mb.MAC; ret.dateCode = mb.DateCode; ret.properties = properties; return ret; } catch (FisException e) { _logger.Error(e.mErrmsg); throw; } catch (Exception e) { _logger.Error(e.Message); throw; } finally { _logger.Debug("(ICTInput)MBReinputInputMBSno end, MB_SNo:" + mbSno); } }
private void setMBInfo(MBInfo info) { txtMBSno.Text = info.id; UpdatePanel1.Update(); txtFamily.Text = info.family; UpdatePanel2.Update(); txtModel.Text = info._111LevelId; UpdatePanel3.Update(); /* * Answer to: ITC-1360-0264 * Description: display description of test station on UI. */ try { txtTestStn.Text = info.testStation + " " + iTS.GeStationDescr(info.testStation); } catch (Exception e) { txtTestStn.Text = info.testStation; showInfo("Maybe station info of [" + info.testStation + "] is not maintained."); } UpdatePanel4.Update(); try { txtPdLine.Text = info.line + " " + iPdLine.GetPdLine(info.line).friendlyName; } catch (Exception e) { txtPdLine.Text = info.line; showInfo("Maybe line info of [" + info.line + "] is not maintained."); } UpdatePanel5.Update(); }
/// <summary> /// Reprint Input mbSno, Whether this mb can be reprinted. /// </summary> /// <returns>MBInfo</returns> public MBInfo EcrReprintInputMBSno(string mbSno, string editor, string line, string station, string customer) { _logger.Debug("(ICTInput)EcrReprintInputMBSno start, MB_SNo:" + mbSno); try { var mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository>(); var prodRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>(); var rptRepository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>(); var mb = mbRepository.Find(mbSno); if (mb == null || mb.MBStatus == null) { var ex = new FisException("SFC001", new[] { mbSno }); throw ex; } //c. 如果MB 已经投入到FA 生产,则报告错误:“此MB 已经投入到FA 生产,不能Reprint!!“ var productByMBSn = prodRepository.GetProductByMBSn(mbSno); if (productByMBSn != null) { var ex = new FisException("CHK013", new string[] { }); throw ex; } //MBSno是否在修复select * from PCBRepair nolock where PCBNo = @MBSno and Status = '0' 若存在,则报错:“请先修复后,再打印Label” if (null != mb.GetCurrentRepair()) { var ex = new FisException("CHK853", new string[] { }); throw ex; } //检查PrintLog记录是否存在,若不存在,则报错:“没有打印记录,不能重印” IList<PrintLog> PrintLogList = rptRepository.GetPrintLogListByRange(mbSno, "ECR Label"); if (PrintLogList == null || PrintLogList.Count == 0) { throw new FisException("CHK270", new string[] { mbSno }); } var ret = new MBInfo { id = mbSno, ecr = mb.ECR, dateCode = mb.DateCode }; return ret; } catch (FisException e) { _logger.Error(e.mErrmsg); throw; } catch (Exception e) { _logger.Error(e.Message); throw; } finally { _logger.Debug("(ICTInput)EcrReprintInputMBSno end, MB_SNo:" + mbSno); } }
/// <summary> /// 根据MBSNO取得MB相关信息 /// </summary> /// <param name="MBId">MB SNO</param> /// <returns>MB相关信息</returns> public IMES.DataModel.MBInfo GetMBInfo(string mbId) { IMES.DataModel.MBInfo mbInfo = new IMES.DataModel.MBInfo(); try { if (!String.IsNullOrEmpty(mbId)) { IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMES.FisObject.PCA.MB.IMB>(); ILineRepository lr = RepositoryFactory.GetInstance().GetRepository<ILineRepository>(); Line line = null; mbInfo = mbRepository.GetMBInfo(mbId); if (mbInfo.line != null) { line = lr.Find(mbInfo.line); if (line != null) { mbInfo.lineDesc = line.Descr; } } } return mbInfo; } catch (Exception) { throw; } }
/// <summary> /// 根据MBSNO取得MB相关信息 /// </summary> /// <param name="MBId">MB SNO</param> /// <returns>MB相关信息</returns> /// //Dean 20100329 public IMES.DataModel.MBInfo GetMBInfo(string mbId, out int MultiQTY) { MultiQTY = 0; IMES.DataModel.MBInfo mbInfo = new IMES.DataModel.MBInfo(); try { if (!String.IsNullOrEmpty(mbId)) { IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMES.FisObject.PCA.MB.IMB>(); ILineRepository lr = RepositoryFactory.GetInstance().GetRepository<ILineRepository>(); Line line = null; //Dean 20110329 IMES.FisObject.PCA.MB.IMB MBData=mbRepository.Find(mbId); if (MBData == null) { var ex = new FisException("SFC001", new string[] { mbId }); throw ex; } mbRepository.FillModelObj(MBData); //MBData.ModelObj MBCode MBCodeData= MBData.ModelObj.MbCodeObj; //如果MB Code 没有维护 [Multi Q’ty],则报告错误 if (MBCodeData != null) { MultiQTY = MBCodeData.MultQty; } else { //請維護 MCode [%1] 的連板數! var ex = new FisException("CHK153", new string[] { MBData.ModelObj.Mbcode }); throw ex; } //如果MB Code Maintain的[Multi Q’ty] 不在Range of Multi Q’ty 允许范围内,则报告错误 //該MB SNo為子板MB Sno,不能進行切板!! //MBCode 升位,CheckCode需要同步修改 // // CheckCode:若MBSN的第5码为’M’,则取MBSN的第6码,否则取第7码 // CheckCode为数字,则为子板,为’R’,则为RCTO // ============================================================ string strCheckCode = ""; if (mbId.Substring(4, 1) == "M" || mbId.Substring(4, 1) == "B") { strCheckCode = mbId.Substring(5, 1); } else { strCheckCode = mbId.Substring(6, 1); } // ============================================================ //if (mbId.Substring(5, 1).ToString() != "0" && MultiQTY > 1)//子板 if (strCheckCode != "0" && MultiQTY > 1)//子板 { var ex = new FisException("CHK161", new string[] { }); throw ex; } // if (mbId.Substring(5, 1).ToString() == "0")//母板 // { if (MultiQTY < 10 && MultiQTY > 0) { //当Multi Q’ty 大于1时,若MB Sno 为子板序列号,则不进行切板 – MB Sno第6位为0,则为母板,否则为子板 if (MultiQTY > 1) { /*if (mbId.Substring(5, 1).ToString() != "0") { //数据越界,请检查[%1] MultiQty! var ex = new FisException("CHK154", new string[] { MBData.ModelObj.Mbcode }); throw ex; }*/ } } else { //数据越界,请检查[%1] MultiQty! var ex = new FisException("CHK154", new string[] { MBData.ModelObj.Mbcode }); throw ex; } // } //Dean 20110329 mbInfo = mbRepository.GetMBInfo(mbId); if (mbInfo.line != null) { line = lr.Find(mbInfo.line); if (line != null) { mbInfo.lineDesc = line.Descr; } } } return mbInfo; } catch (Exception) { throw; } }
private ArrayList GetMBNoList(string beginNo, string endNo) { FisException ex; string strSQL = "select PCBNo, SMTMO from PCB where PCBNo between @beginNo and @endNo"; List<string> relLst = new List<string>(); List<string> _111Lst = new List<string>(); SqlParameter paraName = new SqlParameter("@beginNo", SqlDbType.VarChar, 32); paraName.Direction = ParameterDirection.Input; paraName.Value = beginNo; SqlParameter paraName2 = new SqlParameter("@endNo", SqlDbType.VarChar, 32); paraName2.Direction = ParameterDirection.Input; paraName2.Value = endNo; SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionString_GetData, System.Data.CommandType.Text, strSQL, paraName, paraName2); var mbModelRepository = (IMBModelRepository)RepositoryFactory.GetInstance().GetRepository<IMBModelRepository, IMBModel>(); MBRepository mbRepository = new MBRepository(); IMES.DataModel.MBInfo mbInfo = new IMES.DataModel.MBInfo(); bool bFirst = true; bool bCheckPass = true; string STMMO = ""; List<string> erpara = new List<string>(); if (dr.HasRows) { while (dr.Read()) { if (bFirst) { STMMO = dr["SMTMO"].ToString(); bFirst = false; erpara.Add(STMMO); } else { if (STMMO != dr["SMTMO"].ToString()) { bCheckPass = false; erpara.Add(dr["SMTMO"].ToString()); break; } } relLst.Add(dr[0].ToString()); mbInfo = mbRepository.GetMBInfo(dr[0].ToString()); MBModel model = (MBModel)mbModelRepository.Find(mbInfo._111LevelId); _111Lst.Add(mbInfo._111LevelId); } } if (!bCheckPass) { ex = new FisException("SFC012",erpara); throw ex; } ArrayList retrunValue = new ArrayList(); retrunValue.Add(relLst); retrunValue.Add(_111Lst); return retrunValue; }
public void Reprint( string startMBSNo, string endMBSNo, string reason, string editor, string stationId, string customerId) { logger.Debug("(MBLabelReprint)Reprint start, startMBSno:" + startMBSNo + "endMBSno:" + endMBSNo + " Reason:" + reason + " editor:" + editor + " stationId:" + stationId + " customerId:" + customerId); FisException ex; List<string> erpara = new List<string>(); IList<PrintItem> printList; try { string sessionKey = startMBSNo; int Qty = Convert.ToInt32(endMBSNo) - Convert.ToInt32(startMBSNo) + 1; Session Session = SessionManager.GetInstance.GetSession(sessionKey, theType); if (Session == null) { Session = new Session(sessionKey, theType, editor, stationId, "", customerId); Dictionary<string, object> wfArguments = new Dictionary<string, object>(); wfArguments.Add("Key", sessionKey); wfArguments.Add("Station", stationId); wfArguments.Add("CurrentFlowSession", Session); wfArguments.Add("Editor", editor); wfArguments.Add("Customer", customerId); wfArguments.Add("SessionType", theType); string wfName, rlName; RouteManagementUtils.GetWorkflow(stationId, "002MBLabelReprint.xoml", null, out wfName, out rlName); WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments); //WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("002MBLabelReprint.xoml", null, wfArguments); MBRepository mbRepository = new MBRepository(); IMES.DataModel.MBInfo mbInfo = new IMES.DataModel.MBInfo(); mbInfo = mbRepository.GetMBInfo(startMBSNo); Session.AddValue(Session.SessionKeys.Qty, Qty); Session.AddValue(Session.SessionKeys.DateCode, ""); Session.AddValue(Session.SessionKeys.motherOrChild, "0"); Session.AddValue(Session.SessionKeys.MBMONO, mbInfo.SMTMOId); Session.AddValue(Session.SessionKeys.ModelName, mbInfo._111LevelId); // Session.AddValue(Session.SessionKeys.PrintItems, printItems); //MB mb = new MB(); //mb.Model = _111; var mbModelRepository = (IMBModelRepository)RepositoryFactory.GetInstance().GetRepository<IMBModelRepository, IMBModel>(); MBModel model = (MBModel)mbModelRepository.Find(mbInfo._111LevelId); Session.AddValue(Session.SessionKeys.MBCode, model.Mbcode); Session.AddValue(Session.SessionKeys.MBType, model.Type); Session.SetInstance(instance); //for generate MB no if (!SessionManager.GetInstance.AddSession(Session)) { Session.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists."); erpara.Add(sessionKey); ex = new FisException("CHK020", erpara); throw ex; } Session.WorkflowInstance.Start(); Session.SetHostWaitOne(); } else { erpara.Add(sessionKey); ex = new FisException("CHK020", erpara); throw ex; } //check workflow exception if (Session.Exception != null) { if (Session.GetValue(Session.SessionKeys.WFTerminated) != null) { Session.ResumeWorkFlow(); } throw Session.Exception; } var MBNOList = (IList<string>)Session.GetValue(Session.SessionKeys.MBNOList); // startProdIdAndEndProdId = MBNOList; //startProdIdAndEndProdId.add(MBNOList[0]); //startProdIdAndEndProdId.Add(MBNOList[MBNOList.Count - 1]); IList<PrintItem> returnList = this.getPrintList(Session); // return returnList; } catch (FisException e) { throw e; } catch (Exception e) { throw new SystemException(e.Message); } finally { logger.Debug("(MBLabelReprint)Reprint start, startMBSno:" + startMBSNo + "endMBSno:" + endMBSNo + " Reason:" + reason + " editor:" + editor + " stationId:" + stationId + " customerId:" + customerId); } }
/// <summary> /// 刷mbsno,调用该方法启动工作流,根据输入mbsno获取model /// 返回model /// </summary> /// <param name="mbsno">mbsno</param> /// <param name="editor">editor</param> /// <param name="station">station</param> /// <param name="customer">customer</param> /// <param name="curMBInfo">curMBInfo</param> /// <returns>model</returns> public string inputMBSno(string mbsno, string editor, string station, string customer, out IMES.DataModel.MBInfo curMBInfo) { logger.Debug("(PCAOQCOutputImpl)InputCustSNOnCooLabel start, mbsno:" + mbsno + "editor:" + editor + "station:" + station + "customer:" + customer); FisException ex; List<string> erpara = new List<string>(); ArrayList retLst = new ArrayList(); try { string pdline = null; string sessionKey = mbsno; Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, Session.SessionType.MB); if (currentSession == null) { currentSession = new Session(sessionKey, Session.SessionType.MB, 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.MB); string wfName, rlName; RouteManagementUtils.GetWorkflow(station, "PCAOQCOutput.xoml", "PCAOQCOutput.rules", out wfName, out rlName); WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments); currentSession.AddValue(Session.SessionKeys.MBSN, mbsno); 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; } string line = string.Empty; MB currentMB = (MB)currentSession.GetValue(Session.SessionKeys.MB); if (string.IsNullOrEmpty(currentMB.MBStatus.Line)) { erpara.Add(sessionKey); ex = new FisException("PAK124", erpara); //该PCB %1 没有PdLine,请确认! throw ex; } line = currentMB.MBStatus.Line; ILineRepository lineRepository = RepositoryFactory.GetInstance().GetRepository<ILineRepository, Line>(); Line lineInfo = lineRepository.Find(line); if (lineInfo == null) { erpara.Add(sessionKey); ex = new FisException("PAK124", erpara); //该PCB %1 没有PdLine,请确认! throw ex; } curMBInfo = new IMES.DataModel.MBInfo(); curMBInfo.line = line; curMBInfo.lineDesc = lineInfo.Descr; string model = string.Empty; model = (string)currentSession.GetValue(Session.SessionKeys.PCBModelID); return model; } 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("(PCAOQCOutputImpl)InputCustSNOnCooLabel end, mbsno:" + mbsno + "editor:" + editor + "station:" + station + "customer:" + customer); } }
/// <summary> /// Reprint Input mbSno, Whether this mb can be reprinted. /// </summary> /// <returns>MBInfo</returns> public IList<MBInfo> EcrReprintInputMBSno(string mbSno, string editor, string line, string station, string customer) { _logger.Debug("(ICTInput)EcrReprintInputMBSno start, MB_SNo:" + mbSno); try { var mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository>(); var prodRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>(); var rptRepository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>(); var mb = mbRepository.Find(mbSno); IList<IMB> mbList = new List<IMB>(); IList<MBInfo> ret = new List<MBInfo>(); if (mb == null || mb.MBStatus == null) { var ex = new FisException("SFC001", new[] { mbSno }); throw ex; } if (mb.MBStatus.Status.ToString().Trim() == "CL") { mbList = mbRepository.GetChildMBFromParentMB(mbSno); if (mbList.Count == 0) { foreach (IMES.FisObject.PCA.MB.MBInfo items in mb.MBInfos) { var childMB = mbRepository.Find(items.InfoValue); mbList.Add(childMB); } } } else { mbList.Add(mb); } foreach (IMB item in mbList) { //c. 如果MB 已经投入到FA 生产,则报告错误:“此MB 已经投入到FA 生产,不能Reprint!!“ var productByMBSn = prodRepository.GetProductByMBSn(item.Key.ToString()); if (productByMBSn != null) { var ex = new FisException("CHK013", new string[] { }); throw ex; } //MBSno是否在修复select * from PCBRepair nolock where PCBNo = @MBSno and Status = '0' 若存在,则报错:“请先修复后,再打印Label” if (null != item.GetCurrentRepair()) { var ex = new FisException("CHK853", new string[] { }); throw ex; } //检查PrintLog记录是否存在,若不存在,则报错:“没有打印记录,不能重印” //IList<PrintLog> PrintLogList = rptRepository.GetPrintLogListByRange(mbSno, "ECR Label"); //if (PrintLogList == null || PrintLogList.Count == 0) if (!rptRepository.CheckPrintLogListByRange(item.Key.ToString(), "ECR Label")) { throw new FisException("CHK270", new string[] { mbSno }); } var iteminfo = new MBInfo { id = item.Key.ToString(), ecr = item.ECR, dateCode = item.DateCode }; ret.Add(iteminfo); } return ret; } catch (FisException e) { _logger.Error(e.mErrmsg); throw; } catch (Exception e) { _logger.Error(e.Message); throw; } finally { _logger.Debug("(ICTInput)EcrReprintInputMBSno end, MB_SNo:" + mbSno); } }
private void setMBInfo(MBInfo info) { txtMBSno.Text = info.id; UpdatePanel1.Update(); txtFamily.Text = info.family; UpdatePanel2.Update(); txtModel.Text = info._111LevelId; UpdatePanel3.Update(); /* * Answer to: ITC-1360-0264 * Description: display description of test station on UI. */ txtTestStn.Text = info.testStation + " " + iTS.GeStationDescr(info.testStation); UpdatePanel4.Update(); txtPdLine.Text = iPdLine.GetPdLine(info.line).friendlyName; UpdatePanel5.Update(); }