IDEMPIERE-3896 Process that fixes M_StorageReservation when wrong reservations are found / peer review - fix for oracle

This commit is contained in:
Carlos Ruiz 2019-02-17 11:32:23 +01:00
parent 907eed3f93
commit 9aeb90550f
3 changed files with 109 additions and 944 deletions

View File

@ -18,456 +18,24 @@ INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Upda
INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNodeMM_UU) SELECT t.AD_Client_ID, 0, 'Y', SysDate, 100, SysDate, 100,t.AD_Tree_ID, 200166, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='MM' AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200166) INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNodeMM_UU) SELECT t.AD_Client_ID, 0, 'Y', SysDate, 100, SysDate, 100,t.AD_Tree_ID, 200166, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='MM' AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200166)
; ;
-- Feb 11, 2019 4:38:11 PM CET -- Feb 17, 2019, 11:22:47 AM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=218 UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=20, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200166
; ;
-- Feb 11, 2019 4:38:11 PM CET -- Feb 17, 2019, 11:22:47 AM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=153 UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=21, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=311
; ;
-- Feb 11, 2019 4:38:11 PM CET -- Feb 17, 2019, 11:22:47 AM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=263 UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=22, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=292
; ;
-- Feb 11, 2019 4:38:11 PM CET -- Feb 17, 2019, 11:22:47 AM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=3, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=166 UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=23, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=504
; ;
-- Feb 11, 2019 4:38:11 PM CET -- Feb 17, 2019, 11:22:47 AM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=4, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=203 UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=24, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=515
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=5, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=236
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=6, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=183
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=7, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=160
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=8, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=278
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=9, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000087
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=10, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=345
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=11, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53296
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=12, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53014
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=13, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53108
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=14, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000361
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=15, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000050
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=16, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000343
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=17, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000460
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=18, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000385
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=19, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000386
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=20, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000244
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=21, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000232
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=22, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000256
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=23, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000284
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=24, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000329
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=25, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000313
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=26, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000225
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=27, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000394
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=28, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000155
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=29, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000144
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=30, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000167
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=31, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000081
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=32, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000171
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=33, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000170
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=34, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000156
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=35, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000049
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=36, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000175
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=37, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000279
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=38, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000295
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=39, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000183
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=40, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000377
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=41, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000381
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=42, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000092
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=43, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000250
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=44, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000181
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=45, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000182
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=46, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000052
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=47, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000231
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=48, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000152
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=49, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000389
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=50, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000230
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=51, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000240
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=52, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000403
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=53, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000406
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=54, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000407
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=55, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000402
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=56, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000411
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=57, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000442
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=58, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000443
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=59, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000452
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=60, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000428
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=61, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000431
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=62, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000424
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=63, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000433
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=64, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000434
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=65, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000413
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=66, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000429
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=67, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000414
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=68, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000464
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=69, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000445
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=70, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000465
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=71, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000454
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=72, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000463
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=73, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000447
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=74, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000455
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=75, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000449
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=76, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000459
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=77, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000448
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200166
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=167
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=357
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=3, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=229
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=4, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=412
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=5, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=256
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=6, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=197
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=7, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=477
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=8, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=181
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=9, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=484
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=10, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=179
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=11, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=503
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=12, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200064
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=13, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=196
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=14, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=479
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=15, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=482
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=16, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=481
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=17, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=411
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=18, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000305
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=19, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53253
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=20, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=426
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=21, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=537
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=22, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=311
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=23, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=292
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=24, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=504
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=25, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=515
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=26, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000252
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=27, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000373
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=28, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000372
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=29, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000370
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=30, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000151
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=31, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000241
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=32, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000323
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=33, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000278
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=34, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000312
; ;
SELECT register_migration_script('201902121250_IDEMPIERE-3896.sql') FROM dual SELECT register_migration_script('201902121250_IDEMPIERE-3896.sql') FROM dual

View File

