Ejemplo n.º 1
0
        /// <summary>
        /// Undo时更新Simulation数据
        /// </summary>
        private void UndoNGSimulation(Simulation simulation, bool isNG, OnWIP wip)
        {
            // 更新Simulation
            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
            string            lastAction        = wip.Action;

            simulation.LastAction = lastAction;
            string[] actionList = simulation.ActionList.Split(';');
            simulation.ActionList    = string.Join(";", actionList, 0, actionList.Length - 2) + ";";
            simulation.ProductStatus = wip.ActionResult;
            if (isNG == true)
            {
                simulation.NGTimes = simulation.NGTimes - 1;
            }
            simulation.IsComplete = FormatHelper.BooleanToString(false);
            //simulation.RunningCardSequence = wip.RunningCardSequence;		// 保留测试信息
            dataCollectFacade.UpdateSimulation(simulation);
            // 更新SimulationReport
            SimulationReport simulationReport = (SimulationReport)dataCollectFacade.GetLastSimulationReport(simulation.RunningCard);

            simulationReport.LastAction = lastAction;
            simulationReport.Status     = wip.ActionResult;
            if (isNG == true)
            {
                simulationReport.NGTimes = simulationReport.NGTimes - 1;
            }
            simulationReport.IsComplete = FormatHelper.BooleanToString(false);
            //simulationReport.RunningCardSequence = wip.RunningCardSequence;		// 保留测试信息
            dataCollectFacade.UpdateSimulationReport(simulationReport);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新Undo的WIP
        /// </summary>
        /// <param name="wip"></param>
        private void UpdateUndoWIP(OnWIP wip)
        {
            string strSql = "INSERT INTO tblOnWIPUndo SELECT * FROM tblOnWIP WHERE MOCode='" + wip.MOCode + "' AND RCard='" + wip.RunningCard + "' AND RCardSeq=" + wip.RunningCardSequence.ToString();

            this.DataProvider.CustomExecute(new SQLCondition(strSql));
            this.DataProvider.Delete(wip);
        }
Ejemplo n.º 3
0
        private void NewProduceDetail(OnWIP onWIP, OnOffPostEnvirenment nowEnv, PerformanceFacade performanceFacade)
        {
            int manCount = performanceFacade.QueryLine2ManDetailCount(string.Empty, nowEnv.StepSequence.StepSequenceCode, string.Empty, string.Empty, 0, string.Empty, performanceFacade.GetLine2ManDetailStatusList(true));

            int shiftBeginDate = nowEnv.GetShiftBeginDate();
            int shiftBeginTime = nowEnv.Shift.ShiftBeginTime;

            LinePause linePause = (LinePause)performanceFacade.GetLatestLinePause(nowEnv.StepSequence.StepSequenceCode);

            if (linePause != null && linePause.EndDate == shiftBeginDate && linePause.EndTime > shiftBeginTime)
            {
                shiftBeginTime = FormatHelper.TOTimeInt(FormatHelper.ToDateTime(linePause.EndDate, linePause.EndTime).AddSeconds(1));
            }

            ProduceDetail newProduceDetail = performanceFacade.CreateNewProduceDetail();

            newProduceDetail.SSCode       = nowEnv.StepSequence.StepSequenceCode;
            newProduceDetail.ShiftDate    = nowEnv.ShiftDate;
            newProduceDetail.ShiftCode    = nowEnv.Shift.ShiftCode;
            newProduceDetail.BeginDate    = shiftBeginDate;
            newProduceDetail.BeginTime    = shiftBeginTime;
            newProduceDetail.EndDate      = nowEnv.GetShiftEndDate();
            newProduceDetail.EndTime      = nowEnv.Shift.ShiftEndTime;
            newProduceDetail.Duration     = FormatHelper.GetSpanSeconds(newProduceDetail.BeginDate, newProduceDetail.BeginTime, newProduceDetail.EndDate, newProduceDetail.EndTime);
            newProduceDetail.Status       = ProduceDetailStatus.ProduceDetailStatus_Open;
            newProduceDetail.ManCount     = manCount;
            newProduceDetail.MOCode       = onWIP.MOCode;
            newProduceDetail.MaintainUser = onWIP.MaintainUser;
            performanceFacade.AddProduceDetail(newProduceDetail);
        }
Ejemplo n.º 4
0
        public Messages PerformanceCollect(OnWIP onWIP)
        {
            Messages returnValue = new Messages();

            try
            {
                //检查
                if (returnValue.IsSuccess())
                {
                    returnValue.AddMessages(CheckBeforePerformanceCollect(onWIP));
                }

                //获取环境信息
                DBDateTime           nowDateTime        = new DBDateTime(FormatHelper.ToDateTime(onWIP.MaintainDate, onWIP.MaintainTime));
                OnOffPostEnvirenment nowEnv             = new OnOffPostEnvirenment();
                DBDateTime           lastSecondDateTime = new DBDateTime(FormatHelper.ToDateTime(onWIP.MaintainDate, onWIP.MaintainTime).AddSeconds(-1));
                OnOffPostEnvirenment lastSecondEnv      = new OnOffPostEnvirenment();
                if (returnValue.IsSuccess())
                {
                    if (!nowEnv.InitWithoutResAndOP(this.DataProvider, onWIP.StepSequenceCode, nowDateTime))
                    {
                        returnValue.Add(new UserControl.Message(MessageType.Error, "$Error_CannotGetEnvironmentInfo"));
                    }
                }
                if (returnValue.IsSuccess())
                {
                    if (!lastSecondEnv.InitWithoutResAndOP(this.DataProvider, onWIP.StepSequenceCode, lastSecondDateTime))
                    {
                        returnValue.Add(new UserControl.Message(MessageType.Error, "$Error_CannotGetEnvironmentInfo"));
                    }
                }

                //InputTimes+1之后的绩效采集
                if (returnValue.IsSuccess())
                {
                    returnValue.AddMessages(CollectAfterInputTimesAdded(onWIP, nowEnv, lastSecondEnv));
                }

                //Output工序的绩效采集
                if (returnValue.IsSuccess())
                {
                    returnValue.AddMessages(CollectAtLineOutputOP(onWIP, nowEnv, lastSecondEnv));
                }
            }
            catch (Exception ex)
            {
                returnValue.Add(new UserControl.Message(ex));
            }

            return(returnValue);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///Angel Zhu Add TEST :Onwip
        /// </summary>
        public void TestOnWip()
        {
            OnWIP onwip = dataCollectFacade.CreateNewOnWIP();

            onwip.RunningCard         = RuncardCode;
            onwip.MaintainTime        = 165102;
            onwip.MaintainDate        = 20050523;
            onwip.MaintainUser        = "******";
            onwip.RunningCardSequence = 1;
            onwip.ModelCode           = "Model0";
            onwip.MOCode                = "MO1";
            onwip.TranslateCard         = "card1";
            onwip.SourceCard            = RuncardCode;
            onwip.Action                = "Action1";
            onwip.ActionResult          = "Ok";
            onwip.ShiftDay              = 20050523;
            onwip.TranslateCardSequence = 1;
            onwip.SourceCardSequence    = 1;
            onwip.NGTimes               = 165702;
            onwip.ItemCode              = "Item1";
            onwip.TimePeriodCode        = "period1";
            onwip.ShiftCode             = "shift1";
            onwip.ShiftTypeCode         = "shifttype1";

            this.dataCollectFacade.DeleteOnWIP(onwip);
            this.dataCollectFacade.AddOnWIP(onwip);

            onwip.RunningCard         = RuncardCode;
            onwip.MaintainTime        = 170000;
            onwip.MaintainDate        = 20050523;
            onwip.MaintainUser        = "******";
            onwip.RunningCardSequence = 2;
            onwip.ModelCode           = "Model1";
            onwip.MOCode                = "MO2";
            onwip.TranslateCard         = "card2";
            onwip.SourceCard            = RuncardCode;
            onwip.Action                = "Action2";
            onwip.ActionResult          = "Ok";
            onwip.ShiftDay              = 20050523;
            onwip.TranslateCardSequence = 1;
            onwip.SourceCardSequence    = 1;
            onwip.NGTimes               = 165702;
            onwip.ItemCode              = "Item2";
            onwip.TimePeriodCode        = "period2";
            onwip.ShiftCode             = "shift2";
            onwip.ShiftTypeCode         = "shifttype2";

            this.dataCollectFacade.UpdateOnWIP(onwip);
        }
Ejemplo n.º 6
0
        public void initGirdData()
        {
            Messages msg = new Messages();

            _DataTableLoadedPart.Clear();
            if (m_DataCollectFacade == null)
            {
                m_DataCollectFacade = new DataCollectFacade(this.DataProvider);
            }
            try
            {
                //加入工单的条件  add by klaus
                string   sourceRcard = m_DataCollectFacade.GetSourceCard(FormatHelper.CleanString(this.txtRcard.Text.Trim().ToUpper()), this.drownListMoCode.SelectedItemValue.ToString());
                object[] objs        = m_DataCollectFacade.QueryItemTracingFlow(sourceRcard,
                                                                                Convert.ToString(this.drownListRouteCode.SelectedItemValue),
                                                                                Convert.ToString(this.drownListMoCode.SelectedItemValue));
                _DataTableLoadedPart.Clear();
                if (objs == null)
                {
                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$CS_No_Data_To_Display"));
                    return;
                }

                for (int i = 0; i < objs.Length; i++)
                {
                    OnWIP wip = objs[i] as OnWIP;
                    _DataTableLoadedPart.Rows.Add(new object[] {
                        wip.ItemCode.ToString(),
                        wip.RunningCard.ToString(),
                        wip.MOCode.ToString(),
                        MutiLanguages.ParserString(wip.ActionResult.ToString()),
                        wip.OPCode.ToString(),
                        GetOPResult(wip.Action),
                        wip.RouteCode.ToString(),
                        wip.SegmentCode.ToString(),
                        wip.StepSequenceCode.ToString(),
                        wip.ResourceCode.ToString(),
                        FormatHelper.ToDateString(wip.MaintainDate),
                        FormatHelper.ToTimeString(wip.MaintainTime),
                        wip.GetDisplayText("MaintainUser")
                    });
                }
                this.gridSimulation.DataSource = this._DataTableLoadedPart;
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 7
0
        private Messages CheckBeforePerformanceCollect(OnWIP onWIP)
        {
            Messages returnValue = new Messages();

            PerformanceFacade performanceFacade = new PerformanceFacade(this.DataProvider);

            //检查是否有上岗人员
            if (returnValue.IsSuccess())
            {
                int manCount = performanceFacade.QueryLine2ManDetailCount(string.Empty, onWIP.StepSequenceCode, string.Empty, string.Empty, 0, string.Empty, performanceFacade.GetLine2ManDetailStatusList(true));
                if (manCount <= 0)
                {
                    returnValue.Add(new UserControl.Message(MessageType.Error, "$Error_NoManCountOnLine"));
                }
            }

            return(returnValue);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Undo时更新报表数据
        /// </summary>
        private void UndoNGReport(Simulation simulation, OnWIP wip, bool isNG, string errorCodeList, OnWIP prevWip)
        {
            BenQGuru.eMES.Report.ReportFacade reportFacade = new BenQGuru.eMES.Report.ReportFacade(this.DataProvider);
            // 更新TBLRPTHISOPQTY
            string qtyFlag = "N";
            object objTmp  = reportFacade.GetReportHistoryOPQty(wip.ModelCode, wip.ShiftDay, wip.MOCode, wip.TimePeriodCode, wip.StepSequenceCode, wip.SegmentCode, wip.ItemCode, wip.ShiftCode, wip.OPCode, wip.ResourceCode, "N");

            if (objTmp == null)
            {
                objTmp  = reportFacade.GetReportHistoryOPQty(wip.ModelCode, wip.ShiftDay, wip.MOCode, wip.TimePeriodCode, wip.StepSequenceCode, wip.SegmentCode, wip.ItemCode, wip.ShiftCode, wip.OPCode, wip.ResourceCode, "Y");
                qtyFlag = "Y";
            }
            if (objTmp != null)
            {
                BenQGuru.eMES.Domain.Report.ReportHistoryOPQty hisQty = (BenQGuru.eMES.Domain.Report.ReportHistoryOPQty)objTmp;
                // 如果上次是NG
                if (isNG == true)
                {
                    // NG次数减1
                    hisQty.NGTimes = hisQty.NGTimes - 1 * simulation.IDMergeRule;
                    // 更新不良代码列表
                    if (hisQty.ErrorGroup2Err.Length >= errorCodeList.Length && errorCodeList != string.Empty)
                    {
                        hisQty.ErrorGroup2Err = hisQty.ErrorGroup2Err.Substring(0, hisQty.ErrorGroup2Err.Length - errorCodeList.Length);
                    }
                }
                else                    // 如果上次是GOOD
                {
                    // 如果是Undo GOOD,那OutputQty要不要减 1 ?
                    // 由于Undo GOOD之前一定做过Undo NG,所以OutputQty不用减 1
                    // 也就是这个OP上最后采集的结果是NG,本来就没有记OutputQty
                    //hisQty.OuputQty = hisQty.OuputQty - 1;
                }
                if (prevWip.Action == ActionType.DataCollectAction_GoMO)
                {
                    // 减去OP采集数
                    hisQty.EAttribute2 = hisQty.EAttribute2 - 1 * simulation.IDMergeRule;
                }
                this.DataProvider.Update(hisQty);
            }
            // 更新tblrptreallineecqty
            if (isNG == true)
            {
                string[] errorCodes = errorCodeList.Split(';');
                for (int i = 0; i < errorCodes.Length; i++)
                {
                    if (errorCodes[i] == string.Empty)
                    {
                        continue;
                    }
                    string[] errorCode = errorCodes[i].Split(':');
                    BenQGuru.eMES.Domain.Report.ReportRealtimeLineErrorCodeQty rptErrorCode =
                        (BenQGuru.eMES.Domain.Report.ReportRealtimeLineErrorCodeQty)reportFacade.GetReportRealtimeLineErrorCodeQty(wip.ModelCode, wip.ShiftDay, wip.MOCode, wip.TimePeriodCode, wip.StepSequenceCode, wip.SegmentCode, wip.ItemCode, wip.ShiftCode, errorCode[1], errorCode[0]);
                    if (rptErrorCode != null)
                    {
                        if (rptErrorCode.ErrorCodeTimes <= 1)
                        {
                            reportFacade.DeleteReportRealtimeLineErrorCodeQty(rptErrorCode);
                        }
                        else
                        {
                            string strSql = "UPDATE tblrptreallineecqty SET ECTimes=ECTimes-1 WHERE ModelCode='" + wip.ModelCode + "' AND ShiftDay=" + wip.ShiftDay.ToString() +
                                            " AND MOCode='" + wip.MOCode + "' AND TPCode='" + wip.TimePeriodCode + "' AND SSCode='" + wip.StepSequenceCode + "' AND SegCode='" + wip.SegmentCode + "' AND ItemCode='" + wip.ItemCode + "' AND ShiftCode='" + wip.ShiftCode + "' " +
                                            " AND ECODE='" + errorCode[1] + "' AND ECGCODE='" + errorCode[0] + "' ";
                            this.DataProvider.CustomExecute(new SQLCondition(strSql));
                        }
                    }
                }
            }
            // 更新TBLRPTREALLINEQTY
            string updateField = string.Empty;

            // 如果上次是NG
            if (isNG == true)
            {
                // NG次数减1
                updateField = "NGTimes=NGTimes-" + (1 * simulation.IDMergeRule).ToString();
            }
            else
            {
                // 如果完工,则更新完工数量
                if (FormatHelper.StringToBoolean(simulation.IsComplete) == true)
                {
                    updateField = "OutputQty=OutputQty-" + (1 * simulation.IDMergeRule).ToString();
                    if (simulation.NGTimes == 0)
                    {
                        BenQGuru.eMES.Rework.ReworkFacade reworkFacade = new BenQGuru.eMES.Rework.ReworkFacade(this.DataProvider);
                        if (reworkFacade.GetRejectCountByMO(simulation.RunningCard, simulation.MOCode) == 0)
                        {
                            updateField += "AllGoodQty=AllGoodQty-" + (1 * simulation.IDMergeRule).ToString();
                        }
                    }
                    // 更新工单产出
                    string strSql = "UPDATE tblMO SET MOActQty=MOActQty-" + (1 * simulation.IDMergeRule).ToString() + " WHERE MOCode='" + simulation.MOCode + "' ";
                    this.DataProvider.CustomExecute(new SQLCondition(strSql));
                }
            }
            if (updateField != string.Empty)
            {
                string strSql = "UPDATE TBLRPTREALLINEQTY SET " + updateField + " WHERE ModelCode='" + wip.ModelCode + "' AND ShiftDay=" + wip.ShiftDay.ToString() +
                                " AND MOCode='" + wip.MOCode + "' AND TPCode='" + wip.TimePeriodCode + "' AND SSCode='" + wip.StepSequenceCode + "' AND SegCode='" + wip.SegmentCode + "' AND ItemCode='" + wip.ItemCode + "' AND ShiftCode='" + wip.ShiftCode + "' " +
                                " AND QtyFlag='" + qtyFlag + "' ";
                this.DataProvider.CustomExecute(new SQLCondition(strSql));
            }
        }
Ejemplo n.º 10
0
        private Messages CollectAtLineOutputOP(OnWIP onWIP, OnOffPostEnvirenment nowEnv, OnOffPostEnvirenment lastSecondEnv)
        {
            Messages returnValue = new Messages();

            ItemFacade        itemFacade        = new ItemFacade(this.DataProvider);
            PerformanceFacade performanceFacade = new PerformanceFacade(this.DataProvider);

            //获取是否LineOutputCount需要加一:仅判断是否为产量工序
            ItemRoute2OP itemRoute2OP         = (ItemRoute2OP)itemFacade.GetItemRoute2OP(onWIP.ItemCode, onWIP.RouteCode, onWIP.OPCode);
            bool         lineOutpitCountAdded = false;

            if (itemRoute2OP != null && itemRoute2OP.OPControl.Substring(10, 1) == "1")
            {
                lineOutpitCountAdded = true;
            }

            if (lineOutpitCountAdded)
            {
                ProduceDetail produceDetail = (ProduceDetail)performanceFacade.GetLatestProduceDetail(onWIP.StepSequenceCode, 0, string.Empty, true);

                if (produceDetail == null)
                {
                    NewProduceDetail(onWIP, nowEnv, performanceFacade);
                }
                else
                {
                    if (produceDetail.ShiftDate == nowEnv.ShiftDate && produceDetail.ShiftCode == nowEnv.Shift.ShiftCode)
                    {
                        if (string.Compare(produceDetail.MOCode, onWIP.MOCode, true) != 0)
                        {
                            if (produceDetail.Status == ProduceDetailStatus.ProduceDetailStatus_Open)
                            {
                                produceDetail.EndDate      = lastSecondEnv.DBDateTime.DBDate;
                                produceDetail.EndTime      = lastSecondEnv.DBDateTime.DBTime;
                                produceDetail.Duration     = FormatHelper.GetSpanSeconds(produceDetail.BeginDate, produceDetail.BeginTime, produceDetail.EndDate, produceDetail.EndTime);
                                produceDetail.Status       = ProduceDetailStatus.ProduceDetailStatus_Close;
                                produceDetail.MaintainUser = onWIP.MaintainUser;
                                performanceFacade.UpdateProduceDetail(produceDetail);
                            }

                            int manCount = performanceFacade.QueryLine2ManDetailCount(string.Empty, nowEnv.StepSequence.StepSequenceCode, string.Empty, string.Empty, 0, string.Empty, performanceFacade.GetLine2ManDetailStatusList(true));

                            ProduceDetail newProduceDetail = performanceFacade.CreateNewProduceDetail();
                            newProduceDetail.SSCode       = onWIP.StepSequenceCode;
                            newProduceDetail.ShiftDate    = nowEnv.ShiftDate;
                            newProduceDetail.ShiftCode    = nowEnv.Shift.ShiftCode;
                            newProduceDetail.BeginDate    = nowEnv.DBDateTime.DBDate;
                            newProduceDetail.BeginTime    = nowEnv.DBDateTime.DBTime;
                            newProduceDetail.EndDate      = nowEnv.GetShiftEndDate();
                            newProduceDetail.EndTime      = nowEnv.Shift.ShiftEndTime;
                            newProduceDetail.Duration     = FormatHelper.GetSpanSeconds(newProduceDetail.BeginDate, newProduceDetail.BeginTime, newProduceDetail.EndDate, newProduceDetail.EndTime);
                            newProduceDetail.Status       = ProduceDetailStatus.ProduceDetailStatus_Open;
                            newProduceDetail.ManCount     = manCount;
                            newProduceDetail.MOCode       = onWIP.MOCode;
                            newProduceDetail.MaintainUser = onWIP.MaintainUser;
                            performanceFacade.AddProduceDetail(newProduceDetail);
                        }
                    }
                    else
                    {
                        if (produceDetail.Status == ProduceDetailStatus.ProduceDetailStatus_Open)
                        {
                            produceDetail.Status       = ProduceDetailStatus.ProduceDetailStatus_Close;
                            produceDetail.MaintainUser = onWIP.MaintainUser;
                            performanceFacade.UpdateProduceDetail(produceDetail);
                        }

                        NewProduceDetail(onWIP, nowEnv, performanceFacade);
                    }
                }
            }

            return(returnValue);
        }
Ejemplo n.º 11
0
        private Messages CollectAfterInputTimesAdded(OnWIP onWIP, OnOffPostEnvirenment nowEnv, OnOffPostEnvirenment lastSecondEnv)
        {
            Messages returnValue = new Messages();

            PerformanceFacade performanceFacade = new PerformanceFacade(this.DataProvider);

            //获取是否InputTimes需要加一:Job中的逻辑如下
            //IF INSTR(v_ActionList, '|' || v_ONWIPData.action || '|') > 0 THEN
            //    v_RPTOPQTY.inputtimes := v_RPTOPQTY.inputtimes + 1;
            //END IF;
            string validActionList = "|BURNIN|BURNOUT|CARTON|GOOD|NG|SMTGOOD|SMTNG|";
            bool   inputTimesAdded = validActionList.IndexOf("|" + onWIP.Action + "|") >= 0;

            if (inputTimesAdded)
            {
                object[] line2ManDetailArray = performanceFacade.QueryUserCurrentLine2ManDetail(string.Empty, onWIP.StepSequenceCode, onWIP.ResourceCode, onWIP.OPCode, 0, string.Empty, performanceFacade.GetLine2ManDetailStatusList(true), true);
                if (line2ManDetailArray != null && line2ManDetailArray.Length > 0)
                {
                    foreach (Line2ManDetail line2ManDetail in line2ManDetailArray)
                    {
                        //是否跨Shift
                        if (line2ManDetail.ShiftDate == nowEnv.ShiftDate && line2ManDetail.ShiftCode == nowEnv.Shift.ShiftCode)
                        {
                            //是否变工单
                            if (string.Compare(line2ManDetail.MOCode, onWIP.MOCode, true) == 0)
                            {
                                line2ManDetail.ManActQty++;
                                line2ManDetail.MaintainUser = onWIP.MaintainUser;
                                performanceFacade.UpdateLine2ManDetail(line2ManDetail);
                            }
                            else
                            {
                                //是否第一笔工单
                                if (string.Compare(line2ManDetail.MOCode, " ", true) == 0)
                                {
                                    line2ManDetail.MOCode = onWIP.MOCode;
                                    line2ManDetail.ManActQty++;
                                    line2ManDetail.MaintainUser = onWIP.MaintainUser;
                                    performanceFacade.UpdateLine2ManDetail(line2ManDetail);
                                }
                                else
                                {
                                    line2ManDetail.Status       = Line2ManDetailStatus.Line2ManDetailStatus_AutoOff;
                                    line2ManDetail.OffDate      = lastSecondEnv.DBDateTime.DBDate;
                                    line2ManDetail.OffTime      = lastSecondEnv.DBDateTime.DBTime;
                                    line2ManDetail.Duration     = FormatHelper.GetSpanSeconds(line2ManDetail.OnDate, line2ManDetail.OnTime, line2ManDetail.OffDate, line2ManDetail.OffTime);
                                    line2ManDetail.MaintainUser = onWIP.MaintainUser;
                                    performanceFacade.UpdateLine2ManDetail(line2ManDetail);

                                    Line2ManDetail newLine2ManDetail = performanceFacade.CreateNewLine2ManDetail();
                                    newLine2ManDetail.UserCode     = line2ManDetail.UserCode;
                                    newLine2ManDetail.OPCode       = onWIP.OPCode;
                                    newLine2ManDetail.ResourceCode = onWIP.ResourceCode;
                                    newLine2ManDetail.SSCode       = onWIP.StepSequenceCode;
                                    newLine2ManDetail.ShiftDate    = nowEnv.ShiftDate;
                                    newLine2ManDetail.ShiftCode    = nowEnv.Shift.ShiftCode;
                                    newLine2ManDetail.OnDate       = nowEnv.DBDateTime.DBDate;
                                    newLine2ManDetail.OnTime       = nowEnv.DBDateTime.DBTime;
                                    newLine2ManDetail.OffDate      = nowEnv.GetShiftEndDate();
                                    newLine2ManDetail.OffTime      = nowEnv.Shift.ShiftEndTime;
                                    newLine2ManDetail.Duration     = FormatHelper.GetSpanSeconds(newLine2ManDetail.OnDate, newLine2ManDetail.OnTime, newLine2ManDetail.OffDate, newLine2ManDetail.OffTime);
                                    newLine2ManDetail.Status       = Line2ManDetailStatus.Line2ManDetailStatus_AutoOn;
                                    newLine2ManDetail.MOCode       = onWIP.MOCode;
                                    newLine2ManDetail.ManActQty    = 1;
                                    newLine2ManDetail.MaintainUser = onWIP.MaintainUser;
                                    performanceFacade.AddLine2ManDetail(newLine2ManDetail);
                                }
                            }
                        }
                        else
                        {
                            line2ManDetail.Status       = Line2ManDetailStatus.Line2ManDetailStatus_AutoOff;
                            line2ManDetail.MaintainUser = onWIP.MaintainUser;
                            performanceFacade.UpdateLine2ManDetail(line2ManDetail);

                            Line2ManDetail newLine2ManDetail = performanceFacade.CreateNewLine2ManDetail();
                            newLine2ManDetail.UserCode     = line2ManDetail.UserCode;
                            newLine2ManDetail.OPCode       = onWIP.OPCode;
                            newLine2ManDetail.ResourceCode = onWIP.ResourceCode;
                            newLine2ManDetail.SSCode       = onWIP.StepSequenceCode;
                            newLine2ManDetail.ShiftDate    = nowEnv.ShiftDate;
                            newLine2ManDetail.ShiftCode    = nowEnv.Shift.ShiftCode;
                            newLine2ManDetail.OnDate       = nowEnv.GetShiftBeginDate();
                            newLine2ManDetail.OnTime       = nowEnv.Shift.ShiftBeginTime;
                            newLine2ManDetail.OffDate      = nowEnv.GetShiftEndDate();
                            newLine2ManDetail.OffTime      = nowEnv.Shift.ShiftEndTime;
                            newLine2ManDetail.Duration     = FormatHelper.GetSpanSeconds(newLine2ManDetail.OnDate, newLine2ManDetail.OnTime, newLine2ManDetail.OffDate, newLine2ManDetail.OffTime);
                            newLine2ManDetail.Status       = Line2ManDetailStatus.Line2ManDetailStatus_AutoOn;
                            newLine2ManDetail.MOCode       = onWIP.MOCode;
                            newLine2ManDetail.ManActQty    = 1;
                            newLine2ManDetail.MaintainUser = onWIP.MaintainUser;
                            performanceFacade.AddLine2ManDetail(newLine2ManDetail);
                        }
                    }
                }
            }

            return(returnValue);
        }