Exemplo n.º 1
0
        /// <summary>
        /// 依照輸入LotID取得相關欄位資料及相關Button設定
        /// </summary>
        /// <param name="LotID">批號名稱</param>
        private void LoadControlByLot(string LotID)
        {
            // 清除欄位資訊
            ClearField();

            var lsLotData = LotInfoEx.GetLotByLot(LotID).ChangeTo <LotInfoEx>();

            //若在製找不到,換到MES_WIP_LOT_NONACTIVE找
            if (lsLotData == null)
            {
                string   sql = @"SELECT * FROM MES_WIP_LOT_NONACTIVE WHERE LOT = #[STRING]";
                SqlAgent sa  = SQLCenter.Parse(sql, LotID);
                lsLotData = InfoCenter.GetBySQL <LotInfoEx>(sa);
            }

            // 若該批號無資料可顯示,離開程式並顯示訊息
            if (lsLotData == null)
            {
                btnPrint.Enabled = false;
                throw new Exception(TextMessage.Error.T00060(LotID));
            }

            btnPrint.Enabled = true;

            lotData = lsLotData;
        }
Exemplo n.º 2
0
        protected void ddlOperation_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                btnOK.Enabled = false;
                if (ddlOperation.SelectedValue.IsNullOrEmpty())
                {
                    if (_ProdType == CustomizeFunction.ProdType.B.ToCimesString())
                    {
                        ttbWorkpiece.ReadOnly = false;
                        ttbWorkpiece.Text     = "";
                    }
                    return;
                }
                ttbWorkpiece.ReadOnly = true;

                //用小工單號找出所有的component,逆排後找出第一個符合選擇站點的component為送待判的對象
                var compList = ComponentInfoEx.GetAllComponentByWOLot(ttbWOLot.Text.Trim()).OrderByDescending(p => p.ComponentID).ToList();

                ProcessLotData = null;
                foreach (var p in compList)
                {
                    var tempLot = LotInfoEx.GetLotByLot(p.CurrentLot);

                    //第一個找到站點符合的component就不用再找了
                    if (tempLot.OperationName == ddlOperation.SelectedValue)
                    {
                        ProcessLotData = tempLot;
                        break;
                    }
                }

                if (ProcessLotData == null)
                {
                    AjaxFocus(ddlOperation);
                    ttbWOLot.Text = string.Empty;
                    throw new RuleCimesException(RuleMessage.Error.C00050(ttbWOLot.Text, ddlOperation.SelectedValue));
                }

                // 取得子單元
                var lstComponents = ComponentInfo.GetLotAllComponents(ProcessLotData).OrderByDescending(p => p.ComponentID).ToList();
                _ComponentInfo = lstComponents.Count == 0 ? null : lstComponents[0].ChangeTo <ComponentInfoEx>();
                // 判斷子單元是否存在
                if (_ComponentInfo == null)
                {
                    throw new CimesException(RuleMessage.Error.C00039(ProcessLotData.Lot));
                }
                ttbWorkpiece.ReadOnly = true;
                ttbWorkpiece.Text     = _ComponentInfo.ComponentID;
                btnOK.Enabled         = true;
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 依照輸入LotID取得相關欄位資料及相關Button設定
        /// </summary>
        /// <param name="LotID">批號名稱</param>
        private void LoadControlByLot(string LotID)
        {
            // 清除欄位資訊
            ClearField();
            if (cbxWO.Checked)
            {
                _LotData = LotInfoEx.GetLotByWorkOrderLot(LotID);
            }

            if (cbxLot.Checked)
            {
                _LotData = LotInfoEx.GetLotByLot(LotID);
            }

            if (cbxSN.Checked)
            {
                var lot = CustomizeFunction.ConvertDMCCode(LotID);

                var compInfo = ComponentInfoEx.GetComponentByComponentID(lot);
                if (compInfo == null)
                {
                    var compList = ComponentInfoEx.GetComponentByDMCCode(lot);
                    if (compList.Count != 0)
                    {
                        compInfo = compList[0];
                    }
                }

                if (compInfo != null)
                {
                    _LotData = LotInfo.GetLotByLot(compInfo.CurrentLot).ChangeTo <LotInfoEx>();
                }
            }

            // 若該批號無資料可顯示,離開程式並顯示訊息
            if (_LotData == null)
            {
                btnPrint.Enabled = false;
                AjaxFocus(ttbWOLot);
                throw new Exception(TextMessage.Error.T00060(LotID));
            }

            btnPrint.Enabled = true;
        }
