Subject | RE: [firebird-support] Re: Read uncommitted |
---|---|
Author | Alan McDonald |
Post date | 2010-08-17T21:21:32Z |
> --- In firebird-support@yahoogroups.com, "Alan McDonald" <alan@...>no - in the case of only pure stock counts being maintained, I would use a
> wrote:
> >
> > > Thank you for your answer Alan.
> > >
> > > If I understand, what you suggest might work when products are
> "unique"
> > > (that is, there is only one of each product), but this is not my
> case.
> > > I will give an example.
> > >
> > > There are a stock of 100 pieces of product A.
> > >
> > > Seller 1 is making an order and he inserts a line which includes 70
> > > pieces of product A.
> > >
> > > Seller 2 is making another order and he tries to insert a line
> which
> > > includes 50 pieces of product A. The application should tell him
> there
> > > is no enough stock because at that moment there are only 30 pieces
> > > available (100 - 70).
> > >
> >
> > The same logic would apply with an additional step of counting the
> un-locked
> > items, then if there is enough for the order, locking the first N
> items with
> > the update statement until the commit unlocks them and marks them
> sold.
> > Alan
> >
>
> Hi Alan,
>
> Just to be clearer, you mean that Products table would in that case
> have a column "pieces in Stock" and another "Locked Pieces" that should
> be updated?
>
separate table with stockid and -count insertion which is committed at time
of stock 'grab'
At time of PO commit, I would update the stock count with the sum of stock
count and the -count insertion records and delete the -count record
Alan