Beispiel #1
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);
        }
        /// <summary>
        /// 獲取Panel未分板數量
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void PanelNoBIPQtyDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            Panel        PanelObj   = new Panel();
            T_R_PANEL_SN TablePanel = new T_R_PANEL_SN(Station.SFCDB, Station.DBType);

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

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

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

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

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

            int PanelNoBipQty = TablePanel.PanelNoBIPQty(PanelObj.PanelNo, Station.SFCDB, Station.DBType);

            PanelNoBIPQtySession.Value = PanelNoBipQty;
        }
        public static void PanelNoToSelectDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            Panel             PanelObj     = new Panel();
            MESStationSession PanelSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

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

            string InputName = Paras[1].VALUE;

            var input = Station.Inputs.Find(t => t.DisplayName == InputName);

            input.DataForUse.Clear();
            var sns = PanelObj.GetSnDetail(PanelObj.PanelNo, Station.SFCDB, DB_TYPE_ENUM.Oracle);

            input.DataForUse.Add("");
            for (int i = 0; i < sns.Count; i++)
            {
                input.DataForUse.Add(sns[i].SN);
            }
            //input.RefershType = "EveryTime";
        }
        public static void SetPassOrFailInOba(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            MESStationInput snInput       = Station.Inputs.Find(t => t.DisplayName == Paras[0].SESSION_TYPE.ToString());
            MESStationInput failSnInput   = Station.Inputs.Find(t => t.DisplayName == Paras[1].SESSION_TYPE.ToString());
            MESStationInput FailCodeInput = Station.Inputs.Find(t => t.DisplayName == Paras[2].SESSION_TYPE.ToString());
            MESStationInput LocationInput = Station.Inputs.Find(t => t.DisplayName == Paras[3].SESSION_TYPE.ToString());
            MESStationInput FailDescInput = Station.Inputs.Find(t => t.DisplayName == Paras[4].SESSION_TYPE.ToString());


            if (Input.Value.ToString().ToUpper().Equals("PASS"))
            {
                snInput.Visable       = true;;
                failSnInput.Visable   = false;
                FailCodeInput.Visable = false;
                LocationInput.Visable = false;
                FailDescInput.Visable = false;
                Station.NextInput     = snInput;
            }
            else
            {
                snInput.Visable     = false;;
                failSnInput.Visable = true;
                Station.NextInput   = failSnInput;
            }
        }
Beispiel #5
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 #6
0
        /// <summary>
        /// 打開卡通或棧板
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void OpenPackingAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000057", new string[] { }));
            }

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

            if (sessionPackObject == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            if (sessionPackObject.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            try
            {
                string result = "";
                LogicObject.Packing packObject  = (LogicObject.Packing)sessionPackObject.Value;
                T_R_PACKING         t_r_packing = new T_R_PACKING(Station.SFCDB, Station.DBType);
                result = t_r_packing.UpdateCloseFlagByPackID(packObject.PackID, "0", Station.SFCDB);
                if (Convert.ToInt32(result) == 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180612154414", new string[] { packObject.PackNo }));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #7
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 #8
0
        /// <summary>
        /// 根據工號檢查密碼是否正確
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void EmpPasswordChecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 2)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession sessionEmp = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionEmp == null || sessionEmp.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE }));
            }
            MESStationSession sessionPwd = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (sessionPwd == null || sessionPwd.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE }));
            }
            T_c_user   t_c_user = new T_c_user(Station.SFCDB, Station.DBType);
            Row_c_user rowUser  = t_c_user.getC_Userbyempno(sessionEmp.Value.ToString(), Station.SFCDB, Station.DBType);

            if (rowUser == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180620163103", new string[] { sessionEmp.Value.ToString() }));
            }
            if (!rowUser.EMP_PASSWORD.Equals(sessionPwd.Value.ToString()))
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180813154717", new string[] { sessionEmp.Value.ToString() }));
            }
        }
