identation and prevent NullPointer exception.

This commit is contained in:
trifonnt 2008-08-15 09:49:42 +00:00
parent 5d0df7375b
commit dd231952a6
1 changed files with 14 additions and 15 deletions

View File

@ -66,6 +66,7 @@ public class MRP extends SvrProcess
private int p_S_Resource_ID = 0 ; private int p_S_Resource_ID = 0 ;
private int p_M_Warehouse_ID= 0; private int p_M_Warehouse_ID= 0;
private boolean p_IsRequiredDRP = false; private boolean p_IsRequiredDRP = false;
@SuppressWarnings("unused")
private String p_Version = "1"; private String p_Version = "1";
private String result = ""; private String result = "";
@ -359,11 +360,11 @@ public class MRP extends SvrProcess
while (rs.next()) while (rs.next())
{ {
String TypeMRP = rs.getString("TypeMRP"); String TypeMRP = rs.getString(MPPMRP.COLUMNNAME_TypeMRP);
String OrderType = rs.getString("OrderType"); String OrderType = rs.getString(MPPMRP.COLUMNNAME_OrderType);
//Set Global Variable //Set Global Variable
DatePromised = rs.getTimestamp("DatePromised"); DatePromised = rs.getTimestamp(MPPMRP.COLUMNNAME_DatePromised);
DateStartSchedule = rs.getTimestamp("DateStartSchedule"); DateStartSchedule = rs.getTimestamp(MPPMRP.COLUMNNAME_DateStartSchedule);
// if demand is a forecast and this is minor today then is ignore this QtyGrossReq // if demand is a forecast and this is minor today then is ignore this QtyGrossReq
if (MPPMRP.TYPEMRP_Demand.equals(TypeMRP) && MPPMRP.ORDERTYPE_Forecast.equals(OrderType) && DatePromised.compareTo(Today) <= 0) if (MPPMRP.TYPEMRP_Demand.equals(TypeMRP) && MPPMRP.ORDERTYPE_Forecast.equals(OrderType) && DatePromised.compareTo(Today) <= 0)
@ -406,8 +407,6 @@ public class MRP extends SvrProcess
//{ //{
// DateStartSchedule = rs.getTimestamp("DateStartSchedule"); // DateStartSchedule = rs.getTimestamp("DateStartSchedule");
//} //}
} }
BeforeDateStartSchedule = DateStartSchedule; BeforeDateStartSchedule = DateStartSchedule;
@ -422,15 +421,15 @@ public class MRP extends SvrProcess
log.info( Msg.getMsg(getCtx(), MRP.getValue())); log.info( Msg.getMsg(getCtx(), MRP.getValue()));
} }
// Verify if is ORDER_POLICY_PeriodOrderQuantity and DatePromised < DatePromisedTo then Accumaltion QtyGrossReqs // Verify if is ORDER_POLICY_PeriodOrderQuantity and DatePromised < DatePromisedTo then Accumulation QtyGrossReqs
if (m_product_planning.getOrder_Policy().equals(MPPProductPlanning.ORDER_POLICY_PeriodOrderQuantity) && DatePromised.compareTo(DatePromisedTo) < 0 ) if (m_product_planning != null && m_product_planning.getOrder_Policy().equals(MPPProductPlanning.ORDER_POLICY_PeriodOrderQuantity) && DatePromised.compareTo(DatePromisedTo) < 0 )
{ {
QtyGrossReqs = QtyGrossReqs.add(rs.getBigDecimal("Qty")); QtyGrossReqs = QtyGrossReqs.add(rs.getBigDecimal("Qty"));
//BeforeQty = BeforeQty + Env.ZERO; //BeforeQty = BeforeQty + Env.ZERO;
log.info("Acumulation QtyGrossReqs:" + QtyGrossReqs); log.info("Accumulation QtyGrossReqs:" + QtyGrossReqs);
continue; continue;
}// if not then create new range for next period }// if not then create new range for next period
else if (m_product_planning.getOrder_Policy().equals(MPPProductPlanning.ORDER_POLICY_PeriodOrderQuantity)) else if (m_product_planning != null && m_product_planning.getOrder_Policy().equals(MPPProductPlanning.ORDER_POLICY_PeriodOrderQuantity))
{ {
calculatePlan(rs.getInt("PP_MRP_ID"),product, QtyGrossReqs ,POQDateStartSchedule); calculatePlan(rs.getInt("PP_MRP_ID"),product, QtyGrossReqs ,POQDateStartSchedule);
@ -446,7 +445,7 @@ public class MRP extends SvrProcess
continue; continue;
} }
// If Order_Policy = LoteForLote then always create new range for next period and put QtyGrossReqs // If Order_Policy = LoteForLote then always create new range for next period and put QtyGrossReqs
if (m_product_planning.getOrder_Policy().equals(MPPProductPlanning.ORDER_POLICY_LoteForLote)) if (m_product_planning != null && m_product_planning.getOrder_Policy().equals(MPPProductPlanning.ORDER_POLICY_LoteForLote))
{ {
QtyGrossReqs = rs.getBigDecimal("Qty"); QtyGrossReqs = rs.getBigDecimal("Qty");
calculatePlan(rs.getInt("PP_MRP_ID"),product, QtyGrossReqs , rs.getTimestamp("DateStartSchedule")); calculatePlan(rs.getInt("PP_MRP_ID"),product, QtyGrossReqs , rs.getTimestamp("DateStartSchedule"));