Пример #1
0
        private Messages CollectKeyPartTS(ProductInfo Product)
        {
            Messages msg = new Messages();

            // 根据联美兰达的需求,不良品如果到TS,则自动将KeyPart采到TS
            BenQGuru.eMES.TS.TSFacade  tsFacade = new BenQGuru.eMES.TS.TSFacade(this.DataProvider);
            BenQGuru.eMES.Domain.TS.TS ts       = (BenQGuru.eMES.Domain.TS.TS)tsFacade.GetCardLastTSRecord(Product.LastSimulation.RunningCard);
            if (ts != null && (ts.TSStatus == TSStatus.TSStatus_New || ts.TSStatus == TSStatus.TSStatus_Confirm || ts.TSStatus == TSStatus.TSStatus_TS))
            {
            }
            else
            {
                return(msg);
            }
            if (this.LastRCardOnWIPItem == null || this.LastRCardOnWIPItem.Length == 0)
            {
                return(msg);
            }

            Domain.TS.TSErrorCode2Location[] errorInfo = null;
            MaterialFacade mfacade = new MaterialFacade(this.DataProvider);


            ActionDropMaterial actionDrop = new ActionDropMaterial(this.DataProvider);

            for (int i = 0; i < this.LastRCardOnWIPItem.Length; i++)
            {
                msg.AddMessages(actionDrop.CollectKeyPartNG(this.LastRCardOnWIPItem[i].MCARD, errorInfo, _usercode, _rescode));
                if (msg.IsSuccess() == true)
                {
                    msg.Add(new UserControl.Message(MessageType.Success, "$KeyPart_NG_Collect_Success"));
                }
                msg.Add(new UserControl.Message(MessageType.Normal, "$PageControl_Keyparts: " + this.LastRCardOnWIPItem[i].MCARD));
            }
            return(msg);
        }
Пример #2
0
        /// <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);
        }
Пример #3
0
        /// <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);
        }