Re: Generate a daily serial/batch/lot number

2010-10-07 Thread Darryl Ross
On 06/09/10 19:09, kmpm wrote: Regarding UUIDs, one of the business requirements (which I don't control) is that the identifier that is to be used on barcodes and what not is to be in the format "YYMMDD" where is the number we are talking about. So UUID would be great and unique, as well

Re: Generate a daily serial/batch/lot number

2010-09-06 Thread Shamail Tayyab
On Tuesday 07 September 2010 04:46 AM, Mike Dewhirst wrote: I'm reminded that almost all my own disasters were caused by premature optimisation. Seconds that! :-) I would go with the simplest solution and keep an eye on performance as it scales. Gives you plenty of time to research plan B.

Re: Generate a daily serial/batch/lot number

2010-09-06 Thread kmpm
On Sep 6, 8:40 pm, raj wrote: > Hi all, > Why can't we use the aggregate function 'max' from within save()? I > found it working to find the lot_max from among the objects filtered > by prod_date and then if lot_max is None, lot_no must be 0, else it's > just lot_max + 1. I don't know if I've mi

Re: Generate a daily serial/batch/lot number

2010-09-06 Thread Mike Dewhirst
I'm reminded that almost all my own disasters were caused by premature optimisation. I would go with the simplest solution and keep an eye on performance as it scales. Gives you plenty of time to research plan B. That'll be 2c please M On 7/09/2010 4:49am, kmpm wrote: On Sep 6, 6:52 pm,

Re: Generate a daily serial/batch/lot number

2010-09-06 Thread kmpm
On Sep 6, 6:52 pm, Preston Holmes wrote: > > what about a simple function that does something as low tech as > checking a lock file.  If you had multiple front end servers, this > could be a running process on a server using semaphore lock. > > -Preston Sort of thought about that as well. Meanw

Re: Generate a daily serial/batch/lot number

2010-09-06 Thread raj
Hi all, Why can't we use the aggregate function 'max' from within save()? I found it working to find the lot_max from among the objects filtered by prod_date and then if lot_max is None, lot_no must be 0, else it's just lot_max + 1. I don't know if I've misunderstood some requirement by the way.

Re: Generate a daily serial/batch/lot number

2010-09-06 Thread Preston Holmes
On Sep 6, 2:39 am, kmpm wrote: > First of all to everyone, thanks for all good suggestions so far. > > Regarding UUIDs, one of the business requirements (which I don't > control) is that the identifier that is to be used on barcodes and > what not is to be in the format "YYMMDD" where i

Re: Generate a daily serial/batch/lot number

2010-09-06 Thread kmpm
For anyone listening in... the ticket http://code.djangoproject.com/ticket/2705 might also be worth looking at On Sep 6, 11:39 am, kmpm wrote: > > UUIDs are your best bet. Even if you generated 100 billion UUIDs a > > second for the next 100 years, the chance of one collision would only > > be 50

Re: Generate a daily serial/batch/lot number

2010-09-06 Thread kmpm
> > UUIDs are your best bet. Even if you generated 100 billion UUIDs a > second for the next 100 years, the chance of one collision would only > be 50% [1]. > > class ProducedEntity(models.Model): >     >     uuid = models.CharField(max_length=36, unique=True) > > def _hook_add_uuid(instance,

Re: Generate a daily serial/batch/lot number

2010-09-06 Thread Tom Evans
On Mon, Sep 6, 2010 at 7:19 AM, kmpm wrote: > I have a project running in a manufacturing industry that is actually > built upon django. > In this I need to generate a unique serial, batch or lot number > (depending on what you would like to call it) that is a running number > from 0 to whathever

Re: Generate a daily serial/batch/lot number

2010-09-06 Thread Mike Dewhirst
On 6/09/2010 5:38 PM, kmpm wrote: On Sep 6, 9:02 am, Mike Dewhirst wrote: On 6/09/2010 4:19pm, kmpm wrote: I have a project running in a manufacturing industry that is actually built upon django. In this I need to generate a unique serial, batch or lot number (depending on what you would like

Re: Generate a daily serial/batch/lot number

2010-09-06 Thread Daniel Roseman
On Sep 6, 8:38 am, kmpm wrote: > On Sep 6, 9:02 am, Mike Dewhirst wrote: > > > > > > > On 6/09/2010 4:19pm, kmpm wrote: > > > > I have a project running in a manufacturing industry that is actually > > > built upon django. > > > In this I need to generate a unique serial, batch or lot number > >

Re: Generate a daily serial/batch/lot number

2010-09-06 Thread kmpm
On Sep 6, 9:02 am, Mike Dewhirst wrote: > On 6/09/2010 4:19pm, kmpm wrote: > > > I have a project running in a manufacturing industry that is actually > > built upon django. > > In this I need to generate a unique serial, batch or lot number > > (depending on what you would like to call it) that i

Re: Generate a daily serial/batch/lot number

2010-09-06 Thread Mike Dewhirst
On 6/09/2010 4:19pm, kmpm wrote: I have a project running in a manufacturing industry that is actually built upon django. In this I need to generate a unique serial, batch or lot number (depending on what you would like to call it) that is a running number from 0 to whathever for each and every d

Generate a daily serial/batch/lot number

2010-09-05 Thread kmpm
I have a project running in a manufacturing industry that is actually built upon django. In this I need to generate a unique serial, batch or lot number (depending on what you would like to call it) that is a running number from 0 to whathever for each and every day. There is a high risk of concurr