Beispiel #9
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 #10
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 #11
0
        public static void OutLot(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            OleExec DB         = Station.SFCDB;
            string  strSql     = "";
            var     SN_Session = Station.StationSession.Find(t => t.MESDataType == "SN" && t.SessionKey == "1");
            SN      sn         = (SN)SN_Session.Value;

            var LotStates = DB.ORM.Queryable <R_LOT_STATUS, R_LOT_DETAIL>
                                ((lot, detail) => lot.LOT_NO == detail.LOT_ID)
                            .Where((lot, detail) => detail.SN == sn.SerialNo && detail.STATUS == "0" && SqlFunc.StartsWith(lot.LOT_NO, "LOT-"))
                            .Select((lot, detail) => new { LOT = lot, Detail = detail }).ToList();


            if (LotStates.Count == 0)
            {
                throw new Exception($@"{sn.SerialNo } not in Lot");
            }
            T_R_SN TRS = new T_R_SN(DB, DB_TYPE_ENUM.Oracle);

            for (int i = 0; i < LotStates.Count; i++)
            {
                var LS = LotStates[i];
                LS.Detail.STATUS    = "1";
                LS.Detail.EDIT_EMP  = Station.LoginUser.EMP_NO;
                LS.Detail.EDIT_TIME = DateTime.Now;
                DB.ORM.Updateable <R_LOT_DETAIL>(LS.Detail).Where(t => t.ID == LS.Detail.ID).ExecuteCommand();
                TRS.RecordPassStationDetail(sn.SerialNo, Station.Line, Station.StationName, LS.LOT.SAMPLE_STATION, Station.BU, DB);
                Station.StationMessages.Add(new StationMessage()
                {
                    Message = $@"'{sn.SerialNo}' Scanout Lot'{LS.LOT.LOT_NO}','{LS.LOT.SAMPLE_STATION}'", State = StationMessageState.Message
                });
            }
        }
        public static void SetNextInputAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            //参数1,获取一个内存变量,检查它的值是否为配置值,
            //如是,设置next为配置2的
            //
            R_Station_Action_Para P1 = Paras[0];
            MESStationSession     s  = Station.StationSession.Find(t => t.MESDataType == P1.SESSION_TYPE && t.SessionKey == P1.SESSION_KEY);

            if (s == null)
            {
                return;
            }
            if (s.Value.ToString() == P1.VALUE.ToString())
            {
                R_Station_Action_Para P2 = Paras[1];
                MESStationInput       i  = Station.Inputs.Find(t => t.DisplayName == P2.VALUE.ToString());
                if (i != null)
                {
                    Station.NextInput = i;
                }
            }
            else
            {
                R_Station_Action_Para P2 = Paras[2];
                MESStationInput       i  = Station.Inputs.Find(t => t.DisplayName == P2.VALUE.ToString());
                if (i != null)
                {
                    Station.NextInput = i;
                }
            }
        }
        public static void LoadSn(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"));
            }

            string NewSN = Input.Value.ToString();

            if (NewSN.Length != 8 && NewSN.Length != 9)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000022", new string[] { "SN" }));
            }
            else
            {
                Input.Value = NewSN.Substring(0, 8);
            }
            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);
            }
        }
        ///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);
        }
        public static void SetNextInputActionForShipFinish(MESPubLab.MESStation.MESStationBase Station,
                                                           MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string dnNo    = Station.DisplayOutput.Find(t => t.Name == "DN_NO").Value.ToString(),
                   dnLine  = Station.DisplayOutput.Find(t => t.Name == "DN_ITEM").Value.ToString();
            var dnComplete = Station.SFCDB.ORM.Queryable <R_DN_STATUS>()
                             .Where(x => x.DN_NO == dnNo && x.DN_LINE == dnLine && x.DN_FLAG == "1").Any();

            #region 加載界面信息
            if (dnComplete)
            {
                Station.StationSession.Clear();
                MESStationInput s = Station.Inputs.Find(t => t.DisplayName == "TO_LIST");
                s.Value = Station.SFCDB.ORM
                          .Queryable <R_TO_HEAD, R_TO_DETAIL, R_DN_STATUS>((rth, rtd, rds) =>
                                                                           rth.TO_NO == rtd.TO_NO && rtd.DN_NO == rds.DN_NO && rds.DN_FLAG == "0")
                          .OrderBy((rth) => rth.TO_CREATETIME, SqlSugar.OrderByType.Desc)
                          .GroupBy(rth => new { rth.TO_NO, rth.PLAN_STARTIME, rth.PLAN_ENDTIME, rth.TO_CREATETIME })
                          .Select(rth => new { rth.TO_NO, rth.PLAN_STARTIME, rth.PLAN_ENDTIME, rth.TO_CREATETIME }).ToList();
            }
            var rShipDetail = Station.SFCDB.ORM.Queryable <R_SHIP_DETAIL>()
                              .Where(x => x.DN_NO == dnNo && x.DN_LINE == dnLine).ToList();
            Station.StationSession.Find(x => x.MESDataType == "REAL_QTY").Value = rShipDetail.Count;
            MESStationInput sp = Station.Inputs.Find(t => t.DisplayName == "PACKNO");
            sp.Value = "";
            #endregion
        }
        /// <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;
            }
        }
        /// <summary>
        /// 從輸入加載RootCause
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input">RootCause輸入值轉換為大寫</param>
        /// <param name="Paras">ErrorCode</param>
        public static void RootCauseDataloader(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 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 }, MESPubLab.MESStation.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 }, MESPubLab.MESStation.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;
            //}
        }
Beispiel #18
0
        /// <summary>
        /// 檢查panel對象中的SN的NextStation是否等於當前工站
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void PanleNextStationChecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession sessionPanle = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionPanle == null || sessionPanle.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE }));
            }
            Panel panel = new Panel();

            Panel            panleObject      = (Panel)sessionPanle.Value;
            T_C_ROUTE_DETAIL t_c_route_detail = new T_C_ROUTE_DETAIL(Station.SFCDB, Station.DBType);

            List <R_SN> snList = panel.GetSnDetail(panleObject.PanelNo, Station.SFCDB, Station.DBType);

            foreach (R_SN sn in snList)
            {
                if (!t_c_route_detail.StationInRoute(sn.ROUTE_ID, Station.StationName, Station.SFCDB))
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180621172210", new string[] { Station.StationName, sn.SN }));
                }
                if (!sn.NEXT_STATION.Equals(Station.StationName))
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000136", new string[] { sn.NEXT_STATION }));
                }
            }
        }
