示例#1
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                // 子單元不存在拋錯
                if (ComponentInfo == null)
                {
                    throw new RuleCimesException(TextMessage.Error.T00045(GetUIResource("Component")));
                }
                // 批號不存在拋錯
                if (ProcessLotData == null)
                {
                    throw new RuleCimesException(TextMessage.Error.T00045(GetUIResource("Lot")));
                }
                // 定義交易戳記
                var txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);
                using (var cts = CimesTransactionScope.Create())
                {
                    bool inSpec = true;
                    if (_CenterHoleFlag != "N")
                    {
                        gvComponentEDC.Rows.LoopDo <GridViewRow>((p, i) => {
                            // 取得TextBox Control
                            var ttbEDC = p.FindControl("ttbEDC") as TextBox;
                            if (ttbEDC.Text.IsNullOrEmpty())
                            {
                                throw new RuleCimesException(TextMessage.Error.T00043(GetUIResource("CenterHoleData")));
                            }
                            // 是否符合規格判斷
                            var measureVal = ttbEDC.Text.ToDecimal();
                            if (measureVal > SAICenterHole.Remark02.ToDecimal())
                            {
                                inSpec = false;
                            }

                            if (measureVal < SAICenterHole.Remark03.ToDecimal())
                            {
                                inSpec = false;
                            }
                            // 將量測資料記錄到客製表
                            var edcCompInfo              = InfoCenter.Create <CSTEDCComponentInfo>();
                            edcCompInfo.ComponentID      = ComponentInfo.ComponentID;
                            edcCompInfo.Data             = measureVal;
                            edcCompInfo.UpSpecification  = SAICenterHole.Remark02.ToDecimal();
                            edcCompInfo.LowSpecification = SAICenterHole.Remark03.ToDecimal();
                            edcCompInfo.INSPEC           = inSpec == true ? "OK" : "NG";
                            edcCompInfo.Lot              = ProcessLotData.Lot;
                            edcCompInfo["LINKSID"]       = txnStamp.LinkSID;
                            edcCompInfo["PARAMETER"]     = "SC" + (i + 1).ToString();
                            edcCompInfo.InsertToDB(txnStamp.UserID, txnStamp.RecordTime);
                        });
                    }

                    if (!ttbTemperature.Text.IsNullOrEmpty())
                    {
                        // 溫度必須是數值
                        ttbTemperature.MustDecimal(lblTemperature);
                        // 將量測資料記錄到客製表
                        var edcCompInfo = InfoCenter.Create <CSTEDCComponentInfo>();
                        edcCompInfo.ComponentID  = ComponentInfo.ComponentID;
                        edcCompInfo.Data         = ttbTemperature.Text.ToDecimal();
                        edcCompInfo.Lot          = ProcessLotData.Lot;
                        edcCompInfo["LINKSID"]   = txnStamp.LinkSID;
                        edcCompInfo["PARAMETER"] = "Temperature";
                        edcCompInfo.InsertToDB(txnStamp.UserID, txnStamp.RecordTime);
                    }

                    var lstCompAttr = new List <ModifyAttributeInfo>();
                    // 紀錄子單元量測時間
                    lstCompAttr.Add(ModifyAttributeInfo.CreateSystemAttributeInfo("CENTER_HOLE_TIME", txnStamp.RecordTime));
                    lstCompAttr.Add(ModifyAttributeInfo.CreateSystemAttributeInfo("DMC", ttbWorkpiece.Text.Trim()));
                    if (inSpec)
                    {
                        // 修改子單元系統屬性
                        lstCompAttr.Add(ModifyAttributeInfo.CreateSystemAttributeInfo("CENTER_HOLE_FLAG", "OK"));
                        WIPTransaction.ModifyLotComponentMultipleAttribute(ProcessLotData, ComponentInfo, lstCompAttr, txnStamp);
                    }
                    else
                    {
                        // 修改子單元系統屬性
                        lstCompAttr.Add(ModifyAttributeInfo.CreateSystemAttributeInfo("CENTER_HOLE_FLAG", "NG"));
                        WIPTransaction.ModifyLotComponentMultipleAttribute(ProcessLotData, ComponentInfo, lstCompAttr, txnStamp);

                        #region 若不在規格範圍內則拆批至待判站點
                        var                  lstSourceLot         = new List <LotInfo>();
                        List <SqlAgent>      splitLotArchiSQLList = new List <SqlAgent>();
                        List <ComponentInfo> lsComponentDatas     = new List <ComponentInfo>();
                        lsComponentDatas.Add(ComponentInfo);

                        var generator = NamingIDGenerator.GetRule("SplitLot");
                        if (generator == null)
                        {
                            //WRN-00411,找不到可產生的序號,請至命名規則維護設定,規則名稱:{0}!!!
                            throw new Exception(TextMessage.Error.T00437("SplitLot"));
                        }
                        var serialData = generator.GenerateNextIDs(1, ProcessLotData, new string[] { }, User.Identity.Name);
                        splitLotArchiSQLList = serialData.Second;
                        var splitLotID = serialData.First[0];

                        var          reasonCategoryInfo = ReasonCategoryInfo.GetReasonCategoryByCategoryNameAndReason("Common", "OTHER");
                        SplitLotInfo splitLotData       = SplitLotInfo.CreateSplitLotByLotAndQuantity(ProcessLotData.Lot, splitLotID, lsComponentDatas, reasonCategoryInfo, "EDC");

                        WIPTxn.SplitIndicator splitInd = WIPTxn.SplitIndicator.Create();
                        WIPTxn.Default.SplitLot(ProcessLotData, splitLotData, splitInd, txnStamp);

                        //若子單元為自動產生,更新序號至DB
                        if (splitLotArchiSQLList != null && splitLotArchiSQLList.Count > 0)
                        {
                            DBCenter.ExecuteSQL(splitLotArchiSQLList);
                        }
                        #endregion

                        var splitLotInfo = LotInfo.GetLotByLot(splitLotID);

                        // 新增Defect
                        List <ComponentDefectObject> lstCompDefectObj = new List <ComponentDefectObject>();
                        var reason = ReasonCategoryInfo.GetReasonCategoryByCategoryNameAndReason("CustomizeReason", "MeasureNG_MES");
                        lstCompDefectObj.Add(ComponentDefectObject.Create(ComponentInfo, 1, 0, reason, "CENTER_HOLE_FLAG:NG"));
                        WIPTransaction.DefectComponent(splitLotInfo, lstCompDefectObj, WIPTransaction.DefectIndicator.Create(), txnStamp);

                        #region ReassignOperation
                        // 取得待判站點設定
                        var saiJudgeOperation = WpcExClassItemInfo.GetExClassItemInfo("SAIJudgeOperation", splitLotInfo["PROCESS"].ToString());
                        if (saiJudgeOperation.Count == 0)
                        {
                            throw new RuleCimesException(TextMessage.Error.T00555("SAIJudgeOperation", splitLotInfo["PROCESS"].ToString()));
                        }
                        var reassignOperationInfo = RouteOperationInfo.GetLotAllRouteOperations(splitLotInfo).Find(oper => oper.OperationName == saiJudgeOperation[0].Remark02);
                        if (reassignOperationInfo == null)
                        {
                            throw new RuleCimesException(RuleMessage.Error.C10050());
                        }

                        var lstLotAttr = new List <ModifyLotAttributeInfo>();
                        // 修改批號系統屬性
                        lstLotAttr.Add(ModifyLotAttributeInfo.CreateLotSystemAttributeInfo("USERDEFINECOL01", "Y"));
                        lstLotAttr.Add(ModifyLotAttributeInfo.CreateLotSystemAttributeInfo("USERDEFINECOL02", splitLotInfo.OperationSequence));
                        lstLotAttr.Add(ModifyLotAttributeInfo.CreateLotSystemAttributeInfo("USERDEFINECOL03", splitLotInfo.OperationName));
                        WIPTransaction.ModifyLotMultipleAttribute(splitLotInfo, lstLotAttr, txnStamp);
                        WIPTransaction.ReassignOperation(splitLotInfo, reassignOperationInfo, reasonCategoryInfo, "EDCSplitReassignOperation", txnStamp);
                        WIPTransaction.ResetLotRule(splitLotInfo, txnStamp);
                        #endregion
                    }
                    cts.Complete();
                }

                ClearUI();
                AjaxFocus(ttbWorkpiece);
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
示例#2
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                // 子單元不存在拋錯
                if (_ComponentInfo == null)
                {
                    throw new RuleCimesException(TextMessage.Error.T00045(GetUIResource("Component")));
                }
                // 批號不存在拋錯
                if (ProcessLotData == null)
                {
                    throw new RuleCimesException(TextMessage.Error.T00045(GetUIResource("Lot")));
                }
                //  批號狀態必須為Wait
                if (ProcessLotData.Status != "Wait")
                {
                    throw new RuleCimesException(TextMessage.Error.T00424());
                }
                // 原因碼
                ddlDefectReason.Must(lblDefectReason);

                var txnStamp = new TransactionStamp(User.Identity.Name, ProgramRight, ProgramRight, ApplicationName);
                using (var cts = CimesTransactionScope.Create())
                {
                    //取得原因碼資訊
                    var reasonData = InfoCenter.GetBySID <ReasonCategoryInfo>(ddlDefectReason.SelectedValue);

                    //取得不良子批批號名稱
                    var splitLotNaming = GetNamingRule("SplitLot", txnStamp.UserID, ProcessLotData);

                    //批號拆子批
                    var splitLot = SplitLotInfo.CreateSplitLotByLotAndQuantity(ProcessLotData.Lot, splitLotNaming.First[0], new List <ComponentInfo>()
                    {
                        _ComponentInfo
                    }, reasonData, reasonData.Description);
                    WIPTxn.Default.SplitLot(ProcessLotData, splitLot, WIPTxn.SplitIndicator.Create(), txnStamp);

                    if (splitLotNaming.Second != null && splitLotNaming.Second.Count != 0)
                    {
                        DBCenter.ExecuteSQL(splitLotNaming.Second);
                    }

                    //註記不良
                    var compDefect = ComponentDefectObject.Create(_ComponentInfo, _ComponentInfo.ComponentQuantity, 0, reasonData, ttbDefectDesc.Text.Trim());
                    WIPTransaction.DefectComponent(splitLot, new List <ComponentDefectObject>()
                    {
                        compDefect
                    }, WIPTransaction.DefectIndicator.Create(), txnStamp);

                    #region 送至待判工作站

                    //取得目前批號的流程線上版本
                    RouteVersionInfo RouteVersion = RouteVersionInfo.GetRouteActiveVersion(ProcessLotData.RouteName);

                    //以目前工作站名稱去查詢在所有流程中的序號
                    var routeOperation = RouteOperationInfo.GetRouteAllOperations(RouteVersion).Find(p => p.OperationName == _JudgeOperationName);

                    //以目前工作站名稱去查詢在所有流程中的序號
                    var reasonCategory = ReasonCategoryInfo.GetReasonCategoryByCategoryNameAndReason("Common", "OTHER");

                    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

                    cts.Complete();
                }

                LoadDefaultControl();
                ClearField();
                ttbWOLot.Text = "";
                AjaxFocus(ttbWOLot);

                _ProgramInformationBlock.ShowMessage(TextMessage.Hint.T00614(""));
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
示例#3
0
        /// <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
            });
        }