Define next Batch Number
Example: Manual receipt, Goods Receipt Po and so on
Define new Batch Number in variable e_DistNumber. If this is not defined, the system use the settings in congifuration wizzard
Variable |
Read |
Write |
Description |
---|---|---|---|
e_ItemCode |
x |
Calculation methode Id |
|
e_DistNumber |
|
x |
Define new Batch Number if the batch number not defined, the system use standard counting |
Example 1
// DistNumber = today (yyyy/mm/dd) + "-" + new counter for every day
// Example: 20200501-0001, 20200501-0002, 20200501-0003 ...
function GetBatchNumber
select coalesce(max(substring("DistNumber",10,4)),0) into myCounter from "OBTN" where left("DistNumber",9) = '<today,yyyymmdd>-'
setvar=myCounter=%numadd(myCounter,1)
setvar=myCounter=000<myCounter,#0>
setvar=e_DistNumber=<today,yyyymmdd>-<myCounter,right 4>
end function
Example 2
// Use B05C as Prefix + own Counter with 5 digits
// All items with MaterialGroup = "ZPT" has own counter
function GetBatchNumber
// 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=e_DistNumber=B05C<boy_counter,right 5>
return success
end function