BF2033473 RV_PP_Product_BOMLine incorrect in DB

+ Add Order By Seqno
+ Fix Multi-Level BOM sort order
This commit is contained in:
tspc 2008-08-01 05:23:51 +00:00
parent 330ee457e6
commit dcae366a1b
1 changed files with 21 additions and 23 deletions

View File

@ -15,26 +15,25 @@
*****************************************************************************/ *****************************************************************************/
package org.eevolution.process; package org.eevolution.process;
import java.math.BigDecimal;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Properties; import java.util.Properties;
import java.util.logging.*; import java.util.logging.Level;
import java.math.BigDecimal;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.PrintInfo; import org.compiere.model.PrintInfo;
import org.eevolution.model.X_T_BOMLine;
import org.eevolution.model.X_RV_PP_Product_BOMLine;
import org.compiere.print.MPrintFormat; import org.compiere.print.MPrintFormat;
import org.compiere.print.Viewer;
import org.compiere.print.ReportEngine;
import org.compiere.print.ReportCtl; import org.compiere.print.ReportCtl;
import org.compiere.print.ReportEngine;
import org.compiere.process.ProcessInfoParameter; import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.SvrProcess; import org.compiere.process.SvrProcess;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Language; import org.compiere.util.Language;
import org.eevolution.model.X_RV_PP_Product_BOMLine;
import org.eevolution.model.X_T_BOMLine;
/** /**
* BOM lines explosion for print * BOM lines explosion for print
@ -103,29 +102,27 @@ public class PrintBOM extends SvrProcess {
* Print result generate for this report * Print result generate for this report
*/ */
void print() { void print() {
MPrintFormat format = null;
Language language = Language.getLoginLanguage(); // Base Language Language language = Language.getLoginLanguage(); // Base Language
//try current client first, then system
format = MPrintFormat.get(getCtx(), MPrintFormat int pfid = MPrintFormat.getPrintFormat_ID("Multi Level BOM & Formula Detail",
.getPrintFormat_ID("Multi Level BOM & Formula Detail", 53063, getAD_Client_ID()), false); X_RV_PP_Product_BOMLine.Table_ID, getAD_Client_ID());
if (format == null) if (pfid < 0)
format = MPrintFormat.get(getCtx(), MPrintFormat pfid = MPrintFormat.getPrintFormat_ID("Multi Level BOM & Formula Detail",
.getPrintFormat_ID("Multi Level BOM & Formula Detail", 53063, 0), false); //try client 0 X_RV_PP_Product_BOMLine.Table_ID, 0);
format.setLanguage(language);
format.setTranslationLanguage(language); MPrintFormat pf = MPrintFormat.get(getCtx(), pfid, false);
pf.setLanguage(language);
pf.setTranslationLanguage(language);
// query // query
MQuery query = MQuery.get(getCtx(), AD_PInstance_ID, MQuery query = MQuery.get(getCtx(), AD_PInstance_ID, "RV_PP_Product_BOMLine");
"RV_PP_Product_BOMLine");
query.addRestriction("AD_PInstance_ID", MQuery.EQUAL, AD_PInstance_ID); query.addRestriction("AD_PInstance_ID", MQuery.EQUAL, AD_PInstance_ID);
// Engine // Engine
PrintInfo info = new PrintInfo("RV_PP_Product_BOMLine", PrintInfo info = new PrintInfo("RV_PP_Product_BOMLine", X_RV_PP_Product_BOMLine.Table_ID, getRecord_ID());
X_RV_PP_Product_BOMLine.Table_ID, getRecord_ID()); ReportEngine re = new ReportEngine(getCtx(), pf, query, info);
ReportEngine re = new ReportEngine(getCtx(), format, query, info);
ReportCtl.preview(re); ReportCtl.preview(re);
String sql = "DELETE FROM T_BomLine WHERE AD_PInstance_ID = " String sql = "DELETE FROM T_BomLine WHERE AD_PInstance_ID = " + AD_PInstance_ID;
+ AD_PInstance_ID;
DB.executeUpdate(sql, get_TrxName()); DB.executeUpdate(sql, get_TrxName());
} }
@ -248,7 +245,8 @@ public class PrintBOM extends SvrProcess {
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql = new String( String sql = new String(
"SELECT PP_Product_BOMLine_ID, M_Product_ID FROM PP_Product_BOMLine boml WHERE IsActive = 'Y' AND PP_Product_BOM_ID = ? "); "SELECT PP_Product_BOMLine_ID, M_Product_ID FROM PP_Product_BOMLine boml "
+ "WHERE IsActive = 'Y' AND PP_Product_BOM_ID = ? ORDER BY Line ");
try { try {
stmt = DB.prepareStatement(sql, get_TrxName()); stmt = DB.prepareStatement(sql, get_TrxName());
stmt.setInt(1, PP_Product_BOM_ID); stmt.setInt(1, PP_Product_BOM_ID);