Compare commits
866 Commits
cc189f4761
...
feature-re
| Author | SHA1 | Date | |
|---|---|---|---|
| 9678de10f1 | |||
| c6c1f7b604 | |||
| b9e863a563 | |||
| 60e4429c3f | |||
| 2c494dbbe1 | |||
| 37772627ff | |||
| f5effa4570 | |||
| 690c70c275 | |||
| 6a237ce4d9 | |||
| a64932d918 | |||
| 36e646b7f2 | |||
| c409e49c9a | |||
| a15d009f76 | |||
| a62f37d930 | |||
| aae80b698e | |||
| fd20914e8c | |||
| a4a2b34379 | |||
| f2d67ea89d | |||
| 0e980d61f5 | |||
| a16db8d857 | |||
| 3eaa1218c5 | |||
| fda162d867 | |||
| 164fbf546c | |||
| 2008ef0e8f | |||
| e959157a16 | |||
| 6d8e0e747f | |||
| 26b1c60516 | |||
| 87a0a8834c | |||
| 5417e28630 | |||
| 4ac4686645 | |||
| 1594154639 | |||
| 3a4a954b91 | |||
| 744f92c881 | |||
| 6e5f099fc2 | |||
| 697cd58e39 | |||
| 4bf1f6021f | |||
| 4f51c076e6 | |||
| 118d2d83d5 | |||
| 149bdc36b3 | |||
| 89c69bc0d2 | |||
| 240f18d19d | |||
| 9a8a144705 | |||
| 2f412f1ad6 | |||
| 8e8b03889a | |||
| dd4ace59bd | |||
| 52c0e0ca61 | |||
| e2f2b9bde9 | |||
| 4ea9be84db | |||
| 11e4b1cf20 | |||
| a66cfa16d8 | |||
| 9f628973e9 | |||
| 9fa7f9628c | |||
| 1a5156d53c | |||
| ba667fd28e | |||
| cddc7f8979 | |||
| 60c436256e | |||
| 46449c47b9 | |||
| f8b6d3ebe0 | |||
| b3d29219ee | |||
| 2c81a6566b | |||
| f697a122b6 | |||
| 3f4ed16f20 | |||
| cbbfbb16b8 | |||
| 585a04ffba | |||
| b025be1bd9 | |||
| 5453826156 | |||
| 8312d48970 | |||
| b50c348528 | |||
| 64aeff7bf6 | |||
| 2a8cf16ce0 | |||
| 7d6341ec83 | |||
| df9096f3fa | |||
| 3539e82849 | |||
| f4faa20652 | |||
| e7f5959e27 | |||
| e5d4e47c67 | |||
| 1d897f1461 | |||
| f3e48b9a3e | |||
| f0e41c6554 | |||
| 3d76dec03a | |||
| 754b58fd37 | |||
| 0627fd59c9 | |||
| 5dffe40903 | |||
| 5dfba4cfc8 | |||
| 64ea41d0da | |||
| 31480b8fbe | |||
| c1efdf48a6 | |||
| e1de9f4db9 | |||
| ce2ec669ba | |||
| 13b4fbf245 | |||
| c9658954aa | |||
| 5011aa271d | |||
| af4a5511a3 | |||
| fa996c210c | |||
| c5b5fb62a1 | |||
| 856128cba8 | |||
| 3b007c061e | |||
| 8ee9e2fe57 | |||
| 4ddcc6228e | |||
| 7cf9df3549 | |||
| 8e8d6cf2c3 | |||
| 2a5314fd1e | |||
| 9363e674b5 | |||
| e7252f7fea | |||
| b5e1d2e1ce | |||
| 53ef2539f5 | |||
| 6136d9b848 | |||
| fe2be9b926 | |||
| 1b113999b2 | |||
| 4ebcae77ca | |||
| 44bb64afd0 | |||
| 8d35f9284a | |||
| b953349afc | |||
| 6c2eaaa37a | |||
| 9b8824e681 | |||
| fb03aa1ea7 | |||
| c16e23d3bf | |||
| 6bbd930d5a | |||
| 27055f8e5e | |||
| b8ac769ffd | |||
| 0216bc5d53 | |||
| db3973637d | |||
| 7dab29e8c2 | |||
| 01c1551b73 | |||
| 809ffe73b9 | |||
| 4d13d17095 | |||
| f749356735 | |||
| de47fe4ee5 | |||
| b33090641b | |||
| b2d24ab6b4 | |||
| 6bb7b55618 | |||
| 00efbe6fcf | |||
| cacb24a563 | |||
| 5da098e058 | |||
| 3e0c443ce3 | |||
| b4442bc251 | |||
| eec353c6a5 | |||
| 8b50f54881 | |||
| 42f50e0d80 | |||
| cbeae87d23 | |||
| 71cb1db5ef | |||
| bb642d92db | |||
| ddd3b95d17 | |||
| ff5428f8bd | |||
| d3b39ad878 | |||
| 99a366d875 | |||
| abc4f1c966 | |||
| 3215b7e09a | |||
| fc1c2f192e | |||
| ac4afa9a2b | |||
| c5a315e070 | |||
| 1d0fd3341d | |||
| b44685335a | |||
| 38897d7693 | |||
| e5689da13d | |||
| f57710cb32 | |||
| ceb5dc817c | |||
| 3a934813d8 | |||
| d56fe38e2c | |||
| 5555a40731 | |||
| acf5daf673 | |||
| 939c4ab236 | |||
| 49237b9585 | |||
| abbf298b4f | |||
| 34985c9fd3 | |||
| 401f0330de | |||
| 7815fb72f1 | |||
| 0e8cc5b2de | |||
| 9a18dd6ebd | |||
| 3f0b9315a2 | |||
| 32a15a4f3e | |||
| 932f99c147 | |||
| 1fc7d01b9c | |||
| 46e47a9549 | |||
| ba1bbbafe0 | |||
| fa54de3d76 | |||
| febb3bf10b | |||
| 1550de37e6 | |||
| 450f9f4dd4 | |||
| f1da5057d6 | |||
| a3d15aeb32 | |||
| c933c02727 | |||
| 28b94b228a | |||
| c291db3e34 | |||
| 3f9a451a70 | |||
| 9f39c5bc2d | |||
| b187b085cd | |||
| 6a455db664 | |||
| c33c1da199 | |||
| d0769ea1bd | |||
| f3f768380a | |||
| cb2cf06200 | |||
| a81fc6813c | |||
| 5c03b928b6 | |||
| 16b478a511 | |||
| c2ef09a604 | |||
| f2de64de75 | |||
| b877347a77 | |||
| 2d43952d96 | |||
| ee171374c8 | |||
| f0d1cdc81a | |||
| 1758dcabbb | |||
| 8231716e97 | |||
| 2603cda317 | |||
| 532a9cc3f4 | |||
| 15a63cff14 | |||
| b53d76358b | |||
| f9ded1153a | |||
| 81ddb42e5c | |||
| 5ac4d4be63 | |||
| 0b432960ec | |||
| 159436247d | |||
| 2a2435f64d | |||
| fba5e331b5 | |||
| 40199884f2 | |||
| 84d78a8f93 | |||
| de21ce7cb8 | |||
| 33f24290a9 | |||
| dc83e89392 | |||
| d525048bb3 | |||
| f5d46be57d | |||
| ca4c3c3412 | |||
| e5c16c6e4e | |||
| c515b2da04 | |||
| 42bef35d5f | |||
| 44e3de6a0f | |||
| 9942f92440 | |||
| e34bb01aea | |||
| dfb26ef92f | |||
| 6f11e08807 | |||
| aa9529f551 | |||
| bcb8f4475d | |||
| 8a83213384 | |||
| 2433c98ab1 | |||
| 595fe77472 | |||
| 29f9335876 | |||
| 9f065b17c0 | |||
| e975964f53 | |||
| 9d82cbc610 | |||
| 0a12dc23f2 | |||
| ac5a0d0356 | |||
| 1719f2ba37 | |||
| ddd9c73f49 | |||
| 1b0f5d5d29 | |||
| 6991e60ec5 | |||
| 68eadae6fa | |||
| 8a87d428ae | |||
| cbb50132da | |||
| b9b4ce9a85 | |||
| 0058373710 | |||
| d9f93b14e1 | |||
| dea6b14323 | |||
| d01b4aef8f | |||
| b2c3008464 | |||
| d02f44237e | |||
| eb0f2e3bcb | |||
| 5fc6be6acf | |||
| 675e919652 | |||
| 034f3bd0a9 | |||
| 4bb7182871 | |||
| e388497c52 | |||
| d0e7993fa1 | |||
| 9d9d4e3d87 | |||
| 19e17f76d4 | |||
| df18330a01 | |||
| da61cb5439 | |||
| 89e4067877 | |||
| 975e4f2be4 | |||
| e31b0bc1a0 | |||
| 84ccdafd90 | |||
| 97de2f0e71 | |||
| e6d0f236c3 | |||
| 1ee321b253 | |||
| 7912d29f00 | |||
| ecd8bca2aa | |||
| 1a64179099 | |||
| 54588d20bd | |||
| 84f3823597 | |||
| 0022e620da | |||
| b7ac9ce072 | |||
| 62a1f5a85f | |||
| 164b2e60f3 | |||
| cd389dc83f | |||
| 974b5f61af | |||
| a10876effc | |||
| 4385520480 | |||
| a1b892a75e | |||
| 92dcc45638 | |||
| a178ec5017 | |||
| 1456e094a2 | |||
| b88f0a3c7d | |||
| 562116cb54 | |||
| 76d07ec9b0 | |||
| 58b89777bb | |||
| 454eb8c3c0 | |||
| f4da09eacc | |||
| b10bc86db0 | |||
| 6f47434d6f | |||
| 3a95372f18 | |||
| 030d635dcd | |||
| 8ca15e4378 | |||
| 773611c978 | |||
| 8fb8e4c05a | |||
| d18ac96cc4 | |||
| 9b26849cb6 | |||
| fcbee627b0 | |||
| c9104967cd | |||
| 6b0a1afc0b | |||
| 92e9f6fde7 | |||
| b17d807ca3 | |||
| 5b017fdad1 | |||
| 4957cba34b | |||
| 61d0a62004 | |||
| a99ccc5170 | |||
| 85e59e577f | |||
| 5c60cd2558 | |||
| 5a824d0b3a | |||
| f60c3337b1 | |||
| 3218cca2cc | |||
| 5870865ce7 | |||
| 6a190cde08 | |||
| 9a2a77cc77 | |||
| 70f11c559f | |||
| 4ee64127b1 | |||
| b587e38cc8 | |||
| be4c2d149e | |||
| ccb8b81597 | |||
| 68a45a9eea | |||
| d419c38220 | |||
| 8fe752e595 | |||
| 71ffc5b4cf | |||
| f00f0cf975 | |||
| 19e8949d86 | |||
| a2edd0f29c | |||
| dd62a4f5e0 | |||
| a2cdc5c52c | |||
| bee29e357e | |||
| 461b949581 | |||
| c6e2230052 | |||
| f9794850c4 | |||
| ee18ecb15e | |||
| 2aa6384f69 | |||
| e4de8e4287 | |||
| 96993755da | |||
| 0646fd6943 | |||
| 30db0f9182 | |||
| 8064e87017 | |||
| ef399668c4 | |||
| 35621cadf2 | |||
| 04f1a9e2e6 | |||
| ee4bf3d501 | |||
| 3bff9a6fdc | |||
| 7f878b9a2e | |||
| e2b56e37d4 | |||
| 7956a895d2 | |||
| c0d181fbfa | |||
| 6766e8e964 | |||
| f20ed5b92a | |||
| a4a837edfb | |||
| c5851f4e80 | |||
| 09db33b259 | |||
| dbba57fccc | |||
| 023aac21c9 | |||
| 449f38417e | |||
| 17ffdd8957 | |||
| d294100b28 | |||
| fbe8891f86 | |||
| f740fff33d | |||
| 0c3786c266 | |||
| 6269849a50 | |||
| 81108c58ef | |||
| 8c19cfb9fb | |||
| 5c40eea23c | |||
| 04dbf6dd93 | |||
| 530defaea5 | |||
| 12196815ea | |||
| 199fdfb3b0 | |||
| d3d113b884 | |||
| 7e8659b007 | |||
| 63838e9189 | |||
| bdc0e677fd | |||
| 86734061c6 | |||
| aeef7d2ec2 | |||
| a3927d6f0f | |||
| 44c2c0886b | |||
| 8c0ed8c4f6 | |||
| 2634f6d520 | |||
| 6436a6825f | |||
| fa89398e40 | |||
| b5cbbf7b0b | |||
| db17e8c473 | |||
| c8b1a0ddfd | |||
| 2ab3bb6043 | |||
| 29f6b7d2a4 | |||
| 2be30206ce | |||
| 3306423e0a | |||
| 23a70c266e | |||
| 672a055e55 | |||
| c2f427387b | |||
| 08be0a6ad2 | |||
| 7a9a72f11a | |||
| 68075b89fa | |||
| e9ec1d1a83 | |||
| 9c4f8ff47e | |||
| 09b28cccbe | |||
| 6d4a2bf31b | |||
| db78ca0cc0 | |||
| 5db8172b3c | |||
| 5a07e918a4 | |||
| 8ebac5dd33 | |||
| ff81f2129b | |||
| 04eb85b190 | |||
| db83ba4a3c | |||
| 59788d83d7 | |||
| 5fb2be5da0 | |||
| 0760905c4f | |||
| 3f27ec44f8 | |||
| 69a938d076 | |||
| e2a827f45a | |||
| f8b636f23d | |||
| 981f5e4d67 | |||
| d9bc09e6f3 | |||
| 1439050345 | |||
| 75eb189a11 | |||
| 7eded8848f | |||
| 87d377a83c | |||
| cbf7ec5cdb | |||
| ee83cd024e | |||
| 36a0a99755 | |||
| a0f72ee7b1 | |||
| c633d7c97e | |||
| 44e48527c6 | |||
| 1faf5dd713 | |||
| 59a21796b8 | |||
| 8457bfbc75 | |||
| 5541742c0d | |||
| 6630e42024 | |||
| 50c41e9de2 | |||
| 6aae376098 | |||
| 7ee6e8d64a | |||
| 3daf60767f | |||
| 5ba9035238 | |||
| a0035ad573 | |||
| 203a36cdba | |||
| c18551d630 | |||
| 939cfde0c5 | |||
| 4231f7b6ae | |||
| b7b60491d4 | |||
| 84e46ce609 | |||
| f49c622df0 | |||
| f7f8bee8d0 | |||
| 41e7c24b91 | |||
| 5a6fa368e4 | |||
| 07fdd0a5df | |||
| fd4901c294 | |||
| 6e65992b90 | |||
| 64399d4803 | |||
| c6c4f52e93 | |||
| ab70242ebf | |||
| cf078ced9c | |||
| 6290c18046 | |||
| c544679f1b | |||
| 95bc10950a | |||
| a6415486c3 | |||
| f68f76e5ea | |||
| 8e934b8a38 | |||
| 3e9793eb76 | |||
| ea6cb1e9d7 | |||
| 629cf3bf22 | |||
| 9e8b05cecf | |||
| b7c452d41f | |||
| b3e5c78afb | |||
| 7bd80d9e52 | |||
| 0019f03668 | |||
| d74661153a | |||
| a898ef24eb | |||
| a69466f5db | |||
| cdcb1eb0b6 | |||
| bd706155f6 | |||
| a01025853c | |||
| 884c051b18 | |||
| 20aea0c306 | |||
| 03e6db20b5 | |||
| e53add6f0d | |||
| 2fc60c34c3 | |||
| b2d2bd494a | |||
| 58d900cc6b | |||
| cc21e43bd4 | |||
| 5acf3023b7 | |||
| 9d9ce1f3ac | |||
| 7d6f11272f | |||
| f9ab71462f | |||
| f014e4b959 | |||
| bd2f7126a9 | |||
| 9007eda560 | |||
| 139fc94ed5 | |||
| b51fc95057 | |||
| 0782d0206c | |||
| 1eface5798 | |||
| 3bc9e6629b | |||
| f10e90bc9b | |||
| 997c667f1b | |||
| 6efa6e7293 | |||
| 32229f7157 | |||
| 7b09900a1f | |||
| 71cb4d0d88 | |||
| 0f42d5a2ba | |||
| ebf9af7b8b | |||
| 9476e99476 | |||
| a338077542 | |||
| db9a613fc9 | |||
| 0d4882b818 | |||
| cbbc0739c6 | |||
| e12f00984d | |||
| 5dc20c4e3f | |||
| 4a61a4b60c | |||
| b82a3dd227 | |||
| ca9843f71a | |||
| 41b95b9dcb | |||
| 1d16e2cc13 | |||
| 2abf8b55ac | |||
| 82972a537e | |||
| 5d77838838 | |||
| 9006da1383 | |||
| 026f89d031 | |||
| 1dd6d8b3fa | |||
| 67c1a8fba5 | |||
| c4e8985642 | |||
| d048ea1f9c | |||
| 6f2d485de7 | |||
| 9f46505136 | |||
| 4d2fbf610d | |||
| 3ec8d6d0e1 | |||
| 255de9a955 | |||
| 622c4c903c | |||
| e51fa4fa6b | |||
| febe8be89e | |||
| 3ad15c8457 | |||
| 3ae1d499c2 | |||
| b10c6e837c | |||
| 1d07f15169 | |||
| 18e69f0195 | |||
| 3f4735f953 | |||
| edcd6ecf6b | |||
| b2ac734b5e | |||
| 481e8e35cc | |||
| 725b93be81 | |||
| 7eac47b3b7 | |||
| 8abb7c2842 | |||
| 55e55bd64a | |||
| 7de563abf3 | |||
| 12154ed089 | |||
| 98e518e295 | |||
| 498ce2880e | |||
| b828e5bfae | |||
| 637fdca7ed | |||
| 8778aecbeb | |||
| 724bc750cf | |||
| 4c78c0cf37 | |||
| c8c476f98c | |||
| 0c3cf9095f | |||
| f90688e969 | |||
| c76417b917 | |||
| 332b4fddd8 | |||
| fa2bca9c99 | |||
| 565cbc9f30 | |||
| febd5d7e7f | |||
| 057d7961f2 | |||
| 8ead6d9fdb | |||
| 08215fab9d | |||
| 73aed3e9d6 | |||
| 1ae0ee3567 | |||
| 49f6664874 | |||
| 03fe0c7279 | |||
| 49b4fca63c | |||
| 36c425941a | |||
| 5fa3dc538f | |||
| 280474d038 | |||
| 518263d955 | |||
| 0f298bcd05 | |||
| c8200f3690 | |||
| 08ff9e1940 | |||
| 165e81938c | |||
| c87404a4ee | |||
| 92a9abf978 | |||
| 71e99ed943 | |||
| b1c337a238 | |||
| 21fa20e94f | |||
| bf1b78ccc0 | |||
| 5325f3124a | |||
| fce976b2df | |||
| 8caa0c924b | |||
| 4af7155db9 | |||
| ab682181ce | |||
| d6cda98855 | |||
| 38c1c80abb | |||
| fed416de15 | |||
| d5bf6aef92 | |||
| 5a0cfd160f | |||
| bea182eea9 | |||
| ce6a102f45 | |||
| 9e1a600087 | |||
| 89a6a8c2f4 | |||
| 9fca434612 | |||
| d675ce0e82 | |||
| ef2f2a91b3 | |||
| 49ff0c839b | |||
| bd5eb9c535 | |||
| 0851fe8915 | |||
| fa7e3a55ca | |||
| 52d34fa810 | |||
| 59624c8c17 | |||
| cd53eca2e8 | |||
| a486b6102b | |||
| becfdab1a1 | |||
| e6605c2feb | |||
| 305c79a558 | |||
| edcc08c9da | |||
| 89d0f95834 | |||
| 112dc51ac7 | |||
| a93979c546 | |||
| 6b536b20c6 | |||
| 17c832745f | |||
| fcb62e3689 | |||
| bc88453914 | |||
| a85173bc45 | |||
| ed0c117bac | |||
| 557159cf7f | |||
| 46dcdd7745 | |||
| c30c7ec369 | |||
| 8e99c0898d | |||
| b4ce3f8d27 | |||
| 9549583c86 | |||
| 5b88fa632c | |||
| 64425c2c4a | |||
| e6d5df31dd | |||
| f9be1f4463 | |||
| 1cfc7558ac | |||
| 140c443030 | |||
| 0bfa110d6c | |||
| 374d143090 | |||
| 32dc0b4f4c | |||
| 75edd98223 | |||
| d89ddb447c | |||
| a2b668ed96 | |||
| d7aef97ae0 | |||
| 4f6eed564e | |||
| e3cf9aa115 | |||
| 766e6a18cc | |||
| 45c507cfcc | |||
| ebaee14167 | |||
| 0a56b9dd25 | |||
| 51210cd8df | |||
| e80d8ee151 | |||
| 3b461350d5 | |||
| 5724dc53c9 | |||
| 84ff15687e | |||
| 422e09b072 | |||
| 3dd1cd60cb | |||
| 14cf0d60b5 | |||
| 7a0cbebdfb | |||
| f5e208a973 | |||
| f4189b71e0 | |||
| 0d8101ec05 | |||
| 7f42ee47ce | |||
| 0b1310646c | |||
| ebde200a73 | |||
| 502dc5e7a9 | |||
| 4fca7a604b | |||
| 2b781e795a | |||
| cbfa2482da | |||
| ef9bbe6198 | |||
| 4e78712c2f | |||
| bcb23e8a42 | |||
| 4e9d2615b1 | |||
| f8da37203c | |||
| 29e67b3680 | |||
| 9a7508d05e | |||
| 88da287d33 | |||
| b924e018ab | |||
| b9f2ed0509 | |||
| cecf45cc8f | |||
| 2f6c642ef0 | |||
| c38608d92b | |||
| 08b91b91ef | |||
| 25d266b0f8 | |||
| d9287659d2 | |||
| 9542465064 | |||
| 4901067c3f | |||
| 35727ef0af | |||
| 9aa60b6464 | |||
| c2d9ccf1b1 | |||
| 56764f5918 | |||
| c11ead2b49 | |||
| 219fd1989a | |||
| 78137519ec | |||
| 2010782da4 | |||
| a9718b5fbe | |||
| c995d2334f | |||
| c0340b9863 | |||
| e8d8f7db1a | |||
| e22c467a15 | |||
| 7ba89d3cfa | |||
| fbc13719db | |||
| 5cbc6cce2e | |||
| c3871083b1 | |||
| 33c85e3a18 | |||
| e3863f5992 | |||
| 218f6b9306 | |||
| cf215fae02 | |||
| 358064102e | |||
| 998b63301d | |||
| 3055139b83 | |||
| cf766e190e | |||
| d61cf134fb | |||
| 68238f0d6e | |||
| c3dd5fb59b | |||
| 96a4ab4b39 | |||
| e9411988d2 | |||
| db6319ad6c | |||
| 8a61bc87bc | |||
| e580a12b0e | |||
| 5576834083 | |||
| 715e1fc6c3 | |||
| 090828aa8a | |||
| 7c65f3a8f9 | |||
| 778141da66 | |||
| ceb7deb79f | |||
| 0724f6ab83 | |||
| f910e6855f | |||
| acbd3e8ac2 | |||
| 5e7209f060 | |||
| 5201b5b25d | |||
| 7126f9bf71 | |||
| 5a2ad13068 | |||
| c0dc46935b | |||
| f1c5d7cd2e | |||
| 08c675b662 | |||
| 7d9ca973f5 | |||
| 1b2a3c1203 | |||
| ef7369c2a3 | |||
| 1520d45609 | |||
| 820ae30ab4 | |||
| 60683c0383 | |||
| 90b955f6a4 | |||
| e0d63d5c44 | |||
| d54401cd9e | |||
| 6f6232be13 | |||
| 872503afb5 | |||
| edd50bed65 | |||
| aac8b151dc | |||
| 76785b22fe | |||
| bebf48f6c5 | |||
| 79d0ea1967 | |||
| 069b652035 | |||
| 6b3d579803 | |||
| 5acb744618 | |||
| 0ee6c261e5 | |||
| 0b6ad5d5dc | |||
| 19c8d1eee7 | |||
| 201996e4b5 | |||
| 2bf4edeffe | |||
| 799c3be92d | |||
| 96102328c1 | |||
| 2d458e1836 | |||
| 3f2ad37ff9 | |||
| c343ec70ad | |||
| 4bb59eee38 | |||
| 585771cb2e | |||
| 51ad617bd3 | |||
| 4c71015588 | |||
| 065fb956d3 | |||
| f096f72942 | |||
| f61f8283f0 | |||
| 0682af0dee | |||
| fb09e637ee | |||
| aa4619e323 | |||
| 5e30e340a2 | |||
| ca8fba8d6f | |||
| 7012dca4a6 | |||
| 8256c1e0ce | |||
| f92de927ff | |||
| fe5dc1f55b | |||
| 557ada2363 | |||
| 6b30fea7b8 | |||
| 71df21c003 | |||
| d73f607e21 | |||
| 960f74e7cd | |||
| e1e9a3cbfc | |||
| 48d5190586 | |||
| 36c6ec6c64 | |||
| 7f3c43f263 | |||
| 4d0dfc5341 | |||
| b08e1ef6bb | |||
| 09b8d47c76 | |||
| 43f59ccf3b | |||
| fee5320c37 | |||
| 3a55dcdb58 | |||
| f5ea90a0d0 | |||
| b833fc79e8 | |||
| f52aa4d837 | |||
| fff5faf3be | |||
| 978b42d18a | |||
| c7c8b1be24 | |||
| 6034120f1f | |||
| c2b6d4ba69 | |||
| bc97f9a573 | |||
| ce1f68deb2 | |||
| 45bf3d67d1 | |||
| bf38dfe0d8 | |||
| af68b892f3 | |||
| af29eeba58 | |||
| 5698329cc8 | |||
| d70efd3af2 | |||
| f99957eb41 | |||
| 40104bcce7 | |||
| edda81733d | |||
| ceb11d3261 | |||
| a13671c51a | |||
| b94d9b1177 | |||
| d027f3ff20 | |||
| 8601f4fd90 | |||
| 73ade8691d | |||
| df2a7d6e36 | |||
| c7c6affe3e | |||
| 54fc28eb74 | |||
| ab1200ff84 | |||
| 22f65037f4 | |||
| ec2b83657a | |||
| 2511aabbdb | |||
| 313fa6a8df | |||
| 9bb8751e21 | |||
| 24c4935dad | |||
| 61d76b03c4 | |||
| 0f973c962a | |||
| cffe9082db | |||
| 6c88b7b288 | |||
| ea2121e111 | |||
| 1191f98485 | |||
| 6c0e2d5259 | |||
| 894da40182 | |||
| 749a7e9750 | |||
| e5a66bfd15 | |||
| 9761d05a8e | |||
| 050e8bd19e | |||
| a0c3d3a6b3 | |||
| f06117d5ef | |||
| 75262b5940 | |||
| 0b3f1ee9fc | |||
| 7c19c93814 | |||
| 532c12dd22 | |||
| e81c2ac6b9 | |||
| 161ea5e5dd | |||
| 260019d79f | |||
| 08b68781e9 | |||
| 760be03b18 | |||
| 148a4359b6 | |||
| b65d35cfd6 | |||
| 54eb75a420 | |||
| e9d28c6f63 | |||
| 212f14db36 | |||
| b50e25a0ee | |||
| 0a49695d7c | |||
| 9e5a2e8400 | |||
| f0fb85e6db | |||
| 86081ec113 |
@@ -1,9 +1,14 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="LocalDate passato a SimpleDate" />
|
||||
<option name="myName" value="LocalDate Checks" />
|
||||
<inspection_tool class="2b489e84-a2d7-30b2-9eff-e1ae310a3021" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="3ba9f580-3fdd-3896-b2c5-a57a36bbdc46" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="68d10b55-8d01-38ad-9579-a3dca4cd32a8" enabled="true" level="ERROR" enabled_by_default="true" editorAttributes="ERRORS_ATTRIBUTES" />
|
||||
<inspection_tool class="731e1524-8144-3953-9fa9-9ef0eb4affb5" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="AbstractBeanReferencesInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AccessStaticViaInstance" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ActionIsNotPreviewFriendly" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ActionPresentationInstantiatedInCtor" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AddExplicitTargetToParameterAnnotation" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AddOperatorModifier" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="AmbiguousNonLocalJump" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
@@ -44,6 +49,7 @@
|
||||
<inspection_tool class="AnonymousHasLambdaAlternative" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AnonymousInnerClass" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="AopLanguageInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ApplicationServiceAsStaticFinalFieldOrProperty" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ArgNamesErrorsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ArgNamesWarningsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AroundAdviceStyleInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -69,6 +75,8 @@
|
||||
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,java.lang.foreign.Arena,ofAuto,java.lang.foreign.Arena,global,com.annimon.stream.Stream,of" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="BadExpressionStatementJS" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="BatchJobDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="BatchXmlDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="BigDecimalLegacyMethod" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="BigDecimalMethodWithoutRoundingCalled" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="BintrayPublishingPlugin" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -143,12 +151,18 @@
|
||||
<inspection_tool class="CollectionAddedToSelf" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="CommaExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="CommentedOutCode" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="CompanionObjectInExtension" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ComparatorCombinators" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ComparatorMethodParameterNotUsed" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ComparatorResultComparison" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ComparisonOfShortAndChar" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ComparisonToNaN" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ComplexRedundantLet" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ComponentNotRegistered" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="CHECK_ACTIONS" value="true" />
|
||||
<option name="IGNORE_NON_PUBLIC" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ComponentRegistrationProblems" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ComposeErroneousRelation" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ComposeMissingKeys" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ComposeUnknownKeys" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
@@ -229,6 +243,7 @@
|
||||
<inspection_tool class="CssUnresolvedClassInComposesRule" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="CssUnresolvedCustomProperty" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="CssUnusedSymbol" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="CsvValidation" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="CustomRegExpInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="CyclicJobDependency" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="DanglingJavadoc" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -253,9 +268,11 @@
|
||||
<inspection_tool class="DeprecatedIsStillUsed" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DeprecatedLombok" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DeprecatedMavenDependency" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DeprecatedStaplerJellyCustomTagAttribute" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="Deprecation" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DestructuringWrongName" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DevContainerIdeSettings" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="DevKitPropertiesMessageValidation" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DevcontainerFolder" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="DialogTitleCapitalization" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DiamondCanBeReplacedWithExplicitTypeArguments" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
@@ -349,6 +366,7 @@
|
||||
</inspection_tool>
|
||||
<inspection_tool class="EmptySynchronizedStatement" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="EmptyTryBlock" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="EmptyWebServiceClass" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="EndlessStream" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="EnhancedSwitchBackwardMigration" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="EnhancedSwitchMigration" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -376,11 +394,13 @@
|
||||
<inspection_tool class="ExpressionMayBeFactorized" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="ExtendsAnnotation" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ExtendsObject" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ExtensionRegisteredAsServiceOrComponent" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ExternalizableWithoutPublicNoArgConstructor" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ExtractMethodRecommender" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="FallThroughInSwitchStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="FieldCanBeLocal" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="FieldMayBeFinal" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="FileEqualsUsage" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="FillPermitsList" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="FilterIsInstanceCallWithClassLiteralArgument" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="FilterIsInstanceResultIsAlwaysEmpty" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -403,6 +423,7 @@
|
||||
<inspection_tool class="ForLoopReplaceableByWhile" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="m_ignoreLoopsWithoutConditions" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ForbiddenInSuspectContextMethod" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ForeignDelegate" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ForwardCompatibility" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="FrequentlyUsedInheritorInspection" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
@@ -578,16 +599,20 @@
|
||||
<option name="FLAG_EXPLICIT_CONVERSION" value="true" />
|
||||
<option name="IGNORE_NODESET_TO_BOOLEAN_VIA_STRING" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ImplicitlyExposedWebServiceMethods" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IncompatibleMask" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IncompatibleMaskJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IncompleteDestructuring" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="InconsistentCommentForJavaParameter" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="InconsistentResourceBundle" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="InconsistentTextBlockIndent" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IncorrectCancellationExceptionHandling" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="IncorrectDateTimeFormat" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IncorrectHttpHeaderInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IncorrectMessageFormat" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IncorrectParentDisposable" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IncorrectPluginDslStructure" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="IncorrectServiceRetrieving" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="IndexOfReplaceableByContains" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IndexZeroUsage" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="InfiniteLoopJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -600,19 +625,24 @@
|
||||
<inspection_tool class="InjectionValueTypeInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="InnerClassMayBeStatic" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="InsertLiteralUnderscores" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="InspectionDescriptionNotFoundInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="InspectionUsingGrayColors" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="InstantiatingObjectToGetClassObject" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="InstantiationOfUtilityClass" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IntegerDivisionInFloatingPointContext" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IntegerMultiplicationImplicitCastToLong" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="ignoreNonOverflowingCompileTimeConstants" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="IntentionDescriptionNotFoundInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="InterfaceMethodClashesWithObject" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IntroduceWhenSubject" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="InvalidComparatorMethodReference" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="InvalidIconSrc" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IterableUsedAsVararg" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IteratorHasNextCallsIteratorNext" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JBoss" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="JCenterRepository" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JComponentDataProvider" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSAccessibilityCheck" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSAnnotator" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="JSArrowFunctionBracesCanBeRemoved" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
@@ -727,6 +757,7 @@
|
||||
<inspection_tool class="JavadocReference" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="JavaeeApplicationDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="JdkProxiedBeanTypeInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="Jexl" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="JoinDeclarationAndAssignment" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JoinDeclarationAndAssignmentJava" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="JpaAttributeMemberSignatureInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
@@ -763,6 +794,7 @@
|
||||
<inspection_tool class="JvmCoverageInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="KDocUnresolvedReference" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="KarmaConfigFile" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="KeymapXmlDom" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="KotlinAmbiguousActuals" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="KotlinConstantConditions" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="KotlinDoubleNegation" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
@@ -770,6 +802,8 @@
|
||||
<inspection_tool class="KotlinInvalidBundleOrProperty" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="KotlinMavenPluginPhase" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="KotlinNoActualForExpect" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="KotlinObjectExtensionRegistration" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="KotlinObjectRegisteredAsExtension" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="KotlinOptionsToCompilerOptions" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="KotlinRedundantOverride" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="KotlinTestJUnit" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -795,15 +829,21 @@
|
||||
<option name="CHECK_NON_ANNOTATED_REFERENCES" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="LateinitVarOverridesLateinitVar" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="LeakableMapKey" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="LengthOneStringsInConcatenation" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="LessResolvedByNameOnly" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="LessUnresolvedMixin" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="LessUnresolvedVariable" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="LiftReturnOrAssignment" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="LightServiceMigrationCode" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="LightServiceMigrationXML" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="LightServiceMustBeFinal" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="LimitedScopeInnerClass" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="LiquibaseXmlUnresolvedProperty" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ListIndexOfReplaceableByContains" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ListRemoveInLoop" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ListenerImplementationMustNotBeDisposable" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="LiveTemplateI18n" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="LocalVariableName" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="LogStatementNotGuardedByLogCondition" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WEAK WARNING" enabled_by_default="false">
|
||||
@@ -877,6 +917,7 @@
|
||||
<inspection_tool class="MicronautDataRepositoryMethodReturnType" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MigrateFromJavaLangIo" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="MigrateToJavaLangIo" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="MigrateToOptControl" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MimeType" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="MinMaxValuesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MismatchedArrayReadWrite" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -892,9 +933,12 @@
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="MismatchedJavadocCode" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MismatchedLightServiceLevelAndCtor" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MismatchedStringBuilderQueryUpdate" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MismatchedStringCase" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MisorderedAssertEqualsArguments" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MissingAccessibleContext" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MissingActionUpdateThread" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MissingAspectjAutoproxyInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MissingDeprecatedAnnotationOnScheduledForRemovalApi" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="MissingFinalNewline" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
@@ -902,6 +946,7 @@
|
||||
<option name="ignoreObjectMethods" value="true" />
|
||||
<option name="ignoreAnonymousClassMethods" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="MissingRecentApi" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="MissingSerialAnnotation" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MissortedModifiers" enabled="false" level="INFORMATION" enabled_by_default="false">
|
||||
<option name="m_requireAnnotationsFirst" value="true" />
|
||||
@@ -945,8 +990,10 @@
|
||||
<inspection_tool class="NodeCoreCodingAssistance" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="NonAsciiCharacters" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="NonAtomicOperationOnVolatileField" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="NonDefaultConstructor" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="NonExtendableApiUsage" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="NonFinalFieldInEnum" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="NonJaxWsWebServices" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="NonSerializableWithSerialVersionUIDField" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="NonStrictComparisonCanBeEquality" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="NotNullFieldNotInitialized" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -980,6 +1027,7 @@
|
||||
<inspection_tool class="ObviousNullCheck" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="OctalLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="OneToOneWithLazy" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="OneWayWebMethod" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="OnlyOneElementUsed" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="OpenRewriteYamlRecipe" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="OptionalAssignedToNull" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -994,6 +1042,7 @@
|
||||
<inspection_tool class="OverflowingLoopIndex" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="OverrideOnly" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="OverwrittenKey" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PSScriptAnalyzer" enabled="false" level="SERVER PROBLEM" enabled_by_default="false" />
|
||||
<inspection_tool class="PackageDirectoryMismatch" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PackageInfoWithoutPackage" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PackageJsonMismatchedDependency" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -1010,6 +1059,12 @@
|
||||
<inspection_tool class="PatternVariablesCanBeReplacedWithCast" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="PbDuplicatedImports" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PgSelectFromProcedureInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PluginXmlCapitalization" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PluginXmlDynamicPlugin" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PluginXmlExtensionRegistration" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PluginXmlI18n" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PluginXmlPluginLogo" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PluginXmlValidity" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="PointcutMethodStyleInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PointlessArithmeticExpression" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="m_ignoreExpressionsContainingConstants" value="true" />
|
||||
@@ -1027,22 +1082,27 @@
|
||||
<inspection_tool class="PostCssCustomSelector" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="PostCssMediaRange" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="PostCssUnresolvedModuleValueReference" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="PostfixTemplateDescriptionNotFound" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="PreferCurrentCoroutineContextToCoroutineContext" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PresentationAnnotation" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="PreviewFeature" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PrimitiveArrayArgumentToVariableArgMethod" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PrivatePropertyName" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PropertyName" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ProtectedInFinal" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ProtectedMemberInFinalClass" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PsiElementConcatenation" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PublicField" enabled="false" level="INFORMATION" enabled_by_default="false">
|
||||
<option name="ignoreEnums" value="false" />
|
||||
<option name="ignorableAnnotations">
|
||||
<value />
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PublicTestExtensionFunction" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="QsPrivateBeanMembersInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="QsProperties" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="QsYaml" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="QuickFixGetFamilyNameViolation" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="RawUseOfParameterizedType" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ReactiveStreamsNullableInLambdaInTransform" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ReactiveStreamsPublisherImplementation" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -1189,6 +1249,7 @@
|
||||
<inspection_tool class="ReplaceWithIgnoreCaseEquals" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ReplaceWithJavadoc" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="ReplaceWithOperatorAssignment" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="RequiredArtifactTypeInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="RequiredAttributes" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="myAdditionalRequiredHtmlAttributes" value="" />
|
||||
</inspection_tool>
|
||||
@@ -1203,11 +1264,31 @@
|
||||
<inspection_tool class="RunBlocking" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="RunBlockingInSuspendFunction" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SSBasedInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<searchConfiguration name="Date equals LocalDate inspection" text="$d1$.equals($d2$)" recursive="true" caseInsensitive="false" type="JAVA" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="d1" nameOfExprType="java\.util\.Date" within="" contains="" />
|
||||
<constraint name="d2" nameOfExprType="java\.time\.LocalDate" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="Date equals LocalDateTime inspection" text="$d1$.equals($d2$)" recursive="true" caseInsensitive="false" type="JAVA" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="d1" nameOfExprType="java\.util\.Date" within="" contains="" />
|
||||
<constraint name="d2" nameOfExprType="java\.time\.LocalDateTime" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="LocalDate equals Date inspection" text="$d1$.equals($d2$)" recursive="true" caseInsensitive="false" type="JAVA" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="d1" nameOfExprType="java\.time\.LocalDate" within="" contains="" />
|
||||
<constraint name="d2" nameOfExprType="java\.util\.Date" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="LocalDate passato a SimpleDateFormat" text="$formatter$.format($date$)" recursive="true" caseInsensitive="true" type="JAVA" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="formatter" nameOfExprType="java\.text\.SimpleDateFormat" within="" contains="" />
|
||||
<constraint name="date" nameOfExprType="java\.time\.LocalDate" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="LocalDateTime equals Date inspection" text="$d1$.equals($d2$)" recursive="true" caseInsensitive="false" type="JAVA" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="d1" nameOfExprType="java\.time\.LocalDateTime" within="" contains="" />
|
||||
<constraint name="d2" nameOfExprType="java\.util\.Date" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="SafeCastWithReturn" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SafeVarargsDetector" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -1242,6 +1323,7 @@
|
||||
<inspection_tool class="SimplifiableCallChain" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SimplifiableConditionalExpression" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SimplifiableIfStatement" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="SimplifiableServiceRetrieving" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SimplifyAssertNotNull" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="SimplifyBooleanWithConstants" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SimplifyCollector" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -1391,7 +1473,9 @@
|
||||
<inspection_tool class="SqlUnusedSubqueryItemInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SqlUnusedVariableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SqlWithoutWhereInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="StatefulEp" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="StaticImportCanBeUsed" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="StaticInitializationInExtensions" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="StaticInitializerReferencesSubClass" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="StaticMethodImportLombok" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="StreamToLoop" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
@@ -1477,6 +1561,7 @@
|
||||
<inspection_tool class="ThymeleafMessagesResolveInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ThymeleafVariablesResolveInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ToArrayCallWithZeroLengthArrayArgument" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="TokenSetInParserDefinition" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="TomlUnresolvedReference" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="TooBroadScope" enabled="false" level="INFORMATION" enabled_by_default="false">
|
||||
<option name="m_allowConstructorAsInitializer" value="false" />
|
||||
@@ -1513,8 +1598,10 @@
|
||||
<inspection_tool class="TypeScriptUnresolvedReference" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="TypeScriptValidateGenericTypes" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="TypeScriptValidateTypes" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="UElementAsPsi" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UNCHECKED_WARNING" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UNUSED_IMPORT" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UastHintedVisitorAdapterHints" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UastIncorrectHttpHeaderInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UastIncorrectMimeTypeInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="UnaryPlus" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -1524,8 +1611,10 @@
|
||||
<inspection_tool class="UndefinedJob" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="UndefinedParamsPresent" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UndefinedStage" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="UndesirableClassUsage" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnfinishedStepVerifier" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnhandledExceptionInJSP" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnknownIdInMetaInformation" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="UnknownLanguage" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="UnnecessarilyQualifiedInnerClassAccess" enabled="false" level="INFORMATION" enabled_by_default="false">
|
||||
<option name="ignoreReferencesNeedingImport" value="false" />
|
||||
@@ -1585,10 +1674,14 @@
|
||||
<inspection_tool class="UnreachableCatch" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnreachableCodeJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnresolvedMessageChannel" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnresolvedPluginConfigReference" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="UnresolvedPropertyKey" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="UnresolvedReference" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="UnresolvedRestParam" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="UnsafeReturnStatementVisitor" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnsafeVfsRecursion" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnsatisfiedRange" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnspecifiedActionsPlace" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnstableApiUsage" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnsupportedCharacter" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnsupportedChronoFieldUnitCall" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -1615,12 +1708,20 @@
|
||||
<inspection_tool class="UsagesOfObsoleteApi" enabled="false" level="TEXT ATTRIBUTES" enabled_by_default="false" />
|
||||
<inspection_tool class="UseBulkOperation" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UseCompareMethod" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UseDPIAwareBorders" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UseDPIAwareInsets" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UseExpressionBody" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="UseHashCodeMethodInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UseJBColor" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UsePlatformProcessAwaitExit" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="UsePluginIdEquals" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UsePrimitiveTypes" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UsePropertyAccessSyntax" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UseVirtualFileEquals" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UselessCallOnCollection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UselessCallOnNotNull" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UtilSchemaInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ValidExternallyBoundObject" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="VarargParameter" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="VariableInitializerIsRedundant" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="VariableNeverRead" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
@@ -1640,6 +1741,7 @@
|
||||
<inspection_tool class="VulnerableCodeUsages" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="VulnerableLibrariesGlobal" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="VulnerableLibrariesLocal" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="WSReferenceInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="WadlDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="WaitWhileHoldingTwoLocks" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="WebProperties" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
@@ -1651,11 +1753,15 @@
|
||||
<option name="ignoreNonEmtpyLoops" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="WithStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="WorkspaceEntityMutableField" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="WorkspaceImplAbsent" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="WorkspaceImplObsolete" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="WrapUnaryOperator" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="WrapperTypeMayBePrimitive" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="WriteOnlyObject" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="WrongPackageStatement" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="WrongPropertyKeyValueDelimiter" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="WsdlHighlightingInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="XmlDefaultAttributeValue" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="XmlDeprecatedElement" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="XmlDuplicatedId" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
@@ -1677,6 +1783,21 @@
|
||||
<inspection_tool class="YAMLSchemaValidation" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="YAMLUnresolvedAlias" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="YAMLUnusedAnchor" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="checkReturnValue" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="checkedExceptions" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="com.intellij.jpa.jpb.model.DataClassEqualsAndHashCodeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="com.intellij.jpb.CompositeIdClassSerializable" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="com.intellij.jpb.ConverterSpecifiedIncorrectlyInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="com.intellij.jpb.DuplicateVersionAnnotationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="com.intellij.jpb.EntityIdMissingInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="com.intellij.jpb.IncompatibleTableAnnotationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="com.intellij.jpb.LombokDataInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="com.intellij.jpb.LombokEqualsAndHashCodeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="com.intellij.jpb.LombokToStringIncludeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="com.intellij.jpb.LombokToStringInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="com.intellij.jpb.NoArgsConstructorInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="com.intellij.jpb.UnsupportedTypeWithoutConverterInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="d539a2c0-2ebf-35d7-921f-25a581173971" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="dependsOnMethodTestNG" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="groupsTestNG" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="groups">
|
||||
2485
.idea/inspectionProfiles/Project_Default.xml
generated
2485
.idea/inspectionProfiles/Project_Default.xml
generated
File diff suppressed because it is too large
Load Diff
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="PROJECT_PROFILE" value="LocalDate Checks" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
1
.idea/runConfigurations/MenuStaticCreator.xml
generated
1
.idea/runConfigurations/MenuStaticCreator.xml
generated
@@ -2,6 +2,7 @@
|
||||
<configuration default="false" name="MenuStaticCreator" type="Application" factoryName="Application" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="it.integry.ems.menu.MenuStaticCreator" />
|
||||
<module name="ems-core" />
|
||||
<shortenClasspath name="MANIFEST" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="it.integry.ems.menu.*" />
|
||||
|
||||
6
.idea/sqldialects.xml
generated
Normal file
6
.idea/sqldialects.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/ems-engine/src/main/java/it/integry/ems/document/farm_mes/service/FarmMesImportService.java" dialect="GenericSQL" />
|
||||
</component>
|
||||
</project>
|
||||
20
.idea/structuralSearch.xml
generated
20
.idea/structuralSearch.xml
generated
@@ -6,5 +6,25 @@
|
||||
<constraint name="formatter" nameOfExprType="java\.text\.SimpleDateFormat" within="" contains="" />
|
||||
<constraint name="date" nameOfExprType="java\.time\.LocalDate" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="LocalDate equals java.util.Date inspection" text="$d1$.equals($d2$)" recursive="true" caseInsensitive="false" type="JAVA" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="d1" nameOfExprType="java\.time\.LocalDate" within="" contains="" />
|
||||
<constraint name="d2" nameOfExprType="java\.util\.Date" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="java.util.Date equals LocalDate inspection" text="$d1$.equals($d2$)" recursive="true" caseInsensitive="false" type="JAVA" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="d1" nameOfExprType="java\.util\.Date" within="" contains="" />
|
||||
<constraint name="d2" nameOfExprType="java\.time\.LocalDate" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="java.util.Date equals LocalDateTime inspection" text="$d1$.equals($d2$)" recursive="true" caseInsensitive="false" type="JAVA" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="d1" nameOfExprType="java\.util\.Date" within="" contains="" />
|
||||
<constraint name="d2" nameOfExprType="java\.time\.LocalDateTime" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="LocalDateTime equals java.util.Date inspection" text="$d1$.equals($d2$)" recursive="true" caseInsensitive="false" type="JAVA" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="d1" nameOfExprType="java\.time\.LocalDateTime" within="" contains="" />
|
||||
<constraint name="d2" nameOfExprType="java\.util\.Date" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
</component>
|
||||
</project>
|
||||
@@ -3,7 +3,7 @@ FROM tomcat:9-jre8-alpine
|
||||
RUN apk add --no-cache fontconfig ttf-dejavu
|
||||
|
||||
ENV TZ="Europe/Rome"
|
||||
ENV JAVA_OPTS="-DDISABLE_DROOLS_COMPILE=TRUE -Xms512M -Xmx1G -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
|
||||
ENV JAVA_OPTS="-DDISABLE_DROOLS_COMPILE=TRUE -Xms512M -Xmx2G -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
|
||||
ENV USERDOMAIN="STUDIO-ML"
|
||||
|
||||
COPY docker/tomcat/conf/integry/ems.properties /usr/local/tomcat/conf/integry/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -229,6 +229,11 @@
|
||||
<artifactId>arial-rounded</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>it.integry.font</groupId>
|
||||
<artifactId>NotoSerif</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
|
||||
@@ -19,6 +19,7 @@ import it.integry.WooCommerce.dto.product.variation.WooCommerceProductVariationD
|
||||
import it.integry.WooCommerce.enums.ArticoloException;
|
||||
import it.integry.WooCommerce.enums.StockStatus;
|
||||
import it.integry.WooCommerce.enums.SyncOrigin;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.service.MailService;
|
||||
@@ -29,7 +30,6 @@ import it.integry.ems_model.entity.WdtbOrds;
|
||||
import it.integry.ems_model.entity.WdtbOrdt;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDate;
|
||||
import it.integry.ems_model.utility.UtilityStream;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
@@ -41,7 +41,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -445,7 +445,8 @@ public class WooCommerceService {
|
||||
}
|
||||
|
||||
//CHIAVE ORDINE
|
||||
Date dataOrd = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").parse(orderDTO.getDateCreated());
|
||||
LocalDate dataOrd = UtilityString.parseLocalDateTime(orderDTO.getDateCreated(), "yyyy-MM-dd'T'HH:mm:ss")
|
||||
.toLocalDate();
|
||||
|
||||
ordineWeb
|
||||
.setGestione("V")
|
||||
@@ -453,7 +454,7 @@ public class WooCommerceService {
|
||||
.setNumOrd(Integer.parseInt(orderDTO.getNumber()))
|
||||
//CHIAVE RIFERIMENTO ORDINE WOOCOMMERCE
|
||||
.setSerie(dataManager.getSetup("SERIE"))
|
||||
.setRifOrd(UtilityString.left("RIF N." + orderDTO.getNumber() + " DEL " + UtilityDate.formatDate(dataOrd, "dd-MM-yy") + " " + orderDTO.getOrderKey(), 40))
|
||||
.setRifOrd(UtilityString.left("RIF N." + orderDTO.getNumber() + " DEL " + CommonConstants.DATE_DMY_DASHED_FORMATTER.format(dataOrd) + " " + orderDTO.getOrderKey(), 40))
|
||||
.setDataOrdRif(dataOrd)
|
||||
.setNumOrdRif(Integer.parseInt(orderDTO.getNumber()))
|
||||
.setListino(dataManager.getSetup("LISTINO"));
|
||||
|
||||
@@ -11,6 +11,7 @@ public class CommonConstants {
|
||||
|
||||
public static final String INTEGRY = "integry";
|
||||
public static final String PROFILE_DB = "profileDb";
|
||||
public static final String COD_MDEP = "codMdep";
|
||||
public static final String WHERE_COND = "whereCond";
|
||||
public static final String EMPTY_STRING = "";
|
||||
|
||||
@@ -20,16 +21,17 @@ public class CommonConstants {
|
||||
public static final String TIMESTAMP = "timestamp";
|
||||
|
||||
|
||||
public static final String DATE_FORMAT_YMD = "yyyy-MM-dd";
|
||||
public static final String DATE_FORMAT_DMY = "dd/MM/yyyy";
|
||||
public static final String DATE_FORMAT_YMD_SLASHED = "yyyy/MM/dd";
|
||||
public static final String DATE_FORMAT_YMD_DASHED = "yyyy-MM-dd";
|
||||
public static final String DATE_FORMAT_DMY_SLASHED = "dd/MM/yyyy";
|
||||
public static final String DATE_FORMAT_DMY_DASHED = "dd-MM-yyyy";
|
||||
public static final String DATE_FORMAT_DMYHMS_UNSPACED = "ddMMyyyyHHmmss";
|
||||
|
||||
public static final String TIME_FORMAT = "HH:mm:ss";
|
||||
|
||||
public static final String DATETIME_FORMAT_YMD = String.format("%s %s", DATE_FORMAT_YMD, TIME_FORMAT);
|
||||
public static final String DATETIME_FORMAT_YMD = String.format("%s %s", DATE_FORMAT_YMD_DASHED, TIME_FORMAT);
|
||||
public static final String DATETIME_FORMAT_DMY = String.format("%s %s", DATE_FORMAT_DMY_DASHED, TIME_FORMAT);
|
||||
public static final String DATETIME_FORMAT_DMY_SLASHED = String.format("%s %s", DATE_FORMAT_DMY, TIME_FORMAT);
|
||||
public static final String DATETIME_FORMAT_DMY_SLASHED = String.format("%s %s", DATE_FORMAT_DMY_SLASHED, TIME_FORMAT);
|
||||
public static final String DATETIME_FORMAT_DMY_DASHED = String.format("%s %s", DATE_FORMAT_DMY_DASHED, TIME_FORMAT);
|
||||
|
||||
|
||||
@@ -46,12 +48,19 @@ public class CommonConstants {
|
||||
.withZone(ZoneId.systemDefault());
|
||||
|
||||
|
||||
public static final DateTimeFormatter DATE_YMD_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_YMD)
|
||||
public static final DateTimeFormatter DATE_YMD_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_YMD_SLASHED)
|
||||
.withZone(ZoneId.systemDefault());
|
||||
public static final DateTimeFormatter DATETIME_YMD_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_YMD)
|
||||
.withZone(ZoneId.systemDefault());
|
||||
public static final DateTimeFormatter DATE_YMD_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_YMD_DASHED)
|
||||
.withZone(ZoneId.systemDefault());
|
||||
public static final DateTimeFormatter DATETIME_YMD_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_YMD)
|
||||
.withZone(ZoneId.systemDefault());
|
||||
|
||||
public static final DateTimeFormatter DATE_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_DMY)
|
||||
|
||||
public static final DateTimeFormatter DATE_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_DMY_SLASHED)
|
||||
.withZone(ZoneId.systemDefault());
|
||||
public static final DateTimeFormatter DATE_DMY_DASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATE_FORMAT_DMY_DASHED)
|
||||
.withZone(ZoneId.systemDefault());
|
||||
public static final DateTimeFormatter DATETIME_DMY_SLASHED_FORMATTER = DateTimeFormatter.ofPattern(CommonConstants.DATETIME_FORMAT_DMY_SLASHED)
|
||||
.withZone(ZoneId.systemDefault());
|
||||
|
||||
@@ -69,7 +69,6 @@ public class EmsCoreDBLoader {
|
||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(connectionPool)){
|
||||
discoverAllConnections(multiDBTransactionManager);
|
||||
setupAzienda(multiDBTransactionManager);
|
||||
userCacheService.discoverAllUsers(multiDBTransactionManager);
|
||||
|
||||
if (onComplete != null) onComplete.run(multiDBTransactionManager);
|
||||
} catch (Exception ex) {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.ems.adapter;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class LongDeserializer extends JsonDeserializer<Long> {
|
||||
|
||||
@Override
|
||||
public Long deserialize(JsonParser parser, DeserializationContext context)
|
||||
throws IOException {
|
||||
String string = parser.getText();
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(string)) {
|
||||
if (string.equalsIgnoreCase("null")) {
|
||||
return EmsRestConstants.LONG_NULL;
|
||||
}
|
||||
return new Long(string);
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,269 @@
|
||||
package it.integry.ems.anonymizer;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Generatore di nomi e cognomi italiani per l'anonimizzazione dei dati.
|
||||
* Mantiene la coerenza del sesso tra nome e genere.
|
||||
*/
|
||||
public class ItalianNameGenerator {
|
||||
|
||||
private final Random random;
|
||||
|
||||
// Nomi maschili italiani (200+ nomi)
|
||||
public static final List<String> MALE_NAMES = Arrays.asList(
|
||||
"Alessandro", "Andrea", "Antonio", "Francesco", "Marco", "Matteo", "Giuseppe", "Luca",
|
||||
"Giovanni", "Roberto", "Stefano", "Paolo", "Davide", "Michele", "Simone", "Federico",
|
||||
"Riccardo", "Fabio", "Daniele", "Massimo", "Claudio", "Nicola", "Gabriele", "Vincenzo",
|
||||
"Lorenzo", "Salvatore", "Emanuele", "Alberto", "Diego", "Tommaso", "Alessio", "Filippo",
|
||||
"Giorgio", "Mattia", "Franco", "Bruno", "Enrico", "Mario", "Carlo", "Gianluca",
|
||||
"Cristian", "Domenico", "Raffaele", "Sergio", "Pasquale", "Gianni", "Carmine", "Gennaro",
|
||||
"Antonino", "Gaetano", "Rocco", "Mauro", "Pierluigi", "Valerio", "Mirko", "Dario",
|
||||
"Enzo", "Alfredo", "Renzo", "Giancarlo", "Giampaolo", "Pierpaolo", "Gianfranco", "Guido",
|
||||
"Nino", "Piero", "Armando", "Luciano", "Renato", "Angelo", "Aldo", "Giulio",
|
||||
"Marcello", "Rodolfo", "Umberto", "Silvano", "Ivano", "Giampiero", "Silvio", "Maurizio",
|
||||
"Leonardo", "Adriano", "Ferdinando", "Bernardo", "Teodoro", "Edoardo", "Arturo", "Gino",
|
||||
"Biagio", "Fabrizio", "Fausto", "Ettore", "Cesare", "Elio", "Amerigo", "Italo",
|
||||
"Orlando", "Romeo", "Sandro", "Tiziano", "Ignazio", "Ciro", "Loris", "Orazio",
|
||||
"Lino", "Nello", "Rino", "Primo", "Secondo", "Terzo", "Quarto", "Quinto",
|
||||
"Sesto", "Settimo", "Ottavio", "Nono", "Decimo", "Benito", "Dante", "Virgilio",
|
||||
"Omero", "Eugenio", "Aurelio", "Valentino", "Corrado", "Manlio", "Emilio", "Tullio",
|
||||
"Attilio", "Marcello", "Romolo", "Remo", "Amedeo", "Cosimo", "Damiano", "Sebastiano",
|
||||
"Cristoforo", "Bartolomeo", "Giacomo", "Simone", "Pietro", "Girolamo", "Leopoldo", "Gaspare",
|
||||
"Melchiorre", "Baldassarre", "Epifanio", "Gerardo", "Ruggero", "Tancredi", "Arnaldo", "Osvaldo",
|
||||
"Rinaldo", "Romualdo", "Ubaldo", "Raimondo", "Edmondo", "Redento", "Crescenzo", "Innocenzo",
|
||||
"Fiorenzo", "Vincenzo", "Enzo", "Renzo", "Nunzio", "Maurizio", "Patrizio", "Orazio",
|
||||
"Flavio", "Claudio", "Giuliano", "Adriano", "Emiliano", "Massimiliano", "Gianmarco", "Marcantonio",
|
||||
"Gianbattista", "Giovanbattista", "Giammarco", "Gianluigi", "Giampiero", "Gianmaria", "Giandomenico", "Gianpaolo",
|
||||
"Pierfrancesco", "Piergiorgio", "Pierangelo", "Piermario", "Piercarlo", "Piergiuseppe", "Gioacchino", "Bartolomeo",
|
||||
"Benedetto", "Benvenuto", "Bonaventura", "Bonifacio", "Camillo", "Calogero", "Carmelo", "Demetrio",
|
||||
"Dionisio", "Donato", "Egidio", "Eliseo", "Erminio", "Eustachio", "Evandro", "Ezio",
|
||||
"Fermo", "Fernando", "Ferruccio", "Fortunato", "Fulvio", "Gaetano", "Germano", "Giosuè",
|
||||
"Gregorio", "Guglielmo", "Lamberto", "Lanfranco", "Liborio", "Lucio", "Luigi", "Manfredo"
|
||||
);
|
||||
|
||||
// Nomi femminili italiani (200+ nomi)
|
||||
public static final List<String> FEMALE_NAMES = Arrays.asList(
|
||||
"Giulia", "Francesca", "Chiara", "Federica", "Sara", "Martina", "Valentina", "Alessandra",
|
||||
"Silvia", "Elisa", "Giorgia", "Elena", "Paola", "Laura", "Roberta", "Alice", "Serena",
|
||||
"Barbara", "Anna", "Maria", "Simona", "Claudia", "Monica", "Cristina", "Elisabetta",
|
||||
"Stefania", "Valeria", "Daniela", "Manuela", "Antonella", "Giovanna", "Sabrina", "Emanuela",
|
||||
"Ilaria", "Cinzia", "Rosanna", "Patrizia", "Teresa", "Carmela", "Giuseppina", "Rosa",
|
||||
"Antonietta", "Concetta", "Caterina", "Angela", "Raffaella", "Luisa", "Lucia", "Michela",
|
||||
"Franceschina", "Graziella", "Isabella", "Benedetta", "Beatrice", "Margherita", "Alessia", "Andrea",
|
||||
"Cristiana", "Fabiana", "Gabriella", "Gianna", "Lorena", "Marisa", "Nicoletta", "Ornella",
|
||||
"Rosaria", "Silvana", "Susanna", "Tiziana", "Viviana", "Adriana", "Agnese", "Albina",
|
||||
"Amelia", "Andreina", "Angelica", "Antonella", "Arianna", "Armida", "Augusta", "Aurora",
|
||||
"Bruna", "Brunella", "Camilla", "Carla", "Carolina", "Cecilia", "Clara", "Clelia",
|
||||
"Concettina", "Corinna", "Cosima", "Costanza", "Cristiana", "Delia", "Diana", "Dora",
|
||||
"Donatella", "Edvige", "Eleonora", "Elvira", "Emma", "Enrichetta", "Ester", "Eugenia",
|
||||
"Eva", "Fabia", "Fabiola", "Fernanda", "Fiorella", "Fiorenza", "Flora", "Franca",
|
||||
"Gaia", "Gemma", "Gilda", "Gina", "Gloria", "Grazia", "Ida", "Ilda",
|
||||
"Immacolata", "Ines", "Iolanda", "Irene", "Iris", "Ivana", "Ivanka", "Lara",
|
||||
"Letizia", "Licia", "Lidia", "Liliana", "Lina", "Linda", "Lisa", "Livia",
|
||||
"Loredana", "Lorella", "Lorenza", "Luana", "Luciana", "Lucilla", "Lucrezia", "Ludovica",
|
||||
"Luigia", "Luna", "Maddalena", "Mafalda", "Marcella", "Marella", "Marilena", "Marina",
|
||||
"Marisa", "Marta", "Matilde", "Maura", "Mirella", "Miriam", "Morena", "Nadia",
|
||||
"Natalia", "Natalina", "Nella", "Nelly", "Nicole", "Noemi", "Norma", "Olga",
|
||||
"Olimpia", "Orietta", "Palmira", "Pamela", "Pascale", "Pasqualina", "Pia", "Piera",
|
||||
"Pierina", "Priscilla", "Raffaela", "Rebecca", "Regina", "Renata", "Rita", "Romina",
|
||||
"Rosalba", "Rosalia", "Rosangela", "Rosanna", "Rosella", "Rosetta", "Rosina", "Rossana",
|
||||
"Rossella", "Samanta", "Sandra", "Santina", "Sebastiana", "Serafina", "Sonia", "Stella",
|
||||
"Tecla", "Tina", "Tosca", "Tullia", "Uberta", "Umberta", "Ursula", "Vera",
|
||||
"Veronica", "Vincenza", "Viola", "Virginia", "Vittoria", "Wanda", "Yvonne", "Zaira",
|
||||
"Zelda", "Zita", "Zoe", "Ambra", "Azzurra", "Bianca", "Celeste", "Diamante",
|
||||
"Fiamma", "Giada", "Perla", "Sole", "Stella", "Alba", "Alma", "Anya"
|
||||
);
|
||||
|
||||
// Cognomi italiani (300+ cognomi)
|
||||
public static final List<String> SURNAMES = Arrays.asList(
|
||||
"Rossi", "Ferrari", "Russo", "Bianchi", "Romano", "Gallo", "Costa", "Fontana",
|
||||
"Esposito", "Ricci", "Bruno", "Moretti", "Marino", "Greco", "Barbieri", "Lombardi",
|
||||
"Giordano", "Colombo", "Rizzo", "Benedetti", "Palumbo", "Pellegrini", "Caruso", "Ferretti",
|
||||
"Galli", "Marchetti", "Villa", "Mancini", "Conte", "Serra", "Ferrero", "Martinelli",
|
||||
"Mariani", "Giuliani", "Vitale", "Santoro", "Ferrara", "Leone", "Longo", "Gentile",
|
||||
"Martino", "Fabbri", "Rinaldi", "Messina", "Riva", "Conti", "Silvestri", "Coppola",
|
||||
"Negri", "Milani", "Parisi", "Sala", "Cattaneo", "Orlando", "Fiore", "Marini",
|
||||
"Guerra", "Pagano", "Bernardi", "Valenti", "Farina", "Ruggiero", "Caputo", "Monti",
|
||||
"Grassi", "Montanari", "Santini", "Morelli", "Amato", "Neri", "Donati", "Testa",
|
||||
"Bianco", "Sorrentino", "Rossini", "Giuliano", "Sartori", "De Angelis", "De Rosa",
|
||||
"Basile", "Costantini", "Rizzi", "Barone", "Martini", "De Santis", "Basso", "Pellegrino",
|
||||
"Carbone", "Gatti", "Coppola", "Rossetto", "Piras", "Ricci", "Martinelli", "Sanna",
|
||||
"Torrisi", "Scuderi", "Priolo", "Anastasi", "Puglisi", "La Rosa", "Catalano", "Garofalo",
|
||||
"Aiello", "Trovato", "Pappalardo", "Pulvirenti", "Marletta", "Di Marco", "Biondi", "Ferri",
|
||||
"Testa", "Marchi", "Baldini", "Benedetti", "Colombi", "Gasparini", "Orlandi", "Barbera",
|
||||
"Damico", "Guerriero", "Napolitano", "Romano", "Mazza", "Caruso", "Ferraro", "Gaeta",
|
||||
"Di Stefano", "Palma", "Carbone", "Morrone", "Milazzo", "Calabrese", "Ventura", "Palmieri",
|
||||
"Martello", "Fico", "Pastore", "Arena", "Maggio", "Sciacca", "Pagliaro", "Lupo",
|
||||
"Mangano", "Capra", "Finocchiaro", "Grasso", "Morabito", "Pellicano", "Castelli", "Castaldo",
|
||||
"Mauro", "Piazza", "Battaglia", "D Amico", "Forte", "Antonelli", "Delia", "Marino",
|
||||
"Cosentino", "Lazzaro", "Vitale", "Lombardo", "Crisafulli", "Nicolosi", "Bellomo", "Morreale",
|
||||
"Messina", "Vaccaro", "Nicosia", "Fazio", "Spina", "Russo", "Parisi", "Zappala",
|
||||
"Riccobono", "Camilleri", "Barbagallo", "Oliveri", "Pistone", "Gambino", "Cavallaro", "Burgio",
|
||||
"Gentile", "Restivo", "Di Bella", "Genovese", "Ferrante", "Gianninoto", "Vitrano", "Gargano",
|
||||
"Lombardi", "Milani", "Picci", "De Luca", "Foti", "Giardina", "Di Pietro", "Russo",
|
||||
"La Spina", "Morello", "Moschetti", "Penna", "Ferretti", "Colombo", "Marra", "De Simone",
|
||||
"Cozzi", "Grimaldi", "Pellegrini", "Galdi", "Paolini", "Ferrara", "Santangelo", "Di Giovanni",
|
||||
"Iannone", "Lucchese", "Orsini", "Mastroianni", "Fiorentino", "Capasso", "Di Napoli", "Giannini",
|
||||
"Romano", "Vitale", "Fontana", "Galdi", "Giuliani", "Barbieri", "Lombardo", "Martinelli",
|
||||
"De Rosa", "Ferri", "Caputo", "Castaldi", "Mauro", "Monti", "Villa", "Marcello",
|
||||
"Ricci", "Ferretti", "Gallo", "Fabbri", "Marini", "Grasso", "Carbone", "Bevilacqua",
|
||||
"Giannone", "Perna", "Pellegrino", "Di Lorenzo", "Napoli", "Amato", "Donato", "Riccio",
|
||||
"Giuliano", "Mancuso", "Bellotti", "Bianchini", "Rossetti", "Mazza", "Silvestri", "Baldini",
|
||||
"Martinelli", "Galli", "Colombo", "Ferraro", "Palumbo", "Marchetti", "Ferrera", "Rossi",
|
||||
"Caruso", "Serra", "Marchese", "Benedetti", "Franzese", "Basile", "Di Mauro", "Torrisi",
|
||||
"Licata", "Scuderi", "Platania", "Priolo", "Marletta", "Biondi", "Grassi", "Fontana",
|
||||
"Pagano", "Gentile", "Moretti", "Guerra", "Santoro", "Longo", "Giordano", "Fiore",
|
||||
"Marchetti", "Parisi", "Milani", "Orlando", "Sala", "Costa", "Cattaneo", "Neri",
|
||||
"Donati", "Mancini", "Montanari", "Caputo", "De Angelis", "Sartori", "De Santis", "Basso"
|
||||
);
|
||||
|
||||
public enum Gender {
|
||||
MALE, FEMALE
|
||||
}
|
||||
|
||||
/**
|
||||
* Costruttore con seed random sicuro
|
||||
*/
|
||||
public ItalianNameGenerator() {
|
||||
this.random = new SecureRandom();
|
||||
}
|
||||
|
||||
/**
|
||||
* Costruttore con seed personalizzato per risultati riproducibili
|
||||
* @param seed seed per il generatore random
|
||||
*/
|
||||
public ItalianNameGenerator(long seed) {
|
||||
this.random = new Random(seed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera un genere casuale
|
||||
* @return Gender casuale (MALE o FEMALE)
|
||||
*/
|
||||
public Gender generateGender() {
|
||||
return random.nextBoolean() ? Gender.MALE : Gender.FEMALE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera un nome casuale in base al sesso specificato
|
||||
* @param gender il sesso per cui generare il nome
|
||||
* @return nome casuale del sesso specificato
|
||||
*/
|
||||
public String generateFirstName(Gender gender) {
|
||||
List<String> names = (gender == Gender.MALE) ? MALE_NAMES : FEMALE_NAMES;
|
||||
return names.get(random.nextInt(names.size()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera un cognome casuale
|
||||
* @return cognome casuale
|
||||
*/
|
||||
public String generateSurname() {
|
||||
return SURNAMES.get(random.nextInt(SURNAMES.size()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera un nome completo (nome + cognome) in base al sesso
|
||||
* @param gender il sesso per cui generare il nome completo
|
||||
* @return nome completo del sesso specificato
|
||||
*/
|
||||
public String generateFullName(Gender gender) {
|
||||
return generateFirstName(gender) + " " + generateSurname();
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera un nome completo con sesso casuale
|
||||
* @return nome completo con sesso casuale
|
||||
*/
|
||||
public String generateRandomFullName() {
|
||||
Gender randomGender = random.nextBoolean() ? Gender.MALE : Gender.FEMALE;
|
||||
return generateFullName(randomGender);
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera una persona completa con nome, cognome e sesso
|
||||
* @return oggetto Person con i dati generati
|
||||
*/
|
||||
public Person generatePerson() {
|
||||
Gender gender = random.nextBoolean() ? Gender.MALE : Gender.FEMALE;
|
||||
return new Person(generateFirstName(gender), generateSurname(), gender);
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera una persona mantenendo il sesso specificato
|
||||
* @param gender il sesso da mantenere
|
||||
* @return oggetto Person con i dati generati
|
||||
*/
|
||||
public Person generatePerson(Gender gender) {
|
||||
return new Person(generateFirstName(gender), generateSurname(), gender);
|
||||
}
|
||||
|
||||
/**
|
||||
* Classe interna per rappresentare una persona generata
|
||||
*/
|
||||
public static class Person {
|
||||
private final String firstName;
|
||||
private final String surname;
|
||||
private final Gender gender;
|
||||
|
||||
public Person(String firstName, String surname, Gender gender) {
|
||||
this.firstName = firstName;
|
||||
this.surname = surname;
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public String getSurname() {
|
||||
return surname;
|
||||
}
|
||||
|
||||
public Gender getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public String getFullName() {
|
||||
return firstName + " " + surname;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Person{firstName='%s', surname='%s', gender=%s}",
|
||||
firstName, surname, gender);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metodo di utilità per ottenere il sesso da una stringa
|
||||
* @param genderString stringa rappresentante il sesso ("M", "F", "MALE", "FEMALE", etc.)
|
||||
* @return enum Gender corrispondente
|
||||
* @throws IllegalArgumentException se la stringa non è riconosciuta
|
||||
*/
|
||||
public static Gender parseGender(String genderString) {
|
||||
if (genderString == null) {
|
||||
throw new IllegalArgumentException("Gender string cannot be null");
|
||||
}
|
||||
|
||||
String normalized = genderString.trim().toUpperCase();
|
||||
switch (normalized) {
|
||||
case "M":
|
||||
case "MALE":
|
||||
case "MASCHIO":
|
||||
case "UOMO":
|
||||
return Gender.MALE;
|
||||
case "F":
|
||||
case "FEMALE":
|
||||
case "FEMMINA":
|
||||
case "DONNA":
|
||||
return Gender.FEMALE;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unrecognized gender: " + genderString);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ public class ExecutorServiceConfig {
|
||||
|
||||
private final int corePoolSize = Runtime.getRuntime().availableProcessors();
|
||||
private final int maxPoolSize = (int) (corePoolSize * 1.5f);
|
||||
private final int queueSize = 500;
|
||||
private final int queueSize = 1_000_000;
|
||||
|
||||
@Bean
|
||||
public ExecutorService taskExecutor() {
|
||||
|
||||
@@ -39,7 +39,6 @@ import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Base64Utility;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityDate;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
@@ -69,6 +68,7 @@ import java.lang.reflect.ParameterizedType;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
@@ -793,9 +793,8 @@ public class EmsController {
|
||||
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_STB_EMAIL_CONTENT, method = RequestMethod.GET)
|
||||
public byte[] downloadStbEmailContent(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam Integer idEmail) throws Exception {
|
||||
public ResponseEntity<byte[]> downloadStbEmailContent(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam Integer idEmail) throws Exception {
|
||||
StbEmailContent stbEmailContent = new StbEmailContent();
|
||||
stbEmailContent.setIdEmail(idEmail);
|
||||
stbEmailContent.setOperation(OperationType.SELECT_OBJECT);
|
||||
@@ -803,11 +802,7 @@ public class EmsController {
|
||||
stbEmailContent = entityProcessor.processEntity(stbEmailContent, multiDBTransactionManager);
|
||||
|
||||
if (stbEmailContent != null) {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition.attachment().filename("email.eml").build().toString());
|
||||
|
||||
byte[] byteArr = null;
|
||||
byte[] byteArr;
|
||||
|
||||
String pattern = "[^\\x00-\\x7F]";
|
||||
Pattern pat = Pattern.compile(pattern);
|
||||
@@ -819,13 +814,18 @@ public class EmsController {
|
||||
byteArr = Base64.decodeBase64(stbEmailContent.getEmailContent());
|
||||
}
|
||||
|
||||
response.setContentLength(byteArr != null ? byteArr.length : 0);
|
||||
return byteArr;
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.contentLength(byteArr != null ? byteArr.length : 0)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.builder("attachment")
|
||||
.filename("email.eml")
|
||||
.build()
|
||||
.toString())
|
||||
.body(byteArr);
|
||||
}
|
||||
|
||||
response.sendError(404, "Allegato non trovato");
|
||||
return null;
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_DOC_PDF, method = RequestMethod.GET)
|
||||
@@ -840,7 +840,7 @@ public class EmsController {
|
||||
@RequestParam Integer versione) throws Exception {
|
||||
|
||||
DtbDocPdf dtbDocPdf = new DtbDocPdf();
|
||||
dtbDocPdf.setDataDoc(UtilityDate.RecognizeDate(dataDoc));
|
||||
dtbDocPdf.setDataDoc(UtilityString.parseLocalDate(dataDoc));
|
||||
dtbDocPdf.setSerDoc(serDoc);
|
||||
dtbDocPdf.setNumDoc(numDoc);
|
||||
dtbDocPdf.setCodAnag(codAnag);
|
||||
@@ -884,15 +884,16 @@ public class EmsController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_DTB_ORD_PDF, method = RequestMethod.GET)
|
||||
public byte[] downloadDtbOrdPdf(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String gestione,
|
||||
@RequestParam String dataOrd,
|
||||
@RequestParam Integer numOrd,
|
||||
@RequestParam Integer versione) throws Exception {
|
||||
public ResponseEntity<byte[]> downloadDtbOrdPdf(
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String gestione,
|
||||
@RequestParam String dataOrd,
|
||||
@RequestParam Integer numOrd,
|
||||
@RequestParam Integer versione) throws Exception {
|
||||
|
||||
DtbOrdPdf dtbOrdPdf = new DtbOrdPdf();
|
||||
dtbOrdPdf.setGestione(gestione);
|
||||
dtbOrdPdf.setDataOrd(UtilityDate.RecognizeDate(dataOrd));
|
||||
dtbOrdPdf.setDataOrd(UtilityString.parseLocalDate(dataOrd));
|
||||
dtbOrdPdf.setNumOrd(numOrd);
|
||||
dtbOrdPdf.setVersione(versione);
|
||||
dtbOrdPdf.setOperation(OperationType.SELECT_OBJECT);
|
||||
@@ -900,17 +901,20 @@ public class EmsController {
|
||||
dtbOrdPdf = entityProcessor.processEntity(dtbOrdPdf, multiDBTransactionManager);
|
||||
|
||||
if (dtbOrdPdf != null) {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition.attachment().filename(dtbOrdPdf.getFilename()).build().toString());
|
||||
|
||||
byte[] byteArr = dtbOrdPdf.getFilecontentByteArr(true);
|
||||
response.setContentLength(byteArr != null ? byteArr.length : 0);
|
||||
return byteArr;
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_PDF)
|
||||
.contentLength(byteArr != null ? byteArr.length : 0)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.builder("attachment")
|
||||
.filename(ContentDisposition.attachment().filename(dtbOrdPdf.getFilename()).build().toString())
|
||||
.build()
|
||||
.toString())
|
||||
.body(byteArr);
|
||||
}
|
||||
|
||||
response.sendError(404, "Allegato non trovato");
|
||||
return null;
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_UPLOAD_STB_FILE_ATTACHMENT, method = RequestMethod.POST)
|
||||
@@ -1043,7 +1047,7 @@ public class EmsController {
|
||||
byte[] content = files[0].getBytes();
|
||||
// content = UtilityZip.zlib_compress(content);
|
||||
|
||||
Date dataDoc = UtilityDate.RecognizeDate(dataDocStr);
|
||||
LocalDate dataDoc = UtilityString.parseLocalDate(dataDocStr);
|
||||
|
||||
DtbDocPdf dtbDocPdf = new DtbDocPdf();
|
||||
dtbDocPdf.setDataDoc(dataDoc);
|
||||
@@ -1095,7 +1099,7 @@ public class EmsController {
|
||||
|
||||
String idAttach = null;
|
||||
StbFilesAttached.TypeAttach typeAttach = null;
|
||||
Date dataDoc = UtilityDate.RecognizeDate(dataDocStr);
|
||||
LocalDate dataDoc = UtilityString.parseLocalDate(dataDocStr);
|
||||
|
||||
DrlDocAttached drlDocAttached =
|
||||
new DrlDocAttached()
|
||||
|
||||
@@ -60,7 +60,11 @@ public class DbmsChangeTracker {
|
||||
createConnection();
|
||||
} catch (SQLException e) {
|
||||
try {
|
||||
integryConnection.close();
|
||||
try {
|
||||
integryConnection.close();
|
||||
} catch (Exception ex) {
|
||||
//ignore
|
||||
}
|
||||
createConnection();
|
||||
} catch (SQLException ex) {
|
||||
logger.error("Unable to reestablish DB connection for Change Tracker", ex);
|
||||
@@ -132,21 +136,25 @@ public class DbmsChangeTracker {
|
||||
|
||||
final List<String> trackedTables = retrieveTrackedTables();
|
||||
|
||||
HashMap<Long, DetectedChangeDataDTO> changesByVersion = new HashMap<>();
|
||||
HashMap<Long, List<DetectedChangeDataDTO>> changesByVersion = new HashMap<>();
|
||||
|
||||
for (String trackedTable : trackedTables) {
|
||||
long minValidVersion = getMinValidVersion(trackedTable);
|
||||
if (currentVersion < minValidVersion) {
|
||||
throw new SQLException("Change Tracking on table " + trackedTable + " has been reset. Current version: " + currentVersion + ", Min valid version: " + minValidVersion);
|
||||
}
|
||||
|
||||
if (currentVersion < minValidVersion) {
|
||||
if (eventListener != null) {
|
||||
eventListener.onTrackingResetted();
|
||||
currentVersion = retrieveCurrentVersion();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final List<DetectedChangeDataDTO> detectedChanges = retrieveChangeList(trackedTable);
|
||||
|
||||
detectedChanges.forEach(detectedChangeDataDTO -> {
|
||||
changesByVersion.put(detectedChangeDataDTO.getSysChangeVersion(), detectedChangeDataDTO);
|
||||
changesByVersion.putIfAbsent(detectedChangeDataDTO.getSysChangeVersion(), new ArrayList<>());
|
||||
changesByVersion.get(detectedChangeDataDTO.getSysChangeVersion()).add(detectedChangeDataDTO);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
logTrace("Detected " + changesByVersion.size() + " changes since version " + currentVersion);
|
||||
@@ -154,32 +162,33 @@ public class DbmsChangeTracker {
|
||||
dispatchChanges(changesByVersion);
|
||||
}
|
||||
|
||||
private void dispatchChanges(HashMap<Long, DetectedChangeDataDTO> changesByVersion) throws Exception {
|
||||
private void dispatchChanges(HashMap<Long, List<DetectedChangeDataDTO>> changesByVersion) throws Exception {
|
||||
final List<Long> sortedChanges = changesByVersion.keySet().stream()
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
for (Long changeId : sortedChanges) {
|
||||
final DetectedChangeDataDTO detectedChange = changesByVersion.get(changeId);
|
||||
final List<DetectedChangeDataDTO> detectedChanges = changesByVersion.get(changeId);
|
||||
|
||||
switch (detectedChange.getSysChangeOperation()) {
|
||||
case INSERT:
|
||||
if (eventListener != null)
|
||||
eventListener.onInsertDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
for (DetectedChangeDataDTO detectedChange : detectedChanges) {
|
||||
switch (detectedChange.getSysChangeOperation()) {
|
||||
case INSERT:
|
||||
if (eventListener != null)
|
||||
eventListener.onInsertDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
|
||||
case UPDATE:
|
||||
if (eventListener != null)
|
||||
eventListener.onUpdateDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
case UPDATE:
|
||||
if (eventListener != null)
|
||||
eventListener.onUpdateDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
|
||||
case DELETE:
|
||||
if (eventListener != null)
|
||||
eventListener.onDeleteDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
case DELETE:
|
||||
if (eventListener != null)
|
||||
eventListener.onDeleteDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
currentVersion = changeId;
|
||||
}
|
||||
}
|
||||
@@ -287,5 +296,7 @@ public class DbmsChangeTracker {
|
||||
void onUpdateDetected(String tableName, HashMap<String, Object> primaryKey) throws Exception;
|
||||
|
||||
void onDeleteDetected(String tableName, HashMap<String, Object> primaryKey) throws Exception;
|
||||
|
||||
void onTrackingResetted() throws Exception;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,18 +5,17 @@ import it.integry.annotations.PostContextConstruct;
|
||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordDeletedEvent;
|
||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordInsertedEvent;
|
||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordUpdatedEvent;
|
||||
import it.integry.ems.dbms_change_tracker.model.events.TableTrackingResettedEvent;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.exception.DataConverterNotFoundException;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -32,9 +31,13 @@ public class DbmsChangeTrackerComponent {
|
||||
add(MtbAart.ENTITY);
|
||||
add(MtbAartBarCode.ENTITY);
|
||||
add(MtbUntMis.ENTITY);
|
||||
add(MtbDepo.ENTITY);
|
||||
add(StbEditLimit.ENTITY);
|
||||
add(StbGestSetup.ENTITY);
|
||||
add(StbGestSetupDepo.ENTITY);
|
||||
add(StbUser.ENTITY);
|
||||
add(WtbClie.ENTITY);
|
||||
add(WtbDepo.ENTITY);
|
||||
add(WtbGestSetupUser.ENTITY);
|
||||
}};
|
||||
|
||||
@@ -60,37 +63,47 @@ public class DbmsChangeTrackerComponent {
|
||||
}
|
||||
|
||||
|
||||
private void enableAllChangeTracking() throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
|
||||
private void enableAllChangeTracking() throws Exception {
|
||||
for (Map.Entry<IntegryCustomerDB, DbmsChangeTracker> entrySet : activeChangeTrackers.entrySet()) {
|
||||
IntegryCustomerDB customerDB = entrySet.getKey();
|
||||
DbmsChangeTracker dbmsChangeTracker = entrySet.getValue();
|
||||
final IntegryCustomerDB customerDB = entrySet.getKey();
|
||||
final DbmsChangeTracker dbmsChangeTracker = entrySet.getValue();
|
||||
|
||||
dbmsChangeTracker.enableTrackerInDbms();
|
||||
try {
|
||||
|
||||
for (String tableName : trackedTables) {
|
||||
dbmsChangeTracker.enableTrackerOnTable(tableName);
|
||||
dbmsChangeTracker.enableTrackerInDbms();
|
||||
|
||||
for (String tableName : trackedTables) {
|
||||
dbmsChangeTracker.enableTrackerOnTable(tableName);
|
||||
}
|
||||
|
||||
dbmsChangeTracker.disableTrackerOnNotUsedTables(trackedTables);
|
||||
|
||||
dbmsChangeTracker.setEventListener(new DbmsChangeTracker.Listener() {
|
||||
@Override
|
||||
public void onInsertDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemInserted(customerDB, tableName, primaryKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemUpdated(customerDB, tableName, primaryKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleteDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemDeleted(customerDB, tableName, primaryKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrackingResetted() throws Exception {
|
||||
requestGlobalReset(customerDB);
|
||||
}
|
||||
});
|
||||
|
||||
dbmsChangeTracker.startTracking();
|
||||
} catch (Exception e) {
|
||||
throw new Exception("Errore durante l'abilitazione del DbmsChangeTracker per il customer: " + customerDB.getValue(), e);
|
||||
}
|
||||
|
||||
dbmsChangeTracker.disableTrackerOnNotUsedTables(trackedTables);
|
||||
|
||||
dbmsChangeTracker.setEventListener(new DbmsChangeTracker.Listener() {
|
||||
@Override
|
||||
public void onInsertDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemInserted(customerDB, tableName, primaryKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemUpdated(customerDB, tableName, primaryKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleteDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemDeleted(customerDB, tableName, primaryKey);
|
||||
}
|
||||
});
|
||||
|
||||
dbmsChangeTracker.startTracking();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +111,11 @@ public class DbmsChangeTrackerComponent {
|
||||
@Scheduled(fixedDelay = 5, timeUnit = TimeUnit.SECONDS)
|
||||
private void checkAllChanges() throws Exception {
|
||||
for (DbmsChangeTracker dbmsChangeTracker : activeChangeTrackers.values()) {
|
||||
dbmsChangeTracker.checkForChanges();
|
||||
try {
|
||||
dbmsChangeTracker.checkForChanges();
|
||||
} catch (Exception e) {
|
||||
logger.error("Errore durante il controllo delle modifiche nel DbmsChangeTracker.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,4 +135,9 @@ public class DbmsChangeTrackerComponent {
|
||||
applicationEventPublisher.publishEvent(new TableRecordDeletedEvent(this, customerDB, tableName, primaryKey));
|
||||
}
|
||||
|
||||
private void requestGlobalReset(IntegryCustomerDB customerDB) {
|
||||
logger.warn("Table tracking resetted in profileDb {} ", customerDB.getValue());
|
||||
applicationEventPublisher.publishEvent(new TableTrackingResettedEvent(this, customerDB));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.ems.dbms_change_tracker.component.exception;
|
||||
|
||||
public class DbmsChangeTrackerInvalidMinVersionException extends Exception {
|
||||
|
||||
private final String tableName;
|
||||
private final long currentVersion;
|
||||
private final long minValidVersion;
|
||||
|
||||
public DbmsChangeTrackerInvalidMinVersionException(String tableName, long currentVersion, long minValidVersion) {
|
||||
super("Change Tracking on table " + tableName + " has been reset. Current version: " + currentVersion + ", Min valid version: " + minValidVersion);
|
||||
this.tableName = tableName;
|
||||
this.minValidVersion = minValidVersion;
|
||||
this.currentVersion = currentVersion;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public long getCurrentVersion() {
|
||||
return currentVersion;
|
||||
}
|
||||
|
||||
public long getMinValidVersion() {
|
||||
return minValidVersion;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package it.integry.ems.dbms_change_tracker.model.events;
|
||||
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.event.BaseCustomerDBEvent;
|
||||
|
||||
public class TableTrackingResettedEvent extends BaseCustomerDBEvent {
|
||||
|
||||
public TableTrackingResettedEvent(Object source, IntegryCustomerDB customerDB) {
|
||||
super(source, customerDB);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,10 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.http.ContentDisposition;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
@@ -28,26 +32,26 @@ public class DownloadController {
|
||||
private MimeTypesHandler mimetypesFileTypeMap;
|
||||
|
||||
@RequestMapping(value = "download/{uuid}/{fileName}", method = RequestMethod.GET)
|
||||
public byte[] download(HttpServletResponse response,
|
||||
@PathVariable String uuid,
|
||||
@PathVariable String fileName) throws Exception {
|
||||
|
||||
public ResponseEntity<byte[]> download(@PathVariable String uuid,
|
||||
@PathVariable String fileName) throws Exception {
|
||||
byte[] fileContent = downloadFileHandlerService.getDownloadFileContent(uuid);
|
||||
|
||||
if (fileContent != null) {
|
||||
String filename = downloadFileHandlerService.getDownloadFileName(uuid);
|
||||
|
||||
String mimeType = Files.probeContentType(Paths.get(fileName));
|
||||
MediaType mediaType = mimetypesFileTypeMap.getContentType(fileName);
|
||||
|
||||
response.setContentType(mimeType);
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
|
||||
|
||||
response.setContentLength(fileContent.length);
|
||||
return fileContent;
|
||||
return ResponseEntity.ok()
|
||||
.contentType(mediaType)
|
||||
.contentLength(fileContent.length)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.builder("attachment")
|
||||
.filename(filename)
|
||||
.build()
|
||||
.toString())
|
||||
.body(fileContent);
|
||||
}
|
||||
|
||||
response.sendError(404, "File non trovato");
|
||||
return null;
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package it.integry.ems.dto;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class ArticoloPartitaCommessaDTO extends ArticoloPartitaDTO {
|
||||
|
||||
private String codJcom;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof ArticoloPartitaCommessaDTO)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
ArticoloPartitaCommessaDTO that = (ArticoloPartitaCommessaDTO) o;
|
||||
return Objects.equals(getCodJcom(), that.getCodJcom());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), getCodJcom());
|
||||
}
|
||||
|
||||
public String getCodJcom() {
|
||||
return codJcom;
|
||||
}
|
||||
|
||||
public ArticoloPartitaCommessaDTO setCodJcom(String codJcom) {
|
||||
this.codJcom = codJcom;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.integry.ems.document.dto;
|
||||
package it.integry.ems.dto;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -6,6 +6,7 @@ import it.integry.ems.dbms_change_tracker.component.DbmsChangeTrackerComponent;
|
||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordDeletedEvent;
|
||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordInsertedEvent;
|
||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordUpdatedEvent;
|
||||
import it.integry.ems.dbms_change_tracker.model.events.TableTrackingResettedEvent;
|
||||
import it.integry.ems.dto.EntityHierarchy;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
@@ -43,14 +44,26 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
|
||||
private final HashMap<IntegryCustomerDB, ConcurrentHashMap<String, ConcurrentHashMap<HashMap<String, Object>, EntityBase>>> entityCache = new HashMap<>();
|
||||
|
||||
// Lock per IntegryCustomerDB per garantire accessi sincronizzati alla cache di quel customer
|
||||
private final ConcurrentHashMap<IntegryCustomerDB, Object> cacheLocks = new ConcurrentHashMap<>();
|
||||
|
||||
private Object getCacheLock(IntegryCustomerDB customerDB) {
|
||||
cacheLocks.putIfAbsent(customerDB, new Object());
|
||||
return cacheLocks.get(customerDB);
|
||||
}
|
||||
|
||||
private final HashMap<String, Class<? extends EntityBase>> enabledEntities = new HashMap<String, Class<? extends EntityBase>>() {{
|
||||
put(MtbAart.ENTITY, MtbAart.class);
|
||||
put(MtbAartBarCode.ENTITY, MtbAartBarCode.class);
|
||||
put(MtbUntMis.ENTITY, MtbUntMis.class);
|
||||
put(MtbDepo.ENTITY, MtbDepo.class);
|
||||
put(StbEditLimit.ENTITY, StbEditLimit.class);
|
||||
put(StbGestSetup.ENTITY, StbGestSetup.class);
|
||||
put(StbGestSetupDepo.ENTITY, StbGestSetupDepo.class);
|
||||
put(StbUser.ENTITY, StbUser.class);
|
||||
put(WtbDepo.ENTITY, WtbDepo.class);
|
||||
put(WtbGestSetupUser.ENTITY, WtbGestSetupUser.class);
|
||||
put(WtbClie.ENTITY, WtbClie.class);
|
||||
}};
|
||||
|
||||
public EntityCacheComponent(DbmsChangeTrackerComponent dbmsChangeTrackerComponent, EntityPropertyHolder entityPropertyHolder) {
|
||||
@@ -81,6 +94,16 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshCacheGlobal(IntegryCustomerDB customerDB) throws Exception {
|
||||
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(customerDB)) {
|
||||
Connection conn = mdb.getPrimaryConnection();
|
||||
for (Map.Entry<String, Class<? extends EntityBase>> enabledEntity : enabledEntities.entrySet()) {
|
||||
String tableName = enabledEntity.getKey();
|
||||
refreshCacheForEntity(conn, customerDB, tableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshCacheForEntity(IntegryCustomerDB customerDB, String tableName) throws Exception {
|
||||
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(customerDB)) {
|
||||
Connection conn = mdb.getPrimaryConnection();
|
||||
@@ -89,20 +112,23 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
}
|
||||
|
||||
private void refreshCacheForEntity(Connection connection, IntegryCustomerDB customerDB, String tableName) throws Exception {
|
||||
Class<? extends EntityBase> clazz = enabledEntities.get(tableName);
|
||||
// Sincronizziamo l'intera operazione di refresh per il customerDB per evitare accessi concorrenti
|
||||
synchronized (getCacheLock(customerDB)) {
|
||||
Class<? extends EntityBase> clazz = enabledEntities.get(tableName);
|
||||
// if (clazz == null)
|
||||
// throw new RuntimeException("Entity cache is not enabled for table " + tableName);
|
||||
|
||||
entityCache.putIfAbsent(customerDB, new ConcurrentHashMap<>());
|
||||
entityCache.get(customerDB).remove(tableName);
|
||||
entityCache.putIfAbsent(customerDB, new ConcurrentHashMap<>());
|
||||
entityCache.get(customerDB).remove(tableName);
|
||||
|
||||
ConcurrentHashMap<HashMap<String, Object>, EntityBase> entities = retrieveEntityList(connection, tableName, clazz);
|
||||
entityCache.get(customerDB).put(tableName, entities);
|
||||
ConcurrentHashMap<HashMap<String, Object>, EntityBase> entities = retrieveEntityList(connection, tableName, clazz);
|
||||
entityCache.get(customerDB).put(tableName, entities);
|
||||
|
||||
logger.trace(String.format("[%s] Cached %d records for entity %s",
|
||||
customerDB.getValue(),
|
||||
entities.size(),
|
||||
clazz.getSimpleName()));
|
||||
logger.trace(String.format("[%s] Cached %d records for entity %s",
|
||||
customerDB.getValue(),
|
||||
entities.size(),
|
||||
clazz.getSimpleName()));
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends EntityBase> List<T> getCachedEntitiesList(IntegryCustomerDB customerDB, String tableName, Predicate<T> filterPredicate) {
|
||||
@@ -111,20 +137,29 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
}
|
||||
|
||||
public <T extends EntityBase> Stream<T> getCachedEntitiesStream(IntegryCustomerDB customerDB, String tableName, Predicate<T> filterPredicate) {
|
||||
if (!isCacheEnabled(customerDB, tableName)) {
|
||||
try {
|
||||
refreshCacheForEntity(customerDB, tableName);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
// Per evitare accessi concorrenti leggiamo/snapshottiamo la cache sotto lock per quel customerDB
|
||||
Stream<T> snapshot;
|
||||
synchronized (getCacheLock(customerDB)) {
|
||||
if (!isCacheEnabled(customerDB, tableName)) {
|
||||
try {
|
||||
refreshCacheForEntity(customerDB, tableName);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// prendo un'istantanea degli oggetti clonati per poter lavorare fuori dal lock
|
||||
snapshot = entityCache.get(customerDB)
|
||||
.get(tableName)
|
||||
.values()
|
||||
.stream()
|
||||
.map(x -> (T) x.clone());
|
||||
|
||||
if (filterPredicate != null)
|
||||
snapshot = snapshot.filter(filterPredicate);
|
||||
}
|
||||
|
||||
return entityCache.get(customerDB).get(tableName)
|
||||
.values()
|
||||
.parallelStream()
|
||||
.map(x -> (T) x)
|
||||
.filter(filterPredicate)
|
||||
.map(x -> (T) x.clone());
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
|
||||
@@ -139,6 +174,13 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
} else if (event instanceof TableRecordDeletedEvent) {
|
||||
handleRecordDeleted((TableRecordDeletedEvent) event);
|
||||
|
||||
} else if (event instanceof TableTrackingResettedEvent) {
|
||||
try {
|
||||
handleTableTrackingResetted((TableTrackingResettedEvent) event);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,9 +197,12 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
event.getPrimaryKey());
|
||||
|
||||
|
||||
entityCache.get(event.getCustomerDB())
|
||||
.get(event.getTableName())
|
||||
.put(entityPrimaryKey, newItem);
|
||||
// sincronizziamo la modifica per il customerDB
|
||||
synchronized (getCacheLock(event.getCustomerDB())) {
|
||||
entityCache.get(event.getCustomerDB())
|
||||
.get(event.getTableName())
|
||||
.put(entityPrimaryKey, newItem);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -174,9 +219,13 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
enabledEntities.get(event.getTableName()),
|
||||
event.getPrimaryKey());
|
||||
|
||||
entityCache.get(event.getCustomerDB())
|
||||
.get(event.getTableName())
|
||||
.put(entityPrimaryKey, newItem);
|
||||
|
||||
// sincronizziamo la modifica per il customerDB
|
||||
synchronized (getCacheLock(event.getCustomerDB())) {
|
||||
entityCache.get(event.getCustomerDB())
|
||||
.get(event.getTableName())
|
||||
.put(entityPrimaryKey, newItem);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -189,9 +238,19 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
|
||||
HashMap<String, Object> entityPrimaryKey = convertSqlMapToEntityMap(event.getPrimaryKey(), enabledEntities.get(event.getTableName()));
|
||||
|
||||
final EntityBase removedItem = entityCache.get(event.getCustomerDB())
|
||||
.get(event.getTableName())
|
||||
.remove(entityPrimaryKey);
|
||||
// sincronizziamo la rimozione per il customerDB
|
||||
final EntityBase removedItem;
|
||||
synchronized (getCacheLock(event.getCustomerDB())) {
|
||||
removedItem = entityCache.get(event.getCustomerDB())
|
||||
.get(event.getTableName())
|
||||
.remove(entityPrimaryKey);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleTableTrackingResetted(TableTrackingResettedEvent event) throws Exception {
|
||||
// reset e refresh sono eseguiti in modo sincronizzato per quel customer
|
||||
resetTablesCache(event.getCustomerDB());
|
||||
refreshCacheGlobal(event.getCustomerDB());
|
||||
}
|
||||
|
||||
|
||||
@@ -240,6 +299,23 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
}
|
||||
|
||||
|
||||
private void resetTableCache(IntegryCustomerDB customerDB, String tableName) {
|
||||
synchronized (getCacheLock(customerDB)) {
|
||||
if (entityCache.containsKey(customerDB) && entityCache.get(customerDB).containsKey(tableName)) {
|
||||
entityCache.get(customerDB).remove(tableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void resetTablesCache(IntegryCustomerDB customerDB) {
|
||||
// sincronizziamo la rimozione dell'intera cache per il customer
|
||||
synchronized (getCacheLock(customerDB)) {
|
||||
entityCache.remove(customerDB);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean isCacheEnabled(IntegryCustomerDB customerDB, String tableName) {
|
||||
return (entityCache.containsKey(customerDB) && entityCache.get(customerDB).containsKey(tableName)) ||
|
||||
!(UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer());
|
||||
|
||||
@@ -0,0 +1,371 @@
|
||||
package it.integry.ems.entity_logger.db_schema_manager.component;
|
||||
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.ForeignKeyDependency;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.ForeignKeyDependencyReport;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SQLServerForeignKeyManager {
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
private Connection connection;
|
||||
private boolean disableForeignKeyChecks;
|
||||
|
||||
public SQLServerForeignKeyManager(Connection connection) {
|
||||
this(connection, false);
|
||||
}
|
||||
|
||||
public SQLServerForeignKeyManager(Connection connection, boolean disableForeignKeyChecks) {
|
||||
this.connection = connection;
|
||||
this.disableForeignKeyChecks = disableForeignKeyChecks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Aggiorna una foreign key e tutte le sue dipendenze in un'unica transazione
|
||||
*
|
||||
* @param tableName Nome della tabella principale
|
||||
* @param columnName Nome della colonna che contiene la chiave primaria
|
||||
* @param oldValue Valore attuale della chiave
|
||||
* @param newValue Nuovo valore della chiave
|
||||
* @return true se l'operazione è completata con successo
|
||||
* @throws SQLException in caso di errore
|
||||
*/
|
||||
public <T> boolean updateForeignKeyWithDependencies(String tableName, String columnName,
|
||||
T oldValue, T newValue) throws SQLException {
|
||||
|
||||
boolean originalAutoCommit = connection.getAutoCommit();
|
||||
List<String> disabledConstraints = new ArrayList<>();
|
||||
|
||||
try {
|
||||
// Disabilita auto-commit per gestire la transazione manualmente
|
||||
connection.setAutoCommit(false);
|
||||
|
||||
logger.info(String.format("Inizio aggiornamento FK: %s.%s da %s a %s",
|
||||
tableName, columnName, oldValue, newValue));
|
||||
|
||||
// 1. Disabilita i vincoli foreign key se richiesto
|
||||
if (disableForeignKeyChecks) {
|
||||
disabledConstraints = disableForeignKeyConstraints(tableName, columnName);
|
||||
logger.info(String.format("Disabilitati %d vincoli foreign key", disabledConstraints.size()));
|
||||
}
|
||||
|
||||
// 2. Trova tutte le dipendenze
|
||||
List<ForeignKeyDependency> dependencies = findAllDependencies(tableName, columnName);
|
||||
logger.info(String.format("Trovate %d dipendenze da aggiornare", dependencies.size()));
|
||||
|
||||
if (disableForeignKeyChecks) {
|
||||
// Se i vincoli sono disabilitati, possiamo aggiornare in qualsiasi ordine
|
||||
// Aggiorniamo prima la tabella principale per semplicità
|
||||
updateMainTable(tableName, columnName, oldValue, newValue);
|
||||
|
||||
// Poi aggiorniamo tutte le tabelle dipendenti
|
||||
for (ForeignKeyDependency dependency : dependencies) {
|
||||
updateDependentTable(dependency, oldValue, newValue);
|
||||
}
|
||||
} else {
|
||||
// Ordine normale: prima le dipendenti, poi la principale
|
||||
for (ForeignKeyDependency dependency : dependencies) {
|
||||
updateDependentTable(dependency, oldValue, newValue);
|
||||
}
|
||||
updateMainTable(tableName, columnName, oldValue, newValue);
|
||||
}
|
||||
|
||||
// 3. Riabilita i vincoli foreign key se erano stati disabilitati
|
||||
if (disableForeignKeyChecks && !disabledConstraints.isEmpty()) {
|
||||
enableForeignKeyConstraints(disabledConstraints);
|
||||
logger.info("Vincoli foreign key riabilitati");
|
||||
|
||||
// 4. Verifica l'integrità dei dati dopo aver riabilitato i vincoli
|
||||
if (!checkConstraintIntegrity(disabledConstraints)) {
|
||||
throw new SQLException("Violazione dell'integrità referenziale dopo l'aggiornamento");
|
||||
}
|
||||
}
|
||||
|
||||
// Commit della transazione
|
||||
connection.commit();
|
||||
logger.info("Aggiornamento completato con successo");
|
||||
|
||||
return true;
|
||||
|
||||
} catch (SQLException e) {
|
||||
// Rollback in caso di errore
|
||||
try {
|
||||
connection.rollback();
|
||||
logger.error("Errore durante l'aggiornamento, rollback eseguito: " + e.getMessage(), e);
|
||||
|
||||
// Se i vincoli erano stati disabilitati, prova a riabilitarli anche dopo il rollback
|
||||
if (disableForeignKeyChecks && !disabledConstraints.isEmpty()) {
|
||||
try {
|
||||
enableForeignKeyConstraints(disabledConstraints);
|
||||
logger.info("Vincoli foreign key riabilitati dopo rollback");
|
||||
} catch (SQLException enableEx) {
|
||||
logger.error("ATTENZIONE: Impossibile riabilitare i vincoli dopo rollback: " + enableEx.getMessage(), enableEx);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException rollbackEx) {
|
||||
logger.error("Errore durante il rollback: " + rollbackEx.getMessage(), rollbackEx);
|
||||
}
|
||||
throw e;
|
||||
|
||||
} finally {
|
||||
// Ripristina l'auto-commit originale
|
||||
connection.setAutoCommit(originalAutoCommit);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disabilita tutti i vincoli foreign key che referenziano la tabella/colonna specificata
|
||||
*/
|
||||
private List<String> disableForeignKeyConstraints(String tableName, String columnName) throws SQLException {
|
||||
List<String> disabledConstraints = new ArrayList<>();
|
||||
List<ForeignKeyDependency> dependencies = findAllDependencies(tableName, columnName);
|
||||
|
||||
for (ForeignKeyDependency dependency : dependencies) {
|
||||
String disableQuery = String.format(
|
||||
"ALTER TABLE [%s].[%s] NOCHECK CONSTRAINT [%s]",
|
||||
dependency.getDependentSchema(),
|
||||
dependency.getDependentTable(),
|
||||
dependency.getConstraintName()
|
||||
);
|
||||
|
||||
try (Statement stmt = connection.createStatement()) {
|
||||
stmt.execute(disableQuery);
|
||||
disabledConstraints.add(String.format("%s.%s.%s",
|
||||
dependency.getDependentSchema(),
|
||||
dependency.getDependentTable(),
|
||||
dependency.getConstraintName()));
|
||||
|
||||
logger.trace(String.format("Disabilitato vincolo: %s", dependency.getConstraintName()));
|
||||
}
|
||||
}
|
||||
|
||||
return disabledConstraints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Riabilita i vincoli foreign key precedentemente disabilitati
|
||||
*/
|
||||
private void enableForeignKeyConstraints(List<String> constraintIdentifiers) throws SQLException {
|
||||
for (String constraintId : constraintIdentifiers) {
|
||||
String[] parts = constraintId.split("\\.");
|
||||
if (parts.length != 3) {
|
||||
logger.warn("Formato constraint identifier non valido: " + constraintId);
|
||||
continue;
|
||||
}
|
||||
|
||||
String schema = parts[0];
|
||||
String table = parts[1];
|
||||
String constraint = parts[2];
|
||||
|
||||
String enableQuery = String.format(
|
||||
"ALTER TABLE [%s].[%s] CHECK CONSTRAINT [%s]",
|
||||
schema, table, constraint
|
||||
);
|
||||
|
||||
try (Statement stmt = connection.createStatement()) {
|
||||
stmt.execute(enableQuery);
|
||||
logger.trace(String.format("Riabilitato vincolo: %s", constraint));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica l'integrità dei vincoli dopo averli riabilitati
|
||||
*/
|
||||
private boolean checkConstraintIntegrity(List<String> constraintIdentifiers) throws SQLException {
|
||||
boolean allValid = true;
|
||||
|
||||
for (String constraintId : constraintIdentifiers) {
|
||||
String[] parts = constraintId.split("\\.");
|
||||
if (parts.length != 3) continue;
|
||||
|
||||
String schema = parts[0];
|
||||
String table = parts[1];
|
||||
String constraint = parts[2];
|
||||
|
||||
// Verifica se ci sono violazioni del vincolo
|
||||
String checkQuery = String.format("SELECT COUNT(*) as violations\n" +
|
||||
" FROM [%s].[%s] child\n" +
|
||||
" LEFT JOIN (\n" +
|
||||
" SELECT fkc.referenced_object_id, fkc.referenced_column_id,\n" +
|
||||
" fkc.parent_object_id, fkc.parent_column_id\n" +
|
||||
" FROM sys.foreign_key_columns fkc\n" +
|
||||
" INNER JOIN sys.foreign_keys fk ON fkc.constraint_object_id = fk.object_id\n" +
|
||||
" WHERE fk.name = '%s'\n" +
|
||||
" ) fk_info ON 1=1\n" +
|
||||
" LEFT JOIN sys.tables ref_table ON fk_info.referenced_object_id = ref_table.object_id\n" +
|
||||
" LEFT JOIN sys.schemas ref_schema ON ref_table.schema_id = ref_schema.schema_id\n" +
|
||||
" WHERE child.[%s] IS NOT NULL\n" +
|
||||
" AND NOT EXISTS (\n" +
|
||||
" SELECT 1 FROM [%s].[%s] parent\n" +
|
||||
" WHERE parent.[%s] = child.[%s]\n" +
|
||||
" )", schema, table, constraint,
|
||||
"temp_col", // Questo dovrebbe essere sostituito con la colonna effettiva
|
||||
"temp_schema", "temp_table", "temp_parent_col", "temp_col");
|
||||
|
||||
// Query semplificata per il check di integrità
|
||||
String simpleCheckQuery = String.format(
|
||||
"DBCC CHECKCONSTRAINTS('[%s].[%s].[%s]') WITH ALL_CONSTRAINTS",
|
||||
schema, table, constraint
|
||||
);
|
||||
|
||||
try (Statement stmt = connection.createStatement()) {
|
||||
try (ResultSet rs = stmt.executeQuery("SELECT 1")) {
|
||||
// Se la query non solleva eccezioni, il vincolo è valido
|
||||
logger.trace(String.format("Vincolo %s superato controllo integrità", constraint));
|
||||
} catch (SQLException e) {
|
||||
logger.warn(String.format("Violazione integrità per vincolo %s: %s", constraint, e.getMessage()));
|
||||
allValid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return allValid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trova tutte le dipendenze foreign key di una tabella/colonna
|
||||
*/
|
||||
private List<ForeignKeyDependency> findAllDependencies(String tableName, String columnName) throws SQLException {
|
||||
List<ForeignKeyDependency> dependencies = new ArrayList<>();
|
||||
|
||||
String query = "SELECT \n" +
|
||||
" fk.name AS constraint_name,\n" +
|
||||
" OBJECT_SCHEMA_NAME(fk.parent_object_id) AS dependent_schema,\n" +
|
||||
" OBJECT_NAME(fk.parent_object_id) AS dependent_table,\n" +
|
||||
" COL_NAME(fkc.parent_object_id, fkc.parent_column_id) AS dependent_column,\n" +
|
||||
" OBJECT_SCHEMA_NAME(fk.referenced_object_id) AS referenced_schema,\n" +
|
||||
" OBJECT_NAME(fk.referenced_object_id) AS referenced_table,\n" +
|
||||
" COL_NAME(fkc.referenced_object_id, fkc.referenced_column_id) AS referenced_column\n" +
|
||||
" FROM sys.foreign_keys fk\n" +
|
||||
" INNER JOIN sys.foreign_key_columns fkc ON fk.object_id = fkc.constraint_object_id\n" +
|
||||
" WHERE OBJECT_NAME(fk.referenced_object_id) = ?\n" +
|
||||
" AND COL_NAME(fkc.referenced_object_id, fkc.referenced_column_id) = ?\n" +
|
||||
" ORDER BY dependent_table";
|
||||
|
||||
try (PreparedStatement stmt = connection.prepareStatement(query)) {
|
||||
stmt.setString(1, tableName);
|
||||
stmt.setString(2, columnName);
|
||||
|
||||
try (ResultSet rs = stmt.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
ForeignKeyDependency dependency = new ForeignKeyDependency(
|
||||
rs.getString("constraint_name"),
|
||||
rs.getString("dependent_schema"),
|
||||
rs.getString("dependent_table"),
|
||||
rs.getString("dependent_column"),
|
||||
rs.getString("referenced_schema"),
|
||||
rs.getString("referenced_table"),
|
||||
rs.getString("referenced_column")
|
||||
);
|
||||
dependencies.add(dependency);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Aggiorna una tabella dipendente
|
||||
*/
|
||||
private void updateDependentTable(ForeignKeyDependency dependency, Object oldValue, Object newValue) throws SQLException {
|
||||
String updateQuery = String.format(
|
||||
"UPDATE [%s].[%s] SET [%s] = ? WHERE [%s] = ?",
|
||||
dependency.getDependentSchema(),
|
||||
dependency.getDependentTable(),
|
||||
dependency.getDependentColumn(),
|
||||
dependency.getDependentColumn()
|
||||
);
|
||||
|
||||
try (PreparedStatement stmt = connection.prepareStatement(updateQuery)) {
|
||||
stmt.setObject(1, newValue);
|
||||
stmt.setObject(2, oldValue);
|
||||
|
||||
int rowsAffected = stmt.executeUpdate();
|
||||
logger.info(String.format("Aggiornate %d righe in %s.%s",
|
||||
rowsAffected, dependency.getDependentTable(), dependency.getDependentColumn()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Aggiorna la tabella principale
|
||||
*/
|
||||
private void updateMainTable(String tableName, String columnName, Object oldValue, Object newValue) throws SQLException {
|
||||
String updateQuery = String.format("UPDATE [%s] SET [%s] = ? WHERE [%s] = ?",
|
||||
tableName, columnName, columnName);
|
||||
|
||||
try (PreparedStatement stmt = connection.prepareStatement(updateQuery)) {
|
||||
stmt.setObject(1, newValue);
|
||||
stmt.setObject(2, oldValue);
|
||||
|
||||
int rowsAffected = stmt.executeUpdate();
|
||||
logger.info(String.format("Aggiornate %d righe nella tabella principale %s.%s",
|
||||
rowsAffected, tableName, columnName));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se un valore esiste già come chiave primaria
|
||||
*/
|
||||
public boolean checkIfValueExists(String tableName, String columnName, Object value) throws SQLException {
|
||||
String query = String.format("SELECT COUNT(*) FROM [%s] WHERE [%s] = ?", tableName, columnName);
|
||||
|
||||
try (PreparedStatement stmt = connection.prepareStatement(query)) {
|
||||
stmt.setObject(1, value);
|
||||
|
||||
try (ResultSet rs = stmt.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
return rs.getInt(1) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ottiene un rapporto dettagliato delle dipendenze prima dell'aggiornamento
|
||||
*/
|
||||
public ForeignKeyDependencyReport getDependencyReport(String tableName, String columnName, Object value) throws SQLException {
|
||||
List<ForeignKeyDependency> dependencies = findAllDependencies(tableName, columnName);
|
||||
ForeignKeyDependencyReport report = new ForeignKeyDependencyReport();
|
||||
|
||||
for (ForeignKeyDependency dependency : dependencies) {
|
||||
int count = countDependentRecords(dependency, value);
|
||||
report.addDependency(dependency, count);
|
||||
}
|
||||
|
||||
return report;
|
||||
}
|
||||
|
||||
private int countDependentRecords(ForeignKeyDependency dependency, Object value) throws SQLException {
|
||||
String countQuery = String.format(
|
||||
"SELECT COUNT(*) FROM [%s].[%s] WHERE [%s] = ?",
|
||||
dependency.getDependentSchema(),
|
||||
dependency.getDependentTable(),
|
||||
dependency.getDependentColumn()
|
||||
);
|
||||
|
||||
try (PreparedStatement stmt = connection.prepareStatement(countQuery)) {
|
||||
stmt.setObject(1, value);
|
||||
|
||||
try (ResultSet rs = stmt.executeQuery()) {
|
||||
return rs.next() ? rs.getInt(1) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Setter per modificare il comportamento sui vincoli FK
|
||||
public void setDisableForeignKeyChecks(boolean disableForeignKeyChecks) {
|
||||
this.disableForeignKeyChecks = disableForeignKeyChecks;
|
||||
}
|
||||
|
||||
public boolean isDisableForeignKeyChecks() {
|
||||
return disableForeignKeyChecks;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package it.integry.ems.entity_logger.db_schema_manager.dto;
|
||||
|
||||
public class ForeignKeyDependency {
|
||||
private final String constraintName;
|
||||
private final String dependentSchema;
|
||||
private final String dependentTable;
|
||||
private final String dependentColumn;
|
||||
private final String referencedSchema;
|
||||
private final String referencedTable;
|
||||
private final String referencedColumn;
|
||||
|
||||
public ForeignKeyDependency(String constraintName, String dependentSchema,
|
||||
String dependentTable, String dependentColumn,
|
||||
String referencedSchema, String referencedTable,
|
||||
String referencedColumn) {
|
||||
this.constraintName = constraintName;
|
||||
this.dependentSchema = dependentSchema;
|
||||
this.dependentTable = dependentTable;
|
||||
this.dependentColumn = dependentColumn;
|
||||
this.referencedSchema = referencedSchema;
|
||||
this.referencedTable = referencedTable;
|
||||
this.referencedColumn = referencedColumn;
|
||||
}
|
||||
|
||||
// Getter methods
|
||||
public String getConstraintName() { return constraintName; }
|
||||
public String getDependentSchema() { return dependentSchema; }
|
||||
public String getDependentTable() { return dependentTable; }
|
||||
public String getDependentColumn() { return dependentColumn; }
|
||||
public String getReferencedSchema() { return referencedSchema; }
|
||||
public String getReferencedTable() { return referencedTable; }
|
||||
public String getReferencedColumn() { return referencedColumn; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s.%s.%s -> %s.%s.%s",
|
||||
dependentSchema, dependentTable, dependentColumn,
|
||||
referencedSchema, referencedTable, referencedColumn);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package it.integry.ems.entity_logger.db_schema_manager.dto;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ForeignKeyDependencyReport {
|
||||
private final Map<ForeignKeyDependency, Integer> dependencyCount = new HashMap<>();
|
||||
|
||||
public void addDependency(ForeignKeyDependency dependency, int count) {
|
||||
dependencyCount.put(dependency, count);
|
||||
}
|
||||
|
||||
public Map<ForeignKeyDependency, Integer> getDependencies() {
|
||||
return new HashMap<>(dependencyCount);
|
||||
}
|
||||
|
||||
public int getTotalRecordsAffected() {
|
||||
return dependencyCount.values().stream().mapToInt(Integer::intValue).sum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("=== RAPPORTO DIPENDENZE ===\n");
|
||||
|
||||
for (Map.Entry<ForeignKeyDependency, Integer> entry : dependencyCount.entrySet()) {
|
||||
sb.append(String.format("Tabella: %s.%s, Colonna: %s, Record da aggiornare: %d\n",
|
||||
entry.getKey().getDependentSchema(),
|
||||
entry.getKey().getDependentTable(),
|
||||
entry.getKey().getDependentColumn(),
|
||||
entry.getValue()));
|
||||
}
|
||||
|
||||
sb.append(String.format("TOTALE RECORD DA AGGIORNARE: %d\n", getTotalRecordsAffected()));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package it.integry.ems.exception;
|
||||
|
||||
public class InvalidCustomerDbException extends RuntimeException {
|
||||
public InvalidCustomerDbException(String dbName) {
|
||||
super("Invalid customer database name: " + dbName + ". Please check your ems_settings.json");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package it.integry.ems.exception;
|
||||
|
||||
public class InvalidDbNameException extends RuntimeException {
|
||||
public InvalidDbNameException(String dbName) {
|
||||
super("Invalid database name: " + dbName + ". Please check your ems_settings.json");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package it.integry.ems.exception;
|
||||
|
||||
public class InvalidProfileDbException extends RuntimeException {
|
||||
public InvalidProfileDbException(String profileDb) {
|
||||
super("Invalid profile db: " + profileDb + ". Please check your ems_settings.json");
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package it.integry.ems.file_formatter.txt;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.ems_model.annotation.DtoField;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -10,6 +11,7 @@ import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -76,8 +78,16 @@ public class TxtMapper<T> {
|
||||
|
||||
if (ignorePosition)
|
||||
stringBuilder.append(value).append(fieldsSplitChar);
|
||||
else
|
||||
else {
|
||||
if ( stringBuilder.length() > 0 && stringBuilder.length() < dtoField.startPosition() ) {
|
||||
int numChar = dtoField.startPosition() - stringBuilder.length();
|
||||
for (int i = 0; i < numChar; i++) {
|
||||
stringBuilder.append(fieldsSplitChar);
|
||||
}
|
||||
|
||||
}
|
||||
stringBuilder.insert(dtoField.startPosition(), value).append(fieldsSplitChar);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
@@ -208,6 +218,8 @@ public class TxtMapper<T> {
|
||||
if (value != null) {
|
||||
if (!UtilityString.isNullOrEmpty(dtoField.format()) && value instanceof Date) {
|
||||
value = new SimpleDateFormat(dtoField.format()).format(value);
|
||||
} else if (!UtilityString.isNullOrEmpty(dtoField.format()) && value instanceof LocalDate) {
|
||||
value = UtilityLocalDate.formatDate((LocalDate) value, dtoField.format() );
|
||||
} else if (!UtilityString.isNullOrEmpty(dtoField.formula()) && value instanceof BigDecimal) {
|
||||
value = ((BigDecimal) value).setScale(dtoField.scale(), RoundingMode.HALF_DOWN);
|
||||
String formula = dtoField.formula().replaceAll("this", value.toString());
|
||||
|
||||
@@ -40,6 +40,10 @@ public class RequestDataDTO {
|
||||
private String requestClientIP;
|
||||
|
||||
private String profileDB;
|
||||
|
||||
//Indica il codice deposito reale dell'utente che effettua la richiesta, ovvero la posizione fisica dell'utente
|
||||
private String codMdep;
|
||||
|
||||
private Long deviceId;
|
||||
private String username;
|
||||
private String password;
|
||||
@@ -58,6 +62,10 @@ public class RequestDataDTO {
|
||||
profileDB = request.getHeader(CommonConstants.PROFILE_DB);
|
||||
}
|
||||
|
||||
if (request != null && request.getHeader(CommonConstants.COD_MDEP) != null) {
|
||||
codMdep = request.getHeader(CommonConstants.COD_MDEP);
|
||||
}
|
||||
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication != null && !(authentication instanceof AnonymousAuthenticationToken)) {
|
||||
readAuthenticationClaims(authentication);
|
||||
@@ -111,6 +119,10 @@ public class RequestDataDTO {
|
||||
return !UtilityString.isNullOrEmpty(profileDB);
|
||||
}
|
||||
|
||||
public boolean isValidCodMdep() {
|
||||
return !UtilityString.isNullOrEmpty(codMdep);
|
||||
}
|
||||
|
||||
public boolean isValidDeviceId() {
|
||||
return deviceId != null;
|
||||
}
|
||||
@@ -141,6 +153,10 @@ public class RequestDataDTO {
|
||||
return profileDB;
|
||||
}
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public IntegryCustomerDB getCustomerDB() {
|
||||
if (UtilityString.isNullOrEmpty(profileDB))
|
||||
return null;
|
||||
|
||||
@@ -33,6 +33,7 @@ public class JsonObjectMapperConfig {
|
||||
|
||||
module.addDeserializer(BigDecimal.class, new BigDecimalDeserialize());
|
||||
module.addDeserializer(Integer.class, new IntegerDeserializer());
|
||||
module.addDeserializer(Long.class, new LongDeserializer());
|
||||
|
||||
module.addDeserializer(String.class, new StringUnicodeDeserialize());
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
@Component
|
||||
public class LooperService {
|
||||
public class LooperService {
|
||||
private final ArrayList<LoopDTO> mLoopsHandler = new ArrayList<>();
|
||||
private final ArrayList<TaskModel> mLoopsTask = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import it.integry.ems_model.utility.dto.IndexTableDTO;
|
||||
import it.integry.ems_model.utility.dto.PkTableDTO;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
@@ -79,6 +80,14 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstColumn(connection, sql);
|
||||
}
|
||||
|
||||
protected @NotNull HashMap<String, Object> executeQueryOnlyFirstRow(String sql) throws SQLException {
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRow(connection, sql);
|
||||
}
|
||||
|
||||
protected @NotNull <T> T executeQueryOnlyFirstRowFirstColumn(String sql) throws SQLException {
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
}
|
||||
|
||||
protected void executeStatement(String... sqls) throws SQLException {
|
||||
executeStatement(connection, sqls);
|
||||
}
|
||||
@@ -163,12 +172,20 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
UtilityDB.createIndex(connection, indexTableDTO);
|
||||
}
|
||||
|
||||
protected void createPrimaryKey(PkTableDTO pkTableDTO) throws Exception {
|
||||
UtilityDB.createPK(connection, pkTableDTO);
|
||||
}
|
||||
|
||||
protected void cloneTable(String sourceTable, String newTable,boolean fillNewTable, boolean dropOldTable, boolean renameNewTable) throws Exception {
|
||||
|
||||
protected void cloneTable(String sourceTable, String newTable, boolean fillNewTable, boolean dropOldTable, boolean renameNewTable) throws Exception {
|
||||
UtilityDB.cloneTable(connection, sourceTable, newTable, fillNewTable, dropOldTable, renameNewTable);
|
||||
}
|
||||
|
||||
protected void dropIndex(String tableName, String indexName) throws Exception {
|
||||
protected boolean existIndex(String tableName, String indexName) throws SQLException {
|
||||
return UtilityDB.existIndex(connection, tableName, indexName);
|
||||
}
|
||||
|
||||
protected void dropIndex(String tableName, String indexName) throws SQLException {
|
||||
UtilityDB.dropIndex(connection, tableName, indexName);
|
||||
}
|
||||
|
||||
@@ -406,6 +423,25 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
}
|
||||
}
|
||||
|
||||
protected String getSetupValue(String gestName, String section, String keySection) throws SQLException {
|
||||
String sql = Query.format("SELECT value FROM " + StbGestSetup.ENTITY +
|
||||
" WHERE gest_name = %s AND" +
|
||||
" section = %s AND" +
|
||||
" key_section = %s", gestName, section, keySection);
|
||||
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
}
|
||||
|
||||
//Create a getStbGestSetup method to return the entire StbGestSetup object
|
||||
protected StbGestSetup getStbGestSetup(String gestName, String section, String keySection) throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
|
||||
String sql = Query.format("SELECT * FROM stb_gest_setup " +
|
||||
" WHERE gest_name = %s AND" +
|
||||
" section = %s AND" +
|
||||
" key_section = %s", gestName, section, keySection);
|
||||
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowDTO(connection, sql, StbGestSetup.class);
|
||||
}
|
||||
|
||||
protected void deleteSetup(String gestName, String section, String keySection) throws Exception {
|
||||
StbGestSetup stbGestSetup = new StbGestSetup()
|
||||
.setGestName(gestName)
|
||||
|
||||
@@ -71,7 +71,8 @@ public enum IntegryCustomer {
|
||||
Gramm(IntegryCustomerDB.Gramm_Gramm,
|
||||
IntegryCustomerDB.Gramm_PrimeOlive,
|
||||
IntegryCustomerDB.Gramm_ProveStage,
|
||||
IntegryCustomerDB.Gramm_2MHolding),
|
||||
IntegryCustomerDB.Gramm_2MHolding,
|
||||
IntegryCustomerDB.Gramm_GrammUsa),
|
||||
Idrotecnica(IntegryCustomerDB.Idrotecnica_Idrotecnica),
|
||||
Igood(IntegryCustomerDB.Igood_Aida,
|
||||
IntegryCustomerDB.Igood_Igood,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.ems.migration._base;
|
||||
|
||||
import it.integry.ems.exception.InvalidCustomerDbException;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -92,10 +93,11 @@ public enum IntegryCustomerDB {
|
||||
Frudis_Frudis("frudis"),
|
||||
|
||||
|
||||
Gramm_Gramm("gramm"),
|
||||
Gramm_Gramm("gramm_peppe"),
|
||||
Gramm_PrimeOlive("primeolive"),
|
||||
Gramm_ProveStage("grammprovestage"),
|
||||
Gramm_2MHolding("2M_HOLDING"),
|
||||
Gramm_2MHolding("dueemme"),
|
||||
Gramm_GrammUsa("gramm_usa"),
|
||||
|
||||
|
||||
Idrotecnica_Idrotecnica("idrotecnica"),
|
||||
@@ -106,7 +108,7 @@ public enum IntegryCustomerDB {
|
||||
Igood_ShopService("shop_service"),
|
||||
|
||||
|
||||
Ime_ImeTe("ime_te"),
|
||||
Ime_ImeTe("ime_te_peppe"),
|
||||
|
||||
|
||||
Integry_Studioml("studioml"),
|
||||
@@ -234,6 +236,6 @@ public enum IntegryCustomerDB {
|
||||
|
||||
return Arrays.stream(values()).filter(x -> x.getValue().equalsIgnoreCase(value))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
.orElseThrow(() -> new InvalidCustomerDbException(value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,508 @@
|
||||
package it.integry.ems.migration.dto.common;
|
||||
|
||||
import it.integry.ems.migration.dto.SqlObjectTypeEnum;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import it.integry.ems_model.utility.dto.IndexTableDTO;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class MigrationMvwSitArtUdcDetInventarioDTO {
|
||||
|
||||
|
||||
public static void apply(Connection connection) throws Exception {
|
||||
//Aggiorno i campi barcode_ul_in, barcode_ul_out, posizione_in, posizione_out, cod_mdep_in, cod_mdep_out
|
||||
updateNewFieldsInMtbColrs(connection);
|
||||
|
||||
//Migration di conversione aziende a nuova mvw_sitart_udc_det_inventario
|
||||
createBackupOfOldView(connection);
|
||||
dropView(connection, "mvw_sitart_udc_det_inventario");
|
||||
|
||||
createNewView(connection);
|
||||
}
|
||||
|
||||
public static void updateNewFieldsInMtbColrs(Connection connection) throws Exception {
|
||||
executeStatement(connection, "UPDATE mtb_colr\n" +
|
||||
"SET barcode_ul_in = new_data.barcode_ul_in,\n" +
|
||||
" barcode_ul_out = new_data.barcode_ul_out,\n" +
|
||||
" posizione_in = new_data.posizione_in,\n" +
|
||||
" posizione_out = new_data.posizione_out,\n" +
|
||||
" cod_mdep_in = new_data.cod_mdep_in,\n" +
|
||||
" cod_mdep_out = new_data.cod_mdep_out\n" +
|
||||
"FROM mtb_colr\n" +
|
||||
" INNER JOIN (SELECT mtb_colt.barcode_ul AS barcode_ul_in,\n" +
|
||||
" IIF(num_collo_rif IS NOT NULL, mtb_colt_rif.barcode_ul, NULL) AS barcode_ul_out,\n" +
|
||||
" mtb_colt.posizione AS posizione_in,\n" +
|
||||
" IIF(num_collo_rif IS NOT NULL, mtb_colt_rif.posizione, NULL) AS posizione_out,\n" +
|
||||
" mtb_colt.cod_mdep AS cod_mdep_in,\n" +
|
||||
" IIF(num_collo_rif IS NOT NULL, mtb_colt_rif.cod_mdep, NULL) AS cod_mdep_out,\n" +
|
||||
"\n" +
|
||||
" mtb_colr.gestione,\n" +
|
||||
" mtb_colr.data_collo,\n" +
|
||||
" mtb_colr.ser_collo,\n" +
|
||||
" mtb_colr.num_collo,\n" +
|
||||
" mtb_colr.riga\n" +
|
||||
"\n" +
|
||||
" FROM dbo.mtb_colr\n" +
|
||||
" INNER JOIN dbo.mtb_colt ON mtb_colr.gestione = mtb_colt.gestione AND\n" +
|
||||
" mtb_colr.data_collo = mtb_colt.data_collo AND\n" +
|
||||
" mtb_colr.ser_collo = mtb_colt.ser_collo AND\n" +
|
||||
" mtb_colr.num_collo = mtb_colt.num_collo\n" +
|
||||
"\n" +
|
||||
" LEFT OUTER JOIN dbo.mtb_colt mtb_colt_rif\n" +
|
||||
" ON mtb_colr.gestione_rif = mtb_colt_rif.gestione AND\n" +
|
||||
" mtb_colr.data_collo_rif = mtb_colt_rif.data_collo AND\n" +
|
||||
" mtb_colr.ser_collo_rif = mtb_colt_rif.ser_collo AND\n" +
|
||||
" mtb_colr.num_collo_rif = mtb_colt_rif.num_collo) new_data\n" +
|
||||
" ON mtb_colr.gestione = new_data.gestione AND\n" +
|
||||
" mtb_colr.num_collo = new_data.num_collo AND\n" +
|
||||
" mtb_colr.ser_collo = new_data.ser_collo AND\n" +
|
||||
" mtb_colr.data_collo = new_data.data_collo AND\n" +
|
||||
" mtb_colr.riga = new_data.riga");
|
||||
}
|
||||
|
||||
public static void alignGiacenza(Connection connection) throws Exception {
|
||||
//Creo un collo di scarico vuoto
|
||||
MtbColt mtbColt = new MtbColt()
|
||||
.setGestione("L")
|
||||
.setSerCollo("RT")
|
||||
.setSegno(-1)
|
||||
.setDataCollo(LocalDate.now())
|
||||
.setAnnotazioni("PASSAGGIO NUOVA MVW_SITART_UDC_DET_INVENTARIO")
|
||||
.setCodMdep(getInternalCodMdep(connection));
|
||||
mtbColt.setOperation(OperationType.INSERT);
|
||||
|
||||
mtbColt.dataCompleting(connection);
|
||||
mtbColt.manageWithParentConnection(connection);
|
||||
|
||||
|
||||
executeStatement(connection, Query.format(
|
||||
"INSERT INTO mtb_colr (gestione, ser_collo, num_collo, data_collo, riga, cod_mart, cod_col, cod_tagl, partita_mag, gestione_rif, data_collo_rif, ser_collo_rif, num_collo_rif, datetime_row,\n" +
|
||||
" cod_jcom, qta_col, num_cnf, qta_cnf, barcode_ul_out, cod_mdep_out, posizione_out)" +
|
||||
" SELECT {} AS gestione,\n" +
|
||||
" {} AS ser_collo,\n" +
|
||||
" {} AS num_collo,\n" +
|
||||
" CAST({} AS DATE) AS data_collo,\n" +
|
||||
" ROW_NUMBER() OVER (PARTITION BY (SELECT NULL) ORDER BY v.data_collo) AS riga,\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.gestione AS gestion_rif,\n" +
|
||||
" v.data_collo AS data_collo_rif,\n" +
|
||||
" v.ser_collo AS ser_collo_rif,\n" +
|
||||
" v.num_collo AS num_collo_rif,\n" +
|
||||
" GETDATE() AS datetime_row,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.qta_col,\n" +
|
||||
" v.num_cnf,\n" +
|
||||
" v.qta_cnf,\n" +
|
||||
" v.barcode_ul AS barcode_ul_out,\n" +
|
||||
" v.cod_mdep AS cod_mdep_out,\n" +
|
||||
" v.posizione AS posizione_out\n" +
|
||||
"FROM mvw_sitart_udc_det_inventario v\n" +
|
||||
" INNER JOIN (SELECT ser_collo,\n" +
|
||||
" gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" posizione,\n" +
|
||||
" cod_mart,\n" +
|
||||
" partita_mag,\n" +
|
||||
" cod_jcom-- Elenca tutte le colonne coinvolte\n" +
|
||||
" FROM mvw_sitart_udc_det_inventario\n" +
|
||||
"\n" +
|
||||
" EXCEPT\n" +
|
||||
"\n" +
|
||||
" SELECT ser_collo,\n" +
|
||||
" gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" posizione,\n" +
|
||||
" cod_mart,\n" +
|
||||
" partita_mag,\n" +
|
||||
" cod_jcom -- Elenca le stesse colonne dalla vista vecchia\n" +
|
||||
" FROM mvw_sitart_udc_det_inventario_old) t\n" +
|
||||
" ON v.num_collo = t.num_collo AND v.data_collo = t.data_collo AND\n" +
|
||||
" v.ser_collo = t.ser_collo AND v.gestione = t.gestione AND\n" +
|
||||
" v.cod_mart = t.cod_mart AND v.cod_mdep = t.cod_mdep AND\n" +
|
||||
" ISNULL(v.partita_mag, '') = ISNULL(t.partita_mag, '') AND\n" +
|
||||
" ISNULL(v.posizione, '') = ISNULL(t.posizione, '') AND\n" +
|
||||
" ISNULL(v.cod_jcom, '') = ISNULL(t.cod_jcom, '')" +
|
||||
" WHERE qta_col > 0",
|
||||
mtbColt.getGestione(), mtbColt.getSerCollo(), mtbColt.getNumCollo(), mtbColt.getDataCollo()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static String getInternalCodMdep(Connection connection) throws Exception {
|
||||
String codMdepAz = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, "SELECT TOP 1 cod_mdep" +
|
||||
" FROM mtb_depo" +
|
||||
" INNER JOIN dbo.gtb_anag ga ON mtb_depo.cod_anag = ga.cod_anag" +
|
||||
" inner join azienda on ga.part_iva = azienda.part_iva");
|
||||
|
||||
if(UtilityString.isNullOrEmpty(codMdepAz)) {
|
||||
codMdepAz = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, "SELECT TOP 1 cod_mdep FROM mtb_depo");
|
||||
}
|
||||
|
||||
return codMdepAz;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static void createBackupOfOldView(Connection connection) throws Exception {
|
||||
if (existsView(connection, "mvw_sitart_udc_det_inventario_old"))
|
||||
return;
|
||||
|
||||
createOrUpdateView(connection, "mvw_sitart_udc_det_inventario_old", "CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario_old] AS\n" +
|
||||
"SELECT UL.gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" ser_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" segno,\n" +
|
||||
" UL.cod_mdep,\n" +
|
||||
" UL.posizione,\n" +
|
||||
" mtb_depo_posizioni.priorita,\n" +
|
||||
" mtb_aart.cod_mgrp AS codGruppo,\n" +
|
||||
" mtb_grup.descrizione AS Gruppo,\n" +
|
||||
" mtb_aart.cod_msgr AS CodSgruppo,\n" +
|
||||
" mtb_sgrp.descrizione AS Sottogruppo,\n" +
|
||||
" UL.cod_mart,\n" +
|
||||
" diacod,\n" +
|
||||
" mtb_aart.descrizione_estesa,\n" +
|
||||
" partita_mag,\n" +
|
||||
" UL.cod_jcom,\n" +
|
||||
" jtb_comt.descrizione AS commessa,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" qta_col,\n" +
|
||||
" num_cnf,\n" +
|
||||
" UL.qta_cnf,\n" +
|
||||
" UL.peso_netto_kg,\n" +
|
||||
" UL.peso_lordo_kg,\n" +
|
||||
" UL.cod_jfas\n" +
|
||||
"FROM [mvw_sitart_udc_det] UL\n" +
|
||||
" LEFT OUTER JOIN jtb_comt ON UL.cod_jcom = jtb_comt.cod_jcom\n" +
|
||||
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
|
||||
" ON UL.cod_mdep = mtb_depo_posizioni.cod_mdep AND UL.posizione = mtb_depo_posizioni.posizione,\n" +
|
||||
" mtb_aart,\n" +
|
||||
" mtb_grup,\n" +
|
||||
" mtb_sgrp\n" +
|
||||
"WHERE UL.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" AND mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" AND mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
|
||||
" AND mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
" AND qta_col <> 0");
|
||||
}
|
||||
|
||||
private static void createNewView(Connection connection) throws Exception {
|
||||
|
||||
if (!existsTable(connection, "stb_multiplier")) {
|
||||
executeStatement(connection, "CREATE TABLE stb_multiplier\n" +
|
||||
"(\n" +
|
||||
" moltiplicatore INT NOT NULL\n" +
|
||||
")",
|
||||
"INSERT INTO stb_multiplier (moltiplicatore) VALUES (1)",
|
||||
"INSERT INTO stb_multiplier (moltiplicatore) VALUES (-1)");
|
||||
}
|
||||
|
||||
|
||||
createOrUpdateView(connection, "mvw_mtb_colr_with_giacenza", "CREATE VIEW dbo.mvw_mtb_colr_with_giacenza\n" +
|
||||
" WITH SCHEMABINDING\n" +
|
||||
" AS\n" +
|
||||
"SELECT COUNT_BIG(*) AS c,\n" +
|
||||
" IIF(moltiplicatore = -1, mtb_colr.barcode_ul_out,\n" +
|
||||
" mtb_colr.barcode_ul_in) AS barcode_ul,\n" +
|
||||
" IIF(moltiplicatore = -1, mtb_colr.cod_mdep_out,\n" +
|
||||
" mtb_colr.cod_mdep_in) AS cod_mdep,\n" +
|
||||
" IIF(moltiplicatore = -1, mtb_colr.posizione_out,\n" +
|
||||
" mtb_colr.posizione_in) AS posizione,\n" +
|
||||
" SUM(mtb_colr.qta_col * moltiplicatore) AS qta_col,\n" +
|
||||
" SUM(IIF(mtb_aart.flag_qta_cnf_fissa = 'S', mtb_colr.qta_col / mtb_aart.qta_cnf, mtb_colr.num_cnf) *\n" +
|
||||
" moltiplicatore) AS num_cnf,\n" +
|
||||
" mtb_colr.cod_mart,\n" +
|
||||
" mtb_colr.cod_col,\n" +
|
||||
" mtb_colr.cod_tagl,\n" +
|
||||
" mtb_colr.partita_mag,\n" +
|
||||
" SUM(mtb_colr.peso_netto_kg * moltiplicatore) AS peso_netto_kg,\n" +
|
||||
" SUM(mtb_colr.peso_lordo_kg * moltiplicatore) AS peso_lordo_kg,\n" +
|
||||
" IIF(mtb_colr.cod_jcom = 'MAG', NULL, mtb_colr.cod_jcom) AS cod_jcom,\n" +
|
||||
" mtb_aart.flag_qta_cnf_fissa,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" mtb_aart.diacod,\n" +
|
||||
" mtb_aart.descrizione_estesa,\n" +
|
||||
" mtb_aart.cod_mgrp,\n" +
|
||||
" mtb_aart.cod_msgr,\n" +
|
||||
" mtb_aart.cod_mtip,\n" +
|
||||
" mtb_aart.cod_mstp,\n" +
|
||||
" mtb_aart.cod_msfa,\n" +
|
||||
" mtb_aart.qta_cnf AS qta_cnf_anag\n" +
|
||||
"FROM dbo.mtb_colr\n" +
|
||||
" INNER JOIN dbo.stb_multiplier ON (moltiplicatore = 1 AND mtb_colr.barcode_ul_in IS NOT NULL) OR\n" +
|
||||
" (moltiplicatore = -1 AND mtb_colr.barcode_ul_out IS NOT NULL)\n" +
|
||||
" INNER JOIN dbo.mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart\n" +
|
||||
"GROUP BY mtb_colr.cod_mart,\n" +
|
||||
" mtb_colr.cod_col,\n" +
|
||||
" mtb_colr.cod_tagl,\n" +
|
||||
" mtb_colr.partita_mag,\n" +
|
||||
" IIF(moltiplicatore = -1, mtb_colr.barcode_ul_out,\n" +
|
||||
" mtb_colr.barcode_ul_in),\n" +
|
||||
" IIF(moltiplicatore = -1, mtb_colr.cod_mdep_out,\n" +
|
||||
" mtb_colr.cod_mdep_in),\n" +
|
||||
" IIF(moltiplicatore = -1, mtb_colr.posizione_out,\n" +
|
||||
" mtb_colr.posizione_in),\n" +
|
||||
" IIF(mtb_colr.cod_jcom = 'MAG', NULL, mtb_colr.cod_jcom),\n" +
|
||||
" mtb_aart.flag_qta_cnf_fissa,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" mtb_aart.diacod,\n" +
|
||||
" mtb_aart.descrizione_estesa,\n" +
|
||||
" mtb_aart.cod_mgrp,\n" +
|
||||
" mtb_aart.cod_msgr,\n" +
|
||||
" mtb_aart.cod_mtip,\n" +
|
||||
" mtb_aart.cod_mstp,\n" +
|
||||
" mtb_aart.cod_msfa,\n" +
|
||||
" mtb_aart.qta_cnf");
|
||||
|
||||
dropIndex(connection, "mvw_mtb_colr_with_giacenza", "IDX_CLUSTERED_mvw_mtb_colr_with_giacenza");
|
||||
createIndex(connection, new IndexTableDTO()
|
||||
.setIndexName("IDX_CLUSTERED_mvw_mtb_colr_with_giacenza")
|
||||
.setTableName("mvw_mtb_colr_with_giacenza")
|
||||
.setUnique(true)
|
||||
.setClustered(true)
|
||||
.setMaxDop(1)
|
||||
.setSortInTempDb(true)
|
||||
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
|
||||
add(new IndexTableDTO.ColumnIndex("barcode_ul"));
|
||||
add(new IndexTableDTO.ColumnIndex("posizione"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_mdep"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_mart"));
|
||||
add(new IndexTableDTO.ColumnIndex("partita_mag"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_col"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_jcom"));
|
||||
}}));
|
||||
|
||||
dropIndex(connection, "mvw_mtb_colr_with_giacenza", "IDX_mvw_qta_mtb_colr_with_giacenza");
|
||||
createIndex(connection, new IndexTableDTO()
|
||||
.setIndexName("IDX_mvw_qta_mtb_colr_with_giacenza")
|
||||
.setTableName("mvw_mtb_colr_with_giacenza")
|
||||
.setMaxDop(1)
|
||||
.setSortInTempDb(true)
|
||||
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
|
||||
add(new IndexTableDTO.ColumnIndex("qta_col"));
|
||||
add(new IndexTableDTO.ColumnIndex("num_cnf"));
|
||||
}}));
|
||||
|
||||
dropIndex(connection, "mvw_mtb_colr_with_giacenza", "IDX_mvw_articolo_mtb_colr_with_giacenza");
|
||||
createIndex(connection, new IndexTableDTO()
|
||||
.setIndexName("IDX_mvw_articolo_mtb_colr_with_giacenza")
|
||||
.setTableName("mvw_mtb_colr_with_giacenza")
|
||||
.setMaxDop(1)
|
||||
.setSortInTempDb(true)
|
||||
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
|
||||
add(new IndexTableDTO.ColumnIndex("cod_mart"));
|
||||
add(new IndexTableDTO.ColumnIndex("partita_mag"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_col"));
|
||||
}}));
|
||||
|
||||
dropIndex(connection, "mvw_mtb_colr_with_giacenza", "IDX_mvw_articolo_giac_mtb_colr_with_giacenza");
|
||||
createIndex(connection, new IndexTableDTO()
|
||||
.setIndexName("IDX_mvw_articolo_giac_mtb_colr_with_giacenza")
|
||||
.setTableName("mvw_mtb_colr_with_giacenza")
|
||||
.setMaxDop(1)
|
||||
.setSortInTempDb(true)
|
||||
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
|
||||
add(new IndexTableDTO.ColumnIndex("cod_mart"));
|
||||
add(new IndexTableDTO.ColumnIndex("partita_mag"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_col"));
|
||||
}})
|
||||
.setColumnsInclude("qta_col", "num_cnf"));
|
||||
|
||||
executeStatement(connection, "UPDATE STATISTICS dbo.mvw_mtb_colr_with_giacenza");
|
||||
|
||||
|
||||
createOrUpdateView(connection, "mvw_sitart_udc_det_inventario", "CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario] AS\n" +
|
||||
" WITH baseMtbColr AS (SELECT c,\n" +
|
||||
"\n" +
|
||||
" ROUND(v.qta_col, cifre_dec) AS qta_col,\n" +
|
||||
" ROUND(v.num_cnf, cifre_dec) AS num_cnf,\n" +
|
||||
" IIF(flag_qta_cnf_fissa = 'S',\n" +
|
||||
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)) AS qta_cnf,\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.peso_netto_kg,\n" +
|
||||
" v.peso_lordo_kg,\n" +
|
||||
" mtb_colt.gestione,\n" +
|
||||
" mtb_colt.data_collo,\n" +
|
||||
" mtb_colt.ser_collo,\n" +
|
||||
" mtb_colt.num_collo,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.flag_qta_cnf_fissa,\n" +
|
||||
" v.unt_mis,\n" +
|
||||
" v.diacod,\n" +
|
||||
" v.descrizione_estesa,\n" +
|
||||
" v.cod_mgrp,\n" +
|
||||
" mtb_grup.descrizione AS descrizione_gruppo,\n" +
|
||||
" v.cod_msgr,\n" +
|
||||
" mtb_sgrp.descrizione AS descrizione_sottogruppo,\n" +
|
||||
" mtb_unt_mis.flag_dig,\n" +
|
||||
" mtb_unt_mis.cifre_dec,\n" +
|
||||
" mtb_colt.segno,\n" +
|
||||
" v.cod_mdep,\n" +
|
||||
" v.posizione,\n" +
|
||||
" mtb_colt.cod_dtip,\n" +
|
||||
" mtb_colt.cod_jfas,\n" +
|
||||
" v.barcode_ul,\n" +
|
||||
" v.qta_cnf_anag\n" +
|
||||
" FROM mvw_mtb_colr_with_giacenza v WITH (NOEXPAND)\n" +
|
||||
" INNER JOIN mtb_colt\n" +
|
||||
" ON v.barcode_ul = mtb_colt.barcode_ul\n" +
|
||||
" INNER JOIN dbo.mtb_unt_mis ON v.unt_mis = mtb_unt_mis.unt_mis\n" +
|
||||
"\n" +
|
||||
" INNER JOIN dbo.mtb_grup ON v.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" INNER JOIN dbo.mtb_sgrp ON v.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
|
||||
" AND v.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
" WHERE qta_col > 0\n" +
|
||||
" AND (segno = 1 OR (segno = -1 AND cod_dtip IS NULL AND mtb_colt.gestione = 'V'))\n" +
|
||||
" ),\n" +
|
||||
" final_stock AS (SELECT v.qta_col,\n" +
|
||||
" v.num_cnf,\n" +
|
||||
" v.qta_cnf,\n" +
|
||||
" v.gestione,\n" +
|
||||
" v.data_collo,\n" +
|
||||
" v.ser_collo,\n" +
|
||||
" v.num_collo,\n" +
|
||||
" v.cod_mdep AS cod_mdep,\n" +
|
||||
" v.posizione AS posizione,\n" +
|
||||
" mtb_depo_posizioni.priorita,\n" +
|
||||
" v.cod_mgrp AS codGruppo,\n" +
|
||||
" v.descrizione_gruppo AS Gruppo,\n" +
|
||||
" v.cod_msgr AS CodSgruppo,\n" +
|
||||
" v.descrizione_sottogruppo AS Sottogruppo,\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.diacod,\n" +
|
||||
" v.descrizione_estesa,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.peso_netto_kg,\n" +
|
||||
" v.peso_lordo_kg,\n" +
|
||||
" v.cod_jfas,\n" +
|
||||
" v.flag_qta_cnf_fissa,\n" +
|
||||
" v.unt_mis,\n" +
|
||||
" v.segno,\n" +
|
||||
" v.barcode_ul\n" +
|
||||
" FROM baseMtbColr v\n" +
|
||||
"\n" +
|
||||
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
|
||||
" ON v.cod_mdep = mtb_depo_posizioni.cod_mdep\n" +
|
||||
" AND v.posizione = mtb_depo_posizioni.posizione)\n" +
|
||||
"\n" +
|
||||
" SELECT qta_col,\n" +
|
||||
" num_cnf,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" ser_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" posizione,\n" +
|
||||
" priorita,\n" +
|
||||
" codGruppo,\n" +
|
||||
" Gruppo,\n" +
|
||||
" CodSgruppo,\n" +
|
||||
" Sottogruppo,\n" +
|
||||
" cod_mart,\n" +
|
||||
" diacod,\n" +
|
||||
" descrizione_estesa,\n" +
|
||||
" partita_mag,\n" +
|
||||
" cod_col,\n" +
|
||||
" cod_tagl,\n" +
|
||||
" cod_jcom,\n" +
|
||||
" peso_netto_kg,\n" +
|
||||
" peso_lordo_kg,\n" +
|
||||
" cod_jfas,\n" +
|
||||
" flag_qta_cnf_fissa,\n" +
|
||||
" unt_mis,\n" +
|
||||
" segno,\n" +
|
||||
" barcode_ul\n" +
|
||||
" FROM final_stock");
|
||||
}
|
||||
|
||||
|
||||
private static boolean existsView(Connection connection, String objectName) throws SQLException {
|
||||
return UtilityDB.<Integer>executeSimpleQueryOnlyFirstRowFirstColumn(connection, "SELECT COUNT(*) FROM SYSOBJECTS WHERE id = object_id('" + objectName + "')") > 0;
|
||||
}
|
||||
|
||||
|
||||
private static void dropView(Connection connection, String objectName) throws SQLException, IOException {
|
||||
UtilityDB.executeStatement(connection, "IF EXISTS (SELECT * FROM SYSOBJECTS WHERE id = object_id('" + objectName + "'))\r\n" +
|
||||
"\tDROP " + SqlObjectTypeEnum.VIEW.toString() + " " + objectName);
|
||||
}
|
||||
|
||||
private static boolean existsTable(Connection connection, String tableName) throws SQLException, IOException {
|
||||
String schema = null;
|
||||
if (tableName.contains(".")) {
|
||||
schema = tableName.substring(0, tableName.indexOf("."));
|
||||
tableName = tableName.replace(schema + ".", "");
|
||||
}
|
||||
|
||||
String sql = Query.format("SELECT CAST(COUNT(*) AS BIT) AS exist FROM INFORMATION_SCHEMA.TABLES " +
|
||||
"WHERE TABLE_NAME = N%s ", tableName);
|
||||
|
||||
if (schema != null)
|
||||
sql += Query.format("AND TABLE_SCHEMA = N%s", schema);
|
||||
|
||||
return UtilityDB.<Boolean>executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static void createIndex(Connection connection, IndexTableDTO indexTableDTO) throws Exception {
|
||||
UtilityDB.createIndex(connection, indexTableDTO);
|
||||
}
|
||||
|
||||
private static void dropIndex(Connection connection, String tableName, String indexName) throws Exception {
|
||||
UtilityDB.dropIndex(connection, tableName, indexName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static void executeStatement(Connection connection, String... sqls) throws SQLException {
|
||||
try (Statement statement = connection.createStatement()) {
|
||||
for (String sql : sqls) {
|
||||
statement.execute(sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static void createOrUpdateView(Connection connection, String objectName, String createViewSql) throws SQLException, IOException {
|
||||
alterObject(connection, SqlObjectTypeEnum.VIEW, objectName, createViewSql);
|
||||
}
|
||||
|
||||
private static void alterObject(Connection connection, SqlObjectTypeEnum sqlObject, String objectName, String sql) throws SQLException, IOException {
|
||||
executeStatement(connection, "IF EXISTS (SELECT * FROM SYSOBJECTS WHERE id = object_id('" + objectName + "'))\r\n" +
|
||||
"\tDROP " + sqlObject.toString() + " " + objectName,
|
||||
sql);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import it.integry.ems_model.entity.StbUser;
|
||||
import it.integry.ems_model.entity.WtbUsers;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import it.integry.security.utility.CryptoUtils;
|
||||
|
||||
@@ -57,7 +58,7 @@ public class Migration_20220413102657 extends BaseMigration implements Migration
|
||||
.setUserCode(wtbUser.getUserCode())
|
||||
.setDetails(wtbUser.getDetails())
|
||||
.setLastAccessDatetime(wtbUser.getLastAccessDatetime())
|
||||
.setPasswordEndtime(wtbUser.getPasswordEndtime())
|
||||
.setPasswordEndtime(UtilityLocalDate.localDateTimeFromDate(wtbUser.getPasswordEndtime()))
|
||||
.setUrlCss(wtbUser.getUrlCss())
|
||||
.setCodLang(wtbUser.getCodLang())
|
||||
.setCreationDatetime(wtbUser.getCreationDatetime())
|
||||
|
||||
@@ -3,14 +3,7 @@ package it.integry.ems.migration.model;
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.dto.IndexTableDTO;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import it.integry.ems.migration.dto.common.MigrationMvwSitArtUdcDetInventarioDTO;
|
||||
|
||||
public class Migration_20241213163759 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@@ -22,381 +15,8 @@ public class Migration_20241213163759 extends BaseMigration implements Migration
|
||||
if (!isCustomer(IntegryCustomer.RossoGargano))
|
||||
return;
|
||||
|
||||
//Migration di conversione aziende a nuova mvw_sitart_udc_det_inventario
|
||||
createBackupOfOldView();
|
||||
dropView("mvw_sitart_udc_det_inventario");
|
||||
|
||||
createNewView();
|
||||
|
||||
alignGiacenza();
|
||||
|
||||
}
|
||||
|
||||
private void createBackupOfOldView() throws Exception {
|
||||
if (existsView("mvw_sitart_udc_det_inventario_old"))
|
||||
return;
|
||||
|
||||
createOrUpdateView("mvw_sitart_udc_det_inventario_old", "CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario_old] AS\n" +
|
||||
"SELECT UL.gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" ser_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" segno,\n" +
|
||||
" UL.cod_mdep,\n" +
|
||||
" UL.posizione,\n" +
|
||||
" mtb_depo_posizioni.priorita,\n" +
|
||||
" mtb_aart.cod_mgrp AS codGruppo,\n" +
|
||||
" mtb_grup.descrizione AS Gruppo,\n" +
|
||||
" mtb_aart.cod_msgr AS CodSgruppo,\n" +
|
||||
" mtb_sgrp.descrizione AS Sottogruppo,\n" +
|
||||
" UL.cod_mart,\n" +
|
||||
" diacod,\n" +
|
||||
" mtb_aart.descrizione_estesa,\n" +
|
||||
" partita_mag,\n" +
|
||||
" UL.cod_jcom,\n" +
|
||||
" jtb_comt.descrizione AS commessa,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" qta_col,\n" +
|
||||
" num_cnf,\n" +
|
||||
" UL.qta_cnf,\n" +
|
||||
" UL.peso_netto_kg,\n" +
|
||||
" UL.peso_lordo_kg,\n" +
|
||||
" UL.cod_jfas\n" +
|
||||
"FROM [mvw_sitart_udc_det] UL\n" +
|
||||
" LEFT OUTER JOIN jtb_comt ON UL.cod_jcom = jtb_comt.cod_jcom\n" +
|
||||
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
|
||||
" ON UL.cod_mdep = mtb_depo_posizioni.cod_mdep AND UL.posizione = mtb_depo_posizioni.posizione,\n" +
|
||||
" mtb_aart,\n" +
|
||||
" mtb_grup,\n" +
|
||||
" mtb_sgrp\n" +
|
||||
"WHERE UL.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" AND mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" AND mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
|
||||
" AND mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
" AND qta_col <> 0");
|
||||
}
|
||||
|
||||
private void createNewView() throws Exception {
|
||||
|
||||
if (!existsTable("stb_multiplier")) {
|
||||
executeStatement("CREATE TABLE stb_multiplier\n" +
|
||||
"(\n" +
|
||||
" moltiplicatore INT NOT NULL\n" +
|
||||
")",
|
||||
"INSERT INTO stb_multiplier (moltiplicatore) VALUES (1)",
|
||||
"INSERT INTO stb_multiplier (moltiplicatore) VALUES (-1)");
|
||||
}
|
||||
|
||||
|
||||
createOrUpdateView("mvw_mtb_colr_with_giacenza", "CREATE VIEW dbo.mvw_mtb_colr_with_giacenza\n" +
|
||||
" WITH SCHEMABINDING\n" +
|
||||
"AS\n" +
|
||||
"SELECT COUNT_BIG(*) AS c,\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.gestione_rif,\n" +
|
||||
" mtb_colr.gestione) AS gestione,\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.data_collo_rif,\n" +
|
||||
" mtb_colr.data_collo) AS data_collo,\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.ser_collo_rif,\n" +
|
||||
" mtb_colr.ser_collo) AS ser_collo,\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.num_collo_rif,\n" +
|
||||
" mtb_colr.num_collo) AS num_collo,\n" +
|
||||
" SUM(mtb_colr.qta_col * moltiplicatore) AS qta_col,\n" +
|
||||
"\n" +
|
||||
" SUM(IIF(mtb_aart.flag_qta_cnf_fissa = 'S', mtb_colr.qta_col / mtb_aart.qta_cnf, mtb_colr.num_cnf) *\n" +
|
||||
" moltiplicatore) AS num_cnf,\n" +
|
||||
" mtb_colr.cod_mart,\n" +
|
||||
" mtb_colr.cod_col,\n" +
|
||||
" mtb_colr.cod_tagl,\n" +
|
||||
" mtb_colr.partita_mag,\n" +
|
||||
" SUM(mtb_colr.peso_netto_kg * moltiplicatore) AS peso_netto_kg,\n" +
|
||||
" SUM(mtb_colr.peso_lordo_kg * moltiplicatore) AS peso_lordo_kg,\n" +
|
||||
" IIF(mtb_colr.cod_jcom = 'MAG', NULL, mtb_colr.cod_jcom) AS cod_jcom,\n" +
|
||||
" mtb_aart.flag_qta_cnf_fissa,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" mtb_aart.diacod,\n" +
|
||||
" mtb_aart.descrizione_estesa,\n" +
|
||||
" mtb_aart.cod_mgrp,\n" +
|
||||
" mtb_aart.cod_msgr,\n" +
|
||||
" mtb_aart.cod_mtip,\n" +
|
||||
" mtb_aart.cod_mstp,\n" +
|
||||
" mtb_aart.cod_msfa,\n" +
|
||||
" mtb_aart.qta_cnf AS qta_cnf_anag\n" +
|
||||
"FROM dbo.mtb_colr\n" +
|
||||
" INNER JOIN dbo.stb_multiplier ON moltiplicatore = 1 OR mtb_colr.num_collo_rif IS NOT NULL\n" +
|
||||
" INNER JOIN dbo.mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart\n" +
|
||||
"GROUP BY mtb_colr.cod_mart,\n" +
|
||||
" mtb_colr.cod_col,\n" +
|
||||
" mtb_colr.cod_tagl,\n" +
|
||||
" mtb_colr.partita_mag,\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.gestione_rif, mtb_colr.gestione),\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.data_collo_rif,\n" +
|
||||
" mtb_colr.data_collo),\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.ser_collo_rif,\n" +
|
||||
" mtb_colr.ser_collo),\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.num_collo_rif,\n" +
|
||||
" mtb_colr.num_collo),\n" +
|
||||
" IIF(mtb_colr.cod_jcom = 'MAG', NULL, mtb_colr.cod_jcom),\n" +
|
||||
" mtb_aart.flag_qta_cnf_fissa,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" mtb_aart.diacod,\n" +
|
||||
" mtb_aart.descrizione_estesa,\n" +
|
||||
" mtb_aart.cod_mgrp,\n" +
|
||||
" mtb_aart.cod_msgr,\n" +
|
||||
" mtb_aart.cod_mtip,\n" +
|
||||
" mtb_aart.cod_mstp,\n" +
|
||||
" mtb_aart.cod_msfa,\n" +
|
||||
" mtb_aart.qta_cnf");
|
||||
|
||||
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_CLUSTERED_mvw_mtb_colr_with_giacenza");
|
||||
createIndex(new IndexTableDTO()
|
||||
.setIndexName("IDX_CLUSTERED_mvw_mtb_colr_with_giacenza")
|
||||
.setTableName("mvw_mtb_colr_with_giacenza")
|
||||
.setUnique(true)
|
||||
.setClustered(true)
|
||||
.setMaxDop(1)
|
||||
.setSortInTempDb(true)
|
||||
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
|
||||
add(new IndexTableDTO.ColumnIndex("gestione"));
|
||||
add(new IndexTableDTO.ColumnIndex("data_collo"));
|
||||
add(new IndexTableDTO.ColumnIndex("num_collo"));
|
||||
add(new IndexTableDTO.ColumnIndex("ser_collo"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_mart"));
|
||||
add(new IndexTableDTO.ColumnIndex("partita_mag"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_col"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_jcom"));
|
||||
}}));
|
||||
|
||||
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_mvw_qta_mtb_colr_with_giacenza");
|
||||
createIndex(new IndexTableDTO()
|
||||
.setIndexName("IDX_mvw_qta_mtb_colr_with_giacenza")
|
||||
.setTableName("mvw_mtb_colr_with_giacenza")
|
||||
.setMaxDop(1)
|
||||
.setSortInTempDb(true)
|
||||
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
|
||||
add(new IndexTableDTO.ColumnIndex("qta_col"));
|
||||
add(new IndexTableDTO.ColumnIndex("num_cnf"));
|
||||
}}));
|
||||
|
||||
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_mvw_articolo_mtb_colr_with_giacenza");
|
||||
createIndex(new IndexTableDTO()
|
||||
.setIndexName("IDX_mvw_articolo_mtb_colr_with_giacenza")
|
||||
.setTableName("mvw_mtb_colr_with_giacenza")
|
||||
.setMaxDop(1)
|
||||
.setSortInTempDb(true)
|
||||
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
|
||||
add(new IndexTableDTO.ColumnIndex("cod_mart"));
|
||||
add(new IndexTableDTO.ColumnIndex("partita_mag"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_col"));
|
||||
}}));
|
||||
|
||||
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_mvw_articolo_giac_mtb_colr_with_giacenza");
|
||||
createIndex(new IndexTableDTO()
|
||||
.setIndexName("IDX_mvw_articolo_giac_mtb_colr_with_giacenza")
|
||||
.setTableName("mvw_mtb_colr_with_giacenza")
|
||||
.setMaxDop(1)
|
||||
.setSortInTempDb(true)
|
||||
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
|
||||
add(new IndexTableDTO.ColumnIndex("cod_mart"));
|
||||
add(new IndexTableDTO.ColumnIndex("partita_mag"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_col"));
|
||||
}})
|
||||
.setColumnsInclude("qta_col", "num_cnf"));
|
||||
|
||||
executeStatement("UPDATE STATISTICS dbo.mvw_mtb_colr_with_giacenza");
|
||||
|
||||
|
||||
createOrUpdateView("mvw_sitart_udc_det_inventario", "CREATE VIEW mvw_sitart_udc_det_inventario AS\n" +
|
||||
" WITH baseMtbColr AS (SELECT c,\n" +
|
||||
"\n" +
|
||||
" ROUND(v.qta_col, cifre_dec) AS qta_col,\n" +
|
||||
" ROUND(v.num_cnf, cifre_dec) AS num_cnf,\n" +
|
||||
" IIF(flag_qta_cnf_fissa = 'S',\n" +
|
||||
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)) AS qta_cnf,\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.peso_netto_kg,\n" +
|
||||
" v.peso_lordo_kg,\n" +
|
||||
" v.gestione,\n" +
|
||||
" v.data_collo,\n" +
|
||||
" v.ser_collo,\n" +
|
||||
" v.num_collo,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.flag_qta_cnf_fissa,\n" +
|
||||
" v.unt_mis,\n" +
|
||||
" v.diacod,\n" +
|
||||
" v.descrizione_estesa,\n" +
|
||||
" v.cod_mgrp,\n" +
|
||||
" mtb_grup.descrizione AS descrizione_gruppo,\n" +
|
||||
" v.cod_msgr,\n" +
|
||||
" mtb_sgrp.descrizione AS descrizione_sottogruppo,\n" +
|
||||
" mtb_unt_mis.flag_dig,\n" +
|
||||
" mtb_unt_mis.cifre_dec,\n" +
|
||||
" mtb_colt.segno,\n" +
|
||||
" mtb_colt.cod_mdep,\n" +
|
||||
" mtb_colt.posizione,\n" +
|
||||
" mtb_colt.cod_dtip,\n" +
|
||||
" mtb_colt.cod_jfas,\n" +
|
||||
" mtb_colt.barcode_ul,\n" +
|
||||
" v.qta_cnf_anag\n" +
|
||||
" FROM mvw_mtb_colr_with_giacenza v WITH (NOEXPAND)\n" +
|
||||
" INNER JOIN mtb_colt\n" +
|
||||
" ON v.num_collo = mtb_colt.num_collo AND v.gestione = mtb_colt.gestione AND\n" +
|
||||
" v.ser_collo = mtb_colt.ser_collo AND v.data_collo = mtb_colt.data_collo\n" +
|
||||
" INNER JOIN dbo.mtb_unt_mis ON v.unt_mis = mtb_unt_mis.unt_mis\n" +
|
||||
"\n" +
|
||||
" INNER JOIN dbo.mtb_grup ON v.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" INNER JOIN dbo.mtb_sgrp ON v.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
|
||||
" AND v.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
" WHERE qta_col > 0\n" +
|
||||
" AND (segno = 1 OR (segno = -1 AND cod_dtip IS NULL AND v.gestione = 'V'))),\n" +
|
||||
" final_stock AS (SELECT v.qta_col,\n" +
|
||||
" v.num_cnf,\n" +
|
||||
" v.qta_cnf,\n" +
|
||||
" v.gestione,\n" +
|
||||
" v.data_collo,\n" +
|
||||
" v.ser_collo,\n" +
|
||||
" v.num_collo,\n" +
|
||||
" v.cod_mdep AS cod_mdep,\n" +
|
||||
" v.posizione AS posizione,\n" +
|
||||
" mtb_depo_posizioni.priorita,\n" +
|
||||
" v.cod_mgrp AS codGruppo,\n" +
|
||||
" v.descrizione_gruppo AS Gruppo,\n" +
|
||||
" v.cod_msgr AS CodSgruppo,\n" +
|
||||
" v.descrizione_sottogruppo AS Sottogruppo,\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.diacod,\n" +
|
||||
" v.descrizione_estesa,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.peso_netto_kg,\n" +
|
||||
" v.peso_lordo_kg,\n" +
|
||||
" v.cod_jfas,\n" +
|
||||
" v.flag_qta_cnf_fissa,\n" +
|
||||
" v.unt_mis,\n" +
|
||||
" v.segno,\n" +
|
||||
" v.barcode_ul\n" +
|
||||
" FROM baseMtbColr v\n" +
|
||||
"\n" +
|
||||
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
|
||||
" ON v.cod_mdep = mtb_depo_posizioni.cod_mdep\n" +
|
||||
" AND v.posizione = mtb_depo_posizioni.posizione)\n" +
|
||||
"\n" +
|
||||
" SELECT qta_col,\n" +
|
||||
" num_cnf,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" ser_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" posizione,\n" +
|
||||
" priorita,\n" +
|
||||
" codGruppo,\n" +
|
||||
" Gruppo,\n" +
|
||||
" CodSgruppo,\n" +
|
||||
" Sottogruppo,\n" +
|
||||
" cod_mart,\n" +
|
||||
" diacod,\n" +
|
||||
" descrizione_estesa,\n" +
|
||||
" partita_mag,\n" +
|
||||
" cod_col,\n" +
|
||||
" cod_tagl,\n" +
|
||||
" cod_jcom,\n" +
|
||||
" peso_netto_kg,\n" +
|
||||
" peso_lordo_kg,\n" +
|
||||
" cod_jfas,\n" +
|
||||
" flag_qta_cnf_fissa,\n" +
|
||||
" unt_mis,\n" +
|
||||
" segno,\n" +
|
||||
" barcode_ul\n" +
|
||||
" FROM final_stock");
|
||||
}
|
||||
|
||||
private void alignGiacenza() throws Exception {
|
||||
//Creo un collo di scarico vuoto
|
||||
MtbColt mtbColt = new MtbColt()
|
||||
.setGestione("L")
|
||||
.setSerCollo("RT")
|
||||
.setSegno(-1)
|
||||
.setDataCollo(LocalDate.now())
|
||||
.setAnnotazioni("PASSAGGIO NUOVA MVW_SITART_UDC_DET_INVENTARIO")
|
||||
.setCodMdep(getInternalCodMdep());
|
||||
mtbColt.setOperation(OperationType.INSERT);
|
||||
|
||||
mtbColt.dataCompleting(connection);
|
||||
mtbColt.manageWithParentConnection(connection);
|
||||
|
||||
|
||||
executeStatement(Query.format(
|
||||
"INSERT INTO mtb_colr (gestione, ser_collo, num_collo, data_collo, riga, cod_mart, cod_col, cod_tagl, partita_mag, gestione_rif, data_collo_rif, ser_collo_rif, num_collo_rif, datetime_row,\n" +
|
||||
" cod_jcom, qta_col, num_cnf, qta_cnf)" +
|
||||
" SELECT {} AS gestione,\n" +
|
||||
" {} AS ser_collo,\n" +
|
||||
" {} AS num_collo,\n" +
|
||||
" CAST({} AS DATE) AS data_collo,\n" +
|
||||
" ROW_NUMBER() OVER (PARTITION BY (SELECT NULL) ORDER BY v.data_collo) AS riga,\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.gestione AS gestion_rif,\n" +
|
||||
" v.data_collo AS data_collo_rif,\n" +
|
||||
" v.ser_collo AS ser_collo_rif,\n" +
|
||||
" v.num_collo AS num_collo_rif,\n" +
|
||||
" GETDATE() AS datetime_row,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.qta_col,\n" +
|
||||
" v.num_cnf,\n" +
|
||||
" v.qta_cnf\n" +
|
||||
"FROM mvw_sitart_udc_det_inventario v\n" +
|
||||
" INNER JOIN (SELECT ser_collo,\n" +
|
||||
" gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" posizione,\n" +
|
||||
" cod_mart,\n" +
|
||||
" partita_mag,\n" +
|
||||
" cod_jcom-- Elenca tutte le colonne coinvolte\n" +
|
||||
" FROM mvw_sitart_udc_det_inventario\n" +
|
||||
"\n" +
|
||||
" EXCEPT\n" +
|
||||
"\n" +
|
||||
" SELECT ser_collo,\n" +
|
||||
" gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" posizione,\n" +
|
||||
" cod_mart,\n" +
|
||||
" partita_mag,\n" +
|
||||
" cod_jcom -- Elenca le stesse colonne dalla vista vecchia\n" +
|
||||
" FROM mvw_sitart_udc_det_inventario_old) t\n" +
|
||||
" ON v.num_collo = t.num_collo AND v.data_collo = t.data_collo AND\n" +
|
||||
" v.ser_collo = t.ser_collo AND v.gestione = t.gestione AND\n" +
|
||||
" v.cod_mart = t.cod_mart AND v.cod_mdep = t.cod_mdep AND\n" +
|
||||
" ISNULL(v.partita_mag, '') = ISNULL(t.partita_mag, '') AND\n" +
|
||||
" ISNULL(v.posizione, '') = ISNULL(t.posizione, '') AND\n" +
|
||||
" ISNULL(v.cod_jcom, '') = ISNULL(t.cod_jcom, '')" +
|
||||
" WHERE qta_col > 0",
|
||||
mtbColt.getGestione(), mtbColt.getSerCollo(), mtbColt.getNumCollo(), mtbColt.getDataCollo()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private String getInternalCodMdep() throws Exception {
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, "SELECT TOP 1 cod_mdep" +
|
||||
" FROM mtb_depo" +
|
||||
" INNER JOIN dbo.gtb_anag ga ON mtb_depo.cod_anag = ga.cod_anag" +
|
||||
" inner join azienda on ga.part_iva = azienda.part_iva");
|
||||
MigrationMvwSitArtUdcDetInventarioDTO.apply(connection);
|
||||
MigrationMvwSitArtUdcDetInventarioDTO.alignGiacenza(connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,323 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.dto.IndexTableDTO;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Migration_20250320121611 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomer(IntegryCustomer.Tosca))
|
||||
return;
|
||||
|
||||
//Migration di conversione aziende a nuova mvw_sitart_udc_det_inventario
|
||||
createBackupOfOldView();
|
||||
dropView("mvw_sitart_udc_det_inventario");
|
||||
|
||||
createNewView();
|
||||
|
||||
}
|
||||
|
||||
private void createBackupOfOldView() throws Exception {
|
||||
if (existsView("mvw_sitart_udc_det_inventario_old"))
|
||||
return;
|
||||
|
||||
createOrUpdateView("mvw_sitart_udc_det_inventario_old", "CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario_old] AS\n" +
|
||||
"SELECT UL.gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" ser_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" segno,\n" +
|
||||
" UL.cod_mdep,\n" +
|
||||
" UL.posizione,\n" +
|
||||
" mtb_depo_posizioni.priorita,\n" +
|
||||
" mtb_aart.cod_mgrp AS codGruppo,\n" +
|
||||
" mtb_grup.descrizione AS Gruppo,\n" +
|
||||
" mtb_aart.cod_msgr AS CodSgruppo,\n" +
|
||||
" mtb_sgrp.descrizione AS Sottogruppo,\n" +
|
||||
" UL.cod_mart,\n" +
|
||||
" diacod,\n" +
|
||||
" mtb_aart.descrizione_estesa,\n" +
|
||||
" partita_mag,\n" +
|
||||
" UL.cod_jcom,\n" +
|
||||
" jtb_comt.descrizione AS commessa,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" qta_col,\n" +
|
||||
" num_cnf,\n" +
|
||||
" UL.qta_cnf,\n" +
|
||||
" UL.peso_netto_kg,\n" +
|
||||
" UL.peso_lordo_kg,\n" +
|
||||
" UL.cod_jfas\n" +
|
||||
"FROM [mvw_sitart_udc_det] UL\n" +
|
||||
" LEFT OUTER JOIN jtb_comt ON UL.cod_jcom = jtb_comt.cod_jcom\n" +
|
||||
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
|
||||
" ON UL.cod_mdep = mtb_depo_posizioni.cod_mdep AND UL.posizione = mtb_depo_posizioni.posizione,\n" +
|
||||
" mtb_aart,\n" +
|
||||
" mtb_grup,\n" +
|
||||
" mtb_sgrp\n" +
|
||||
"WHERE UL.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" AND mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" AND mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
|
||||
" AND mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
" AND qta_col <> 0");
|
||||
}
|
||||
|
||||
private void createNewView() throws Exception {
|
||||
|
||||
if (!existsTable("stb_multiplier")) {
|
||||
executeStatement("CREATE TABLE stb_multiplier\n" +
|
||||
"(\n" +
|
||||
" moltiplicatore INT NOT NULL\n" +
|
||||
")",
|
||||
"INSERT INTO stb_multiplier (moltiplicatore) VALUES (1)",
|
||||
"INSERT INTO stb_multiplier (moltiplicatore) VALUES (-1)");
|
||||
}
|
||||
|
||||
|
||||
createOrUpdateView("mvw_mtb_colr_with_giacenza", "CREATE VIEW dbo.mvw_mtb_colr_with_giacenza\n" +
|
||||
" WITH SCHEMABINDING\n" +
|
||||
"AS\n" +
|
||||
"SELECT COUNT_BIG(*) AS c,\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.gestione_rif,\n" +
|
||||
" mtb_colr.gestione) AS gestione,\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.data_collo_rif,\n" +
|
||||
" mtb_colr.data_collo) AS data_collo,\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.ser_collo_rif,\n" +
|
||||
" mtb_colr.ser_collo) AS ser_collo,\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.num_collo_rif,\n" +
|
||||
" mtb_colr.num_collo) AS num_collo,\n" +
|
||||
" SUM(mtb_colr.qta_col * moltiplicatore) AS qta_col,\n" +
|
||||
"\n" +
|
||||
" SUM(IIF(mtb_aart.flag_qta_cnf_fissa = 'S', mtb_colr.qta_col / mtb_aart.qta_cnf, mtb_colr.num_cnf) *\n" +
|
||||
" moltiplicatore) AS num_cnf,\n" +
|
||||
" mtb_colr.cod_mart,\n" +
|
||||
" mtb_colr.cod_col,\n" +
|
||||
" mtb_colr.cod_tagl,\n" +
|
||||
" mtb_colr.partita_mag,\n" +
|
||||
" SUM(mtb_colr.peso_netto_kg * moltiplicatore) AS peso_netto_kg,\n" +
|
||||
" SUM(mtb_colr.peso_lordo_kg * moltiplicatore) AS peso_lordo_kg,\n" +
|
||||
" IIF(mtb_colr.cod_jcom = 'MAG', NULL, mtb_colr.cod_jcom) AS cod_jcom,\n" +
|
||||
" mtb_aart.flag_qta_cnf_fissa,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" mtb_aart.diacod,\n" +
|
||||
" mtb_aart.descrizione_estesa,\n" +
|
||||
" mtb_aart.cod_mgrp,\n" +
|
||||
" mtb_aart.cod_msgr,\n" +
|
||||
" mtb_aart.cod_mtip,\n" +
|
||||
" mtb_aart.cod_mstp,\n" +
|
||||
" mtb_aart.cod_msfa,\n" +
|
||||
" mtb_aart.qta_cnf AS qta_cnf_anag\n" +
|
||||
"FROM dbo.mtb_colr\n" +
|
||||
" INNER JOIN dbo.stb_multiplier ON moltiplicatore = 1 OR mtb_colr.num_collo_rif IS NOT NULL\n" +
|
||||
" INNER JOIN dbo.mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart\n" +
|
||||
"GROUP BY mtb_colr.cod_mart,\n" +
|
||||
" mtb_colr.cod_col,\n" +
|
||||
" mtb_colr.cod_tagl,\n" +
|
||||
" mtb_colr.partita_mag,\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.gestione_rif, mtb_colr.gestione),\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.data_collo_rif,\n" +
|
||||
" mtb_colr.data_collo),\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.ser_collo_rif,\n" +
|
||||
" mtb_colr.ser_collo),\n" +
|
||||
" IIF(moltiplicatore = -1 AND num_collo_rif IS NOT NULL, mtb_colr.num_collo_rif,\n" +
|
||||
" mtb_colr.num_collo),\n" +
|
||||
" IIF(mtb_colr.cod_jcom = 'MAG', NULL, mtb_colr.cod_jcom),\n" +
|
||||
" mtb_aart.flag_qta_cnf_fissa,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" mtb_aart.diacod,\n" +
|
||||
" mtb_aart.descrizione_estesa,\n" +
|
||||
" mtb_aart.cod_mgrp,\n" +
|
||||
" mtb_aart.cod_msgr,\n" +
|
||||
" mtb_aart.cod_mtip,\n" +
|
||||
" mtb_aart.cod_mstp,\n" +
|
||||
" mtb_aart.cod_msfa,\n" +
|
||||
" mtb_aart.qta_cnf");
|
||||
|
||||
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_CLUSTERED_mvw_mtb_colr_with_giacenza");
|
||||
createIndex(new IndexTableDTO()
|
||||
.setIndexName("IDX_CLUSTERED_mvw_mtb_colr_with_giacenza")
|
||||
.setTableName("mvw_mtb_colr_with_giacenza")
|
||||
.setUnique(true)
|
||||
.setClustered(true)
|
||||
.setMaxDop(1)
|
||||
.setSortInTempDb(true)
|
||||
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
|
||||
add(new IndexTableDTO.ColumnIndex("gestione"));
|
||||
add(new IndexTableDTO.ColumnIndex("data_collo"));
|
||||
add(new IndexTableDTO.ColumnIndex("num_collo"));
|
||||
add(new IndexTableDTO.ColumnIndex("ser_collo"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_mart"));
|
||||
add(new IndexTableDTO.ColumnIndex("partita_mag"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_col"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_jcom"));
|
||||
}}));
|
||||
|
||||
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_mvw_qta_mtb_colr_with_giacenza");
|
||||
createIndex(new IndexTableDTO()
|
||||
.setIndexName("IDX_mvw_qta_mtb_colr_with_giacenza")
|
||||
.setTableName("mvw_mtb_colr_with_giacenza")
|
||||
.setMaxDop(1)
|
||||
.setSortInTempDb(true)
|
||||
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
|
||||
add(new IndexTableDTO.ColumnIndex("qta_col"));
|
||||
add(new IndexTableDTO.ColumnIndex("num_cnf"));
|
||||
}}));
|
||||
|
||||
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_mvw_articolo_mtb_colr_with_giacenza");
|
||||
createIndex(new IndexTableDTO()
|
||||
.setIndexName("IDX_mvw_articolo_mtb_colr_with_giacenza")
|
||||
.setTableName("mvw_mtb_colr_with_giacenza")
|
||||
.setMaxDop(1)
|
||||
.setSortInTempDb(true)
|
||||
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
|
||||
add(new IndexTableDTO.ColumnIndex("cod_mart"));
|
||||
add(new IndexTableDTO.ColumnIndex("partita_mag"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_col"));
|
||||
}}));
|
||||
|
||||
dropIndex("mvw_mtb_colr_with_giacenza", "IDX_mvw_articolo_giac_mtb_colr_with_giacenza");
|
||||
createIndex(new IndexTableDTO()
|
||||
.setIndexName("IDX_mvw_articolo_giac_mtb_colr_with_giacenza")
|
||||
.setTableName("mvw_mtb_colr_with_giacenza")
|
||||
.setMaxDop(1)
|
||||
.setSortInTempDb(true)
|
||||
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
|
||||
add(new IndexTableDTO.ColumnIndex("cod_mart"));
|
||||
add(new IndexTableDTO.ColumnIndex("partita_mag"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_tagl"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_col"));
|
||||
}})
|
||||
.setColumnsInclude("qta_col", "num_cnf"));
|
||||
|
||||
executeStatement("UPDATE STATISTICS dbo.mvw_mtb_colr_with_giacenza");
|
||||
|
||||
|
||||
createOrUpdateView("mvw_sitart_udc_det_inventario", "CREATE VIEW mvw_sitart_udc_det_inventario AS\n" +
|
||||
" WITH baseMtbColr AS (SELECT c,\n" +
|
||||
"\n" +
|
||||
" ROUND(v.qta_col, cifre_dec) AS qta_col,\n" +
|
||||
" ROUND(v.num_cnf, cifre_dec) AS num_cnf,\n" +
|
||||
" IIF(flag_qta_cnf_fissa = 'S',\n" +
|
||||
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)) AS qta_cnf,\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.peso_netto_kg,\n" +
|
||||
" v.peso_lordo_kg,\n" +
|
||||
" v.gestione,\n" +
|
||||
" v.data_collo,\n" +
|
||||
" v.ser_collo,\n" +
|
||||
" v.num_collo,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.flag_qta_cnf_fissa,\n" +
|
||||
" v.unt_mis,\n" +
|
||||
" v.diacod,\n" +
|
||||
" v.descrizione_estesa,\n" +
|
||||
" v.cod_mgrp,\n" +
|
||||
" mtb_grup.descrizione AS descrizione_gruppo,\n" +
|
||||
" v.cod_msgr,\n" +
|
||||
" mtb_sgrp.descrizione AS descrizione_sottogruppo,\n" +
|
||||
" mtb_unt_mis.flag_dig,\n" +
|
||||
" mtb_unt_mis.cifre_dec,\n" +
|
||||
" mtb_colt.segno,\n" +
|
||||
" mtb_colt.cod_mdep,\n" +
|
||||
" mtb_colt.posizione,\n" +
|
||||
" mtb_colt.cod_dtip,\n" +
|
||||
" mtb_colt.cod_jfas,\n" +
|
||||
" mtb_colt.barcode_ul,\n" +
|
||||
" v.qta_cnf_anag\n" +
|
||||
" FROM mvw_mtb_colr_with_giacenza v WITH (NOEXPAND)\n" +
|
||||
" INNER JOIN mtb_colt\n" +
|
||||
" ON v.num_collo = mtb_colt.num_collo AND v.gestione = mtb_colt.gestione AND\n" +
|
||||
" v.ser_collo = mtb_colt.ser_collo AND v.data_collo = mtb_colt.data_collo\n" +
|
||||
" INNER JOIN dbo.mtb_unt_mis ON v.unt_mis = mtb_unt_mis.unt_mis\n" +
|
||||
"\n" +
|
||||
" INNER JOIN dbo.mtb_grup ON v.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" INNER JOIN dbo.mtb_sgrp ON v.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
|
||||
" AND v.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
" WHERE qta_col > 0\n" +
|
||||
" AND (segno = 1 OR (segno = -1 AND cod_dtip IS NULL AND v.gestione = 'V'))),\n" +
|
||||
" final_stock AS (SELECT v.qta_col,\n" +
|
||||
" v.num_cnf,\n" +
|
||||
" v.qta_cnf,\n" +
|
||||
" v.gestione,\n" +
|
||||
" v.data_collo,\n" +
|
||||
" v.ser_collo,\n" +
|
||||
" v.num_collo,\n" +
|
||||
" v.cod_mdep AS cod_mdep,\n" +
|
||||
" v.posizione AS posizione,\n" +
|
||||
" mtb_depo_posizioni.priorita,\n" +
|
||||
" v.cod_mgrp AS codGruppo,\n" +
|
||||
" v.descrizione_gruppo AS Gruppo,\n" +
|
||||
" v.cod_msgr AS CodSgruppo,\n" +
|
||||
" v.descrizione_sottogruppo AS Sottogruppo,\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.diacod,\n" +
|
||||
" v.descrizione_estesa,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.peso_netto_kg,\n" +
|
||||
" v.peso_lordo_kg,\n" +
|
||||
" v.cod_jfas,\n" +
|
||||
" v.flag_qta_cnf_fissa,\n" +
|
||||
" v.unt_mis,\n" +
|
||||
" v.segno,\n" +
|
||||
" v.barcode_ul\n" +
|
||||
" FROM baseMtbColr v\n" +
|
||||
"\n" +
|
||||
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
|
||||
" ON v.cod_mdep = mtb_depo_posizioni.cod_mdep\n" +
|
||||
" AND v.posizione = mtb_depo_posizioni.posizione)\n" +
|
||||
"\n" +
|
||||
" SELECT qta_col,\n" +
|
||||
" num_cnf,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" ser_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" posizione,\n" +
|
||||
" priorita,\n" +
|
||||
" codGruppo,\n" +
|
||||
" Gruppo,\n" +
|
||||
" CodSgruppo,\n" +
|
||||
" Sottogruppo,\n" +
|
||||
" cod_mart,\n" +
|
||||
" diacod,\n" +
|
||||
" descrizione_estesa,\n" +
|
||||
" partita_mag,\n" +
|
||||
" cod_col,\n" +
|
||||
" cod_tagl,\n" +
|
||||
" cod_jcom,\n" +
|
||||
" peso_netto_kg,\n" +
|
||||
" peso_lordo_kg,\n" +
|
||||
" cod_jfas,\n" +
|
||||
" flag_qta_cnf_fissa,\n" +
|
||||
" unt_mis,\n" +
|
||||
" segno,\n" +
|
||||
" barcode_ul\n" +
|
||||
" FROM final_stock");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250402112610 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
// //Gia aggiornato
|
||||
// if (isCustomer(IntegryCustomer.RossoGargano) ||
|
||||
// isCustomer(IntegryCustomer.Tosca))
|
||||
// return;
|
||||
//
|
||||
// //Azienda da aggiornare
|
||||
// if (!isCustomer(IntegryCustomer.Gramm))
|
||||
// return;
|
||||
//
|
||||
// MigrationMvwSitArtUdcDetInventarioDTO.apply(connection);
|
||||
// MigrationMvwSitArtUdcDetInventarioDTO.alignGiacenza(connection);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems.migration.dto.common.MigrationMvwSitArtUdcDetInventarioDTO;
|
||||
import it.integry.ems.rules.completing.PackagesRules;
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Migration_20250403174531 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomer(IntegryCustomer.RossoGargano))
|
||||
return;
|
||||
|
||||
//Rigenero barcodeUl testate con barcode duplicato
|
||||
regenerateDuplicatedBarcodeUlTestate();
|
||||
|
||||
//Aggiorno la view mvw_mtb_colr_with_giacenza
|
||||
MigrationMvwSitArtUdcDetInventarioDTO.apply(connection);
|
||||
|
||||
MigrationMvwSitArtUdcDetInventarioDTO.alignGiacenza(connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
|
||||
|
||||
private void regenerateDuplicatedBarcodeUlTestate() throws Exception {
|
||||
String retrieveDuplicatedSql = "SELECT barcode_ul\n" +
|
||||
"FROM mtb_colt\n" +
|
||||
"GROUP BY barcode_ul, ser_collo\n" +
|
||||
"HAVING COUNT(barcode_ul) > 1";
|
||||
|
||||
|
||||
final List<String> duplicatedBarcodes = UtilityDB.executeSimpleQueryOnlyFirstColumn(connection, retrieveDuplicatedSql);
|
||||
|
||||
for (String barcode : duplicatedBarcodes) {
|
||||
String sql = Query.format("SELECT * FROM mtb_colt WHERE barcode_ul = {}", barcode);
|
||||
List<MtbColt> loadedMtbColts = executeQueryDTO(sql, MtbColt.class);
|
||||
|
||||
for (MtbColt colt : loadedMtbColts) {
|
||||
if (colt.getSerCollo().equalsIgnoreCase("T")) {
|
||||
String newBarcodeUl = PackagesRules.completeBarcodeUl(connection,
|
||||
colt.getGestione(),
|
||||
colt.getDataCollo(),
|
||||
colt.getSerCollo(),
|
||||
colt.getNumCollo(),
|
||||
null,
|
||||
null);
|
||||
|
||||
colt.setBarcodeUl(newBarcodeUl);
|
||||
colt.setOperation(OperationType.UPDATE);
|
||||
colt.manageWithParentConnection(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250403174532 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
if (isCustomer(IntegryCustomer.Gramm) ||
|
||||
isCustomer(IntegryCustomer.RossoGargano) ||
|
||||
isCustomer(IntegryCustomer.Carelli) ||
|
||||
isDMS())
|
||||
return;
|
||||
|
||||
//Cancello tutti i barcode UL dalle testate degli scarichi a lavorazione
|
||||
executeStatement("UPDATE mtb_colt SET barcode_ul = NULL\n" +
|
||||
"WHERE gestione = 'L' AND segno = -1\n" +
|
||||
"AND barcode_ul IS NOT NULL");
|
||||
|
||||
|
||||
executeStatement("UPDATE mtb_colt\n" +
|
||||
"SET barcode_ul = EAN128.AI_00\n" +
|
||||
"FROM mtb_colt\n" +
|
||||
" CROSS APPLY (SELECT TOP 1 * FROM (SELECT DISTINCT AI_00\n" +
|
||||
" FROM f_getEAN128UL(mtb_colt.gestione, mtb_colt.data_collo, mtb_colt.ser_collo,\n" +
|
||||
" mtb_colt.num_collo,\n" +
|
||||
" NULL)" +
|
||||
" WHERE mtb_colt.ser_collo <> 'UL'\n" +
|
||||
" UNION\n" +
|
||||
" SELECT CONCAT('U', RIGHT(YEAR(mtb_colt.data_collo), 2), FORMAT(mtb_colt.num_collo, '0000000')) AS AI_00\n" +
|
||||
" WHERE mtb_colt.ser_collo = 'UL') tmp) EAN128");
|
||||
|
||||
createOrUpdateFunction("f_getEAN128UL", "CREATE FUNCTION [dbo].[f_getEAN128UL](@gestione VARCHAR(1), @dataCollo DATETIME, @serCollo VARCHAR(2), @numCollo INT,\n" +
|
||||
" @customPrefissoEan VARCHAR(7))\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
" -- DECLARE @gestione AS VARCHAR(1) = 'L'\n" +
|
||||
"-- DECLARE @serCollo AS VARCHAR(10) = 'GG'\n" +
|
||||
"-- DECLARE @numCollo AS INT = 7837\n" +
|
||||
"-- DECLARE @dataCollo AS DATETIME = '2025-03-10';\n" +
|
||||
"-- DECLARE @customPrefissoEan AS VARCHAR(7);-- = '8017596';\n" +
|
||||
"\n" +
|
||||
" WITH barcodes AS (SELECT mtb_colt.barcode_ul AS AI_00,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_aart.cod_barre_imb IS NOT NULL AND LEN(mtb_aart.cod_barre_imb) < 14 THEN\n" +
|
||||
" FORMAT(CONVERT(NUMERIC, ISNULL(NULLIF(mtb_aart.cod_barre_imb, ''), '0')),\n" +
|
||||
" REPLICATE('0', 14))\n" +
|
||||
" ELSE mtb_aart.cod_barre_imb\n" +
|
||||
" END AS AI_01,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_aart.bar_code IS NOT NULL AND LEN(mtb_aart.bar_code) < 14\n" +
|
||||
" THEN\n" +
|
||||
" FORMAT(CONVERT(BIGINT, mtb_aart.bar_code), REPLICATE('0', 14))\n" +
|
||||
" ELSE mtb_aart.bar_code\n" +
|
||||
" END AS AI_02,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_colr.partita_mag IS NOT NULL THEN\n" +
|
||||
" mtb_colr.partita_mag + CHAR(29)\n" +
|
||||
" END AS AI_10,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_partita_mag.data_scad IS NOT NULL THEN\n" +
|
||||
" REPLACE(CONVERT(VARCHAR(10), mtb_partita_mag.data_scad, 2), '.', '')\n" +
|
||||
" END AS AI_15,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 6 THEN\n" +
|
||||
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '000000'), '.', '')\n" +
|
||||
" END AS AI_3100,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 5 THEN\n" +
|
||||
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '00000.0'), '.', '')\n" +
|
||||
" END AS AI_3101,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 4 THEN\n" +
|
||||
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '0000.00'), '.', '')\n" +
|
||||
" END AS AI_3102,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 3 THEN\n" +
|
||||
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '000.000'), '.', '')\n" +
|
||||
" END AS AI_3103,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 2 THEN\n" +
|
||||
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '00.0000'), '.', '')\n" +
|
||||
" END AS AI_3104,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 1 THEN\n" +
|
||||
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '0.00000'), '.', '')\n" +
|
||||
" END AS AI_3105,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 6 THEN\n" +
|
||||
" REPLACE(FORMAT(mtb_colt.peso_kg, '000000'), '.', '')\n" +
|
||||
" END AS AI_3300,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 5 THEN\n" +
|
||||
" REPLACE(FORMAT(mtb_colt.peso_kg, '00000.0'), '.', '')\n" +
|
||||
" END AS AI_3301,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 4 THEN\n" +
|
||||
" REPLACE(FORMAT(mtb_colt.peso_kg, '0000.00'), '.', '')\n" +
|
||||
" END AS AI_3302,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 3 THEN\n" +
|
||||
" REPLACE(FORMAT(mtb_colt.peso_kg, '000.000'), '.', '')\n" +
|
||||
" END AS AI_3303,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 2 THEN\n" +
|
||||
" REPLACE(FORMAT(mtb_colt.peso_kg, '00.0000'), '.', '')\n" +
|
||||
" END AS AI_3304,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 1 THEN\n" +
|
||||
" REPLACE(FORMAT(mtb_colt.peso_kg, '0.00000'), '.', '')\n" +
|
||||
" END AS AI_3305,\n" +
|
||||
" CONVERT(VARCHAR, CONVERT(INTEGER, SUM(mtb_colr.qta_col / mtb_colr.qta_cnf))) AS AI_37\n" +
|
||||
" FROM mtb_colt\n" +
|
||||
" INNER JOIN mtb_colr\n" +
|
||||
" ON mtb_colt.gestione = mtb_colr.gestione AND\n" +
|
||||
" mtb_colt.data_collo = mtb_colr.data_collo AND\n" +
|
||||
" mtb_colt.ser_collo = mtb_colr.ser_collo AND\n" +
|
||||
" mtb_colt.num_collo = mtb_colr.num_collo\n" +
|
||||
" INNER JOIN mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" LEFT OUTER JOIN mtb_partita_mag ON mtb_colr.cod_mart = mtb_partita_mag.cod_mart AND\n" +
|
||||
" mtb_colr.partita_mag =\n" +
|
||||
" mtb_partita_mag.partita_mag,\n" +
|
||||
" azienda\n" +
|
||||
" WHERE mtb_colt.gestione = @gestione\n" +
|
||||
" AND mtb_colt.data_collo = @dataCollo\n" +
|
||||
" AND mtb_colt.ser_collo = @serCollo\n" +
|
||||
" AND mtb_colt.num_collo = @numCollo\n" +
|
||||
" GROUP BY mtb_colr.qta_cnf,\n" +
|
||||
" mtb_colt.data_vers,\n" +
|
||||
" nome_ditta,\n" +
|
||||
" azienda.indirizzo,\n" +
|
||||
" azienda.cap,\n" +
|
||||
" azienda.citta,\n" +
|
||||
" azienda.prov,\n" +
|
||||
" prefisso_ean,\n" +
|
||||
" mtb_colt.data_collo,\n" +
|
||||
" mtb_colt.num_collo,\n" +
|
||||
" mtb_aart.cod_barre_imb,\n" +
|
||||
" mtb_aart.bar_code,\n" +
|
||||
" mtb_aart.descrizione_estesa,\n" +
|
||||
" mtb_colr.partita_mag,\n" +
|
||||
" mtb_partita_mag.data_scad,\n" +
|
||||
" mtb_colt.peso_netto_kg,\n" +
|
||||
" mtb_colr.cod_mart,\n" +
|
||||
" mtb_colt.gestione,\n" +
|
||||
" mtb_colt.peso_kg,\n" +
|
||||
" mtb_aart.peso_kg, \n" +
|
||||
" mtb_colt.barcode_ul)\n" +
|
||||
" SELECT AI_00,\n" +
|
||||
" IIF(AI_01 IS NOT NULL AND LEN(AI_01) = 13,\n" +
|
||||
" CONCAT(AI_01, dbo.getCheckDigitITF14(AI_01)), AI_01) AS AI_01,\n" +
|
||||
" AI_02,\n" +
|
||||
" AI_10,\n" +
|
||||
" AI_15,\n" +
|
||||
" AI_3100,\n" +
|
||||
" AI_3101,\n" +
|
||||
" AI_3102,\n" +
|
||||
" AI_3103,\n" +
|
||||
" AI_3104,\n" +
|
||||
" AI_3105,\n" +
|
||||
" AI_3300,\n" +
|
||||
" AI_3301,\n" +
|
||||
" AI_3302,\n" +
|
||||
" AI_3303,\n" +
|
||||
" AI_3304,\n" +
|
||||
" AI_3305,\n" +
|
||||
" AI_37\n" +
|
||||
" FROM barcodes\n" +
|
||||
"GO");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems.migration.dto.common.MigrationMvwSitArtUdcDetInventarioDTO;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Migration_20250417110238 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
//Migration per aggiornare la view mvw_sitart_udc_det_inventario
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomer(IntegryCustomer.Maggio) &&
|
||||
!isCustomer(IntegryCustomer.Biolevante) &&
|
||||
!isCustomer(IntegryCustomer.Ime) &&
|
||||
!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
|
||||
return;
|
||||
|
||||
//Aggiorno la view mvw_mtb_colr_with_giacenza
|
||||
MigrationMvwSitArtUdcDetInventarioDTO.apply(connection);
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
|
||||
resetCodJcomColli();
|
||||
//alignCodJcomScarichiFromCarichi();
|
||||
|
||||
MigrationMvwSitArtUdcDetInventarioDTO.alignGiacenza(connection);
|
||||
}
|
||||
|
||||
private void resetCodJcomColli() throws SQLException {
|
||||
executeStatement("UPDATE mtb_colr SET cod_jcom = NULL");
|
||||
}
|
||||
|
||||
private void alignCodJcomScarichiFromCarichi() throws Exception {
|
||||
String updateSql = "UPDATE mtb_colr\n" +
|
||||
"SET mtb_colr.cod_jcom = tmp.cod_jcom_carico\n" +
|
||||
" FROM mtb_colr\n" +
|
||||
" INNER JOIN\n" +
|
||||
" (SELECT mr_scarico.num_collo,\n" +
|
||||
" mr_scarico.data_collo,\n" +
|
||||
" mr_scarico.ser_collo,\n" +
|
||||
" mr_scarico.gestione,\n" +
|
||||
" mr_scarico.riga,\n" +
|
||||
" mr_scarico.cod_mart,\n" +
|
||||
" mr_scarico.partita_mag,\n" +
|
||||
" mr_scarico.cod_jcom AS cod_jcom_scarico,\n" +
|
||||
" mr_carico.num_collo AS num_collo_ccarico,\n" +
|
||||
" mr_carico.cod_jcom AS cod_jcom_carico\n" +
|
||||
" FROM mtb_colr mr_scarico\n" +
|
||||
" INNER JOIN mtb_colt mt_scarico\n" +
|
||||
" ON mr_scarico.gestione = mt_scarico.gestione AND\n" +
|
||||
" mr_scarico.data_collo = mt_scarico.data_collo AND\n" +
|
||||
" mr_scarico.num_collo = mt_scarico.num_collo AND\n" +
|
||||
" mr_scarico.ser_collo = mt_scarico.ser_collo\n" +
|
||||
" LEFT OUTER JOIN mtb_colr mr_carico\n" +
|
||||
" ON mr_scarico.gestione_rif = mr_carico.gestione AND\n" +
|
||||
" mr_scarico.data_collo_rif = mr_carico.data_collo AND\n" +
|
||||
" mr_scarico.num_collo_rif = mr_carico.num_collo AND\n" +
|
||||
" mr_scarico.ser_collo_rif = mr_carico.ser_collo AND\n" +
|
||||
" mr_scarico.cod_mart = mr_carico.cod_mart AND\n" +
|
||||
" ISNULL(mr_scarico.partita_mag, '') = ISNULL(mr_carico.partita_mag, '')\n" +
|
||||
" WHERE\n" +
|
||||
// " mt_scarico.segno = -1 AND\n" +
|
||||
" mr_carico.num_collo IS NOT NULL\n" +
|
||||
" AND ISNULL(mr_carico.cod_jcom, '') <> ISNULL(mr_scarico.cod_jcom, '')) tmp\n" +
|
||||
"ON mtb_colr.num_collo = tmp.num_collo AND\n" +
|
||||
" mtb_colr.data_collo = tmp.data_collo AND\n" +
|
||||
" mtb_colr.gestione = tmp.gestione AND\n" +
|
||||
" mtb_colr.ser_collo = tmp.ser_collo AND\n" +
|
||||
" mtb_colr.riga = tmp.riga";
|
||||
|
||||
executeStatement(updateSql);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250604172635 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateView("WMS_OrdPrelievo", "CREATE VIEW [dbo].[WMS_OrdPrelievo] AS\n" +
|
||||
"WITH elencoFornitoriInterni AS (SELECT value_string AS fornitore\n" +
|
||||
" FROM dbo.ParseStringIntoArray((SELECT value\n" +
|
||||
" FROM stb_gest_setup\n" +
|
||||
" WHERE gest_name = 'PICKING'\n" +
|
||||
" AND section = 'SPEDIZIONE'\n" +
|
||||
" AND key_section = 'ELENCO_FORNITORI_INTERNI'),\n" +
|
||||
" '|')),\n" +
|
||||
" riservatoPerOrd AS (\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"SELECT mtb_colt.gestione,\n" +
|
||||
" mtb_colr.data_ord,\n" +
|
||||
" mtb_colr.num_ord,\n" +
|
||||
" mtb_colr.riga_ord,\n" +
|
||||
" SUM(mtb_colr.qta_col) AS qtaCollo,\n" +
|
||||
" SUM(mtb_colr.num_cnf) AS numCnfCollo,\n" +
|
||||
" COUNT(DISTINCT mtb_colr.num_ord) AS ColliRiservati\n" +
|
||||
" FROM mtb_colr\n" +
|
||||
" INNER JOIN mtb_colt ON mtb_colr.gestione = mtb_colt.gestione AND\n" +
|
||||
" mtb_colr.data_collo = mtb_colt.data_collo AND\n" +
|
||||
" mtb_colr.ser_collo = mtb_colt.ser_collo AND\n" +
|
||||
" mtb_colr.num_collo = mtb_colt.num_collo\n" +
|
||||
" WHERE segno = - 1\n" +
|
||||
" AND mtb_colr.gestione IN ('L', 'V')\n" +
|
||||
" AND mtb_colr.data_ord IS NOT NULL\n" +
|
||||
" GROUP BY mtb_colt.gestione, mtb_colr.data_ord, mtb_colr.num_ord, mtb_colr.riga_ord\n" +
|
||||
"\n" +
|
||||
" ), OrdVr AS (\n" +
|
||||
" SELECT dtb_ordr.gestione,\n" +
|
||||
" dtb_ordr.data_ord,\n" +
|
||||
" dtb_ordr.num_ord,\n" +
|
||||
" dtb_ordt.cod_vdes,\n" +
|
||||
" IIF(dtb_ordr.gestione = 'V', LEFT(ISNULL(vtb_dest.citta + ' - ', '') + vtb_dest.indirizzo, 40),\n" +
|
||||
" dtb_ordt.rif_ord) AS rif_ord,\n" +
|
||||
" dtb_ordt.cod_anag,\n" +
|
||||
" dtb_ordt.cod_prod,\n" +
|
||||
" CASE dtb_ordr.gestione WHEN 'L' THEN '2' WHEN 'V' THEN '3' END +\n" +
|
||||
" REPLACE(CONVERT(VARCHAR(10), dtb_ordr.data_ord, 105), '-', '') +\n" +
|
||||
" REPLICATE('0', 5 - LEN(dtb_ordr.num_ord)) +\n" +
|
||||
" CONVERT(VARCHAR(6), dtb_ordr.num_ord) AS chiave_ordine,\n" +
|
||||
" dtb_ordr.cod_jcom,\n" +
|
||||
" dtb_ordr.cod_mart,\n" +
|
||||
" SUM(ROUND(dtb_ordr.qta_ord - dtb_ordr.qta_evasa, mtb_unt_mis.cifre_dec)) *\n" +
|
||||
" dtb_ordr.rap_conv AS qta_inevasa,\n" +
|
||||
" dtb_ordt.listino,\n" +
|
||||
" dtb_ordt.term_cons,\n" +
|
||||
" dtb_ordt.cod_auto,\n" +
|
||||
" dtb_ordt.cod_vvet,\n" +
|
||||
" dtb_ordt.data_iniz_trasp,\n" +
|
||||
" dtb_ordt.cod_mdep,\n" +
|
||||
" dtb_ordr.data_cons AS data_cons,\n" +
|
||||
" dtb_ordr.id_viaggio,\n" +
|
||||
" dtb_ordt.cod_vage,\n" +
|
||||
" SUM(colli.qtaCollo) AS qtaCollo,\n" +
|
||||
" SUM(ROUND((dtb_ordr.qta_ord - dtb_ordr.qta_evasa) * dtb_ordr.rap_conv -\n" +
|
||||
" ISNULL(colli.qtaCollo, 0),\n" +
|
||||
" mtb_unt_mis.cifre_dec)) AS qtaInevasaColli,\n" +
|
||||
" SUM(colli.numCnfCollo) AS numCnfCollo,\n" +
|
||||
" SUM(dtb_ordr.num_cnf - dtb_ordr.num_cnf_evasa -\n" +
|
||||
" ISNULL(colli.numCnfCollo, 0)) AS numCnfInevasaColli,\n" +
|
||||
" IIF((dtb_ordr.gestione = 'L' AND dtb_ordt.gestione_rif = 'T') OR\n" +
|
||||
" elencoFornitoriInterni.fornitore IS NOT NULL, 'S', 'N') AS ord_trasf\n" +
|
||||
" FROM dtb_ordt\n" +
|
||||
" INNER JOIN dtb_ordr ON dtb_ordt.gestione = dtb_ordr.gestione AND\n" +
|
||||
" dtb_ordt.data_ord = dtb_ordr.data_ord AND\n" +
|
||||
" dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||
" INNER JOIN mtb_unt_mis ON mtb_unt_mis.unt_mis = dtb_ordr.unt_ord\n" +
|
||||
" INNER JOIN mtb_aart ON dtb_ordr.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" LEFT OUTER JOIN vtb_dest ON dtb_ordt.cod_anag = vtb_dest.cod_anag AND\n" +
|
||||
" dtb_ordt.cod_vdes = vtb_dest.cod_vdes\n" +
|
||||
" LEFT OUTER JOIN riservatoPerOrd colli\n" +
|
||||
" ON dtb_ordt.gestione = colli.gestione AND\n" +
|
||||
" dtb_ordt.data_ord = colli.data_ord AND\n" +
|
||||
" dtb_ordt.num_ord = colli.num_ord\n" +
|
||||
" LEFT OUTER JOIN elencoFornitoriInterni ON fornitore = dtb_ordt.cod_anag\n" +
|
||||
" WHERE dtb_ordt.flag_annulla = 'N'\n" +
|
||||
" AND dtb_ordt.flag_sospeso = 'N'\n" +
|
||||
" AND dtb_ordr.flag_evaso = 'I'\n" +
|
||||
" AND dtb_ordt.flag_evaso_forzato = 'N'\n" +
|
||||
" AND dtb_ordt.gestione IN ('L', 'V')\n" +
|
||||
" AND ((mtb_aart.flag_qta_cnf_fissa = 'S' AND qta_ord > qta_evasa) OR\n" +
|
||||
" (mtb_aart.flag_qta_cnf_fissa <> 'S' AND num_cnf > num_cnf_evasa))\n" +
|
||||
" GROUP BY dtb_ordr.gestione, dtb_ordr.data_ord, dtb_ordr.num_ord, dtb_ordt.cod_vdes,\n" +
|
||||
" vtb_dest.indirizzo,\n" +
|
||||
" vtb_dest.citta, dtb_ordt.rif_ord, dtb_ordt.cod_anag, dtb_ordr.cod_jcom, dtb_ordr.cod_mart,\n" +
|
||||
" dtb_ordt.cod_prod, dtb_ordt.listino, dtb_ordt.term_cons, dtb_ordt.cod_auto,\n" +
|
||||
" dtb_ordt.cod_vvet, fornitore,\n" +
|
||||
" dtb_ordt.data_iniz_trasp, dtb_ordt.cod_mdep, dtb_ordt.cod_vage, dtb_ordr.id_viaggio,\n" +
|
||||
" colli.num_ord, dtb_ordr.data_cons, dtb_ordt.gestione_rif, dtb_ordr.rap_conv\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" ), OrdV AS (\n" +
|
||||
" SELECT gestione,\n" +
|
||||
" data_ord,\n" +
|
||||
" num_ord,\n" +
|
||||
" rif_ord,\n" +
|
||||
" cod_anag,\n" +
|
||||
" chiave_ordine,\n" +
|
||||
" cod_jcom,\n" +
|
||||
" cod_prod,\n" +
|
||||
" listino,\n" +
|
||||
" term_cons,\n" +
|
||||
" cod_auto,\n" +
|
||||
" cod_vvet,\n" +
|
||||
" data_iniz_trasp,\n" +
|
||||
" data_cons,\n" +
|
||||
" cod_vdes,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" COUNT(DISTINCT cod_mart) AS arts_da_evadere,\n" +
|
||||
" SUM(qtaInevasaColli) AS qtaInevasa,\n" +
|
||||
" SUM(numCnfInevasaColli) AS numCnfInevasa,\n" +
|
||||
" id_viaggio,\n" +
|
||||
" cod_vage,\n" +
|
||||
" COUNT(DISTINCT qtaCollo) AS colliRiservati,\n" +
|
||||
" ord_trasf\n" +
|
||||
" FROM OrdVr\n" +
|
||||
" GROUP BY gestione, data_ord, num_ord, rif_ord, cod_anag, chiave_ordine, cod_jcom, cod_prod, listino,\n" +
|
||||
" term_cons, cod_auto, cod_vvet, data_iniz_trasp, data_cons, cod_vdes, cod_mdep, cod_vage,\n" +
|
||||
" id_viaggio, ord_trasf\n" +
|
||||
"\n" +
|
||||
" ),\n" +
|
||||
" OrdV2 AS (SELECT OrdV.gestione,\n" +
|
||||
" OrdV.data_ord,\n" +
|
||||
" OrdV.num_ord,\n" +
|
||||
" rif_ord,\n" +
|
||||
" OrdV.cod_anag,\n" +
|
||||
" chiave_ordine,\n" +
|
||||
" cod_jcom,\n" +
|
||||
" cod_prod,\n" +
|
||||
" listino,\n" +
|
||||
" term_cons,\n" +
|
||||
" OrdV.cod_auto,\n" +
|
||||
" ISNULL(vtb_viaggi.cod_vvet, OrdV.cod_vvet) AS cod_vvet,\n" +
|
||||
" data_iniz_trasp,\n" +
|
||||
" ISNULL(CONVERT(DATETIME, CONVERT(VARCHAR(10), vtb_viaggi.data_ora_iniz_trasp, 121)),\n" +
|
||||
" data_cons) AS data_cons,\n" +
|
||||
" cod_vdes,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" arts_da_evadere AS ArtDaEvadere,\n" +
|
||||
" OrdV.id_viaggio,\n" +
|
||||
" cod_vage,\n" +
|
||||
" ISNULL(ordV.ColliRiservati, 0) AS colli_riservati,\n" +
|
||||
" qtaInevasa,\n" +
|
||||
" numCnfInevasa,\n" +
|
||||
" CAST(IIF(ISNULL(ordV.ColliRiservati, 0) > 0, 1, 0) AS BIT) exist_collo,\n" +
|
||||
" CAST(IIF(ISNULL(qtaInevasa, 0) > 0,\n" +
|
||||
" IIF(ISNULL(numCnfInevasa, 0) > 0, 0, IIF(ordV.colliRiservati > 0, 1, 0)), 1) AS BIT) AS flag_evaso,\n" +
|
||||
" ord_trasf,\n" +
|
||||
" IIF((SELECT azienda.part_iva\n" +
|
||||
" FROM azienda\n" +
|
||||
" WHERE azienda.part_iva = gtb_anag.part_iva) IS NULL, 'N', 'S') AS ord_aziendale\n" +
|
||||
" FROM Ordv\n" +
|
||||
" INNER JOIN gtb_anag ON OrdV.cod_anag = gtb_anag.cod_anag\n" +
|
||||
" LEFT OUTER JOIN vtb_viaggi ON OrdV.id_viaggio = vtb_viaggi.id_viaggio\n" +
|
||||
" WHERE (arts_da_evadere > 0 OR ISNULL(ColliRiservati, 0) > 0))\n" +
|
||||
"SELECT gestione,\n" +
|
||||
" data_ord,\n" +
|
||||
" num_ord,\n" +
|
||||
" rif_ord,\n" +
|
||||
" cod_anag,\n" +
|
||||
" chiave_ordine,\n" +
|
||||
" cod_jcom,\n" +
|
||||
" cod_prod,\n" +
|
||||
" listino,\n" +
|
||||
" term_cons,\n" +
|
||||
" cod_auto,\n" +
|
||||
" cod_vvet,\n" +
|
||||
" data_iniz_trasp,\n" +
|
||||
" data_cons,\n" +
|
||||
" cod_vdes,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" SUM(ArtDaEvadere) AS ArtDaEvadere,\n" +
|
||||
" id_viaggio,\n" +
|
||||
" cod_vage,\n" +
|
||||
" SUM(colli_riservati) AS colli_riservati,\n" +
|
||||
" SUM(qtaInevasa) AS qtaInevasa,\n" +
|
||||
" SUM(numCnfInevasa) AS numCnfInevasa,\n" +
|
||||
" exist_collo,\n" +
|
||||
" flag_evaso,\n" +
|
||||
" ord_trasf,\n" +
|
||||
" ord_aziendale\n" +
|
||||
"FROM OrdV2\n" +
|
||||
"GROUP BY gestione, data_ord, num_ord, rif_ord, cod_anag, chiave_ordine, cod_jcom, cod_prod, listino, term_cons,\n" +
|
||||
" cod_auto, cod_vvet, data_iniz_trasp, data_cons, cod_vdes, cod_mdep, id_viaggio, cod_vage, exist_collo,\n" +
|
||||
" flag_evaso, ord_trasf, ord_aziendale");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250618195259 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateView("dvw_situazione_qta_docs", "CREATE VIEW dvw_situazione_qta_docs AS\n" +
|
||||
"SELECT dtb_docr.[cod_anag],\n" +
|
||||
" dtb_docr.[cod_dtip],\n" +
|
||||
" dtb_docr.[data_doc],\n" +
|
||||
" dtb_docr.[ser_doc],\n" +
|
||||
" dtb_docr.[num_doc],\n" +
|
||||
" dtb_docr.[id_riga],\n" +
|
||||
" dtb_docr.[cod_mart],\n" +
|
||||
" dtb_docr.[descrizione],\n" +
|
||||
" dtb_docr.[unt_doc],\n" +
|
||||
" (dtb_docr.[rap_conv] / dtb_docr.[rap_conv]) AS rap_conv,\n" +
|
||||
" (dtb_docr.[qta_doc] * dtb_docr.[rap_conv]) - ISNULL(mtb_colr.qta_col, 0) AS qta_doc,\n" +
|
||||
" dtb_docr.[val_unt],\n" +
|
||||
" dtb_docr.[sconto5],\n" +
|
||||
" dtb_docr.[sconto6],\n" +
|
||||
" dtb_docr.[sconto7],\n" +
|
||||
" dtb_docr.[sconto8],\n" +
|
||||
" dtb_docr.[cod_aliq],\n" +
|
||||
" dtb_docr.[perc_prov],\n" +
|
||||
" dtb_docr.[val_prov],\n" +
|
||||
" dtb_docr.[data_ord],\n" +
|
||||
" dtb_docr.[num_ord],\n" +
|
||||
" dtb_docr.[riga_ord],\n" +
|
||||
" dtb_docr.[importo_riga],\n" +
|
||||
" dtb_docr.[cod_col],\n" +
|
||||
" dtb_docr.[cod_tagl],\n" +
|
||||
" dtb_docr.[cod_jcom],\n" +
|
||||
" dtb_docr.[cod_mdep],\n" +
|
||||
" dtb_docr.[perc_gest],\n" +
|
||||
" dtb_docr.[val_gest],\n" +
|
||||
" dtb_docr.[partita_mag],\n" +
|
||||
" dtb_docr.[val_unt_iva],\n" +
|
||||
" (dtb_docr.[qta_cnf] * dtb_docr.[rap_conv]) AS qta_cnf,\n" +
|
||||
" dtb_docr.[descrizione_estesa],\n" +
|
||||
" dtb_docr.[costo_unt],\n" +
|
||||
" dtb_docr.[perc_ispe],\n" +
|
||||
" dtb_docr.[val_ispe],\n" +
|
||||
" dtb_docr.[perc_promo],\n" +
|
||||
" dtb_docr.[val_promo],\n" +
|
||||
" dtb_docr.[perc_oneri],\n" +
|
||||
" dtb_docr.[val_oneri],\n" +
|
||||
" dtb_docr.[flag_evaso_forzato],\n" +
|
||||
" dtb_docr.[cod_dtip_comp],\n" +
|
||||
" dtb_docr.[data_doc_comp],\n" +
|
||||
" dtb_docr.[ser_doc_comp],\n" +
|
||||
" dtb_docr.[num_doc_comp],\n" +
|
||||
" dtb_docr.[cod_promo],\n" +
|
||||
" dtb_docr.[perc_prov2],\n" +
|
||||
" dtb_docr.[val_prov2],\n" +
|
||||
" dtb_docr.[cod_art_for],\n" +
|
||||
" dtb_docr.[unt_doc2],\n" +
|
||||
" dtb_docr.[qta_doc2],\n" +
|
||||
" dtb_docr.[unt_doc3],\n" +
|
||||
" dtb_docr.[qta_doc3],\n" +
|
||||
" dtb_docr.[num_cnf] - ISNULL(mtb_colr.num_cnf, 0) AS num_cnf,\n" +
|
||||
" dtb_docr.[peso_lordo],\n" +
|
||||
" dtb_docr.[posizione],\n" +
|
||||
" dtb_docr.[cod_anag_comp],\n" +
|
||||
" dtb_docr.[cod_mtip],\n" +
|
||||
" dtb_docr.[matricola],\n" +
|
||||
" dtb_docr.[data_iniz_comp],\n" +
|
||||
" dtb_docr.[data_fine_comp],\n" +
|
||||
" dtb_docr.[cod_kit],\n" +
|
||||
" dtb_docr.[cod_alis],\n" +
|
||||
" dtb_docr.[data_ins_row],\n" +
|
||||
" dtb_docr.[note],\n" +
|
||||
" dtb_doct.[gestione],\n" +
|
||||
" mtb_partita_mag.[data_scad] AS data_scad_partita_mag\n" +
|
||||
"FROM dtb_docr\n" +
|
||||
" INNER JOIN dtb_doct ON dtb_docr.num_doc = dtb_doct.num_doc AND dtb_docr.data_doc = dtb_doct.data_doc AND\n" +
|
||||
" dtb_docr.cod_anag = dtb_doct.cod_anag AND dtb_docr.cod_dtip = dtb_doct.cod_dtip AND\n" +
|
||||
" dtb_docr.ser_doc = dtb_doct.ser_doc\n" +
|
||||
" INNER JOIN mtb_aart ON dtb_docr.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" LEFT OUTER JOIN mtb_partita_mag ON dtb_docr.cod_mart = mtb_partita_mag.cod_mart AND\n" +
|
||||
" dtb_docr.partita_mag = mtb_partita_mag.partita_mag\n" +
|
||||
" LEFT OUTER JOIN ctb_cont ON mtb_aart.cod_ccon_ricavi = ctb_cont.cod_ccon\n" +
|
||||
" LEFT OUTER JOIN ctb_grup ON ctb_cont.cod_cgrp = ctb_grup.cod_cgrp\n" +
|
||||
" LEFT OUTER JOIN (SELECT gestione,\n" +
|
||||
" cod_mart,\n" +
|
||||
" cod_col,\n" +
|
||||
" cod_tagl,\n" +
|
||||
" SUM(qta_col) AS qta_col,\n" +
|
||||
" data_ord,\n" +
|
||||
" num_ord,\n" +
|
||||
" riga_ord,\n" +
|
||||
" partita_mag,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" gestione_rif,\n" +
|
||||
" data_collo_rif,\n" +
|
||||
" ser_collo_rif,\n" +
|
||||
" num_collo_rif,\n" +
|
||||
" cod_jcom,\n" +
|
||||
" SUM(num_cnf) AS num_cnf,\n" +
|
||||
" cod_anag_doc,\n" +
|
||||
" cod_dtip_doc,\n" +
|
||||
" data_doc,\n" +
|
||||
" ser_doc,\n" +
|
||||
" num_doc,\n" +
|
||||
" id_riga_doc\n" +
|
||||
" FROM mtb_colr\n" +
|
||||
" GROUP BY gestione, cod_barre, cod_mart, cod_col, cod_tagl, data_ord, num_ord, riga_ord,\n" +
|
||||
" partita_mag, qta_cnf, gestione_rif, data_collo_rif, ser_collo_rif, num_collo_rif,\n" +
|
||||
" cod_jcom, cod_anag_doc, cod_dtip_doc, data_doc, ser_doc, num_doc,\n" +
|
||||
" id_riga_doc) mtb_colr\n" +
|
||||
" ON dtb_docr.cod_anag = mtb_colr.cod_anag_doc AND dtb_docr.cod_dtip = mtb_colr.cod_dtip_doc AND\n" +
|
||||
" dtb_docr.ser_doc = mtb_colr.ser_doc AND dtb_docr.data_doc = mtb_colr.data_doc AND\n" +
|
||||
" dtb_docr.num_doc = mtb_colr.num_doc AND dtb_docr.id_riga = mtb_colr.id_riga_doc\n" +
|
||||
"WHERE (ctb_grup.sezione <> 1 OR ctb_grup.sezione IS NULL)\n" +
|
||||
" AND (dtb_docr.[qta_doc] * dtb_docr.[rap_conv]) - ISNULL(mtb_colr.qta_col, 0) > 0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250625155432 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateView("mvw_sitart_udc_det_inventario", "CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario] AS\n" +
|
||||
"WITH baseMtbColr AS (SELECT c,\n" +
|
||||
"\n" +
|
||||
" ROUND(v.qta_col, cifre_dec) AS qta_col,\n" +
|
||||
" ROUND(v.num_cnf, cifre_dec) AS num_cnf,\n" +
|
||||
" IIF(flag_qta_cnf_fissa = 'S',\n" +
|
||||
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)) AS qta_cnf,\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.peso_netto_kg,\n" +
|
||||
" v.peso_lordo_kg,\n" +
|
||||
" mtb_colt.gestione,\n" +
|
||||
" mtb_colt.data_collo,\n" +
|
||||
" mtb_colt.ser_collo,\n" +
|
||||
" mtb_colt.num_collo,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.flag_qta_cnf_fissa,\n" +
|
||||
" v.unt_mis,\n" +
|
||||
" v.diacod,\n" +
|
||||
" v.descrizione_estesa,\n" +
|
||||
" v.cod_mgrp,\n" +
|
||||
" mtb_grup.descrizione AS descrizione_gruppo,\n" +
|
||||
" v.cod_msgr,\n" +
|
||||
" mtb_sgrp.descrizione AS descrizione_sottogruppo,\n" +
|
||||
" mtb_unt_mis.flag_dig,\n" +
|
||||
" mtb_unt_mis.cifre_dec,\n" +
|
||||
" mtb_colt.segno,\n" +
|
||||
" v.cod_mdep,\n" +
|
||||
" v.posizione,\n" +
|
||||
" mtb_colt.cod_dtip,\n" +
|
||||
" mtb_colt.cod_jfas,\n" +
|
||||
" v.barcode_ul,\n" +
|
||||
" v.qta_cnf_anag,\n" +
|
||||
" mtb_colr.datetime_row AS datetime_posizionamento\n" +
|
||||
" FROM mvw_mtb_colr_with_giacenza v WITH (NOEXPAND)\n" +
|
||||
" INNER JOIN mtb_colt\n" +
|
||||
" ON v.barcode_ul = mtb_colt.barcode_ul\n" +
|
||||
" LEFT OUTER JOIN mtb_colr ON\n" +
|
||||
" v.barcode_ul = mtb_colr.barcode_ul_in AND\n" +
|
||||
" v.cod_mart = mtb_colr.cod_mart AND\n" +
|
||||
" ISNULL(v.partita_mag, '') = ISNULL(mtb_colr.partita_mag, '') AND\n" +
|
||||
" ISNULL(v.cod_col, '') = ISNULL(mtb_colr.cod_col, '') AND\n" +
|
||||
" ISNULL(v.cod_tagl, '') = ISNULL(mtb_colr.cod_tagl, '') AND\n" +
|
||||
" ISNULL(v.cod_jcom, '') = ISNULL(mtb_colr.cod_jcom, '') AND\n" +
|
||||
" ISNULL(v.posizione, '') = ISNULL(mtb_colr.posizione_in, '') AND\n" +
|
||||
" ISNULL(v.cod_mdep, '') = ISNULL(mtb_colr.cod_mdep_in, '') AND\n" +
|
||||
" ISNULL(mtb_colr.posizione_in, '') <> ISNULL(mtb_colr.posizione_out, '')\n" +
|
||||
" INNER JOIN dbo.mtb_unt_mis ON v.unt_mis = mtb_unt_mis.unt_mis\n" +
|
||||
"\n" +
|
||||
" INNER JOIN dbo.mtb_grup ON v.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" INNER JOIN dbo.mtb_sgrp ON v.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
|
||||
" AND v.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
" WHERE v.qta_col > 0\n" +
|
||||
" AND (segno = 1 OR (segno = -1 AND cod_dtip IS NULL AND mtb_colt.gestione = 'V'))),\n" +
|
||||
" final_stock AS (SELECT v.qta_col,\n" +
|
||||
" v.num_cnf,\n" +
|
||||
" v.qta_cnf,\n" +
|
||||
" v.gestione,\n" +
|
||||
" v.data_collo,\n" +
|
||||
" v.ser_collo,\n" +
|
||||
" v.num_collo,\n" +
|
||||
" v.cod_mdep AS cod_mdep,\n" +
|
||||
" v.posizione AS posizione,\n" +
|
||||
" mtb_depo_posizioni.priorita,\n" +
|
||||
" v.cod_mgrp AS codGruppo,\n" +
|
||||
" v.descrizione_gruppo AS Gruppo,\n" +
|
||||
" v.cod_msgr AS CodSgruppo,\n" +
|
||||
" v.descrizione_sottogruppo AS Sottogruppo,\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.diacod,\n" +
|
||||
" v.descrizione_estesa,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.peso_netto_kg,\n" +
|
||||
" v.peso_lordo_kg,\n" +
|
||||
" v.cod_jfas,\n" +
|
||||
" v.flag_qta_cnf_fissa,\n" +
|
||||
" v.unt_mis,\n" +
|
||||
" v.segno,\n" +
|
||||
" v.barcode_ul,\n" +
|
||||
" v.datetime_posizionamento\n" +
|
||||
" FROM baseMtbColr v\n" +
|
||||
"\n" +
|
||||
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
|
||||
" ON v.cod_mdep = mtb_depo_posizioni.cod_mdep\n" +
|
||||
" AND v.posizione = mtb_depo_posizioni.posizione)\n" +
|
||||
"\n" +
|
||||
"SELECT qta_col,\n" +
|
||||
" num_cnf,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" ser_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" posizione,\n" +
|
||||
" priorita,\n" +
|
||||
" codGruppo,\n" +
|
||||
" Gruppo,\n" +
|
||||
" CodSgruppo,\n" +
|
||||
" Sottogruppo,\n" +
|
||||
" cod_mart,\n" +
|
||||
" diacod,\n" +
|
||||
" descrizione_estesa,\n" +
|
||||
" partita_mag,\n" +
|
||||
" cod_col,\n" +
|
||||
" cod_tagl,\n" +
|
||||
" cod_jcom,\n" +
|
||||
" peso_netto_kg,\n" +
|
||||
" peso_lordo_kg,\n" +
|
||||
" cod_jfas,\n" +
|
||||
" flag_qta_cnf_fissa,\n" +
|
||||
" unt_mis,\n" +
|
||||
" segno,\n" +
|
||||
" barcode_ul,\n" +
|
||||
" datetime_posizionamento\n" +
|
||||
"FROM final_stock");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250626142053 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
String reportNamePackingList = null;
|
||||
if (isCustomer(IntegryCustomer.RossoGargano)) {
|
||||
reportNamePackingList = "PackingListScarico";
|
||||
}
|
||||
createSetup("PVM", "CONTROLLO_GIACENZE", "REPORT_NAME_PACKING_LIST", reportNamePackingList, "Nome report per stampa packing list post trasferimento", "REPORT_NAME");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250627184608 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
String value = null;
|
||||
if (isCustomer(IntegryCustomer.RossoGargano)){
|
||||
value = "ControlloGiacenzeSintetico";
|
||||
}
|
||||
createSetup("PVM","CONTROLLO_GIACENZE","REPORT_NAME_ELENCO_SINTETICO",value,"Report name per report giacenze sintetico da portale web","REPORT_NAME");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250630164505 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateView("mvw_sitart_udc_det_inventario", "CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario] AS\n" +
|
||||
"WITH baseMtbColr AS (SELECT c,\n" +
|
||||
"\n" +
|
||||
" ROUND(v.qta_col, cifre_dec) AS qta_col,\n" +
|
||||
" ROUND(v.num_cnf, cifre_dec) AS num_cnf,\n" +
|
||||
" IIF(flag_qta_cnf_fissa = 'S',\n" +
|
||||
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)) AS qta_cnf,\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.peso_netto_kg,\n" +
|
||||
" v.peso_lordo_kg,\n" +
|
||||
" mtb_colt.gestione,\n" +
|
||||
" mtb_colt.data_collo,\n" +
|
||||
" mtb_colt.ser_collo,\n" +
|
||||
" mtb_colt.num_collo,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.flag_qta_cnf_fissa,\n" +
|
||||
" v.unt_mis,\n" +
|
||||
" v.diacod,\n" +
|
||||
" v.descrizione_estesa,\n" +
|
||||
" v.cod_mgrp,\n" +
|
||||
" mtb_grup.descrizione AS descrizione_gruppo,\n" +
|
||||
" v.cod_msgr,\n" +
|
||||
" mtb_sgrp.descrizione AS descrizione_sottogruppo,\n" +
|
||||
" mtb_unt_mis.flag_dig,\n" +
|
||||
" mtb_unt_mis.cifre_dec,\n" +
|
||||
" mtb_colt.segno,\n" +
|
||||
" v.cod_mdep,\n" +
|
||||
" v.posizione,\n" +
|
||||
" mtb_colt.cod_dtip,\n" +
|
||||
" mtb_colt.cod_jfas,\n" +
|
||||
" v.barcode_ul,\n" +
|
||||
" v.qta_cnf_anag,\n" +
|
||||
" MAX(mtb_colr.datetime_row) AS datetime_posizionamento\n" +
|
||||
" FROM mvw_mtb_colr_with_giacenza v WITH (NOEXPAND)\n" +
|
||||
" INNER JOIN mtb_colt\n" +
|
||||
" ON v.barcode_ul = mtb_colt.barcode_ul\n" +
|
||||
" LEFT OUTER JOIN mtb_colr ON\n" +
|
||||
" v.barcode_ul = mtb_colr.barcode_ul_in AND\n" +
|
||||
" v.cod_mart = mtb_colr.cod_mart AND\n" +
|
||||
" ((v.partita_mag IS NULL AND mtb_colr.partita_mag IS NULL) OR\n" +
|
||||
" (v.partita_mag = mtb_colr.partita_mag)) AND\n" +
|
||||
" ((v.cod_col IS NULL AND mtb_colr.cod_col IS NULL) OR (v.cod_col = mtb_colr.cod_col)) AND\n" +
|
||||
" ((v.cod_tagl IS NULL AND mtb_colr.cod_tagl IS NULL) OR (v.cod_tagl = mtb_colr.cod_tagl)) AND\n" +
|
||||
" ((v.cod_jcom IS NULL AND mtb_colr.cod_jcom IS NULL) OR (v.cod_jcom = mtb_colr.cod_jcom)) AND\n" +
|
||||
" ((v.posizione IS NULL AND mtb_colr.posizione_in IS NULL) OR (v.posizione = mtb_colr.posizione_in)) AND\n" +
|
||||
" ((v.cod_mdep IS NULL AND mtb_colr.cod_mdep_in IS NULL) OR (v.cod_mdep = mtb_colr.cod_mdep_in)) AND\n" +
|
||||
" ISNULL(mtb_colr.posizione_in, '') <> ISNULL(mtb_colr.posizione_out, '')\n" +
|
||||
" INNER JOIN dbo.mtb_unt_mis ON v.unt_mis = mtb_unt_mis.unt_mis\n" +
|
||||
"\n" +
|
||||
" INNER JOIN dbo.mtb_grup ON v.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" INNER JOIN dbo.mtb_sgrp ON v.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
|
||||
" AND v.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
" WHERE v.qta_col > 0\n" +
|
||||
" AND (segno = 1 OR (segno = -1 AND cod_dtip IS NULL AND mtb_colt.gestione = 'V'))\n" +
|
||||
" GROUP BY c,\n" +
|
||||
" ROUND(v.qta_col, cifre_dec),\n" +
|
||||
" ROUND(v.num_cnf, cifre_dec),\n" +
|
||||
" IIF(flag_qta_cnf_fissa = 'S',\n" +
|
||||
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)),\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.peso_netto_kg,\n" +
|
||||
" v.peso_lordo_kg,\n" +
|
||||
" mtb_colt.gestione,\n" +
|
||||
" mtb_colt.data_collo,\n" +
|
||||
" mtb_colt.ser_collo,\n" +
|
||||
" mtb_colt.num_collo,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.flag_qta_cnf_fissa,\n" +
|
||||
" v.unt_mis,\n" +
|
||||
" v.diacod,\n" +
|
||||
" v.descrizione_estesa,\n" +
|
||||
" v.cod_mgrp,\n" +
|
||||
" mtb_grup.descrizione,\n" +
|
||||
" v.cod_msgr,\n" +
|
||||
" mtb_sgrp.descrizione,\n" +
|
||||
" mtb_unt_mis.flag_dig,\n" +
|
||||
" mtb_unt_mis.cifre_dec,\n" +
|
||||
" mtb_colt.segno,\n" +
|
||||
" v.cod_mdep,\n" +
|
||||
" v.posizione,\n" +
|
||||
" mtb_colt.cod_dtip,\n" +
|
||||
" mtb_colt.cod_jfas,\n" +
|
||||
" v.barcode_ul,\n" +
|
||||
" v.qta_cnf_anag),\n" +
|
||||
" final_stock AS (SELECT v.qta_col,\n" +
|
||||
" v.num_cnf,\n" +
|
||||
" v.qta_cnf,\n" +
|
||||
" v.gestione,\n" +
|
||||
" v.data_collo,\n" +
|
||||
" v.ser_collo,\n" +
|
||||
" v.num_collo,\n" +
|
||||
" v.cod_mdep AS cod_mdep,\n" +
|
||||
" v.posizione AS posizione,\n" +
|
||||
" mtb_depo_posizioni.priorita,\n" +
|
||||
" v.cod_mgrp AS codGruppo,\n" +
|
||||
" v.descrizione_gruppo AS Gruppo,\n" +
|
||||
" v.cod_msgr AS CodSgruppo,\n" +
|
||||
" v.descrizione_sottogruppo AS Sottogruppo,\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.diacod,\n" +
|
||||
" v.descrizione_estesa,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.peso_netto_kg,\n" +
|
||||
" v.peso_lordo_kg,\n" +
|
||||
" v.cod_jfas,\n" +
|
||||
" v.flag_qta_cnf_fissa,\n" +
|
||||
" v.unt_mis,\n" +
|
||||
" v.segno,\n" +
|
||||
" v.barcode_ul,\n" +
|
||||
" v.datetime_posizionamento\n" +
|
||||
" FROM baseMtbColr v\n" +
|
||||
"\n" +
|
||||
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
|
||||
" ON v.cod_mdep = mtb_depo_posizioni.cod_mdep\n" +
|
||||
" AND v.posizione = mtb_depo_posizioni.posizione)\n" +
|
||||
"\n" +
|
||||
"SELECT qta_col,\n" +
|
||||
" num_cnf,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" ser_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" posizione,\n" +
|
||||
" priorita,\n" +
|
||||
" codGruppo,\n" +
|
||||
" Gruppo,\n" +
|
||||
" CodSgruppo,\n" +
|
||||
" Sottogruppo,\n" +
|
||||
" cod_mart,\n" +
|
||||
" diacod,\n" +
|
||||
" descrizione_estesa,\n" +
|
||||
" partita_mag,\n" +
|
||||
" cod_col,\n" +
|
||||
" cod_tagl,\n" +
|
||||
" cod_jcom,\n" +
|
||||
" peso_netto_kg,\n" +
|
||||
" peso_lordo_kg,\n" +
|
||||
" cod_jfas,\n" +
|
||||
" flag_qta_cnf_fissa,\n" +
|
||||
" unt_mis,\n" +
|
||||
" segno,\n" +
|
||||
" barcode_ul,\n" +
|
||||
" datetime_posizionamento\n" +
|
||||
"FROM final_stock");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250714164813 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateFunction("WMS_GetUltimeConsegneClienti", "CREATE FUNCTION [dbo].[WMS_GetUltimeConsegneClienti](@numConsegnePerClie INT, @codAnag VARCHAR(5), @codMart VARCHAR(15),\n" +
|
||||
" @codMdep VARCHAR(5), @daysDiff INT)\n" +
|
||||
"/*Funzione che restituisce le ultime consegne effettuate per conto di un cliente con possibilitàdi filtrare per articolo/deposito.\n" +
|
||||
"Se il cliente non viene passato allora la funzione restituiràle ultime consegne di tutti i clienti. */\n" +
|
||||
" RETURNS TABLE AS RETURN\n" +
|
||||
" SELECT DISTINCT *\n" +
|
||||
" FROM (SELECT dtb_doct.cod_anag,\n" +
|
||||
" DENSE_RANK() OVER (PARTITION BY dtb_doct.cod_anag ORDER BY dtb_doct.cod_anag ASC, dtb_doct.data_doc DESC, dtb_doct.num_doc) AS counter_consegna,\n" +
|
||||
" dtb_doct.cod_dtip,\n" +
|
||||
" dtb_doct.data_doc,\n" +
|
||||
" dtb_doct.ser_doc,\n" +
|
||||
" dtb_doct.num_doc,\n" +
|
||||
" dtb_doct.compilato_da,\n" +
|
||||
" dtb_doct.rif_ord,\n" +
|
||||
" dtb_doct.data_ord,\n" +
|
||||
" vtb_dest.destinatario,\n" +
|
||||
" vtb_dest.indirizzo,\n" +
|
||||
" dtb_doct.data_iniz_trasp\n" +
|
||||
" FROM dtb_doct\n" +
|
||||
" INNER JOIN dtb_docr ON dtb_doct.cod_anag = dtb_docr.cod_anag AND\n" +
|
||||
" dtb_doct.cod_dtip = dtb_docr.cod_dtip AND\n" +
|
||||
" dtb_doct.num_doc = dtb_docr.num_doc AND\n" +
|
||||
" dtb_doct.data_doc = dtb_docr.data_doc AND\n" +
|
||||
" dtb_doct.ser_doc = dtb_docr.ser_doc\n" +
|
||||
" INNER JOIN dtb_tipi ON dtb_doct.cod_dtip = dtb_tipi.cod_dtip\n" +
|
||||
" LEFT OUTER JOIN vtb_dest\n" +
|
||||
" ON dtb_doct.cod_anag = vtb_dest.cod_anag\n" +
|
||||
" AND dtb_doct.cod_vdes = vtb_dest.cod_vdes\n" +
|
||||
"\n" +
|
||||
" WHERE dtb_doct.gestione = 'V'\n" +
|
||||
" AND dtb_tipi.tipo_emissione = 'DIRETTA'\n" +
|
||||
" AND dtb_tipi.segno_qta_scar = 1\n" +
|
||||
" AND DATEDIFF(DAY, dtb_doct.data_doc, GETDATE()) <= @daysDiff\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" AND (@codMdep IS NULL\n" +
|
||||
" OR dtb_doct.cod_mdep = @codMdep)\n" +
|
||||
" AND (@codMart IS NULL\n" +
|
||||
" OR dtb_docr.cod_mart = @codMart)\n" +
|
||||
" AND (@codAnag IS NULL\n" +
|
||||
" OR dtb_doct.cod_anag = @codAnag)) grouped_consegne\n" +
|
||||
" WHERE @numConsegnePerClie IS NULL\n" +
|
||||
" OR grouped_consegne.counter_consegna <= @numConsegnePerClie");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250715110408 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateFunction("WMS_GetUltimeConsegneClienti", "CREATE FUNCTION [dbo].[WMS_GetUltimeConsegneClienti](@numConsegnePerClie INT, @codAnag VARCHAR(5), @codVdes VARCHAR(5), @codMart VARCHAR(15),\n" +
|
||||
" @codMdep VARCHAR(5), @daysDiff INT)\n" +
|
||||
"/*Funzione che restituisce le ultime consegne effettuate per conto di un cliente con possibilitàdi filtrare per articolo/deposito.\n" +
|
||||
"Se il cliente non viene passato allora la funzione restituiràle ultime consegne di tutti i clienti. */\n" +
|
||||
" RETURNS TABLE AS RETURN\n" +
|
||||
" SELECT DISTINCT *\n" +
|
||||
" FROM (SELECT dtb_doct.cod_anag,\n" +
|
||||
" DENSE_RANK() OVER (PARTITION BY dtb_doct.cod_anag ORDER BY dtb_doct.cod_anag ASC, dtb_doct.data_doc DESC, dtb_doct.num_doc) AS counter_consegna,\n" +
|
||||
" dtb_doct.cod_dtip,\n" +
|
||||
" dtb_doct.data_doc,\n" +
|
||||
" dtb_doct.ser_doc,\n" +
|
||||
" dtb_doct.num_doc,\n" +
|
||||
" dtb_doct.compilato_da,\n" +
|
||||
" dtb_doct.rif_ord,\n" +
|
||||
" dtb_doct.data_ord,\n" +
|
||||
" vtb_dest.destinatario,\n" +
|
||||
" vtb_dest.indirizzo,\n" +
|
||||
" dtb_doct.data_iniz_trasp\n" +
|
||||
" FROM dtb_doct\n" +
|
||||
" INNER JOIN dtb_docr ON dtb_doct.cod_anag = dtb_docr.cod_anag AND\n" +
|
||||
" dtb_doct.cod_dtip = dtb_docr.cod_dtip AND\n" +
|
||||
" dtb_doct.num_doc = dtb_docr.num_doc AND\n" +
|
||||
" dtb_doct.data_doc = dtb_docr.data_doc AND\n" +
|
||||
" dtb_doct.ser_doc = dtb_docr.ser_doc\n" +
|
||||
" INNER JOIN dtb_tipi ON dtb_doct.cod_dtip = dtb_tipi.cod_dtip\n" +
|
||||
" LEFT OUTER JOIN vtb_dest\n" +
|
||||
" ON dtb_doct.cod_anag = vtb_dest.cod_anag\n" +
|
||||
" AND dtb_doct.cod_vdes = vtb_dest.cod_vdes\n" +
|
||||
"\n" +
|
||||
" WHERE dtb_doct.gestione = 'V'\n" +
|
||||
" AND dtb_tipi.tipo_emissione = 'DIRETTA'\n" +
|
||||
" AND dtb_tipi.segno_qta_scar = 1\n" +
|
||||
" AND DATEDIFF(DAY, dtb_doct.data_doc, GETDATE()) <= @daysDiff\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" AND (@codMdep IS NULL\n" +
|
||||
" OR dtb_doct.cod_mdep = @codMdep)\n" +
|
||||
" AND (@codMart IS NULL\n" +
|
||||
" OR dtb_docr.cod_mart = @codMart)\n" +
|
||||
" AND (@codAnag IS NULL\n" +
|
||||
" OR dtb_doct.cod_anag = @codAnag)\n" +
|
||||
" AND (@codVdes IS NULL\n" +
|
||||
" OR dtb_doct.cod_vdes = @codVdes)) grouped_consegne\n" +
|
||||
" WHERE @numConsegnePerClie IS NULL\n" +
|
||||
" OR grouped_consegne.counter_consegna <= @numConsegnePerClie");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250728095637 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("alter table dbo.atb_tipi add socio_aziendale BIT default 0 not null");
|
||||
|
||||
|
||||
if (isCustomer(IntegryCustomer.RossoGargano)) {
|
||||
executeStatement("UPDATE dbo.atb_tipi SET socio_aziendale = 1 where cod_atip in (N'C1050', N'C1055')");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250728125101 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
String reportNameScar = null;
|
||||
String reportNameLav = null;
|
||||
|
||||
if (isCustomer(IntegryCustomer.RossoGargano)) {
|
||||
reportNameScar = "ReportScaricoProdotto";
|
||||
reportNameLav = "RiepilogoLavorazioniMateriaPrimaGrezza";
|
||||
}
|
||||
|
||||
createSetup("PVM","PIAN_ACC_ROSSG","REPORT_NAME_RIEP_SCARICO_PRODOTTO",reportNameScar,"Nome report stampa riepilogo scarico prodotti (da tab omonima in pagina accettazione da campo)","REPORT_NAME");
|
||||
createSetup("PVM","PIAN_ACC_ROSSG","REPORT_NAME_RIEP_LAV_MATERIALE",reportNameLav,"Nome report stampa riepilogo lavorazioni del giorno (da tab Laborazioni in pagina accettazione da campo)","REPORT_NAME");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250909162127 extends BaseMigration implements MigrationModelInterface {
|
||||
@@ -10,7 +10,8 @@ public class Migration_20250909162127 extends BaseMigration implements Migration
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
if (!isCustomer(IntegryCustomer.Biolevante))
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Biolevante_Biolevante))
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250925103840 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
String sqlCreateMaster = "CREATE TABLE dbo.mtb_missione_mag_auto\n" +
|
||||
"(\n" +
|
||||
" id BIGINT IDENTITY\n" +
|
||||
" CONSTRAINT mtb_missione_mag_auto_pk\n" +
|
||||
" PRIMARY KEY,\n" +
|
||||
" cod_mdep VARCHAR(5) NOT NULL,\n" +
|
||||
" cod_area VARCHAR(15) NOT NULL,\n" +
|
||||
" CONSTRAINT table_name_mtb_depo_area_cod_area_cod_mdep_fk\n" +
|
||||
" FOREIGN KEY (cod_mdep, cod_area) REFERENCES dbo.mtb_depo_area (cod_mdep, cod_area),\n" +
|
||||
" created_by VARCHAR(40) NOT NULL\n" +
|
||||
" CONSTRAINT mtb_missione_mag_auto_stb_user_user_name_fk\n" +
|
||||
" REFERENCES dbo.stb_user,\n" +
|
||||
" created_at DATETIME DEFAULT GETDATE() NOT NULL\n" +
|
||||
")";
|
||||
|
||||
String sqlCreateDetail = "CREATE TABLE dbo.mtb_missione_mag_auto_det\n" +
|
||||
"(\n" +
|
||||
" id BIGINT IDENTITY\n" +
|
||||
" CONSTRAINT mtb_missione_mag_auto_det_pk\n" +
|
||||
" PRIMARY KEY,\n" +
|
||||
" parent_id BIGINT NOT NULL\n" +
|
||||
" CONSTRAINT mtb_missione_mag_auto_det_mtb_missione_mag_auto_id_fk\n" +
|
||||
" REFERENCES dbo.mtb_missione_mag_auto (id),\n" +
|
||||
" sscc VARCHAR(18),\n" +
|
||||
" posizione_in VARCHAR(40),\n" +
|
||||
" posizione_out VARCHAR(40),\n" +
|
||||
" error_message VARCHAR(MAX),\n" +
|
||||
" completed BIT DEFAULT 0 NOT NULL,\n" +
|
||||
" skipped BIT DEFAULT 0 NOT NULL,\n" +
|
||||
" started_at DATETIME,\n" +
|
||||
" ended_at DATETIME,\n" +
|
||||
" created_at DATETIME DEFAULT GETDATE(),\n" +
|
||||
" updated_at DATETIME DEFAULT GETDATE() NOT NULL\n" +
|
||||
")";
|
||||
|
||||
executeStatement(sqlCreateMaster, sqlCreateDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251015111009 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("alter table dbo.dtb_ord_steps add posizione_out varchar(40)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,610 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251015111701 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateFunction("MES_GetWorkOrders", "CREATE FUNCTION [dbo].[MES_GetWorkOrders](@codJfas VARCHAR(50), @dateStart DATE, @dateEnd DATE, @flagEvaso VARCHAR(1),\n" +
|
||||
" @codAnag VARCHAR(5))\n" +
|
||||
" RETURNS TABLE\n" +
|
||||
" AS RETURN\n" +
|
||||
" -- DECLARE @codJfas VARCHAR(5) = 'L1'\n" +
|
||||
" -- DECLARE @dateStart DATE = DATEADD(MONTH, -1, GETDATE())\n" +
|
||||
" -- DECLARE @dateEnd DATE = DATEADD(MONTH, 1, GETDATE())\n" +
|
||||
" -- DECLARE @flagEvaso VARCHAR(1) = 'I'\n" +
|
||||
" -- DECLARE @codAnag VARCHAR(5) = null;\n" +
|
||||
"\n" +
|
||||
"--Funzione per calcolare la sequenza di ordini su una linea e il RunTimeEND\n" +
|
||||
" WITH setup AS (SELECT ISNULL(@dateStart, DATEADD(DAY, -14, GETDATE())) AS date_start,\n" +
|
||||
" ISNULL(@dateEnd, GETDATE()) AS date_end,\n" +
|
||||
" ISNULL(@flagEvaso, 'I') AS flag_evaso,\n" +
|
||||
" @codJfas AS cod_jfas,\n" +
|
||||
" @codAnag AS cod_anag),\n" +
|
||||
"\n" +
|
||||
" setup_depo AS (SELECT cod_mdep, value AS flag_carico_scarico_immediato\n" +
|
||||
" FROM stb_gest_setup_depo\n" +
|
||||
" WHERE gest_name = 'CARICO_SCARICO_PF'\n" +
|
||||
" AND section = 'SETUP'\n" +
|
||||
" AND key_section = 'GENERA_CARICO_SCARICO_IMMEDIATO'),\n" +
|
||||
"\n" +
|
||||
" setup_run_time AS (SELECT value AS flag_restart\n" +
|
||||
" FROM stb_gest_setup\n" +
|
||||
" WHERE gest_name = 'PVM'\n" +
|
||||
" AND section = 'MONITORAGGIO_LINEE_V2'\n" +
|
||||
" AND key_section = 'RESTART_RUN_TIME_END'),\n" +
|
||||
"\n" +
|
||||
" mtb_colr_sum_filtered_rows AS (SELECT gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" ser_collo,\n" +
|
||||
" cod_mart,\n" +
|
||||
" data_ord,\n" +
|
||||
" num_ord,\n" +
|
||||
" qta_col,\n" +
|
||||
" num_cnf\n" +
|
||||
" FROM mtb_colr\n" +
|
||||
" WHERE gestione_rif IS NULL\n" +
|
||||
" AND data_collo_rif IS NULL\n" +
|
||||
" AND ser_collo_rif IS NULL\n" +
|
||||
" AND num_collo_rif IS NULL),\n" +
|
||||
"\n" +
|
||||
" mtb_colr_sum_valid_colli AS (SELECT DISTINCT gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" ser_collo,\n" +
|
||||
" num_collo\n" +
|
||||
" FROM mtb_colt\n" +
|
||||
" CROSS APPLY setup\n" +
|
||||
" WHERE segno = 1\n" +
|
||||
" AND data_ord BETWEEN setup.date_start AND setup.date_end),\n" +
|
||||
"\n" +
|
||||
" mtb_colr_sum AS (SELECT colr.gestione,\n" +
|
||||
" colr.data_collo,\n" +
|
||||
" colr.num_collo,\n" +
|
||||
" colr.ser_collo,\n" +
|
||||
" colr.cod_mart,\n" +
|
||||
" colr.data_ord,\n" +
|
||||
" colr.num_ord,\n" +
|
||||
" SUM(colr.qta_col) AS qta_col,\n" +
|
||||
" SUM(colr.num_cnf) AS num_cnf\n" +
|
||||
" FROM mtb_colr_sum_valid_colli colt\n" +
|
||||
" INNER JOIN mtb_colr_sum_filtered_rows colr\n" +
|
||||
" ON colr.gestione = colt.gestione\n" +
|
||||
" AND colr.data_collo = colt.data_collo\n" +
|
||||
" AND colr.num_collo = colt.num_collo\n" +
|
||||
" AND colr.ser_collo = colt.ser_collo\n" +
|
||||
" GROUP BY colr.gestione,\n" +
|
||||
" colr.data_collo,\n" +
|
||||
" colr.num_collo,\n" +
|
||||
" colr.ser_collo,\n" +
|
||||
" colr.cod_mart,\n" +
|
||||
" colr.data_ord,\n" +
|
||||
" colr.num_ord),\n" +
|
||||
"\n" +
|
||||
" machine_last_event AS (SELECT gestione,\n" +
|
||||
" data_ord,\n" +
|
||||
" num_ord,\n" +
|
||||
" cod_cmac,\n" +
|
||||
" MAX(data_mov) AS max_data_mov\n" +
|
||||
" FROM dtb_ord_macc\n" +
|
||||
" GROUP BY gestione, data_ord, num_ord, cod_cmac),\n" +
|
||||
"\n" +
|
||||
" machine_event_values AS (SELECT evento,\n" +
|
||||
" IIF(tipologia = 'ENTRATA', 1, -1) AS value\n" +
|
||||
" FROM dtb_ord_macc_eventi),\n" +
|
||||
"\n" +
|
||||
" in_production_machines AS (SELECT dtb.gestione,\n" +
|
||||
" dtb.data_ord,\n" +
|
||||
" dtb.num_ord,\n" +
|
||||
" LAST_VALUE(dtb.data_mov) OVER (ORDER BY dtb.gestione,\n" +
|
||||
" dtb.data_ord,\n" +
|
||||
" dtb.num_ord) AS max_data_mov,\n" +
|
||||
" LAST_VALUE(ev.value) OVER (ORDER BY dtb.gestione,\n" +
|
||||
" dtb.data_ord,\n" +
|
||||
" dtb.num_ord) AS final_value\n" +
|
||||
" FROM dtb_ord_macc dtb\n" +
|
||||
" INNER JOIN machine_last_event le\n" +
|
||||
" ON dtb.data_ord = le.data_ord\n" +
|
||||
" AND dtb.num_ord = le.num_ord\n" +
|
||||
" AND dtb.gestione = le.gestione\n" +
|
||||
" AND dtb.cod_cmac = le.cod_cmac\n" +
|
||||
" AND dtb.data_mov = le.max_data_mov\n" +
|
||||
" INNER JOIN machine_event_values ev\n" +
|
||||
" ON dtb.evento = ev.evento\n" +
|
||||
" CROSS APPLY setup\n" +
|
||||
" WHERE dtb.data_ord BETWEEN setup.date_start AND setup.date_end),\n" +
|
||||
"\n" +
|
||||
" dtb_ord_with_max_step AS (SELECT gestione,\n" +
|
||||
" data_ord,\n" +
|
||||
" num_ord,\n" +
|
||||
" id_step AS id_step,\n" +
|
||||
" MAX(id_step) OVER (PARTITION BY gestione,\n" +
|
||||
" data_ord,\n" +
|
||||
" num_ord,\n" +
|
||||
" dtb_ord_steps.cod_jfas,\n" +
|
||||
" dtb_ord_steps.num_fase) AS max_id_step,\n" +
|
||||
" num_fase,\n" +
|
||||
" MAX(num_fase) OVER (PARTITION BY gestione,\n" +
|
||||
" data_ord,\n" +
|
||||
" num_ord) AS max_fase,\n" +
|
||||
" dtb_ord_steps.cod_jfas,\n" +
|
||||
" dtb_ord_steps.flag_step_attivo,\n" +
|
||||
" dtb_ord_steps.data_iniz,\n" +
|
||||
" dtb_ord_steps.data_fine,\n" +
|
||||
" dtb_ord_steps.qta_lav,\n" +
|
||||
" dtb_ord_steps.qta_prod,\n" +
|
||||
" dtb_ord_steps.hr_num,\n" +
|
||||
" dtb_ord_steps.posizione_out,\n" +
|
||||
" dtb_ord_steps.descrizione_attivita,\n" +
|
||||
" SUM(CAST(DATEDIFF(S, data_iniz, ISNULL(data_fine, GETDATE())) AS BIGINT))\n" +
|
||||
" OVER (PARTITION BY gestione,\n" +
|
||||
" data_ord,\n" +
|
||||
" num_ord,\n" +
|
||||
" num_fase,\n" +
|
||||
" dtb_ord_steps.cod_jfas) AS elapsed_time\n" +
|
||||
" FROM dtb_ord_steps\n" +
|
||||
" CROSS APPLY setup\n" +
|
||||
" WHERE data_ord BETWEEN setup.date_start AND setup.date_end\n" +
|
||||
" AND gestione = 'L'),\n" +
|
||||
"\n" +
|
||||
" dtb_ord_max_step AS (SELECT DISTINCT IIF(in_production_machines.max_data_mov IS NOT NULL AND\n" +
|
||||
" (dtb_ord_with_max_step.id_step = 0 OR\n" +
|
||||
" (dtb_ord_with_max_step.id_step > 0 AND\n" +
|
||||
" dtb_ord_with_max_step.data_fine IS NOT NULL AND\n" +
|
||||
" DATEDIFF(MINUTE,\n" +
|
||||
" dtb_ord_with_max_step.data_fine,\n" +
|
||||
" in_production_machines.max_data_mov) >\n" +
|
||||
" 5)), 1, 0) AS starting_machines,\n" +
|
||||
" dtb_ord_with_max_step.*\n" +
|
||||
" FROM dtb_ord_with_max_step\n" +
|
||||
" LEFT OUTER JOIN in_production_machines\n" +
|
||||
" ON dtb_ord_with_max_step.data_ord =\n" +
|
||||
" in_production_machines.data_ord\n" +
|
||||
" AND\n" +
|
||||
" dtb_ord_with_max_step.num_ord =\n" +
|
||||
" in_production_machines.num_ord\n" +
|
||||
" AND\n" +
|
||||
" dtb_ord_with_max_step.gestione =\n" +
|
||||
" in_production_machines.gestione\n" +
|
||||
" AND in_production_machines.final_value = 1\n" +
|
||||
"\n" +
|
||||
" WHERE max_id_step = id_step),\n" +
|
||||
"\n" +
|
||||
" riga_ord_prod_w_materia_prima AS (SELECT dtb_ordr.data_ord AS data_ord_prod,\n" +
|
||||
" dtb_ordr.num_ord AS num_ord_prod,\n" +
|
||||
" dtb_ordr.riga_ord AS riga_ord_prod,\n" +
|
||||
" dtb_ordr.gestione AS gestione_ord_prod,\n" +
|
||||
" IIF(CONVERT(DATE, dtb_ordr.data_ord) >= CONVERT(DATE, GETDATE()),\n" +
|
||||
" 'S',\n" +
|
||||
" 'N') AS flag_avviabile,\n" +
|
||||
" mtb_aart_prod.flag_tracciabilita,\n" +
|
||||
" dtb_ordr.unt_ord,\n" +
|
||||
" dtb_ordr.rap_conv,\n" +
|
||||
" dtb_ordr.unt_ord2,\n" +
|
||||
" CAST(ROUND(dtb_ordr.qta_ord2 /\n" +
|
||||
" ISNULL(NULLIF(dtb_ordr.qta_ord, 0), 1),\n" +
|
||||
" 5) AS NUMERIC(20, 5)) AS rap_conv2,\n" +
|
||||
" dtb_ordr.unt_ord3,\n" +
|
||||
" CAST(ROUND(dtb_ordr.qta_ord3 /\n" +
|
||||
" ISNULL(NULLIF(dtb_ordr.qta_ord, 0), 1),\n" +
|
||||
" 5) AS NUMERIC(20, 5)) AS rap_conv3,\n" +
|
||||
" dtb_ordr.qta_ord,\n" +
|
||||
" dtb_ordr.qta_ord2,\n" +
|
||||
" dtb_ordr.qta_ord3,\n" +
|
||||
" dtb_ordr.num_cnf,\n" +
|
||||
" IIF(mtb_aart_prod.unt_mis IN ('PZ', 'NR'), mtb_aart_prod.qta_cnf,\n" +
|
||||
" IIF(mtb_aart_prod.unt_mis2 IN ('PZ', 'NR'),\n" +
|
||||
" mtb_aart_prod.qta_cnf /\n" +
|
||||
" ISNULL(NULLIF(mtb_aart_prod.rap_conv2, 0), 1),\n" +
|
||||
" mtb_aart_prod.qta_cnf)) AS cal_qta_cnf,\n" +
|
||||
" IIF(dtb_ordr.colli_pedana = 0 OR dtb_ordr.colli_pedana = 1,\n" +
|
||||
" IIF(mtb_aart_prod.colli_pedana = 0, 1, mtb_aart_prod.colli_pedana),\n" +
|
||||
" dtb_ordr.colli_pedana)\n" +
|
||||
" AS colli_pedana,\n" +
|
||||
" dtb_ordr.pos_riga,\n" +
|
||||
" dtb_ordr.cod_mdep,\n" +
|
||||
"\n" +
|
||||
" IIF(mtb_aart_prod.unt_mis IN ('PZ', 'NR'), 1,\n" +
|
||||
" IIF(mtb_aart_prod.unt_mis2 IN ('PZ', 'NR') AND\n" +
|
||||
" NULLIF(mtb_aart_prod.rap_conv2, 0) IS NOT NULL,\n" +
|
||||
" mtb_aart_prod.rap_conv2,\n" +
|
||||
" 1)) AS calc_rap_conv,\n" +
|
||||
" mtb_aart_prod.gg_scad_partita,\n" +
|
||||
" mtb_aart_prod.qta_cnf\n" +
|
||||
" FROM dtb_ordr\n" +
|
||||
" INNER JOIN mtb_aart mtb_aart_prod ON mtb_aart_prod.cod_mart = dtb_ordr.cod_mart\n" +
|
||||
" WHERE dtb_ordr.gestione = 'A'),\n" +
|
||||
"\n" +
|
||||
" ord_lav AS (SELECT dtb_ordt.cod_jcom,\n" +
|
||||
" riga_ord_prod_w_materia_prima.data_ord_prod,\n" +
|
||||
" riga_ord_prod_w_materia_prima.num_ord_prod,\n" +
|
||||
" riga_ord_prod_w_materia_prima.riga_ord_prod,\n" +
|
||||
" riga_ord_prod_w_materia_prima.flag_avviabile,\n" +
|
||||
" riga_ord_prod_w_materia_prima.flag_tracciabilita,\n" +
|
||||
" riga_ord_prod_w_materia_prima.unt_ord,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_partita_mag.partita_mag IS NULL THEN\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv\n" +
|
||||
" ELSE CASE\n" +
|
||||
" WHEN riga_ord_prod_w_materia_prima.unt_ord = mtb_aart.unt_mis THEN\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv\n" +
|
||||
" WHEN riga_ord_prod_w_materia_prima.unt_ord = mtb_aart.unt_mis2 THEN\n" +
|
||||
" IIF(mtb_partita_mag.rap_conv2 IS NULL OR mtb_partita_mag.rap_conv2 = 0,\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv2, mtb_partita_mag.rap_conv2)\n" +
|
||||
" WHEN riga_ord_prod_w_materia_prima.unt_ord = mtb_aart.unt_mis3 THEN\n" +
|
||||
" IIF(mtb_partita_mag.rap_conv3 IS NULL OR mtb_partita_mag.rap_conv3 = 0,\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv3, mtb_partita_mag.rap_conv3)\n" +
|
||||
" END\n" +
|
||||
" END\n" +
|
||||
" AS rap_conv,\n" +
|
||||
" riga_ord_prod_w_materia_prima.unt_ord2,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_partita_mag.partita_mag IS NULL THEN\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv2\n" +
|
||||
" ELSE CASE\n" +
|
||||
" WHEN riga_ord_prod_w_materia_prima.unt_ord2 = mtb_aart.unt_mis THEN\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv2\n" +
|
||||
" WHEN riga_ord_prod_w_materia_prima.unt_ord2 = mtb_aart.unt_mis2 THEN\n" +
|
||||
" IIF(mtb_partita_mag.rap_conv2 IS NULL OR mtb_partita_mag.rap_conv2 = 0,\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv2, mtb_partita_mag.rap_conv2)\n" +
|
||||
" WHEN riga_ord_prod_w_materia_prima.unt_ord2 = mtb_aart.unt_mis3 THEN\n" +
|
||||
" IIF(mtb_partita_mag.rap_conv3 IS NULL OR mtb_partita_mag.rap_conv3 = 0,\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv3, mtb_partita_mag.rap_conv3)\n" +
|
||||
" END\n" +
|
||||
" END\n" +
|
||||
" AS rap_conv2,\n" +
|
||||
" riga_ord_prod_w_materia_prima.unt_ord3,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_partita_mag.partita_mag IS NULL THEN\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv3\n" +
|
||||
" ELSE CASE\n" +
|
||||
" WHEN riga_ord_prod_w_materia_prima.unt_ord3 = mtb_aart.unt_mis THEN\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv3\n" +
|
||||
" WHEN riga_ord_prod_w_materia_prima.unt_ord3 = mtb_aart.unt_mis2 THEN\n" +
|
||||
" IIF(mtb_partita_mag.rap_conv2 IS NULL OR mtb_partita_mag.rap_conv2 = 0,\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv2, mtb_partita_mag.rap_conv2)\n" +
|
||||
" WHEN riga_ord_prod_w_materia_prima.unt_ord3 = mtb_aart.unt_mis3 THEN\n" +
|
||||
" IIF(mtb_partita_mag.rap_conv3 IS NULL OR mtb_partita_mag.rap_conv3 = 0,\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv3, mtb_partita_mag.rap_conv3)\n" +
|
||||
" END\n" +
|
||||
" END\n" +
|
||||
" AS rap_conv3,\n" +
|
||||
" ISNULL(dtb_ordt.descr_estesa_prod, dtb_ordt.descrizione_prod) AS descrizione_prod,\n" +
|
||||
" riga_ord_prod_w_materia_prima.num_cnf *\n" +
|
||||
" riga_ord_prod_w_materia_prima.cal_qta_cnf AS num_pezzi,\n" +
|
||||
" riga_ord_prod_w_materia_prima.num_cnf,\n" +
|
||||
" riga_ord_prod_w_materia_prima.gg_scad_partita,\n" +
|
||||
" riga_ord_prod_w_materia_prima.qta_cnf,\n" +
|
||||
" riga_ord_prod_w_materia_prima.colli_pedana,\n" +
|
||||
" riga_ord_prod_w_materia_prima.num_cnf /\n" +
|
||||
" riga_ord_prod_w_materia_prima.colli_pedana AS num_pedane,\n" +
|
||||
" riga_ord_prod_w_materia_prima.pos_riga,\n" +
|
||||
" dtb_ordt.flag_evaso_prod,\n" +
|
||||
" dtb_ordt.flag_evaso_forzato,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN (dtb_ordt.flag_evaso_prod = 'I' OR\n" +
|
||||
" (setupCaricoImmediato.flag_carico_scarico_immediato = 'S' AND\n" +
|
||||
" flag_evaso_prod = 'E'))\n" +
|
||||
" AND dtb_ordt.flag_evaso_forzato = 'N'\n" +
|
||||
" THEN 'I'\n" +
|
||||
" WHEN flag_evaso_prod <> 'I' AND dtb_ordt.flag_evaso_forzato = 'S'\n" +
|
||||
" THEN flag_evaso_prod\n" +
|
||||
" END AS flag_ordine_evaso,\n" +
|
||||
" dtb_ordt.gestione,\n" +
|
||||
" dtb_ordt.data_ord,\n" +
|
||||
" dtb_ordt.cod_tcol_UL,\n" +
|
||||
" mtb_tcol.descrizione AS descrizione_tcol,\n" +
|
||||
" dtb_ordt.cod_anag,\n" +
|
||||
" gtb_anag.rag_soc AS rag_soc_anag,\n" +
|
||||
" gtb_anag.part_iva,\n" +
|
||||
" dtb_ordt.rif_ord,\n" +
|
||||
" dtb_ordt.cod_vdes,\n" +
|
||||
" dtb_ordt.cod_mdep,\n" +
|
||||
" ISNULL(riga_ord_prod_w_materia_prima.cod_mdep, dtb_ordt.cod_mdep) AS cod_mdep_prod,\n" +
|
||||
" dtb_ordt.num_ord,\n" +
|
||||
" dtb_ord_steps.cod_jfas,\n" +
|
||||
" dtb_ordt.cod_jfas AS cod_jfas_lav,\n" +
|
||||
" mtb_partita_mag.partita_mag,\n" +
|
||||
" ISNULL(mtb_partita_mag.partita_mag_prod,\n" +
|
||||
" mtb_partita_mag.partita_mag) AS partita_mag_prod,\n" +
|
||||
" dtb_ordt.note AS note_lav,\n" +
|
||||
" mtb_partita_mag.data_scad,\n" +
|
||||
" dtb_ordt.cod_prod,\n" +
|
||||
" jtb_comt.descrizione AS descrizione_commessa,\n" +
|
||||
" dtb_ordt.data_iniz_prod,\n" +
|
||||
" dtb_ord_steps.id_step,\n" +
|
||||
" dtb_ord_steps.max_fase,\n" +
|
||||
" dtb_ord_steps.num_fase,\n" +
|
||||
" IIF(mtb_aart.flag_qta_cnf_fissa = 'S' AND\n" +
|
||||
" (mtb_aart.qta_cnf > 1 OR riga_ord_prod_w_materia_prima.colli_pedana > 1), 'Colli',\n" +
|
||||
" jtb_cicl.unt_mis_prod)\n" +
|
||||
" AS unt_mis_prod,\n" +
|
||||
" IIF(mtb_aart.flag_qta_cnf_fissa = 'S' AND\n" +
|
||||
" (mtb_aart.qta_cnf > 1 OR riga_ord_prod_w_materia_prima.colli_pedana > 1),\n" +
|
||||
" riga_ord_prod_w_materia_prima.colli_pedana, jtb_cicl.qta_prod)\n" +
|
||||
" AS qta_batch_prod,\n" +
|
||||
" IIF(mtb_aart.qta_cnf > 1 OR riga_ord_prod_w_materia_prima.colli_pedana > 1,\n" +
|
||||
" mtb_aart.qta_cnf,\n" +
|
||||
" jtb_cicl.rap_conv_prod) AS rap_conv_prod,\n" +
|
||||
" dtb_ord_steps.data_iniz,\n" +
|
||||
" dtb_ord_steps.data_fine,\n" +
|
||||
" dtb_ord_steps.qta_lav AS qta_lav,\n" +
|
||||
" IIF(dtb_ord_steps.qta_prod <> 0, dtb_ord_steps.qta_prod,\n" +
|
||||
" dtb_ordt.qta_prod) AS qta_prod,\n" +
|
||||
" dtb_ord_steps.hr_num,\n" +
|
||||
" dtb_ord_steps.descrizione_attivita,\n" +
|
||||
" dtb_ord_steps.posizione_out,\n" +
|
||||
" 3600 / (ISNULL(NULLIF(jtb_dist_clav_dir.duration, 0), 1) /\n" +
|
||||
" ISNULL(NULLIF(jtb_cicl.rap_conv_prod, 0), 1)) AS prod_std,\n" +
|
||||
" dtb_ord_steps.elapsed_time,\n" +
|
||||
" SUM(ISNULL(mtb_colr_carico.qta_col, 0)) AS qta_trasferite,\n" +
|
||||
" COUNT(mtb_colr_carico.num_collo) AS udc_trasferiti,\n" +
|
||||
" COUNT(colli_lotto.num_collo) AS uds_scaricati,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN dtb_ord_steps.id_step = 0\n" +
|
||||
" THEN IIF(dtb_ord_steps.starting_machines = 1, 'IN AVVIO', 'PROGRAMMATO')\n" +
|
||||
" WHEN dtb_ord_steps.data_fine IS NULL\n" +
|
||||
" THEN 'IN CORSO'\n" +
|
||||
" ELSE 'IN PAUSA'\n" +
|
||||
" END AS stato,\n" +
|
||||
" CONVERT(INT, SUM(ISNULL(\n" +
|
||||
" mtb_colr_carico.qta_col / riga_ord_prod_w_materia_prima.calc_rap_conv,\n" +
|
||||
" 0))) AS pz_trasferiti,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN (jtb_dist_clav_dir.duration / ISNULL(NULLIF(jtb_cicl.rap_conv_prod, 0), 1)) *\n" +
|
||||
" (dtb_ordt.qta_prod * dtb_ordt.rap_conv_prod -\n" +
|
||||
" SUM(ISNULL(mtb_colr_carico.qta_col, 0))) > 0\n" +
|
||||
" THEN\n" +
|
||||
" (jtb_dist_clav_dir.duration /\n" +
|
||||
" ISNULL(NULLIF(jtb_cicl.rap_conv_prod, 0), 1)) *\n" +
|
||||
" (dtb_ordt.qta_prod * dtb_ordt.rap_conv_prod -\n" +
|
||||
" SUM(ISNULL(mtb_colr_carico.qta_col, 0)))\n" +
|
||||
" ELSE 0 END AS run_time_sec,\n" +
|
||||
" jl.id_lotto,\n" +
|
||||
" jlt.data_lotto,\n" +
|
||||
" mtb_aart.peso_kg,\n" +
|
||||
" dtb_ordt.data_cons_prod_max\n" +
|
||||
" FROM dtb_ord_max_step dtb_ord_steps\n" +
|
||||
" INNER JOIN dtb_ordt ON dtb_ord_steps.data_ord = dtb_ordt.data_ord\n" +
|
||||
" AND dtb_ord_steps.num_ord = dtb_ordt.num_ord\n" +
|
||||
" AND dtb_ord_steps.gestione = dtb_ordt.gestione\n" +
|
||||
" LEFT OUTER JOIN setup_depo setupCaricoImmediato\n" +
|
||||
" ON dtb_ordt.cod_mdep = setupCaricoImmediato.cod_mdep\n" +
|
||||
" LEFT OUTER JOIN jtb_dist_clav_dir\n" +
|
||||
" ON dtb_ordt.cod_prod = jtb_dist_clav_dir.cod_prod AND\n" +
|
||||
" dtb_ordt.cod_jfas = jtb_dist_clav_dir.cod_jfas\n" +
|
||||
" LEFT OUTER JOIN mtb_partita_mag\n" +
|
||||
" ON dtb_ordt.partita_mag = mtb_partita_mag.partita_mag AND\n" +
|
||||
" dtb_ordt.cod_prod = mtb_partita_mag.cod_mart AND\n" +
|
||||
" mtb_partita_mag.flag_stato = 'A'\n" +
|
||||
" LEFT OUTER JOIN mtb_colr_sum mtb_colr_carico\n" +
|
||||
" ON dtb_ordt.data_ord = mtb_colr_carico.data_ord AND\n" +
|
||||
" dtb_ordt.gestione = mtb_colr_carico.gestione AND\n" +
|
||||
" dtb_ordt.num_ord = mtb_colr_carico.num_ord AND\n" +
|
||||
" dtb_ordt.cod_prod = mtb_colr_carico.cod_mart\n" +
|
||||
" LEFT OUTER JOIN jtb_comt ON dtb_ordt.cod_jcom = jtb_comt.cod_jcom\n" +
|
||||
" LEFT OUTER JOIN riga_ord_prod_w_materia_prima\n" +
|
||||
" ON riga_ord_prod_w_materia_prima.gestione_ord_prod =\n" +
|
||||
" dtb_ordt.gestione_rif AND\n" +
|
||||
" riga_ord_prod_w_materia_prima.data_ord_prod =\n" +
|
||||
" dtb_ordt.data_ord_rif AND\n" +
|
||||
" riga_ord_prod_w_materia_prima.num_ord_prod =\n" +
|
||||
" dtb_ordt.num_ord_rif AND\n" +
|
||||
" riga_ord_prod_w_materia_prima.riga_ord_prod = dtb_ordt.riga_ord_rif\n" +
|
||||
" LEFT OUTER JOIN jtb_cicl ON jtb_cicl.cod_prod = dtb_ordt.cod_prod\n" +
|
||||
" LEFT OUTER JOIN mtb_aart ON mtb_aart.cod_mart = dtb_ordt.cod_prod\n" +
|
||||
" LEFT OUTER JOIN gtb_anag ON dtb_ordt.cod_anag = gtb_anag.cod_anag\n" +
|
||||
" LEFT OUTER JOIN mtb_tcol ON dtb_ordt.cod_tcol_UL = mtb_tcol.cod_tcol\n" +
|
||||
" LEFT OUTER JOIN jtb_lotr jl\n" +
|
||||
" ON dtb_ord_steps.cod_jfas = jl.cod_jfas AND\n" +
|
||||
" dtb_ordt.gestione = jl.gestione AND\n" +
|
||||
" dtb_ordt.data_ord = jl.data_ord AND\n" +
|
||||
" dtb_ordt.num_ord = jl.num_ord\n" +
|
||||
" LEFT OUTER JOIN jtb_lott jlt\n" +
|
||||
" ON jl.cod_jfas = jlt.cod_jfas AND jl.id_lotto = jlt.id_lotto\n" +
|
||||
" LEFT OUTER JOIN mtb_colt colli_lotto ON jlt.id_lotto = colli_lotto.id_lotto\n" +
|
||||
"\n" +
|
||||
" CROSS APPLY setup\n" +
|
||||
" WHERE dtb_ordt.flag_annulla = 'N'\n" +
|
||||
" AND dtb_ord_steps.data_ord BETWEEN setup.date_start AND setup.date_end\n" +
|
||||
" AND (setup.flag_evaso IS NULL\n" +
|
||||
" OR (\n" +
|
||||
" (setup.flag_evaso = 'I'\n" +
|
||||
" AND\n" +
|
||||
" dtb_ord_steps.flag_step_attivo = 'S'\n" +
|
||||
" AND (flag_evaso_prod = 'I'\n" +
|
||||
" OR\n" +
|
||||
" (setupCaricoImmediato.flag_carico_scarico_immediato = 'S'\n" +
|
||||
" AND\n" +
|
||||
" flag_evaso_prod = 'E'))\n" +
|
||||
" AND dtb_ordt.flag_evaso_forzato = 'N'\n" +
|
||||
" )\n" +
|
||||
" OR (setup.flag_evaso = 'E'\n" +
|
||||
" AND (flag_evaso_prod = 'E' OR jlt.data_chiusura IS NOT NULL)\n" +
|
||||
" AND dtb_ordt.flag_evaso_forzato = 'S')\n" +
|
||||
" )\n" +
|
||||
" )\n" +
|
||||
" AND (setup.cod_jfas IS NULL\n" +
|
||||
" OR dtb_ord_steps.cod_jfas = setup.cod_jfas)\n" +
|
||||
" AND (setup.cod_anag IS NULL\n" +
|
||||
" OR dtb_ordt.cod_anag = setup.cod_anag)\n" +
|
||||
" GROUP BY riga_ord_prod_w_materia_prima.data_ord_prod,\n" +
|
||||
" riga_ord_prod_w_materia_prima.num_ord_prod,\n" +
|
||||
" riga_ord_prod_w_materia_prima.riga_ord_prod,\n" +
|
||||
" riga_ord_prod_w_materia_prima.flag_avviabile,\n" +
|
||||
" riga_ord_prod_w_materia_prima.flag_tracciabilita,\n" +
|
||||
" riga_ord_prod_w_materia_prima.unt_ord,\n" +
|
||||
" mtb_partita_mag.rap_conv2,\n" +
|
||||
" mtb_partita_mag.rap_conv3,\n" +
|
||||
" dtb_ordt.note,\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv,\n" +
|
||||
" dtb_ordt.descrizione_prod,\n" +
|
||||
" dtb_ordt.descr_estesa_prod,\n" +
|
||||
" riga_ord_prod_w_materia_prima.num_cnf,\n" +
|
||||
" mtb_aart.qta_cnf,\n" +
|
||||
" mtb_aart.gg_scad_partita,\n" +
|
||||
" mtb_aart.flag_qta_cnf_fissa,\n" +
|
||||
" riga_ord_prod_w_materia_prima.pos_riga,\n" +
|
||||
" dtb_ordt.flag_evaso_prod,\n" +
|
||||
" dtb_ordt.flag_evaso_forzato,\n" +
|
||||
" dtb_ordt.gestione,\n" +
|
||||
" dtb_ordt.data_ord,\n" +
|
||||
" dtb_ordt.num_ord,\n" +
|
||||
" dtb_ord_steps.cod_jfas,\n" +
|
||||
" dtb_ordt.cod_jfas,\n" +
|
||||
" dtb_ordt.cod_jcom,\n" +
|
||||
" mtb_partita_mag.partita_mag,\n" +
|
||||
" mtb_partita_mag.partita_mag_prod,\n" +
|
||||
" mtb_partita_mag.data_scad,\n" +
|
||||
" dtb_ordt.cod_prod,\n" +
|
||||
" dtb_ordt.data_iniz_prod,\n" +
|
||||
" dtb_ord_steps.id_step,\n" +
|
||||
" dtb_ord_steps.data_iniz,\n" +
|
||||
" dtb_ord_steps.data_fine,\n" +
|
||||
" dtb_ordt.cod_tcol_UL,\n" +
|
||||
" dtb_ordt.cod_anag,\n" +
|
||||
" gtb_anag.rag_soc,\n" +
|
||||
" gtb_anag.part_iva,\n" +
|
||||
" dtb_ordt.rif_ord,\n" +
|
||||
" dtb_ordt.cod_vdes,\n" +
|
||||
" dtb_ordt.cod_mdep,\n" +
|
||||
" riga_ord_prod_w_materia_prima.cod_mdep,\n" +
|
||||
" mtb_aart.colli_pedana,\n" +
|
||||
" dtb_ord_steps.qta_prod,\n" +
|
||||
" dtb_ordt.qta_prod,\n" +
|
||||
" jtb_dist_clav_dir.duration,\n" +
|
||||
" jtb_comt.descrizione,\n" +
|
||||
" dtb_ord_steps.elapsed_time,\n" +
|
||||
" riga_ord_prod_w_materia_prima.colli_pedana,\n" +
|
||||
" dtb_ord_steps.hr_num,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" mtb_aart.unt_mis2,\n" +
|
||||
" mtb_aart.rap_conv2,\n" +
|
||||
" mtb_aart.unt_mis3,\n" +
|
||||
" mtb_aart.rap_conv3,\n" +
|
||||
" riga_ord_prod_w_materia_prima.unt_ord2,\n" +
|
||||
" riga_ord_prod_w_materia_prima.unt_ord3,\n" +
|
||||
" riga_ord_prod_w_materia_prima.qta_ord,\n" +
|
||||
" riga_ord_prod_w_materia_prima.qta_ord2,\n" +
|
||||
" riga_ord_prod_w_materia_prima.qta_ord3,\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv2,\n" +
|
||||
" riga_ord_prod_w_materia_prima.rap_conv3,\n" +
|
||||
" riga_ord_prod_w_materia_prima.qta_cnf,\n" +
|
||||
" riga_ord_prod_w_materia_prima.cal_qta_cnf,\n" +
|
||||
" riga_ord_prod_w_materia_prima.gg_scad_partita,\n" +
|
||||
" jtb_cicl.qta_prod,\n" +
|
||||
" jtb_cicl.rap_conv_prod,\n" +
|
||||
" dtb_ord_steps.descrizione_attivita,\n" +
|
||||
" dtb_ord_steps.posizione_out,\n" +
|
||||
" jtb_cicl.unt_mis_prod,\n" +
|
||||
" mtb_tcol.descrizione,\n" +
|
||||
" dtb_ordt.qta_prod,\n" +
|
||||
" dtb_ordt.rap_conv_prod,\n" +
|
||||
" setupCaricoImmediato.flag_carico_scarico_immediato,\n" +
|
||||
" dtb_ord_steps.num_fase, dtb_ord_steps.qta_lav,\n" +
|
||||
" jl.id_lotto, jlt.data_lotto, mtb_aart.peso_kg, dtb_ordt.data_cons_prod_max,\n" +
|
||||
" dtb_ord_steps.id_step,\n" +
|
||||
" dtb_ord_steps.max_fase,\n" +
|
||||
" dtb_ord_steps.starting_machines)\n" +
|
||||
" SELECT ROW_NUMBER() OVER (ORDER BY data_ord, num_ord_prod, pos_riga, num_ord) AS sort,\n" +
|
||||
" cod_jcom,\n" +
|
||||
" data_ord_prod,\n" +
|
||||
" num_ord_prod,\n" +
|
||||
" riga_ord_prod,\n" +
|
||||
" flag_avviabile,\n" +
|
||||
" flag_tracciabilita,\n" +
|
||||
" unt_ord,\n" +
|
||||
" rap_conv,\n" +
|
||||
" unt_ord2,\n" +
|
||||
" rap_conv2,\n" +
|
||||
" unt_ord3,\n" +
|
||||
" rap_conv3,\n" +
|
||||
" descrizione_prod,\n" +
|
||||
" num_pezzi,\n" +
|
||||
" num_cnf,\n" +
|
||||
" gg_scad_partita,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" colli_pedana,\n" +
|
||||
" num_pedane,\n" +
|
||||
" pos_riga,\n" +
|
||||
" flag_evaso_prod,\n" +
|
||||
" flag_evaso_forzato,\n" +
|
||||
" flag_ordine_evaso,\n" +
|
||||
" gestione,\n" +
|
||||
" data_ord,\n" +
|
||||
" cod_tcol_UL,\n" +
|
||||
" descrizione_tcol,\n" +
|
||||
" cod_anag,\n" +
|
||||
" rag_soc_anag,\n" +
|
||||
" part_iva,\n" +
|
||||
" rif_ord,\n" +
|
||||
" cod_vdes,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" cod_mdep_prod,\n" +
|
||||
" num_ord,\n" +
|
||||
" cod_jfas,\n" +
|
||||
" cod_jfas_lav,\n" +
|
||||
" partita_mag,\n" +
|
||||
" partita_mag_prod,\n" +
|
||||
" note_lav,\n" +
|
||||
" data_scad,\n" +
|
||||
" cod_prod,\n" +
|
||||
" descrizione_commessa,\n" +
|
||||
" data_iniz_prod,\n" +
|
||||
" id_step,\n" +
|
||||
" unt_mis_prod,\n" +
|
||||
" qta_batch_prod,\n" +
|
||||
" rap_conv_prod,\n" +
|
||||
" data_iniz,\n" +
|
||||
" data_fine,\n" +
|
||||
" qta_prod,\n" +
|
||||
" qta_lav,\n" +
|
||||
" max_fase,\n" +
|
||||
" num_fase,\n" +
|
||||
" hr_num,\n" +
|
||||
" descrizione_attivita,\n" +
|
||||
" posizione_out,\n" +
|
||||
" prod_std,\n" +
|
||||
" elapsed_time,\n" +
|
||||
" qta_trasferite,\n" +
|
||||
" udc_trasferiti,\n" +
|
||||
" uds_scaricati,\n" +
|
||||
" stato,\n" +
|
||||
" pz_trasferiti,\n" +
|
||||
" run_time_sec,\n" +
|
||||
" SUM(run_time_sec) OVER (PARTITION BY cod_jfas, data_ord_prod) AS cumulative_run_time_sec,\n" +
|
||||
" CONVERT(INT, run_time_sec / 3600) AS run_time_hour,\n" +
|
||||
" ROUND((run_time_sec / 3600 - CONVERT(INT, run_time_sec / 3600)) * 60, 0) AS run_time_min,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN setup_run_time.flag_restart = 'S' THEN\n" +
|
||||
" DATEADD(SECOND, SUM(run_time_sec)\n" +
|
||||
" OVER (PARTITION BY cod_jfas, data_ord_prod ORDER BY stato, cod_jfas, data_ord_prod, pos_riga ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW),\n" +
|
||||
" CASE\n" +
|
||||
" WHEN (data_ord_prod > GETDATE() AND (data_iniz IS NULL OR data_fine IS NOT NULL))\n" +
|
||||
" THEN DATEADD(HH, 7, data_ord_prod)\n" +
|
||||
" ELSE GETDATE() END)\n" +
|
||||
" ELSE\n" +
|
||||
" DATEADD(SECOND, SUM(run_time_sec)\n" +
|
||||
" OVER (PARTITION BY cod_jfas ORDER BY stato, cod_jfas, data_ord_prod, num_ord_prod, pos_riga ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW),\n" +
|
||||
" GETDATE())\n" +
|
||||
" END AS run_time_end,\n" +
|
||||
" id_lotto,\n" +
|
||||
" data_lotto,\n" +
|
||||
" peso_kg,\n" +
|
||||
" data_cons_prod_max\n" +
|
||||
" FROM ord_lav\n" +
|
||||
" CROSS APPLY setup_run_time");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251015120629 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createOrUpdateView("mvw_sitart_udc_det_inventario", "CREATE VIEW [dbo].[mvw_sitart_udc_det_inventario] AS\n" +
|
||||
"WITH baseMtbColr AS (SELECT c,\n" +
|
||||
"\n" +
|
||||
" ROUND(v.qta_col, cifre_dec) AS qta_col,\n" +
|
||||
" ROUND(v.num_cnf, cifre_dec) AS num_cnf,\n" +
|
||||
" IIF(flag_qta_cnf_fissa = 'S',\n" +
|
||||
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)) AS qta_cnf,\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.peso_netto_kg,\n" +
|
||||
" v.peso_lordo_kg,\n" +
|
||||
" mtb_colt.gestione,\n" +
|
||||
" mtb_colt.data_collo,\n" +
|
||||
" mtb_colt.ser_collo,\n" +
|
||||
" mtb_colt.num_collo,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.flag_qta_cnf_fissa,\n" +
|
||||
" v.unt_mis,\n" +
|
||||
" v.diacod,\n" +
|
||||
" v.descrizione_estesa,\n" +
|
||||
" v.cod_mgrp,\n" +
|
||||
" mtb_grup.descrizione AS descrizione_gruppo,\n" +
|
||||
" v.cod_msgr,\n" +
|
||||
" mtb_sgrp.descrizione AS descrizione_sottogruppo,\n" +
|
||||
" mtb_unt_mis.flag_dig,\n" +
|
||||
" mtb_unt_mis.cifre_dec,\n" +
|
||||
" mtb_colt.segno,\n" +
|
||||
" v.cod_mdep,\n" +
|
||||
" v.posizione,\n" +
|
||||
" mtb_colt.cod_dtip,\n" +
|
||||
" mtb_colt.cod_jfas,\n" +
|
||||
" v.barcode_ul,\n" +
|
||||
" v.qta_cnf_anag,\n" +
|
||||
" MAX(mtb_colr.datetime_row) AS datetime_posizionamento,\n" +
|
||||
" mtb_colt.progressivo_ul\n" +
|
||||
" FROM mvw_mtb_colr_with_giacenza v WITH (NOEXPAND)\n" +
|
||||
" INNER JOIN mtb_colt\n" +
|
||||
" ON v.barcode_ul = mtb_colt.barcode_ul\n" +
|
||||
" LEFT OUTER JOIN mtb_colr ON\n" +
|
||||
" v.barcode_ul = mtb_colr.barcode_ul_in AND\n" +
|
||||
" v.cod_mart = mtb_colr.cod_mart AND\n" +
|
||||
" ((v.partita_mag IS NULL AND mtb_colr.partita_mag IS NULL) OR\n" +
|
||||
" (v.partita_mag = mtb_colr.partita_mag)) AND\n" +
|
||||
" ((v.cod_col IS NULL AND mtb_colr.cod_col IS NULL) OR (v.cod_col = mtb_colr.cod_col)) AND\n" +
|
||||
" ((v.cod_tagl IS NULL AND mtb_colr.cod_tagl IS NULL) OR (v.cod_tagl = mtb_colr.cod_tagl)) AND\n" +
|
||||
" ((v.cod_jcom IS NULL AND mtb_colr.cod_jcom IS NULL) OR (v.cod_jcom = mtb_colr.cod_jcom)) AND\n" +
|
||||
" ((v.posizione IS NULL AND mtb_colr.posizione_in IS NULL) OR (v.posizione = mtb_colr.posizione_in)) AND\n" +
|
||||
" ((v.cod_mdep IS NULL AND mtb_colr.cod_mdep_in IS NULL) OR (v.cod_mdep = mtb_colr.cod_mdep_in)) AND\n" +
|
||||
" ISNULL(mtb_colr.posizione_in, '') <> ISNULL(mtb_colr.posizione_out, '')\n" +
|
||||
" INNER JOIN dbo.mtb_unt_mis ON v.unt_mis = mtb_unt_mis.unt_mis\n" +
|
||||
"\n" +
|
||||
" INNER JOIN dbo.mtb_grup ON v.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" INNER JOIN dbo.mtb_sgrp ON v.cod_mgrp = mtb_sgrp.cod_mgrp\n" +
|
||||
" AND v.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
" WHERE v.qta_col > 0\n" +
|
||||
" AND (segno = 1 OR (segno = -1 AND cod_dtip IS NULL AND mtb_colt.gestione = 'V'))\n" +
|
||||
" GROUP BY c,\n" +
|
||||
" ROUND(v.qta_col, cifre_dec),\n" +
|
||||
" ROUND(v.num_cnf, cifre_dec),\n" +
|
||||
" IIF(flag_qta_cnf_fissa = 'S',\n" +
|
||||
" v.qta_cnf_anag, v.qta_col / IIF(v.num_cnf = 0, 1, v.num_cnf)),\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.peso_netto_kg,\n" +
|
||||
" v.peso_lordo_kg,\n" +
|
||||
" mtb_colt.gestione,\n" +
|
||||
" mtb_colt.data_collo,\n" +
|
||||
" mtb_colt.ser_collo,\n" +
|
||||
" mtb_colt.num_collo,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.flag_qta_cnf_fissa,\n" +
|
||||
" v.unt_mis,\n" +
|
||||
" v.diacod,\n" +
|
||||
" v.descrizione_estesa,\n" +
|
||||
" v.cod_mgrp,\n" +
|
||||
" mtb_grup.descrizione,\n" +
|
||||
" v.cod_msgr,\n" +
|
||||
" mtb_sgrp.descrizione,\n" +
|
||||
" mtb_unt_mis.flag_dig,\n" +
|
||||
" mtb_unt_mis.cifre_dec,\n" +
|
||||
" mtb_colt.segno,\n" +
|
||||
" v.cod_mdep,\n" +
|
||||
" v.posizione,\n" +
|
||||
" mtb_colt.cod_dtip,\n" +
|
||||
" mtb_colt.cod_jfas,\n" +
|
||||
" v.barcode_ul,\n" +
|
||||
" v.qta_cnf_anag,\n" +
|
||||
" mtb_colt.progressivo_ul),\n" +
|
||||
" final_stock AS (SELECT v.qta_col,\n" +
|
||||
" v.num_cnf,\n" +
|
||||
" v.qta_cnf,\n" +
|
||||
" v.gestione,\n" +
|
||||
" v.data_collo,\n" +
|
||||
" v.ser_collo,\n" +
|
||||
" v.num_collo,\n" +
|
||||
" v.cod_mdep AS cod_mdep,\n" +
|
||||
" v.posizione AS posizione,\n" +
|
||||
" mtb_depo_posizioni.priorita,\n" +
|
||||
" v.cod_mgrp AS codGruppo,\n" +
|
||||
" v.descrizione_gruppo AS Gruppo,\n" +
|
||||
" v.cod_msgr AS CodSgruppo,\n" +
|
||||
" v.descrizione_sottogruppo AS Sottogruppo,\n" +
|
||||
" v.cod_mart,\n" +
|
||||
" v.diacod,\n" +
|
||||
" v.descrizione_estesa,\n" +
|
||||
" v.partita_mag,\n" +
|
||||
" v.cod_col,\n" +
|
||||
" v.cod_tagl,\n" +
|
||||
" v.cod_jcom,\n" +
|
||||
" v.peso_netto_kg,\n" +
|
||||
" v.peso_lordo_kg,\n" +
|
||||
" v.cod_jfas,\n" +
|
||||
" v.flag_qta_cnf_fissa,\n" +
|
||||
" v.unt_mis,\n" +
|
||||
" v.segno,\n" +
|
||||
" v.barcode_ul,\n" +
|
||||
" v.datetime_posizionamento,\n" +
|
||||
" v.progressivo_ul\n" +
|
||||
" FROM baseMtbColr v\n" +
|
||||
"\n" +
|
||||
" LEFT OUTER JOIN mtb_depo_posizioni\n" +
|
||||
" ON v.cod_mdep = mtb_depo_posizioni.cod_mdep\n" +
|
||||
" AND v.posizione = mtb_depo_posizioni.posizione)\n" +
|
||||
"\n" +
|
||||
"SELECT qta_col,\n" +
|
||||
" num_cnf,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" gestione,\n" +
|
||||
" data_collo,\n" +
|
||||
" ser_collo,\n" +
|
||||
" num_collo,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" posizione,\n" +
|
||||
" priorita,\n" +
|
||||
" codGruppo,\n" +
|
||||
" Gruppo,\n" +
|
||||
" CodSgruppo,\n" +
|
||||
" Sottogruppo,\n" +
|
||||
" cod_mart,\n" +
|
||||
" diacod,\n" +
|
||||
" descrizione_estesa,\n" +
|
||||
" partita_mag,\n" +
|
||||
" cod_col,\n" +
|
||||
" cod_tagl,\n" +
|
||||
" cod_jcom,\n" +
|
||||
" peso_netto_kg,\n" +
|
||||
" peso_lordo_kg,\n" +
|
||||
" cod_jfas,\n" +
|
||||
" flag_qta_cnf_fissa,\n" +
|
||||
" unt_mis,\n" +
|
||||
" segno,\n" +
|
||||
" barcode_ul,\n" +
|
||||
" datetime_posizionamento,\n" +
|
||||
" progressivo_ul\n" +
|
||||
"FROM final_stock");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251015152419 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
if (isCustomer(IntegryCustomer.Biolevante))
|
||||
createOrUpdateFunction("MPS_grid", "Create function dbo.MPS_grid(@timeBucket char(1) = 'W' )\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
" (\n" +
|
||||
" --@timeBucket D=giorno; W=settimana (default); M=Mese\n" +
|
||||
" with horizon as\n" +
|
||||
" (\n" +
|
||||
" select dateadd(day,-1,convert(date, getdate())) as t0_from, dateadd(day,-1,convert(date, getdate())) as t0_to,\n" +
|
||||
" dateadd(day, 0,convert(date, getdate())) as t1_from, \n" +
|
||||
" case @timeBucket \n" +
|
||||
" when 'D' then CONVERT(date, getdate())\n" +
|
||||
" when 'W' then DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)) \n" +
|
||||
" when 'M' then EOMonth(getdate())\n" +
|
||||
" end as t1_to,\n" +
|
||||
" case @timeBucket \n" +
|
||||
" when 'D' then dateadd(day,1,CONVERT(date, getdate()))\n" +
|
||||
" when 'W' then dateadd(DAY,1,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)))\n" +
|
||||
" when 'M' then dateadd(day,1,EOMonth(getdate()))\n" +
|
||||
" end as t2_from,\n" +
|
||||
" case @timeBucket \n" +
|
||||
" when 'D' then dateadd(day,1,CONVERT(date, getdate()))\n" +
|
||||
" when 'W' then dateadd(WEEK,1,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)))\n" +
|
||||
" when 'M' then dateadd(MONTH,1,EOMonth(getdate()))\n" +
|
||||
" end as t2_to,\n" +
|
||||
" case @timeBucket \n" +
|
||||
" when 'D' then dateadd(day,1,dateadd(day,1,CONVERT(date, getdate())))\n" +
|
||||
" when 'W' then dateadd(day,1,dateadd(WEEK,1,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE))))\n" +
|
||||
" when 'M' then dateadd(day,1,dateadd(MONTH,1,EOMonth(getdate())))\n" +
|
||||
" end as t3_from,\n" +
|
||||
" case @timeBucket \n" +
|
||||
" when 'D' then dateadd(day,2,CONVERT(date, getdate()))\n" +
|
||||
" when 'W' then dateadd(WEEK,2,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)))\n" +
|
||||
" when 'M' then dateadd(MONTH,2,EOMonth(getdate()))\n" +
|
||||
" end as t3_to,\n" +
|
||||
" case @timeBucket \n" +
|
||||
" when 'D' then dateadd(day,3,CONVERT(date, getdate()))\n" +
|
||||
" when 'W' then dateadd(day,1,dateadd(WEEK,2,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE))))\n" +
|
||||
" when 'M' then dateadd(day,1,dateadd(MONTH,2,EOMonth(getdate())))\n" +
|
||||
" end as t4_from,\n" +
|
||||
" case @timeBucket \n" +
|
||||
" when 'D' then dateadd(day,3,CONVERT(date, getdate()))\n" +
|
||||
" when 'W' then dateadd(WEEK,3,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)))\n" +
|
||||
" when 'M' then dateadd(MONTH,3,EOMonth(getdate()))\n" +
|
||||
" end as t4_to,\n" +
|
||||
" case @timeBucket \n" +
|
||||
" when 'D' then dateadd(day,4,CONVERT(date, getdate()))\n" +
|
||||
" when 'W' then dateadd(day,1,dateadd(WEEK,3,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE))))\n" +
|
||||
" when 'M' then dateadd(day,1,dateadd(MONTH,3,EOMonth(getdate())))\n" +
|
||||
" end as t5_from,\n" +
|
||||
" case @timeBucket \n" +
|
||||
" when 'D' then dateadd(day,4,CONVERT(date, getdate()))\n" +
|
||||
" when 'W' then dateadd(WEEK,4,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)))\n" +
|
||||
" when 'M' then dateadd(MONTH,4,EOMonth(getdate()))\n" +
|
||||
" end as t5_to,\n" +
|
||||
" case @timeBucket \n" +
|
||||
" when 'D' then dateadd(day,5,CONVERT(date, getdate()))\n" +
|
||||
" when 'W' then dateadd(day,1,dateadd(WEEK,4,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE))))\n" +
|
||||
" when 'M' then dateadd(day,1,dateadd(MONTH,4,EOMonth(getdate())))\n" +
|
||||
" end as t6_from,\n" +
|
||||
" case @timeBucket \n" +
|
||||
" when 'D' then dateadd(day,5,CONVERT(date, getdate()))\n" +
|
||||
" when 'W' then dateadd(WEEK,5,DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)))\n" +
|
||||
" when 'M' then dateadd(MONTH,5,EOMonth(getdate()))\n" +
|
||||
" end as t6_to\n" +
|
||||
" ),\n" +
|
||||
"\n" +
|
||||
" AlberoDiCLassificazione as\n" +
|
||||
" --Albero classificazione Articoli personalizzato per Olio Levante, da sostituire con vista su database di AI per forecast con algoritmo Tuidi\n" +
|
||||
" (select distinct --mtb_aart.cod_mart, mtb_aart.descrizione, \n" +
|
||||
" mtb_aart.cod_mgrp + Replicate('_',3-len(mtb_aart.cod_mgrp))+\n" +
|
||||
" isNull(mtb_aart.cod_mstp,'0000')+\n" +
|
||||
" ISNULL(mtb_aart.cod_msfa,'') as hierarchy_code,\n" +
|
||||
" mtb_aart.cod_mgrp as level_1_code, mtb_grup.descrizione as level_1_description,\n" +
|
||||
" isNull(mtb_aart.cod_mstp,'000') as level_2_code, isNull(mtb_tipi.descrizione+' '+mtb_stip.descrizione,'000') as level_2_description,\n" +
|
||||
" mtb_aart.cod_msfa as level_3_code, mtb_sfam.descrizione as level_3_description\n" +
|
||||
" from mtb_aart inner join mtb_grup on mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" inner join mtb_sgrp on mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp and mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
" left outer join mtb_sfam on mtb_aart.cod_mgrp = mtb_sfam.cod_mgrp and mtb_aart.cod_msgr = mtb_sfam.cod_msgr and mtb_aart.cod_msfa = mtb_sfam.cod_msfa\n" +
|
||||
" left outer join mtb_tipi on mtb_aart.cod_mtip = mtb_tipi.cod_mtip\n" +
|
||||
" left outer join mtb_stip on mtb_aart.cod_mtip = mtb_stip.cod_mtip and mtb_aart.cod_mstp = mtb_stip.cod_mstp\n" +
|
||||
" \n" +
|
||||
" Where mtb_aart.cod_mgrp in ('AP','C','CO','S','SO','SOR') and mtb_aart.flag_stato = 'A'\n" +
|
||||
" )\n" +
|
||||
" ,\n" +
|
||||
" ArticoliRiclassificati as\n" +
|
||||
" (\n" +
|
||||
" --Vista Articoli personalizzata per Olio Levante, da sostituire con vista su database di AI per forecast con algoritmo Tuidi\n" +
|
||||
" select \n" +
|
||||
" cod_mart as art_code,\n" +
|
||||
" descrizione_estesa as description,\n" +
|
||||
" null as art_info,\n" +
|
||||
" marchio as brand,\n" +
|
||||
" bar_code as ean,\n" +
|
||||
" null as img_url,\n" +
|
||||
" gg_scad_partita as shelf_life,\n" +
|
||||
" unt_mis as uom_purchase,\n" +
|
||||
" unt_mis as uom_selling,\n" +
|
||||
" peso_kg as weight,\n" +
|
||||
" IIF(flag_stato='A',1,0) as status,\n" +
|
||||
" mtb_aart.cod_mgrp + Replicate('_',3-len(mtb_aart.cod_mgrp))+\n" +
|
||||
" isNull(mtb_aart.cod_mstp,'0000')+\n" +
|
||||
" ISNULL(mtb_aart.cod_msfa,'') as hierarchy_code\n" +
|
||||
" from mtb_aart inner join mtb_grup on mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" inner join mtb_sgrp on mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp and mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
" left outer join mtb_sfam on mtb_aart.cod_mgrp = mtb_sfam.cod_mgrp and mtb_aart.cod_msgr = mtb_sfam.cod_msgr and mtb_aart.cod_msfa = mtb_sfam.cod_msfa\n" +
|
||||
" left outer join mtb_tipi on mtb_aart.cod_mtip = mtb_tipi.cod_mtip\n" +
|
||||
" left outer join mtb_stip on mtb_aart.cod_mtip = mtb_stip.cod_mtip and mtb_aart.cod_mstp = mtb_stip.cod_mstp\n" +
|
||||
" where mtb_aart.cod_mgrp in ('AP','C','CO','S','SO','SOR') and mtb_aart.flag_stato = 'A'\n" +
|
||||
" ),\n" +
|
||||
"\n" +
|
||||
" forecast as\n" +
|
||||
" (\n" +
|
||||
" select 'FORECAST' as causale,\n" +
|
||||
" mtb_aart.cod_mgrp, mtb_aart.cod_msgr,\n" +
|
||||
" mtb_aart.cod_mart,\n" +
|
||||
" mtb_aart.descrizione,\n" +
|
||||
" dateadd(year, 1,vend.data_doc) as data_vend,\n" +
|
||||
" -vend.qtaVendUM1 as qtaPrevista,\n" +
|
||||
" null as partita_mag,\n" +
|
||||
" 0 as qta_progressiva,\n" +
|
||||
" null as gestione, null as data_ord, null as num_ord,\n" +
|
||||
" null as cod_mdep,\n" +
|
||||
" 'N' as isOrdTrasf,\n" +
|
||||
" 'N' as flag_sospeso,\n" +
|
||||
" null as stato_partita\n" +
|
||||
" \n" +
|
||||
" from OlapPPVendite vend inner join mtb_aart on vend.cod_prod = mtb_aart.cod_mart\n" +
|
||||
" where data_doc between dateadd(year, -1, CONVERT(date, getDate())) and \n" +
|
||||
" case @timeBucket\n" +
|
||||
" when 'D' then DATEADD(DAY,6,dateadd(year, -1, CONVERT(date, getDate())))\n" +
|
||||
" WHEN 'W' then DATEADD(week,6,dateadd(year, -1, CONVERT(date, getDate())))\n" +
|
||||
" WHEN 'M' then DATEADD(month,6,dateadd(year, -1, CONVERT(date, getDate())))\n" +
|
||||
" end\n" +
|
||||
" )\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" SELECT clas.*, --mrp.cod_mart, mrp.descrizione,\n" +
|
||||
"\n" +
|
||||
" --inserire qui la riga del forecast\n" +
|
||||
" case when causale like 'FORECAST' then '1 - FORECAST'\n" +
|
||||
" when causale like '%GIACENZA%' then '3 - DISPONIBILITA'\n" +
|
||||
" when causale like '%ORD.VEND.%' then '2 - ORDINI VENDITA'\n" +
|
||||
" when causale like '%ORD.LAVORAZ.%' then '4 - ORDINI LAVORAZIONE' end as MPS_row,\n" +
|
||||
" case when causale like '%GIACENZA%' then mrp.qta else 0 end as bucket0,\n" +
|
||||
" case when (mrp.data_mrp < horizon.t1_from OR mrp.data_mrp between horizon.t1_from and horizon.t1_to) and causale not like '%GIACENZA%' then mrp.qta else 0 end as bucket1,\n" +
|
||||
" case when mrp.data_mrp between horizon.t2_from and horizon.t2_to then mrp.qta else 0 end as bucket2,\n" +
|
||||
" case when mrp.data_mrp between horizon.t3_from and horizon.t3_to then mrp.qta else 0 end as bucket3,\n" +
|
||||
" case when mrp.data_mrp between horizon.t4_from and horizon.t4_to then mrp.qta else 0 end as bucket4,\n" +
|
||||
" case when mrp.data_mrp between horizon.t5_from and horizon.t5_to then mrp.qta else 0 end as bucket5,\n" +
|
||||
" case when mrp.data_mrp between horizon.t6_from and horizon.t6_to then mrp.qta else 0 end as bucket6,\n" +
|
||||
" case when mrp.data_mrp > horizon.t6_to then mrp.qta else 0 end as bucketOver,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" mtb_aart.qta_cnf,\n" +
|
||||
" isNull(jtb_cicl.lotto_min_ord, mtb_aart.qta_cnf*mtb_aart.colli_pedana) as LotSize,\n" +
|
||||
" mrp.*\n" +
|
||||
" FROM (\n" +
|
||||
" select * from [dbo].[MRP_DailyMaterialReq] () \n" +
|
||||
" union\n" +
|
||||
" select * from forecast\n" +
|
||||
" )\n" +
|
||||
" \n" +
|
||||
" mrp inner join ArticoliRiclassificati art on mrp.cod_mart = art.art_code\n" +
|
||||
" inner join AlberoDiCLassificazione clas on art.hierarchy_code = clas.hierarchy_code\n" +
|
||||
" inner join horizon on mrp.data_mrp >= horizon.t0_from\n" +
|
||||
" inner join mtb_aart on mrp.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" left outer join jtb_cicl on mrp.cod_mart = jtb_cicl.cod_mart\n" +
|
||||
" )");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251020113516 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createOrUpdateView("MPS_albero_classificazione","create view MPS_albero_classificazione as\n" +
|
||||
"select distinct mtb_aart.cod_mart, mtb_aart.descrizione,\n" +
|
||||
" mtb_aart.cod_mgrp + Replicate('_', 3 - len(mtb_aart.cod_mgrp)) +\n" +
|
||||
" isNull(mtb_aart.cod_mstp, '0000') +\n" +
|
||||
" ISNULL(mtb_aart.cod_msfa, '') as hierarchy_code,\n" +
|
||||
" mtb_aart.cod_mgrp as level_1_code,\n" +
|
||||
" mtb_grup.descrizione as level_1_description,\n" +
|
||||
" isNull(mtb_aart.cod_mstp, '000') as level_2_code,\n" +
|
||||
" isNull(mtb_tipi.descrizione + ' ' + mtb_stip.descrizione, '000') as level_2_description,\n" +
|
||||
" mtb_aart.cod_msfa as level_3_code,\n" +
|
||||
" mtb_sfam.descrizione as level_3_description\n" +
|
||||
"from mtb_aart\n" +
|
||||
" inner join mtb_grup on mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" inner join mtb_sgrp\n" +
|
||||
" on mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp and mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
" left outer join mtb_sfam on mtb_aart.cod_mgrp = mtb_sfam.cod_mgrp and\n" +
|
||||
" mtb_aart.cod_msgr = mtb_sfam.cod_msgr and\n" +
|
||||
" mtb_aart.cod_msfa = mtb_sfam.cod_msfa\n" +
|
||||
" left outer join mtb_tipi on mtb_aart.cod_mtip = mtb_tipi.cod_mtip\n" +
|
||||
" left outer join mtb_stip on mtb_aart.cod_mtip = mtb_stip.cod_mtip and\n" +
|
||||
" mtb_aart.cod_mstp = mtb_stip.cod_mstp\n" +
|
||||
"\n" +
|
||||
"Where mtb_grup.tipo_mgrp in ('PF', 'SL')\n" +
|
||||
" and mtb_aart.flag_stato = 'A'\n");
|
||||
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Biolevante_Biolevante)){
|
||||
createOrUpdateView("MPS_albero_classificazione","CREATE view MPS_albero_classificazione as\n" +
|
||||
" select distinct mtb_aart.cod_mgrp + Replicate('_', 3 - len(mtb_aart.cod_mgrp)) +\n" +
|
||||
" isNull(mtb_aart.cod_mstp, '0000') +\n" +
|
||||
" ISNULL(mtb_aart.cod_msfa, '') as hierarchy_code,\n" +
|
||||
" mtb_aart.cod_mart,\n" +
|
||||
" mtb_aart.descrizione,\n" +
|
||||
" mtb_aart.cod_mgrp as level_1_code,\n" +
|
||||
" mtb_grup.descrizione as level_1_description,\n" +
|
||||
" mtb_aart.cod_mstp as level_2_code,\n" +
|
||||
" mtb_tipi.descrizione + ' ' + mtb_stip.descrizione as level_2_description,\n" +
|
||||
" mtb_aart.cod_msfa as level_3_code,\n" +
|
||||
" mtb_sfam.descrizione as level_3_description,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" (IIF(jtb_cicl.lotto_min_ord > 0, jtb_cicl.lotto_min_ord * jtb_cicl.rap_conv_prod,\n" +
|
||||
" mtb_aart.qta_cnf * mtb_aart.colli_pedana)) as lot_size\n" +
|
||||
" from mtb_aart\n" +
|
||||
" inner join mtb_grup on mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" inner join mtb_sgrp\n" +
|
||||
" on mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp and mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
" left outer join mtb_sfam on mtb_aart.cod_mgrp = mtb_sfam.cod_mgrp and\n" +
|
||||
" mtb_aart.cod_msgr = mtb_sfam.cod_msgr and\n" +
|
||||
" mtb_aart.cod_msfa = mtb_sfam.cod_msfa\n" +
|
||||
" left outer join mtb_tipi on mtb_aart.cod_mtip = mtb_tipi.cod_mtip\n" +
|
||||
" left outer join mtb_stip on mtb_aart.cod_mtip = mtb_stip.cod_mtip and\n" +
|
||||
" mtb_aart.cod_mstp = mtb_stip.cod_mstp\n" +
|
||||
" left outer join jtb_cicl on mtb_aart.cod_mart = jtb_cicl.cod_prod\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" Where mtb_aart.cod_mgrp in ('AP', 'C', 'CO', 'S', 'SO', 'SOR')\n" +
|
||||
" and not tipo_mgrp = 'ACC'\n" +
|
||||
" and mtb_aart.flag_stato = 'A'\n" +
|
||||
" \n");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251021114611 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE mtb_missione_mag_auto\n" +
|
||||
" ADD priorita SMALLINT DEFAULT 0 NOT NULL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251024113416 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE mtb_missione_mag_auto_det " +
|
||||
"ALTER COLUMN posizione_in VARCHAR (MAX);",
|
||||
|
||||
"ALTER TABLE mtb_missione_mag_auto_det " +
|
||||
"ALTER COLUMN posizione_out VARCHAR (MAX);",
|
||||
|
||||
"ALTER TABLE dtb_ord_steps " +
|
||||
"ALTER COLUMN posizione_out VARCHAR (MAX);");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.entity.MtbDepoPosizioni;
|
||||
import it.integry.ems_model.utility.UtilityList;
|
||||
import it.integry.ems_model.utility.dto.IndexTableDTO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Migration_20251028122833 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createIndex(
|
||||
new IndexTableDTO()
|
||||
.setIndexName("ix_metb_depo_posizioni_posizione_cod_mdep")
|
||||
.setTableName(MtbDepoPosizioni.ENTITY)
|
||||
.setColumnsIndex(new ArrayList<IndexTableDTO.ColumnIndex>() {{
|
||||
add(new IndexTableDTO.ColumnIndex("posizione"));
|
||||
add(new IndexTableDTO.ColumnIndex("cod_mdep"));
|
||||
}})
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.entity.CtbAmac;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
|
||||
public class Migration_20251106114932 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Biolevante_Biolevante)){
|
||||
CtbAmac eurofork = new CtbAmac();
|
||||
eurofork.setCodCmac("MAG-WH1")
|
||||
.setDescrizione("MAGAZZINO AUTOMATICO EUROFORK L7")
|
||||
.setCodJfas("L7")
|
||||
.setPosizione("WH1C3")
|
||||
.setFlagAttivo(true)
|
||||
.setMachineType(CtbAmac.MachineType.SILOS_MACHINE.getValue())
|
||||
.setOperation(OperationType.INSERT);
|
||||
|
||||
eurofork.manageWithParentConnection(connection);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251113102040 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE vtb_list_data ADD promo_chiusa bit DEFAULT 0 NOT NULL");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251113105159 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("exec sp_rename 'vtb_list_data.promo_chiusa', 'chiusura_immediata'");
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251113122313 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("lisv_getTipoUm", "CREATE FUNCTION [dbo].[lisv_getTipoUm]\n" +
|
||||
"(\t\n" +
|
||||
"\t@codMart varchar(15), @tipoUmLisv tinyint\n" +
|
||||
|
||||
@@ -10,6 +10,8 @@ public class Migration_20251114114334 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE ctb_amac DROP COLUMN cod_mdep;");
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251114163222 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE vtb_dest ADD data_mod DATETIME");
|
||||
executeStatement("ALTER TABLE ptb_pros ADD data_mod DATETIME");
|
||||
executeStatement("ALTER TABLE ptb_pros_rif ADD data_mod DATETIME");
|
||||
|
||||
@@ -0,0 +1,289 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251117100418 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateProcedure("sp_moveTableToFileGroup", "CREATE PROCEDURE [dbo].[sp_moveTableToFileGroup] (@tableName varchar(max), @fileGroup varchar(max), @fileName varchar(max), @createFile varchar(1) = 'N')\n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
" /*la variabile @fileGroup deve contenere solo il prefisso poi la procedura aggiunge _DATA e _INDEX*/\n" +
|
||||
"\n" +
|
||||
" declare @fileGroupIndex varchar(max), @fileGroupData varchar(max), @sqlText varchar(max),\n" +
|
||||
" @countFile int, @pathDB varchar(max), @fileGroupDataName varchar(max),\n" +
|
||||
" @fileGroupIndexName varchar(max)\n" +
|
||||
"\n" +
|
||||
" SELECT @pathDB = reverse(substring(reverse(physical_name), charindex('\', reverse(physical_name)), LEN(physical_name) -charindex('', reverse(physical_name) ) + 1)) \n" +
|
||||
" FROM sys.master_files inner join sys.databases on sys.master_files.database_id = sys.databases.database_id WHERE sys.databases.name = DB_NAME()and data_space_id = 1\n" +
|
||||
"\n" +
|
||||
" select @fileGroup = case when IsNull(@fileGroup, '') <> '' and RIGHT(@fileGroup, 5) = '_DATA' THEN LEFT(@fileGroup, LEN(@fileGroup) - 5 ) ELSE @fileGroup END\n" +
|
||||
" \n" +
|
||||
" SELECT @fileGroupData = CASE WHEN @fileGroup = 'PRIMARY' OR IsNull(@fileGroup, '') = '' THEN '' ELSE @fileGroup + '_DATA' END,\n" +
|
||||
" @fileGroupIndex = CASE WHEN @fileGroup = 'PRIMARY' OR IsNull(@fileGroup, '') = '' THEN '' ELSE @fileGroup + '_INDEX ' END\n" +
|
||||
"\n" +
|
||||
" if @fileGroup <> 'PRIMARY' \n" +
|
||||
" BEGIN\n" +
|
||||
" select @countFile = COUNT(*) from sys.filegroups f WHERE name like @fileGroup + '%'\n" +
|
||||
" \n" +
|
||||
" IF @countFile = 0 AND @createFile = 'S'\n" +
|
||||
" BEGIN\n" +
|
||||
" select @fileGroupDataName = Lower(db_name()) + '_' + \n" +
|
||||
" (SELECT UPPER(LEFT(value_string,1)) + LOWER(SUBSTRING(value_string,2,LEN(value_string))) \n" +
|
||||
" FROM dbo.ParseStringIntoArray(@fileGroupData, '_') FOR XML PATH('') ),\n" +
|
||||
" @fileGroupIndexName = Lower(db_name()) + '_' + \n" +
|
||||
" (SELECT UPPER(LEFT(value_string,1)) + LOWER(SUBSTRING(value_string,2,LEN(value_string))) \n" +
|
||||
" FROM dbo.ParseStringIntoArray(@fileGroupIndex, '_') FOR XML PATH('') )\n" +
|
||||
"\n" +
|
||||
" \n" +
|
||||
" SELECT @sqlText =\n" +
|
||||
" 'ALTER DATABASE ' + Upper(db_name()) + ' ADD FILEGROUP ' + @fileGroupData + '; '+ CHAR(13) + CHAR(10) + ' GO' + CHAR(13) + CHAR(10) + \n" +
|
||||
" 'ALTER DATABASE ' + Upper(db_name()) + ' ADD FILE (NAME = ' + @fileGroupDataName + ',' +\n" +
|
||||
" 'FILENAME = ''' + @pathDB + @fileGroupDataName + '.ndf'' ' +\n" +
|
||||
" ') TO FILEGROUP ' + @fileGroupData + ';'+ CHAR(13) + CHAR(10) + ' GO' + CHAR(13) + CHAR(10) + \n" +
|
||||
" 'ALTER DATABASE ' + Upper(db_name()) + ' ADD FILEGROUP ' + @fileGroupIndex + '; '+ CHAR(13) + CHAR(10) + ' GO' + CHAR(13) + CHAR(10) + \n" +
|
||||
" 'ALTER DATABASE ' + Upper(db_name()) + ' ADD FILE (NAME = ' +@fileGroupIndexName + ',' + \n" +
|
||||
" 'FILENAME = ''' + @pathDB + @fileGroupIndexName + '.ndf'' ' +\n" +
|
||||
" ') TO FILEGROUP ' + @fileGroupIndex + ';' + CHAR(13) + CHAR(10) + ' GO' + CHAR(13) + CHAR(10) ;\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" if @fileName <> '' \n" +
|
||||
" exec sp_writeFile @fileName, @sqlText, 'S' \n" +
|
||||
" else \n" +
|
||||
" select @sqlText\n" +
|
||||
" \n" +
|
||||
" END\n" +
|
||||
"\n" +
|
||||
" SELECT @fileGroupData = ' ON ' + @fileGroupData, \n" +
|
||||
" @fileGroupIndex = ' ON ' + @fileGroupIndex\n" +
|
||||
"\n" +
|
||||
" END\n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
" DECLARE crs_query CURSOR FOR\n" +
|
||||
" SELECT 'DROP INDEX '+ schema_name(t.schema_id) + '.' + t.name + '.' +i.name + CHAR(13) + CHAR(10) + ' GO' as script\n" +
|
||||
" FROM sys.indexes i\n" +
|
||||
" INNER JOIN sys.tables t ON t.object_id= i.object_id\n" +
|
||||
" WHERE i.type>0 and \n" +
|
||||
" t.is_ms_shipped=0 and \n" +
|
||||
" t.name<>'sysdiagrams' and \n" +
|
||||
" (is_primary_key=0 and is_unique_constraint=0) and\n" +
|
||||
" t.name = @tableName\n" +
|
||||
" union all\n" +
|
||||
" SELECT 'CREATE ' +\n" +
|
||||
" CASE \n" +
|
||||
" WHEN I.is_unique = 1 THEN ' UNIQUE '\n" +
|
||||
" ELSE ''\n" +
|
||||
" END +\n" +
|
||||
" I.type_desc COLLATE DATABASE_DEFAULT + ' INDEX ' +\n" +
|
||||
" I.name + ' ON ' +\n" +
|
||||
" SCHEMA_NAME(T.schema_id) + '.' + T.name + ' ( ' +\n" +
|
||||
" KeyColumns + ' ) ' +\n" +
|
||||
" ISNULL(' INCLUDE (' + IncludedColumns + ' ) ', '') +\n" +
|
||||
" ISNULL(' WHERE ' + I.filter_definition, '') + ' WITH ( ' +\n" +
|
||||
" CASE \n" +
|
||||
" WHEN I.is_padded = 1 THEN ' PAD_INDEX = ON '\n" +
|
||||
" ELSE ' PAD_INDEX = OFF '\n" +
|
||||
" END + ',' +\n" +
|
||||
" 'FILLFACTOR = ' + CONVERT(\n" +
|
||||
" CHAR(5),\n" +
|
||||
" CASE \n" +
|
||||
" WHEN I.fill_factor = 0 THEN 100\n" +
|
||||
" ELSE I.fill_factor\n" +
|
||||
" END\n" +
|
||||
" ) + ',' +\n" +
|
||||
" -- default value \n" +
|
||||
" 'SORT_IN_TEMPDB = OFF ' + ',' +\n" +
|
||||
" CASE \n" +
|
||||
" WHEN I.ignore_dup_key = 1 THEN ' IGNORE_DUP_KEY = ON '\n" +
|
||||
" ELSE ' IGNORE_DUP_KEY = OFF '\n" +
|
||||
" END + ',' +\n" +
|
||||
" CASE \n" +
|
||||
" WHEN ST.no_recompute = 0 THEN ' STATISTICS_NORECOMPUTE = OFF '\n" +
|
||||
" ELSE ' STATISTICS_NORECOMPUTE = ON '\n" +
|
||||
" END + ',' +\n" +
|
||||
" ' ONLINE = OFF ' + ',' +\n" +
|
||||
" CASE \n" +
|
||||
" WHEN I.allow_row_locks = 1 THEN ' ALLOW_ROW_LOCKS = ON '\n" +
|
||||
" ELSE ' ALLOW_ROW_LOCKS = OFF '\n" +
|
||||
" END + ',' +\n" +
|
||||
" CASE \n" +
|
||||
" WHEN I.allow_page_locks = 1 THEN ' ALLOW_PAGE_LOCKS = ON '\n" +
|
||||
" ELSE ' ALLOW_PAGE_LOCKS = OFF '\n" +
|
||||
" END + ' ) ' + @fileGroupIndex + CHAR(13) + CHAR(10) + ' GO' [CreateIndexScript]\n" +
|
||||
" FROM sys.indexes I\n" +
|
||||
" JOIN sys.tables T\n" +
|
||||
" ON T.object_id = I.object_id\n" +
|
||||
" JOIN sys.sysindexes SI\n" +
|
||||
" ON I.object_id = SI.id\n" +
|
||||
" AND I.index_id = SI.indid\n" +
|
||||
" JOIN (\n" +
|
||||
" SELECT *\n" +
|
||||
" FROM (\n" +
|
||||
" SELECT IC2.object_id,\n" +
|
||||
" IC2.index_id,\n" +
|
||||
" STUFF(\n" +
|
||||
" (\n" +
|
||||
" SELECT ' , ' + C.name + CASE \n" +
|
||||
" WHEN MAX(CONVERT(INT, IC1.is_descending_key)) \n" +
|
||||
" = 1 THEN \n" +
|
||||
" ' DESC '\n" +
|
||||
" ELSE \n" +
|
||||
" ' ASC '\n" +
|
||||
" END\n" +
|
||||
" FROM sys.index_columns IC1\n" +
|
||||
" JOIN sys.columns C\n" +
|
||||
" ON C.object_id = IC1.object_id\n" +
|
||||
" AND C.column_id = IC1.column_id\n" +
|
||||
" AND IC1.is_included_column = \n" +
|
||||
" 0\n" +
|
||||
" WHERE IC1.object_id = IC2.object_id\n" +
|
||||
" AND IC1.index_id = IC2.index_id\n" +
|
||||
" GROUP BY\n" +
|
||||
" IC1.object_id,\n" +
|
||||
" C.name,\n" +
|
||||
" index_id\n" +
|
||||
" ORDER BY\n" +
|
||||
" MAX(IC1.key_ordinal) \n" +
|
||||
" FOR XML PATH('')\n" +
|
||||
" ),\n" +
|
||||
" 1,\n" +
|
||||
" 2,\n" +
|
||||
" ''\n" +
|
||||
" ) KeyColumns\n" +
|
||||
" FROM sys.index_columns IC2 \n" +
|
||||
" --WHERE IC2.Object_id = object_id('Person.Address') --Comment for all tables\n" +
|
||||
" GROUP BY\n" +
|
||||
" IC2.object_id,\n" +
|
||||
" IC2.index_id\n" +
|
||||
" ) tmp3\n" +
|
||||
" )tmp4\n" +
|
||||
" ON I.object_id = tmp4.object_id\n" +
|
||||
" AND I.Index_id = tmp4.index_id\n" +
|
||||
" JOIN sys.stats ST\n" +
|
||||
" ON ST.object_id = I.object_id\n" +
|
||||
" AND ST.stats_id = I.index_id\n" +
|
||||
" JOIN sys.data_spaces DS\n" +
|
||||
" ON I.data_space_id = DS.data_space_id\n" +
|
||||
" JOIN sys.filegroups FG\n" +
|
||||
" ON I.data_space_id = FG.data_space_id\n" +
|
||||
" LEFT JOIN (\n" +
|
||||
" SELECT *\n" +
|
||||
" FROM (\n" +
|
||||
" SELECT IC2.object_id,\n" +
|
||||
" IC2.index_id,\n" +
|
||||
" STUFF(\n" +
|
||||
" (\n" +
|
||||
" SELECT ' , ' + C.name\n" +
|
||||
" FROM sys.index_columns IC1\n" +
|
||||
" JOIN sys.columns C\n" +
|
||||
" ON C.object_id = IC1.object_id\n" +
|
||||
" AND C.column_id = IC1.column_id\n" +
|
||||
" AND IC1.is_included_column = \n" +
|
||||
" 1\n" +
|
||||
" WHERE IC1.object_id = IC2.object_id\n" +
|
||||
" AND IC1.index_id = IC2.index_id\n" +
|
||||
" GROUP BY\n" +
|
||||
" IC1.object_id,\n" +
|
||||
" C.name,\n" +
|
||||
" index_id \n" +
|
||||
" FOR XML PATH('')\n" +
|
||||
" ),\n" +
|
||||
" 1,\n" +
|
||||
" 2,\n" +
|
||||
" ''\n" +
|
||||
" ) IncludedColumns\n" +
|
||||
" FROM sys.index_columns IC2 \n" +
|
||||
" --WHERE IC2.Object_id = object_id('Person.Address') --Comment for all tables\n" +
|
||||
" GROUP BY\n" +
|
||||
" IC2.object_id,\n" +
|
||||
" IC2.index_id\n" +
|
||||
" ) tmp1\n" +
|
||||
" WHERE IncludedColumns IS NOT NULL\n" +
|
||||
" ) tmp2\n" +
|
||||
" ON tmp2.object_id = I.object_id\n" +
|
||||
" AND tmp2.index_id = I.index_id\n" +
|
||||
" WHERE I.is_primary_key = 0\n" +
|
||||
" AND I.is_unique_constraint = 0 and\n" +
|
||||
" t.name = @tableName\n" +
|
||||
" --AND I.Object_id = object_id('Person.Address') --Comment for all tables\n" +
|
||||
" --AND I.name = 'IX_Address_PostalCode' --comment for all indexes \n" +
|
||||
" union all\n" +
|
||||
" SELECT 'ALTER TABLE ' + schema_name(fk.schema_id) + '.' + object_name(fk.parent_object_id)+ ' DROP CONSTRAINT ' + name + CHAR(13) + CHAR(10) + ' GO'\n" +
|
||||
" from sys.foreign_keys fk\n" +
|
||||
" where (object_name(fk.referenced_object_id) = @tableName)\n" +
|
||||
" union all\n" +
|
||||
" SELECT 'EXEC dbo.DropPrimaryKey '''+@tableName+''''+ CHAR(13) + CHAR(10) + ' GO' \n" +
|
||||
" FROM sysobjects sysobjects_a, \n" +
|
||||
" sysobjects sysobjects_b\n" +
|
||||
" WHERE ( sysobjects_a.parent_obj = sysobjects_b.id) and \n" +
|
||||
" ( sysobjects_a.xtype = 'PK' ) and \n" +
|
||||
" ( sysobjects_b.name = @tableName )\n" +
|
||||
" union all\n" +
|
||||
" SELECT 'ALTER TABLE ' + schema_name(tb.schema_id) + '.' + tb. name + ' ADD CONSTRAINT pk_' + tb.name + ' primary key (' + \n" +
|
||||
" ( select STUFF(( select ',' + col.name\n" +
|
||||
" from sys.indexes ix \n" +
|
||||
" inner join sys.index_columns ixc on ix.object_id=ixc.object_id and ix.index_id= ixc.index_id\n" +
|
||||
" inner join sys.columns col on ixc.object_id =col.object_id and ixc.column_id=col.column_id\n" +
|
||||
" where ix.type>0 and (ix.is_primary_key=1 or ix.is_unique_constraint=1)\n" +
|
||||
" and object_name(ix.object_id) = tb.name\n" +
|
||||
" ORDER BY ixc.key_ordinal\n" +
|
||||
" FOR XML PATH('')), 1, 1, '' ) ) + ') ' + @fileGroupData + CHAR(13) + CHAR(10) + ' GO'\n" +
|
||||
" from sys.tables tb\n" +
|
||||
" where tb.name = @tableName and\n" +
|
||||
" object_id in ( select object_id from sys.indexes ix where ix.is_primary_key=1 ) \n" +
|
||||
" union all\n" +
|
||||
" SELECT 'ALTER TABLE ' + schema_name(fk.schema_id) + '.' + object_name(fk.parent_object_id) + \n" +
|
||||
" ' ADD CONSTRAINT ' + FK.NAME + ' FOREIGN KEY (' + \n" +
|
||||
" (SELECT STUFF(( select ',' + c1.NAME \n" +
|
||||
" from sys.foreign_key_columns fkc \n" +
|
||||
" inner join sys.columns c1 on c1.object_id=fkc.parent_object_id and c1.column_id=fkc.parent_column_id \n" +
|
||||
" where fkc.constraint_object_id = fk.OBJECT_ID \n" +
|
||||
" ORDER by fkc.constraint_column_id\n" +
|
||||
" FOR XML PATH('')), 1, 1, '' )) + \n" +
|
||||
" ') REFERENCES ' + OBJECT_NAME(fk.referenced_object_id) + CHAR(13) + CHAR(10) + ' GO'\n" +
|
||||
" from sys.foreign_keys fk\n" +
|
||||
" where ( object_name(fk.referenced_object_id) = @tableName)\n" +
|
||||
" union all\n" +
|
||||
" select 'ALTER TABLE ' + + schema_name(tb.schema_id) + '.' + tb. name + ' ADD ID_PK_TEMP INT IDENTITY; ' + + CHAR(13) + CHAR(10) + 'GO' + CHAR(13) + CHAR(10) + \n" +
|
||||
" 'ALTER TABLE ' + schema_name(tb.schema_id) + '.' + tb. name + ' ADD CONSTRAINT PK_' + tb. name + ' PRIMARY KEY(ID_PK_TEMP) ' + @fileGroupData + '; ' +\n" +
|
||||
"CHAR(13) + CHAR(10) + 'GO' + CHAR(13) + CHAR(10) + \n" +
|
||||
" 'ALTER TABLE ' + schema_name(tb.schema_id) + '.' + tb. name + ' DROP CONSTRAINT PK_' + tb. name + ' ;' + CHAR(13) + CHAR(10) + 'GO'\n" +
|
||||
" from sys.tables tb\n" +
|
||||
" where object_id not in (\n" +
|
||||
" select object_id\n" +
|
||||
" from sys.indexes ix \n" +
|
||||
" where ix.is_primary_key=1 ) and tb.name = @tableName\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" OPEN crs_query \n" +
|
||||
" FETCH NEXT FROM crs_query INTO @sqlText\n" +
|
||||
" WHILE @@FETCH_STATUS = 0\n" +
|
||||
" BEGIN\n" +
|
||||
" if @fileName <> '' \n" +
|
||||
" exec sp_writeFile @fileName, @sqlText, 'S' \n" +
|
||||
" else \n" +
|
||||
" select @sqlText\n" +
|
||||
" \n" +
|
||||
"\n" +
|
||||
" FETCH NEXT FROM crs_query INTO @sqlText\n" +
|
||||
" END\n" +
|
||||
" CLOSE crs_query\n" +
|
||||
" DEALLOCATE crs_query \n" +
|
||||
"END");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251117170957 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
|
||||
return;
|
||||
|
||||
executeStatement("update stb_gest_setup set value = 'S' where gest_name = 'DTB_ORDT' and key_section in ('NUOVA_PROCEDURA','DISABLE_TRIGGER_ORDL')");
|
||||
executeStatement("update stb_gest_sync set syncronize = 'R' where gest_name like 'lord%'");
|
||||
executeStatement("update stb_gest_sync set syncronize = 'R' where gest_name like 'pord%'");
|
||||
executeStatement("insert into stb_abil \n" +
|
||||
"select case when gest_name = 'lordi' then 'LG081' else 'AG031' end , user_name, 'S', case when gest_name = 'lordi' then 'lordi_tab' else 'pordi_tab' end from stb_abil \n" +
|
||||
"where gest_name in ('lordi','pordi') and case when gest_name = 'lordi' then 'LG081' else 'AG031' end + user_name not in (select cod_opz + user_name from stb_abil where cod_opz in ('LG081','AG031'))");
|
||||
executeStatement("update stb_abil set flag_abil = 'N' where gest_name in ('lordi','pordi')");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251118172320 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateTrigger("tr_changeTipoRiep", "CREATE TRIGGER [dbo].[tr_changeTipoRiep]\n" +
|
||||
" ON [dbo].[ctb_cont]\n" +
|
||||
" INSTEAD OF update\n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
" SET NOCOUNT ON;\n" +
|
||||
" declare @cnt int = 0\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" if Update(tipo_riep ) \n" +
|
||||
" begin\n" +
|
||||
" SELECT @cnt = COUNT(*) from ctb_movr inner join inserted on ctb_movr.cod_ccon = inserted.cod_ccon and \n" +
|
||||
" ( (inserted.tipo_riep is null and ctb_movr.cod_anag is not null ) or (inserted.tipo_riep is null and ctb_movr.cod_anag is null ) )\n" +
|
||||
" end\n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
" IF @cnt > 0\n" +
|
||||
" BEGIN\n" +
|
||||
" THROW 50002, 'Update non consentito: esistono movimenti collegati.', 1;\n" +
|
||||
" RETURN;\n" +
|
||||
" END\n" +
|
||||
" \n" +
|
||||
" update ctb_cont \n" +
|
||||
" set cod_cmas = inserted.cod_cmas,\n" +
|
||||
" cod_cgrp = inserted.cod_cgrp,\n" +
|
||||
" descrizione = inserted.descrizione,\n" +
|
||||
" tipo_riep = inserted.tipo_riep,\n" +
|
||||
" saldo_att = inserted.saldo_att,\n" +
|
||||
" flag_cont_analit = inserted.flag_cont_analit,\n" +
|
||||
" cod_biva = inserted.cod_biva,\n" +
|
||||
" cod_jfas = inserted.cod_jfas,\n" +
|
||||
" cod_csct = inserted.cod_csct,\n" +
|
||||
" flag_risconto = inserted.flag_risconto,\n" +
|
||||
" perc_ded = inserted.perc_ded,\n" +
|
||||
" diacod = inserted.diacod,\n" +
|
||||
" data_ins = inserted.data_ins,\n" +
|
||||
" data_mod = inserted.data_mod\n" +
|
||||
" from ctb_cont inner join inserted on ctb_cont.cod_ccon = inserted.cod_ccon\n" +
|
||||
"\n" +
|
||||
"END");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251119084719 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("alter table dtb_note_doc add flag_bio bit not null default 0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251119170058 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("COD_PAGA_D", "Codice pagamento", " SELECT COD_PAGA + '|' + COD_PAGA + '-' + DESCRIZIONE FROM gtb_paga WHERE flag_attivo = 'S'");
|
||||
executeStatement("UPDATE stb_gest_setup SET query_default = 'COD_PAGA_D'\n" +
|
||||
"WHERE gest_name = 'CTB_SCAD'\n" +
|
||||
"AND section ='COD_PAGA'",
|
||||
"alter table ctb_caus add flag_paga_enasarco bit default 0 not null");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251120123843 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("alter table gtb_anag alter column citta varchar(60)");
|
||||
|
||||
createOrUpdateFunction("IntToBase36", "CREATE FUNCTION dbo.IntToBase36(@n bigint)\n" +
|
||||
" RETURNS varchar(50)\n" +
|
||||
" AS\n" +
|
||||
" BEGIN\n" +
|
||||
" DECLARE @chars varchar(36) = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n" +
|
||||
" DECLARE @res varchar(50) = '';\n" +
|
||||
" DECLARE @rem bigint;\n" +
|
||||
" IF @n IS NULL RETURN NULL;\n" +
|
||||
" IF @n = 0 RETURN '0';\n" +
|
||||
" WHILE @n > 0\n" +
|
||||
" BEGIN\n" +
|
||||
" SET @rem = @n % 36;\n" +
|
||||
" SET @res = SUBSTRING(@chars, @rem + 1, 1) + @res;\n" +
|
||||
" SET @n = @n / 36;\n" +
|
||||
" END\n" +
|
||||
" RETURN @res;\n" +
|
||||
" END;");
|
||||
createOrUpdateFunction("Base36ToInt", "CREATE FUNCTION dbo.Base36ToInt(@s varchar(50))\n" +
|
||||
" RETURNS bigint\n" +
|
||||
" AS\n" +
|
||||
" BEGIN\n" +
|
||||
" DECLARE @chars varchar(36) = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n" +
|
||||
" DECLARE @i int = 1;\n" +
|
||||
" DECLARE @len int = LEN(@s);\n" +
|
||||
" DECLARE @val bigint = 0;\n" +
|
||||
" DECLARE @c char(1);\n" +
|
||||
" IF @s IS NULL RETURN NULL;\n" +
|
||||
" WHILE @i <= @len\n" +
|
||||
" BEGIN\n" +
|
||||
" SET @c = UPPER(SUBSTRING(@s, @i, 1));\n" +
|
||||
" SET @val = @val * 36 + (CHARINDEX(@c, @chars) - 1);\n" +
|
||||
" SET @i = @i + 1;\n" +
|
||||
" END\n" +
|
||||
" RETURN @val;\n" +
|
||||
" END;");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251120153047 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("alter table gtb_anag alter column rag_soc varchar(100)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251120172527 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
if(!isCustomer(IntegryCustomer.CapelliMonelli)) return;
|
||||
|
||||
createOrUpdateFunction("[f_suggestCodeCodAnag]", "CREATE FUNCTION [dbo].[f_suggestCodeCodAnag](@partialCode varchar(5))\n" +
|
||||
" \n" +
|
||||
"RETURNS varchar(20) \n" +
|
||||
"WITH INLINE = OFF\n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
" DECLARE @ls_codAnag VARCHAR(5), @codLen int, @condPartialCode varchar(10), @recuperaCodici varchar(1);\n" +
|
||||
"\n" +
|
||||
" SELECT @condPartialCode= ISNULL(@partialCode, '') + '[0-9]'\n" +
|
||||
"\n" +
|
||||
" SELECT @partialCode = ISNULL(@partialCode, '')\n" +
|
||||
"\n" +
|
||||
" SET @codLen = 5\n" +
|
||||
" \n" +
|
||||
" SELECT @recuperaCodici = dbo.getGestSetup('GTB_ANAG','SETUP','RECUPERA_CODICI')\n" +
|
||||
"\n" +
|
||||
" IF @recuperaCodici = 'S'\n" +
|
||||
" BEGIN\n" +
|
||||
" SELECT @ls_codAnag = (\n" +
|
||||
" SELECT top 1 @partialCode + REPLICATE('0', 5 - len(@partialCode) - len(row_id)) + cast(row_id as varchar)\n" +
|
||||
" from (\n" +
|
||||
" select cast(SUBSTRING(cod_anag, len(@partialCode) + 1, len(cod_anag) - len(@partialCode) + 1) as int) as num_code, \n" +
|
||||
" ROW_NUMBER() over (order by cast(SUBSTRING(cod_anag, len(@partialCode) + 1, len(cod_anag) - len(@partialCode) + 1) as int)) as row_id\n" +
|
||||
" from gtb_anag\n" +
|
||||
" where cod_anag like @condPartialCode+'%') tmp \n" +
|
||||
" where tmp.num_code > tmp.row_id and tmp.num_code <> 0)\n" +
|
||||
" END\n" +
|
||||
"\n" +
|
||||
" if @ls_codAnag is null \n" +
|
||||
" begin \n" +
|
||||
" SELECT @ls_codAnag = @partialCode + REPLICATE('0', @codLen - len(@partialCode) - len(dbo.IntToBase36(max_code.partial_code))) + Cast(dbo.IntToBase36(max_code.partial_code) as varchar)\n" +
|
||||
" from ( \n" +
|
||||
" SELECT cast(IsNull(max(try_cast(substring(cod_anag, len(@partialCode)+1, len(cod_anag) - len(@partialCode)) as numeric)), 0) + 1 as varchar) as partial_code\n" +
|
||||
" FROM gtb_anag\n" +
|
||||
" WHERE cod_anag like @partialCode + '%' ) max_code;\n" +
|
||||
" end \n" +
|
||||
" RETURN @ls_codAnag;\n" +
|
||||
"END");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251120181812 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateView("cvw_tipi_pdc", "CREATE VIEW cvw_tipi_pdc AS\n" +
|
||||
"SELECT '1' AS codice, Upper('Attivo') descrizione, '1' as sezione\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT '2', Upper('Passivo'), '1' as sezione\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT '3', Upper('Netto'), '1' as sezione\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT '4', Upper('Costi'), '2' as sezione\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT '5', Upper('Ricavi'), '2' as sezione\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT '6', Upper('D''ordine'), '3'\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT '7', Upper('Epilogativi'), '3'");
|
||||
createOrUpdateView("cvw_sezione_pdc", "CREATE VIEW cvw_sezione_pdc AS\n" +
|
||||
"SELECT '1' AS codice, Upper('Stato Patrimoniale') AS descrizione\n" +
|
||||
"UNION ALL\n" +
|
||||
"SELECT '2', Upper('Conto Economico')\n" +
|
||||
"UNION ALL\n" +
|
||||
"SELECT '3', upper('Conti d''ordine e di Riepilogo')");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251121105212 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
addDefault("mtb_lisv", "add_ric_spese", 1);
|
||||
addDefault("mtb_lisv", "add_sco_spese", 1);
|
||||
addDefault("mtb_lisv", "add_val_spese", 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251121132504 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("SI_NO", "SI_NO", "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
createSetup("VTB_LIST", "SETUP", "GESTISCI_SPESE_LISTINO", "N",
|
||||
"permette di gestire le spese di trasporto agganciate a listino", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (isCustomer(IntegryCustomer.RossoGargano))
|
||||
updateSetupValue("VTB_LIST", "SETUP", "GESTISCI_SPESE_LISTINO", "S");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251121133310 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomer(IntegryCustomer.Carelli) || isCustomer(IntegryCustomer.SaporiVeri)) return;
|
||||
updateSetupValue("W_VLISTDATA_RC", "SETUP", "FILTRO_ARTICOLI", "N");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251121140004 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("SI_NO", "SI_NO", "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
createSetup("PICKING", "SPEDIZIONE", "FLAG_UNDERFLOW_QUANTITY_WARNING", "N",
|
||||
"Avvisa l'operatore che sta prelevando una quantità inferiore rispetto a quella disponibile nel UL", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (isCustomer(IntegryCustomer.RossoGargano)) {
|
||||
updateSetupValue("PICKING", "SPEDIZIONE", "FLAG_UNDERFLOW_QUANTITY_WARNING", "S");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251121150257 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("getMaggiorazioneSpese", "CREATE FUNCTION [dbo].[getMaggiorazioneSpese](@dataValidita datetime, @codVlis varchar(5), @codSpes varchar(5)) \n" +
|
||||
"RETURNS TABLE AS \n" +
|
||||
" return \n" +
|
||||
" select vtb_list.cod_vlis, \n" +
|
||||
" vtb_list.descrizione, \n" +
|
||||
" case when tmp_lisv_spese.max_lisv is null then null else Convert(datetime, left(tmp_lisv_spese.max_lisv, 10)) end as data_iniz, \n" +
|
||||
" case when tmp_lisv_spese.max_lisv is null then null else Convert(int, right(tmp_lisv_spese.max_lisv, 4)) end as versione, \n" +
|
||||
" vtb_list.cod_divi,\n" +
|
||||
" tmp_lisv_spese.cod_spes as 'cod_spes', \n" +
|
||||
" IsNull(mtb_lisv_data_spese.perc_ricarico, 0) as perc_ricarico, \n" +
|
||||
" IsNull(mtb_lisv_data_spese.val_ricarico, 0) as val_ricarico,\n" +
|
||||
" mtb_lisv_data_spese.da as da,\n" +
|
||||
" mtb_lisv_data_spese.a as a,\n" +
|
||||
" IsNull(mtb_lisv_data_spese.perc_sconto, 0) as perc_sconto,\n" +
|
||||
" mtb_lisv_data_spese.id\n" +
|
||||
" from ( SELECT vtb_list.cod_vlis as cod_vlis, \n" +
|
||||
" mtb_lisv_data_spese.cod_spes, \n" +
|
||||
" max(case when vtb_list_data.versione is null then null else Convert(varchar(10), vtb_list_data.data_iniz, 111) + ' ' + replicate('0', 4 - len(vtb_list_data.versione)) + Convert(varchar(5), vtb_list_data.versione) end ) as max_lisv,\n" +
|
||||
" vtb_list.cod_vlis as 'cod_vlis_rif'\n" +
|
||||
" FROM vtb_list, \n" +
|
||||
" mtb_lisv_data_spese LEFT OUTER JOIN vtb_list_data ON mtb_lisv_data_spese.cod_vlis = vtb_list_data.cod_vlis AND \n" +
|
||||
" mtb_lisv_data_spese.versione = vtb_list_data.versione and \n" +
|
||||
" vtb_list_data.cod_promo is null AND\n" +
|
||||
" vtb_list_data.data_iniz <= IsNull(@dataValidita, GetDate())\n" +
|
||||
" WHERE vtb_list.cod_vlis = mtb_lisv_data_spese.cod_vlis and vtb_list.cod_vlis_rif is null\n" +
|
||||
" GROUP BY vtb_list.cod_vlis,\n" +
|
||||
" mtb_lisv_data_spese.cod_spes\n" +
|
||||
" union\n" +
|
||||
" SELECT vtb_list.cod_vlis as cod_vlis, \n" +
|
||||
" mtb_lisv_data_spese.cod_spes, \n" +
|
||||
" max(case when vtb_list_data.versione is null then null else Convert(varchar(10), vtb_list_data.data_iniz, 111) + ' ' + replicate('0', 4 - len(vtb_list_data.versione)) + Convert(varchar(5), vtb_list_data.versione) end ) as max_lisv,\n" +
|
||||
" vtb_list.cod_vlis_rif as 'cod_vlis_rif'\n" +
|
||||
" FROM vtb_list, \n" +
|
||||
" mtb_lisv_data_spese \n" +
|
||||
" LEFT OUTER JOIN vtb_list_data ON mtb_lisv_data_spese.cod_vlis = vtb_list_data.cod_vlis AND \n" +
|
||||
" mtb_lisv_data_spese.versione = vtb_list_data.versione and \n" +
|
||||
" vtb_list_data.cod_promo is null AND\n" +
|
||||
" vtb_list_data.data_iniz <= IsNull(@dataValidita, GetDate())\n" +
|
||||
" WHERE vtb_list.cod_vlis_rif = mtb_lisv_data_spese.cod_vlis and vtb_list.cod_vlis_rif is not null\n" +
|
||||
" GROUP BY vtb_list.cod_vlis,\n" +
|
||||
" mtb_lisv_data_spese.cod_spes, \n" +
|
||||
" vtb_list.cod_vlis_rif ) tmp_lisv_spese LEFT OUTER JOIN mtb_lisv_data_spese ON tmp_lisv_spese.cod_vlis_rif = mtb_lisv_data_spese.cod_vlis AND \n" +
|
||||
" tmp_lisv_spese.cod_spes = mtb_lisv_data_spese.cod_spes AND\n" +
|
||||
" Convert(int, right( tmp_lisv_spese.max_lisv, 4)) = mtb_lisv_data_spese.versione, \n" +
|
||||
" vtb_list,\n" +
|
||||
" gtb_spes\n" +
|
||||
" WHERE vtb_list.cod_vlis = tmp_lisv_spese.cod_vlis and \n" +
|
||||
" ( @codSpes is null or tmp_lisv_spese.cod_spes = @codSpes ) and\n" +
|
||||
" ( @codVlis is null or tmp_lisv_spese.cod_vlis = @codVlis) and\n" +
|
||||
" tmp_lisv_spese.cod_spes = gtb_spes.cod_spes");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251121165211 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if(isCustomer(IntegryCustomer.Biolevante)) {
|
||||
createOrUpdateFunction("[getSchedaCosti]", "CREATE FUNCTION [dbo].[getSchedaCosti](@CodProd VARCHAR(15), @DataCosto DATETIME, @codVlis VARCHAR(5),\n" +
|
||||
" @tipoCosto VARCHAR(2))\n" +
|
||||
" RETURNS TABLE\n" +
|
||||
" AS\n" +
|
||||
" RETURN\n" +
|
||||
" (\n" +
|
||||
"/*\n" +
|
||||
"\n" +
|
||||
"declare @CodProd VARCHAR(15), @DataCosto DATETIME, @codVlis VARCHAR(5), @tipoCosto varchar(2)\n" +
|
||||
"\n" +
|
||||
"set @codProd = 'ccondib1lev'\n" +
|
||||
"set @dataCosto = Cast(getDAte() as date)\n" +
|
||||
"set @tipoCosto = 'UC';\n" +
|
||||
"set @codVlis = '0036';\n" +
|
||||
"*/\n" +
|
||||
"/*tipoCosto: \n" +
|
||||
" UC = Ultimo costo\n" +
|
||||
" CM = Costo di mercato */\n" +
|
||||
" WITH gruppi_merc AS (SELECT cod_mgrp,\n" +
|
||||
" descrizione,\n" +
|
||||
" tipo_mgrp,\n" +
|
||||
" CASE tipo_mgrp\n" +
|
||||
" WHEN 'MP' THEN '01'\n" +
|
||||
" WHEN 'IMB' THEN '02'\n" +
|
||||
" WHEN 'ACC' THEN '03'\n" +
|
||||
" WHEN 'SL' THEN '04'\n" +
|
||||
" WHEN 'PF' THEN '04'\n" +
|
||||
" ELSE 11 END AS sort_categ,\n" +
|
||||
" CASE tipo_mgrp\n" +
|
||||
" WHEN 'MP' THEN 'MATERIE PRIME'\n" +
|
||||
" WHEN 'IMB' THEN 'IMBALLAGGI'\n" +
|
||||
" WHEN 'ACC' THEN 'MATERIALE ACCESSORIO'\n" +
|
||||
" WHEN 'SL' THEN 'COSTO LAVORAZIONI'\n" +
|
||||
" WHEN 'PF' THEN 'COSTO LAVORAZIONI'\n" +
|
||||
" ELSE tipo_mgrp\n" +
|
||||
" END AS categoria,\n" +
|
||||
" CASE WHEN tipo_mgrp IN ('MP', 'IMB', 'ACC') THEN 1 ELSE 0 END AS isMateriaPrima\n" +
|
||||
" from mtb_grup)\n" +
|
||||
" ,explode_dist AS (\n" +
|
||||
" SELECT CASE WHEN sfuso.cod_mart IS NOT NULL THEN 1 ELSE 0 END AS isSfuso,\n" +
|
||||
" ISNULL(ISNULL(sfuso.cod_mart, dist.cod_prod), mtb_aart.cod_mart) AS cod_mart,\n" +
|
||||
" dist.flag_foglia,\n" +
|
||||
" dist.unt_mis_prod AS unt_mis_art,\n" +
|
||||
" mtb_aart.unt_mis AS unt_mis_prod,\n" +
|
||||
" dist.qta_prod * ISNULL(sfuso.PercProd, 1) AS qta_prod,\n" +
|
||||
" case when sfuso.cod_mart IS not null \n" +
|
||||
" then\n" +
|
||||
" /*se si tratta di un mix pendiamo il costo dei materiali dalla mtb_aart*/\n" +
|
||||
" sfuso_art.val_ult_car\n" +
|
||||
" else\n" +
|
||||
" ROUND(ISNULL(dist.costo_materiali, 0) / dist.qta_prod *\n" +
|
||||
" ISNULL(sfuso.PercProd, 1),\n" +
|
||||
" 5) end AS costo_unt,\n" +
|
||||
" ISNULL( (case \n" +
|
||||
" when sfuso.cod_mart IS not null \n" +
|
||||
" then sfuso_art.val_ult_car * dist.qta_prod \n" +
|
||||
" else dist.costo_materiali end ) \n" +
|
||||
" * ISNULL(sfuso.PercProd, 1), 0) AS costo_materiali,\n" +
|
||||
" \n" +
|
||||
" ISNULL(dist.costo_manodopera, 0) +\n" +
|
||||
" ISNULL(dist.costo_manodopera_magaz, 0) +\n" +
|
||||
" ISNULL(dist.costo_servizi, 0) \n" +
|
||||
" AS altri_costi\n" +
|
||||
" FROM dbo.f_explodedist(@codprod, 1, 'U', @datacosto, 'S', 'S') dist\n" +
|
||||
" INNER JOIN mtb_aart\n" +
|
||||
" ON mtb_aart.cod_mart = ISNULL(dist.cod_prod_pri, dist.cod_prod) \n" +
|
||||
" LEFT OUTER JOIN olvw_miscele_olio miscele ON dist.cod_prod = miscele.cod_mart\n" +
|
||||
" LEFT OUTER JOIN olvw_distinta_sfuso sfuso\n" +
|
||||
" ON dist.cod_prod_pri = sfuso.cod_prod AND\n" +
|
||||
" dist.cod_prod = miscele.cod_mart\n" +
|
||||
" LEFT OUTER JOIN mtb_aart sfuso_art on sfuso.cod_mart = sfuso_art.cod_mart\n" +
|
||||
"\n" +
|
||||
" )\n" +
|
||||
" , distinta_base AS (\n" +
|
||||
" SELECT 1 AS sort,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN explode_dist.flag_foglia = 1 THEN gruppi_merc.sort_categ ELSE '4' END as sort_categ,\n" +
|
||||
" gruppi_merc.tipo_mgrp,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN explode_dist.flag_foglia = 1 THEN gruppi_merc.categoria ELSE 'COSTO LAVORAZIONI' END as categoria,\n" +
|
||||
" mtb_aart.cod_msgr, \n" +
|
||||
" CASE\n" +
|
||||
" WHEN explode_dist.flag_foglia = 1 --OR gruppi_merc.isMateriaPrima = 1\n" +
|
||||
" THEN mtb_aart.descrizione\n" +
|
||||
" ELSE 'MANO DOPERA E ALTRI COSTI DI PRODUZIONE (' + gruppi_merc.tipo_mgrp + ')' END AS descr_costo,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN explode_dist.flag_foglia = 1 --OR gruppi_merc.isMateriaPrima = 1\n" +
|
||||
" THEN explode_dist.cod_mart\n" +
|
||||
" END AS cod_mart,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN explode_dist.flag_foglia = 1 --OR gruppi_merc.isMateriaPrima = 1\n" +
|
||||
" THEN explode_dist.unt_mis_art\n" +
|
||||
" ELSE explode_dist.unt_mis_prod END AS unt_mis,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN explode_dist.flag_foglia = 1 --OR gruppi_merc.isMateriaPrima = 1\n" +
|
||||
" THEN explode_dist.qta_prod\n" +
|
||||
" ELSE 1 END AS qta_prod,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN explode_dist.flag_foglia = 1 --OR gruppi_merc.isMateriaPrima = 1 \n" +
|
||||
" THEN\n" +
|
||||
" CASE\n" +
|
||||
" WHEN @tipoCosto = 'CM' THEN ISNULL(lisa.costo_mercato, 0)\n" +
|
||||
" ELSE explode_dist.costo_unt END\n" +
|
||||
" ELSE explode_dist.altri_costi END AS costo_unit,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN explode_dist.flag_foglia = 1 THEN\n" +
|
||||
" CASE\n" +
|
||||
" WHEN @tipoCosto = 'CM'\n" +
|
||||
" THEN ISNULL(lisa.costo_mercato, 0) * explode_dist.qta_prod\n" +
|
||||
" ELSE explode_dist.costo_materiali END +\n" +
|
||||
" --ISNULL(oneri_acq.costo_kg * explode_dist.qta_prod, 0)\n" +
|
||||
" CASE WHEN @tipoCosto = 'CM'\n" +
|
||||
" THEN ISNULL(oneri_acq.costo_kg * explode_dist.qta_prod, 0)\n" +
|
||||
" ELSE 0 END\n" +
|
||||
" ELSE explode_dist.altri_costi END costo_materiali,\n" +
|
||||
" CONVERT(VARCHAR(4), 'VAL') AS qualificatore,\n" +
|
||||
" CONVERT(VARCHAR(1), 'V') AS tipo_calcolo,\n" +
|
||||
" dati_listino.dati AS dati_listino\n" +
|
||||
" FROM explode_dist\n" +
|
||||
" INNER JOIN mtb_aart ON explode_dist.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" INNER JOIN gruppi_merc ON mtb_aart.cod_mgrp = gruppi_merc.cod_mgrp\n" +
|
||||
" OUTER APPLY (SELECT LISA.COD_MART,\n" +
|
||||
" AVG(prz_acq_netto_um) AS costo_mercato\n" +
|
||||
" FROM dbo.getListinoAcquisto(DATEADD(MONTH, 1, @DataCosto),\n" +
|
||||
" NULL, NULL, mtb_aart.cod_mart,\n" +
|
||||
" 'S', NULL) lisa\n" +
|
||||
" WHERE ( Lisa.tipo_variazione is null OR lisa.tipo_variazione <> 'D' )\n" +
|
||||
" AND lisa.flag_attivo = 'S'\n" +
|
||||
" AND lisa.flag_forn_pref = 'S'\n" +
|
||||
" AND @tipoCosto = 'CM'\n" +
|
||||
" GROUP BY lisa.cod_mart) lisa\n" +
|
||||
" OUTER APPLY (SELECT STUFF((SELECT '~' + lisa.cod_alis + ' - ' +\n" +
|
||||
" lisa.descrizione + ' DEL ' +\n" +
|
||||
" CONVERT(VARCHAR(10), lisa.data_iniz, 103) +\n" +
|
||||
" ' PREZZO: ' +\n" +
|
||||
" FORMAT(prz_acq_netto_um, '#,##0.00###') +\n" +
|
||||
" '€' AS [text()]\n" +
|
||||
" FROM dbo.getListinoAcquisto(\n" +
|
||||
" DATEADD(WEEK, 1, @DataCosto),\n" +
|
||||
" NULL, NULL, mtb_aart.cod_mart,\n" +
|
||||
" 'S', NULL) lisa\n" +
|
||||
" WHERE lisa.tipo_variazione <> 'D'\n" +
|
||||
" AND lisa.flag_attivo = 'S'\n" +
|
||||
" AND lisa.flag_forn_pref = 'S'\n" +
|
||||
" AND @tipoCosto = 'CM'\n" +
|
||||
" FOR XML PATH('')), 1, 1,\n" +
|
||||
" '') AS dati) dati_listino\n" +
|
||||
" OUTER APPLY (SELECT SUM(conai.costo_kg * mtb_spes.qta_spes) AS costo_kg\n" +
|
||||
" FROM mtb_aart arti\n" +
|
||||
" INNER JOIN mtb_spes ON arti.cod_mart = mtb_spes.cod_mart\n" +
|
||||
" LEFT OUTER JOIN (SELECT cod_conai,\n" +
|
||||
" da_data,\n" +
|
||||
" LEAD(\n" +
|
||||
" DATEADD(DAY, -1, da_data),\n" +
|
||||
" 1,\n" +
|
||||
" CAST(GETDATE() AS DATE))\n" +
|
||||
" OVER (PARTITION BY cod_conai ORDER BY da_data) AS a_data,\n" +
|
||||
" costo_kg\n" +
|
||||
" FROM gtb_conai_costi) conai\n" +
|
||||
" ON mtb_spes.cod_spes =\n" +
|
||||
" conai.cod_conai AND\n" +
|
||||
" CAST(GETDATE() AS DATE) BETWEEN da_data AND a_data\n" +
|
||||
" WHERE arti.cod_mart = mtb_aart.cod_mart) AS oneri_acq )\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" SELECT sort,\n" +
|
||||
" sort_categ AS group_categ,\n" +
|
||||
" sort_categ,\n" +
|
||||
" tipo_mgrp,\n" +
|
||||
" categoria,\n" +
|
||||
" cod_msgr,\n" +
|
||||
" descr_costo,\n" +
|
||||
" cod_mart,\n" +
|
||||
" unt_mis,\n" +
|
||||
" ROUND(qta_prod, 4) AS qta_prod,\n" +
|
||||
" /*costo_unit,*/\n" +
|
||||
" CASE\n" +
|
||||
" WHEN qta_prod > 0 THEN ROUND(ISNULL(costo_materiali, 0) / qta_prod, 5)\n" +
|
||||
" ELSE 0 END AS costo_unit,\n" +
|
||||
" ROUND(ISNULL(costo_materiali, 0), 5) AS valore,\n" +
|
||||
" qualificatore,\n" +
|
||||
" tipo_calcolo,\n" +
|
||||
" dati_listino\n" +
|
||||
" FROM distinta_base\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT CASE WHEN tipo_calcolo = 'LAVORAZIONE' THEN 1 ELSE 2 END AS sort,\n" +
|
||||
" CASE WHEN tipo_calcolo = 'LAVORAZIONE' THEN 4 ELSE 5 END AS group_categ,\n" +
|
||||
" 20,\n" +
|
||||
" NULL,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN tipo_calcolo = 'LAVORAZIONE' THEN 'COSTO LAVORAZIONI'\n" +
|
||||
" ELSE 'COSTI DIRETTI COMMERCIALI E CONSEGNA' END,\n" +
|
||||
" NULL,\n" +
|
||||
" jtb_dist_clav_dir.descrizione,\n" +
|
||||
" jtb_dist_clav_dir.cod_prod,\n" +
|
||||
" jtb_dist_clav_dir.unt_mis,\n" +
|
||||
" jtb_dist_clav_dir.qta_lav / jtb_cicl.qta_prod / jtb_cicl.rap_conv_prod AS qta_lav,\n" +
|
||||
" jtb_dist_clav_dir.val_unt,\n" +
|
||||
" (jtb_dist_clav_dir.qta_lav * jtb_dist_clav_dir.val_unt / jtb_cicl.qta_prod /\n" +
|
||||
" jtb_cicl.rap_conv_prod),\n" +
|
||||
" CONVERT(VARCHAR(4), 'VAL') AS qualificatore,\n" +
|
||||
" CONVERT(VARCHAR(1), 'V') AS tipo_calcolo,\n" +
|
||||
" NULL AS dati_listino\n" +
|
||||
" FROM jtb_dist_clav_dir\n" +
|
||||
" INNER JOIN jtb_cicl ON jtb_cicl.cod_prod = jtb_dist_clav_dir.cod_prod\n" +
|
||||
" INNER JOIN gtb_spes ON jtb_dist_clav_dir.cod_jcos_dir = gtb_spes.cod_spes\n" +
|
||||
" WHERE jtb_dist_clav_dir.cod_prod = (@codprod)\n" +
|
||||
" AND gtb_spes.tipo_calcolo IN ('TRASPORTO PER KG', 'TRASPORTO PER COLLO', 'COMMERCIALI', 'LAVORAZIONE')\n" +
|
||||
" AND jtb_dist_clav_dir.flag_fase_pref = 'S'\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT 2,\n" +
|
||||
" 5 AS group_categ,\n" +
|
||||
" 21,\n" +
|
||||
" NULL,\n" +
|
||||
" 'COSTI DIRETTI COMMERCIALI E CONSEGNA',\n" +
|
||||
" NULL,\n" +
|
||||
" jtb_clav_ind.descrizione,\n" +
|
||||
" NULL,\n" +
|
||||
" NULL,\n" +
|
||||
" NULL,\n" +
|
||||
" NULL,\n" +
|
||||
" jtb_dist_clav_ind.perc_cost,\n" +
|
||||
" CONVERT(VARCHAR(4), 'PERC') AS qualificatore,\n" +
|
||||
" jtb_clav_ind.tipo_calcolo AS tipo_calcolo,\n" +
|
||||
" NULL AS dati_listino\n" +
|
||||
" FROM jtb_dist_clav_ind\n" +
|
||||
" INNER JOIN jtb_clav_ind ON jtb_clav_ind.cod_jcos_ind = jtb_dist_clav_ind.cod_jcos_ind\n" +
|
||||
" WHERE jtb_dist_clav_ind.cod_prod = (@codprod)\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT sort,\n" +
|
||||
" group_categ,\n" +
|
||||
" sort_categ,\n" +
|
||||
" tipo_mgrp,\n" +
|
||||
" categoria,\n" +
|
||||
" cod_msgr,\n" +
|
||||
" descr_costo,\n" +
|
||||
" cod_mart,\n" +
|
||||
" unt_mis,\n" +
|
||||
" ROUND(qta_prod, 4) AS qta_prod,\n" +
|
||||
" costo_unit,\n" +
|
||||
" valore,\n" +
|
||||
" qualificatore,\n" +
|
||||
" tipo_calcolo,\n" +
|
||||
" dati_listino\n" +
|
||||
" FROM dbo.getSchedaCosti_DatiCommerciali(@codprod, @DataCosto, @codvlis) AS dati_commerciali\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT 3,\n" +
|
||||
" 6 AS group_categ,\n" +
|
||||
" 31,\n" +
|
||||
" NULL,\n" +
|
||||
" 'COSTI INDIRETTI',\n" +
|
||||
" NULL,\n" +
|
||||
" 'COSTI GENERALI INCIDENZA A PERCENTUALE',\n" +
|
||||
" jtb_cicl.cod_mart,\n" +
|
||||
" NULL,\n" +
|
||||
" NULL,\n" +
|
||||
" NULL,\n" +
|
||||
" ISNULL(jtb_cicl.perc_cost_gen, 0) AS perc_costi_gen,\n" +
|
||||
" CONVERT(VARCHAR(4), 'PERC') AS qualificatore,\n" +
|
||||
" CONVERT(VARCHAR(1), 'V') AS tipo_calcolo,\n" +
|
||||
" NULL AS dati_listino\n" +
|
||||
" FROM mtb_aart\n" +
|
||||
" INNER JOIN jtb_cicl ON mtb_aart.cod_mart = jtb_cicl.cod_prod \n" +
|
||||
" WHERE mtb_aart.cod_mart = (@codprod) \n" +
|
||||
" )");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251121183801 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomer(IntegryCustomer.Materica) && !isCustomer(IntegryCustomer.Ime)) return;
|
||||
updateSetupValue("CRM", "COD_CCON", "PREFISSO_I", "105000");
|
||||
updateSetupValue("CRM", "COD_CCON", "DEFAULT", "111000");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.utility.dto.IndexTableDTO;
|
||||
import it.integry.ems_model.utility.dto.PkTableDTO;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Migration_20251124102759 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomer(IntegryCustomer.Carelli) || isCustomer(IntegryCustomer.RistoCash)) {
|
||||
executeStatement("create table apuliac_perc_premio (\n" +
|
||||
"id bigint identity,\n" +
|
||||
"cod_forn varchar(10) not null,\n" +
|
||||
"divisione varchar(10),\n" +
|
||||
"perc_premio numeric(5,3) not null default 0 )");
|
||||
|
||||
|
||||
PkTableDTO pkTableDTO = new PkTableDTO()
|
||||
.setTableName("apuliac_perc_premio")
|
||||
.addColumn(new PkTableDTO.Column("id"));
|
||||
createPrimaryKey(pkTableDTO);
|
||||
|
||||
IndexTableDTO indexTableDTO = new IndexTableDTO()
|
||||
.setTableName("apuliac_perc_premio")
|
||||
.setIndexName("ix_apuliac_perc_premio_codforn_div")
|
||||
.setUnique(true)
|
||||
.setColumnsIndex(Arrays.asList(
|
||||
new IndexTableDTO.ColumnIndex("cod_forn"),
|
||||
new IndexTableDTO.ColumnIndex("divisione")
|
||||
));
|
||||
|
||||
createIndex(indexTableDTO);
|
||||
|
||||
executeStatement("exec sp_rename 'apuliac_agg_prz_csv.altro', 'divisione_premio'");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251124135552 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("getGrigliaAcquisto","CREATE FUNCTION [dbo].[getGrigliaAcquisto] (@dataValidita datetime, @codAlis varchar(5), @codMdep varchar(5), @codArtFor varchar(25), @codMart varchar(15)) RETURNS TABLE AS\n" +
|
||||
"return\n" +
|
||||
"SELECT *\n" +
|
||||
"FROM (SELECT atb_griglie.cod_alis,\n" +
|
||||
" atb_griglie.cod_mdep,\n" +
|
||||
" atb_griglie.data_validita,\n" +
|
||||
" atb_griglie.note,\n" +
|
||||
" atb_griglie_art.cod_art_for,\n" +
|
||||
" atb_griglie_art.cod_mart,\n" +
|
||||
" atb_griglie_art.tipo_assortimento,\n" +
|
||||
" atb_griglie_art.tipo_variazione,\n" +
|
||||
" ROW_NUMBER() OVER (PARTITION BY atb_griglie.cod_alis,\n" +
|
||||
" atb_griglie.cod_mdep,\n" +
|
||||
" atb_griglie_art.cod_mart,\n" +
|
||||
" atb_griglie_art.cod_art_for ORDER BY atb_griglie.data_validita DESC) AS last_griglia\n" +
|
||||
" FROM atb_griglie\n" +
|
||||
" INNER JOIN atb_griglie_art ON atb_griglie.cod_alis = atb_griglie_art.cod_alis AND\n" +
|
||||
" atb_griglie.cod_mdep = atb_griglie_art.cod_mdep AND\n" +
|
||||
" atb_griglie.data_validita = atb_griglie_art.data_validita\n" +
|
||||
" WHERE atb_griglie.data_validita <= COALESCE(@datavalidita, CAST(GETDATE() AS DATE))\n" +
|
||||
" AND (@codmdep IS NULL OR atb_griglie.cod_mdep = @codmdep)\n" +
|
||||
" AND (@codalis IS NULL OR atb_griglie.cod_alis = @codalis)\n" +
|
||||
" AND (@codartfor IS NULL OR atb_griglie_art.cod_art_for = @codartfor)\n" +
|
||||
" AND (@codmart IS NULL OR atb_griglie_art.cod_mart = @codmart)) t\n" +
|
||||
"WHERE last_griglia = 1\n" +
|
||||
"\n");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251124164630 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("getMaterialiDistinta",
|
||||
"CREATE FUNCTION [dbo].[getMaterialiDistinta](@codProd VARCHAR(15), @explodeSemilavorati BIT)\n" +
|
||||
" RETURNS TABLE\n" +
|
||||
" AS\n" +
|
||||
" RETURN(WITH distinta AS (SELECT cod_prod,\n" +
|
||||
" CONVERT(VARCHAR(15), NULL) AS cod_parent,\n" +
|
||||
" cod_prod AS cod_mart,\n" +
|
||||
" jtb_cicl.descrizione_prod AS descrizione,\n" +
|
||||
" jtb_cicl.descrizione_estesa,\n" +
|
||||
" CONVERT(VARCHAR(3), unt_mis_prod) AS unt_mis_prod,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), rap_conv_prod) AS rap_conv_prod,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), jtb_cicl.qta_prod) AS qta_prod,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), jtb_cicl.qta_prod) AS qta_dist,\n" +
|
||||
" 1 AS livello,\n" +
|
||||
" FORMAT(ROW_NUMBER() OVER ( ORDER BY cod_prod), '00000') AS item_id,\n" +
|
||||
" CONVERT(VARCHAR(15), cod_prod) AS cod_prod_pri,\n" +
|
||||
" CAST(0 AS BIT) AS ricorsione,\n" +
|
||||
" CONVERT(NUMERIC(5, 2), 0) AS perc_sfrido,\n" +
|
||||
" CONVERT(INT, NULL) AS num_fase,\n" +
|
||||
" CONVERT(VARCHAR(1), NULL) AS flag_pri,\n" +
|
||||
" CONVERT(VARCHAR(1024), NULL) AS note,\n" +
|
||||
" CAST(1 AS BIT) AS is_root,\n" +
|
||||
" CAST(0 AS BIT) AS is_foglia\n" +
|
||||
" FROM jtb_cicl\n" +
|
||||
" WHERE (@codProd IS NULL OR cod_prod = @codProd)\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT distinta.cod_prod,\n" +
|
||||
" CONVERT(VARCHAR(15), jtb_dist_mate.cod_prod) AS cod_parent,\n" +
|
||||
" jtb_dist_mate.cod_mart,\n" +
|
||||
" jtb_dist_mate.descrizione,\n" +
|
||||
" jtb_dist_mate.descrizione_estesa,\n" +
|
||||
" CONVERT(VARCHAR(3), jtb_dist_mate.unt_mis_dist) AS unt_mis_prod,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), jtb_dist_mate.rap_conv_dist) AS rap_conv_prod,\n" +
|
||||
" CONVERT(NUMERIC(20, 5),\n" +
|
||||
" ((jtb_dist_mate.qta_std * (1 + jtb_dist_mate.perc_sfrido / 100)) /\n" +
|
||||
" (distinta.qta_prod)) * distinta.qta_prod) AS qta_prod,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), NULL),\n" +
|
||||
" distinta.livello + 1,\n" +
|
||||
" distinta.item_id + '_' +\n" +
|
||||
" FORMAT(\n" +
|
||||
" ROW_NUMBER() OVER ( ORDER BY jtb_dist_mate.flag_pri DESC, jtb_dist_mate.num_fase, id_riga ),\n" +
|
||||
" '00000') AS item_id,\n" +
|
||||
" CONVERT(VARCHAR(15), distinta.cod_mart) AS cod_prod_pri,\n" +
|
||||
" CAST(CASE\n" +
|
||||
" WHEN jtb_dist_mate.cod_mart = jtb_dist_mate.cod_prod THEN 1\n" +
|
||||
" ELSE 0 END AS BIT) AS ricorsione,\n" +
|
||||
" jtb_dist_mate.perc_sfrido,\n" +
|
||||
" jtb_dist_mate.num_fase,\n" +
|
||||
" CONVERT(VARCHAR(1), jtb_dist_mate.flag_pri) AS flag_pri,\n" +
|
||||
" CONVERT(VARCHAR(1024), jtb_dist_mate.note) AS note,\n" +
|
||||
" CAST(0 AS BIT) AS is_root,\n" +
|
||||
" CAST(IIF(jtb_dist_mate.flag_pri = 's', 0, 1) AS BIT) AS is_foglia\n" +
|
||||
" FROM jtb_dist_mate\n" +
|
||||
" INNER JOIN distinta ON jtb_dist_mate.cod_prod = distinta.cod_mart\n" +
|
||||
" INNER JOIN mtb_aart ON mtb_aart.cod_mart = jtb_dist_mate.cod_mart\n" +
|
||||
" WHERE distinta.ricorsione = 0\n" +
|
||||
" AND (distinta.is_root = 1 OR distinta.flag_pri = 'S' OR @explodeSemilavorati = 1))\n" +
|
||||
" SELECT cod_prod,\n" +
|
||||
" cod_parent,\n" +
|
||||
" cod_mart,\n" +
|
||||
" descrizione,\n" +
|
||||
" descrizione_estesa,\n" +
|
||||
" unt_mis_prod,\n" +
|
||||
" rap_conv_prod,\n" +
|
||||
" ISNULL(qta_dist, qta_prod) AS qta_prod,\n" +
|
||||
" livello,\n" +
|
||||
" item_id,\n" +
|
||||
" cod_prod_pri,\n" +
|
||||
" perc_sfrido,\n" +
|
||||
" num_fase,\n" +
|
||||
" DENSE_RANK() OVER ( PARTITION BY cod_prod ORDER BY cod_prod_pri ) - 1 + num_fase AS num_fase_calc,\n" +
|
||||
" flag_pri,\n" +
|
||||
" note,\n" +
|
||||
" is_root,\n" +
|
||||
" is_foglia\n" +
|
||||
" FROM distinta)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,304 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251125093824 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomer(IntegryCustomer.Biolevante)) return;
|
||||
|
||||
createOrUpdateFunction("f_pp_consuntivo_prod_tracc", "CREATE function [dbo].[f_pp_consuntivo_prod_tracc] (@as_codProdParent varchar(15), @as_partitaMagParent varchar(20), @ac_qtaProdParent numeric(20,5), @as_codProd varchar(15), @as_partitaMag varchar(20), @ac_qtaProd numeric(20, 5), @ai_livello integer, @as_item_id varchar(255), @ai_idRiga integer) \n" +
|
||||
"RETURNS @dettCosti TABLE(livello integer, \n" +
|
||||
" item_id varchar(255),\n" +
|
||||
" cod_prod_parent varchar(15),\n" +
|
||||
" partita_mag_parent varchar(20), \n" +
|
||||
" qta_prod_parent numeric(20,5),\n" +
|
||||
" cod_prod varchar(15),\n" +
|
||||
" partita_mag varchar(20), \n" +
|
||||
" qta_prod numeric(20,5),\n" +
|
||||
" gruppo_conto varchar(40), \n" +
|
||||
" conto varchar(40), \n" +
|
||||
" descrizione_conto varchar(255), \n" +
|
||||
" dettaglio_conto varchar(40),\n" +
|
||||
" unt_mis varchar(5), \n" +
|
||||
" qta_consumata numeric(20, 5)) AS\n" +
|
||||
"Begin\n" +
|
||||
" DECLARE \n" +
|
||||
" @lc_qtaProd numeric(20,5), \n" +
|
||||
" @ls_gruppoConto varchar(40), \n" +
|
||||
" @ls_codMart varchar(15), \n" +
|
||||
" @ls_partitaMag varchar(20), \n" +
|
||||
" @ls_descrizione varchar(255), \n" +
|
||||
" @ls_untMis varchar(5), \n" +
|
||||
" @lc_qtaMP numeric(20,5), \n" +
|
||||
" @li_existDist integer, \n" +
|
||||
" @lc_rapporto numeric(20, 5),\n" +
|
||||
" @lc_qtaProdScaricata numeric(20,5),\n" +
|
||||
" @li_livello integer, \n" +
|
||||
" @ls_itemID varchar(255),\n" +
|
||||
" @li_idRiga integer,\n" +
|
||||
" @ls_codMiscela varchar(15),\n" +
|
||||
" @ls_posizione varchar(20),\n" +
|
||||
" @ls_posizione_da varchar(20),\n" +
|
||||
" @ls_posizione_a varchar(20),\n" +
|
||||
" @li_countScarichiLotto integer\n" +
|
||||
"\n" +
|
||||
" SELECT @ls_codMiscela = cod_mart FROM olvw_miscele_olio\n" +
|
||||
"\n" +
|
||||
" if @ai_idRiga is null\n" +
|
||||
" begin\n" +
|
||||
" SELECT @ai_livello = 1\n" +
|
||||
" SELECT @as_item_id = '00001';\n" +
|
||||
" end ;\n" +
|
||||
" IF @as_item_id = '' \n" +
|
||||
" begin\n" +
|
||||
" Select @ls_posizione = mtb_depo_posizioni.posizione from mtb_partita_mag, mtb_depo_posizioni \n" +
|
||||
" where mtb_depo_posizioni.posizione = mtb_partita_mag.posizione and\n" +
|
||||
" mtb_partita_mag.cod_mart = @as_codProdParent and partita_mag = @as_partitaMagParent and\n" +
|
||||
" mtb_depo_posizioni.flag_silos_liquidi = 1;\n" +
|
||||
" If @ls_posizione is not null Select @as_item_id = 'SILOS' --Serve ad identificare le miscele di olio\n" +
|
||||
" end\n" +
|
||||
"\n" +
|
||||
" /* Acquisizione quantita totale prodotta per prodotto-partita */\n" +
|
||||
" Select @lc_qtaProd = ISNULL(sum(dtb_docr.qta_doc * dtb_docr.rap_conv * dtb_tipi.segno_qta_car), 0)\n" +
|
||||
" from dtb_docr, \n" +
|
||||
" dtb_tipi, \n" +
|
||||
" mtb_aart, \n" +
|
||||
" mtb_grup\n" +
|
||||
" where dtb_docr.cod_dtip = dtb_tipi.cod_dtip and\n" +
|
||||
" dtb_docr.cod_mart = mtb_aart.cod_mart and\n" +
|
||||
" mtb_aart.cod_mgrp = mtb_Grup.cod_mgrp and\n" +
|
||||
" dtb_docr.cod_mart = @as_codProd and\n" +
|
||||
" dtb_docr.partita_mag = @as_partitaMag and\n" +
|
||||
" dtb_tipi.gestione = 'L' and\n" +
|
||||
" dtb_tipi.tipo_emissione = 'DIRETTA' and\n" +
|
||||
" dtb_tipi.segno_qta_car <> 0\n" +
|
||||
"\n" +
|
||||
" /* Calcolo del rapporto della qta passata come parametro e di quella totale*/\n" +
|
||||
" if @ac_qtaProd is not null\n" +
|
||||
" if @lc_qtaProd = 0 select @lc_rapporto = 0 else select @lc_rapporto = @ac_qtaProd / @lc_qtaProd\n" +
|
||||
" else\n" +
|
||||
" begin \n" +
|
||||
" select @lc_rapporto = 1\n" +
|
||||
" select @ac_qtaProdParent = @lc_qtaProd\n" +
|
||||
" end\n" +
|
||||
" \n" +
|
||||
" /* Acquisizione totale quantita' prodotta per prododo-partita_mag dagli scarichi\n" +
|
||||
" E' necessario prendere la quantita dalla testata degli scarichi perche' ci \n" +
|
||||
" potrebbero essere delle perdite rispetto alla quantita' caricata.\n" +
|
||||
" N.B. al momento questa variabile viene acquisita solo per controllo in fase di debug\n" +
|
||||
" */\n" +
|
||||
" Select @lc_qtaProdScaricata = sum(dtb_doct.qta_prod*dtb_doct.rap_conv_prod * @lc_rapporto)\n" +
|
||||
" From dtb_doct, \n" +
|
||||
" dtb_tipi\n" +
|
||||
" Where dtb_doct.cod_dtip = dtb_tipi.cod_dtip and\n" +
|
||||
" dtb_tipi.gestione = 'L' and \n" +
|
||||
" dtb_tipi.segno_qta_scar = 1 and\n" +
|
||||
" dtb_doct.cod_prod = @as_codProd and\n" +
|
||||
" ISNULL(dtb_doct.partita_mag, '') = ISNULL(@as_partitaMag, '')\n" +
|
||||
" \n" +
|
||||
"\n" +
|
||||
" /* Acquisizione scarichi per prodotto-partita_mag */\n" +
|
||||
" select @li_idRiga = 0;\n" +
|
||||
" IF @as_codProd = @ls_codMiscela\n" +
|
||||
" begin\n" +
|
||||
" Select @ai_livello = @ai_livello+1\n" +
|
||||
" end\n" +
|
||||
" Declare csr_scarichi Cursor LOCAL SCROLL FOR\n" +
|
||||
" Select PP_gruppiCostiMP.GruppoConto,\n" +
|
||||
" dtb_docr.cod_mart, \n" +
|
||||
" dtb_docr.partita_mag,\n" +
|
||||
" dtb_docr.descrizione_estesa as descrizione,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" sum(dtb_docr.qta_doc*dtb_docr.rap_conv*dtb_tipi.segno_qta_scar*@lc_rapporto) as Qta_mp\n" +
|
||||
" From dtb_doct, \n" +
|
||||
" dtb_docr, \n" +
|
||||
" dtb_tipi, \n" +
|
||||
" mtb_aart, \n" +
|
||||
" mtb_grup, \n" +
|
||||
" PP_gruppiCostiMP\n" +
|
||||
" Where dtb_doct.cod_anag = dtb_docr.cod_anag and\n" +
|
||||
" dtb_doct.cod_dtip = dtb_docr.cod_dtip and\n" +
|
||||
" dtb_doct.data_doc = dtb_docr.data_doc and\n" +
|
||||
" dtb_doct.ser_doc = dtb_docr.ser_doc and\n" +
|
||||
" dtb_doct.num_doc = dtb_docr.num_doc and\n" +
|
||||
" dtb_doct.cod_dtip = dtb_tipi.cod_dtip and\n" +
|
||||
" dtb_tipi.gestione = 'L' and \n" +
|
||||
" dtb_tipi.segno_qta_scar = 1 and\n" +
|
||||
" dtb_docr.cod_mart = mtb_aart.cod_mart and\n" +
|
||||
" mtb_aart.cod_mgrp = mtb_grup.cod_mgrp and\n" +
|
||||
" dtb_docr.cod_mart = PP_gruppiCostiMP.cod_mart and\n" +
|
||||
" dtb_doct.cod_prod = @as_codProd and\n" +
|
||||
" ISNULL(dtb_doct.partita_mag, '') = ISNULL(@as_partitaMag, '')\n" +
|
||||
" and NOT (dtb_docr.cod_mart = @as_codProd and ISNULL(dtb_docr.partita_mag, '') = ISNULL(@as_partitaMag, ''))\n" +
|
||||
" group by PP_gruppiCostiMP.GruppoConto,\n" +
|
||||
" dtb_docr.cod_mart, \n" +
|
||||
" dtb_docr.partita_mag,\n" +
|
||||
" dtb_docr.descrizione_estesa,\n" +
|
||||
" mtb_aart.unt_mis\n" +
|
||||
" union all\n" +
|
||||
" \n" +
|
||||
" Select PP_gruppiCostiMP.GruppoConto,\n" +
|
||||
" car.cod_mart, \n" +
|
||||
" car.partita_mag,\n" +
|
||||
" car.descrizione_estesa as descrizione,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" sum(car.qta_doc*car.rap_conv*dtb_tipi.segno_qta_scar*@lc_rapporto) as Qta_mp \n" +
|
||||
" from dtb_doct inner join dtb_docr on dtb_doct.cod_anag = dtb_docr.cod_anag and\n" +
|
||||
" dtb_doct.cod_dtip = dtb_docr.cod_dtip and\n" +
|
||||
" dtb_doct.data_doc = dtb_docr.data_doc and\n" +
|
||||
" dtb_doct.ser_doc = dtb_docr.ser_doc and\n" +
|
||||
" dtb_doct.num_doc = dtb_docr.num_doc \n" +
|
||||
" inner join dtb_tipi on dtb_doct.cod_dtip = dtb_tipi.cod_dtip \n" +
|
||||
" inner join dtb_docr car on dtb_doct.activity_id = car.activity_id_row \n" +
|
||||
" inner join dtb_tipi tipo_car on car.cod_dtip = tipo_car.cod_dtip\n" +
|
||||
" inner join olvw_caratteristiche on car.cod_mart = olvw_caratteristiche.cod_mart\n" +
|
||||
" inner join PP_gruppiCostiMP on car.cod_mart = PP_gruppiCostiMP.cod_mart\n" +
|
||||
" inner join mtb_aart on car.cod_mart = mtb_aart.cod_mart \n" +
|
||||
" inner join mtb_grup on mtb_aart.cod_mgrp = mtb_grup.cod_mgrp \n" +
|
||||
" where tipo_car.gestione = 'L' and \n" +
|
||||
" tipo_car.segno_qta_car - tipo_car.segno_qta_scar < 0 and \n" +
|
||||
" olvw_caratteristiche.Confezionato = 'S' and \n" +
|
||||
" dtb_tipi.gestione = 'L' and \n" +
|
||||
" dtb_tipi.segno_qta_scar = 1 and\n" +
|
||||
" dtb_doct.cod_prod = @as_codProd and\n" +
|
||||
" ISNULL(dtb_doct.partita_mag, '') = ISNULL(@as_partitaMag, '')\n" +
|
||||
" and NOT (dtb_docr.cod_mart = @as_codProd and ISNULL(dtb_docr.partita_mag, '') = ISNULL(@as_partitaMag, '')) \n" +
|
||||
" group by PP_gruppiCostiMP.GruppoConto,\n" +
|
||||
" car.cod_mart, \n" +
|
||||
" car.partita_mag,\n" +
|
||||
" car.descrizione_estesa,\n" +
|
||||
" mtb_aart.unt_mis\n" +
|
||||
" Order by PP_gruppiCostiMP.GruppoConto desc \n" +
|
||||
" \n" +
|
||||
" OPEN csr_scarichi\n" +
|
||||
" FETCH NEXT FROM csr_scarichi INTO @ls_gruppoConto, @ls_codMart, @ls_partitaMag, @ls_descrizione, @ls_untMis, @lc_qtaMP\n" +
|
||||
" WHILE @@FETCH_STATUS = 0\n" +
|
||||
" begin\n" +
|
||||
" IF ABS(@lc_qtaMP) > 0.01\n" +
|
||||
" Begin\n" +
|
||||
" select @li_idRiga = @li_idRiga + 1;\n" +
|
||||
" SELECT @ls_itemID = @as_item_id + '_' + REPLICATE('0', 5 - len(CONVERT(varchar(15), @li_idRiga))) + CONVERT(varchar(15), @li_idRiga); \n" +
|
||||
"\n" +
|
||||
" /* verifica esistenza scarico, Indica che siamo in presenza di un semilavorato/lotto */\n" +
|
||||
" select @li_existDist = count(*)\n" +
|
||||
" from dtb_doct, dtb_tipi\n" +
|
||||
" where dtb_doct.cod_prod = @ls_codMart and partita_mag = @ls_partitaMag and \n" +
|
||||
" dtb_doct.cod_dtip = dtb_tipi.cod_dtip and\n" +
|
||||
" dtb_tipi.segno_qta_scar = 1 and \n" +
|
||||
" dtb_doct.gestione = 'L'\n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
" /* Materia prima */\n" +
|
||||
" if @li_existDist = 0 or @@NESTLEVEL >= 30\n" +
|
||||
" begin\n" +
|
||||
" insert into @dettCosti \n" +
|
||||
" select @ai_livello,\n" +
|
||||
" @ls_itemID,\n" +
|
||||
" @as_codProdParent, \n" +
|
||||
" @as_partitaMagParent, \n" +
|
||||
" @ac_qtaProdParent, \n" +
|
||||
" @as_codProd, \n" +
|
||||
" @as_partitaMag, \n" +
|
||||
" @lc_qtaProdScaricata, \n" +
|
||||
" @ls_gruppoConto, \n" +
|
||||
" @ls_codMart, \n" +
|
||||
" @ls_descrizione, \n" +
|
||||
" @ls_partitaMag, \n" +
|
||||
" @ls_untMis, \n" +
|
||||
" @lc_qtaMP\n" +
|
||||
" end\n" +
|
||||
" else\n" +
|
||||
" Begin\n" +
|
||||
" /* Semilavorato */\n" +
|
||||
" \n" +
|
||||
" Select @ls_posizione_a = mtb_depo_posizioni.posizione \n" +
|
||||
" from mtb_partita_mag, mtb_depo_posizioni \n" +
|
||||
" where mtb_depo_posizioni.posizione = mtb_partita_mag.posizione and\n" +
|
||||
" mtb_partita_mag.cod_mart = @as_codProd and partita_mag = @as_partitaMag and\n" +
|
||||
" mtb_depo_posizioni.flag_silos_liquidi = 1;\n" +
|
||||
" Select @ls_posizione_da = mtb_depo_posizioni.posizione \n" +
|
||||
" from mtb_partita_mag, mtb_depo_posizioni \n" +
|
||||
" where mtb_depo_posizioni.posizione = mtb_partita_mag.posizione and\n" +
|
||||
" mtb_partita_mag.cod_mart = @as_codProd and partita_mag = @as_partitaMag and\n" +
|
||||
" mtb_depo_posizioni.flag_silos_liquidi = 1;\n" +
|
||||
" \n" +
|
||||
" --24/11/25 (Massimo) Segue query per verificare se siamo su un lotto di olio che è stato scaricato e non azzerato. In tal caso la ricorsione non deve avvenire\n" +
|
||||
" select @li_countScarichiLotto = count(*)\n" +
|
||||
" from dtb_docr inner join dtb_tipi on dtb_docr.cod_dtip = dtb_tipi.cod_dtip \n" +
|
||||
" where dtb_tipi.segno_qta_scar = 1\n" +
|
||||
" and dtb_docr.cod_mart = @ls_codMart and dtb_docr.partita_mag = @ls_partitaMag\n" +
|
||||
" and @ls_posizione_da = @ls_posizione_a\n" +
|
||||
"\n" +
|
||||
" If @ls_posizione_da is not null and \n" +
|
||||
" (ISNULL(@ls_posizione_da,'') <> ISNULL(@ls_posizione_a,00) or \n" +
|
||||
" @ls_posizione_da is null or @ls_posizione_a is null or \n" +
|
||||
" (@ai_livello <1 and @as_codProd = @ls_codMiscela) or \n" +
|
||||
" (ISNULL(@ls_posizione_da,'') = ISNULL(@ls_posizione_a,00) and @as_codProd= @ls_codMiscela) or\n" +
|
||||
" IsNull(@li_countScarichiLotto,1) > 1)\n" +
|
||||
" --Questa insert serve per trattare l'olio che proviene da altro serbatoio come una materia prima a partire dal 2° livello di ricorsione\n" +
|
||||
" --dal 24/11/25 vale anche per olio proveniente dallo stesso serbatoio ma già scaricato parzialmente prima del carico del lotto parent\n" +
|
||||
" Begin\n" +
|
||||
" insert into @dettCosti \n" +
|
||||
" select @ai_livello,\n" +
|
||||
" @ls_itemID,\n" +
|
||||
" @as_codProdParent, \n" +
|
||||
" @as_partitaMagParent, \n" +
|
||||
" @ac_qtaProdParent, \n" +
|
||||
" @as_codProd, \n" +
|
||||
" @as_partitaMag, \n" +
|
||||
" @lc_qtaProdScaricata, \n" +
|
||||
" @ls_gruppoConto, \n" +
|
||||
" @ls_codMart, \n" +
|
||||
" @ls_descrizione, \n" +
|
||||
" @ls_partitaMag, \n" +
|
||||
" @ls_untMis, \n" +
|
||||
" @lc_qtaMP;\n" +
|
||||
" End\n" +
|
||||
" \n" +
|
||||
" /*Ricorsione su semilavorato-partita_mag*/\n" +
|
||||
" If IsNull(@li_countScarichiLotto,1) = 1 and --Aggiunta 24/11/25 da Massimo per escludere ricorsione su olio proveniente dallo stesso serbatoio ma già scaricato parzialmente prima del carico del lotto parent\n" +
|
||||
" ISNULL(@ls_posizione_da,'') = ISNULL(@ls_posizione_a,00) and @as_codProd <> @ls_codMiscela or \n" +
|
||||
" @ls_posizione_da is null or @ls_posizione_a is null or \n" +
|
||||
" (@ai_livello <1 and @as_codProd = @ls_codMiscela)\n" +
|
||||
" --La ricorsione non avviene sugli olii provenienti da altro serbatoio e neanche nel caso di Miscele fittizie create nello stesso serbatoio dell'olio di provenienza in assenza di polmone\n" +
|
||||
" insert into @dettCosti \n" +
|
||||
" select costi.livello, \n" +
|
||||
" costi.item_id,\n" +
|
||||
" @as_codProdParent, \n" +
|
||||
" @as_partitaMagParent,\n" +
|
||||
" @ac_qtaProdParent,\n" +
|
||||
" costi.cod_prod, \n" +
|
||||
" costi.partita_mag, \n" +
|
||||
" costi.qta_prod,\n" +
|
||||
" costi.gruppo_conto, \n" +
|
||||
" costi.conto, \n" +
|
||||
" costi.descrizione_conto, \n" +
|
||||
" costi.dettaglio_conto,\n" +
|
||||
" costi.unt_mis, \n" +
|
||||
" costi.qta_consumata \n" +
|
||||
" from dbo.f_pp_consuntivo_prod_tracc(@as_codProdParent, @as_partitaMagParent, @ac_qtaProdParent, @ls_codMart, @ls_partitaMag, @lc_qtaMP, @ai_livello, @ls_itemID, @li_idRiga) costi\n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
" end\n" +
|
||||
" end\n" +
|
||||
" FETCH NEXT FROM csr_scarichi INTO @ls_gruppoConto, @ls_codMart, @ls_partitaMag, @ls_descrizione, @ls_untMis, @lc_qtaMP\n" +
|
||||
" end\n" +
|
||||
" close csr_scarichi\n" +
|
||||
" deallocate csr_scarichi\n" +
|
||||
" return\n" +
|
||||
"END");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251125095325 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("getMaterialiDistinta",
|
||||
"CREATE FUNCTION [dbo].[getMaterialiDistinta](@codProd VARCHAR(15), @explodeSemilavorati BIT)\n" +
|
||||
" RETURNS TABLE\n" +
|
||||
" AS\n" +
|
||||
" RETURN(WITH distinta AS (SELECT cod_prod,\n" +
|
||||
" CONVERT(VARCHAR(15), NULL) AS cod_parent,\n" +
|
||||
" cod_prod AS cod_mart,\n" +
|
||||
" jtb_cicl.descrizione_prod AS descrizione,\n" +
|
||||
" jtb_cicl.descrizione_estesa,\n" +
|
||||
" CONVERT(VARCHAR(3), unt_mis_prod) AS unt_mis_prod,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), rap_conv_prod) AS rap_conv_prod,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), jtb_cicl.qta_prod) AS qta_prod,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), jtb_cicl.qta_prod) AS qta_dist,\n" +
|
||||
" 1 AS livello,\n" +
|
||||
" FORMAT(ROW_NUMBER() OVER ( ORDER BY cod_prod), '00000') AS item_id,\n" +
|
||||
" CONVERT(VARCHAR(15), cod_prod) AS cod_prod_pri,\n" +
|
||||
" CAST(0 AS BIT) AS ricorsione,\n" +
|
||||
" CONVERT(NUMERIC(5, 2), 0) AS perc_sfrido,\n" +
|
||||
" CONVERT(INT, NULL) AS num_fase,\n" +
|
||||
" CONVERT(VARCHAR(1), NULL) AS flag_pri,\n" +
|
||||
" CONVERT(VARCHAR(1024), NULL) AS note,\n" +
|
||||
" CAST(1 AS BIT) AS is_root,\n" +
|
||||
" CAST(0 AS BIT) AS is_foglia\n" +
|
||||
" FROM jtb_cicl\n" +
|
||||
" WHERE (@codProd IS NULL OR cod_prod = @codProd)\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT distinta.cod_prod,\n" +
|
||||
" CONVERT(VARCHAR(15), jtb_dist_mate.cod_prod) AS cod_parent,\n" +
|
||||
" jtb_dist_mate.cod_mart,\n" +
|
||||
" jtb_dist_mate.descrizione,\n" +
|
||||
" jtb_dist_mate.descrizione_estesa,\n" +
|
||||
" CONVERT(VARCHAR(3), jtb_dist_mate.unt_mis_dist) AS unt_mis_prod,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), jtb_dist_mate.rap_conv_dist) AS rap_conv_prod,\n" +
|
||||
" CONVERT(NUMERIC(20, 5),\n" +
|
||||
" ((jtb_dist_mate.qta_std * (1 + jtb_dist_mate.perc_sfrido / 100)) /\n" +
|
||||
" (jtb_cicl.qta_prod)) * distinta.qta_prod) AS qta_prod,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), NULL),\n" +
|
||||
" distinta.livello + 1,\n" +
|
||||
" distinta.item_id + '_' +\n" +
|
||||
" FORMAT(\n" +
|
||||
" ROW_NUMBER() OVER ( ORDER BY jtb_dist_mate.flag_pri DESC, jtb_dist_mate.num_fase, id_riga ),\n" +
|
||||
" '00000') AS item_id,\n" +
|
||||
" CONVERT(VARCHAR(15), distinta.cod_mart) AS cod_prod_pri,\n" +
|
||||
" CAST(CASE\n" +
|
||||
" WHEN jtb_dist_mate.cod_mart = jtb_dist_mate.cod_prod THEN 1\n" +
|
||||
" ELSE 0 END AS BIT) AS ricorsione,\n" +
|
||||
" jtb_dist_mate.perc_sfrido,\n" +
|
||||
" jtb_dist_mate.num_fase,\n" +
|
||||
" CONVERT(VARCHAR(1), jtb_dist_mate.flag_pri) AS flag_pri,\n" +
|
||||
" CONVERT(VARCHAR(1024), jtb_dist_mate.note) AS note,\n" +
|
||||
" CAST(0 AS BIT) AS is_root,\n" +
|
||||
" CAST(IIF(jtb_dist_mate.flag_pri = 's', 0, 1) AS BIT) AS is_foglia\n" +
|
||||
" FROM jtb_dist_mate\n" +
|
||||
" INNER JOIN distinta ON jtb_dist_mate.cod_prod = distinta.cod_mart\n" +
|
||||
" INNER JOIN jtb_cicl\n" +
|
||||
" ON jtb_dist_mate.cod_prod = jtb_cicl.cod_prod\n" +
|
||||
" INNER JOIN mtb_aart ON mtb_aart.cod_mart = jtb_dist_mate.cod_mart\n" +
|
||||
" WHERE distinta.ricorsione = 0\n" +
|
||||
" AND (distinta.is_root = 1 OR distinta.flag_pri = 'S' OR @explodeSemilavorati = 1))\n" +
|
||||
" SELECT cod_prod,\n" +
|
||||
" cod_parent,\n" +
|
||||
" cod_mart,\n" +
|
||||
" descrizione,\n" +
|
||||
" descrizione_estesa,\n" +
|
||||
" unt_mis_prod,\n" +
|
||||
" rap_conv_prod,\n" +
|
||||
" ISNULL(qta_dist, qta_prod) AS qta_prod,\n" +
|
||||
" livello,\n" +
|
||||
" item_id,\n" +
|
||||
" cod_prod_pri,\n" +
|
||||
" perc_sfrido,\n" +
|
||||
" num_fase,\n" +
|
||||
" DENSE_RANK() OVER ( PARTITION BY cod_prod ORDER BY cod_prod_pri ) - 1 + num_fase AS num_fase_calc,\n" +
|
||||
" flag_pri,\n" +
|
||||
" note,\n" +
|
||||
" is_root,\n" +
|
||||
" is_foglia\n" +
|
||||
" FROM distinta)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251125100117 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("create table dbo.mtb_livelli_anomalie\n" +
|
||||
"(\n" +
|
||||
" id bigint identity\n" +
|
||||
" constraint pk_mtb_livelli_anomalie\n" +
|
||||
" primary key,\n" +
|
||||
" descrizione varchar(255) not null,\n" +
|
||||
" hex_colore varchar(20) default '#ffffff',\n" +
|
||||
" escludi_picking_vendita bit default 0 not null,\n" +
|
||||
" escludi_picking_lavorazione bit default 0 not null\n" +
|
||||
")");
|
||||
|
||||
executeStatement("create table dbo.mtb_anomalie_ul\n" +
|
||||
"(\n" +
|
||||
" id bigint identity\n" +
|
||||
" constraint pk_mtb_anomalie_ul\n" +
|
||||
" primary key,\n" +
|
||||
" descrizione varchar(200) not null,\n" +
|
||||
" annotazioni varchar(400),\n" +
|
||||
" inizio_anomalia datetime,\n" +
|
||||
" fine_anomalia datetime,\n" +
|
||||
" id_livello_anomalia bigint not null\n" +
|
||||
" constraint mtb_anomalie_ul_mtb_livelli_anomalie_id_fk\n" +
|
||||
" references dbo.mtb_livelli_anomalie,\n" +
|
||||
" cod_jfas varchar(5)\n" +
|
||||
" constraint mtb_anomalie_ul_jtb_fasi_cod_jfas_fk\n" +
|
||||
" references dbo.jtb_fasi\n" +
|
||||
")");
|
||||
|
||||
executeStatement("alter table dbo.mtb_colt\n" +
|
||||
" add id_anomalia bigint\n" +
|
||||
" constraint mtb_colt_mtb_anomalie_ul_id_fk\n" +
|
||||
" references dbo.mtb_anomalie_ul (id)");
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.RossoGargano_RossoGargano)) {
|
||||
executeInsertStatement("INSERT INTO mtb_livelli_anomalie (descrizione, hex_colore, escludi_picking_vendita, escludi_picking_lavorazione) VALUES (N'Prodotto non conforme', N'#FF0000', 1, 1)");
|
||||
executeInsertStatement("INSERT INTO mtb_livelli_anomalie (descrizione, hex_colore, escludi_picking_vendita, escludi_picking_lavorazione) VALUES (N'Prodotto uscito con alte temperature', N'#E36C0A', 1, 0)");
|
||||
executeInsertStatement("INSERT INTO mtb_livelli_anomalie (descrizione, hex_colore, escludi_picking_vendita, escludi_picking_lavorazione) VALUES (N'Pedana in osservazione', N'#FFC000', 1, 0)");
|
||||
executeInsertStatement("INSERT INTO mtb_livelli_anomalie (descrizione, hex_colore, escludi_picking_vendita, escludi_picking_lavorazione) VALUES (N'Barattoli con difetto di marcatura', N'#00B050', 0, 0)");
|
||||
executeInsertStatement("INSERT INTO mtb_livelli_anomalie (descrizione, hex_colore, escludi_picking_vendita, escludi_picking_lavorazione) VALUES (N'Barattoli difettati', N'#00B0F0', 0, 1)");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251125105713 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateProcedure("MRP_UpdateQtaImpProx", "CREATE Procedure [dbo].[MRP_UpdateQtaImpProx](@elencoArticoli varchar(max) = null)\n" +
|
||||
"AS \n" +
|
||||
"--DECLARE @elencoarticoli VARCHAR(MAX) --= 'CEB1TREORI6|CEB1LMS5|CEBB1MRCH2|CVINACBO1LEV2'\n" +
|
||||
"--DROP TABLE #tmp\n" +
|
||||
"\n" +
|
||||
"SET NOCOUNT ON;\n" +
|
||||
"DECLARE @tableart TABLE\n" +
|
||||
" (\n" +
|
||||
" cod_mart VARCHAR(15)\n" +
|
||||
" );\n" +
|
||||
"\n" +
|
||||
"IF @elencoarticoli IS NOT NULL AND @elencoarticoli <> ''\n" +
|
||||
" BEGIN\n" +
|
||||
" INSERT INTO @tableart\n" +
|
||||
" SELECT *\n" +
|
||||
" FROM dbo.parsestringintoarray(@elencoarticoli, '|')\n" +
|
||||
" END\n" +
|
||||
"ELSE\n" +
|
||||
" BEGIN\n" +
|
||||
" INSERT INTO @tableart\n" +
|
||||
" SELECT mtb_aart.cod_mart\n" +
|
||||
" FROM mtb_aart\n" +
|
||||
" INNER JOIN jtb_cicl ON mtb_aart.cod_mart = jtb_cicl.cod_mart\n" +
|
||||
" WHERE mtb_aart.flag_stato = 'A'\n" +
|
||||
" END;\n" +
|
||||
"\n" +
|
||||
"WITH imp_ordini AS (SELECT mtb_part.cod_mart,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN SUM(mtb_part.qta_imp_cli) > SUM(iif(mtb_part.qta_esistente<0,0,mtb_part.qta_esistente) + mtb_part.qta_ord_for) THEN\n" +
|
||||
" SUM(mtb_part.qta_imp_cli - (iif(mtb_part.qta_esistente<0,0,mtb_part.qta_esistente) + mtb_part.qta_ord_for))\n" +
|
||||
" ELSE 0 END AS qtadaprodurre,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN SUM(mtb_part.qta_imp_cli) > SUM(iif(mtb_part.qta_esistente<0,0,mtb_part.qta_esistente) + mtb_part.qta_ord_for) THEN\n" +
|
||||
" SUM(mtb_part.qta_imp_cli - (iif(mtb_part.qta_esistente<0,0,mtb_part.qta_esistente) + mtb_part.qta_ord_for)) /\n" +
|
||||
" mtb_aart.qta_cnf\n" +
|
||||
" ELSE 0 END AS numdaprodurre,\n" +
|
||||
" SUM((iif(mtb_part.qta_esistente<0,0,mtb_part.qta_esistente) + mtb_part.qta_ord_for) - mtb_part.qta_imp_cli) AS qta_disp\n" +
|
||||
" \n" +
|
||||
" FROM mtb_part\n" +
|
||||
" INNER JOIN jtb_cicl ON mtb_part.cod_mart = jtb_cicl.cod_prod\n" +
|
||||
" INNER JOIN mtb_aart ON mtb_part.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" INNER JOIN @tableart a ON mtb_aart.cod_mart = a.cod_mart\n" +
|
||||
" WHERE mtb_aart.flag_stato = 'A'\n" +
|
||||
" GROUP BY mtb_part.cod_mart, mtb_aart.unt_mis, mtb_aart.qta_cnf\n" +
|
||||
" HAVING SUM(iif(mtb_part.qta_esistente<0,0,mtb_part.qta_esistente) + mtb_part.qta_ord_for) <> SUM(mtb_part.qta_imp_cli) )\n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
" , imp_contratti AS ( SELECT c.cod_mart,\n" +
|
||||
" ISNULL(SUM((qta_vend_contratto - qta_ord - qta_doc) /\n" +
|
||||
" CASE WHEN c.rap_conv = 0 THEN 1 ELSE c.rap_conv END), 0) AS qtacontratto\n" +
|
||||
" FROM vvw_contratti_vendita c\n" +
|
||||
" INNER JOIN @tableart a ON c.cod_mart = a.cod_mart\n" +
|
||||
" WHERE c.data_fine >= CAST(GETDATE() AS DATE)\n" +
|
||||
" GROUP BY c.cod_mart\n" +
|
||||
" HAVING ISNULL(SUM(qta_residua), 0) > 0)\n" +
|
||||
" , imp_budget AS (SELECT b.cod_mart,\n" +
|
||||
" SUM(qta_saldo) AS qta_bdg\n" +
|
||||
" FROM ovw_budget_ordv b\n" +
|
||||
" INNER JOIN @tableart a ON b.cod_mart = a.cod_mart\n" +
|
||||
" WHERE CAST(GETDATE() AS DATE) BETWEEN b.data_iniz AND b.data_fine\n" +
|
||||
" AND qta_saldo <> 0\n" +
|
||||
" GROUP BY b.cod_mart)\n" +
|
||||
" , tmp_impegni\n" +
|
||||
" AS (SELECT ISNULL(ISNULL(imp_ordini.cod_mart, imp_contratti.cod_mart), imp_budget.cod_mart) AS cod_mart,\n" +
|
||||
" SUM(ISNULL(imp_ordini.qtadaprodurre, 0)) AS qtadaprodurre,\n" +
|
||||
" SUM(ISNULL(imp_ordini.numdaprodurre, 0)) AS numdaprodurre,\n" +
|
||||
" SUM(ISNULL(imp_contratti.qtacontratto,0)) AS qtacontratto ,\n" +
|
||||
" SUM(ISNULL(imp_budget.qta_bdg, 0)) AS qtabudget\n" +
|
||||
" \n" +
|
||||
" FROM imp_ordini\n" +
|
||||
" FULL OUTER JOIN imp_contratti ON imp_ordini.cod_mart = imp_contratti.cod_mart\n" +
|
||||
" FULL OUTER JOIN imp_budget ON imp_ordini.cod_mart = imp_budget.cod_mart\n" +
|
||||
" \n" +
|
||||
" GROUP BY ISNULL(ISNULL(imp_ordini.cod_mart, imp_contratti.cod_mart), imp_budget.cod_mart)\n" +
|
||||
" HAVING SUM(ISNULL(imp_ordini.qtadaprodurre, 0)) <> 0\n" +
|
||||
" OR SUM(ISNULL(imp_contratti.qtacontratto,0)) <> 0\n" +
|
||||
" OR SUM(ISNULL(imp_budget.qta_bdg, 0)) <> 0)\n" +
|
||||
"\n" +
|
||||
"SELECT materiali.cod_mart,\n" +
|
||||
" materiali.cod_prod,\n" +
|
||||
" jtb_fasi.cod_mdep_lav AS cod_mdep,\n" +
|
||||
" SUM(qtadaprodurre * (materiali.qta_prod * materiali.rap_conv) /\n" +
|
||||
" (jtb_cicl.qta_prod * jtb_cicl.rap_conv_prod)) AS impegnatoprox,\n" +
|
||||
" SUM(qtacontratto * (materiali.qta_prod * materiali.rap_conv) /\n" +
|
||||
" (jtb_cicl.qta_prod * jtb_cicl.rap_conv_prod)) AS impproxcontratto,\n" +
|
||||
" SUM(qtabudget * (materiali.qta_prod * materiali.rap_conv) /\n" +
|
||||
" (jtb_cicl.qta_prod * jtb_cicl.rap_conv_prod)) AS impproxbudget,\n" +
|
||||
" /*\n" +
|
||||
" max(case when ord.gestione = 'L' THEN max_data_cons else null end ) as data_imp_prox,\n" +
|
||||
" max(case when ord.gestione = 'A' THEN max_data_cons else null end ) as data_imp_prox_contr\n" +
|
||||
" */\n" +
|
||||
" IsNull(max(ORD.data_imp_prox), convert(date,GetDate())) as data_imp_prox,\n" +
|
||||
" IsNull(max(ORD.data_imp_prox_contr), convert(date,GetDate())) as data_imp_prox_contr\n" +
|
||||
"INTO #tmp\n" +
|
||||
"FROM tmp_impegni\n" +
|
||||
" INNER JOIN\n" +
|
||||
" (\n" +
|
||||
" SELECT cod_mart, descrizione_estesa, unt_mis_prod AS unt_doc, rap_conv_prod AS rap_conv, qta_prod, cod_prod\n" +
|
||||
" FROM [dbo].getmaterialidistinta(NULL, 1)\n" +
|
||||
" WHERE cod_parent IS NOT NULL) materiali ON materiali.cod_prod = tmp_impegni.cod_mart\n" +
|
||||
" INNER JOIN jtb_cicl ON materiali.cod_prod = jtb_cicl.cod_prod\n" +
|
||||
" INNER JOIN jtb_fasi ON jtb_cicl.cod_jfas = jtb_fasi.cod_jfas \n" +
|
||||
" LEFT OUTER JOIN (\n" +
|
||||
" /* Modifcata da Massimo 10/07/24 la vecchia query creva quantità doppie in presenza di ordini L e A\n" +
|
||||
" select cod_mart, dtb_ordt.gestione, MAX(dtb_ordr.data_cons) as max_data_cons\n" +
|
||||
" from dtb_ordt inner join dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione\n" +
|
||||
" and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||
" and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||
" where dtb_ordt.gestione <> 'V' AND\n" +
|
||||
" dtb_ordt.flag_annulla = 'N' and\n" +
|
||||
" dtb_ordt.flag_budget = 0 and\n" +
|
||||
" dtb_ordt.flag_sospeso = 'N' and\n" +
|
||||
" dtb_ordt.flag_evaso_forzato = 'N' and \n" +
|
||||
" dtb_ordr.flag_evaso = 'I' \n" +
|
||||
" group by cod_mart, dtb_ordt.gestione\n" +
|
||||
" */\n" +
|
||||
" Select isNull(ODL.cod_mart,ODA.cod_mart) as cod_mart, ODL.data_imp_prox, ODA.data_imp_prox_contr\n" +
|
||||
" from \n" +
|
||||
" (select cod_mart, dtb_ordt.gestione, MAX(dtb_ordr.data_cons) as data_imp_prox\n" +
|
||||
" from dtb_ordt inner join dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione\n" +
|
||||
" and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||
" and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||
" where dtb_ordt.gestione = 'L' AND\n" +
|
||||
" dtb_ordt.flag_annulla = 'N' and\n" +
|
||||
" dtb_ordt.flag_budget = 0 and\n" +
|
||||
" dtb_ordt.flag_sospeso = 'N' and\n" +
|
||||
" dtb_ordt.flag_evaso_forzato = 'N' and \n" +
|
||||
" dtb_ordt.flag_evaso_prod = 'I' and\n" +
|
||||
" dtb_ordr.flag_evaso = 'I' \n" +
|
||||
" group by cod_mart, dtb_ordt.gestione\n" +
|
||||
" )ODL full outer join\n" +
|
||||
" (\n" +
|
||||
" select cod_mart, dtb_ordt.gestione, MAX(dtb_ordr.data_cons) as data_imp_prox_contr\n" +
|
||||
" from dtb_ordt inner join dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione\n" +
|
||||
" and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||
" and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||
" where dtb_ordt.gestione = 'A' AND\n" +
|
||||
" dtb_ordt.flag_annulla = 'N' and\n" +
|
||||
" dtb_ordt.flag_budget = 0 and\n" +
|
||||
" dtb_ordt.flag_sospeso = 'N' and\n" +
|
||||
" dtb_ordt.flag_evaso_forzato = 'N' and \n" +
|
||||
" dtb_ordr.flag_evaso = 'I' \n" +
|
||||
" \n" +
|
||||
" group by cod_mart, dtb_ordt.gestione)\n" +
|
||||
" ODA on ODA.cod_mart = ODL.cod_mart\n" +
|
||||
" ) ORD ON materiali.cod_mart = ORD.cod_mart\n" +
|
||||
"GROUP BY materiali.cod_prod,\n" +
|
||||
" materiali.cod_mart,\n" +
|
||||
" jtb_fasi.cod_mdep_lav\n" +
|
||||
" \n" +
|
||||
"SELECT cod_mart,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" SUM(impegnatoprox) AS impegnatoprox,\n" +
|
||||
" SUM(impproxcontratto) AS impproxcontratto,\n" +
|
||||
" SUM(impproxbudget) AS impproxbudget,\n" +
|
||||
" case when data_imp_prox < convert(date, GetDate()) then convert(date, getDate()) else data_imp_prox end data_imp_prox,\n" +
|
||||
" case when data_imp_prox_contr < case when data_imp_prox < convert(date, GetDate()) then convert(date, getDate()) else data_imp_prox end \n" +
|
||||
" then case when data_imp_prox < convert(date, GetDate()) then convert(date, getDate()) else data_imp_prox end \n" +
|
||||
" else data_imp_prox_contr end as data_imp_prox_contr\n" +
|
||||
" --case when data_imp_prox_contr is null then isNull(data_imp_prox,convert(date,GetDate())) else data_imp_prox_contr end as data_imp_prox_contr\n" +
|
||||
" --IIF( data_imp_prox is null or data_imp_prox < Cast(getdate() as date), Cast(getdate() as date), data_imp_prox) as data_imp_prox,\n" +
|
||||
" --IIF( data_imp_prox_contr is null or isNull(data_imp_prox_contr,data_imp_prox) < Cast(getdate() as date), Cast(getdate() as date), data_imp_prox_contr) as data_imp_prox_contr \n" +
|
||||
"INTO #tmpsum\n" +
|
||||
"FROM #tmp\n" +
|
||||
"WHERE cod_mdep IS NOT NULL\n" +
|
||||
"GROUP BY cod_mart, cod_mdep,\n" +
|
||||
" data_imp_prox,\n" +
|
||||
" data_imp_prox_contr\n" +
|
||||
"\n" +
|
||||
"INSERT INTO mtb_part (cod_mart, cod_mdep, scorta_min, qta_esistente, qta_imp_cli, qta_imp_lav, qta_ord_for)\n" +
|
||||
"SELECT cod_mart, cod_mdep, 0, 0, 0, 0, 0\n" +
|
||||
"FROM #tmpsum t\n" +
|
||||
"WHERE NOT EXISTS(SELECT * FROM mtb_part WHERE mtb_part.cod_mart = t.cod_mart AND mtb_part.cod_mdep = t.cod_mdep)\n" +
|
||||
"\n" +
|
||||
"IF @elencoarticoli IS NULL OR @elencoarticoli = ''\n" +
|
||||
" UPDATE mtb_part SET qta_imp_prox = 0, qta_imp_prox_contr = 0, qta_imp_prox_bdg = 0, data_imp_prox = null, data_imp_prox_contr = null\n" +
|
||||
"ELSE\n" +
|
||||
" UPDATE mtb_part\n" +
|
||||
" SET qta_imp_prox = 0,\n" +
|
||||
" qta_imp_prox_contr = 0,\n" +
|
||||
" qta_imp_prox_bdg = 0,\n" +
|
||||
" data_imp_prox = null, \n" +
|
||||
" data_imp_prox_contr = null \n" +
|
||||
" WHERE cod_mart IN (SELECT cod_mart FROM #tmpsum)\n" +
|
||||
"\n" +
|
||||
"UPDATE mtb_part\n" +
|
||||
"SET qta_imp_prox = q.impegnatoprox,\n" +
|
||||
" qta_imp_prox_contr = q.impproxcontratto,\n" +
|
||||
" qta_imp_prox_bdg = q.impproxbudget,\n" +
|
||||
" data_imp_prox = DateAdd(day, 1, q.data_imp_prox), \n" +
|
||||
" data_imp_prox_contr = DateAdd(day, 1, q.data_imp_prox_contr )\n" +
|
||||
"FROM mtb_part\n" +
|
||||
" INNER JOIN #tmpsum q ON mtb_part.cod_mdep = q.cod_mdep AND mtb_part.cod_mart = q.cod_mart\n" +
|
||||
"\n" +
|
||||
"IF EXISTS(SELECT *\n" +
|
||||
" FROM #tmp\n" +
|
||||
" WHERE cod_mdep IS NULL)\n" +
|
||||
" BEGIN\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" DECLARE @message VARCHAR(MAX), @email VARCHAR(MAX)\n" +
|
||||
"\n" +
|
||||
" SELECT @email = e_mail FROM stb_email WHERE flag_default = 'S';\n" +
|
||||
"\n" +
|
||||
" SET @message = 'Verificare i seguenti articoli: la fase non ha il deposito agganciato.' + CHAR(10) + CHAR(13)\n" +
|
||||
" SELECT @message = @message +\n" +
|
||||
" STUFF((SELECT ',' + cod_prod\n" +
|
||||
" FROM #tmp\n" +
|
||||
" WHERE cod_mdep IS NULL\n" +
|
||||
" FOR XML PATH('')), 1, 1, '')\n" +
|
||||
"\n" +
|
||||
" EXECUTE [dbo].[sp_sendEmail] @email, 'helpdesk@integry.it', 'Errore Impegni Prossimi', @message\n" +
|
||||
"\n" +
|
||||
" END");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251125113907 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if(isCustomer(IntegryCustomer.Carelli)) {
|
||||
updateSetupValue("W_DDOCU_ORD_RC", "SITUAZONE_CLIENTE", "SHOW_DIALOG", "N",
|
||||
"Attiva Situazione cliente", false, "SI_NO", false, false, false,
|
||||
false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251126113917 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomer(IntegryCustomer.Sardinya)) {
|
||||
|
||||
createSetup("EXPORT_DOCUMENTI DI VENDITA", "MD", "ATTIVO", "N",
|
||||
"Inserire S/N per attivare/disattivare il tipo di importazione", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("EXPORT_DOCUMENTI DI VENDITA", "MD", "EMAIL_FOR_LOG", null,
|
||||
"Inserire il file l'indirizzo email per inviare il log dell'importazione", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("EXPORT_DOCUMENTI DI VENDITA", "MD", "GG_CANC_FILE", null,
|
||||
"Giorni per la cancellazione dei file dalla cartella di appoggio", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("EXPORT_DOCUMENTI DI VENDITA", "MD", "IMPORT_REST", "S",
|
||||
"Inserire S/N per attivare/disattivare il salvataggio con i servizi REST", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("EXPORT_DOCUMENTI DI VENDITA", "MD", "PATH_FILE", null,
|
||||
"Directory dove vengono salvati i file temporanei, se non è configurata i file saranno salvati in c:\\mlSetupWS\\TEMP_EXPORT", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
}
|
||||
updateSetupValue("EXPORT_DOCUMENTI DI VENDITA", "MD", "ATTIVO", "S",
|
||||
"Inserire S/N per attivare/disattivare il tipo di importazione", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251126115627 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact))
|
||||
return;
|
||||
|
||||
boolean existIndex = existIndex("wtb_depo", "ux_wtb_depo_depo_default_utente");
|
||||
|
||||
if(existIndex)
|
||||
dropIndex("wtb_depo", "ux_wtb_depo_depo_default_utente");
|
||||
|
||||
executeStatement("ALTER TABLE dbo.wtb_depo\n" +
|
||||
" ALTER COLUMN user_name VARCHAR(40) NOT NULL",
|
||||
|
||||
"ALTER TABLE dbo.wtb_depo\n" +
|
||||
" ALTER COLUMN cod_mdep VARCHAR(5) NOT NULL",
|
||||
|
||||
"ALTER TABLE dbo.wtb_depo\n" +
|
||||
" ADD CONSTRAINT pk_wtb_depo\n" +
|
||||
" PRIMARY KEY (cod_mdep, user_name)");
|
||||
|
||||
if(existIndex)
|
||||
executeStatement("CREATE unique index ux_wtb_depo_depo_default_utente\n" +
|
||||
" on dbo.wtb_depo (user_name)\n" +
|
||||
" where [default_depo] = 1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251126191506 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
String value = executeQueryOnlyFirstRowFirstColumn("SELECT value FROM stb_gest_setup WHERE gest_name = 'PICKING' AND section = 'SETUP' AND key_section = 'ASS_SERIE_ORD_A_COLLO'");
|
||||
|
||||
if (value == null || value.isEmpty())
|
||||
updateSetupValue("PICKING", "SETUP", "ASS_SERIE_ORD_A_COLLO", "N");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,306 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251127104634 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
if (!isCustomer(IntegryCustomer.Biolevante)) return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("f_pp_consuntivo_prod_tracc", "CREATE function [dbo].[f_pp_consuntivo_prod_tracc] (@as_codProdParent varchar(15), @as_partitaMagParent varchar(20), @ac_qtaProdParent numeric(20,5), @as_codProd varchar(15), @as_partitaMag varchar(20), @ac_qtaProd numeric(20, 5), @ai_livello integer, @as_item_id varchar(255), @ai_idRiga integer) \n" +
|
||||
"RETURNS @dettCosti TABLE(livello integer, \n" +
|
||||
" item_id varchar(255),\n" +
|
||||
" cod_prod_parent varchar(15),\n" +
|
||||
" partita_mag_parent varchar(20), \n" +
|
||||
" qta_prod_parent numeric(20,5),\n" +
|
||||
" cod_prod varchar(15),\n" +
|
||||
" partita_mag varchar(20), \n" +
|
||||
" qta_prod numeric(20,5),\n" +
|
||||
" gruppo_conto varchar(40), \n" +
|
||||
" conto varchar(40), \n" +
|
||||
" descrizione_conto varchar(255), \n" +
|
||||
" dettaglio_conto varchar(40),\n" +
|
||||
" unt_mis varchar(5), \n" +
|
||||
" qta_consumata numeric(20, 5)) AS\n" +
|
||||
"Begin\n" +
|
||||
" DECLARE \n" +
|
||||
" @lc_qtaProd numeric(20,5), \n" +
|
||||
" @ls_gruppoConto varchar(40), \n" +
|
||||
" @ls_codMart varchar(15), \n" +
|
||||
" @ls_partitaMag varchar(20), \n" +
|
||||
" @ls_descrizione varchar(255), \n" +
|
||||
" @ls_untMis varchar(5), \n" +
|
||||
" @lc_qtaMP numeric(20,5), \n" +
|
||||
" @li_existDist integer, \n" +
|
||||
" @lc_rapporto numeric(20, 5),\n" +
|
||||
" @lc_qtaProdScaricata numeric(20,5),\n" +
|
||||
" @li_livello integer, \n" +
|
||||
" @ls_itemID varchar(255),\n" +
|
||||
" @li_idRiga integer,\n" +
|
||||
" @ls_codMiscela varchar(15),\n" +
|
||||
" @ls_posizione varchar(20),\n" +
|
||||
" @ls_posizione_da varchar(20),\n" +
|
||||
" @ls_posizione_a varchar(20),\n" +
|
||||
" @li_countScarichiLotto integer\n" +
|
||||
"\n" +
|
||||
" SELECT @ls_codMiscela = cod_mart FROM olvw_miscele_olio\n" +
|
||||
"\n" +
|
||||
" if @ai_idRiga is null\n" +
|
||||
" begin\n" +
|
||||
" SELECT @ai_livello = 1\n" +
|
||||
" SELECT @as_item_id = '00001';\n" +
|
||||
" end ;\n" +
|
||||
" IF @as_item_id = '' \n" +
|
||||
" begin\n" +
|
||||
" Select @ls_posizione = mtb_depo_posizioni.posizione from mtb_partita_mag, mtb_depo_posizioni \n" +
|
||||
" where mtb_depo_posizioni.posizione = mtb_partita_mag.posizione and\n" +
|
||||
" mtb_partita_mag.cod_mart = @as_codProdParent and partita_mag = @as_partitaMagParent and\n" +
|
||||
" mtb_depo_posizioni.flag_silos_liquidi = 1;\n" +
|
||||
" If @ls_posizione is not null Select @as_item_id = 'SILOS' --Serve ad identificare le miscele di olio\n" +
|
||||
" end\n" +
|
||||
"\n" +
|
||||
" /* Acquisizione quantita totale prodotta per prodotto-partita */\n" +
|
||||
" Select @lc_qtaProd = ISNULL(sum(dtb_docr.qta_doc * dtb_docr.rap_conv * dtb_tipi.segno_qta_car), 0)\n" +
|
||||
" from dtb_docr, \n" +
|
||||
" dtb_tipi, \n" +
|
||||
" mtb_aart, \n" +
|
||||
" mtb_grup\n" +
|
||||
" where dtb_docr.cod_dtip = dtb_tipi.cod_dtip and\n" +
|
||||
" dtb_docr.cod_mart = mtb_aart.cod_mart and\n" +
|
||||
" mtb_aart.cod_mgrp = mtb_Grup.cod_mgrp and\n" +
|
||||
" dtb_docr.cod_mart = @as_codProd and\n" +
|
||||
" dtb_docr.partita_mag = @as_partitaMag and\n" +
|
||||
" dtb_tipi.gestione = 'L' and\n" +
|
||||
" dtb_tipi.tipo_emissione = 'DIRETTA' and\n" +
|
||||
" dtb_tipi.segno_qta_car <> 0\n" +
|
||||
"\n" +
|
||||
" /* Calcolo del rapporto della qta passata come parametro e di quella totale*/\n" +
|
||||
" if @ac_qtaProd is not null\n" +
|
||||
" if @lc_qtaProd = 0 select @lc_rapporto = 0 else select @lc_rapporto = @ac_qtaProd / @lc_qtaProd\n" +
|
||||
" else\n" +
|
||||
" begin \n" +
|
||||
" select @lc_rapporto = 1\n" +
|
||||
" select @ac_qtaProdParent = @lc_qtaProd\n" +
|
||||
" end\n" +
|
||||
" \n" +
|
||||
" /* Acquisizione totale quantita' prodotta per prododo-partita_mag dagli scarichi\n" +
|
||||
" E' necessario prendere la quantita dalla testata degli scarichi perche' ci \n" +
|
||||
" potrebbero essere delle perdite rispetto alla quantita' caricata.\n" +
|
||||
" N.B. al momento questa variabile viene acquisita solo per controllo in fase di debug\n" +
|
||||
" */\n" +
|
||||
" Select @lc_qtaProdScaricata = sum(dtb_doct.qta_prod*dtb_doct.rap_conv_prod * @lc_rapporto)\n" +
|
||||
" From dtb_doct, \n" +
|
||||
" dtb_tipi\n" +
|
||||
" Where dtb_doct.cod_dtip = dtb_tipi.cod_dtip and\n" +
|
||||
" dtb_tipi.gestione = 'L' and \n" +
|
||||
" dtb_tipi.segno_qta_scar = 1 and\n" +
|
||||
" dtb_doct.cod_prod = @as_codProd and\n" +
|
||||
" ISNULL(dtb_doct.partita_mag, '') = ISNULL(@as_partitaMag, '')\n" +
|
||||
" \n" +
|
||||
"\n" +
|
||||
" /* Acquisizione scarichi per prodotto-partita_mag */\n" +
|
||||
" select @li_idRiga = 0;\n" +
|
||||
" IF @as_codProd = @ls_codMiscela\n" +
|
||||
" begin\n" +
|
||||
" Select @ai_livello = @ai_livello+1\n" +
|
||||
" end\n" +
|
||||
" Declare csr_scarichi Cursor LOCAL SCROLL FOR\n" +
|
||||
" Select PP_gruppiCostiMP.GruppoConto,\n" +
|
||||
" dtb_docr.cod_mart, \n" +
|
||||
" dtb_docr.partita_mag,\n" +
|
||||
" dtb_docr.descrizione_estesa as descrizione,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" sum(dtb_docr.qta_doc*dtb_docr.rap_conv*dtb_tipi.segno_qta_scar*@lc_rapporto) as Qta_mp\n" +
|
||||
" From dtb_doct, \n" +
|
||||
" dtb_docr, \n" +
|
||||
" dtb_tipi, \n" +
|
||||
" mtb_aart, \n" +
|
||||
" mtb_grup, \n" +
|
||||
" PP_gruppiCostiMP\n" +
|
||||
" Where dtb_doct.cod_anag = dtb_docr.cod_anag and\n" +
|
||||
" dtb_doct.cod_dtip = dtb_docr.cod_dtip and\n" +
|
||||
" dtb_doct.data_doc = dtb_docr.data_doc and\n" +
|
||||
" dtb_doct.ser_doc = dtb_docr.ser_doc and\n" +
|
||||
" dtb_doct.num_doc = dtb_docr.num_doc and\n" +
|
||||
" dtb_doct.cod_dtip = dtb_tipi.cod_dtip and\n" +
|
||||
" dtb_tipi.gestione = 'L' and \n" +
|
||||
" dtb_tipi.segno_qta_scar = 1 and\n" +
|
||||
" dtb_docr.cod_mart = mtb_aart.cod_mart and\n" +
|
||||
" mtb_aart.cod_mgrp = mtb_grup.cod_mgrp and\n" +
|
||||
" dtb_docr.cod_mart = PP_gruppiCostiMP.cod_mart and\n" +
|
||||
" dtb_doct.cod_prod = @as_codProd and\n" +
|
||||
" ISNULL(dtb_doct.partita_mag, '') = ISNULL(@as_partitaMag, '')\n" +
|
||||
" and NOT (dtb_docr.cod_mart = @as_codProd and ISNULL(dtb_docr.partita_mag, '') = ISNULL(@as_partitaMag, ''))\n" +
|
||||
" group by PP_gruppiCostiMP.GruppoConto,\n" +
|
||||
" dtb_docr.cod_mart, \n" +
|
||||
" dtb_docr.partita_mag,\n" +
|
||||
" dtb_docr.descrizione_estesa,\n" +
|
||||
" mtb_aart.unt_mis\n" +
|
||||
" union all\n" +
|
||||
" \n" +
|
||||
" Select PP_gruppiCostiMP.GruppoConto,\n" +
|
||||
" car.cod_mart, \n" +
|
||||
" car.partita_mag,\n" +
|
||||
" car.descrizione_estesa as descrizione,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" sum(car.qta_doc*car.rap_conv*dtb_tipi.segno_qta_scar*@lc_rapporto) as Qta_mp \n" +
|
||||
" from dtb_doct inner join dtb_docr on dtb_doct.cod_anag = dtb_docr.cod_anag and\n" +
|
||||
" dtb_doct.cod_dtip = dtb_docr.cod_dtip and\n" +
|
||||
" dtb_doct.data_doc = dtb_docr.data_doc and\n" +
|
||||
" dtb_doct.ser_doc = dtb_docr.ser_doc and\n" +
|
||||
" dtb_doct.num_doc = dtb_docr.num_doc \n" +
|
||||
" inner join dtb_tipi on dtb_doct.cod_dtip = dtb_tipi.cod_dtip \n" +
|
||||
" inner join dtb_docr car on dtb_doct.activity_id = car.activity_id_row \n" +
|
||||
" inner join dtb_tipi tipo_car on car.cod_dtip = tipo_car.cod_dtip\n" +
|
||||
" inner join olvw_caratteristiche on car.cod_mart = olvw_caratteristiche.cod_mart\n" +
|
||||
" inner join PP_gruppiCostiMP on car.cod_mart = PP_gruppiCostiMP.cod_mart\n" +
|
||||
" inner join mtb_aart on car.cod_mart = mtb_aart.cod_mart \n" +
|
||||
" inner join mtb_grup on mtb_aart.cod_mgrp = mtb_grup.cod_mgrp \n" +
|
||||
" where tipo_car.gestione = 'L' and \n" +
|
||||
" tipo_car.segno_qta_car - tipo_car.segno_qta_scar < 0 and \n" +
|
||||
" olvw_caratteristiche.Confezionato = 'S' and \n" +
|
||||
" dtb_tipi.gestione = 'L' and \n" +
|
||||
" dtb_tipi.segno_qta_scar = 1 and\n" +
|
||||
" dtb_doct.cod_prod = @as_codProd and\n" +
|
||||
" ISNULL(dtb_doct.partita_mag, '') = ISNULL(@as_partitaMag, '')\n" +
|
||||
" and NOT (dtb_docr.cod_mart = @as_codProd and ISNULL(dtb_docr.partita_mag, '') = ISNULL(@as_partitaMag, '')) \n" +
|
||||
" group by PP_gruppiCostiMP.GruppoConto,\n" +
|
||||
" car.cod_mart, \n" +
|
||||
" car.partita_mag,\n" +
|
||||
" car.descrizione_estesa,\n" +
|
||||
" mtb_aart.unt_mis\n" +
|
||||
" Order by PP_gruppiCostiMP.GruppoConto desc \n" +
|
||||
" \n" +
|
||||
" OPEN csr_scarichi\n" +
|
||||
" FETCH NEXT FROM csr_scarichi INTO @ls_gruppoConto, @ls_codMart, @ls_partitaMag, @ls_descrizione, @ls_untMis, @lc_qtaMP\n" +
|
||||
" WHILE @@FETCH_STATUS = 0\n" +
|
||||
" begin\n" +
|
||||
" IF ABS(@lc_qtaMP) > 0.01\n" +
|
||||
" Begin\n" +
|
||||
" select @li_idRiga = @li_idRiga + 1;\n" +
|
||||
" SELECT @ls_itemID = @as_item_id + '_' + REPLICATE('0', 5 - len(CONVERT(varchar(15), @li_idRiga))) + CONVERT(varchar(15), @li_idRiga); \n" +
|
||||
"\n" +
|
||||
" /* verifica esistenza scarico, Indica che siamo in presenza di un semilavorato/lotto */\n" +
|
||||
" select @li_existDist = count(*)\n" +
|
||||
" from dtb_doct, dtb_tipi\n" +
|
||||
" where dtb_doct.cod_prod = @ls_codMart and partita_mag = @ls_partitaMag and \n" +
|
||||
" dtb_doct.cod_dtip = dtb_tipi.cod_dtip and\n" +
|
||||
" dtb_tipi.segno_qta_scar = 1 and \n" +
|
||||
" dtb_doct.gestione = 'L'\n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
" /* Materia prima */\n" +
|
||||
" if @li_existDist = 0 or @@NESTLEVEL >= 30\n" +
|
||||
" begin\n" +
|
||||
" insert into @dettCosti \n" +
|
||||
" select @ai_livello,\n" +
|
||||
" @ls_itemID,\n" +
|
||||
" @as_codProdParent, \n" +
|
||||
" @as_partitaMagParent, \n" +
|
||||
" @ac_qtaProdParent, \n" +
|
||||
" @as_codProd, \n" +
|
||||
" @as_partitaMag, \n" +
|
||||
" @lc_qtaProdScaricata, \n" +
|
||||
" @ls_gruppoConto, \n" +
|
||||
" @ls_codMart, \n" +
|
||||
" @ls_descrizione, \n" +
|
||||
" @ls_partitaMag, \n" +
|
||||
" @ls_untMis, \n" +
|
||||
" @lc_qtaMP\n" +
|
||||
" end\n" +
|
||||
" else\n" +
|
||||
" Begin\n" +
|
||||
" /* Semilavorato */\n" +
|
||||
" \n" +
|
||||
" Select @ls_posizione_a = mtb_depo_posizioni.posizione \n" +
|
||||
" from mtb_partita_mag, mtb_depo_posizioni \n" +
|
||||
" where mtb_depo_posizioni.posizione = mtb_partita_mag.posizione and\n" +
|
||||
" mtb_partita_mag.cod_mart = @as_codProd and partita_mag = @as_partitaMag and\n" +
|
||||
" mtb_depo_posizioni.flag_silos_liquidi = 1;\n" +
|
||||
" Select @ls_posizione_da = mtb_depo_posizioni.posizione \n" +
|
||||
" from mtb_partita_mag, mtb_depo_posizioni \n" +
|
||||
" where mtb_depo_posizioni.posizione = mtb_partita_mag.posizione and\n" +
|
||||
" mtb_partita_mag.cod_mart = @ls_codMart and partita_mag = @ls_partitaMag and\n" +
|
||||
" mtb_depo_posizioni.flag_silos_liquidi = 1;\n" +
|
||||
" \n" +
|
||||
" --24/11/25 (Massimo) Segue query per verificare se siamo su un lotto di olio che è stato scaricato e non azzerato. In tal caso la ricorsione non deve avvenire\n" +
|
||||
" select @li_countScarichiLotto = count(*)\n" +
|
||||
" from dtb_docr inner join dtb_tipi on dtb_docr.cod_dtip = dtb_tipi.cod_dtip \n" +
|
||||
" where dtb_tipi.segno_qta_scar = 1\n" +
|
||||
" and dtb_docr.cod_mart = @ls_codMart and dtb_docr.partita_mag = @ls_partitaMag\n" +
|
||||
" and @ls_posizione_da = @ls_posizione_a\n" +
|
||||
"\n" +
|
||||
" If @ls_posizione_da is not null and \n" +
|
||||
" (ISNULL(@ls_posizione_da,'') <> ISNULL(@ls_posizione_a,00) or \n" +
|
||||
" @ls_posizione_da is null or @ls_posizione_a is null or \n" +
|
||||
" (@ai_livello <1 and @as_codProd = @ls_codMiscela) or \n" +
|
||||
" (ISNULL(@ls_posizione_da,'') = ISNULL(@ls_posizione_a,00) and @as_codProd= @ls_codMiscela) or\n" +
|
||||
" IsNull(@li_countScarichiLotto,1) > 1)\n" +
|
||||
" --Questa insert serve per trattare l'olio che proviene da altro serbatoio come una materia prima a partire dal 2° livello di ricorsione\n" +
|
||||
" --dal 24/11/25 vale anche per olio proveniente dallo stesso serbatoio ma già scaricato parzialmente prima del carico del lotto parent\n" +
|
||||
" Begin\n" +
|
||||
" insert into @dettCosti \n" +
|
||||
" select @ai_livello,\n" +
|
||||
" @ls_itemID,\n" +
|
||||
" @as_codProdParent, \n" +
|
||||
" @as_partitaMagParent, \n" +
|
||||
" @ac_qtaProdParent, \n" +
|
||||
" @as_codProd, \n" +
|
||||
" @as_partitaMag, \n" +
|
||||
" @lc_qtaProdScaricata, \n" +
|
||||
" @ls_gruppoConto, \n" +
|
||||
" @ls_codMart, \n" +
|
||||
" @ls_descrizione, \n" +
|
||||
" @ls_partitaMag, \n" +
|
||||
" @ls_untMis, \n" +
|
||||
" @lc_qtaMP;\n" +
|
||||
" End\n" +
|
||||
" \n" +
|
||||
" /*Ricorsione su semilavorato-partita_mag*/\n" +
|
||||
" If IsNull(@li_countScarichiLotto,1) = 1 and --Aggiunta 24/11/25 da Massimo per escludere ricorsione su olio proveniente dallo stesso serbatoio ma già scaricato parzialmente prima del carico del lotto parent\n" +
|
||||
" ISNULL(@ls_posizione_da,'') = ISNULL(@ls_posizione_a,00) and @as_codProd <> @ls_codMiscela or \n" +
|
||||
" @ls_posizione_da is null or @ls_posizione_a is null or \n" +
|
||||
" (@ai_livello <1 and @as_codProd = @ls_codMiscela)\n" +
|
||||
" --La ricorsione non avviene sugli olii provenienti da altro serbatoio e neanche nel caso di Miscele fittizie create nello stesso serbatoio dell'olio di provenienza in assenza di polmone\n" +
|
||||
" insert into @dettCosti \n" +
|
||||
" select costi.livello, \n" +
|
||||
" costi.item_id,\n" +
|
||||
" @as_codProdParent, \n" +
|
||||
" @as_partitaMagParent,\n" +
|
||||
" @ac_qtaProdParent,\n" +
|
||||
" costi.cod_prod, \n" +
|
||||
" costi.partita_mag, \n" +
|
||||
" costi.qta_prod,\n" +
|
||||
" costi.gruppo_conto, \n" +
|
||||
" costi.conto, \n" +
|
||||
" costi.descrizione_conto, \n" +
|
||||
" costi.dettaglio_conto,\n" +
|
||||
" costi.unt_mis, \n" +
|
||||
" costi.qta_consumata \n" +
|
||||
" from dbo.f_pp_consuntivo_prod_tracc(@as_codProdParent, @as_partitaMagParent, @ac_qtaProdParent, @ls_codMart, @ls_partitaMag, @lc_qtaMP, @ai_livello, @ls_itemID, @li_idRiga) costi\n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
" end\n" +
|
||||
" end\n" +
|
||||
" FETCH NEXT FROM csr_scarichi INTO @ls_gruppoConto, @ls_codMart, @ls_partitaMag, @ls_descrizione, @ls_untMis, @lc_qtaMP\n" +
|
||||
" end\n" +
|
||||
" close csr_scarichi\n" +
|
||||
" deallocate csr_scarichi\n" +
|
||||
" return\n" +
|
||||
"END");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.utility.dto.IndexTableDTO;
|
||||
import it.integry.ems_model.utility.dto.PkTableDTO;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Migration_20251127114735 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"exec DropForeignKey 'mtb_aart', 'mtb_marchio_linea'",
|
||||
"exec DropForeignKey 'mtb_aart', 'mtb_marchio_slinea'",
|
||||
"exec DropForeignKey 'mtb_aart', 'mtb_marchio_sslinea'",
|
||||
"exec DropForeignKey 'mtb_marchio_sslinea', 'mtb_marchio_slinea'",
|
||||
"exec DropForeignKey 'mtb_marchio_slinea', 'mtb_marchio_linea'",
|
||||
"exec DropForeignKey 'mtb_marchio_linea', 'mtb_aart_marchio'",
|
||||
"exec DropPrimaryKey 'mtb_marchio_linea'",
|
||||
"exec DropPrimaryKey 'mtb_marchio_slinea'",
|
||||
"exec DropPrimaryKey 'mtb_marchio_sslinea'",
|
||||
"alter table mtb_marchio_linea drop column id_marchio",
|
||||
"alter table mtb_marchio_slinea drop column cod_linea",
|
||||
"alter table mtb_marchio_sslinea drop column cod_slinea",
|
||||
"exec sp_rename 'mtb_marchio_linea', 'mtb_aart_linea'",
|
||||
"exec sp_rename 'mtb_marchio_slinea', 'mtb_aart_slinea'",
|
||||
"exec sp_rename 'mtb_marchio_sslinea', 'mtb_aart_sslinea'"
|
||||
);
|
||||
|
||||
PkTableDTO pkTableDTO = new PkTableDTO()
|
||||
.setTableName("mtb_aart_linea")
|
||||
.setColumns(Arrays.asList(
|
||||
new PkTableDTO.Column("cod_linea")
|
||||
));
|
||||
createPrimaryKey(pkTableDTO);
|
||||
|
||||
pkTableDTO = new PkTableDTO()
|
||||
.setTableName("mtb_aart_slinea")
|
||||
.setColumns(Arrays.asList(
|
||||
new PkTableDTO.Column("cod_slinea")
|
||||
));
|
||||
createPrimaryKey(pkTableDTO);
|
||||
|
||||
|
||||
pkTableDTO = new PkTableDTO()
|
||||
.setTableName("mtb_aart_sslinea")
|
||||
.setColumns(Arrays.asList(
|
||||
new PkTableDTO.Column("cod_sslinea")
|
||||
));
|
||||
createPrimaryKey(pkTableDTO);
|
||||
|
||||
executeStatement(
|
||||
"ALTER TABLE mtb_aart ADD CONSTRAINT fk_mtb_aart_mtb_aart_linea "
|
||||
+ "FOREIGN KEY (cod_linea) REFERENCES mtb_aart_linea(cod_linea);",
|
||||
"ALTER TABLE mtb_aart ADD CONSTRAINT fk_mtb_aart_mtb_aart_slinea "
|
||||
+ "FOREIGN KEY (cod_slinea) REFERENCES mtb_aart_slinea(cod_slinea);",
|
||||
"ALTER TABLE mtb_aart ADD CONSTRAINT fk_mtb_aart_mtb_aart_sslinea "
|
||||
+ "FOREIGN KEY (cod_sslinea) REFERENCES mtb_aart_sslinea(cod_sslinea);");
|
||||
|
||||
dropIndex("mtb_aart_marchio", "marchio");
|
||||
|
||||
|
||||
executeStatement(
|
||||
"insert into mtb_aart_marchio\n" +
|
||||
"select distinct marchio\n" +
|
||||
"from mtb_aart\n" +
|
||||
"where marchio is not null\n" +
|
||||
"except\n" +
|
||||
"select marchio\n" +
|
||||
"from mtb_aart_marchio",
|
||||
"exec DropForeignKey 'mtb_aart', 'mtb_aart_marchio' ",
|
||||
"alter table mtb_aart drop column id_marchio ",
|
||||
"exec DropPrimaryKey 'mtb_aart_marchio' ",
|
||||
"alter table mtb_aart_marchio drop column id ",
|
||||
"alter table mtb_aart_marchio add constraint pk_mtb_aart_marchio primary key (marchio) ",
|
||||
"ALTER TABLE mtb_aart ADD CONSTRAINT fk_mtb_aart_mtb_aart_marchio FOREIGN KEY (marchio) REFERENCES mtb_aart_marchio(marchio) ");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user