Exemplo n.º 1
0
        public void QueryWorkClass(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string              className     = Data["CLASS_NAME"].ToString().Trim();
            OleExec             sfcdb         = null;
            T_C_WORK_CLASS      workClass     = null;
            List <C_WORK_CLASS> workClassList = new List <C_WORK_CLASS>();

            try
            {
                sfcdb         = this.DBPools["SFCDB"].Borrow();
                workClass     = new T_C_WORK_CLASS(sfcdb, DBTYPE);
                workClassList = workClass.GetWorkClassList(sfcdb, className);
                if (workClassList.Count > 0)
                {
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000033";
                    StationReturn.Data        = workClassList;
                }
                else
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000034";
                    StationReturn.Data        = "";
                }
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception exception)
            {
                this.DBPools["SFCDB"].Return(sfcdb);
                throw exception;
            }
        }
Exemplo n.º 2
0
        public void DeleteWorkClass(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            //string id = Data["CLASS_ID"].ToString().Trim();
            Newtonsoft.Json.Linq.JArray idArray = (Newtonsoft.Json.Linq.JArray)Data["CLASS_ID"];
            OleExec          oleDB     = null;
            T_C_WORK_CLASS   workClass = null;
            Row_C_WORK_CLASS workClassRow;

            if (idArray.Count == 0)
            {
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000006";
                StationReturn.MessagePara.Add("CLASS ID");
                StationReturn.Data = "";
                return;
            }
            try
            {
                oleDB = this.DBPools["SFCDB"].Borrow();
                oleDB.ThrowSqlExeception = true;
                oleDB.BeginTrain();
                workClass = new T_C_WORK_CLASS(oleDB, DBTYPE);
                for (int i = 0; i < idArray.Count; i++)
                {
                    workClassRow = (Row_C_WORK_CLASS)workClass.GetObjByID(idArray[i].ToString(), oleDB, DBTYPE);

                    oleDB.ExecSQL(workClassRow.GetDeleteString(DBTYPE));
                }
                oleDB.CommitTrain();
                StationReturn.Status  = StationReturnStatusValue.Pass;
                StationReturn.Message = "MES00000004";
                StationReturn.Data    = "";
                this.DBPools["SFCDB"].Return(oleDB);
            }
            catch (Exception exception)
            {
                oleDB.RollbackTrain();
                this.DBPools["SFCDB"].Return(oleDB);
                throw exception;
            }
        }
Exemplo n.º 3
0
        public void UpdateWorkClass(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string           strID        = Data["CLASS_ID"].ToString().Trim();
            string           newClassName = Data["NEW_CLASS_NAME"].ToString().Trim();
            string           startTime    = Data["START_TIME"].ToString().Trim();
            string           endTime      = Data["END_TIME"].ToString().Trim();
            OleExec          oleDB        = null;
            T_C_WORK_CLASS   workClass    = null;
            Row_C_WORK_CLASS workClassRow = null;

            if (string.IsNullOrEmpty(strID))
            {
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000006";
                StationReturn.MessagePara.Add("CLASS ID");
                StationReturn.Data = "";
                return;
            }
            if (string.IsNullOrEmpty(startTime))
            {
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000006";
                StationReturn.MessagePara.Add("START TIME");
                StationReturn.Data = "";
                return;
            }
            if (string.IsNullOrEmpty(endTime))
            {
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000006";
                StationReturn.MessagePara.Add("END TIME");
                StationReturn.Data = "";
                return;
            }
            try
            {
                oleDB        = this.DBPools["SFCDB"].Borrow();
                workClass    = new T_C_WORK_CLASS(oleDB, DBTYPE);
                workClassRow = (Row_C_WORK_CLASS)workClass.NewRow();
                if (!workClass.WorkClassIsExistByID(strID, oleDB))
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000007";
                    StationReturn.Data        = "";
                }
                else if (!string.IsNullOrEmpty(newClassName) && workClass.WorkClassIsExistByName(newClassName, oleDB))
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000008";
                    StationReturn.MessagePara.Add(newClassName);
                    StationReturn.Data = "";
                }
                else
                {
                    workClassRow = (Row_C_WORK_CLASS)workClass.GetObjByID(strID, oleDB, DBTYPE);
                    if (!string.IsNullOrEmpty(newClassName))
                    {
                        workClassRow.NAME = newClassName;
                    }
                    if (!string.IsNullOrEmpty(startTime))
                    {
                        workClassRow.START_TIME = startTime;
                    }
                    if (!string.IsNullOrEmpty(endTime))
                    {
                        workClassRow.END_TIME = endTime;
                    }
                    oleDB.ThrowSqlExeception = true;
                    oleDB.ExecSQL(workClassRow.GetUpdateString(DBTYPE));
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000003";
                    StationReturn.Data        = "";
                }
                this.DBPools["SFCDB"].Return(oleDB);
            }
            catch (Exception exception)
            {
                this.DBPools["SFCDB"].Return(oleDB);
                throw exception;
            }
        }
Exemplo n.º 4
0
        public void AddWorkClass(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string         className = Data["CLASS_NAME"].ToString().Trim();
            string         startTime = Data["START_TIME"].ToString().Trim();
            string         endTime   = Data["END_TIME"].ToString().Trim();
            bool           isExist   = false;
            OleExec        oleDB     = null;
            T_C_WORK_CLASS workClass = null;

            if (string.IsNullOrEmpty(className))
            {
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000006";
                StationReturn.MessagePara.Add("CLASS NAME");
                StationReturn.Data = "";
                return;
            }
            if (string.IsNullOrEmpty(startTime))
            {
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000006";
                StationReturn.MessagePara.Add("START TIME");
                StationReturn.Data = "";
                return;
            }
            if (string.IsNullOrEmpty(endTime))
            {
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000006";
                StationReturn.MessagePara.Add("END TIME");
                StationReturn.Data = "";
                return;
            }
            try
            {
                oleDB     = this.DBPools["SFCDB"].Borrow();
                workClass = new T_C_WORK_CLASS(oleDB, DBTYPE);
                if (workClass.WorkClassIsExistByName(className, oleDB))
                {
                    StationReturn.MessagePara.Add(className);
                    isExist = true;
                }
                if (workClass.TimeIsExist(startTime, oleDB))
                {
                    StationReturn.MessagePara.Add(startTime);
                    isExist = true;
                }
                if (workClass.TimeIsExist(endTime, oleDB))
                {
                    StationReturn.MessagePara.Add(endTime);
                    isExist = true;
                }
                if (isExist)
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000008";
                    StationReturn.Data        = "";
                }
                else
                {
                    Row_C_WORK_CLASS workClassRow = (Row_C_WORK_CLASS)workClass.NewRow();
                    workClassRow.ID          = workClass.GetNewID(this.BU, oleDB, DBTYPE);
                    workClassRow.NAME        = className;
                    workClassRow.START_TIME  = startTime;
                    workClassRow.END_TIME    = endTime;
                    oleDB.ThrowSqlExeception = true;
                    oleDB.ExecSQL(workClassRow.GetInsertString(DBTYPE));
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000002";
                    StationReturn.Data        = "";
                }
                this.DBPools["SFCDB"].Return(oleDB);
            }
            catch (Exception exctption)
            {
                this.DBPools["SFCDB"].Return(oleDB);
                throw exctption;
            }
        }