====== AIRS-4786 Problem with reducing Qty of a partially invoiced PO on PRD ======
[[https://tasks.supplyon.de/browse/AIRS-4786|AIRS-4786 Problem with reducing Qty of a partially invoiced PO on PRD]]
===== History of PO Num 9301487157 =====
* CHANGE (ReceivingTimeStamp = 20200120110611)
* CollabRequestedQuantity = 8
* CollabPromisedQuantity = 8
* ReceivedQuantity = 0
* CHANGE (ReceivingTimeStamp = 20200122154321)
* CollabRequestedQuantity = 6
* CollabPromisedQuantity = 6
* ReceivedQuantity = 1
* CREATE (ReceivingTimeStamp = 20200124084354)
* CollabRequestedQuantity = 6
* CollabPromisedQuantity = 6
* ReceivedQuantity = 1
Get history for this schedule line:
select * from SEESCMDB0.tAirChangelog where
COBJECTREFERENCE=15977737
--and 1580130681104
and CLOGICALSUBOBJREF='00020/0001'
--and CLOGICALOBJREF like '%9301487157%'
order by cActiontime asc;
===== Misc =====
* The data about quantities is contained in tAirPOLineItem
* Noticeable:
* tAirPoLineItem.cReqTotalQty=0 (bei mir 8)
* tAirPoLineItem.cPromTotalQty=0 (bei mir 8)
update TAIRPOSCHEDULE
set
CNEWFORCUST=0,
CCOLLABACTOR=4,
-- cStatus=1800, -- don't work because of a trigger
CSTATUSPO=1800, CSTATUSLOGISTIC=1800,
CCOLLABSTARTTIME=1579517828870, CCOLLABLASTACTTIME=1580130681144, CORIGREQDATE=1580165999000, CAGREEDREQDATE=1580943599000,
CCOLLABREQDATE=1580943599000, CAGREEDPROMDATE=1580943599000, CCOLLABPROMDATE=1580943599000, CTRANSITDAQTY=0, CRECQTY=6, CREMAININGRECQTY=2, CFINALDELIVERY=1, CLASTGRDATE=1580130669000, CLASTGRNUM='0000001607660673', CREQUESTEDAMOUNT=53.6,
CCOLLABMODEL=4, CCOLLABALLOWEDONDATE=1, CCOLLABALLOWEDONQTY=1, CCOLLABALLOWEDONSUPACKNUM=0, CACTIONREQUIREDTIMEOUT=0, CSERIALNUMREQUIRED=0, CMANUFPRESENT=0, CALLOWCCORTOSCOR=0, CGOODSARRIVALDATE=-1, COTDRELEVANT=0, CALLOWOTDCOLLABORATION=0,
CONTIMEFROM=-1, CONTIMETO=-1, CDISCOUNT=-1, CINVPARTICIPATION='E', CREASONFORLASTCHANGETOOPEN='Customer Accept'
where CREFHEADERID=546520;
Get Order Ids whether the tAirChangeLog contains lesser than 40 entries:
select * from (
select cObjectReference, count(*) as ccount from (SELECT * FROM SEESCMDB0.tAirChangelog
WHERE
COBJECTREFERENCE IN (
SELECT cREFHEADERID FROM SEESCMDB0.TAIRPOLINEITEM where CREQTOTALQTY < 0 and CREFHEADERID > 15977737
)
ORDER BY cActiontime ASC
)
group by cObjectReference
)
where ccount < 40 order by ccount asc;