private BenQGuru.eMES.Domain.TS.TS GetTS(RMADetial rmadetial) { BenQGuru.eMES.Domain.TS.TS itemTs = null; itemTs = new BenQGuru.eMES.Domain.TS.TS(); if (_DataCollectFacade == null) { _DataCollectFacade = new DataCollectFacade(this.DataProvider); } itemTs.MOCode = ""; itemTs.RMABillCode = rmadetial.Rmabillcode; itemTs.RunningCard = rmadetial.Rcard; itemTs.RunningCardSequence = 0; itemTs.TSId = FormatHelper.GetUniqueID("", itemTs.RunningCard, itemTs.RunningCardSequence.ToString()); itemTs.TranslateCard = rmadetial.Rcard; itemTs.TranslateCardSequence = 0; itemTs.CardType = CardType.CardType_Product; itemTs.TSStatus = TSStatus.TSStatus_New; itemTs.SourceCardSequence = 0; itemTs.MaintainUser = this.GetUserCode(); itemTs.MaintainDate = FormatHelper.TODateInt(DateTime.Now); itemTs.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); itemTs.TSDate = 0; itemTs.TSTime = 0; itemTs.FromInputType = TSFacade.TSSource_RMA; itemTs.FromUser = itemTs.MaintainUser; itemTs.FromDate = itemTs.MaintainDate; itemTs.FormTime = itemTs.MaintainTime; itemTs.FromOPCode = " "; itemTs.FromResourceCode = " "; itemTs.FromRouteCode = " "; itemTs.FromSegmentCode = " "; itemTs.FromShiftCode = " "; itemTs.FromShiftDay = FormatHelper.TODateInt(DateTime.Now); itemTs.FromShiftTypeCode = " "; itemTs.FromStepSequenceCode = " "; itemTs.FromTimePeriodCode = " "; itemTs.FromSegmentCode = " "; itemTs.TSTimes = _TSFacade.GetMaxTSTimes(rmadetial.Rcard) + 1; itemTs.ItemCode = rmadetial.Itemcode; itemTs.ModelCode = rmadetial.Modelcode; itemTs.TransactionStatus = " "; if (_ReportFacade == null) { _ReportFacade = new BenQGuru.eMES.Report.ReportFacade(this.DataProvider); } object obmTimeDimension = _ReportFacade.GetTimeDimension(itemTs.FromShiftDay); if (obmTimeDimension != null) { itemTs.Week = (obmTimeDimension as Domain.Report.TimeDimension).Week; itemTs.Month = (obmTimeDimension as Domain.Report.TimeDimension).Month; } else { itemTs.Week = 0; itemTs.Month = 0; } if (_MOFacade == null) { _MOFacade = new MOFacade(this.DataProvider); } object objmo = _MOFacade.GetMO(rmadetial.Remocode); if (objmo == null) { itemTs.MOSeq = 0; } else { itemTs.MOSeq = (objmo as MO).MOSeq; } return(itemTs); }
/// <summary> /// 采集NG后,可以再次测试采集,这里做自动Undo /// </summary> public Messages UndoNG(ActionEventArgs actionEventArgs) { Messages msg = new Messages(); // 是否配置需要Undo if (System.Configuration.ConfigurationSettings.AppSettings["UndoNG"] != "1") { return(msg); } bool bNeedUndo = false; BenQGuru.eMES.TS.TSFacade tsFacade = null; BenQGuru.eMES.Domain.TS.TS ts = null; object objTmp; if (actionEventArgs.ProductInfo != null && actionEventArgs.ProductInfo.LastSimulation != null) { // 上次采NG的才可以Undo if (actionEventArgs.ProductInfo.LastSimulation.ProductStatus == ProductStatus.NG) { // 产品是否还在本OP BenQGuru.eMES.BaseSetting.BaseModelFacade modelFacade = new BaseModelFacade(this.DataProvider); objTmp = modelFacade.GetOperation2Resource(actionEventArgs.ProductInfo.LastSimulation.OPCode, actionEventArgs.ResourceCode); if (objTmp == null) { return(msg); } // 是否已在做维修 tsFacade = new BenQGuru.eMES.TS.TSFacade(this.DataProvider); ts = (BenQGuru.eMES.Domain.TS.TS)tsFacade.GetCardLastTSRecord(actionEventArgs.ProductInfo.LastSimulation.RunningCard); if (ts == null || ts.TSStatus != TSStatus.TSStatus_New) { return(msg); } bNeedUndo = true; } } if (bNeedUndo == false) { return(msg); } // 开始Undo // 查询OnWIP Simulation simulation = actionEventArgs.ProductInfo.LastSimulation; string strSql = "SELECT * FROM tblOnWIP WHERE RCard='" + simulation.RunningCard + "' AND MOCode='" + simulation.MOCode + "' ORDER BY RCardSeq "; object[] objsWip = this.DataProvider.CustomQuery(typeof(OnWIP), new SQLCondition(strSql)); if (objsWip == null || objsWip.Length < 2) { return(msg); } OnWIP wip = (OnWIP)objsWip[objsWip.Length - 1]; BenQGuru.eMES.Report.ReportFacade reportFacade = new BenQGuru.eMES.Report.ReportFacade(this.DataProvider); DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); #region 更新TS相关 /* 不用再清除不良信息 * // 查询TBLTSERRORCODE * strSql = "SELECT * FROM TBLTSERRORCODE WHERE TSID='" + ts.TSId + "' "; * object[] objsErrorCode = this.DataProvider.CustomQuery(typeof(BenQGuru.eMES.Domain.TS.TSErrorCode), new SQLCondition(strSql)); * string strErrorCodeList = string.Empty; * if (objsErrorCode != null) * { * // 更新TBLRPTRESECG * for (int i = 0; i < objsErrorCode.Length; i++) * { * BenQGuru.eMES.Domain.TS.TSErrorCode errorCode = (BenQGuru.eMES.Domain.TS.TSErrorCode)objsErrorCode[i]; * objTmp = reportFacade.GetReportErrorCode2Resource(wip.ModelCode, wip.ItemCode, wip.MOCode, wip.ShiftDay, wip.ShiftCode, wip.TimePeriodCode, wip.OPCode, wip.ResourceCode, wip.SegmentCode, wip.StepSequenceCode, errorCode.ErrorCodeGroup, errorCode.ErrorCode); * if (objTmp != null) * { * BenQGuru.eMES.Domain.Report.ReportErrorCode2Resource rptError = (BenQGuru.eMES.Domain.Report.ReportErrorCode2Resource)objTmp; * if (rptError.NGTimes == 1) * { * reportFacade.DeleteReportErrorCode2Resource(rptError); * } * else * { * rptError.NGTimes = rptError.NGTimes - 1; * reportFacade.UpdateReportErrorCode2Resource(rptError); * } * } * strErrorCodeList = strErrorCodeList + errorCode.ErrorCodeGroup + ":" + errorCode.ErrorCode + ";"; * } * // 删除TBLTSERRORCODE * if (objsErrorCode.Length == 1) * tsFacade.DeleteTSErrorCode((BenQGuru.eMES.Domain.TS.TSErrorCode)objsErrorCode[0]); * else * { * strSql = "DELETE FROM TBLTSERRORCODE WHERE TSID='" + ts.TSId + "' "; * this.DataProvider.CustomExecute(new SQLCondition(strSql)); * } * } * // 删除TS * tsFacade.DeleteTS(ts); */ // 更新TS ts.TSStatus = TSStatus.TSStatus_RepeatNG; // 不良品重复测试 ts.ReflowMOCode = simulation.MOCode; ts.ReflowOPCode = simulation.OPCode; ts.ReflowRouteCode = simulation.RouteCode; tsFacade.UpdateTS(ts); #endregion // 更新报表 //UndoNGReport(simulation, wip, true, strErrorCodeList, (OnWIP)objsWip[objsWip.Length - 2]); if (System.Configuration.ConfigurationSettings.AppSettings["UndoNGUndoReport"] == "1") { // 查询TBLTSERRORCODE strSql = "SELECT * FROM TBLTSERRORCODE WHERE TSID='" + ts.TSId + "' "; object[] objsErrorCode = this.DataProvider.CustomQuery(typeof(BenQGuru.eMES.Domain.TS.TSErrorCode), new SQLCondition(strSql)); string strErrorCodeList = string.Empty; if (objsErrorCode != null) { // 更新TBLRPTRESECG for (int i = 0; i < objsErrorCode.Length; i++) { BenQGuru.eMES.Domain.TS.TSErrorCode errorCode = (BenQGuru.eMES.Domain.TS.TSErrorCode)objsErrorCode[i]; strErrorCodeList = strErrorCodeList + errorCode.ErrorCodeGroup + ":" + errorCode.ErrorCode + ";"; } } //UndoNGReport(simulation, wip, true, strErrorCodeList, (OnWIP)objsWip[objsWip.Length - 2]); } // 更新Simulation UndoNGSimulation(simulation, true, (OnWIP)objsWip[objsWip.Length - 2]); //UpdateUndoWIP((OnWIP)objsWip[objsWip.Length - 1]); // 保留测试信息 // 如果上次采集是GOOD->NG,这次采GOOD,那还需要Undo再上次的GOOD wip = (OnWIP)objsWip[objsWip.Length - 2]; if (wip.Action == ActionType.DataCollectAction_GOOD && wip.OPCode == simulation.OPCode) { if (System.Configuration.ConfigurationSettings.AppSettings["UndoNGUndoReport"] == "1") { // 更新报表 //UndoNGReport(simulation, wip, false, string.Empty, (OnWIP)objsWip[objsWip.Length - 3]); } // 更新Simulation UndoNGSimulation(simulation, false, (OnWIP)objsWip[objsWip.Length - 3]); //UpdateUndoWIP((OnWIP)objsWip[objsWip.Length - 2]); // 保留测试信息 } ActionOnLineHelper onlineHelper = new ActionOnLineHelper(this.DataProvider); Messages msgTmp = onlineHelper.GetIDInfo(simulation.RunningCard); actionEventArgs.ProductInfo = (ProductInfo)msgTmp.GetData().Values[0]; return(msg); }
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> /// ** 功能描述: 确认流程卡序列号的维修 /// ** 作 者: crystal chu /// ** 日 期: 2005/07/26/ /// ** 修 改: /// ** 日 期: /// ** nunit /// </summary> /// <param name="actionEventArgs"> </param> /// <returns></returns> public Messages Execute(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect"); dataCollectDebug.WhenFunctionIn(messages); try { ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); //检查res在不在OPTS中 messages.AddMessages(dataCollect.CheckResourceInOperationTS(actionEventArgs)); //Laws Lu,2006/11/13 uniform system collect date DBDateTime dbDateTime; //Laws Lu,2006/11/13 uniform system collect date if (actionEventArgs.ProductInfo != null && actionEventArgs.ProductInfo.WorkDateTime != null) { dbDateTime = actionEventArgs.ProductInfo.WorkDateTime; } else { dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); if (actionEventArgs.ProductInfo != null) { actionEventArgs.ProductInfo.WorkDateTime = dbDateTime; } } DateTime dtNow = FormatHelper.ToDateTime(dbDateTime.DBDate, dbDateTime.DBTime); if (messages.IsSuccess()) { //Laws Lu,2005/09/16,修改 整理逻辑 TSFacade tsFacade = new TSFacade(this.DataProvider); // if( !tsFacade.IsCardInTS(actionEventArgs.RunningCard)) // { // messages.Add(new Message(MessageType.Error,"$CSError_Card_Not_In_TS")); // } //Laws Lu,2005/10/16,在订单1中的已经拆解的产品序列号, //现在系统中可以实现将该产品序列号重新归属到另外一个订单2, //但是该产品序列号在工单2采集完不良后, //作送修作业时,系统提出报错信息: //该产品状态为“拆解”状态。导致该产品序列号无法进行维修。 object obj = tsFacade.GetCardLastTSRecordInNewStatus(actionEventArgs.RunningCard); if (obj == null) { //Laws Lu,2006,07/05 Support RMA Repair // if(actionEventArgs.IsRMA) // { MOFacade moFAC = new MOFacade(DataProvider); object objRMA = moFAC.GetRepairRMARCARDByRcard(actionEventArgs.RunningCard); if (objRMA != null) { #region 新增维修信息 RMARCARD rma = objRMA as RMARCARD; Domain.TS.TS tS = tsFacade.CreateNewTS(); tS.TSId = FormatHelper.GetUniqueID((rma.REWORKMOCODE == String.Empty?rma.RMABILLNO:rma.REWORKMOCODE) , actionEventArgs.RunningCard, ActionOnLineHelper.StartSeq.ToString()); tS.CardType = CardType.CardType_Product;; tS.FormTime = rma.MTIME; tS.FromDate = rma.MDATE; tS.FromInputType = TSFacade.TSSource_RMA; tS.FromUser = rma.MUSER; tS.FromMemo = rma.EATTRIBUTE1; //Laws Lu,2006/07/05 add support RMA tS.RMABillCode = rma.RMABILLNO; //工作时间和工业布局信息 //Laws Lu,2005/11/09,新增 记录ShiftDay BaseSetting.BaseModelFacade dataModel = new BaseSetting.BaseModelFacade(this.DataProvider); Domain.BaseSetting.Resource res = (Domain.BaseSetting.Resource)dataModel.GetResource(actionEventArgs.ResourceCode); //onwip.SegmentCode = productInfo.NowSimulationReport.SegmentCode; //2006/11/17,Laws Lu add get DateTime from db Server BaseSetting.ShiftModelFacade shiftModel = new BaseSetting.ShiftModelFacade(this.DataProvider); Domain.BaseSetting.TimePeriod period = (Domain.BaseSetting.TimePeriod)shiftModel.GetTimePeriod(res.ShiftTypeCode, Web.Helper.FormatHelper.TOTimeInt(dtNow)); if (period == null) { throw new Exception("$OutOfPerid"); } if (period.IsOverDate == Web.Helper.FormatHelper.TRUE_STRING) { if (period.TimePeriodBeginTime < period.TimePeriodEndTime) { tS.FromShiftDay = FormatHelper.TODateInt(dtNow.AddDays(-1)); } else if (Web.Helper.FormatHelper.TOTimeInt(dtNow) < period.TimePeriodBeginTime) { tS.FromShiftDay = FormatHelper.TODateInt(dtNow.AddDays(-1)); } else { tS.FromShiftDay = FormatHelper.TODateInt(dtNow); } } else { tS.FromShiftDay = FormatHelper.TODateInt(dtNow); } tS.FromOPCode = "TS"; tS.FromResourceCode = actionEventArgs.ResourceCode; tS.FromRouteCode = String.Empty; tS.FromSegmentCode = res.SegmentCode; tS.FromShiftCode = period.ShiftCode; /*Laws Lu,2006/03/11 修正班次填写有误*/ tS.FromShiftTypeCode = period.ShiftTypeCode; tS.FromStepSequenceCode = res.StepSequenceCode; tS.FromTimePeriodCode = period.TimePeriodCode; tS.ItemCode = rma.ITEMCODE; tS.MaintainDate = FormatHelper.TODateInt(dtNow); tS.MaintainTime = FormatHelper.TOTimeInt(dtNow); tS.MaintainUser = actionEventArgs.MaintainUser; tS.MOCode = (rma.REWORKMOCODE == String.Empty?rma.RMABILLNO:rma.REWORKMOCODE); tS.ModelCode = rma.MODELCODE; tS.RunningCard = actionEventArgs.RunningCard; tS.RunningCardSequence = ActionOnLineHelper.StartSeq; tS.SourceCard = actionEventArgs.RunningCard; tS.SourceCardSequence = ActionOnLineHelper.StartSeq; tS.TransactionStatus = TSFacade.TransactionStatus_None; tS.TranslateCard = actionEventArgs.RunningCard; tS.TranslateCardSequence = ActionOnLineHelper.StartSeq; //tS.TSStatus = TSStatus.TSStatus_New; tS.Week = (new ReportHelper(DataProvider)).WeekOfYear(tS.FromShiftDay.ToString()); tS.Month = int.Parse(tS.FromShiftDay.ToString().Substring(4, 2)); tS.TSTimes = ActionOnLineHelper.StartNGTimes; tS.ConfirmUser = actionEventArgs.UserCode; tS.ConfirmDate = FormatHelper.TODateInt(dtNow); tS.ConfirmTime = FormatHelper.TOTimeInt(dtNow); tS.ConfirmOPCode = "TS"; tS.ConfirmResourceCode = actionEventArgs.ResourceCode; tS.TSStatus = TSStatus.TSStatus_Confirm; // Added by Icyer 2007/07/03 MO mo = (MO)moFAC.GetMO(tS.MOCode); if (mo != null) { tS.MOSeq = mo.MOSeq; } // Added end tsFacade.AddTS(tS); //Laws Lu,2006/07/07 add ,Success release than delete rma moFAC.DeleteRMARCARD(rma); #endregion } else { messages.Add(new Message(MessageType.Error, "$CSError_Card_Not_In_TS_OR_Status_Error")); } // } // else // { // messages.Add(new Message(MessageType.Error,"$CSError_Card_Not_In_TS_OR_Status_Error")); // } } else { BenQGuru.eMES.Domain.TS.TS ts = (BenQGuru.eMES.Domain.TS.TS)obj; if (ts.TSStatus == TSStatus.TSStatus_New) { ts.ConfirmUser = actionEventArgs.UserCode; ts.ConfirmDate = FormatHelper.TODateInt(dtNow); ts.ConfirmTime = FormatHelper.TOTimeInt(dtNow); ts.ConfirmOPCode = "TS"; ts.ConfirmResourceCode = actionEventArgs.ResourceCode; ts.TSStatus = TSStatus.TSStatus_Confirm; //added by jessie lee, 2005/11/24, ts.MaintainUser = actionEventArgs.MaintainUser; ts.MaintainDate = FormatHelper.TODateInt(dtNow); ts.MaintainTime = FormatHelper.TOTimeInt(dtNow); tsFacade.UpdateTSConfirmStatus(ts); } else { messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_Error $Current_Status $" + ts.TSStatus)); } } } } catch (Exception e) { messages.Add(new Message(e)); } dataCollectDebug.WhenFunctionOut(messages); return(messages); }
public override Messages Action(object act) { Messages msgs = new Messages(); if (act == null) { return(msgs); } BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null; DataCollect.Action.ActionEventArgs args; if (ObjectState == null) { args = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs(); args.RunningCard = act.ToString().Trim().ToUpper(); } else { args = ObjectState as DataCollect.Action.ActionEventArgs; } //Laws Lu,2006/06/03 添加 获取已有连接 if ((act as IDCTClient).DBConnection != null) { domainProvider = (act as IDCTClient).DBConnection as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider; } else { domainProvider = Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider() as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider; (act as IDCTClient).DBConnection = domainProvider; } if (msgs.IsSuccess()) { //检查序列号 ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider); msgs = _helper.GetIDInfo(args.RunningCard); if (msgs.IsSuccess()) { ProductInfo product = (ProductInfo)msgs.GetData().Values[0]; if (product == null || product.LastSimulation == null) { msgs.Add(new UserControl.Message(MessageType.Error, "$NoSimulation")); } else { msgs.ClearMessages(); if (product.LastSimulation.IsComplete == "1") { msgs.Add(new UserControl.Message(MessageType.Error, "$CS_ERROR_PRODUCT_ALREADY_COMPLETE")); } else { switch (product.LastSimulation.ProductStatus) { case ProductStatus.NG: BenQGuru.eMES.Domain.TS.TS ts = (BenQGuru.eMES.Domain.TS.TS)(new TSFacade(domainProvider)).GetCardLastTSRecord(args.RunningCard); if (ts != null && (ts.TSStatus == TSStatus.TSStatus_Complete || ts.TSStatus == TSStatus.TSStatus_Reflow)) { msgs.AddMessages(GetRunningCardOP(product, domainProvider)); } else { msgs.Add(new UserControl.Message(MessageType.Error, "$CS_NG_PLEASE_SEND_TS")); } break; case ProductStatus.OffMo: msgs.Add(new UserControl.Message(MessageType.Error, "$CS_RCRAD_ALREADY_OFF_MO")); break; case ProductStatus.Scrap: msgs.Add(new UserControl.Message(MessageType.Error, "$CS_Error_Product_Already_Scrap")); break; default: msgs.AddMessages(GetRunningCardOP(product, domainProvider)); break; } } } } } if (msgs.IsSuccess()) { base.Action(act); } ProcessBeforeReturn(this.Status, msgs); return(msgs); }