@ -15,456 +15,24 @@ INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Upda
INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNodeMM_UU) SELECT t.AD_Client_ID, 0, 'Y', statement_timestamp(), 100, statement_timestamp(), 100,t.AD_Tree_ID, 200166, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='MM' AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200166) INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNodeMM_UU) SELECT t.AD_Client_ID, 0, 'Y', statement_timestamp(), 100, statement_timestamp(), 100,t.AD_Tree_ID, 200166, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='MM' AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200166)
; ;
-- Feb 11, 2019 4:38:11 PM CET -- Feb 17, 2019, 11:22:47 AM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=0, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=218 UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=20, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200166
; ;
-- Feb 11, 2019 4:38:11 PM CET -- Feb 17, 2019, 11:22:47 AM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=1, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=153 UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=21, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=311
; ;
-- Feb 11, 2019 4:38:11 PM CET -- Feb 17, 2019, 11:22:47 AM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=2, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=263 UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=22, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=292
; ;
-- Feb 11, 2019 4:38:11 PM CET -- Feb 17, 2019, 11:22:47 AM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=3, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=166 UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=23, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=504
; ;
-- Feb 11, 2019 4:38:11 PM CET -- Feb 17, 2019, 11:22:47 AM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=4, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=203 UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=24, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=515
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=5, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=236
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=6, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=183
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=7, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=160
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=8, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=278
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=9, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000087
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=10, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=345
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=11, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53296
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=12, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53014
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=13, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53108
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=14, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000361
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=15, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000050
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=16, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000343
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=17, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000460
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=18, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000385
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=19, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000386
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=20, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000244
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=21, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000232
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=22, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000256
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=23, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000284
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=24, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000329
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=25, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000313
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=26, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000225
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=27, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000394
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=28, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000155
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=29, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000144
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=30, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000167
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=31, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000081
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=32, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000171
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=33, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000170
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=34, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000156
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=35, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000049
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=36, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000175
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=37, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000279
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=38, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000295
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=39, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000183
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=40, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000377
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=41, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000381
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=42, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000092
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=43, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000250
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=44, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000181
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=45, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000182
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=46, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000052
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=47, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000231
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=48, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000152
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=49, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000389
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=50, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000230
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=51, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000240
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=52, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000403
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=53, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000406
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=54, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000407
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=55, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000402
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=56, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000411
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=57, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000442
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=58, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000443
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=59, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000452
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=60, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000428
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=61, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000431
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=62, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000424
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=63, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000433
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=64, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000434
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=65, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000413
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=66, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000429
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=67, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000414
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=68, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000464
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=69, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000445
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=70, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000465
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=71, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000454
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=72, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000463
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=73, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000447
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=74, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000455
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=75, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000449
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=76, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000459
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=77, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000448
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=0, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200166
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=1, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=167
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=2, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=357
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=3, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=229
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=4, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=412
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=5, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=256
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=6, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=197
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=7, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=477
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=8, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=181
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=9, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=484
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=10, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=179
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=11, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=503
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=12, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200064
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=13, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=196
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=14, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=479
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=15, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=482
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=16, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=481
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=17, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=411
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=18, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000305
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=19, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53253
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=20, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=426
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=21, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=537
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=22, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=311
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=23, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=292
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=24, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=504
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=25, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=515
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=26, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000252
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=27, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000373
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=28, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000372
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=29, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000370
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=30, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000151
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=31, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000241
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=32, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000323
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=33, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000278
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=183, SeqNo=34, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000312
; ;
SELECT register_migration_script('201902121250_IDEMPIERE-3896.sql') FROM dual SELECT register_migration_script('201902121250_IDEMPIERE-3896.sql') FROM dual

View File

