public Dictionary <string, string> GetProduct(Ctx ctx, string fields) { string[] paramValue = fields.Split(','); //Assign parameter value int M_Product_ID = Util.GetValueOfInt(paramValue[0].ToString()); int M_Warehouse_ID = 0; if (paramValue.Length > 1) { M_Warehouse_ID = Util.GetValueOfInt(paramValue[1].ToString()); } //End Assign parameter value MProduct product = MProduct.Get(ctx, M_Product_ID); Dictionary <string, string> result = new Dictionary <string, string>(); result["C_UOM_ID"] = product.GetC_UOM_ID().ToString(); result["IsStocked"] = product.IsStocked() ? "Y" : "N"; if (M_Product_ID > 0) { if (M_Warehouse_ID > 0) { result["M_Locator_ID"] = MProductLocator.GetFirstM_Locator_ID(product, M_Warehouse_ID).ToString(); } } return(result); }
} // createRequisition /// <summary> /// Get Locator_ID /// </summary> /// <param name="product"> product </param> /// <param name="wh">warehouse</param> /// <returns>locator with highest priority</returns> private int GetLocator_ID(MProduct product, MWarehouse wh) { int M_Locator_ID = MProductLocator.GetFirstM_Locator_ID(product, wh.GetM_Warehouse_ID()); /** * MLocator[] locators = MProductLocator.getLocators (product, wh.getM_Warehouse_ID()); * for (int i = 0; i < locators.length; i++) * { * MLocator locator = locators[i]; * // Storage/capacity restrictions come here * return locator.getM_Locator_ID(); * } * // default **/ if (M_Locator_ID == 0) { M_Locator_ID = wh.GetDefaultM_Locator_ID(); } return(M_Locator_ID); } // getLocator_ID