Batchnumber and Serialnumber

Batch No. and serial No. can be created automatically.

Therefore you can set a function at

Configuration wizard

..  Production, Material Entry and Reserved, Batch Management - Number Assignment

or / and:

.. Materialmanagement, Incoming Goods, Batchmanagement, Number Assignment

 

Example: Create a file in the project folder:

 

workordermanagement.src

 

Create a function which has to return the batch/serial in str_parm.s_parm1

 

help-beispielExample Serialnumber G/C+Counter

 

// Create SerNr : Itemgroupnam + Number 5 digits

// 25.4.06 M.Heigl

// this function is running with Beas 2020.02 or later

function sernr

// define instance from beas Service Layer

instance bsl boy_b

// Read Material Group from item

boy_b.get=Item(<e_itemcode,bsl>)/MaterialGroupId/$value

// if Material Group is ZPT then read Counter G otherwise C

if <boy_b.ret_value> = "ZPT" then

 setvar=boy_counter=G

else

 setvar=boy_counter=C

end if

// new serial Number is B05C + Counter with 5 digits

setvar=boy_counter=00000<system.counter.boy_counter_[boy_counter]>

setvar=s_parm1=B05C<boy_counter,right 5>

return success

 

 

write in configuration wizard:

workordermanagement:sernr()

 

When creating a batch make sure that it can be defined previously (when you create the work order).

Therefore you have to check in the script if you are in the booking action. Helpful here is checking the variable "e_type"

 

help-beispiel Example: manuall input Batchnum

 

function batchnumbergenerate

if <e_type> <> receiptWO then

 return success

end if

[loop]

setvar=cbatchnum=

input=Chargennummer:=cbatchnum

if <cbatchnum> = then

 goto=loop

end if

setstr=s_parm1=<cbatchnum>

return success

end

 

help-beispiel Example Batchnum SSywwxxxx

y=Year

w=Week

x=counter

 

// Create Batchnum

// 5.7.06 M.Heigl

function btchnum

// only while create wo

if <e_type> <> receiptWO then

 return success

end if

// week from beas_kalender

select substring(convert(char(4),year(getdate())),4,1)+substring(convert(char(20),kw_id),5,2) from beas_kalender where convert(char(8),datum_id,12) = convert(char(8),getdate(),12)

// Vesuvius Site = "SS"

setvar=cbatchnum=SS<wert1>

// select max Batchnum

select right('000'+rtrim(convert(varchar(5),isnull(max(substring(batchnum,6,3)),0)+1)),3) from oibt where substring(oibt.batchnum,1,5)='<cbatchnum>'

setvar=cbatchnum=<cbatchnum><wert1>

// return new Batchnum in s_parm1

setstr=s_parm1=<cbatchnum>

return success

end

//