Exemple #1
0
        /// <summary>
        /// 確認
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);

                //確認模具是否有輸入
                ttbToolName.Must(lblToolName);

                using (var cts = CimesTransactionScope.Create())
                {
                    //變更模具上的儲位為Warehouse
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "Location", "Warehouse", txnStamp);

                    cts.Complete();
                }

                ClearField();

                AjaxFocus(ttbToolName);

                _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614(""));
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemple #2
0
        /// <summary>
        /// 確認
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);

                //確認是否輸入刀具零組件
                ttbToolName.Must(lblToolName);

                //確認是否選擇報廢原因
                ddlReason.Must(lblReason);

                using (var cts = CimesTransactionScope.Create())
                {
                    var newStateInfo = ToolStateInfo.GetToolStateByState("SCRAP");
                    if (newStateInfo == null)
                    {
                        //刀具零組件狀態: {0}不存在,請至配件狀態維護新增此狀態!!
                        throw new Exception(RuleMessage.Error.C10149("SCRAP"));
                    }

                    //因刀具報表需求,所以在報廢時要將使用次數記錄在UDC07
                    var toolLifeList = CSTToolLifeInfo.GetToolLifeByToolNmae(_ToolData.ToolName);
                    var toolLifeData = toolLifeList.Find(p => p.Head == _ToolData.Head);
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "USERDEFINECOL07", toolLifeData.UseCount.ToCimesString(), txnStamp);

                    //變更刀具 GROUPID
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "GROUPID", "", txnStamp);

                    //變更IDENTITY為報廢品
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "IDENTITY", "報廢品", txnStamp);

                    //變更狀態為SCRAP
                    TMSTransaction.ChangeToolState(_ToolData, newStateInfo, txnStamp);

                    //註記原因碼
                    var reasonCategory = InfoCenter.GetBySID <ReasonCategoryInfo>(ddlReason.SelectedValue);
                    txnStamp.CategoryReasonCode = reasonCategory;
                    txnStamp.Description        = "";

                    //備註
                    TMSTransaction.AddToolComment(_ToolData, txnStamp);

                    cts.Complete();
                }

                ClearField();

                AjaxFocus(ttbToolName);

                _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614(""));
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemple #3
0
        /// <summary>
        /// 確認
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);

                //確認是否輸入刀具零組件
                ttbToolName.Must(lblToolName);

                //確認是否有選擇變更回廠日
                var date = ttbDate.MustDate(lblDate);

                //取得系統時間
                var sysDate = Convert.ToDateTime(DBCenter.GetSystemDateTime().ToString("yyyy/MM/dd"));

                //確認預定回廠日是否大於等於當天日期
                if (date < sysDate)
                {
                    //變更回廠日必須大於等於{0} !
                    throw new Exception(RuleMessage.Error.C10170(sysDate.ToString("yyyy/MM/dd")));
                }

                using (var cts = CimesTransactionScope.Create())
                {
                    #region 更新[CST_TOOL_REPAIR]的預計回廠日
                    _ToolRepairData.EstimateDateOfReturn = ttbDate.Text;
                    _ToolRepairData.UpdateToDB(txnStamp.UserID, txnStamp.RecordTime);

                    //新增一筆[CST_TOOL_REPAIR_LOG]
                    LogCenter.LogToDB(_ToolRepairData, LogCenter.LogIndicator.Create(ActionType.Set, txnStamp.UserID, txnStamp.RecordTime));

                    #endregion

                    //預定回廠日
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "USERDEFINECOL04", ttbDate.Text, txnStamp);

                    cts.Complete();
                }

                ClearField();

                AjaxFocus(ttbToolName);

                _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614(""));
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemple #4
0
        /// <summary>
        /// 確認
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);

                //確認模具是否有輸入
                ttbToolName.Must(lblToolName);

                //確認機台是否有輸入
                ttbEquip.Must(lblEquip);

                using (var cts = CimesTransactionScope.Create())
                {
                    //配件上機台
                    TMSTxn.Default.AddToolToEquipment(new List <ToolInfo>()
                    {
                        _ToolData
                    }, _EquipData, txnStamp);

                    var newStateInfo = ToolStateInfo.GetToolStateByState("USED");
                    if (newStateInfo == null)
                    {
                        // 模治具狀態:{0}不存在!!
                        throw new Exception(RuleMessage.Error.C10032("USED"));
                    }

                    //變更配件狀態為USED
                    TMSTransaction.ChangeToolState(_ToolData, newStateInfo, txnStamp);

                    cts.Complete();
                }

                ClearField();

                AjaxFocus(ttbToolName);

                _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614(""));
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemple #5
0
        /// <summary>
        /// 確認
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);

                //確認模具是否有輸入
                ttbToolName.Must(lblToolName);

                using (var cts = CimesTransactionScope.Create())
                {
                    #region 變更配件狀態為IDLE
                    var newStateInfo = ToolStateInfo.GetToolStateByState("IDLE");
                    if (newStateInfo == null)
                    {
                        // 模具狀態:{0}不存在!!
                        throw new Exception(RuleMessage.Error.C10027("IDLE"));
                    }

                    TMSTransaction.ChangeToolState(_ToolData, newStateInfo, txnStamp);
                    #endregion

                    //將配件上的鉗修次數重置成0 (MES_TOOL_MAST. USERDEFINECOL01)
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "USERDEFINECOL01", "0", txnStamp);

                    //將配件上的降模次數重置成0 (MES_TOOL_MAST. USERDEFINECOL02)
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "USERDEFINECOL02", "0", txnStamp);

                    cts.Complete();
                }

                ClearField();

                AjaxFocus(ttbToolName);

                _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614(""));
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemple #6
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                ttbEquipmentName.Must(lblEquipment);
                ttbDevice1.Must(lblDevice1);

                //料號1一定要有資料
                if (_DeviceInfo1 == null)
                {
                    throw new RuleCimesException(TextMessage.Error.T00826(lblDevice1.Text));
                }

                //一定要輸入一種料號
                if (_dtVerifiy1 == null)
                {
                    throw new RuleCimesException(TextMessage.Error.T00826(lblDevice1.Text));
                }

                //若有輸入料號1則需驗證應領數量與領用數量是否相同
                if (_dtVerifiy1 != null)
                {
                    _dtVerifiy1.Rows.LoopDo <DataRow>((p, i) =>
                    {
                        if (p["NEEDQTY"].ToDecimal() != p["EQPTOOLCOUNT"].ToDecimal())
                        {
                            throw new RuleCimesException(RuleMessage.Error.C10141(_EquipmentInfo.EquipmentName, _DeviceInfo1.DeviceName, p["TOOLTYPE"].ToString(), p["NEEDQTY"].ToString()));
                        }
                    });
                }

                //若有輸入料號2則需驗證應領數量與領用數量是否相同
                if (_dtVerifiy2 != null)
                {
                    _dtVerifiy2.Rows.LoopDo <DataRow>((p, i) =>
                    {
                        if (p["NEEDQTY"].ToDecimal() != p["EQPTOOLCOUNT"].ToDecimal())
                        {
                            throw new RuleCimesException(RuleMessage.Error.C10141(_EquipmentInfo.EquipmentName, _DeviceInfo1.DeviceName, p["TOOLTYPE"].ToString(), p["NEEDQTY"].ToString()));
                        }
                    });
                }

                string           sReleaseID = DBCenter.GetSystemID();
                TransactionStamp txnStamp   = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);
                using (var cts = CimesTransactionScope.Create())
                {
                    //先將舊的資料刪除
                    var lstEqpToolRelease = CSTEquipmentToolReleaseInfo.GetDataByEquipment(_EquipmentInfo.EquipmentName);
                    lstEqpToolRelease.ForEach(p => {
                        p.DeleteFromDB();
                        LogCenter.LogToDB(p, LogCenter.LogIndicator.Create(ActionType.Remove, txnStamp.UserID, txnStamp.RecordTime));
                    });

                    var lstEqpTool = EquipToolInfo.GetByEquipmentName(_EquipmentInfo.EquipmentName);
                    lstEqpTool.ForEach(p => {
                        //取得配件資訊
                        var toolInfo = ToolInfo.GetToolByName(p.ToolName);
                        //新增至CST_EQP_TOOL_RELEASE的Info物件
                        var eqpToolReleaseInfo           = InfoCenter.Create <CSTEquipmentToolReleaseInfo>();
                        eqpToolReleaseInfo.EquipmentName = _EquipmentInfo.EquipmentName;
                        eqpToolReleaseInfo.ToolName      = toolInfo.ToolName;
                        eqpToolReleaseInfo.HEAD          = toolInfo["HEAD"].ToString();
                        eqpToolReleaseInfo.RELEASEID     = sReleaseID;
                        eqpToolReleaseInfo["OPERATION"]  = toolInfo.UserDefineColumn08;
                        eqpToolReleaseInfo.InsertToDB(txnStamp.UserID, txnStamp.RecordTime);
                        LogCenter.LogToDB(eqpToolReleaseInfo, LogCenter.LogIndicator.Create(ActionType.Add, txnStamp.UserID, txnStamp.RecordTime));
                        //異動Tool的RELEASEID欄位
                        TMSTransaction.ModifyToolSystemAttribute(toolInfo, "RELEASEID", sReleaseID, txnStamp);
                    });

                    //先將舊的資料刪除
                    var lstEqpDeviceRelease = CSTEquipmentDeviceReleaseInfo.GetDataByEquipment(_EquipmentInfo.EquipmentName);
                    lstEqpDeviceRelease.ForEach(p => {
                        p.DeleteFromDB();
                        LogCenter.LogToDB(p, LogCenter.LogIndicator.Create(ActionType.Remove, txnStamp.UserID, txnStamp.RecordTime));
                    });

                    if (_dtVerifiy1 != null)
                    {
                        //新增至CST_EQP_DEVICE_RELEASE的Info物件
                        var eqpDeviceReleaseInfo = InfoCenter.Create <CSTEquipmentDeviceReleaseInfo>();
                        eqpDeviceReleaseInfo.EquipmentName = _EquipmentInfo.EquipmentName;
                        eqpDeviceReleaseInfo.DeviceName    = _DeviceInfo1.DeviceName;
                        eqpDeviceReleaseInfo.RELEASEID     = sReleaseID;
                        eqpDeviceReleaseInfo.InsertToDB(txnStamp.UserID, txnStamp.RecordTime);
                        LogCenter.LogToDB(eqpDeviceReleaseInfo, LogCenter.LogIndicator.Create(ActionType.Add, txnStamp.UserID, txnStamp.RecordTime));
                    }

                    if (_dtVerifiy2 != null)
                    {
                        //新增至CST_EQP_DEVICE_RELEASE的Info物件
                        var eqpDeviceReleaseInfo = InfoCenter.Create <CSTEquipmentDeviceReleaseInfo>();
                        eqpDeviceReleaseInfo.EquipmentName = _EquipmentInfo.EquipmentName;
                        eqpDeviceReleaseInfo.DeviceName    = _DeviceInfo2.DeviceName;
                        eqpDeviceReleaseInfo.RELEASEID     = sReleaseID;
                        eqpDeviceReleaseInfo.InsertToDB(txnStamp.UserID, txnStamp.RecordTime);
                        LogCenter.LogToDB(eqpDeviceReleaseInfo, LogCenter.LogIndicator.Create(ActionType.Add, txnStamp.UserID, txnStamp.RecordTime));
                    }
                    cts.Complete();
                }

                ((ProgramInformationBlock)ProgramInformationBlock1).ShowMessage(TextMessage.Hint.T00057(GetUIResource("ToolVerifiy")));
                ClearField();
                AjaxFocus(ttbEquipmentName);
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemple #7
0
        /// <summary>
        /// 確認
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);

                List <decimal> lsLife = new List <decimal>();

                //確認是否輸入刀具零組件
                ttbToolName.Must(lblToolName);

                #region 確認是否有勾選任一刀面設定
                string mainHead = "";
                for (int i = 0; i < gvToolHead.Rows.Count; i++)
                {
                    CheckBox ckbSelect = gvToolHead.Rows[i].FindControl("ckbSelect") as CheckBox;

                    if (ckbSelect.Checked == true)
                    {
                        mainHead = _ToolLifeList[i].Head;
                    }
                }

                if (mainHead.IsNullOrTrimEmpty())
                {
                    //[00841]請選擇一個 {0}!
                    throw new Exception(TextMessage.Error.T00841(lblMainHead.Text));
                }
                #endregion

                using (var cts = CimesTransactionScope.Create())
                {
                    //變更主刀面
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "HEAD", mainHead, txnStamp);

                    //因刀具報表需求,所以在送修時要將使用次數記錄在UDC07
                    var toolLifeList = CSTToolLifeInfo.GetToolLifeByToolNmae(_ToolData.ToolName);
                    var toolLifeData = toolLifeList.Find(p => p.Head == _ToolData.Head);
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "USERDEFINECOL06", _ToolData.Head, txnStamp);
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "USERDEFINECOL07", toolLifeData.UseCount.ToCimesString(), txnStamp);

                    //註記原因碼
                    var reasonCategory = ReasonCategoryInfo.GetReasonCategoryByCategoryNameAndReason("CustomizeReason", "刀具換面");
                    if (reasonCategory == null)
                    {
                        throw new CimesException(RuleMessage.Error.C00053("CustomizeReason", "刀具換面"));
                    }
                    txnStamp.CategoryReasonCode = reasonCategory;
                    txnStamp.Remark             = reasonCategory.Reason;
                    //備註
                    TMSTransaction.AddToolComment(_ToolData, txnStamp);

                    cts.Complete();
                }

                ClearField();

                AjaxFocus(ttbToolName);

                _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614(""));
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemple #8
0
        /// <summary>
        /// 確認
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                //確認是否輸入機台
                ttbEquipment.Must(lblEquipment);

                int checkedCount = 0;

                #region 確認是否有勾選資料
                for (int i = 0; i < gvQuery.Rows.Count; i++)
                {
                    var thisCheckBox = (CheckBox)gvQuery.Rows[i].FindControl("ckbSelect");
                    if (thisCheckBox.Checked)
                    {
                        checkedCount++;
                    }
                }

                if(checkedCount == 0)
                {
                    // [00816]請至少選取一個{0}!
                    throw new Exception(TextMessage.Error.T00816(GetUIResource("ToolName")));
                }
                #endregion

                TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);

                using (var cts = CimesTransactionScope.Create())
                {
                    //新的群組ID
                    string newGroupID = DBCenter.GetSystemID();

                    for (int i = 0; i < gvQuery.Rows.Count; i++)
                    {
                        var thisCheckBox = (CheckBox)gvQuery.Rows[i].FindControl("ckbSelect");

                        //只有勾選的刀具才要下機
                        if (thisCheckBox.Checked)
                        {
                            //因刀具報表需求,所以在下機時要將當下的使用次數記錄在UDC07
                            var toolLifeList = CSTToolLifeInfo.GetToolLifeByToolNmae(_ToolList[i].ToolName);
                            var toolLife = toolLifeList.Find(p => p.Head == _ToolList[i].Head);
                            TMSTransaction.ModifyToolSystemAttribute(_ToolList[i], "USERDEFINECOL07", toolLife.UseCount.ToCimesString(), txnStamp);

                            //因為下機後在tool_hist會沒有機台資訊,所以在下機前把機台資訊記到remark(刀具報表需要用到)
                            txnStamp.Remark = _EquipData.EquipmentName;
                            //刀具下機台
                            TMSTxn.Default.RemoveToolFromEquipment(_ToolList[i], _EquipData, txnStamp);

                            //變更刀具 GROUPID
                            TMSTransaction.ModifyToolSystemAttribute(_ToolList[i], "GROUPID", newGroupID, txnStamp);

                            //變更儲位為Hub
                            TMSTransaction.ModifyToolSystemAttribute(_ToolList[i], "Location", "Hub", txnStamp);

                            //取得刀具狀態資料
                            var newStateInfo = ToolStateInfo.GetToolStateByState("IDLE");
                            if (newStateInfo == null)
                            {
                                //刀具零組件狀態: {0}不存在,請至配件狀態維護新增此狀態!!
                                throw new Exception(RuleMessage.Error.C10149("IDLE"));
                            }

                            //變更配件狀態為USED
                            TMSTransaction.ChangeToolState(_ToolList[i], newStateInfo, txnStamp);
                        }
                    }

                    //依據機台編號資料刪除[CST_EQP_TOOL_RELEASE]
                    var lstEqpToolRelease = CSTEquipmentToolReleaseInfo.GetDataByEquipment(_EquipData.EquipmentName);
                    lstEqpToolRelease.ForEach(p => {
                        p.DeleteFromDB();
                        LogCenter.LogToDB(p, LogCenter.LogIndicator.Create(ActionType.Remove, txnStamp.UserID, txnStamp.RecordTime));
                    });

                    //依據機台編號資料刪除[CST_EQP_DEVICE_RELEASE]
                    var lstEqpDeviceRelease = CSTEquipmentDeviceReleaseInfo.GetDataByEquipment(_EquipData.EquipmentName);
                    lstEqpDeviceRelease.ForEach(p => {
                        p.DeleteFromDB();
                        LogCenter.LogToDB(p, LogCenter.LogIndicator.Create(ActionType.Remove, txnStamp.UserID, txnStamp.RecordTime));
                    });

                    cts.Complete();
                }

                ClearField();

                AjaxFocus(ttbEquipment);

                _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614(""));
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemple #9
0
        /// <summary>
        /// 確認
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);

                List <decimal> lsLife = new List <decimal>();

                //確認是否輸入刀具零組件
                ttbToolName.Must(lblToolName);

                //確認變更刀壽次數資料是否正確
                for (int i = 0; i < gvToolHead.Rows.Count; i++)
                {
                    TextBox ttbChangeLife = gvToolHead.Rows[i].FindControl("ttbChangeLife") as TextBox;

                    //確認刀壽是否為正整數
                    ttbChangeLife.MustInt(GetUIResource("ChangeLife"));
                    int lifeCount = Convert.ToInt32(ttbChangeLife.Text);
                    if (lifeCount <= 0)
                    {
                        AjaxFocus(ttbChangeLife);

                        //[00916]輸入值必須為數字且必須大於等於0!!
                        throw new Exception(TextMessage.Error.T00916());
                    }

                    lsLife.Add(lifeCount.ToCimesDecimal());
                }

                using (var cts = CimesTransactionScope.Create())
                {
                    for (int i = 0; i < gvToolHead.Rows.Count; i++)
                    {
                        //原刀壽次數
                        string life = _ToolLifeList[i].Life.ToString();

                        //更新刀壽資料
                        _ToolLifeList[i].Life = lsLife[i];
                        _ToolLifeList[i].UpdateToDB(txnStamp.UserID, txnStamp.RecordTime);

                        //紀錄歷史紀錄[CST_TOOL_TYPE_LIFE_LOG]
                        LogCenter.LogToDB(_ToolLifeList[i], LogCenter.LogIndicator.Create(ActionType.Set, txnStamp.UserID, txnStamp.RecordTime));

                        //註記原因碼
                        var reasonCategory = ReasonCategoryInfo.GetReasonCategoryByCategoryNameAndReason("CustomizeReason", "AlterToolLife");
                        txnStamp.CategoryReasonCode = reasonCategory;
                        //txnStamp.Description = string.Format("刀具零組件[{0}],刀面[{1}],原刀壽次數[{2}],設定刀壽次數[{3}]",
                        //    _ToolData.ToolName, _ToolLifeList[i].Head, life, _ToolLifeList[i].Life.ToString());

                        //備註
                        TMSTransaction.AddToolComment(_ToolData, txnStamp);
                    }
                    cts.Complete();
                }

                ClearField();

                AjaxFocus(ttbToolName);

                _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614(""));
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemple #10
0
        /// <summary>
        /// 確認
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);

                //確認是否輸入刀具零組件
                ttbToolName.Must(lblToolName);

                //確認是否選擇維修原因
                ddlReason.Must(lblReason);

                //確認是否有選擇預定回廠日
                var date = ttbDate.MustDate(lblDate);

                //取得系統時間
                var sysDate = Convert.ToDateTime(DBCenter.GetSystemDateTime().ToString("yyyy/MM/dd"));

                //確認預定回廠日是否大於等於當天日期
                if (date < sysDate)
                {
                    //預定回廠日必須大於等於{0} !
                    throw new Exception(RuleMessage.Error.C10159(sysDate.ToString("yyyy/MM/dd")));
                }

                using (var cts = CimesTransactionScope.Create())
                {
                    //取得原因碼資料
                    var reasonCategory = InfoCenter.GetBySID <ReasonCategoryInfo>(ddlReason.SelectedValue);

                    //取得刀面資料清單
                    var toolLifes = CSTToolLifeInfo.GetToolLifeByToolNmae(_ToolData.ToolName);
                    toolLifes.Sort(data => data.Head);

                    //新增一筆[CST_TOOL_REPAIR]
                    var newToolRePair = InfoCenter.Create <CSTToolRepairInfo>();
                    newToolRePair.EstimateDateOfReturn = ttbDate.Text;
                    newToolRePair.Parts          = ttbRepairPart.Text;
                    newToolRePair.Reason         = reasonCategory.Reason;
                    newToolRePair.ReasonCategory = reasonCategory.Category;
                    newToolRePair.RepairTime     = txnStamp.RecordTime;
                    newToolRePair.RepairUser     = txnStamp.UserID;
                    newToolRePair.ToolName       = _ToolData.ToolName;
                    newToolRePair.InsertToDB(txnStamp.UserID, txnStamp.RecordTime);

                    //新增一筆[CST_TOOL_REPAIR_LOG]
                    LogCenter.LogToDB(newToolRePair, LogCenter.LogIndicator.Create(ActionType.Add, txnStamp.UserID, txnStamp.RecordTime));

                    //新增[CST_TOOL_REPAIR_LIFE]
                    toolLifes.ForEach(toolLife =>
                    {
                        var newToolRePairLife           = InfoCenter.Create <CSTToolRepairLifeInfo>();
                        newToolRePairLife.Head          = toolLife.Head;
                        newToolRePairLife.Life          = toolLife.UseCount.ToString();
                        newToolRePairLife.ToolRepairSID = newToolRePair.ToolRepairSID;
                        newToolRePairLife.InsertToDB();
                    });

                    var newStateInfo = ToolStateInfo.GetToolStateByState("REPAIR");
                    if (newStateInfo == null)
                    {
                        //刀具零組件狀態: {0}不存在,請至配件狀態維護新增此狀態!!
                        throw new Exception(RuleMessage.Error.C10149("REPAIR"));
                    }

                    //因刀具報表需求,所以在送修時要將使用次數記錄在UDC07
                    var toolLifeData = toolLifes.Find(p => p.Head == _ToolData.Head);
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "USERDEFINECOL07", toolLifeData.UseCount.ToCimesString(), txnStamp);

                    //變更狀態為REPAIR
                    TMSTransaction.ChangeToolState(_ToolData, newStateInfo, txnStamp);

                    int maintainCount = _ToolData.MaintainCount;

                    //維修次數+1
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "MAINTAINCOUNT", (maintainCount + 1).ToString(), txnStamp);

                    //預定回廠日
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "USERDEFINECOL04", ttbDate.Text, txnStamp);

                    //註記原因碼
                    txnStamp.CategoryReasonCode = reasonCategory;
                    txnStamp.Description        = "";

                    //備註
                    TMSTransaction.AddToolComment(_ToolData, txnStamp);

                    cts.Complete();
                }

                ClearField();

                AjaxFocus(ttbToolName);

                _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614(""));
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemple #11
0
        /// <summary>
        /// 確認
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);

                //確認是否輸入刀具零組件
                ttbToolName.Must(lblToolName);

                //確認檢驗報告是否需要上傳
                if (_ToolType.InspectionFlag == "Y")
                {
                    if (_ToolReports.Count == 0)
                    {
                        //刀具類型:{0} 必須上傳檢驗報告資料 !
                        throw new Exception(RuleMessage.Error.C10126(_ToolType.Type));
                    }
                }

                using (var cts = CimesTransactionScope.Create())
                {
                    #region 更新[CST_TOOL_REPAIR]的實際回廠日
                    var toolRepair = CSTToolRepairInfo.GetDataByToolName(_ToolData.ToolName);
                    toolRepair.ActualDateOfReturn = txnStamp.RecordTime.Substring(0, 10);
                    toolRepair.UpdateToDB(txnStamp.UserID, txnStamp.RecordTime);

                    //新增一筆[CST_TOOL_REPAIR_LOG]
                    LogCenter.LogToDB(toolRepair, LogCenter.LogIndicator.Create(ActionType.Set, txnStamp.UserID, txnStamp.RecordTime));

                    #endregion

                    #region 將刀面使用次數歸零
                    //取得刀面資料清單
                    var toolLifes = CSTToolLifeInfo.GetToolLifeByToolNmae(_ToolData.ToolName);
                    toolLifes.ForEach(toolLife =>
                    {
                        toolLife.UseCount = 0;
                        toolLife.UpdateToDB(txnStamp.UserID, txnStamp.RecordTime);
                    });
                    #endregion

                    var newStateInfo = ToolStateInfo.GetToolStateByState("IDLE");
                    if (newStateInfo == null)
                    {
                        //刀具零組件狀態: {0}不存在,請至配件狀態維護新增此狀態!!
                        throw new Exception(RuleMessage.Error.C10149("IDLE"));
                    }

                    //因刀具報表需求,所以在送修時要將使用次數記錄在UDC07
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "USERDEFINECOL07", "0", txnStamp);

                    //變更狀態為IDLE
                    TMSTransaction.ChangeToolState(_ToolData, newStateInfo, txnStamp);

                    //變更LOCATION為Warehouse
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "LOCATION", "Warehouse", txnStamp);

                    //變更IDENTITY為維修品
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "IDENTITY", "維修品", txnStamp);

                    //清空預定回廠日
                    TMSTransaction.ModifyToolSystemAttribute(_ToolData, "USERDEFINECOL04", "", txnStamp);

                    //新增檢驗報告[CST_TOOL_REPORT]
                    _ToolReports.ForEach(toolReport =>
                    {
                        toolReport.InsertToDB(txnStamp.UserID, txnStamp.RecordTime);
                        LogCenter.LogToDB(toolReport, LogCenter.LogIndicator.Create(ActionType.Add, txnStamp.UserID, txnStamp.RecordTime));
                    });

                    //註記原因碼
                    var reasonCategory = ReasonCategoryInfo.GetReasonCategoryByCategoryNameAndReason("CustomizeReason", "ToolReturn");
                    txnStamp.CategoryReasonCode = reasonCategory;
                    txnStamp.Remark             = reasonCategory.Reason;
                    //txnStamp.Description = string.Format("刀具零組件[{0}],維修回廠", _ToolData.ToolName);

                    //備註
                    TMSTransaction.AddToolComment(_ToolData, txnStamp);

                    cts.Complete();
                }

                ClearField();

                AjaxFocus(ttbToolName);

                _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614(""));
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemple #12
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                ttbEquipment.Must(lblEquipment);
                ddlOperation.Must(lblOperation);
                csReason.Must(lblTakeReason);

                if (_TakeToolLifeList.Count == 0)
                {
                    // [00824]請新增[刀頭]!
                    throw new RuleCimesException(TextMessage.Error.T00824(lblMillHeader.Text));
                }

                string groupid  = DBCenter.GetSystemID();
                var    txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);
                using (var cts = CimesTransactionScope.Create())
                {
                    _TakeToolLifeList.ForEach(tool =>
                    {
                        // 變更GROUPID與HEAD系統屬性
                        // HEAD紀錄目前刀具使用的刀頭
                        // GROUPID紀錄目前綁定的刀具
                        var toolInfo       = ToolInfo.GetToolByName(tool.ToolName);
                        var modifyAttrList = new List <ModifyAttributeInfo>();
                        modifyAttrList.Add(ModifyAttributeInfo.CreateSystemAttributeInfo("GROUPID", groupid));
                        modifyAttrList.Add(ModifyAttributeInfo.CreateSystemAttributeInfo("HEAD", tool.Head));
                        modifyAttrList.Add(ModifyAttributeInfo.CreateSystemAttributeInfo("LOCATION", "Hub"));
                        //因刀具報表需求,所以在領用時要AddComment,並將刀面及使用次數記錄在UDC06 & UDC07
                        modifyAttrList.Add(ModifyAttributeInfo.CreateSystemAttributeInfo("USERDEFINECOL06", tool.Head));
                        modifyAttrList.Add(ModifyAttributeInfo.CreateSystemAttributeInfo("USERDEFINECOL07", tool.UseCount));
                        modifyAttrList.Add(ModifyAttributeInfo.CreateSystemAttributeInfo("USERDEFINECOL08", tool.Operation));
                        TMSTransaction.ModifyToolMultipleAttribute(toolInfo, modifyAttrList, txnStamp);

                        txnStamp.Remark             = "刀具領用";
                        var reasonCategory          = InfoCenter.GetBySID <ReasonCategoryInfo>(csReason.SelectedValue);
                        txnStamp.CategoryReasonCode = reasonCategory;
                        txnStamp.Description        = "";
                        TMSTransaction.AddToolComment(toolInfo, txnStamp);
                    });

                    // 寫入CSTToolIssue客製表
                    var toolIssueInfo = InfoCenter.Create <CSTToolIssueInfo>();
                    toolIssueInfo.TOTALQTY      = _TakeToolLifeList.Count;
                    toolIssueInfo.Reason        = csReason.GetBusinessReason().ReasonCode;
                    toolIssueInfo.EquipmentName = _EquipmentInfo == null ? "" : _EquipmentInfo.EquipmentName;
                    toolIssueInfo.LinkSID       = txnStamp.LinkSID;
                    toolIssueInfo.Action        = "領用";
                    toolIssueInfo.InsertToDB(txnStamp.UserID, txnStamp.RecordTime);
                    cts.Complete();
                }

                ClearField();
                AjaxFocus(ttbMillName);

                ((ProgramInformationBlock)ProgramInformationBlock1).ShowMessage(TextMessage.Hint.T00057("領用"));
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemple #13
0
        /// <summary>
        /// 確認
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);

                //確認是否輸入模治具
                ttbToolName.Must(lblToolName);

                //確認是否選擇下機原因
                ddlCheckOutReasonCode.Must(lblCheckOutReasonCode);

                using (var cts = CimesTransactionScope.Create())
                {
                    #region 確認機台資料
                    var equipData = EquipmentInfo.GetEquipmentByName(ttbEquip.Text);

                    if (equipData == null)
                    {
                        //[00885]機台{0}不存在!
                        throw new Exception(TextMessage.Error.T00885(ttbEquip.Text));
                    }
                    #endregion

                    //配件下機台
                    TMSTxn.Default.RemoveToolFromEquipment(_ToolData, equipData, txnStamp);

                    ////配件記錄下機原因。
                    //TMSTransaction.AddToolComment(_ToolData, txnStamp);

                    //註記原因碼
                    var reasonCategory = InfoCenter.GetBySID <ReasonCategoryInfo>(ddlCheckOutReasonCode.SelectedValue);
                    txnStamp.CategoryReasonCode = reasonCategory;
                    txnStamp.Description        = ttbCheckOutDescr.Text;

                    #region 變更配件狀態為WaitPM或IDLE(依權限傳入的參數而定)
                    var newStateInfo = ToolStateInfo.GetToolStateByState(_ToolChangeState);
                    if (newStateInfo == null)
                    {
                        //模治具狀態:{0}不存在!!
                        throw new Exception(RuleMessage.Error.C10032(_ToolChangeState));
                    }

                    TMSTransaction.ChangeToolState(_ToolData, newStateInfo, txnStamp);
                    #endregion



                    cts.Complete();
                }

                ClearField();

                AjaxFocus(ttbToolName);

                _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614(""));
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }