Beispiel #1
0
        public void AddCSeqno(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.NewRow();
                LogicObject.LotNo lot = new LogicObject.LotNo();
                r.ID           = LOCK.GetNewID(this.BU, sfcdb);
                r.LOCK_LOT     = lot.GetNewLotNo("LOCKLOT", sfcdb);
                r.SN           = (Data["SN"].ToString()).Trim();
                r.TYPE         = (Data["TYPE"].ToString()).Trim();
                r.WORKORDERNO  = (Data["WORKORDERNO"].ToString()).Trim();
                r.LOCK_STATION = (Data["LOCK_STATION"].ToString()).Trim();
                r.LOCK_STATUS  = (Data["LOCK_STATUS"].ToString()).Trim();
                r.LOCK_REASON  = (Data["LOCK_REASON"].ToString()).Trim();
                r.LOCK_TIME    = GetDBDateTime();
                r.LOCK_EMP     = this.LoginUser.EMP_NO;
                string strRet = sfcdb.ExecSQL(r.GetInsertString(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;
            }
        }
Beispiel #2
0
        public void DoLock(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn)
        {
            string        lockType    = Data["LockType"].ToString().Trim();
            string        lockReason  = Data["LockReason"].ToString().Trim();
            string        lockStation = Data["LockStation"].ToString().Trim();
            OleExec       sfcdb       = null;
            T_R_SN_LOCK   t_r_sn_lock = null;
            Row_R_SN_LOCK rowSNLock   = null;

            try
            {
                sfcdb       = this.DBPools["SFCDB"].Borrow();
                t_r_sn_lock = new T_R_SN_LOCK(sfcdb, DBTYPE);
                if (lockType == "LockByWo")
                {
                    if (t_r_sn_lock.isUnLock("", "", Data["LockData"].ToString().Trim(), sfcdb))
                    {
                        StationReturn.Status      = StationReturnStatusValue.Fail;
                        StationReturn.MessageCode = "MSGCODE20180730134109";
                        StationReturn.MessagePara.Add(Data["LockData"].ToString().Trim());
                        StationReturn.Data = "";
                        return;
                    }
                    rowSNLock                = (Row_R_SN_LOCK)t_r_sn_lock.NewRow();
                    rowSNLock.ID             = t_r_sn_lock.GetNewID(this.BU, sfcdb);
                    rowSNLock.WORKORDERNO    = Data["LockData"].ToString().Trim();
                    rowSNLock.TYPE           = "WO";
                    rowSNLock.LOCK_STATION   = lockStation;
                    rowSNLock.LOCK_REASON    = lockReason;
                    rowSNLock.LOCK_STATUS    = "1";
                    rowSNLock.LOCK_EMP       = this.LoginUser.EMP_NO;
                    rowSNLock.LOCK_TIME      = GetDBDateTime();
                    sfcdb.ThrowSqlExeception = true;
                    sfcdb.ExecSQL(rowSNLock.GetInsertString(DBTYPE));
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000001";
                    StationReturn.Data        = "";
                }
                else if (lockType == "LockByLot")
                {
                    if (t_r_sn_lock.isUnLock(Data["LockData"].ToString().Trim(), "", "", sfcdb))
                    {
                        StationReturn.Status      = StationReturnStatusValue.Fail;
                        StationReturn.MessageCode = "MSGCODE20180730134109";
                        StationReturn.MessagePara.Add(Data["LockData"].ToString().Trim());
                        StationReturn.Data = "";
                        return;
                    }
                    rowSNLock                = (Row_R_SN_LOCK)t_r_sn_lock.NewRow();
                    rowSNLock.ID             = t_r_sn_lock.GetNewID(this.BU, sfcdb);
                    rowSNLock.LOCK_LOT       = Data["LockData"].ToString().Trim();
                    rowSNLock.TYPE           = "LOT";
                    rowSNLock.LOCK_STATION   = lockStation;
                    rowSNLock.LOCK_REASON    = lockReason;
                    rowSNLock.LOCK_STATUS    = "1";
                    rowSNLock.LOCK_EMP       = this.LoginUser.EMP_NO;
                    rowSNLock.LOCK_TIME      = GetDBDateTime();
                    sfcdb.ThrowSqlExeception = true;
                    sfcdb.ExecSQL(rowSNLock.GetInsertString(DBTYPE));
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000001";
                    StationReturn.Data        = "";
                }
                else if (lockType == "LockBySn")
                {
                    Newtonsoft.Json.Linq.JArray arraySN = (Newtonsoft.Json.Linq.JArray)Data["LockData"];
                    for (int i = 0; i < arraySN.Count; i++)
                    {
                        if (!t_r_sn_lock.isUnLock(arraySN[i].ToString(), "", "", sfcdb))
                        {
                            rowSNLock                = (Row_R_SN_LOCK)t_r_sn_lock.NewRow();
                            rowSNLock.ID             = t_r_sn_lock.GetNewID(this.BU, sfcdb);
                            rowSNLock.SN             = arraySN[i].ToString();
                            rowSNLock.TYPE           = "SN";
                            rowSNLock.LOCK_STATION   = lockStation;
                            rowSNLock.LOCK_REASON    = lockReason;
                            rowSNLock.LOCK_STATUS    = "1";
                            rowSNLock.LOCK_EMP       = this.LoginUser.EMP_NO;
                            rowSNLock.LOCK_TIME      = GetDBDateTime();
                            sfcdb.ThrowSqlExeception = true;
                            sfcdb.ExecSQL(rowSNLock.GetInsertString(DBTYPE));
                        }
                    }
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000001";
                    StationReturn.Data        = "";
                }
                else
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180607163531", new string[] { "LockType" }));
                }
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            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);
                }
            }
        }