IDEMPIERE-3896 Process that fixes M_StorageReservation when wrong reservations are found

This commit is contained in:
Diego Ruiz 2019-02-16 19:53:40 +01:00
parent 5d55c6e6ef
commit 907eed3f93
3 changed files with 1051 additions and 0 deletions

View File

@ -0,0 +1,474 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Feb 11, 2019 4:36:05 PM CET
-- IDEMPIERE-3896 Process that fixes M_StorageReservation when wrong reservations are found
INSERT INTO AD_Process (CopyFromProcess,AD_Process_ID,Help,IsDirectPrint,IsReport,AD_Process_UU,AccessLevel,IsBetaFunctionality,IsServerProcess,Statistic_Seconds,Statistic_Count,ShowHelp,Updated,IsActive,UpdatedBy,Name,Created,CreatedBy,Classname,AD_Client_ID,EntityType,Value,AD_Org_ID,AllowMultipleExecution) VALUES ('N',200107,'The process checks if there are errors in storage reservartion (storageqtyReserved <> orderqtyreserved), if there are, it recreates all the reservation records for the offending products.','N','N','c4409eac-e5a8-4eac-b34a-1ac73319aa03','3','N','N',0,0,'Y',TO_DATE('2019-02-11 16:36:04','YYYY-MM-DD HH24:MI:SS'),'Y',100,'Recreate Storage Reservation',TO_DATE('2019-02-11 16:36:04','YYYY-MM-DD HH24:MI:SS'),100,'org.adempiere.process.RecreateStorageReservation',0,'D','RecreateStorageReservation',0,'N')
;
-- Feb 11, 2019 4:37:49 PM CET
INSERT INTO AD_Menu (AD_Menu_ID,IsSummary,AD_Menu_UU,IsSOTrx,IsReadOnly,AD_Process_ID,IsCentrallyMaintained,Name,Action,IsActive,CreatedBy,AD_Client_ID,Created,Updated,UpdatedBy,EntityType,AD_Org_ID) VALUES (200166,'N','cac979ac-f9b3-4756-a367-1f2f5941ad41','N','N',200107,'Y','Recreate Storage Reservation','P','Y',100,0,TO_DATE('2019-02-11 16:37:48','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2019-02-11 16:37:48','YYYY-MM-DD HH24:MI:SS'),100,'D',0)
;
-- Feb 11, 2019 4:37:49 PM CET
INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_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='TL' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200166)
;
-- Feb 11, 2019 4:37:49 PM CET
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
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=218
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=153
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=263
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=3, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=166
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=4, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=203
;
-- 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
;

View File

@ -0,0 +1,471 @@
-- Feb 11, 2019 4:36:05 PM CET
-- IDEMPIERE-3896 Process that fixes M_StorageReservation when wrong reservations are found
INSERT INTO AD_Process (CopyFromProcess,AD_Process_ID,Help,IsDirectPrint,IsReport,AD_Process_UU,AccessLevel,IsBetaFunctionality,IsServerProcess,Statistic_Seconds,Statistic_Count,ShowHelp,Updated,IsActive,UpdatedBy,Name,Created,CreatedBy,Classname,AD_Client_ID,EntityType,Value,AD_Org_ID,AllowMultipleExecution) VALUES ('N',200107,'The process checks if there are errors in storage reservartion (storageqtyReserved <> orderqtyreserved), if there are, it recreates all the reservation records for the offending products.','N','N','c4409eac-e5a8-4eac-b34a-1ac73319aa03','3','N','N',0,0,'Y',TO_TIMESTAMP('2019-02-11 16:36:04','YYYY-MM-DD HH24:MI:SS'),'Y',100,'Recreate Storage Reservation',TO_TIMESTAMP('2019-02-11 16:36:04','YYYY-MM-DD HH24:MI:SS'),100,'org.adempiere.process.RecreateStorageReservation',0,'D','RecreateStorageReservation',0,'N')
;
-- Feb 11, 2019 4:37:49 PM CET
INSERT INTO AD_Menu (AD_Menu_ID,IsSummary,AD_Menu_UU,IsSOTrx,IsReadOnly,AD_Process_ID,IsCentrallyMaintained,Name,"action",IsActive,CreatedBy,AD_Client_ID,Created,Updated,UpdatedBy,EntityType,AD_Org_ID) VALUES (200166,'N','cac979ac-f9b3-4756-a367-1f2f5941ad41','N','N',200107,'Y','Recreate Storage Reservation','P','Y',100,0,TO_TIMESTAMP('2019-02-11 16:37:48','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2019-02-11 16:37:48','YYYY-MM-DD HH24:MI:SS'),100,'D',0)
;
-- Feb 11, 2019 4:37:49 PM CET
INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_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='TL' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200166)
;
-- Feb 11, 2019 4:37:49 PM CET
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
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=0, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=218
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=1, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=153
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=2, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=263
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=3, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=166
;
-- Feb 11, 2019 4:38:11 PM CET
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=4, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=203
;
-- 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
;

