示例#1
0
        public FMultiGoMO()
        {
            UserControl.UIStyleBuilder.FormUI(this);

            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            grdMoList.DisplayLayout.Appearance.BackColor                      = System.Drawing.Color.White;;
            grdMoList.DisplayLayout.CaptionAppearance.BackColor               = Color.FromName("WhiteSmoke");
            grdMoList.DisplayLayout.Appearance.BackColor                      = Color.FromArgb(255, 255, 255);
            grdMoList.DisplayLayout.Override.HeaderAppearance.BackColor       = Color.FromName("WhiteSmoke");
            grdMoList.DisplayLayout.Override.RowAppearance.BackColor          = Color.FromArgb(230, 234, 245);
            grdMoList.DisplayLayout.Override.RowAlternateAppearance.BackColor = Color.FromArgb(255, 255, 255);
            grdMoList.DisplayLayout.Override.RowSelectors                     = Infragistics.Win.DefaultableBoolean.False;
            grdMoList.DisplayLayout.Override.ActiveRowAppearance.BackColor    = System.Drawing.Color.Gainsboro;
            grdMoList.DisplayLayout.Override.ActiveRowAppearance.ForeColor    = System.Drawing.Color.Black;
            grdMoList.DisplayLayout.ScrollBarLook.Appearance.BackColor        = Color.FromName("LightGray");

            ucMessage.Add(">>$CS_Please_Input_MOCode");

            txtMoCode.TextFocus(false, true);
            //UserControl.UIStyleBuilder.GridUI(grdMoList);
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
示例#2
0
        private void txtMoCode_TxtboxKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                Messages msg = new Messages();

                if (txtMoCode.Value.Trim() == string.Empty)
                {
                    ucMessage.Add(">>$CS_Please_Input_MOCode");

                    txtMoCode.TextFocus(false, true);
                }
                else
                {
                    msg.AddMessages(DisplayMoInfo(FormatHelper.CleanString(txtMoCode.Value.Trim().ToUpper())));

                    if (msg.IsSuccess())
                    {
                        LockMoInput();

                        ucMessage.Add(">>$CS_Please_Input_RunningCard");                        //请输入产品序列号

                        txtRCard.TextFocus(false, true);
                    }
                    else
                    {
                        ClearMoInfo();

                        ucMessage.Add(msg);

                        txtMoCode.TextFocus(false, true);
                    }
                }
            }
        }
示例#3
0
        private void txtMoCode_TxtboxKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                if (txtMoCode.Value.Trim() != String.Empty)
                {
                    Messages msg = new Messages();
                    string[] MOs = ParseMo(Web.Helper.FormatHelper.CleanString(txtMoCode.Value.Trim().ToUpper()));
                    msg.AddMessages(UpdateList(MOs));

                    if (msg.IsSuccess())
                    {
                        LockMoInput();

                        ucMessage.Add(">>$CS_Please_Input_RunningCard " + CurrentSequence.ToString() + "/" + dsMo.MultiMo.Rows.Count);                        //请输入产品序列号

                        txtRCard.TextFocus(false, true);
                    }
                    else
                    {
                        ucMessage.Add(msg);

                        txtMoCode.TextFocus(false, true);
                    }
                }
                else
                {
                    dsMo.MultiMo.Rows.Clear();

                    ucMessage.Add(">>$CS_Please_Input_MOCode");

                    txtMoCode.TextFocus(false, true);
                }
            }
        }
示例#4
0
        private void ucLEMOCode_TxtboxKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                if (this.ucLEMOCode.Value.Trim() == string.Empty)
                {
                    return;
                }

                this.ucMessage.Add("<< " + this.ucLEMOCode.Value.Trim());

                if (this.displayMOInfo())
                {
                    this.ucMessage.Add(">>$CS_Please_Input_RunningCard");                    //请输入产品序列号

                    this.ucLERunningCard.TextFocus(false, true);

                    return;
                }
                else
                {
                    this.ucMessage.Add(">>$CS_Please_Input_MOCode");

                    ucLEMOCode.TextFocus(false, true);

                    return;
                }
            }
        }
示例#5
0
        private void txtCartonNO_TxtboxKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                string cartonno = txtCartonNO.Value.Trim().ToUpper();

                if (cartonno == String.Empty)
                {
                    ucMessage.AddEx(this._FunctionName, this.txtCartonNO.Caption + " " + this.txtCartonNO.Value,
                                    new UserControl.Message("$CS_PLEASE_INPUT_CARTONNO"), false);

                    txtCartonNO.TextFocus(false, true);

                    return;
                }

                ProcessCarton(cartonno);

                btnEnable_Click(sender, e);

                txtRCard.TextFocus(false, true);

                //SendKeys.Send("+{TAB}");
                //Remove UCLabel.SelectAll;
            }
        }
示例#6
0
        //Process LotCode
        private void ProcessLotCode(string lotCode)
        {
            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
            OQCFacade         _OQCFacade        = new OQCFacade(this.DataProvider);

            object objSimulationReport = dataCollectFacade.GetLastLotSimulationReport(lotCode);

            if (objSimulationReport != null)
            {
                // Added By hi1/venus.Feng on 20081127 for Hisense Version : 如果没有Carton信息,则不能进行移转
                object[] objCarton2Lot = pf.GetCarton2LotByLotCode(lotCode);
                if (objCarton2Lot == null || objCarton2Lot.Length == 0)
                {
                    ClearLotCodeInfo();
                    ucMessage.Add(new UserControl.Message(MessageType.Error
                                                          , "$Error_LotNoCartonInfo $CS_Param_LotNO =" + lotCode));
                    ucMessage.Add(new UserControl.Message(">>$CS_Please_Input_LotCode"));
                    txtLotCode.TextFocus(true, true);
                }
                else
                {
                    //add by andy xin 判断包装转移判断Lot是否在TBLLOT2CARD中有
                    //object lot2Card = _OQCFacade.GetOQCLot2Card((objSimulationReport as Domain.LotDataCollect.LotSimulationReport).LotCode, (objSimulationReport as Domain.LotDataCollect.LotSimulationReport).MOCode, "", "");
                    //if (lot2Card != null)
                    //{
                    //    OQCLot oqcLot = _OQCFacade.GetOQCLot((lot2Card as OQCLot2Card).LOTNO, OQCFacade.Lot_Sequence_Default) as OQCLot;
                    //    if (!(oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Reject || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Rejecting ||
                    //        oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Pass || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Passing))
                    //    {

                    //        ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_RCARD_Can_not_Trans"));
                    //        this.txtLotCode.TextFocus(true, true);
                    //        return;
                    //    }
                    //}

                    DisplayLotCodeInfo(objCarton2Lot, objSimulationReport as Domain.LotDataCollect.LotSimulationReport);
                    ucMessage.Add(new UserControl.Message(">>$CS_PleaseInputCartonNo"));
                    txtCartonNO.TextFocus(true, true);
                }
                // End Added
            }
            else
            {
                ClearLotCodeInfo();
                ucMessage.Add(new UserControl.Message(MessageType.Error
                                                      , "$NoSimulation $CS_Param_LotNO =" + lotCode));
                ucMessage.Add(new UserControl.Message(">>$CS_Please_Input_LotCode"));
                txtLotCode.TextFocus(true, true);
            }
        }
示例#7
0
        public FOffMo()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            UserControl.UIStyleBuilder.FormUI(this);

            ucMessage.Add(">>$CS_Please_Input_MOCode");

            txtMoCode.TextFocus(false, true);
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
示例#8
0
        private void txtRunningCard_TxtboxKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                //Laws Lu,2005/08/12,修改 产品序列号不能为空值
                if (txtRunningCard.Value.Trim() == string.Empty)
                {
                    ApplicationRun.GetInfoForm().Add("$CS_Please_Input_RunningCard");

                    //将焦点移到产品序列号输入框
                    txtRunningCard.TextFocus(false, true);
                    System.Windows.Forms.SendKeys.Send("+{TAB}");
                }
                else
                {
                    errorCodeSelect.ClearErrorGroup();
                    errorCodeSelect.ClearSelectedErrorCode();
                    errorCodeSelect.ClearSelectErrorCode();


                    ApplicationRun.GetInfoForm().Add(CheckProduct());

                    //Laws Lu,2006/06/21 set focus to error code
                    errorCodeSelect.ErrorInpuTextBox.Text = String.Empty;
                    errorCodeSelect.ErrorInpuTextBox.Focus();

//					//Laws Lu,2005/08/12,新增设置焦点
//
//					txtRunningCard.TextFocus(false, true);
                    SendKeys.Send("+{TAB}");
                }
            }
            else
            {
                btnSave.Enabled = false;
            }
        }
