예제 #1
0
        public void DeleteCKpRule(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string    RWOKPREPLACEIDS = Data["IDS"].ToString().Trim();
            ArrayList DelIds          = new ArrayList(RWOKPREPLACEIDS.Split(','));

            DelIds.Remove("");
            OleExec     oleDB   = null;
            T_C_KP_Rule cKpRule = null;

            try
            {
                oleDB   = this.DBPools["SFCDB"].Borrow();
                cKpRule = new T_C_KP_Rule(oleDB, DBTYPE);
                oleDB.BeginTrain();
                foreach (var VARIABLE in (string[])DelIds.ToArray(typeof(string)))
                {
                    oleDB.ThrowSqlExeception = true;
                    Row_C_KP_Rule row = (Row_C_KP_Rule)cKpRule.GetObjByID(VARIABLE, oleDB, DBTYPE);
                    oleDB.ExecSQL(row.GetDeleteString(DBTYPE));
                }
                oleDB.CommitTrain();
                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.MessageCode = "MES00000004";
            }
            catch (Exception e)
            {
                oleDB.RollbackTrain();
                throw e;
            }
            finally
            {
                this.DBPools["SFCDB"].Return(oleDB);
            }
        }
예제 #2
0
        public void AddCKpRule(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string      Partno = Data["PARTNO"].ToString().Trim(), Mpn = Data["MPN"].ToString().Trim(), ScanType = Data["SCANTYPE"].ToString().Trim(), REGEX = Data["REGEX"].ToString().Trim();
            OleExec     oleDB   = null;
            T_C_KP_Rule cKpRule = null;

            try
            {
                oleDB   = this.DBPools["SFCDB"].Borrow();
                cKpRule = new T_C_KP_Rule(oleDB, DBTYPE);
                if (cKpRule.IsExists(oleDB, Partno, Mpn, ScanType))
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000005";
                    StationReturn.Data        = "";
                }
                else
                {
                    Row_C_KP_Rule row = (Row_C_KP_Rule)cKpRule.NewRow();
                    row.ID                   = cKpRule.GetNewID(this.BU, oleDB, DBTYPE);
                    row.PARTNO               = Partno;
                    row.MPN                  = Mpn;
                    row.SCANTYPE             = ScanType;
                    row.REGEX                = REGEX;
                    row.EDIT_EMP             = this.LoginUser.EMP_NO;
                    row.EDIT_TIME            = GetDBDateTime();;
                    oleDB.ThrowSqlExeception = true;
                    oleDB.ExecSQL(row.GetInsertString(DBTYPE));
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000002";
                    StationReturn.Data        = "";
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                this.DBPools["SFCDB"].Return(oleDB);
            }
        }
예제 #3
0
        public void ModifyCKpRule(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string id            = Data["ID"].ToString().Trim(),
                   REGEX         = Data["REGEX"].ToString().Trim();
            OleExec     oleDB    = null;
            T_C_KP_Rule cKpCheck = null;

            try
            {
                oleDB    = this.DBPools["SFCDB"].Borrow();
                cKpCheck = new T_C_KP_Rule(oleDB, DBTYPE);
                Row_C_KP_Rule row = (Row_C_KP_Rule)cKpCheck.GetObjByID(id, oleDB, DBTYPE);
                if (row == null)
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000005";
                    StationReturn.Data        = "";
                }
                else
                {
                    row.REGEX                = REGEX;
                    row.EDIT_EMP             = this.LoginUser.EMP_NO;
                    row.EDIT_TIME            = GetDBDateTime();
                    oleDB.ThrowSqlExeception = true;
                    oleDB.ExecSQL(row.GetUpdateString(DBTYPE));
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000003";
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                oleDB.ThrowSqlExeception = false;
                this.DBPools["SFCDB"].Return(oleDB);
            }
        }