/// <summary> /// 不良品采集 /// </summary> /// <param name="domainDataProvider"></param> /// <param name="iD"></param> /// <param name="actionType"></param> /// <param name="resourceCode"></param> /// <param name="userCode"></param> /// <param name="product"></param> /// <param name="datas1"></param> /// <param name="datas2"></param> /// <returns></returns> public Messages Execute(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect"); dataCollectDebug.WhenFunctionIn(messages); try { //检查ErrorCode,ErrorGroup是否正确 TODO //如果CS能确保ErrorCode,ErrorGroup是正确的,此处逻辑可以去掉 ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); //填写SIMULATION 检查工单、ID、途程、操作 messages.AddMessages(this.CheckIDIn(actionEventArgs)); if (messages.IsSuccess()) { messages.AddMessages(dataCollect.Execute(actionEventArgs)); if (messages.IsSuccess()) { //填写Reject报表 TODO ReworkFacade rework = new ReworkFacade(this.DataProvider); Reject reject = rework.CreateNewReject(); reject.ItemCode = actionEventArgs.ProductInfo.NowSimulationReport.ItemCode; reject.MaintainDate = actionEventArgs.ProductInfo.NowSimulationReport.MaintainDate; reject.MaintainTime = actionEventArgs.ProductInfo.NowSimulationReport.MaintainTime; reject.MaintainUser = actionEventArgs.ProductInfo.NowSimulationReport.MaintainUser; reject.MOCode = actionEventArgs.ProductInfo.NowSimulationReport.MOCode; reject.ModelCode = actionEventArgs.ProductInfo.NowSimulationReport.ModelCode; reject.OPCode = actionEventArgs.ProductInfo.NowSimulationReport.OPCode; reject.RejectDate = actionEventArgs.ProductInfo.NowSimulationReport.MaintainDate; reject.RejectStatus = RejectStatus.Reject; reject.RejectTime = actionEventArgs.ProductInfo.NowSimulationReport.MaintainTime; reject.RejectUser = actionEventArgs.ProductInfo.NowSimulationReport.MaintainUser; reject.ResourceCode = actionEventArgs.ProductInfo.NowSimulationReport.ResourceCode; reject.RouteCode = actionEventArgs.ProductInfo.NowSimulationReport.RouteCode; reject.RunningCard = actionEventArgs.ProductInfo.NowSimulationReport.RunningCard; reject.RunningCardSequence = actionEventArgs.ProductInfo.NowSimulationReport.RunningCardSequence; reject.SegmentCode = actionEventArgs.ProductInfo.NowSimulationReport.SegmentCode; reject.SourceCard = actionEventArgs.ProductInfo.NowSimulationReport.SourceCard; reject.SourceCardSequence = actionEventArgs.ProductInfo.NowSimulationReport.SourceCardSequence; reject.StepSequenceCode = actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode; reject.TranslateCard = actionEventArgs.ProductInfo.NowSimulationReport.TranslateCard; reject.TranslateCardSequence = actionEventArgs.ProductInfo.NowSimulationReport.TranslateCardSequence; //reject.LOTNO ="~"; reject.OPId = "~"; reject.EAttribute1 = ((TSActionEventArgs)actionEventArgs).Memo; reject.MOSeq = actionEventArgs.ProductInfo.NowSimulationReport.MOSeq; // Added by Icyer 2007/07/02 rework.AddReject(reject); //reject errorcode TODO //填写测试报表 TODO object[] obj = ((TSActionEventArgs)actionEventArgs).ErrorCodes; if (obj != null) { Reject2ErrorCode reject2ErrorCode = rework.CreateNewReject2ErrorCode(); for (int i = 0; i < obj.Length; i++) { reject2ErrorCode.ErrorCode = ((ErrorCodeGroup2ErrorCode)obj[i]).ErrorCode; reject2ErrorCode.ErrorCodeGroup = ((ErrorCodeGroup2ErrorCode)obj[i]).ErrorCodeGroup; reject2ErrorCode.MaintainDate = reject.MaintainDate; reject2ErrorCode.MaintainTime = reject.MaintainTime; reject2ErrorCode.MaintainUser = reject.MaintainUser; reject2ErrorCode.MOCode = reject.MOCode; reject2ErrorCode.RunningCard = reject.RunningCard; reject2ErrorCode.RunningCardSequence = reject.RunningCardSequence; reject2ErrorCode.MOSeq = reject.MOSeq; // Added by Icyer 2007/07/03 rework.AddReject2ErrorCode(reject2ErrorCode); } } } //ReportHelper reportCollect= new ReportHelper(this.DataProvider); //messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo)); ////messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo)); //messages.AddMessages(reportCollect.ReportLineECOQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo,((TSActionEventArgs)actionEventArgs).ErrorCodes)); } } catch (Exception e) { messages.Add(new Message(e)); } dataCollectDebug.WhenFunctionOut(messages); return(messages); }
private Messages SetReworkInformation(Messages messages, object[] Simulations, OQCRejectEventArgs actionEventArgs, ActionOnLineHelper dataCollect, ReworkFacade reworkFacade) { Messages newMessages = new Messages(); BenQGuru.eMES.TS.TSFacade tsFacade = new BenQGuru.eMES.TS.TSFacade(this.DataProvider); DataCollectFacade dcf = new DataCollectFacade(this._domainDataProvider); //ProductInfo preProduct =null; int i = 0; ActionCheckStatus actionCheckStatus = new ActionCheckStatus(); if (Resource == null) { BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider); Resource = (Domain.BaseSetting.Resource)dataModel.GetResource(actionEventArgs.ResourceCode); } while (i < Simulations.Length) { try { #region 保存WIP ProductInfo productionInf = dataCollect.GetIDInfoBySimulation((Simulation)Simulations[i]); if (actionEventArgs.listActionCheckStatus.ContainsKey(productionInf.LastSimulation.MOCode)) { actionCheckStatus = (ActionCheckStatus)actionEventArgs.listActionCheckStatus[productionInf.LastSimulation.MOCode]; actionCheckStatus.ProductInfo = productionInf; actionCheckStatus.ProductInfo.Resource = Resource; // lastSimulation = productionInf.LastSimulation; actionCheckStatus.ActionList = new ArrayList(); } else { //actionCheckStatus.NeedUpdateSimulation = false; //actionCheckStatus.NeedFillReport = true; actionEventArgs.listActionCheckStatus.Add(productionInf.LastSimulation.MOCode, actionCheckStatus); } OQCRejectEventArgs oqcRejectEventArgs = new OQCRejectEventArgs( ActionType.DataCollectAction_OQCReject, ((Simulation)Simulations[i]).RunningCard, actionEventArgs.UserCode, actionEventArgs.ResourceCode, actionEventArgs.OQCLotNO, productionInf); newMessages.AddMessages(dataCollect.CheckID(oqcRejectEventArgs, actionCheckStatus)); // if (preProduct != null) // { // if (dataCollect.CompareSimulationCheck(preProduct.LastSimulation,oqcRejectEventArgs.ProductInfo.LastSimulation)) // { // dataCollect.CopyProduct(preProduct,oqcRejectEventArgs.ProductInfo); // dcf.WriteSimulationCheckOnlineOP(oqcRejectEventArgs.RunningCard,oqcRejectEventArgs.ActionType,oqcRejectEventArgs.ResourceCode, // oqcRejectEventArgs.UserCode,oqcRejectEventArgs.ProductInfo); // needCheck=false; // } // } // if (needCheck) // newMessages.AddMessages(dataCollect.CheckID(oqcRejectEventArgs)); if (!newMessages.IsSuccess()) { return(newMessages); } #region TS //Laws Lu,需要修改 曾经走过TS处理,没有考虑多次TS的情况,MOCode和Sequence也应该作为关键参数, BenQGuru.eMES.Domain.TS.TS ts = (BenQGuru.eMES.Domain.TS.TS)tsFacade.GetCardLastTSRecord(oqcRejectEventArgs.RunningCard); if (ActionType.DataCollectAction_OQCReject == oqcRejectEventArgs.ActionType && ts != null && ts.FromInputType == TS.TSFacade.TSSource_OnWIP ) { //Laws Lu,2006/07/07 修复在OQC前工序NG回流后,SN后仍然留在PK站 dcf.AdjustRouteOPOnline(oqcRejectEventArgs.RunningCard , ActionType.DataCollectAction_OQCReject , oqcRejectEventArgs.ResourceCode , oqcRejectEventArgs.UserCode , oqcRejectEventArgs.ProductInfo); //oqcRejectEventArgs.ProductInfo.NowSimulation.OPCode = op.OPCode; dcf.WriteSimulation( oqcRejectEventArgs.RunningCard , ActionType.DataCollectAction_OQCReject , oqcRejectEventArgs.ResourceCode , oqcRejectEventArgs.UserCode , oqcRejectEventArgs.ProductInfo); } #endregion //Laws Lu,2006/07/07 fix op if (oqcRejectEventArgs.ProductInfo.CurrentItemRoute2OP != null) { oqcRejectEventArgs.ProductInfo.NowSimulation.OPCode = oqcRejectEventArgs.ProductInfo.CurrentItemRoute2OP.OPCode; } else { object objNextOP = (new BaseModelFacade(DataProvider)).GetNextOperationOfRoute(oqcRejectEventArgs.ProductInfo.LastSimulation.RouteCode, oqcRejectEventArgs.ProductInfo.LastSimulation.OPCode); if (objNextOP != null) { oqcRejectEventArgs.ProductInfo.NowSimulation.OPCode = (objNextOP as Operation).OPCode; } } oqcRejectEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.Reject; if (actionCheckStatus.NeedUpdateSimulation == true) { //把资源暂时替换成onwip需要正确资源 string resCode = oqcRejectEventArgs.ResourceCode; oqcRejectEventArgs.ResourceCode = actionEventArgs.rightResource; newMessages.AddMessages(dataCollect.Execute(oqcRejectEventArgs)); //转换回原来的资源 oqcRejectEventArgs.ResourceCode = resCode; } #endregion if (newMessages.IsSuccess()) { if (oqcRejectEventArgs.ProductInfo.NowSimulation == null) { throw new Exception("$System_Error"); } #region reject Reject reject = reworkFacade.CreateNewReject(); reject.ItemCode = oqcRejectEventArgs.ProductInfo.NowSimulation.ItemCode; reject.LOTNO = oqcRejectEventArgs.OQCLotNO; reject.MaintainUser = oqcRejectEventArgs.UserCode; reject.MOCode = oqcRejectEventArgs.ProductInfo.NowSimulation.MOCode; reject.ModelCode = oqcRejectEventArgs.ProductInfo.NowSimulation.ModelCode; reject.OPCode = oqcRejectEventArgs.ProductInfo.NowSimulation.OPCode; reject.RejectDate = oqcRejectEventArgs.ProductInfo.NowSimulation.MaintainDate; reject.RejectStatus = RejectStatus.Reject; reject.RejectTime = oqcRejectEventArgs.ProductInfo.NowSimulation.MaintainTime; reject.RejectUser = oqcRejectEventArgs.UserCode; reject.ResourceCode = oqcRejectEventArgs.ResourceCode; reject.RouteCode = oqcRejectEventArgs.ProductInfo.NowSimulation.RouteCode; reject.RunningCard = oqcRejectEventArgs.RunningCard; reject.RunningCardSequence = oqcRejectEventArgs.ProductInfo.NowSimulation.RunningCardSequence; reject.SegmentCode = oqcRejectEventArgs.ProductInfo.NowSimulationReport.SegmentCode; reject.SourceCard = oqcRejectEventArgs.ProductInfo.NowSimulation.SourceCard; reject.SourceCardSequence = oqcRejectEventArgs.ProductInfo.NowSimulation.SourceCardSequence; reject.StepSequenceCode = oqcRejectEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode; reject.TranslateCard = oqcRejectEventArgs.ProductInfo.NowSimulation.TranslateCard; reject.TranslateCardSequence = oqcRejectEventArgs.ProductInfo.NowSimulation.TranslateCardSequence; reject.MOSeq = oqcRejectEventArgs.ProductInfo.NowSimulation.MOSeq; // Added by Icyer 2007/07/02 reworkFacade.AddReject(reject); #endregion } //Laws Lu,2005/08/25,新增 //样本如果有若干个已经经过“送修确认”转为“待修”状态(或者在维修中),那么批退不可以继续 //TSFacade tsFacade = new TSFacade(this._domainDataProvider); //Laws Lu,2005/08/25,新增 删除TS中的记录 //Laws Lu,2005/08/31,修改 只有FQC工序送修才能够被删除 if (oqcRejectEventArgs.ActionType == ActionType.DataCollectAction_OQCReject && ts != null && ts.FromInputType == TS.TSFacade.TSSource_OnWIP && ts.TSStatus == BenQGuru.eMES.Web.Helper.TSStatus.TSStatus_New) { if (ts.FromRouteCode == oqcRejectEventArgs.ProductInfo.LastSimulation.RouteCode && ts.FromOPCode == oqcRejectEventArgs.ProductInfo.LastSimulation.OPCode && ts.MOCode == oqcRejectEventArgs.ProductInfo.LastSimulation.MOCode && ts.RunningCardSequence == oqcRejectEventArgs.ProductInfo.LastSimulation.RunningCardSequence && ts.RunningCard == oqcRejectEventArgs.ProductInfo.LastSimulation.RunningCard) { tsFacade.DeleteCardInTS( oqcRejectEventArgs.ProductInfo.LastSimulation.MOCode , oqcRejectEventArgs.ProductInfo.LastSimulation.RunningCard , oqcRejectEventArgs.ProductInfo.LastSimulation.RunningCardSequence.ToString()); } } } catch (Exception ex) { newMessages.Add(new Message(ex)); } //preProduct=oqcRejectEventArgs.ProductInfo; i = i + 1; } //Laws Lu,2006/03/20 填写资源报表 //Laws Lu,2006/03/21 支持混单 Hashtable htOutput = new Hashtable(); foreach (Simulation sim in Simulations) { Simulation tmpSim = null; foreach (Simulation x in htOutput.Keys) { if (sim.MOCode == x.MOCode) { tmpSim = x; break; } } if (tmpSim != null) { htOutput[tmpSim] = Convert.ToInt32(htOutput[tmpSim]) + 1; } else { htOutput.Add(sim, 1); } } foreach (Simulation sim in htOutput.Keys) { ProductInfo product = null; Messages msgs = dataCollect.GetIDInfo(sim.RunningCard); if (msgs.IsSuccess()) { product = msgs.GetData().Values[0] as ProductInfo; } DBDateTime dbDateTime; dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); // dcf.AdjustRouteOPOnline( // product.LastSimulation.RunningCard, // actionEventArgs.ActionType, // actionEventArgs.ResourceCode, // actionEventArgs.UserCode, // product); product.NowSimulation.MaintainUser = actionEventArgs.UserCode; product.NowSimulation.MaintainDate = dbDateTime.DBDate; product.NowSimulation.MaintainTime = dbDateTime.DBTime; product.NowSimulation.LastAction = actionEventArgs.ActionType; product.NowSimulation.ProductStatus = ProductStatus.GOOD; product.NowSimulation.ResourceCode = Resource.ResourceCode; (new DataCollectFacade(DataProvider)).WriteSimulation( product.LastSimulation.RunningCard , ActionType.DataCollectAction_OQCPass , actionEventArgs.ResourceCode , actionEventArgs.UserCode , product); product.NowSimulation.RouteCode = product.LastSimulation.RouteCode; product.NowSimulation.OPCode = product.LastSimulation.OPCode;; product.NowSimulationReport = dataCollect.FillSimulationReport(product); //dataCollect.FillOnWip(pro); //newMessages.AddMessages((new ReportHelper(DataProvider)).SetReportResQuanMaster( // DataProvider // , actionEventArgs.ActionType // , product // , 0 // , Convert.ToInt32(htOutput[sim]) // , Convert.ToInt32(htOutput[sim]))); } return(newMessages); }
/// <summary> /// 不良品采集 /// </summary> /// <param name="domainDataProvider"></param> /// <param name="iD"></param> /// <param name="actionType"></param> /// <param name="resourceCode"></param> /// <param name="userCode"></param> /// <param name="product"></param> /// <param name="datas1"></param> /// <param name="datas2"></param> /// <returns></returns> public Messages Execute(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect"); dataCollectDebug.WhenFunctionIn(messages); try { if (((TSActionEventArgs)actionEventArgs).OPCode == string.Empty) { throw new Exception("$CS_Sys_OutLine_LostOPParam"); } string opCode = ((TSActionEventArgs)actionEventArgs).OPCode; messages.AddMessages(this.CheckIDIn(actionEventArgs)); if (messages.IsSuccess()) { ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); //补充SIMULATION 不良信息 if (actionEventArgs.ActionType == ActionType.DataCollectAction_OutLineReject) { actionEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.Reject; actionEventArgs.ProductInfo.NowSimulation.NGTimes = actionEventArgs.ProductInfo.NowSimulation.NGTimes + 1; //2006/01/10,新增 OQCNG后将产品脱离批 actionEventArgs.ProductInfo.NowSimulation.LOTNO = String.Empty; } messages.AddMessages(dataCollect.Execute(actionEventArgs)); if (messages.IsSuccess()) { //填写Reject报表 TODO ReworkFacade rework = new ReworkFacade(this.DataProvider); Reject reject = rework.CreateNewReject(); reject.ItemCode = actionEventArgs.ProductInfo.NowSimulationReport.ItemCode; reject.MaintainDate = actionEventArgs.ProductInfo.NowSimulationReport.MaintainDate; reject.MaintainTime = actionEventArgs.ProductInfo.NowSimulationReport.MaintainTime; reject.MaintainUser = actionEventArgs.ProductInfo.NowSimulationReport.MaintainUser; reject.MOCode = actionEventArgs.ProductInfo.NowSimulationReport.MOCode; reject.ModelCode = actionEventArgs.ProductInfo.NowSimulationReport.ModelCode; reject.OPCode = actionEventArgs.ProductInfo.NowSimulationReport.OPCode; reject.RejectDate = actionEventArgs.ProductInfo.NowSimulationReport.MaintainDate; reject.RejectStatus = RejectStatus.Reject; reject.RejectTime = actionEventArgs.ProductInfo.NowSimulationReport.MaintainTime; reject.RejectUser = actionEventArgs.ProductInfo.NowSimulationReport.MaintainUser; reject.ResourceCode = actionEventArgs.ProductInfo.NowSimulationReport.ResourceCode; reject.RouteCode = ((ExtendSimulation)actionEventArgs.ProductInfo.LastSimulation).NextRouteCode; reject.RunningCard = actionEventArgs.ProductInfo.NowSimulationReport.RunningCard; reject.RunningCardSequence = actionEventArgs.ProductInfo.NowSimulationReport.RunningCardSequence; reject.SegmentCode = actionEventArgs.ProductInfo.NowSimulationReport.SegmentCode; reject.SourceCard = actionEventArgs.ProductInfo.NowSimulationReport.SourceCard; reject.SourceCardSequence = actionEventArgs.ProductInfo.NowSimulationReport.SourceCardSequence; reject.StepSequenceCode = actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode; reject.TranslateCard = actionEventArgs.ProductInfo.NowSimulationReport.TranslateCard; reject.TranslateCardSequence = actionEventArgs.ProductInfo.NowSimulationReport.TranslateCardSequence; //reject.LOTNO ="~"; reject.OPId = "~"; reject.EAttribute1 = ((TSActionEventArgs)actionEventArgs).Memo; reject.MOSeq = actionEventArgs.ProductInfo.NowSimulation.MOSeq; // Added by Icyer 2007/07/02 rework.AddReject(reject); //reject errorcode TODO //填写测试报表 TODO object[] obj = ((TSActionEventArgs)actionEventArgs).ErrorCodes; if (obj != null) { Reject2ErrorCode reject2ErrorCode = rework.CreateNewReject2ErrorCode(); for (int i = 0; i < obj.Length; i++) { reject2ErrorCode.ErrorCode = ((ErrorCodeGroup2ErrorCode)obj[i]).ErrorCode; reject2ErrorCode.ErrorCodeGroup = ((ErrorCodeGroup2ErrorCode)obj[i]).ErrorCodeGroup; reject2ErrorCode.MaintainDate = reject.MaintainDate; reject2ErrorCode.MaintainTime = reject.MaintainTime; reject2ErrorCode.MaintainUser = reject.MaintainUser; reject2ErrorCode.MOCode = reject.MOCode; reject2ErrorCode.RunningCard = reject.RunningCard; reject2ErrorCode.RunningCardSequence = reject.RunningCardSequence; reject2ErrorCode.LotNo = reject.LOTNO; //reject2ErrorCode.LotSeq = reject.l reject2ErrorCode.MOSeq = reject.MOSeq; // Added by Icyer 2007/07/03 rework.AddReject2ErrorCode(reject2ErrorCode); } } //ReportHelper reportCollect= new ReportHelper(this.DataProvider); //messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo)); ////messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo)); //messages.AddMessages(reportCollect.ReportLineECOQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo,((TSActionEventArgs)actionEventArgs).ErrorCodes)); // } // if (messages.IsSuccess()) // { // actionEventArgs.ProductInfo.ECG2ErrCodes = ActionTS.ParseECG2Errs(((OutLineActionEventArgs)actionEventArgs).ErrorCodes,actionEventArgs.ActionType); // // //填写测试报表 TODO // ReportHelper reportCollect= new ReportHelper(this.DataProvider); // messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo)); // messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo)); // // if (actionEventArgs.ActionType == ActionType.DataCollectAction_OutLineReject) // { // messages.AddMessages( dataCollect.CollectErrorInformation(this.DataProvider, actionEventArgs.ActionType, // actionEventArgs.ProductInfo, // ((OutLineActionEventArgs)actionEventArgs).ErrorCodes, null, // ((OutLineActionEventArgs)actionEventArgs).Memo)); // messages.AddMessages(reportCollect.ReportLineECOQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo,((OutLineActionEventArgs)actionEventArgs).ErrorCodes)); // } // // } // } } } catch (Exception e) { messages.Add(new Message(e)); } dataCollectDebug.WhenFunctionOut(messages); return(messages); }