Beispiel #19
0
        /// <summary>
        /// 1.檢查SN 在r_repair_failcode 表中是否已经维修完成
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">1個參數,WO保存的位置</param>
        public static void SNFailCodeReapirDatachecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            T_R_REPAIR_FAILCODE   RepairFailcode = new T_R_REPAIR_FAILCODE(Station.SFCDB, Station.DBType);
            Row_R_REPAIR_FAILCODE FailCodeRow;

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

            if (SNFailCodeSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            else
            {
                if (SNFailCodeSession.Value != null)
                {
                    FailCodeRow = RepairFailcode.GetByFailCodeID(SNFailCodeSession.Value.ToString(), Station.SFCDB);
                    if (FailCodeRow == null)
                    {
                        throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000192", new string[] {  }));
                    }
                }
                else
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].VALUE }));
                }
            }
        }
Beispiel #20
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);
            }
        }
Beispiel #21
0
        /// <summary>
        /// 棧板或卡通是否存在
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void CheckPackingIsExist(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", new string[] { }));
            }

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

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

            T_R_PACKING t_r_packing = new T_R_PACKING(Station.SFCDB, Station.DBType);

            if (!t_r_packing.PackNoIsExist(sessionPackObject.Value.ToString(), Station.SFCDB))
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180613093329", new string[] { sessionPackObject.Value.ToString() }));
            }
        }
Beispiel #22
0
        /// <summary>
        /// 檢查SN條碼或SN對象的KEYPART
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void SNStationKeypartDatachecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            MESStationSession SNSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
            OleExec           SFCDB     = Station.SFCDB;
            SN snObject = null;

            if (SNSession.Value is string)
            {
                snObject = new SN(SNSession.Value.ToString(), Station.SFCDB, Station.DBType);
            }
            else
            {
                snObject = (SN)SNSession.Value;
            }

            if (snObject == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { SNSession.Value.ToString() }));
            }

            T_R_SN_KP      TRKP = new T_R_SN_KP(SFCDB, DB_TYPE_ENUM.Oracle);
            List <R_SN_KP> snkp = TRKP.GetKPRecordBySnIDStation(snObject.ID, Station.StationName, SFCDB);

            List <R_SN_KP> kpwait = snkp.FindAll(T => T.VALUE == "" || T.VALUE == null);

            if (kpwait.Count > 0)
            {
                Station.AddKPScan(snObject.SerialNo, snObject.WorkorderNo, Station.StationName);
                throw new Exception($@"{snObject.SerialNo} 缺少Keypart");
            }
        }
Beispiel #23
0
        /// <summary>
        /// 檢查棧板或卡通是否關閉
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void CheckPackCloseStatus(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", new string[] { }));
            }

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

            if (sessionPackObject == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            if (sessionPackObject.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            try
            {
                LogicObject.Packing packObject = (LogicObject.Packing)sessionPackObject.Value;
                if (packObject.ClosedFlag == "0")
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180611104338", new string[] { packObject.PackNo }));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #24
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 #25
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 #26
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;
            }
        }
        /// <summary>
        /// Sn條碼長度如果是9位,則取前8位
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void LoadSnFromInput(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"));
            }

            string NewSN = Input.Value.ToString();

            if (NewSN.Length != 8 && NewSN.Length != 9)
            {
                // Station.AddMessage("MES00000022", new string[] { "SN" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Fail);
                //Station.NextInput = Station.Inputs[2];
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000022", new string[] { "SN" }));
            }
            else
            {
                Input.Value = NewSN.Substring(0, 8);
            }


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


            //if (Input.Value.ToString().Length == 8)
            //{
            //    //Station.AddMessage("MES00000029", new string[] { "Sn", Input.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            //    //Station.NextInput = Station.Inputs[1];
            //}
            //else if (NewSN)
            //{
            //    Station.AddMessage("MES00000029", new string[] { "LinkQTY", LinkNum.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            //    Station.NextInput = Station.Inputs[1];
            //}
            //else
            //{
            //    Station.AddMessage("MES00000020", new string[] { "LinkQTY", "Number" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message);
            //    Station.NextInput = Station.Inputs[3];
            //}
            //Station.NextInput = Station.Inputs[2];
            ////Station.DBS["APDB"].Borrow()
            //LogicObject.WorkOrder WO = new LogicObject.WorkOrder();
            //WO.WO = Input.Value.ToString();
            //s.Value = WO;
            //s.InputValue = Input.Value.ToString();
            //s.ResetInput = Input;
            //Station.AddMessage("MES00000029", new string[] { "Workorder", WO.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message);
            //Station.AddMessage("MES00000029", new string[] { "Workorder", WO.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            //Station.AddMessage("MES00000029", new string[] { "Workorder", WO.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Fail);
        }
Beispiel #28
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);
            }
        }
        /// <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 #30
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);
        }