Search in sources :

Example 11 with MResource

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;
}
Also used : MResource(org.compiere.model.MResource) MPPOrderNode(org.eevolution.model.MPPOrderNode) MProduct(org.compiere.model.MProduct) MPPOrderWorkflow(org.eevolution.model.MPPOrderWorkflow) Timestamp(java.sql.Timestamp) SimpleDateFormat(java.text.SimpleDateFormat) MPPOrder(org.eevolution.model.MPPOrder) MResourceType(org.compiere.model.MResourceType)

Example 12 with MResource

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);
    }
}
Also used : MResource(org.compiere.model.MResource) Hbox(org.zkoss.zul.Hbox) Center(org.zkoss.zul.Center) Timestamp(java.sql.Timestamp) JFreeChart(org.jfree.chart.JFreeChart)

Example 13 with MResource

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;
}
Also used : MResource(org.compiere.model.MResource) ImageIcon(javax.swing.ImageIcon) MPPOrderNode(org.eevolution.model.MPPOrderNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Date(java.util.Date) MPPOrder(org.eevolution.model.MPPOrder)

Example 14 with MResource

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;
}
Also used : MResource(org.compiere.model.MResource) MProduct(org.compiere.model.MProduct) BOMWrapper(org.eevolution.model.wrapper.BOMWrapper) MPPOrder(org.eevolution.model.MPPOrder) BOMLineWrapper(org.eevolution.model.wrapper.BOMLineWrapper)

Example 15 with MResource

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;
}
Also used : MResource(org.compiere.model.MResource) Query(org.compiere.model.Query) MResourceType(org.compiere.model.MResourceType)

Aggregations

MResource (org.compiere.model.MResource)18 Timestamp (java.sql.Timestamp)6 Query (org.compiere.model.Query)4 MPPOrder (org.eevolution.model.MPPOrder)4 JFreeChart (org.jfree.chart.JFreeChart)4 MUOM (org.compiere.model.MUOM)3 MPPOrderNode (org.eevolution.model.MPPOrderNode)3 ArrayList (java.util.ArrayList)2 Properties (java.util.Properties)2 AdempiereException (org.adempiere.exceptions.AdempiereException)2 I_AD_Workflow (org.compiere.model.I_AD_Workflow)2 MOrg (org.compiere.model.MOrg)2 MProduct (org.compiere.model.MProduct)2 MResourceType (org.compiere.model.MResourceType)2 MWarehouse (org.compiere.model.MWarehouse)2 MPPOrderWorkflow (org.eevolution.model.MPPOrderWorkflow)2 BOMWrapper (org.eevolution.model.wrapper.BOMWrapper)2 ChartPanel (org.jfree.chart.ChartPanel)2 CategoryDataset (org.jfree.data.category.CategoryDataset)2 DefaultCategoryDataset (org.jfree.data.category.DefaultCategoryDataset)2