Beispiel #1
0
        public static void AutoMerge(string invLot, TransactionStamp txs, ReasonCategoryInfo reasonCategory)
        {
            //找到相同的INVLot的序號
            var lots = LotInfoEx.GetLotListByInvertoryLot(invLot);
            //排除送過NG的序號
            var autoMergeLots = lots.FindAll(p => p.UserDefineColumn01.IsNullOrTrimEmpty());

            //利用小工單號確認是否還有QC未檢驗的資料(包含FAI、PQC、PPK)
            //只要有一張未檢,則代表檢驗未完成,回傳false,反之
            var qcFlag = CheckQCInspectionDone(lots[0].WorkOrderLot);

            //檢查數量是否可以做AUTOMERGE
            var waitMergeLots = autoMergeLots.FindAll(p => p.Status == "WaitMerge");

            if (waitMergeLots.Count == autoMergeLots.Count && qcFlag)
            {
                var customizeFunction = new CustomizeFunction();
                //取得命名規則
                //var naming = customizeFunction.GetNamingRule("SplitLot", txs.UserID, autoMergeLots[0], null);
                //拆批
                var split = SplitLotInfo.CreateSplitLotByLotAndQuantity(autoMergeLots[0].Lot, autoMergeLots[0].WorkOrderLot, 0, 0, txs.CategoryReasonCode, txs.Description);
                //母批不做結批
                var splitIndicator = WIPTxn.SplitIndicator.Create(null, null, null, TerminateBehavior.NoTerminate);
                WIPTxn.Default.SplitLot(autoMergeLots[0], split, splitIndicator, txs);
                //更新命名規則
                //if (naming.Second.Count > 0)
                //{
                //    DBCenter.ExecuteSQL(naming.Second);
                //}
                //再取一次批號資訊
                var newLot = LotInfo.GetLotByLot(split.Lot);
                //併批與子單元
                List <MergeLotInfo> mergeLotList = new List <MergeLotInfo>();
                waitMergeLots.ForEach(mergelot =>
                {
                    var compData = ComponentInfo.GetComponentByComponentID(mergelot.ComponentLot);
                    var mergeLot = MergeLotInfo.GetMergeLotByLotAndQuantity(mergelot.Lot, new List <ComponentInfo>()
                    {
                        compData
                    }, reasonCategory, txs.Description);
                    mergeLotList.Add(mergeLot);
                });
                WIPTransaction.MergeLot(newLot, mergeLotList, txs);
                //再取一次批號資訊
                var newMergeLot = LotInfo.GetLotByLot(split.Lot);

                //將批號狀態變更為wait
                WIPTransaction.ModifyLotSystemAttribute(newMergeLot, "STATUS", LotDefaultStatus.Wait.ToCimesString(), txs);
                //將COMPLOT、PROCESS_EQUIP欄位清空,因為這個時間點這個欄位已經沒意義了
                WIPTransaction.ModifyLotSystemAttribute(newMergeLot, "COMPLOT", string.Empty, txs);
                WIPTransaction.ModifyLotSystemAttribute(newMergeLot, "PROCESS_EQUIP", string.Empty, txs);

                //Dispatch到下一站
                WIPTransaction.DispatchLot(newMergeLot, txs);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 判定NG直接拆批及送待判工作站
        /// </summary>
        /// <param name="componentID">工件序號</param>
        /// <param name="defectDescription">不良說明</param>
        /// <param name="reasonData">待判原因碼</param>
        /// <param name="txnStamp"></param>
        public static void SplitDefectLot(string componentID, string defectDescription, ReasonCategoryInfo reasonData, TransactionStamp txnStamp)
        {
            //待判工作站點名稱
            string judgeOperationName = "";

            //取得批號子單元資訊
            var component = ComponentInfo.GetComponentByComponentID(componentID);

            //取得批號資料
            var txnLotData = LotInfo.GetLotByLot(component.CurrentLot).ChangeTo <LotInfoEx>();

            //在系統資料維護裡,取得此批號對應製程(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;

            //取得不良子批批號名稱
            var splitLotNaming = CustomizeFunction.GetNamingRule("SplitLot", txnStamp.UserID, 1, 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, defectDescription);

            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");

            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
        }