Beispiel #1
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;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 檢查輸入的Action_code是否存在
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void ActionCodeDataChecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            string            ActionCodeInput   = "";
            MESStationSession sessionActionCode = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionActionCode == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            if (sessionActionCode.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            try
            {
                T_C_ACTION_CODE t_c_action_code = new T_C_ACTION_CODE(Station.SFCDB, Station.DBType);
                C_ACTION_CODE   c_action_code   = new C_ACTION_CODE();
                c_action_code = t_c_action_code.GetByActionCode(sessionActionCode.Value.ToString(), Station.SFCDB);
                if (c_action_code == null)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { "ActionCode", ActionCodeInput }));
                }
                Station.AddMessage("MES00000026", new string[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
        /// <summary>
        /// HWD Allparts AOI測試資料檢查
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        /// MES1.CHECK_AOI_STATUS@mbdallpart(VAR_PANELNO,var_nextevent,var_productionline,var_LASTEDITBY,var_message )
        /// (G_SYSSERIALNO IN VARCHAR2,
        public static void AOITestAPDatachecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            OleExec apdb        = Station.APDB;
            string  Psn         = Input.Value.ToString();
            string  Line        = Station.Line;
            string  StationName = Station.StationName;
            string  EMP_NO      = Station.LoginUser.EMP_NO;

            OleDbParameter[] StencilSP = new OleDbParameter[5];
            StencilSP[0]               = new OleDbParameter("G_SYSSERIALNO", Psn);
            StencilSP[1]               = new OleDbParameter("G_EVENTNAME", StationName);
            StencilSP[2]               = new OleDbParameter("G_LINE_NAME", Line);
            StencilSP[3]               = new OleDbParameter("G_EMP", EMP_NO);
            StencilSP[4]               = new OleDbParameter();
            StencilSP[4].Size          = 1000;
            StencilSP[4].ParameterName = "RES";
            StencilSP[4].Direction     = System.Data.ParameterDirection.Output;
            //string result = apdb.ExecProcedureNoReturn("MES1.CHECK_AOI_STATUS@mbdallpart", StencilSP);
            string result = apdb.ExecProcedureNoReturn("MES1.CHECK_AOI_STATUS", StencilSP);

            if (result == "OK")
            {
                Station.AddMessage("MES00000062", new string[] { Psn }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            else
            {
                throw new Exception(result);
            }
        }
Beispiel #4
0
        //計數器初始化
        public static void CounterInitDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.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" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
        }
Beispiel #5
0
        /// <summary>
        /// HWD Allpart鋼網計數,add by LLF 2018-01-29
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void APStencilUpdateCountAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            OleExec apdb        = Station.APDB;
            string  Psn         = Input.Value.ToString();
            string  Line        = Station.Line;
            string  StationName = Station.StationName;

            OleDbParameter[] StencilSP = new OleDbParameter[4];
            StencilSP[0]               = new OleDbParameter("IN_P_SN", Psn);
            StencilSP[1]               = new OleDbParameter("IN_STATION", StationName);
            StencilSP[2]               = new OleDbParameter("IN_LINE", Line);
            StencilSP[3]               = new OleDbParameter();
            StencilSP[3].Size          = 1000;
            StencilSP[3].ParameterName = "RES";
            StencilSP[3].Direction     = System.Data.ParameterDirection.Output;
            string result = apdb.ExecProcedureNoReturn("MES1.CHECK_STENCIL_COUNT_UPDATE", StencilSP);

            if (result == "OK")
            {
                //apdbPool.Return(apdb);
                Station.AddMessage("MES00000062", new string[] { Psn }, StationMessageState.Pass);
            }
            else
            {
                //apdbPool.Return(apdb);
                throw new Exception(result);
            }
        }
        ///Add by LLF 2018-01-28 AOI1&AOI2,Print1&Print2,VI1&VI2  工站可以相互轉換
        public static void ChangeCurrentStationDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.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[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
        }
        /// <summary>
        /// 初始化工站時加載出默認的維修大項,維修小項LIST
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input">RootCause輸入值轉換為大寫</param>
        /// <param name="Paras">ErrorCode</param>
        public static void RepairItemsInitDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.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[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message);
            }
            catch (Exception ex)
            {
                string msgCode = ex.Message;
                throw ex;
            }
        }
