This question has been flagged

Hi All, Using V6.1 on windows I basically want to design a class or function in an existing module, probably the stock module, that would allow the system to create production lot number based on the current date and number of production lot that has been created on that day. I have written a code that I think would do the job but I do not know where exactly to put it. The python code is below which is quite simple. This is to make tracking of product even easier for the company and employees

currentid=None;

#currentid='1130206'

if currentid==None or currentid=='':

   currentid='1'+time.strftime('%y%d%m')

else:

   idpart=currentid[0:-6];

datepart=currentid[1:];

#print (idpart)

#print (datepart)

idpartint=int(idpart)

if time.strftime('%y%d%m')==datepart:

    currentid=str(idpartint+1)+datepart

else:

    currentid='1'+time.strftime('%y%d%m')

#print (currentid)

prodt_lot = currentid

the series should look something like 1132205,2132205...x132205 for the 22May2013 then the next day should start from 1 again looking like this 1132305,2132305...x132305 etc as oppose to the current seven digit number e.g 0000007 generated by the system

Thank you.
Can anyone help please?

Avatar
Discard