示例#9
0
 private void FeederAnalyse()
 {
     this.txtFeederNo.Value = this.txtFeederNo.Value.Trim().ToUpper();
     if (this.txtFeederNo.Value == string.Empty)
     {
         ApplicationRun.GetInfoForm().Add("$Please_Input_FeederCode");
         txtFeederNo.TextFocus(false, true);
         return;
     }
     ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection();
     ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.BeginTransaction();
     try
     {
         string strAnalyseReason = string.Empty;
         if (cboAnalyseReason.SelectedIndex >= 0)
         {
             strAnalyseReason = ((BenQGuru.eMES.Domain.BaseSetting.Parameter) this.analyseReasonList[cboAnalyseReason.SelectedIndex]).ParameterCode;
         }
         string strOperationMessage = string.Empty;
         if (cboOperationMessage.SelectedIndex >= 0)
         {
             strOperationMessage = ((BenQGuru.eMES.Domain.BaseSetting.Parameter) this.operationMessageList[cboOperationMessage.SelectedIndex]).ParameterCode;
         }
         Messages messages = smtFacade.FeederAnalyse(txtFeederNo.Value, strAnalyseReason, strOperationMessage, this.chkScrapFlag.Checked, Service.ApplicationService.Current().UserCode, this.tableSource);
         if (messages.IsSuccess())
         {
             ConvertStatusText();
             messages.Add(new UserControl.Message(MessageType.Success, "$Feeder_Analyse_Success"));
             ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CommitTransaction();
         }
         else
         {
             ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.RollbackTransaction();
         }
         ApplicationRun.GetInfoForm().Add(messages);
     }
     catch (Exception e)
     {
         ApplicationRun.GetInfoForm().Add(new UserControl.Message(e));
         ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.RollbackTransaction();
     }
     finally
     {
         ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
     }
     this.txtFeederNo.Value     = string.Empty;
     this.txtReturnReason.Value = string.Empty;
     this.txtFeederNo.TextFocus(false, true);
 }
示例#10
0
        private void ucBtnOK_Click(object sender, System.EventArgs e)
        {
            if (this.ucLEInput.Value.Trim() == string.Empty)
            {
                //Laws Lu,2005/08/11,新增焦点设置
                ucLEInput.TextFocus(false, true);

                return;
            }

            this.ucMessage.Add(string.Format("<<{0}", this.ucLEInput.Value.Trim()));

            if (this.inputBuffer.Count == 0)                            // 输入软件产品序列号
            {
                this.inputBuffer.Add(this.ucLEInput.Value.Trim().ToUpper());

                if (!this.chbSoftName.Checked)
                {
                    this.inputBuffer.Add(string.Empty);
                }
                else
                {
                    ucMessage.Add(new UserControl.Message(">>$CS_CMPleaseInputSoftName"));
                    ucLEInput.Value = String.Empty;
                    ucLEInput.TextFocus(false, true);
                }
            }
            else if (this.inputBuffer.Count == 1)                               // 输入软件名称
            {
                this.inputBuffer.Add(this.ucLEInput.Value.Trim());
            }
            else if (this.inputBuffer.Count == 2)                               // 输入软件版本
            {
                Collect();
            }

            if (chkAutoGetVersion.Checked == false)
            {
                this.ucLEInput.Value = "";
                this.showInputHint();

                //Laws Lu,2005/08/11,新增焦点设置
                ucLEInput.TextFocus(false, true);
            }
            else if (this.inputBuffer.Count == 2 && chkAutoGetVersion.Checked == true)
            {
                Collect();
            }
        }
示例#11
0
        //Process Running Card
        private void ProcessRCard(string rcard)
        {
            //根据当前序列号获取最新序列号
            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
            OQCFacade         _OQCFacade        = new OQCFacade(this.DataProvider);
            string            sourceRCard       = dataCollectFacade.GetSourceCard(rcard.Trim().ToUpper(), string.Empty);

            object objSimulationReport = dataCollectFacade.GetLastSimulationReport(sourceRCard);

            if (objSimulationReport != null)
            {
                // Added By hi1/venus.Feng on 20081127 for Hisense Version : 如果没有Carton信息,则不能进行移转

                if (string.IsNullOrEmpty((objSimulationReport as Domain.DataCollect.SimulationReport).CartonCode))
                {
                    ClearRCardInfo();
                    ucMessage.Add(new UserControl.Message(MessageType.Error
                                                          , "$Error_RCardNoCartonInfo $CS_Param_ID =" + rcard));
                    txtRCard.TextFocus(true, true);
                }
                else
                {
                    //add by andy xin 判断包装转移判断RCARD是否在TBLLOT2CARD中有
                    object lot2Card = _OQCFacade.GetOQCLot2Card((objSimulationReport as Domain.DataCollect.SimulationReport).RunningCard, (objSimulationReport as Domain.DataCollect.SimulationReport).MOCode, "", "");
                    if (lot2Card != null)
                    {
                        OQCLot oqcLot = _OQCFacade.GetOQCLot((lot2Card as OQCLot2Card).LOTNO, OQCFacade.Lot_Sequence_Default) as OQCLot;
                        if (!(oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Reject || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Rejecting ||
                              oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Pass || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Passing))
                        {
                            ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_RCARD_In_OQC"));
                            this.txtRCard.TextFocus(true, true);
                            return;
                        }
                    }


                    DisplayRCardInfo(objSimulationReport as Domain.DataCollect.SimulationReport);
                }
                // End Added
            }
            else
            {
                ClearRCardInfo();
                ucMessage.Add(new UserControl.Message(MessageType.Error
                                                      , "$NoSimulation $CS_Param_ID =" + rcard));
                txtRCard.TextFocus(true, true);
            }
        }
示例#12
0
        private void DoAction()
        {
            try
            {
                //2006/11/17,Laws Lu add get DateTime from db Server
                DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

                DateTime dtNow = FormatHelper.ToDateTime(dbDateTime.DBDate, dbDateTime.DBTime);

                this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
                Messages msg = new Messages();

                //取得当前时间所在的班次
                int i = _facade.GetCurrShiftIndex(FormatHelper.TOTimeInt(this.dtpBegin.Text), this.cbxShiftTime.ComboBoxData.Items);
                if (i != -1)
                {
                    this.cbxShiftTime.ComboBoxData.SelectedIndex = i;
                }
                else
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "选择的时间没有班次"));                    //请选择班次
                    ApplicationRun.GetInfoForm().Add(msg);
                    return;
                }
                UIShift shift = this.cbxShiftTime.ComboBoxData.SelectedItem as UIShift;
                if (shift == null)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$班次不存在"));                    //请选择班次
                    ApplicationRun.GetInfoForm().Add(msg);
                    return;
                }

                BenQGuru.eMES.DataCollect.DataCollectFacade dcFacade = new DataCollectFacade(this.DataProvider);
                BenQGuru.eMES.Domain.DataCollect.Simulation sim      = dcFacade.GetSimulation(ucRCard.InnerTextBox.Text.Trim()) as BenQGuru.eMES.Domain.DataCollect.Simulation;

                string itemcode;
                if (sim == null)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$Error_First_No_Rcard"));                    //产线上不存在这个产品序列号
                    ApplicationRun.GetInfoForm().Add(msg);
                    ucRCard.TextFocus(false, true);
                    return;
                }
                else
                {
                    itemcode = sim.ItemCode;
                }

                //判断是否已经有上线了
                DateTime dtShiftDay = dtNow;

                /////如是跨天的班次,并且是处在第二天,则用前一天做为上线日期
                if (shift.IsOverDay == FormatHelper.TRUE_STRING)
                {
                    if (FormatHelper.TOTimeInt(dtShiftDay) < shift.EndTime)
                    {
                        dtShiftDay = dtShiftDay.AddDays(-1);
                    }
                }

                #region                 //判断时间规则:班次起始时间<=上班时间<=NOW<=班次终止时间
