fix small bug
This commit is contained in:
parent
b2ba1bdc1a
commit
b59d46ef57
|
@ -304,7 +304,7 @@ public class MPPMRP extends X_PP_MRP
|
|||
order.setPriorityRule(MPPOrder.PRIORITYRULE_High);
|
||||
order.saveEx();
|
||||
order.prepareIt();
|
||||
order.setDocAction(MPPOrder.DOCSTATUS_Completed);
|
||||
//order.setDocAction(MPPOrder.DOCSTATUS_Completed);
|
||||
order.saveEx();
|
||||
|
||||
}
|
||||
|
@ -447,8 +447,8 @@ public class MPPMRP extends X_PP_MRP
|
|||
DB.executeUpdateEx(sql ,trxName);
|
||||
return;
|
||||
}
|
||||
String whereClause = "TypeMRP = 'D' AND OrderType='DOO' AND AD_Client_ID=? AND DD_OrderLine_ID = ?";
|
||||
MPPMRP mrp = (MPPMRP)MTable.get(m_ctx, MPPMRP.Table_ID).getPO(whereClause, new Object[]{ol.getAD_Client_ID(),ol.getDD_OrderLine_ID()}, trxName);
|
||||
String whereClause = "TypeMRP = ? AND OrderType=? AND AD_Client_ID=? AND DD_OrderLine_ID = ?";
|
||||
MPPMRP mrp = (MPPMRP)MTable.get(m_ctx, MPPMRP.Table_ID).getPO(whereClause, new Object[]{MPPMRP.TYPEMRP_Demand,"DOO",ol.getAD_Client_ID(),ol.getDD_OrderLine_ID()}, trxName);
|
||||
MLocator source = MLocator.get( m_ctx , ol.getM_Locator_ID());
|
||||
MLocator target = MLocator.get( m_ctx , ol.getM_LocatorTo_ID());
|
||||
if(mrp!=null)
|
||||
|
@ -483,8 +483,8 @@ public class MPPMRP extends X_PP_MRP
|
|||
mrp.saveEx();
|
||||
|
||||
}
|
||||
whereClause ="TypeMRP='S' AND OrderType='DOO' AND AD_Client_ID=? AND DD_OrderLine_ID = ? ";
|
||||
mrp = (MPPMRP)MTable.get(m_ctx, MPPMRP.Table_ID).getPO(whereClause, new Object[]{ol.getAD_Client_ID(),ol.getDD_OrderLine_ID()}, trxName);
|
||||
whereClause ="TypeMRP=? AND OrderType=? AND AD_Client_ID=? AND DD_OrderLine_ID = ? ";
|
||||
mrp = (MPPMRP)MTable.get(m_ctx, MPPMRP.Table_ID).getPO(whereClause, new Object[]{MPPMRP.TYPEMRP_Supply,"DOO",ol.getAD_Client_ID(),ol.getDD_OrderLine_ID()}, trxName);
|
||||
if(mrp!=null)
|
||||
{
|
||||
mrp.setAD_Org_ID(target.getAD_Org_ID());
|
||||
|
@ -597,9 +597,9 @@ public class MPPMRP extends X_PP_MRP
|
|||
*/
|
||||
public static BigDecimal getQtyReserved(Properties ctx, int M_Warehouse_ID ,int M_Product_ID, Timestamp To,String trxName)
|
||||
{
|
||||
StringBuffer sql = new StringBuffer("SELECT SUM(Qty) FROM PP_MRP WHERE TypeMRP='D' AND DocStatus IN ('IN','CO')");
|
||||
StringBuffer sql = new StringBuffer("SELECT SUM(Qty) FROM PP_MRP WHERE TypeMRP=? AND DocStatus IN ('IN','CO')");
|
||||
sql.append(" AND OrderType IN ('SOO','MOP','DOO') AND AD_Client_ID= ? AND DatePromised <=? AND M_Warehouse_ID =? AND M_Product_ID=?");
|
||||
BigDecimal qty = DB.getSQLValueBD(trxName, sql.toString(), new Object[]{Env.getAD_Client_ID(ctx), To , M_Warehouse_ID, M_Product_ID});
|
||||
BigDecimal qty = DB.getSQLValueBD(trxName, sql.toString(), new Object[]{MPPMRP.TYPEMRP_Demand,Env.getAD_Client_ID(ctx), To , M_Warehouse_ID, M_Product_ID});
|
||||
// SQL may return no rows or null
|
||||
if (qty == null)
|
||||
return Env.ZERO;
|
||||
|
|
|
@ -230,6 +230,9 @@ public class MRP extends SvrProcess
|
|||
MWarehouse[] ws = MWarehouse.getForOrg(getCtx(), organization.getAD_Org_ID());
|
||||
for(MWarehouse w : ws)
|
||||
{
|
||||
if(plant.getM_Warehouse_ID() == w.getM_Warehouse_ID() && p_IsRequiredDRP)
|
||||
continue;
|
||||
|
||||
log.info("Run MRP to Wharehouse: " + w.getName());
|
||||
runMRP(m_AD_Client_ID,organization.getAD_Org_ID(),plant.getS_Resource_ID(),w.getM_Warehouse_ID());
|
||||
result = result + "<br>finish MRP to Warehouse " +w.getName();
|
||||
|
@ -237,6 +240,9 @@ public class MRP extends SvrProcess
|
|||
}
|
||||
else
|
||||
{
|
||||
if(plant.getM_Warehouse_ID() == p_M_Warehouse_ID && p_IsRequiredDRP)
|
||||
continue;
|
||||
|
||||
runMRP(m_AD_Client_ID,organization.getAD_Org_ID(),plant.getS_Resource_ID(),p_M_Warehouse_ID);
|
||||
}
|
||||
result = result + "<br>finish MRP to Organization " +organization.getName();
|
||||
|
@ -313,7 +319,9 @@ public class MRP extends SvrProcess
|
|||
Timestamp POQDateStartSchedule = null;
|
||||
|
||||
// Mark all supply MRP records as available
|
||||
DB.executeUpdateEx("UPDATE PP_MRP SET IsAvailable ='Y' WHERE TypeMRP = 'S' AND AD_Client_ID = " + AD_Client_ID+" AND AD_Org_ID=" + AD_Org_ID + " AND M_Warehouse_ID=" + M_Warehouse_ID ,get_TrxName());
|
||||
|
||||
DB.executeUpdateEx("UPDATE PP_MRP SET IsAvailable ='Y' WHERE TypeMRP = 'S' AND AD_Client_ID = ? AND AD_Org_ID=? AND M_Warehouse_ID=?", new Object[]{AD_Client_ID,AD_Org_ID,M_Warehouse_ID} ,get_TrxName());
|
||||
|
||||
commit();
|
||||
int lowlevel = MPPMRP.getMaxLowLevel(getCtx(), get_TrxName());
|
||||
log.info("Low Level Is :"+lowlevel);
|
||||
|
|
Loading…
Reference in New Issue