Ejemplo n.º 1
0
        /// <summary>
        /// 檢查Pack狀態是否可以入OBA
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void CheckPackStatusInOba(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            DisplayOutPut     Dis_LotNo   = Station.DisplayOutput.Find(t => t.Name == "LOTNO");
            DisplayOutPut     Dis_SkuNo   = Station.DisplayOutput.Find(t => t.Name == "SKUNO");
            DisplayOutPut     Dis_Ver     = Station.DisplayOutput.Find(t => t.Name == "VER");
            MESStationInput   Level       = Station.Inputs.Find(t => t.DisplayName == "AQLLEVEL");
            MESStationSession packSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            #region 用於界面上顯示的批次信息
            R_LOT_STATUS      rLotStatus   = new R_LOT_STATUS();
            List <R_LOT_PACK> rLotPackList = new List <R_LOT_PACK>();
            List <string>     cAqlLevel    = new List <string>();
            #endregion

            T_R_PACKING t_r_packing = new T_R_PACKING(Station.SFCDB, Station.DBType);
            //add by fgg 2018.6.28 卡棧板是否關閉,避免棧板還沒有關閉就拿去抽檢OBA,導致抽檢總數異常,進而導致OBA抽檢數量不對
            if (!t_r_packing.CheckCloseByPackno(packSession.Value.ToString(), Station.SFCDB))
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180611104338", new string[] { packSession.Value.ToString() }));
            }
            LotNo        LotNo     = new LotNo(Station.DBType);
            T_R_LOT_PACK tRLotPack = new T_R_LOT_PACK(Station.SFCDB, Station.DBType);
            rLotPackList = tRLotPack.GetRLotPackWithWaitClose(Station.SFCDB, packSession.Value.ToString());
            List <R_LOT_STATUS> rLotStatusList = tRLotPack.GetRLotStatusWithWaitClose(Station.SFCDB, packSession.Value.ToString());
            rLotStatus = rLotStatusList.Find(t => t.CLOSED_FLAG == "1");
            if (rLotStatus != null)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180526181007", new string[] { packSession.Value.ToString() }));
            }
            else
            {
                rLotStatus = rLotStatusList.Find(t => t.CLOSED_FLAG == "0");
            }
            if (Dis_LotNo.Value.Equals(""))
            {
                #region 當前Lot為空=>檢查當前Pack無有效LOT?新建LOT:加載LOT;

                if (rLotPackList.Count == 0)
                {
                    rLotStatus =
                        LotNo.CreateLotByPackno(Station.LoginUser, packSession.Value.ToString(), Station.SFCDB);
                    rLotPackList.Add(
                        new R_LOT_PACK()
                    {
                        LOTNO = rLotStatus.LOT_NO, PACKNO = packSession.Value.ToString()
                    });
                }
                else
                {
                    rLotStatus = rLotStatusList.Find(t => t.CLOSED_FLAG == "0");
                }
                #endregion
            }
            else
            {
                #region 當前Lot不為空=>PackNo與當前頁面LOT的機種版本是否一致?ReLoad LOT信息:Throw e;
                T_R_PACKING   tRPacking   = new T_R_PACKING(Station.SFCDB, Station.DBType);
                Row_R_PACKING rowRPacking = tRPacking.GetRPackingByPackNo(Station.SFCDB, packSession.Value.ToString());
                if (!rowRPacking.SKUNO.Equals(Dis_SkuNo.Value.ToString()))
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180526185434", new string[] { packSession.Value.ToString() }));
                }
                if (rLotPackList.Count == 0)
                {
                    rLotStatus = LotNo.ObaInLotByPackno(Station.User, rLotStatus, packSession.Value.ToString(), Level.Value.ToString(), Station.SFCDB);
                    rLotPackList.Add(new R_LOT_PACK()
                    {
                        LOTNO = rLotStatus.LOT_NO, PACKNO = packSession.Value.ToString()
                    });
                }
                else
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180526185618", new string[] { packSession.Value.ToString(), rLotStatus.LOT_NO }));
                }
                #endregion
            }
            #region 加載AQL等級
            T_C_AQLTYPE tCAqlType = new T_C_AQLTYPE(Station.SFCDB, Station.DBType);
            cAqlLevel = tCAqlType.GetAqlLevelByType(rLotStatus.AQL_TYPE, Station.SFCDB);
            T_C_SKU_AQL tCSkuAql = new T_C_SKU_AQL(Station.SFCDB, Station.DBType);
            C_SKU_AQL   cSkuAql  = tCSkuAql.GetSkuAql(Station.SFCDB, rLotStatus.SKUNO);
            #endregion
            #region 加載界面信息
            MESStationSession lotNoSession = new MESStationSession()
            {
                MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input
            };
            MESStationSession skuNoSession = new MESStationSession()
            {
                MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input
            };
            MESStationSession aqlSession = new MESStationSession()
            {
                MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[4].SESSION_KEY, ResetInput = Input
            };
            MESStationSession lotQtySession = new MESStationSession()
            {
                MESDataType = Paras[5].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[5].SESSION_KEY, ResetInput = Input
            };
            MESStationSession sampleQtySession = new MESStationSession()
            {
                MESDataType = Paras[6].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[6].SESSION_KEY, ResetInput = Input
            };
            MESStationSession RejectQtySession = new MESStationSession()
            {
                MESDataType = Paras[7].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[7].SESSION_KEY, ResetInput = Input
            };

            Station.StationSession.Clear();
            Station.StationSession.Add(lotNoSession);
            Station.StationSession.Add(skuNoSession);
            Station.StationSession.Add(aqlSession);
            Station.StationSession.Add(lotQtySession);
            Station.StationSession.Add(sampleQtySession);
            Station.StationSession.Add(RejectQtySession);

            lotNoSession.Value     = rLotStatus.LOT_NO;
            skuNoSession.Value     = rLotStatus.SKUNO;
            aqlSession.Value       = rLotStatus.AQL_TYPE;
            lotQtySession.Value    = rLotStatus.LOT_QTY;
            sampleQtySession.Value = rLotStatus.SAMPLE_QTY;
            RejectQtySession.Value = rLotStatus.REJECT_QTY;

            MESStationInput s = Station.Inputs.Find(t => t.DisplayName == Paras[1].SESSION_TYPE);
            s.DataForUse.Clear();
            foreach (var VARIABLE in rLotPackList)
            {
                s.DataForUse.Add(VARIABLE.PACKNO);
            }

            MESStationInput l = Station.Inputs.Find(t => t.DisplayName == "AQLLEVEL");
            l.DataForUse.Clear();
            foreach (string VARIABLE in cAqlLevel)
            {
                l.DataForUse.Add(VARIABLE);
            }
            //設置默認等級
            l.Value = cSkuAql.DEFAULLEVEL;
            #endregion
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 檢查Pack狀態是否可以入OBA
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void CheckPackStatusInOba(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            DisplayOutPut     Dis_LotNo   = Station.DisplayOutput.Find(t => t.Name == "LOTNO");
            DisplayOutPut     Dis_SkuNo   = Station.DisplayOutput.Find(t => t.Name == "SKUNO");
            DisplayOutPut     Dis_Ver     = Station.DisplayOutput.Find(t => t.Name == "VER");
            MESStationSession packSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            #region 用於界面上顯示的批次信息
            R_LOT_STATUS      rLotStatus   = new R_LOT_STATUS();
            List <R_LOT_PACK> rLotPackList = new List <R_LOT_PACK>();
            #endregion
            LotNo        LotNo     = new LotNo(Station.DBType);
            T_R_LOT_PACK tRLotPack = new T_R_LOT_PACK(Station.SFCDB, Station.DBType);
            rLotPackList = tRLotPack.GetRLotPackWithWaitClose(Station.SFCDB, packSession.Value.ToString());
            List <R_LOT_STATUS> rLotStatusList = tRLotPack.GetRLotStatusWithWaitClose(Station.SFCDB, packSession.Value.ToString());
            rLotStatus = rLotStatusList.Find(t => t.CLOSED_FLAG == "1");
            if (rLotStatus != null)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180526181007", new string[] { packSession.Value.ToString() }));
            }
            else
            {
                rLotStatus = rLotStatusList.Find(t => t.CLOSED_FLAG == "0");
            }
            if (Dis_LotNo.Value.Equals(""))
            {
                #region 當前Lot為空=>檢查當前Pack無有效LOT?新建LOT:加載LOT;
                if (rLotPackList.Count == 0)
                {
                    rLotStatus = LotNo.CreateLotByPackno(Station.LoginUser, packSession.Value.ToString(), Station.SFCDB);
                    rLotPackList.Add(new R_LOT_PACK()
                    {
                        LOTNO = rLotStatus.LOT_NO, PACKNO = packSession.Value.ToString()
                    });
                }
                else
                {
                    rLotStatus = rLotStatusList.Find(t => t.CLOSED_FLAG == "0");
                }
                #endregion
            }
            else
            {
                #region 當前Lot不為空=>PackNo與當前頁面LOT的機種版本是否一致?ReLoad LOT信息:Throw e;
                T_R_PACKING   tRPacking   = new T_R_PACKING(Station.SFCDB, Station.DBType);
                Row_R_PACKING rowRPacking = tRPacking.GetRPackingByPackNo(Station.SFCDB, packSession.Value.ToString());
                if (!rowRPacking.SKUNO.Equals(Dis_SkuNo.Value))
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180526185434", new string[] { packSession.Value.ToString() }));
                }
                if (rLotPackList.Count == 0)
                {
                    rLotStatus = LotNo.ObaInLotByPackno(Station.User, rLotStatus, packSession.Value.ToString(), Station.SFCDB);
                    rLotPackList.Add(new R_LOT_PACK()
                    {
                        LOTNO = rLotStatus.LOT_NO, PACKNO = packSession.Value.ToString()
                    });
                }
                else
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180526185618", new string[] { packSession.Value.ToString(), rLotStatus.LOT_NO }));
                }
                #endregion
            }

            #region 加載界面信息
            MESStationSession lotNoSession = new MESStationSession()
            {
                MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input
            };
            MESStationSession skuNoSession = new MESStationSession()
            {
                MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input
            };
            MESStationSession aqlSession = new MESStationSession()
            {
                MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[4].SESSION_KEY, ResetInput = Input
            };
            MESStationSession lotQtySession = new MESStationSession()
            {
                MESDataType = Paras[5].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[5].SESSION_KEY, ResetInput = Input
            };
            MESStationSession sampleQtySession = new MESStationSession()
            {
                MESDataType = Paras[6].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[6].SESSION_KEY, ResetInput = Input
            };
            MESStationSession RejectQtySession = new MESStationSession()
            {
                MESDataType = Paras[7].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[7].SESSION_KEY, ResetInput = Input
            };

            Station.StationSession.Clear();
            Station.StationSession.Add(lotNoSession);
            Station.StationSession.Add(skuNoSession);
            Station.StationSession.Add(aqlSession);
            Station.StationSession.Add(lotQtySession);
            Station.StationSession.Add(sampleQtySession);
            Station.StationSession.Add(RejectQtySession);

            lotNoSession.Value     = rLotStatus.LOT_NO;
            skuNoSession.Value     = rLotStatus.SKUNO;
            aqlSession.Value       = rLotStatus.AQL_TYPE;
            lotQtySession.Value    = rLotStatus.LOT_QTY;
            sampleQtySession.Value = rLotStatus.SAMPLE_QTY;
            RejectQtySession.Value = rLotStatus.REJECT_QTY;

            MESStationInput s = Station.Inputs.Find(t => t.DisplayName == Paras[1].SESSION_TYPE);
            s.DataForUse.Clear();
            foreach (var VARIABLE in rLotPackList)
            {
                s.DataForUse.Add(VARIABLE.PACKNO);
            }
            #endregion
        }