//				int shiftBegin = shift.BeginTime; //班次起始时间
//
//				int begin = FormatHelper.TOTimeInt(this.dtpBegin.Text); //上班时间
//				if(shift.IsOverDay == FormatHelper.TRUE_STRING && begin <shiftBegin)
//					begin += 1000000;
//
//				int iNow = FormatHelper.TOTimeInt(dtNow);//NOW
//				if(shift.IsOverDay == FormatHelper.TRUE_STRING && iNow < shiftBegin)
//					iNow += 1000000;
//
//				//下班时间
//				int shiftEnd = shift.EndTime;
//				if(shift.IsOverDay == FormatHelper.TRUE_STRING)
//					shiftEnd += 1000000;
//
//				if(!
//					(shiftBegin<=begin
//					&&
//					begin<=iNow
//					&&
//					iNow<=shiftEnd)
//					)
//				{
//					if(MessageBox.Show("上班时间可能输入错误(规则为:班次起始时间<=上班时间<=上线时间<=班次终止时间),是否继续?",
//															"确认要继续",
//															MessageBoxButtons.YesNo)==DialogResult.No)
//						return;
//				}
                #endregion

                object obj = _facade.GetFirstOnline(this.ucSSName.Value, FormatHelper.TODateInt(dtShiftDay), itemcode, shift.ShiftCode, FormatHelper.TOTimeInt(this.dtpBegin.Text));
                BenQGuru.eMES.Domain.Alert.FirstOnline first = obj as BenQGuru.eMES.Domain.Alert.FirstOnline;

                if (first != null)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "今天这个上班时间,此产线上此产品已经有一个上线首件"));                   //"$Error_FirstOn_Repeat")); //今天这个班次,此产线上此产品已经有一个上线首件
                    ApplicationRun.GetInfoForm().Add(msg);
                    return;
                }
                try
                {
                    this.DataProvider.BeginTransaction();

                    first                   = _facade.CreateNewFirstOnline();
                    first.ItemCode          = itemcode;
                    first.ModelCode         = sim.ModelCode;
                    first.SSCode            = this.ucSSName.Value;
                    first.RunningCard       = this.ucRCard.Value;
                    first.OfflineRuningCard = string.Empty;
                    first.ActionType        = LineActionType.ON;
                    first.MaintainDate      = FormatHelper.TODateInt(dtShiftDay);                ////如是跨天的班次,并且是处在第二天,则用前一天做为上线日期
                    first.MaintianUser      = ApplicationService.Current().UserCode;
                    first.OffLineTime       = 0;
                    first.OnLineTime        = FormatHelper.TOTimeInt(dtNow);
                    first.ShiftCode         = shift.ShiftCode;
                    first.ShiftTime         = FormatHelper.TOTimeInt(this.dtpBegin.Text);
                    first.IsOverDay         = shift.IsOverDay;

                    this.DataProvider.Insert(first);

                    ucMessage.Add(new UserControl.Message("上班时间" + this.dtpBegin.Text + "," +
                                                          String.Format(_firstMsg,
                                                                        dtShiftDay.ToLongDateString(),
                                                                        first.SSCode,
                                                                        first.ItemCode,
                                                                        FormatHelper.ToTimeString(first.OnLineTime)
                                                                        )
                                                          )
                                  );

                    this.DataProvider.CommitTransaction();
                    msg.Add(new UserControl.Message(MessageType.Success, "$Error_FirstOn_Sucess"));                    //首件上线成功
                    ApplicationRun.GetInfoForm().Add(msg);
                }
                catch (System.Exception ex)
                {
                    this.DataProvider.RollbackTransaction();
                    msg.Add(new UserControl.Message(MessageType.Success, ex.Message));
                    ApplicationRun.GetInfoForm().Add(msg);
                }
            }
            finally
            {
                this.Cursor        = System.Windows.Forms.Cursors.Arrow;
                this.ucRCard.Value = string.Empty;
                this.ucRCard.TextFocus(false, true);
                CloseConnection();
            }
        }
示例#13
0
        //根据产线,产品,Fill上班时间下拉列表
        private void FillBegin()
        {
            #region 检查界面输入
            if (this.ucSSName.Value == string.Empty)
            {
                Messages msg = new Messages();
                msg.Add(new UserControl.Message(MessageType.Error, this.ucSSName.Caption + " $Error_Input_Empty"));
                ApplicationRun.GetInfoForm().Add(msg);
                this.ucRCard.TextFocus(false, true);
                return;
            }
            if (this.ucRCard.Value == string.Empty)
            {
                Messages msg = new Messages();
                msg.Add(new UserControl.Message(MessageType.Error, this.ucRCard.Caption + " $Error_Input_Empty"));
                ApplicationRun.GetInfoForm().Add(msg);
                this.ucRCard.TextFocus(false, true);
                return;
            }
            #endregion

            #region 判断产品序列号是否存在
            BenQGuru.eMES.DataCollect.DataCollectFacade dcFacade = new DataCollectFacade(this.DataProvider);
            BenQGuru.eMES.Domain.DataCollect.Simulation sim      = dcFacade.GetSimulation(ucRCard.InnerTextBox.Text.Trim()) as BenQGuru.eMES.Domain.DataCollect.Simulation;

            string itemcode;
            if (sim == null)
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_First_No_Rcard"));
                ucRCard.TextFocus(false, true);
                return;
            }
            else
            {
                itemcode = sim.ItemCode;
            }
            #endregion

            #region Build下班时间下拉列表
            this.cbxBeginTime.ComboBoxData.Items.Clear();
            object[] objs = this._facade.QueryFirst(this.ucSSName.Value, itemcode);
            if (objs != null && objs.Length > 0)
            {
                foreach (BenQGuru.eMES.Domain.Alert.FirstOnline last in objs)
                {
                    if (last != null)
                    {
                        this.cbxBeginTime.ComboBoxData.Items.Add(new UIFirstOnline(last));
                    }
                }
            }
            else
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "请先做上线"));
                ucRCard.TextFocus(false, true);
                return;
            }

            if (this.cbxBeginTime.ComboBoxData.Items.Count > 0)
            {
                this.cbxBeginTime.ComboBoxData.SelectedIndex = 0;
            }
            #endregion
        }
