Customer script provided, which performs the following for a given ordnum:
1. Update all pckmov arrqty and prcqty to zero
2. Find where the inventory is currently for shipment - qty and location
3. Update correct pckmov records with the correct arrqty
publish data
where ordnum = ' '
|
/* clean out all pckmov records for the order */
[update pckmov
set arrqty = 0,
prcqty = 0
where cmbcod in (select cmbcod
from pckwrk
where ordnum = @ordnum)]
|
/* find the sum of inventory, location and pckmov key that needs updating */
[select sum(untqty) vc_updateqty,
invlod.stoloc,
pckmov.cmbcod vc_cmbcod,
seqnum
from invdtl,
invsub,
invlod,
pckwrk,
pckmov
where invdtl.ship_line_id in (select ship_line_id
from shipment_line
where ordnum = @ordnum)
and invlod.lodnum = invsub.lodnum
and invdtl.subnum = invsub.subnum
and invdtl.wrkref = pckwrk.wrkref
and pckmov.cmbcod = pckwrk.cmbcod
and pckmov.stoloc = invlod.stoloc
group by invlod.stoloc,
pckmov.cmbcod,
seqnum]
|
/* update the arrqty for the pckmov */
[update pckmov
set arrqty = @vc_updateqty,
prcqty = 0
where cmbcod = @vc_cmbcod
and seqnum = @seqnum
and stoloc = @stoloc];