public ActionResult Start(WarehouseBL warehouse)
        {
            WarehouseBusinessLayer warehouseBL = new WarehouseBusinessLayer();

            warehouse.managerId = Convert.ToInt32(Session["UserID"]);
            warehouseBL.UpdateStartWareHouse(warehouse);

            return(RedirectToAction("LoggedIn", "Account"));
        }
示例#2
0
 protected void gvxReceiving_RowUpdated(object sender, DevExpress.Web.Data.ASPxDataUpdatedEventArgs e)
 {
     if (e.OldValues["ItemID"] != e.NewValues["ItemID"] || e.OldValues["StorageID"] != e.NewValues["StorageID"])
     {
         WarehouseBL warhouseManagement = new WarehouseBL();
         warhouseManagement.UpdateMangment(int.Parse(e.OldValues["ItemID"].ToString()), int.Parse(e.OldValues["StorageID"].ToString()), int.Parse(e.OldValues["Amount"].ToString()));
         warhouseManagement.InsertMangment(int.Parse(e.NewValues["ItemID"].ToString()), int.Parse(e.NewValues["StorageID"].ToString()), int.Parse(e.NewValues["Amount"].ToString()));
     }
 }
        public JsonResult GetAllUser()
        {
            try
            {
                List <WarehouseBL> allUser = new List <WarehouseBL>();

                WarehouseBusinessLayer wbl = new WarehouseBusinessLayer();
                DataSet     ds             = wbl.getWarehouseDetails(Convert.ToInt32(Session["UserID"]));
                DataRow     dr             = ds.Tables[0].Rows[0];
                WarehouseBL w = new WarehouseBL();
                w.scaledShelfLength = dr["scaledShelfLength"].ToString();
                w.scaledShelfWidth  = dr["scaledShelfWidth"].ToString();

                allUser.Add(w);

                return(new JsonResult {
                    Data = allUser, JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
        private void LoadData()
        {
            OperationResult objOperationResult = new OperationResult();

            Utils.LoadDropDownList(ddlProductId, "Value1", "Id", BLL.Utils.GetProductWarehouse(ref objOperationResult, "Id==" + "\"" + -1 + "\""), DropDownListAction.Select); // el combo producto se carga vacio hasta que se seleccione un almacén de origen.
            lblNodeSource.Text   = Globals.ClientSession.v_CurrentExecutionNodeName;
            dtpDate.CustomFormat = "dd/MM/yyyy";
            if (_Mode == "New")
            {
                _booAlreadySaved = false;
                //Source
                Utils.LoadDropDownList(ddlOrganizationLocationSourceId, "Value1", "Id", BLL.Utils.GetJoinOrganizationAndLocationNotInRestricted(ref objOperationResult, Globals.ClientSession.i_CurrentExecutionNodeId), DropDownListAction.Select);
                Utils.LoadDropDownList(ddlWarehouseSourceId, "Value1", "Id", BLL.Utils.GetWarehouseNotInRestricted(ref objOperationResult, Globals.ClientSession.i_CurrentExecutionNodeId, "-1", "-1"), DropDownListAction.Select);

                //Destination
                Utils.LoadDropDownList(ddlNodeDestinationId, "Value1", "Id", BLL.Utils.GetAllNodeForCombo(ref objOperationResult), DropDownListAction.Select);
                if (rbLocal.Checked == true)
                {
                    ddlNodeDestinationId.Enabled       = false;
                    ddlNodeDestinationId.SelectedValue = Globals.ClientSession.i_CurrentExecutionNodeId.ToString();
                }
                else
                {
                    ddlNodeDestinationId.Enabled = true;
                }

                Utils.LoadDropDownList(ddlOrganizationLocationDestinationId, "Value1", "Id", BLL.Utils.GetJoinOrganizationAndLocationNotInRestricted(ref objOperationResult, Globals.ClientSession.i_CurrentExecutionNodeId), DropDownListAction.Select);
                Utils.LoadDropDownList(ddlWarehouseDestinationId, "Value1", "Id", BLL.Utils.GetWarehouseNotInRestricted(ref objOperationResult, Globals.ClientSession.i_CurrentExecutionNodeId, "-1", "-1"), DropDownListAction.Select);

                txtIsProcessed.Text  = "NO";
                txtDocReference.Text = "";
                dtpDate.Value        = DateTime.Now.Date;
            }
            else if (_Mode == "Edit")
            {
                // Get the Entity Data

                warehouseDto objwarehouseDto = new warehouseDto();
                WarehouseBL  objWarehouseBL  = new WarehouseBL();

                movementDto objMovementDto = new movementDto();
                MovementBL  objMovementBL  = new MovementBL();

                movementdetailDto objmovementdetailDto = new movementdetailDto();

                supplierDto objSupplierDto = new supplierDto();
                SupplierBL  objSupplierBL  = new SupplierBL();

                nodeorganizationlocationwarehouseprofileDto objnodeorganizationlocationwarehouseprofileDto = new nodeorganizationlocationwarehouseprofileDto();
                NodeBL objNodeBL = new NodeBL();
                _booAlreadySaved = true;
                string pstrFilterExpression = null;

                objMovementDto = objMovementBL.GetMovement(ref objOperationResult, _MovementId);

                //Source
                Utils.LoadDropDownList(ddlOrganizationLocationSourceId, "Value1", "Id", BLL.Utils.GetJoinOrganizationAndLocationNotInRestricted(ref objOperationResult, Globals.ClientSession.i_CurrentExecutionNodeId), DropDownListAction.Select);
                objwarehouseDto = objWarehouseBL.GetWarehouse(ref objOperationResult, objMovementDto.v_WarehouseId);
                ddlOrganizationLocationSourceId.SelectedValue = Globals.ClientSession.i_CurrentExecutionNodeId + "|" + objwarehouseDto.v_OrganizationId + "|" + objwarehouseDto.v_LocationId;
                ddlWarehouseSourceId.SelectedValue            = objwarehouseDto.v_WarehouseId;

                //Destination
                Utils.LoadDropDownList(ddlNodeDestinationId, "Value1", "Id", BLL.Utils.GetAllNodeForCombo(ref objOperationResult), DropDownListAction.Select);

                objnodeorganizationlocationwarehouseprofileDto = objNodeBL.GetNodeOrganizationLocationWarehouseProfile(ref objOperationResult, objMovementDto.v_RemoteWarehouseId);

                if (Globals.ClientSession.i_CurrentExecutionNodeId.ToString() == objnodeorganizationlocationwarehouseprofileDto.i_NodeId.ToString())
                {
                    ddlNodeDestinationId.Enabled = false;
                    rbLocal.Checked = true;
                }
                else
                {
                    ddlNodeDestinationId.Enabled = true;
                    rbRemote.Checked             = true;
                }

                ddlNodeDestinationId.SelectedValue = objnodeorganizationlocationwarehouseprofileDto.i_NodeId.ToString();
                ddlOrganizationLocationDestinationId.SelectedValue = objnodeorganizationlocationwarehouseprofileDto.i_NodeId.ToString() + "|" + objnodeorganizationlocationwarehouseprofileDto.v_OrganizationId + "|" + objnodeorganizationlocationwarehouseprofileDto.v_LocationId;
                ddlWarehouseDestinationId.SelectedValue            = objMovementDto.v_RemoteWarehouseId;
                txtDocReference.Text = objMovementDto.v_ReferenceDocument;
                dtpDate.Value        = (DateTime)objMovementDto.d_Date;
                if (objMovementDto.i_IsLocallyProcessed == (int)Common.SiNo.NO)
                {
                    txtIsProcessed.Text       = "NO";
                    btnSaveRefresh.Enabled    = true;
                    btnConfirmProcess.Enabled = true;
                    btnDiscardProcess.Enabled = true;
                }
                else
                {
                    txtIsProcessed.Text       = "SI";
                    btnSaveRefresh.Enabled    = false;
                    btnConfirmProcess.Enabled = false;
                    btnDiscardProcess.Enabled = false;
                }

                pstrFilterExpression    = "v_MovementId==" + "\"" + objMovementDto.v_MovementId + "\"" + "&&" + "v_WarehouseId==" + "\"" + objMovementDto.v_WarehouseId + "\"";
                _TempMovementDetailList = objMovementBL.GetMovementDeatilPagedAndFiltered(ref objOperationResult, 0, null, "", pstrFilterExpression);
                lblRecordCount.Text     = string.Format("Se encontraron {0} registros.", _TempMovementDetailList.Count());

                grdData.DataSource = _TempMovementDetailList;
            }
        }
        public ActionResult Save(WarehouseBL ware, List <Shelves> shel, List <Depot> depot)
        {
            WarehouseDBEntities    wdb         = new WarehouseDBEntities();
            Shelves                s           = new Shelves();
            WarehouseBusinessLayer warehouseBL = new WarehouseBusinessLayer();

            ware.managerId = Convert.ToInt32(Session["UserID"]);
            warehouseBL.UpdateWareHouse(ware);
            int shelfCount = shel.Count;
            int zoneA      = s.ZoneAshelf(shelfCount);
            int zoneB      = s.ZoneBshelf(shelfCount);
            int zoneC      = s.ZoneCshelf(shelfCount, zoneA, zoneB);

            shel = s.ShelvesWithDistance(shel, depot);
            shel = s.SortShelves(shel);
            shel = s.assignZones(shel, zoneA, zoneB, zoneC);

            foreach (Shelves shelve in shel)
            {
                shelve.warehouse_id = warehouseBL.getWarehouseId(Convert.ToInt32(Session["UserID"]));
                int  myid    = warehouseBL.getWarehouseId(Convert.ToInt32(Session["UserID"]));
                bool isExist = wdb.Shelves.Any(u => u.shelfName == myid.ToString() + shelve.shelveID);
                if (isExist)
                {
                    shelve.shelveID = shelve.warehouse_id + shelve.shelveID;
                    warehouseBL.UpdateShelf(shelve);
                }
                else
                {
                    shelve.shelveID = shelve.warehouse_id + shelve.shelveID;


                    int warehouseID                 = warehouseBL.getWarehouseId(Convert.ToInt32(Session["UserID"]));
                    JavaScriptSerializer jss        = new JavaScriptSerializer();
                    Warehouse            warehouse  = wdb.Warehouses.Find(warehouseID);
                    List <ShelfItems>    shelfItems = new List <ShelfItems>();
                    int z = 1;
                    for (int i = 1; i <= warehouse.shelfSlots; i++)
                    {
                        ShelfItems si = new ShelfItems();
                        si.slot_id     = i;
                        si.item_id     = -1;
                        si.item_name   = "";
                        si.expiry_date = "";
                        si.status      = 0;


                        if (i - warehouse.sections <= 0)
                        {
                            si.section_id = i;
                        }
                        else if (i - warehouse.sections > 0 && i - warehouse.sections * z <= warehouse.sections)
                        {
                            si.section_id = i - (int)warehouse.sections * z;
                        }
                        else
                        {
                            z            += 1;
                            si.section_id = i - ((int)warehouse.sections * z);
                        }



                        shelfItems.Add(si);
                    }
                    string output = JsonConvert.SerializeObject(shelfItems);

                    shelve.slotsRemaining = warehouse.shelfSlots;
                    shelve.shelfItems     = output;



                    warehouseBL.AddShelf(shelve);
                }
            }

            return(RedirectToAction("LoggedIn", "Account"));
        }