Пример #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;
            }
        }
Пример #2
0
        public void DeleteCStationAcation(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec            sfcdb     = null;
            string             DeleteSql = "";
            string             StrID     = "";
            T_c_station_action stationaction;
            T_R_Station_Action saction;

            Newtonsoft.Json.Linq.JArray ID = (Newtonsoft.Json.Linq.JArray)Data["ID"];
            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                sfcdb.BeginTrain();
                stationaction = new T_c_station_action(sfcdb, DBTYPE);
                saction       = new T_R_Station_Action(sfcdb, DBTYPE);
                for (int i = 0; i < ID.Count; i++)
                {
                    StrID = ID[i].ToString();

                    if (saction.CheckExistByCSActionID(StrID, sfcdb))
                    {
                        Row_c_station_action row = (Row_c_station_action)stationaction.GetObjByID(StrID, sfcdb);
                        DeleteSql = row.GetDeleteString(DBTYPE);
                        sfcdb.ExecSQL(DeleteSql);
                    }
                    else
                    {
                        StationReturn.Status      = StationReturnStatusValue.Fail;
                        StationReturn.MessageCode = "MES00000113";
                        sfcdb.RollbackTrain();
                        this.DBPools["SFCDB"].Return(sfcdb);
                        return;
                    }
                }
                sfcdb.CommitTrain();
                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.MessageCode = "MES00000004";
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                sfcdb.RollbackTrain();
                this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
Пример #3
0
        public void DeleteStationAction(String ID, OleExec sfcdb)
        {
            string             DeleteSql = "";
            T_R_Station_Action stationaction;

            try
            {
                stationaction = new T_R_Station_Action(sfcdb, DBTYPE);

                if (stationaction.CheckDataExistByID(ID, sfcdb))
                {
                    Row_R_Station_Action row = (Row_R_Station_Action)stationaction.GetObjByID(ID, sfcdb);
                    DeleteSql = row.GetDeleteString(DBTYPE);
                    sfcdb.ExecSQL(DeleteSql);
                }
            }
            catch (Exception e)
            {
                //  this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
Пример #4
0
        public void AddStationAction(Newtonsoft.Json.Linq.JToken Data, OleExec sfcdb)
        {
            //OleExec sfcdb = null;
            string             InsertSql = "";
            T_R_Station_Action input;
            string             ID = Data["ID"].ToString();
            string             RStationInputID  = Data["R_STATION_INPUT_ID"].ToString();
            string             CStationActionID = Data["C_STATION_ACTION_ID"].ToString();
            double             SeqNo            = Convert.ToDouble(Data["SEQ_NO"]);
            string             ConfigType       = Data["CONFIG_TYPE"].ToString();
            string             ConfigValue      = Data["CONFIG_VALUE"].ToString();
            double             AddFlag          = Convert.ToDouble(Data["ADD_FLAG"]);

            try
            {
                input = new T_R_Station_Action(sfcdb, DBTYPE);
                DeleteStationAction(ID, sfcdb);
                Row_R_Station_Action row = (Row_R_Station_Action)input.NewRow();
                row.ID = ID;
                row.R_STATION_INPUT_ID  = RStationInputID;
                row.C_STATION_ACTION_ID = CStationActionID;
                row.SEQ_NO       = SeqNo;
                row.CONFIG_TYPE  = ConfigType;
                row.CONFIG_VALUE = ConfigValue;
                row.ADD_FLAG     = AddFlag;
                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;
            }
        }
Пример #5
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;
        }