View File

@ -0,0 +1,106 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* 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 *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* 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., *
* 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;
import org.compiere.process.SvrProcess;
import org.compiere.util.DB;
import org.compiere.util.Env;
public class RecreateStorageReservation extends SvrProcess {
private int m_AD_Client_ID = 0;
@Override
protected void prepare() {
m_AD_Client_ID = Env.getAD_Client_ID(getCtx());
}
@Override
protected String doIt() throws Exception {
StringBuilder sql = new StringBuilder();
sql.append("SELECT count(*) FROM ");
sql.append(" (");
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,");
sql.append(" o.issotrx, w.ad_client_id,w.ad_org_id");
sql.append(" FROM c_orderline ol ");
sql.append(" 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(" WHERE ol.m_product_id > 0 AND ol.qtyreserved!=0 AND o.docstatus NOT IN ('VO','RE') ");
sql.append(" GROUP BY 2,3,4,5,6,7 ");
sql.append(" ) AS y ");
sql.append(" FULL OUTER JOIN ");
sql.append(" ( ");
sql.append(" SELECT qty AS storageqtyReserved,");
sql.append(" m_warehouse_id, m_product_id, m_attributesetinstance_id,issotrx,ad_client_id");
sql.append(" FROM m_storagereservation");
sql.append(" WHERE qty!=0");
sql.append(" ) AS x");
sql.append(" ON y.m_warehouse_id = x.m_warehouse_id");
sql.append(" AND x.m_product_id = y.m_product_id");
sql.append(" AND x.m_attributesetinstance_id = y.m_attributesetinstance_id");
sql.append(" AND x.issotrx = y.issotrx");
sql.append(" WHERE COALESCE(x.storageqtyreserved, 0) <> COALESCE(y.orderqtyreserved, 0)");
sql.append(" AND (x.ad_client_id = ? OR y.ad_client_id = ?)");
int wrongReservations = DB.getSQLValue(get_TrxName(), sql.toString(), m_AD_Client_ID, m_AD_Client_ID);
int noInserted = 0;
if (wrongReservations > 0) {
log.warning(wrongReservations + " wrong reservation records found");
final String deleteSql = "DELETE FROM M_StorageReservation WHERE AD_Client_ID=?";
int no = DB.executeUpdateEx(deleteSql, new Object[]{m_AD_Client_ID}, get_TrxName());
log.warning(no + " reservation records deleted");
sql = new StringBuilder();
sql.append("INSERT INTO M_StorageReservation ");
sql.append(" (qty, m_warehouse_id,");
sql.append(" m_product_id,m_attributesetinstance_id,");
sql.append(" issotrx, ad_client_id, ad_org_id,");
sql.append(" created, createdby,");
sql.append(" updated, updatedby,");
sql.append(" isactive)");
sql.append(" SELECT SUM(ol.qtyreserved) AS orderqtyreserved,");
sql.append(" ol.m_warehouse_id, ");
sql.append(" ol.m_product_id,");
sql.append(" COALESCE(m_attributesetinstance_id,0),");
sql.append(" o.issotrx, w.ad_client_id, w.ad_org_id,");
sql.append(" SYSDATE,");
sql.append(Env.getAD_User_ID(getCtx()));
sql.append(" ,SYSDATE,");
sql.append(Env.getAD_User_ID(getCtx()));
sql.append(" ,'Y' ");
sql.append(" FROM c_orderline ol");
sql.append(" 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(" WHERE ol.m_product_id > 0");
sql.append(" AND ol.qtyreserved != 0");
sql.append(" AND o.docstatus NOT IN ('VO', 'RE')");
sql.append(" AND o.ad_client_id = ?");
sql.append(" GROUP BY 2, 3, 4, 5, 6,7,8,9,10,11,12");
noInserted = DB.executeUpdateEx(sql.toString(), new Object[]{m_AD_Client_ID}, get_TrxName());
log.warning(noInserted + " reservation records inserted");
}
return noInserted + " @Inserted@";
}
}