IDEMPIERE-1559 create purchase order not success still make link / based on patch from hieplq

This commit is contained in:
Carlos Ruiz 2013-11-25 19:02:58 -05:00
parent a99c11e203
commit b1d9aad6f2
19 changed files with 65 additions and 29 deletions

View File

@ -265,8 +265,7 @@ public class InOutGenerateRMA extends SvrProcess
} }
// Add processing information to process log // Add processing information to process log
addLog(shipment.getM_InOut_ID(), shipment.getMovementDate(), null, processMsg.toString(),shipment.get_Table_ID(),shipment.getM_InOut_ID() addBufferLog(shipment.getM_InOut_ID(), shipment.getMovementDate(), null, processMsg.toString(),shipment.get_Table_ID(),shipment.getM_InOut_ID());
);
m_created++; m_created++;
} }

View File

@ -216,7 +216,7 @@ public class InvoiceGenerateRMA extends SvrProcess
// Add processing information to process log // Add processing information to process log
String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + processMsg.toString()); String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + processMsg.toString());
addLog(invoice.getC_Invoice_ID(), invoice.getDateInvoiced(), null, message, invoice.get_Table_ID(), invoice.getC_Invoice_ID()); addBufferLog(invoice.getC_Invoice_ID(), invoice.getDateInvoiced(), null, message, invoice.get_Table_ID(), invoice.getC_Invoice_ID());
m_created++; m_created++;
} }
} }

View File

@ -399,7 +399,7 @@ public class AllocationAuto extends SvrProcess
if (payment.allocateIt()) if (payment.allocateIt())
{ {
String message = Msg.parseTranslation(getCtx(), "@PaymentAllocated@ " + payment.getDocumentNo() + " [1]"); String message = Msg.parseTranslation(getCtx(), "@PaymentAllocated@ " + payment.getDocumentNo() + " [1]");
addLog(0, payment.getDateAcct(), openAmt, message, payment.get_Table_ID(), payment.getC_Payment_ID()); addBufferLog(0, payment.getDateAcct(), openAmt, message, payment.get_Table_ID(), payment.getC_Payment_ID());
count++; count++;
} }
break; break;
@ -444,7 +444,7 @@ public class AllocationAuto extends SvrProcess
if (payment.allocateIt()) if (payment.allocateIt())
{ {
String message = Msg.parseTranslation(getCtx(), "@PaymentAllocated@ " + payment.getDocumentNo() + " [n]"); String message = Msg.parseTranslation(getCtx(), "@PaymentAllocated@ " + payment.getDocumentNo() + " [n]");
addLog(0, payment.getDateAcct(), availableAmt, message); addBufferLog(0, payment.getDateAcct(), availableAmt, message, payment.get_Table_ID(), payment.getC_Payment_ID());
count++; count++;
} }
} }

View File

@ -64,7 +64,7 @@ public class BOMFlagValidate extends SvrProcess {
while (rs.next()) while (rs.next())
{ {
StringBuilder msglog=new StringBuilder().append(rs.getString(1)).append(" BOM without BOM lines"); StringBuilder msglog=new StringBuilder().append(rs.getString(1)).append(" BOM without BOM lines");
addLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2)); addBufferLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
} }
} catch (SQLException e) { } catch (SQLException e) {
throw e; throw e;
@ -120,7 +120,7 @@ public class BOMFlagValidate extends SvrProcess {
while (rs.next()) while (rs.next())
{ {
StringBuilder msglog = new StringBuilder().append(rs.getString(1)).append(" not BOM with BOM lines"); StringBuilder msglog = new StringBuilder().append(rs.getString(1)).append(" not BOM with BOM lines");
addLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2)); addBufferLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
} }
} catch (SQLException e) { } catch (SQLException e) {
throw e; throw e;

View File

@ -108,7 +108,7 @@ public class BOMValidate extends SvrProcess
while (rs.next ()) while (rs.next ())
{ {
String info = validateProduct(new MProduct(getCtx(), rs.getInt("M_Product_ID"), get_TrxName())); String info = validateProduct(new MProduct(getCtx(), rs.getInt("M_Product_ID"), get_TrxName()));
addLog(0, null, null, info, MProduct.Table_ID, rs.getInt("M_Product_ID")); addBufferLog(0, null, null, info, MProduct.Table_ID, rs.getInt("M_Product_ID"));
counter++; counter++;
} }
} }

View File

