Esempio n. 1
0
        /// <summary>
        /// is used to save Product container
        /// </summary>
        /// <param name="warehouseId">Warehouse where we create container</param>
        /// <param name="locatorId">Locator - in which locator we place container</param>
        /// <param name="value">Search key of the container</param>
        /// <param name="name">name of teh container</param>
        /// <param name="height">height of the container</param>
        /// <param name="width">width of the container</param>
        /// <param name="parentContainerId">Parent of the nw container</param>
        /// <returns>Save Or Not Saved message</returns>
        /// <writer>Amit Bansal</writer>
        public string SaveProductContainer(int warehouseId, int locatorId, string value, string name, Decimal height, Decimal width, int parentContainerId)
        {
            MLocator   m_locator   = null;
            MWarehouse m_warehouse = null;

            // when warehouse ID is ZERO, then extract it from Locator
            if (warehouseId == 0 && locatorId > 0)
            {
                m_locator   = MLocator.Get(_ctx, locatorId);
                warehouseId = m_locator.GetM_Warehouse_ID();
            }
            // when locator ID is ZERO, then extract it either from Parent Conatiner or from Warehouse
            else if (warehouseId > 0 && locatorId == 0)
            {
                if (parentContainerId == 0)
                {
                    m_warehouse = MWarehouse.Get(_ctx, warehouseId);
                    locatorId   = m_warehouse.GetDefaultM_Locator_ID();
                }
                else
                {
                    locatorId = Util.GetValueOfInt(DB.ExecuteScalar("SELECT M_Locator_ID FROM M_ProductContainer WHERE M_ProductContainer_ID = " + parentContainerId, null, null));
                }
            }

            // need to check warehouse and locator shoyld be active during ceation of Product Container
            m_warehouse = MWarehouse.Get(_ctx, warehouseId);
            m_locator   = MLocator.Get(_ctx, locatorId);
            if (!m_warehouse.IsActive())
            {
                return(Msg.GetMsg(_ctx, "VIS_WarehouseNotActive"));
            }
            else if (!m_locator.IsActive())
            {
                return(Msg.GetMsg(_ctx, "VIS_LocatorNotActive"));
            }

            // Create Product Container in Locator Organization
            //MProductContainer container = new MProductContainer(_ctx, 0, null);
            //container.SetAD_Org_ID(m_locator.GetAD_Org_ID());
            //container.SetValue(value);
            //container.SetName(name);
            //container.SetM_Warehouse_ID(warehouseId);
            //container.SetM_Locator_ID(locatorId);
            //container.SetHeight(height);
            //container.SetWidth(width);
            //container.SetRef_M_Container_ID(parentContainerId);
            //if (!container.Save())
            //{
            //    ValueNamePair pp = VLogger.RetrieveError();
            //    return Msg.GetMsg(_ctx, "VIS_ContainernotSaved") + " " + (pp != null ? pp.GetName() : "");
            //}
            //else
            //{
            //    return "";
            //}
            return("");
        }
Esempio n. 2
0
        /// <summary>
        /// GetWarehouse
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="fields"></param>
        /// <returns></returns>
        public Dictionary <string, string> GetWarehouse(Ctx ctx, string fields)
        {
            string[] paramValue = fields.Split(',');
            int      M_Warehouse_ID;

            //Assign parameter value
            M_Warehouse_ID = Util.GetValueOfInt(paramValue[0].ToString());
            //Assign parameter value

            MWarehouse wh = MWarehouse.Get(ctx, M_Warehouse_ID);
            Dictionary <string, string> result = new Dictionary <string, string>();

            result["M_Locator_ID"] = wh.GetDefaultM_Locator_ID().ToString();
            return(result);
        }
Esempio n. 3
0
        }       //	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