/// <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)); } //確認刀具零組件狀態是否可使用,僅IDLE可執行 if (_ToolData.CurrentState != "IDLE") { //刀具零組件狀態為{0},不可執行此功能!! throw new Exception(RuleMessage.Error.C10129(_ToolData.CurrentState)); } #region 機原因碼(DropDownList):依照原因碼工作站設定,帶出原因碼 ddlReason.Items.Clear(); List <BusinessReason> reasonList = ReasonCategoryInfo.GetOperationRuleCategoryReasonsWithReasonDescr(ProgramRight, "ALL", "Default", ReasonMode.Category); if (reasonList.Count > 0) { ddlReason.DataSource = reasonList; ddlReason.DataTextField = "ReasonDescription"; ddlReason.DataValueField = "ReasonCategorySID"; ddlReason.DataBind(); if (ddlReason.Items.Count != 1) { ddlReason.Items.Insert(0, ""); } else { ddlReason.SelectedIndex = 0; } } else { //[00641]規則:{0} 工作站:{1} 使用的原因碼未設定,請洽IT人員! throw new Exception(TextMessage.Error.T00641(ProgramRight, "ALL")); } #endregion btnOK.Enabled = true; } catch (Exception ex) { ClearField(); AjaxFocus(ttbToolName); HandleError(ex); } }
/// <summary> /// 鍛造出站有不良數量直接拆批及送待判工作站 /// </summary> /// <param name="txnLotData">機加批號</param> /// <param name="defectGridDataList">不良清單</param> /// <param name="txnStamp"></param> public void SplitDefectLotList(LotInfoEx txnLotData, List <DefectGridData> defectGridDataList, TransactionStamp txnStamp) { //待判工作站點名稱 string judgeOperationName = ""; //確認是否有不良清單,如果有不良清單的話,則要取得待判工作站資料 if (defectGridDataList.Count > 0) { //在系統資料維護裡,取得此批號對應製程(CPC/CPF)的待判工作站名稱 List <WpcExClassItemInfo> operationList = WpcExClassItemInfo.GetExtendItemListByClassAndRemarks("SAIJudgeOperation"); WpcExClassItemInfo judgeOperationData = operationList.Find(p => p.Remark01 == txnLotData.Process); if (judgeOperationData == null) { //找不到待判站資訊,請至系統資料維護增加資訊,屬性:{0} throw new Exception(RuleMessage.Error.C10014(txnLotData.Process)); } //取得待判工作站名稱 judgeOperationName = judgeOperationData.Remark02; } //處理不良批號 defectGridDataList.ForEach(defectGridData => { //取得原因碼資訊 var reasonData = InfoCenter.GetBySID <ReasonCategoryInfo>(defectGridData.DefectID); //取得批號子單元資訊 var component = ComponentInfo.GetComponentByComponentID(defectGridData.ComponentID); //取得不良子批批號名稱 var splitLotNaming = GetNamingRule("SplitLot", txnStamp.UserID, txnLotData); //批號拆子批 var splitLot = SplitLotInfo.CreateSplitLotByLotAndQuantity(txnLotData.Lot, splitLotNaming.First[0], new List <ComponentInfo>() { component }, reasonData, reasonData.Description); WIPTxn.Default.SplitLot(txnLotData, splitLot, WIPTxn.SplitIndicator.Create(null, null, null, TerminateBehavior.NoTerminate), txnStamp); if (splitLotNaming.Second != null && splitLotNaming.Second.Count != 0) { DBCenter.ExecuteSQL(splitLotNaming.Second); } //註記不良 var compDefect = ComponentDefectObject.Create(component, component.ComponentQuantity, 0, reasonData, defectGridData.DefectDesc); WIPTransaction.DefectComponent(splitLot, new List <ComponentDefectObject>() { compDefect }, WIPTransaction.DefectIndicator.Create(), txnStamp); #region 送至待判工作站 //取得目前批號的流程線上版本 RouteVersionInfo RouteVersion = RouteVersionInfo.GetRouteActiveVersion(txnLotData.RouteName); //以目前工作站名稱去查詢在所有流程中的序號 var routeOperation = RouteOperationInfo.GetRouteAllOperations(RouteVersion).Find(p => p.OperationName == judgeOperationName); //以目前工作站名稱去查詢在所有流程中的序號 var reasonCategory = ReasonCategoryInfo.GetReasonCategoryByCategoryNameAndReason("Common", "OTHER"); ////將批號的UDC01註記不良批 //WIPTransaction.ModifyLotSystemAttribute(splitLot, "USERDEFINECOL01", "Y", txnStamp); ////將批號的UDC02註記工作站序號 //WIPTransaction.ModifyLotSystemAttribute(splitLot, "USERDEFINECOL02", operationSequence, txnStamp); ////將批號的UDC03註記工作站名稱 //WIPTransaction.ModifyLotSystemAttribute(splitLot, "USERDEFINECOL03", operationName, txnStamp); var modifyAttrList = new List <ModifyLotAttributeInfo>(); //將批號的UDC01註記不良批 modifyAttrList.Add(ModifyLotAttributeInfo.CreateLotSystemAttributeInfo("USERDEFINECOL01", "Y")); //將批號的UDC02註記工作站序號 modifyAttrList.Add(ModifyLotAttributeInfo.CreateLotSystemAttributeInfo("USERDEFINECOL02", splitLot.OperationSequence)); //將批號的UDC03註記工作站名稱 modifyAttrList.Add(ModifyLotAttributeInfo.CreateLotSystemAttributeInfo("USERDEFINECOL03", splitLot.OperationName)); WIPTransaction.ModifyLotMultipleAttribute(splitLot, modifyAttrList, txnStamp); WIPTransaction.ReassignOperation(splitLot, routeOperation, reasonCategory, reasonCategory.Description, txnStamp); #endregion }); }
/// <summary> /// 切換序號 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlSN_SelectedIndexChanged(object sender, EventArgs e) { try { ddlSN.Must(lblSN); if (ddlSN.SelectedIndex != -1) { //清除原因碼資料 ddlPQCReasonCode.Items.Clear(); ttbMaterialLot.Text = ""; ttbWorkOrderLot.Text = ""; ttbDescr.Text = ""; rdbNG.Enabled = false; rdbOK.Enabled = false; int index = -1; for (int i = 0; i < _QCDataList.Count; i++) { string ID = _QCDataList[i].ID; //比對符合選擇機台編號的資料 if (ID == ddlSN.SelectedValue) { index = i; break; } } _SelectedQCData = _QCDataList[index]; ttbMaterialLot.Text = _SelectedQCData.MaterialLot; ttbWorkOrderLot.Text = _SelectedQCData.WorkOderLot; if (_SelectedQCData.PassFlag == "N") { // 取得中心孔量測設定值 var lstSAICenterHolde = WpcExClassItemInfo.GetExClassItemInfo("SAICenterHole", _SelectedQCData.DeviceName); if (lstSAICenterHolde.Count == 0) { lstSAICenterHolde = WpcExClassItemInfo.GetExClassItemInfo("SAICenterHole", "ALL"); } // 若找不到中心孔量測需拋錯 if (lstSAICenterHolde.Count == 0) { throw new Exception(TextMessage.Error.T00555("SAICenterHole", _SelectedQCData.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(); } //取得Lot資料 var lotData = InfoCenter.GetBySID <LotInfo>(_SelectedQCData.ObjectSID); rdbNG.Enabled = true; rdbOK.Enabled = true; #region 設置原因碼 List <BusinessReason> reason = ReasonCategoryInfo.GetOperationRuleCategoryReasonsWithReasonDescr(ProgramRight, "ALL", "Default", ReasonMode.Category); if (reason.Count > 0) { ddlPQCReasonCode.DataSource = reason; ddlPQCReasonCode.DataTextField = "ReasonDescription"; ddlPQCReasonCode.DataValueField = "ReasonCategorySID"; ddlPQCReasonCode.DataBind(); if (ddlPQCReasonCode.Items.Count != 1) { ddlPQCReasonCode.Items.Insert(0, ""); } else { ddlPQCReasonCode.SelectedIndex = 0; } } else { //[00641]規則:{0} 工作站:{1} 使用的原因碼未設定,請洽IT人員! throw new Exception(TextMessage.Error.T00641(ProgramRight, "ALL")); } #endregion btnOK.Enabled = true; } } catch (Exception ex) { HandleError(ex); ddlPQCReasonCode.Items.Clear(); ttbMaterialLot.Text = ""; ttbDescr.Text = ""; ttbWorkOrderLot.Text = ""; btnOK.Enabled = false; rdbOK.Checked = true; rdbNG.Checked = false; rdbOK.Enabled = true; rdbNG.Enabled = false; gvComponentEDC.DataSource = null; gvComponentEDC.DataBind(); } }
protected void btnOK_Click(object sender, EventArgs e) { try { // 包裝數量必須符合滿箱數量,否則須拋錯 if (!ckbNoControl.Checked && _PackType == "Standard" && (_PackingList.Count + _RelativePackingList.Count) != ttbMaxPackSize.Text.ToDecimal()) { throw new RuleCimesException(RuleMessage.Error.C10043((_PackingList.Count + _RelativePackingList.Count).ToString(), ttbMaxPackSize.Text)); } // 若包裝方式為左右手,則左右手的輸入數量需相同 if (!ckbNoControl.Checked && _PackType == "Mix" && _PackingList.Count != _RelativePackingList.Count) { throw new RuleCimesException(RuleMessage.Error.C10044(_DeviceName, _PackingList.Count.ToString(), _RelativeDeviceName, _RelativePackingList.Count.ToString())); } // 若包裝方式為左右手,則左右手的輸入數量需相同且需符合滿箱數量乘以二 if (!ckbNoControl.Checked && _PackType == "Mix" && (_PackingList.Count + _RelativePackingList.Count) != (ttbMaxPackSize.Text.ToDecimal() * 2)) { throw new RuleCimesException(RuleMessage.Error.C10043((_PackingList.Count + _RelativePackingList.Count).ToString(), (ttbMaxPackSize.Text.ToDecimal() * 2).ToString())); } if (ddlInspector.SelectedValue.IsNullOrEmpty()) { //[00826] 請輸入{0}! throw new RuleCimesException(TextMessage.Error.T00826(lblInspector.Text), ddlInspector); } var lstSourceLot = new List <LotInfo>(); // 定義交易戳記 var txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName); using (var cts = CimesTransactionScope.Create()) { // 若有不同的批號需拆批 _PackingList.Distinct <PackingInfo>(new PackCompare()).ToList().ForEach(p => { lstSourceLot.Add(SplitLot(p.LotInfo, false, txnStamp)); }); // 若有不同的批號需拆批 _RelativePackingList.Distinct <PackingInfo>(new PackCompare()).ToList().ForEach(p => { lstSourceLot.Add(SplitLot(p.LotInfo, true, txnStamp)); }); #region SplitBoxLot List <SqlAgent> splitLotArchiSQLList = new List <SqlAgent>(); var generator = NamingIDGenerator.GetRule("BoxNo"); if (generator == null) { //WRN-00411,找不到可產生的序號,請至命名規則維護設定,規則名稱:{0}!!! throw new Exception(TextMessage.Error.T00437("BoxNo")); } var serialData = generator.GenerateNextIDs(1, lstSourceLot[0], new string[] { }, User.Identity.Name); splitLotArchiSQLList = serialData.Second; var boxNoLotID = serialData.First[0]; var reasonCategoryInfo = ReasonCategoryInfo.GetReasonCategoryByCategoryNameAndReason("Common", "OTHER"); var splitLotData = SplitLotInfo.CreateSplitLotByLotAndQuantity(lstSourceLot[0].Lot, boxNoLotID, 0, 0, reasonCategoryInfo, "SplitBoxLot"); WIPTxn.SplitIndicator splitInd = WIPTxn.SplitIndicator.Create(); WIPTxn.Default.SplitLot(lstSourceLot[0], splitLotData, splitInd, txnStamp); //若子單元為自動產生,更新序號至DB if (splitLotArchiSQLList != null && splitLotArchiSQLList.Count > 0) { DBCenter.ExecuteSQL(splitLotArchiSQLList); } #endregion var targetLot = LotInfo.GetLotByLot(boxNoLotID); // 將批號轉換為另一個批號的子單元,轉換後批號結批,例如可使用於包裝 WIPTxn.Default.ConvertToComponent(targetLot, lstSourceLot, "Box", WIPTxn.ConvertToComponentIndicator.Default, txnStamp); // 紀錄檢驗人員 //WIPTransaction.ModifyLotSystemAttribute(targetLot, "USERDEFINECOL12", ddlInspector.SelectedValue, txnStamp); // 進行Dispatch WIPTransaction.DispatchLot(targetLot, txnStamp); // 刪除暫存檔案 if (_BatchID != "") { CSTWIPPackTempInfo.DeletePackTempByBatchID(_BatchID); } var packInfo = InfoCenter.Create <CSTWIPPackInfo>(); packInfo.BOXNO = boxNoLotID; packInfo.Quantity = _PackingList.Count + _RelativePackingList.Count; packInfo.INSPUSER = ddlInspector.SelectedValue; packInfo.InsertToDB(txnStamp.UserID, txnStamp.RecordTime); _PackingList.ForEach(comp => { var packDataInfo = InfoCenter.Create <CSTWIPPackDataInfo>(); packDataInfo.WIP_PACK_SID = packInfo.ID; packDataInfo.ComponentID = comp.ComponentID; packDataInfo.DMC = comp.DMC; packDataInfo.DeviceName = comp.Device; packDataInfo.Quantity = 1; packDataInfo.InsertToDB(txnStamp.UserID, txnStamp.RecordTime); }); _RelativePackingList.ForEach(comp => { var packDataInfo = InfoCenter.Create <CSTWIPPackDataInfo>(); packDataInfo.WIP_PACK_SID = packInfo.ID; packDataInfo.ComponentID = comp.ComponentID; packDataInfo.DMC = comp.DMC; packDataInfo.DeviceName = comp.Device; packDataInfo.Quantity = 1; packDataInfo.InsertToDB(txnStamp.UserID, txnStamp.RecordTime); }); //工時 _UserWorkTimeList.ForEach(p => { p.InsertToDB(txnStamp.UserID, txnStamp.RecordTime); }); _UserWorkTimeList.Clear(); #region Print _dsReport = new DataSet(); // 取得Report資料 _dsReport = GetRunCardDataSource(targetLot); _dsReport.AcceptChanges(); if (_dsReport.Tables.Count > 0) { string sPrintProgram = "/CustomizeRule/WIPRule/W035View.aspx"; string sHost = Request.Url.Host; string sApplicationPath = Request.ApplicationPath; string ReportPath = "http://" + sHost + sApplicationPath + sPrintProgram; Session["W035View"] = _dsReport; //開啟查詢工單頁面 string openPrintWindow = "window.open('" + ReportPath + "','pop','resizable: yes; status: no; scrollbars:no; menubar:no;toolbar:no;location:no;dialogLeft:10px;dialogTop:10px;dialogHeight:10px;dialogWidth:10px',false);"; ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), Guid.NewGuid().ToString(), openPrintWindow, true); } #endregion cts.Complete(); } // ClearUI不會清除Device資料 ttbDeviceName.Text = ""; ClearField(); //ReturnToPortal(); } catch (Exception ex) { HandleError(ex); } }
/// <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); } }
/// <summary> /// 切換序號 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlSN_SelectedIndexChanged(object sender, EventArgs e) { try { //清除機台檢驗資料 _CSTWIPCMMList = new List <CSTWIPCMMInfo>(); _CSTWIPCMMDataList = new List <CSTWIPCMMDataInfo>(); gvInspectionData.SetDataSource(_CSTWIPCMMDataList, true); ddlFileName.Items.Clear(); ddlSN.Must(lblSN); if (ddlSN.SelectedIndex != -1) { //清除原因碼資料 ddlPQCReasonCode.Items.Clear(); ttbMaterialLot.Text = ""; ttbWorkOrderLot.Text = ""; ttbDescr.Text = ""; rdbNG.Enabled = false; rdbOK.Enabled = false; int index = -1; for (int i = 0; i < _QCDataList.Count; i++) { string ID = _QCDataList[i].ID; //比對符合選擇機台編號的資料 if (ID == ddlSN.SelectedValue) { index = i; break; } } _SelectedQCData = _QCDataList[index]; ttbMaterialLot.Text = _SelectedQCData.MaterialLot; ttbWorkOrderLot.Text = _SelectedQCData.WorkOderLot; if (_SelectedQCData.PassFlag == "N") { //以機台名稱檢查是否有檢驗結果資料 _CSTWIPCMMList = CSTWIPCMMInfo.GetDataListByEquipmantAndFileIDAndDevice(_SelectedQCData.EquipmentName, _SelectedQCData.ComponentLot, _SelectedQCData.WorkOderLot, _SelectedQCData.MaterialLot, _SelectedQCData.DeviceName); //以OP1機台名稱檢查是否有檢驗結果資料 var CSTWIPCMMListBySEquipment = CSTWIPCMMInfo.GetDataListByEquipmantAndFileIDAndDevice(_SelectedQCData.SecondEquipmentName, _SelectedQCData.ComponentLot, _SelectedQCData.WorkOderLot, _SelectedQCData.MaterialLot, _SelectedQCData.DeviceName); //將二組資料合併,去除重覆資料 CSTWIPCMMListBySEquipment.ForEach(data => { if (_CSTWIPCMMList.Contains(data) == false) { _CSTWIPCMMList.Add(data); } }); if (_CSTWIPCMMList.Count == 0) { //序號:{0} 沒有機台檢驗資料可以顯示! throw new Exception(RuleMessage.Error.C10065(ddlSN.SelectedItem.Text)); } //加入機台檢驗檔名稱 _CSTWIPCMMList.ForEach(data => { ddlFileName.Items.Add(new ListItem(data["FILENAME"].ToString(), data.ID)); }); if (ddlFileName.Items.Count > 0) { ddlFileName.Items.Insert(0, ""); } } else { } //取得Lot資料 var lotData = InfoCenter.GetBySID <LotInfo>(_SelectedQCData.ObjectSID); rdbNG.Enabled = true; rdbOK.Enabled = true; #region 設置原因碼 List <BusinessReason> reason = ReasonCategoryInfo.GetOperationRuleCategoryReasonsWithReasonDescr(ProgramRight, "ALL", "Default", ReasonMode.Category); if (reason.Count > 0) { ddlPQCReasonCode.DataSource = reason; ddlPQCReasonCode.DataTextField = "ReasonDescription"; ddlPQCReasonCode.DataValueField = "ReasonCategorySID"; ddlPQCReasonCode.DataBind(); if (ddlPQCReasonCode.Items.Count != 1) { ddlPQCReasonCode.Items.Insert(0, ""); } else { ddlPQCReasonCode.SelectedIndex = 0; } } else { //[00641]規則:{0} 工作站:{1} 使用的原因碼未設定,請洽IT人員! throw new Exception(TextMessage.Error.T00641(ProgramRight, "ALL")); } #endregion btnOK.Enabled = true; } } catch (Exception ex) { HandleError(ex); ddlPQCReasonCode.Items.Clear(); ttbMaterialLot.Text = ""; ttbDescr.Text = ""; ttbWorkOrderLot.Text = ""; btnOK.Enabled = false; rdbOK.Checked = true; rdbNG.Checked = false; rdbCLOSE.Checked = false; rdbOK.Enabled = true; rdbNG.Enabled = false; _CSTWIPCMMList = new List <CSTWIPCMMInfo>(); _CSTWIPCMMDataList = new List <CSTWIPCMMDataInfo>(); gvInspectionData.SetDataSource(_CSTWIPCMMDataList, true); } }
/// <summary> /// 確定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnOK_Click(object sender, EventArgs e) { try { #region 確認選擇結果,如果是選擇NG,確認是否有選擇原因碼 string result = ""; if (rdbOK.Checked) { result = "OK"; } else if (rdbNG.Checked) { result = "NG"; //確認是否有選擇原因碼 ddlPQCReasonCode.Must(lblPQCReasonCode); } else if (rdbCLOSE.Checked) { result = "CLOSE"; //確認是否有選擇原因碼 ddlPQCReasonCode.Must(lblPQCReasonCode); } #endregion TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName); using (var cts = CimesTransactionScope.Create()) { #region 更新檢驗主檔[MES_QC_INSP] //取得檢驗主檔資料 var QCInsepctionData = InfoCenter.GetBySID <QCInspectionInfo>(_SelectedQCData.QCInspectionSID).ChangeTo <QCInspectionInfoEx>(); //原因碼 ReasonCategoryInfo reason = null; //有選擇原因碼才更新[NG_Category]及[NG_Reason] if (string.IsNullOrEmpty(ddlPQCReasonCode.SelectedValue) == false) { reason = InfoCenter.GetBySID <ReasonCategoryInfo>(ddlPQCReasonCode.SelectedValue); QCInsepctionData.NG_Category = reason.Category; QCInsepctionData.NG_Reason = reason.Reason; } //如果判定結果為結單的話,則必須把結單時間及人員資料寫回資料庫 if (result == "CLOSE") { QCInsepctionData.FINISHTIME = txnStamp.RecordTime; QCInsepctionData.FINISHUSER = txnStamp.UserID; } QCInsepctionData.NG_Description = ttbDescr.Text; QCInsepctionData.Result = result; QCInsepctionData.Status = "Finished"; QCInsepctionData.UpdateToDB(txnStamp.UserID, txnStamp.RecordTime); #endregion #region 更新機台檢驗主檔[CST_WIP_CMM] if (_CSTWIPCMMList != null) { //更新檢驗主檔的QCInspectionSID欄位 _CSTWIPCMMList.ForEach(data => { data.QCInspectionSID = QCInsepctionData.ID; data.UpdateToDB(); }); } #endregion #region 更新機台狀態及更新檢驗單對應的批號資料 //如果選擇結果為NG時,則更新機台狀態及更新檢驗單對應的批號資料 if (rdbNG.Checked) { //取得機台狀態資料 var newStateInfo = EquipmentStateInfo.GetEquipmentStateByState("DOWN"); var equipData = EquipmentInfo.GetEquipmentByName(_SelectedQCData.EquipmentName); //如果機台狀態為IDLE,則變更狀態為DOWN if (equipData.CurrentState == "IDLE") { //更新機台狀態 EMSTransaction.ChangeState(equipData, newStateInfo, txnStamp); } else { //如果機台狀態不為IDLE,則註記機台[USERDEFINECOL01]為Y EMSTransaction.ModifyEquipmentSystemAttribute(equipData, "USERDEFINECOL01", "Y", txnStamp); } //上一次的檢驗單號資料 QCInspectionInfoEx previousInspectionData = null; //依據機台及料號查詢,然後用建立時間逆排序,找出所有FAI及PQC的檢驗單號資料 var QCDataList = QCInspectionInfoEx.GetInspDataListByEquipmentAndDevice(QCInsepctionData.EquipmentName, QCInsepctionData.DeviceName); //如果筆數大於1,則目前檢驗單號的索引值 if (QCDataList.Count > 1) { //找出目前檢驗單號的索引值 var NGIndex = QCDataList.FindIndex(p => p.InspectionNo == QCInsepctionData.InspectionNo); //如果找到的索引值不是最後一筆的話,則找出上一次的檢驗單號資料 if (NGIndex != (QCDataList.Count - 1)) { //找出上一次的檢驗單號資料 previousInspectionData = QCDataList[NGIndex + 1]; } } //取得目前檢驗單號的批號子單元資料 var componentList = ComponentInfoEx.GetDataByInspectionNo(QCInsepctionData.InspectionNo); componentList.ForEach(component => { //取得批號資料 var lotData = LotInfo.GetLotByLot(component.CurrentLot); //更新欄位[PQCNGFLAG] WIPTransaction.ModifyLotComponentSystemAttribute(lotData, component, "PQCNGFLAG", "Y", txnStamp); //更新欄位[PQCNGNO] WIPTransaction.ModifyLotComponentSystemAttribute(lotData, component, "PQCNGNO", QCInsepctionData.InspectionNo, txnStamp); }); if (previousInspectionData != null) { //取得上一次檢驗單號的批號子單元資料 var previousComponentList = ComponentInfoEx.GetDataByInspectionNo(previousInspectionData.InspectionNo); //取得不需要註記的ComponentID var passInspectionDataList = QCInspectionObjectInfo.GetInspectionObjects(previousInspectionData); previousComponentList.ForEach(component => { //確認是否為不需要註記的ComponentID if (passInspectionDataList.FindIndex(p => p.ItemName1 == component.ComponentID) == -1) { //取得批號資料 var lotData = LotInfo.GetLotByLot(component.CurrentLot); //更新欄位[PQCNGFLAG] WIPTransaction.ModifyLotComponentSystemAttribute(lotData, component, "PQCNGFLAG", "Y", txnStamp); //更新欄位[PQCNGNO] WIPTransaction.ModifyLotComponentSystemAttribute(lotData, component, "PQCNGNO", QCInsepctionData.InspectionNo, txnStamp); } }); } } #endregion //如果判定結果選擇為NG,則必須拆批送待判 if (rdbNG.Checked) { //判定NG直接拆批及送待判工作站 CustomizeFunction.SplitDefectLot(_SelectedQCData.ComponentLot, ttbDescr.Text, reason, txnStamp); } cts.Complete(); } ClearField(); AjaxFocus(ttbLot); _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614("")); } catch (Exception ex) { HandleError(ex); } }
/// <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); } }
/// <summary> /// 確定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnOK_Click(object sender, EventArgs e) { try { /* 1. 檢查畫面上所有輸入欄位是否都已輸入。 * 2. 如為當站進站(批號狀態為Wait),則將批號進站併上機台。(EquipmentAddLot、CheckIn、Dispatch)。 * 3. 如為預約進站,則將預約資訊塞入客製表,做批號備註。(AddComment) * 4. 清空畫面,游標停在機加批號。 */ string equipmentName = ""; EquipmentInfo equipData = null; TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName); //檢查機台是否有輸入 if (ttbLot.Text.IsNullOrEmpty() || _LotData == null) { AjaxFocus(ttbLot); throw new Exception(TextMessage.Error.T00030(GetUIResource("LotCheckInLot"), "")); } //如果機台下拉式清單Enabled為TRUE,則必須檢查是否有選擇機台 if (ddlEquip.Enabled) { ddlEquip.Must(lblEquip); //取得機台資訊 equipData = EquipmentInfo.GetEquipmentByID(ddlEquip.SelectedValue); //註記機台名稱 equipmentName = equipData.EquipmentName; } using (var cts = CimesTransactionScope.Create()) { //批號狀態為Wait時,表示目前要執行進站 if (_LotData.Status == LotDefaultStatus.Wait.ToString()) { CheckBom(_LotData.OperationName, equipData, _LotData); if (equipData != null) { //批號上機台 EMSTxn.Default.AddLotToEquipment(_LotData, equipData, txnStamp); //取得機台狀態資料 var newStateInfo = EquipmentStateInfo.GetEquipmentStateByState("RUN"); if (equipData.CurrentState != "RUN") { //更新機台狀態 EMSTransaction.ChangeState(equipData, newStateInfo, txnStamp); } } //批號進站 WIPTransaction.CheckIn(_LotData, equipmentName, "", "", LotDefaultStatus.Run.ToString(), txnStamp); //將批號Dispatch到下一規則 WIPTransaction.DispatchLot(_LotData, txnStamp); } else { CheckBom(_WIPReserveCheckInData.OperationName, equipData, _LotData); //執行預約進站功能 _WIPReserveCheckInData.Equipment = equipmentName; _WIPReserveCheckInData.InTime = DBCenter.GetSystemTime(); _WIPReserveCheckInData.InsertToDB(); //做批號備註。(AddComment) var reason = ReasonCategoryInfo.GetReasonCategoryByCategoryNameAndReason("CustomizeReason", "ReserveLotCheckIn"); var massage = ""; WIPTransaction.AddLotComment(_LotData, reason, massage, txnStamp); } cts.Complete(); } ClearField(); AjaxFocus(ttbLot); _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614("")); } catch (Exception ex) { HandleError(ex); } }
/// <summary> /// 確定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnOK_Click(object sender, EventArgs e) { /******************************************************************* * PPK判定後須執行事項: * 1. 依照判定的BATCHID+料號,將所屬單號資料更新。 * 2. 依照判定狀態更新CST_WIP_PPK結果。 * 3. 如同一個BATCHID都判定完成,變更機台狀態,從PPK變IDLE。 * 如一個BATCHID有兩個料號,需兩個料號都判定完成才可以變更機台狀態。 ******************************************************************/ try { //取得所選擇的料號名稱 var deviceName = ddlDevice.SelectedValue; #region 確認選擇結果,如果是選擇NG,確認是否有選擇原因碼及選擇結果及檢驗清單的勾選是否符合 string result = ""; if (rdbOK.Checked) { result = "OK"; } else if (rdbNG.Checked) { result = "NG"; //確認是否有選擇原因碼 ddlPPKReasonCode.Must(lblPPKReasonCode); if (SelectedNGData() == false) { //PPK結果選擇NG,檢驗清單至少勾選一筆資料! throw new Exception(RuleMessage.Error.C10070()); } } else if (rdbCLOSE.Checked) { result = "CLOSE"; //確認是否有選擇原因碼 ddlPPKReasonCode.Must(lblPPKReasonCode); } #endregion TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName); using (var cts = CimesTransactionScope.Create()) { #region 更新檢驗主檔清單[MES_QC_INSP] _QCInspectionDataList.ForEach(QCInspectionData => { //符合選擇的料號才進行資料更新 if (QCInspectionData.DeviceName == deviceName) { //有選擇原因碼才更新[NG_Category]及[NG_Reason] if (string.IsNullOrEmpty(ddlPPKReasonCode.SelectedValue) == false) { var reason = InfoCenter.GetBySID <ReasonCategoryInfo>(ddlPPKReasonCode.SelectedValue); QCInspectionData.NG_Category = reason.Category; QCInspectionData.NG_Reason = reason.Reason; } //如果判定結果為結單的話,則必須把結單時間及人員資料寫回資料庫 if (result == "CLOSE") { QCInspectionData.FINISHTIME = txnStamp.RecordTime; QCInspectionData.FINISHUSER = txnStamp.UserID; } QCInspectionData.NG_Description = ttbDescr.Text; QCInspectionData.Result = result; QCInspectionData.Status = "Finished"; QCInspectionData.UpdateToDB(txnStamp.UserID, txnStamp.RecordTime); } }); #endregion #region 更新機台資訊及檢驗工件結果 //取某一支工件序號的資料來傳入UpdatePPK var updateLot = InfoCenter.GetBySID <LotInfo>(_QCInspectionObjDataList[0].OBJECTSID).ChangeTo <LotInfoEx>(); //更新[CST_WIP_PPK.PPKCOUNT] CustomizeFunction.UpdatePPK(_QCInspectionDataList[0].EquipmentName, updateLot.DeviceName, updateLot.DeviceVersion, (rdbNG.Checked) ? "false" : "true"); //將介面上所勾選/不勾選的資料對應到MES_QC_INSP_OBJ.ITEM4的欄位 for (int i = 0; i < gvQC.Rows.Count; i++) { var thisCheckBox = (CheckBox)gvQC.Rows[i].FindControl("ckbDefectSelect"); if (thisCheckBox.Checked) { _QCInspectionObjDataList[i].ItemName4 = "NG"; } else { _QCInspectionObjDataList[i].ItemName4 = "OK"; } _QCInspectionObjDataList[i].UpdateToDB(txnStamp.UserID, txnStamp.RecordTime); } //更新機台檢驗主檔 _CSTWIPCMMList.ForEach(data => { data.UpdateToDB(); }); //取得相同BatchID的檢驗資料 (理論上應該都完成檢驗...) //如果是雙料號,每次判定要分料號判定 var QCDataList = QCInspectionInfoEx.GetDataListByBatchIDAndDeviceName(_QCInspectionDataList[0].BatchID, deviceName); //如果是雙料號,每次判定要分料號判定,但是機台的狀態要該batchID都判定通過,才算PPK完成 var QCDAllataList = QCInspectionInfoEx.GetDataListByBatchID(_QCInspectionDataList[0].BatchID); #region 如果相同的BatchID都檢驗完成時,則更新機台狀態為IDLE //相同BatchID都已完成檢驗旗標 //如果是雙料號,每次判定要分料號判定,但是機台的狀態要該batchID都判定通過,才算PPK完成 bool isAllFinish = true; QCDAllataList.ForEach(p => { if (p.Status != "Finished") { isAllFinish = false; } }); if (isAllFinish) { //取得機台狀態資料 var newStateInfo = EquipmentStateInfo.GetEquipmentStateByState("IDLE"); //檢查機台是否存在 var equipData = EquipmentInfo.GetEquipmentByName(_QCInspectionDataList[0].EquipmentName); if (equipData == null) { //[00885]機台{0}不存在! throw new Exception(TextMessage.Error.T00885(_QCInspectionDataList[0].EquipmentName)); } //更新機台狀態 EMSTransaction.ChangeState(equipData, newStateInfo, txnStamp); } #endregion #region 如果相同的BatchID都檢驗完成且結果都為OK時,則更新機台檢驗資料及更新COUNT //相同BatchID都已完成檢驗及結果都為OK旗標 bool isAllFinishAndOK = true; QCDataList.ForEach(p => { if (!(p.Status == "Finished" && p.Result == "OK")) { isAllFinishAndOK = false; } }); if (isAllFinishAndOK) { //取得AutoMerge原因碼 var reasonCategory = ReasonCategoryInfo.GetReasonCategoryByCategoryNameAndReason("CustomizeReason", "AutoMerge"); if (reasonCategory == null) { //[00030]{0}:{1}不存在! throw new Exception(TextMessage.Error.T00030("", "CustomizeReason- AutoMerge")); } _QCInspectionObjDataList.ForEach(Data => { //更新機台檢驗資料 Data.UpdateToDB(txnStamp.UserID, txnStamp.RecordTime); }); var mergeList = _QCInspectionObjDataList.Select(p => p.ItemName2).Distinct().ToList(); foreach (var lot in mergeList) { var lotData = LotInfoEx.GetLotByWorkOrderLot(lot); //確認FAI是否已經檢驗完成 if (CustomizeFunction.CheckFAI(_QCInspectionDataList[0].EquipmentName, lotData.Lot)) { //執行AutoMerge CustomizeFunction.AutoMerge(lotData.InventoryLot, txnStamp, reasonCategory); } } } #endregion #endregion cts.Complete(); } ClearField(); AjaxFocus(ttbEquipOrCompLot); _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614("")); } catch (Exception ex) { HandleError(ex); } }
/// <summary> /// 切換料號 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlDevice_SelectedIndexChanged(object sender, EventArgs e) { try { #region 清除資料 ddlFileName.Items.Clear(); ddlPPKReasonCode.Items.Clear(); _CSTWIPCMMList = new List <CSTWIPCMMInfo>(); _QCInspectionObjDataList.Clear(); gvQC.SetDataSource(_QCInspectionObjDataList, true); _CSTWIPCMMDataList = new List <CSTWIPCMMDataInfo>(); gvInspectionData.SetDataSource(_CSTWIPCMMDataList, true); btnOK.Enabled = false; #endregion //確認是否有選擇料號 if (ddlDevice.SelectedItem.Text.IsNullOrTrimEmpty() == false) { //取得料號名稱 string deviceName = ddlDevice.SelectedItem.Text; //清除檢驗清單 _QCInspectionObjDataList.Clear(); List <QCInspectionObjectInfoEx> QCInspectionObjDataListTemp = new List <QCInspectionObjectInfoEx>(); _QCInspectionDataList.ForEach(QCData => { //符合所選的料號才可以加入序號清單 if (QCData.DeviceName == deviceName) { var selectDataList = QCInspectionObjectInfoEx.GetDataListByQCInspectionSID(QCData.QC_INSP_SID); QCInspectionObjDataListTemp.AddRange(selectDataList); } }); //以SID排序 _QCInspectionObjDataList = QCInspectionObjDataListTemp.OrderBy(p => p.ID).ToList(); #region 檢驗資料 //確認料號資料是否在在 _DeviceVersionData = DeviceVersionInfo.GetActiveDeviceVersion(deviceName).ChangeTo <DeviceVersionInfoEx>(); if (_DeviceVersionData == null) { //[00030]{0}:{1}不存在! throw new Exception(TextMessage.Error.T00030(lblDevice.Text, deviceName)); } //清除資料 _CSTWIPCMMList.Clear(); if (_DeviceVersionData.ProdType == CustomizeFunction.ProdType.S.ToCimesString()) { _QCInspectionObjDataList.ForEach(data => { //以機台名稱檢查是否有檢驗結果資料 var CSTWIPCMMListByEquipment = CSTWIPCMMInfo.GetDataListByEquipmantAndFileIDAndDevice(ttbEquip.Text, data.ItemName1, data.ItemName2, data.ItemName3, deviceName); //以OP1機台名稱檢查是否有檢驗結果資料 var CSTWIPCMMListBySEquipment = CSTWIPCMMInfo.GetDataListByEquipmantAndFileIDAndDevice(data.ItemName5, data.ItemName1, data.ItemName2, data.ItemName3, deviceName); //將二組資料合併,去除重覆資料 CSTWIPCMMListBySEquipment.ForEach(WIPCMMdata => { if (CSTWIPCMMListByEquipment.Contains(WIPCMMdata) == false) { CSTWIPCMMListByEquipment.Add(WIPCMMdata); } }); if (CSTWIPCMMListByEquipment.Count == 0) { //PPK 檢驗工件未到齊,無法執行 PPK 判定! throw new Exception(RuleMessage.Error.C10118()); } //再將找到的資料合併,去除重覆資料 CSTWIPCMMListByEquipment.ForEach(WIPCMMdata => { //將[QC_INSP_SID]寫到每一筆檢驗機台資料 WIPCMMdata.QCInspectionSID = data.QC_INSP_SID; if (_CSTWIPCMMList.Contains(WIPCMMdata) == false) { _CSTWIPCMMList.Add(WIPCMMdata); } }); }); } else { //以機台名稱檢查是否有檢驗結果資料 var CSTWIPCMMListByEquipment = CSTWIPCMMInfo.GetDataListByEquipmantAndDevice(ttbEquip.Text, deviceName); if (CSTWIPCMMListByEquipment.Count == 0) { //PPK 檢驗工件未到齊,無法執行 PPK 判定! throw new Exception(RuleMessage.Error.C10118()); } _QCInspectionObjDataList.ForEach(data => { //以OP1機台名稱檢查是否有檢驗結果資料 var CSTWIPCMMListBySEquipment = CSTWIPCMMInfo.GetDataListByEquipmantAndDevice(data.ItemName5, deviceName); //將二組資料合併,去除重覆資料 CSTWIPCMMListBySEquipment.ForEach(WIPCMMdata => { if (CSTWIPCMMListByEquipment.Contains(WIPCMMdata) == false) { CSTWIPCMMListByEquipment.Add(WIPCMMdata); } }); }); //重新依據[FILEID], [SN], [SEQUENCE]執行排序 _CSTWIPCMMList = CSTWIPCMMListByEquipment.OrderBy(data => data.FileID).ThenBy(data => data["SN"]).ToList(); #region 確認檢驗結果主檔筆數是否與檢驗單明細筆數相同 List <NoSNData> NoSNDataList = new List <NoSNData>(); _CSTWIPCMMList.ForEach(data => { NoSNData tempNoSNData = new NoSNData(); tempNoSNData.SN = data["SN"].ToCimesString(); tempNoSNData.FileID = data.FileID; if (NoSNDataList.Contains(tempNoSNData) == false) { NoSNDataList.Add(tempNoSNData); } }); //比對檢驗結果主檔筆數是否與檢驗單明細筆數相同 if (NoSNDataList.Count != _QCInspectionObjDataList.Count) { //檢驗結果主檔筆數({0})與檢驗單明細筆數({1})不相同 throw new Exception(RuleMessage.Error.C10112(NoSNDataList.Count().ToString(), _QCInspectionObjDataList.Count.ToString())); } #endregion for (int i = 0; i < NoSNDataList.Count; i++) { string QCInspectionSID = _QCInspectionObjDataList[i].QC_INSP_OBJ_SID; _CSTWIPCMMList.ForEach(data => { if (data.FileID == NoSNDataList[i].FileID && data["SN"].ToCimesString() == NoSNDataList[i].SN) { //將[QC_INSP_SID]寫到每一筆檢驗機台資料 data.QCInspectionSID = QCInspectionSID; } }); } } //加入機台檢驗檔名稱 _CSTWIPCMMList.ForEach(WIPCMMdata => { ddlFileName.Items.Add(new ListItem(WIPCMMdata["FILENAME"].ToString(), WIPCMMdata.ID)); }); if (ddlFileName.Items.Count > 0) { ddlFileName.Items.Insert(0, ""); } gvQC.SetDataSource(_QCInspectionObjDataList, true); #endregion #region 設置原因碼 //清除原因碼資料 ddlPPKReasonCode.Items.Clear(); rdbNG.Enabled = false; rdbOK.Enabled = false; rdbNG.Enabled = true; rdbOK.Enabled = true; //取得原因碼清單 List <BusinessReason> reason = ReasonCategoryInfo.GetOperationRuleCategoryReasonsWithReasonDescr(ProgramRight, "ALL", "Default", ReasonMode.Category); if (reason.Count > 0) { ddlPPKReasonCode.DataSource = reason; ddlPPKReasonCode.DataTextField = "ReasonDescription"; ddlPPKReasonCode.DataValueField = "ReasonCategorySID"; ddlPPKReasonCode.DataBind(); if (ddlPPKReasonCode.Items.Count != 1) { ddlPPKReasonCode.Items.Insert(0, ""); } else { ddlPPKReasonCode.SelectedIndex = 0; } } else { //[00641]規則:{0} 工作站:{1} 使用的原因碼未設定,請洽IT人員! throw new Exception(TextMessage.Error.T00641(ProgramRight, "ALL")); } #endregion btnOK.Enabled = true; } } catch (Exception ex) { //清除資料 ddlFileName.Items.Clear(); ddlPPKReasonCode.Items.Clear(); _CSTWIPCMMList = new List <CSTWIPCMMInfo>(); _QCInspectionObjDataList.Clear(); gvQC.SetDataSource(_QCInspectionObjDataList, true); _CSTWIPCMMDataList = new List <CSTWIPCMMDataInfo>(); gvInspectionData.SetDataSource(_CSTWIPCMMDataList, true); btnOK.Enabled = false; AjaxFocus(ddlDevice); HandleError(ex); } }
/// <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); } }