Beispiel #1
0
        public Row_C_SKU_SAMPLE GetBySkuNo(string _SkuNo, string _Station, OleExec DB)
        {
            string strsql = "";

            if (DBType == DB_TYPE_ENUM.Oracle)
            {
                strsql = $@" select ID from c_sku_sample where skuno='{_SkuNo.Replace("'", "''")}' and station_name='{_Station.Replace("'", "''")}'";
                string ID = DB.ExecSelectOneValue(strsql)?.ToString();
                if (ID == null)
                {
                    string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000189", new string[] { _SkuNo, _Station });
                    throw new MESReturnMessage(errMsg);
                }
                Row_C_SKU_SAMPLE R = (Row_C_SKU_SAMPLE)this.GetObjByID(ID, DB);
                return(R);
            }
            else
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000019", new string[] { DBType.ToString() });
                throw new MESReturnMessage(errMsg);
            }
        }
Beispiel #2
0
        public List <C_SKU_SAMPLE> GetSample(string skuno, string station, OleExec DB)
        {
            List <C_SKU_SAMPLE> aqls = new List <C_SKU_SAMPLE>();
            string           sql     = string.Empty;
            DataTable        dt      = new DataTable("C_SKU_SAMPLE");
            Row_C_SKU_SAMPLE aqlsRow = (Row_C_SKU_SAMPLE)NewRow();

            if (this.DBType.Equals(DB_TYPE_ENUM.Oracle))
            {
                sql = $@" select * from c_Sku_Sample where 1=1  ";
                if (skuno != "")
                {
                    sql += $@" and skuno='{skuno}' ";
                }
                if (station != "")
                {
                    sql += $@" and STATION_NAME='{station}' ";
                }
                if (skuno == "" && station == "")
                {
                    sql += $@" and rownum<21  order by EDIT_TIME ";
                }
                dt = DB.ExecSelect(sql, null).Tables[0];
                foreach (DataRow dr in dt.Rows)
                {
                    aqlsRow.loadData(dr);
                    aqls.Add(aqlsRow.GetDataObject());
                }
            }
            else
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000019", new string[] { DBType.ToString() });
                throw new MESReturnMessage(errMsg);
            }

            return(aqls);
        }