Libero QA:

LiberoValidator - fix intendation
MPPMRP.C_OrderLine - fix SQL boolean logic; Victor, please ALWAYS use brackets when write boolean logic
This commit is contained in:
teo_sarca 2009-01-13 13:08:46 +00:00
parent 9227c53c4f
commit 67d8427774
2 changed files with 45 additions and 49 deletions

View File

@ -181,55 +181,54 @@ public class LiberoValidator implements ModelValidator
MInOut inout = (MInOut)po; MInOut inout = (MInOut)po;
if(inout.isSOTrx()) if(inout.isSOTrx())
{ {
final String whereClause = "C_OrderLine_ID IS NOT NULL AND EXISTS ( SELECT 1 FROM C_OrderLine ol , M_InOutLine iol WHERE ol.C_OrderLine_ID=iol.C_OrderLine_ID AND iol.M_InOut_ID=? )"; final String whereClause = "C_OrderLine_ID IS NOT NULL"
Collection<MPPOrder> orders = new Query(po.getCtx(), MPPOrder.Table_Name, whereClause, po.get_TrxName()) +" AND EXISTS (SELECT 1 FROM C_OrderLine ol , M_InOutLine iol"
.setParameters(new Object[]{inout.getM_InOut_ID()}) +" WHERE ol.C_OrderLine_ID=iol.C_OrderLine_ID AND iol.M_InOut_ID=? )";
.list(); Collection<MPPOrder> orders = new Query(po.getCtx(), MPPOrder.Table_Name, whereClause, po.get_TrxName())
for(MPPOrder order : orders) .setParameters(new Object[]{inout.getM_InOut_ID()})
{ .list();
String description = order.getDescription() != null ? order.getDescription() : "" for(MPPOrder order : orders)
+ Msg.translate(inout.getCtx(), MInOut.COLUMNNAME_M_InOut_ID) {
+ " : " String description = order.getDescription() != null ? order.getDescription() : ""
+ Msg.translate(inout.getCtx(), MInOut.COLUMNNAME_DocumentNo); + Msg.translate(inout.getCtx(), MInOut.COLUMNNAME_M_InOut_ID)
+ " : "
order.setDescription(description); + Msg.translate(inout.getCtx(), MInOut.COLUMNNAME_DocumentNo);
order.closeIt();
order.setDocStatus(MPPOrder.DOCACTION_Close); order.setDescription(description);
order.setDocAction(MPPOrder.DOCACTION_None); order.closeIt();
order.saveEx(); order.setDocStatus(MPPOrder.DOCACTION_Close);
} order.setDocAction(MPPOrder.DOCACTION_None);
} order.saveEx();
} }
else }
{
} }
if (po instanceof MInOut && timing == TIMING_AFTER_COMPLETE) else if (po instanceof MInOut && timing == TIMING_AFTER_COMPLETE)
{ {
MInOut inout = (MInOut)po; MInOut inout = (MInOut)po;
for (MInOutLine line : inout.getLines()) for (MInOutLine line : inout.getLines())
{
final String whereClause = "C_OrderLine_ID=? AND PP_Cost_Collector_ID IS NOT NULL";
Collection<MOrderLine> olines = new Query(po.getCtx(), MOrderLine.Table_Name, whereClause, po.get_TrxName())
.setParameters(new Object[]{line.getC_OrderLine_ID()})
.list();
for (MOrderLine oline : olines)
{ {
final String whereClause = "C_OrderLine_ID=? AND PP_Cost_Collector_ID IS NOT NULL"; if(oline.getQtyOrdered().compareTo(oline.getQtyDelivered()) >= 0)
Collection<MOrderLine> olines = new Query(po.getCtx(), MOrderLine.Table_Name, whereClause, po.get_TrxName()) {
.setParameters(new Object[]{line.getC_OrderLine_ID()}) MPPCostCollector cc = new MPPCostCollector(po.getCtx(), oline.getPP_Cost_Collector_ID(), po.get_TrxName());
.list(); String docStatus = cc.completeIt();
for (MOrderLine oline : olines) cc.setDocStatus(docStatus);
{ cc.setDocAction(MPPCostCollector.DOCACTION_Close);
if(oline.getQtyOrdered().compareTo(oline.getQtyDelivered()) >= 0) cc.saveEx();
{ return Msg.translate(po.getCtx(), "PP_Order_ID")
MPPCostCollector cc = new MPPCostCollector(po.getCtx(), oline.getPP_Cost_Collector_ID(), po.get_TrxName()); +":"+cc.getPP_Order().getDocumentNo()
String docStatus = cc.completeIt(); +Msg.translate(po.getCtx(),"PP_Order_Node_ID")
cc.setDocStatus(docStatus); +":"+cc.getPP_Order_Node().getValue();
cc.setDocAction(MPPCostCollector.DOCACTION_Close);
cc.saveEx();
return Msg.translate(po.getCtx(), "PP_Order_ID")
+":"+cc.getPP_Order().getDocumentNo()
+Msg.translate(po.getCtx(),"PP_Order_Node_ID")
+":"+cc.getPP_Order_Node().getValue();
}
} }
} }
} }
}
return null; return null;
} // docValidate } // docValidate

View File

@ -369,8 +369,7 @@ public class MPPMRP extends X_PP_MRP
MPPOrder order = MPPOrder.forC_OrderLine_ID(ol.getCtx(), ol.get_ID(), ol.get_TrxName()); MPPOrder order = MPPOrder.forC_OrderLine_ID(ol.getCtx(), ol.get_ID(), ol.get_TrxName());
if (order == null) if (order == null)
{ {
final String whereClause = MPPProductBOM.COLUMNNAME_BOMType+"=? " final String whereClause = MPPProductBOM.COLUMNNAME_BOMType+" IN (?,?)"
+" OR "+MPPProductBOM.COLUMNNAME_BOMType+"=? "
+" AND "+MPPProductBOM.COLUMNNAME_BOMUse+"=?" +" AND "+MPPProductBOM.COLUMNNAME_BOMUse+"=?"
+" AND "+MPPProductBOM.COLUMNNAME_M_Product_ID+"=?"; +" AND "+MPPProductBOM.COLUMNNAME_M_Product_ID+"=?";
MPPProductBOM bom = new Query(ol.getCtx(), MPPProductBOM.Table_Name, whereClause, null) MPPProductBOM bom = new Query(ol.getCtx(), MPPProductBOM.Table_Name, whereClause, null)
@ -389,11 +388,9 @@ public class MPPMRP extends X_PP_MRP
if(pp != null) if(pp != null)
{ {
bom = (MPPProductBOM) pp.getPP_Product_BOM(); bom = (MPPProductBOM) pp.getPP_Product_BOM();
if(bom != null && !MPPProductBOM.BOMTYPE_Make_To_Order.equals(bom.getBOMType())) if( bom != null
{ && !MPPProductBOM.BOMTYPE_Make_To_Order.equals(bom.getBOMType())
bom = null; && !MPPProductBOM.BOMTYPE_Make_To_Kit.equals(bom.getBOMType()) )
}
if(bom != null && !MPPProductBOM.BOMTYPE_Make_To_Kit.equals(bom.getBOMType()))
{ {
bom = null; bom = null;
} }