Esempio n. 1
0
        //保存老化信息
        private void SaveBurnWip()
        {
            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
            BaseModelFacade   baseModelFacade   = new BaseModelFacade(this.DataProvider);
            ShiftModelFacade  shiftModelFacade  = new ShiftModelFacade(this.DataProvider);
            DBDateTime        dbDateTime        = FormatHelper.GetNowDBDateTime(this.DataProvider);
            ItemFacade        itemFacade        = new ItemFacade(this.DataProvider);
            BurnFacade        burnFacade        = new BurnFacade(this.DataProvider);
            //获取时段代码
            StepSequence _StepSequence = (StepSequence)baseModelFacade.GetStepSequence(Resource.StepSequenceCode);
            TimePeriod   tp            = (TimePeriod)shiftModelFacade.GetTimePeriod(Resource.ShiftTypeCode, dbDateTime.DBTime);

            BurnWip burnWip     = new BurnWip();
            string  sourceRCard = dataCollectFacade.GetSourceCard(this.txtRunningCard.Value.Trim().ToUpper(), string.Empty);

            burnWip.RunningCard = sourceRCard;
            burnWip.MOCode      = product.LastSimulation.MOCode;
            burnWip.ItemCode    = this.txtItem.Value;
            burnWip.SsCode      = Resource.StepSequenceCode;
            burnWip.ResCode     = Resource.ResourceCode;
            if (tp != null)
            {
                burnWip.TpCode   = tp.TimePeriodCode;
                burnWip.ShiftDay = shiftModelFacade.GetShiftDay(tp, dbDateTime.DateTime);
            }

            burnWip.ProductStatus = ProductStatus.GOOD;
            if (rdoBurnIn.Checked)
            {
                burnWip.Status     = BurnType.BurnIn;
                burnWip.BurnInDate = dbDateTime.DBDate;
                burnWip.BurnInTime = dbDateTime.DBTime;

                object objItem = itemFacade.GetItem(this.txtItem.Value, GlobalVariables.CurrentOrganizations.First().OrganizationID);
                if (objItem != null && ((Item)objItem).BurnUseMinutes.ToString() != "")
                {
                    burnWip.ForecastOutDate = FormatHelper.TODateInt(dbDateTime.DateTime.AddMinutes(((Item)objItem).BurnUseMinutes));
                    burnWip.ForecastOutTime = FormatHelper.TOTimeInt(dbDateTime.DateTime.AddMinutes(((Item)objItem).BurnUseMinutes));
                }
            }
            else
            {
                burnWip.Status      = BurnType.BurnOut;
                burnWip.BurnOutDate = dbDateTime.DBDate;
                burnWip.BurnOutTime = dbDateTime.DBTime;

                if (rdoNG.Checked)
                {
                    burnWip.ProductStatus = ProductStatus.NG;
                }
            }

            burnWip.MaintainUser = userCode;
            burnWip.MaintainDate = dbDateTime.DBDate;
            burnWip.MaintainTime = dbDateTime.DBTime;

            object objBurn = burnFacade.GetBurnWip(burnWip.RunningCard, burnWip.MOCode);

            if (objBurn == null)
            {
                burnFacade.AddBurnWip(burnWip);
            }
            else
            {
                if (((BurnWip)objBurn).Status == BurnType.BurnOut && rdoBurnOut.Checked)  //返工或维修回流时,若没有走burn in工序,则预计完成时间更新为系统时间
                {
                    burnWip.BurnInDate      = dbDateTime.DBDate;
                    burnWip.BurnInTime      = dbDateTime.DBTime;
                    burnWip.ForecastOutDate = dbDateTime.DBDate;
                    burnWip.ForecastOutTime = dbDateTime.DBTime;
                }
                else
                {
                    burnWip.BurnInDate      = ((BurnWip)objBurn).BurnInDate;
                    burnWip.BurnInTime      = ((BurnWip)objBurn).BurnInTime;
                    burnWip.ForecastOutDate = ((BurnWip)objBurn).ForecastOutDate;
                    burnWip.ForecastOutTime = ((BurnWip)objBurn).ForecastOutTime;
                }

                burnFacade.UpdateBurnWip(burnWip);
            }
        }
