Example #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
        }
Example #2
0
        public static void TEST1(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string SN = SNMaker.SNmaker.GetNextSN("TEST", Station.SFCDB);

            Station.StationMessages.Add(new StationMessage()
            {
                Message = SN, State = StationMessageState.Message
            });
        }
Example #3
0
        public static void SetNextInput(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            MESStationInput input = Station.Inputs.Find(t => t.DisplayName == Paras[0].VALUE.ToString().Trim());

            if (input != null)
            {
                Station.NextInput = input;
            }
        }
Example #4
0
 public static void InputsEnable(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
 {
     for (int i = 0; i < Paras.Count; i++)
     {
         MESStationInput input = Station.Inputs.Find(t => t.DisplayName == Paras[i].VALUE.ToString().Trim());
         if (input != null)
         {
             input.Enable = true;
         }
     }
 }
Example #5
0
        /// <summary>
        /// 檢查工單數據是否存在
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">1個參數,WO保存的位置</param>
        public static void WoDataCheck(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            string ErrMessage = "";

            if (Paras.Count != 1)
            {
                throw new Exception("參數數量不正確!");
            }
            MESStationSession s = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (s == null)
            {
                s = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(s);
            }
            //CHECK  Workorder是否存在
            T_R_WO_BASE   TRWO = new T_R_WO_BASE(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            Row_R_WO_BASE ROWWO;
            string        WO = Input.Value.ToString();

            try
            {
                ROWWO        = TRWO.GetWo(WO, Station.SFCDB);
                s.Value      = WO;
                s.InputValue = Input.Value.ToString();
                s.ResetInput = Input;

                //modify by LLF 2018-02-02
                //Station.AddMessage("MES00000029", new string[] { "Workorder", WO}, MESReturnView.Station.StationMessageState.Message);
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000029", new string[] { "Workorder", WO });
                throw new MESReturnMessage(ErrMessage);
            }
            catch (Exception ex)
            {
                //modify by LLF 2018-02-02
                //ex.InnerException.Message;
                //string msgCode = ex.Message;
                //Station.AddMessage(msgCode, new string[] { "Workorder:" + WO }, StationMessageState.Fail);
                throw new MESReturnMessage(ex.Message);
            }
        }
        /// <summary>
        /// 從輸入加載工單
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">1個參數,WO保存的位置</param>
        public static void WoDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession Swo = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (Swo == null)
            {
                Swo = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(Swo);
            }

            WorkOrder ObjWorkorder = new WorkOrder();
            string    WOSavePoint  = Input.Value.ToString();

            try
            {
                ObjWorkorder.Init(WOSavePoint, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
                if (ObjWorkorder == null)
                {
                    //throw new Exception("Can Not Find " + WOSavePoint + " 'Information ' !");
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000189", new string[] { WOSavePoint }));
                }
                Swo.Value = ObjWorkorder;
                Station.AddMessage("MES00000029", new string[] { "Workorder", WOSavePoint }, MESReturnView.Station.StationMessageState.Pass);
            }
            catch (Exception ex)
            {
                string msgCode = ex.Message;
                throw ex;
            }
        }
Example #7
0
        public static void CartionAndPalletAction(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            OleExec SFCDB = Station.SFCDB;
            string  Run   = "";

            try
            {
                Run = (Station.StationSession.Find(T => T.MESDataType == Paras[0].SESSION_TYPE && T.SessionKey == Paras[0].SESSION_KEY).Value).ToString();
                if (Run.ToUpper() == "FALSE")
                {
                    return;
                }
            }
            catch
            {
            }
            MESStationSession sessionSN = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (sessionSN == null)
            {
                throw new System.Exception("sessionSN miss ");
            }

            MESStationSession sessionCartion = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY);

            if (sessionCartion == null)
            {
                throw new System.Exception("sessionCartion miss ");
            }

            MESStationSession sessionPallet = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY);

            if (sessionPallet == null)
            {
                throw new System.Exception("sessionPallet miss ");
            }

            MESStationSession sessionPrintPL = Station.StationSession.Find(t => t.MESDataType == "ISPRINT_PL" && t.SessionKey == "1");

            if (sessionPrintPL == null)
            {
                sessionPrintPL = new MESStationSession()
                {
                    MESDataType = "ISPRINT_PL", SessionKey = "1", Value = "FALSE"
                };
                Station.StationSession.Add(sessionPrintPL);
            }
            sessionPrintPL.Value = "FALSE";
            MESStationSession sessionPrintCTN = Station.StationSession.Find(t => t.MESDataType == "ISPRINT_CTN" && t.SessionKey == "1");

            if (sessionPrintCTN == null)
            {
                sessionPrintCTN = new MESStationSession()
                {
                    MESDataType = "ISPRINT_CTN", SessionKey = "1", Value = "FALSE"
                };
                Station.StationSession.Add(sessionPrintCTN);
            }
            sessionPrintCTN.Value = "FALSE";

            SN SN = (SN)sessionSN.Value;

            if (SN.isPacked(Station.SFCDB))
            {
                throw new System.Exception($@"{SN.SerialNo} is packed!");
            }

            CartionBase cartion = (CartionBase)sessionCartion.Value;
            PalletBase  Pallet  = (PalletBase)sessionPallet.Value;



            cartion.Add(SN, Station.BU, Station.LoginUser.EMP_NO, Station.SFCDB);

            if (cartion.DATA.MAX_QTY <= cartion.GetCount(Station.SFCDB))
            {
                sessionPrintCTN.Value = "TRUE";
                //設置打印變量
                MESStationSession CTNPrintSession = Station.StationSession.Find(T => T.MESDataType == "PRINT_CTN" && T.SessionKey == "1");
                if (CTNPrintSession == null)
                {
                    CTNPrintSession = new MESStationSession()
                    {
                        MESDataType = "PRINT_CTN", SessionKey = "1"
                    };
                    Station.StationSession.Add(CTNPrintSession);
                }
                CTNPrintSession.Value = cartion.DATA.PACK_NO;
                T_C_PACKING      TCP           = new T_C_PACKING(Station.SFCDB, DB_TYPE_ENUM.Oracle);
                List <C_PACKING> PackConfigs   = TCP.GetPackingBySku(SN.SkuNo, Station.SFCDB);
                C_PACKING        CartionConfig = PackConfigs.Find(T => T.PACK_TYPE == "CARTION");
                C_PACKING        PalletConfig  = PackConfigs.Find(T => T.PACK_TYPE == "PALLET");
                if (CartionConfig == null)
                {
                    throw new Exception("Can't find CartionConfig");
                }
                if (PalletConfig == null)
                {
                    throw new Exception("Can't find PalletConfig");
                }
                if (Pallet.DATA.MAX_QTY <= Pallet.GetCount(Station.SFCDB))
                {
                    sessionPrintPL.Value = "TRUE";
                    //設置打印變量
                    MESStationSession PlPrintSession = Station.StationSession.Find(T => T.MESDataType == "PRINT_PL" && T.SessionKey == "1");
                    if (PlPrintSession == null)
                    {
                        PlPrintSession = new MESStationSession()
                        {
                            MESDataType = "PRINT_PL", SessionKey = "1"
                        };
                        Station.StationSession.Add(PlPrintSession);
                    }
                    PlPrintSession.Value = Pallet.DATA.PACK_NO;

                    Pallet.DATA.CLOSED_FLAG = "1";
                    Pallet.DATA.EDIT_TIME   = DateTime.Now;
                    Pallet.DATA.EDIT_EMP    = Station.LoginUser.EMP_NO;
                    Station.SFCDB.ExecSQL(Pallet.DATA.GetUpdateString(DB_TYPE_ENUM.Oracle));

                    Pallet.DATA = PackingBase.GetNewPacking(PalletConfig, Station.Line, Station.StationName, Station.IP, Station.BU, Station.LoginUser.EMP_NO, Station.SFCDB);
                }
                cartion.DATA.CLOSED_FLAG = "1";
                cartion.DATA.EDIT_TIME   = DateTime.Now;
                cartion.DATA.EDIT_EMP    = Station.LoginUser.EMP_NO;
                Station.SFCDB.ExecSQL(cartion.DATA.GetUpdateString(DB_TYPE_ENUM.Oracle));
                cartion.DATA = PackingBase.GetNewPacking(CartionConfig, Station.Line, Station.StationName, Station.IP, Station.BU, Station.LoginUser.EMP_NO, Station.SFCDB);

                Pallet.Add(cartion, Station.BU, Station.LoginUser.EMP_NO, Station.SFCDB);
            }
            sessionCartion.Value = cartion;
            sessionPallet.Value  = Pallet;

            cartion.DATA.AcceptChange();
            Pallet.DATA.AcceptChange();
        }