@ -182,7 +182,7 @@ public class BOMVerify extends SvrProcess
if (p_fromButton) if (p_fromButton)
addLog(0, null, null, product.getValue() + " recursively contains " + pp.getValue()); addLog(0, null, null, product.getValue() + " recursively contains " + pp.getValue());
else else
addLog(0, null, null, product.getValue() + " recursively contains " + pp.getValue(), MProduct.Table_ID, product.getM_Product_ID()); addBufferLog(0, null, null, product.getValue() + " recursively contains " + pp.getValue(), MProduct.Table_ID, product.getM_Product_ID());
} }
else else
{ {
@ -200,7 +200,7 @@ public class BOMVerify extends SvrProcess
if (p_fromButton) if (p_fromButton)
addLog(0, null, null, product.getValue() + " does not have lines"); addLog(0, null, null, product.getValue() + " does not have lines");
else else
addLog(0, null, null, product.getValue() + " does not have lines", MProduct.Table_ID, product.getM_Product_ID()); addBufferLog(0, null, null, product.getValue() + " does not have lines", MProduct.Table_ID, product.getM_Product_ID());
} }
checkedproducts.add(product); checkedproducts.add(product);

View File

@ -68,7 +68,7 @@ public class ConvertLead extends SvrProcess {
bp.setName(lead.getName()); bp.setName(lead.getName());
bp.saveEx(); bp.saveEx();
addLog(bp.getC_BPartner_ID(), null, null, "@C_BPartner_ID@ @Created@", MBPartner.Table_ID, bp.getC_BPartner_ID()); addBufferLog(bp.getC_BPartner_ID(), null, null, "@C_BPartner_ID@ @Created@", MBPartner.Table_ID, bp.getC_BPartner_ID());
lead.setC_BPartner_ID(bp.getC_BPartner_ID()); lead.setC_BPartner_ID(bp.getC_BPartner_ID());
@ -139,7 +139,7 @@ public class ConvertLead extends SvrProcess {
op.saveEx(); op.saveEx();
addLog(op.getC_Opportunity_ID(), null, null, "@C_Opportunity_ID@ @Created@", MOpportunity.Table_ID, op.getC_Opportunity_ID()); addBufferLog(op.getC_Opportunity_ID(), null, null, "@C_Opportunity_ID@ @Created@", MOpportunity.Table_ID, op.getC_Opportunity_ID());
} }
lead.setIsSalesLead(false); lead.setIsSalesLead(false);

View File

@ -338,7 +338,7 @@ public class CostUpdate extends SvrProcess
msg.append(m_docType.getName()).append(" ").append(inventoryDoc.getDocumentNo()); msg.append(m_docType.getName()).append(" ").append(inventoryDoc.getDocumentNo());
else else
msg.append(m_docType.get_Translation(I_C_DocType.COLUMNNAME_Name)).append(" ").append(inventoryDoc.getDocumentNo()); msg.append(m_docType.get_Translation(I_C_DocType.COLUMNNAME_Name)).append(" ").append(inventoryDoc.getDocumentNo());
addLog(getAD_PInstance_ID(), null, null, msg.toString(), I_M_Inventory.Table_ID, inventoryDoc.getM_Inventory_ID()); addBufferLog(getAD_PInstance_ID(), null, null, msg.toString(), I_M_Inventory.Table_ID, inventoryDoc.getM_Inventory_ID());
} }
} }
} }

View File

@ -224,7 +224,7 @@ public class ExpenseAPInvoice extends SvrProcess
throw new IllegalStateException("Cannot save Invoice"); throw new IllegalStateException("Cannot save Invoice");
// //
m_noInvoices++; m_noInvoices++;
addLog(invoice.get_ID(), invoice.getDateInvoiced(), addBufferLog(invoice.get_ID(), invoice.getDateInvoiced(),
invoice.getGrandTotal(), invoice.getDocumentNo(), invoice.get_Table_ID(), invoice.getC_Invoice_ID()); invoice.getGrandTotal(), invoice.getDocumentNo(), invoice.get_Table_ID(), invoice.getC_Invoice_ID());
} // completeInvoice } // completeInvoice

View File

@ -282,7 +282,7 @@ public class ExpenseSOrder extends SvrProcess
if (!m_order.save()) if (!m_order.save())
throw new IllegalStateException("Cannot save Order"); throw new IllegalStateException("Cannot save Order");
m_noOrders++; m_noOrders++;
addLog (m_order.get_ID(), m_order.getDateOrdered(), m_order.getGrandTotal(), m_order.getDocumentNo(), m_order.get_Table_ID(), m_order.getC_Order_ID()); addBufferLog (m_order.get_ID(), m_order.getDateOrdered(), m_order.getGrandTotal(), m_order.getDocumentNo(), m_order.get_Table_ID(), m_order.getC_Order_ID());
m_order = null; m_order = null;
} // completeOrder } // completeOrder

