Example #1
0
        public R_SN_LOCK GetDetailBySN(OleExec sfcdb, string sn, string station)
        {
            if (string.IsNullOrEmpty(sn) || string.IsNullOrEmpty(station))
            {
                return(null);
            }
            string        sql           = $@"select * from {TableName} where sn='{sn.Replace("'", "''")}' 
                            and lock_station='{station.Replace("'", "''")}' and lock_status='0' ";
            DataTable     dt            = null;
            Row_R_SN_LOCK row_r_sn_lock = null;

            if (DBType == DB_TYPE_ENUM.Oracle)
            {
                dt = sfcdb.ExecSelect(sql).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    row_r_sn_lock = (Row_R_SN_LOCK)this.NewRow();
                    row_r_sn_lock.loadData(dt.Rows[0]);
                }
            }
            else
            {
                return(null);
            }
            return(row_r_sn_lock == null? null: row_r_sn_lock.GetDataObject());
        }
Example #2
0
        public List <R_SN_LOCK> GetLockList(string LOCK_ID, string LOCK_LOT, string SN, string WORKORDERNO, string STATUS, OleExec DB)
        {
            List <R_SN_LOCK> Seq    = new List <R_SN_LOCK>();
            string           sql    = string.Empty;
            DataTable        dt     = new DataTable("C_SEQNO");
            Row_R_SN_LOCK    SeqRow = (Row_R_SN_LOCK)NewRow();

            if (this.DBType.Equals(DB_TYPE_ENUM.Oracle))
            {
                sql = $@"  select * from R_SN_LOCK where 1=1  ";

                if (LOCK_ID != "")
                {
                    sql += $@" and ID='{LOCK_ID}' ";
                }

                if (LOCK_LOT != "")
                {
                    sql += $@" and LOCK_LOT='{LOCK_LOT}' ";
                }

                if (SN != "")
                {
                    sql += $@" and SN='{SN}' ";
                }

                if (WORKORDERNO != "")
                {
                    sql += $@" and WORKORDERNO='{WORKORDERNO}' ";
                }
                if (STATUS != "")
                {
                    sql += $@" and LOCK_STATUS='{STATUS}'";
                }
                if (LOCK_LOT == "" && SN == "" && WORKORDERNO == "")
                {
                    sql += $@" and  rownum<21  order by LOCK_TIME ";
                }
                dt = DB.ExecSelect(sql, null).Tables[0];
                foreach (DataRow dr in dt.Rows)
                {
                    SeqRow.loadData(dr);
                    Seq.Add(SeqRow.GetDataObject());
                }
            }
            else
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000019", new string[] { DBType.ToString() });
                throw new MESReturnMessage(errMsg);
            }

            return(Seq);
        }
Example #3
0
        /// <summary>
        /// 獲取卡通內被鎖定的SN集合
        /// </summary>
        /// <param name="cartonNo"></param>
        /// <param name="sfcdb"></param>
        /// <returns></returns>
        public List <R_SN_LOCK> GetLockListByCartonNo(string cartonNo, OleExec sfcdb)
        {
            string           sql      = $@"select D.* from R_PACKING A,R_SN_PACKING B, R_SN C, R_SN_LOCK D WHERE A.ID = B.PACK_ID
                            AND B.SN_ID = C.ID   AND D.SN = C.SN   AND A.PACK_NO = '{cartonNo}'   AND D.LOCK_STATUS = '1'  ";
            List <R_SN_LOCK> lockList = new List <R_SN_LOCK>();
            DataSet          ds       = sfcdb.ExecSelect(sql);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                Row_R_SN_LOCK rowLock = (Row_R_SN_LOCK)this.NewRow();
                rowLock.loadData(row);
                lockList.Add(rowLock.GetDataObject());
            }
            return(lockList);
        }
Example #4
0
        public List <R_SN_LOCK> GetLockListByPackNo(string packNo, OleExec DB)
        {
            List <R_SN_LOCK> res    = new List <R_SN_LOCK>();
            string           strSql = $@" select E.* from R_PACKING A,R_PACKING B ,R_SN_PACKING C,R_SN D,R_SN_LOCK E WHERE A.ID=C.PACK_ID AND B.ID=A.PARENT_PACK_ID AND C.SN_ID=D.ID AND D.SN=E.SN
                                AND B.PACK_NO='{packNo}' AND E.LOCK_STATUS='1' ";
            DataSet          ds     = DB.ExecSelect(strSql);

            foreach (DataRow VARIABLE in ds.Tables[0].Rows)
            {
                Row_R_SN_LOCK r = (Row_R_SN_LOCK)this.NewRow();
                r.loadData(VARIABLE);
                res.Add(r.GetDataObject());
            }
            return(res);
        }