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;
            }
        }
        public void SelectRSnLock(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);
                List <R_SN_LOCK> list = LOCK.GetLockList((Data["LOCK_LOT"].ToString()).Trim(), (Data["SN"].ToString()).Trim(), (Data["WORKORDERNO"].ToString()).Trim(), sfcdb);
                if (list.Count > 0)
                {
                    StationReturn.Message = "获取成功!!";
                    StationReturn.Status  = StationReturnStatusValue.Pass;
                    StationReturn.Data    = list;
                }
                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;
            }
        }
Exemple #3
0
        public void GetLockInfo(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn)
        {
            string           type     = Data["Type"].ToString().ToUpper();
            string           status   = Data["Status"].ToString();
            List <string>    snList   = new List <string>();
            OleExec          sfcdb    = null;
            List <R_SN_LOCK> lockList = new List <R_SN_LOCK>();

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                sfcdb.ThrowSqlExeception = true;
                T_R_SN_LOCK t_r_sn_lock = new T_R_SN_LOCK(sfcdb, DBTYPE);
                if (status.ToUpper() == "ALL")
                {
                    status = "";
                }
                if (type == "BYWO")
                {
                    lockList = t_r_sn_lock.GetLockList("", "", "", Data["Data"].ToString(), status, sfcdb);
                }
                else if (type == "BYLOT")
                {
                    lockList = t_r_sn_lock.GetLockList("", Data["Data"].ToString(), "", "", status, sfcdb);
                }
                else if (type == "BYSN")
                {
                    Newtonsoft.Json.Linq.JArray arraySN = (Newtonsoft.Json.Linq.JArray)Data["Data"];
                    for (int i = 0; i < arraySN.Count; i++)
                    {
                        lockList.AddRange(t_r_sn_lock.GetLockList("", "", arraySN[i].ToString(), "", status, sfcdb));
                    }
                }
                else if (type == "BYID")
                {
                    Newtonsoft.Json.Linq.JArray arraySN = (Newtonsoft.Json.Linq.JArray)Data["Data"];
                    for (int i = 0; i < arraySN.Count; i++)
                    {
                        lockList.AddRange(t_r_sn_lock.GetLockList(arraySN[i].ToString(), "", "", "", status, sfcdb));
                    }
                }

                this.DBPools["SFCDB"].Return(sfcdb);
                StationReturn.Data        = lockList;
                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.MessageCode = "MES00000001";
            }
            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);
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// 檢查棧板或卡通中SN是否有被鎖定
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void MovePackCheckSnStatusIsLock(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000057", new string[] { }));
            }

            MESStationSession sessionPackObject = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionPackObject == null || sessionPackObject.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            R_PACKING packObject = Station.SFCDB.ORM.Queryable <R_PACKING>().Where(p => p.PACK_NO == sessionPackObject.Value.ToString()).ToList().FirstOrDefault();

            if (packObject != null)
            {
                T_R_SN_LOCK      tRSnLock    = new T_R_SN_LOCK(Station.SFCDB, Station.DBType);
                List <R_SN_LOCK> rSnLockList = new List <R_SN_LOCK>();
                string           strSnList   = "";
                if (packObject.PACK_TYPE == LogicObject.PackType.PALLET.ToString())
                {
                    rSnLockList = tRSnLock.GetLockListByPackNo(packObject.PACK_NO, Station.SFCDB);
                }
                else if (packObject.PACK_TYPE == LogicObject.PackType.CARTON.ToString())
                {
                    rSnLockList = tRSnLock.GetLockListByCartonNo(packObject.PACK_NO, Station.SFCDB);
                }
                else
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180529094259", new string[] { }));
                }

                foreach (R_SN_LOCK snLock in rSnLockList)
                {
                    strSnList += snLock.SN + ",";
                }
                if (rSnLockList.Count > 0 && packObject.PACK_TYPE == LogicObject.PackType.PALLET.ToString())
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180531114237", new string[] { packObject.PACK_NO, rSnLockList.Count().ToString(), strSnList }));
                }
                if (rSnLockList.Count > 0 && packObject.PACK_TYPE == LogicObject.PackType.CARTON.ToString())
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180808141643", new string[] { packObject.PACK_NO, rSnLockList.Count().ToString(), strSnList }));
                }
            }
            else
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180613093329", new string[] { sessionPackObject.Value.ToString() }));
            }
        }
Exemple #5
0
        /// <summary>
        /// 檢查棧板中SN是否有被鎖定
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void CheckPackSnStatusIsLock(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            MESStationSession packSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
            T_R_SN_LOCK       tRSnLock    = new T_R_SN_LOCK(Station.SFCDB, Station.DBType);
            List <R_SN_LOCK>  rSnLockList = tRSnLock.GetLockListByPackNo(packSession.Value.ToString(), Station.SFCDB);
            string            strSnList   = "";

            foreach (R_SN_LOCK VARIABLE in rSnLockList)
            {
                strSnList += VARIABLE.SN + ",";
            }
            if (rSnLockList.Count > 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180531114237", new string[] { packSession.Value.ToString(), rSnLockList.Count().ToString(), strSnList }));
            }
        }
        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;
            }
        }
Exemple #7
0
        /// <summary>
        /// 檢查線體是否被鎖
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void LineLockedChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            //GET LINE
            string LineName       = Station.Line;
            string CurrentStation = Station.StationName;

            if (string.IsNullOrEmpty(LineName))
            {
                throw new MESReturnMessage("LINE線體加載異常");
            }
            OleExec   sfcdb     = Station.SFCDB;
            R_SN_LOCK r_sn_lock = new T_R_SN_LOCK(sfcdb, DB_TYPE_ENUM.Oracle).GetDetailBySN(sfcdb, LineName, CurrentStation);//sn.SerialNo,sn.CurrentStation

            if (r_sn_lock != null)
            {
                Station.AddMessage("MES00000044", new string[] { "LINE", r_sn_lock.SN, r_sn_lock.LOCK_EMP }, StationMessageState.Fail);
                //return;
                throw new MESReturnMessage("線體被鎖定");
            }
        }
Exemple #8
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);
                }
            }
        }
Exemple #9
0
        /// <summary>
        /// 檢查SN/PanelSN是否被鎖
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void SNLockedChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            //input test
            //string inputValue = Input.Value.ToString();
            //MESStationSession snSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
            //if (snSession == null)
            //{
            //    throw new MESReturnMessage("SN加載異常");
            //}
            //SN sn = (SN) snSession.Value;
            OleExec sfcdb = Station.SFCDB;
            //R_SN_LOCK r_sn_lock = new T_R_SN_LOCK(sfcdb, DB_TYPE_ENUM.Oracle).GetDetailBySN(sfcdb, sn.SerialNo, Station.StationName);//sn.SerialNo,sn.CurrentStation
            R_SN_LOCK r_sn_lock = new T_R_SN_LOCK(sfcdb, DB_TYPE_ENUM.Oracle).GetDetailBySN(sfcdb, Input.Value.ToString(), Station.StationName);//sn.SerialNo,sn.CurrentStation

            if (r_sn_lock != null)
            {
                Station.AddMessage("MES00000044", new string[] { "SN", r_sn_lock.SN, r_sn_lock.LOCK_EMP }, StationMessageState.Fail);
                //return;
                throw new MESReturnMessage("SN被鎖定");
            }
        }
Exemple #10
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);
                }
            }
        }