Esempio n. 1
0
        public void Init(C_Input Cmodel, R_Station_Input Rmodel)
        {
            BaseModel   = Cmodel;
            RecordModel = Rmodel;
            OleExec SFCDB = Station.SFCDB;

            try
            {
                //調用處理邏輯
                T_c_station_action      TCSA          = new T_c_station_action(SFCDB, DB_TYPE_ENUM.Oracle);
                T_R_Input_Action        TRIA          = new T_R_Input_Action(SFCDB, DB_TYPE_ENUM.Oracle);
                T_R_Station_Action      TRSA          = new T_R_Station_Action(SFCDB, DB_TYPE_ENUM.Oracle);
                T_R_Station_Input       TRSI          = new T_R_Station_Input(SFCDB, DB_TYPE_ENUM.Oracle);
                T_R_Station_Action_Para TRSAP         = new T_R_Station_Action_Para(SFCDB, DB_TYPE_ENUM.Oracle);
                List <R_Input_Action>   _InputActions = TRIA.GetActionByInputID(InputID, SFCDB);
                //_InputActions.Sort();
                _InputActions.OrderBy(r => r.SEQ_NO);
                for (int i = 0; i < _InputActions.Count; i++)
                {
                    StationAction Action = new StationAction(_InputActions[i], this);
                    InputActions.Add(Action);
                }

                List <R_Station_Action> _StationActions = TRSA.GetActionByInputID(RecordModel.ID, SFCDB);
                for (int i = 0; i < _StationActions.Count; i++)
                {
                    StationAction Action = new StationAction(_StationActions[i], this);
                    InputActions.Add(Action);
                }
            }
            catch (Exception ee)
            {
                throw ee;
            }
        }
Esempio n. 2
0
        void LoadPara(OleExec SFCDB)
        {
            T_R_Station_Action_Para TRSAP = new T_R_Station_Action_Para(SFCDB, DB_TYPE_ENUM.Oracle);

            if (this.StationActionType == StationActionTypeEnum.Input)
            {
                Paras = TRSAP.GetActionParaByInputActionID(RInputAction.ID, SFCDB);
            }
            else
            {
                Paras = TRSAP.GetActionParaByStationActionID(RStationAction.ID, SFCDB);
            }
        }