Example #8
0
        //計數器初始化
        public static void CounterInitDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession CounterSavePoint = Station.StationSession.Find(t => t.MESDataType == "COUNT" && t.SessionKey == "1");

            if (CounterSavePoint == null)
            {
                CounterSavePoint = new MESStationSession()
                {
                    MESDataType = "COUNT", InputValue = Input.Value.ToString(), SessionKey = "1", ResetInput = Input
                };
                Station.StationSession.Add(CounterSavePoint);
            }
            //CounterSavePoint.Value = Paras.Find(p => p.SESSION_TYPE == "COUNT").VALUE;
            R_Station_Action_Para para = Paras.Where(p => p.SESSION_TYPE == "COUNT").FirstOrDefault();

            if (para == null)
            {
                CounterSavePoint.Value = 0;
            }
            else
            {
                CounterSavePoint.Value = int.Parse(Paras.Where(p => p.SESSION_TYPE == "COUNT").FirstOrDefault().VALUE);
            }
            Station.AddMessage("MES00000029", new string[] { "COUNT", "InitCount" }, MESReturnView.Station.StationMessageState.Pass);
        }
 /// <summary>
 /// 加載輸入的字符串到指定的 MESStationSession
 /// </summary>
 /// <param name="Station"></param>
 /// <param name="Input"></param>
 /// <param name="Paras">
 /// </param>
 public static void InputDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
 {
     if (Paras.Count <= 0)
     {
         throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
     }
     for (int i = 0; i < Paras.Count; i++)
     {
         MESStationSession s = Station.StationSession.Find(t => t.MESDataType == Paras[i].SESSION_TYPE && t.SessionKey == Paras[i].SESSION_KEY);
         if (s == null)
         {
             s = new MESStationSession()
             {
                 MESDataType = Paras[i].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[i].SESSION_KEY, ResetInput = Input
             };
             Station.StationSession.Add(s);
         }
         s.Value      = Input.Value.ToString();
         s.InputValue = Input.Value.ToString();
         s.ResetInput = Input;
         Station.AddMessage("MES00000029", new string[] { Paras[i].SESSION_TYPE, Input.Value.ToString() }, MESReturnView.Station.StationMessageState.Pass);
     }
 }
