/// <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); //檢查維修原因是否有選擇 ddlRepairReasonCode.Must(lblJudgeReason); #region 檢查維修結果是否有選擇 if (rdbOK.Checked == false && rdbNG.Checked == false) { throw new Exception(TextMessage.Error.T00841(lblRepairResult.Text)); } #endregion using (var cts = CimesTransactionScope.Create()) { //選取的原因碼 var reasonCategory = InfoCenter.GetBySID <ReasonCategoryInfo>(ddlRepairReasonCode.SelectedValue); #region 紀錄維修結束 To do... List <WIPRepairFinishInfo> repairFinishDatas = new List <WIPRepairFinishInfo>(); var repairData = WIPRepairInfo.GetRepairByLotAndReason(_LotData.Lot, _DefectJudgementData.Reason); var repairFinishData = WIPRepairFinishInfo.CreateInfo(repairData); repairFinishData.ActionCategory = reasonCategory.Category; repairFinishData.ActionReasonCode = reasonCategory.Reason; repairFinishData.ActionReasonSID = reasonCategory.ReasonSID; repairFinishData.Result = rdbOK.Checked ? "OK" : "NG"; repairFinishDatas.Add(repairFinishData); var issueOperation = OperationInfo.GetOperationByName(_LotData.OperationName); WIPTransaction.RepairEnd(_LotData, repairFinishDatas, issueOperation, txnStamp); #endregion #region 2017/10/26 跟詩涵確認,無論維修結果如何,一律送回待判站由品保決定處理結果 /* #region OK:依照批號的UDC02(工作站序號)+UDC03(工作站名稱)找出預設流程的下一站點,將批號跳站至該站 * * if (rdbOK.Checked) * { * //取得流程線上版本 取得目前Lot的所有流程(所有工作站) * RouteVersionInfo RouteVersion = RouteVersionInfo.GetRouteActiveVersion(_LotData.RouteName); * * //以此工作站名稱去查詢在流程中的序號 * var routeOperation = RouteOperationInfo.GetRouteAllOperations(RouteVersion).Find(p => p.OperationName == _LotData.UserDefineColumn03); * * var lastOperationSeq = string.Format("{0:000}", (Convert.ToDecimal(routeOperation.OperationSequence) + 1)); * * //下一個工作站 用LOT和流程中下一站的序號去查出下一個工作站資訊 * var NextRouteOperation = RouteOperationInfo.GetRouteOperationByLotSequence(_LotData, lastOperationSeq); * * if (NextRouteOperation == null) * { * //批號:{0}已無下個工作站點,請確認[流程設定] * throw new Exception(RuleMessage.Error.C10008(_LotData.Lot)); * } * * //將批號的UDC02清空 * WIPTransaction.ModifyLotSystemAttribute(_LotData, "USERDEFINECOL02", "", txnStamp); * * //將批號的UDC03清空 * WIPTransaction.ModifyLotSystemAttribute(_LotData, "USERDEFINECOL03", "", txnStamp); * * //執行出站 * WIPTransaction.CheckOut(_LotData, txnStamp); * * WIPTransaction.ReassignOperation(_LotData, NextRouteOperation, reasonCategory, ttbRepairDescr.Text, txnStamp); * } #endregion * #region NG:送到下一站 * if (rdbNG.Checked) * { * //執行出站 * WIPTransaction.CheckOut(_LotData, txnStamp); * * WIPTransaction.DispatchLot(_LotData, txnStamp); * } #endregion * */ #endregion //執行出站 WIPTransaction.CheckOut(_LotData, txnStamp); WIPTransaction.DispatchLot(_LotData, 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 { /* 1. 如有不良數量,先確認有待判站。 * 2. 待判站找尋方式:到系統資料設定(MES_WPC_EXTENDITEM)裡找尋屬性SAIJudgeOperation,依照process找出待判站的名稱。如找不到要報錯。(找不到待判站資訊,請至系統資料維護增加資訊,屬性:xxxx。) * 拿MES_WIP_LOT_PROCESS 跟系統資料設定裡的REMARK01比對後,找出工作站點(REMARK02) * 3. 將批號出站。(CheckOut) * 4. 將批號下機。(EQPRemoveLot) * 5. 判定機台容量如果為0,將機台狀態變更為IDLE。(ChangeStaus) * 機台容量判定方式:MES_EQP_EQP. CAPACITY = 0。 * 6. 將CST_WIP_RESERVE_CHECKIN_INFO搬移至CST_WIP_RESERVE_CHECKIN_INFO_LOG。 * 資料條件:Lot + Operation * 7. 如有不良數量,拆一個不良批號,將批號送到待判站。(Defect、SplitLot、ReassignOperation) * 8. 將原批號派送至下一規則。(Dispatch) */ TransactionStamp txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName); using (var cts = CimesTransactionScope.Create()) { //取得批號資料 var txnLotData = _LotData; //取得批號上機台資料 var equipmentLotData = EquipmentLotInfo.GetEquipmentLotByLot(txnLotData.Lot); //如果批號上機台是有資料,表示必須執行機台相關的交易 if (equipmentLotData != null) { var newStateInfo = EquipmentStateInfo.GetEquipmentStateByState("IDLE"); var equipment = EquipmentInfo.GetEquipmentByName(txnLotData.ResourceName); if (equipment == null) { //[00885]機台{0}不存在! throw new Exception(TextMessage.Error.T00885(txnLotData.ResourceName)); } //機台移批號 EMSTransaction.RemoveLotFromEquipment(txnLotData, equipment, txnStamp); //確認機台的最大容量是否為零,如果不是,則執行變更機台狀態 if (equipment.Capacity == 0) { //變更機台狀態 Run=>IDLE EMSTransaction.ChangeState(equipment, newStateInfo, txnStamp); } } //更新預約資料 UpdateReserveCheckInData(txnLotData, txnLotData.OperationName, txnStamp); //批號出站 WIPTransaction.CheckOut(txnLotData, txnStamp); //如果有不良數量,則拆號及送待判工作站 if (_DefectGridData != null && _DefectGridData.Count > 0) { SplitDefectLotList(txnLotData, _DefectGridData, txnStamp); } //將批號Dispatch到下一規則 WIPTransaction.DispatchLot(txnLotData, txnStamp); //檢查是否還有預約工作站資料 CheckNextReserveCheckIn(txnLotData, txnStamp); cts.Complete(); } ClearField(); AjaxFocus(ttbLot); _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614("")); } catch (Exception ex) { HandleError(ex); } }