View File

@ -582,7 +582,7 @@ public class InOutGenerate extends SvrProcess
} }
m_shipment.saveEx(); m_shipment.saveEx();
String message = Msg.parseTranslation(getCtx(), "@ShipmentProcessed@ " + m_shipment.getDocumentNo()); String message = Msg.parseTranslation(getCtx(), "@ShipmentProcessed@ " + m_shipment.getDocumentNo());
addLog(m_shipment.getM_InOut_ID(), m_shipment.getMovementDate(), null, message, m_shipment.get_Table_ID(),m_shipment.getM_InOut_ID()); addBufferLog(m_shipment.getM_InOut_ID(), m_shipment.getMovementDate(), null, message, m_shipment.get_Table_ID(),m_shipment.getM_InOut_ID());
m_created++; m_created++;
//reset storage cache as MInOut.completeIt will update m_storage //reset storage cache as MInOut.completeIt will update m_storage

View File

@ -167,7 +167,7 @@ public class InvoiceBatchProcess extends SvrProcess
m_invoice.saveEx(); m_invoice.saveEx();
String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + m_invoice.getDocumentNo()); String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + m_invoice.getDocumentNo());
addLog(0, m_invoice.getDateInvoiced(), m_invoice.getGrandTotal(), message, m_invoice.get_Table_ID(), m_invoice.getC_Invoice_ID()); addBufferLog(0, m_invoice.getDateInvoiced(), m_invoice.getGrandTotal(), message, m_invoice.get_Table_ID(), m_invoice.getC_Invoice_ID());
m_count++; m_count++;
m_invoice = null; m_invoice = null;

View File

@ -271,7 +271,7 @@ public class InvoiceGenerate extends SvrProcess
if (completeOrder && !fullyDelivered) if (completeOrder && !fullyDelivered)
{ {
if (log.isLoggable(Level.FINE)) log.fine("Failed CompleteOrder - " + oLine); if (log.isLoggable(Level.FINE)) log.fine("Failed CompleteOrder - " + oLine);
addLog(0, null, null,"Failed CompleteOrder - " + oLine,oLine.get_Table_ID(),oLine.getC_OrderLine_ID()); // Elaine 2008/11/25 addBufferLog(0, null, null,"Failed CompleteOrder - " + oLine,oLine.get_Table_ID(),oLine.getC_OrderLine_ID()); // Elaine 2008/11/25
completeOrder = false; completeOrder = false;
break; break;
} }
@ -291,7 +291,7 @@ public class InvoiceGenerate extends SvrProcess
{ {
if (log.isLoggable(Level.FINE)) log.fine("Failed: " + order.getInvoiceRule() if (log.isLoggable(Level.FINE)) log.fine("Failed: " + order.getInvoiceRule()
+ " - ToInvoice=" + toInvoice + " - " + oLine); + " - ToInvoice=" + toInvoice + " - " + oLine);
addLog(0, null, null,"Failed: " + order.getInvoiceRule() addBufferLog(0, null, null,"Failed: " + order.getInvoiceRule()
+ " - ToInvoice=" + toInvoice + " - " + oLine,oLine.get_Table_ID(),oLine.getC_OrderLine_ID()); + " - ToInvoice=" + toInvoice + " - " + oLine,oLine.get_Table_ID(),oLine.getC_OrderLine_ID());
} }
} // for all order lines } // for all order lines
@ -489,14 +489,14 @@ public class InvoiceGenerate extends SvrProcess
if (!m_invoice.processIt(p_docAction)) if (!m_invoice.processIt(p_docAction))
{ {
log.warning("completeInvoice - failed: " + m_invoice); log.warning("completeInvoice - failed: " + m_invoice);
addLog(0, null, null,"completeInvoice - failed: " + m_invoice,m_invoice.get_Table_ID(),m_invoice.getC_Invoice_ID()); // Elaine 2008/11/25 addBufferLog(0, null, null,"completeInvoice - failed: " + m_invoice,m_invoice.get_Table_ID(),m_invoice.getC_Invoice_ID()); // Elaine 2008/11/25
throw new IllegalStateException("Invoice Process Failed: " + m_invoice + " - " + m_invoice.getProcessMsg()); throw new IllegalStateException("Invoice Process Failed: " + m_invoice + " - " + m_invoice.getProcessMsg());
} }
m_invoice.saveEx(); m_invoice.saveEx();
String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + m_invoice.getDocumentNo()); String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + m_invoice.getDocumentNo());
addLog(m_invoice.getC_Invoice_ID(), m_invoice.getDateInvoiced(), null, message, m_invoice.get_Table_ID(), m_invoice.getC_Invoice_ID()); addBufferLog(m_invoice.getC_Invoice_ID(), m_invoice.getDateInvoiced(), null, message, m_invoice.get_Table_ID(), m_invoice.getC_Invoice_ID());
m_created++; m_created++;
} }
m_invoice = null; m_invoice = null;