Example #10
0
        public static void SNSampleFailInfoDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string ErrMessage  = "";
            string StrSn       = "";
            string StrLocation = "";
            string StrFailCode = "";
            string StrFailDesc = "";

            string[] FailInfo = new string[3];
            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }

            //獲取Fail SN
            MESStationSession SNSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (SNSession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            StrSn = SNSession.Value.ToString();

            //獲取FailCode
            MESStationSession FailCodeSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (FailCodeSession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            StrFailCode = FailCodeSession.Value.ToString();

            //獲取Fail Description
            MESStationSession FailDescSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY);

            if (FailDescSession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            StrFailDesc = FailDescSession.Value.ToString();

            //獲取Fail Location
            MESStationSession LocationSession = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY);

            if (LocationSession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[3].SESSION_TYPE + Paras[3].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            StrLocation = LocationSession.Value.ToString();

            MESStationSession FailListSession = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY);

            if (FailListSession == null)
            {
                FailListSession = new MESStationSession()
                {
                    MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[4].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(FailListSession);
            }

            FailInfo[0]           = StrFailCode;
            FailInfo[1]           = StrLocation;
            FailInfo[2]           = StrFailDesc;
            FailListSession.Value = FailInfo;
        }
Example #11
0
        /// <summary>
        /// 從輸入加載C_SECTION信息
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">1個參數,C_SECTION保存的位置</param>
        public static void LoadSectionFromInput(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            string            SectionInput = "";
            MESStationSession strInput     = Station.StationSession.Find(t => t.MESDataType == "StrSavePoint" && t.SessionKey == "1");

            if (strInput == null)
            {
            }
            else
            {
                SectionInput = strInput.Value.ToString();
            }

            string strSql = $@"SELECT * FROM C_SECTION WHERE SECTION_NAME = '{SectionInput.Replace("'", "''")}'";

            OleDbParameter[] paramet = new OleDbParameter[] { new OleDbParameter(":RootCause", SectionInput) };
            DataTable        res     = Station.SFCDB.ExecuteDataTable(strSql, CommandType.Text, paramet);

            if (res.Rows.Count <= 0)
            {
                Station.AddMessage("MES00000007", new string[] { "Section", SectionInput }, MESReturnView.Station.StationMessageState.Fail);
            }
            else
            {
                MESStationSession Section = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
                if (Section == null)
                {
                    Section = new MESStationSession()
                    {
                        MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                    };
                    Station.StationSession.Add(Section);
                }
                Section.Value = SectionInput;
            }
        }
Example #12
0
        /// <summary>
        /// 檢查工單狀態必須Release&Start
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">1個參數,WO保存的位置</param>
        public static void SkuFromWODataChecker(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            string ErrMessage = "";

            if (Paras.Count != 1)
            {
                throw new Exception("參數數量不正確!");
            }

            //marked by ZGJ 2018-03-15
            //單從這個方法的功能上(這個方法的功能定義為檢查工單的狀態,但是方法名卻像是從工單加載機種)看,
            //沒有必要使用 SKU session
            //MESStationSession SKU = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
            //if (SKU == null)
            //{
            //    SKU = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input };
            //    Station.StationSession.Add(SKU);
            //}

            MESStationSession TWO = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (TWO == null)
            {
                TWO = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(TWO);
            }

            //CHECK  Workorder是否Release&Start
            WorkOrder WorkorderInfo = new WorkOrder();
            //string WoNum = TWO.InputValue;
            var obj_wo = TWO.Value;

            //string WoNum = TWO.Value.ToString();
            try
            {
                //add by ZGJ 2018-03-15
                //檢查工單時,之前的步驟中可能就已經把工單實例放在 WO1 中,所以這裡判斷,如果已經是工單實例,
                //那麼就直接賦值,否則進行加載
                if (obj_wo is string)
                {
                    WorkorderInfo.Init(obj_wo.ToString(), Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
                }
                else if (obj_wo is WorkOrder)
                {
                    WorkorderInfo = (WorkOrder)obj_wo;
                }
                //WorkorderInfo.Init(WoNum, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
                if (string.IsNullOrEmpty(WorkorderInfo.CLOSED_FLAG) || WorkorderInfo.CLOSED_FLAG == "1")   //null or 1代表工單已經關閉,0代表工單開啟
                {
                    //Modify by LLF 2018-02-02
                    //Station.AddMessage("MES00000041", new string[] { "WO:" + WorkorderInfo.WorkorderNo }, StationMessageState.Fail);
                    //return;
                    ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000041", new string[] { WorkorderInfo.WorkorderNo });
                    throw new MESReturnMessage(ErrMessage);
                }

                if (WorkorderInfo.RELEASE_DATE == null)
                {
                    //Modify by LLF 2018-02-02
                    //Station.AddMessage("MES00000042", new string[] { "WO:" + WorkorderInfo.WorkorderNo }, StationMessageState.Fail);
                    //return;
                    ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000042", new string[] { WorkorderInfo.WorkorderNo });
                    throw new MESReturnMessage(ErrMessage);
                }
            }
            catch (Exception ex)
            {
                //Modify by LLF 2018-02-02
                //ex.InnerException.Message;
                //string msgCode = ex.Message;
                //Station.AddMessage(msgCode, new string[] { "Workorder:" + WorkorderInfo.WorkorderNo }, StationMessageState.Fail);
                throw new MESReturnMessage(ex.Message);
            }
        }
Example #13
0
        /// <summary>
        /// add by fgg 2018.05.12
        /// 工單類型檢查
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void WOTypeDataChecker(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            OleExec sfcdb = Station.SFCDB;

            if (Paras.Count != 1)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession sessionWO = Station.StationSession.Find(s => s.MESDataType == Paras[0].SESSION_TYPE && s.SessionKey == Paras[0].SESSION_KEY);

            if (sessionWO == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE }));
            }

            try
            {
                WorkOrder objWorkorder = new WorkOrder();
                objWorkorder = (WorkOrder)sessionWO.Value;
                if (objWorkorder.WO_TYPE.Equals("REWORK"))
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000249", new string[] { objWorkorder.WorkorderNo, objWorkorder.WO_TYPE }));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #14
0
        /// <summary>
        /// add by fgg 2018.05.12
        /// 工單投入檢查
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void WOInputDataChecker(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string  stationName = Station.StationName;
            OleExec sfcdb       = Station.SFCDB;

            if (Paras.Count != 4)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession sessionWO = Station.StationSession.Find(s => s.MESDataType == Paras[0].SESSION_TYPE && s.SessionKey == Paras[0].SESSION_KEY);

            if (sessionWO == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE }));
            }

            MESStationSession sessionWOQty = Station.StationSession.Find(s => s.MESDataType == Paras[1].SESSION_TYPE && s.SessionKey == Paras[1].SESSION_TYPE);

            if (sessionWOQty == null)
            {
                sessionWOQty = new MESStationSession()
                {
                    MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(sessionWOQty);
            }

            MESStationSession sessionInputQty = Station.StationSession.Find(s => s.MESDataType == Paras[2].SESSION_TYPE && s.SessionKey == Paras[2].SESSION_TYPE);

            if (sessionInputQty == null)
            {
                sessionInputQty = new MESStationSession()
                {
                    MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(sessionInputQty);
            }

            MESStationSession sessionExtQty = Station.StationSession.Find(s => s.MESDataType == Paras[3].SESSION_TYPE && s.SessionKey == Paras[3].SESSION_TYPE);

            if (sessionExtQty == null)
            {
                sessionExtQty = new MESStationSession()
                {
                    MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(sessionExtQty);
            }

            try
            {
                WorkOrder objWorkorder = new WorkOrder();
                objWorkorder = (WorkOrder)sessionWO.Value;
                //投錯工站
                if (!objWorkorder.START_STATION.Equals(stationName))
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000246", new string[] { stationName, objWorkorder.START_STATION }));
                }
                //工單關節
                if (objWorkorder.CLOSED_FLAG.Equals("1"))
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000100"));
                }
                //已經投滿
                if (objWorkorder.INPUT_QTY >= objWorkorder.WORKORDER_QTY)
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000247", new string[] { objWorkorder.WorkorderNo }));
                }
                sessionWOQty.Value    = objWorkorder.WORKORDER_QTY;
                sessionInputQty.Value = objWorkorder.INPUT_QTY;
                sessionExtQty.Value   = objWorkorder.WORKORDER_QTY - objWorkorder.INPUT_QTY;

                Station.AddMessage("MES00000029", new string[] { "Workorder", objWorkorder.WorkorderNo }, MESReturnView.Station.StationMessageState.Message);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #15
0
        //工單狀態檢查
        public static void WoStateDatachecker(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            ////ADD BY  SDL  20180316
            if (Paras.Count != 1)
            {
                throw new Exception("參數數量不正確!");
            }
            MESStationSession WoLoadPoint = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (WoLoadPoint == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            WorkOrder ObjWO = (WorkOrder)WoLoadPoint.Value;

            ////ADD BY  SDL  20180316
            //CHECK  Workorder是否存在
            string ErrMessage = "";

            T_R_WO_BASE   TRWO = new T_R_WO_BASE(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            Row_R_WO_BASE ROWWO;
            T_R_SN        rSn = new T_R_SN(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            // string WO = Input.Value.ToString();   by sdl  20180316
            string WO = ObjWO.WorkorderNo;

            try
            {
                //List<R_SN> snList = rSn.GetRSNbyWo(WO, Station.SFCDB);
                ROWWO = TRWO.GetWo(WO, Station.SFCDB);
                R_WO_BASE woBase       = ROWWO.GetDataObject();
                WorkOrder ObjWorkorder = new WorkOrder();
                //if (snList!=null)
                //{
                //    foreach (var item in snList)
                //    {
                //        if (woBase.ROUTE_ID != item.ROUTE_ID)
                //        {
                //            //throw new Exception("SN RouteID不唯一!");
                //            ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000167", new string[] { item.SN });
                //            throw new MESReturnMessage(ErrMessage);
                //        }
                //    }
                //}

                if (woBase.CLOSED_FLAG == 1.ToString())
                {
                    // throw new Exception("ClosedFlag=1!");
                    ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000168", new string[] { woBase.WORKORDERNO });
                    throw new MESReturnMessage(ErrMessage);
                }

                if ((woBase.START_STATION == null || woBase.START_STATION == "N/A") && woBase.WO_TYPE == "REWORK")
                {
                    ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000203", new string[] { woBase.WORKORDERNO });
                    throw new MESReturnMessage(ErrMessage);
                }

                if (woBase.FINISHED_QTY > woBase.WORKORDER_QTY)
                {
                    //  throw new Exception("FinishQty>WorkOrderQty!");
                    ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000169", new string[] { woBase.WORKORDERNO });
                    throw new MESReturnMessage(ErrMessage);
                }
                Station.StationSession.Add(WoLoadPoint);
                ObjWorkorder.Init(WO, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
                WoLoadPoint.Value       = ObjWorkorder;
                WoLoadPoint.InputValue  = Input.Value.ToString();
                WoLoadPoint.ResetInput  = Input;
                WoLoadPoint.SessionKey  = "1";
                WoLoadPoint.MESDataType = "WO";
                Station.AddMessage("MES00000029", new string[] { "Workorder", WO }, MESReturnView.Station.StationMessageState.Message);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #16
0
        /// <summary>
        /// 加載FailList
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void SNFailCollectDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string ErrMessage  = "";
            string StrSn       = "";
            string StrLocation = "";
            string StrProcess  = "";
            string StrFailCode = "";
            string StrFailDesc = "";
            Int16  FailCount   = 0;
            List <Dictionary <string, string> > FailList = new List <Dictionary <string, string> >();
            Dictionary <string, string>         FailInfo = null;

            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }

            //獲取Fail SN
            MESStationSession SNSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (SNSession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            //StrSn = SNSession.Value.ToString();
            StrSn = SNSession.InputValue.ToString();

            //獲取Fail Location
            MESStationSession LocationSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (LocationSession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            StrLocation = LocationSession.Value.ToString();

            //獲取Fail Process
            MESStationSession ProcessSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY);

            if (ProcessSession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            StrProcess = ProcessSession.Value.ToString();

            //獲取FailCode
            MESStationSession FailCodeSession = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY);

            if (FailCodeSession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[3].SESSION_TYPE + Paras[3].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            StrFailCode = FailCodeSession.Value.ToString();

            //獲取Fail Description
            MESStationSession FailDescSession = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY);

            if (FailDescSession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[4].SESSION_TYPE + Paras[4].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            StrFailDesc = FailDescSession.Value.ToString();

            MESStationSession FailListSession = Station.StationSession.Find(t => t.MESDataType == Paras[5].SESSION_TYPE && t.SessionKey == Paras[5].SESSION_KEY);

            if (FailListSession == null)
            {
                FailListSession = new MESStationSession()
                {
                    MESDataType = Paras[5].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[5].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(FailListSession);
            }
            else
            {
                FailList = (List <Dictionary <string, string> >)FailListSession.Value;
            }

            FailInfo = new Dictionary <string, string>();
            //FailList=new List<Dictionary<string, string>>();

            foreach (Dictionary <string, string> failure in FailList)
            {
            }

            //            FailList.Select((dic) => {
            //                dic["FailProcess"].Equals(StrProcess) &&
            //dic["FailLocation"].Equals(StrLocation) && dic["FailCode"].Equals(StrFailCode); });

            //add by ZGJ 2018-03-15
            //檢查當前不良信息是否已經存在於已輸入中
            Dictionary <string, string> ExistFailInfo = FailList.Find((dic) => {
                return(dic["FailProcess"].Equals(StrProcess) &&
                       dic["FailLocation"].Equals(StrLocation) &&
                       dic["FailCode"].Equals(StrFailCode));
            });

            if (ExistFailInfo == null)
            {
                FailInfo.Add("FailLocation", StrLocation);
                FailInfo.Add("FailProcess", StrProcess);
                FailInfo.Add("FailDesc", StrFailDesc);
                FailInfo.Add("FailCode", StrFailCode);
                FailList.Add(FailInfo);
                FailListSession.Value = FailList;
            }
            else
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000163", new string[] { StrProcess, StrLocation, StrFailCode });
                throw new MESReturnMessage(ErrMessage);
            }
        }
Example #17
0
        ///Add by LLF 2018-01-28 AOI1&AOI2,Print1&Print2,VI1&VI2  工站可以相互轉換
        public static void ChangeCurrentStationDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            string StrStation       = Paras[0].VALUE.ToString();
            string StrChangeStation = Paras[1].VALUE.ToString();

            MESStationSession NextStationSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY);

            if (NextStationSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }));
            }

            List <string> ListNextStation = new List <string>();

            ListNextStation = (List <string>)NextStationSession.Value;

            if (Station.StationName == StrStation && Station.StationName != StrChangeStation && ListNextStation.Contains(StrChangeStation))
            {
                Station.StationName = StrChangeStation;
            }
            else if (Station.StationName == StrChangeStation && Station.StationName != StrStation && ListNextStation.Contains(StrStation))
            {
                Station.StationName = StrStation;
            }

            Station.AddMessage("MES00000001", new string[] { }, MESReturnView.Station.StationMessageState.Pass);
        }
Example #18
0
 /// <summary>
 /// 加載一個字符串特定格式到指定位置
 /// </summary>
 /// <param name="Station"></param>
 /// <param name="Input"></param>
 /// <param name="Paras">
 /// StrSavePoint:字符串保存位置;
 /// Change:0轉小寫,1轉大寫,2保持不變;
 /// Trim:0不變,1 去前空,2去后空,3前後去空;
 /// </param>
 public static void StringDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
 {
     if (Paras.Count != 3)
     {
         throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
     }
     for (int i = 0; i < Paras.Count; i++)
     {
         if (Paras[i].SESSION_TYPE == "Change")
         {
             if (Paras[i].VALUE == "0")
             {
                 Input.Value = Input.Value.ToString().ToLower();
             }
             else if (Paras[i].VALUE == "1")
             {
                 Input.Value = Input.Value.ToString().ToUpper();
             }
             //else if (Paras[i].VALUE != "0"&& Paras[i].VALUE != "1"&& Paras[i].VALUE != "2")
             //{
             //    Station.AddMessage("MES00000020", new string[] { "SESSION_TYPE为\"Change\"的", "0,1,2" }, MESReturnView.Station.StationMessageState.Fail);
             //}
         }
         else if (Paras[i].SESSION_TYPE == "Trim")
         {
             if (Paras[i].VALUE == "1")
             {
                 Input.Value = Input.Value.ToString().TrimStart();
             }
             else if (Paras[i].VALUE == "2")
             {
                 Input.Value = Input.Value.ToString().TrimEnd();
             }
             else if (Paras[i].VALUE == "3")
             {
                 Input.Value = Input.Value.ToString().Trim();
             }
             //else if (Paras[i].VALUE != "0" && Paras[i].VALUE != "1" && Paras[i].VALUE != "2" && Paras[i].VALUE != "3")
             //{
             //    Station.AddMessage("MES00000020", new string[] { "SESSION_TYPE为\"Trim\"的", "0,1,2,3" }, MESReturnView.Station.StationMessageState.Fail);
             //}
         }
     }
     for (int j = 0; j < Paras.Count; j++)
     {
         if (Paras[j].SESSION_TYPE != "Change" && Paras[j].SESSION_TYPE != "Trim")
         {
             MESStationSession StrInput = Station.StationSession.Find(t => t.MESDataType == Paras[j].SESSION_TYPE && t.SessionKey == Paras[j].SESSION_KEY);
             if (StrInput == null)
             {
                 StrInput = new MESStationSession()
                 {
                     MESDataType = Paras[j].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[j].SESSION_KEY, ResetInput = Input
                 };
                 Station.StationSession.Add(StrInput);
             }
             StrInput.InputValue = Input.Value.ToString();
             StrInput.ResetInput = Input;
             StrInput.Value      = Input.Value.ToString();
             //Station.NextInput = Station.Inputs[0];
             break;
         }
     }
 }
Example #19
0
        /// <summary>
        ///從輸入框加載數據到下拉框
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void InputValueLoaderToSelectList(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string        ErrMessage = "";
            string        strPanel   = "";
            List <string> PackList   = new List <string>();

            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }

            MESStationSession PackNoSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (PackNoSession == null)
            {
                PackNoSession = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                PackNoSession.InputValue = Input.Value.ToString();
                Station.StationSession.Add(PackNoSession);
            }
            strPanel = PackNoSession.InputValue.ToString();

            MESStationSession PackListSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (PackListSession == null)
            {
                PackListSession = new MESStationSession()
                {
                    MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(PackListSession);
            }
            else
            {
                PackList = (List <string>)PackListSession.Value;
            }
            PackList.Add(strPanel);
            PackListSession.Value = PackList;
            MESStationInput s = Station.Inputs.Find(t => t.DisplayName == Paras[1].SESSION_TYPE);

            s.DataForUse.Clear();
            foreach (var VARIABLE in PackList)
            {
                s.DataForUse.Add(VARIABLE);
            }
            Station.Inputs.Find(t => t.DisplayName == Paras[0].SESSION_TYPE).Value = "";
        }
Example #20
0
        /// <summary>
        /// 從輸入加載ActionCode
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input">輸入的ActionCode轉換為大寫</param>
        /// <param name="Paras">ActionCode</param>
        public static void ActionCodeDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            string            ActionCodeInput = "";//Station.StationSession[0].Value.ToString();
            MESStationSession strInput        = Station.StationSession.Find(t => t.MESDataType == "StrSavePoint" && t.SessionKey == "1");

            if (strInput == null)
            {
                //Station.AddMessage("MES00000076", new string[] { "Sn", Sn }, MESReturnView.Station.StationMessageState.Fail);
            }
            else
            {
                ActionCodeInput = strInput.Value.ToString();
            }

            string strSql = $@"SELECT * FROM C_ACTION_CODE WHERE ACTION_CODE = '{ActionCodeInput.Replace("'", "''")}'";

            OleDbParameter[] paramet = new OleDbParameter[] { new OleDbParameter(":ActionCode", ActionCodeInput) };
            DataTable        res     = Station.SFCDB.ExecuteDataTable(strSql, CommandType.Text, paramet);

            if (res.Rows.Count <= 0)
            {
                Station.NextInput = Input;
                Station.AddMessage("MES00000007", new string[] { "ActionCode", ActionCodeInput }, MESReturnView.Station.StationMessageState.Fail);
            }
            else
            {
                MESStationSession ActionCode = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
                if (ActionCode == null)
                {
                    ActionCode = new MESStationSession()
                    {
                        MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                    };
                    Station.StationSession.Add(ActionCode);
                }
                ActionCode.Value = ActionCodeInput;
            }
        }
Example #21
0
        public static void LoginEmpPrivchecker(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                throw new Exception("參數數量不正確!");
            }
            MESStationSession EMP_LoginLoadPoint = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (EMP_LoginLoadPoint == null)
            {
                EMP_LoginLoadPoint = new MESStationSession()
                {
                    MESDataType = "LOGINOUTEMP", InputValue = Input.Value.ToString(), SessionKey = "1", ResetInput = Input
                };
                Station.StationSession.Add(EMP_LoginLoadPoint);
            }

            bool                bPrivilege     = false;
            string              loginUserEmpNo = Input.Value.ToString();
            T_c_user_role       cUserRole      = new T_c_user_role(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            List <get_c_roleid> roleList       = cUserRole.GetRoleID(loginUserEmpNo, Station.SFCDB);
            List <string>       listRoleID     = new List <string>();

            foreach (var item in roleList)
            {
                listRoleID.Add(item.ROLE_ID);
            }
            T_C_ROLE_PRIVILEGE tRolePrivilege = new T_C_ROLE_PRIVILEGE(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            List <c_role_privilegeinfobyemp> privilegeList = new List <c_role_privilegeinfobyemp>();

            foreach (string item in listRoleID)
            {
                List <c_role_privilegeinfobyemp> tempList = tRolePrivilege.QueryRolePrivilege(item, Station.SFCDB);
                privilegeList.AddRange(tempList);
            }
            EMP_LoginLoadPoint.Value = privilegeList;
            foreach (var item in privilegeList)
            {
                if (item.PRIVILEGE_NAME == Station.DisplayName)
                {
                    bPrivilege = true;
                }
            }
            if (bPrivilege)
            {
                Station.AddMessage("MES00000001", new string[] { }, MESReturnView.Station.StationMessageState.Pass);
            }
            else
            {
                throw new Exception("no privilege");
            }
        }
Example #22
0
        /// <summary>
        /// 從輸入加載RootCause
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input">RootCause輸入值轉換為大寫</param>
        /// <param name="Paras">ErrorCode</param>
        public static void RootCauseDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            string RootCauseInput = Input.Value.ToString();// = Station.StationSession[0].Value.ToString();
            //Modify by LLF 2018-02-03
            //MESStationSession strInput = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
            //if (strInput == null)
            //{
            //    //Station.AddMessage("MES00000076", new string[] { "Sn", Sn }, MESReturnView.Station.StationMessageState.Fail);
            //}
            //else
            //{
            //    RootCauseInput = strInput.Value.ToString();
            //}
            //string strSql = $@"SELECT * FROM C_ERROR_CODE WHERE ERROR_CODE = '{RootCauseInput.Replace("'", "''")}'";
            //OleDbParameter[] paramet = new OleDbParameter[] { new OleDbParameter(":RootCause", RootCauseInput) };
            //DataTable res = Station.SFCDB.ExecuteDataTable(strSql, CommandType.Text, paramet);
            MESStationSession ErrorCode = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (ErrorCode == null)
            {
                ErrorCode = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(ErrorCode);
            }

            T_C_ERROR_CODE Obj_C_ERROR_CODE = new T_C_ERROR_CODE(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            C_ERROR_CODE   ObjErrorCode     = Obj_C_ERROR_CODE.GetByErrorCode(RootCauseInput, Station.SFCDB);

            if (ObjErrorCode == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000142", new string[] { RootCauseInput }));
            }
            else
            {
                ErrorCode.Value = RootCauseInput;
                Station.Inputs[Station.Inputs.Count - 1].Value = ObjErrorCode.ENGLISH_DESCRIPTION.ToString();
            }
            //Modify by LLF 2018-02-03
            //if (res.Rows.Count <= 0)
            //{
            //    Station.NextInput = Input;
            //    Station.AddMessage("MES00000007", new string[] { "RootCause", RootCauseInput }, MESReturnView.Station.StationMessageState.Fail);
            //}
            //else
            //{
            //    MESStationSession ErrorCode = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
            //    if (ErrorCode == null)
            //    {
            //        ErrorCode = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input };
            //        Station.StationSession.Add(ErrorCode);
            //    }
            //    ErrorCode.Value = RootCauseInput;
            //}
        }
Example #23
0
        public static void LoadWoFromInput(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession s = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (s == null)
            {
                s = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(s);
            }
        }
Example #24
0
        /// <summary>
        /// 判斷是否為整數,若為整數保存到指定位置,否則提示報錯
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">
        /// IntSavePoint:保存到指定位置
        /// </param>
        public static void IntegerDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession s = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (s == null)
            {
                s = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(s);
            }

            string IntData = Input.Value.ToString();

            long Num;

            if (IntData == "")
            {
                Station.AddMessage("MES00000006", new string[] { "InputData" }, MESReturnView.Station.StationMessageState.Fail);
                //Station.NextInput = Station.Inputs[2];
            }
            else if (long.TryParse(IntData.ToString(), out Num) && long.Parse(IntData) >= 0)
            {
                s.Value = IntData;
                Station.AddMessage("MES00000029", new string[] { "InputData", Num.ToString() }, MESReturnView.Station.StationMessageState.Pass);
                //Station.NextInput = Station.Inputs[3];
            }
            else
            {
                Station.AddMessage("MES00000020", new string[] { "InputData", "Number" }, MESReturnView.Station.StationMessageState.Fail);
                //Station.NextInput = Station.Inputs[2];
            }
        }
Example #25
0
        public static void TESTGetPoBuySKUDataLoader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            string          skuno = Input.Value.ToString();
            MESStationInput I     = Station.Inputs.Find(t => t.DisplayName == "PO");

            List <object> ret = I.DataForUse;

            ret.Clear();
            if (skuno == "A03022ASS-A")
            {
                ret.Add("00045879");
                ret.Add("00045880");
                ret.Add("00045881");
                //"{SKUNO:[SKU],TT:'2222'}"
            }
            else if (skuno == "A03023UBB-A")
            {
                ret.Add("00095879");
                ret.Add("00095880");
                ret.Add("00095881");
            }
        }
