Compare commits
1032 Commits
master-202
...
feature-re
| Author | SHA1 | Date | |
|---|---|---|---|
| db17e8c473 | |||
| c8b1a0ddfd | |||
| 2ab3bb6043 | |||
| 29f6b7d2a4 | |||
| 2be30206ce | |||
| 3306423e0a | |||
| 23a70c266e | |||
| 672a055e55 | |||
| c2f427387b | |||
| 08be0a6ad2 | |||
| 7a9a72f11a | |||
| 68075b89fa | |||
| e9ec1d1a83 | |||
| 9c4f8ff47e | |||
| b0194e569a | |||
| 3339cf1c9d | |||
| d635079e50 | |||
| e7082aef49 | |||
| 09b28cccbe | |||
| a25dc83d30 | |||
| 7d0bc83b67 | |||
| 67756553f3 | |||
| 473c2e05b5 | |||
| 9a35af5b20 | |||
| ba899f3309 | |||
| 612bc1e3de | |||
| 6f198e7d5a | |||
| 19e709fc3d | |||
| fd4636e6a6 | |||
| 6d4a2bf31b | |||
| 43efca4045 | |||
| 3516a8c8de | |||
| db78ca0cc0 | |||
| 5db8172b3c | |||
|
|
e1b85b8879 | ||
| 3f4a8b38eb | |||
| 99047236fc | |||
| 0f3c828c1f | |||
| 5a07e918a4 | |||
| 8ebac5dd33 | |||
| 6d950cee38 | |||
| 2b426103cd | |||
| 876daa7df4 | |||
| cca26eb472 | |||
| ff81f2129b | |||
| 04eb85b190 | |||
| db83ba4a3c | |||
| a1c7f63976 | |||
| e83e7f03c8 | |||
| e4b08b9a61 | |||
| b4f8fa49da | |||
| 5842cf0048 | |||
| d75dd5ead7 | |||
| b6eed691d0 | |||
| 59788d83d7 | |||
| 5fb2be5da0 | |||
| 0760905c4f | |||
| 3f27ec44f8 | |||
| 49626f4371 | |||
| 6e1d889eb8 | |||
| 0cf5dbd24b | |||
| 19d4c6b929 | |||
| a040670c5b | |||
| 69a938d076 | |||
| b9fd701098 | |||
| d39134c47e | |||
| fa0b2e338b | |||
| e2a827f45a | |||
| 0efc991231 | |||
| 965e9ee3b4 | |||
| 59aabd6a43 | |||
| 40f5649a5f | |||
| 45d067673c | |||
| 9634306d01 | |||
| f8b636f23d | |||
| 981f5e4d67 | |||
| d8e24764dc | |||
| 5cd2151f6c | |||
| 449aa664ab | |||
| 91f7269af4 | |||
| 29a8f6efc6 | |||
| be3b57b1c5 | |||
| cd5cfa88bc | |||
| d9bc09e6f3 | |||
| d28e3578e4 | |||
| af6b053215 | |||
| cd3468fd50 | |||
| ac5361b9a8 | |||
| e7b3d65628 | |||
| 164f105878 | |||
| 605ec9a910 | |||
| 8d83789356 | |||
| 623d9d316a | |||
| bba6ae5d9b | |||
| db32ba0e15 | |||
| 02e2e73259 | |||
| 1bc1caa528 | |||
| 1439050345 | |||
| 3637ba0048 | |||
| 7409d15cce | |||
| 563902d29e | |||
| c2994b8767 | |||
| 7a9b1fba4d | |||
| 88743f65c6 | |||
| 61cf7b8601 | |||
| 2663f039a0 | |||
| 0bac28fc98 | |||
| 9f696ec2cd | |||
| 8983748314 | |||
| bcb39b8829 | |||
| 3abf35028f | |||
| 58c7d31fea | |||
| 68db2d9591 | |||
| d6d342ba42 | |||
| 9b7ba6e6f4 | |||
| fc3fcaf80c | |||
| 8a2029f396 | |||
| 3b4d29d1c4 | |||
| 952e1b22f2 | |||
| 75eb189a11 | |||
| 3151755a1f | |||
| 2659bbdc83 | |||
| d60ffea913 | |||
| 0144d6d7ef | |||
| 755132a1b9 | |||
| 0b1292ec55 | |||
| 4b4ba7bc10 | |||
| 8f365e77be | |||
| 7eded8848f | |||
| 42a9756d94 | |||
| 41fbeb333f | |||
| 279257a35d | |||
| 87d377a83c | |||
| 5d7d2cb99f | |||
| 9676b65be3 | |||
| 27f28abb9b | |||
| cbf7ec5cdb | |||
| b3e390a634 | |||
| 2ae58205d8 | |||
| ea025c1f31 | |||
| ee83cd024e | |||
| 36a0a99755 | |||
| 0a03b1d489 | |||
| 9d14673771 | |||
| ee9f4b08ff | |||
| a0f72ee7b1 | |||
| cdc81c58e7 | |||
| 4c4b364177 | |||
| 0a46eda642 | |||
| c633d7c97e | |||
| 53fb1cb58e | |||
| 44e48527c6 | |||
| 74dcedeba9 | |||
| 1faf5dd713 | |||
| 5848f82e4a | |||
| 797c5c7736 | |||
| 59a21796b8 | |||
| b666064d15 | |||
| 8457bfbc75 | |||
| 5541742c0d | |||
| 532aa91b23 | |||
| 6630e42024 | |||
| 50c41e9de2 | |||
| 6aae376098 | |||
| 7ee6e8d64a | |||
| 7f2c83ea69 | |||
| 307840c236 | |||
| 3daf60767f | |||
| 5ba9035238 | |||
| 25321a9941 | |||
| dcbf627840 | |||
| 3e069d1c39 | |||
| 988712b234 | |||
| 123c7835d6 | |||
| d9d2b5bef7 | |||
| a0035ad573 | |||
| 203a36cdba | |||
| 99740104b9 | |||
| 3606aa99d9 | |||
| 673de9d9b1 | |||
| 0bebf87fa4 | |||
| 87cb0f8302 | |||
| 6b80520d8d | |||
| c18551d630 | |||
| 939cfde0c5 | |||
| 4231f7b6ae | |||
| ab956b4a6e | |||
| b7b60491d4 | |||
| 84e46ce609 | |||
| 2831137dac | |||
| f49c622df0 | |||
| f7f8bee8d0 | |||
| dabf6a0a54 | |||
| 41e7c24b91 | |||
| 7a6ddde702 | |||
| 17f4e1ad49 | |||
| 74227e6bf1 | |||
| fc2eee29a6 | |||
| 5a6fa368e4 | |||
| 8cf75f9497 | |||
| 5b40bd4780 | |||
| 9899944a04 | |||
| 58335a5102 | |||
| 3507bc531c | |||
| 07fdd0a5df | |||
| fd4901c294 | |||
| 6e65992b90 | |||
| 64399d4803 | |||
| c6c4f52e93 | |||
| 4bb4a6b34b | |||
| fe0927c0eb | |||
| 0d93dd2b1c | |||
| ab70242ebf | |||
| cf078ced9c | |||
| dad53637e8 | |||
| 853470701b | |||
| b1ee861a5c | |||
| 05857e2b11 | |||
| 60fb37ad8b | |||
| dae03dc91f | |||
| 5c81248472 | |||
| 7184c24f16 | |||
| a2be331295 | |||
| 18403554e7 | |||
| b1e189321c | |||
| e61b2532b1 | |||
| db56575b8f | |||
| 7832095b86 | |||
| 6290c18046 | |||
| 2bd8b6392c | |||
| 442af631aa | |||
| 2666e9a7ef | |||
| 7b3395dec8 | |||
| 7a15a94b38 | |||
| da8884dcdc | |||
| 54a09c2300 | |||
| 8818a42457 | |||
| d4a035fc0e | |||
| 3c5a0ba1f1 | |||
| c49f135e49 | |||
| a4d7d09c0b | |||
| 73b26249eb | |||
| 2581f537b1 | |||
| 8c14cd1937 | |||
| 597c2fe2a2 | |||
| 785b03455e | |||
| c544679f1b | |||
| 95bc10950a | |||
| e7a581f326 | |||
| db85805afd | |||
| 3350677b23 | |||
| 8413be30a0 | |||
| 9033da0bf2 | |||
| a6415486c3 | |||
| 6dfd56c58e | |||
| 98e251478c | |||
| d31a28d3b5 | |||
| fd5867e5f1 | |||
| 13311f191e | |||
| 1f2ace8258 | |||
| 0aaba82e57 | |||
| f68f76e5ea | |||
| 3888c1ce25 | |||
| 954eb96a2a | |||
| 057e3ac3c1 | |||
| 8e934b8a38 | |||
| 3e9793eb76 | |||
| ea6cb1e9d7 | |||
| 49cad4a71a | |||
| 629cf3bf22 | |||
| 9e8b05cecf | |||
| 8b593a3b21 | |||
| 6072ab57c9 | |||
| 120d85c1d3 | |||
| 13e2b1b3a4 | |||
| 6c705ab96b | |||
| 28e0c448f4 | |||
| 0b22aa9764 | |||
| a1b813f051 | |||
| 516874a6e5 | |||
| 5b31befcec | |||
| 19335be66b | |||
| b7c452d41f | |||
| 9ac451693b | |||
| 399f712024 | |||
| db38f84fca | |||
| b3e5c78afb | |||
| fa94de4135 | |||
| 81b01dd5a8 | |||
| 085d6af657 | |||
| 5421cb12d2 | |||
| cd98c3884f | |||
| 92e60c95e3 | |||
| 227025b526 | |||
| 4647125b61 | |||
| 1217922b90 | |||
| 731c28f382 | |||
| 2c5deeceb6 | |||
| 8e727aeb73 | |||
| 273b76715a | |||
| 7aa8c71b3f | |||
| ac235c2b56 | |||
| b78ab2e308 | |||
| a44a307dd1 | |||
| c25d08c9ac | |||
| 695e784c73 | |||
| 0c3415b7d6 | |||
| b412860f1f | |||
| 85f5129057 | |||
| 74bfc38cd5 | |||
| 3ec6deaec6 | |||
| 7bd80d9e52 | |||
| e2113d0660 | |||
| 8199b354d8 | |||
| 4e795f6a0a | |||
| 5f8732299a | |||
| 8babc6acfb | |||
| f193d21ffa | |||
| 6361e790b2 | |||
| 206927622a | |||
| b1ee82f0dc | |||
| 0019f03668 | |||
| d74661153a | |||
| 2529660f3b | |||
| 5c784a3f90 | |||
| d493749445 | |||
| 7e9c36ab77 | |||
| 904f5115b9 | |||
| 4387c4d1c3 | |||
| 9c481c5380 | |||
| 8eda08d060 | |||
|
|
ea493b3fa2 | ||
| a898ef24eb | |||
| e8bd3c0c99 | |||
| ac7bb55874 | |||
| 626a728529 | |||
| a69466f5db | |||
| cdcb1eb0b6 | |||
| 9f9e1ef12d | |||
| c6526f6574 | |||
| a919c323ae | |||
| 00cb459c66 | |||
| e1bee4b70f | |||
| bd706155f6 | |||
| cd81b92bfe | |||
| 4120f20c5a | |||
| d43345c5fc | |||
| c0ad1f0770 | |||
| a2bd7bc9aa | |||
| 02eb94fdef | |||
| c6380a9e05 | |||
| a01025853c | |||
| 08b2cb3289 | |||
| 884c051b18 | |||
| 65009a6693 | |||
| cb0f18eb0b | |||
| 30108563a0 | |||
| bec0430942 | |||
| ed9952d37d | |||
| a656c81373 | |||
| d6c0271129 | |||
| d3ba9aae5f | |||
| 809a31ea87 | |||
| 63cf1920a9 | |||
| 3c79fb6745 | |||
| 4a86118707 | |||
| 9dfd8623a7 | |||
| 7e8b8a8bc4 | |||
| 554a78e40f | |||
| 32022652b3 | |||
| 3560f2a661 | |||
| 63265571ac | |||
| 73049f32eb | |||
| 1e9b48811c | |||
| 2312323649 | |||
| 9c634059ab | |||
| 57892e22ee | |||
| 9d6dd2ff5f | |||
| 2d1d15da98 | |||
| 08af6fddb2 | |||
| 1a97940826 | |||
| b2e6b0bd87 | |||
| c161857422 | |||
| 69343830a9 | |||
| f3644dcc3f | |||
| 20aea0c306 | |||
| 03e6db20b5 | |||
| e53add6f0d | |||
| b8782a14c1 | |||
| 4825d59616 | |||
| e10f2d3a0c | |||
| 18f4f2770a | |||
|
|
fbf26157c1 | ||
| ee2e5c5938 | |||
| 8602bbf09d | |||
| 38ef2b297d | |||
| 452a2d2555 | |||
| d6794a904f | |||
| 18c2ae047e | |||
| 2fc60c34c3 | |||
| 5581055f07 | |||
| fc0ac2ec4b | |||
| b64cd203eb | |||
| e436b9773e | |||
| 37cb5d90f4 | |||
| 15e598df7e | |||
| b2d2bd494a | |||
| b43b6be4ac | |||
| 4036d2a04f | |||
| 58d900cc6b | |||
| 90bc764e61 | |||
| 37fcfba74e | |||
| 9e5bfc6655 | |||
| 295fd59729 | |||
| 8c2cf7d9fe | |||
| efb786ed0d | |||
| cc21e43bd4 | |||
| 5acf3023b7 | |||
| 514500de0b | |||
| 304f0a53db | |||
| 645b269fc8 | |||
| 94ceff0753 | |||
| 7f16ca80f4 | |||
| 14c57d6ab5 | |||
| ce56820405 | |||
| 9d9ce1f3ac | |||
| 4e46f89440 | |||
| fa337ffb16 | |||
| bd3b915963 | |||
| 032a4e3aca | |||
| 3c4d62cde2 | |||
| d1a7a166a8 | |||
| e0a3dbcea2 | |||
| 112f083c9a | |||
| adccf68c45 | |||
| f84a18b9b6 | |||
| d7ef52f164 | |||
| 5a91589ac6 | |||
| 942dbeef5e | |||
| 7d6f11272f | |||
| a18156014b | |||
| c5cbfd406f | |||
| abc2a0bb1e | |||
| f9ab71462f | |||
| 3568b6b17e | |||
| 93261bdb87 | |||
| 202261afc1 | |||
| 75d42d04ee | |||
| f014e4b959 | |||
| 6898cfc92c | |||
| e85b00c457 | |||
| ba1e8bb41c | |||
| 32ad423fc2 | |||
| bd2f7126a9 | |||
| 1661d60b94 | |||
| 438d62a362 | |||
| 0bb2cf76bf | |||
| 987a576bfd | |||
| 91ea98d9f2 | |||
| b64c01e7ce | |||
| be1ee50f32 | |||
| d2955085c5 | |||
| 10ed26c023 | |||
| 98cf6d5192 | |||
| 9007eda560 | |||
| 139fc94ed5 | |||
| 7e0ee7192e | |||
| f68690a01b | |||
| fcdbe8ab94 | |||
| 19568d1394 | |||
| 425b4b544f | |||
| 5dc8949215 | |||
| b51fc95057 | |||
| 1497a55607 | |||
| 0782d0206c | |||
| 6f94a290ee | |||
| 911271a6b1 | |||
| d955609d93 | |||
| eddd9ff8e7 | |||
| 1eface5798 | |||
| dcd3b0aace | |||
| 77a2fef606 | |||
| d54da02dc0 | |||
| 7e4c36a785 | |||
| 1bee7e59ab | |||
| d629f0a21d | |||
| eecadba27d | |||
| ab764a9a50 | |||
| 6027df9ee5 | |||
| 3bc9e6629b | |||
| f10e90bc9b | |||
| 997c667f1b | |||
| 6efa6e7293 | |||
| 7d831c59e7 | |||
| eaf8e4779e | |||
| 84669f3929 | |||
| 9b3184281c | |||
| 32229f7157 | |||
| 7dff05df5c | |||
| b88a5bface | |||
| 7b09900a1f | |||
| 48b87b7b48 | |||
| bc512ab8f2 | |||
| 71cb4d0d88 | |||
| b73d2e9bac | |||
| bc18dc3231 | |||
| d660bb592b | |||
| a5478ef619 | |||
| c8034042aa | |||
| bff520b2ab | |||
| 71eeba9091 | |||
| f30284a30b | |||
| 0f42d5a2ba | |||
| 8932e3ac98 | |||
| ebf9af7b8b | |||
| 9476e99476 | |||
| a338077542 | |||
| db9a613fc9 | |||
| 0d4882b818 | |||
| 856b759acc | |||
| c6271341b8 | |||
| b68a7aebd4 | |||
| c682331a22 | |||
| af6bc8ebe9 | |||
| cbbc0739c6 | |||
| 685fa64f46 | |||
| e12f00984d | |||
| 5dc20c4e3f | |||
| 1456749587 | |||
| dac957e5b0 | |||
| f8fd7820bc | |||
| db35c3d914 | |||
| fde32f2314 | |||
| dee4485a89 | |||
| ef58f2e65c | |||
| d5763c1d03 | |||
| 26d83ddabf | |||
| d0369d85c5 | |||
| 4a61a4b60c | |||
| dbba2e3fb3 | |||
| 6248e0da07 | |||
| c9fac89d16 | |||
| 11431e37c9 | |||
| 827fc6836c | |||
| 262d6d0f08 | |||
| ea5c880b0a | |||
| 182bd07d6c | |||
| 66a514468f | |||
| ff41b7e0dd | |||
| de6e0865ac | |||
| 6b8a2fb4c0 | |||
| 86e0750f03 | |||
| d0bb5e9342 | |||
| 9712d81a7d | |||
| cea2af9237 | |||
| 6734cfdde2 | |||
| 8f6ce309a2 | |||
| d551f029a8 | |||
| 87204b30bd | |||
| 28faad2491 | |||
| 839942ea40 | |||
| d24f5387dc | |||
| 521cc48e56 | |||
| 44a9d7dbd2 | |||
| 74d3dc0a67 | |||
| acc35b8cc8 | |||
| b9b756a811 | |||
| b82a3dd227 | |||
| c1e979391d | |||
| 5fd28fddd1 | |||
| 8a1ef5c6cf | |||
| da57dfed5b | |||
| d60b57ff02 | |||
| 9c85f5da3c | |||
| 8357a33df8 | |||
| 7a150516b4 | |||
| ddf518d11a | |||
| cf69cccbce | |||
| 68c220b8a8 | |||
| 1b05d58049 | |||
| 925e08ffc7 | |||
| ca9843f71a | |||
| 90f86858e9 | |||
| 6c1652e955 | |||
| af364d4220 | |||
| b97bd848a8 | |||
| 4dedea79cf | |||
| 29963759f2 | |||
| 70c1723c5d | |||
| 41b95b9dcb | |||
| c0b67577a7 | |||
| 82a74cbf1c | |||
| 56fbc96d9a | |||
| 7d629b5753 | |||
| 56d7876eb5 | |||
| af0f1e14b0 | |||
| 20c6adc41f | |||
| cfe0ae52e8 | |||
| 49cbc45ac0 | |||
| 8672c7df11 | |||
| 6177a4b3c4 | |||
| 50c57d1977 | |||
| 1d16e2cc13 | |||
| 79355eab19 | |||
| d4f2032aa7 | |||
| d1a1aad1d8 | |||
| d94f0f1a7e | |||
| 7507ab834c | |||
| a2c007119b | |||
| 7e421762d7 | |||
| 2abf8b55ac | |||
| a24e26b436 | |||
| 1008229297 | |||
| cf492ee2a0 | |||
| dac93e9e30 | |||
| aaac5bebb7 | |||
| 46002e7580 | |||
| 5982c8e966 | |||
| 6889372e40 | |||
| 158ccaa3ce | |||
| a0014d5ccd | |||
| 44091910ff | |||
| b25dff5d48 | |||
| 163613f836 | |||
| 82972a537e | |||
| 5d77838838 | |||
| b163c74771 | |||
| 9006da1383 | |||
| 026f89d031 | |||
| 8068110cf3 | |||
| 78f91d2cfe | |||
| b39f07414b | |||
| e3be231990 | |||
| 3ee2272886 | |||
| 6c58a19495 | |||
| 2d11f53330 | |||
| ad7274fdbf | |||
| fd2f4772ce | |||
| 2f649932b6 | |||
| 198e1d284b | |||
| 5041244f63 | |||
| 592c4f4b9a | |||
| cb7a45d83e | |||
| 6c95492412 | |||
| 1dd6d8b3fa | |||
| e026f9a0ea | |||
| 17c5b96c98 | |||
| eddad11630 | |||
| 0f65aaffab | |||
| 8723751f78 | |||
| 67c1a8fba5 | |||
| 24db8fbcec | |||
| c687831f4f | |||
| b878529840 | |||
| c4e8985642 | |||
| e6ee9c7090 | |||
| ab9672cae3 | |||
| 3dc3aea47b | |||
| c8fdf2634d | |||
| 295afc7acc | |||
| 450848b080 | |||
| d154ee9852 | |||
| ff2420c551 | |||
| 096650b4f6 | |||
| b5a2d999e6 | |||
| 92bc126e24 | |||
| 966f73aef3 | |||
| d048ea1f9c | |||
| 77ff799dba | |||
| 4804ec24c1 | |||
| b1c3935457 | |||
| 6301305b1a | |||
| 5d0b300e2a | |||
| eac86126c2 | |||
| a3552e0926 | |||
| 6f2d485de7 | |||
| 9f46505136 | |||
| 3bd6521967 | |||
| e189aa4f6c | |||
| e318d8625b | |||
| 4d2fbf610d | |||
| 0f91128b8e | |||
| d5eb4c62f6 | |||
| 3ec8d6d0e1 | |||
| 360fa9e59f | |||
| a3df8d0822 | |||
| b902879a26 | |||
| c9ee41a1b1 | |||
| eaf10604ef | |||
| 4a0382cafc | |||
| 0b0942b995 | |||
| 255de9a955 | |||
| 622c4c903c | |||
| e51fa4fa6b | |||
| febe8be89e | |||
| 3ad15c8457 | |||
| 3ae1d499c2 | |||
| b10c6e837c | |||
| 1d07f15169 | |||
| 18e69f0195 | |||
| 3f4735f953 | |||
| edcd6ecf6b | |||
| b2ac734b5e | |||
| 481e8e35cc | |||
| 725b93be81 | |||
| 63a891d061 | |||
| 044540ff10 | |||
| 90f3a636db | |||
| 048c639e72 | |||
| 5b1b5c5cde | |||
| 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 | |||
| d94bd75770 | |||
| bea182eea9 | |||
| ce6a102f45 | |||
| 9e1a600087 | |||
| 32c38b85aa | |||
| 89a6a8c2f4 | |||
| 9fca434612 | |||
| d675ce0e82 | |||
| c7a96834a2 | |||
| 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 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -122,3 +122,5 @@ fabric.properties
|
||||
/temp
|
||||
/docker/tomcat/conf/integry/logs.db
|
||||
/docker/tomcat/conf/integry/logs.db-journal
|
||||
copilot.*.xml
|
||||
/.idea/dataSources.xml
|
||||
|
||||
19
.idea/copilot.data.migration.agent.xml
generated
19
.idea/copilot.data.migration.agent.xml
generated
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AgentMigrationStateService">
|
||||
<option name="pendingSessionIds">
|
||||
<option value="c2adff55-0384-4ed3-8e89-6740a0a19622" />
|
||||
</option>
|
||||
<option name="pendingTurns">
|
||||
<map>
|
||||
<entry key="c2adff55-0384-4ed3-8e89-6740a0a19622">
|
||||
<value>
|
||||
<set>
|
||||
<option value="0ff64af0-e1e5-4e48-9056-263f3dd7e63f" />
|
||||
</set>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/copilot.data.migration.edit.xml
generated
Normal file
6
.idea/copilot.data.migration.edit.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EditMigrationStateService">
|
||||
<option name="migrationStatus" value="COMPLETED" />
|
||||
</component>
|
||||
</project>
|
||||
2
.idea/dataSources.xml
generated
2
.idea/dataSources.xml
generated
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="Biolevante" uuid="ff4f0bad-7271-429e-a4e1-bae28629efc8">
|
||||
<data-source source="LOCAL" name="@SERVERDB2019" uuid="ff4f0bad-7271-429e-a4e1-bae28629efc8">
|
||||
<driver-ref>sqlserver.ms</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc-driver>
|
||||
|
||||
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.*" />
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Tomcat 9 (RistoCash)" type="Remote">
|
||||
<configuration default="false" name="Tomcat 9 (AnydeskTunnel)" type="Remote">
|
||||
<module name="ems-engine" />
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" />
|
||||
<option name="HOST" value="127.0.0.1" />
|
||||
<option name="HOST" value="localhost" />
|
||||
<option name="PORT" value="8001" />
|
||||
<option name="AUTO_RESTART" value="false" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
16
.idea/runConfigurations/Tomcat__AnydeskTunnel_.xml
generated
16
.idea/runConfigurations/Tomcat__AnydeskTunnel_.xml
generated
@@ -1,16 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Tomcat (AnydeskTunnel)" type="Remote">
|
||||
<module name="ems-engine" />
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" />
|
||||
<option name="HOST" value="servertomcat" />
|
||||
<option name="PORT" value="8001" />
|
||||
<option name="AUTO_RESTART" value="false" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="8001" />
|
||||
<option name="LOCAL" value="false" />
|
||||
</RunnerSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
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>
|
||||
18
Containerfile
Normal file
18
Containerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
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 USERDOMAIN="STUDIO-ML"
|
||||
|
||||
COPY docker/tomcat/conf/integry/ems.properties /usr/local/tomcat/conf/integry/
|
||||
COPY docker/tomcat/conf/integry/ems_automated_operations.json /usr/local/tomcat/conf/integry/
|
||||
COPY docker/tomcat/conf/integry/ems_settings.json /usr/local/tomcat/conf/integry/
|
||||
COPY ems-engine/target/ems-api.war /usr/local/tomcat/webapps/
|
||||
|
||||
#COPY docker/FontTest.class .
|
||||
#ENTRYPOINT ["java","FontTest"]
|
||||
|
||||
EXPOSE 8080
|
||||
EXPOSE 5005
|
||||
@@ -42,7 +42,7 @@ pipeline {
|
||||
bat(script: 'mvn clean install -t toolchains-jenkins.xml', returnStdout: true)
|
||||
archiveArtifacts(artifacts: 'ems-engine/target/ems-api.war', onlyIfSuccessful: true)
|
||||
}
|
||||
stash includes: 'ems-engine/target/ems-api.war,docker/**,Dockerfile', name: 'docker-files'
|
||||
stash includes: 'ems-engine/target/ems-api.war,docker/**,Containerfile', name: 'container-files'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ sleep 10''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaul
|
||||
steps {
|
||||
node('server-build') {
|
||||
echo "Building Docker image"
|
||||
unstash 'docker-files'
|
||||
unstash 'container-files'
|
||||
|
||||
script {
|
||||
def branchVersion = ""
|
||||
@@ -127,7 +127,9 @@ sleep 10''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaul
|
||||
branchVersion = "-${env.GIT_BRANCH.toLowerCase().replace('/', '-')}"
|
||||
}
|
||||
|
||||
bat "docker buildx build --platform linux/amd64,linux/arm64 --push -t \"git.studioml.it/integry/ems-api${branchVersion}:latest\" ."
|
||||
// bat "docker buildx build --platform linux/amd64,linux/arm64 --push -t \"git.studioml.it/integry/ems-api${branchVersion}:latest\" ."
|
||||
bat "podman build -f .\\Containerfile -t \"git.studioml.it/integry/ems-api${branchVersion}:latest\" ."
|
||||
bat "podman push \"git.studioml.it/integry/ems-api${branchVersion}:latest\""
|
||||
|
||||
//containerImageLink "git.studioml.it/integry/ems-api-${env.GIT_BRANCH.toLowerCase().replace('/', '-')}:latest}"
|
||||
}
|
||||
|
||||
@@ -5,16 +5,7 @@
|
||||
"primaryInstance" : true,
|
||||
"enableTokenCaching" : false,
|
||||
"systemPassword" : "?MF!jbI+&OkA",
|
||||
"availableConnections" : [ {
|
||||
"profileName" : "MAGGIOSRL",
|
||||
"connectionType" : "MSSQL",
|
||||
"dbName" : "MaggioSRL",
|
||||
"username" : "sa",
|
||||
"password" : "sZ",
|
||||
"host" : "192.168.2.214",
|
||||
"encryptedDbPsw" : true,
|
||||
"internalDb" : true
|
||||
}, {
|
||||
"availableConnections" : [{
|
||||
"profileName" : "AGRICOPER",
|
||||
"connectionType" : "MSSQL",
|
||||
"dbName" : "agricoper",
|
||||
@@ -33,18 +24,18 @@
|
||||
"encryptedDbPsw" : true,
|
||||
"internalDb" : true
|
||||
}, {
|
||||
"profileName" : "COAP",
|
||||
"profileName" : "RESINA_COLOR",
|
||||
"connectionType" : "MSSQL",
|
||||
"dbName" : "COAP",
|
||||
"dbName" : "RESINACOLOR",
|
||||
"username" : "sa",
|
||||
"password" : "sZ",
|
||||
"host" : "192.168.2.214",
|
||||
"encryptedDbPsw" : true,
|
||||
"internalDb" : true
|
||||
}, {
|
||||
"profileName" : "RESINA_COLOR",
|
||||
"profileName" : "RESINA_COLOR_PASQUALE",
|
||||
"connectionType" : "MSSQL",
|
||||
"dbName" : "RESINACOLOR",
|
||||
"dbName" : "RESINACOLOR_PASQUALE",
|
||||
"username" : "sa",
|
||||
"password" : "sZ",
|
||||
"host" : "192.168.2.214",
|
||||
@@ -242,12 +233,21 @@
|
||||
}, {
|
||||
"profileName" : "GRAMM",
|
||||
"connectionType" : "MSSQL",
|
||||
"dbName" : "gramm",
|
||||
"dbName" : "gramm_peppe",
|
||||
"username" : "SA",
|
||||
"password" : "sZ",
|
||||
"host" : "192.168.2.220",
|
||||
"encryptedDbPsw" : true,
|
||||
"internalDb" : true
|
||||
}, {
|
||||
"profileName" : "MAGGIOSRL",
|
||||
"connectionType" : "MSSQL",
|
||||
"dbName" : "MaggioSRL",
|
||||
"username" : "sa",
|
||||
"password" : "sZ",
|
||||
"host" : "192.168.2.214",
|
||||
"encryptedDbPsw" : true,
|
||||
"internalDb" : true
|
||||
}, {
|
||||
"profileName" : "IDROTECNICA",
|
||||
"connectionType" : "MSSQL",
|
||||
@@ -278,7 +278,7 @@
|
||||
}, {
|
||||
"profileName" : "IME_TE",
|
||||
"connectionType" : "MSSQL",
|
||||
"dbName" : "IME_TE",
|
||||
"dbName" : "IME_TE_peppe",
|
||||
"username" : "SA",
|
||||
"password" : "sZ",
|
||||
"host" : "192.168.2.214",
|
||||
@@ -692,7 +692,7 @@
|
||||
}, {
|
||||
"profileName" : "BIOLEVANTE",
|
||||
"connectionType" : "MSSQL",
|
||||
"dbName" : "biolevante",
|
||||
"dbName": "biolevante",
|
||||
"username" : "SA",
|
||||
"password" : "sZ",
|
||||
"host" : "192.168.2.220",
|
||||
|
||||
@@ -363,6 +363,11 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.20</version> <!-- Versione scritta a mano perché qui non hanno usato lo 0 finale -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.annotations;
|
||||
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import org.springframework.stereotype.Indexed;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Indexed
|
||||
public @interface CustomerComponent {
|
||||
IntegryCustomer value();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package it.integry.annotations;
|
||||
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@CustomerComponent(IntegryCustomer.Integry) // Valore di default, verrà sovrascritto
|
||||
public @interface CustomerService {
|
||||
@AliasFor(
|
||||
annotation = CustomerComponent.class
|
||||
)
|
||||
IntegryCustomer value();
|
||||
}
|
||||
@@ -20,16 +20,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 +47,17 @@ 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 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());
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.json.JsonObjectMapperConfig;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
@@ -24,6 +25,7 @@ public abstract class BaseEntityImporter<T> implements IEntityImporter<T> {
|
||||
protected String format;
|
||||
protected boolean headless;
|
||||
protected ImportRequestDTO requestDto;
|
||||
protected RequestDataDTO requestDataDTO;
|
||||
protected MultiDBTransactionManager multiDBTransactionManager;
|
||||
protected List<AnomalieDTO> anomalie = new ArrayList<AnomalieDTO>();
|
||||
|
||||
@@ -77,6 +79,12 @@ public abstract class BaseEntityImporter<T> implements IEntityImporter<T> {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityImporter<T> setRequestDataDTO(RequestDataDTO requestDataDTO) {
|
||||
this.requestDataDTO = requestDataDTO;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<AnomalieDTO> getAnomalie() {
|
||||
return anomalie;
|
||||
}
|
||||
@@ -100,4 +108,6 @@ public abstract class BaseEntityImporter<T> implements IEntityImporter<T> {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package it.integry.ems.Import.base;
|
||||
|
||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
@@ -26,10 +27,14 @@ public interface IEntityImporter<T> {
|
||||
|
||||
IEntityImporter<T> setRequestDTO(ImportRequestDTO requestDto);
|
||||
|
||||
IEntityImporter<T> setRequestDataDTO(RequestDataDTO requestDataDTO);
|
||||
|
||||
List<AnomalieDTO> getAnomalie();
|
||||
|
||||
T doImport() throws Exception;
|
||||
|
||||
String renameFile(String orginalFileName, List<EntityBase> entities) throws Exception;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package it.integry.ems._context;
|
||||
import it.integry.annotations.PostContextConstruct;
|
||||
import it.integry.common.var.EmsDBConst;
|
||||
import it.integry.ems.expansion.RunnableArgsThrowable;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.settings.SettingsController;
|
||||
import it.integry.ems.sync.MultiDBTransaction.BasicConnectionPool;
|
||||
@@ -83,9 +83,9 @@ public class EmsCoreDBLoader {
|
||||
private void discoverAllConnections(MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
||||
|
||||
ArrayList<Callable<Void>> futureTasks = new ArrayList<>();
|
||||
for (AvailableConnectionsModel model : settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(true)) {
|
||||
for (AvailableConnectionModel model : settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(true)) {
|
||||
|
||||
AtomicReference<AvailableConnectionsModel> modelAtomicReference = new AtomicReference<>(model);
|
||||
AtomicReference<AvailableConnectionModel> modelAtomicReference = new AtomicReference<>(model);
|
||||
|
||||
futureTasks.add(() -> {
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package it.integry.ems.adapter;
|
||||
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class XmlLocalDateAdapter extends XmlAdapter<String, LocalDate> {
|
||||
|
||||
private DateTimeFormatter sdf;
|
||||
|
||||
public XmlLocalDateAdapter() {
|
||||
sdf = DateTimeFormatter.ofPattern("dd-MM-yyyy");
|
||||
}
|
||||
|
||||
public XmlLocalDateAdapter(String format) {
|
||||
sdf = DateTimeFormatter.ofPattern(format);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String marshal(LocalDate arg0) throws Exception {
|
||||
return arg0.format(sdf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDate unmarshal(String arg0) throws Exception {
|
||||
String format = UtilityString.determineDateFormat(arg0);
|
||||
if (format != null && !"dd-MM-yyyy".equals(format))
|
||||
sdf = DateTimeFormatter.ofPattern(format);
|
||||
return LocalDate.parse(arg0,sdf);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package it.integry.ems.adapter;
|
||||
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class XmlLocalDateTimeAdapter extends XmlAdapter<String, LocalDateTime> {
|
||||
|
||||
private DateTimeFormatter sdf;
|
||||
|
||||
public XmlLocalDateTimeAdapter() {
|
||||
sdf = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss");
|
||||
}
|
||||
|
||||
public XmlLocalDateTimeAdapter(String format) {
|
||||
sdf = DateTimeFormatter.ofPattern(format);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String marshal(LocalDateTime arg0) throws Exception {
|
||||
return arg0.format(sdf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDateTime unmarshal(String arg0) throws Exception {
|
||||
String format = UtilityString.determineDateFormat(arg0);
|
||||
if (format != null && !"dd-MM-yyyy HH:mm:ss".equals(format))
|
||||
sdf = DateTimeFormatter.ofPattern(format);
|
||||
return LocalDateTime.parse(arg0,sdf);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
package it.integry.ems.configuration;
|
||||
|
||||
import it.integry.annotations.CustomerComponent;
|
||||
import it.integry.annotations.CustomerService;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.core.type.filter.AnnotationTypeFilter;
|
||||
|
||||
/**
|
||||
* Configurazione per registrare gli scope personalizzati per customer specifici
|
||||
*/
|
||||
@Configuration
|
||||
public class CustomerServicesConfig implements ApplicationListener<ContextRefreshedEvent> {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
@Autowired
|
||||
private SettingsModel settingsModel;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
// Assicuriamoci che sia il context principale e non un sub-context
|
||||
if (event.getApplicationContext() == applicationContext) {
|
||||
registerCustomerBeans();
|
||||
}
|
||||
}
|
||||
|
||||
private void registerCustomerBeans() {
|
||||
ClassPathScanningCandidateComponentProvider scanner =
|
||||
new ClassPathScanningCandidateComponentProvider(false);
|
||||
|
||||
// Aggiungo filtri per le annotazioni custom
|
||||
scanner.addIncludeFilter(new AnnotationTypeFilter(CustomerService.class));
|
||||
scanner.addIncludeFilter(new AnnotationTypeFilter(CustomerComponent.class));
|
||||
|
||||
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) applicationContext.getAutowireCapableBeanFactory();
|
||||
|
||||
// Scansiono tutti i package del progetto
|
||||
for (BeanDefinition bd : scanner.findCandidateComponents("it.integry")) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(bd.getBeanClassName());
|
||||
String beanName = generateBeanName(clazz);
|
||||
|
||||
IntegryCustomer customer = extractCustomer(clazz);
|
||||
|
||||
// Ora SettingsModel è completamente inizializzato con @PostConstruct chiamato
|
||||
if (!settingsModel.getDefaultProfile().equalsIgnoreCase(customer.toString())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Evito duplicati controllando se il bean esiste già
|
||||
if (!registry.containsBeanDefinition(beanName)) {
|
||||
logger.trace("Registering custom bean for customer: " + customer + " - Class: " + clazz.getSimpleName());
|
||||
|
||||
// Creo la definizione del bean
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(clazz);
|
||||
|
||||
// Registro il bean nel registry di Spring
|
||||
registry.registerBeanDefinition(beanName, builder.getBeanDefinition());
|
||||
|
||||
// Determino lo scope del bean per decidere se istanziarlo immediatamente
|
||||
String beanScope = determineBeanScope(clazz);
|
||||
|
||||
if (shouldInstantiateImmediately(beanScope)) {
|
||||
// Forzo l'istanziazione immediata solo per bean con scope appropriati
|
||||
try {
|
||||
Object beanInstance = applicationContext.getBean(beanName);
|
||||
logger.info("Bean customer {} istanziato con successo: {} (scope: {})",
|
||||
customer, beanInstance.getClass().getSimpleName(), beanScope);
|
||||
} catch (Exception e) {
|
||||
logger.error("Errore durante l'istanziazione del bean {} (scope: {}): {}",
|
||||
beanName, beanScope, e.getMessage());
|
||||
}
|
||||
} else {
|
||||
logger.info("Bean customer {} registrato ma non istanziato (scope: {}). " +
|
||||
"Verrà istanziato quando richiesto", customer, beanScope);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
logger.error("Impossibile caricare la classe: " + bd.getBeanClassName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera il nome del bean basato sul nome della classe
|
||||
*/
|
||||
private String generateBeanName(Class<?> clazz) {
|
||||
String simpleName = clazz.getSimpleName();
|
||||
return Character.toLowerCase(simpleName.charAt(0)) + simpleName.substring(1);
|
||||
}
|
||||
|
||||
private IntegryCustomer extractCustomer(Class<?> clazz) {
|
||||
if (clazz.isAnnotationPresent(CustomerService.class)) {
|
||||
CustomerService cs = clazz.getAnnotation(CustomerService.class);
|
||||
return cs.value();
|
||||
} else if (clazz.isAnnotationPresent(CustomerComponent.class)) {
|
||||
CustomerComponent cc = clazz.getAnnotation(CustomerComponent.class);
|
||||
return cc.value();
|
||||
}
|
||||
return IntegryCustomer.Integry; // Valore di default
|
||||
}
|
||||
|
||||
/**
|
||||
* Determina lo scope del bean analizzando le annotazioni della classe
|
||||
*/
|
||||
private String determineBeanScope(Class<?> clazz) {
|
||||
// Controllo per @Scope
|
||||
if (clazz.isAnnotationPresent(org.springframework.context.annotation.Scope.class)) {
|
||||
org.springframework.context.annotation.Scope scopeAnnotation =
|
||||
clazz.getAnnotation(org.springframework.context.annotation.Scope.class);
|
||||
return scopeAnnotation.value();
|
||||
}
|
||||
|
||||
// Controllo per @RequestScope
|
||||
if (clazz.isAnnotationPresent(org.springframework.web.context.annotation.RequestScope.class)) {
|
||||
return "request";
|
||||
}
|
||||
|
||||
// Controllo per @SessionScope
|
||||
if (clazz.isAnnotationPresent(org.springframework.web.context.annotation.SessionScope.class)) {
|
||||
return "session";
|
||||
}
|
||||
|
||||
// Controllo per @ApplicationScope
|
||||
if (clazz.isAnnotationPresent(org.springframework.web.context.annotation.ApplicationScope.class)) {
|
||||
return "application";
|
||||
}
|
||||
|
||||
// Default è singleton
|
||||
return "singleton";
|
||||
}
|
||||
|
||||
/**
|
||||
* Determina se il bean può essere istanziato immediatamente in base al suo scope
|
||||
*/
|
||||
private boolean shouldInstantiateImmediately(String scope) {
|
||||
switch (scope.toLowerCase()) {
|
||||
case "request":
|
||||
case "session":
|
||||
// I bean con scope request/session non possono essere istanziati
|
||||
// al di fuori del contesto web
|
||||
return false;
|
||||
case "prototype":
|
||||
// I bean prototype non vengono istanziati automaticamente
|
||||
return false;
|
||||
case "singleton":
|
||||
case "application":
|
||||
default:
|
||||
// Singleton e application possono essere istanziati immediatamente
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package it.integry.ems.configuration;
|
||||
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
|
||||
@Configuration
|
||||
@EnableScheduling // Equivale a <task:annotation-driven/>
|
||||
public class SchedulerConfig {
|
||||
|
||||
@Bean
|
||||
public ThreadPoolTaskScheduler taskScheduler() {
|
||||
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
||||
scheduler.setPoolSize(5); // Equivale a pool-size="5"
|
||||
scheduler.setThreadNamePrefix("taskScheduler-");
|
||||
scheduler.initialize();
|
||||
return scheduler;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -552,7 +552,7 @@ public class EmsController {
|
||||
@RequestParam(required = false, defaultValue = "true") boolean headless,
|
||||
@RequestBody(required = false) JsonNode body) throws Exception {
|
||||
|
||||
EntityExportResponse<?> entityExportResponse = emsServices.export(typeExport, formatExport, body, headless);
|
||||
EntityExportResponse<?> entityExportResponse = emsServices.export(multiDBTransactionManager, requestDataDTO, typeExport, formatExport, body, headless);
|
||||
List<AnomalieDTO> anomalie = new ArrayList<>();
|
||||
|
||||
if (entityExportResponse != null && entityExportResponse.getAnomalie() != null && !entityExportResponse.getAnomalie().isEmpty())
|
||||
@@ -608,7 +608,7 @@ public class EmsController {
|
||||
@RequestParam(required = false, defaultValue = "true") boolean headless,
|
||||
@RequestBody(required = false) ImportRequestDTO requestBody) throws Exception {
|
||||
|
||||
EntityImportResponse<List<EntityBase>> importResponse = emsServices.importEntity(importType, importFormat, requestBody, headless);
|
||||
EntityImportResponse<List<EntityBase>> importResponse = emsServices.importEntity(multiDBTransactionManager, requestDataDTO, importType, importFormat, requestBody, headless);
|
||||
List<EntityBase> entities = importResponse.getResponse();
|
||||
|
||||
|
||||
@@ -733,7 +733,7 @@ public class EmsController {
|
||||
@PathVariable String filename,
|
||||
@RequestParam(name = "contentDisposition", defaultValue = "attachment") String contentDispositionType,
|
||||
@RequestParam(defaultValue = "false") boolean requestThumbnail) throws Exception {
|
||||
AttachmentDTO attachmentDTO = emsServices.downloadStbFileAttachment(idAttach, requestThumbnail);
|
||||
AttachmentDTO attachmentDTO = emsServices.downloadStbFileAttachment(multiDBTransactionManager, idAttach, requestThumbnail);
|
||||
|
||||
if (attachmentDTO != null) {
|
||||
return ResponseEntity.ok()
|
||||
@@ -754,7 +754,7 @@ public class EmsController {
|
||||
public ResponseEntity<byte[]> downloadFileFromRefUuid(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam() String refUuid,
|
||||
@RequestParam() String fileName) throws Exception {
|
||||
AttachmentDTO attached = emsServices.downloadFileFromRefUuid(refUuid, fileName);
|
||||
AttachmentDTO attached = emsServices.downloadFileFromRefUuid(multiDBTransactionManager, refUuid, fileName);
|
||||
|
||||
if (attached == null) return ResponseEntity.notFound().build();
|
||||
|
||||
@@ -774,7 +774,7 @@ public class EmsController {
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String idAttach,
|
||||
@RequestParam(defaultValue = "false") boolean requestThumbnail) throws Exception {
|
||||
AttachmentDTO attachmentDTO = emsServices.downloadStbFileAttachment(idAttach, requestThumbnail);
|
||||
AttachmentDTO attachmentDTO = emsServices.downloadStbFileAttachment(multiDBTransactionManager, idAttach, requestThumbnail);
|
||||
|
||||
if (attachmentDTO != null) {
|
||||
return ResponseEntity.ok()
|
||||
@@ -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);
|
||||
@@ -892,7 +892,7 @@ public class EmsController {
|
||||
@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);
|
||||
@@ -927,7 +927,7 @@ public class EmsController {
|
||||
throw new Exception("Sono stati inviati più file del previsto");
|
||||
}
|
||||
|
||||
StbFilesAttached stbFilesAttached = emsServices.uploadStbFilesAttached(idAttach,
|
||||
StbFilesAttached stbFilesAttached = emsServices.uploadStbFilesAttached(multiDBTransactionManager, idAttach,
|
||||
files[0].getOriginalFilename(),
|
||||
files[0].getBytes(),
|
||||
descrizione,
|
||||
@@ -1043,7 +1043,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 +1095,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()
|
||||
@@ -1106,7 +1106,7 @@ public class EmsController {
|
||||
.setCodDtip(codDtip);
|
||||
drlDocAttached.setOperation(OperationType.INSERT);
|
||||
|
||||
StbFilesAttached stbFilesAttached = emsServices.uploadStbFilesAttached(idAttach,
|
||||
StbFilesAttached stbFilesAttached = emsServices.uploadStbFilesAttached(multiDBTransactionManager, idAttach,
|
||||
files[0].getOriginalFilename(),
|
||||
files[0].getBytes(),
|
||||
descrizione,
|
||||
@@ -1125,7 +1125,7 @@ public class EmsController {
|
||||
@RequestMapping(value = "createZipFromFiles", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse createZipFromFiles(@RequestBody CreateZipDTO createZipDTO) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(emsServices.createZipFromFiles(createZipDTO));
|
||||
return ServiceRestResponse.createPositiveResponse(emsServices.createZipFromFiles(multiDBTransactionManager, createZipDTO));
|
||||
}
|
||||
|
||||
// @RequestMapping(value = EmsRestConstants.PATH_UPLOAD_STB_EMAIL_CONTENT, method = RequestMethod.POST)
|
||||
@@ -1171,22 +1171,10 @@ public class EmsController {
|
||||
// }
|
||||
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_CLEAN_DIRECTORIES, method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse cleanDirectories(@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
|
||||
try {
|
||||
emsServices.cleanDirectories();
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryConnection().getProfileName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_EXPORT_SERVER_INFO_ISCC, method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse exportServerInfoISCC(@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
|
||||
emsServices.checkServerVariables();
|
||||
emsServices.checkServerVariables(multiDBTransactionManager);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.integry.ems.datasource;
|
||||
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
@@ -13,13 +13,13 @@ import java.util.HashMap;
|
||||
|
||||
public class DataSource extends BasicDataSource {
|
||||
|
||||
private AvailableConnectionsModel connectionModel;
|
||||
private AvailableConnectionModel connectionModel;
|
||||
|
||||
/**
|
||||
* Instanzia un nuovo datasource.
|
||||
*
|
||||
* @deprecated Il datasource non deve essere istanziato direttamente ma bisogna utilizzare il metodo
|
||||
* {@link it.integry.ems.sync.MultiDBTransaction.BasicConnectionPool#getConnection(AvailableConnectionsModel)} per ottenere una connessione.
|
||||
* {@link it.integry.ems.sync.MultiDBTransaction.BasicConnectionPool#getConnection(AvailableConnectionModel)} per ottenere una connessione.
|
||||
*/
|
||||
@Deprecated
|
||||
public DataSource() {
|
||||
@@ -62,12 +62,12 @@ public class DataSource extends BasicDataSource {
|
||||
}
|
||||
|
||||
public synchronized void initialize(String profileDB) throws Exception {
|
||||
AvailableConnectionsModel connectionsModel = SettingsModel.getInstance().findConnectionModel(profileDB);
|
||||
AvailableConnectionModel connectionsModel = SettingsModel.getInstance().findConnectionModel(profileDB);
|
||||
|
||||
initialize(connectionsModel);
|
||||
}
|
||||
|
||||
public synchronized void initialize(AvailableConnectionsModel connectionModel) throws Exception {
|
||||
public synchronized void initialize(AvailableConnectionModel connectionModel) throws Exception {
|
||||
if (connectionModel == null) {
|
||||
throw new Exception("Configurazione DB non trovata");
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import it.integry.ems.utility.UtilityFile;
|
||||
import it.integry.ems_model.entity.StbFilesAttached;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
@@ -16,7 +15,6 @@ import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
public class DownloadFileHandlerService {
|
||||
@@ -26,12 +24,6 @@ public class DownloadFileHandlerService {
|
||||
|
||||
private final HashMap<String, CachedFileDto> mFileMap = new HashMap<>();
|
||||
|
||||
@Scheduled(fixedDelay = 1, timeUnit = TimeUnit.HOURS, zone = "Europe/Rome")
|
||||
public void clean() {
|
||||
UtilityFile.cleanDirectory(getTempPath(), 1, "");
|
||||
}
|
||||
|
||||
|
||||
public DownloadFileDto generateDownloadItem(File file) throws IOException {
|
||||
return generateDownloadItem(file.getName(), FileUtils.readFileToByteArray(file), false);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.ems.dto;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
public class ExtendedStbActivity {
|
||||
@@ -14,11 +15,9 @@ public class ExtendedStbActivity {
|
||||
private String userCreator;
|
||||
private String note;
|
||||
private String activityDescription;
|
||||
private Date dataInsAct;
|
||||
private int priorita;
|
||||
private Date alarmDate;
|
||||
private Date alarmTime;
|
||||
private Date oraInsAct;
|
||||
private LocalDateTime alarmTime;
|
||||
private LocalDateTime oraInsAct;
|
||||
private String activityTypeId;
|
||||
private String parentActivityId;
|
||||
private StbActivityEmailObject emailObject;
|
||||
@@ -116,15 +115,6 @@ public class ExtendedStbActivity {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataInsAct() {
|
||||
return dataInsAct;
|
||||
}
|
||||
|
||||
public ExtendedStbActivity setDataInsAct(Date dataInsAct) {
|
||||
this.dataInsAct = dataInsAct;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getPriorita() {
|
||||
return priorita;
|
||||
}
|
||||
@@ -134,29 +124,20 @@ public class ExtendedStbActivity {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getAlarmDate() {
|
||||
return alarmDate;
|
||||
}
|
||||
|
||||
public ExtendedStbActivity setAlarmDate(Date alarmDate) {
|
||||
this.alarmDate = alarmDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getAlarmTime() {
|
||||
public LocalDateTime getAlarmTime() {
|
||||
return alarmTime;
|
||||
}
|
||||
|
||||
public ExtendedStbActivity setAlarmTime(Date alarmTime) {
|
||||
public ExtendedStbActivity setAlarmTime(LocalDateTime alarmTime) {
|
||||
this.alarmTime = alarmTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getOraInsAct() {
|
||||
public LocalDateTime getOraInsAct() {
|
||||
return oraInsAct;
|
||||
}
|
||||
|
||||
public ExtendedStbActivity setOraInsAct(Date oraInsAct) {
|
||||
public ExtendedStbActivity setOraInsAct(LocalDateTime oraInsAct) {
|
||||
this.oraInsAct = oraInsAct;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package it.integry.ems.dynamic_cache;
|
||||
import it.integry.ems.expansion.RunnableArgsWithReturn;
|
||||
import it.integry.ems.expansion.RunnableWithReturn;
|
||||
import it.integry.ems.looper.service.LooperService;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
@@ -51,11 +51,11 @@ public class DynamicCacheService {
|
||||
List<String> finalDbNames = dbNames.stream().map(String::toLowerCase).collect(Collectors.toList());
|
||||
RunnableWithReturn<Object> internalRefreshAction = () -> {
|
||||
|
||||
Map<String, List<AvailableConnectionsModel>> databases = settingsModel.getAvailableConnections()
|
||||
Map<String, List<AvailableConnectionModel>> databases = settingsModel.getAvailableConnections()
|
||||
.stream()
|
||||
.filter(AvailableConnectionsModel::getInternalDb)
|
||||
.filter(AvailableConnectionModel::getInternalDb)
|
||||
.filter(x -> finalDbNames.contains(x.getDbName().toLowerCase()))
|
||||
.collect(Collectors.groupingBy(AvailableConnectionsModel::getDbName));
|
||||
.collect(Collectors.groupingBy(AvailableConnectionModel::getDbName));
|
||||
|
||||
final HashMap<String, T> cachedDataByDB = new HashMap<>();
|
||||
|
||||
@@ -83,11 +83,11 @@ public class DynamicCacheService {
|
||||
|
||||
RunnableWithReturn<Object> refreshAction = () -> {
|
||||
|
||||
Map<String, List<AvailableConnectionsModel>> databases = settingsModel.getAvailableConnections()
|
||||
Map<String, List<AvailableConnectionModel>> databases = settingsModel.getAvailableConnections()
|
||||
.stream()
|
||||
.filter(AvailableConnectionsModel::getInternalDb)
|
||||
.filter(AvailableConnectionModel::getInternalDb)
|
||||
.filter(x -> finalDbNames.contains(x.getDbName().toLowerCase()))
|
||||
.collect(Collectors.groupingBy(AvailableConnectionsModel::getDbName));
|
||||
.collect(Collectors.groupingBy(AvailableConnectionModel::getDbName));
|
||||
|
||||
final HashMap<String, List<? extends EntityBase>> cachedEntitiesByDB = new HashMap<>();
|
||||
|
||||
@@ -138,11 +138,11 @@ public class DynamicCacheService {
|
||||
|
||||
RunnableWithReturn<Object> refreshAction = () -> {
|
||||
|
||||
Map<String, List<AvailableConnectionsModel>> databases = settingsModel.getAvailableConnections()
|
||||
Map<String, List<AvailableConnectionModel>> databases = settingsModel.getAvailableConnections()
|
||||
.stream()
|
||||
.filter(AvailableConnectionsModel::getInternalDb)
|
||||
.filter(AvailableConnectionModel::getInternalDb)
|
||||
.filter(x -> finalDbNames.contains(x.getDbName().toLowerCase()))
|
||||
.collect(Collectors.groupingBy(AvailableConnectionsModel::getDbName));
|
||||
.collect(Collectors.groupingBy(AvailableConnectionModel::getDbName));
|
||||
|
||||
final HashMap<String, List<?>> cacheQueryByDB = new HashMap<>();
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import it.integry.annotations.PostContextConstruct;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.component.SQLServerDBSchemaManager;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.*;
|
||||
import it.integry.ems.looper.service.LooperService;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.settings.SettingsController;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
@@ -57,7 +57,7 @@ public class EntityLoggerComponent {
|
||||
|
||||
private void syncDBScheme() throws Exception {
|
||||
|
||||
AvailableConnectionsModel connectionsModel = settingsModel.getDefaultConnectionModel();
|
||||
AvailableConnectionModel connectionsModel = settingsModel.getDefaultConnectionModel();
|
||||
|
||||
if (connectionsModel == null) {
|
||||
throw new Exception("Impossibile ricavare la default connection");
|
||||
@@ -107,7 +107,7 @@ public class EntityLoggerComponent {
|
||||
}
|
||||
|
||||
if (settingsModel.getAvailableConnections().stream().noneMatch(x -> x.getDbName().equalsIgnoreCase(destDBName))) {
|
||||
settingsModel.addAvailableConnection(new AvailableConnectionsModel()
|
||||
settingsModel.addAvailableConnection(new AvailableConnectionModel()
|
||||
.setInternalDb(false)
|
||||
.setHost(dbHost)
|
||||
.setUsername(dbUsername)
|
||||
@@ -210,12 +210,12 @@ public class EntityLoggerComponent {
|
||||
return;
|
||||
|
||||
try {
|
||||
List<AvailableConnectionsModel> connectionsModels = settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(true);
|
||||
List<AvailableConnectionModel> connectionsModels = settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(true);
|
||||
String historyProfileDB = settingsController.getHistoryProfileDb();
|
||||
|
||||
try (MultiDBTransactionManager historyMultiDB = new MultiDBTransactionManager(historyProfileDB)) {
|
||||
|
||||
for (AvailableConnectionsModel sourceConnectionModel : connectionsModels) {
|
||||
for (AvailableConnectionModel sourceConnectionModel : connectionsModels) {
|
||||
String sql = "SELECT * FROM stb_log_entity_setup" +
|
||||
" WHERE entity_name <> " + UtilityDB.valueToString(StbLogEntitySetup.ENTITY);
|
||||
|
||||
|
||||
@@ -42,14 +42,14 @@ public class RequestDataDTO {
|
||||
private String password;
|
||||
private boolean includeNulls = false;
|
||||
|
||||
private IntegryApplicationEnum integryApplication = IntegryApplicationEnum.PVM;
|
||||
private IntegryApplicationEnum integryApplication;
|
||||
|
||||
private UserDTO userDTO;
|
||||
|
||||
@PostConstruct
|
||||
public void init() throws IOException, InterruptedException {
|
||||
|
||||
if (request != null && request.getQueryString() != null && request.getQueryString().contains(CommonConstants.PROFILE_DB)) {
|
||||
if (request != null && request.getParameter(CommonConstants.PROFILE_DB) != null) {
|
||||
profileDB = request.getParameter(CommonConstants.PROFILE_DB);
|
||||
} else if (request != null && request.getHeader(CommonConstants.PROFILE_DB) != null) {
|
||||
profileDB = request.getHeader(CommonConstants.PROFILE_DB);
|
||||
@@ -98,6 +98,12 @@ public class RequestDataDTO {
|
||||
.setPassword("sql");
|
||||
}
|
||||
|
||||
public static RequestDataDTO scheduledOperationsMockupData() {
|
||||
return new RequestDataDTO()
|
||||
.setUsername("INTEGRY")
|
||||
.setPassword("INTEGRY");
|
||||
}
|
||||
|
||||
public boolean isValidProfileDB() {
|
||||
return !UtilityString.isNullOrEmpty(profileDB);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package it.integry.ems.license;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -11,7 +12,6 @@ import java.util.Random;
|
||||
|
||||
public class LicenseCheckInterceptor extends HandlerInterceptorAdapter {
|
||||
|
||||
|
||||
@Autowired
|
||||
private LicenseComponent licenseComponent;
|
||||
|
||||
@@ -19,13 +19,9 @@ public class LicenseCheckInterceptor extends HandlerInterceptorAdapter {
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response, Object handler) {
|
||||
|
||||
RequestDataDTO requestData = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class);
|
||||
|
||||
String profileDB = null;
|
||||
if (request != null && request.getQueryString() != null && request.getQueryString().contains(CommonConstants.PROFILE_DB)) {
|
||||
profileDB = request.getParameter(CommonConstants.PROFILE_DB);
|
||||
} else if (request != null && request.getHeader(CommonConstants.PROFILE_DB) != null) {
|
||||
profileDB = request.getHeader(CommonConstants.PROFILE_DB);
|
||||
}
|
||||
String profileDB = requestData.getProfileDB();
|
||||
|
||||
LicenseStatusDTO licenseStatusDTO = null;
|
||||
if (profileDB != null) licenseStatusDTO = licenseComponent.getLicenseStatus(profileDB);
|
||||
|
||||
@@ -8,7 +8,7 @@ import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.response.EsitoType;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.service.HttpRestWrapper;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
@@ -25,6 +25,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Component
|
||||
@@ -59,11 +60,11 @@ public class LicenseComponent {
|
||||
if (!canStart)
|
||||
return;
|
||||
|
||||
List<AvailableConnectionsModel> availableConnectionsModels = settingsModel.getAvailableConnections(true);
|
||||
List<AvailableConnectionModel> availableConnectionModels = settingsModel.getAvailableConnections(true);
|
||||
|
||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager()) {
|
||||
|
||||
for (AvailableConnectionsModel model : availableConnectionsModels) {
|
||||
for (AvailableConnectionModel model : availableConnectionModels) {
|
||||
multiDBTransactionManager.addConnection(model);
|
||||
}
|
||||
|
||||
@@ -105,14 +106,19 @@ public class LicenseComponent {
|
||||
} else {
|
||||
List<LicenseStatusDTO> licenses = response.getDTO(new TypeReference<List<LicenseStatusDTO>>() {
|
||||
});
|
||||
if (licenses == null) return;
|
||||
if (licenses == null || licenses.isEmpty()) return;
|
||||
|
||||
listAziende.forEach((key, value) -> {
|
||||
cachedLicenseStatus.remove(key);
|
||||
|
||||
licenses.stream().filter(x -> x.getPartIva().equalsIgnoreCase(value))
|
||||
.findFirst()
|
||||
.ifPresent(license -> cachedLicenseStatus.put(key, license));
|
||||
final Optional<LicenseStatusDTO> licenseSearch = licenses.stream().filter(x -> x.getPartIva().equalsIgnoreCase(value))
|
||||
.findFirst();
|
||||
|
||||
if (licenseSearch.isPresent()) {
|
||||
cachedLicenseStatus.put(key, licenseSearch.get());
|
||||
} else {
|
||||
cachedLicenseStatus.put(key, licenses.get(0));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,10 +10,13 @@ import java.util.Date;
|
||||
public class LicenseStatusDTO {
|
||||
@SqlField("part_iva")
|
||||
private String partIva;
|
||||
|
||||
@SqlField("classe_merito")
|
||||
private Quality quality;
|
||||
|
||||
@SqlField
|
||||
private Status status;
|
||||
|
||||
@SqlField("data_scad_license")
|
||||
private Date expiringDate;
|
||||
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import it.integry.ems_model.exception.DataConverterNotFoundException;
|
||||
import it.integry.ems_model.rulescompleting.DroolsDataCompleting;
|
||||
import it.integry.ems_model.types.ApplicationName;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.types.TypeDbObject;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
@@ -154,6 +155,11 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
UtilityDB.createIndex(connection, indexTableDTO);
|
||||
}
|
||||
|
||||
|
||||
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 {
|
||||
UtilityDB.dropIndex(connection, tableName, indexName);
|
||||
}
|
||||
@@ -594,4 +600,38 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
protected boolean isSqlServer2022() throws Exception {
|
||||
return getSqlCompatibilityLevel() == DatabaseVersionEnum.SQLServer2022;
|
||||
}
|
||||
|
||||
protected void addDescriptionTable(String tableName, String description) throws SQLException {
|
||||
if (existsTable(tableName)) {
|
||||
addDescriptionObject(tableName, TypeDbObject.TABLE, description);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void addDescriptionView(String viewName, String description) throws SQLException {
|
||||
if (existsView(viewName)) {
|
||||
addDescriptionObject(viewName, TypeDbObject.VIEW, description);
|
||||
}
|
||||
}
|
||||
|
||||
private void addDescriptionObject(String objectName, TypeDbObject type, String description) throws SQLException {
|
||||
String typeString = "TABLE";
|
||||
|
||||
if (type == TypeDbObject.VIEW) {
|
||||
typeString = "VIEW";
|
||||
}
|
||||
executeStatement(
|
||||
Query.format("EXEC sp_addextendedproperty " +
|
||||
"@name = N'MS_Description', " +
|
||||
"@value = %s, " +
|
||||
"@level0type = N'SCHEMA', @level0name = 'dbo', " +
|
||||
"@level1type = %s, @level1name = %s;", description, typeString, objectName));
|
||||
}
|
||||
|
||||
private void addDescriptionColumn(String tableName, String columnName, String description) throws SQLException {
|
||||
executeStatement(Query.format("EXEC sp_addextendedproperty 'MS_Description', %s, 'SCHEMA', 'dbo', 'TABLE',%s, 'COLUMN', %s)",
|
||||
description, tableName, columnName));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ public enum IntegryCustomer {
|
||||
Biolevante(IntegryCustomerDB.Biolevante_Biolevante,
|
||||
IntegryCustomerDB.Biolevante_BiolevanteStorico,
|
||||
IntegryCustomerDB.Biolevante_TenutaSanMartino),
|
||||
CapelliMonelli(IntegryCustomerDB.CapelliMonelli_CapelliMonelli),
|
||||
Carelli(IntegryCustomerDB.Carelli_Carelli,
|
||||
IntegryCustomerDB.Carelli_GestFood,
|
||||
IntegryCustomerDB.Carelli_Chiuso,
|
||||
|
||||
@@ -24,6 +24,7 @@ public enum IntegryCustomerDB {
|
||||
Biolevante_BiolevanteStorico("biolevante_storico"),
|
||||
Biolevante_TenutaSanMartino("tenutasanmartino"),
|
||||
|
||||
CapelliMonelli_CapelliMonelli("capelli_monelli"),
|
||||
|
||||
Carelli_Carelli("carelli"),
|
||||
Carelli_GestFood("gestfood"),
|
||||
@@ -88,7 +89,7 @@ public enum IntegryCustomerDB {
|
||||
Frudis_Frudis("frudis"),
|
||||
|
||||
|
||||
Gramm_Gramm("gramm"),
|
||||
Gramm_Gramm("gramm_peppe"),
|
||||
Gramm_PrimeOlive("primeolive"),
|
||||
Gramm_ProveStage("grammprovestage"),
|
||||
Gramm_2MHolding("2M_HOLDING"),
|
||||
@@ -102,7 +103,7 @@ public enum IntegryCustomerDB {
|
||||
Igood_ShopService("shop_service"),
|
||||
|
||||
|
||||
Ime_ImeTe("ime_te"),
|
||||
Ime_ImeTe("ime_te_peppe"),
|
||||
|
||||
|
||||
Integry_Studioml("studioml"),
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
|
||||
@@ -14,7 +14,7 @@ public class Migration_20210721093948 extends BaseMigration implements Migration
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
AvailableConnectionsModel historyDBModel = settingsController.getHistoryDbConnectionModel();
|
||||
AvailableConnectionModel historyDBModel = settingsController.getHistoryDbConnectionModel();
|
||||
|
||||
if (!settingsModel.getDefaultProfile().equalsIgnoreCase(connection.getProfileName()))
|
||||
return;
|
||||
|
||||
@@ -2,7 +2,7 @@ package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
|
||||
@@ -14,7 +14,7 @@ public class Migration_20210924152555 extends BaseMigration implements Migration
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
AvailableConnectionsModel historyDBModel = settingsController.getHistoryDbConnectionModel();
|
||||
AvailableConnectionModel historyDBModel = settingsController.getHistoryDbConnectionModel();
|
||||
|
||||
if (!settingsModel.getDefaultProfile().equalsIgnoreCase(connection.getProfileName()))
|
||||
return;
|
||||
|
||||
@@ -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,33 @@
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
MigrationMvwSitArtUdcDetInventarioDTO.alignGiacenza(connection);
|
||||
}
|
||||
|
||||
@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 {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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_20250827114912 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Ime_ImeTe) || isCustomerDb(IntegryCustomerDB.Materica_ImeBa)) {
|
||||
updateSetupValue("W_PORDI_RC", "SETUP", "CHECK_DEP_TERZISTA", "S");
|
||||
updateSetupValue("DTB_ORDT", "SETUP", "DISABLE_TRIGGER_ORDL", "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.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250827151739 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (existsColumn("dtb_ord_log_import", "id")) return;
|
||||
|
||||
executeStatement(
|
||||
"exec dropPrimaryKey 'dtb_ord_log_import'",
|
||||
"alter table dtb_ord_log_import add id bigint identity",
|
||||
"alter table dtb_ord_log_import add constraint pk_dtb_ord_log_import primary key (id)");
|
||||
}
|
||||
|
||||
@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_20250828100041 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"alter table ntb_docr add val_sco_art numeric(20,5);",
|
||||
"alter table mtb_depo_casse add last_idx int;",
|
||||
"Create table ntb_docs ( " +
|
||||
" id bigint identity not null, " +
|
||||
" cod_mdep varchar(5) not null, " +
|
||||
" cod_cassa varchar(5) not null, " +
|
||||
" data_doc datetime not null, " +
|
||||
" id_riga int not null, " +
|
||||
" promozione varchar(40) not null , " +
|
||||
" val_sco numeric(20,5) not null default 0); ",
|
||||
"alter table ntb_docs add constraint pk_ntb_docs primary key (id)",
|
||||
"alter table ntb_docs add constraint fk_ntb_docs_ntb_docr foreign key (cod_mdep, cod_cassa, data_doc, id_riga) references ntb_docr (cod_mdep, cod_cassa, data_doc, id_riga);"
|
||||
);
|
||||
}
|
||||
|
||||
@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.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250828145642 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("IMPORT_SCONTRINI", "MMPOS_SERVICES", "PROFILE_DB", null,
|
||||
"Inserire il profile del db a cui collegarsi", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Carelli_Carelli) && isCustomerDb(IntegryCustomerDB.Carelli_GestFood) ) {
|
||||
updateSetupValue("IMPORT_SCONTRINI", "MMPOS_SERVICES", "PROFILE_DB", "MMPOS");
|
||||
}else if (isCustomerDb(IntegryCustomerDB.Carelli_Murgia) && isCustomerDb(IntegryCustomerDB.Carelli_GestFood) ) {
|
||||
updateSetupValue("IMPORT_SCONTRINI", "MMPOS_SERVICES", "PROFILE_DB", "MMPOS_FORNO");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ public class Migration_20250908160026 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateView("cvw_marg_contr_com", "CREATE VIEW [dbo].[cvw_marg_contr_com] (cod_jcom,descrizione,costo_lavorazione,costo_materiali,costo_servizi,altri_costi,ricavi,ore_lavorazione, data) AS \n" +
|
||||
"SELECT jtb_rlavr.cod_jcom AS cod_jcom,\n" +
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
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_20250909112137 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("IMPORT_ORDINI LAVORAZIONE", "MAXIDATA", "ATTIVO", null, "Flag che abilita l'utilizzo delle API di UVE2K", "SI_NO");
|
||||
createSetup("IMPORT_ORDINI LAVORAZIONE", "MAXIDATA", "UVE2K_JWT_ACCESS_TOKEN", null, "Access token utile per autenticarsi sulle API di UVE2K", null);
|
||||
createSetup("IMPORT_ORDINI LAVORAZIONE", "MAXIDATA", "UVE2K_URL_BASE_PATH", null, "URL base delle API di UVE2K", null);
|
||||
createSetup("IMPORT_ORDINI LAVORAZIONE", "MAXIDATA", "UVE2K_COMPANY_ID", null, "Company ID di UVE2K", null);
|
||||
createSetup("IMPORT_ORDINI LAVORAZIONE", "MAXIDATA", "UVE2K_APP_CLIENT_ID", null, "App Client ID di UVE2K", null);
|
||||
createSetup("IMPORT_ORDINI LAVORAZIONE", "MAXIDATA", "UVE2K_USERNAME", null, "Username di accesso a UVE2K", null);
|
||||
createSetup("IMPORT_ORDINI LAVORAZIONE", "MAXIDATA", "UVE2K_PASSWORD", null, "Password di accesso a UVE2K", null);
|
||||
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Lamonarca_Lamonarca)) {
|
||||
updateSetupValue("IMPORT_ORDINI LAVORAZIONE", "MAXIDATA", "ATTIVO", "S");
|
||||
updateSetupValue("IMPORT_ORDINI LAVORAZIONE", "MAXIDATA", "UVE2K_URL_BASE_PATH", "https://bluetech02.maxidata.net/uve2k.blue.srv1/");
|
||||
updateSetupValue("IMPORT_ORDINI LAVORAZIONE", "MAXIDATA", "UVE2K_COMPANY_ID", "MAXI.MAXI.LAMON.00001");
|
||||
updateSetupValue("IMPORT_ORDINI LAVORAZIONE", "MAXIDATA", "UVE2K_APP_CLIENT_ID", "uve2k.Blue");
|
||||
updateSetupValue("IMPORT_ORDINI LAVORAZIONE", "MAXIDATA", "UVE2K_USERNAME", "Integry.Lamonarca");
|
||||
updateSetupValue("IMPORT_ORDINI LAVORAZIONE", "MAXIDATA", "UVE2K_PASSWORD", "Bt02Mes#2025");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@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,89 +10,90 @@ 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(
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'0T' WHERE cod_cmac = N'TANK00T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'1' WHERE cod_cmac = N'TANK01';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'1T' WHERE cod_cmac = N'TANK01T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'2' WHERE cod_cmac = N'TANK02';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'2T' WHERE cod_cmac = N'TANK02T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'3' WHERE cod_cmac = N'TANK03';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'3T' WHERE cod_cmac = N'TANK03T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'4' WHERE cod_cmac = N'TANK04';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'4T' WHERE cod_cmac = N'TANK04T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'5' WHERE cod_cmac = N'TANK05';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'5T' WHERE cod_cmac = N'TANK05T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'6' WHERE cod_cmac = N'TANK06';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'6T' WHERE cod_cmac = N'TANK06T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'7' WHERE cod_cmac = N'TANK07';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'7T' WHERE cod_cmac = N'TANK07T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'8T' WHERE cod_cmac = N'TANK08T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'9T' WHERE cod_cmac = N'TANK09T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'10T' WHERE cod_cmac = N'TANK10T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'11T' WHERE cod_cmac = N'TANK11T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'12T' WHERE cod_cmac = N'TANK12T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'13T' WHERE cod_cmac = N'TANK13T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'14T' WHERE cod_cmac = N'TANK14T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'15T' WHERE cod_cmac = N'TANK15T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'16T' WHERE cod_cmac = N'TANK16T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'17T' WHERE cod_cmac = N'TANK17T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'18T' WHERE cod_cmac = N'TANK18T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'19T' WHERE cod_cmac = N'TANK19T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'20T' WHERE cod_cmac = N'TANK20T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'22T' WHERE cod_cmac = N'TANK22T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'23T' WHERE cod_cmac = N'TANK23T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'24T' WHERE cod_cmac = N'TANK24T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'25T' WHERE cod_cmac = N'TANK25T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'26T' WHERE cod_cmac = N'TANK26T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'27T' WHERE cod_cmac = N'TANK27T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'28T' WHERE cod_cmac = N'TANK28T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'29T' WHERE cod_cmac = N'TANK29T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'30T' WHERE cod_cmac = N'TANK30T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'31T' WHERE cod_cmac = N'TANK31T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'32T' WHERE cod_cmac = N'TANK32T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'33T' WHERE cod_cmac = N'TANK33T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'34T' WHERE cod_cmac = N'TANK34T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'35T' WHERE cod_cmac = N'TANK35T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'36T' WHERE cod_cmac = N'TANK36T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'37T' WHERE cod_cmac = N'TANK37T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'38T' WHERE cod_cmac = N'TANK38T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'39T' WHERE cod_cmac = N'TANK39T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'40T' WHERE cod_cmac = N'TANK40T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'41T' WHERE cod_cmac = N'TANK41T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'42T' WHERE cod_cmac = N'TANK42T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'43T' WHERE cod_cmac = N'TANK43T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V1' WHERE cod_cmac = N'TANKV01';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V1T' WHERE cod_cmac = N'TANKV01T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V2' WHERE cod_cmac = N'TANKV02';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V2T' WHERE cod_cmac = N'TANKV02T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V3' WHERE cod_cmac = N'TANKV03';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V3T' WHERE cod_cmac = N'TANKV03T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V4' WHERE cod_cmac = N'TANKV04';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V4T' WHERE cod_cmac = N'TANKV04T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V5' WHERE cod_cmac = N'TANKV05';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V5T' WHERE cod_cmac = N'TANKV05T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V6' WHERE cod_cmac = N'TANKV06';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V6T' WHERE cod_cmac = N'TANKV06T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V7' WHERE cod_cmac = N'TANKV07';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V7T' WHERE cod_cmac = N'TANKV07T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V8' WHERE cod_cmac = N'TANKV08';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V8T' WHERE cod_cmac = N'TANKV08T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V9' WHERE cod_cmac = N'TANKV09';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V9T' WHERE cod_cmac = N'TANKV09T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V10' WHERE cod_cmac = N'TANKV10';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V0T' WHERE cod_cmac = N'TANKV10T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V11' WHERE cod_cmac = N'TANKV11';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V12' WHERE cod_cmac = N'TANKV12';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V13' WHERE cod_cmac = N'TANKV13';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V14' WHERE cod_cmac = N'TANKV14';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V15' WHERE cod_cmac = N'TANKV15';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V16' WHERE cod_cmac = N'TANKV16';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V17' WHERE cod_cmac = N'TANKV17';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V18' WHERE cod_cmac = N'TANKV18';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V19' WHERE cod_cmac = N'TANKV19';",
|
||||
"UPDATE ctb_amac SET posizione = N'0T' WHERE cod_cmac = N'TANK00T';",
|
||||
"UPDATE ctb_amac SET posizione = N'1' WHERE cod_cmac = N'TANK01';",
|
||||
"UPDATE ctb_amac SET posizione = N'1T' WHERE cod_cmac = N'TANK01T';",
|
||||
"UPDATE ctb_amac SET posizione = N'2' WHERE cod_cmac = N'TANK02';",
|
||||
"UPDATE ctb_amac SET posizione = N'2T' WHERE cod_cmac = N'TANK02T';",
|
||||
"UPDATE ctb_amac SET posizione = N'3' WHERE cod_cmac = N'TANK03';",
|
||||
"UPDATE ctb_amac SET posizione = N'3T' WHERE cod_cmac = N'TANK03T';",
|
||||
"UPDATE ctb_amac SET posizione = N'4' WHERE cod_cmac = N'TANK04';",
|
||||
"UPDATE ctb_amac SET posizione = N'4T' WHERE cod_cmac = N'TANK04T';",
|
||||
"UPDATE ctb_amac SET posizione = N'5' WHERE cod_cmac = N'TANK05';",
|
||||
"UPDATE ctb_amac SET posizione = N'5T' WHERE cod_cmac = N'TANK05T';",
|
||||
"UPDATE ctb_amac SET posizione = N'6' WHERE cod_cmac = N'TANK06';",
|
||||
"UPDATE ctb_amac SET posizione = N'6T' WHERE cod_cmac = N'TANK06T';",
|
||||
"UPDATE ctb_amac SET posizione = N'7' WHERE cod_cmac = N'TANK07';",
|
||||
"UPDATE ctb_amac SET posizione = N'7T' WHERE cod_cmac = N'TANK07T';",
|
||||
"UPDATE ctb_amac SET posizione = N'8T' WHERE cod_cmac = N'TANK08T';",
|
||||
"UPDATE ctb_amac SET posizione = N'9T' WHERE cod_cmac = N'TANK09T';",
|
||||
"UPDATE ctb_amac SET posizione = N'10T' WHERE cod_cmac = N'TANK10T';",
|
||||
"UPDATE ctb_amac SET posizione = N'11T' WHERE cod_cmac = N'TANK11T';",
|
||||
"UPDATE ctb_amac SET posizione = N'12T' WHERE cod_cmac = N'TANK12T';",
|
||||
"UPDATE ctb_amac SET posizione = N'13T' WHERE cod_cmac = N'TANK13T';",
|
||||
"UPDATE ctb_amac SET posizione = N'14T' WHERE cod_cmac = N'TANK14T';",
|
||||
"UPDATE ctb_amac SET posizione = N'15T' WHERE cod_cmac = N'TANK15T';",
|
||||
"UPDATE ctb_amac SET posizione = N'16T' WHERE cod_cmac = N'TANK16T';",
|
||||
"UPDATE ctb_amac SET posizione = N'17T' WHERE cod_cmac = N'TANK17T';",
|
||||
"UPDATE ctb_amac SET posizione = N'18T' WHERE cod_cmac = N'TANK18T';",
|
||||
"UPDATE ctb_amac SET posizione = N'19T' WHERE cod_cmac = N'TANK19T';",
|
||||
"UPDATE ctb_amac SET posizione = N'20T' WHERE cod_cmac = N'TANK20T';",
|
||||
"UPDATE ctb_amac SET posizione = N'22T' WHERE cod_cmac = N'TANK22T';",
|
||||
"UPDATE ctb_amac SET posizione = N'23T' WHERE cod_cmac = N'TANK23T';",
|
||||
"UPDATE ctb_amac SET posizione = N'24T' WHERE cod_cmac = N'TANK24T';",
|
||||
"UPDATE ctb_amac SET posizione = N'25T' WHERE cod_cmac = N'TANK25T';",
|
||||
"UPDATE ctb_amac SET posizione = N'26T' WHERE cod_cmac = N'TANK26T';",
|
||||
"UPDATE ctb_amac SET posizione = N'27T' WHERE cod_cmac = N'TANK27T';",
|
||||
"UPDATE ctb_amac SET posizione = N'28T' WHERE cod_cmac = N'TANK28T';",
|
||||
"UPDATE ctb_amac SET posizione = N'29T' WHERE cod_cmac = N'TANK29T';",
|
||||
"UPDATE ctb_amac SET posizione = N'30T' WHERE cod_cmac = N'TANK30T';",
|
||||
"UPDATE ctb_amac SET posizione = N'31T' WHERE cod_cmac = N'TANK31T';",
|
||||
"UPDATE ctb_amac SET posizione = N'32T' WHERE cod_cmac = N'TANK32T';",
|
||||
"UPDATE ctb_amac SET posizione = N'33T' WHERE cod_cmac = N'TANK33T';",
|
||||
"UPDATE ctb_amac SET posizione = N'34T' WHERE cod_cmac = N'TANK34T';",
|
||||
"UPDATE ctb_amac SET posizione = N'35T' WHERE cod_cmac = N'TANK35T';",
|
||||
"UPDATE ctb_amac SET posizione = N'36T' WHERE cod_cmac = N'TANK36T';",
|
||||
"UPDATE ctb_amac SET posizione = N'37T' WHERE cod_cmac = N'TANK37T';",
|
||||
"UPDATE ctb_amac SET posizione = N'38T' WHERE cod_cmac = N'TANK38T';",
|
||||
"UPDATE ctb_amac SET posizione = N'39T' WHERE cod_cmac = N'TANK39T';",
|
||||
"UPDATE ctb_amac SET posizione = N'40T' WHERE cod_cmac = N'TANK40T';",
|
||||
"UPDATE ctb_amac SET posizione = N'41T' WHERE cod_cmac = N'TANK41T';",
|
||||
"UPDATE ctb_amac SET posizione = N'42T' WHERE cod_cmac = N'TANK42T';",
|
||||
"UPDATE ctb_amac SET posizione = N'43T' WHERE cod_cmac = N'TANK43T';",
|
||||
"UPDATE ctb_amac SET posizione = N'V1' WHERE cod_cmac = N'TANKV01';",
|
||||
"UPDATE ctb_amac SET posizione = N'V1T' WHERE cod_cmac = N'TANKV01T';",
|
||||
"UPDATE ctb_amac SET posizione = N'V2' WHERE cod_cmac = N'TANKV02';",
|
||||
"UPDATE ctb_amac SET posizione = N'V2T' WHERE cod_cmac = N'TANKV02T';",
|
||||
"UPDATE ctb_amac SET posizione = N'V3' WHERE cod_cmac = N'TANKV03';",
|
||||
"UPDATE ctb_amac SET posizione = N'V3T' WHERE cod_cmac = N'TANKV03T';",
|
||||
"UPDATE ctb_amac SET posizione = N'V4' WHERE cod_cmac = N'TANKV04';",
|
||||
"UPDATE ctb_amac SET posizione = N'V4T' WHERE cod_cmac = N'TANKV04T';",
|
||||
"UPDATE ctb_amac SET posizione = N'V5' WHERE cod_cmac = N'TANKV05';",
|
||||
"UPDATE ctb_amac SET posizione = N'V5T' WHERE cod_cmac = N'TANKV05T';",
|
||||
"UPDATE ctb_amac SET posizione = N'V6' WHERE cod_cmac = N'TANKV06';",
|
||||
"UPDATE ctb_amac SET posizione = N'V6T' WHERE cod_cmac = N'TANKV06T';",
|
||||
"UPDATE ctb_amac SET posizione = N'V7' WHERE cod_cmac = N'TANKV07';",
|
||||
"UPDATE ctb_amac SET posizione = N'V7T' WHERE cod_cmac = N'TANKV07T';",
|
||||
"UPDATE ctb_amac SET posizione = N'V8' WHERE cod_cmac = N'TANKV08';",
|
||||
"UPDATE ctb_amac SET posizione = N'V8T' WHERE cod_cmac = N'TANKV08T';",
|
||||
"UPDATE ctb_amac SET posizione = N'V9' WHERE cod_cmac = N'TANKV09';",
|
||||
"UPDATE ctb_amac SET posizione = N'V9T' WHERE cod_cmac = N'TANKV09T';",
|
||||
"UPDATE ctb_amac SET posizione = N'V10' WHERE cod_cmac = N'TANKV10';",
|
||||
"UPDATE ctb_amac SET posizione = N'V0T' WHERE cod_cmac = N'TANKV10T';",
|
||||
"UPDATE ctb_amac SET posizione = N'V11' WHERE cod_cmac = N'TANKV11';",
|
||||
"UPDATE ctb_amac SET posizione = N'V12' WHERE cod_cmac = N'TANKV12';",
|
||||
"UPDATE ctb_amac SET posizione = N'V13' WHERE cod_cmac = N'TANKV13';",
|
||||
"UPDATE ctb_amac SET posizione = N'V14' WHERE cod_cmac = N'TANKV14';",
|
||||
"UPDATE ctb_amac SET posizione = N'V15' WHERE cod_cmac = N'TANKV15';",
|
||||
"UPDATE ctb_amac SET posizione = N'V16' WHERE cod_cmac = N'TANKV16';",
|
||||
"UPDATE ctb_amac SET posizione = N'V17' WHERE cod_cmac = N'TANKV17';",
|
||||
"UPDATE ctb_amac SET posizione = N'V18' WHERE cod_cmac = N'TANKV18';",
|
||||
"UPDATE ctb_amac SET posizione = N'V19' WHERE cod_cmac = N'TANKV19';",
|
||||
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q4' WHERE cod_mdep = N'01' AND posizione = N'V6T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q4' WHERE cod_mdep = N'01' AND posizione = N'V0T'",
|
||||
|
||||
@@ -10,6 +10,7 @@ public class Migration_20250909175525 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateTrigger("t_UpdProgMagaR", "CREATE TRIGGER [dbo].[t_UpdProgMagaR] ON [dbo].[dtb_ordr] \n" +
|
||||
"FOR UPDATE, DELETE, INSERT\n" +
|
||||
|
||||
@@ -10,6 +10,8 @@ public class Migration_20250910105805 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
executeStatement(
|
||||
"ALTER TABLE dbo.vtb_offt\n" +
|
||||
" ADD CONSTRAINT vtb_offt_gtb_porto_porto_fk\n" +
|
||||
|
||||
@@ -10,6 +10,7 @@ public class Migration_20250911191115 extends BaseMigration implements Migration
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateFunction("getDettMatricoleDaOrdine", "CREATE Function [dbo].[getDettMatricoleDaOrdine] (@codJcom varchar(10)) \n" +
|
||||
"RETURNS @dettMatricole TABLE( cod_prod varchar(15),\n" +
|
||||
|
||||
@@ -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_20250912152309 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("w_ddocu_rc", "SETUP", "INVIO_EMAIL", "N",
|
||||
"Attiva invio email direttamente dalla gestione", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (isCustomer(IntegryCustomer.RossoGargano))
|
||||
updateSetupValue("w_ddocu_rc", "SETUP", "INVIO_EMAIL", "S");
|
||||
}
|
||||
|
||||
@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.MigrationModelInterface;
|
||||
import it.integry.ems_model.utility.dto.IndexTableDTO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Migration_20250915091459 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE vtb_auto ADD costo_aci NUMERIC(20, 5)");
|
||||
|
||||
executeStatement("ALTER TABLE vtb_auto_km ADD id BIGINT IDENTITY NOT NULL");
|
||||
|
||||
executeStatement(
|
||||
"ALTER TABLE vtb_auto_km\n" +
|
||||
" ADD user_name VARCHAR(40) NULL,\n" +
|
||||
" luogo_destinazione VARCHAR(40) NULL,\n" +
|
||||
" km_percorsi NUMERIC(20,5) NOT NULL DEFAULT 0,\n" +
|
||||
" ora_partenza TIME NULL,\n" +
|
||||
" ora_arrivo TIME NULL,\n" +
|
||||
" note VARCHAR(MAX) NULL"
|
||||
);
|
||||
|
||||
executeStatement("ALTER TABLE vtb_auto_km DROP CONSTRAINT pk_vtb_auto_km");
|
||||
|
||||
executeStatement("ALTER TABLE vtb_auto_km ALTER COLUMN cod_vvet VARCHAR(5) NULL");
|
||||
|
||||
executeStatement("ALTER TABLE vtb_auto_km ADD CONSTRAINT pk_vtb_auto_km PRIMARY KEY (id)");
|
||||
|
||||
executeStatement("ALTER TABLE dbo.vtb_auto_km\n" +
|
||||
" ADD CONSTRAINT fk_vtb_auto_km_stb_user\n" +
|
||||
" FOREIGN KEY (User_name)\n" +
|
||||
" REFERENCES dbo.stb_user(User_name)");
|
||||
|
||||
List<IndexTableDTO.ColumnIndex> columnsIndex = new ArrayList<>();
|
||||
columnsIndex.add(new IndexTableDTO.ColumnIndex("cod_auto"));
|
||||
columnsIndex.add(new IndexTableDTO.ColumnIndex("cod_vvet"));
|
||||
columnsIndex.add(new IndexTableDTO.ColumnIndex("user_name"));
|
||||
columnsIndex.add(new IndexTableDTO.ColumnIndex("data_cons"));
|
||||
|
||||
createIndex(
|
||||
new IndexTableDTO()
|
||||
.setTableName("vtb_auto_km")
|
||||
.setIndexName("idx_vtb_auto_km_unique")
|
||||
.setColumnsIndex(columnsIndex)
|
||||
.setUnique(true)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250915155856 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateFunction("getNumDoc4NumDocForn", "-- =============================================\n" +
|
||||
"-- Author: <Author,,Name>\n" +
|
||||
"-- Create date: <Create Date,,>\n" +
|
||||
"-- Description: <Description,,>\n" +
|
||||
"-- =============================================\n" +
|
||||
"CREATE FUNCTION getNumDoc4NumDocForn\n" +
|
||||
"( \n" +
|
||||
" @numdocOrig varchar(60), @annoComp varchar(4)\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"RETURNS @numTable TABLE \n" +
|
||||
"(\n" +
|
||||
" num_doc_orig varchar(max), num_doc int\n" +
|
||||
")\n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
" \n" +
|
||||
" declare @sep varchar(5), @numDoc varchar(60), @rowc int\n" +
|
||||
"\n" +
|
||||
" select @numdocOrig = LTRIM(RTRIM(@numdocOrig))\n" +
|
||||
"\n" +
|
||||
" declare @tmpChar table (sep varchar(5));\n" +
|
||||
" declare @splitString table (numOrig varchar(60), numNew varchar(60), is_numeric int);\n" +
|
||||
"\n" +
|
||||
" SET @numdocOrig = REPLACE(@numdocOrig, '-', ',');\n" +
|
||||
" SET @numdocOrig = REPLACE(@numdocOrig, '.', ',');\n" +
|
||||
" SET @numdocOrig = REPLACE(@numdocOrig, ' ', ',');\n" +
|
||||
" SET @numdocOrig = REPLACE(@numdocOrig, '/', ',');\n" +
|
||||
" SET @numdocOrig = REPLACE(@numdocOrig, '\', ',');\n" +
|
||||
" \n" +
|
||||
" ;with tab_p as (\n" +
|
||||
" select value_string as num_new, \n" +
|
||||
" COUNT(*) over (partition by (select 1)) as tot_row, \n" +
|
||||
" ROW_NUMBER() over (order by (select 1)) as id,\n" +
|
||||
" LEN(value_string) as lunghezza\n" +
|
||||
" from dbo.parseStringIntoArray(@numdocOrig, ',')\n" +
|
||||
" where ISNUMERIC(value_string) = 1 )\n" +
|
||||
" \n" +
|
||||
" insert into @numTable\n" +
|
||||
" select @numdocOrig as num_doc_forn, cast(num_new as int ) as num_doc\n" +
|
||||
" from (\n" +
|
||||
" select * from tab_p ) t\n" +
|
||||
" where (tot_row = 1 or (tot_row > 1 AND \n" +
|
||||
" num_new <> cast(@annoComp as varchar) and\n" +
|
||||
" num_new <> cast(right(@annoComp,2) as varchar) )) \n" +
|
||||
" union all\n" +
|
||||
" select @numdocOrig, @numdocOrig\n" +
|
||||
" where not exists (select * from tab_p)\n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
"\n" +
|
||||
" RETURN \n" +
|
||||
"END");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
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_20250916122341 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
deleteSetup("w_ddocu_rc", "SETUP", "INVIO_EMAIL");
|
||||
|
||||
createSetup("w_vdocu_rc", "SETUP", "INVIO_EMAIL", "N",
|
||||
"Attiva invio email direttamente dalla gestione", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
createSetup("w_ldocu_rc", "SETUP", "INVIO_EMAIL", "N",
|
||||
"Attiva invio email direttamente dalla gestione", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (isCustomer(IntegryCustomer.RossoGargano))
|
||||
updateSetupValue("w_vdocu_rc", "SETUP", "INVIO_EMAIL", "S");
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Carelli_Chiuso))
|
||||
updateSetupValue("w_ldocu_rc", "SETUP", "INVIO_EMAIL", "S");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250916163520 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateFunction("[getNumDoc4NumDocForn]", "-- =============================================\n" +
|
||||
"-- Author: <Author,,Name>\n" +
|
||||
"-- Create date: <Create Date,,>\n" +
|
||||
"-- Description: <Description,,>\n" +
|
||||
"-- =============================================\n" +
|
||||
"CREATE FUNCTION [dbo].[getNumDoc4NumDocForn]\n" +
|
||||
"( \n" +
|
||||
" @numdocorig varchar(60), @annoComp varchar(4)\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"RETURNS @numTable TABLE \n" +
|
||||
"(\n" +
|
||||
" num_doc_orig varchar(max), num_doc int\n" +
|
||||
")\n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
" \n" +
|
||||
" declare @sep varchar(5), @numDoc varchar(60), @rowc int, @numDocForn varchar(60)\n" +
|
||||
"\n" +
|
||||
" select @numDocForn = LTRIM(RTRIM(@numdocOrig))\n" +
|
||||
"\n" +
|
||||
" declare @tmpChar table (sep varchar(5));\n" +
|
||||
" declare @splitString table (numOrig varchar(60), numNew varchar(60), is_numeric int);\n" +
|
||||
"\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '-', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '.', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, ' ', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '/', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '', ',');\n" +
|
||||
" \n" +
|
||||
" ;with tab_p as (\n" +
|
||||
" select value_string as num_new, \n" +
|
||||
" COUNT(*) over (partition by (select 1)) as tot_row, \n" +
|
||||
" ROW_NUMBER() over (order by (select 1)) as id,\n" +
|
||||
" LEN(value_string) as lunghezza\n" +
|
||||
" from dbo.parseStringIntoArray(@numDocForn, ',')\n" +
|
||||
" where ISNUMERIC(value_string) = 1 )\n" +
|
||||
" \n" +
|
||||
" insert into @numTable\n" +
|
||||
" select @numdocOrig as num_doc_forn, try_cast(num_new as int ) as num_doc\n" +
|
||||
" from (\n" +
|
||||
" select * from tab_p ) t\n" +
|
||||
" where (tot_row = 1 or (tot_row > 1 AND \n" +
|
||||
" num_new <> cast(@annoComp as varchar) and\n" +
|
||||
" num_new <> cast(right(@annoComp,2) as varchar) )) AND \n" +
|
||||
" try_cast(num_new as int ) is not null \n" +
|
||||
" union \n" +
|
||||
" select @numdocOrig, @numDocForn\n" +
|
||||
" where not exists (select * from tab_p)\n" +
|
||||
" union \n" +
|
||||
" select @numdocOrig, TRY_CAST(Left(@numDocForn,6) as int)\n" +
|
||||
" where TRY_CAST(left(@numDocForn,6) as int) is not null\n" +
|
||||
" union \n" +
|
||||
" select @numdocOrig, TRY_CAST(Right(@numDocForn,6) as int)\n" +
|
||||
" where TRY_CAST(Right(@numDocForn,6) as int) is not null\n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
"\n" +
|
||||
" RETURN \n" +
|
||||
"END");
|
||||
}
|
||||
|
||||
@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.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250916175210 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("DATI_AZIENDA", "GIACENZA_DA_INV", "ATTIVA_LOG", "N",
|
||||
"Attiva log articoli negativi", false, "SI_NO", false, true,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (existsTable("carelli_giacenza_prog"))
|
||||
executeStatement("SELECT getDate() as datetime_ins, *\n" +
|
||||
"into carelli_giacenza_prog_bck\n" +
|
||||
"FROM carelli_giacenza_prog\n" +
|
||||
"where 1 <> 1");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
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_20250917111031 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("REPORT_NAME", "REPORT_NAME", "SELECT REPORT_NAME FROM WTB_JREPT ORDER BY 1");
|
||||
|
||||
String value = null;
|
||||
|
||||
if (this.isCustomerDb(IntegryCustomerDB.RossoGargano_RossoGargano)) {
|
||||
value = "ReportTracciabilitaUDCAcquistate";
|
||||
}
|
||||
|
||||
createSetup("PVM", "TRACCIABILITA", "REPORT_NAME_UDCACQ", value,
|
||||
"Nome report stampa tracciabilità udc acquisti", false, "REPORT_NAME", false, false,
|
||||
false, false, false, null, false, "SELECT REPORT_NAME FROM WTB_JREPT ORDER BY 1");
|
||||
|
||||
if (this.isCustomerDb(IntegryCustomerDB.RossoGargano_RossoGargano)) {
|
||||
value = "ReportTracciabilitaUDCProdotte";
|
||||
}
|
||||
|
||||
createSetup("PVM", "TRACCIABILITA", "REPORT_NAME_UDCPROD", value,
|
||||
"Nome report stampa tracciabilità udc produzione", false, "REPORT_NAME", false, false,
|
||||
false, false, false, null, false, "SELECT REPORT_NAME FROM WTB_JREPT ORDER BY 1");
|
||||
|
||||
if (this.isCustomerDb(IntegryCustomerDB.RossoGargano_RossoGargano)) {
|
||||
value = "ReportTracciabilitaUDCVendute";
|
||||
}
|
||||
|
||||
createSetup("PVM", "TRACCIABILITA", "REPORT_NAME_UDCVEND", value,
|
||||
"Nome report stampa tracciabilità udc vendite", false, "REPORT_NAME", false, false,
|
||||
false, false, false, null, false, "SELECT REPORT_NAME FROM WTB_JREPT ORDER BY 1");
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateView("vw_tracciabUDCACQ",
|
||||
"CREATE VIEW [dbo].[vw_tracciabUDCACQ] AS\n" +
|
||||
"SELECT doct.cod_anag AS codAnag,\n" +
|
||||
" gtb_anag.rag_soc AS ragSoc,\n" +
|
||||
" doct.data_doc AS dataDoc,\n" +
|
||||
" doct.ser_doc AS serDoc,\n" +
|
||||
" doct.num_doc AS numDoc,\n" +
|
||||
" doct.cod_dtip AS codDtip,\n" +
|
||||
" doct.num_doc_forn AS numDocForn,\n" +
|
||||
" mtb_grup.tipo_mgrp AS tipoMgrp,\n" +
|
||||
" docr.cod_mart AS codMart,\n" +
|
||||
" docr.descrizione,\n" +
|
||||
" docr.partita_mag AS lotto,\n" +
|
||||
" docr.unt_doc AS untDoc,\n" +
|
||||
" docr.qta_doc AS qtaDoc,\n" +
|
||||
" UDCAcq.UDC,\n" +
|
||||
" UDCAcq.qtaUDC\n" +
|
||||
"FROM dtb_doct doct\n" +
|
||||
" INNER JOIN dtb_docr docr ON doct.cod_anag = docr.cod_anag AND\n" +
|
||||
" doct.cod_dtip = docr.cod_dtip AND\n" +
|
||||
" doct.data_doc = docr.data_doc AND\n" +
|
||||
" doct.ser_doc = docr.ser_doc AND\n" +
|
||||
" doct.num_doc = docr.num_doc\n" +
|
||||
" INNER JOIN dtb_tipi ON doct.cod_dtip = dtb_tipi.cod_Dtip\n" +
|
||||
" INNER JOIN gtb_anag ON doct.cod_anag = gtb_anag.cod_anag\n" +
|
||||
" INNER JOIN mtb_aart ON docr.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" INNER JOIN mtb_grup ON mtb_aart.cod_mgrp = mtb_grup.cod_mgrp\n" +
|
||||
" LEFT OUTER JOIN\n" +
|
||||
" (SELECT mtb_colt.barcode_ul AS UDC,\n" +
|
||||
" mtb_colt.cod_anag,\n" +
|
||||
" mtb_colt.cod_dtip,\n" +
|
||||
" mtb_colt.data_doc,\n" +
|
||||
" mtb_colt.ser_doc,\n" +
|
||||
" mtb_colt.num_doc,\n" +
|
||||
" mtb_colr.cod_mart,\n" +
|
||||
" mtb_colr.partita_mag,\n" +
|
||||
" mtb_colr.qta_col AS qtaUDC\n" +
|
||||
" FROM mtb_colt\n" +
|
||||
" INNER JOIN mtb_colr 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" +
|
||||
" WHERE mtb_colt.gestione = 'A'\n" +
|
||||
" AND mtb_colt.segno = 1) UDCAcq ON doct.cod_anag = UDCAcq.cod_anag AND\n" +
|
||||
" doct.cod_dtip = UDCAcq.cod_dtip AND\n" +
|
||||
" doct.data_doc = UDCAcq.data_doc AND\n" +
|
||||
" doct.ser_doc = UDCAcq.ser_doc AND\n" +
|
||||
" doct.num_doc = UDCAcq.num_doc AND\n" +
|
||||
" docr.cod_mart = UDCAcq.cod_mart AND\n" +
|
||||
" docr.partita_mag = UDCAcq.partita_mag\n" +
|
||||
"WHERE doct.gestione = 'A'\n" +
|
||||
" AND dtb_tipi.segno_qta_car = 1\n" +
|
||||
" AND dtb_tipi.tipo_emissione = 'DIRETTA'\n" +
|
||||
" AND docr.partita_mag IS NOT NULL"
|
||||
);
|
||||
|
||||
createOrUpdateView("vw_tracciabUDCProd",
|
||||
"CREATE VIEW [dbo].[vw_tracciabUDCProd] AS\n" +
|
||||
"SELECT mtb_colr.data_ord AS dataOrdProd,\n" +
|
||||
" mtb_colr.num_ord AS numOrdProd,\n" +
|
||||
" mtb_colt.cod_anag AS codAnag,\n" +
|
||||
" gtb_anag.rag_soc AS produttore,\n" +
|
||||
" mtb_colt.cod_jfas AS linea,\n" +
|
||||
" mtb_colr.datetime_row AS dataOraProd,\n" +
|
||||
" mtb_colt.cod_dtip AS codDtip,\n" +
|
||||
" mtb_colt.data_doc AS dataDoc,\n" +
|
||||
" mtb_colt.ser_doc AS serDoc,\n" +
|
||||
" mtb_colt.num_doc AS numDoc,\n" +
|
||||
" mtb_colt.segno,\n" +
|
||||
" dtb_ordt.cod_prod AS codProd,\n" +
|
||||
" dtb_ordt.descrizione_prod AS DescrizioneProd,\n" +
|
||||
" IIF(mtb_colt.segno = 1, mtb_colr.partita_mag, NULL) AS lottoProd,\n" +
|
||||
" IIF(mtb_colt.segno = 1, mtb_colt.progressivo_ul, NULL) AS numUDCProd,\n" +
|
||||
" IIF(mtb_colt.segno = 1, mtb_colr.barcode_ul_in, NULL) AS UDCProd,\n" +
|
||||
" IIF(mtb_colt.segno = 1, mtb_aart.unt_mis, NULL) AS untMisProd,\n" +
|
||||
" IIF(mtb_colt.segno = 1, mtb_colr.qta_col, 0) AS qtaProd,\n" +
|
||||
" IIF(mtb_colt.segno = 1, mtb_colr.num_cnf, 0) AS colliProd,\n" +
|
||||
" IIF(mtb_colt.segno = -1, mtb_colr.cod_mart, NULL) AS codMP,\n" +
|
||||
" IIF(mtb_colt.segno = -1, mtb_aart.descrizione_estesa, NULL) AS DescrizioneMP,\n" +
|
||||
" IIF(mtb_colt.segno = -1, mtb_colr.partita_mag, NULL) AS lottoMP,\n" +
|
||||
" IIF(mtb_colt.segno = -1, mtb_colr.barcode_ul_out, NULL) AS UDCMP,\n" +
|
||||
" IIF(mtb_colt.segno = -1, mtb_aart.unt_mis, NULL) AS untMisMP,\n" +
|
||||
" IIF(mtb_colt.segno = -1, mtb_colr.qta_col, 0) AS qtaScar\n" +
|
||||
"FROM mtb_colt\n" +
|
||||
" INNER JOIN mtb_colr 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" +
|
||||
" INNER JOIN gtb_anag ON mtb_colt.cod_anag = gtb_anag.cod_anag\n" +
|
||||
" LEFT OUTER JOIN dtb_ordt ON mtb_colt.gestione = dtb_ordt.gestione AND mtb_colt.data_ord = dtb_ordt.data_ord AND\n" +
|
||||
" mtb_colt.num_ord = dtb_ordt.num_ord\n" +
|
||||
"WHERE mtb_colt.gestione = 'L'\n" +
|
||||
" AND mtb_colr.data_ord IS NOT NULL\n" +
|
||||
"UNION ALL\n" +
|
||||
"SELECT dtb_doct.data_ord AS dataOrdProd,\n" +
|
||||
" dtb_doct.num_ord AS num_ordProd,\n" +
|
||||
" dtb_doct.cod_anag,\n" +
|
||||
" gtb_anag.rag_soc,\n" +
|
||||
" dtb_doct.cod_jfas,\n" +
|
||||
" step_ordine.data_iniz AS dataOraProd,\n" +
|
||||
" dtb_doct.cod_Dtip,\n" +
|
||||
" dtb_doct.data_doc,\n" +
|
||||
" dtb_doct.ser_doc,\n" +
|
||||
" dtb_doct.num_doc,\n" +
|
||||
" -1 AS segno,\n" +
|
||||
" dtb_doct.cod_prod AS codProd,\n" +
|
||||
" dtb_ordt.descrizione_prod AS descrizioneProd,\n" +
|
||||
" NULL AS LottoProd,\n" +
|
||||
" NULL AS NumUdcProd,\n" +
|
||||
" NULL AS UDCProd,\n" +
|
||||
" NULL AS untMisProd,\n" +
|
||||
" NULL AS qtaProd,\n" +
|
||||
" NULL AS colliProd,\n" +
|
||||
" dtb_docr.cod_mart AS codMp,\n" +
|
||||
" dtb_docr.descrizione AS DescrizioneMP,\n" +
|
||||
" dtb_docr.partita_mag AS LottMP,\n" +
|
||||
" NULL AS UDCMP,\n" +
|
||||
" dtb_docr.unt_doc AS UntMisMP,\n" +
|
||||
" dtb_docr.qta_doc AS qtaScar\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.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 gtb_anag ON dtb_doct.cod_anag = gtb_anag.cod_anag\n" +
|
||||
" INNER JOIN mtb_aart ON dtb_docr.cod_mart = mtb_aart.cod_mart AND mtb_aart.flag_tracciabilita = 'S'\n" +
|
||||
" INNER JOIN mtb_grup ON mtb_aart.cod_mgrp = mtb_grup.cod_mgrp AND mtb_grup.tipo_mgrp = 'IMB'\n" +
|
||||
" INNER JOIN dtb_ordt ON dtb_ordt.gestione = dtb_doct.gestione AND dtb_ordt.data_ord = dtb_doct.data_ord AND\n" +
|
||||
" dtb_ordt.num_ord = dtb_doct.num_ord\n" +
|
||||
" INNER JOIN (SELECT gestione, data_ord, num_ord, MIN(data_iniz) AS data_iniz\n" +
|
||||
" FROM dtb_ord_steps\n" +
|
||||
" WHERE gestione = 'L'\n" +
|
||||
" GROUP BY gestione, data_ord, num_ord) step_ordine\n" +
|
||||
" ON step_ordine.gestione = dtb_doct.gestione AND step_ordine.data_ord = dtb_doct.data_ord AND\n" +
|
||||
" step_ordine.num_ord = dtb_doct.num_ord\n" +
|
||||
" INNER JOIN (SELECT cod_anag, cod_dtip, data_doc, ser_doc, num_doc\n" +
|
||||
" FROM dtb_doct\n" +
|
||||
" WHERE dtb_doct.cod_dtip IN ('H2', 'SLAV')\n" +
|
||||
" EXCEPT\n" +
|
||||
" SELECT cod_anag, cod_Dtip, data_doc, ser_doc, num_doc\n" +
|
||||
" FROM mtb_colt\n" +
|
||||
" WHERE cod_dtip IN ('H2', 'SLAV')) DocNoPackList ON dtb_doct.cod_anag = DocNoPackList.cod_anag AND\n" +
|
||||
" dtb_doct.cod_Dtip = DocNoPackList.cod_Dtip AND\n" +
|
||||
" dtb_doct.data_doc = DocNoPackList.data_doc AND\n" +
|
||||
" dtb_doct.ser_doc = DocNoPackList.ser_doc AND\n" +
|
||||
" dtb_doct.num_doc = DocNoPackList.num_doc"
|
||||
);
|
||||
|
||||
createOrUpdateView("vw_tracciabUDCVend",
|
||||
"CREATE VIEW [dbo].[vw_tracciabUDCVend] AS\n" +
|
||||
"SELECT mtb_colt.cod_anag AS codAnag,\n" +
|
||||
" gtb_anag.rag_soc AS ragSoc,\n" +
|
||||
" ISNULL(vtb_dest.destinatario, '') AS destinazione,\n" +
|
||||
" ISNULL(vtb_dest.citta, gtb_anag.citta) AS citta,\n" +
|
||||
" ISNULL(vtb_dest.prov, gtb_anag.prov) AS provincia,\n" +
|
||||
" ISNULL(vtb_dest.nazione, gtb_anag.nazione) AS nazione,\n" +
|
||||
" mtb_colt.cod_dtip AS codDtip,\n" +
|
||||
" mtb_colt.data_doc AS dataDoc,\n" +
|
||||
" mtb_colt.ser_doc AS serDoc,\n" +
|
||||
" mtb_colt.num_doc AS numDoc,\n" +
|
||||
" mtb_colr.cod_mart AS codMart,\n" +
|
||||
" mtb_aart.descrizione_estesa AS descrizioneEstesa,\n" +
|
||||
" ISNULL(mtb_partita_mag.partita_mag_prod, mtb_colr.partita_mag) AS lotto,\n" +
|
||||
" mtb_partita_mag.data_prod AS dataLotto,\n" +
|
||||
" IIF(dtb_tipi.segno_qta_scar = -1, mtb_colr.barcode_ul_in, mtb_colr.barcode_ul_out) AS UDCVenduta,\n" +
|
||||
" UDC.data_vers AS dataOraProd,\n" +
|
||||
" UDC.cod_jfas AS LineaProd,\n" +
|
||||
" UDC.num_ord AS numOrdProd,\n" +
|
||||
" UDC.data_ord AS DataOrdProd,\n" +
|
||||
" mtb_aart.unt_mis AS untMis,\n" +
|
||||
" SUM(mtb_colr.qta_col) AS qtaVenduta,\n" +
|
||||
" SUM(mtb_colr.num_cnf) AS colliVenduti\n" +
|
||||
"FROM mtb_colt\n" +
|
||||
" INNER JOIN mtb_colr 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 dtb_tipi ON mtb_colt.cod_dtip = dtb_tipi.cod_dtip\n" +
|
||||
" INNER JOIN gtb_anag ON mtb_colt.cod_anag = gtb_anag.cod_anag\n" +
|
||||
" LEFT OUTER JOIN vtb_dest ON mtb_colt.cod_anag = vtb_dest.cod_anag AND\n" +
|
||||
" mtb_colt.cod_vdes = vtb_dest.cod_vdes\n" +
|
||||
" INNER JOIN mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" INNER JOIN mtb_partita_mag ON mtb_colr.cod_mart = mtb_partita_mag.cod_mart AND\n" +
|
||||
" mtb_colr.partita_mag = mtb_partita_mag.partita_mag\n" +
|
||||
" INNER JOIN mtb_colt UDC ON IIF(dtb_tipi.segno_qta_scar = -1, mtb_colr.barcode_ul_in, mtb_colr.barcode_ul_out) =\n" +
|
||||
" UDC.barcode_ul\n" +
|
||||
"WHERE mtb_colt.gestione = 'V'\n" +
|
||||
" AND dtb_tipi.tipo_emissione = 'DIRETTA'\n" +
|
||||
"GROUP BY mtb_colt.cod_anag, gtb_anag.rag_soc, ISNULL(vtb_dest.destinatario, ''),\n" +
|
||||
" ISNULL(vtb_dest.citta, gtb_anag.citta),\n" +
|
||||
" ISNULL(vtb_dest.prov, gtb_anag.prov),\n" +
|
||||
" ISNULL(vtb_dest.nazione, gtb_anag.nazione),\n" +
|
||||
" mtb_colt.cod_dtip, mtb_colt.data_doc, mtb_colt.ser_doc, mtb_colt.num_doc,\n" +
|
||||
" mtb_colr.cod_mart, mtb_aart.descrizione_estesa,\n" +
|
||||
" ISNULL(mtb_partita_mag.partita_mag_prod, mtb_colr.partita_mag),\n" +
|
||||
" mtb_partita_mag.data_prod,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" IIF(dtb_tipi.segno_qta_scar = -1, mtb_colr.barcode_ul_in, mtb_colr.barcode_ul_out),\n" +
|
||||
" UDC.data_vers,\n" +
|
||||
" UDC.cod_jfas,\n" +
|
||||
" UDC.data_ord,\n" +
|
||||
" UDC.num_ord"
|
||||
);
|
||||
}
|
||||
|
||||
@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.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250917135026 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
enableSaveToRest("vauto");
|
||||
|
||||
if ( isCustomer(IntegryCustomer.Carelli))
|
||||
executeStatement("insert into stb_abil\n" +
|
||||
" select 'LG082', user_name, flag_abil, gest_name\n" +
|
||||
" from stb_abil\n" +
|
||||
" where cod_opz = 'LG005'\n" +
|
||||
" and not exists(select * from stb_abil s where s.user_name = stb_abil.user_name and s.cod_opz = 'LG082')",
|
||||
"update stb_abil set flag_abil = 'N' where cod_opz = 'LG005'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
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_20250917162650 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if ( isCustomer(IntegryCustomer.Biolevante)) {
|
||||
executeStatement(";with moduli as (\n" +
|
||||
"select *\n" +
|
||||
"from dtb_mod_stampa\n" +
|
||||
"where mod_stampa in ('CMR', 'PACK', 'PACKC') and report_id is not null)\n" +
|
||||
"insert into drl_tipi_report ( cod_dtip, report_id, sort_id, report_type)\n" +
|
||||
"select cod_dtip, moduli.report_id, \n" +
|
||||
"ROW_NUMBER() over (partition by cod_dtip order by moduli.mod_stampa desc) as sort_id,\n" +
|
||||
"IIF(moduli.mod_stampa ='CMR',2, 1) as report_type\n" +
|
||||
"from dtb_tipi,\n" +
|
||||
"moduli\n" +
|
||||
"where dtb_tipi.tipo_emissione = 'DIRETTA'\n" +
|
||||
"and ((gestione = 'A' AND moduli.mod_stampa = 'PACKC') OR\n" +
|
||||
"(gestione = 'V' AND moduli.mod_stampa IN( 'CMR','PACK') ) OR \n" +
|
||||
"(gestione = 'L' AND segno_qta_car - segno_val_scar > 0 AND moduli.mod_stampa = 'PACKC') OR\n" +
|
||||
"(gestione = 'L' AND segno_qta_car - segno_val_scar < 0 AND moduli.mod_stampa = 'PACK')\n" +
|
||||
")\n" +
|
||||
"order by 1");
|
||||
}
|
||||
}
|
||||
|
||||
@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.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250918105103 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!existsSetup("PICKING", "ACCETTAZIONE", "FLAG_GROUP_LIST_FORN")) {
|
||||
createSetup("PICKING", "ACCETTAZIONE", "FLAG_GROUP_LIST_FORN", "", "Permette di scegliere il raggruppamento delle bolle per fornitore (true) o per listino (false)", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "ACCETTAZIONE_BOLLA", "FLAG_EXCLUDE_KG")) {
|
||||
createSetup("PICKING", "ACCETTAZIONE_BOLLA", "FLAG_EXCLUDE_KG", "N", "Flag per escludere gli articoli a peso variabile", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "ACCETTAZIONE_BOLLA", "FLAG_QTA_TOT_EDITABLE")) {
|
||||
createSetup("PICKING", "ACCETTAZIONE_BOLLA", "FLAG_QTA_TOT_EDITABLE", "S", "Se abilitato rende editabile il campo ''Qta tot''", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "IMBALLI", "COD_DTIP_CARICO")) {
|
||||
createSetup("PICKING", "IMBALLI", "COD_DTIP_CARICO", "", "Codice documento che identifica il carico degli imballi", "COD_DTIP");
|
||||
}
|
||||
if (!existsSetup("PICKING", "IMBALLI", "COD_DTIP_SCARICO")) {
|
||||
createSetup("PICKING", "IMBALLI", "COD_DTIP_SCARICO", "", "Codice documento che identifica lo scarico degli imballi", "COD_DTIP");
|
||||
}
|
||||
if (!existsSetup("PICKING", "PICKING_LIBERO", "ENABLE_SCAN_ART")) {
|
||||
createSetup("PICKING", "PICKING_LIBERO", "ENABLE_SCAN_ART", "", "Permette di abilitare la scansione dei barcode inerenti all'articolo o alla confezione senza dover usare il barcode UL.", "SI_NO");
|
||||
}
|
||||
|
||||
if (!existsSetup("PICKING", "PICKING_LIBERO", "FLAG_ASK_COMMESSA_LAV")) {
|
||||
createSetup("PICKING", "PICKING_LIBERO", "FLAG_ASK_COMMESSA_LAV", "N", "Se 'S' allora all'apertura del Picking Libero di lavorazione verrà chiesta la commessa", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "PRODUZIONE", "FLAG_GENERA_DOC_CAR")) {
|
||||
createSetup("PICKING", "PRODUZIONE", "FLAG_GENERA_DOC_CAR", "N", "Se 'S' abilita la generazione dei documenti di carico lavorazione. Il codice documento è letto dalla setup W_PORDI_RC > SETUP_DOCUMENTI > COD_DTIP_CAR.", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "PRODUZIONE", "FLAG_GENERA_DOC_SCAR")) {
|
||||
createSetup("PICKING", "PRODUZIONE", "FLAG_GENERA_DOC_SCAR", "N", "Se 'S' abilita la generazione dei documenti di scarico lavorazione. Il codice documento è letto dalla setup W_PORDI_RC > SETUP_DOCUMENTI > COD_DTIP_SCAR.", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "RETTIFICA_GIACENZE", "FLAG_ENABLE_MOVIMENTO_FISCALE")) {
|
||||
createSetup("PICKING", "RETTIFICA_GIACENZE", "FLAG_ENABLE_MOVIMENTO_FISCALE", "N", "Flag che abilita o meno la generazione automatica di un movimento fiscale quando viene effettuata una rettifica giacenze", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "RETTIFICA_GIACENZE", "TIPO_MOVIMENTO_FISCALE")) {
|
||||
createSetup("PICKING", "RETTIFICA_GIACENZE", "TIPO_MOVIMENTO_FISCALE", "", "Indica il tipo documento del movimento fiscale da utilizzare", "COD_DTIP");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SETUP", "ENABLE_ART_CREATION")) {
|
||||
createSetup("PICKING", "SETUP", "ENABLE_ART_CREATION", "N", "Permette agli utenti di creare gli articoli", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SETUP", "ENABLE_ART_CREATION_GRP_MERC")) {
|
||||
createSetup("PICKING", "SETUP", "ENABLE_ART_CREATION_GRP_MERC", "", "Vincola la creazione degli articoli solo ad alcuni gruppi merceologici", "COD_MGRP");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SETUP", "ENABLE_POSITION_CHANGE_REQUEST")) {
|
||||
createSetup("PICKING", "SETUP", "ENABLE_POSITION_CHANGE_REQUEST", "S", "Permette di abilitare il pop-up di richiesta di modifica posizione", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SETUP", "VIEW_SWITCH_DEPO_BUTTON")) {
|
||||
createSetup("PICKING", "SETUP", "VIEW_SWITCH_DEPO_BUTTON", "S", "Permette di abilitare la selezione del deposito in home page", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SPEDIZIONE", "ADD_DATACONS_IN_FILTRO")) {
|
||||
createSetup("PICKING", "SPEDIZIONE", "ADD_DATACONS_IN_FILTRO", "S", "Permettere l'inserimento di data_cons in filtro ordine della MtbColt", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SPEDIZIONE", "ELENCO_FORNITORI_INTERNI")) {
|
||||
createSetup("PICKING", "SPEDIZIONE", "ELENCO_FORNITORI_INTERNI", "", "Elenco utilizzato per riconoscere i fornitori del gruppo. Separati da pipe", "");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SPEDIZIONE", "ENABLE_FAST_PICKING")) {
|
||||
createSetup("PICKING", "SPEDIZIONE", "ENABLE_FAST_PICKING", "N", "Permette di abilitare il fast picking: abilita la scansione degli SSCC direttamente nel popup di inserimento delle quantità procedendo alla chiusura UL automatica e successiva apertura di una nuova UL.", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SPEDIZIONE", "FLAG_ASK_DUPLICATE_UDS")) {
|
||||
createSetup("PICKING", "SPEDIZIONE", "FLAG_ASK_DUPLICATE_UDS", "N", "Questo flag permetta all'utente di creare nel picking di vendita più UDS partendo da una già creata solo se l'UDS non ha riferimenti a colli di carico.", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SPEDIZIONE", "FLAG_USE_COLLI_PEDANA")) {
|
||||
createSetup("PICKING", "SPEDIZIONE", "FLAG_USE_COLLI_PEDANA", "N", "Questo flag permette, durante il picking, di proporre automaticamente la qta dei colli pedana presente nell'anagrafica articolo. Questa setup prevale su FLAG_USE_QTA_ORD se entrambe attive.", "SI_NO");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SPEDIZIONE", "REPORT_PACKING_LIST")) {
|
||||
createSetup("PICKING", "SPEDIZIONE", "REPORT_PACKING_LIST", "", "Selezionare la stampa del packing list che verrà lanciata alla pressione del tasto \"Chiudi ordine\" del WMS", "REPORT_NAME");
|
||||
}
|
||||
if (!existsSetup("PICKING", "SPEDIZIONE", "SUGGEST_DATA_SCAD")) {
|
||||
createSetup("PICKING", "SPEDIZIONE", "SUGGEST_DATA_SCAD", "N", "Suggerisce la data di scadenza di una partita già esistente", "SI_NO");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250918115332 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isTextiles()) return;
|
||||
createOrUpdateFunction("ftx_calcCostoProd", "CREATE FUNCTION ftx_calcCostoProd\n" +
|
||||
"(\n" +
|
||||
" -- Add the parameters for the function here\n" +
|
||||
" @codStyle varchar(15)\n" +
|
||||
")\n" +
|
||||
"RETURNS numeric(20,5)\n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
" declare @costoProd numeric(20,5);\n" +
|
||||
"\n" +
|
||||
"WITH \n" +
|
||||
"CostoAcquisto AS (\n" +
|
||||
" SELECT \n" +
|
||||
" ttb_style.cod_style, \n" +
|
||||
" ROUND(SUM(ttb_style_taglie.costo) / COUNT(ttb_style_taglie.costo), 5) AS costo_acquisto\n" +
|
||||
" FROM ttb_style \n" +
|
||||
" INNER JOIN ttb_style_taglie \n" +
|
||||
" ON ttb_style.cod_style = ttb_style_taglie.cod_style\n" +
|
||||
" WHERE ttb_style.cod_style = @codStyle\n" +
|
||||
" GROUP BY ttb_style.cod_style\n" +
|
||||
"),\n" +
|
||||
"CostoMateriali AS (\n" +
|
||||
" SELECT \n" +
|
||||
" ttb_style.cod_style,\n" +
|
||||
" SUM(ISNULL(costo_unt, 0) * ISNULL(jtb_dist_mate.qta_std, 0) * (1 + ISNULL(jtb_dist_mate.perc_sfrido, 0) / 100)) AS costo_materiali\n" +
|
||||
" FROM jtb_dist_mate \n" +
|
||||
" INNER JOIN ttb_style \n" +
|
||||
" ON jtb_dist_mate.cod_prod = ttb_style.cod_style\n" +
|
||||
" WHERE ttb_style.cod_style = @codStyle\n" +
|
||||
" GROUP BY ttb_style.cod_style\n" +
|
||||
"),\n" +
|
||||
"CostiDirettiPerc AS (\n" +
|
||||
" SELECT \n" +
|
||||
" jtb_dist_clav_ind.cod_prod AS cod_style,\n" +
|
||||
" SUM(\n" +
|
||||
" CASE \n" +
|
||||
" WHEN jtb_clav_ind.tipo_calcolo = 'A' THEN ISNULL(ROUND(CostoAcquisto.costo_acquisto * jtb_dist_clav_ind.perc_cost / 100, 5), 0)\n" +
|
||||
" WHEN jtb_clav_ind.tipo_calcolo = 'M' THEN ISNULL(ROUND(CostoMateriali.costo_materiali * jtb_dist_clav_ind.perc_cost / 100, 5), 0)\n" +
|
||||
" ELSE 0\n" +
|
||||
" END\n" +
|
||||
" ) AS costi_perc_lav\n" +
|
||||
" FROM jtb_dist_clav_ind \n" +
|
||||
" INNER JOIN jtb_clav_ind \n" +
|
||||
" ON jtb_dist_clav_ind.cod_jcos_ind = jtb_clav_ind.cod_jcos_ind\n" +
|
||||
" LEFT JOIN CostoAcquisto \n" +
|
||||
" ON CostoAcquisto.cod_style = jtb_dist_clav_ind.cod_prod\n" +
|
||||
" LEFT JOIN CostoMateriali \n" +
|
||||
" ON CostoMateriali.cod_style = jtb_dist_clav_ind.cod_prod\n" +
|
||||
" WHERE jtb_clav_ind.tipo_calcolo IN ('A', 'M')\n" +
|
||||
" GROUP BY jtb_dist_clav_ind.cod_prod\n" +
|
||||
"),\n" +
|
||||
"CostiDiretti AS (\n" +
|
||||
" SELECT \n" +
|
||||
" CostoAcquisto.cod_style,\n" +
|
||||
" ISNULL(CostoAcquisto.costo_acquisto, 0) AS costo_acquisto,\n" +
|
||||
" ISNULL(CostoMateriali.costo_materiali, 0) AS costo_materiali,\n" +
|
||||
" ISNULL(CostiDirettiPerc.costi_perc_lav, 0) AS costi_perc_lav,\n" +
|
||||
" ROUND(\n" +
|
||||
" ISNULL(CostoAcquisto.costo_acquisto, 0) + \n" +
|
||||
" ISNULL(CostoMateriali.costo_materiali, 0) + \n" +
|
||||
" ISNULL(CostiDirettiPerc.costi_perc_lav, 0), \n" +
|
||||
" 5) AS costi_diretti\n" +
|
||||
" FROM CostoAcquisto\n" +
|
||||
" LEFT JOIN CostoMateriali ON CostoAcquisto.cod_style = CostoMateriali.cod_style\n" +
|
||||
" LEFT JOIN CostiDirettiPerc ON CostoAcquisto.cod_style = CostiDirettiPerc.cod_style\n" +
|
||||
"),\n" +
|
||||
"CostiIndiretti AS (\n" +
|
||||
" SELECT \n" +
|
||||
" jtb_dist_clav_ind.cod_prod AS cod_style,\n" +
|
||||
" SUM(ISNULL(ROUND(CostiDiretti.costi_diretti * jtb_dist_clav_ind.perc_cost / 100, 5), 0)) AS costi_indiretti\n" +
|
||||
" FROM jtb_dist_clav_ind\n" +
|
||||
" INNER JOIN jtb_clav_ind ON jtb_dist_clav_ind.cod_jcos_ind = jtb_clav_ind.cod_jcos_ind\n" +
|
||||
" INNER JOIN CostiDiretti ON CostiDiretti.cod_style = jtb_dist_clav_ind.cod_prod\n" +
|
||||
" WHERE jtb_clav_ind.tipo_calcolo = 'D'\n" +
|
||||
" and jtb_dist_clav_ind.cod_prod = @codStyle\n" +
|
||||
" GROUP BY jtb_dist_clav_ind.cod_prod\n" +
|
||||
"),\n" +
|
||||
"AltriCosti AS (\n" +
|
||||
" SELECT\n" +
|
||||
" jtb_dist_clav_dir.cod_prod AS cod_style,\n" +
|
||||
" SUM(ISNULL(jtb_dist_clav_dir.val_unt, 0)) AS altri_costi\n" +
|
||||
" FROM jtb_dist_clav_dir\n" +
|
||||
" LEFT JOIN gtb_spes ON jtb_dist_clav_dir.cod_jcos_dir = gtb_spes.cod_spes\n" +
|
||||
" LEFT JOIN gtb_anag ON jtb_dist_clav_dir.cod_forn = gtb_anag.cod_anag\n" +
|
||||
" LEFT JOIN jtb_lisa_lav ON jtb_dist_clav_dir.cod_forn = jtb_lisa_lav.cod_forn\n" +
|
||||
" AND jtb_dist_clav_dir.cod_lav_forn = jtb_lisa_lav.cod_lav_forn\n" +
|
||||
" INNER JOIN CostoAcquisto ON jtb_dist_clav_dir.cod_prod = CostoAcquisto.cod_style\n" +
|
||||
" where jtb_dist_clav_dir.cod_prod = @codStyle\n" +
|
||||
" GROUP BY jtb_dist_clav_dir.cod_prod\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"SELECT \n" +
|
||||
" @costoProd = \n" +
|
||||
" ROUND(\n" +
|
||||
" CostiDiretti.costi_diretti + \n" +
|
||||
" ISNULL(CostiIndiretti.costi_indiretti, 0) + \n" +
|
||||
" ISNULL(AltriCosti.altri_costi, 0), 2\n" +
|
||||
" ) \n" +
|
||||
"FROM CostiDiretti\n" +
|
||||
"LEFT JOIN CostiIndiretti ON CostiDiretti.cod_style = CostiIndiretti.cod_style\n" +
|
||||
"LEFT JOIN AltriCosti ON CostiDiretti.cod_style = AltriCosti.cod_style\n" +
|
||||
"\n" +
|
||||
"return @costoProd\n" +
|
||||
"\n" +
|
||||
"END");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250919095906 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateFunction("f_getNumDoc4NumDocForn", "CREATE FUNCTION [dbo].[f_getNumDoc4NumDocForn](@numdocOrig varchar(60), @annoComp varchar(4))\n" +
|
||||
"RETURNS int\n" +
|
||||
"AS\n" +
|
||||
"BEGIN \n" +
|
||||
" DECLARE @numDoc int\n" +
|
||||
"\n" +
|
||||
" select @numDoc = num_doc\n" +
|
||||
" from(\n" +
|
||||
"select *, COUNT(*) over (partition by len(num_doc)) as conta_len, ROW_NUMBER() over(order by len(num_doc) desc) as sort\n" +
|
||||
"from dbo.getNumDoc4NumDocForn(@numDocOrig, @annoComp) )t\n" +
|
||||
"where sort = 1 AND conta_len = 1\n" +
|
||||
"\n" +
|
||||
" return @numDoc\n" +
|
||||
"END");
|
||||
createOrUpdateFunction("f_getNumDoc4NumDocFornOld", "CREATE FUNCTION [dbo].[f_getNumDoc4NumDocFornOld](@numdocOrig varchar(60), @annoComp varchar(4))\n" +
|
||||
"RETURNS int\n" +
|
||||
"AS\n" +
|
||||
"BEGIN \n" +
|
||||
"\n" +
|
||||
"declare @sep varchar(5), @numDoc varchar(60), @rowc int\n" +
|
||||
"\n" +
|
||||
" select @numdocOrig = LTRIM(RTRIM(@numdocOrig))\n" +
|
||||
"\n" +
|
||||
" declare @tmpChar table (sep varchar(5));\n" +
|
||||
" declare @splitString table (numOrig varchar(60), numNew varchar(60), is_numeric int);\n" +
|
||||
" \n" +
|
||||
"\n" +
|
||||
" insert into @tmpChar values ('-')\n" +
|
||||
" insert into @tmpChar values ('.') \n" +
|
||||
" insert into @tmpChar values (' ')\n" +
|
||||
" insert into @tmpChar values ('/')\n" +
|
||||
" insert into @tmpChar values ('\')\n" +
|
||||
"\n" +
|
||||
" declare @string varchar(1), @i int , @parseString varchar(60), @find int\n" +
|
||||
"\n" +
|
||||
" set @i = 1\n" +
|
||||
"\n" +
|
||||
" select @string = left(@numdocOrig, 1)\n" +
|
||||
"\n" +
|
||||
" while @string <> '' and @string is not null\n" +
|
||||
" begin\n" +
|
||||
" select @find = count(*)from @tmpChar where sep = @string\n" +
|
||||
"\n" +
|
||||
" if @find > 0 \n" +
|
||||
" begin\n" +
|
||||
" insert @splitString values (@numdocOrig, @parseString, IsNumeric(@parseString))\n" +
|
||||
" set @parseString = ''\n" +
|
||||
" end \n" +
|
||||
" else\n" +
|
||||
" begin\n" +
|
||||
" select @parseString = IsNull(@parseString, '') + @string\n" +
|
||||
" end \n" +
|
||||
" select @i = @i + 1\n" +
|
||||
" select @string = substring(@numdocOrig, @i, 1)\n" +
|
||||
" end\n" +
|
||||
"\n" +
|
||||
" insert @splitString values (@numdocOrig, @parseString, IsNumeric(@parseString))\n" +
|
||||
"\n" +
|
||||
" select @rowc = count(*) From @splitString\n" +
|
||||
" \n" +
|
||||
" /*select *\n" +
|
||||
" from @splitString\n" +
|
||||
" where value <> @annoComp\n" +
|
||||
" and IsNumeric(value) <> 0 \n" +
|
||||
" and cast(value as bigint) <> 0 \n" +
|
||||
" and ((value <> @numdocOrig and ISNUMERIC(@numdocOrig) = 0) or ISNUMERIC(@numdocOrig) = 1)\n" +
|
||||
" */\n" +
|
||||
"\n" +
|
||||
" select @numDoc = numNew from @splitString\n" +
|
||||
" where ( numNew <> @annoComp and numNew <> RIGHT( @annoComp, 2)) and \n" +
|
||||
" is_numeric <> 0 and \n" +
|
||||
" cast(numNew as bigint) <> 0 and\n" +
|
||||
" numNew <> @numdocOrig\n" +
|
||||
" \n" +
|
||||
" Set @rowc = @@ROWCOUNT\n" +
|
||||
"\n" +
|
||||
" if @rowc = 0\n" +
|
||||
" begin\n" +
|
||||
" --Analizzare la stringa \n" +
|
||||
" set @i = 0\n" +
|
||||
" while @i < Len(@numdocOrig)\n" +
|
||||
" begin\n" +
|
||||
" select @i = @i+1\n" +
|
||||
" --select substring(@numdocOrig, @i, 1)\n" +
|
||||
" if isNumeric(substring(@numdocOrig, @i, 1) ) = 1 AND (select count(*) FROM @tmpChar WHERE sep = substring(@numdocOrig, @i, 1) ) = 0\n" +
|
||||
" begin\n" +
|
||||
" select @numdoc = IsNull(@numdoc, '') + substring(@numdocOrig, @i, 1)\n" +
|
||||
" end\n" +
|
||||
" else\n" +
|
||||
" begin \n" +
|
||||
" if LEN (@numDoc) > 0\n" +
|
||||
" begin\n" +
|
||||
" break\n" +
|
||||
" end \n" +
|
||||
" \n" +
|
||||
" end\n" +
|
||||
"\n" +
|
||||
" end\n" +
|
||||
" end\n" +
|
||||
" else if @rowC > 1\n" +
|
||||
" begin\n" +
|
||||
" select @numDoc = 0\n" +
|
||||
" end\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" select @numDoc = (SELECT numDoc from ( select @numDoc as numDoc except SELECT * from @tmpChar ) t)\n" +
|
||||
" \n" +
|
||||
" select @numDoc = right(@numDoc, 6)\n" +
|
||||
" \n" +
|
||||
" return cast (@numDoc as int)\n" +
|
||||
"END");
|
||||
|
||||
createOrUpdateFunction("getNumDoc4NumDocForn", "CREATE FUNCTION [dbo].[getNumDoc4NumDocForn]\n" +
|
||||
"(\t\n" +
|
||||
"\t@numdocorig varchar(60), @annoComp varchar(4)\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"RETURNS @numTable TABLE \n" +
|
||||
"(\n" +
|
||||
"\tnum_doc_orig varchar(max), num_doc int\n" +
|
||||
")\n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
"\t\n" +
|
||||
"\tdeclare @sep varchar(5), @numDoc varchar(60), @rowc int, @numDocForn varchar(60)\n" +
|
||||
"\n" +
|
||||
"\tselect @numDocForn = LTRIM(RTRIM(@numdocOrig))\n" +
|
||||
"\n" +
|
||||
"\tdeclare @tmpChar table (sep varchar(5));\n" +
|
||||
"\tdeclare @splitString table (numOrig varchar(60), numNew varchar(60), is_numeric int);\n" +
|
||||
"\n" +
|
||||
"\tSET @numDocForn = REPLACE(@numDocForn, '-', ',');\n" +
|
||||
"\tSET @numDocForn = REPLACE(@numDocForn, '.', ',');\n" +
|
||||
"\tSET @numDocForn = REPLACE(@numDocForn, '_', ',');\n" +
|
||||
"\tSET @numDocForn = REPLACE(@numDocForn, ' ', ',');\n" +
|
||||
"\tSET @numDocForn = REPLACE(@numDocForn, '/', ',');\n" +
|
||||
"\tSET @numDocForn = REPLACE(@numDocForn, '', ',');\n" +
|
||||
"\tSET @numDocForn = REPLACE(@numDocForn, '@', ',');\n" +
|
||||
"\n" +
|
||||
"\tselect @numDocForn = IIF(left(@numDocForn, 2)='IT', substring(@numDocForn, 3, len(@numDocForn) - 2),@numDocForn)\n" +
|
||||
"\n" +
|
||||
"\t\n" +
|
||||
"\t;with tab_p as (\n" +
|
||||
"\tselect value_string as num_new, \n" +
|
||||
"\tCOUNT(*) over (partition by (select 1)) as tot_row, \n" +
|
||||
"\tROW_NUMBER() over (order by (select 1)) as id,\n" +
|
||||
"\tLEN(value_string) as lunghezza\n" +
|
||||
"\tfrom dbo.parseStringIntoArray(@numDocForn, ',')\n" +
|
||||
"\twhere ISNUMERIC(value_string) = 1 )\n" +
|
||||
"\n" +
|
||||
"\t,\n" +
|
||||
"\ttab_union as (\t \n" +
|
||||
"\tselect @numdocOrig as num_doc_forn, try_cast(IIF(try_cast(num_new as bigint) > 2147483647, right(num_new,6), num_new) as int ) as num_doc\n" +
|
||||
"\tfrom (\n" +
|
||||
"\tselect * from tab_p ) t\n" +
|
||||
"\twhere ((num_new <> @annoComp and\n" +
|
||||
"\tnum_new <> right(@annoComp,2)) or tot_row = 1 ) \n" +
|
||||
"\tunion \n" +
|
||||
"\tselect @numdocOrig, Try_cast(@numDocForn as int )\n" +
|
||||
"\twhere not exists (select * from tab_p)\n" +
|
||||
"\tunion\n" +
|
||||
"\tselect @numdocOrig, \n" +
|
||||
"\tcoalesce(TRY_CAST(Right(@numDocForn,6) as int), \n" +
|
||||
"\tIIF(PATINDEX('%[0-9]%', @numDocForn) > 0, try_cast(SUBSTRING(@numDocForn, PATINDEX('%[0-9]%', @numDocForn), len(@numDocForn)) as int), null), \n" +
|
||||
"\tIIF(PATINDEX('%[a-Z]%', @numDocForn) > 0, try_cast(left(@numDocForn, PATINDEX('%[a-Z]%', @numDocForn) - 1) as int), null))\n" +
|
||||
"\twhere not exists (select * from tab_p)\n" +
|
||||
"\t)\n" +
|
||||
"\n" +
|
||||
"\tinsert into @numTable\n" +
|
||||
"\tselect *\n" +
|
||||
"\tfrom tab_union\n" +
|
||||
"\twhere num_doc is not null\n" +
|
||||
"\tand num_doc<> 0\n" +
|
||||
"\t\n" +
|
||||
"\t\n" +
|
||||
"\tRETURN \n" +
|
||||
"END");
|
||||
}
|
||||
|
||||
@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_20250919102659 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("DATI_AZIENDA", "FATTURAZIONE_ELETTRONICA", "FIRST_NUM_DOC", "N",
|
||||
"seleziona sempre il primo numero con lunghezza maggiore dal numero che ci invia il fornitore in fattura elettronica", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (isCustomer(IntegryCustomer.RossoGargano))
|
||||
updateSetupValue("DATI_AZIENDA", "FATTURAZIONE_ELETTRONICA", "FIRST_NUM_DOC", "S");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250919102944 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateFunction("f_getNumDoc4NumDocForn", "CREATE FUNCTION [dbo].[f_getNumDoc4NumDocForn](@numdocOrig varchar(60), @annoComp varchar(4))\n" +
|
||||
"RETURNS int\n" +
|
||||
"AS\n" +
|
||||
"BEGIN \n" +
|
||||
" DECLARE @numDoc int, @selectFirst bit\n" +
|
||||
"\n" +
|
||||
" select @selectFirst = cast(IIF(value = 'S',1,0) as bit) FROM stb_gest_setup WHERe gest_name = 'DATI_AZIENDA' AND section = 'FATTURAZIONE_ELETTRONICA' AND key_section = 'FIRST_NUM_DOC'; \n" +
|
||||
"\n" +
|
||||
" select @numDoc = num_doc\n" +
|
||||
" from(\n" +
|
||||
"select *, COUNT(*) over (partition by len(num_doc)) as conta_len, ROW_NUMBER() over(order by len(num_doc) desc) as sort,\n" +
|
||||
"COUNT(*) over (partition by (select 1)) as tot_num\n" +
|
||||
"from dbo.getNumDoc4NumDocForn(@numDocOrig, @annoComp) )t\n" +
|
||||
"where ((@selectFirst = 1 AND sort = 1 AND conta_len = 1) or (@selectFirst = 0 and tot_num = 1))\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" return @numDoc\n" +
|
||||
"END");
|
||||
createOrUpdateFunction("getNumDoc4NumDocForn", "CREATE FUNCTION [dbo].[getNumDoc4NumDocForn]\n" +
|
||||
"( \n" +
|
||||
" @numdocorig varchar(60), @annoComp varchar(4)\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"RETURNS @numTable TABLE \n" +
|
||||
"(\n" +
|
||||
" num_doc_orig varchar(max), num_doc int\n" +
|
||||
")\n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
" \n" +
|
||||
" declare @sep varchar(5), @numDoc varchar(60), @rowc int, @numDocForn varchar(60)\n" +
|
||||
"\n" +
|
||||
" select @numDocForn = LTRIM(RTRIM(@numdocOrig))\n" +
|
||||
"\n" +
|
||||
" declare @tmpChar table (sep varchar(5));\n" +
|
||||
" declare @splitString table (numOrig varchar(60), numNew varchar(60), is_numeric int);\n" +
|
||||
"\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '-', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '.', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '_', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, ' ', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '/', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '', ',');\n" +
|
||||
" SET @numDocForn = REPLACE(@numDocForn, '@', ',');\n" +
|
||||
"\n" +
|
||||
" select @numDocForn = IIF(left(@numDocForn, 2)='IT', substring(@numDocForn, 3, len(@numDocForn) - 2),@numDocForn)\n" +
|
||||
"\n" +
|
||||
" \n" +
|
||||
" ;with tab_p as (\n" +
|
||||
" select value_string as num_new, \n" +
|
||||
" COUNT(*) over (partition by (select 1)) as tot_row, \n" +
|
||||
" ROW_NUMBER() over (order by (select 1)) as id,\n" +
|
||||
" LEN(value_string) as lunghezza\n" +
|
||||
" from dbo.parseStringIntoArray(@numDocForn, ',')\n" +
|
||||
" where ISNUMERIC(value_string) = 1 )\n" +
|
||||
"\n" +
|
||||
" ,\n" +
|
||||
" tab_union as ( \n" +
|
||||
" select @numdocOrig as num_doc_forn, try_cast(IIF(try_cast(num_new as bigint) > 2147483647, right(num_new,6), num_new) as int ) as num_doc\n" +
|
||||
" from (\n" +
|
||||
" select * from tab_p ) t\n" +
|
||||
" where ((num_new <> @annoComp and\n" +
|
||||
" num_new <> right(@annoComp,2)) or tot_row = 1 ) \n" +
|
||||
" union \n" +
|
||||
" select @numdocOrig, Try_cast(@numDocForn as int )\n" +
|
||||
" where not exists (select * from tab_p)\n" +
|
||||
" union\n" +
|
||||
" select @numdocOrig, \n" +
|
||||
" coalesce(TRY_CAST(Right(@numDocForn,6) as int), \n" +
|
||||
" IIF(PATINDEX('%[0-9]%', @numDocForn) > 0, try_cast(SUBSTRING(@numDocForn, PATINDEX('%[0-9]%', @numDocForn), len(@numDocForn)) as int), null), \n" +
|
||||
" IIF(PATINDEX('%[a-Z]%', @numDocForn) > 0, try_cast(left(@numDocForn, PATINDEX('%[a-Z]%', @numDocForn) - 1) as int), null))\n" +
|
||||
" where not exists (select * from tab_p)\n" +
|
||||
" )\n" +
|
||||
"\n" +
|
||||
" insert into @numTable\n" +
|
||||
" select *\n" +
|
||||
" from tab_union\n" +
|
||||
" where num_doc is not null\n" +
|
||||
" and num_doc<> 0\n" +
|
||||
" \n" +
|
||||
" \n" +
|
||||
" RETURN \n" +
|
||||
"END");
|
||||
|
||||
createOrUpdateView("svw_fattura_elettronica_files",
|
||||
"CREATE View [dbo].[svw_fattura_elettronica_files] as\n" +
|
||||
"SELECT description,\n" +
|
||||
" stb_files_attached.id_attach,\n" +
|
||||
" datetime_attach,\n" +
|
||||
" dtb_fatture_passive.part_iva,\n" +
|
||||
" dtb_fatture_passive.data_doc,\n" +
|
||||
" dtb_fatture_passive.num_doc,\n" +
|
||||
" dtb_fatture_passive.tot_doc,\n" +
|
||||
" dtb_fatture_passive.iban,\n" +
|
||||
" dtb_fatture_passive.cod_dtip,\n" +
|
||||
" (SELECT TOP 1 cod_paga_fe\n" +
|
||||
" FROM dtb_fatture_passive_scad\n" +
|
||||
" WHERE dtb_fatture_passive_scad.id_attach = dtb_fatture_passive.id_attach) AS cod_paga_fe\n" +
|
||||
"FROM stb_files_attached\n" +
|
||||
" INNER JOIN dtb_fatture_passive ON stb_files_attached.parent_id_attach = dtb_fatture_passive.id_attach AND dtb_fatture_passive.part_iva is not null\n" +
|
||||
"WHERE file_ext IN ('P7M', 'XML')\n" +
|
||||
" AND type_attach = 'FP'\n" +
|
||||
" AND stb_files_attached.id_attach = parent_id_attach\n");
|
||||
|
||||
}
|
||||
|
||||
@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_20250919110702 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("alter table mtb_sgrp add flag_miscela bit default 0 not null;\n",
|
||||
"CREATE UNIQUE INDEX ux_mtb_sgrp_flag_miscela ON dbo.mtb_sgrp (flag_miscela) WHERE flag_miscela = 1;");
|
||||
|
||||
if (isCustomer(IntegryCustomer.Biolevante))
|
||||
executeStatement("update mtb_sgrp set flag_miscela = 1 WHERE cod_mgrp = 'S' AND cod_msgr = 'M00'\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_20250922095154 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
dropColumn("ntb_docr", "val_sco_art");
|
||||
executeStatement("alter table ntb_docr add val_voucher numeric(20,5);");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
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_20250922140309 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("IMPORT_SCONTRINI", "MMPOS_SERVICES", "IMPOSTA_DATI_ORDINE", "N",
|
||||
"Imposta sulla riga dello scontrino i dati dell'ordine", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
createSetup("IMPORT_SCONTRINI", "MMPOS_SERVICES", "IMPOSTA_KIT", "N",
|
||||
"Imposta sulla riga dello scontrino il codice del kit ( menu ) ", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
if ( isCustomerDb(IntegryCustomerDB.Carelli_Murgia)) {
|
||||
updateSetupValue("IMPORT_SCONTRINI", "MMPOS_SERVICES", "IMPOSTA_DATI_ORDINE", "S");
|
||||
updateSetupValue("IMPORT_SCONTRINI", "MMPOS_SERVICES", "IMPOSTA_KIT", "S");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
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_20250922143404 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomer(IntegryCustomer.Biolevante)) return;
|
||||
|
||||
createOrUpdateView("olvw_miscele_olio", "CREATE view [dbo].[olvw_miscele_olio] as \n" +
|
||||
"select mtb_aart.cod_mart\n" +
|
||||
"from dbo.mtb_sgrp inner join dbo.mtb_aart on mtb_aart.cod_mgrp = mtb_sgrp.cod_mgrp and mtb_aart.cod_msgr = mtb_sgrp.cod_msgr\n" +
|
||||
"where flag_miscela = 1 and mtb_aart.flag_stato = 'A'");
|
||||
createOrUpdateFunction("lol_getMovimentazioneOlioDett", "CREATE FUNCTION [dbo].[lol_getMovimentazioneOlioDett]\n" +
|
||||
"( \n" +
|
||||
" @codAnag varchar(5), @codDtip varchar(5), @dataDoc datetime, @serDoc varchar(3), @numDoc int, @filtraMiscela bit\n" +
|
||||
")\n" +
|
||||
"RETURNS TABLE as\n" +
|
||||
"return \n" +
|
||||
"(\n" +
|
||||
"SELECT \n" +
|
||||
" doc_r.id_riga, \n" +
|
||||
" doc_r.posizione, \n" +
|
||||
" doc_r.cod_mart, \n" +
|
||||
" doc_r.descrizione_estesa, \n" +
|
||||
" doc_r.unt_doc, \n" +
|
||||
" doc_r.qta_doc, \n" +
|
||||
" doc_r.partita_mag,\n" +
|
||||
" doc_r.cod_art_for as 'cod_art_for',\n" +
|
||||
" dtb_doct.cod_prod,\n" +
|
||||
" dtb_doct.unt_mis_prod,\n" +
|
||||
" dtb_doct.qta_prod,\n" +
|
||||
" dtb_doct.partita_mag as partita_mag_prod,\n" +
|
||||
" mtb_partita_mag.posizione as posizione_prod,\n" +
|
||||
" doc_r.is_olioSfuso\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 mtb_partita_mag on dtb_doct.cod_prod = mtb_partita_mag.cod_mart AND\n" +
|
||||
" dtb_doct.partita_mag = mtb_partita_mag.partita_mag\n" +
|
||||
"LEFT OUTER JOIN (\n" +
|
||||
"SELECT doc_t.activity_id, doc_r.id_riga, doc_r.cod_mart, doc_r.descrizione_estesa, doc_r.unt_doc, doc_r.qta_doc, doc_r.partita_mag, doc_r.posizione, doc_r.cod_art_for,\n" +
|
||||
"case when IsNull(carat.confezionato, 'S') = 'N' THEN 1 ELSE 0 END as is_olioSfuso\n" +
|
||||
"FROM dtb_doct doc_t inner join dtb_docr doc_r on doc_t.cod_anag = doc_r.cod_anag AND \n" +
|
||||
" doc_t.cod_dtip = doc_r.cod_dtip AND \n" +
|
||||
" doc_t.data_doc = doc_r.data_doc AND\n" +
|
||||
" doc_t.ser_doc = doc_r.ser_doc AND\n" +
|
||||
" doc_t.num_doc = doc_r.num_doc\n" +
|
||||
" inner join dtb_tipi on doc_t.cod_dtip = dtb_tipi.cod_dtip \n" +
|
||||
" left outer join olvw_caratteristiche carat on doc_r.cod_mart = carat.cod_mart\n" +
|
||||
"WHERE dtb_tipi.segno_qta_car - dtb_tipi.segno_qta_scar < 0 AND\n" +
|
||||
"(@filtraMiscela = 0 OR (@filtraMiscela = 1 AND doc_t.cod_prod IN (select cod_mart from olvw_miscele_olio )))\n" +
|
||||
") doc_r on dtb_docr.activity_id_row = doc_r.activity_id \n" +
|
||||
" where dtb_doct.cod_anag = @codAnag AND\n" +
|
||||
" dtb_doct.cod_dtip = @codDtip AND\n" +
|
||||
" dtb_doct.data_doc = @dataDoc AND\n" +
|
||||
" dtb_doct.ser_doc = @serDoc AND\n" +
|
||||
" dtb_doct.num_doc = @numDoc AND\n" +
|
||||
" (@filtraMiscela = 0 OR (@filtraMiscela = 1 AND dtb_docr.cod_mart IN (select cod_mart from olvw_miscele_olio )))\n" +
|
||||
")");
|
||||
createOrUpdateView("lvw_MovimentiPosture", "CREATE view [dbo].[lvw_MovimentiPosture] as\n" +
|
||||
"With MovimentiMixPosture as\n" +
|
||||
" ( \n" +
|
||||
" select CarT.cod_prod CarCodProd,\n" +
|
||||
" CarT.partita_mag CartPartitaMag,\n" +
|
||||
" MixT.cod_prod MixTCodProd,\n" +
|
||||
" MixT.partita_mag as MixTPartita,\n" +
|
||||
" CarR.cod_mart CarRCodMart,\n" +
|
||||
" CarR.posizione CarRPos,\n" +
|
||||
" MixR.cod_mart MixRCodMart,\n" +
|
||||
" MixR.posizione MixRPos,\n" +
|
||||
"\n" +
|
||||
" MixT.data_reg,\n" +
|
||||
" MixT.data_ins,\n" +
|
||||
" MixT.cod_mdep,\n" +
|
||||
" carT.gestione,\n" +
|
||||
" CarT.cod_anag,\n" +
|
||||
" gtb_anag.rag_soc,\n" +
|
||||
" CarT.cod_dtip,\n" +
|
||||
" dtb_tipi.descrizione as causale,\n" +
|
||||
" CarT.data_doc,\n" +
|
||||
" CarT.ser_doc,\n" +
|
||||
" CarT.num_doc,\n" +
|
||||
" Cart.cod_prod as cod_prod_fine,\n" +
|
||||
" Cart.partita_mag as partita_mag_fine,\n" +
|
||||
" MixT.cod_prod as Cod_prod_mix,\n" +
|
||||
" MixT.partita_mag as partita_mag_mix,\n" +
|
||||
" case\n" +
|
||||
" when (MixT.cod_prod <> CarT.cod_prod and MixT.cod_prod not in (select cod_mart from olvw_miscele_olio))\n" +
|
||||
" then\n" +
|
||||
" mtb_partita_mag.posizione --Avvinamento\n" +
|
||||
" else\n" +
|
||||
" Case\n" +
|
||||
" when MixR.cod_mart in (select cod_mart from olvw_miscele_olio)\n" +
|
||||
" then null --La miscela termina nel confezionato quindi postura null\n" +
|
||||
" else\n" +
|
||||
" Case\n" +
|
||||
" when MixT.cod_prod in (select cod_mart from olvw_miscele_olio)\n" +
|
||||
" and CarR.posizione = MixR.posizione\n" +
|
||||
" then null --Rigo di scarico a confezionamento di un olio senza serbatoio polomone\n" +
|
||||
"\n" +
|
||||
" else\n" +
|
||||
" CarR.posizione end end end as Posizione_a,\n" +
|
||||
" MixR.cod_dtip as cod_dtip_mix,\n" +
|
||||
" MixR.cod_mart,\n" +
|
||||
" mtb_aart.descrizione_estesa as descrizione_Articolo, \n" +
|
||||
" MixR.partita_mag,\n" +
|
||||
" CASE WHEN Isnull(carat_CarR.Confezionato, 'N') = 'S' -- Scarico olio confezionato\n" +
|
||||
" THEN null else MixR.posizione end as Posizione_da,\n" +
|
||||
"\n" +
|
||||
" MAX(Case\n" +
|
||||
" when MixR.cod_mart in (select cod_mart from olvw_miscele_olio)\n" +
|
||||
" then null\n" +
|
||||
" else MixR.posizione end)\n" +
|
||||
" over (PARTITION by CarT.cod_anag, CarT.cod_Dtip, CarT.data_doc, CarT.ser_doc, CarT.num_doc) as MaxPosizioneA,\n" +
|
||||
" MAX(MixR.posizione)\n" +
|
||||
" over (PARTITION by CarT.cod_anag, CarT.cod_Dtip, CarT.data_doc, CarT.ser_doc, CarT.num_doc) as MaxPosizioneDa, \n" +
|
||||
" Case\n" +
|
||||
" when isnull(carat_CarR.Confezionato , 'N') = 'S' THEN\n" +
|
||||
" case when tipoMix.segno_qta_car - tipoMix.segno_qta_scar > 0 THEN MixT.qta_prod eLSE 0 END --Sconfezionamento \n" +
|
||||
" when MAX(Case\n" +
|
||||
" when MixR.cod_mart in (select cod_mart from olvw_miscele_olio)\n" +
|
||||
" then Null\n" +
|
||||
" else MixR.posizione end)\n" +
|
||||
" over (PARTITION by CarT.cod_anag, CarT.cod_Dtip, CarT.data_doc, CarT.ser_doc, CarT.num_doc) =\n" +
|
||||
" MAX(MixR.posizione)\n" +
|
||||
" over (PARTITION by CarT.cod_anag, CarT.cod_Dtip, CarT.data_doc, CarT.ser_doc, CarT.num_doc)\n" +
|
||||
" and\n" +
|
||||
" MixR.posizione = MAX(Case\n" +
|
||||
" when MixR.cod_mart in (select cod_mart from olvw_miscele_olio)\n" +
|
||||
" then null\n" +
|
||||
" else MixR.posizione end)\n" +
|
||||
" over (PARTITION by CarT.cod_anag, CarT.cod_Dtip, CarT.data_doc, CarT.ser_doc, CarT.num_doc)\n" +
|
||||
" and MixR.cod_mart in (select cod_mart from olvw_miscele_olio)\n" +
|
||||
" then 0 --Esclusione dei movimenti di M00 nei confezionamenti senza serbatoio polmone\n" +
|
||||
" else \n" +
|
||||
" MixR.qta_doc \n" +
|
||||
" end as qta_doc\n" +
|
||||
" from dtb_doct CarT \n" +
|
||||
" INNER JOIN dtb_tipi on CarT.cod_dtip = dtb_tipi.cod_dtip \n" +
|
||||
" INNER JOIN gtb_anag ON CarT.cod_anag = gtb_anag.cod_anag \n" +
|
||||
" INNER JOIN dtb_docr CarR ON CarT.cod_anag = CarR.cod_anag\n" +
|
||||
" and CarT.cod_dtip = CarR.cod_dtip\n" +
|
||||
" and CarT.data_doc = CarR.data_doc\n" +
|
||||
" and CarT.ser_doc = CarR.ser_doc\n" +
|
||||
" and CarT.num_doc = CarR.num_doc \n" +
|
||||
" INNER JOIn dtb_doct MixT ON CarR.activity_id_row = MixT.activity_id \n" +
|
||||
" INNER JOIN dtb_tipi tipoMix on MixT.cod_dtip = tipoMix.cod_dtip\n" +
|
||||
" INNER JOIN dtb_docr MixR ON MixT.cod_anag = MixR.cod_anag\n" +
|
||||
" and MixT.cod_dtip = MixR.cod_dtip\n" +
|
||||
" and MixT.data_doc = MixR.data_doc\n" +
|
||||
" and MixT.ser_doc = MixR.ser_doc\n" +
|
||||
" and MixT.num_doc = MixR.num_doc \n" +
|
||||
" INNER JOIN mtb_partita_mag ON MixT.cod_prod = mtb_partita_mag.cod_mart and \n" +
|
||||
" MixT.partita_mag = mtb_partita_mag.partita_mag \n" +
|
||||
" INNER JOIN mtb_aart ON MixR.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" LEFT OUTER JOIN olvw_caratteristiche carat_CarR on CarR.cod_mart = carat_CarR.cod_mart\n" +
|
||||
" where dtb_tipi.tipo_emissione = 'DIRETTA' \n" +
|
||||
" and Carr.posizione is not null \n" +
|
||||
" And (\n" +
|
||||
" isNUll(mtb_partita_mag.posizione, '') <> isNull(MixR.posizione, '')\n" +
|
||||
" and CarR.posizione <> isNull(MixR.posizione, '') --esclusione dei giroconti dovuti agli avvinamenti\n" +
|
||||
"\n" +
|
||||
" OR MixT.cod_prod in (select cod_mart from olvw_miscele_olio)\n" +
|
||||
" and\n" +
|
||||
" CarR.posizione = isNull(MixR.posizione, '') --Serve ad includere la riga dell'olio dei confezionamenti senza serbatoio polmone\n" +
|
||||
" \n" +
|
||||
" OR MixT.cod_prod not in (select cod_mart from olvw_miscele_olio)\n" +
|
||||
" and ( MixT.cod_prod <> MixR.cod_mart \n" +
|
||||
" OR (MixT.cod_prod = MixR.cod_mart AND IsNull(carat_CarR.Confezionato, 'N') = 'S' )\n" +
|
||||
" )\n" +
|
||||
" and CarR.posizione = isNull(MixR.posizione, '') --Serve ad includere la riga di riqualificazione dell'olio\n" +
|
||||
" ) \n" +
|
||||
" )\n" +
|
||||
"\n" +
|
||||
", movi as (\n" +
|
||||
" --Carichi da Mix per movimento speciale \n" +
|
||||
" Select data_reg,\n" +
|
||||
" data_ins,\n" +
|
||||
" MovimentiMixPosture.cod_mdep,\n" +
|
||||
" gestione,\n" +
|
||||
" cod_anag,\n" +
|
||||
" rag_soc,\n" +
|
||||
" cod_dtip,\n" +
|
||||
" causale,\n" +
|
||||
" data_doc,\n" +
|
||||
" ser_doc,\n" +
|
||||
" num_doc,\n" +
|
||||
" posizione_a as Posizione,\n" +
|
||||
" mtb_depo_posizioni.descrizione as descrizione_posizione,\n" +
|
||||
" mtb_depo_posizioni.capacita,\n" +
|
||||
" cod_mart,\n" +
|
||||
" descrizione_Articolo,\n" +
|
||||
" partita_mag,\n" +
|
||||
" qta_doc as qta_Car,\n" +
|
||||
" 0 as qta_Scar,\n" +
|
||||
" ISNULL(cod_prod_fine, cod_prod_mix) as cod_prod,\n" +
|
||||
" ISNULL(partita_mag_fine, partita_mag_mix) as partita_mag_prod\n" +
|
||||
" from MovimentiMixPosture,\n" +
|
||||
" mtb_depo_posizioni\n" +
|
||||
" Where Posizione_a is not null\n" +
|
||||
" and qta_doc <> 0\n" +
|
||||
" /*and MovimentiMixPosture.cod_mdep = mtb_depo_posizioni.cod_mdep*/\n" +
|
||||
" and MovimentiMixPosture.Posizione_a = mtb_depo_posizioni.posizione\n" +
|
||||
" \n" +
|
||||
" Union all\n" +
|
||||
"\n" +
|
||||
" --Scarichi da Mix per movimento speciale\n" +
|
||||
" Select data_reg,\n" +
|
||||
" data_ins,\n" +
|
||||
" MovimentiMixPosture.cod_mdep,\n" +
|
||||
" gestione,\n" +
|
||||
" cod_anag,\n" +
|
||||
" rag_soc,\n" +
|
||||
" cod_dtip,\n" +
|
||||
" causale,\n" +
|
||||
" data_doc,\n" +
|
||||
" ser_doc,\n" +
|
||||
" num_doc,\n" +
|
||||
" posizione_da as Posizione,\n" +
|
||||
" mtb_depo_posizioni.descrizione as descrizione_posizione,\n" +
|
||||
" mtb_depo_posizioni.capacita,\n" +
|
||||
" cod_mart,\n" +
|
||||
" descrizione_Articolo,\n" +
|
||||
" partita_mag,\n" +
|
||||
" 0 as qta_Car,\n" +
|
||||
" qta_doc as qta_Scar,\n" +
|
||||
" ISNULL(cod_prod_fine, cod_prod_mix) as cod_prod,\n" +
|
||||
" ISNULL(partita_mag_fine, partita_mag_mix) as partita_mag_prod\n" +
|
||||
" from MovimentiMixPosture,\n" +
|
||||
" mtb_depo_posizioni\n" +
|
||||
" Where Posizione_da is not null\n" +
|
||||
" and qta_doc <> 0\n" +
|
||||
" /*and MovimentiMixPosture.cod_mdep = mtb_depo_posizioni.cod_mdep*/\n" +
|
||||
" and MovimentiMixPosture.Posizione_da = mtb_depo_posizioni.posizione\n" +
|
||||
" \n" +
|
||||
" union all\n" +
|
||||
"\n" +
|
||||
" --Carichi e scarichi da movimenti normali (inventari, ddt di vendita, etc)\n" +
|
||||
" Select dtb_doct.data_reg,\n" +
|
||||
" dtb_doct.data_ins,\n" +
|
||||
" dtb_doct.cod_mdep,\n" +
|
||||
" dtb_doct.gestione,\n" +
|
||||
" dtb_doct.cod_anag,\n" +
|
||||
" gtb_anag.rag_soc,\n" +
|
||||
" dtb_doct.cod_dtip,\n" +
|
||||
" dtb_tipi.descrizione as causale,\n" +
|
||||
" dtb_doct.data_doc,\n" +
|
||||
" dtb_doct.ser_doc,\n" +
|
||||
" dtb_doct.num_doc,\n" +
|
||||
" dtb_docr.posizione,\n" +
|
||||
" mtb_depo_posizioni.descrizione as descrizione_posizione,\n" +
|
||||
" mtb_depo_posizioni.capacita,\n" +
|
||||
" dtb_docr.cod_mart,\n" +
|
||||
" mtb_aart.descrizione_estesa,\n" +
|
||||
" dtb_docr.partita_mag,\n" +
|
||||
" dtb_docr.qta_doc * dtb_docr.rap_conv * (segno_qta_car) as qta_Car,\n" +
|
||||
" dtb_docr.qta_doc * dtb_docr.rap_conv * (segno_qta_scar) as qta_sCar,\n" +
|
||||
" dtb_doct.cod_prod,\n" +
|
||||
" dtb_doct.partita_mag as partita_mag_prod\n" +
|
||||
" from dtb_doct,\n" +
|
||||
" dtb_docr\n" +
|
||||
" left outer join mtb_depo_posizioni on dtb_docr.posizione = mtb_depo_posizioni.posizione,\n" +
|
||||
" dtb_tipi,\n" +
|
||||
" gtb_anag,\n" +
|
||||
" mtb_aart\n" +
|
||||
" Where dtb_doct.cod_anag = dtb_docr.cod_anag\n" +
|
||||
" and dtb_doct.cod_dtip = dtb_docr.cod_dtip\n" +
|
||||
" and dtb_doct.data_doc = dtb_docr.data_doc\n" +
|
||||
" and dtb_doct.ser_doc = dtb_docr.ser_doc\n" +
|
||||
" and dtb_doct.num_doc = dtb_docr.num_doc\n" +
|
||||
" and dtb_doct.cod_anag = gtb_anag.cod_anag\n" +
|
||||
" and dtb_doct.cod_dtip = dtb_tipi.cod_dtip\n" +
|
||||
" and dtb_docr.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" and dtb_tipi.tipo_emissione = 'DIRETTA'\n" +
|
||||
" and dtb_docr.posizione is not null\n" +
|
||||
" and dtb_doct.activity_id is null\n" +
|
||||
" and dtb_docr.cod_mart not in (select cod_mart from olvw_miscele_olio)\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"select data_reg,\n" +
|
||||
" data_ins,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" gestione,\n" +
|
||||
" cod_anag,\n" +
|
||||
" rag_soc,\n" +
|
||||
" cod_dtip,\n" +
|
||||
" causale,\n" +
|
||||
" data_doc,\n" +
|
||||
" ser_doc,\n" +
|
||||
" num_doc,\n" +
|
||||
" Posizione,\n" +
|
||||
" descrizione_posizione,\n" +
|
||||
" capacita,\n" +
|
||||
" cod_mart,\n" +
|
||||
" descrizione_Articolo,\n" +
|
||||
" partita_mag,\n" +
|
||||
" sum(qta_Car) as qta_car,\n" +
|
||||
" sum(qta_Scar) as qta_scar,\n" +
|
||||
" cod_prod,\n" +
|
||||
" partita_mag_prod\n" +
|
||||
"from movi\n" +
|
||||
"group by data_reg,\n" +
|
||||
" data_ins,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" gestione,\n" +
|
||||
" cod_anag,\n" +
|
||||
" rag_soc,\n" +
|
||||
" cod_dtip,\n" +
|
||||
" causale,\n" +
|
||||
" data_doc,\n" +
|
||||
" ser_doc,\n" +
|
||||
" num_doc,\n" +
|
||||
" Posizione,\n" +
|
||||
" descrizione_posizione,\n" +
|
||||
" capacita,\n" +
|
||||
" cod_mart,\n" +
|
||||
" descrizione_Articolo,\n" +
|
||||
" partita_mag,\n" +
|
||||
" cod_prod,\n" +
|
||||
" partita_mag_prod");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,187 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250923113155 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isTextiles())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("ftx_getDisponibilitaArticoli", "CREATE FUNCTION [dbo].[ftx_getDisponibilitaArticoli](@datavalidita DATETIME,\n" +
|
||||
" @codmdep VARCHAR(8000),\n" +
|
||||
" @annostag VARCHAR(10),\n" +
|
||||
" @codmart VARCHAR(15),\n" +
|
||||
" @codtagl VARCHAR(15),\n" +
|
||||
" @codcol VARCHAR(15),\n" +
|
||||
" @barcode VARCHAR(15))\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
" WITH setup AS (SELECT mtb_depo.cod_mdep,\n" +
|
||||
" MAX(IIF(stb_gest_setup.key_section = 'INCLUDI_QTA_ORD_FOR',\n" +
|
||||
" ISNULL(stb_gest_setup_depo.value, stb_gest_setup.value),\n" +
|
||||
" NULL)) AS includi_qta_ord_for,\n" +
|
||||
" MAX(IIF(stb_gest_setup.key_section = 'ESCLUDI_QTA_COLLI',\n" +
|
||||
" ISNULL(stb_gest_setup_depo.value, 'S'), NULL)) AS ESCLUDI_QTA_COLLI\n" +
|
||||
" FROM mtb_depo\n" +
|
||||
" CROSS APPLY stb_gest_setup\n" +
|
||||
" LEFT OUTER JOIN stb_gest_setup_depo\n" +
|
||||
" ON mtb_depo.cod_mdep = stb_gest_setup_depo.cod_mdep AND\n" +
|
||||
" stb_gest_setup.gest_name = stb_gest_setup_depo.gest_name AND\n" +
|
||||
" stb_gest_setup.section = stb_gest_setup_depo.section AND\n" +
|
||||
" stb_gest_setup.key_section = stb_gest_setup_depo.key_section\n" +
|
||||
" WHERE stb_gest_setup.gest_name = 'DATI_AZIENDA'\n" +
|
||||
" AND stb_gest_setup.section = 'CALCOLO_DISPONIBILITA'\n" +
|
||||
" AND stb_gest_setup.key_section IN ('INCLUDI_QTA_ORD_FOR', 'ESCLUDI_QTA_COLLI')\n" +
|
||||
" GROUP BY mtb_depo.cod_mdep),\n" +
|
||||
" articoli AS (SELECT ttb_style.anno_stag,\n" +
|
||||
" ttb_style.cod_style,\n" +
|
||||
" ttb_style_colori.cod_col,\n" +
|
||||
" ttb_style_taglie.cod_tagl,\n" +
|
||||
" mtb_part_dt.qta_ord_for,\n" +
|
||||
" mtb_part_dt.cod_mdep\n" +
|
||||
" FROM ttb_style,\n" +
|
||||
" ttb_style_colori,\n" +
|
||||
" ttb_style_taglie,\n" +
|
||||
" mtb_part_dt\n" +
|
||||
" WHERE (@codmdep IS NULL OR mtb_part_dt.cod_mdep IN (SELECT value_string AS cod_mdep\n" +
|
||||
" FROM parsestringintoarray(@codmdep, ',')))\n" +
|
||||
" AND (@codmart IS NULL OR ttb_style.cod_style = @codmart)\n" +
|
||||
" AND (@codcol IS NULL OR ttb_style_colori.cod_col = @codcol)\n" +
|
||||
" AND (@codtagl IS NULL OR ttb_style_taglie.cod_tagl = @codtagl)\n" +
|
||||
" AND (@annostag IS NULL OR ttb_style.anno_stag = @annostag)\n" +
|
||||
" AND ttb_style.cod_style = mtb_part_dt.cod_mart\n" +
|
||||
" AND ttb_style_colori.cod_col = mtb_part_dt.cod_col\n" +
|
||||
" AND ttb_style_taglie.cod_tagl = mtb_part_dt.cod_tagl\n" +
|
||||
" AND ttb_style.cod_style = ttb_style_colori.cod_style\n" +
|
||||
" AND ttb_style.cod_style = ttb_style_taglie.cod_style),\n" +
|
||||
" colli AS (SELECT mtb_colr.cod_mart,\n" +
|
||||
" mtb_colr.cod_col,\n" +
|
||||
" mtb_colr.cod_tagl,\n" +
|
||||
" SUM(mtb_colr.qta_col) AS qta,\n" +
|
||||
" mtb_colt.cod_mdep\n" +
|
||||
" FROM mtb_colt\n" +
|
||||
" LEFT OUTER JOIN dtb_tipi ON mtb_colt.cod_dtip = dtb_tipi.cod_dtip,\n" +
|
||||
" mtb_colr\n" +
|
||||
" WHERE mtb_colt.gestione = mtb_colr.gestione\n" +
|
||||
" AND mtb_colt.data_collo = mtb_colr.data_collo\n" +
|
||||
" AND mtb_colt.ser_collo = mtb_colr.ser_collo\n" +
|
||||
" AND mtb_colt.num_collo = mtb_colr.num_collo\n" +
|
||||
" AND mtb_colt.gestione = 'V'\n" +
|
||||
" AND (@codmdep IS NULL OR mtb_colt.cod_mdep IN (SELECT value_string AS cod_mdep\n" +
|
||||
" FROM parsestringintoarray(@codmdep, ',')))\n" +
|
||||
" AND (mtb_colt.cod_dtip IS NULL OR (dtb_tipi.segno_qta_car = 0 AND dtb_tipi.segno_qta_scar = 0))\n" +
|
||||
" AND (@codmart IS NULL OR mtb_colr.cod_mart = @codmart)\n" +
|
||||
" AND (@codcol IS NULL OR mtb_colr.cod_col = @codcol)\n" +
|
||||
" AND (@codtagl IS NULL OR mtb_colr.cod_tagl = @codtagl)\n" +
|
||||
" GROUP BY mtb_colr.cod_mart,\n" +
|
||||
" mtb_colr.cod_col,\n" +
|
||||
" mtb_colr.cod_tagl,\n" +
|
||||
" mtb_colt.cod_mdep),\n" +
|
||||
" prenotazione AS (SELECT wdtb_ordr.cod_mart,\n" +
|
||||
" wdtb_ordr.cod_col,\n" +
|
||||
" wdtb_ordr.cod_tagl,\n" +
|
||||
" SUM(wdtb_ordr.qta_ord) AS qta,\n" +
|
||||
" wdtb_ordt.cod_mdep\n" +
|
||||
" FROM wdtb_ordt,\n" +
|
||||
" wdtb_ordr\n" +
|
||||
" WHERE wdtb_ordt.gestione = wdtb_ordr.gestione\n" +
|
||||
" AND wdtb_ordt.data_ord = wdtb_ordr.data_ord\n" +
|
||||
" AND wdtb_ordt.num_ord = wdtb_ordr.num_ord\n" +
|
||||
" AND wdtb_ordt.gestione = 'V'\n" +
|
||||
" AND (@codmdep IS NULL OR wdtb_ordt.cod_mdep IN (SELECT value_string AS cod_mdep\n" +
|
||||
" FROM parsestringintoarray(@codmdep, ',')))\n" +
|
||||
" AND wdtb_ordt.flag_elaborato = 'N'\n" +
|
||||
" AND (@codmart IS NULL OR wdtb_ordr.cod_mart = @codmart)\n" +
|
||||
" AND (@codcol IS NULL OR wdtb_ordr.cod_col = @codcol)\n" +
|
||||
" AND (@codtagl IS NULL OR wdtb_ordr.cod_tagl = @codtagl)\n" +
|
||||
" GROUP BY wdtb_ordr.cod_mart,\n" +
|
||||
" wdtb_ordr.cod_col,\n" +
|
||||
" wdtb_ordr.cod_tagl,\n" +
|
||||
" wdtb_ordt.cod_mdep),\n" +
|
||||
" ordine AS (SELECT dtb_ordr.cod_mart,\n" +
|
||||
" dtb_ordr.cod_col,\n" +
|
||||
" dtb_ordr.cod_tagl,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN SUM(CASE\n" +
|
||||
" WHEN dtb_ordr.flag_evaso = 'I' OR\n" +
|
||||
" (dtb_ordr.flag_evaso = 'A' AND dtb_ordr.qta_acc > 0)\n" +
|
||||
" THEN dtb_ordr.qta_ord - dtb_ordr.qta_evasa - dtb_ordr.qta_col\n" +
|
||||
" ELSE 0 END) > 0 THEN\n" +
|
||||
" SUM(CASE\n" +
|
||||
" WHEN dtb_ordr.flag_evaso = 'I' OR\n" +
|
||||
" (dtb_ordr.flag_evaso = 'A' AND dtb_ordr.qta_acc > 0)\n" +
|
||||
" THEN dtb_ordr.qta_ord - dtb_ordr.qta_evasa - dtb_ordr.qta_col\n" +
|
||||
" ELSE 0 END)\n" +
|
||||
" ELSE 0 END AS qta,\n" +
|
||||
" SUM(dtb_ordr.qta_acc) AS qta_acc,\n" +
|
||||
" /*sum(dtb_ordr.qta_acc - dtb_ordr.qta_col) as qta_acc,*/\n" +
|
||||
" dtb_ordt.cod_mdep\n" +
|
||||
" FROM dtb_ordt,\n" +
|
||||
" dtb_ordr\n" +
|
||||
" WHERE 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" +
|
||||
" AND dtb_ordt.gestione = 'V'\n" +
|
||||
" AND (@codmdep IS NULL OR dtb_ordt.cod_mdep IN (SELECT value_string AS cod_mdep\n" +
|
||||
" FROM parsestringintoarray(@codmdep, ',')))\n" +
|
||||
" /* AND dtb_ordr.flag_evaso = 'I'*/\n" +
|
||||
" AND dtb_ordt.flag_annulla = 'N'\n" +
|
||||
" AND (@codmart IS NULL OR dtb_ordr.cod_mart = @codmart)\n" +
|
||||
" AND (@codcol IS NULL OR dtb_ordr.cod_col = @codcol)\n" +
|
||||
" AND (@codtagl IS NULL OR dtb_ordr.cod_tagl = @codtagl)\n" +
|
||||
" GROUP BY dtb_ordr.cod_mart,\n" +
|
||||
" dtb_ordr.cod_col,\n" +
|
||||
" dtb_ordr.cod_tagl,\n" +
|
||||
" dtb_ordt.cod_mdep)\n" +
|
||||
"\n" +
|
||||
" SELECT articoli.anno_stag,\n" +
|
||||
" articoli.cod_style,\n" +
|
||||
" articoli.cod_col,\n" +
|
||||
" articoli.cod_tagl,\n" +
|
||||
" ttb_bar_code.cod_barre,\n" +
|
||||
" articoli.cod_mdep,\n" +
|
||||
" ISNULL(giacenza.qta_fine, 0) AS giacenza,\n" +
|
||||
" ISNULL(articoli.qta_ord_for, 0) AS ord_forn,\n" +
|
||||
" ISNULL(ordine.qta, 0) AS ordini,\n" +
|
||||
" ISNULL(prenotazione.qta, 0) AS ordini_web,\n" +
|
||||
" ISNULL(ordine.qta_acc, 0) AS accant_su_ordine,\n" +
|
||||
" ISNULL(colli.qta, 0) AS colli,\n" +
|
||||
" ISNULL(giacenza.qta_fine, 0) - ISNULL(ordine.qta, 0) - ISNULL(prenotazione.qta, 0) +\n" +
|
||||
" IIF(setup.includi_qta_ord_for = 'S', ISNULL(articoli.qta_ord_for, 0), 0) -\n" +
|
||||
" IIF(setup.ESCLUDI_QTA_COLLI = 'S', ISNULL(colli.qta, 0), 0) AS qta_disp,\n" +
|
||||
" ISNULL(giacenza.qta_fine, 0) - ISNULL(ordine.qta_acc, 0) - ISNULL(colli.qta, 0) AS qta_distrib_su_ordini\n" +
|
||||
" FROM articoli\n" +
|
||||
" LEFT OUTER JOIN ttb_bar_code ON articoli.cod_style = ttb_bar_code.cod_style AND\n" +
|
||||
" articoli.cod_col = ttb_bar_code.cod_col AND\n" +
|
||||
" articoli.cod_tagl = ttb_bar_code.cod_tagl\n" +
|
||||
" LEFT OUTER JOIN getsitartadatadett(@datavalidita, @codmdep) giacenza\n" +
|
||||
" ON articoli.cod_style = giacenza.cod_mart AND articoli.cod_col = giacenza.cod_col AND\n" +
|
||||
" articoli.cod_tagl = giacenza.cod_tagl AND articoli.cod_mdep = giacenza.cod_mdep\n" +
|
||||
" LEFT OUTER JOIN ordine\n" +
|
||||
" ON articoli.cod_style = ordine.cod_mart AND articoli.cod_col = ordine.cod_col AND\n" +
|
||||
" articoli.cod_tagl = ordine.cod_tagl AND articoli.cod_mdep = ordine.cod_mdep\n" +
|
||||
" LEFT OUTER JOIN prenotazione ON articoli.cod_style = prenotazione.cod_mart AND\n" +
|
||||
" articoli.cod_col = prenotazione.cod_col AND\n" +
|
||||
" articoli.cod_tagl = prenotazione.cod_tagl AND\n" +
|
||||
" articoli.cod_mdep = prenotazione.cod_mdep\n" +
|
||||
" LEFT OUTER JOIN colli ON articoli.cod_style = colli.cod_mart AND articoli.cod_col = colli.cod_col AND\n" +
|
||||
" articoli.cod_tagl = colli.cod_tagl AND articoli.cod_mdep = colli.cod_mdep\n" +
|
||||
" left outer join setup on setup.cod_mdep = articoli.cod_mdep\n" +
|
||||
" WHERE (@barcode IS NULL OR ttb_bar_code.cod_barre = @barcode)");
|
||||
}
|
||||
|
||||
@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.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250923115203 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomer(IntegryCustomer.FolliesGroup)) {
|
||||
|
||||
updateSetupValue("DATI_AZIENDA", "SETUP", "DELIMITED_IDENTIFIER", "1");
|
||||
}
|
||||
}
|
||||
|
||||
@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_20250923132435 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("f_getCodEsenz", "CREATE FUNCTION [dbo].[f_getCodEsenz](@gestione varchar(1), @codAnag varchar(5), @codVdes varchar(5))\n" +
|
||||
"RETURNS varchar(5) \n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
" DECLARE @ls_codAliqCli VARCHAR(5),\n" +
|
||||
" @ls_codAliqForn VARCHAR(5),\n" +
|
||||
" @ls_codAliqIn VARCHAR(5),\n" +
|
||||
" @ls_codAliqOut VARCHAR(5),\n" +
|
||||
" @ls_codesenz VARCHAR(5),\n" +
|
||||
" @existCodAnag INTEGER;\n" +
|
||||
" \n" +
|
||||
" SELECT @existCodAnag = 0\n" +
|
||||
" SELECT @ls_codAliqCli = vtb_clie.cod_aliq,\n" +
|
||||
" @ls_codAliqForn = atb_forn.cod_aliq,\n" +
|
||||
" @ls_codAliqIn = vtb_dest.cod_aliq_in,\n" +
|
||||
" @ls_codAliqOut = vtb_dest.cod_aliq_out,\n" +
|
||||
" @existCodAnag = 1\n" +
|
||||
" FROM gtb_anag LEFT OUTER JOIN vtb_clie ON vtb_clie.cod_anag = gtb_anag.cod_anag\n" +
|
||||
" LEFT OUTER JOIN atb_forn ON atb_forn.cod_anag = @codAnag\n" +
|
||||
" LEFT OUTER JOIN vtb_dest ON vtb_dest.cod_vdes = @codVdes AND\n" +
|
||||
" vtb_dest.cod_anag = @codAnag\n" +
|
||||
" WHERE gtb_anag.cod_anag = @codAnag;\n" +
|
||||
"\n" +
|
||||
" IF @gestione = 'V' and @existCodAnag = 0\n" +
|
||||
" begin\n" +
|
||||
" select @ls_codAliqIn = ptb_dest.cod_aliq_in,\n" +
|
||||
" @ls_codAliqOut = ptb_dest.cod_aliq_out\n" +
|
||||
" from ptb_dest \n" +
|
||||
" where cod_ppro = @codAnag AND\n" +
|
||||
" cod_pdes = @codVdes;\n" +
|
||||
" end\n" +
|
||||
" \n" +
|
||||
" if @ls_codAliqIn is null and @ls_codAliqOut is not null\n" +
|
||||
" SELECT @ls_codesenz = @ls_codAliqOut\n" +
|
||||
" \n" +
|
||||
" if @gestione <>'V'\n" +
|
||||
" SELECT @ls_codAliqCli = @ls_codAliqForn\n" +
|
||||
" \n" +
|
||||
" if @ls_codesenz is null and @ls_codAliqCli is not null \n" +
|
||||
" SELECT @ls_codEsenz = @ls_codAliqCli\n" +
|
||||
" \n" +
|
||||
" RETURN @ls_codEsenz;\n" +
|
||||
"END");
|
||||
}
|
||||
|
||||
@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.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250923171606 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("alter table dbo.wtb_depo add default_depo tinyint not null default 0",
|
||||
"create unique index ux_wtb_depo_depo_default_utente\n" +
|
||||
" on dbo.wtb_depo (user_name)\n" +
|
||||
" where default_depo = 1");
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Biolevante_Biolevante)){
|
||||
executeStatement("update wtb_depo set default_depo = 1 where cod_mdep = '01'");
|
||||
}
|
||||
}
|
||||
|
||||
@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_20250924151610 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("COD_PROMO_TAGLI", "Query per selezionare i tagli prezzo", "SELECT COD_PROMO FROM VTB_PROMO WHERE flag_tipo_promo = 'T'");
|
||||
executeStatement("update stb_gest_setup\n" +
|
||||
"set query_default = 'c' where gest_name = 'pvm' and section = 'CHIUSURA_TAGLI_PREZZO'\n" +
|
||||
"and key_section ='COD_PROMO_TAGLI' ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -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,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_20250925130833 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomer(IntegryCustomer.Carelli))
|
||||
return;
|
||||
|
||||
|
||||
updateSetupValue("DATI_AZIENDA", "SETUP", "LOGIN_OVER_WEBSERVICES", "S");
|
||||
}
|
||||
|
||||
@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