Exemplo n.º 1
0
        /// <summary>
        /// 更新刀具已設定的刀壽次數
        /// </summary>
        /// <param name="toolTypeLife"></param>
        /// <param name="userID"></param>
        /// <param name="recordTime"></param>
        private void UpdateToolLifes(CSTToolTypeLifeInfo toolTypeLife, string userID, string recordTime)
        {
            //依據刀具型態及供應商取得有刀具清單
            var toolList = ToolInfoEx.GetToolByToolTypeAndVendor(toolTypeLife.ToolType, toolTypeLife.Supplier);

            //執行更新每支刀具對應的基本刀壽次數
            toolList.ForEach(tool =>
            {
                //取得刀具基本刀壽資料
                var toolLifeList = CSTToolLifeInfo.GetToolLifeByToolNmae(tool.ToolName);

                //取得此刀具所在的機台清單
                var equipToolList = EquipToolInfo.GetByToolName(tool.ToolName);

                //如果此刀具沒有在任何機台上,則進行修改基本刀壽次數
                if (equipToolList.Count == 0)
                {
                    toolLifeList.ForEach(toolLife =>
                    {
                        //確認基本刀壽次數是否一致,如果不一致,則直接更新資料
                        if (toolLife.Life != toolTypeLife.Life)
                        {
                            //更新基本刀壽次數
                            toolLife.Life = toolTypeLife.Life;
                            toolLife.UpdateToDB(userID, recordTime);

                            //記錄LOG
                            LogCenter.LogToDB(toolLife, LogCenter.LogIndicator.Create(ActionType.Set, userID, recordTime));
                        }
                    });
                }
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// 輸入模具編號
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ttbToolName_TextChanged(object sender, EventArgs e)
        {
            try
            {
                _ToolData = ToolInfo.GetToolByName(ttbToolName.Text.Trim());

                #region 驗證模治具號正確性
                if (_ToolData == null)
                {
                    //模治具:{0}不存在,請確認資料正確性
                    throw new Exception(RuleMessage.Error.C10029(ttbToolName.Text));
                }
                #endregion

                #region 驗證模治具啟用狀態
                if (_ToolData.UsingStatus == UsingStatus.Disable)
                {
                    //模治具:{0}已停用,如需使用,請至"配件資料維護"啟用!!
                    throw new Exception(RuleMessage.Error.C10030(ttbToolName.Text));
                }
                #endregion

                #region 驗證模治具是否在別的機台上,如是要報錯
                var equipToolDataList = EquipToolInfo.GetByToolName(_ToolData.ToolName);

                if (equipToolDataList.Count > 0)
                {
                    //模治具:{0}已在機台:{1}上,不可再上機!!
                    throw new Exception(RuleMessage.Error.C10023(ttbToolName.Text, equipToolDataList[0].EquipmentName));
                }
                #endregion

                #region 驗證模治具儲位是否可上機,僅Hub可執行
                if (_ToolData.Location != "Hub")
                {
                    //模治具儲位為{0},尚未領用,不可執行上機!!
                    throw new Exception(RuleMessage.Error.C10024(_ToolData.Location));
                }
                #endregion

                #region 驗證模治具狀態是否可使用,僅IDLE可執行
                if (_ToolData.CurrentState != "IDLE")
                {
                    //模治具狀態為{0},不可執行此功能!!
                    throw new Exception(RuleMessage.Error.C10022(_ToolData.CurrentState));
                }
                #endregion

                ttbToolDescr.Text = _ToolData.Description;
                ttbToolType.Text  = _ToolData.ToolType;

                if (_EquipData != null)
                {
                    btnOK.Enabled = true;
                }

                AjaxFocus(ttbEquip);
            }
            catch (Exception ex)
            {
                ClearField();
                AjaxFocus(ttbToolName);
                HandleError(ex);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 輸入刀具零組件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ttbToolName_TextChanged(object sender, EventArgs e)
        {
            try
            {
                _ToolData = ToolInfo.GetToolByName(ttbToolName.Text.Trim()).ChangeTo <ToolInfoEx>();

                //確認刀具零組件是否存在
                if (_ToolData == null)
                {
                    // [00030]{0}:{1}不存在!
                    throw new Exception(TextMessage.Error.T00030(lblToolName.Text, ttbToolName.Text));
                }

                //確認刀具零組件是否啟用
                if (_ToolData.UsingStatus == UsingStatus.Disable)
                {
                    //刀具零組件:{0}已停用,如需使用,請至"刀具零組件進料作業"啟用!!
                    throw new Exception(RuleMessage.Error.C10128(ttbToolName.Text));
                }

                //確認刀具零組件是否為一面刀頭
                var toolType = ToolTypeInfo.GetToolTypeByType(_ToolData.ToolType).ChangeTo <ToolTypeInfoEx>();
                if (toolType.SideCount == "1")
                {
                    //刀具零組件:{0} 只有一個刀面,不能更換刀面!!
                    throw new Exception(RuleMessage.Error.C10153(ttbToolName.Text));
                }

                //確認刀具零組件是否已經下機
                var equipTools = EquipToolInfo.GetByToolName(_ToolData.ToolName);
                if (equipTools.Count > 0)
                {
                    //刀具零組件:{0} 已在機台({1})上,請先執行刀具下機!!
                    throw new Exception(RuleMessage.Error.C10152(ttbToolName.Text, equipTools[0].EquipmentName));
                }

                ////確認刀具零組件的LOCATION是否在Warehouse
                //if (_ToolData.Location != "Warehouse")
                //{
                //    //刀具零組件:{0} 不在庫房,不可執行此功能!!
                //    throw new Exception(RuleMessage.Error.C10127(ttbToolName.Text));
                //}

                //確認刀具零組件狀態是否可使用,僅IDLE可執行
                if (_ToolData.CurrentState != "IDLE")
                {
                    //刀具零組件狀態為{0},不可執行此功能!!
                    throw new Exception(RuleMessage.Error.C10129(_ToolData.CurrentState));
                }

                //取得刀面資料清單
                var toolLifeListTmp = CSTToolLifeInfo.GetToolLifeByToolNmae(_ToolData.ToolName);
                if (toolLifeListTmp.Count == 0)
                {
                    //刀具零組件:{0} 無刀面設定資料!!
                    throw new Exception(RuleMessage.Error.C10130(_ToolData.ToolName));
                }

                //資料過濾目前設定的刀面
                _ToolLifeList = toolLifeListTmp.FindAll(p => p.Head != _ToolData.Head);

                ttbMainHead.Text = _ToolData.Head;

                gvToolHead.SetDataSource(_ToolLifeList, true);

                btnOK.Enabled = true;
            }
            catch (Exception ex)
            {
                ClearField();
                AjaxFocus(ttbToolName);
                HandleError(ex);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 輸入刀具零組件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ttbToolName_TextChanged(object sender, EventArgs e)
        {
            try
            {
                _ToolData = ToolInfo.GetToolByName(ttbToolName.Text);

                # region 確認刀具零組件是否存在
                if (_ToolData == null)
                {
                    // [00030]{0}:{1}不存在!
                    throw new Exception(TextMessage.Error.T00030(lblToolName.Text, ttbToolName.Text));
                }
                #endregion

                #region 搜尋相同 GroupID 的刀具
                if (_ToolData["GROUPID"].ToString() == null || _ToolData["GROUPID"].ToString() == "")
                {
                    // [C10131]刀具零組件:{0}沒有刀具群組編號資訊!
                    //throw new Exception(RuleMessage.Error.C10131(ttbToolName.Text));

                    _ToolGroupData = new List <ToolInfoEx>();
                    _ToolGroupData.Add(_ToolData.ChangeTo <ToolInfoEx>());
                }
                else
                {
                    _ToolGroupData = ToolInfoEx.GetToolListByGroupID(_ToolData["GROUPID"].ToString());
                }

                foreach (var tool in _ToolGroupData)
                {
                    //尚未確認刀具在產線的判斷

                    #region 確認刀具零組件是否啟用
                    if (tool.UsingStatus == UsingStatus.Disable)
                    {
                        //刀具零組件:{0}已停用,如需使用,請至"刀具零組件進料作業"啟用!!
                        throw new Exception(RuleMessage.Error.C10128(tool.ToolName));
                    }
                    #endregion

                    #region 確認刀具零組件的LOCATION是否為Hub
                    if (tool.Location != "Hub")
                    {
                        //{0}: {1} 狀態不為: {2},不可使用!
                        throw new Exception(RuleMessage.Error.C00006(lblToolName.Text, tool.ToolName, "Hub"));
                    }
                    #endregion


                    #region 驗證模治具是否在別的機台上,如是要報錯
                    var equipToolDataList = EquipToolInfo.GetByToolName(tool.ToolName);

                    if (equipToolDataList.Count > 0)
                    {
                        //[C10138]刀具零組件:{0}已在機台:{1}上,不可執行刀具零組件歸還!
                        throw new Exception(RuleMessage.Error.C10138(tool.ToolName, equipToolDataList[0].EquipmentName));
                    }
                    #endregion
                }

                #endregion

                gvQuery.SetDataSource(_ToolGroupData, true);
                btnOK.Enabled = true;
            }
Exemplo n.º 5
0
        /// <summary>
        /// 輸入模具編號
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ttbToolName_TextChanged(object sender, EventArgs e)
        {
            try
            {
                string equipmentName = "";

                _ToolData = ToolInfo.GetToolByName(ttbToolName.Text);

                #region 驗證模治具號正確性
                if (_ToolData == null)
                {
                    //模治具:{0}不存在,請確認資料正確性
                    throw new Exception(RuleMessage.Error.C10029(ttbToolName.Text));
                }
                #endregion

                #region 驗證模治具啟用狀態
                if (_ToolData.UsingStatus == UsingStatus.Disable)
                {
                    //模治具:{0}已停用,如需使用,請至"配件資料維護"啟用!!
                    throw new Exception(RuleMessage.Error.C10030(ttbToolName.Text));
                }
                #endregion

                #region 驗證模治具是否在別的機台上,如是要報錯
                var equipToolDataList = EquipToolInfo.GetByToolName(_ToolData.ToolName);

                if (equipToolDataList.Count == 0)
                {
                    //模治具:{0}不在機台上,不須下機!!
                    throw new Exception(RuleMessage.Error.C10031(ttbToolName.Text));
                }

                equipmentName = equipToolDataList[0].EquipmentName;
                #endregion

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

                List <BusinessReason> reasonList = ReasonCategoryInfo.GetOperationRuleCategoryReasonsWithReasonDescr(ProgramRight, "ALL", "Default", ReasonMode.Category);

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

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

                ttbToolDescr.Text = _ToolData.Description;
                ttbToolType.Text  = _ToolData.ToolType;
                ttbEquip.Text     = equipmentName;

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