Example #26
0
        /// <summary>
        /// 從輸入加載維修小項
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input">RootCause輸入值轉換為大寫</param>
        /// <param name="Paras">ErrorCode</param>
        public static void RepairItemsSonDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }

            MESStationSession RepairItemsSonSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (RepairItemsSonSession == null)
            {
                RepairItemsSonSession = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(RepairItemsSonSession);
            }
            RepairItemsSonSession.Value = Input.Value.ToString();
        }
Example #27
0
        public static void CloseCartionAndPalletAction(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            OleExec SFCDB = Station.SFCDB;
            string  Run   = "";

            try
            {
                Run = (Station.StationSession.Find(T => T.MESDataType == Paras[0].SESSION_TYPE && T.SessionKey == Paras[0].SESSION_KEY).Value).ToString();
                if (Run.ToUpper() == "FALSE")
                {
                    return;
                }
            }
            catch
            {
            }

            MESStationSession sessionCarton = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (sessionCarton == null)
            {
                throw new System.Exception("sessionCartion miss ");
            }

            MESStationSession sessionPallet = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY);

            if (sessionPallet == null)
            {
                throw new System.Exception("sessionPallet miss ");
            }
            MESStationSession sessionPrintPL = Station.StationSession.Find(t => t.MESDataType == "ISPRINT_PL" && t.SessionKey == "1");

            if (sessionPrintPL == null)
            {
                sessionPrintPL = new MESStationSession()
                {
                    MESDataType = "ISPRINT_PL", SessionKey = "1", Value = "FALSE"
                };
                Station.StationSession.Add(sessionPrintPL);
            }
            sessionPrintPL.Value = "FALSE";
            MESStationSession sessionPrintCTN = Station.StationSession.Find(t => t.MESDataType == "ISPRINT_CTN" && t.SessionKey == "1");

            if (sessionPrintCTN == null)
            {
                sessionPrintCTN = new MESStationSession()
                {
                    MESDataType = "ISPRINT_CTN", SessionKey = "1", Value = "FALSE"
                };
                Station.StationSession.Add(sessionPrintCTN);
            }
            sessionPrintCTN.Value = "FALSE";
            CartionBase cartion = (CartionBase)sessionCarton.Value;
            PalletBase  Pallet  = (PalletBase)sessionPallet.Value;

            cartion.DATA.CLOSED_FLAG = "1";
            cartion.DATA.EDIT_TIME   = DateTime.Now;
            cartion.DATA.EDIT_EMP    = Station.LoginUser.EMP_NO;
            Station.SFCDB.ExecSQL(cartion.DATA.GetUpdateString(DB_TYPE_ENUM.Oracle));

            Pallet.DATA.CLOSED_FLAG = "1";
            Pallet.DATA.EDIT_TIME   = DateTime.Now;
            Pallet.DATA.EDIT_EMP    = Station.LoginUser.EMP_NO;
            Station.SFCDB.ExecSQL(cartion.DATA.GetUpdateString(DB_TYPE_ENUM.Oracle));
            sessionPrintPL.Value  = "TRUE";
            sessionPrintCTN.Value = "TRUE";

            MESStationSession CTNPrintSession = Station.StationSession.Find(T => T.MESDataType == "PRINT_CTN" && T.SessionKey == "1");

            if (CTNPrintSession == null)
            {
                CTNPrintSession = new MESStationSession()
                {
                    MESDataType = "PRINT_CTN", SessionKey = "1"
                };
                Station.StationSession.Add(CTNPrintSession);
            }
            CTNPrintSession.Value = cartion.DATA.PACK_NO;

            MESStationSession PlPrintSession = Station.StationSession.Find(T => T.MESDataType == "PRINT_PL" && T.SessionKey == "1");

            if (PlPrintSession == null)
            {
                PlPrintSession = new MESStationSession()
                {
                    MESDataType = "PRINT_PL", SessionKey = "1"
                };
                Station.StationSession.Add(PlPrintSession);
            }
            PlPrintSession.Value = Pallet.DATA.PACK_NO;


            Station.StationSession.Remove(sessionCarton);
            Station.StationSession.Remove(sessionPallet);
        }