View File

@ -210,7 +210,7 @@ public class OrderPOCreate extends SvrProcess
{ {
po = createPOForVendor(rs.getInt(1), so); po = createPOForVendor(rs.getInt(1), so);
String message = Msg.parseTranslation(getCtx(), "@OrderCreated@ " + po.getDocumentNo()); String message = Msg.parseTranslation(getCtx(), "@OrderCreated@ " + po.getDocumentNo());
addLog(0, null, null, message, po.get_Table_ID(), po.getC_Order_ID()); addBufferLog (0, null, null, message, po.get_Table_ID(), po.getC_Order_ID());
counter++; counter++;
} }

View File

@ -150,6 +150,7 @@ public class RequestInvoice extends SvrProcess
catch (Exception e) catch (Exception e)
{ {
log.log (Level.SEVERE, sql.toString(), e); log.log (Level.SEVERE, sql.toString(), e);
throw e;
} }
finally finally
{ {
@ -180,7 +181,7 @@ public class RequestInvoice extends SvrProcess
} }
m_invoice.saveEx(); m_invoice.saveEx();
String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + m_invoice.getDocumentNo()); String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + m_invoice.getDocumentNo());
addLog(0, null, m_invoice.getGrandTotal(), message, m_invoice.get_Table_ID(), m_invoice.getC_Invoice_ID()); addBufferLog(0, null, m_invoice.getGrandTotal(), message, m_invoice.get_Table_ID(), m_invoice.getC_Invoice_ID());
} }
} }
m_invoice = null; m_invoice = null;

View File

@ -382,7 +382,7 @@ public class RequisitionPOCreate extends SvrProcess
{ {
m_order.load(get_TrxName()); m_order.load(get_TrxName());
String message = Msg.parseTranslation(getCtx(), "@GeneratedPO@ " + m_order.getDocumentNo()); String message = Msg.parseTranslation(getCtx(), "@GeneratedPO@ " + m_order.getDocumentNo());
addLog(0, null, m_order.getGrandTotal(), message, m_order.get_Table_ID(), m_order.getC_Order_ID()); addBufferLog(0, null, m_order.getGrandTotal(), message, m_order.get_Table_ID(), m_order.getC_Order_ID());
} }
m_order = null; m_order = null;
m_orderLine = null; m_orderLine = null;

View File

@ -175,7 +175,7 @@ public class RfQCreatePO extends SvrProcess
order.setSalesRep_ID(rfq.getSalesRep_ID()); order.setSalesRep_ID(rfq.getSalesRep_ID());
order.saveEx(); order.saveEx();
noOrders++; noOrders++;
addLog(0, null, null, order.getDocumentNo(), order.get_Table_ID(), order.getC_Order_ID()); addBufferLog(0, null, null, order.getDocumentNo(), order.get_Table_ID(), order.getC_Order_ID());
} }
// For all Qtys // For all Qtys
MRfQResponseLineQty[] qtys = line.getQtys(false); MRfQResponseLineQty[] qtys = line.getQtys(false);

View File

