Esempio n. 1
0
        public async Task <ActionResult <GoodsReceive> > PostGoodsReceive(GoodsReceive goodsReceive)
        {
            _context.GoodsReceive.Add(goodsReceive);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetGoodsReceive", new { id = goodsReceive.GoodsReceiveId }, goodsReceive));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(Guid id, [Bind("GoodsReceiveId,Number,Description,GoodsReceiveDate,PurchaseOrderId")] GoodsReceive goodsReceive)
        {
            if (id != goodsReceive.GoodsReceiveId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(goodsReceive);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GoodsReceiveExists(goodsReceive.GoodsReceiveId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PurchaseOrderId"] = new SelectList(_context.PurchaseOrder, "PurchaseOrderId", "Number", goodsReceive.PurchaseOrderId);
            return(View(goodsReceive));
        }
Esempio n. 3
0
        public async Task <IActionResult> PutGoodsReceive(Guid id, GoodsReceive goodsReceive)
        {
            if (id != goodsReceive.GoodsReceiveId)
            {
                return(BadRequest());
            }

            _context.Entry(goodsReceive).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!GoodsReceiveExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 4
0
        private void EunDetails(GoodsReceive obj)
        {
            ObjectSelectionNotification notification = new ObjectSelectionNotification();

            notification.ParentItem        = obj;
            notification.Title             = "Unit Kilogram (KG) Child Window";
            notification.AuthenticatedUser = AuthenticatedUser;

            var kgs = GRServices.GetEunKG(obj.ID).EunKGs;

            if (kgs.Count() > 0)
            {
                foreach (var item in kgs)
                {
                    notification.Items.Add(item);
                }
            }

            this.eunSetDetailsRequest.Raise(
                notification,
                returned =>
            {
                if (returned.Confirmed && returned.ReturnItem != null)
                {
                    MessageBox.Show($"{returned.ReturnItem}.", "Success", MessageBoxButton.OK);
                }
            });
        }
Esempio n. 5
0
 public void Update(GoodsReceive gr)
 {
     using (var context = new InventoryContext())
     {
         context.Entry(gr).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Esempio n. 6
0
 public void Add(GoodsReceive gr)
 {
     using (var context = new InventoryContext())
     {
         context.GoodsReceives.Add(gr);
         context.SaveChanges();
     }
 }
Esempio n. 7
0
        private void OpenGRDetails(GoodsReceive gr)
        {
            var parameters = new NavigationParameters();

            parameters.Add("AuthenticatedUser", AuthenticatedUser);
            parameters.Add("ID", gr.ID);

            this.regionManager.RequestNavigate(RegionNames.MainContentRegion, new Uri(grDetailsViewName + parameters, UriKind.Relative));
        }
Esempio n. 8
0
        public async Task <IActionResult> Create([Bind("GoodsReceiveId,Number,Description,GoodsReceiveDate,PurchaseOrderId")] GoodsReceive goodsReceive)
        {
            if (ModelState.IsValid)
            {
                goodsReceive.GoodsReceiveId = Guid.NewGuid();
                _context.Add(goodsReceive);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PurchaseOrderId"] = new SelectList(_context.PurchaseOrder, "PurchaseOrderId", "Number", goodsReceive.PurchaseOrderId);
            return(View(goodsReceive));
        }
Esempio n. 9
0
 private void Update(ref GoodsReceive obj, GoodsReceive gr)
 {
     obj.Vendor            = gr.Vendor;
     obj.Material          = gr.Material;
     obj.MaterialShortText = gr.MaterialShortText;
     obj.Ok           = gr.Ok;
     obj.Quantity     = gr.Quantity;
     obj.StorageLoc   = gr.StorageLoc;
     obj.Plant        = gr.Plant;
     obj.StorageBin   = gr.StorageBin;
     obj.DocumentDate = gr.DocumentDate;
     obj.PostingDate  = gr.PostingDate;
     obj.ModifiedOn   = DateTime.Now;
     obj.ModifiedBy   = AuthenticatedUser;
 }
Esempio n. 10
0
        private void InitTabRegion(long GRID)
        {
            if (GRID == 0)
            {
                return;
            }

            GoodsReceive objSummry = new GoodsReceive();

            objSummry = grTransServices.GetGRDetails(GRID);

            ObservableCollection <GRTransaction> lstTrnx = new ObservableCollection <GRTransaction>();

            foreach (var obj in grTransServices.GetGRTransactionByGRID(GRID))
            {
                lstTrnx.Add(obj);
            }

            IRegion tabRegion = regionManager.Regions[RegionNames.TabRegionGR];

            if (tabRegion == null)
            {
                return;
            }

            GRDetailsSummaryView     summryView = tabRegion.GetView("GRDetailsSummaryView") as GRDetailsSummaryView;
            GRDetailsTransactionView trnxView   = tabRegion.GetView("GRDetailsTransactionView") as GRDetailsTransactionView;

            if (summryView == null && trnxView == null)
            {
                summryView = this.container.Resolve <GRDetailsSummaryView>();
                trnxView   = this.container.Resolve <GRDetailsTransactionView>();

                tabRegion.Add(summryView, "GRDetailsSummaryView");
                tabRegion.Add(trnxView, "GRDetailsTransactionView");
            }
            tabRegion.Activate(summryView);

            GRDetailsSummaryViewModel     summryVM = summryView.DataContext as GRDetailsSummaryViewModel;
            GRDetailsTransactionViewModel trnxVM   = trnxView.DataContext as GRDetailsTransactionViewModel;

            if (summryVM != null && trnxVM != null)
            {
                summryVM.summryObj    = objSummry;
                trnxVM.trnxCollection = lstTrnx;
            }
        }
        public async Task <IActionResult> Create([Bind("GoodsReceiveId,Number,Description,GoodsReceiveDate,PurchaseOrderId")] GoodsReceive goodsReceive)
        {
            if (ModelState.IsValid)
            {
                goodsReceive.GoodsReceiveId = Guid.NewGuid();
                _context.Add(goodsReceive);
                List <PurchaseOrderLine> purchLines = new List <PurchaseOrderLine>();
                purchLines = await _context.PurchaseOrderLine.Where(x => x.PurchaseOrderId.Equals(goodsReceive.PurchaseOrderId)).ToListAsync();

                foreach (var item in purchLines)
                {
                    GoodsReceiveLine line = new GoodsReceiveLine();
                    line.GoodsReceiveId      = goodsReceive.GoodsReceiveId;
                    line.PurchaseOrderLineId = item.PurchaseOrderLineId;
                    line.ProductId           = item.ProductId;
                    line.QtyPurchase         = item.Quantity;
                    line.QtyReceive          = 0;
                    List <GoodsReceiveLine> received = new List <GoodsReceiveLine>();
                    received = await _context.GoodsReceiveLine.Where(x => x.PurchaseOrderLineId.Equals(item.PurchaseOrderLineId)).ToListAsync();

                    line.QtyReceived = received.Sum(x => x.QtyReceive);
                    _context.Add(line);

                    InvenTran tran = new InvenTran();
                    tran.InvenTranId      = Guid.NewGuid();
                    tran.Number           = _pos.GenerateInvenTranNumber();
                    tran.ProductId        = line.ProductId;
                    tran.TranSourceId     = line.GoodsReceiveLineId;
                    tran.TranSourceNumber = goodsReceive.Number;
                    tran.TranSourceType   = "GR";
                    tran.Quantity         = line.QtyReceive * 1;
                    tran.InvenTranDate    = DateTime.Now;
                    _context.Add(tran);
                }
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Edit), new { id = goodsReceive.GoodsReceiveId }));
            }
            ViewData["PurchaseOrderId"] = new SelectList(_context.PurchaseOrder, "PurchaseOrderId", "Number", goodsReceive.PurchaseOrderId);
            return(View(goodsReceive));
        }
Esempio n. 12
0
 public ObjectSelectionNotification(GoodsReceive parentItem)
     : this()
 {
     this.ParentItem = parentItem;
 }