Пример #1
0
        /// <summary>
        /// 確認此批號是否為WOLOT
        /// </summary>
        /// <param name="lot"></param>
        /// <returns></returns>
        private bool CheckWOLot(string lot)
        {
            //確認此批號是否為WOLOT
            var woLotList = LotDefectInfoEx.GetDataListByWOLot(lot);

            if (woLotList.Count == 0)
            {
                return(false);
            }

            foreach (var data in woLotList)
            {
                //取得批號資訊
                var lotData = LotInfoEx.GetLotByLot(data.Lot).ChangeTo <LotInfoEx>();

                //驗證批號狀態,Wait的批號
                if (lotData.Status != LotDefaultStatus.Wait.ToString())
                {
                    continue;
                }

                //驗證currentRule
                if (lotData.CurrentRuleName != _ProgramInformationBlock.ProgramRight)
                {
                    continue;
                }

                var reason = ReasonInfo.GetReasonByName(data.ReasonCode);
                if (reason == null)
                {
                    throw new CimesException(RuleMessage.Error.C00051(data.ReasonCode));
                }

                //格式:(批號) 原因碼_說明_備註
                string defectText = "(" + data.Lot + ")";

                defectText += " " + data.ReasonCode;

                if (!reason.Description.IsNullOrTrimEmpty())
                {
                    defectText += "_" + reason.Description;
                }

                if (!data.Description.IsNullOrTrimEmpty())
                {
                    defectText += "_" + data.Description;
                }

                ddlJudgeDefect.Items.Add(new ListItem(defectText, data.ID));
            }

            if (ddlJudgeDefect.Items.Count == 0)
            {
                //查無送待判原因!
                throw new Exception(RuleMessage.Error.C10187());
            }
            else if (ddlJudgeDefect.Items.Count == 1)
            {
                ddlJudgeDefect_SelectedIndexChanged(null, EventArgs.Empty);
            }
            else
            {
                ddlJudgeDefect.Items.Insert(0, new ListItem());
            }

            return(true);
        }
Пример #2
0
        /// <summary>
        /// 輸入機加批號
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ttbLot_TextChanged(object sender, EventArgs e)
        {
            try
            {
                #region 驗證批號存在性
                _LotData = LotInfoEx.GetLotByLot(ttbLot.Text);

                if (_LotData == null)
                {
                    //[00030]{0}:{1}不存在!
                    throw new Exception(TextMessage.Error.T00030(lblLot.Text, ttbLot.Text));
                }
                #endregion

                #region 驗證批號狀態,Run的批號
                if (_LotData.Status != LotDefaultStatus.Run.ToString())
                {
                    //狀態為{0},不可執行
                    throw new Exception(RuleMessage.Error.C10003(_LotData.Status));
                }
                #endregion

                #region 驗證currentRule
                if (_LotData.CurrentRuleName != _ProgramInformationBlock.ProgramRight)
                {
                    //該批號作業為XXXX,不為此功能,請遵循作業規範
                    throw new Exception(RuleMessage.Error.C10004(_LotData.CurrentRuleName));
                }
                #endregion

                #region 維修原因碼(DropDownList):依照原因碼工作站設定,帶出原因碼
                ddlRepairReasonCode.Items.Clear();

                List <BusinessReason> reasonList = ReasonCategoryInfo.GetOperationRuleCategoryReasonsWithReasonDescr(_LotData.CurrentRuleName, _LotData.OperationName, "Default", ReasonMode.Category);

                if (reasonList.Count > 0)
                {
                    ddlRepairReasonCode.DataSource     = reasonList;
                    ddlRepairReasonCode.DataTextField  = "ReasonDescription";
                    ddlRepairReasonCode.DataValueField = "ReasonCategorySID";
                    ddlRepairReasonCode.DataBind();

                    if (ddlRepairReasonCode.Items.Count != 1)
                    {
                        ddlRepairReasonCode.Items.Insert(0, "");
                    }
                    else
                    {
                        ddlRepairReasonCode.SelectedIndex = 0;
                    }
                }
                else
                {
                    //[00641]規則:{0} 工作站:{1} 使用的原因碼未設定,請洽IT人員!
                    throw new Exception(TextMessage.Error.T00641(ProgramRight, _LotData.OperationName));
                }
                #endregion

                //取得工件序號
                var componentDataList = ComponentInfoEx.GetDataByCurrentLot(_LotData.Lot);
                if (componentDataList.Count > 0)
                {
                    ttbItemSN.Text = componentDataList[0].ComponentID;
                }

                //取得送待判原因
                var lotDefectData = LotDefectInfoEx.GetDataByLotAndComponentID(_LotData.Lot, ttbItemSN.Text);
                if (lotDefectData != null)
                {
                    _DefectJudgementData = CSTWIPDefectJudgementInfo.GetDataByWIPDefectSID(lotDefectData.DefectSID);

                    if (_DefectJudgementData != null)
                    {
                        ttbJudgeReason.Text = _DefectJudgementData.Reason;
                    }
                }

                ttbRepairDescr.Text = "";
                btnOK.Enabled       = true;
            }
            catch (Exception ex)
            {
                ClearField();
                AjaxFocus(ttbLot);
                HandleError(ex);
            }
        }