示例#14
0
        //Process Carton NO
        private void ProcessCarton(string cartonno)
        {
            DataCollectFacade dcf   = new DataCollectFacade(DataProvider);
            string            rCard = txtRCard.Value.Trim().ToUpper();

            rCard = dcf.GetSourceCard(rCard, string.Empty);

            //箱号为空时,表示序列号从旧箱中移除
            if (cartonno == String.Empty)
            {
                #region RCARD 从 Carton中移出
                if (DialogResult.OK == MessageBox.Show(this, MutiLanguages.ParserString("$CS_Confirm_Transfer_1") + " " + txtRCard.Value.Trim().ToUpper() + " "
                                                       + MutiLanguages.ParserString("$CS_Confirm_Transfer_2") + txtCurrentCarton.Value.Trim().ToUpper() + " " + MutiLanguages.ParserString("$CS_Confirm_Transfer_3"), MutiLanguages.ParserString("$ShowConfirm"), MessageBoxButtons.OKCancel))
                {
                    InventoryFacade materialDCF = new InventoryFacade(DataProvider);

                    object objSimulationReport = dcf.GetLastSimulationReport(rCard);

                    //在制品存在
                    if (objSimulationReport != null)
                    {
                        Domain.DataCollect.SimulationReport sim = objSimulationReport as Domain.DataCollect.SimulationReport;

                        sim.CartonCode = String.Empty;
                        PackageFacade pf = new PackageFacade(DataProvider);

                        #region 移出操作
                        DataProvider.BeginTransaction();
                        try
                        {
                            dcf.RemoveFromCarton(sim.RunningCard, ApplicationService.Current().UserCode);
                            //dcf.RemoveFromPallet2RCard(sim.RunningCard);
                            DataProvider.CommitTransaction();

                            ucMessage.Add(new UserControl.Message(MessageType.Success
                                                                  , "$CS_RCARD_BREAK_FROM_CARTON_SUCCESS $CS_Param_ID =" + txtRCard.Value.Trim().ToUpper()));

                            txtRCard.TextFocus(true, true);
                            txtCartonNO.Value = String.Empty;
                            ClearRCardInfo();
                        }
                        catch (Exception ex)
                        {
                            DataProvider.RollbackTransaction();
                            ucMessage.Add(new UserControl.Message(ex));

                            txtCartonNO.TextFocus(true, true);
                        }
                        finally
                        {
                            (DataProvider as SQLDomainDataProvider).PersistBroker.CloseConnection();
                        }
                        #endregion
                    }
                    else//在制品不存在
                    {
                        ucMessage.Add(new UserControl.Message(MessageType.Error
                                                              , "$NoSimulation $CS_Param_ID =" + txtRCard.Value.Trim().ToUpper()));

                        ClearRCardInfo();
                        txtRCard.TextFocus(true, true);
                    }
                }
                #endregion
            }
            else
            {
                #region RCARD 从当前Carton移转到另外一个Carton
                InventoryFacade materialDCF = new InventoryFacade(DataProvider);
                //ActionOnLineHelper onlineHelper = new ActionOnLineHelper(DataProvider);

                if (!CheckTargetCarton(cartonno))
                {
                    if (!m_NeedAddNewCarton)
                    {
                        txtCartonNO.TextFocus(true, true);
                        return;
                    }
                }
                string sourceCard          = dcf.GetSourceCard(txtRCard.Value.Trim().ToUpper(), string.Empty);
                object objSimulationReport = dcf.GetLastSimulationReport(sourceCard);

                if (objSimulationReport != null)
                {
                    Domain.DataCollect.SimulationReport simulationReport = objSimulationReport as Domain.DataCollect.SimulationReport;

                    simulationReport.CartonCode = cartonno.Trim().ToUpper();
                    Package.PackageFacade pf = new BenQGuru.eMES.Package.PackageFacade(DataProvider);

                    #region 移转操作
                    DataProvider.BeginTransaction();
                    try
                    {
                        //Add By Bernard @ 2010-11-01
                        string moCode           = txtMoCode.Value.Trim().ToUpper();
                        string oldCartonno      = txtCurrentCarton.Value.Trim().ToUpper();
                        bool   m_HasCartonAdded = false;
                        //end

                        //包装箱不存在,为CartonInfo表增加一个包装箱信息
                        if (m_NeedAddNewCarton)
                        {
                            DBDateTime currentDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
                            BenQGuru.eMES.Domain.Package.CARTONINFO newCarton = new BenQGuru.eMES.Domain.Package.CARTONINFO();

                            newCarton.CARTONNO    = cartonno.Trim().ToUpper();
                            newCarton.CAPACITY    = ((new ItemFacade(DataProvider)).GetItem(simulationReport.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID) as Item).ItemCartonQty;
                            newCarton.COLLECTED   = 0;
                            newCarton.EATTRIBUTE1 = "";
                            newCarton.PKCARTONID  = System.Guid.NewGuid().ToString().ToUpper();
                            newCarton.MUSER       = ApplicationService.Current().UserCode;
                            newCarton.MDATE       = currentDateTime.DBDate;
                            newCarton.MTIME       = currentDateTime.DBTime;
                            pf.AddCARTONINFO(newCarton);

                            //0.向tblcarton2rcard表增加一个包装箱 Add By Bernard @ 2010-11-01
                            Carton2RCARD newCarton2RCard = new Carton2RCARD();
                            newCarton2RCard.CartonCode  = cartonno.Trim().ToUpper();
                            newCarton2RCard.Rcard       = rCard;
                            newCarton2RCard.MUser       = ApplicationService.Current().UserCode;
                            newCarton2RCard.MDate       = currentDateTime.DBDate;
                            newCarton2RCard.MTime       = currentDateTime.DBTime;
                            newCarton2RCard.Eattribute1 = "";
                            newCarton2RCard.MOCode      = moCode;
                            pf.AddCarton2RCARD(newCarton2RCard);
                            m_HasCartonAdded = true;
                            //end
                        }

                        //1.判断新箱与旧箱内产品工单代码是否一致 Add By Bernard @ 2010-11-01
                        object oldObj = pf.GetCarton2RCARD(oldCartonno, rCard);
                        //modified by lisa @20120829
                        //string newMOCode = moCode;
                        object[] newObj    = pf.GetCarton2RCARDByCartonNO(FormatHelper.CleanString(this.txtCartonNO.Value.Trim()));
                        string   newMOCode = ((Carton2RCARD)newObj[0]).MOCode;
                        //end add
                        string oldMOCode = ((Carton2RCARD)oldObj).MOCode;

                        if (oldMOCode == newMOCode)        //工单代码一致
                        {
                            if (m_HasCartonAdded == false) //箱号没有新增,则向Carton2RCard新增一条记录
                            {
                                DBDateTime   currentDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
                                Carton2RCARD carton2rcard    = new Carton2RCARD();
                                carton2rcard.Rcard       = rCard;
                                carton2rcard.CartonCode  = cartonno;
                                carton2rcard.MOCode      = moCode;
                                carton2rcard.MUser       = ApplicationService.Current().UserCode;
                                carton2rcard.MDate       = currentDateTime.DBDate;
                                carton2rcard.MTime       = currentDateTime.DBTime;
                                carton2rcard.Eattribute1 = "";
                                pf.AddCarton2RCARD(carton2rcard);
                            }
                            //end

                            dcf.RemoveFromCarton(simulationReport.RunningCard, ApplicationService.Current().UserCode);

                            pf.UpdateCollected(cartonno.Trim().ToUpper());

                            Domain.DataCollect.Simulation simulation = (Domain.DataCollect.Simulation)dcf.GetSimulation(simulationReport.RunningCard);

                            if (simulation != null)
                            {
                                simulation.CartonCode = cartonno.Trim().ToUpper();
                                dcf.UpdateSimulation(simulation);
                            }

                            dcf.UpdateSimulationReport(simulationReport);

                            //记log
                            pf.addCarton2RCARDLog(cartonno, simulationReport.RunningCard, ApplicationService.Current().UserCode);
                            //end
                        }
                        else//新旧包装箱工单代码不一致 Add By Bernard @ 2010-11-01
                        {
                            if (m_HasCartonAdded == true)
                            {
                                //删除CartonInfo表新增加的包装箱
                                CARTONINFO cartoninfo = new CARTONINFO();
                                cartoninfo.CARTONNO = cartonno;
                                pf.DeleteCARTONINFO(cartoninfo);

                                //删除旧Carton2RCARD表新增加的箱号
                                Carton2RCARD carton2rcard = new Carton2RCARD();
                                carton2rcard.Rcard      = rCard;
                                carton2rcard.CartonCode = cartonno;
                                pf.DeleteCarton2RCARD(carton2rcard);
                            }
                            else
                            {
                                DataProvider.RollbackTransaction();
                                ucMessage.Add(new UserControl.Message(MessageType.Error,
                                                                      "$CS_CARTON_NO :" + cartonno + "$CS_Which_MOCode_With_RCard :" + rCard + "$CS_For_Carton_No's_MOCode_Is_Different"));
                                txtCartonNO.TextFocus(true, true);
                                return;
                            }
                        }
                        //end

                        DataProvider.CommitTransaction();

                        ucMessage.Add(new UserControl.Message(MessageType.Success
                                                              , "$CS_RCARD_TRANSFER_CARTON_SUCCESS $CS_Param_ID =" + txtRCard.Value.Trim().ToUpper()));

                        txtRCard.TextFocus(true, true);
                        txtCartonNO.Value = String.Empty;
                        ClearRCardInfo();
                    }
                    catch (Exception ex)
                    {
                        DataProvider.RollbackTransaction();
                        ucMessage.Add(new UserControl.Message(ex));

                        txtCartonNO.TextFocus(true, true);
                    }
                    finally
                    {
                        (DataProvider as SQLDomainDataProvider).PersistBroker.CloseConnection();
                    }
                    #endregion
                }
                else
                {
                    ucMessage.Add(new UserControl.Message(MessageType.Error, "$NoSimulation $CS_Param_ID =" + txtRCard.Value.Trim().ToUpper()));

                    ClearRCardInfo();
                    txtRCard.TextFocus(true, true);
                }

                #endregion
            }
        }
