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("");
        }