Ejemplo n.º 1
0
        public void DeleteRSnLock(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            T_R_SN_LOCK LOCK  = null;
            OleExec     sfcdb = null;

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                LOCK  = new T_R_SN_LOCK(sfcdb, DB_TYPE_ENUM.Oracle);
                Row_R_SN_LOCK r      = (Row_R_SN_LOCK)LOCK.GetObjByID((Data["ID"].ToString()).Trim(), sfcdb);
                string        strRet = sfcdb.ExecSQL(r.GetDeleteString(DB_TYPE_ENUM.Oracle));
                if (Convert.ToInt32(strRet) > 0)
                {
                    StationReturn.Message = "删除成功!!";
                    StationReturn.Status  = StationReturnStatusValue.Pass;
                    StationReturn.Data    = "";
                }
                else
                {
                    StationReturn.MessageCode = "MES00000036";
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.Data        = "";
                }
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
Ejemplo n.º 2
0
        public void DoUnlock(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn)
        {
            Newtonsoft.Json.Linq.JArray arraySN = (Newtonsoft.Json.Linq.JArray)Data["ID"];
            string  unlockReason = Data["UnlockReason"].ToString();
            OleExec sfcdb        = null;

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                sfcdb.ThrowSqlExeception = true;
                T_R_SN_LOCK t_r_sn_lock = new T_R_SN_LOCK(sfcdb, DBTYPE);

                for (int i = 0; i < arraySN.Count; i++)
                {
                    Row_R_SN_LOCK rowLock = (Row_R_SN_LOCK)t_r_sn_lock.GetObjByID(arraySN[i].ToString(), sfcdb);
                    if (rowLock.LOCK_STATUS == "1")
                    {
                        rowLock.LOCK_STATUS   = "0";
                        rowLock.UNLOCK_REASON = unlockReason;
                        rowLock.UNLOCK_EMP    = this.LoginUser.EMP_NO;
                        rowLock.UNLOCK_TIME   = GetDBDateTime();
                        sfcdb.ExecSQL(rowLock.GetUpdateString(DBTYPE));
                    }
                }

                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.MessageCode = "MES00000001";
                StationReturn.Data        = "";
            }
            catch (Exception exception)
            {
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000037";
                StationReturn.MessagePara.Add(exception.Message);
                StationReturn.Data = exception.Message;
                if (sfcdb != null)
                {
                    this.DBPools["SFCDB"].Return(sfcdb);
                }
            }
        }