//Laws Lu,2006/01/10,获取不良代码组、不良代码 public static string ParseECG2Errs(object[] errorInfo, string actType) { string strReturn = String.Empty; if (errorInfo == null) { return(strReturn); } for (int i = 0; i < errorInfo.Length; i++) { if (actType == ActionType.DataCollectAction_SMTNG) { TSErrorCode2Location tsLoc = ((TSErrorCode2Location)errorInfo[i]); //Laws Lu,2006/06/06 string eg2er = tsLoc.ErrorCodeGroup + ":" + tsLoc.ErrorCode + ";"; if (strReturn.IndexOf(eg2er) < 0) { strReturn += tsLoc.ErrorCodeGroup + ":" + tsLoc.ErrorCode + ";"; } } if (actType == ActionType.DataCollectAction_NG || actType == ActionType.DataCollectAction_OutLineNG) { ErrorCodeGroup2ErrorCode tsLoc = ((ErrorCodeGroup2ErrorCode)errorInfo[i]); strReturn += tsLoc.ErrorCodeGroup + ":" + tsLoc.ErrorCode + ";"; } } return(strReturn); }
public object[] GetErrorInfo(ATETestInfo ateTestInfo, string modelcode) { /* Fail Code,to be confirmed, * 格式为FailCode和KeyName之间的分隔符是^;KeyName之间的分隔符是#;每组FailCode之间的分隔符是*; * 例如:FailCode^KeyName#KeyName*FailCode^KeyName#KeyName */ if (ateTestInfo.FailCode == null || ateTestInfo.FailCode.Trim().Length == 0) { return(null); } string[] failGroup = ateTestInfo.FailCode.Split('*'); int count = 0; for (int i = 0; i < failGroup.Length; i++) { count += failGroup[i].Split('^')[1].Split('#').Length; } object[] objs = new object[count]; int k = 0; for (int i = 0; i < failGroup.Length; i++) { string errorCode = failGroup[i].Split('^')[0]; string[] errorLoc = failGroup[i].Split('^')[1].Split('#'); for (int j = 0; j < errorLoc.Length; j++) { TSErrorCode2Location tsinfo = new TSErrorCode2Location(); tsinfo.ErrorCode = errorCode; TSModelFacade tsmodelFacade = new TSModelFacade(this.DataProvider); object[] objecgs = tsmodelFacade.QueryECG2ECByECAndModelCode(new string[] { errorCode }, modelcode); tsinfo.ErrorCodeGroup = (objecgs[0] as ErrorCodeGroup2ErrorCode).ErrorCodeGroup; tsinfo.ErrorLocation = errorLoc[j]; tsinfo.AB = ItemLocationSide.ItemLocationSide_AB; objs[k] = tsinfo; k++; } } return(objs); }
private void FCollectErrorCode_Load(object sender, EventArgs e) { UserControl.UIStyleBuilder.FormUI(this); //补录不良时默认不带出不良代码 if (!_isResActive) { this.LoadInitData(); } if (this.IsSelectErrorCode && Old_ErrorCodes != null && Old_ErrorCodes.Length > 0) { TSErrorCode2Location[] errorInfo = new TSErrorCode2Location[Old_ErrorCodes.Length]; for (int i = 0; i < Old_ErrorCodes.Length; i++) { TSErrorCode ec = Old_ErrorCodes[i] as TSErrorCode; errorInfo[i] = new BenQGuru.eMES.Domain.TS.TSErrorCode2Location(); errorInfo[i].ErrorCode = ec.ErrorCode; errorInfo[i].ErrorCodeGroup = ec.ErrorCodeGroup; if (ec.EAttribute1 != "" && ec.EAttribute1 != null) { string[] strLocPoint = ec.EAttribute1.Split('|'); errorInfo[i].ErrorLocation = strLocPoint[0]; // Marked by Scott //if (strLocPoint.Length > 1 && strLocPoint[1] != "") // errorInfo[i].Points = int.Parse(strLocPoint[1]); } errorInfo[i].AB = ItemLocationSide.ItemLocationSide_AB; } ucErrorCodeSelect21.AddSelectedErrorCodes(errorInfo); } if (this.IsSelectErrorCode) { txtResource.Visible = false; } }
/// <summary> /// 采集KeyPart不良 /// </summary> public Messages CollectKeyPartNG(string keyPartNo, TSErrorCode2Location[] errorInfo, string userCode, string resourceCode) { Messages msg = new Messages(); string strSql = "SELECT * FROM tblOnWIPItem WHERE MCard='" + keyPartNo + "' ORDER BY MDate DESC,MTime DESC "; object[] objs = this._domainDataProvider.CustomQuery(typeof(BenQGuru.eMES.Domain.DataCollect.OnWIPItem), new SQLCondition(strSql)); if (objs == null || objs.Length == 0) { msg.Add(new Message(MessageType.Error, "$KeyPart_NG_ErrorKeyPart")); return(msg); } BenQGuru.eMES.Domain.DataCollect.OnWIPItem item = (BenQGuru.eMES.Domain.DataCollect.OnWIPItem)objs[0]; TS.TSFacade tsFacade = new BenQGuru.eMES.TS.TSFacade(this.DataProvider); BenQGuru.eMES.Domain.TS.TS itemTs = new BenQGuru.eMES.Domain.TS.TS(); object objTs = tsFacade.GetCardLastTSRecord(keyPartNo); if (objTs != null) { Domain.TS.TS ts = (Domain.TS.TS)objTs; if (ts.TSStatus == TSStatus.TSStatus_New || ts.TSStatus == TSStatus.TSStatus_Confirm || ts.TSStatus == TSStatus.TSStatus_TS) { msg.Add(new Message(MessageType.Error, "$KeyPart_NG_In_TS")); return(msg); } } #region ItemTS DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); itemTs.MOCode = item.MOCode; itemTs.RunningCard = keyPartNo; itemTs.RunningCardSequence = tsFacade.GetUniqueTSRunningCardSequence(keyPartNo); itemTs.TSId = FormatHelper.GetUniqueID(item.MOCode, itemTs.RunningCard, itemTs.RunningCardSequence.ToString()); itemTs.TranslateCard = item.RunningCard; itemTs.TranslateCardSequence = item.RunningCardSequence; itemTs.CardType = CardType.CardType_Part; itemTs.TSStatus = TSStatus.TSStatus_New; itemTs.MaintainUser = userCode; itemTs.MaintainDate = dbDateTime.DBDate; itemTs.MaintainTime = dbDateTime.DBTime; itemTs.TSDate = itemTs.ConfirmDate; itemTs.TSTime = itemTs.ConfirmTime; itemTs.FromInputType = BenQGuru.eMES.TS.TSFacade.TSSource_TS; itemTs.FromUser = userCode; itemTs.FromDate = itemTs.MaintainDate; itemTs.FormTime = itemTs.MaintainTime; itemTs.FromOPCode = "TS"; itemTs.FromResourceCode = resourceCode; itemTs.FromRouteCode = item.RouteCode; itemTs.FromSegmentCode = item.SegmentCode; itemTs.FromShiftCode = item.ShiftCode; itemTs.FromShiftDay = item.MaintainDate; itemTs.FromShiftTypeCode = item.ShiftTypeCode; itemTs.FromStepSequenceCode = item.StepSequenceCode; itemTs.FromTimePeriodCode = item.TimePeriodCode; itemTs.ItemCode = item.MItemCode; itemTs.ModelCode = item.ModelCode; itemTs.TransactionStatus = TransactionStatus.TransactionStatus_NO; itemTs.TSDate = 0; itemTs.TSTime = 0; itemTs.MOSeq = item.MOSeq; itemTs.TSTimes = 1; tsFacade.AddTS(itemTs); #endregion #region Error Info for (int i = 0; errorInfo != null && i < errorInfo.Length; i++) { TSErrorCode tsErrorCode = new TSErrorCode(); TSErrorCode2Location tsErrorCode2Location = new TSErrorCode2Location(); int j = tsFacade.QueryTSErrorCodeCount(((TSErrorCode2Location)errorInfo[i]).ErrorCodeGroup, ((TSErrorCode2Location)errorInfo[i]).ErrorCode, itemTs.TSId); if (j == 0) { tsErrorCode.ErrorCode = ((TSErrorCode2Location)errorInfo[i]).ErrorCode; tsErrorCode.ErrorCodeGroup = ((TSErrorCode2Location)errorInfo[i]).ErrorCodeGroup; tsErrorCode.ItemCode = itemTs.ItemCode; tsErrorCode.MaintainDate = itemTs.MaintainDate; tsErrorCode.MaintainTime = itemTs.MaintainTime; tsErrorCode.MaintainUser = itemTs.MaintainUser; tsErrorCode.MOCode = itemTs.MOCode; tsErrorCode.ModelCode = itemTs.ModelCode; tsErrorCode.RunningCard = itemTs.RunningCard; tsErrorCode.RunningCardSequence = itemTs.RunningCardSequence; tsErrorCode.TSId = itemTs.TSId; tsErrorCode.MOSeq = itemTs.MOSeq; tsFacade.AddTSErrorCode(tsErrorCode); } if (((TSErrorCode2Location)errorInfo[i]).ErrorLocation.Trim() != string.Empty) { tsErrorCode2Location.AB = ((TSErrorCode2Location)errorInfo[i]).AB; tsErrorCode2Location.ErrorLocation = ((TSErrorCode2Location)errorInfo[i]).ErrorLocation; tsErrorCode2Location.ErrorCode = ((TSErrorCode2Location)errorInfo[i]).ErrorCode; tsErrorCode2Location.ErrorCodeGroup = ((TSErrorCode2Location)errorInfo[i]).ErrorCodeGroup; tsErrorCode2Location.ItemCode = tsErrorCode.ItemCode; tsErrorCode2Location.MaintainDate = tsErrorCode.MaintainDate; tsErrorCode2Location.MaintainTime = tsErrorCode.MaintainTime; tsErrorCode2Location.MaintainUser = tsErrorCode.MaintainUser; tsErrorCode2Location.MEMO = ""; tsErrorCode2Location.MOCode = tsErrorCode.MOCode; tsErrorCode2Location.ModelCode = tsErrorCode.ModelCode; tsErrorCode2Location.RunningCard = tsErrorCode.RunningCard; tsErrorCode2Location.RunningCardSequence = tsErrorCode.RunningCardSequence; if (tsErrorCode2Location.ErrorLocation.IndexOf(".") < 0) { tsErrorCode2Location.SubErrorLocation = tsErrorCode2Location.ErrorLocation; } else { tsErrorCode2Location.SubErrorLocation = tsErrorCode2Location.ErrorLocation.Substring( 0, tsErrorCode2Location.ErrorLocation.IndexOf(".")); } tsErrorCode2Location.TSId = tsErrorCode.TSId; tsErrorCode2Location.ShiftDay = tsErrorCode2Location.MaintainDate; tsErrorCode2Location.MOSeq = tsErrorCode.MOSeq; tsFacade.AddTSErrorCode2Location(tsErrorCode2Location); } } #endregion return(msg); }
private Messages SetRCardReflowByErrorCode(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); string routeCode = ""; string opCode = ""; System.Collections.Generic.List <string> listErrorCode = new System.Collections.Generic.List <string>(); if (((TSActionEventArgs)actionEventArgs).ErrorInfor != null) { TSErrorCode2Location[] error = new TSErrorCode2Location[((TSActionEventArgs)actionEventArgs).ErrorInfor.Length]; ((TSActionEventArgs)actionEventArgs).ErrorInfor.CopyTo(error, 0); for (int i = 0; i < error.Length; i++) { if (error[i].ErrorCode != "" && listErrorCode.Contains(error[i].ErrorCode) == false) { listErrorCode.Add(error[i].ErrorCode); } } } else if (((TSActionEventArgs)actionEventArgs).ErrorCodes != null) { ErrorCodeGroup2ErrorCode[] error = new ErrorCodeGroup2ErrorCode[((TSActionEventArgs)actionEventArgs).ErrorCodes.Length]; ((TSActionEventArgs)actionEventArgs).ErrorCodes.CopyTo(error, 0); for (int i = 0; i < error.Length; i++) { if (error[i].ErrorCode != "" && listErrorCode.Contains(error[i].ErrorCode) == false) { listErrorCode.Add(error[i].ErrorCode); } } } if (listErrorCode.Count == 0) { return(messages); } // 查询不良代码和产品对应的返工途程 TSModel.TSModelFacade tsmodelFacade = new BenQGuru.eMES.TSModel.TSModelFacade(this.DataProvider); object objErrorCode2OPRework = tsmodelFacade.GetErrorCode2OPRework(actionEventArgs.ProductInfo.NowSimulation.OPCode, listErrorCode[0], GlobalVariables.CurrentOrganizations.First().OrganizationID); object tempOPRework; ErrorCode2OPRework tempErrorCode2OPRework; if (objErrorCode2OPRework == null) { for (int i = 1; i < listErrorCode.Count; i++) { tempOPRework = tsmodelFacade.GetErrorCode2OPRework(actionEventArgs.ProductInfo.NowSimulation.OPCode, listErrorCode[i], GlobalVariables.CurrentOrganizations.First().OrganizationID); if (tempOPRework != null) { messages.Add(new Message(MessageType.Error, "$Error_ErrorCodeHaveMoreThanOneRoute")); return(messages); } } return(messages); } else { ErrorCode2OPRework firstErrorCode2OPRework = objErrorCode2OPRework as ErrorCode2OPRework; for (int i = 1; i < listErrorCode.Count; i++) { tempOPRework = tsmodelFacade.GetErrorCode2OPRework(actionEventArgs.ProductInfo.NowSimulation.OPCode, listErrorCode[i], GlobalVariables.CurrentOrganizations.First().OrganizationID); if (tempOPRework == null) { messages.Add(new Message(MessageType.Error, "$Error_ErrorCodeHaveMoreThanOneRoute")); return(messages); } else { tempErrorCode2OPRework = tempOPRework as ErrorCode2OPRework; if (tempErrorCode2OPRework.RouteCode != firstErrorCode2OPRework.RouteCode || tempErrorCode2OPRework.ToOPCode != firstErrorCode2OPRework.ToOPCode) { messages.Add(new Message(MessageType.Error, "$Error_ErrorCodeHaveMoreThanOneRoute")); return(messages); } } } opCode = firstErrorCode2OPRework.ToOPCode; routeCode = firstErrorCode2OPRework.RouteCode; if (string.Compare(opCode, "TS", true) == 0) { return(messages); } } if (routeCode.Trim().Length == 0) // 如果途程等于空,则将当前序列号的途程作为返工途程 { routeCode = actionEventArgs.ProductInfo.NowSimulation.RouteCode; } // 检查产品与途程的对应 ItemFacade itemFacade = new ItemFacade(this.DataProvider); ItemRoute2OP op = (ItemRoute2OP)itemFacade.GetItemRoute2Operation(actionEventArgs.ProductInfo.NowSimulation.ItemCode, routeCode, opCode); if (op == null) { messages.Add(new Message(MessageType.Error, "$Error_ReworkRouteNotBelongToItem [" + routeCode + "]")); return(messages); } // 将TS的状态改成维修中 TSFacade tsFacade = new TSFacade(this.DataProvider); object obj = tsFacade.GetCardLastTSRecord(actionEventArgs.RunningCard); if (obj != null) { Domain.TS.TS ts = (Domain.TS.TS)obj; ts.ConfirmResourceCode = actionEventArgs.ResourceCode; ts.ConfirmUser = actionEventArgs.UserCode; ts.ConfirmDate = actionEventArgs.ProductInfo.NowSimulation.MaintainDate; ts.ConfirmTime = actionEventArgs.ProductInfo.NowSimulation.MaintainTime; ts.TSStatus = TSStatus.TSStatus_TS; tsFacade.UpdateTS(ts); } else { return(messages); } // 开始设置回流 ActionFactory actionFactory = new ActionFactory(this.DataProvider); IAction actionTSComplete = actionFactory.CreateAction(ActionType.DataCollectAction_TSComplete); TSActionEventArgs tsactionEventArgs = new TSActionEventArgs( ActionType.DataCollectAction_TSComplete, actionEventArgs.RunningCard, actionEventArgs.UserCode, actionEventArgs.ResourceCode, TSStatus.TSStatus_Reflow, actionEventArgs.ProductInfo.NowSimulation.MOCode, actionEventArgs.ProductInfo.NowSimulation.ItemCode, routeCode, op.OPCode, actionEventArgs.UserCode, null); tsactionEventArgs.RouteCode = routeCode; tsactionEventArgs.IgnoreResourceInOPTS = true; messages.AddMessages(actionTSComplete.Execute(tsactionEventArgs)); return(messages); }
private object[] GetErrorInfor(ICTData ictData) { string[] errorList = ictData.ERRORCODES.Split('|'); ArrayList ecg2ecList = new ArrayList(); for (int i = 0; i < errorList.Length; i++) { if (errorList[i].Trim() == string.Empty) { continue; } bool hasShort = false; //是否有短路不良 bool hasOpen = false; //是否有开路不良 string[] deError = errorList[i].Split(';'); if (deError != null && deError.Length > 0) { for (int j = 0; j < deError.Length; j++) { if (deError[j].Trim() == string.Empty) { continue; } string[] ldeErrorInfo = deError[j].Split(','); TSErrorCode2Location tsinfo = new TSErrorCode2Location(); object[] ecg2ec = this.QueryECG2ECByECode(ldeErrorInfo[0]); tsinfo.ErrorCode = ldeErrorInfo[0]; if (tsinfo.ErrorCode.IndexOf("PVIB") > -1) { //OPEN Error if (hasShort) { continue; } } else if (tsinfo.ErrorCode.IndexOf("PVIA") > -1) { //Short Error if (hasOpen) { continue; } } tsinfo.ErrorLocation = getErrorLocation(ldeErrorInfo[1]); tsinfo.AB = "A"; if (ecg2ec != null && ecg2ec.Length > 0) { tsinfo.ErrorCodeGroup = ((ErrorCodeGroup2ErrorCode)ecg2ec[0]).ErrorCodeGroup; } else { tsinfo.ErrorCodeGroup = ldeErrorInfo[0] + "GROUP"; //如果没有不良代码组,填入默认值 } ecg2ecList.Add(tsinfo); if (tsinfo.ErrorCode.IndexOf("PVIB") > -1) { //OPEN Error hasShort = true; } else if (tsinfo.ErrorCode.IndexOf("PVIA") > -1) { //Short Error hasOpen = true; } } } } return((TSErrorCode2Location[])ecg2ecList.ToArray(typeof(TSErrorCode2Location))); }