Exemplo n.º 4
0
        protected void ttbWorkpiece_TextChanged(object sender, EventArgs e)
        {
            try
            {
                btnOK.Enabled = false;

                if (ttbWorkpiece.Text.Trim().IsNullOrEmpty())
                {
                    if (_ProdType == CustomizeFunction.ProdType.B.ToCimesString())
                    {
                        ddlOperation.Enabled = true;
                        ddlOperation.ClearSelection();
                    }
                    return;
                }

                string componentid = CustomizeFunction.ConvertDMCCode(ttbWorkpiece.Text.Trim());

                //僅有B跟S型態會刷DMC,故只需針對兩種CASE處理
                if (_ProdType == CustomizeFunction.ProdType.B.ToCimesString())
                {
                    _ComponentInfo = ComponentInfoEx.GetOneComponentByDMCCode(componentid);
                    if (_ComponentInfo == null)
                    {
                        throw new RuleCimesException(RuleMessage.Error.C00049(ttbWorkpiece.Text));
                    }
                }
                else if (_ProdType == CustomizeFunction.ProdType.S.ToCimesString())
                {
                    _ComponentInfo = ComponentInfoEx.GetComponentByComponentID(componentid);

                    if (_ComponentInfo == null)
                    {
                        throw new RuleCimesException(RuleMessage.Error.C10047(ttbWorkpiece.Text));
                    }
                }

                // 找不到工件
                if (_ComponentInfo == null)
                {
                    throw new RuleCimesException(RuleMessage.Error.C10047(ttbWorkpiece.Text));
                }

                ddlOperation.Enabled = false;

                ProcessLotData = LotInfoEx.GetLotByLot(_ComponentInfo.CurrentLot);
                if (ProcessLotData == null)
                {
                    AjaxFocus(ttbWorkpiece);
                    throw new RuleCimesException(TextMessage.Error.T00030(lblWOLot.Text + "(" + ttbWOLot.Text.Trim() + ")" + lblttbWorkpiece.Text + "(" + componentid + ")", GetUIResource("Lot")), ttbWorkpiece);
                }

                if (ProcessLotData.OperationName == _JudgeOperationName)
                {
                    AjaxFocus(ttbWorkpiece);
                    throw new RuleCimesException(RuleMessage.Error.C10175(_JudgeOperationName), ttbWorkpiece);
                }

                var item = ddlOperation.Items.FindByValue(ProcessLotData.OperationName);
                if (item != null)
                {
                    ddlOperation.ClearSelection();
                    item.Selected = true;
                }

                btnOK.Enabled = true;
            }
            catch (Exception ex)
            {
                HandleError(ex);
                AjaxFocus(ttbWorkpiece);
            }
        }
