use of org.compiere.model.MWarehouse in project adempiere by adempiere.
the class CreateProductPlanning method prepare.
/**
* Prepare - e.g., get Parameters.
*/
protected void prepare() {
for (ProcessInfoParameter para : getParameter()) {
String name = para.getParameterName();
if (para.getParameter() == null)
;
else if (MProduct.COLUMNNAME_M_Product_Category_ID.equals(name))
productCategoryId = para.getParameterAsInt();
else if (MPPProductPlanning.COLUMNNAME_M_Warehouse_ID.equals(name))
warehouseId = para.getParameterAsInt();
else if (MPPProductPlanning.COLUMNNAME_S_Resource_ID.equals(name))
resourceId = para.getParameterAsInt();
else if (MPPProductPlanning.COLUMNNAME_IsCreatePlan.equals(name))
createPlan = para.getParameterAsBoolean();
else if (MPPProductPlanning.COLUMNNAME_IsMPS.equals(name))
isMPS = para.getParameterAsBoolean();
else if (MPPProductPlanning.COLUMNNAME_DD_NetworkDistribution_ID.equals(name))
networkDistributionId = para.getParameterAsInt();
else if (MPPProductPlanning.COLUMNNAME_AD_Workflow_ID.equals(name))
workflowId = para.getParameterAsInt();
else if (MPPProductPlanning.COLUMNNAME_TimeFence.equals(name))
timeFence = para.getParameterAsBigDecimal();
else if (MPPProductPlanning.COLUMNNAME_TransferTime.equals(name))
transferTime = para.getParameterAsBigDecimal();
else if (MPPProductPlanning.COLUMNNAME_SafetyStock.equals(name))
safetyStock = para.getParameterAsBigDecimal();
else if (MPPProductPlanning.COLUMNNAME_Order_Min.equals(name))
orderMin = para.getParameterAsBigDecimal();
else if (MPPProductPlanning.COLUMNNAME_Order_Max.equals(name))
orderMax = para.getParameterAsBigDecimal();
else if (MPPProductPlanning.COLUMNNAME_Order_Pack.equals(name))
orderPack = para.getParameterAsBigDecimal();
else if (MPPProductPlanning.COLUMNNAME_Order_Qty.equals(name))
orderQty = para.getParameterAsBigDecimal();
else if (MPPProductPlanning.COLUMNNAME_WorkingTime.equals(name))
workingTime = para.getParameterAsBigDecimal();
else if (MPPProductPlanning.COLUMNNAME_Yield.equals(name))
yield = para.getParameterAsInt();
else if (MPPProductPlanning.COLUMNNAME_DeliveryTime_Promised.equals(name))
deliveryTimePromised = para.getParameterAsBigDecimal();
else if (MPPProductPlanning.COLUMNNAME_Order_Period.equals(name))
orderPeriod = para.getParameterAsBigDecimal();
else if (MPPProductPlanning.COLUMNNAME_Order_Policy.equals(name))
orderPolicy = para.getParameterAsString();
else if (MPPProductPlanning.COLUMNNAME_Planner_ID.equals(name))
plannerId = para.getParameterAsInt();
else
log.log(Level.SEVERE, "prepare - Unknown Parameter: " + name);
}
clientId = Env.getAD_Client_ID(getCtx());
if (warehouseId > 0) {
MWarehouse warehouse = MWarehouse.get(getCtx(), warehouseId);
orgId = warehouse.getAD_Org_ID();
}
}
use of org.compiere.model.MWarehouse in project adempiere by adempiere.
the class VLocator method setDefault_Locator_ID.
// getOnly_Product_ID
/**
* Set the default locator if this field is mandatory
* and we have a warehouse restriction.
*
* @since 3.1.4
*/
private void setDefault_Locator_ID() {
// teo_sarca, FR [ 1661546 ] Mandatory locator fields should use defaults
if (!isMandatory() || m_mLocator == null) {
return;
}
int M_Warehouse_ID = getOnly_Warehouse_ID();
if (M_Warehouse_ID <= 0) {
return;
}
MWarehouse wh = MWarehouse.get(Env.getCtx(), M_Warehouse_ID);
if (wh == null || wh.get_ID() <= 0) {
return;
}
MLocator loc = wh.getDefaultLocator();
if (loc == null || loc.get_ID() <= 0) {
return;
}
setValue(Integer.valueOf(loc.get_ID()));
}
use of org.compiere.model.MWarehouse in project adempiere by adempiere.
the class WMRPDetailed method selectAttributeSetInstance.
private void selectAttributeSetInstance() {
//getM_Warehouse_ID();
int m_warehouse_id = 0;
//getM_Product_ID();
int m_product_id = 0;
if (m_product_id <= 0)
return;
MProduct product = MProduct.get(getCtx(), m_product_id);
MWarehouse wh = MWarehouse.get(getCtx(), m_warehouse_id);
String title = product.get_Translation(MProduct.COLUMNNAME_Name) + " - " + wh.get_Translation(MWarehouse.COLUMNNAME_Name);
WPAttributeInstance pai = new WPAttributeInstance(title, m_warehouse_id, 0, m_product_id, 0);
if (pai.getM_AttributeSetInstance_ID() != -1) {
fAttrSetInstance_ID.setLabel(pai.getM_AttributeSetInstanceName());
ASI_ID = new Integer(pai.getM_AttributeSetInstance_ID());
} else {
ASI_ID = 0;
}
}
use of org.compiere.model.MWarehouse in project adempiere by adempiere.
the class StorageEngine method getM_Locator_ID.
/**
* Set (default) Locator based on qty.
* @param Qty quantity
* Assumes Warehouse is set
*/
public static int getM_Locator_ID(Properties ctx, int M_Warehouse_ID, int M_Product_ID, int M_AttributeSetInstance_ID, BigDecimal Qty, String trxName) {
// Get existing Location
int M_Locator_ID = MStorage.getM_Locator_ID(M_Warehouse_ID, M_Product_ID, M_AttributeSetInstance_ID, Qty, trxName);
// Get default Location
if (M_Locator_ID == 0) {
MWarehouse wh = MWarehouse.get(ctx, M_Warehouse_ID);
M_Locator_ID = wh.getDefaultLocator().getM_Locator_ID();
}
return M_Locator_ID;
}
use of org.compiere.model.MWarehouse in project adempiere by adempiere.
the class ReplenishReport method createPO.
// fillTable
/**
* Create PO's
*/
private void createPO() {
int noOrders = 0;
String info = "";
//
MOrder order = null;
MWarehouse wh = null;
X_T_Replenish[] replenishs = getReplenish("M_WarehouseSource_ID IS NULL");
for (int i = 0; i < replenishs.length; i++) {
X_T_Replenish replenish = replenishs[i];
if (wh == null || wh.getM_Warehouse_ID() != replenish.getM_Warehouse_ID())
wh = MWarehouse.get(getCtx(), replenish.getM_Warehouse_ID());
//
if (order == null || order.getC_BPartner_ID() != replenish.getC_BPartner_ID() || order.getM_Warehouse_ID() != replenish.getM_Warehouse_ID()) {
order = new MOrder(getCtx(), 0, get_TrxName());
order.setIsSOTrx(false);
order.setC_DocTypeTarget_ID(p_C_DocType_ID);
MBPartner bp = new MBPartner(getCtx(), replenish.getC_BPartner_ID(), get_TrxName());
order.setBPartner(bp);
order.setSalesRep_ID(getAD_User_ID());
order.setDescription(Msg.getMsg(getCtx(), "Replenishment"));
// Set Org/WH
order.setAD_Org_ID(wh.getAD_Org_ID());
order.setM_Warehouse_ID(wh.getM_Warehouse_ID());
if (!order.save())
return;
log.fine(order.toString());
noOrders++;
info += " - " + order.getDocumentNo();
}
MOrderLine line = new MOrderLine(order);
line.setM_Product_ID(replenish.getM_Product_ID());
line.setQty(replenish.getQtyToOrder());
line.setPrice();
line.saveEx();
}
m_info = "#" + noOrders + info;
log.info(m_info);
}
Aggregations