示例#15
0
        public void ucbBurnOut_Click(object sender, EventArgs e)
        {
            /* 检查车号 */
            string shelfno = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.uclShelfNO.Value));

            if (shelfno.Length == 0)
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_Please_Input_ShelfNO"));

                Application.DoEvents();
                uclShelfNO.TextFocus(true, true);
                //System.Windows.Forms.SendKeys.Send("+{TAB}");
                return;
            }

            bool expired = false;

            for (int i = 0; i < this.ultraDataSource2.Rows.Count; i++)
            {
                if (string.Compare(shelfno, this.ultraDataSource2.Rows[i]["ShelfNO2"].ToString()) == 0)
                {
                    expired = true;
                    break;
                }
            }

            if (!expired)
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_Shelf_Not_Expired"));

                Application.DoEvents();
                uclShelfNO.TextFocus(true, true);
                //System.Windows.Forms.SendKeys.Send("+{TAB}");
                return;
            }

            Messages messages = new Messages();

            if (_shelfFacade == null)
            {
                _shelfFacade = new ShelfFacade(this.DataProvider);
            }

            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection();
            DataProvider.BeginTransaction();
            try
            {
                /* step1: 改变shelf的状态 */
                object shelf = _shelfFacade.GetShelfAndLockit(shelfno);

                if (shelf == null)
                {
                    messages.Add(new UserControl.Message(MessageType.Error, "$CS_Shelf_Not_Exist"));
                    ApplicationRun.GetInfoForm().Add(messages);
                    //RefreshPanel() ;
//					this.DataProvider.RollbackTransaction();	// Added by Icyer 2006/06/13 @Darfon
                }

                if (messages.IsSuccess())
                {
                    if ((shelf as Shelf).Status == ShelfStatus.BurnOut)
                    {
                        messages.Add(new UserControl.Message(MessageType.Error, "$CS_Shelf_Has_Burn_Out"));
                        ApplicationRun.GetInfoForm().Add(messages);
                        //RefreshPanel() ;
                        //					this.DataProvider.RollbackTransaction();	// Added by Icyer 2006/06/13 @Darfon
                    }
                }

                object shelfActionList = null;
                if (messages.IsSuccess())
                {
                    (shelf as Shelf).Status       = ShelfStatus.BurnOut;
                    (shelf as Shelf).MaintainUser = ApplicationService.Current().UserCode;


                    /* step2: 记录shelf */
                    DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

                    shelfActionList = _shelfFacade.GetShelfActionList(shelfno, ShelfStatus.BurnIn);
                    (shelfActionList as ShelfActionList).Status = ShelfStatus.BurnOut;
//				(shelfActionList as ShelfActionList).BurnOutDate = FormatHelper.TODateInt( DateTime.Now );
//				(shelfActionList as ShelfActionList).BurnOutTIme = FormatHelper.TOTimeInt( DateTime.Now );

                    (shelfActionList as ShelfActionList).BurnOutDate = dbDateTime.DBDate;
                    (shelfActionList as ShelfActionList).BurnOutTIme = dbDateTime.DBTime;;

                    (shelfActionList as ShelfActionList).BurnOutUser  = ApplicationService.Current().UserCode;
                    (shelfActionList as ShelfActionList).MaintainUser = ApplicationService.Current().UserCode;


                    /* step3: 车位计数,减1 */


                    /* step4: rcard burn Out */
                    string[] rcards = _shelfFacade.GetShelf2RCard((shelfActionList as ShelfActionList).PKID);
                    if (rcards != null && rcards.Length > 0)
                    {
                        for (int i = 0; i < rcards.Length; i++)
                        {
                            messages.AddMessages(RunBurnOut(rcards[i], (shelfActionList as ShelfActionList).PKID));
                            if (!messages.IsSuccess())
                            {
                                break;
                            }
                        }
                    }
                }

                if (messages.IsSuccess())
                {
                    //Laws Lu,2006/11/31 change update database sequence
                    _shelfFacade.UpdateShelf(shelf as Shelf);
                    //Laws Lu,2006/11/31 update detail data
                    _shelfFacade.UpdateShelfActionList(shelfActionList as ShelfActionList);
                    //Laws Lu,2006/11/31 车位计数
                    _shelfFacade.UpdateBurnInOutVolumnBySqlMinus(ApplicationService.Current().UserCode);


                    ApplicationRun.GetInfoForm().Add(messages);

                    DataProvider.CommitTransaction();
                    //RefreshPanel() ;
                }
                else
                {
                    DataProvider.RollbackTransaction();
                    ApplicationRun.GetInfoForm().Add(messages);
                    //RefreshPanel() ;
                }
            }
            catch (Exception ex)
            {
                DataProvider.RollbackTransaction();
                if (ex.Message.IndexOf("ORA-00054") >= 0)
                {
                    messages.Add(new UserControl.Message(MessageType.Error, "$ERR_CURRENT_SHELF_BE_LOCKED"));
                }
                else
                {
                    messages.Add(new UserControl.Message(ex));
                }
                ApplicationRun.GetInfoForm().Add(messages);
                //RefreshPanel() ;
            }
            finally
            {
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
                RefreshPanel();
            }
        }