Пример #3
0
        /// <summary>
        /// 確認此批號是否為COMPONENTID
        /// </summary>
        /// <param name="lot"></param>
        /// <returns></returns>
        private bool CheckComponentID(string lot)
        {
            //確認此批號是否為COMPONENTID
            var component = ComponentInfo.GetComponentByComponentID(lot);

            if (component == null)
            {
                return(false);
            }

            //取得批號資料
            var lotData = LotInfoEx.GetLotByLot(component.CurrentLot).ChangeTo <LotInfoEx>();

            if (lotData == null)
            {
                return(false);
            }

            //驗證批號狀態,Wait的批號
            if (lotData.Status != LotDefaultStatus.Wait.ToString())
            {
                //狀態為{0},不可執行
                throw new Exception(RuleMessage.Error.C10003(lotData.Status));
            }

            //驗證currentRule
            if (lotData.CurrentRuleName != _ProgramInformationBlock.ProgramRight)
            {
                //該批號作業為XXXX,不為此功能,請遵循作業規範
                throw new Exception(RuleMessage.Error.C10004(lotData.CurrentRuleName));
            }

            //取得工件序號
            var componentDataList = ComponentInfoEx.GetDataByCurrentLot(lotData.Lot);

            if (componentDataList.Count > 0)
            {
                ttbItemSN.Text = componentDataList[0].ComponentID;
            }

            //取得送待判原因
            var lotDefectData = LotDefectInfoEx.GetDataByLotAndComponentID(lotData.Lot, ttbItemSN.Text);

            if (lotDefectData != null)
            {
                var reason = ReasonInfo.GetReasonByName(lotDefectData.ReasonCode);
                if (reason == null)
                {
                    throw new CimesException(RuleMessage.Error.C00051(lotDefectData.ReasonCode));
                }

                //格式:(批號) 原因碼_說明_備註
                string defectText = "(" + lotDefectData.Lot + ")";

                defectText += " " + lotDefectData.ReasonCode;

                if (!reason.Description.IsNullOrTrimEmpty())
                {
                    defectText += "_" + reason.Description;
                }

                if (!lotDefectData.Description.IsNullOrTrimEmpty())
                {
                    defectText += "_" + lotDefectData.Description;
                }

                ddlJudgeDefect.Items.Add(new ListItem(defectText, lotDefectData.ID));

                ddlJudgeDefect_SelectedIndexChanged(null, EventArgs.Empty);
            }
            else
            {
                //查無送待判原因!
                throw new Exception(RuleMessage.Error.C10187());
            }

            return(true);
        }