Пример #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);

                //檢查維修原因是否有選擇
                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);
            }
        }
Пример #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);

                //確認是否有選擇送待判原因
                ddlJudgeDefect.Must(lblJudgeDefect);

                #region 檢查判定結果是否有選擇
                if (rdbGoods.Checked == false && rdbRepair.Checked == false && rdbDefectInv.Checked == false && rdbScrapInv.Checked == false)
                {
                    throw new Exception(TextMessage.Error.T00841(lblJudgeResult.Text));
                }
                #endregion

                //檢查判定原因是否有選擇
                ddlJudgeReason.Must(lblJudgeReason);

                using (var cts = CimesTransactionScope.Create())
                {
                    #region 依照選擇的判定結果,對批號進行不同的處置

                    //選取的判定結果
                    string result = "";

                    //選取的原因碼
                    var reasonCategory = InfoCenter.GetBySID <ReasonCategoryInfo>(ddlJudgeReason.SelectedValue);

                    #region 良品:依照批號的UDC02(工作站序號)+UDC03(工作站名稱)找出預設流程的下一站點,將批號跳站至該站
                    if (rdbGoods.Checked)
                    {
                        result = "Good";

                        //取得流程線上版本 取得目前Lot的所有流程(所有工作站)
                        RouteVersionInfo RouteVersion = RouteVersionInfo.GetRouteActiveVersion(_LotData.RouteName);

                        //取得設定包裝工作站名稱
                        var packingOperation = WpcExClassItemInfo.GetExtendItemListByClassAndRemarks("SAIPackingOperation");
                        if (packingOperation.Count == 0)
                        {
                            //T00555:查無資料,請至系統資料維護新增類別{0}、項目{1}!
                            throw new CimesException(TextMessage.Error.T00555("SAIPackingOperation", ""));
                        }

                        var reassignOperation = packingOperation[0];

                        //如果送待判站之前記錄的是包裝站,則直接跳至包裝站,反之,跳至下一站
                        if (reassignOperation.Remark01 == _LotData.UserDefineColumn03)
                        {
                            //取得包裝站名稱
                            string qcOperationName = reassignOperation.Remark01;

                            //取得包裝工作站資訊
                            var operation = OperationInfo.GetOperationByName(qcOperationName);
                            if (operation == null)
                            {
                                //T00171, 工作站:{0}不存在!!
                                throw new CimesException(TextMessage.Error.T00171(qcOperationName));
                            }
                            //根據指定的流程名稱、流程版本、工作站名稱, 找出第一個符合的流程工作站,新的站點包裝
                            var newOperation = RouteOperationInfo.GetRouteOperationByOperationName(_LotData.RouteName, _LotData.RouteVersion, qcOperationName);

                            //將批號的UDC02清空
                            WIPTransaction.ModifyLotSystemAttribute(_LotData, "USERDEFINECOL02", "", txnStamp);

                            //將批號的UDC03清空
                            WIPTransaction.ModifyLotSystemAttribute(_LotData, "USERDEFINECOL03", "", txnStamp);

                            //變更至指定工作站
                            WIPTransaction.ReassignOperation(_LotData, newOperation, reasonCategory, ttbJudgeDescr.Text, txnStamp);
                        }
                        else
                        {
                            //以此工作站名稱去查詢在流程中的序號
                            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.ReassignOperation(_LotData, NextRouteOperation, reasonCategory, ttbJudgeDescr.Text, txnStamp);
                        }
                    }
                    #endregion

                    #region 維修:紀錄維修及將批號派送至下一規則
                    if (rdbRepair.Checked)
                    {
                        result = "Repair";

                        List <WIPRepairInfo> repairDatas = new List <WIPRepairInfo>();

                        var componentData = ComponentInfoEx.GetDataByCurrentLot(_LotData.Lot)[0];
                        var repairData    = WIPRepairInfo.CreateInfo(_LotData, componentData, componentData.ComponentQuantity, reasonCategory, _LotData.OperationName, _LotData.ResourceName, string.Empty, string.Empty);
                        repairDatas.Add(repairData);

                        var issueOperation = OperationInfo.GetOperationByName(_LotData.OperationName);

                        WIPTransaction.RepairAdd(_LotData, repairDatas, issueOperation, txnStamp);
                        WIPTransaction.DispatchLot(_LotData, txnStamp);
                    }
                    #endregion

                    #region  良品入庫:將批號狀態變更為DefectInv
                    if (rdbDefectInv.Checked)
                    {
                        result = "DefectInv";
                        WIPTransaction.ModifyLotSystemAttribute(_LotData, "STATUS", "DefectInv", txnStamp);
                    }
                    #endregion

                    #region 報廢品入庫:將批號狀態變更為ScrapInv
                    if (rdbScrapInv.Checked)
                    {
                        result = "ScrapInv";
                        WIPTransaction.ModifyLotSystemAttribute(_LotData, "STATUS", "ScrapInv", txnStamp);
                    }
                    #endregion

                    #endregion

                    #region 將判定結果紀錄在CST_WIP_DEFECT_JUDGEMENT,Result:良品(Goods)、維修(Repair)、不良品入庫(DefectInv)、報廢入庫(ScrapInv)

                    var insertData = InfoCenter.Create <CSTWIPDefectJudgementInfo>();

                    insertData.WIPDefectSID      = _LotDefectData.DefectSID;
                    insertData["REASONCATEGORY"] = reasonCategory.Category;
                    insertData["LOT"]            = _LotData.Lot;
                    insertData.Reason            = reasonCategory.Reason;
                    insertData.Result            = result;
                    insertData.Description       = ttbJudgeDescr.Text;
                    insertData.LinkSID           = WIPHistoryInfo.GetLotFirstHistory(_LotData.Lot).LinkSID;

                    insertData.InsertToDB(txnStamp.UserID, txnStamp.RecordTime);

                    #endregion

                    cts.Complete();
                }

                ttbLot.Text = "";

                ClearField();
                AjaxFocus(ttbLot);

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