示例#16
0
        //Process Carton NO
        private void ProcessCarton(string cartonno)
        {
            DataCollectFacade dcf     = new DataCollectFacade(DataProvider);
            string            lotCode = txtLotCode.Value.Trim().ToUpper();

            #region lotCode 从当前Carton移转到另外一个Carton
            InventoryFacade materialDCF = new InventoryFacade(DataProvider);

            if (!CheckTargetCarton(cartonno))
            {
                if (!m_NeedAddNewCarton)
                {
                    txtCartonNO.TextFocus(true, true);
                    return;
                }
            }
            object objSimulationReport = dcf.GetLastLotSimulationReport(lotCode);

            if (objSimulationReport != null)
            {
                Domain.LotDataCollect.LotSimulationReport simulationReport = objSimulationReport as Domain.LotDataCollect.LotSimulationReport;

                #region 移转操作
                DataProvider.BeginTransaction();
                try
                {
                    //Add By Bernard @ 2010-11-01
                    string moCode           = txtMoCode.Value.Trim().ToUpper();
                    string oldCartonno      = ucLabelComboxCurrentCarton.SelectedItemText;
                    bool   m_HasCartonAdded = false;
                    //end
                    decimal    oldCartonQty  = 0;
                    Carton2Lot oldCarton2Lot = (Carton2Lot)pf.GetCarton2Lot(oldCartonno.Trim().ToUpper(), lotCode.Trim().ToUpper());
                    if (oldCarton2Lot != null)
                    {
                        oldCartonQty = oldCarton2Lot.CartonQty;
                    }

                    int capaCity = ((new ItemFacade(DataProvider)).GetItem(simulationReport.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID) as Item).ItemCartonQty;

                    //包装箱不存在,为CartonInfo表增加一个包装箱信息
                    if (m_NeedAddNewCarton)
                    {
                        if (oldCartonQty > capaCity)
                        {
                            DataProvider.RollbackTransaction();
                            ShowMessage(
                                "$CS_CartonQty_IS_Large $CS_Param_LotNO =" + txtLotCode.Value.Trim().ToUpper());
                            txtCartonNO.TextFocus(true, true);
                            return;
                        }

                        DBDateTime currentDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
                        BenQGuru.eMES.Domain.Package.CARTONINFO newCarton = new BenQGuru.eMES.Domain.Package.CARTONINFO();

                        newCarton.CARTONNO    = cartonno.Trim().ToUpper();
                        newCarton.CAPACITY    = capaCity;
                        newCarton.COLLECTED   = 0;
                        newCarton.EATTRIBUTE1 = "";
                        newCarton.PKCARTONID  = System.Guid.NewGuid().ToString().ToUpper();
                        newCarton.MUSER       = ApplicationService.Current().UserCode;
                        newCarton.MDATE       = currentDateTime.DBDate;
                        newCarton.MTIME       = currentDateTime.DBTime;
                        pf.AddCARTONINFO(newCarton);

                        //0.向tblcarton2rcard表增加一个包装箱 Add By Bernard @ 2010-11-01
                        Carton2Lot newCarton2Lot = new Carton2Lot();
                        newCarton2Lot.CartonCode  = cartonno.Trim().ToUpper();
                        newCarton2Lot.LotCode     = lotCode;
                        newCarton2Lot.CartonQty   = oldCartonQty;
                        newCarton2Lot.MUser       = ApplicationService.Current().UserCode;
                        newCarton2Lot.MDate       = currentDateTime.DBDate;
                        newCarton2Lot.MTime       = currentDateTime.DBTime;
                        newCarton2Lot.Eattribute1 = "";
                        newCarton2Lot.MOCode      = moCode;
                        pf.AddCarton2Lot(newCarton2Lot);
                        m_HasCartonAdded = true;
                        //end
                    }

                    //判断箱中采集数量是否大与包装容量
                    object obj = pf.GetCARTONINFO(cartonno.Trim().ToUpper());
                    Domain.Package.CARTONINFO carton = obj as Domain.Package.CARTONINFO;
                    if ((carton.COLLECTED + oldCartonQty) > carton.CAPACITY)
                    {
                        DataProvider.RollbackTransaction();
                        ShowMessage("$CS_CartonQty_IS_Large $CS_CARTON_NO =" + cartonno.Trim().ToUpper());
                        txtCartonNO.TextFocus(true, true);
                        return;
                    }

                    //1.判断新箱与旧箱内产品工单代码是否一致 Add By Bernard @ 2010-11-01
                    object oldObj    = pf.GetCarton2Lot(oldCartonno, lotCode);
                    string newMOCode = moCode;
                    string oldMOCode = ((Carton2Lot)oldObj).MOCode;

                    if (oldMOCode == newMOCode)        //工单代码一致
                    {
                        if (m_HasCartonAdded == false) //箱号没有新增,则向Carton2RCard新增一条记录
                        {
                            DBDateTime currentDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

                            object newObj = pf.GetCarton2Lot(cartonno, lotCode);
                            if (newObj == null)
                            {
                                Carton2Lot carton2Lot = new Carton2Lot();
                                carton2Lot.LotCode     = lotCode;
                                carton2Lot.CartonQty   = oldCartonQty;
                                carton2Lot.CartonCode  = cartonno;
                                carton2Lot.MOCode      = moCode;
                                carton2Lot.MUser       = ApplicationService.Current().UserCode;
                                carton2Lot.MDate       = currentDateTime.DBDate;
                                carton2Lot.MTime       = currentDateTime.DBTime;
                                carton2Lot.Eattribute1 = "";
                                pf.AddCarton2Lot(carton2Lot);
                            }
                            else
                            {
                                Carton2Lot carton2Lot = newObj as Carton2Lot;
                                carton2Lot.CartonQty = carton2Lot.CartonQty + oldCartonQty;
                                carton2Lot.MUser     = ApplicationService.Current().UserCode;
                                carton2Lot.MDate     = currentDateTime.DBDate;
                                carton2Lot.MTime     = currentDateTime.DBTime;
                                pf.UpdateCarton2Lot(carton2Lot);
                            }
                        }
                        //end

                        dcf.RemoveFromCarton(simulationReport.LotCode, oldCartonno, ApplicationService.Current().UserCode);
                        pf.UpdateCollected(cartonno.Trim().ToUpper(), oldCartonQty);

                        //记log
                        pf.AddCarton2LotLog(cartonno, simulationReport.LotCode, oldCartonQty, ApplicationService.Current().UserCode);
                        //end
                    }
                    else
                    {
                        DataProvider.RollbackTransaction();
                        ShowMessage("$ERROR_CARTON_MOCODE $CS_CARTON_NO =" + cartonno.Trim().ToUpper());
                        txtCartonNO.TextFocus(true, true);
                        return;
                    }

                    //判断相中的批次是否属于同一批次
                    int mocodeCount = pf.GetMoCountByCartonNo(cartonno);
                    if (mocodeCount > 1)
                    {
                        DataProvider.RollbackTransaction();
                        ShowMessage("$ERROR_CARTON_MOCODE $CS_CARTON_NO =" + cartonno.Trim().ToUpper());
                        txtCartonNO.TextFocus(true, true);
                        return;
                    }
                    //end

                    DataProvider.CommitTransaction();

                    ShowMessage("$CS_LOTCODE_TRANSFER_CARTON_SUCCESS $CS_Param_LotNO =" + txtLotCode.Value.Trim().ToUpper());

                    txtLotCode.TextFocus(true, true);
                    txtCartonNO.Value = String.Empty;
                    ClearLotCodeInfo();
                }
                catch (Exception ex)
                {
                    DataProvider.RollbackTransaction();
                    txtCartonNO.TextFocus(true, true);
                }
                finally
                {
                    (DataProvider as SQLDomainDataProvider).PersistBroker.CloseConnection();
                }
                #endregion
            }
            else
            {
                ShowMessage("$NoSimulation $CS_Param_ID =" + txtLotCode.Value.Trim().ToUpper());

                ClearLotCodeInfo();
                txtLotCode.TextFocus(true, true);
            }
            #endregion
        }
示例#17
0
        //根据班次,产品代码,产线,查出今天做过的首件上线和跨天的班次昨天做的首件上线,填充在“上班时间”下拉列表中
        private void FillBeginTime()
        {
            #region 检查界面输入
            if (this.ucSSName.Value == string.Empty)
            {
                Messages msg = new Messages();
                msg.Add(new UserControl.Message(MessageType.Error, this.ucSSName.Caption + " $Error_Input_Empty"));
                ApplicationRun.GetInfoForm().Add(msg);
                this.ucRCard.TextFocus(false, true);
                return;
            }
            if (this.ucRCard.Value == string.Empty)
            {
                Messages msg = new Messages();
                msg.Add(new UserControl.Message(MessageType.Error, this.ucRCard.Caption + " $Error_Input_Empty"));
                ApplicationRun.GetInfoForm().Add(msg);
                this.ucRCard.TextFocus(false, true);
                return;
            }
            #endregion

            #region             //取得当前时间所在的班次

            int i = _facade.GetCurrShiftIndex(FormatHelper.TOTimeInt(this.dtpEnd.Text), this.cbxShiftTime.ComboBoxData.Items);
            if (i != -1)
            {
                this.cbxShiftTime.ComboBoxData.SelectedIndex = i;
            }
            else
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "选择的时间没有班次"));
                return;
            }
            UIShift shift = this.cbxShiftTime.ComboBoxData.SelectedItem as UIShift;
            if (shift == null)
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "班次不存在"));
                return;
            }
            #endregion

            #region 判断产品序列号是否存在
            BenQGuru.eMES.DataCollect.DataCollectFacade dcFacade = new DataCollectFacade(this.DataProvider);
            BenQGuru.eMES.Domain.DataCollect.Simulation sim      = dcFacade.GetSimulation(ucRCard.InnerTextBox.Text.Trim()) as BenQGuru.eMES.Domain.DataCollect.Simulation;

            if (sim == null)
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_First_No_Rcard"));
                ucRCard.TextFocus(false, true);
                return;
            }
            else
            {
                _itemcode = sim.ItemCode;
            }
            #endregion

            //判断是否已经有上线了
            //2006/11/17,Laws Lu add get DateTime from db Server
            DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

            DateTime dtNow = FormatHelper.ToDateTime(dbDateTime.DBDate, dbDateTime.DBTime);

            DateTime dtShiftDay = dtNow;

            /////如是跨天的班次,并且是处在第二天,则用前一天做为上线日期
            if (shift.IsOverDay == FormatHelper.TRUE_STRING)
            {
                if (FormatHelper.TOTimeInt(dtShiftDay) < shift.BeginTime)
                {
                    dtShiftDay = dtShiftDay.AddDays(-1);
                }
            }

            this.cbxBeginTime.ComboBoxData.Items.Clear();
            this._shiftCode = shift.ShiftCode;
            this._shiftDate = FormatHelper.TODateInt(dtShiftDay);

            //取出做的首件信息
            object[] objs = _facade.QueryFirst(this.ucSSName.Value, this._shiftDate, _itemcode, this._shiftCode);
            if (objs == null || objs.Length == 0)
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "请先做首件上/下线"));
                return;
            }

            foreach (BenQGuru.eMES.Domain.Alert.FirstOnline first in objs)
            {
                if (first != null)
                {
                    //将做过末件上线和下线的排除掉
                    if (first.LastType == LineActionType.ON || first.LastType == LineActionType.OFF)
                    {
                        continue;
                    }

                    this.cbxBeginTime.ComboBoxData.Items.Add(FormatHelper.ToTimeString(first.ShiftTime));
                }
            }
            if (this.cbxBeginTime.ComboBoxData.Items.Count > 0)
            {
                this.cbxBeginTime.ComboBoxData.SelectedIndex = 0;
            }
        }