Example #28
0
        /// <summary>
        /// 初始化工站時加載出默認的維修大項,維修小項LIST
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input">RootCause輸入值轉換為大寫</param>
        /// <param name="Paras">ErrorCode</param>
        public static void RepairItemsInitDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            T_C_REPAIR_ITEMS     RepairItems = new T_C_REPAIR_ITEMS(Station.SFCDB, Station.DBType);
            Row_C_REPAIR_ITEMS   RowItems;
            T_C_REPAIR_ITEMS_SON RepairItemsSon     = new T_C_REPAIR_ITEMS_SON(Station.SFCDB, Station.DBType);
            List <string>        RepairItemsSonList = new List <string>();
            List <string>        RepairItemsList    = new List <string>();
            T_C_REPAIR_ITEMS     TC_REPAIR_ITEM     = new T_C_REPAIR_ITEMS(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            string ITEM_NAME = Input.Value.ToString();

            MESStationInput I = Station.Inputs.Find(t => t.DisplayName == "Son_Items");

            try
            {
                Input.DataForUse.Clear();
                //RepairItemsList = TC_REPAIR_ITEM.GetRepairItemsList(ITEM_NAME, Station.SFCDB);
                //Input.DataForUse.Add(RepairItemsList);//初始化維修大項
                RowItems = RepairItems.GetIDByItemName(ITEM_NAME, Station.SFCDB);

                RepairItemsSonList = RepairItemsSon.GetRepairItemsSonList(RowItems.ID, Station.SFCDB);
                Input.DataForUse.Add(RepairItemsSonList);   //初始化維修小項

                Station.AddMessage("MES00000001", new string[] { }, MESReturnView.Station.StationMessageState.Message);
            }
            catch (Exception ex)
            {
                string msgCode = ex.Message;
                throw ex;
            }
        }