Beispiel #8
0
        public static void SkuDataLoader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                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);
            }
            SKU sku = new SKU();

            try
            {
                MESDBHelper.OleExec ole = Station.SFCDB;
                sku     = sku.Init(Input.Value.ToString(), ole, MESDataObject.DB_TYPE_ENUM.Oracle);
                s.Value = sku;
                Station.AddMessage("MES00000029", new string[] { "Skuno", sku.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            catch
            {
                //Station.AddMessage("MES00000052", new string[] { "Skuno"+ ":"+ Input.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Fail);
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { "Skuno" + ":" + Input.Value.ToString() }));
            }
        }
Beispiel #9
0
        //Add by LLF 2017-01-26 End

        /// <summary>
        /// TR_SN數據對象加載其中每個欄位
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void LoadDataFromTRSNDataLoader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            object TRSN_SessionObject;

            if (Paras.Count == 0)
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057");
                throw new MESReturnMessage(errMsg);
            }
            try
            {
                MESStationSession TRSN_Session = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
                if (TRSN_Session == null)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
                }
                else if (TRSN_Session.Value == null)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
                }
                TRSN_SessionObject = TRSN_Session.Value;

                //獲取TR_SN 欄位數據
                Dictionary <string, DataRow> dd = (Dictionary <string, DataRow>)TRSN_SessionObject;
                DataRow tr;
                dd.TryGetValue("R_TR_SN", out tr);

                MESStationInput I   = Station.Inputs.Find(t => t.DisplayName == "KP_NO");
                List <object>   ret = I.DataForUse;
                ret.Clear();
                if (I != null)
                {
                    ret.Add(tr["CUST_KP_NO"].ToString());
                }

                MESStationInput I1   = Station.Inputs.Find(t => t.DisplayName == "MFR_Name");
                List <object>   ret1 = I1.DataForUse;
                if (I1 != null)
                {
                    ret1.Add(tr["MFR_KP_NO"].ToString());
                }
                MESStationInput I2   = Station.Inputs.Find(t => t.DisplayName == "Date_Code");
                List <object>   ret2 = I2.DataForUse;
                if (I2 != null)
                {
                    ret2.Add(tr["DATE_CODE"].ToString());
                }
                MESStationInput I3   = Station.Inputs.Find(t => t.DisplayName == "Lot_Code");
                List <object>   ret3 = I3.DataForUse;
                if (I3 != null)
                {
                    ret3.Add(tr["LOT_CODE"].ToString());
                }
                Station.AddMessage("MES00000001", new string[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #10
0
        public static void WoInputCountDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession count = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

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

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

            MESStation.LogicObject.WorkOrder   worder = new LogicObject.WorkOrder();
            MESDataObject.Module.T_R_WO_BASE   trwb   = new MESDataObject.Module.T_R_WO_BASE(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            MESDataObject.Module.Row_R_WO_BASE rrwb   = (MESDataObject.Module.Row_R_WO_BASE)trwb.NewRow();
            rrwb = worder.GetWoMode(workorder, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            Station.AddMessage("MES00000029", new string[] { "Workorder", wo.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message);
        }
Beispiel #11
0
        /// <summary>
        /// 從輸入加載工單數據
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">1個參數,WO保存的位置</param>
        public static void LoadWoFromInput(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            //if (Paras.Count == 0)
            //{
            //    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);
            }

            //dStation.NextInput = Station.Inputs[1];
            //Station.DBS["APDB"].Borrow()
            LogicObject.WorkOrder WO = new LogicObject.WorkOrder();
            WO.Init(Input.Value.ToString(), Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            s.Value      = WO;
            s.InputValue = Input.Value.ToString();
            s.ResetInput = Input;
            Station.AddMessage("MES00000029", new string[] { "Workorder", WO.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
        }
Beispiel #12
0
        /// <summary>
        /// 1.檢查输入的Location位置是否是在数据库中存在,不存在则报错
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">1個參數,WO保存的位置</param>
        public static void ReapirLocationDatachecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            OleExec       apdb         = null;
            List <string> LocationList = new List <string>();

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

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

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

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

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

            //獲取ALLPART數據
            AP_DLL          APDLL = new AP_DLL();
            MESStationInput I     = Station.Inputs.Find(t => t.DisplayName == "Location");
            List <object>   ret   = I.DataForUse;

            ret.Clear();
            try
            {
                apdb         = Station.DBS["APDB"].Borrow();
                LocationList = APDLL.CheckLocationExist(ObjSN.SkuNo, StrLocation, apdb);
                if (LocationList.Count <= 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { StrLocation, ObjSN.SkuNo }));
                }
                else
                {
                    foreach (object item in LocationList)
                    {
                        ret.Add(item);
                    }
                }
                Station.DBS["APDB"].Return(apdb);
                Station.AddMessage("MES00000001", new string[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            catch (Exception ex)
            {
                if (apdb != null)
                {
                    Station.DBS["APDB"].Return(apdb);
                }
                throw ex;
            }
        }
Beispiel #13
0
        //Add by LLF 2017-01-26 Begin
        public static void TrCodeDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string  Process = "";
            string  Message = "";
            string  StrWO   = "";
            string  StrCode = "";
            string  IP      = string.Empty;
            OleExec APDB    = null;

            Dictionary <string, DataRow> TrSnTable = null;
            T_R_SN Table = new T_R_SN(Station.SFCDB, Station.DBType);

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

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

            //獲取 TRSN 對象
            MESStationSession TrSnSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (TrSnSession == null)
            {
                Message = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY });
                throw new MESReturnMessage(Message);
            }
            TrSnTable = (Dictionary <string, DataRow>)TrSnSession.Value;

            Process = Paras[2].VALUE.ToString();

            IP = Paras[3].VALUE.ToString();

            try
            {
                APDB    = Station.APDB;
                StrCode = Table.GetAPTrCode(StrWO, TrSnTable["R_TR_SN"]["TR_SN"].ToString(), Process, Station.LoginUser.EMP_NO, IP, APDB);


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

                TrCodeSession.Value = StrCode;
                Station.AddMessage("MES00000001", new string[] { TrCodeSession.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Beispiel #14
0
        /// <summary>
        /// 加載工站Pass下一站
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        /// add by LLF 2018-01-29
        public static void StationNextDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string            NextStation     = "";
            MESStationSession StationNextSave = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

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

            //Marked by LLF 2018-02-22 begin
            //sn.PanelSN(strSn, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            try
            {
                sn.PanelSN(strSn, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            }
            catch
            {
                sn.Load(strSn, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            }
            //Marked by LLF 2018-02-22 end

            Route              routeDetail     = new Route(sn.RouteID, GetRouteType.ROUTEID, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            List <string>      snStationList   = new List <string>();
            List <RouteDetail> routeDetailList = routeDetail.DETAIL;
            RouteDetail        R = routeDetailList.Where(r => r.STATION_NAME == Station.StationName).FirstOrDefault();

            if (R == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180724154541", new string[] { Station.StationName }));
            }

            if (routeDetailList.Where(r => r.SEQ_NO > R.SEQ_NO).FirstOrDefault() == null)//當前工站為最後一個工站時
            {
                NextStation = routeDetailList.Where(r => r.SEQ_NO == R.SEQ_NO).FirstOrDefault().STATION_TYPE;
            }
            else
            {
                NextStation = routeDetailList.Where(r => r.SEQ_NO > R.SEQ_NO).FirstOrDefault().STATION_NAME;
            }

            snStationList.Add(NextStation);
            if (R.DIRECTLINKLIST != null)
            {
                foreach (var item in R.DIRECTLINKLIST)
                {
                    snStationList.Add(item.STATION_NAME);
                }
            }
            StationNextSave.Value = snStationList;
            Station.AddMessage("MES00000029", new string[] { "StationNext", "StationNextList" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
        }
        /// <summary>
        /// 從PanelLoadPoint保存的Panel對象加載工單對象到指定位置
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">2個參數,WO,Panle保存的位置</param>
        public static void WoFromPanelDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 2)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000052"));
            }
            MESStationSession Swo    = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
            MESStationSession Spanel = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].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);
            }

            if (Spanel == null)
            {
                //throw new Exception("请输入PANEL!");
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000171", new string[] { "PANEL" }));
            }
            else
            {
                Panel     ObjPanel       = (Panel)Spanel.Value;
                WorkOrder ObjWorkorder   = new WorkOrder();
                string    PanelLoadPoint = Input.Value.ToString();
                string    WOSavePoint    = null;

                try
                {
                    if (ObjPanel.PanelCollection.Count != 0)
                    {
                        WOSavePoint = ObjPanel.PanelCollection[0].WORKORDERNO.ToString();
                    }
                    else
                    {
                        //throw new Exception("Can Not Find " + PanelLoadPoint + " 'Information ' !");
                        throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000189", new string[] { PanelLoadPoint }));
                    }
                    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 }, StationMessageState.Pass);
                }
                catch (Exception ex)
                {
                    string msgCode = ex.Message;
                    throw ex;
                }
            }
        }
Beispiel #16
0
        //加載SN待過工站
        public static void SNNextStationDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            //Modify by LLF 2018-01-26 通過配置獲取
            //MESStationSession WipStationSave = new MESStationSession() {MESDataType= "WIPSTATION", InputValue=Input.Value.ToString(),SessionKey="1",ResetInput=Input };

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

            if (NextStationSave == null)
            {
                NextStationSave = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(NextStationSave);
            }
            string             strSn           = Input.Value.ToString();
            SN                 sn              = new SN(strSn, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            Route              routeDetail     = new Route(sn.RouteID, GetRouteType.ROUTEID, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            List <string>      snStationList   = new List <string>();
            List <RouteDetail> routeDetailList = routeDetail.DETAIL;
            RouteDetail        R = routeDetailList.Where(r => r.STATION_NAME == sn.CurrentStation).FirstOrDefault();

            //Modify by LLF 2018-01-29
            //string nextStation1 = routeDetailList.Where(r => r.SEQ_NO == R.SEQ_NO + 10).FirstOrDefault().STATION_NAME;

            string nextStation1 = sn.NextStation;

            if (!sn.CurrentStation.Equals("REWORK"))
            {
                if (R == null)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000156", new string[] { strSn, sn.CurrentStation }));
                }

                if (routeDetailList.Where(r => r.SEQ_NO > R.SEQ_NO).FirstOrDefault() == null && !sn.CurrentStation.Equals("REWORK"))
                {
                    if (!string.IsNullOrEmpty(sn.CurrentStation))
                    {
                        StrNextStation = sn.NextStation;
                    }
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000200", new string[] { strSn, StrNextStation }));
                }
                nextStation1 = routeDetailList.Where(r => r.SEQ_NO > R.SEQ_NO).FirstOrDefault().STATION_NAME;
            }

            snStationList.Add(nextStation1);
            if (R != null && R.DIRECTLINKLIST != null)
            {
                foreach (var item in R.DIRECTLINKLIST)
                {
                    snStationList.Add(item.STATION_NAME);
                }
            }
            NextStationSave.Value = snStationList;
            Station.AddMessage("MES00000029", new string[] { "NextStationList", "NextStation" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
        }
Beispiel #17
0
        public static void APPanelSNReplaceAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            string ErrMessage = "";
            string PanelSN;
            SN     SNObj = new SN();

            string     StrSN = "";
            R_PANEL_SN Psn   = null;

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

            if (PanelSession == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            PanelSN = PanelSession.InputValue.ToString();
            Psn     = SNObj.GetPanelVirtualSN(PanelSN, Station.SFCDB, DB_TYPE_ENUM.Oracle);

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

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

            StrSN = SNSession.Value.ToString();



            OleExec apdb = Station.APDB;

            //Psn = PanelSession.InputValue.ToString();

            OleDbParameter[] StencilSP = new OleDbParameter[4];
            StencilSP[0]               = new OleDbParameter("G_PANEL", "");
            StencilSP[1]               = new OleDbParameter("G_PSN", StrSN);
            StencilSP[2]               = new OleDbParameter();
            StencilSP[2].Size          = 1000;
            StencilSP[2].ParameterName = "RES";
            StencilSP[2].Direction     = System.Data.ParameterDirection.Output;
            string result = apdb.ExecProcedureNoReturn("MES1.Z_PANEL_REPLACE_SP", StencilSP);

            if (result == "OK")
            {
                //apdbPool.Return(apdb);
                Station.AddMessage("MES00000062", new string[] { "" }, StationMessageState.Pass);
            }
            else
            {
                //apdbPool.Return(apdb);
                throw new Exception(result);
            }
        }
Beispiel #18
0
        /// <summary>
        /// 根據SN的SKUNO帶出維修LOCATION
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void LocationFromSNDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            List <string> LocationList = new List <string>();
            string        ErrMessage   = "";
            OleExec       apdb         = null;

            if (Paras.Count != 1)
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057");
                throw new MESReturnMessage(errMsg);
            }

            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);
            }
            SN ObjSn = (SN)SNSession.Value;

            //獲取ALLPART數據
            AP_DLL          APDLL = new AP_DLL();
            MESStationInput I     = Station.Inputs.Find(t => t.DisplayName == "Location");
            List <object>   ret   = I.DataForUse;

            ret.Clear();
            try
            {
                apdb = Station.APDB;

                LocationList = APDLL.GetLocationList(ObjSn.SkuNo, apdb);
                if (LocationList.Count <= 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { }));
                }
                else
                {
                    foreach (object item in LocationList)
                    {
                        ret.Add(item);
                    }
                }

                Station.AddMessage("MES00000001", new string[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            catch (Exception ex)
            {
                if (apdb != null)
                {
                }
                throw ex;
            }
        }
Beispiel #19
0
        public static void InputEmpPrivchecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                throw new Exception("參數數量不正確!");
            }
            MESStationSession EMP_NOLoadPoint = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (EMP_NOLoadPoint == null)
            {
                EMP_NOLoadPoint = new MESStationSession()
                {
                    MESDataType = "INPUTEMP", InputValue = Input.Value.ToString(), SessionKey = "1", ResetInput = Input
                };
                Station.StationSession.Add(EMP_NOLoadPoint);
            }
            bool   bPrivilege = false;
            string empNo      = Input.Value.ToString();
            //T_c_user cUser = new T_c_user(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            //Row_c_user rUser = cUser.getC_Userbyempno(empNo, Station.SFCDB, DB_TYPE_ENUM.Oracle);

            T_c_user_role       cUserRole  = new T_c_user_role(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            List <get_c_roleid> roleList   = cUserRole.GetRoleID(empNo, 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_NOLoadPoint.Value = privilegeList;
            foreach (var item in privilegeList)
            {
                if (item.PRIVILEGE_NAME == Station.DisplayName)
                {
                    bPrivilege = true;
                }
            }
            if (bPrivilege)
            {
                Station.AddMessage("MES00000001", new string[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            else
            {
                throw new Exception("no privilege");
            }
        }
Beispiel #20
0
        public static void SnSKUDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 2)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            //加載SnPoint位置
            MESStationSession SnSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (SnSession == null)
            {
                //modify by 張官軍 2018-03-15
                //根據該方法的定義:從 SN 對象加載機種對象,SnSession 不能為空
                //SnSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input };
                //Station.StationSession.Add(SnSession);
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000170"));
            }
            //加載SkunoPoint
            MESStationSession SkuSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (SkuSession == null)
            {
                SkuSession = new MESStationSession()
                {
                    MESDataType = Paras[1].SESSION_TYPE, SessionKey = Paras[1].SESSION_KEY
                };
                Station.StationSession.Add(SkuSession);
                //throw new MESReturnMessage("Skuno參數不存在");
            }

            // BY SDL 20180320  SN SnObject = (SN)SkuSession.Value;.

            SN SnObject = (SN)SnSession.Value;

            //SnObject.SerialNo

            SKU sku = new SKU();

            try
            {
                MESDBHelper.OleExec ole = Station.SFCDB;
                sku = sku.InitBySn(SnObject.SerialNo, ole, MESDataObject.DB_TYPE_ENUM.Oracle);
                SkuSession.Value = sku;
                Station.AddMessage("MES00000029", new string[] { "SN", sku.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            catch
            {
                //Station.AddMessage("MES00000007", new string[] { "SN" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Fail);
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { "SN" }));
            }
        }
Beispiel #21
0
        /// <summary>
        /// By工單Route獲取下一工站
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void StationNextByWODataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string    NextStation = "";
            WorkOrder WoObj       = new WorkOrder();

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

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

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

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

            WoObj = (WorkOrder)WOSession.Value;
            Route routeDetail = new Route(WoObj.RouteID, GetRouteType.ROUTEID, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);

            List <string>      snStationList   = new List <string>();
            List <RouteDetail> routeDetailList = routeDetail.DETAIL;
            RouteDetail        R = routeDetailList.Where(r => r.STATION_NAME == Station.StationName).FirstOrDefault();

            if (routeDetailList.Where(r => r.SEQ_NO > R.SEQ_NO).FirstOrDefault() == null)//當前工站為最後一個工站時
            {
                NextStation = routeDetailList.Where(r => r.SEQ_NO == R.SEQ_NO).FirstOrDefault().STATION_TYPE;
            }
            else
            {
                NextStation = routeDetailList.Where(r => r.SEQ_NO > R.SEQ_NO).FirstOrDefault().STATION_NAME;
            }

            snStationList.Add(NextStation);

            if (R.DIRECTLINKLIST != null)
            {
                foreach (var item in R.DIRECTLINKLIST)
                {
                    snStationList.Add(item.STATION_NAME);
                }
            }
            StationNextSave.Value = snStationList;
            Station.AddMessage("MES00000029", new string[] { "StationNext", "StationNextList" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
        }
        /// <summary>
        /// 判斷是否為整數,若為整數保存到指定位置,否則提示報錯
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">
        /// IntSavePoint:保存到指定位置
        /// </param>
        public static void IntegerDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.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" }, MESPubLab.MESStation.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() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
                //Station.NextInput = Station.Inputs[3];
            }
            else
            {
                Station.AddMessage("MES00000020", new string[] { "InputData", "Number" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Fail);
                //Station.NextInput = Station.Inputs[2];
            }
        }
Beispiel #23
0
        /// <summary>
        /// 維修輸入加載TR_SN的DataRow對象,并把KP_NO,MFR_Name,Date_Code,Lot_Code到加載到對應輸入框的值
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void RepairTRSNObjDataLoader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000057"));
            }
            string            inputValue  = Input.Value.ToString();
            MESStationSession sessionTRSN = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionTRSN == null)
            {
                sessionTRSN = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(sessionTRSN);
            }
            try
            {
                AP_DLL         APDLL    = new AP_DLL();
                List <DataRow> TRSNlist = APDLL.R_TR_SN_GetBYTR_SN(inputValue, Station.APDB);
                if (TRSNlist.Count == 0)
                {
                    Station.Inputs.Find(input => input.DisplayName == "KP_NO").Value     = "";
                    Station.Inputs.Find(input => input.DisplayName == "MFR_Name").Value  = "";
                    Station.Inputs.Find(input => input.DisplayName == "Date_Code").Value = "";
                    Station.Inputs.Find(input => input.DisplayName == "Lot_Code").Value  = "";
                    Station.Inputs.Find(input => input.DisplayName == "TR_SN").Value     = "";
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { "TRSN:" + inputValue, "R_TR_SN" }));
                }
                else
                {
                    Station.Inputs.Find(input => input.DisplayName == "KP_NO").Value     = TRSNlist[0]["CUST_KP_NO"].ToString();
                    Station.Inputs.Find(input => input.DisplayName == "MFR_Name").Value  = TRSNlist[0]["MFR_KP_NO"].ToString();
                    Station.Inputs.Find(input => input.DisplayName == "Date_Code").Value = TRSNlist[0]["DATE_CODE"].ToString();
                    Station.Inputs.Find(input => input.DisplayName == "Lot_Code").Value  = TRSNlist[0]["Lot_Code"].ToString();
                    Dictionary <string, DataRow> TRSNInfo = new Dictionary <string, DataRow>();
                    TRSNInfo.Add("TR_SN", TRSNlist[0]);
                    sessionTRSN.Value      = TRSNlist[0];
                    sessionTRSN.InputValue = inputValue;
                    sessionTRSN.ResetInput = Input;
                    Station.NextInput      = Station.Inputs.Find(input => input.DisplayName == "Description");
                    Station.AddMessage("MES00000001", new string[] { inputValue }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #24
0
        /// <summary>
        /// 1.檢查工單是否可以進行SMTloading/SIloading.只有正常工單可以進行.
        /// 2.工單不能R_WO_BASE.Inputqty >= R_WO_BASE.Workorderqty
        /// 3.Check工單不能關結(R_WO_BASE.Closed != 1)
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">1個參數,WO保存的位置</param>
        public static void WoLoadingStationDatachecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            WorkOrder ObjWorkorder = new WorkOrder();
            string    ErrMessage   = string.Empty;

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

            if (Swo == null)
            {
                throw new Exception("Can Not Find " + Paras[0].SESSION_TYPE + " " + Paras[0].SESSION_KEY + " !");
            }
            else
            {
                if (Swo.Value != null)
                {
                    ObjWorkorder = (WorkOrder)Swo.Value;
                    if (ObjWorkorder != null)
                    {
                        if (ObjWorkorder.WORKORDER_QTY <= ObjWorkorder.INPUT_QTY)
                        {
                            //Station.AddMessage("MES00000060", new string[] { ObjWorkorder.WorkorderNo.ToString(),ObjWorkorder.WORKORDER_QTY.ToString(), ObjWorkorder.INPUT_QTY.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Fail);
                            ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000060",
                                                                              new string[] { ObjWorkorder.WorkorderNo.ToString(),
                                                                                             ObjWorkorder.WORKORDER_QTY.ToString(),
                                                                                             ObjWorkorder.INPUT_QTY.ToString() });
                            throw new MESReturnMessage(ErrMessage);
                        }
                        if (ObjWorkorder.CLOSED_FLAG != "0")
                        {
                            //Station.AddMessage("MES00000041", new string[] { ObjWorkorder.WorkorderNo.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Fail);
                            ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000041",
                                                                              new string[] { ObjWorkorder.WorkorderNo.ToString() });
                            throw new MESReturnMessage(ErrMessage);
                        }
                        Station.AddMessage("MES00000061", new string[] { ObjWorkorder.WorkorderNo.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
                    }
                }
                else
                {
                    throw new Exception("Can Not Find " + Paras[0].SESSION_TYPE + " " + Paras[0].SESSION_KEY + "" + Paras[0].VALUE + " !");
                }
            }
        }
        /// <summary>
        /// 從SNLoadPoint保存的SN對象加載工單對象到指定位置
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">2個參數,WO,SN保存的位置</param>
        public static void WoFromSNDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 2)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession Swo = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
            MESStationSession Ssn = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (Swo == null)
            {
                //throw new Exception("Can Not Fint " + Paras[0].SESSION_TYPE + " " + Paras[0].SESSION_KEY + " !");
                Swo = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(Swo);
            }

            if (Ssn == null)
            {
                //throw new Exception("请输入SN!");
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE }));
            }
            else
            {
                SN        ObjSN        = (SN)Ssn.Value;
                WorkOrder ObjWorkorder = new WorkOrder();
                String    SNLoadPoint  = Input.Value.ToString();
                string    WOSavePoint  = null;

                try
                {
                    WOSavePoint = ObjSN.WorkorderNo.Trim();
                    ObjWorkorder.Init(WOSavePoint, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
                    Swo.Value = ObjWorkorder;

                    Station.AddMessage("MES00000029", new string[] { "Workorder", WOSavePoint }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
                }
                catch (Exception ex)
                {
                    string msgCode = ex.Message;
                    throw ex;
                }
            }
        }
Beispiel #26
0
        public static void SNLinkSubSNKPAction_Old(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            WorkOrder wO = null;
            //SN snob = null;
            string ErrMessage = string.Empty;
            string wo         = Station.Inputs.Find(s => s.DisplayName == "WO").Value.ToString();
            string sn         = Station.Inputs.Find(s => s.DisplayName == "SUB_SN").Value.ToString();

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

            if (WOLoadPoint == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            wO = (WorkOrder)WOLoadPoint.Value;
            //snob.Load(sn,Station.SFCDB,DB_TYPE_ENUM.Oracle);
            SN snob = new SN(sn, Station.SFCDB, DB_TYPE_ENUM.Oracle);

            if (snob == null)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "SN Point" }));
            }

            T_C_KEYPART           tck      = new T_C_KEYPART(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            T_R_SN_KEYPART_DETAIL T_kd     = new T_R_SN_KEYPART_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            List <C_KEYPART>      KEYPARTS = tck.GetKeypartListByWOAndStation(Station.SFCDB, wO.WorkorderNo, Station.StationName);

            if (KEYPARTS.Count > 0)
            {
                T_kd.INSN_KEYPART_DETAIL(Station.SFCDB, Station.BU, snob.ID, snob.SerialNo, sn, Station.StationName, KEYPARTS[0].PART_NO, KEYPARTS[0].SEQ_NO, KEYPARTS[0].CATEGORY_NAME, KEYPARTS[0].CATEGORY, Station.LoginUser.EMP_NO);
                Station.AddMessage("MES00000180", new string[] { "SUB_SN", sn }, StationMessageState.Pass);
            }
            else
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { sn });
                throw new MESReturnMessage(ErrMessage);
            }
        }