示例#18
0
        private void ucBtnOK_Click(object sender, System.EventArgs e)
        {
            if (this.ucLERunningCard.Value.Trim() == string.Empty)
            {
                //Laws Lu,2005/08/11,新增焦点设置
                ucLERunningCard.TextFocus(true, true);
                return;
            }

            this.ucMessage.Add(string.Format("<< {0}", this.ucLERunningCard.Value.Trim().ToUpper()));

            // 输入分板前产品序列号
            if (this._currSequence == 0)
            {
                #region 工单、序列号匹配
                _runningCardList = new ArrayList();

                if (this.txtMoCode.Checked)
                {
                    if (string.IsNullOrEmpty(txtMoCode.Value.ToUpper().Trim()))
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Input_MOCode"));
                        this.ucLERunningCard.Value = "";

                        //Laws Lu,2005/08/11,新增焦点设置
                        txtMoCode.Focus();
                        return;
                    }
                }

                //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;
                //added by jessie lee, 2005/11/29
                #region 判断转换前序列号是否符合条件
                //长度检查
                if (bCardTransLenULE.Checked)
                {
                    if (bCardTransLenULE.Value.Trim().Length == 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_Transfer_Empty"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    int len = 0;
                    try
                    {
                        len = int.Parse(bCardTransLenULE.Value.Trim());
                    }
                    catch
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_BeforeCardTransLen_Should_be_Integer"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    if (len != this.ucLERunningCard.Value.Trim().Length)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_BeforeCardTransLen_Not_Correct"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }

                //首字符串检查
                if (bCardTransLetterULE.Checked)
                {
                    if (bCardTransLetterULE.Value.Trim().Length == 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_Transfer_FLetter_Empty"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    int index = ucLERunningCard.Value.Trim().IndexOf(bCardTransLetterULE.Value.Trim());
                    if (index != 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_Transfer_FLetter_NotCompare"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }
                #endregion

                #region 取得分板比例,从工单和SMT是否是打叉板得到分板比例,若不是,带出工单的分版比例

                simReport = _DataCollectFacade.GetLastSimulationReport(this.ucLERunningCard.Value.Trim().ToUpper());
                if (simReport == null)
                {
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_CS_ID_Not_Exist"));
                    this.ucLERunningCard.Value = "";
                    this.ucLERunningCard.TextFocus(true, true);
                    return;
                }
                else
                {
                    if (simReport.IsComplete != "1")
                    {
                        //完工后才可以分板,故注释。
                        //主要应用于以下业务情况:
                        //序列号 s1 通过两张工单 mo1, mo2 完成。s1 经过第一张工单 mo1 完工后,需要进行分板 s1--> s1-1, s1-2,
                        //分板后再用 s1-1, s1-2 进行第二张工单 mo2 的归属生产。
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_ERROR_PRODUCT_NO_COMPLETE"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    if (txtMoCode.Checked)
                    {
                        if (string.Compare(txtMoCode.Value.ToUpper().Trim(), simReport.MOCode, true) != 0)
                        {
                            this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$RCARD_NOT_IN_MO"));
                            ucLERunningCard.TextFocus(true, true);
                            return;
                        }
                    }

                    int rcardCount = _DataCollectFacade.GetSplitBoardCount(this.ucLERunningCard.Value.Trim().ToUpper());

                    if (rcardCount > 0)
                    {
                        //已经分板的序列号就不可以在分了
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_ERROR_PRODUCT_ALREADY_SPLITE"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }


                SMTFacade smtFacade = new SMTFacade(this.DataProvider);
                object    objsmtrel = smtFacade.GetSMTRelationQty(this.ucLERunningCard.Value.Trim().ToUpper(), simReport.MOCode);
                if (objsmtrel != null)
                {
                    Smtrelationqty smtrel = (Smtrelationqty)objsmtrel;
                    this.txtIDMergeValue.Text = Convert.ToString(smtrel.Relationqtry);
                }
                else
                {
                    MOFacade mofacade = new MOFacade(this.DataProvider);
                    object   objMO    = mofacade.GetMO(simReport.MOCode);
                    if (objMO != null)
                    {
                        MO mo = (MO)objMO;
                        this.txtIDMergeValue.Text = Convert.ToString(mo.IDMergeRule);
                    }
                    else
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_MO_Not_Exit"));
                        txtMoCode.Focus();
                        txtMoCode.SelectAll();
                        return;
                    }
                }
                #endregion

                #region 判断分板前序列号是否存在


                int mergeRule = 1;
                try
                {
                    mergeRule = System.Int32.Parse(this.txtIDMergeValue.Text.ToUpper().Trim());
                }
                catch
                {
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_CS_IDMerge_Should_be_Integer"));//分板比例必须为整数
                    //Laws Lu,2005/08/11,新增焦点设置
                    ucLERunningCard.TextFocus(true, true);
                    return;
                }

                if (mergeRule <= 0)
                {
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_CS_IDMerge_Should_Over_Zero"));//分板比例必须大于零
                    ucLERunningCard.TextFocus(true, true);
                    return;
                }
                this._mergeRule = mergeRule;
                #endregion

                #endregion
            }
            else
            {
                //added by jessie lee, 2005/11/29
                #region 判断转换后序列号是否符合条件
                //长度检查
                if (aCardTransLenULE.Checked)
                {
                    if (aCardTransLenULE.Value.Trim().Length == 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_After_Card_Transfer_Empty"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    int len = 0;
                    try
                    {
                        len = int.Parse(aCardTransLenULE.Value.Trim());
                    }
                    catch
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_AfterCardTransLen_Should_be_Integer"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    if (len != this.ucLERunningCard.Value.Trim().Length)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_AfterCardTransLen_Not_Correct"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }

                //首字符串检查
                if (aCardTransLetterULE.Checked)
                {
                    if (aCardTransLetterULE.Value.Trim().Length == 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_After_Card_Transfer_FLetter_Empty"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    int index = ucLERunningCard.Value.Trim().IndexOf(aCardTransLetterULE.Value.Trim());
                    if (index != 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_After_Card_Transfer_FLetter_NotCompare"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }
                #endregion

                #region 判断分板后序列号是否重复
                if (this._runningCardList.Contains(this.ucLERunningCard.Value.Trim().ToUpper()))
                {
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_CS_Merge_ID_Exist"));//转换后产品序列号重复
                    this.ucLERunningCard.Value = "";

                    //Laws Lu,2005/08/11,新增焦点设置
                    ucLERunningCard.TextFocus(true, true);
                    return;
                }
                #endregion


                int rcardCount = _DataCollectFacade.GetSplitBoardCount(this.ucLERunningCard.Value.Trim().ToUpper());

                if (rcardCount > 0)
                {
                    //已经分板的序列号就不可以在分了
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_ERROR_PRODUCT_ALREADY_SPLITE"));
                    this.ucMessage.AddBoldText(string.Format(">>$CS_Please_Input_Merge_ID {0}/{1}", this._currSequence.ToString(), this._mergeRule.ToString()));//请输入转换后产品序列号
                    ucLERunningCard.TextFocus(true, true);
                    return;
                }


                this._runningCardList.Add(this.ucLERunningCard.Value.Trim().ToUpper());
            }

            if (this._currSequence < this._mergeRule)
            {
                this._currSequence++;

                this.txtIDMergeValue.Enabled = false;
                this.ucMessage.AddBoldText(string.Format(">>$CS_Please_Input_Merge_ID {0}/{1}", this._currSequence.ToString(), this._mergeRule.ToString())); //请输入转换后产品序列号
            }
            else if (this._currSequence == this._mergeRule)                                                                                                  // 达到分板比例,写入数据库
            {
                try
                {
                    this.DataProvider.BeginTransaction();
                    int        tempCount  = 1;
                    DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                    foreach (string strRcard in _runningCardList)
                    {
                        #region 将ID添加到SplitBoard
                        SplitBoard splitBorad = new SplitBoard();
                        splitBorad.Seq           = tempCount;
                        splitBorad.Mocode        = simReport.MOCode;
                        splitBorad.Rcard         = strRcard;
                        splitBorad.Modelcode     = simReport.ModelCode;
                        splitBorad.Itemcode      = simReport.ItemCode;
                        splitBorad.Opcode        = simReport.OPCode;
                        splitBorad.Rescode       = ApplicationService.Current().ResourceCode;
                        splitBorad.Routecode     = simReport.RouteCode;
                        splitBorad.Scard         = simReport.SourceCard;
                        splitBorad.Segcode       = simReport.SegmentCode;
                        splitBorad.Shiftcode     = simReport.ShiftCode;
                        splitBorad.Shifttypecode = simReport.ShiftTypeCode;
                        splitBorad.Sscode        = simReport.StepSequenceCode;
                        splitBorad.Tpcode        = simReport.TimePeriodCode;
                        splitBorad.Muser         = ApplicationService.Current().UserCode;
                        splitBorad.Mdate         = dbDateTime.DBDate;
                        splitBorad.Mtime         = dbDateTime.DBTime;
                        _DataCollectFacade.AddSplitBoard(splitBorad);
                        tempCount++;
                        #endregion
                    }
                    this.DataProvider.CommitTransaction();

                    this.ucMessage.Add(new UserControl.Message(MessageType.Success, ">>$CS_SplitID_CollectSuccess"));//产品序列号转换采集成功
                    //added by jessie lee, 2005/11/29,
                }
                catch (Exception ex)
                {
                    this.DataProvider.RollbackTransaction();
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, ">>$CS_SplitID_CollectSuccess"));//产品序列号转换采集成功
                }


                this.initInput();
            }

            this.ucLERunningCard.Value = "";

            //Laws Lu,2005/08/11,新增焦点设置
            if (!aCardTransLetterULE.Checked)
            {
                ucLERunningCard.TextFocus(true, true);
            }
            else
            {
                ucLERunningCard.TextFocus(true, true);
            }
        }
示例#19
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            if (this.txtMOCodeQuery.Value == string.Empty)
            {
                //Application.DoEvents();
                this.txtMOCodeQuery.TextFocus(false, true);
                return;
            }
            if (this.txtSSCodeQuery.Value == string.Empty)
            {
                //Application.DoEvents();
                this.txtSSCodeQuery.TextFocus(true, true);
                return;
            }
            if (this.checkedMOCode != this.txtMOCodeQuery.Value.Trim().ToUpper())
            {
                this.txtMOCodeQuery_TxtboxKeyPress(null, new KeyPressEventArgs('\r'));
            }
            if (tableSource.Rows.Count == 0)
            {
                return;
            }
            this.txtReelNoCheckQty.Value = this.txtReelNoCheckQty.Value.Trim().ToUpper();
            this.txtReelNoReturn.Value   = this.txtReelNoReturn.Value.Trim().ToUpper();
            string strReelNo = string.Empty;

            if (this.rdoCheckQty.Checked == true)
            {
                //Application.DoEvents();
                if (this.txtReelNoCheckQty.Value.Trim() == string.Empty)
                {
                    txtReelNoCheckQty.TextFocus(false, true);
                    return;
                }
                if (this.txtReelQty.Value.Trim() == string.Empty)
                {
                    txtReelQty.TextFocus(false, true);
                    return;
                }
                strReelNo = this.txtReelNoCheckQty.Value.Trim().ToUpper();
            }
            else if (this.rdoReturn.Checked == true)
            {
                if (this.txtReelNoReturn.Value.Trim() == string.Empty)
                {
                    //Application.DoEvents();
                    this.txtReelNoReturn.TextFocus(false, true);
                    return;
                }
                strReelNo = this.txtReelNoReturn.Value.Trim().ToUpper();
            }
            DataRow[] rowsTmp = tableSource.Select("ReelNo='" + strReelNo + "'");
            if (rowsTmp.Length == 0)
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$SMT_CheckReel_Not_In_List"));
                return;
            }
            if (rowsTmp[0]["IsChecked"].ToString() == "1")
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$SMT_CheckReel_Reel_Checked_Already"));
                return;
            }
            // 提交
            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection();
            this.DataProvider.BeginTransaction();
            Messages messages = new Messages();

            try
            {
                if (this.rdoCheckQty.Checked == true)
                {
                    messages.AddMessages(smtFacade.CheckReel(strReelNo, int.Parse(this.txtReelQty.Value), Service.ApplicationService.Current().UserCode));
                }
                else
                {
                    messages.AddMessages(smtFacade.CheckReel(strReelNo, int.MinValue, Service.ApplicationService.Current().UserCode));
                }
                if (messages.IsSuccess() == true)
                {
                    this.DataProvider.CommitTransaction();
                    if (this.rdoCheckQty.Checked == true)
                    {
                        messages.Add(new UserControl.Message(MessageType.Success, "$SMT_CheckReel_Success"));
                    }
                    else
                    {
                        messages.Add(new UserControl.Message(MessageType.Success, "$SMT_Prepare_Reel_Return_Success"));
                    }
                }
                else
                {
                    this.DataProvider.RollbackTransaction();
                }
            }
            catch (Exception ex)
            {
                messages.Add(new UserControl.Message(ex));
                this.DataProvider.RollbackTransaction();
            }
            finally
            {
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
            }
            ApplicationRun.GetInfoForm().Add(messages);
            // 更改Grid
            if (messages.IsSuccess() == true)
            {
                DataRow[] rows = tableSource.Select("ReelNo='" + strReelNo + "'");
                if (this.rdoCheckQty.Checked == true)
                {
                    rows[0]["ActualQty"] = this.txtReelQty.Value;
                }
                else
                {
                    rows[0]["ActualQty"] = rows[0]["ReelLeftQty"];
                }
                rows[0]["IsChecked"] = "1";
                for (int i = 0; i < tableSource.Rows.Count; i++)
                {
                    if (gridList.Rows[i].Cells["ReelNo"].Text == strReelNo)
                    {
                        gridList.Rows[i].Appearance.ForeColor = Color.Black;
                        break;
                    }
                }
            }
            //Application.DoEvents();
            if (this.rdoCheckQty.Checked == true)
            {
                this.txtReelQty.Value = string.Empty;
                this.txtReelNoCheckQty.TextFocus(true, true);
            }
            else
            {
                this.txtReelNoReturn.TextFocus(true, true);
            }
        }