Exemplo n.º 5
0
        protected void ttbWOLot_TextChanged(object sender, EventArgs e)
        {
            try
            {
                /***************************************************************************************
                 * 依照PRODTYP不同,做不同畫面的處置:
                 * S:有序號,一律刷入DMC處理。
                 * G:僅有鍛造批,選擇要判定的工作站,系統找出該工作站所有的COMPONENT,順排取最後一個
                 * W:沒有刻字,選擇要判定的工作站,系統找出該工作站所有的COMPONENT,順排取最後一個
                 * B:有刻字,但序號無意義。
                 *    在刻字站前因為未刻字所以選擇要判定的工作站,系統找出該工作站所有的COMPONENT,順排取最後一個
                 *    刻字後,直接刷入DMC處理
                 **********************************************************/
                // 清除資料與使用者介面
                ClearField();

                LoadDefaultControl();

                string sWOLot = ttbWOLot.Text.Trim();
                if (sWOLot.IsNullOrEmpty())
                {
                    return;
                }

                #region 找出料號型態
                // 小工單號找批號,此處找批號只是為了找出料號,也順便可以確認線上還有批號可以做送待判這件事
                ProcessLotData = LotInfoEx.GetLotByWorkOrderLot(sWOLot);
                if (ProcessLotData == null)
                {
                    ProcessLotData = LotInfoEx.GetLotByLot(sWOLot);
                }

                if (ProcessLotData == null)
                {
                    ttbWOLot.Text = "";
                    AjaxFocus(ttbWOLot);
                    throw new RuleCimesException(TextMessage.Error.T00030(GetUIResource("WOLot"), sWOLot));
                }

                //取得小工單號的料號版本
                var deviceVersionInfo = DeviceVersionInfo.GetLotCurrentDeviceVersion(ProcessLotData).ChangeTo <DeviceVersionInfoEx>();
                if (deviceVersionInfo == null)
                {
                    throw new CimesException(TextMessage.Error.T00537(ProcessLotData.DeviceName));
                }

                if (deviceVersionInfo.ProdType.IsNullOrTrimEmpty())
                {
                    ttbWOLot.Text = "";
                    AjaxFocus(ttbWOLot);
                    throw new RuleCimesException(TextMessage.Error.T00031(GetUIResource("Device"), deviceVersionInfo.DeviceName, "PRODTYPE"));
                }
                _ProdType = deviceVersionInfo.ProdType;
                #endregion

                #region 取得工作站
                ddlOperation.Items.Clear();
                var lstLotRouteOperation = RouteOperationInfo.GetLotDefaultOperations(ProcessLotData).OrderBy(p => p.OperationSequence).ToList();
                lstLotRouteOperation.ForEach(oper => {
                    ddlOperation.Items.Add(new ListItem(oper.OperationName + "[" + oper.OperationSequence + "]", oper.OperationName));
                });
                ddlOperation.Items.Insert(0, "");
                #endregion

                #region 原因碼選項
                ddlDefectReason.Items.Clear();
                List <BusinessReason> reason = ReasonCategoryInfo.GetOperationRuleCategoryReasonsWithReasonDescr(ProgramRight, ProcessLotData.OperationName, "Default", ReasonMode.Category);
                if (reason.Count == 0)
                {
                    reason = ReasonCategoryInfo.GetOperationRuleCategoryReasonsWithReasonDescr(ProgramRight, "ALL", "Default", ReasonMode.Category);
                }

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

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

                #region 依照PRODTYPE處理介面
                ttbDefectDesc.ReadOnly  = false;
                ddlDefectReason.Enabled = true;

                if (_ProdType == CustomizeFunction.ProdType.S.ToCimesString())
                {
                    ddlOperation.Enabled  = false;
                    ttbWorkpiece.ReadOnly = false;
                }

                if (_ProdType == CustomizeFunction.ProdType.W.ToCimesString() || _ProdType == CustomizeFunction.ProdType.G.ToCimesString())
                {
                    ttbWorkpiece.ReadOnly = true;
                    ddlOperation.Enabled  = true;
                }

                if (_ProdType == CustomizeFunction.ProdType.B.ToCimesString())
                {
                    ttbWorkpiece.ReadOnly = false;
                    ddlOperation.Enabled  = true;
                }
                #endregion

                #region 找出待判站
                //在系統資料維護裡,取得此批號對應製程(CPC/CPF)的待判工作站名稱
                List <WpcExClassItemInfo> operationList      = WpcExClassItemInfo.GetExtendItemListByClassAndRemarks("SAIJudgeOperation");
                WpcExClassItemInfo        judgeOperationData = operationList.Find(p => p.Remark01 == ProcessLotData.Process);
                if (judgeOperationData == null)
                {
                    //找不到待判站資訊,請至系統資料維護增加資訊,屬性:{0}
                    throw new Exception(RuleMessage.Error.C10014(ProcessLotData.Process));
                }

                //取得待判工作站名稱
                _JudgeOperationName = judgeOperationData.Remark02;

                #endregion

                if (ttbWorkpiece.Enabled)
                {
                    AjaxFocus(ttbWorkpiece);
                }
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemplo n.º 6
0
        protected void ttbWOLot_TextChanged(object sender, EventArgs e)
        {
            try
            {
                /****************************************************************
                * 1. 依照工作站點及料號的設定,判斷批號是否可執行中心孔資訊收集。
                * 2. 部分料號就算不收中心孔資訊,但需要收集DMC
                * 3. 若不須收集中心孔,且prodType = 'W',連DMC都不須執行
                ****************************************************************/
                ttbWorkpiece.ReadOnly   = true;
                ttbTemperature.ReadOnly = true;
                // 清除資料與使用者介面
                ClearField();

                string sWOLot = ttbWOLot.Text.Trim();
                if (sWOLot.IsNullOrEmpty())
                {
                    return;
                }

                // 小工單號找批號
                //var lotInfo = LotInfoEx.GetLotByWorkOrderLot(sWOLot);
                ProcessLotData = LotInfoEx.GetLotByLot(sWOLot);

                if (ProcessLotData == null)
                {
                    ttbWOLot.Text = "";
                    AjaxFocus(ttbWOLot);
                    throw new RuleCimesException(TextMessage.Error.T00030(lblWOLot.Text + "(" + sWOLot + ")", GetUIResource("Lot")));
                }

                _ComponentList = ComponentInfo.GetLotAllComponents(ProcessLotData);

                //取得小工單號的料號版本
                var deviceVersionInfo = DeviceVersionInfo.GetLotCurrentDeviceVersion(ProcessLotData).ChangeTo <DeviceVersionInfoEx>();
                if (deviceVersionInfo == null)
                {
                    throw new CimesException(TextMessage.Error.T00537(ProcessLotData.DeviceName));
                }

                if (deviceVersionInfo.ProdType.IsNullOrTrimEmpty())
                {
                    ttbWOLot.Text = "";
                    AjaxFocus(ttbWOLot);
                    throw new RuleCimesException(TextMessage.Error.T00031(GetUIResource("Device"), deviceVersionInfo.DeviceName, "PRODTYPE"));
                }
                _ProdType       = deviceVersionInfo.ProdType;
                _CenterHoleFlag = deviceVersionInfo.CenterHoleFlag;

                //確認執行的工作站是否需要收集中心孔
                var operData = OperationInfo.GetOperationByName(ProcessLotData.OperationName).ChangeTo <OperationInfoEx>();
                if (operData == null)
                {
                    throw new CimesException(TextMessage.Error.T00171(ProcessLotData.OperationName));
                }

                if (!operData.CenterHoleFlag.ToBool() && !operData.GetDMC.ToBool())
                {
                    AjaxFocus(ttbWOLot);
                    throw new CimesException(RuleMessage.Error.C00042(ProcessLotData.OperationName));
                }

                //若不須收集中心孔,且prodType = 'W',連DMC都不須執行
                if (!_CenterHoleFlag.ToBool() && deviceVersionInfo.ProdType == CustomizeFunction.ProdType.W.ToCimesString())
                {
                    AjaxFocus(ttbWOLot);
                    throw new CimesException(RuleMessage.Error.C00043(ProcessLotData.DeviceName));
                }

                if (_CenterHoleFlag.ToBool())
                {
                    gvComponentEDC.Visible = true;
                }
                else
                {
                    gvComponentEDC.Visible = false;
                }
                ttbWorkpiece.ReadOnly = false;
                AjaxFocus(ttbWorkpiece);
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemplo n.º 7
0
        protected void ttbWorkpiece_TextChanged(object sender, EventArgs e)
        {
            try
            {
                string inputObject = ttbWorkpiece.Text.Trim();
                if (inputObject.IsNullOrEmpty())
                {
                    ClearUI();
                    return;
                }
                //轉換字串最後"."的字串
                inputObject = CustomizeFunction.ConvertDMCCode(inputObject);
                //DMCCode有刻字有SN
                if (_ProdType == CustomizeFunction.ProdType.S.ToCimesString())
                {
                    ComponentInfo = _ComponentList.Find(p => p.ComponentID == inputObject);
                    if (ComponentInfo == null)
                    {
                        //工件{0}不屬於Runcard {1},請確認!!
                        throw new CimesException(RuleMessage.Error.C00030(inputObject, ttbWOLot.Text));
                    }
                    #region 以ComponentID找出ComponentInfo
                    //ComponentInfo = ComponentInfoEx.GetComponentByComponentID(inputObject);

                    //if (ComponentInfo != null)
                    //{
                    //    ProcessLotData = LotInfo.GetLotByLot(ComponentInfo.CurrentLot);
                    //}
                    #endregion
                }

                //DMCCode有刻字無SN
                if (_ProdType == CustomizeFunction.ProdType.G.ToCimesString())
                {
                    #region 以MLot,WOLot找出ComponentInfo
                    // 以物料批找出批號
                    var lstLots = LotInfoEx.GetLotByMaterialLotAndWOLot(inputObject, ProcessLotData.WorkOrderLot);
                    if (lstLots.Count > 1)
                    {
                        throw new RuleCimesException(RuleMessage.Error.C10040(inputObject));
                    }
                    // 若物料批找不到批號則以WOLot找出批號
                    if (lstLots.Count == 0)
                    {
                        //[00030]{0}:{1}不存在!
                        throw new RuleCimesException(TextMessage.Error.T00030(lblWOLot.Text + "(" + ttbWOLot.Text + ")," + lblMaterialLot.Text + "(" + inputObject + ")", GetUIResource("Lot")));
                    }

                    ProcessLotData = lstLots[0];

                    // 取得所有子單元,並取得沒有做過中心孔量測的批號,以ComponentID排序
                    var lstComponents = ComponentInfo.GetLotAllComponents(ProcessLotData).FindAll(p => p["CENTER_HOLE_FLAG"].ToString() == "N").OrderBy(p => p.ComponentID).ToList();
                    ComponentInfo = lstComponents.Count == 0 ? null : lstComponents[0];

                    if (ComponentInfo == null)
                    {
                        throw new CimesException(RuleMessage.Error.C00039(ProcessLotData.Lot));
                    }
                    #endregion
                }

                //DMCCode有刻字無意義,或是沒有刻DMCCODE,WOLOT是唯一所以可以直接找到批號
                if (_ProdType == CustomizeFunction.ProdType.B.ToCimesString() || _ProdType == CustomizeFunction.ProdType.W.ToCimesString())
                {
                    #region 以小工單號找出批號
                    // 以小工單號找出批號
                    //ProcessLotData = LotInfoEx.GetLotByWorkOrderLot(ttbWOLot.Text.Trim());
                    ProcessLotData = LotInfoEx.GetLotByLot(ttbWOLot.Text.Trim());
                    if (ProcessLotData == null)
                    {
                        throw new RuleCimesException(RuleMessage.Error.C10040(inputObject));
                    }

                    var lstComponents = ComponentInfo.GetLotAllComponents(ProcessLotData).ChangeTo <ComponentInfoEx>();

                    var lstComponentTemp = lstComponents.Find(p => p.DMC == inputObject);
                    if (lstComponentTemp != null)
                    {
                        throw new CimesException(RuleMessage.Error.C00052(inputObject));
                    }

                    // 取得所有子單元,並取得沒有做過中心孔量測的批號,以ComponentID排序
                    lstComponents = lstComponents.FindAll(p => p["CENTER_HOLE_FLAG"].ToString() == "N").OrderBy(p => p.ComponentID).ToList();

                    ComponentInfo = lstComponents.Count == 0 ? null : lstComponents[0];

                    if (ComponentInfo == null)
                    {
                        throw new CimesException(RuleMessage.Error.C00039(ProcessLotData.Lot));
                    }
                    #endregion
                }

                // 找不到工件
                if (ComponentInfo == null)
                {
                    throw new RuleCimesException(TextMessage.Error.T00045(GetUIResource("Workpiece")));
                }

                // 找不到批號
                if (ProcessLotData == null)
                {
                    throw new RuleCimesException(TextMessage.Error.T00045(GetUIResource("Lot")));
                }

                if (ComponentInfo["CENTER_HOLE_FLAG"].ToString() != "N")
                {
                    throw new RuleCimesException(RuleMessage.Error.C10049());
                }

                //批號檢查狀態
                if (ProcessLotData.Status != LotDefaultStatus.Run.ToCimesString())
                {
                    //[01203]批號狀態不正確, 應為 {0} !
                    throw new Exception(TextMessage.Error.T01203("Run"));
                }

                // 顯示機加批號資訊
                //ttbWOLot.Text = ProcessLotData["WOLOT"].ToString();
                // 顯示鍛造批號資訊
                ttbMaterialLot.Text = ProcessLotData["MATERIALLOT"].ToString();
                // 顯示工件序號資訊
                ttbWorkpieceSerialNumber.Text = ComponentInfo.ComponentID;
                // 顯示料號資訊
                ttbDeviceName.Text = ProcessLotData.DeviceName;

                var deviceInfo = DeviceInfo.GetDeviceByName(ProcessLotData.DeviceName);
                // 顯示機加批號資訊
                ttbDeviceDescr.Text = deviceInfo.Description;
                // 顯示工作站資訊
                ttbOperation.Text = ProcessLotData.OperationName;
                // 顯示流程名稱資訊
                ttbRouteName.Text = ProcessLotData.RouteName;

                if (_CenterHoleFlag.ToBool())
                {
                    // 取得中心孔量測設定值
                    var lstSAICenterHolde = WpcExClassItemInfo.GetExClassItemInfo("SAICenterHole", ProcessLotData.DeviceName);
                    if (lstSAICenterHolde.Count == 0)
                    {
                        lstSAICenterHolde = WpcExClassItemInfo.GetExClassItemInfo("SAICenterHole", "ALL");
                    }
                    // 若找不到中心孔量測需拋錯
                    if (lstSAICenterHolde.Count == 0)
                    {
                        throw new RuleCimesException(TextMessage.Error.T00555("SAICenterHole", ProcessLotData.DeviceName + "," + "ALL"));
                    }

                    SAICenterHole = lstSAICenterHolde[0];
                    // 設定中心孔量測的DataTable資料
                    DataTable dtEmpty = new DataTable();
                    dtEmpty.Columns.Add("ITEM", typeof(int));
                    dtEmpty.Columns.Add("EDC", typeof(String));

                    for (int i = 0; i < SAICenterHole.Remark04.ToDecimal(0); i++)
                    {
                        DataRow dr = dtEmpty.NewRow();
                        dr["ITEM"] = i + 1;
                        dtEmpty.Rows.Add(dr);
                    }
                    // 將產生的資料表顯示在畫面上
                    gvComponentEDC.DataSource = dtEmpty;
                    gvComponentEDC.DataBind();

                    ttbTemperature.ReadOnly = false;
                }
                else
                {
                    btnOK_Click(null, EventArgs.Empty);
                }
            }
            catch (Exception ex)
            {
                ttbWorkpiece.Text = "";
                ClearUI();
                HandleError(ex, ttbWorkpiece.ClientID);
            }
        }
Exemplo n.º 8
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);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 切換不同的送待判原因
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ddlJudgeDefect_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                //確認是否有選擇送待判原因
                ddlJudgeDefect.Must(lblJudgeDefect);

                //取得批號資訊
                _LotDefectData = InfoCenter.GetBySID <LotDefectInfo>(ddlJudgeDefect.SelectedValue);
                _LotData       = LotInfoEx.GetLotByLot(_LotDefectData.Lot).ChangeTo <LotInfoEx>();

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

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

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

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

                //數量
                ttbQty.Text = _LotData.Quantity.ToString();

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

                ttbJudgeDescr.Text = "";
                btnOK.Enabled      = true;
                btnPrint.Enabled   = true;
            }
            catch (Exception ex)
            {
                ttbItemSN.Text     = "";
                ttbQty.Text        = "";
                ttbJudgeDescr.Text = "";

                ddlJudgeReason.Items.Clear();

                btnOK.Enabled    = false;
                btnPrint.Enabled = false;

                _LotData       = null;
                _LotDefectData = null;

                HandleError(ex);
            }
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 輸入機加批號
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ttbLot_TextChanged(object sender, EventArgs e)
        {
            try
            {
                /* 1.	驗證批號存在性。(批號不存在)
                 * 2.	驗證批號狀態,只能輸入Wait或Run的批號。(狀態為XX,不可執行)
                 *   數量(Label):帶出批號數量。
                 *   料號(Label):帶出批號所屬料號。
                 *   料號描述(Label):帶出料號說明。
                 *   流程(Label):帶出批號所屬流程。
                 *   工作站(Label):帶出批號所屬工作站。
                 */

                ttbLot.Must(lblLot);

                #region 清除介面資料
                ttbEquip.Text       = "";
                ttbQty.Text         = "";
                ttbDevice.Text      = "";
                ttbRoute.Text       = "";
                ttbOperation.Text   = "";
                ttbComponentId.Text = "";
                ttbDefectDesc.Text  = "";
                ttbDefectQty.Text   = "";
                ttbDeviceDescr.Text = "";

                ddlComponentId.Items.Clear();
                ddlDefectReason.Items.Clear();
                ddlComponentId.Enabled = true;
                ttbComponentId.Enabled = true;

                _LotData = null;
                _SelectedComponetData = null;
                _DeviceData           = null;

                _DispatchReportTable = new DataTable();

                _DefectGridData = new List <DefectGridData>();

                btnOK.Enabled = false;

                gvDefect.SetDataSource(_DispatchReportTable, true);
                #endregion

                _LotData = LotInfoEx.GetLotByLot(ttbLot.Text).ChangeTo <LotInfoEx>();

                //驗證批號存在性。(批號不存在)
                if (_LotData != null)
                {
                    //驗證批號狀態,Run的批號。(狀態為XX,不可執行)
                    if (_LotData.Status == LotDefaultStatus.Run.ToString())
                    {
                        //驗證currentRule。
                        if (_LotData.CurrentRuleName != _ProgramInformationBlock.ProgramRight)
                        {
                            //該批號作業為{0},不為此功能,請遵循作業規範
                            throw new Exception(RuleMessage.Error.C10004(_LotData.CurrentRuleName));
                        }

                        var operData = OperationInfo.GetOperationByName(_LotData.OperationName).ChangeTo <OperationInfoEx>();
                        if (operData.GetDMC.ToBool())
                        {
                            var compList = ComponentInfo.GetLotAllComponents(_LotData.Lot).ChangeTo <ComponentInfoEx>();
                            foreach (var compData in compList)
                            {
                                if (compData.DMC.IsNullOrTrimEmpty())
                                {
                                    throw new CimesException(RuleMessage.Error.C00040(compData.ComponentID));
                                }
                            }
                        }

                        _DeviceData = DeviceVersionInfoEx.GetDataByDeviceName(_LotData.DeviceName);

                        ttbQty.Text         = _LotData.Quantity.ToString();
                        ttbDevice.Text      = _LotData.DeviceName;
                        ttbEquip.Text       = _LotData.ResourceName;
                        ttbDeviceDescr.Text = _DeviceData.Description;
                        ttbRoute.Text       = _LotData.RouteName;
                        ttbOperation.Text   = _LotData.OperationName;

                        InitialDropDownList();

                        if (_DeviceData.ProdType == CustomizeFunction.ProdType.S.ToCimesString())
                        {
                            ttbDefectQty.Enabled = false;
                            ttbDefectQty.Text    = "1";
                        }
                        else if (_DeviceData.ProdType == CustomizeFunction.ProdType.G.ToCimesString() ||
                                 _DeviceData.ProdType == CustomizeFunction.ProdType.W.ToCimesString() ||
                                 _DeviceData.ProdType == CustomizeFunction.ProdType.B.ToCimesString())
                        {
                            ttbDefectQty.Enabled = true;
                            ttbDefectQty.Text    = "1";

                            ddlComponentId.Enabled       = false;
                            ddlComponentId.SelectedIndex = -1;
                            ttbComponentId.Enabled       = false;
                        }
                        else
                        {
                            //[00031]{0}:{1}的系統屬性:{2} 未設定,請洽IT人員!
                            throw new Exception(TextMessage.Error.T00031(lblDevice.Text, _DeviceData.DeviceName, _DeviceData.ProdType));
                        }
                    }
                    else
                    {
                        //狀態為{0},不可執行
                        throw new Exception(RuleMessage.Error.C10003(_LotData.Status));
                    }
                }
                else
                {
                    //[00030]{0}:{1}不存在!
                    throw new Exception(TextMessage.Error.T00030(lblLot.Text, ttbLot.Text));
                }

                btnOK.Enabled = true;
            }
            catch (Exception ex)
            {
                ClearField();
                AjaxFocus(ttbLot);
                HandleError(ex);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// 輸入機加批號
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ttbLot_TextChanged(object sender, EventArgs e)
        {
            try
            {
                /* 1.	驗證批號存在性。(批號不存在)
                 * 2.	驗證批號狀態,只能輸入Wait或Run的批號。(狀態為XX,不可執行)
                 *   數量(Label):帶出批號數量。
                 *   料號(Label):帶出批號所屬料號。
                 *   料號描述(Label):帶出料號說明。
                 *   流程(Label):帶出批號所屬流程。
                 *   工作站(Label):帶出批號所屬工作站。
                 */

                #region 清除介面資料
                ttbQty.Text         = "";
                ttbDevice.Text      = "";
                ttbRoute.Text       = "";
                ttbOperation.Text   = "";
                ttbDeviceDescr.Text = "";

                _LotData = null;
                _WIPReserveCheckInData = null;

                ddlEquip.Items.Clear();
                ddlEquip.Enabled = false;
                btnOK.Enabled    = false;
                #endregion

                ttbLot.Must(lblLot);

                _LotData = LotInfoEx.GetLotByLot(ttbLot.Text);

                if (_LotData != null)
                {
                    if (_LotData.Status == LotDefaultStatus.Wait.ToString() || _LotData.Status == LotDefaultStatus.Run.ToString())
                    {
                        // 取得預約工作站資料
                        GetReserveCheckInData();

                        //取得可使用機台清單
                        GetEquipmentList(_LotData.OperationName);

                        //顯示介面欄位內容
                        var device = DeviceInfo.GetDeviceByName(_LotData.DeviceName);
                        ttbQty.Text         = _LotData.Quantity.ToString();
                        ttbDevice.Text      = _LotData.DeviceName;
                        ttbRoute.Text       = _LotData.RouteName;
                        ttbOperation.Text   = _LotData.OperationName;
                        ttbDeviceDescr.Text = device.Description;

                        AjaxFocus(ddlEquip);
                    }
                    else
                    {
                        //狀態為{0},不可執行
                        throw new Exception(RuleMessage.Error.C10003(_LotData.Status));
                    }
                }
                else
                {
                    //[00030]{0}:{1}不存在!
                    throw new Exception(TextMessage.Error.T00030(lblLot.Text, ttbLot.Text));
                }

                btnOK.Enabled = true;
            }
            catch (Exception ex)
            {
                ClearField();
                AjaxFocus(ttbLot);
                HandleError(ex);
            }
        }