use of org.compiere.model.MResource in project adempiere by adempiere.
the class CRPDatasetFactory method getTreeNodeRepresentation.
private String getTreeNodeRepresentation(Timestamp dateTime, DefaultMutableTreeNode node, MResource r) {
String name = null;
if (node.getUserObject() instanceof MResource) {
MResource res = (MResource) node.getUserObject();
name = res.getName();
} else if (node.getUserObject() instanceof Timestamp) {
Timestamp d = (Timestamp) node.getUserObject();
SimpleDateFormat df = Env.getLanguage(Env.getCtx()).getDateFormat();
name = df.format(d);
if (!isAvailable(r, d)) {
name = "{" + name + "}";
}
} else if (node.getUserObject() instanceof MPPOrder) {
MPPOrder o = (MPPOrder) node.getUserObject();
MProduct p = MProduct.get(Env.getCtx(), o.getM_Product_ID());
name = o.getDocumentNo() + " (" + p.getName() + ")";
} else if (node.getUserObject() instanceof MPPOrderNode) {
MPPOrderNode on = (MPPOrderNode) node.getUserObject();
MPPOrderWorkflow owf = on.getMPPOrderWorkflow();
MResourceType rt = MResourceType.get(Env.getCtx(), r.getS_ResourceType_ID());
// no function
//Env.getLanguage(Env.getCtx()).getTimeFormat();
SimpleDateFormat df = new SimpleDateFormat("HH:mm");
Timestamp[] interval = getDayBorders(dateTime, on, rt);
name = df.format(interval[0]) + " - " + df.format(interval[1]) + " " + on.getName() + " (" + owf.getName() + ")";
}
return name;
}
use of org.compiere.model.MResource in project adempiere by adempiere.
the class WCRPDetail method handleActionEvent.
private void handleActionEvent(Event e) {
Timestamp df = getDateFrom();
Timestamp dt = getDateTo();
MResource r = getResource(resource.getValue());
if (df != null && dt != null && r != null) {
model = CRPDatasetFactory.get(df, dt, r);
JFreeChart jfreechart = createChart(model.getDataset(), getChartTitle(), getSourceUOM(resource.getValue()));
renderChart(jfreechart);
tree = getTree();
mainLayout.removeChild(center);
treePanel = new Hbox();
treePanel.appendChild(tree);
tree.setStyle("border: none");
center = new Center();
center.appendChild(treePanel);
center.setAutoscroll(true);
mainLayout.appendChild(center);
}
}
use of org.compiere.model.MResource in project adempiere by adempiere.
the class DiagramTreeCellRenderer method getIcon.
protected ImageIcon getIcon(Object value) {
ImageIcon icon = null;
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
if (node.getUserObject() instanceof MResource) {
} else if (node.getUserObject() instanceof Date) {
icon = Env.getImageIcon("Calendar10.gif");
} else if (node.getUserObject() instanceof MPPOrder) {
} else if (node.getUserObject() instanceof MPPOrderNode) {
}
return icon;
}
use of org.compiere.model.MResource in project adempiere by adempiere.
the class BOMTreeFactory method getTreeNodeRepresentation.
protected String getTreeNodeRepresentation(DefaultMutableTreeNode node) {
String name = null;
if (node.getUserObject() instanceof MProduct) {
MProduct p = (MProduct) node.getUserObject();
name = p.getName() + " (" + p.getValue() + ")";
}
if (node.getUserObject() instanceof MPPOrder) {
MPPOrder o = (MPPOrder) node.getUserObject();
MResource r = MResource.get(Env.getCtx(), o.getS_Resource_ID());
name = o.getDocumentNo() + " (" + r.getName() + ")";
} else if (node.getUserObject() instanceof BOMWrapper) {
BOMWrapper pb = (BOMWrapper) node.getUserObject();
MProduct p = new MProduct(Env.getCtx(), pb.getM_Product_ID(), null);
name = pb.getName();
} else if (node.getUserObject() instanceof BOMLineWrapper) {
BOMLineWrapper mpbl = (BOMLineWrapper) node.getUserObject();
MProduct p = new MProduct(Env.getCtx(), mpbl.getM_Product_ID(), null);
name = p.getName();
}
return name;
}
use of org.compiere.model.MResource in project adempiere by adempiere.
the class DefaultRoutingServiceImplTest method getCreatePlant.
private I_S_Resource getCreatePlant() {
final String plantValue = "JUnit_Plant_24x7";
MResource plant = new Query(getCtx(), MResource.Table_Name, "Value=?", null).setParameters(new Object[] { plantValue }).setClient_ID().firstOnly();
if (plant == null) {
plant = new MResource(getCtx(), 0, null);
plant.setValue(plantValue);
}
plant.setName(plantValue);
plant.setIsManufacturingResource(true);
plant.setManufacturingResourceType(MResource.MANUFACTURINGRESOURCETYPE_Plant);
plant.setPlanningHorizon(365);
plant.setM_Warehouse_ID(getM_Warehouse_ID());
//
MResourceType rt = null;
if (plant.getS_ResourceType_ID() <= 0) {
rt = new MResourceType(getCtx(), 0, null);
} else {
rt = new MResourceType(getCtx(), plant.getS_ResourceType_ID(), null);
}
rt.setValue(plantValue);
rt.setName(plantValue);
rt.setAllowUoMFractions(true);
rt.setC_TaxCategory_ID(getC_TaxCategory_ID());
rt.setM_Product_Category_ID(getM_Product_Category_ID());
// Hour
rt.setC_UOM_ID(getC_UOM_ID("HR"));
rt.setIsDateSlot(false);
rt.setIsTimeSlot(false);
rt.setIsSingleAssignment(false);
rt.saveEx();
plant.setS_ResourceType_ID(rt.getS_ResourceType_ID());
//
plant.saveEx();
return plant;
}
Aggregations