Example #29
0
        /// <summary>
        /// 檢查輸入的料號與工單的料號是否一致
        /// 張官軍 2018/01/18
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void InputSkuWoSkuChecker(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            string ErrMessage = string.Empty;
            string SkuNo      = string.Empty;
            //marked by LLF 2018-02-24
            //MESStationSession WoSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
            //if (WoSession == null)
            //{
            //    MESStationSession SNSession = Station.StationSession.Find(t => t.MESDataType == "SN" && t.SessionKey == "1");
            //    if (SNSession != null)
            //    {
            //        SN Sn = ((SN)SNSession.Value);
            //        WorkOrder WoTemp = new WorkOrder();
            //        WoTemp.Init(Sn.WorkorderNo, Station.SFCDB);
            //        WoSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, SessionKey = Paras[0].SESSION_KEY, Value = WoTemp };
            //        Station.StationSession.Add(WoSession);
            //    }
            //    else
            //    {
            //        ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] {Paras[0].SESSION_TYPE+Paras[0].SESSION_KEY });
            //        throw new MESReturnMessage(ErrMessage);
            //    }
            //}
            //WorkOrder Wo = ((WorkOrder)WoSession.Value);

            //SkuNo = Input.Value.ToString().ToUpper().Trim();
            //if (Wo != null)
            //{
            //    if (Wo.SkuNO.Equals(SkuNo))
            //    {
            //        Station.AddMessage("MES00000111", new string[] { SkuNo }, MESReturnView.Station.StationMessageState.Pass);
            //    }
            //    else
            //    {
            //        ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000110", new string[] {SkuNo,Wo.WorkorderNo });
            //        throw new MESReturnMessage(ErrMessage);
            //    }
            //}

            MESStationSession InputSKUSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
            MESStationSession SNSKUSession    = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (InputSKUSession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }

            if (SNSKUSession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }

            if (InputSKUSession.Value.ToString() != SNSKUSession.Value.ToString())
            {
                //誰把這段防呆屏蔽了?Openned by LLF 2018-03-17
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000110", new string[] { InputSKUSession.Value.ToString(), SNSKUSession.Value.ToString() });
                throw new MESReturnMessage(ErrMessage);
            }
        }
Example #30
0
        /// <summary>
        /// 從輸入加載FailDesc
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void FailDescDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            MESStationSession FailDescSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (FailDescSession == null)
            {
                FailDescSession = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(FailDescSession);
            }
            FailDescSession.Value = Input.Value.ToString();
        }