Example #1
0
        private void FSMTCheckReelQty_Load(object sender, System.EventArgs e)
        {
            smtFacade   = new SMTFacade(this.DataProvider);
            tableSource = new DataTable();
            tableSource.Columns.Add("MOCode");
            tableSource.Columns.Add("StepSequenceCode");
            tableSource.Columns.Add("ReelNo");
            tableSource.Columns.Add("MaterialCode");
            tableSource.Columns.Add("ReelLeftQty", typeof(int));
            tableSource.Columns.Add("ActualQty", typeof(int));
            tableSource.Columns.Add("IsChecked");

            gridList.DataSource = tableSource;
            gridList.DisplayLayout.Bands[0].Columns["ReelLeftQty"].Format = "#,#";
            gridList.DisplayLayout.Bands[0].Columns["ReelLeftQty"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;
            gridList.DisplayLayout.Bands[0].Columns["ActualQty"].Format = "#,#";
            gridList.DisplayLayout.Bands[0].Columns["ActualQty"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;
            gridList.DisplayLayout.Bands[0].Columns["IsChecked"].Hidden = true;

            UserControl.UIStyleBuilder.FormUI(this);
            UserControl.UIStyleBuilder.GridUI(gridList);

            //this.InitPageLanguage();
            //this.InitGridLanguage(gridList);
        }
Example #2
0
        private void FSMTFeederReelWatch_Load(object sender, System.EventArgs e)
        {
            smtFacade = new SMTFacade(this.DataProvider);

            tableSource = new DataTable();
            tableSource.Columns.AddRange(new DataColumn[] {
                new DataColumn("LineCode"),
                new DataColumn("MachineCode"),
                new DataColumn("MachineStationCode"),
                new DataColumn("FeederCode"),
                new DataColumn("FeederLeftCount", typeof(int)),
                new DataColumn("FeederAlterDay", typeof(int)),
                new DataColumn("ReelNo"),
                new DataColumn("ReelLeftQty", typeof(int)),
                new DataColumn("IsAlert"),
                new DataColumn("NextReelNo"),
                new DataColumn("NextReelLeftQty", typeof(int)),
                new DataColumn("MoCode")
            });
            tableSource.DefaultView.Sort = "LineCode,MachineCode,MachineStationCode";
            this.gridList.DataSource     = tableSource.DefaultView;
            this.gridList.DisplayLayout.Bands[0].Columns["IsAlert"].Hidden = true;
            this.gridList.DisplayLayout.Bands[0].Columns["MoCode"].Hidden  = true;
            //this.gridList.DisplayLayout.Bands[0].Columns["NextReelNo"].Hidden = true;

            tableLineError = new DataTable();
            tableLineError.Columns.AddRange(new DataColumn[] {
                new DataColumn("LineCode"),
                new DataColumn("MOCode"),
                new DataColumn("ErrorType"),
                new DataColumn("MachineCode"),
                new DataColumn("MachineStationCode"),
                new DataColumn("ReelNo"),
                new DataColumn("ReelLeftQty", typeof(int))
            });
            tableLineError.DefaultView.Sort = "LineCode,MOCode,MachineCode,MachineStationCode";
            this.gridLineError.DataSource   = tableLineError.DefaultView;

            UserControl.UIStyleBuilder.FormUI(this);
            UserControl.UIStyleBuilder.GridUI(gridList);
            UserControl.UIStyleBuilder.GridUI(gridLineError);
            gridList.DisplayLayout.Bands[0].Columns["FeederLeftCount"].Format = "#,#";
            gridList.DisplayLayout.Bands[0].Columns["FeederLeftCount"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;
            gridList.DisplayLayout.Bands[0].Columns["FeederAlterDay"].Format = "#,#";
            gridList.DisplayLayout.Bands[0].Columns["FeederAlterDay"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;
            gridList.DisplayLayout.Bands[0].Columns["ReelLeftQty"].Format = "#,#";
            gridList.DisplayLayout.Bands[0].Columns["ReelLeftQty"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;
            gridList.DisplayLayout.Bands[0].Columns["NextReelLeftQty"].Format = "#,#";
            gridList.DisplayLayout.Bands[0].Columns["NextReelLeftQty"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;
            gridLineError.DisplayLayout.Bands[0].Columns["ReelLeftQty"].Format = "#,#";
            gridLineError.DisplayLayout.Bands[0].Columns["ReelLeftQty"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;

            this.lblLineStatus.Text = string.Empty;
            this.txtLineCode.Value  = Service.ApplicationService.Current().LoginInfo.Resource.StepSequenceCode;
            this.btnRefresh_Click(null, null);

            Current = this;
        }
Example #3
0
        private void FFeederMaintain_Load(object sender, System.EventArgs e)
        {
            if (tableSource == null)
            {
                tableSource = new DataTable();
                tableSource.Columns.Add("FeederCode");
                tableSource.Columns.Add("MaxCount", typeof(int));
                tableSource.Columns.Add("UsedCount", typeof(int));
                tableSource.Columns.Add("OldStatus");
                tableSource.Columns.Add("MaintainType");
                tableSource.Columns.Add("ReturnReason");
                tableSource.Columns.Add("AnalyseReason");
                tableSource.Columns.Add("OperationMessage");
                tableSource.Columns.Add("Status");
                tableSource.Columns.Add("MaintainUser");
                tableSource.Columns.Add("MaintainDate");
                tableSource.Columns.Add("MaintainTime");
            }
            gridList.DataSource = tableSource;
            gridList.DisplayLayout.Bands[0].Columns["UsedCount"].Hidden = true;
            SetControlEnabled();
            this.txtFeederNo.TextFocus(false, true);
            smtFacade = new SMTFacade(this.DataProvider);

            UserControl.UIStyleBuilder.FormUI(this);
            UserControl.UIStyleBuilder.GridUI(gridList);
            gridList.DisplayLayout.Bands[0].Columns["MaxCount"].Format = "#,#";
            gridList.DisplayLayout.Bands[0].Columns["MaxCount"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;
            gridList.DisplayLayout.Bands[0].Columns["UsedCount"].Format = "#,#";
            gridList.DisplayLayout.Bands[0].Columns["UsedCount"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;

            BenQGuru.eMES.BaseSetting.SystemSettingFacade sysFacade = new BenQGuru.eMES.BaseSetting.SystemSettingFacade(this.DataProvider);
            analyseReasonList = sysFacade.GetParametersByParameterGroup("FEEDERANALYSEREASON");
            if (analyseReasonList != null)
            {
                for (int i = 0; i < analyseReasonList.Length; i++)
                {
                    BenQGuru.eMES.Domain.BaseSetting.Parameter parameter = (BenQGuru.eMES.Domain.BaseSetting.Parameter)analyseReasonList[i];
                    this.cboAnalyseReason.Items.Add(parameter.ParameterAlias);
                }
            }
            operationMessageList = sysFacade.GetParametersByParameterGroup("FEEDERSOLUTION");
            if (operationMessageList != null)
            {
                for (int i = 0; i < operationMessageList.Length; i++)
                {
                    BenQGuru.eMES.Domain.BaseSetting.Parameter parameter = (BenQGuru.eMES.Domain.BaseSetting.Parameter)operationMessageList[i];
                    this.cboOperationMessage.Items.Add(parameter.ParameterAlias);
                }
            }
            //this.InitPageLanguage();
            //this.InitGridLanguage(gridList);
        }
Example #4
0
        private void btnQuery_Click(object sender, System.EventArgs e)
        {
            string status = string.Empty;

            if (smtfacade == null)
            {
                smtfacade = new SMTFacade(this.DataProvider);
            }
            if (mofacade == null)
            {
                mofacade = new MOFacade(this.DataProvider);
            }
            if (collectfacade == null)
            {
                collectfacade = new DataCollectFacade(this.DataProvider);
            }
            object[] objs = smtfacade.Querysmtrelation(this.txtMoCodeQuery.Value.Trim().ToUpper(),
                                                       this.txtPartNumber.Value.Trim().ToUpper(),
                                                       this.txtRCardQuery.Value.Trim().ToUpper(),
                                                       FormatHelper.TODateInt(this.startDate.Value),
                                                       FormatHelper.TODateInt(this.endDate.Value));
            tableSource.Rows.Clear();
            this.ucBtnNew.Enabled           = true;
            this.ucBtnSave.Enabled          = false;
            this.txtMoCodeEdit.Value        = string.Empty;
            this.txtRelationQtyEdit.Value   = string.Empty;
            this.txtRCardEdit.Value         = string.Empty;
            this.txtMoCodeEdit.Enabled      = true;
            this.txtRelationQtyEdit.Enabled = true;
            this.txtRCardEdit.Enabled       = true;
            this.txtMoCodeEdit.TextFocus(false, true);
            if (objs != null)
            {
                string strStatusClose = ProductionStatus.ProductionStatus_CloseProduction.ToString().Trim();
                string strStatusin    = ProductionStatus.ProductionStatus_InProduction.ToString().Trim();
                string strStatusNo    = ProductionStatus.ProductionStatus_NoProduction.ToString().Trim();
                for (int i = 0; i < objs.Length; i++)
                {
                    Smtrelationqty smt       = (Smtrelationqty)objs[i];
                    DataRow        row       = tableSource.NewRow();
                    object         simrepObj = collectfacade.GetSimulationReport(smt.Mocode.Trim().ToUpper(), smt.Rcard.Trim().ToUpper());

                    if (simrepObj != null)
                    {
                        if (((SimulationReport)simrepObj).IsComplete.Trim() == "1")
                        {
                            status = MutiLanguages.ParserString(strStatusClose);
                        }
                        else
                        {
                            status = MutiLanguages.ParserString(strStatusin);
                        }
                    }
                    else
                    {
                        status = MutiLanguages.ParserString(strStatusNo);
                    }
                    row["PartNumber"]  = smt.Itemcode.ToString();
                    row["MOCode"]      = smt.Mocode;
                    row["Rcard"]       = smt.Rcard;
                    row["RelationQty"] = smt.Relationqtry;
                    row["Status"]      = status;
                    row["MDate"]       = FormatHelper.ToDateTime(smt.Mdate, smt.Mtime);
                    row["Edit"]        = "";
                    tableSource.Rows.Add(row);
                }
            }
            else
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$CS_No_Data_To_Display"));
                return;
            }
        }
Example #5
0
        private void txtRelationQtyEdit__TxtboxKeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                #region facade
                if (mofacade == null)
                {
                    mofacade = new MOFacade(this.DataProvider);
                }
                if (materialFacade == null)
                {
                    materialFacade = new MaterialFacade(this.DataProvider);
                }
                if (collectfacade == null)
                {
                    collectfacade = new DataCollectFacade(this.DataProvider);
                }
                if (morcardfacade == null)
                {
                    morcardfacade = new MORunningCardFacade(this.DataProvider);
                }
                if (smtfacade == null)
                {
                    smtfacade = new SMTFacade(this.DataProvider);
                }
                if (itemfacade == null)
                {
                    itemfacade = new ItemFacade(this.DataProvider);
                }
                #endregion

                if (this.txtMoCodeEdit.Enabled == false && this.txtRCardEdit.Enabled == false)
                {
                    btnSave_Click(sender, e);
                    return;
                }

                #region   null
                if (this.txtMoCodeEdit.Value == string.Empty)
                {
                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$MO_Cannot_Null"));
                    this.txtMoCodeEdit.TextFocus(false, true);
                    return;
                }
                if (string.IsNullOrEmpty(txtRCardEdit.Value))
                {
                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$RMARcard_Cannot_Null"));
                    this.txtRCardEdit.TextFocus(false, true);
                    return;
                }
                if (this.txtRelationQtyEdit.Value.Trim() == string.Empty)
                {
                    //数量不能为空 $Error_Qty_Cannot_Empty
                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_Qty_Cannot_Empty"));
                    this.txtRelationQtyEdit.TextFocus(false, true);
                    return;
                }
                #endregion

                try
                {
                    #region mocode
                    if (materialFacade.GetMOCode(this.txtMoCodeEdit.Value) == false)
                    {
                        //该工单不存在
                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_Rework_MO_Not_Exist"));
                        this.txtMoCodeEdit.TextFocus(false, true);
                        return;
                    }
                    object objMO = mofacade.GetMO(this.txtMoCodeEdit.Value.Trim().ToUpper());
                    if (objMO == null || ((MO)objMO).MOStatus.Trim().ToUpper() == "MOSTATUS_CLOSE")
                    {
                        //该工单已关单,不能维护打X板!
                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_MO_Close_Not_SmtRelQty"));
                        this.txtMoCodeEdit.TextFocus(false, true);
                        return;
                    }
                    #endregion

                    #region rcard
                    object lastsimulationReport = materialFacade.GetLastSimulationReport(this.txtRCardEdit.Value.Trim().ToUpper());
                    if (lastsimulationReport != null)
                    {
                        if (((SimulationReport)lastsimulationReport).IsComplete.Trim() == "0")
                        {
                            // 该序列号在生产中,不允许维护打X板!
                            ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_Rcard_inProduction"));
                            this.txtRCardEdit.TextFocus(false, true);
                            return;
                        }
                        object simulationReport = collectfacade.GetSimulationReport(this.txtMoCodeEdit.Value.Trim().ToUpper(), this.txtRCardEdit.Value.Trim().ToUpper());
                        if (simulationReport != null)
                        {
                            // 该序列号在生产中或者已经完工,不允许维护打X板!
                            ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_Rcard_inProductionOrClose"));
                            this.txtRCardEdit.TextFocus(false, true);
                            return;
                        }
                        else
                        {
                            //修改  rcard不在工单范围内
                            #region
                            object item2sncheck = itemfacade.GetItem2SNCheck(((MO)objMO).ItemCode.Trim().ToUpper(), ItemCheckType.ItemCheckType_SERIAL);
                            if (item2sncheck != null)
                            {
                                string checkContent = ((Item2SNCheck)item2sncheck).SNContentCheck.Trim().ToUpper();
                                int    checkLength  = ((Item2SNCheck)item2sncheck).SNLength;
                                string checkPrefix  = ((Item2SNCheck)item2sncheck).SNPrefix.Trim().ToUpper();

                                string rcardCheck = this.txtRCardEdit.Value.Trim().ToUpper();
                                if (!string.IsNullOrEmpty(checkPrefix))
                                {
                                    if (rcardCheck.IndexOf(checkPrefix) != 0)
                                    {
                                        // 该序列号与工单要求的序列号前缀不一样
                                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_RunningCardPrefix_ERROR  $CS_RunningCardPrefix: " + checkPrefix));
                                        this.txtRCardEdit.TextFocus(false, true);
                                        return;
                                    }
                                }
                                if (checkLength != null && checkLength > 0)
                                {
                                    if (rcardCheck.Length != checkLength)
                                    {
                                        // 该序列号与工单要求的序列号长度不一样
                                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_RunningCardLength_ERROR  $CS_RunningCardLength: " + checkLength));
                                        this.txtRCardEdit.TextFocus(false, true);
                                        return;
                                    }
                                }
                                if (checkContent != null && checkContent == "Y")
                                {
                                    string pattern = @"^([A-Za-z0-9]+[ ]*)*[A-Za-z0-9]+$";
                                    Regex  rex     = new Regex(pattern, RegexOptions.IgnoreCase);
                                    Match  match   = rex.Match(rcardCheck);
                                    // 序列号被限制为字符 空格 数字
                                    if (!match.Success)
                                    {
                                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_SNContent_CheckWrong $CS_Param_RunSeq:" + this.txtRCardEdit.Value.Trim()));
                                        this.txtRCardEdit.TextFocus(false, true);
                                        return;
                                    }
                                }
                            }
                            #endregion
                        }
                    }
                    else
                    {
                        //修改      rcard不在工单范围内
                        #region
                        object item2sncheck = itemfacade.GetItem2SNCheck(((MO)objMO).ItemCode.Trim().ToUpper(), ItemCheckType.ItemCheckType_SERIAL);
                        if (item2sncheck != null)
                        {
                            string checkContent = ((Item2SNCheck)item2sncheck).SNContentCheck.Trim().ToUpper();
                            int    checkLength  = ((Item2SNCheck)item2sncheck).SNLength;
                            string checkPrefix  = ((Item2SNCheck)item2sncheck).SNPrefix.Trim().ToUpper();

                            string rcardCheck = this.txtRCardEdit.Value.Trim().ToUpper();
                            if (!string.IsNullOrEmpty(checkPrefix))
                            {
                                if (rcardCheck.IndexOf(checkPrefix) != 0)
                                {
                                    // 该序列号与工单要求的序列号前缀不一样
                                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_RunningCardPrefix_ERROR  $CS_RunningCardPrefix: " + checkPrefix));
                                    this.txtRCardEdit.TextFocus(false, true);
                                    return;
                                }
                            }
                            if (checkLength != null && checkLength > 0)
                            {
                                if (rcardCheck.Length != checkLength)
                                {
                                    // 该序列号与工单要求的序列号长度不一样
                                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_RunningCardLength_ERROR  $CS_RunningCardLength: " + checkLength));
                                    this.txtRCardEdit.TextFocus(false, true);
                                    return;
                                }
                            }
                            if (checkContent != null && checkContent == "Y")
                            {
                                string pattern = @"^([A-Za-z0-9]+[ ]*)*[A-Za-z0-9]+$";
                                Regex  rex     = new Regex(pattern, RegexOptions.IgnoreCase);
                                Match  match   = rex.Match(rcardCheck);
                                // 序列号被限制为字符 空格 数字
                                if (!match.Success)
                                {
                                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_SNContent_CheckWrong $CS_Param_RunSeq:" + this.txtRCardEdit.Value.Trim()));
                                    this.txtRCardEdit.TextFocus(false, true);
                                    return;
                                }
                            }
                        }
                        #endregion
                    }
                    #endregion

                    #region  Qty
                    try
                    {
                        decimal moQty  = 0;
                        int     intQty = Convert.ToInt32(this.txtRelationQtyEdit.Value);
                        if (intQty <= 0)
                        {
                            //数量应为整数类型 $Error_Qty_Not_Int
                            ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_CS_SmtRelQty_Should_Over_Zero"));
                            this.txtRelationQtyEdit.TextFocus(false, true);
                            return;
                        }
                        if (objMO != null && ((MO)objMO).IDMergeRule >= 0)
                        {
                            moQty = ((MO)objMO).IDMergeRule;
                        }
                        if (moQty < Convert.ToDecimal(intQty))
                        {
                            //数量应小于工单的连板数 $Error_Qty_Not_Int
                            ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_CS_SmtRelQty_Should_less_MO" + ": " + moQty));
                            this.txtRelationQtyEdit.TextFocus(false, true);
                            return;
                        }
                    }
                    catch
                    {
                        //数量应为整数类型 $Error_Qty_Not_Int
                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_Qty_Not_Int"));
                        this.txtRelationQtyEdit.TextFocus(false, true);
                        return;
                    }
                    #endregion

                    #region      Smtrelationqty
                    DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                    if (smtfacade.GetSMTRelationQty(this.txtRCardEdit.Value.Trim().ToUpper(), this.txtMoCodeEdit.Value.Trim().ToUpper()) != null)
                    {
                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_CS_RCard_Exist"));
                        this.txtRCardEdit.TextFocus(false, true);
                        return;
                    }
                    Smtrelationqty smtqty = smtfacade.CreateNewSmtrelationqty();
                    smtqty.Rcard        = this.txtRCardEdit.Value.Trim().ToUpper();
                    smtqty.Mocode       = this.txtMoCodeEdit.Value.Trim().ToUpper();
                    smtqty.Itemcode     = ((MO)mofacade.GetMO(smtqty.Mocode)).ItemCode;
                    smtqty.Relationqtry = int.Parse(this.txtRelationQtyEdit.Value);
                    smtqty.Muser        = ApplicationService.Current().UserCode;
                    smtqty.Mdate        = dbDateTime.DBDate;
                    smtqty.Mtime        = dbDateTime.DBTime;
                    smtqty.Eattribute1  = "";
                    smtqty.Eattribute2  = "";
                    smtqty.Eattribute3  = "";
                    smtqty.Memo         = "";
                    smtfacade.AddSmtrelationqty(smtqty);
                    #endregion
                }
                catch (Exception ex)
                {
                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, ex.Message));
                    return;
                }
                btnQuery_Click(sender, e);
            }
        }
Example #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.txtRelationQtyEdit.Value.Trim() == string.Empty)
            {
                //数量不能为空 $Error_Qty_Cannot_Empty
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_Qty_Cannot_Empty"));
                this.txtRelationQtyEdit.TextFocus(false, true);
                return;
            }
            try
            {
                if (mofacade == null)
                {
                    mofacade = new MOFacade(this.DataProvider);
                }
                object  objMO = mofacade.GetMO(this.txtMoCodeEdit.Value.Trim().ToUpper());
                decimal moQty = 0;

                int intQty = Convert.ToInt32(this.txtRelationQtyEdit.Value);
                if (intQty <= 0)
                {
                    //数量应为整数类型 $Error_Qty_Not_Int
                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_CS_SmtRelQty_Should_Over_Zero"));
                    this.txtRelationQtyEdit.TextFocus(false, true);
                    return;
                }
                else
                {
                    if (objMO != null && ((MO)objMO).IDMergeRule >= 0)
                    {
                        moQty = ((MO)objMO).IDMergeRule;
                    }
                    if (moQty < Convert.ToDecimal(intQty))
                    {
                        //数量应小于工单的连板数 $Error_Qty_Not_Int
                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_CS_SmtRelQty_Should_less_MO" + ": " + moQty));
                        this.txtRelationQtyEdit.TextFocus(false, true);
                        return;
                    }
                }
            }
            catch
            {
                //数量应为整数类型 $Error_Qty_Not_Int
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_Qty_Not_Int"));
                this.txtRelationQtyEdit.TextFocus(false, true);
                return;
            }
            if (smtfacade == null)
            {
                smtfacade = new SMTFacade(this.DataProvider);
            }
            object     relation   = smtfacade.GetSMTRelationQty(this.txtRCardEdit.Value, this.txtMoCodeEdit.Value.Trim());
            DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);

            if (relation != null)
            {
                ((Smtrelationqty)relation).Relationqtry = int.Parse(this.txtRelationQtyEdit.Value);
                ((Smtrelationqty)relation).Muser        = ApplicationService.Current().UserCode;

                ((Smtrelationqty)relation).Mdate = dbDateTime.DBDate;
                ((Smtrelationqty)relation).Mtime = dbDateTime.DBTime;
                smtfacade.UpdateSmtrelationqty((Smtrelationqty)relation);
            }
            this.ucBtnSave.Enabled = false;
            btnQuery_Click(sender, e);
        }
Example #7
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);
            }
        }