MResourceType.isAvailable : better logic
MPPProductPlanning: javadoc
This commit is contained in:
teo_sarca 2009-02-19 06:53:15 +00:00
parent 3bdadc091c
commit 4f5340552b
2 changed files with 26 additions and 11 deletions

View File

@ -260,19 +260,19 @@ public class MResourceType extends X_S_ResourceType
return retValue; return retValue;
} }
/**
* @return true if a resource of this type is generally available
* (i.e. active, at least 1 day available, at least 1 hour available)
*/
public boolean isAvailable() public boolean isAvailable()
{ {
if (!isActive()) if (!isActive())
{ {
return false; return false;
} }
if(!isDateSlot()) return getAvailableDaysWeek() > 0
{ && getTimeSlotHours() > 0;
return true;
}
return isOnMonday() || isOnTuesday() || isOnWednesday() || isOnThursday() || isOnFriday()
|| isOnSaturday() || isOnSunday();
} }
@Override @Override

View File

@ -37,7 +37,10 @@ import org.compiere.wf.MWorkflow;
*/ */
public class MPPProductPlanning extends X_PP_Product_Planning public class MPPProductPlanning extends X_PP_Product_Planning
{ {
private static final long serialVersionUID = 1L; /**
*
*/
private static final long serialVersionUID = -3061309620804116277L;
/** Log */ /** Log */
private static CLogger log = CLogger.getCLogger(MPPProductPlanning.class); private static CLogger log = CLogger.getCLogger(MPPProductPlanning.class);
@ -155,10 +158,14 @@ public class MPPProductPlanning extends X_PP_Product_Planning
+", COALESCE(S_Resource_ID, 0) DESC") +", COALESCE(S_Resource_ID, 0) DESC")
.first(); .first();
} }
/**
* Get plant resource for warehouse. If more than one resource is found, first will be used.
* @param M_Warehouse_ID
* @return Plant_ID (S_Resource_ID)
*/
public static int getPlantForWarehouse(int M_Warehouse_ID) public static int getPlantForWarehouse(int M_Warehouse_ID)
{ {
// Get plant resource for warehouse. If more than one resource is found, first will be used
final String sql = "SELECT MIN("+MResource.COLUMNNAME_S_Resource_ID+")" final String sql = "SELECT MIN("+MResource.COLUMNNAME_S_Resource_ID+")"
+" FROM "+MResource.Table_Name +" FROM "+MResource.Table_Name
+" WHERE "+MResource.COLUMNNAME_IsManufacturingResource+"=?" +" WHERE "+MResource.COLUMNNAME_IsManufacturingResource+"=?"
@ -216,11 +223,19 @@ public class MPPProductPlanning extends X_PP_Product_Planning
} }
private int m_C_BPartner_ID = 0; private int m_C_BPartner_ID = 0;
/**
* Set Supplier
* @param C_BPartner_ID
*/
public void setC_BPartner_ID(int C_BPartner_ID) public void setC_BPartner_ID(int C_BPartner_ID)
{ {
this.m_C_BPartner_ID = C_BPartner_ID; this.m_C_BPartner_ID = C_BPartner_ID;
} }
/**
* @return Supplier
*/
public int getC_BPartner_ID() public int getC_BPartner_ID()
{ {
return this.m_C_BPartner_ID; return this.m_C_BPartner_ID;
@ -246,6 +261,6 @@ public class MPPProductPlanning extends X_PP_Product_Planning
log.info(" Order Policy: " + getOrder_Policy()); log.info(" Order Policy: " + getOrder_Policy());
log.info(" Warehouse: " + getM_Warehouse_ID()); log.info(" Warehouse: " + getM_Warehouse_ID());
log.info(" Planner: " + getPlanner_ID()); log.info(" Planner: " + getPlanner_ID());
log.info(" Supplier: " + getC_BPartner_ID());
} }
} // Product Data Planning } // Product Data Planning