Esempio n. 2
0
        private void CheckAndRunOnWip()
        {
            if (txtRunningCard.Value.Trim() == string.Empty)
            {
                if (!this.txtGOMO.Checked)
                {
                    txtMO.Value               = String.Empty;
                    txtItem.Value             = String.Empty;
                    labelItemDescription.Text = "";
                }

                ApplicationRun.GetInfoForm().AddEx("$CS_Please_Input_RunningCard");

                //将焦点移到产品序列号输入框
                txtRunningCard.TextFocus(false, true);
                return;
            }
            else
            {
                DBDateTime        dbDateTime        = FormatHelper.GetNowDBDateTime(this.DataProvider);
                BurnFacade        burnFacade        = new BurnFacade(this.DataProvider);
                DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                string            sourceCard        = dataCollectFacade.GetSourceCard(this.txtRunningCard.Value.Trim().ToUpper(), string.Empty);

                if (this.txtGOMO.Checked && this.txtGOMO.Value.Trim().Length == 0)
                {
                    ApplicationRun.GetInfoForm().AddEx("$CS_CMPleaseInputMO");
                    this.txtGOMO.Checked = true;
                    this.txtGOMO.TextFocus(false, true);
                    return;
                }

                if (this.txtGOMO.Checked && this.txtGOMO.InnerTextBox.Enabled)
                {
                    ApplicationRun.GetInfoForm().AddEx("$CS_PleasePressEnterOnGOMO");
                    this.txtGOMO.Checked = true;
                    this.txtGOMO.TextFocus(false, true);
                    return;
                }
                // End Added
                //Add by sandy on 20140528
                if (rdoBurnIn.Checked && rdoNG.Checked)
                {
                    UserControl.Message message = new UserControl.Message(MessageType.Error, "$CS_BurnIn_Can_Not_NG");
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ": " + this.txtRunningCard.Value, message, true);
                    txtRunningCard.TextFocus(false, true);
                    return;
                }
                //end
                if (txtRunningCard.Value.Trim().ToUpper() == ng_collect)
                {
                    rdoNG.Checked      = true;
                    rdoBurnOut.Checked = true;
                    txtRunningCard.TextFocus(false, true);
                    return;
                }

                //Jarvis 20130125 支持GOOD指令
                if (txtRunningCard.Value.Trim().ToUpper() == good_collect)
                {
                    rdoGood.Checked = true;
                    txtRunningCard.TextFocus(false, true);
                    return;
                }
                //Add by sandy on 20140528
                if (txtRunningCard.Value.Trim().ToUpper() == ActionType.DataCollectAction_BurnIn)
                {
                    rdoGood.Checked   = true;
                    rdoBurnIn.Checked = true;
                    txtRunningCard.TextFocus(false, true);
                    return;
                }

                if (txtRunningCard.Value.Trim().ToUpper() == ActionType.DataCollectAction_BurnOutGood)
                {
                    rdoGood.Checked    = true;
                    rdoBurnOut.Checked = true;
                    txtRunningCard.TextFocus(false, true);
                    return;
                }

                if (txtRunningCard.Value.Trim().ToUpper() == ActionType.DataCollectAction_BurnOutNG)
                {
                    rdoNG.Checked      = true;
                    rdoBurnOut.Checked = true;
                    txtRunningCard.TextFocus(false, true);
                    return;
                }

                //End

                //add by hiro.chen 08/11/18 TocheckIsDown
                Messages msg = new Messages();
                msg.AddMessages(dataCollectFacade.CheckISDown(sourceCard.Trim().ToUpper()));
                if (!msg.IsSuccess())
                {
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ":" + this.txtRunningCard.Value, msg, true);
                    txtRunningCard.TextFocus(false, true);
                    return;
                }
                //end

                //报废不能返工
                msg.AddMessages(dataCollectFacade.CheckReworkRcardIsScarp(sourceCard.Trim().ToUpper(), ApplicationService.Current().ResourceCode));
                if (!msg.IsSuccess())
                {
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ":" + this.txtRunningCard.Value, msg, true);
                    txtRunningCard.TextFocus(false, true);
                    return;
                }
                //end

                //Laws Lu,2005/10/19,新增	缓解性能问题
                //Laws Lu,2006/12/25 修改	减少Open/Close的次数
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = false;
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection();

                //Laws Lu,2005/08/16,修改	把msg换成globeMSG
                globeMSG = CheckProduct();

                // Added by Icyer 2005/10/28
                if (Resource == null)
                {
                    BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                    Resource = (Domain.BaseSetting.Resource)dataModel.GetResource(ApplicationService.Current().ResourceCode);
                }
                actionCheckStatus             = new ActionCheckStatus();
                actionCheckStatus.ProductInfo = product;

                if (actionCheckStatus.ProductInfo != null)
                {
                    actionCheckStatus.ProductInfo.Resource = Resource;
                }

                string strMoCode = String.Empty;
                if (product != null && product.LastSimulation != null)
                {
                    strMoCode = product.LastSimulation.MOCode;
                }

                if (strMoCode != String.Empty)
                {
                    if (listActionCheckStatus.ContainsKey(strMoCode))
                    {
                        actionCheckStatus             = (ActionCheckStatus)listActionCheckStatus[strMoCode];
                        actionCheckStatus.ProductInfo = product;
                        actionCheckStatus.ActionList  = new ArrayList();
                    }
                    else
                    {
                        listActionCheckStatus.Add(strMoCode, actionCheckStatus);
                    }
                }
                //Amoi,Laws Lu,2005/08/02,修改

                if (txtGOMO.Checked == true)
                {
                    globeMSG.AddMessages(RunGOMO(actionCheckStatus));

                    if (!globeMSG.IsSuccess())
                    {
                        listActionCheckStatus.Clear();
                    }
                }
                else
                {
                    if (product != null && product.LastSimulation != null)
                    {
                        this.txtMO.Value               = product.LastSimulation.MOCode;
                        this.txtItem.Value             = product.LastSimulation.ItemCode;
                        this.labelItemDescription.Text = this.GetItemDescription(product.LastSimulation.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID);
                    }
                    else
                    {
                        this.txtMO.Value               = "";
                        this.txtItem.Value             = "";
                        this.labelItemDescription.Text = "";
                    }
                }
                //EndAmoi

                //老化进和老化出工序不能同时勾选
                BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider);
                ItemFacade      itemFacade      = new ItemFacade(this.DataProvider);
                object          objOP           = baseModelFacade.GetOperationByResource(ApplicationService.Current().ResourceCode);
                if (product != null && product.LastSimulation != null && objOP != null)
                {
                    object objOp = itemFacade.GetItemRoute2Operation(this.txtItem.Value, product.LastSimulation.RouteCode,
                                                                     ((Operation2Resource)objOP).OPCode);
                    if (objOp != null)
                    {
                        opControl = ((ItemRoute2OP)objOp).OPControl;
                        if (opControl[(int)OperationList.BurnIn] == isSelected && opControl[(int)OperationList.BurnOut] == isSelected)
                        {
                            globeMSG.Add(new UserControl.Message(MessageType.Error, "$CS_BurnInOut_Can_Not_Choose_Together"));
                        }
                    }
                }
                //老化未达到预计时间且不是强制老化时不可做老化出良品采集
                if (!isForce && globeMSG.IsSuccess() && rdoBurnOut.Checked && rdoGood.Checked && product.LastSimulation != null)
                {
                    object  objBurnWip = burnFacade.GetBurnWip(sourceCard.Trim().ToUpper(), product.LastSimulation.MOCode);
                    BurnWip burnWip    = objBurnWip as BurnWip;
                    if (objBurnWip != null && burnWip.Status == BurnType.BurnIn)
                    {
                        DateTime dtForecast = FormatHelper.ToDateTime(burnWip.ForecastOutDate, burnWip.ForecastOutTime);
                        if (dbDateTime.DateTime < dtForecast)
                        {
                            globeMSG.Add(new UserControl.Message(MessageType.Error, "$CS_Burn_Time_Not_Enough"));
                        }
                    }
                }

                if (globeMSG.IsSuccess())
                {
                    this.RunOnWip();
                }
            }
            //刷新grid
            this.BindGrid();
            //Laws Lu,2005/10/19,新增	缓解性能问题
            //Laws Lu,2006/12/25 修改	减少Open/Close的次数
            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = true;

            //将焦点移到产品序列号输入框
            ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ": " + this.txtRunningCard.Value, globeMSG, true);

            //Application.DoEvents();
            txtRunningCard.TextFocus(false, true);

            globeMSG.ClearMessages();
        }