예제 #1
0
        public async Task <IActionResult> PutStockDelivery(int id, StockDelivery stockDelivery)
        {
            if (id != stockDelivery.DeliveryID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult <StockDelivery> > PostStockDelivery(StockDelivery stockDelivery)
        {
            _context.StockDeliveries.Add(stockDelivery);
            await _context.SaveChangesAsync();

            Stock stock = _context.Stocks.Single(s => s.StockID == stockDelivery.StockID);

            stock.DeliveryID = stockDelivery.DeliveryID;

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StockExists(stockDelivery.StockID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetStockDelivery", new { id = stockDelivery.DeliveryID }, stockDelivery));
        }
예제 #3
0
 public void Save_Click()
 {
     if (StockDelivery.IsValid())
     {
         StockDelivery.EndEdit();
         Display = !Display;
     }
 }
예제 #4
0
        private void dataGridViewStockDeliveryMaster_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            if (e.ColumnIndex == this.ColumnStockDeliveryMasterComplete.Index)
            {
                StockDelivery stockDelivery = (dataGridViewStockDeliveryMaster.CurrentRow.DataBoundItem as StockDelivery);

                this.simulatorCore.StockDeliverySetCore.CompleteDelivery(stockDelivery);

                //update UI.
                this.StorageSystemSimulatorCore_StockDeliveryUpdated(this, null);
            }
        }
예제 #5
0
        private void dataGridViewStockDeliveryDetail_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            if (e.ColumnIndex == this.ColumnStockDeliveryLoadPack.Index)
            {
                StockDelivery     stockDelivery     = (dataGridViewStockDeliveryMaster.CurrentRow.DataBoundItem as StockDelivery);
                StockDeliveryItem stockDeliveryItem = (dataGridViewStockDeliveryDetail.Rows[e.RowIndex].DataBoundItem as StockDeliveryItem);

                this.simulatorCore.StockDeliverySetCore.LoadStockDeliveryItem(stockDelivery, stockDeliveryItem);

                //update UI.
                this.StorageSystemSimulatorCore_StockDeliveryUpdated(this, null);
            }
        }
예제 #6
0
        public bool LoadStockDeliveryItem(StockDelivery stockDelivery, StockDeliveryItem stockDeliveryItem)
        {
            if ((stockDelivery.State != StockDeliveryState.Queued) &&
                ((stockDelivery.State != StockDeliveryState.InProcess)))
            {
                // delivery doesn't expect any more packs.
                return(false);
            }

            if ((stockDeliveryItem.RequestedQuantity <= stockDeliveryItem.ProcessedQuantity) &&
                (stockDeliveryItem.RequestedQuantity != 0))
            {
                // this item doesn't expect any more packs.
                return(false);
            }

            if (stockDelivery.State == StockDeliveryState.Queued)
            {
                stockDelivery.State = StockDeliveryState.InProcess;
            }

            stockDeliveryItem.ProcessedQuantity++;

            this.stock.LoadInput(stockDeliveryItem.ArticleCode,
                                 stockDeliveryItem.Name,
                                 stockDeliveryItem.DosageForm,
                                 stockDeliveryItem.PackagingUnit,
                                 stockDeliveryItem.MaxSubItemQuantity,
                                 stockDeliveryItem.BatchNumber,
                                 stockDeliveryItem.ExternalID,
                                 stockDeliveryItem.ExpiryDate,
                                 0, // is stock delivery always for full packs ?
                                 stockDeliveryItem.MachineLocation,
                                 stockDeliveryItem.TenantID,
                                 stockDeliveryItem.StockLocationID);


            return(true);
        }
예제 #7
0
        private void dataGridViewStockDeliveryMaster_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            StockDelivery stockDelivery = (dataGridViewStockDeliveryMaster.Rows[e.RowIndex].DataBoundItem as StockDelivery);

            dataGridViewStockDeliveryDetail.DataSource = new BindingSource(stockDelivery.Items, "");
        }
예제 #8
0
 public void Cancel_Click()
 {
     StockDelivery.CancelEdit();
     Display = !Display;
 }
예제 #9
0
 public void Edit_Click()
 {
     StockDelivery.BeginEdit();
     Display = !Display;
 }
예제 #10
0
 public void CompleteDelivery(StockDelivery stockDelivery)
 {
     // chould we check that all epxected pack have been loaded and set state to complete / imcomplete
     stockDelivery.State = StockDeliveryState.Completed;
 }