Esempio n. 3
0
        public void DeleteStationActionPara(String ID, OleExec sfcdb)
        {
            string DeleteSql = "";
            T_R_Station_Action_Para stationactionpara;

            try
            {
                stationactionpara = new T_R_Station_Action_Para(sfcdb, DBTYPE);
                if (stationactionpara.CheckDataExistByID(ID, sfcdb))
                {
                    Row_R_Station_Action_Para row = (Row_R_Station_Action_Para)stationactionpara.GetObjByID(ID, sfcdb);
                    DeleteSql = row.GetDeleteString(DBTYPE);
                    sfcdb.ExecSQL(DeleteSql);
                }
            }
            catch (Exception e)
            {
                //  this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 添加StationActionPara參數
        /// </summary>
        /// <param name="Data"></param>
        /// <param name="sfcdb"></param>
        //public  void AddStationActionPara(Newtonsoft.Json.Linq.JToken Data, OleExec sfcdb)
        //{
        //    //OleExec sfcdb = null;
        //    string InsertSql = "";
        //    T_R_Station_Action_Para input;
        //    string ID = Data["ID"].ToString();
        //    string RStationInputID = Data["R_STATION_INPUT_ID"].ToString();
        //    string RStationActionID = Data["R_STATION_ACTION_ID"].ToString();
        //    double SeqNo = Convert.ToDouble(Data["SEQ_NO"]);
        //    string SessionType = Data["SESSION_TYPE"].ToString();
        //    string SessionValue = Data["SESSION_KEY"].ToString();
        //    string AddFlag = Data["VALUE"].ToString();
        //    try
        //    {
        //        sfcdb = this.DBPools["SFCDB"].Borrow();
        //        input = new T_R_Station_Action_Para(sfcdb, DBTYPE);
        //        DeleteStationActionPara(ID, sfcdb);
        //        Row_R_Station_Action_Para row = (Row_R_Station_Action_Para)input.NewRow();
        //        row.ID = input.GetNewID(BU, sfcdb);
        //        row.R_STATION_ACTION_ID = RStationActionID;
        //        row.R_INPUT_ACTION_ID = RStationInputID;
        //        row.SEQ_NO = SeqNo;
        //        row.SESSION_TYPE = SessionType;
        //        row.SESSION_KEY = SessionValue;
        //        row.EDIT_EMP = LoginUser.EMP_NO;
        //        row.EDIT_TIME = GetDBDateTime();
        //        InsertSql = row.GetInsertString(DBTYPE);
        //        sfcdb.ExecSQL(InsertSql);
        //    }
        //    catch (Exception e)
        //    {
        //     //   this.DBPools["SFCDB"].Return(sfcdb);
        //        throw e;

        //    }

        //}

        public void GetID(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec sfcdb;
            T_R_Station_Action_Para station;
            string ID = "";

            sfcdb = this.DBPools["SFCDB"].Borrow();
            try
            {
                station = new T_R_Station_Action_Para(sfcdb, DBTYPE);
                ID      = station.GetNewID(BU, sfcdb);
                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.Data        = ID;
                StationReturn.MessageCode = "MES00000001";
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
Esempio n. 5
0
        public void AddStationActionPara(Newtonsoft.Json.Linq.JToken Data, OleExec sfcdb)
        {
            //OleExec sfcdb = null;
            string InsertSql = "";
            T_R_Station_Action_Para input;
            string ID               = Data["ID"].ToString();
            string RInputActionID   = Data["R_INPUT_ACTION_ID"].ToString();
            string RStationActionID = Data["R_STATION_ACTION_ID"].ToString();
            double SeqNo            = Convert.ToDouble(Data["SEQ_NO"]);
            string SessionType      = Data["SESSION_TYPE"].ToString();
            string SessionValue     = Data["SESSION_KEY"].ToString();
            string StrValue         = Data["VALUE"].ToString();

            try
            {
                input = new T_R_Station_Action_Para(sfcdb, DBTYPE);
                DeleteStationActionPara(ID, sfcdb);
                Row_R_Station_Action_Para row = (Row_R_Station_Action_Para)input.NewRow();
                row.ID = ID;
                row.R_STATION_ACTION_ID = RStationActionID;
                row.R_INPUT_ACTION_ID   = RInputActionID;
                row.SEQ_NO       = SeqNo;
                row.SESSION_TYPE = SessionType;
                row.SESSION_KEY  = SessionValue;
                row.VALUE        = StrValue;
                row.EDIT_EMP     = LoginUser.EMP_NO;
                row.EDIT_TIME    = GetDBDateTime();
                InsertSql        = row.GetInsertString(DBTYPE);
                sfcdb.ExecSQL(InsertSql);
            }
            catch (Exception e)
            {
                //   this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
Esempio n. 6
0
        public void Init(string DisplayName, OleExec SFCDB)
        {
            //生成R_STATION類
            Dictionary <string, object> ret = new Dictionary <string, object>();
            T_R_Station   T        = new T_R_Station(SFCDB, DBType);
            Row_R_Station R        = T.GetRowByDisplayName(DisplayName, SFCDB);
            R_Station     RStation = R.GetDataObject();

            ret["ID"] = RStation.ID;
            ret["DISPLAY_STATION_NAME"] = RStation.DISPLAY_STATION_NAME;
            ret["STATION_NAME"]         = RStation.STATION_NAME;
            ret["FAIL_STATION_ID"]      = RStation.FAIL_STATION_ID;
            ret["FAIL_STATION_FLAG"]    = RStation.FAIL_STATION_FLAG;
            ret["EDIT_TIME"]            = RStation.EDIT_TIME;
            ret["EDIT_EMP"]             = RStation.EDIT_EMP;

            List <object> inputlist = new List <object>();

            ret["InputList"] = inputlist;
            //生成InputActionList類
            List <R_Station_Input> RStationInputList = new List <R_Station_Input>();
            T_R_Station_Input      T_I = new T_R_Station_Input(SFCDB, DBType);

            RStationInputList = T_I.GetRowsByStationID(RStation.ID, SFCDB, true);

            T_R_Input_Action T_A = new T_R_Input_Action(SFCDB, DBType);

            T_R_Station_Action S_A = new T_R_Station_Action(SFCDB, DBType);

            for (int i = 0; i < RStationInputList.Count; i++)
            {
                Dictionary <string, object> input = new Dictionary <string, object>();

                input                        = MakeInput();
                input["ID"]                  = RStationInputList[i].ID;
                input["STATION_ID"]          = RStationInputList[i].STATION_ID;
                input["INPUT_ID"]            = RStationInputList[i].INPUT_ID;
                input["SEQ_NO"]              = RStationInputList[i].SEQ_NO;
                input["REMEMBER_LAST_INPUT"] = RStationInputList[i].REMEMBER_LAST_INPUT;
                input["EDIT_TIME"]           = RStationInputList[i].EDIT_TIME;
                input["EDIT_EMP"]            = RStationInputList[i].EDIT_EMP;
                input["SCAN_FLAG"]           = RStationInputList[i].SCAN_FLAG;
                input["DISPLAY_NAME"]        = RStationInputList[i].DISPLAY_NAME;

                List <object>         daction     = new List <object>();
                List <R_Input_Action> inputaction = new List <R_Input_Action>();
                inputaction = T_A.GetActionByInputID(RStationInputList[i].INPUT_ID.ToString(), SFCDB);
                for (int j = 0; j < inputaction.Count; j++) //R_Input_Action表
                {
                    Dictionary <string, object> dinputaction = new Dictionary <string, object>();

                    dinputaction["ID"]                  = inputaction[j].ID;
                    dinputaction["INPUT_ID"]            = inputaction[j].INPUT_ID;
                    dinputaction["C_STATION_ACTION_ID"] = inputaction[j].C_STATION_ACTION_ID;
                    dinputaction["SEQ_NO"]              = inputaction[j].SEQ_NO;
                    dinputaction["CONFIG_TYPE"]         = inputaction[j].CONFIG_TYPE;
                    dinputaction["CONFIG_VALUE"]        = inputaction[j].CONFIG_VALUE;
                    dinputaction["ADD_FLAG"]            = inputaction[j].ADD_FLAG;
                    dinputaction["EDIT_TIME"]           = inputaction[j].EDIT_TIME;
                    dinputaction["EDIT_EMP"]            = inputaction[j].EDIT_EMP;
                    //  ret["ParaIA"] =;
                    T_R_Station_Action_Para      T_P      = new T_R_Station_Action_Para(SFCDB, DBType);//R_Station_Action_Para 表
                    List <R_Station_Action_Para> ParaList = T_P.GetActionParaByInputActionID(inputaction[j].ID, SFCDB);
                    dinputaction["ParaSA"] = ParaList;
                    T_C_ACTION_PARA      A_P       = new T_C_ACTION_PARA(SFCDB, DBType); //C_ACTION_PAR 表
                    List <C_ACTION_PARA> AParaList = A_P.QueryActionPara(RStationInputList[i].INPUT_ID, SFCDB);
                    dinputaction["ParaSB"] = AParaList;
                    T_c_station_action CS_A      = new T_c_station_action(SFCDB, DBType);//R_Station_Action_Para 表
                    c_station_action   ParaList3 = CS_A.GetActionByID(inputaction[j].C_STATION_ACTION_ID, SFCDB);
                    dinputaction["C_STATION_ACTION"] = ParaList3;

                    daction.Add(dinputaction);
                }


                List <object>           dsaction      = new List <object>();
                List <R_Station_Action> stationaction = new List <R_Station_Action>();//R_Station_Action 表
                stationaction = S_A.GetActionByInputID(RStationInputList[i].ID.ToString(), SFCDB);


                for (int j = 0; j < stationaction.Count; j++) //R_Station_Action 表
                {
                    Dictionary <string, object> dinputaction2 = new Dictionary <string, object>();
                    dinputaction2       = MakeStationAction();
                    dinputaction2["ID"] = stationaction[j].ID;
                    dinputaction2["R_STATION_INPUT_ID"]  = stationaction[j].R_STATION_INPUT_ID;
                    dinputaction2["C_STATION_ACTION_ID"] = stationaction[j].C_STATION_ACTION_ID;
                    dinputaction2["SEQ_NO"]       = stationaction[j].SEQ_NO;
                    dinputaction2["CONFIG_TYPE"]  = stationaction[j].CONFIG_TYPE;
                    dinputaction2["CONFIG_VALUE"] = stationaction[j].CONFIG_VALUE;
                    dinputaction2["ADD_FLAG"]     = stationaction[j].ADD_FLAG;
                    dinputaction2["EDIT_TIME"]    = stationaction[j].EDIT_TIME;
                    dinputaction2["EDIT_EMP"]     = stationaction[j].EDIT_EMP;

                    T_R_Station_Action_Para      T_P2      = new T_R_Station_Action_Para(SFCDB, DBType);//R_Station_Action_Para 表
                    List <R_Station_Action_Para> ParaList2 = T_P2.GetActionParaByStationActionID(stationaction[j].ID, SFCDB);
                    dinputaction2["ParaSA"] = ParaList2;

                    T_C_ACTION_PARA      A_P       = new T_C_ACTION_PARA(SFCDB, DBType);//C_ACTION_PARA 表
                    List <C_ACTION_PARA> AParaList = A_P.QueryActionParaByStation(stationaction[j].C_STATION_ACTION_ID, SFCDB);
                    dinputaction2["ParaSB"] = AParaList;

                    T_c_station_action CS_A      = new T_c_station_action(SFCDB, DBType);//R_Station_Action_Para 表
                    c_station_action   ParaList3 = CS_A.GetActionByID(stationaction[j].C_STATION_ACTION_ID, SFCDB);
                    dinputaction2["C_STATION_ACTION"] = ParaList3;

                    dsaction.Add(dinputaction2);
                }
                input["StationActionList"] = dsaction;

                inputlist.Add(input);
            }

            ret["InputList"] = inputlist;
            T_R_Station_Output      R_O           = new T_R_Station_Output(SFCDB, DBType);//R_Station_Output 表
            List <R_Station_Output> StationOutput = R_O.GetStationOutputByStationID(RStation.ID, SFCDB, true);

            ret["OutputList"] = StationOutput;

            Station = ret;
        }