Exemplo n.º 1
0
        public static void CloseLot(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");
            T_R_LOT_STATUS   tRLotStatus = new T_R_LOT_STATUS(Station.SFCDB, Station.DBType);
            Row_R_LOT_STATUS r           = tRLotStatus.GetByLotNo(Dis_LotNo.Value.ToString(), Station.SFCDB);

            if (r == null || !r.CLOSED_FLAG.Equals("0"))
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180528103627", new string[] { Dis_LotNo.Value.ToString() }));
            }
            try
            {
                r.CLOSED_FLAG = "1";
                r.EDIT_EMP    = Station.LoginUser.EMP_NO;
                Station.SFCDB.ThrowSqlExeception = true;
                r.EDIT_TIME = tRLotStatus.GetDBDateTime(Station.SFCDB);
                Station.SFCDB.ExecSQL(r.GetUpdateString(Station.DBType));
            }
            catch (Exception e)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180528105826", new string[] { Dis_LotNo.Value.ToString(), e.Message }));
            }
            finally { Station.SFCDB.ThrowSqlExeception = false; }
            #region 清空界面信息
            Station.StationSession.Clear();
            Station.Inputs.Find(t => t.DisplayName == Paras[0].SESSION_TYPE).DataForUse.Clear();
            #endregion
        }
Exemplo n.º 2
0
        public static void SmtSkuFromWODataCheck(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 3)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            //加載SKUSavePoint位置
            MESStationSession SkuSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (SkuSession == null)
            {
                SkuSession = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(SkuSession);
            }
            //加載WoLoadPoint
            MESStationSession WOSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (WOSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE }));
                // throw new Exception("WO參數不存在!");
            }

            WorkOrder WOObject = (WorkOrder)WOSession.Value;

            //WOObject.SkuNO

            SKU sku = new SKU();

            try
            {
                MESDBHelper.OleExec ole = Station.SFCDB;
                sku = sku.Init(WOObject.SkuNO, ole, MESDataObject.DB_TYPE_ENUM.Oracle);

                MESStationSession SessionSN    = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY);
                DisplayOutPut     CurrentSkuno = Station.DisplayOutput.Find(t => t.Name == "SKUNO");
                //SN機種與當前操作機種不一致卡住
                if (CurrentSkuno.Value != null && CurrentSkuno.Value.ToString().Trim().Length > 0 && !sku.SkuNo.Equals(CurrentSkuno.Value.ToString()))
                {
                    string ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000235", new string[] { SessionSN.Value.ToString(), sku.SkuNo, CurrentSkuno.Value.ToString() });
                    throw new MESReturnMessage(ErrMessage);
                }

                SkuSession.Value = sku;
                Station.AddMessage("MES00000029", new string[] { "Skuno", sku.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            catch (Exception e)
            {
                Station.AddMessage("MES00000007", new string[] { "Skuno" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Fail);
                throw e;
            }
        }
Exemplo n.º 3
0
        public static void CloseLot(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");
            MESStationInput  Level       = Station.Inputs.Find(t => t.DisplayName == "AQLLEVEL");
            T_R_LOT_STATUS   tRLotStatus = new T_R_LOT_STATUS(Station.SFCDB, Station.DBType);
            Row_R_LOT_STATUS r           = tRLotStatus.GetByLotNo(Dis_LotNo.Value.ToString(), Station.SFCDB);

            if (r.LOT_NO == null || !r.CLOSED_FLAG.Equals("0"))
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180528103627", new string[] { Dis_LotNo.Value.ToString() }));
            }
            try
            {
                //根據關閉時的AQL更新LotStatus
                T_C_AQLTYPE      tCAqlType    = new T_C_AQLTYPE(Station.SFCDB, Station.DBType);
                List <C_AQLTYPE> cAqlTypeList = tCAqlType.GetAqlTypeBySkunoAndLevel(r.SKUNO, Level.Value.ToString(), Station.SFCDB);

                r.REJECT_QTY  = cAqlTypeList.Where(t => t.LOT_QTY > r.LOT_QTY).OrderBy(t => t.LOT_QTY).Take(1).ToList <C_AQLTYPE>()[0].REJECT_QTY;
                r.SAMPLE_QTY  = cAqlTypeList.Where(t => t.LOT_QTY > r.LOT_QTY).OrderBy(t => t.LOT_QTY).Take(1).ToList <C_AQLTYPE>()[0].SAMPLE_QTY;
                r.SAMPLE_QTY  = r.SAMPLE_QTY > r.LOT_QTY ? r.LOT_QTY : r.SAMPLE_QTY;
                r.CLOSED_FLAG = "1";
                r.AQL_LEVEL   = Level.Value.ToString();
                r.EDIT_EMP    = Station.LoginUser.EMP_NO;
                Station.SFCDB.ThrowSqlExeception = true;
                r.EDIT_TIME = tRLotStatus.GetDBDateTime(Station.SFCDB);
                Station.SFCDB.ExecSQL(r.GetUpdateString(Station.DBType));
            }
            catch (Exception e)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180528105826", new string[] { Dis_LotNo.Value.ToString(), e.Message }));
            }
            finally { Station.SFCDB.ThrowSqlExeception = false; }
            #region 清空界面信息
            Station.StationSession.Clear();
            Station.Inputs.Find(t => t.DisplayName == Paras[0].SESSION_TYPE).DataForUse.Clear();
            Station.Inputs.Find(t => t.DisplayName == "AQLLEVEL").DataForUse.Clear();
            #endregion
        }
Exemplo n.º 4
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
        }
Exemplo n.º 5
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
        }