Ejemplo 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("");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get Product Container in term of Tree Structure
        /// </summary>
        /// <param name="warehouse">Warehouse -- which warehouse container we have to show</param>
        /// <param name="locator">Locato - which locator container we have to show</param>
        /// <param name="container">not used this parameter functionality -- Tree structure mismatched</param>
        /// <returns></returns>
        public List <TreeContainer> GetContainerAsTree(int warehouse, int locator, int container, string validation)
        {
            if (warehouse == 0 && locator > 0)
            {
                MLocator m_locator = MLocator.Get(_ctx, locator);
                warehouse = m_locator.GetM_Warehouse_ID();
            }
            List <TreeContainer> keyVal = new List <TreeContainer>();
            string sql = @"SELECT value ,   '.'   || LPAD (' ', LEVEL * 1)   || Name AS Name,
                            LEVEL ,   name   || '_'   || value AS ContainerName , m_productcontainer_id
                         FROM m_productcontainer WHERE IsActive = 'Y'";

            if (warehouse > 0)
            {
                sql += " AND m_warehouse_id = " + warehouse;
            }
            if (locator > 0)
            {
                sql += "  AND M_Locator_ID = " + locator;
            }
            if (container > 0)
            {
                sql += " AND M_ProductContainer_ID != " + container;
            }
            if (!String.IsNullOrEmpty(validation))
            {
                sql += " AND " + validation;
            }
            sql += "  START WITH NVL(ref_m_container_id,0) =0  CONNECT BY NVL(ref_m_container_id,0) = PRIOR m_productcontainer_id";
            sql  = MRole.GetDefault(_ctx).AddAccessSQL(sql, "M_ProductContainer", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO); // fully qualidfied - RO
            DataSet ds = DB.ExecuteDataset(sql);

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    keyVal.Add(new TreeContainer()
                    {
                        Value                 = Util.GetValueOfString(ds.Tables[0].Rows[i]["value"]),
                        Name                  = Util.GetValueOfString(ds.Tables[0].Rows[i]["Name"]),
                        Level                 = Util.GetValueOfInt(ds.Tables[0].Rows[i]["LEVEL"]),
                        ContainerName         = Util.GetValueOfString(ds.Tables[0].Rows[i]["ContainerName"]),
                        M_ProductContainer_ID = Util.GetValueOfInt(ds.Tables[0].Rows[i]["M_ProductContainer_ID"])
                    });
                }
                ds.Dispose();
            }
            return(keyVal);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// This function is used to create or update record on Container Storage
 /// </summary>
 /// <param name="containerStorage">Container Storage Object</param>
 /// <param name="dr">data row</param>
 /// <returns>container Storage object</returns>
 private X_M_ContainerStorage InsertContainerStorage(X_M_ContainerStorage containerStorage, DataRow dr)
 {
     if (containerStorage.Get_ID() <= 0)
     {
         containerStorage.SetAD_Client_ID(Convert.ToInt32(dr["AD_Client_ID"]));
         containerStorage.SetAD_Org_ID(MLocator.Get(containerStorage.GetCtx(), Convert.ToInt32(dr["M_Locator_ID"])).GetAD_Org_ID());
         containerStorage.SetM_Locator_ID(Convert.ToInt32(dr["M_Locator_ID"]));
         containerStorage.SetM_Product_ID(Convert.ToInt32(dr["M_Product_ID"]));
         containerStorage.SetM_AttributeSetInstance_ID(Convert.ToInt32(dr["M_AttributeSetInstance_ID"]));
         containerStorage.SetMMPolicyDate(Convert.ToDateTime(dr["MovementDate"]));
         containerStorage.SetIsPhysicalInventory(Convert.ToString(dr["PhysicalInventory"]).Equals("Y") ? true : false);
         containerStorage.SetQty(Convert.ToDecimal(dr["MovementQty"]));
     }
     else
     {
         containerStorage.SetQty(Decimal.Add(containerStorage.GetQty(), Convert.ToDecimal(dr["MovementQty"])));
     }
     return(containerStorage);
 }
        /// <summary>
        /// savelocator value into database
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="warehouseId"></param>
        /// <param name="tValue"></param>
        /// <param name="tX"></param>
        /// <param name="tY"></param>
        /// <param name="tZ"></param>
        /// <returns></returns>
        public int LocatorSave(Ctx ctx, string warehouseId, string tValue, string tX, string tY, string tZ)
        {
            var loc = MLocator.Get(ctx, Convert.ToInt32(warehouseId), tValue, tX, tY, tZ);

            return(loc.GetM_Locator_ID());
        }