public List <C_SKU_DETAIL> GetSkuDetailBySkuno(string skuno, OleExec DB) { List <C_SKU_DETAIL> SkuDetails = new List <C_SKU_DETAIL>(); string sql = string.Empty; DataTable dt = new DataTable("AllSkuDetail"); Row_C_SKU_DETAIL SkuDetailRow = (Row_C_SKU_DETAIL)NewRow(); if (this.DBType.Equals(DB_TYPE_ENUM.Oracle)) { sql = $@" SELECT * FROM C_SKU_DETAIL where "; if (skuno == "") { sql += $@" rownum<21 order by EDIT_TIME DESC "; } else { sql += $@" SKUNO='{skuno}' ORDER BY EDIT_TIME DESC "; } dt = DB.ExecSelect(sql, null).Tables[0]; foreach (DataRow dr in dt.Rows) { SkuDetailRow.loadData(dr); SkuDetails.Add(SkuDetailRow.GetDataObject()); } } else { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000019", new string[] { DBType.ToString() }); throw new MESReturnMessage(errMsg); } return(SkuDetails); }
/// <summary> /// 根據料號,類別,類別具體項目來獲得設置在 C_SKU_DETAIL 裡面的值 /// </summary> /// <param name="Category"></param> /// <param name="CategoryName"></param> /// <param name="Skuno"></param> /// <param name="DB"></param> /// <returns></returns> public C_SKU_DETAIL GetSkuDetail(string Category, string CategoryName, string Skuno, OleExec DB) { C_SKU_DETAIL SkuDetail = null; string sql = string.Empty; DataTable dt = new DataTable(); Row_C_SKU_DETAIL SkuDetailRow = (Row_C_SKU_DETAIL)NewRow(); if (this.DBType.Equals(DB_TYPE_ENUM.Oracle)) { sql = $@"SELECT * FROM C_SKU_DETAIL WHERE SKUNO='{Skuno}' AND CATEGORY='{Category}' AND CATEGORY_NAME='{CategoryName}'"; dt = DB.ExecSelect(sql).Tables[0]; if (dt.Rows.Count > 0) { SkuDetailRow.loadData(dt.Rows[0]); SkuDetail = SkuDetailRow.GetDataObject(); } } else { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000019", new string[] { DBType.ToString() }); throw new MESReturnMessage(errMsg); } return(SkuDetail); }