@ -1,6 +1,6 @@
/****************************************************************************** /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution * * Project: Trek Global ERP *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 2009-2018 Trek Global Corporation *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope * * by the Free Software Foundation. This program is distributed in the hope *
@ -10,9 +10,6 @@
* You should have received a copy of the GNU General Public License along * * You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., * * with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/ *****************************************************************************/
package org.adempiere.process; package org.adempiere.process;
@ -32,33 +29,50 @@ public class RecreateStorageReservation extends SvrProcess {
@Override @Override
protected String doIt() throws Exception { protected String doIt() throws Exception {
StringBuilder sql = new StringBuilder(); final String sql = ""
sql.append("SELECT count(*) FROM "); + "SELECT COUNT(*) "
sql.append(" ("); + "FROM "
sql.append(" SELECT SUM(ol.qtyreserved) AS orderqtyreserved, ol.m_warehouse_id,"); + "( "
sql.append(" ol.m_product_id, coalesce(m_attributesetinstance_id,0) AS m_attributesetinstance_id,"); + "SELECT SUM(ol.QtyReserved) AS OrderQtyReserved, "
sql.append(" o.issotrx, w.ad_client_id,w.ad_org_id"); + " ol.M_Warehouse_ID, "
sql.append(" FROM c_orderline ol "); + " ol.M_Product_ID, "
sql.append(" JOIN c_order o ON ( ol.c_order_id = o.c_order_id ) "); + " COALESCE(M_AttributeSetInstance_ID, 0) AS M_AttributeSetInstance_ID, "
sql.append(" JOIN m_warehouse w ON (w.m_warehouse_id = o.m_warehouse_id)"); + " o.IsSOTrx, "
sql.append(" WHERE ol.m_product_id > 0 AND ol.qtyreserved!=0 AND o.docstatus NOT IN ('VO','RE') "); + " w.AD_Client_ID, "
sql.append(" GROUP BY 2,3,4,5,6,7 "); + " w.AD_Org_ID "
sql.append(" ) AS y "); + "FROM C_OrderLine ol "
sql.append(" FULL OUTER JOIN "); + " JOIN C_Order o ON ( ol.C_Order_ID = o.C_Order_ID ) "
sql.append(" ( "); + " JOIN M_Warehouse w ON ( w.M_Warehouse_ID = o.M_Warehouse_ID ) "
sql.append(" SELECT qty AS storageqtyReserved,"); + "WHERE ol.m_product_ID > 0 "
sql.append(" m_warehouse_id, m_product_id, m_attributesetinstance_id,issotrx,ad_client_id"); + " AND ol.ad_client_ID = ? "
sql.append(" FROM m_storagereservation"); + " AND ol.qtyreserved != 0 "
sql.append(" WHERE qty!=0"); + " AND o.docstatus NOT IN ( 'VO', 'RE' ) "
sql.append(" ) AS x"); + "GROUP BY ol.M_Warehouse_ID, "
sql.append(" ON y.m_warehouse_id = x.m_warehouse_id"); + " ol.M_Product_ID, "
sql.append(" AND x.m_product_id = y.m_product_id"); + " COALESCE(M_AttributeSetInstance_ID, 0), "
sql.append(" AND x.m_attributesetinstance_id = y.m_attributesetinstance_id"); + " o.IsSOTrx, "
sql.append(" AND x.issotrx = y.issotrx"); + " w.AD_Client_ID, "
sql.append(" WHERE COALESCE(x.storageqtyreserved, 0) <> COALESCE(y.orderqtyreserved, 0)"); + " w.AD_Org_ID "
sql.append(" AND (x.ad_client_id = ? OR y.ad_client_id = ?)"); + ") y "
+ "FULL OUTER JOIN "
+ "( "
+ "SELECT Qty AS StorageQtyreserved, "
+ " M_Warehouse_ID, "
+ " M_Product_ID, "
+ " M_AttributeSetInstance_ID, "
+ " IsSOTrx, "
+ " AD_Client_ID "
+ "FROM M_StorageReservation "
+ "WHERE AD_Client_ID = ? "
+ " AND Qty != 0 "
+ ") x "
+ " ON y.M_Warehouse_ID = x.M_Warehouse_ID "
+ " AND x.M_Product_ID = y.M_Product_ID "
+ " AND x.M_AttributeSetInstance_ID = y.M_AttributeSetInstance_ID "
+ " AND x.IsSOTrx = y.IsSOTrx "
+ "WHERE COALESCE(x.StorageQtyReserved, 0) <> COALESCE(y.OrderQtyReserved, 0)";
int wrongReservations = DB.getSQLValue(get_TrxName(), sql.toString(), m_AD_Client_ID, m_AD_Client_ID); int wrongReservations = DB.getSQLValueEx(get_TrxName(), sql, m_AD_Client_ID, m_AD_Client_ID);
int noInserted = 0; int noInserted = 0;
if (wrongReservations > 0) { if (wrongReservations > 0) {
@ -69,34 +83,49 @@ public class RecreateStorageReservation extends SvrProcess {
int no = DB.executeUpdateEx(deleteSql, new Object[]{m_AD_Client_ID}, get_TrxName()); int no = DB.executeUpdateEx(deleteSql, new Object[]{m_AD_Client_ID}, get_TrxName());
log.warning(no + " reservation records deleted"); log.warning(no + " reservation records deleted");
sql = new StringBuilder(); final String ins = ""
sql.append("INSERT INTO M_StorageReservation "); + "INSERT INTO M_StorageReservation "
sql.append(" (qty, m_warehouse_id,"); + " (Qty, "
sql.append(" m_product_id,m_attributesetinstance_id,"); + " M_Warehouse_ID, "
sql.append(" issotrx, ad_client_id, ad_org_id,"); + " M_Product_ID, "
sql.append(" created, createdby,"); + " M_AttributeSetInstance_ID, "
sql.append(" updated, updatedby,"); + " IsSOTrx, "
sql.append(" isactive)"); + " AD_Client_ID, "
sql.append(" SELECT SUM(ol.qtyreserved) AS orderqtyreserved,"); + " AD_Org_ID, "
sql.append(" ol.m_warehouse_id, "); + " Created, "
sql.append(" ol.m_product_id,"); + " CreatedBy, "
sql.append(" COALESCE(m_attributesetinstance_id,0),"); + " Updated, "
sql.append(" o.issotrx, w.ad_client_id, w.ad_org_id,"); + " UpdatedBy, "
sql.append(" SYSDATE,"); + " IsActive, "
sql.append(Env.getAD_User_ID(getCtx())); + " M_StorageReservation_UU) "
sql.append(" ,SYSDATE,"); + "SELECT SUM(ol.QtyReserved) AS OrderQtyReserved, "
sql.append(Env.getAD_User_ID(getCtx())); + " ol.M_Warehouse_ID, "
sql.append(" ,'Y' "); + " ol.M_Product_ID, "
sql.append(" FROM c_orderline ol"); + " COALESCE(M_AttributeSetInstance_ID, 0), "
sql.append(" JOIN c_order o ON ( ol.c_order_id = o.c_order_id )"); + " o.IsSOTrx, "
sql.append(" JOIN m_warehouse w ON (w.m_warehouse_id = o.m_warehouse_id)"); + " w.AD_Client_ID, "
sql.append(" WHERE ol.m_product_id > 0"); + " w.AD_Org_ID, "
sql.append(" AND ol.qtyreserved != 0"); + " SysDate, "
sql.append(" AND o.docstatus NOT IN ('VO', 'RE')"); + " ?, "
sql.append(" AND o.ad_client_id = ?"); + " SysDate, "
sql.append(" GROUP BY 2, 3, 4, 5, 6,7,8,9,10,11,12"); + " ?, "
+ " 'Y', "
+ " generate_uuid() "
+ "FROM C_OrderLine ol "
+ " JOIN C_Order o ON ( ol.C_Order_ID = o.C_Order_ID ) "
+ " JOIN M_Warehouse w ON ( w.M_Warehouse_ID = o.M_Warehouse_ID ) "
+ "WHERE ol.M_Product_ID > 0 "
+ " AND ol.QtyReserved != 0 "
+ " AND o.DocStatus NOT IN ( 'VO', 'RE' ) "
+ " AND o.AD_Client_ID = ? "
+ "GROUP BY ol.M_Warehouse_ID, "
+ " ol.M_Product_ID, "
+ " COALESCE(M_AttributeSetInstance_ID, 0), "
+ " o.IsSOTrx, "
+ " w.AD_Client_ID, "
+ " w.AD_Org_ID";
noInserted = DB.executeUpdateEx(sql.toString(), new Object[]{m_AD_Client_ID}, get_TrxName()); noInserted = DB.executeUpdateEx(ins, new Object[]{Env.getAD_User_ID(getCtx()), Env.getAD_User_ID(getCtx()), m_AD_Client_ID}, get_TrxName());
log.warning(noInserted + " reservation records inserted"); log.warning(noInserted + " reservation records inserted");
} }