Beispiel #27
0
        /// <summary>
        /// 重新加载 TRSN 的数量并进行判断
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void TRInputResetAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            //獲取TR_SN
            string TRSN = string.Empty;

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


            TRSN = Paras[1].VALUE.ToString();
            //使用 TRSN 重新加載 TRSNWIP,目前不存在 DataLoader 來根據 TRSN 加載 TRSNWIP 信息


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

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

            double ExtQty = ((DataRow)TRSNWip.Value)["EXT_QTY"] == null?0.0d:double.Parse(((DataRow)TRSNWip.Value)["EXT_QTY"].ToString());

            TRSN = ((DataRow)TRSNWip.Value)["TR_SN"] == null?"": ((DataRow)TRSNWip.Value)["TR_SN"].ToString();
            if (ExtQty <= 0)
            {
                MESStationInput input = Station.FindInputByName("TRSN");
                input.Enable      = true;
                Station.NextInput = input;
                Station.AddMessage("MES00000039", new string[] { TRSN }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message);
            }
            else
            {
                TRSNWip.Value = ExtQty--;
                MESStationInput input = Station.FindInputByName("NEW_SN");
            }
        }
        /// <summary>
        /// 從輸入加載ActionCode
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input">輸入的ActionCode轉換為大寫</param>
        /// <param name="Paras">ActionCode</param>
        public static void ActionCodeDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.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 }, MESPubLab.MESStation.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 }, MESPubLab.MESStation.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;
            }
        }
