dylphin
22nd March 2009, 05:25
Hi to all :

thanks a lot !

mark_h
23rd March 2009, 01:53
Not sure what session your are looking for, but search this forum for the session number. You might find something. That is the one area we have not developed any api code for.

_Ralph_
23rd March 2009, 16:45
Hi to all :

thanks a lot !

if you are working with LN, a long time a go I needed to use afs on this session. What I can say: I suffer :D

The big problem involved the field of "counted pieces".

The solution in the end was a mix of AFS and db transactions(such an ugly thing)

Thomasm
24th March 2009, 10:41
Tried to solve this via afs but ended up doing it via db.update since I did not get the 'find' to work in the session tdinv1120m000.

This is what I do:

i if ( OK.to.report.item ) then
| first we do a check to see if we can assume that the order has been zeroed or not and take action if not
| Zeroing an order destroys the table buffer, hence 2 selects
select
*
from
tdinv120
where
tdinv120._index3 = {:tssma306.cwar,:counted.item}
and tdinv120.prst = tcyesno.yes
and ( tdinv120.csts = tcyesno.no
or tdinv120.cstc < 0.01 )
order by
tdinv120.date desc | make sure to pick up the latest order (if more than one)
as set with 1 rows | make sure to pick up the latest order (if more than one)
selectdo
if ( tdinv120.csts = tcyesno.no and double.cmp(tdinv120.cstc, 0.0, 0.01) <= 0 ) then
| this is record not set to 0 so expect the complete order to not be zeroed
OK.to.report.item = setAllNotCountedRecordsOnOrderToAllocated( tdinv120.orno, tdinv120.cwar )
endif

endselect

| here we do the real update.
| Zeroing an order destroys the table buffer, hence 2 selects
db.retry.point()
select
*
from
tdinv120 for update
where
tdinv120._index3 = {:tssma306.cwar,:counted.item}
and tdinv120.prst = tcyesno.yes
and ( tdinv120.csts = tcyesno.no
or tdinv120.cstc < 0.01 )
order by
tdinv120.date desc | make sure to pick up the latest order (if more than one)
as set with 1 rows | make sure to pick up the latest order (if more than one)
selectdo

select
*
from
tdinv001
where
tdinv001._index1 = {:tdinv120.cwar,:tdinv120.item}
as set with 1 rows
selectdo
break | just pick it up
selectempty
setError( "Did not find the item in the warehouse from table tdinv001"
& " Warehouse: " & strip$(shiftl$(tdinv120.cwar))
& " Item: " & strip$(shiftl$( tdinv120.item) ) )
OK.to.report.item = false
endselect

if ( OK.to.report.item ) then
quantity = tdinv001.allo + counted.qana

tdinv120.cstc = quantity
tdinv120.cdat = counted.cdat
tdinv120.csts = tcyesno.yes
upd = db.update(ttdinv120, db.retry)
if ( upd = 0 ) then
comm = commit.transaction()
if ( comm = 0 ) then
OK.to.report.item = true
else
OK.to.report.item = false
endif
else
OK.to.report.item = false
endif
endif
selectempty
| error handling
endselect



Good luck