@ -22,6 +22,8 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
@ -54,6 +56,26 @@ public abstract class SvrProcess implements ProcessCall
public static final String PROCESS_INFO_CTX_KEY = "ProcessInfo"; public static final String PROCESS_INFO_CTX_KEY = "ProcessInfo";
public static final String PROCESS_UI_CTX_KEY = "ProcessUI"; public static final String PROCESS_UI_CTX_KEY = "ProcessUI";
private List<ProcessInfoLog> listEntryLog;
/**
* Add log to buffer, only process total success, flush buffer
* @param id
* @param date
* @param number
* @param msg
* @param tableId
* @param recordId
*/
public void addBufferLog(int id, Timestamp date, BigDecimal number, String msg, int tableId ,int recordId) {
ProcessInfoLog entryLog = new ProcessInfoLog(id, date, number, msg, tableId, recordId);
if (listEntryLog == null)
listEntryLog = new ArrayList<ProcessInfoLog>();
listEntryLog.add(entryLog);
}
/** /**
* Server Process. * Server Process.
* Note that the class is initiated by startProcess. * Note that the class is initiated by startProcess.
@ -191,7 +213,10 @@ public abstract class SvrProcess implements ProcessCall
//transaction should rollback if there are error in process //transaction should rollback if there are error in process
if ("@Error@".equals(msg)) if ("@Error@".equals(msg))
success = false; success = false;
if (success)
flushBufferLog();
// Parse Variables // Parse Variables
msg = Msg.parseTranslation(m_ctx, msg); msg = Msg.parseTranslation(m_ctx, msg);
m_pi.setSummary (msg, !success); m_pi.setSummary (msg, !success);
@ -449,7 +474,7 @@ public abstract class SvrProcess implements ProcessCall
if (m_pi != null) if (m_pi != null)
m_pi.addLog(id, date, number, msg,tableId,recordId); m_pi.addLog(id, date, number, msg,tableId,recordId);
if (log.isLoggable(Level.INFO)) log.info(id + " - " + date + " - " + number + " - " + msg +" - "+tableId); if (log.isLoggable(Level.INFO)) log.info(id + " - " + date + " - " + number + " - " + msg + " - " + tableId + " - " + recordId);
} // addLog } // addLog
/************************************************************************** /**************************************************************************
@ -476,6 +501,17 @@ public abstract class SvrProcess implements ProcessCall
addLog (0, null, null, msg); addLog (0, null, null, msg);
} // addLog } // addLog
private void flushBufferLog () {
if (listEntryLog == null)
return;
for (ProcessInfoLog entryLog : listEntryLog) {
if (m_pi != null)
m_pi.addLog(entryLog);
if (log.isLoggable(Level.INFO)) log.info(entryLog.getP_ID() + " - " + entryLog.getP_Date() + " - " + entryLog.getP_Number() + " - " + entryLog.getP_Msg() + " - " + entryLog.getAD_Table_ID() + " - " + entryLog.getRecord_ID());
}
}
/************************************************************************** /**************************************************************************
* Execute function * Execute function
* @param className class * @param className class

View File

@ -164,7 +164,7 @@ public class BankTransfer extends SvrProcess
throw new IllegalStateException("Payment Process Failed: " + paymentBankFrom + " - " + paymentBankFrom.getProcessMsg()); throw new IllegalStateException("Payment Process Failed: " + paymentBankFrom + " - " + paymentBankFrom.getProcessMsg());
} }
paymentBankFrom.saveEx(); paymentBankFrom.saveEx();
addLog(paymentBankFrom.getC_Payment_ID(), paymentBankFrom.getDateTrx(), addBufferLog(paymentBankFrom.getC_Payment_ID(), paymentBankFrom.getDateTrx(),
null, paymentBankFrom.getC_DocType().getName() + " " + paymentBankFrom.getDocumentNo(), null, paymentBankFrom.getC_DocType().getName() + " " + paymentBankFrom.getDocumentNo(),
MPayment.Table_ID, paymentBankFrom.getC_Payment_ID()); MPayment.Table_ID, paymentBankFrom.getC_Payment_ID());
m_created++; m_created++;
@ -190,7 +190,7 @@ public class BankTransfer extends SvrProcess
throw new IllegalStateException("Payment Process Failed: " + paymentBankTo + " - " + paymentBankTo.getProcessMsg()); throw new IllegalStateException("Payment Process Failed: " + paymentBankTo + " - " + paymentBankTo.getProcessMsg());
} }
paymentBankTo.saveEx(); paymentBankTo.saveEx();
addLog(paymentBankTo.getC_Payment_ID(), paymentBankTo.getDateTrx(), addBufferLog(paymentBankTo.getC_Payment_ID(), paymentBankTo.getDateTrx(),
null, paymentBankTo.getC_DocType().getName() + " " + paymentBankTo.getDocumentNo(), null, paymentBankTo.getC_DocType().getName() + " " + paymentBankTo.getDocumentNo(),
MPayment.Table_ID, paymentBankTo.getC_Payment_ID()); MPayment.Table_ID, paymentBankTo.getC_Payment_ID());
m_created++; m_created++;