Beispiel #29
0
        //add by LLF 2018-01-26
        //加載Panel待過工站
        //modify by ZGJ 2018-03-07
        public static void PanelSNNextStationDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            //MESStationSession WipStationSave = new MESStationSession() { MESDataType = "WIPSTATION", InputValue = Input.Value.ToString(), SessionKey = "1", ResetInput = Input };
            MESStationSession NextStationSave = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (NextStationSave == null)
            {
                NextStationSave = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(NextStationSave);
            }
            string       PanelSn = Input.Value.ToString();
            T_R_PANEL_SN table   = new T_R_PANEL_SN(Station.SFCDB, Station.DBType);

            NextStationSave.Value = new List <string>()
            {
                table.GetPanelNextStation(PanelSn, Station.SFCDB)
            };
            //SN sn = new SN();

            //sn.PanelSN(strSn, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);

            //Route routeDetail = new Route(sn.RouteID, GetRouteType.ROUTEID, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            //List<string> snStationList = new List<string>();
            //List<RouteDetail> routeDetailList = routeDetail.DETAIL;
            //RouteDetail R = routeDetailList.Where(r => r.STATION_NAME == sn.CurrentStation).FirstOrDefault();
            ////Modify By LLF 2018-01-29
            ////string nextStation1 = routeDetailList.Where(r => r.SEQ_NO == R.SEQ_NO + 10).FirstOrDefault().STATION_NAME;
            //string nextStation1 = routeDetailList.Where(r => r.SEQ_NO > R.SEQ_NO).FirstOrDefault().STATION_NAME;
            //snStationList.Add(nextStation1);
            //if (R.DIRECTLINKLIST != null)
            //{
            //    foreach (var item in R.DIRECTLINKLIST)
            //    {
            //        snStationList.Add(item.STATION_NAME);
            //    }
            //}
            Station.AddMessage("MES00000029", new string[] { "NextStationList", "NextStation" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
        }
Beispiel #30
0
        public static void UpdateWOKeypartID(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession sessionWO = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionWO == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE }));
            }
            try
            {
                int       result;
                WorkOrder objWorkorder = new WorkOrder();
                objWorkorder = (WorkOrder)sessionWO.Value;
                T_C_KP_LIST   t_c_kp_list = new T_C_KP_LIST(Station.SFCDB, Station.DBType);
                T_R_WO_BASE   t_r_wo_base = new T_R_WO_BASE(Station.SFCDB, Station.DBType);
                Row_R_WO_BASE rowWOBase;
                List <string> kpList = t_c_kp_list.GetListIDBySkuno(objWorkorder.SkuNO, Station.SFCDB);
                if (kpList.Count == 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000255", new string[] { objWorkorder.SkuNO }));
                }
                rowWOBase            = (Row_R_WO_BASE)t_r_wo_base.GetObjByID(objWorkorder.ID, Station.SFCDB);
                rowWOBase.KP_LIST_ID = kpList[0].ToString();
                result = Station.SFCDB.ExecSqlNoReturn(rowWOBase.GetUpdateString(Station.DBType), null);
                if (result <= 0)
                {
                    //報錯信息待改
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { objWorkorder.WorkorderNo }));
                }
                Station.AddMessage("MES00000063", new string[] { objWorkorder.WorkorderNo }, StationMessageState.Pass);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }