Compare commits
629 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c5d4db3e8 | |||
| 8d94ce6d80 | |||
| cc30fe7bf4 | |||
| 0c1061e6f4 | |||
| e3872881f6 | |||
| c02397efd5 | |||
| b9dc343dc8 | |||
| cfabbc6eff | |||
| 43b89de822 | |||
| 912c3370fc | |||
| 5f7ddbfb1e | |||
| 9e7f25dba0 | |||
| 54f5e599b5 | |||
| 7e296f37b0 | |||
| 2bddb280ee | |||
| 942fb1de9a | |||
| e854d97b74 | |||
| f12b98a3c3 | |||
| 14a4fe5841 | |||
| 8293b71c5e | |||
| b8aa5ceea2 | |||
| 768897e507 | |||
| 35feb72c76 | |||
| ab55298847 | |||
| e7467b19d0 | |||
| cd6e98a59c | |||
| 92d465fd77 | |||
| df9ee8bdb4 | |||
| a6ce521f47 | |||
| 114255bb87 | |||
| 4499a042f8 | |||
| 386b253115 | |||
| f9f0d90334 | |||
| 3ba550c124 | |||
| 7e442efc5f | |||
| 85763bc747 | |||
| f62ad2b019 | |||
| dcee1f0438 | |||
| 3192bdf419 | |||
| 8899b245d6 | |||
| 13cfef1437 | |||
| 9d66e95ca9 | |||
| 9d3d5ef273 | |||
| 8ed0c450ed | |||
| e07c961508 | |||
| 3282db3824 | |||
| d2647c142e | |||
| ad490d0e91 | |||
| 0b14efd595 | |||
| 6c498e1857 | |||
| cf047a84fb | |||
| f21b0b8a17 | |||
| f544ea0eae | |||
| d2045f8c0d | |||
| dc4b79f1c3 | |||
| 38f9c80d93 | |||
| e551461f49 | |||
| c6c721240d | |||
| 95bdf3b5e7 | |||
| 63dd00e512 | |||
| f4a55298f7 | |||
| c6d75c4418 | |||
| afd5d7e4f7 | |||
| 96dd57eba6 | |||
| 0332d47e56 | |||
| f5f0b268d8 | |||
| 088bae8052 | |||
| 5942c8dc04 | |||
| 9a57d0df03 | |||
| 67a2701b16 | |||
| 894372b8be | |||
| 62e71947ef | |||
| b2671c97c5 | |||
| 0296830d3b | |||
| 7d2d0db7d3 | |||
| 93a50e226c | |||
| 2af9d633f0 | |||
| 0f67fcdef4 | |||
| dce37f0be5 | |||
| f30c2aac3b | |||
| 3d87675d77 | |||
| 7abd9feb72 | |||
| d514bfe40c | |||
| 38c0cc3fee | |||
| e28d32fbad | |||
| 1c5359eb7d | |||
| 89dce20add | |||
| 6ea61efc76 | |||
| 17cf56ada2 | |||
| 1ec81f1359 | |||
| a78d146550 | |||
| 8b5d024feb | |||
| 0c7018b2d3 | |||
| 9a85978461 | |||
| a2544d7334 | |||
| f49c92d96c | |||
| afd264a5ca | |||
| a31bb77889 | |||
| 1bd2939e84 | |||
| cae404e4f1 | |||
| 8b02512c63 | |||
| 97c69c79db | |||
| 687e38d88c | |||
| 8dc2b6d1ce | |||
| c74919a59b | |||
| 54cf4d11e9 | |||
| 8cae935899 | |||
| 76deea81c4 | |||
| 91754b4df7 | |||
| c74e5e3b39 | |||
| 2d0ace0def | |||
| acd4592345 | |||
| ee2c21b3b9 | |||
| 71925e3ea1 | |||
| 55e6dd62a6 | |||
| 79588172a7 | |||
| 33925d68b3 | |||
| bf2644768e | |||
| 44a9430d0d | |||
| f817daded5 | |||
| ab9346af02 | |||
| 864d929ea6 | |||
| 0ed6719508 | |||
| a269ad0fda | |||
| dbbfef35a9 | |||
| 4132212605 | |||
| a26b93f8a9 | |||
| 7efd7c353a | |||
| 98cc52e84f | |||
| 65db8b285c | |||
| e69f6f37d4 | |||
| 8a49d500a4 | |||
| 3991db50c4 | |||
| 9714631b68 | |||
| fdd4bfec6e | |||
| a8900568f6 | |||
| 6aefdb8b84 | |||
| 10e2f5a341 | |||
| e338412abb | |||
| ef08937e05 | |||
| 37ca0b1ae2 | |||
| bcc7af3acd | |||
| 71f5cf1ec6 | |||
| eaab42ee14 | |||
| b3a9cbbfd8 | |||
| 417d857547 | |||
| 56ad2003ac | |||
| 51bbdb6d24 | |||
| 194fd34c34 | |||
| 3ec507a967 | |||
| fcfc9f0da2 | |||
| e1de69babd | |||
| 51fb7ad34e | |||
| ad775341ad | |||
| 5df2e5e314 | |||
| 410b2155da | |||
| ebb16b6136 | |||
| fef8aaaa2f | |||
| 9fac681033 | |||
| 19732e091b | |||
| 739205f972 | |||
| 06da8c6b48 | |||
| 672ec76955 | |||
| 12dc64eb15 | |||
| 356c6b6f85 | |||
| 8e0aa7ba0c | |||
| 6047080f37 | |||
| 5d2daaf7cd | |||
| a6b10d57b7 | |||
| 68a6a3ff1b | |||
| 2109fbd65e | |||
| 01c00226bd | |||
| f1578bfe4b | |||
| d245421d52 | |||
| aab825d4fc | |||
| 3b33c1a34d | |||
| 1f2e7ce0f6 | |||
| 692c9e707b | |||
| 6d920a2453 | |||
| 67e8b2af54 | |||
| 803670f5e8 | |||
| 35272d7460 | |||
| 6f91af6546 | |||
| 8dceab40f3 | |||
| 84f76348ad | |||
| b445a17280 | |||
| 9d957975d0 | |||
| f85cc1bd33 | |||
| 89d75a36cf | |||
| d8d16a7972 | |||
| dd67130eb5 | |||
| f66fe0cb1c | |||
| 3dbc5dfb38 | |||
| 28a1a3d828 | |||
| 155da598fa | |||
| cff9bbc5c7 | |||
| e06614fd60 | |||
| 734d155d3d | |||
| 3b9bc051dd | |||
| 8df4e74a56 | |||
| beb025984e | |||
| 10d7ef179a | |||
| ec13ba8257 | |||
| f896f59bcc | |||
| 43de071280 | |||
| 2bab549ab7 | |||
| 988e91630b | |||
| 940ddae3e0 | |||
| be241f04d2 | |||
| 3873d468e7 | |||
| 318bb6d3d9 | |||
| 62d692dc32 | |||
| 228994e1e9 | |||
| 1de156f0a3 | |||
| d97fda4a83 | |||
| 9270fed036 | |||
| 4a477df49d | |||
| dc52e06160 | |||
| 1b0162ea53 | |||
| 1cde6e7e58 | |||
| 45ad346924 | |||
| 5c7b5c677d | |||
| a9f526af15 | |||
| 467010dc13 | |||
| ba13697dda | |||
| 6a51eae198 | |||
| f18f13dac4 | |||
| 825412e81a | |||
| 464c22f743 | |||
| 91524932f4 | |||
| a464c989c3 | |||
| 559206cd70 | |||
| 819928805f | |||
| 24300e8805 | |||
| 5896862614 | |||
| 70078533d2 | |||
| 07b7ad6ee3 | |||
| fc1ce2ce53 | |||
| 958421f4f5 | |||
| ef59f66c67 | |||
| 14bf36ed68 | |||
| 06bac914ef | |||
| 1b956580c9 | |||
| 625f12a1e8 | |||
| 63f0412065 | |||
| 6eb51e8feb | |||
| 19557d6e05 | |||
| 84dffd8966 | |||
| 113ad8bcf6 | |||
| 58acf21f52 | |||
| c32715a4b5 | |||
| a83752e565 | |||
| ec2ce96b3b | |||
| d131e0b42d | |||
| efea14db89 | |||
| c09d8a6b0f | |||
| 946ad1d29c | |||
| c5f1d1669f | |||
| 689e81219b | |||
| 05ec565f84 | |||
| 0e7866922d | |||
| fb92f9faea | |||
| f65d07ab22 | |||
| f140b6df54 | |||
| 441ddc4397 | |||
| 9f16294994 | |||
| fd4e961b39 | |||
| 7156ca93d0 | |||
| 8c42493382 | |||
| 7a6eebcdab | |||
| e1b4dc52cb | |||
| 99ea410056 | |||
| ae19eae94d | |||
| 5f321fba3a | |||
| 3401bb7557 | |||
| b7a127c1cd | |||
| 8f6eaf5a53 | |||
| 80150b508a | |||
| 34089f946f | |||
| 7bc58a74e1 | |||
| 92f347cd7e | |||
| 1817870dfe | |||
| 7def088b9d | |||
| 810a61ea0d | |||
| 70cbef0efb | |||
| ec6c44d036 | |||
| 5d42576da1 | |||
| 227ded2e88 | |||
| 1c81e7fdb4 | |||
| d37014272f | |||
| dc8fcae112 | |||
| 3e84659fca | |||
| 638461a4e3 | |||
| bf1dd1d526 | |||
| 7d121b2bd5 | |||
| 0fc7d826a8 | |||
| dfb3e1f74a | |||
| 8980da46be | |||
| 531da47cbc | |||
| b279a287ec | |||
| 79db35220b | |||
| d7ba34527f | |||
| 7622117281 | |||
| b331126f8a | |||
| 8b6c9b38cc | |||
| 3133c1d78c | |||
| 2ae08165f4 | |||
| f77ea8309c | |||
| 3a9e8651e7 | |||
| eddd7b93ca | |||
| 1d9182f96d | |||
| c3916dcf41 | |||
| 15bfc1bc15 | |||
| cee4375ea3 | |||
| 5b04080f35 | |||
| 0d7cc99a2d | |||
| d48deed9e0 | |||
| 4d8f0d6411 | |||
| 1cff7af4a6 | |||
| c3cc4518d8 | |||
| 04debf6b51 | |||
| cc71f0a34f | |||
| 3787b4e1f5 | |||
| 88b9226bcb | |||
| 9f4e025305 | |||
| ecbd6ecd66 | |||
| c968befafb | |||
| df3b6ae657 | |||
| 668a37c6da | |||
| f4b18d962d | |||
| eaa43c6209 | |||
| 99dd1b6807 | |||
| 5b6f719349 | |||
| 93b3ddec79 | |||
| dd2f75abf1 | |||
| 2922c0e6ef | |||
| e701f54c07 | |||
| 2a2728505f | |||
| a5dc629e21 | |||
| c7fbe8a26a | |||
| b43a8ff2bb | |||
| 6cf303deca | |||
| 855762095f | |||
| 733fd4dc09 | |||
| 71a4985392 | |||
| 0d4d9a4520 | |||
| 622439de62 | |||
| 618d02d7c6 | |||
| d37df9d0f4 | |||
| 011673510d | |||
| ff52b9a79b | |||
| 85a5200e6b | |||
| 0e665ef1b0 | |||
| 2b99df6238 | |||
| 39ea11a8c4 | |||
| 79c7e3e536 | |||
| e4eb264abb | |||
| 500aa2eacf | |||
| b55810f235 | |||
| b898346efb | |||
| 586e4689ae | |||
| 7668aa5766 | |||
| e64090bfaf | |||
| 7c71fd4842 | |||
| 888bf0fcf8 | |||
| 009f22e146 | |||
| ef14b08737 | |||
| 8f9bd3ecb7 | |||
| 3eb6518ea4 | |||
| b15eb92785 | |||
| 96511ca335 | |||
| 974dee54da | |||
| 7e52ce986f | |||
| 4fc4875b91 | |||
| b3138d1982 | |||
| e87622ef5d | |||
| aafe52d2da | |||
| ffe53bf725 | |||
| 832ea7aec5 | |||
| 6d9a157b35 | |||
| 71afc6554e | |||
| bc40da74ab | |||
| 405fde996c | |||
| 8321f09af8 | |||
| 391583b9ea | |||
| 5cf0472806 | |||
| 89598c154e | |||
| 785792d63b | |||
| 5874a39b25 | |||
| 43f3f2f6d8 | |||
| 79a883a303 | |||
| e3f88296e5 | |||
| e207ed7ece | |||
| e97175765b | |||
| 6a0ebb9fee | |||
| 0a698dae34 | |||
| b74c052dd1 | |||
| 330e501277 | |||
| b7d62ace2c | |||
| c6f353ec35 | |||
| 0b7bdd6ade | |||
| 3febbbbcbf | |||
| 31874a8b92 | |||
| c75d9d6bc2 | |||
| 96dd92c3d3 | |||
| ebc41183bc | |||
| feb7982bef | |||
| f241b72453 | |||
| 2b306763c6 | |||
| f1b0a28e71 | |||
| 121f02fb0c | |||
| 848b6d98a5 | |||
| 0589565b8e | |||
| 1109a91dd9 | |||
| 37cb1dbb6a | |||
| 152788fe1b | |||
| 534b363a04 | |||
| 3f13706b97 | |||
| 1f804ab6fc | |||
| 21dd6fbbb1 | |||
| da73acc8a0 | |||
| f9825db2ac | |||
| a3ea3bd1eb | |||
| 805a3acf54 | |||
| f21f2a6422 | |||
| b25d73c0cb | |||
| 50d9603598 | |||
| fae8018df9 | |||
| 3b2715ee58 | |||
| d7c8e8e21d | |||
| 9d11e6e9ca | |||
| 8d90714a82 | |||
| 429d7f58e4 | |||
| 7e15ef9dd1 | |||
| 6060746412 | |||
| 2b4f3d93dc | |||
| f365c7a593 | |||
| fc797ff4a7 | |||
| 63b1f1532a | |||
| b861c647fc | |||
| fa7d95cc53 | |||
| cdb0414097 | |||
| 48ac0a878f | |||
| 804992e485 | |||
| 4ef9497514 | |||
| 3c939a9e5b | |||
| aaddb6897f | |||
| b0db630d56 | |||
| e608fd3a52 | |||
| 573cc1478a | |||
| 25d7516c7a | |||
| 8ac3c4879b | |||
| b551120fcc | |||
| b1846bb804 | |||
| 399a1f466f | |||
| c1ca70adce | |||
| 364520f9a3 | |||
| c0bfe75fd7 | |||
| 1d9618d797 | |||
| 1ac9f823a4 | |||
| 73950690ff | |||
| 2bc79ad2de | |||
| 9ad45b9ea4 | |||
| 89cb9e06f1 | |||
| 3b77f647a6 | |||
| 71c5b20782 | |||
| 08ac48d16e | |||
| 90ac144f2a | |||
| f5b98f803c | |||
| 8f05ef25f6 | |||
| 0022aacbd3 | |||
| ba64c8e231 | |||
| 431c30935c | |||
| 47d0fef508 | |||
| 6decc2f690 | |||
| 2bbd407019 | |||
| abc2c4fe07 | |||
| 2b8342111a | |||
| d57dd30fa0 | |||
| 06d3c53122 | |||
| 5a20897641 | |||
| ae65d448a9 | |||
| df9395e808 | |||
| 402e17b57d | |||
| 3d867dfa3a | |||
| 03a6936f8a | |||
| a4a48f3c3b | |||
| 1d7c390180 | |||
| adb4636513 | |||
| fb0c02e790 | |||
| b5ef4567b6 | |||
| 1a6c2fa340 | |||
| 21784ab491 | |||
| d5147e3dd1 | |||
| bfb1dea84b | |||
| e927a5334a | |||
| 3310eb039c | |||
| 946b4e0e42 | |||
| ff7661f1e0 | |||
| f4eaaf2d59 | |||
| b5fef75133 | |||
| 09035439bd | |||
| 22ed5c599c | |||
| 8822da5d09 | |||
| c4d01b7aff | |||
| c8e962d709 | |||
| cb7819c687 | |||
| ebd9092565 | |||
| 167c6bf39d | |||
| def20a48a3 | |||
| 0945aaf9d0 | |||
| 07dbd89849 | |||
| fa511c5c2c | |||
| 6c065fedfc | |||
| 7858480cde | |||
| c388cb7b21 | |||
| 4d11248b0e | |||
| e2040f2153 | |||
| b19b44f86d | |||
| eb37f8bb8f | |||
| b83a03e36a | |||
| 6d11f6345f | |||
| 32e8cf7923 | |||
| ac2167f5ea | |||
| 8236b0ff96 | |||
| 78cde47c01 | |||
| 2d51bbaeb5 | |||
| 620a87105a | |||
| ab40ad056c | |||
| 62f85d6f92 | |||
| 01ac9d36da | |||
| a466e85b70 | |||
| 5c9fd216bc | |||
| 4685717a8a | |||
| 08ae91e412 | |||
| 145b3ccbe8 | |||
| 4cea9959c9 | |||
| 7118efbc2d | |||
| 4a4613454d | |||
| 45464ab85d | |||
| 22539226e6 | |||
| e9eaff2685 | |||
| 66567d8ec6 | |||
| 1715b5c5b1 | |||
| 2ad4c5af21 | |||
| 27a1618265 | |||
| a3c9d256b4 | |||
| 5c6febf055 | |||
| feecab95ab | |||
| d5a338a902 | |||
| 8763400f06 | |||
| 34ddc826f8 | |||
| 1b3c46fbae | |||
| b05fbac9fe | |||
| 42353d4b04 | |||
| 52ce04727a | |||
| 87b4ebca64 | |||
| c7a50d88b7 | |||
| fef7112f46 | |||
| 98025f02a4 | |||
| f4b4d5ee90 | |||
| 6337113437 | |||
| b7b2606c84 | |||
| c79a584ab7 | |||
| f7435ab895 | |||
| ccd9a70c0c | |||
| 04c8f8eba2 | |||
| e8870ca050 | |||
| 6900eedd63 | |||
| 5848bc2b0c | |||
| 795f202b0c | |||
| e41cb24fc9 | |||
| ed72c7a4e1 | |||
| 8c3ff80547 | |||
| 28de1c6791 | |||
| 4e814d73c6 | |||
| 402015af8a | |||
| e4d1514047 | |||
| 33da807eb5 | |||
| 43a755febd | |||
| 24ed23f161 | |||
| ba6a718119 | |||
| 9a7db0207d | |||
| e35f51e0c8 | |||
| 4502f1162c | |||
| 370b270d95 | |||
| 70f26de43f | |||
| ef626eaaf9 | |||
| 2ebbfd5662 | |||
| 5244caf8e2 | |||
| 89ab7bf961 | |||
| 331b9341be | |||
| fe5d09a8bd | |||
| 312722d3c3 | |||
| 5f37a796e6 | |||
| 0a9fe6f8b6 | |||
| 8f12378299 | |||
| affd519bc8 | |||
| 9434211413 | |||
| 01959dde1f | |||
| fc6c07c613 | |||
| c6e59dd6bb | |||
| fc1f07a01b | |||
| 11d6425de3 | |||
| da79e8b833 | |||
| 4a1bdf2397 | |||
| 40bcfde47c | |||
| 08db55b69f | |||
| 914b7317e8 | |||
| be2c5e1774 | |||
| dcdc612569 | |||
| 6798c0faa5 | |||
| 3758957946 | |||
| cb755b8869 | |||
| ffedabc0f3 | |||
| 557f53bc66 | |||
| 24770cc9f4 | |||
| d07d441e5d | |||
| 2d1de6ccf3 | |||
| 457da42970 | |||
| 527a3bc3b9 | |||
| e6047e51c6 | |||
| 77f225f866 | |||
| 0e662a8799 | |||
| ca2828958d | |||
| 97d6b26df5 | |||
| e01104dba3 | |||
| 443f72d86a | |||
| 794b45e4f3 |
@@ -327,3 +327,4 @@ _UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
|
||||
.ionide/symbolCache.db
|
||||
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
variables:
|
||||
NUGET_PATH: 'C:\Tools\nuget.exe'
|
||||
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
|
||||
ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
|
||||
EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release'
|
||||
DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds'
|
||||
APP_NAME: 'EgtBEAMWALL'
|
||||
APP_NAMEG: 'EgtBEAMWALL'
|
||||
NEW_REL: ''
|
||||
VERS_RD: 'Release'
|
||||
ARCH: 'x86'
|
||||
ARCH64: 'x64'
|
||||
OUTPUT_DIR: ''
|
||||
NET_SHARE: '\\10.74.82.201\Artifacts\EgtProg\EgtBEAMWALL'
|
||||
NET_USER: 'steamw\steamware'
|
||||
|
||||
# helper x mount cartella Artifacts su truenas
|
||||
.ReplicaCompiled: &ReplicaCompiled
|
||||
- |
|
||||
rm -Recurse Z:\$CI_COMMIT_BRANCH\$env:ARCH\*.*
|
||||
rm -Recurse Z:\$CI_COMMIT_BRANCH\$env:ARCH\*.*
|
||||
ROBOCOPY /E $env:APP_NAME\bin\$env:ARCH\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH /XF *.xml /XF *.pdb
|
||||
ROBOCOPY /E $env:APP_NAME2\bin\$env:ARCH\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH /XF *.xml /XF *.pdb
|
||||
SLEEP 2
|
||||
net use Z: /delete
|
||||
|
||||
.ReplicaCompileds2: &ReplicaCompileds2
|
||||
- |
|
||||
ROBOCOPY /E $env:APP_NAME\bin\$env:ARCH64\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH64 /XF *.xml /XF *.pdb
|
||||
ROBOCOPY /E $env:APP_NAME2\bin\$env:ARCH64\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH64 /XF *.xml /XF *.pdb
|
||||
SLEEP 2
|
||||
net use Z: /delete
|
||||
|
||||
.MakeFolderM: &MakeFolderM
|
||||
- |
|
||||
net use Z: /delete
|
||||
new-item c:\EgtProg\EgtBEAMWALL -itemtype directory
|
||||
net use Z: $env:NET_SHARE
|
||||
|
||||
.nuget-fix: &nuget-fix
|
||||
- |
|
||||
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
|
||||
if ($hasSource -eq 0) {
|
||||
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
|
||||
} else {
|
||||
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
|
||||
}
|
||||
echo $hasSource
|
||||
|
||||
|
||||
# helper creazione hash files
|
||||
.hashBuild: &hashBuild
|
||||
- |
|
||||
$Target = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
|
||||
$MD5 = Get-FileHash $Target -Algorithm MD5
|
||||
$SHA1 = Get-FileHash $Target -Algorithm SHA1
|
||||
New-Item $Target".md5"
|
||||
New-Item $Target".sha1"
|
||||
$MD5.Hash | Set-Content -Path $Target".md5"
|
||||
$SHA1.Hash | Set-Content -Path $Target".sha1"
|
||||
|
||||
echo "Created HASH files for $Target"
|
||||
|
||||
.cleanup-dir: &cleanup-dir
|
||||
- |
|
||||
rm $env:APP_NAME\bin\$env:ARCH\$env:VERS_RD\*.xml
|
||||
rm $env:APP_NAME\bin\$env:ARCH\$env:VERS_RD\*.pdb
|
||||
rm $env:APP_NAME\bin\$env:ARCH64\$env:VERS_RD\*.xml
|
||||
rm $env:APP_NAME\bin\$env:ARCH64\$env:VERS_RD\*.pdb
|
||||
|
||||
stages:
|
||||
- build
|
||||
- deploy
|
||||
|
||||
X86:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
only:
|
||||
- main
|
||||
- master
|
||||
- develop
|
||||
variables:
|
||||
APP_NAME: EgtBEAMWALL.Supervisor
|
||||
APP_NAME2: EgtBEAMWALL.ViewerOptimizer
|
||||
VERS_RD: 'Release'
|
||||
ARCH: 'x86'
|
||||
ARCH64: 'x64'
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore EgtBEAMWALL.sln -verbosity quiet'
|
||||
- *MakeFolderM
|
||||
script:
|
||||
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH" /p:OutputPath=bin/$env:ARCH/$env:VERS_RD/ /verbosity:minimal /m'
|
||||
- '& "$env:MSBUILD_PATH" "$env:APP_NAME2\$env:APP_NAME2.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH" /p:OutputPath=bin/$env:ARCH/$env:VERS_RD/ /verbosity:minimal /m'
|
||||
- *ReplicaCompiled
|
||||
|
||||
|
||||
X64:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
only:
|
||||
- main
|
||||
- master
|
||||
- develop
|
||||
variables:
|
||||
APP_NAME: EgtBEAMWALL.Supervisor
|
||||
APP_NAME2: EgtBEAMWALL.ViewerOptimizer
|
||||
VERS_RD: 'Release'
|
||||
ARCH: 'x86'
|
||||
ARCH64: 'x64'
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore EgtBEAMWALL.sln -verbosity quiet'
|
||||
- *MakeFolderM
|
||||
script:
|
||||
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH64" /p:OutputPath=bin/$env:ARCH64/$env:VERS_RD/ /verbosity:minimal /m'
|
||||
- '& "$env:MSBUILD_PATH" "$env:APP_NAME2\$env:APP_NAME2.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH64" /p:OutputPath=bin/$env:ARCH64/$env:VERS_RD/ /verbosity:minimal /m'
|
||||
- *ReplicaCompileds2
|
||||
|
||||
@@ -90,6 +90,16 @@ Public Class BTLFeatureM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nPriority As Integer = 0
|
||||
Public Overridable Property nPriority As Integer
|
||||
Get
|
||||
Return m_nPriority
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nPriority = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Nome
|
||||
Protected m_sName As String
|
||||
Public ReadOnly Property sName As String
|
||||
@@ -244,10 +254,11 @@ Public Class BTLFeatureM
|
||||
Dim NewBTLFeature As New BTLFeatureM
|
||||
NewBTLFeature.m_ParentPart = ParentPart
|
||||
NewBTLFeature.m_nFeatureId = nFeatureId
|
||||
' leggo gruppo, numero feature e lato
|
||||
' leggo gruppo, numero feature, lato e priorità
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_GRP, NewBTLFeature.m_nSelGRP)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_PRC, NewBTLFeature.m_nPRC)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_SIDE, NewBTLFeature.m_nSelSIDE)
|
||||
EgtGetInfo(nFeatureId, BTL_FTR_PRIORITY, NewBTLFeature.m_nPRIORITY)
|
||||
Dim nDO As Integer = 1
|
||||
If EgtGetInfo(nFeatureId, BTL_FTR_DO, nDO) Then
|
||||
NewBTLFeature.m_bDO = (nDO <> 0)
|
||||
@@ -309,6 +320,7 @@ Public Class BTLFeatureM
|
||||
NewBTLFeature.m_nPRC = nPRC
|
||||
NewBTLFeature.m_nSelGRP = nGRP
|
||||
NewBTLFeature.m_nSelSIDE = nSIDE
|
||||
NewBTLFeature.m_nPriority = 0
|
||||
NewBTLFeature.m_bDO = True
|
||||
' crea parametri per questa feature da file ini
|
||||
NewBTLFeature.CreateFeatureParams(NewBTLFeature)
|
||||
@@ -467,7 +479,7 @@ Public Class BTLFeatureM
|
||||
If Param.nType = BTLParamType.DOUBLE_ Or Param.nType = BTLParamType.LENGTH Then
|
||||
Param.SetValue(Param.dDefault)
|
||||
ElseIf Param.nType = BTLParamType.STRING_ Then
|
||||
Param.SetValue("")
|
||||
Param.SetValue(Param.sDefault)
|
||||
ElseIf Param.nType = BTLParamType.COMBO Then
|
||||
Param.nSelValue = Param.dDefault
|
||||
End If
|
||||
@@ -533,6 +545,7 @@ Public Class BTLFeatureM
|
||||
For Each QPar In QBTLParamMList
|
||||
If QPar.bCustom Then EgtSetInfo(nFeatureId, QPar.sName & "A", 1)
|
||||
Next
|
||||
EgtSetInfo( nFeatureId, BTL_FTR_PRIORITY, nPriority)
|
||||
SetFeatureId(nFeatureId)
|
||||
' imposto modificato per copie
|
||||
EgtDuploSetModified(ParentPart.nPartId)
|
||||
@@ -541,7 +554,7 @@ Public Class BTLFeatureM
|
||||
' Impossibile creare una feature con questi valori - ERRORE
|
||||
MessageBox.Show(EgtMsg(61852), EgtMsg(30007))
|
||||
nFeatureId = EgtBeamModifyProcess(Me.nFeatureId, Me.nSelGRP, Me.nPRC, Me.nSelSIDE, "", Me.nPRID,
|
||||
New Frame3d(), vPar, sPar, vParQ, nCrvId, nCrv2Id)
|
||||
Me.frFRAME, vPar, sPar, vParQ, nCrvId, nCrv2Id)
|
||||
SetFeatureId(nFeatureId)
|
||||
bOk = False
|
||||
End If
|
||||
|
||||
@@ -129,6 +129,16 @@ Public Class BTLParamM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sDefault As String
|
||||
Public Property sDefault As String
|
||||
Get
|
||||
Return m_sDefault
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sDefault = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' tipo della variabile
|
||||
Protected m_nType As BTLParamType
|
||||
Public ReadOnly Property nType As BTLParamType
|
||||
@@ -136,6 +146,9 @@ Public Class BTLParamM
|
||||
Return m_nType
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetType(value As BTLParamType)
|
||||
m_nType = value
|
||||
End Sub
|
||||
|
||||
' Feature a cui appartiene il parametro
|
||||
Protected m_ParentFeature As BTLFeatureM
|
||||
@@ -245,16 +258,18 @@ Public Class BTLParamM
|
||||
End Function
|
||||
|
||||
' new per stringhe
|
||||
Public Shared Function CreateBTLParam(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, sDescription As String)
|
||||
Public Shared Function CreateBTLParam(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, sDefault As String, sDescription As String)
|
||||
Dim NewBTLParam As New BTLParamM
|
||||
NewBTLParam.StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
|
||||
NewBTLParam.m_sDefault = sDefault
|
||||
Return NewBTLParam
|
||||
End Function
|
||||
|
||||
' new per stringhe (con tipo Beam o Wall)
|
||||
Public Shared Function CreateBTLParam(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, sDescription As String, sBWType As String)
|
||||
Public Shared Function CreateBTLParam(ParentFeature As BTLFeatureM, IsP As Boolean, nType As BTLParamType, sParamName As String, sDefault As String, sDescription As String, sBWType As String)
|
||||
Dim NewBTLParam As New BTLParamM
|
||||
NewBTLParam.StdInit(ParentFeature, IsP, nType, sParamName, sDescription)
|
||||
NewBTLParam.m_sDefault = sDefault
|
||||
NewBTLParam.m_sBWType = sBWType
|
||||
Return NewBTLParam
|
||||
End Function
|
||||
|
||||
@@ -178,6 +178,16 @@ Public Class BTLPartM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_MaterialM As MaterialM
|
||||
Public Property MaterialM As MaterialM
|
||||
Get
|
||||
Return m_MaterialM
|
||||
End Get
|
||||
Set(value As MaterialM)
|
||||
m_MaterialM = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_sTIMBERGRADE As String
|
||||
Public Property sTIMBERGRADE As String
|
||||
Get
|
||||
@@ -587,7 +597,7 @@ Public Class BTLPartM
|
||||
Public ReadOnly Property nINPROD As Integer
|
||||
Get
|
||||
Dim INPROD As Integer = 0
|
||||
EgtDuploCount(m_nPartId, INPROD)
|
||||
EgtDuploInRawCount(m_nPartId, INPROD)
|
||||
Return INPROD
|
||||
End Get
|
||||
End Property
|
||||
@@ -797,15 +807,15 @@ Public Class BTLPartM
|
||||
Dim vtVersY As New Vector3d
|
||||
sValArray = sValue.Split({","}, StringSplitOptions.RemoveEmptyEntries)
|
||||
If sValArray.Count() >= 9 Then
|
||||
StringToLen(sValArray(0), ptOri.x)
|
||||
StringToLen(sValArray(1), ptOri.y)
|
||||
StringToLen(sValArray(2), ptOri.z)
|
||||
StringToDouble(sValArray(3), vtVersX.x)
|
||||
StringToDouble(sValArray(4), vtVersX.y)
|
||||
StringToDouble(sValArray(5), vtVersX.z)
|
||||
StringToDouble(sValArray(6), vtVersY.x)
|
||||
StringToDouble(sValArray(7), vtVersY.y)
|
||||
StringToDouble(sValArray(8), vtVersY.z)
|
||||
StringToLenAdv(sValArray(0), ptOri.x)
|
||||
StringToLenAdv(sValArray(1), ptOri.y)
|
||||
StringToLenAdv(sValArray(2), ptOri.z)
|
||||
StringToDoubleAdv(sValArray(3), vtVersX.x)
|
||||
StringToDoubleAdv(sValArray(4), vtVersX.y)
|
||||
StringToDoubleAdv(sValArray(5), vtVersX.z)
|
||||
StringToDoubleAdv(sValArray(6), vtVersY.x)
|
||||
StringToDoubleAdv(sValArray(7), vtVersY.y)
|
||||
StringToDoubleAdv(sValArray(8), vtVersY.z)
|
||||
NewBTLPart.m_refTransf.ChangeOrigin(ptOri)
|
||||
NewBTLPart.m_refTransf.Setup(ptOri, ptOri + vtVersX, ptOri + vtVersY)
|
||||
End If
|
||||
@@ -813,12 +823,12 @@ Public Class BTLPartM
|
||||
ind = ind + 1
|
||||
End While
|
||||
EgtGetInfo(nPartId, BTL_PRT_CAMBER, sValue)
|
||||
sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
If sValArray.Count() >= 5 Then
|
||||
StringToLen(sValArray(3), NewBTLPart.m_dCamberLen1)
|
||||
StringToLen(sValArray(5), NewBTLPart.m_dCamberLen2)
|
||||
StringToLen(sValArray(7), NewBTLPart.m_dCamberLen3)
|
||||
StringToLen(sValArray(9), NewBTLPart.m_dCamberCross3)
|
||||
sValArray = sValue.Split(New String() {":", "P"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
If sValArray.Count() >= 10 Then
|
||||
StringToLenAdv(sValArray(3), NewBTLPart.m_dCamberLen1)
|
||||
StringToLenAdv(sValArray(5), NewBTLPart.m_dCamberLen2)
|
||||
StringToLenAdv(sValArray(7), NewBTLPart.m_dCamberLen3)
|
||||
StringToLenAdv(sValArray(9), NewBTLPart.m_dCamberCross3)
|
||||
End If
|
||||
Dim pFrom As Integer = sValue.IndexOf("SIDE: ") + "SIDE: ".Length
|
||||
Dim pTo As Integer = sValue.LastIndexOf(" P01")
|
||||
@@ -828,12 +838,12 @@ Public Class BTLPartM
|
||||
End If
|
||||
|
||||
EgtGetInfo(nPartId, BTL_PRT_PARTOFFSET, sValue)
|
||||
sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
If sValArray.Count() >= 5 Then
|
||||
StringToLen(sValArray(3), NewBTLPart.m_dPartOffsetSide1)
|
||||
StringToLen(sValArray(5), NewBTLPart.m_dPartOffsetSide2)
|
||||
StringToLen(sValArray(7), NewBTLPart.m_dPartOffsetSide3)
|
||||
StringToLen(sValArray(9), NewBTLPart.m_dPartOffsetSide4)
|
||||
sValArray = sValue.Split(New String() {":", "P"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
If sValArray.Count() >= 10 Then
|
||||
StringToLenAdv(sValArray(3), NewBTLPart.m_dPartOffsetSide1)
|
||||
StringToLenAdv(sValArray(5), NewBTLPart.m_dPartOffsetSide2)
|
||||
StringToLenAdv(sValArray(7), NewBTLPart.m_dPartOffsetSide3)
|
||||
StringToLenAdv(sValArray(9), NewBTLPart.m_dPartOffsetSide4)
|
||||
End If
|
||||
pFrom = sValue.IndexOf("P04: ") + "P04: ".Length
|
||||
pTo = sValue.LastIndexOf(" P11")
|
||||
@@ -883,9 +893,9 @@ Public Class BTLPartM
|
||||
NewBTLPart.m_refGrainDir = New Vector3d
|
||||
sValArray = sValue.Split(New String() {",", ";"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
If sValArray.Count() >= 4 Then
|
||||
StringToDouble(sValArray(0), NewBTLPart.m_refGrainDir.x)
|
||||
StringToDouble(sValArray(1), NewBTLPart.m_refGrainDir.y)
|
||||
StringToDouble(sValArray(2), NewBTLPart.m_refGrainDir.z)
|
||||
StringToDoubleAdv(sValArray(0), NewBTLPart.m_refGrainDir.x)
|
||||
StringToDoubleAdv(sValArray(1), NewBTLPart.m_refGrainDir.y)
|
||||
StringToDoubleAdv(sValArray(2), NewBTLPart.m_refGrainDir.z)
|
||||
NewBTLPart.m_bGRAINDIRALIGN = (CInt(sValArray(3)) = 1)
|
||||
End If
|
||||
|
||||
@@ -922,6 +932,7 @@ Public Class BTLPartM
|
||||
NewBTLPart.m_nINVERTED = 0
|
||||
End If
|
||||
EgtGetInfo(nPartId, BTL_PRT_MATERIAL, NewBTLPart.m_sMATERIAL)
|
||||
' EgtGetInfo(nPartId, BTL_PRT_WAREHOUSEMATERIAL, NewBTLPart.m_sWAREHOUSEMATERIAL)
|
||||
If Not EgtGetInfo(nPartId, LOCK_ROT, NewBTLPart.m_bLockRotation) Then
|
||||
NewBTLPart.m_bLockRotation = False
|
||||
End If
|
||||
@@ -1044,15 +1055,15 @@ Public Class BTLPartM
|
||||
' Dim vtVersY As New Vector3d
|
||||
' sValArray = sValue.Split({","}, StringSplitOptions.RemoveEmptyEntries)
|
||||
' If sValArray.Count() >= 9 Then
|
||||
' StringToLen(sValArray(0), ptOri.x)
|
||||
' StringToLen(sValArray(1), ptOri.y)
|
||||
' StringToLen(sValArray(2), ptOri.z)
|
||||
' StringToDouble(sValArray(3), vtVersX.x)
|
||||
' StringToDouble(sValArray(4), vtVersX.y)
|
||||
' StringToDouble(sValArray(5), vtVersX.z)
|
||||
' StringToDouble(sValArray(6), vtVersY.x)
|
||||
' StringToDouble(sValArray(7), vtVersY.y)
|
||||
' StringToDouble(sValArray(8), vtVersY.z)
|
||||
' StringToLenAdv(sValArray(0), ptOri.x)
|
||||
' StringToLenAdv(sValArray(1), ptOri.y)
|
||||
' StringToLenAdv(sValArray(2), ptOri.z)
|
||||
' StringToDoubleAdv(sValArray(3), vtVersX.x)
|
||||
' StringToDoubleAdv(sValArray(4), vtVersX.y)
|
||||
' StringToDoubleAdv(sValArray(5), vtVersX.z)
|
||||
' StringToDoubleAdv(sValArray(6), vtVersY.x)
|
||||
' StringToDoubleAdv(sValArray(7), vtVersY.y)
|
||||
' StringToDoubleAdv(sValArray(8), vtVersY.z)
|
||||
' m_refTransf.ChangeOrigin(ptOri)
|
||||
' m_refTransf.Setup(ptOri, ptOri + vtVersX, ptOri + vtVersY)
|
||||
' End If
|
||||
@@ -1063,10 +1074,10 @@ Public Class BTLPartM
|
||||
' EgtGetInfo(nPartId, BTL_PRT_CAMBER, sValue)
|
||||
' sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
' If sValArray.Count() >= 5 Then
|
||||
' StringToLen(sValArray(3), m_dCamberLen1)
|
||||
' StringToLen(sValArray(5), m_dCamberLen2)
|
||||
' StringToLen(sValArray(7), m_dCamberLen3)
|
||||
' StringToLen(sValArray(9), m_dCamberCross3)
|
||||
' StringToLenAdv(sValArray(3), m_dCamberLen1)
|
||||
' StringToLenAdv(sValArray(5), m_dCamberLen2)
|
||||
' StringToLenAdv(sValArray(7), m_dCamberLen3)
|
||||
' StringToLenAdv(sValArray(9), m_dCamberCross3)
|
||||
' End If
|
||||
' Dim pFrom As Integer = sValue.IndexOf("SIDE: ") + "SIDE: ".Length
|
||||
' Dim pTo As Integer = sValue.LastIndexOf(" P01")
|
||||
@@ -1078,10 +1089,10 @@ Public Class BTLPartM
|
||||
' EgtGetInfo(nPartId, BTL_PRT_PARTOFFSET, sValue)
|
||||
' sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
' If sValArray.Count() >= 5 Then
|
||||
' StringToLen(sValArray(3), m_dPartOffsetSide1)
|
||||
' StringToLen(sValArray(5), m_dPartOffsetSide2)
|
||||
' StringToLen(sValArray(7), m_dPartOffsetSide3)
|
||||
' StringToLen(sValArray(9), m_dPartOffsetSide4)
|
||||
' StringToLenAdv(sValArray(3), m_dPartOffsetSide1)
|
||||
' StringToLenAdv(sValArray(5), m_dPartOffsetSide2)
|
||||
' StringToLenAdv(sValArray(7), m_dPartOffsetSide3)
|
||||
' StringToLenAdv(sValArray(9), m_dPartOffsetSide4)
|
||||
' End If
|
||||
' pFrom = sValue.IndexOf("P04: ") + "P04: ".Length
|
||||
' pTo = sValue.LastIndexOf(" P11")
|
||||
@@ -1105,9 +1116,9 @@ Public Class BTLPartM
|
||||
' m_refGrainDir = New Vector3d
|
||||
' sValArray = sValue.Split(New String() {",", ";"}, StringSplitOptions.RemoveEmptyEntries)
|
||||
' If sValArray.Count() >= 4 Then
|
||||
' StringToDouble(sValArray(0), m_refGrainDir.x)
|
||||
' StringToDouble(sValArray(1), m_refGrainDir.y)
|
||||
' StringToDouble(sValArray(2), m_refGrainDir.z)
|
||||
' StringToDoubleAdv(sValArray(0), m_refGrainDir.x)
|
||||
' StringToDoubleAdv(sValArray(1), m_refGrainDir.y)
|
||||
' StringToDoubleAdv(sValArray(2), m_refGrainDir.z)
|
||||
' m_bGRAINDIRALIGN = (CInt(sValArray(3)) = 1)
|
||||
' End If
|
||||
|
||||
@@ -1210,7 +1221,7 @@ Public Class BTLPartM
|
||||
Return New List(Of BTLFeatureM)(m_BTLFeatureMList)
|
||||
End Function
|
||||
|
||||
Public Function Rotation(IsPositive As Boolean, SelectedMachineType As MachineType, Optional dAng As Double = 90) As Boolean
|
||||
Public Function Rotation(IsPositive As Boolean, SelectedMachineType As MachineType, Optional bRedraw As Boolean = True, Optional dAng As Double = 90) As Boolean
|
||||
' recupero il box del pezzo
|
||||
Dim nLs As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
|
||||
Dim b3Solid As New BBox3d
|
||||
@@ -1249,7 +1260,7 @@ Public Class BTLPartM
|
||||
' ripristino inversione
|
||||
Inversion(SelectedMachineType)
|
||||
End If
|
||||
EgtDraw()
|
||||
If bRedraw Then EgtDraw()
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ Public Module CalcIntegration
|
||||
Public Event Calc_ProcessResult As EventHandler(Of CalcResultEventArgs)
|
||||
Public Event Calc_ProcessEnd As EventHandler(Of CalcProcessEndEventArgs)
|
||||
|
||||
Private m_bIsSupervisor As Boolean = False
|
||||
|
||||
Public Enum CmdTypes As Integer
|
||||
GENERATE = 0
|
||||
MODIFY = 1
|
||||
@@ -38,8 +40,9 @@ Public Module CalcIntegration
|
||||
|
||||
Delegate Sub CallbackDlg(dProgress As Double, sProgress As String, ByRef bCancel As Boolean)
|
||||
|
||||
Public Sub Run(vBar As Bar(), sProjDirPath As String, callback As CallbackDlg)
|
||||
Public Sub Run(vBar As Bar(), sProjDirPath As String, callback As CallbackDlg, Optional bIsSupervisor As Boolean = False)
|
||||
_thread = New Thread(Sub()
|
||||
m_bIsSupervisor = bIsSupervisor
|
||||
DoJob(vBar, sProjDirPath, callback)
|
||||
End Sub)
|
||||
_thread.Start()
|
||||
@@ -62,7 +65,7 @@ Public Module CalcIntegration
|
||||
End If
|
||||
ElseIf Bar.nProgramPage = ProjectType.PROD Then
|
||||
If Bar.nGlobState = CalcStates.NOTCALCULATED Then
|
||||
Bar.sBarPath = CreateNewProjectFromMachGroup(Bar.nBarId, sProjDirPath)
|
||||
Bar.sBarPath = CreateNewProjectFromMachGroup(Bar.nBarId, sProjDirPath, Bar.nGlobState)
|
||||
Else
|
||||
Dim sMachGroupName As String = ""
|
||||
EgtGetMachGroupName(Bar.nBarId, sMachGroupName)
|
||||
@@ -75,7 +78,7 @@ Public Module CalcIntegration
|
||||
If Bar.nProgramPage = ProjectType.PROJ Then
|
||||
Bar.sBarPath = CreateNewProjectFromPart(Bar.nBarId, sProjDirPath)
|
||||
ElseIf Bar.nProgramPage = ProjectType.PROD Then
|
||||
Bar.sBarPath = CreateNewProjectFromMachGroup(Bar.nBarId, sProjDirPath)
|
||||
Bar.sBarPath = CreateNewProjectFromMachGroup(Bar.nBarId, sProjDirPath, Bar.nGlobState)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
@@ -352,27 +355,38 @@ Public Module CalcIntegration
|
||||
Return If(bOk, sPartFilePath, String.Empty)
|
||||
End Function
|
||||
|
||||
Private Function CreateNewProjectFromMachGroup(nMachGroupId As Integer, sProjDirPath As String) As String
|
||||
|
||||
' Aggiorno identificativi per segnalazione errori
|
||||
Dim nOldMachGroup As Integer = EgtGetCurrMachGroup()
|
||||
If nMachGroupId <> nOldMachGroup Then EgtSetCurrMachGroup(nMachGroupId)
|
||||
Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
While nRawId <> GDB_ID.NULL
|
||||
If EgtVerifyRawPartPhase(nRawId, 1) Then
|
||||
Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId)
|
||||
While nPartId <> GDB_ID.NULL
|
||||
UpdateCutIdAndTaskId(nPartId)
|
||||
nPartId = EgtGetNextPartInRawPart(nPartId)
|
||||
End While
|
||||
Private Function CreateNewProjectFromMachGroup(nMachGroupId As Integer, sProjDirPath As String, nGlobState As Integer) As String
|
||||
' aggiorno cutid e taskid solo fuori dal supervisore o se pezzo ricalcolato
|
||||
If Not m_bIsSupervisor OrElse nGlobState = CalcStates.NOTCALCULATED Then
|
||||
Dim DisableMgr As DisableModifiedMgr = Nothing
|
||||
If m_bIsSupervisor Then
|
||||
' Disabilito segnalazione modificato
|
||||
DisableMgr = New DisableModifiedMgr
|
||||
End If
|
||||
nRawId = EgtGetNextRawPart(nRawId)
|
||||
End While
|
||||
If nMachGroupId <> nOldMachGroup Then
|
||||
If nOldMachGroup <> GDB_ID.NULL Then
|
||||
EgtSetCurrMachGroup(nOldMachGroup)
|
||||
Else
|
||||
EgtResetCurrMachGroup()
|
||||
' Aggiorno identificativi per segnalazione errori
|
||||
Dim nOldMachGroup As Integer = EgtGetCurrMachGroup()
|
||||
If nMachGroupId <> nOldMachGroup Then EgtSetCurrMachGroup(nMachGroupId)
|
||||
Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
While nRawId <> GDB_ID.NULL
|
||||
If EgtVerifyRawPartPhase(nRawId, 1) Then
|
||||
Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId)
|
||||
While nPartId <> GDB_ID.NULL
|
||||
UpdateCutIdAndTaskId(nPartId)
|
||||
nPartId = EgtGetNextPartInRawPart(nPartId)
|
||||
End While
|
||||
End If
|
||||
nRawId = EgtGetNextRawPart(nRawId)
|
||||
End While
|
||||
If nMachGroupId <> nOldMachGroup Then
|
||||
If nOldMachGroup <> GDB_ID.NULL Then
|
||||
EgtSetCurrMachGroup(nOldMachGroup)
|
||||
Else
|
||||
EgtResetCurrMachGroup()
|
||||
End If
|
||||
End If
|
||||
If m_bIsSupervisor Then
|
||||
' Ripristino stato segnalazione modifica
|
||||
DisableMgr.ReEnable()
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -579,4 +593,13 @@ Public Class ProcessResult
|
||||
m_nTIME = TIME
|
||||
End Sub
|
||||
|
||||
Public Sub ResetTypeFeature()
|
||||
m_Type = ProcessResultTypes.PART
|
||||
m_nTASKID = 0
|
||||
End Sub
|
||||
Public Sub ResetTypePart()
|
||||
m_Type = ProcessResultTypes.BAR
|
||||
m_nCUTID = 0
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -175,8 +175,10 @@
|
||||
Public Const BTL_PRT_REFSIDE = "REFERENCESIDE"
|
||||
Public Const BTL_PRT_ALIGNMENT = "ALIGNMENT"
|
||||
Public Const BTL_PRT_MATERIALTYPE = "MATERIALTYPE"
|
||||
Public Const BTL_PRT_DESCRIPTION = "NAM"
|
||||
|
||||
' parametri generici
|
||||
Public Const BTL_GEN_BTLPATH = "BTL"
|
||||
Public Const BTL_GEN_PROJNUM = "PROJECTNUMBER"
|
||||
Public Const BTL_GEN_PROJNAME = "PROJECTNAME"
|
||||
Public Const BTL_GEN_PROJPART = "PROJECTPART"
|
||||
@@ -204,6 +206,7 @@
|
||||
Public Const BTL_FTR_PRC As String = "PRC"
|
||||
Public Const BTL_FTR_DO As String = "DO"
|
||||
Public Const BTL_FTR_SIDE As String = "SIDE"
|
||||
Public Const BTL_FTR_PRIORITY As String = "PRIORITY"
|
||||
Public Const BTL_FTR_NAME As String = "NAME"
|
||||
Public Const BTL_FTR_DES As String = "DES"
|
||||
Public Const BTL_FTR_PRID As String = "PRID"
|
||||
@@ -251,6 +254,7 @@
|
||||
Public Const MGR_RPT_PANELLEN As String = "PANELLEN"
|
||||
Public Const MGR_RPT_PANELWIDTH As String = "PANELWIDTH"
|
||||
Public Const MGR_RPT_PANELHEIGHT As String = "PANELHEIGHT"
|
||||
Public Const MGR_RPT_PANELPOSZ As String = "PANELPOSZ"
|
||||
Public Const MGR_RPT_PART As String = "PART"
|
||||
|
||||
' parametri P per comunicazione con la macchina
|
||||
@@ -298,5 +302,11 @@
|
||||
Public Const BTLFILENAME As String = "BTLFILENAME"
|
||||
Public Const EXP_PART As String = "ImportExport"
|
||||
Public Const EXP_MACHINE As String = "Machine"
|
||||
Public Const EXP_CLOUDID As String = "CloudId"
|
||||
' parametro che indica se il progetto e' stato appena importato e quindi bisogna riverificare i MachGroup
|
||||
Public Const IMP_VERIFYMACHGROUP As String = "VerifyMachGroup"
|
||||
|
||||
' parametri modifica percorsi free contour
|
||||
Public Const PATH_SIDEANGLAYER As String = "SideAngLayer"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -6,11 +6,24 @@
|
||||
Public Const COL_STARTCUT As String = "colSTARTCUT"
|
||||
Public Const COL_W As String = "colW"
|
||||
Public Const COL_L As String = "colL"
|
||||
Public Const COL_POSZ As String = "colPOSZ"
|
||||
Public Const COL_ROT As String = "colROT"
|
||||
Public Const COL_FLIP As String = "colFLIP"
|
||||
Public Const COL_POSX As String = "colPOSX"
|
||||
Public Const COL_POSY As String = "colPOSY"
|
||||
Public Const COL_OFFSET As String = "colOFFSET"
|
||||
Public Const COL_REDO As String = "colREDO"
|
||||
Public Const COL_TYPE As String = "colTYPE"
|
||||
Public Const COL_DESCRIPTION As String = "colDESCRIPTION"
|
||||
Public Const COL_SUPERVISORID As String = "colSUPERVISORID"
|
||||
Public Const COL_PRIORITY As String = "colPRIORITY"
|
||||
Public Const COL_NAME As String = "colNAME"
|
||||
Public Const COL_H As String = "colH"
|
||||
Public Const COL_MATERIAL As String = "colMATERIAL"
|
||||
Public Const COL_WAREHOUSEMATERIAL As String = "colWAREHOUSEMATERIAL"
|
||||
Public Const COL_USAGE As String = "colUSAGE"
|
||||
Public Const COL_WASTE As String = "colWASTE"
|
||||
Public Const COL_ARCHIVED As String = "colARCHIVED"
|
||||
Public Const COL_USEQTY As String = "colUSEQTY"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
Public Const S_FEATURELIST As String = "DG_FeatureList"
|
||||
Public Const S_OPENPROJFILEDLG_PROJ As String = "DG_OpenProjectFileDialog_PROJ"
|
||||
Public Const S_OPENPROJFILEDLG_PROD As String = "DG_OpenProjectFileDialog_PROD"
|
||||
Public Const S_NEWOPENPROJFILEDLG_PROD As String = "DG_NewOpenProjectFileDialog_PROD"
|
||||
Public Const S_RAWPARTLIST_BEAM As String = "DG_RawPartList_BEAM"
|
||||
Public Const S_RAWPARTLIST_WALL As String = "DG_RawPartList_WALL"
|
||||
Public Const S_PARTINRAWPARTLIST_BEAM As String = "DG_PartInRawPartList_BEAM"
|
||||
@@ -27,6 +28,7 @@
|
||||
Public Const S_SECTXMATLIST_WALL As String = "DG_SectXMatList_WALL"
|
||||
Public Const S_VARIABLESLIST As String = "DG_VariablesList"
|
||||
Public Const S_MDICOMMANDS As String = "DG_MDICommands"
|
||||
Public Const S_MACHINELOG As String = "DG_MachineLog"
|
||||
Public Const S_UPDATEBTLPARTLIST As String = "DG_UpdateBTLPartList"
|
||||
|
||||
Public Const K_LOCKTABLE As String = "LockTable"
|
||||
|
||||
@@ -21,6 +21,7 @@ Public Module ConstGen
|
||||
' File con dati di licenza
|
||||
Public Const LIC_FILE_NAME As String = "EgtBEAMWALL.lic"
|
||||
Public Const S_LICENCE As String = "Licence"
|
||||
Public Const K_LOCKID As String = "LockId"
|
||||
Public Const K_KEY As String = "Key"
|
||||
Public Const K_NESTKEY As String = "NestKey"
|
||||
|
||||
@@ -41,6 +42,7 @@ Public Module ConstGen
|
||||
NESTING_AUTO = 4
|
||||
SUPERVISOR = 8
|
||||
NETWORK = 16
|
||||
ANY_DB = 32
|
||||
End Enum
|
||||
|
||||
' File di log generale
|
||||
|
||||
@@ -20,6 +20,7 @@ Public Module ConstIni
|
||||
'Public Const K_LICENCE As String = "Licence"
|
||||
'Public Const K_USERLEVEL As String = "UserLevel"
|
||||
'Public Const K_MAXINST As String = "MaxInstances"
|
||||
Public Const K_NETKEY As String = "NetKey"
|
||||
Public Const K_MAXCAMINST As String = "MaxCamInstances"
|
||||
Public Const K_VIEWOPTIM_INSTANCES As String = "ViewOptimInstances"
|
||||
Public Const K_SUPERVISOR_INSTANCES As String = "SupervisorInstances"
|
||||
@@ -27,6 +28,8 @@ Public Module ConstIni
|
||||
'Public Const K_MESSAGESDIR As String = "MessagesDir"
|
||||
'Public Const K_MESSAGES As String = "Messages"
|
||||
'Public Const K_WINPLACE As String = "WinPlace"
|
||||
Public Const K_VIEWOPTIMWINPLACE As String = "ViewOptimWinPlace"
|
||||
Public Const K_SUPERVISORWINPLACE As String = "SupervisorWinPlace"
|
||||
'Public Const K_LASTPROJ As String = "LastProj"
|
||||
'Public Const K_AUTOLOADLASTPROJ As String = "AutoLoadLastProj"
|
||||
Public Const K_LASTIMPDIR As String = "LastImpDir"
|
||||
@@ -35,9 +38,16 @@ Public Module ConstIni
|
||||
Public Const K_PROJSINDEX As String = "ProjsIndex"
|
||||
Public Const K_PRODSINDEX As String = "ProdsIndex"
|
||||
'Public Const K_SUPPORT As String = "Support"
|
||||
Public Const K_WAREHOUSE As String = "Warehouse"
|
||||
Public Const K_DBADDRESS As String = "DbAddress"
|
||||
Public Const K_DBMASTERKEY As String = "DbMasterKey"
|
||||
Public Const K_SHAREDFOLDER As String = "SharedFolder"
|
||||
Public Const K_UPDATEBTL As String = "UpdateBtl"
|
||||
Public Const K_DATADIR As String = "DataDir"
|
||||
Public Const K_ENABLEEDIT As String = "EnableEdit"
|
||||
Public Const K_FASTPRODUCE As String = "FastProduce"
|
||||
Public Const K_ADDPROJ As String = "AddProj"
|
||||
Public Const K_PROJECTMODE As String = "ProjectMode"
|
||||
Public Const K_NETWAREHOUSE As String = "NetWarehouse"
|
||||
|
||||
'Public Const S_LANGUAGES As String = "Languages"
|
||||
'Public Const K_LANGUAGE As String = "Language"
|
||||
@@ -88,6 +98,7 @@ Public Module ConstIni
|
||||
Public Const S_IMPORT As String = "Import"
|
||||
Public Const K_BTLFLAG As String = "BtlFlag"
|
||||
Public Const K_WALLBTLFLAG As String = "WallBtlFlag"
|
||||
Public Const K_WALLOPPOSITESIDENESTING As String = "WallOppositeSideNesting"
|
||||
|
||||
'Public Const S_MACH As String = "Mach"
|
||||
'Public Const K_MACHINESDIR As String = "MachinesDir"
|
||||
@@ -95,6 +106,8 @@ Public Module ConstIni
|
||||
'Public Const K_CURRMACH As String = "CurrMach"
|
||||
Public Const K_SUPERVISORMACH As String = "SupervisorMach"
|
||||
Public Const K_PASSWORD As String = "Password"
|
||||
Public Const K_CHANGEMACH As String = "ChangeMach"
|
||||
Public Const K_EXPORTBWE As String = "ExpBwe"
|
||||
|
||||
'Public Const S_SIMUL As String = "Simul"
|
||||
'Public Const K_SLIDERX As String = "SliderX"
|
||||
@@ -109,6 +122,16 @@ Public Module ConstIni
|
||||
Public Const K_WALLBASEDIR As String = "BaseDir"
|
||||
Public Const K_WALLBWEEXEC As String = "BweExec"
|
||||
|
||||
Public Const S_MACHINELOGFILTER As String = "MachineLogFilters"
|
||||
Public Const K_PARTEVENTTYPE As String = "PartEventType"
|
||||
Public Const K_ENTITYTYPE As String = "EntityType"
|
||||
Public Const K_DAYTYPE As String = "DayType"
|
||||
Public Const K_STARTDATE As String = "StartDate"
|
||||
Public Const K_ENDDATE As String = "EndDate"
|
||||
|
||||
Public Const S_OPENFILEDIALOG As String = "OpenFileDialog"
|
||||
Public Const K_VIEWARCHIVED As String = "ViewArchived"
|
||||
|
||||
'Public Const S_NEST As String = "Nest"
|
||||
Public Const K_NESTEXEC As String = "NestExec"
|
||||
Public Const K_FLIPROT As String = "FlipRot"
|
||||
@@ -137,4 +160,22 @@ Public Module ConstIni
|
||||
Public Const S_BEAM_LIST As String = "Beam_List"
|
||||
Public Const S_WALL_LIST As String = "Wall_List"
|
||||
|
||||
Public Const S_WAREHOUSE As String = "Warehouse"
|
||||
Public Const K_TYPE As String = "Type"
|
||||
Public Const K_DEFAULTQUANTITY As String = "DefaultQuantity"
|
||||
Public Const K_LASTSYNCHRONIZATION As String = "LastSynchronization"
|
||||
Public Const K_USENETWAREHOUSE As String = "UseNetWarehouse"
|
||||
Public Const K_SHOWWAREHOUSEMATERIAL As String = "ShowWarehouseMaterial"
|
||||
Public Const K_NETADDRESS As String = "NetAddress"
|
||||
Public Const K_AUTHTOKEN As String = "AuthToken"
|
||||
Public Const K_SENDESTIMONSAVE As String = "SendEstimOnSave"
|
||||
|
||||
Public Const S_BACKUPANDRESTORE As String = "Backup&Restore"
|
||||
Public Const K_EXTERNALBACKUPACTIVE As String = "ExternalBackupActive"
|
||||
Public Const K_EXTERNALFILEPATH As String = "ExternalFilePath"
|
||||
Public Const K_REMINDERFREQUENCY As String = "ReminderFrequency"
|
||||
|
||||
Public Const S_SPECIAL As String = "Special"
|
||||
Public Const K_SPECIALENABLE As String = "SpecialEnable"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
Public Module ConstMachIni
|
||||
|
||||
Public Const MACH_INI_FILE_NAME As String = "MachData.ini"
|
||||
Public Const GETBEAMDATA_FILE_NAME As String = "GetBeamData.lua"
|
||||
Public Const GETWALLDATA_FILE_NAME As String = "GetWallData.lua"
|
||||
Public Const GETTS3DATA_FILE_NAME As String = "GetTs3Data.lua"
|
||||
|
||||
Public Const K_NCTYPE As String = "NCType"
|
||||
Public Const K_CONNECTIONSTRING As String = "ConnectionString"
|
||||
|
||||
Public Const S_CHANNELS As String = "Channels"
|
||||
|
||||
|
||||
@@ -47,13 +47,11 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EgtUILib, Version=2.3.7.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtUILib.dll</HintPath>
|
||||
<Reference Include="EgtUILib">
|
||||
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgtWPFLib5, Version=2.3.4.3, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtWPFLib5.dll</HintPath>
|
||||
<Reference Include="EgtWPFLib5">
|
||||
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
@@ -114,6 +112,11 @@
|
||||
<DependentUpon>LoadingWndV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="LoadingWnd\LoadingWndVM.vb" />
|
||||
<Compile Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogV.xaml.vb">
|
||||
<DependentUpon>NewOpenProjectFileDialogV.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogVM.vb" />
|
||||
<Compile Include="ProjectFileVM\ProdItem.vb" />
|
||||
<Compile Include="Utility\DimensionsIniFile.vb" />
|
||||
<Compile Include="Utility\Enum.vb" />
|
||||
<Compile Include="MachGroupPanel\MyMachGroupPanelVM.vb" />
|
||||
@@ -143,6 +146,7 @@
|
||||
<Compile Include="Lib\MachGroupPanelM.vb" />
|
||||
<Compile Include="MachGroupModel\MyMachGroupPanelM.vb" />
|
||||
<Compile Include="Utility\ManageWindow.vb" />
|
||||
<Compile Include="Utility\RawPart.vb" />
|
||||
<Compile Include="Utility\MyMachine.vb" />
|
||||
<Compile Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml.vb">
|
||||
<DependentUpon>OpenProjectFileDialogV.xaml</DependentUpon>
|
||||
@@ -155,6 +159,7 @@
|
||||
<Compile Include="ProjectManager\ProjectFileVM.vb" />
|
||||
<Compile Include="ProjectManager\ProjFileVM.vb" />
|
||||
<Compile Include="ProjectFileVM\ProjFileM.vb" />
|
||||
<Compile Include="Utility\Material.vb" />
|
||||
<Compile Include="Utility\SectionXMaterial.vb" />
|
||||
<Compile Include="Utility\BTLIniFile.vb" />
|
||||
<Compile Include="Utility\CoreMap.vb" />
|
||||
@@ -192,6 +197,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>XamlIntelliSenseFileGenerator</Generator>
|
||||
</Page>
|
||||
<Page Include="NewOpenProjectFileDialog\NewOpenProjectFileDialogV.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -28,7 +28,7 @@ Public Module DataGridColumnsIniFile
|
||||
Dim bIsReadOnly As Boolean = sColumnParams(4).Equals("1")
|
||||
Dim Width As Double
|
||||
Dim WidthType As DataGridLengthUnitType
|
||||
StringToDouble(sColumnParams(5), Width)
|
||||
StringToDoubleAdv(sColumnParams(5), Width)
|
||||
Integer.TryParse(sColumnParams(6), WidthType)
|
||||
Dim bVisible As Boolean = sColumnParams(7).Equals("1")
|
||||
Dim bCanUserEditVisible As Boolean = sColumnParams(8).Equals("1")
|
||||
@@ -65,7 +65,7 @@ Public Module DataGridColumnsIniFile
|
||||
Dim bIsReadOnly As Boolean = sColumnParams(4).Equals("1")
|
||||
Dim Width As Double
|
||||
Dim WidthType As DataGridLengthUnitType
|
||||
StringToDouble(sColumnParams(5), Width)
|
||||
StringToDoubleAdv(sColumnParams(5), Width)
|
||||
Integer.TryParse(sColumnParams(6), WidthType)
|
||||
Dim bVisible As Boolean = sColumnParams(7).Equals("1")
|
||||
Dim bCanUserEditVisible As Boolean = sColumnParams(8).Equals("1")
|
||||
|
||||
@@ -12,6 +12,8 @@ Imports EgtWPFLib5
|
||||
|
||||
Public Class EgtDataGrid
|
||||
|
||||
Public Event ResetSort()
|
||||
|
||||
' vecchio indice da salvare per il Reorder delle colonne
|
||||
Public OldIndex As Integer = 0
|
||||
' indice header su cui è aperto il ContextMenu per gestione check/uncheck LockTable
|
||||
@@ -361,12 +363,14 @@ Public Class EgtDataGrid
|
||||
' resetto graficamente anche l'header della colonna
|
||||
CurrDataGrid.Columns(column.DisplayIndex).SortDirection = Nothing
|
||||
Next
|
||||
RaiseEvent ResetSort()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class EgtDataGridColumn
|
||||
Inherits VMBase
|
||||
|
||||
Private m_dgColumn As DataGridColumn
|
||||
|
||||
@@ -424,6 +428,7 @@ Public Class EgtDataGridColumn
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property m_OrigIsReadOnly As Boolean = True
|
||||
Private Property m_IsReadOnly As Boolean = True
|
||||
Public Property IsReadOnly As Boolean
|
||||
Get
|
||||
@@ -437,6 +442,9 @@ Public Class EgtDataGridColumn
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
Public Sub ResetToOrigIsReadOnly()
|
||||
IsReadOnly = m_OrigIsReadOnly
|
||||
End Sub
|
||||
|
||||
Friend OldCanUserReorder As Boolean?
|
||||
Private m_CanUserReorder As Boolean
|
||||
@@ -500,7 +508,7 @@ Public Class EgtDataGridColumn
|
||||
Private m_ColumnVisibility As Visibility
|
||||
Public Property ColumnVisibility As Visibility
|
||||
Get
|
||||
Return If(m_Visible, Visibility.Visible, Visibility.Collapsed)
|
||||
Return If(m_ColumnVisibility, Visibility.Visible, Visibility.Collapsed)
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_ColumnVisibility = value
|
||||
@@ -520,6 +528,9 @@ Public Class EgtDataGridColumn
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
Public Sub SetColumnVisibility(value As Visibility)
|
||||
ColumnVisibility = value
|
||||
End Sub
|
||||
|
||||
Private m_CanUserEditVisible As Boolean
|
||||
Public Property CanUserEditVisible As Boolean
|
||||
@@ -561,6 +572,7 @@ Public Class EgtDataGridColumn
|
||||
m_CanUserReorder = bCanUserReorder
|
||||
m_CanUserResize = bCanUserResize
|
||||
m_CanUserSort = bCanUserSort
|
||||
m_OrigIsReadOnly = bIsReadOnly
|
||||
m_IsReadOnly = bIsReadOnly
|
||||
m_Width = Width
|
||||
m_Visible = bVisible
|
||||
@@ -588,7 +600,7 @@ Public Class EgtDataGridColumn
|
||||
Public Function SaveDataGridColumn() As Boolean
|
||||
Dim bOk As Boolean
|
||||
Dim sColumnParams = String.Empty
|
||||
sColumnParams = Name & "," & If(CanUserReorder, 1, 0) & "," & If(CanUserResize, 1, 0) & "," & If(CanUserSort, 1, 0) & "," & If(IsReadOnly, 1, 0) & "," & DoubleToString(Width.Value, 6) & "," & Width.UnitType & "," & If(Visible, 1, 0) & "," & If(CanUserEditVisible, 1, 0) & "," & CInt(SortDirection)
|
||||
sColumnParams = Name & "," & If(CanUserReorder, 1, 0) & "," & If(CanUserResize, 1, 0) & "," & If(CanUserSort, 1, 0) & "," & If(m_OrigIsReadOnly, 1, 0) & "," & DoubleToString(Width.Value, 6) & "," & Width.UnitType & "," & If(Visible, 1, 0) & "," & If(CanUserEditVisible, 1, 0) & "," & CInt(SortDirection)
|
||||
bOk = WriteColumnPrivateProfileParam(ParentDataGridName, DisplayIndex, sColumnParams)
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
@@ -94,8 +94,6 @@ Public Class NewMachGroupPanelVM
|
||||
AddHandler m_MachGroupPanelM.MachGroupAdded, AddressOf OnMachGroupAdded
|
||||
If Not MachGroupPanelM.IsMultiMachGroup Then SetMachGroupPanelVisibility(False)
|
||||
CreateMachGroupVMList()
|
||||
' Creo riferimento a questa classe in LibMap
|
||||
'''LibMap.SetRefMachGroupPanelVM(Me)
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
@@ -16,17 +16,19 @@ Public Module LoadingWndHelper
|
||||
CHANGEPARAM = 10
|
||||
CREATINGPDF = 11
|
||||
CHANGEMATERIAL = 12
|
||||
BACKUP = 13
|
||||
RESTORE = 14
|
||||
End Enum
|
||||
|
||||
Dim m_MainWindow As Windows.Window
|
||||
Public Function SetMainWindow(MainWindow As Windows.Window)
|
||||
Public Sub SetMainWindow(MainWindow As Windows.Window)
|
||||
m_MainWindow = MainWindow
|
||||
End Function
|
||||
End Sub
|
||||
|
||||
Private m_bMainWindow_IsActive As Boolean = True
|
||||
Public Function SetMainWindowIsActive(IsActive As Boolean)
|
||||
Public Sub SetMainWindowIsActive(IsActive As Boolean)
|
||||
m_bMainWindow_IsActive = IsActive
|
||||
End Function
|
||||
End Sub
|
||||
|
||||
Delegate Sub CallbackLoadingDlg(ByRef CurrStep As Integer, ByRef StepText As String, ByRef nProgress As Integer, ByRef nNextProgress As Integer, ByRef MainWindow_IsActive As Boolean, ByRef bClose As Boolean)
|
||||
|
||||
@@ -52,7 +54,7 @@ Public Module LoadingWndHelper
|
||||
Dim Left As Double = m_MainWindow.Left + (m_MainWindow.Width / 2) - 150
|
||||
Dim WindowStartupLocation As Windows.WindowStartupLocation = Windows.WindowStartupLocation.Manual
|
||||
If m_MainWindow.WindowState = Windows.WindowState.Maximized Then
|
||||
WindowStartupLocation = Windows.WindowStartupLocation.CenterScreen
|
||||
WindowStartupLocation = Windows.WindowStartupLocation.CenterOwner
|
||||
End If
|
||||
m_thread = New Thread(Sub()
|
||||
m_LoadingWndVM = New Core.LoadingWndVM(nSteps, TotText, AddressOf LoadingCallback)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Input
|
||||
|
||||
Public Class LoadingWndV
|
||||
|
||||
@@ -25,4 +26,11 @@ Public Class LoadingWndV
|
||||
m_LoadingWndVM.StartFunction()
|
||||
End Sub
|
||||
|
||||
Private Sub ToolsDbView_Closing(sender As Object, e As ComponentModel.CancelEventArgs) Handles Me.Closing
|
||||
If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then
|
||||
e.Cancel = True
|
||||
Return
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -113,6 +113,26 @@ Public Class MyMachGroupM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sWAREHOUSEMATERIAL As String
|
||||
Public Property sWAREHOUSEMATERIAL As String
|
||||
Get
|
||||
Return m_sWAREHOUSEMATERIAL
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sWAREHOUSEMATERIAL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_RawPartM As RawPartM
|
||||
Public Property RawPartM As RawPartM
|
||||
Get
|
||||
Return m_RawPartM
|
||||
End Get
|
||||
Set(value As RawPartM)
|
||||
m_RawPartM = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' lista dei pezzi che sono nel grezzo
|
||||
Protected m_PartMList As New List(Of PartM)
|
||||
Public Property PartMList As List(Of PartM)
|
||||
@@ -149,6 +169,16 @@ Public Class MyMachGroupM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_dPosZ As Double = 0
|
||||
Public Property dPosZ As Double
|
||||
Get
|
||||
Return m_dPosZ
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dPosZ = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region ' Wall
|
||||
|
||||
#Region "Calc"
|
||||
@@ -300,17 +330,18 @@ Public Class MyMachGroupM
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_BARLEN, NewMachGroupM.m_dL)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_BARHEIGHT, NewMachGroupM.m_dH)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_BARWIDTH, NewMachGroupM.m_dW)
|
||||
NewMachGroupM.m_dTotMat = NewMachGroupM.m_dL * NewMachGroupM.m_dW * NewMachGroupM.m_dH
|
||||
NewMachGroupM.m_PartMList = LoadParts(NewMachGroupM)
|
||||
For Each Part In NewMachGroupM.m_PartMList
|
||||
Part.UpdateOffset()
|
||||
NewMachGroupM.m_dMatForPart += Part.dVolume
|
||||
NewMachGroupM.m_dTotMat += Part.dL + Part.dOffset
|
||||
NewMachGroupM.m_dMatForPart += Part.dL
|
||||
Next
|
||||
Else
|
||||
NewMachGroupM.m_nRawPartId = EgtGetFirstRawPart()
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELLEN, NewMachGroupM.m_dL)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELWIDTH, NewMachGroupM.m_dW)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELHEIGHT, NewMachGroupM.m_dH)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELPOSZ, NewMachGroupM.m_dPosZ)
|
||||
NewMachGroupM.m_dTotMat = NewMachGroupM.m_dL * NewMachGroupM.m_dW * NewMachGroupM.m_dH
|
||||
NewMachGroupM.m_PartMList = LoadParts(NewMachGroupM)
|
||||
For Each Part In NewMachGroupM.m_PartMList
|
||||
@@ -336,13 +367,14 @@ Public Class MyMachGroupM
|
||||
NewMachGroupM.m_PartMList = LoadParts(NewMachGroupM)
|
||||
For Each Part In NewMachGroupM.m_PartMList
|
||||
Part.UpdateOffset()
|
||||
NewMachGroupM.m_dMatForPart += Part.dVolume
|
||||
NewMachGroupM.m_dMatForPart += Part.dL + Part.dOffset
|
||||
Next
|
||||
Else
|
||||
NewMachGroupM.m_nRawPartId = EgtGetFirstRawPart()
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELLEN, NewMachGroupM.m_dL)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELWIDTH, NewMachGroupM.m_dW)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELHEIGHT, NewMachGroupM.m_dH)
|
||||
EgtGetInfo(NewMachGroupM.m_Id, MGR_RPT_PANELPOSZ, NewMachGroupM.m_dPosZ)
|
||||
NewMachGroupM.m_dTotMat = NewMachGroupM.m_dL * NewMachGroupM.m_dW
|
||||
NewMachGroupM.m_PartMList = LoadParts(NewMachGroupM)
|
||||
For Each Part In NewMachGroupM.m_PartMList
|
||||
@@ -408,7 +440,7 @@ Public Class MyMachGroupM
|
||||
EgtGetInfo(Id, MGR_RPT_PART & 1, sInfo)
|
||||
If Not String.IsNullOrWhiteSpace(sInfo) Then
|
||||
sSplitInfo = sInfo.Split(","c)
|
||||
StringToDouble(sSplitInfo(1), m_dStartCut)
|
||||
StringToDoubleAdv(sSplitInfo(1), m_dStartCut)
|
||||
Else
|
||||
m_dStartCut = 0
|
||||
End If
|
||||
|
||||
@@ -186,7 +186,13 @@ Public Class MyMachGroupPanelM
|
||||
While nOutlineId <> GDB_ID.NULL
|
||||
' verifico che sia feature
|
||||
If EgtExistsInfo(nOutlineId, MGR_FTR_PRC) Then
|
||||
If EgtExistsInfo(nOutlineId, MGR_FTR_PRID) Then
|
||||
Dim nCurrPrId As Integer = GDB_ID.NULL
|
||||
If EgtGetInfo(nOutlineId, MGR_FTR_PRID, nCurrPrId) AndAlso nCurrPrId <> GDB_ID.NULL Then
|
||||
If nCurrPrId < nPRId Then
|
||||
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
|
||||
nPRId += 1
|
||||
End If
|
||||
nPRId = Math.Max(nPRId - 1, nCurrPrId) + 1
|
||||
nOutlineId = EgtGetNext(nOutlineId)
|
||||
Continue While
|
||||
Else
|
||||
@@ -215,20 +221,46 @@ Public Class MyMachGroupPanelM
|
||||
If nBWType = BWType.WALL Then
|
||||
' salvo parametri Q
|
||||
QArray(Duploindex) = New Dictionary(Of String, Dictionary(Of String, String))
|
||||
' ciclo sulle feature
|
||||
Dim nGlobPRId As Integer = 1
|
||||
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
|
||||
If nFeatureLayer <> GDB_ID.NULL Then
|
||||
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
|
||||
While nFeatureId <> GDB_ID.NULL
|
||||
' verifico che sia feature
|
||||
Dim nPRC As Integer
|
||||
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
|
||||
nPRId = 0
|
||||
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
|
||||
If nPRId > nGlobPRId Then nGlobPRId = nPRId
|
||||
Dim sKey As String = nPRId & "." & nPRC
|
||||
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
|
||||
For QIndex = 1 To 10
|
||||
Dim QKey As String = "Q" & QIndex.ToString("D2")
|
||||
Dim QValue As Integer = 0
|
||||
If EgtGetInfo(nFeatureId, QKey, QValue) Then
|
||||
QArray(Duploindex)(sKey).Add(QKey, QValue)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
nFeatureId = EgtGetNext(nFeatureId)
|
||||
End While
|
||||
End If
|
||||
' ciclo sugli outline
|
||||
nOutlineLayer = EgtGetFirstNameInGroup(DuploArray(Duploindex), OUTLINE)
|
||||
If nOutlineLayer <> GDB_ID.NULL Then
|
||||
Dim nGlobPRId As Integer = 1
|
||||
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
|
||||
While nOutlineId <> GDB_ID.NULL
|
||||
' verifico che sia feature
|
||||
Dim nPRC As Integer
|
||||
If EgtGetInfo(nOutlineId, MGR_FTR_PRC, nPRC) Then
|
||||
nPRId = 0
|
||||
If Not EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId) Then
|
||||
If Not EgtGetInfo(nOutlineId, MGR_FTR_PRID, nPRId) OrElse nPRId < nGlobPRId Then
|
||||
nGlobPRId += 1
|
||||
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nGlobPRId)
|
||||
nPRId = nGlobPRId
|
||||
nGlobPRId += 1
|
||||
Else
|
||||
If nPRId > nGlobPRId Then nGlobPRId = nPRId
|
||||
End If
|
||||
Dim sKey As String = nPRId & "." & nPRC
|
||||
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
|
||||
@@ -243,29 +275,6 @@ Public Class MyMachGroupPanelM
|
||||
nOutlineId = EgtGetNext(nOutlineId)
|
||||
End While
|
||||
End If
|
||||
' ciclo sulle feature
|
||||
Dim nFeatureLayer As Integer = EgtGetFirstNameInGroup(DuploArray(Duploindex), PROCESSINGS)
|
||||
If nFeatureLayer <> GDB_ID.NULL Then
|
||||
Dim nFeatureId As Integer = EgtGetFirstInGroup(nFeatureLayer)
|
||||
While nFeatureId <> GDB_ID.NULL
|
||||
' verifico che sia feature
|
||||
Dim nPRC As Integer
|
||||
If EgtGetInfo(nFeatureId, MGR_FTR_PRC, nPRC) Then
|
||||
nPRId = 0
|
||||
EgtGetInfo(nFeatureId, MGR_FTR_PRID, nPRId)
|
||||
Dim sKey As String = nPRId & "." & nPRC
|
||||
QArray(Duploindex).Add(sKey, New Dictionary(Of String, String))
|
||||
For QIndex = 1 To 10
|
||||
Dim QKey As String = "Q" & QIndex.ToString("D2")
|
||||
Dim QValue As Integer = 0
|
||||
If EgtGetInfo(nFeatureId, QKey, QValue) Then
|
||||
QArray(Duploindex)(sKey).Add(QKey, QValue)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
nFeatureId = EgtGetNext(nFeatureId)
|
||||
End While
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
' aggiornamento dei Duplo
|
||||
@@ -338,7 +347,8 @@ Public Class MyMachGroupPanelM
|
||||
End Class
|
||||
|
||||
' funzione che cancella tutti i pezzi segnati da eliminare
|
||||
Public Shared Sub DeleteDuplo()
|
||||
Public Shared Function DeleteDuplo() As List(Of Integer)
|
||||
Dim ToRedrawMachGroupList As New List(Of Integer)
|
||||
' reset necessario per poter accedere direttamente al grezzo dalle info pezzo e al MachGroup tramite la gerarchia Db geometrico
|
||||
EgtResetCurrMachGroup()
|
||||
Dim nPartId As Integer = EgtGetFirstPart()
|
||||
@@ -356,16 +366,37 @@ Public Class MyMachGroupPanelM
|
||||
Dim nRawPartId As Integer = DuploGetRawPart(nDuploId)
|
||||
' recupero gruppo di lavorazione
|
||||
Dim nMachGroupId As Integer = EgtGetParent(EgtGetParent(EgtGetParent(nRawPartId)))
|
||||
|
||||
' elimino eventuali successive info pezzi di troppo
|
||||
Dim nIndex As Integer = 0
|
||||
Dim sTemp As String = ""
|
||||
While EgtGetInfo(nMachGroupId, MGR_RPT_PART & nIndex, sTemp)
|
||||
Dim PartData() As String = sTemp.Split(","c)
|
||||
If PartData(0) <> nDuploId Then
|
||||
EgtSetInfo(nMachGroupId, MGR_RPT_PART & nIndex, sTemp)
|
||||
nIndex += 1
|
||||
End If
|
||||
End While
|
||||
ToRedrawMachGroupList.Add(nMachGroupId)
|
||||
|
||||
|
||||
|
||||
'' elimino vecchio grezzo ed eseguo script creazione nuovo
|
||||
'Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
'While nRawId <> GDB_ID.NULL
|
||||
' EgtRemovePartFromRawPart(EgtGetFirstPartInRawPart(nRawId))
|
||||
' EgtRemoveRawPart(nRawId)
|
||||
' nRawId = EgtGetFirstRawPart()
|
||||
'End While
|
||||
'If Not ExecBeam(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then Return False
|
||||
|
||||
|
||||
|
||||
' lo setto come corrente
|
||||
EgtSetCurrMachGroup(nMachGroupId)
|
||||
' elimino pezzo copia
|
||||
EgtRemovePartFromRawPart(nDuploId)
|
||||
EgtErase(nDuploId)
|
||||
'' recupero gruppo di lavorazione e trave dell'interfaccia
|
||||
'Dim BeamMachGroup As BeamMachGroupM = MachGroupMList.FirstOrDefault(Function(x) x.Id = nMachGroupId)
|
||||
'Dim Beam As BeamM = BeamMachGroup.PartMList.FirstOrDefault(Function(x) x.nPartId = nDuploId)
|
||||
'EgtSetCurrMachGroup(BeamMachGroup.Id)
|
||||
'''Beam.DeletePart()
|
||||
Next
|
||||
End If
|
||||
DuploResetToDelete(nPartId)
|
||||
@@ -373,7 +404,8 @@ Public Class MyMachGroupPanelM
|
||||
nPartId = EgtGetNextPart(nPartId)
|
||||
End While
|
||||
EgtResetCurrMachGroup()
|
||||
End Sub
|
||||
Return ToRedrawMachGroupList
|
||||
End Function
|
||||
|
||||
Friend Shared Function DuploGetToDelete(nSouId As Integer, ByRef bToDelete As Boolean) As Boolean
|
||||
If IsNothing(nSouId) Then Return False
|
||||
@@ -402,12 +434,23 @@ Public Class MyMachGroupPanelM
|
||||
End Function
|
||||
|
||||
Public Shared Function DuploGetRawPart(nDuploId As Integer) As Integer
|
||||
Dim nRawId As Integer = GDB_ID.NULL
|
||||
If EgtGetInfo(nDuploId, GDB_SI_LIST, nRawId) AndAlso nRawId > 0 Then
|
||||
Return nRawId
|
||||
Else
|
||||
Return GDB_ID.NULL
|
||||
Dim nSwapItem As Integer = GDB_ID.NULL
|
||||
Dim sSwapItem As String = String.Empty
|
||||
EgtGetInfo(nDuploId, "!LST", sSwapItem)
|
||||
Dim LSTValues() As String = sSwapItem.Split(","c)
|
||||
If Not IsNothing(LSTValues(LSTValues.Count - 1)) AndAlso Integer.TryParse(LSTValues(LSTValues.Count - 1), nSwapItem) AndAlso nSwapItem > 0 Then
|
||||
Return EgtGetParent(nSwapItem)
|
||||
End If
|
||||
Return GDB_ID.NULL
|
||||
|
||||
|
||||
|
||||
'Dim nRawId As Integer = GDB_ID.NULL
|
||||
'If EgtGetInfo(nDuploId, GDB_SI_LIST, nRawId) AndAlso nRawId > 0 Then
|
||||
' Return nRawId
|
||||
'Else
|
||||
' Return GDB_ID.NULL
|
||||
'End If
|
||||
End Function
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
@@ -210,6 +210,16 @@ Public Class PartM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_MaterialM As MaterialM
|
||||
Public Property MaterialM As MaterialM
|
||||
Get
|
||||
Return m_MaterialM
|
||||
End Get
|
||||
Set(value As MaterialM)
|
||||
m_MaterialM = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public m_sSTOREY As String
|
||||
Public Property sSTOREY As String
|
||||
Get
|
||||
@@ -508,7 +518,7 @@ Public Class PartM
|
||||
Index += 1
|
||||
End While
|
||||
If bFound Then
|
||||
StringToDouble(sSplitInfo(1), NewPartM.m_dPOSX)
|
||||
StringToDoubleAdv(sSplitInfo(1), NewPartM.m_dPOSX)
|
||||
End If
|
||||
Else
|
||||
' leggo PosX, PosY, Rot e Flip
|
||||
|
||||
@@ -47,6 +47,18 @@ Public MustInherit Class MyMachGroupPanelVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dDoneTime As String
|
||||
Get
|
||||
Return m_MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) If(x.nProduction_State >= ItemState.Produced AndAlso Not IsNothing(x.dtEndTime) AndAlso x.dtEndTime <> DateTime.MinValue, (x.dtEndTime - x.dtStartTime).TotalSeconds(), 0), Func(Of MachGroupVM, Double)))
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sDoneTime As String
|
||||
Get
|
||||
Return TimeSpan.FromSeconds(dDoneTime).ToString()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dRemainingTime As String
|
||||
Get
|
||||
Return m_MachGroupVMList.Sum(CType(Function(x As MyMachGroupVM) If(x.nProduction_State < ItemState.Produced, x.nCALC_TIME, 0), Func(Of MachGroupVM, Double)))
|
||||
@@ -96,6 +108,21 @@ Public MustInherit Class MyMachGroupPanelVM
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Sub RedrawModifiedMachGroup(RedrawList As List(Of Integer))
|
||||
For Each nMachGroupId In RedrawList
|
||||
EgtSetCurrMachGroup(nMachGroupId)
|
||||
' elimino vecchio grezzo ed eseguo script creazione nuovo
|
||||
Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
While nRawId <> GDB_ID.NULL
|
||||
EgtRemovePartFromRawPart(EgtGetFirstPartInRawPart(nRawId))
|
||||
EgtRemoveRawPart(nRawId)
|
||||
nRawId = EgtGetFirstRawPart()
|
||||
End While
|
||||
'If Not ExecBeam(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdTypes.RAWPART, False) Then Return False
|
||||
|
||||
Next
|
||||
End Sub
|
||||
|
||||
'Public Overrides Sub AddMachGroup()
|
||||
' Dim MyMachGroupM As MyMachGroupM = m_MyMachGroupPanelM.NewMyMachGroup(CurrentMachine.sMachineName, Map.refProjectVM.BTLStructureVM.nPROJTYPE)
|
||||
' ' e lo seleziono
|
||||
|
||||
@@ -85,13 +85,13 @@ Public MustInherit Class MyMachGroupVM
|
||||
|
||||
Public ReadOnly Property dUsage As Double
|
||||
Get
|
||||
Return If(MyMachGroupM.dMatForPart > 0 AndAlso MyMachGroupM.dTotMat > 0, MyMachGroupM.dMatForPart / MyMachGroupM.dTotMat * 100, 0)
|
||||
Return If(MyMachGroupM.dMatForPart > 0 AndAlso MyMachGroupM.dTotMat > 0, If(nType = BWType.WALL, MyMachGroupM.dMatForPart / MyMachGroupM.dTotMat * 100, MyMachGroupM.dMatForPart / MyMachGroupM.dL * 100), 0)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dWaste As Double
|
||||
Get
|
||||
Return If(MyMachGroupM.dMatForPart > 0 AndAlso MyMachGroupM.dTotMat > 0, (MyMachGroupM.dTotMat - MyMachGroupM.dMatForPart) / MyMachGroupM.dTotMat * 100, 0)
|
||||
Return If(MyMachGroupM.dMatForPart > 0 AndAlso MyMachGroupM.dTotMat > 0, If(nType = BWType.WALL, (MyMachGroupM.dTotMat - MyMachGroupM.dMatForPart) / 1000000000, MyMachGroupM.dL - MyMachGroupM.dTotMat), 0)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -103,7 +103,7 @@ Public MustInherit Class MyMachGroupVM
|
||||
|
||||
Public ReadOnly Property sWaste As String
|
||||
Get
|
||||
Return DoubleToString(dWaste, 3)
|
||||
Return LenToString(dWaste, 3)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -116,6 +116,18 @@ Public MustInherit Class MyMachGroupVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sWAREHOUSEMATERIAL As String
|
||||
Get
|
||||
Return MyMachGroupM.RawPartM.Material.sWarehouseMaterial
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property RawPartM As RawPartM
|
||||
Get
|
||||
Return MyMachGroupM.RawPartM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sUnitTime As String
|
||||
Get
|
||||
Return TimeSpan.FromSeconds(nCALC_TIME).ToString()
|
||||
@@ -130,7 +142,7 @@ Public MustInherit Class MyMachGroupVM
|
||||
|
||||
Public ReadOnly Property Section As SectionXMaterial
|
||||
Get
|
||||
Return New SectionXMaterial(dW, dH, dL, MyMachGroupM.sMATERIAL)
|
||||
Return New SectionXMaterial(dW, dH, dL, MyMachGroupM.RawPartM.Material.sMaterial, MyMachGroupM.sWAREHOUSEMATERIAL)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -169,7 +181,7 @@ Public MustInherit Class MyMachGroupVM
|
||||
Return LenToString(MyMachGroupM.dStartCut, 3)
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, MyMachGroupM.dStartCut)
|
||||
StringToLenAdv(value, MyMachGroupM.dStartCut, True)
|
||||
End Set
|
||||
End Property
|
||||
Public Property dStartCut As Double
|
||||
@@ -481,13 +493,25 @@ Public MustInherit Class MyMachGroupVM
|
||||
End Function
|
||||
|
||||
Public Sub UpdateUsage()
|
||||
MyMachGroupM.SetTotMat(dL * dH * dW)
|
||||
MyMachGroupM.SetMatForPart(0)
|
||||
Dim dPartVolume As Double
|
||||
For Each Part In PartVMList
|
||||
dPartVolume += Part.dVolume
|
||||
Next
|
||||
MyMachGroupM.SetMatForPart(dPartVolume)
|
||||
If nType = BWType.BEAM Then
|
||||
MyMachGroupM.SetMatForPart(0)
|
||||
Dim dPartLength As Double
|
||||
Dim dPartOffsetLength As Double
|
||||
For Each Part In PartVMList
|
||||
dPartOffsetLength += Part.dL + Part.dOffset
|
||||
dPartLength += Part.dL
|
||||
Next
|
||||
MyMachGroupM.SetTotMat(dPartOffsetLength)
|
||||
MyMachGroupM.SetMatForPart(dPartLength)
|
||||
Else
|
||||
MyMachGroupM.SetTotMat(dL * dH * dW)
|
||||
MyMachGroupM.SetMatForPart(0)
|
||||
Dim dPartVolume As Double
|
||||
For Each Part In PartVMList
|
||||
dPartVolume += Part.dVolume
|
||||
Next
|
||||
MyMachGroupM.SetMatForPart(dPartVolume)
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(sUsage))
|
||||
NotifyPropertyChanged(NameOf(sWaste))
|
||||
End Sub
|
||||
@@ -620,13 +644,17 @@ Public MustInherit Class MyMachGroupVM
|
||||
Public ReadOnly Property DeleteMachGroup_Command As ICommand
|
||||
Get
|
||||
If m_cmdDeleteMachGroup Is Nothing Then
|
||||
m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroup)
|
||||
m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroupCmd)
|
||||
End If
|
||||
Return m_cmdDeleteMachGroup
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Sub DeleteMachGroup()
|
||||
Public Sub DeleteMachGroupCmd()
|
||||
DeleteMachGroup()
|
||||
End Sub
|
||||
|
||||
Public Overridable Sub DeleteMachGroup(Optional bMultipleCommand As Boolean = False)
|
||||
' elimino tutte le copie
|
||||
Dim nRawPartId As Integer = EgtGetFirstRawPart()
|
||||
Dim nBeamId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
|
||||
|
||||
@@ -107,7 +107,7 @@ Public MustInherit Class PartVM
|
||||
Return LenToString(m_PartM.dPOSX, 3)
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_PartM.dPOSX)
|
||||
StringToLenAdv(value, m_PartM.dPOSX, True)
|
||||
End Set
|
||||
End Property
|
||||
Public Property dPOSX As Double
|
||||
@@ -162,6 +162,19 @@ Public MustInherit Class PartVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sWAREHOUSEMATERIAL As String
|
||||
Get
|
||||
Return m_PartM.MaterialM.sWarehouseMaterial
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property MaterialM As MaterialM
|
||||
Get
|
||||
Return m_PartM.MaterialM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
Public ReadOnly Property sSTOREY As String
|
||||
Get
|
||||
Return m_PartM.sSTOREY
|
||||
@@ -217,7 +230,7 @@ Public MustInherit Class PartVM
|
||||
Return LenToString(m_PartM.dOffset, 3)
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_PartM.dOffset)
|
||||
StringToLenAdv(value, m_PartM.dOffset, True)
|
||||
End Set
|
||||
End Property
|
||||
Public ReadOnly Property dOffset As Double
|
||||
@@ -235,7 +248,7 @@ Public MustInherit Class PartVM
|
||||
Return LenToString(m_PartM.dPOSY, 3)
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_PartM.dPOSY)
|
||||
StringToLenAdv(value, m_PartM.dPOSY, True)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
@@ -250,7 +263,7 @@ Public MustInherit Class PartVM
|
||||
Return LenToString(m_PartM.dROT, 3) & "°"
|
||||
End Get
|
||||
Set(value As String)
|
||||
StringToLen(value, m_PartM.dROT)
|
||||
StringToLenAdv(value, m_PartM.dROT, True)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
@@ -562,8 +575,9 @@ Public MustInherit Class PartVM
|
||||
|
||||
Public Sub CalcFallUpdate(FALL As Integer)
|
||||
EgtSetInfo(nPartId, ITG_PROD_FALL, FALL, True)
|
||||
m_PartM.nCALC_FALL = 0
|
||||
m_PartM.nCALC_FALL = FALL
|
||||
NotifyPropertyChanged(NameOf(nCALC_FALL))
|
||||
NotifyPropertyChanged(NameOf(CALC_FALL_Visibility))
|
||||
End Sub
|
||||
|
||||
' funzione che aggiorna lo stato e gli errori dopo calcolo
|
||||
|
||||
@@ -16,7 +16,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("Egalware s.r.l.")>
|
||||
<Assembly: AssemblyProduct("EgtBEAMWALL.Core")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020-2022 by Egalware s.r.l.")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2020-2024 by Egalware s.r.l.")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
@@ -35,5 +35,5 @@ Imports System.Runtime.InteropServices
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.4.3.2")>
|
||||
<Assembly: AssemblyFileVersion("2.4.3.2")>
|
||||
<Assembly: AssemblyVersion("2.6.6.1")>
|
||||
<Assembly: AssemblyFileVersion("2.6.6.1")>
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
<EgtWPFLib5:EgtCustomWindow x:Class="NewOpenProjectFileDialogV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
|
||||
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Core"
|
||||
Title="{Binding Title}"
|
||||
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="True"
|
||||
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
|
||||
IsClosable="False"
|
||||
MinHeight="500" MinWidth="500"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}">
|
||||
|
||||
<EgtWPFLib5:EgtCustomWindow.Resources>
|
||||
<EgtWPFLib5:FileNameConverter x:Key="FileNameConverter"/>
|
||||
</EgtWPFLib5:EgtCustomWindow.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="5*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Header="{Binding Filters_Msg}"
|
||||
Margin="5"
|
||||
Visibility="{Binding Filters_Visibility}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox ItemsSource="{Binding BTLDateTypeList}"
|
||||
SelectedIndex="{Binding SelBTLDateType}"
|
||||
Width="105"
|
||||
Margin="5"
|
||||
Style="{StaticResource FeatureComboBox}"/>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||
<ComboBox ItemsSource="{Binding DayTypeList}"
|
||||
SelectedIndex="{Binding SelDayType}"
|
||||
Width="105"
|
||||
Margin="0,0,2.5,0"
|
||||
Style="{StaticResource PartParam_ComboBox}"/>
|
||||
<StackPanel Orientation="Horizontal" Visibility="{Binding Date_Visibility}">
|
||||
<TextBlock Text="{Binding From_Msg}"
|
||||
Style="{StaticResource Filter_TextBlock}"/>
|
||||
<DatePicker SelectedDate="{Binding dtStartDate}"
|
||||
Style="{StaticResource Filter_DatePicker}"/>
|
||||
<TextBlock Text="{Binding To_Msg}"
|
||||
Style="{StaticResource Filter_TextBlock}"/>
|
||||
<DatePicker SelectedDate="{Binding dtEndDate}"
|
||||
Style="{StaticResource Filter_DatePicker}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<CheckBox Grid.Column="2"
|
||||
IsChecked="{Binding bViewArchived}"
|
||||
Content="{Binding ViewArchived_Msg}"
|
||||
VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox ItemsSource="{Binding FilterTypeList}"
|
||||
SelectedItem="{Binding SelFilterType}"
|
||||
Width="105"
|
||||
Margin="5"
|
||||
Style="{StaticResource FeatureComboBox}"/>
|
||||
<EgtWPFLib5:EgtTextBox Grid.Column="1"
|
||||
Text="{Binding SearchText}"
|
||||
Margin="5"
|
||||
Visibility="{Binding SearchText_Visibility}"/>
|
||||
<StackPanel Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Rows_Msg}"
|
||||
Style="{StaticResource OptionTextBlock}"/>
|
||||
<ComboBox ItemsSource="{Binding RowQuantityList}"
|
||||
SelectedIndex="{Binding SelRowQuantity}"
|
||||
Style="{StaticResource FeatureComboBox}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<EgtBEAMWALL:EgtDataGrid x:Name="MainDataGrid"
|
||||
Grid.Row="1"
|
||||
ItemsSource="{Binding ProjectList}"
|
||||
SelectedItem="{Binding SelProject}"
|
||||
CanUserAddRows="False"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserResizeRows="False"
|
||||
SelectionMode="Single"
|
||||
ScrollViewer.CanContentScroll="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
Margin="5"
|
||||
RowDetailsVisibilityMode="Visible"
|
||||
CellEditEnding="MainDataGrid_CellEditEnding"
|
||||
BindingColumns="{Binding ProdColumns}">
|
||||
<DataGrid.Resources>
|
||||
<!-- ProdId -->
|
||||
<DataGridTextColumn x:Key="colPRODID" Binding="{Binding sProdId}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.Id_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!--Name-->
|
||||
<DataGridTextColumn x:Key="colNAME" Binding="{Binding sName}">
|
||||
<DataGridTextColumn.Header>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding Path=DataContext.Name_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
<ToggleButton Grid.Column="1"
|
||||
Margin="5,0,0,0"
|
||||
IsChecked="{Binding Path=DataContext.bIsEditNameActive,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
|
||||
Style="{StaticResource ToolBar_SmallToggleButton}">
|
||||
<Image Source="\Resources\CalcPanel\Edit.png"
|
||||
Style="{StaticResource LockImage}"/>
|
||||
</ToggleButton>
|
||||
</Grid>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<!-- Creation date -->
|
||||
<DataGridTextColumn x:Key="colCRTDATE" Binding="{Binding dtCreateDate}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.CreateDate_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<!-- Machine -->
|
||||
<DataGridTextColumn x:Key="colMACHINE" Binding="{Binding sMachine}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.Machine_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<!-- Archived -->
|
||||
<DataGridTemplateColumn x:Key="colARCHIVED">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Image Source="\Resources\OpenProjectFileDialog\Archived.png"
|
||||
Visibility="{Binding Archived_Visibility}"
|
||||
Height="15"
|
||||
Width="15"
|
||||
Stretch="UniformToFill"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock Text="{Binding Path=DataContext.Archived_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
</DataGridTemplateColumn.Header>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="FontWeight" Value="DemiBold"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<EventSetter Event="MouseDoubleClick" Handler="ProjectList_MouseDoubleClick"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.RowDetailsTemplate>
|
||||
<DataTemplate>
|
||||
<ItemsControl ItemsSource="{Binding ProjFileList}"
|
||||
BorderThickness="0"
|
||||
Margin="0,-1,0,0"
|
||||
Padding="0">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid TextBlock.FontSize="12"
|
||||
TextBlock.FontWeight="Normal">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Path=DataContext.ProdColumns[0].ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Gray"
|
||||
Margin="40,0,40,0"/>
|
||||
<Grid Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Margin="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="{Binding Path=DataContext.BTLFileName_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
|
||||
Style="{StaticResource OpenWnd_TextBlock}"/>
|
||||
<TextBlock Grid.Column="1"
|
||||
Text="{Binding sBTLFileName}"/>
|
||||
<TextBlock Grid.Row="1"
|
||||
Text="{Binding Path=DataContext.ListName_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
|
||||
Style="{StaticResource OpenWnd_TextBlock}"/>
|
||||
<TextBlock Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Text="{Binding sListName}"/>
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="{Binding Path=DataContext.ExportDate_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:NewOpenProjectFileDialogV}}}"
|
||||
Style="{StaticResource OpenWnd_TextBlock}"/>
|
||||
<TextBlock Grid.Column="3"
|
||||
Text="{Binding dtExportDate}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</DataTemplate>
|
||||
</DataGrid.RowDetailsTemplate>
|
||||
</EgtBEAMWALL:EgtDataGrid>
|
||||
|
||||
<UniformGrid Columns="4" Grid.Row="2" Margin="0,0,0,5">
|
||||
<Button IsDefault="True" Name="OpenBtn"
|
||||
Content="{Binding Open_Msg}"
|
||||
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
<Button Content="{Binding Archive_Msg}"
|
||||
Command="{Binding Archive_Command}"
|
||||
IsEnabled="{Binding bArchived_IsEnabled}"
|
||||
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
<Button Content="{Binding Delete_Msg}"
|
||||
Command="{Binding Delete_Command}"
|
||||
IsEnabled="{Binding bDelete_IsEnabled}"
|
||||
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
<Button Command="{Binding Cancel_Command}"
|
||||
Content="{Binding Cancel_Msg}"
|
||||
Style="{DynamicResource EgtWPFLib5_InputButton}"/>
|
||||
</UniformGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</EgtWPFLib5:EgtCustomWindow>
|
||||
@@ -0,0 +1,86 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Input
|
||||
Imports EgtBEAMWALL.Core.ConstBeam
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtBEAMWALL
|
||||
Imports System.Windows.Media
|
||||
|
||||
Public Class NewOpenProjectFileDialogV
|
||||
|
||||
Private WithEvents m_OpenProjFileDialogVM As NewOpenProjectFileDialogVM
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(Owner As Window, OpenProjFileDialogVM As NewOpenProjectFileDialogVM)
|
||||
' Funzione che interpreta l'xaml
|
||||
InitializeComponent()
|
||||
Me.Owner = Owner
|
||||
Me.DataContext = OpenProjFileDialogVM
|
||||
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
||||
m_OpenProjFileDialogVM = OpenProjFileDialogVM
|
||||
AddHandler Me.Loaded, AddressOf OpenProjectFileDialog_Loaded
|
||||
AddHandler Me.Closing, AddressOf OpenProjectFileDialog_Closing
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public Function EgtShowDialog(ProjectType As ProjectType) As Boolean?
|
||||
m_OpenProjFileDialogVM.Init(ProjectType)
|
||||
' mostro la finestra di dialogo
|
||||
Return Me.ShowDialog()
|
||||
End Function
|
||||
Public Function EgtShowDialog(ProjectType As ProjectType, ProjectList As List(Of ProjectFileVM)) As Boolean?
|
||||
m_OpenProjFileDialogVM.Init(ProjectType, ProjectList)
|
||||
' mostro la finestra di dialogo
|
||||
Return Me.ShowDialog()
|
||||
End Function
|
||||
|
||||
Public Function EgtShowDialog(ProjectType As ProjectType, GoToProd As Boolean) As Boolean?
|
||||
m_OpenProjFileDialogVM.Init(ProjectType, Nothing, GoToProd)
|
||||
' mostro la finestra di dialogo
|
||||
Return Me.ShowDialog()
|
||||
End Function
|
||||
|
||||
Private Sub OpenProjectFileDialog_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
' Carico e imposto posizione finestra
|
||||
WinPosFromIniToWindow(S_OPENFILEDIALOG, K_VIEWOPTIMWINPLACE, Me)
|
||||
End Sub
|
||||
|
||||
Private Sub OpenProjectFileDialog_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs)
|
||||
If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then
|
||||
e.Cancel = True
|
||||
Return
|
||||
End If
|
||||
' Salvo posizione finestra (se non minimizzata)
|
||||
WinPosFromWindowToIni(Me, S_OPENFILEDIALOG, K_VIEWOPTIMWINPLACE)
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "EVENTS"
|
||||
|
||||
Private Sub ProjectList_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs)
|
||||
m_OpenProjFileDialogVM.ProjDoubleClick()
|
||||
End Sub
|
||||
|
||||
#End Region ' EVENTS
|
||||
|
||||
Private Sub OpenBtn_Click(sender As Object, e As RoutedEventArgs) Handles OpenBtn.Click
|
||||
DialogResult = m_OpenProjFileDialogVM.VerifySelected()
|
||||
End Sub
|
||||
|
||||
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_OpenProjFileDialogVM.m_CloseWindow
|
||||
Me.DialogResult = bDialogResult
|
||||
End Sub
|
||||
|
||||
Private Sub MainDataGrid_CellEditEnding(sender As Object, e As DataGridCellEditEndingEventArgs)
|
||||
'm_OpenProjFileDialogVM.SetIsEditNameActive(False)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,781 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Data
|
||||
Imports System.Windows.Input
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtBEAMWALL.Core.ConstBeam
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public MustInherit Class NewOpenProjectFileDialogVM
|
||||
Inherits VMBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Public Enum BTLDateTypes As Integer
|
||||
CREATEDATE = 0
|
||||
EXPORTDATE = 1
|
||||
End Enum
|
||||
|
||||
Private Enum FilterTypes As Integer
|
||||
NULL = 0
|
||||
ID = 1
|
||||
BTLFILENAME = 2
|
||||
LISTNAME = 3
|
||||
MACHINE = 4
|
||||
End Enum
|
||||
|
||||
Public Enum DayTypes As Integer
|
||||
LASTMONTH = 0
|
||||
LAST3MONTHS = 1
|
||||
LAST6MONTHS = 2
|
||||
PERIOD = 3
|
||||
ALWAYS = 4
|
||||
End Enum
|
||||
|
||||
Public Enum RowQuantities As Integer
|
||||
FIFTY = 0
|
||||
HUNDRED = 1
|
||||
HUNDREDANDFIFTY = 2
|
||||
End Enum
|
||||
|
||||
Friend Event m_CloseWindow(bDialogResult As Boolean)
|
||||
|
||||
Protected m_ProdColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||
Public Property ProdColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||
Get
|
||||
Return m_ProdColumns
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of EgtDataGridColumn))
|
||||
m_ProdColumns = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_colProdFile_Name As EgtDataGridColumn
|
||||
Public ReadOnly Property colProdFile_Name As EgtDataGridColumn
|
||||
Get
|
||||
Return m_colProdFile_Name
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_colArchived_Name As EgtDataGridColumn
|
||||
Public ReadOnly Property colArchived_Name As EgtDataGridColumn
|
||||
Get
|
||||
Return m_colArchived_Name
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_ProjColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||
Public Property ProjColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||
Get
|
||||
Return m_ProjColumns
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of EgtDataGridColumn))
|
||||
m_ProjColumns = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_ProjectType As ProjectType
|
||||
|
||||
Protected m_sFilter As String
|
||||
Public Property Filter As String
|
||||
Get
|
||||
Return m_sFilter
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sFilter = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sFileNameFilter As Predicate(Of String)
|
||||
Public Property FileNameFilter As Predicate(Of String)
|
||||
Get
|
||||
Return m_sFileNameFilter
|
||||
End Get
|
||||
Set(value As Predicate(Of String))
|
||||
m_sFileNameFilter = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sExtensions As New List(Of String)
|
||||
Public ReadOnly Property Extensions As List(Of String)
|
||||
Get
|
||||
Return m_sExtensions
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public m_ProjectList_View As CollectionView = Nothing
|
||||
Protected m_ProjectList As New ObservableCollection(Of ProdItem)
|
||||
Public ReadOnly Property ProjectList As ObservableCollection(Of ProdItem)
|
||||
Get
|
||||
Return m_ProjectList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_nSelProjIndex As Integer
|
||||
Public ReadOnly Property nSelProjIndex As Integer
|
||||
Get
|
||||
Return m_nSelProjIndex
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelProject As ProdItem
|
||||
Public Property SelProject As ProdItem
|
||||
Get
|
||||
Return m_SelProject
|
||||
End Get
|
||||
Set(value As ProdItem)
|
||||
m_SelProject = value
|
||||
' verifico se abilitare il bottone Delete
|
||||
If IsNothing(m_SelProject) Then
|
||||
SetDeleteIsEnabled(False)
|
||||
SetArchivedIsEnabled(False)
|
||||
ElseIf IsNothing(m_SelProject.ProdFileVM) Then
|
||||
SetDeleteIsEnabled(True)
|
||||
SetArchivedIsEnabled(False)
|
||||
Else
|
||||
SetDeleteIsEnabled(Not SelProject.ProdFileVM.bIsProduced)
|
||||
SetArchivedIsEnabled(True)
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(Archive_Msg))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_FileName As String
|
||||
Public Property FileName As String
|
||||
Get
|
||||
Return m_FileName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_FileName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_bFixedProjectList As Boolean
|
||||
Public ReadOnly Property bFixedProjectList As Boolean
|
||||
Get
|
||||
Return m_bFixedProjectList
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetFixedProjectList(bValue As Boolean)
|
||||
m_bFixedProjectList = bValue
|
||||
NotifyPropertyChanged(NameOf(Filters_Visibility))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Filters_Visibility As Visibility
|
||||
Get
|
||||
Return If(m_bFixedProjectList, Visibility.Collapsed, Visibility.Visible)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_BTLDateTypeList As New List(Of String)
|
||||
Public ReadOnly Property BTLDateTypeList As List(Of String)
|
||||
Get
|
||||
Return m_BTLDateTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelBTLDateType As BTLDateTypes = Nothing
|
||||
Public Property SelBTLDateType As Integer
|
||||
Get
|
||||
Return m_SelBTLDateType
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_DayTypeList As New List(Of String)({EgtMsg(62532), EgtMsg(62533), EgtMsg(62534), EgtMsg(62531)})
|
||||
Public Overridable ReadOnly Property DayTypeList As List(Of String)
|
||||
Get
|
||||
Return m_DayTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelDayType As DayTypes = DayTypes.LASTMONTH
|
||||
Public Property SelDayType As Integer
|
||||
Get
|
||||
Return m_SelDayType
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
Dim PrevSelDayType As DayTypes = m_SelDayType
|
||||
m_SelDayType = value
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_DAYTYPE, Convert.ToInt32(m_SelDayType))
|
||||
m_Date_Visibility = If(m_SelDayType = DayTypes.PERIOD, Visibility.Visible, Visibility.Collapsed)
|
||||
If m_SelDayType = DayTypes.PERIOD Then
|
||||
Select Case PrevSelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 3)
|
||||
Case DayTypes.LAST6MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 6)
|
||||
Case DayTypes.ALWAYS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = New DateTime(2020, 1, 1)
|
||||
End Select
|
||||
NotifyPropertyChanged(NameOf(dtStartDate))
|
||||
NotifyPropertyChanged(NameOf(dtEndDate))
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(Date_Visibility))
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dtStartDate As DateTime = DateTime.Today
|
||||
Public Property dtStartDate As DateTime
|
||||
Get
|
||||
Return m_dtStartDate
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtStartDate = value
|
||||
Dim lStartDate As Long = m_dtStartDate.ToFileTimeUtc()
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, lStartDate.ToString())
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dtEndDate As DateTime = DateTime.Today
|
||||
Public Property dtEndDate As DateTime
|
||||
Get
|
||||
Return m_dtEndDate
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtEndDate = value
|
||||
Dim lEndDate As Long = m_dtEndDate.ToFileTimeUtc()
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, lEndDate.ToString())
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Date_Visibility As Visibility = Visibility.Collapsed
|
||||
Public ReadOnly Property Date_Visibility As Visibility
|
||||
Get
|
||||
Return m_Date_Visibility
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_RowQuantityList As New List(Of String)({50, 100, 150})
|
||||
Public ReadOnly Property RowQuantityList As List(Of String)
|
||||
Get
|
||||
Return m_RowQuantityList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_SelRowQuantity As RowQuantities
|
||||
Public Property SelRowQuantity As Integer
|
||||
Get
|
||||
Return m_SelRowQuantity
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_SelRowQuantity = value
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' lista campi per ricerca testuale e con datepicker
|
||||
Protected m_FilterTypeList As New ObservableCollection(Of IdNameStruct)
|
||||
Public ReadOnly Property FilterTypeList As ObservableCollection(Of IdNameStruct)
|
||||
Get
|
||||
Return m_FilterTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelFilterType As IdNameStruct = Nothing
|
||||
Public Property SelFilterType As IdNameStruct
|
||||
Get
|
||||
Return m_SelFilterType
|
||||
End Get
|
||||
Set(value As IdNameStruct)
|
||||
' resetto il contenuto della barra di ricerca testuale
|
||||
m_SearchText = ""
|
||||
NotifyPropertyChanged(NameOf(SearchText))
|
||||
' resetto le selezioni sul calendario
|
||||
If Not IsNothing(SearchDate) Then SearchDate.Clear()
|
||||
' setto il Tipo Filtro a NULL e refresho la lista dei progetti (in modo da averli visibili tutti)
|
||||
m_SelFilterType = m_FilterTypeList(0)
|
||||
m_ProjectList_View.Refresh()
|
||||
' ora setto il valore scelto come Tipo Filtro
|
||||
m_SelFilterType = value
|
||||
Select Case m_SelFilterType.Id
|
||||
Case FilterTypes.ID, FilterTypes.BTLFILENAME, FilterTypes.LISTNAME, FilterTypes.MACHINE
|
||||
SearchText_Visibility = Visibility.Visible
|
||||
SearchDate_Visibility = Visibility.Collapsed
|
||||
Case BTLDateTypes.EXPORTDATE, BTLDateTypes.CREATEDATE
|
||||
SearchText_Visibility = Visibility.Collapsed
|
||||
SearchDate_Visibility = Visibility.Visible
|
||||
Case Else
|
||||
SearchText_Visibility = Visibility.Collapsed
|
||||
SearchDate_Visibility = Visibility.Collapsed
|
||||
End Select
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_SearchText As String = ""
|
||||
Public Property SearchText As String
|
||||
Get
|
||||
Return m_SearchText
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_SearchText = value
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Friend m_SearchDate As SelectedDatesCollection = Nothing
|
||||
Public ReadOnly Property SearchDate As SelectedDatesCollection
|
||||
Get
|
||||
Return m_SearchDate
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SearchText_Visibility As Visibility = Visibility.Collapsed
|
||||
Public Property SearchText_Visibility As Visibility
|
||||
Get
|
||||
Return m_SearchText_Visibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_SearchText_Visibility = value
|
||||
NotifyPropertyChanged(NameOf(SearchText_Visibility))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_SearchDate_Visibility As Visibility = Visibility.Collapsed
|
||||
Public Property SearchDate_Visibility As Visibility
|
||||
Get
|
||||
Return m_SearchDate_Visibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_SearchDate_Visibility = value
|
||||
NotifyPropertyChanged(NameOf(SearchDate_Visibility))
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property bIsEditNameActive As Boolean
|
||||
Get
|
||||
Return Not m_colProdFile_Name.IsReadOnly
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If Not IsNothing(m_colProdFile_Name) Then
|
||||
m_colProdFile_Name.IsReadOnly = Not value
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
Public Sub SetIsEditNameActive(value As Boolean)
|
||||
If Not IsNothing(m_colProdFile_Name) Then
|
||||
m_colProdFile_Name.IsReadOnly = Not value
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(bIsEditNameActive))
|
||||
End Sub
|
||||
|
||||
Private m_bViewArchived As Boolean
|
||||
Public Property bViewArchived As Boolean
|
||||
Get
|
||||
Return m_bViewArchived
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bViewArchived = value
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_VIEWARCHIVED, If(bViewArchived, 1, 0))
|
||||
If Not IsNothing( m_colArchived_Name) Then
|
||||
m_colArchived_Name.Visible = value
|
||||
RefreshProjectList()
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_bArchived_IsEnabled As Boolean
|
||||
Public ReadOnly Property bArchived_IsEnabled As Boolean
|
||||
Get
|
||||
Return m_bArchived_IsEnabled
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetArchivedIsEnabled(bValue As Boolean)
|
||||
m_bArchived_IsEnabled = bValue
|
||||
NotifyPropertyChanged(NameOf(bArchived_IsEnabled))
|
||||
End Sub
|
||||
|
||||
Private m_bDelete_IsEnabled As Boolean
|
||||
Public ReadOnly Property bDelete_IsEnabled As Boolean
|
||||
Get
|
||||
Return m_bDelete_IsEnabled
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetDeleteIsEnabled(bValue As Boolean)
|
||||
m_bDelete_IsEnabled = bValue
|
||||
NotifyPropertyChanged(NameOf(bDelete_IsEnabled))
|
||||
End Sub
|
||||
|
||||
Protected m_ChangeOpenedProjectOnCancel As Boolean = False
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property Title As String
|
||||
Get
|
||||
Return EgtMsg(61986)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Filters_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61985)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property FilterType_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61836)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Search_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61837)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Id_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61815)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property BTLFileName_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61819)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ListName_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61820)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ExportDate_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61821)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property CreateDate_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61822)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Machine_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61886)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Name_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61808)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Open_Msg As String
|
||||
Get
|
||||
Return EgtMsg(30006)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Archived_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61983)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Archive_Msg As String
|
||||
Get
|
||||
If Not IsNothing(m_SelProject) AndAlso m_SelProject.bIsArchived Then
|
||||
Return EgtMsg(61984)
|
||||
Else
|
||||
Return EgtMsg(61981)
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Delete_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61823)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property Cancel_Msg As String
|
||||
Get
|
||||
Return EgtMsg(30002)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property From_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62523)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property To_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62524)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property ViewArchived_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61982)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Rows_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61995)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdProjectDoubleClick As ICommand
|
||||
Private m_cmdDelete As ICommand
|
||||
Private m_cmdArchive As ICommand
|
||||
Private m_cmdCancel As ICommand
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
Sub New()
|
||||
' assegno delegato a elementi lista
|
||||
ProdItem.m_delIsModifiedSetUp = AddressOf SetIsEditNameActive
|
||||
' carico colonne
|
||||
LoadColumns()
|
||||
m_colProdFile_Name = m_ProdColumns.FirstOrDefault(Function(x) x.Name = COL_NAME)
|
||||
m_colArchived_Name = m_ProdColumns.FirstOrDefault(Function(x) x.Name = COL_ARCHIVED)
|
||||
' leggo valori per filtri
|
||||
m_SelDayType = GetMainPrivateProfileInt(S_OPENFILEDIALOG, K_DAYTYPE, 0)
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 3)
|
||||
Case DayTypes.LAST6MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 6)
|
||||
Case DayTypes.PERIOD
|
||||
Dim sStartDate As String = "0"
|
||||
Dim lStartDate As Long = 0
|
||||
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, 0, sStartDate)
|
||||
Long.TryParse(sStartDate, lStartDate)
|
||||
m_dtStartDate = If(lStartDate > 0, DateTime.FromFileTimeUtc(lStartDate), DateTime.Today)
|
||||
Dim sEndDate As String = "0"
|
||||
Dim lEndDate As Long = 0
|
||||
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, 0, sEndDate)
|
||||
Long.TryParse(sEndDate, lEndDate)
|
||||
m_dtEndDate = If(lEndDate > 0, DateTime.FromFileTimeUtc(lEndDate), DateTime.Today)
|
||||
m_Date_Visibility = Visibility.Visible
|
||||
End Select
|
||||
m_bViewArchived = GetMainPrivateProfileInt(S_OPENFILEDIALOG, K_VIEWARCHIVED, 0) <> 0
|
||||
End Sub
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public MustOverride Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||
Public Overridable Sub RefreshProjectList(Optional GoToProd As Boolean = False)
|
||||
End Sub
|
||||
|
||||
Protected Sub LoadColumns()
|
||||
'If ProjectType = ProjectType.PROJ Then
|
||||
' carico le colonne della datagrid
|
||||
' GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROJ, ProjColumns)
|
||||
' ' carico campi su cui eseguire il filtro di ricerca
|
||||
' m_BTLDateTypeList = New List(Of String)({CreateDate_Msg, ExportDate_Msg})
|
||||
' m_SelBTLDateType = BTLDateTypes.CREATEDATE
|
||||
' NotifyPropertyChanged(NameOf(BTLDateTypeList))
|
||||
' NotifyPropertyChanged(NameOf(SelBTLDateType))
|
||||
' m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
|
||||
' New IdNameStruct(FilterTypes.ID, Id_Msg),
|
||||
' New IdNameStruct(FilterTypes.BTLFILENAME, BTLFileName_Msg),
|
||||
' New IdNameStruct(FilterTypes.LISTNAME, ListName_Msg),
|
||||
' New IdNameStruct(FilterTypes.MACHINE, Machine_Msg)})
|
||||
' m_SelFilterType = m_FilterTypeList.FirstOrDefault(Function(x) x.Id = FilterTypes.NULL)
|
||||
' NotifyPropertyChanged(NameOf(SelFilterType))
|
||||
'ElseIf ProjectType = ProjectType.PROD Then
|
||||
' carico le colonne della datagrid
|
||||
GetPrivateProfileColumns(S_NEWOPENPROJFILEDLG_PROD, ProdColumns)
|
||||
' carico campi su cui eseguire il filtro di ricerca
|
||||
m_BTLDateTypeList = New List(Of String)({CreateDate_Msg})
|
||||
m_SelBTLDateType = BTLDateTypes.CREATEDATE
|
||||
NotifyPropertyChanged(NameOf(BTLDateTypeList))
|
||||
NotifyPropertyChanged(NameOf(SelBTLDateType))
|
||||
m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
|
||||
New IdNameStruct(FilterTypes.BTLFILENAME, BTLFileName_Msg),
|
||||
New IdNameStruct(FilterTypes.LISTNAME, ListName_Msg),
|
||||
New IdNameStruct(FilterTypes.MACHINE, Machine_Msg)})
|
||||
m_SelFilterType = m_FilterTypeList.FirstOrDefault(Function(x) x.Id = FilterTypes.NULL)
|
||||
NotifyPropertyChanged(NameOf(SelFilterType))
|
||||
'End If
|
||||
' setto la visibilità delle colonne delle EgtDataGrid
|
||||
For Each col In ProjColumns
|
||||
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
|
||||
Next
|
||||
For Each col In ProdColumns
|
||||
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Friend Function VerifySelected() As Boolean
|
||||
If IsNothing(SelProject) Then Return False
|
||||
Dim AllFilesInDir As IEnumerable(Of String) = Nothing
|
||||
If m_ProjectType = Core.ConstBeam.ProjectType.PROJ Then
|
||||
If Not IsNothing(SelProject.ProdFileVM) Then
|
||||
If String.IsNullOrWhiteSpace(SelProject.ProdFileVM.sProdDirPath) OrElse Not Directory.Exists(SelProject.ProdFileVM.sProdDirPath) Then Return False
|
||||
AllFilesInDir = Directory.EnumerateFiles(SelProject.ProdFileVM.sProdDirPath)
|
||||
ElseIf SelProject.ProjFileList.Count > 0 Then
|
||||
If String.IsNullOrWhiteSpace(SelProject.ProjFileList(0).sProjDirPath) OrElse Not Directory.Exists(SelProject.ProjFileList(0).sProjDirPath) Then Return False
|
||||
AllFilesInDir = Directory.EnumerateFiles(SelProject.ProjFileList(0).sProjDirPath)
|
||||
Else Return False
|
||||
End If
|
||||
ElseIf m_ProjectType = Core.ConstBeam.ProjectType.PROD Then
|
||||
If String.IsNullOrWhiteSpace(SelProject.ProdFileVM.sProdDirPath) OrElse Not Directory.Exists(SelProject.ProdFileVM.sProdDirPath) Then Return False
|
||||
AllFilesInDir = Directory.EnumerateFiles(SelProject.ProdFileVM.sProdDirPath)
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
Return AllFilesInDir.Any(Function(x) Path.GetExtension(x).ToLower() = ".nge")
|
||||
End Function
|
||||
|
||||
Protected Function ProjectFilter(Proj As Object) As Boolean
|
||||
Dim bProjectOk As Boolean = True
|
||||
'If TypeOf Proj Is ProjFileVM Then
|
||||
Dim CurrProj As ProdItem = DirectCast(Proj, ProdItem)
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
|
||||
(m_SelFilterType.Id = BTLDateTypes.EXPORTDATE AndAlso Not CurrProj.ProjFileList.Any(Function(x) SearchDate.Contains(DirectCast(x, ProjFileVM).dtExportDate.Date))) OrElse
|
||||
(m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
(m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.ProjFileList.Any(Function(x) DirectCast(x, ProjFileVM).sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso CurrProj.ProjFileList.Any(Function(x) DirectCast(x, ProjFileVM).sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
'ElseIf TypeOf Proj Is ProdFileVM Then
|
||||
' Dim CurrProj As ProdFileVM = DirectCast(Proj, ProdFileVM)
|
||||
' If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
|
||||
' (m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
' If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
' (m_SelFilterType.Id = FilterTypes.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
' (m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
' (m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
'End If
|
||||
Return bProjectOk
|
||||
End Function
|
||||
|
||||
Protected Sub CloseWindow(bDialogResult As Boolean)
|
||||
RaiseEvent m_CloseWindow(bDialogResult)
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "ProjectDoubleClick"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property ProjectDoubleClick_Command As ICommand
|
||||
Get
|
||||
If m_cmdProjectDoubleClick Is Nothing Then
|
||||
m_cmdProjectDoubleClick = New Command(AddressOf ProjDoubleClick)
|
||||
End If
|
||||
Return m_cmdProjectDoubleClick
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Friend Sub ProjDoubleClick()
|
||||
' verifico se non e' attivo edit del nome
|
||||
If bIsEditNameActive Then Return
|
||||
' verifico validita' selezionato
|
||||
If VerifySelected() Then
|
||||
RaiseEvent m_CloseWindow(True)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' ProjectDoubleClick
|
||||
|
||||
#Region "Archive"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property Archive_Command As ICommand
|
||||
Get
|
||||
If m_cmdArchive Is Nothing Then
|
||||
m_cmdArchive = New Command(AddressOf Archive)
|
||||
End If
|
||||
Return m_cmdArchive
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Overridable Sub Archive()
|
||||
End Sub
|
||||
|
||||
#End Region ' Archive
|
||||
|
||||
#Region "Delete"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property Delete_Command As ICommand
|
||||
Get
|
||||
If m_cmdDelete Is Nothing Then
|
||||
m_cmdDelete = New Command(AddressOf Delete)
|
||||
End If
|
||||
Return m_cmdDelete
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Overridable Sub Delete()
|
||||
End Sub
|
||||
|
||||
#End Region ' Delete
|
||||
|
||||
#Region "Cancel"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do New.
|
||||
''' </summary>
|
||||
Public ReadOnly Property Cancel_Command As ICommand
|
||||
Get
|
||||
If m_cmdCancel Is Nothing Then
|
||||
m_cmdCancel = New Command(AddressOf Cancel)
|
||||
End If
|
||||
Return m_cmdCancel
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the New. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Overridable Sub Cancel()
|
||||
End Sub
|
||||
|
||||
#End Region ' Cancel
|
||||
|
||||
#End Region ' Commands
|
||||
|
||||
End Class
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Core"
|
||||
Title="{Binding Title}"
|
||||
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
|
||||
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False"
|
||||
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="True"
|
||||
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
|
||||
Height="500" Width="500" Topmost="True"
|
||||
MinHeight="500" MinWidth="500"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}">
|
||||
|
||||
<EgtWPFLib5:EgtCustomWindow.Resources>
|
||||
@@ -21,42 +21,106 @@
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel>
|
||||
<Grid Grid.Row="0" Margin="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*" />
|
||||
<RowDefinition Height="1*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<GroupBox Header="Filters"
|
||||
Margin="5"
|
||||
Visibility="{Binding Filters_Visibility}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox ItemsSource="{Binding BTLDateTypeList}"
|
||||
SelectedIndex="{Binding SelBTLDateType}"
|
||||
Width="105"
|
||||
Margin="5"
|
||||
Style="{StaticResource FeatureComboBox}"/>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||
<ComboBox ItemsSource="{Binding DayTypeList}"
|
||||
SelectedIndex="{Binding SelDayType}"
|
||||
Width="105"
|
||||
Margin="0,0,2.5,0"
|
||||
Style="{StaticResource PartParam_ComboBox}"/>
|
||||
<StackPanel Orientation="Horizontal" Visibility="{Binding Date_Visibility}">
|
||||
<TextBlock Text="{Binding From_Msg}"
|
||||
Style="{StaticResource Filter_TextBlock}"/>
|
||||
<DatePicker SelectedDate="{Binding dtStartDate}"
|
||||
Style="{StaticResource Filter_DatePicker}"/>
|
||||
<TextBlock Text="{Binding To_Msg}"
|
||||
Style="{StaticResource Filter_TextBlock}"/>
|
||||
<DatePicker SelectedDate="{Binding dtEndDate}"
|
||||
Style="{StaticResource Filter_DatePicker}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox ItemsSource="{Binding FilterTypeList}"
|
||||
SelectedItem="{Binding SelFilterType}"
|
||||
Width="105"
|
||||
Margin="5"
|
||||
Style="{StaticResource FeatureComboBox}"/>
|
||||
<EgtWPFLib5:EgtTextBox Grid.Column="1"
|
||||
Text="{Binding SearchText}"
|
||||
Margin="5"
|
||||
Visibility="{Binding SearchText_Visibility}"/>
|
||||
<StackPanel Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Text="Rows"
|
||||
Style="{StaticResource OptionTextBlock}"/>
|
||||
<ComboBox ItemsSource="{Binding RowQuantityList}"
|
||||
SelectedIndex="{Binding SelRowQuantity}"
|
||||
Style="{StaticResource FeatureComboBox}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<TextBlock Text="{Binding FilterType_Msg}"
|
||||
|
||||
<!--<StackPanel>
|
||||
<Grid Grid.Row="0" Margin="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*" />
|
||||
<RowDefinition Height="1*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding FilterType_Msg}"
|
||||
Grid.Row="0" Grid.Column="0"
|
||||
Style="{StaticResource OptionTextBlock}"/>
|
||||
<ComboBox ItemsSource="{Binding SearchColumnList}"
|
||||
<ComboBox ItemsSource="{Binding SearchColumnList}"
|
||||
SelectedItem="{Binding SelSearchColumn}"
|
||||
Width="Auto"
|
||||
Margin="5"
|
||||
Grid.Row="0" Grid.Column="1"
|
||||
Style="{StaticResource FeatureComboBox}"/>
|
||||
<TextBlock Text="{Binding Search_Msg}"
|
||||
<TextBlock Text="{Binding Search_Msg}"
|
||||
Margin="0,5,0,0"
|
||||
Grid.Row="1" Grid.Column="0"
|
||||
Style="{StaticResource OptionTextBlock}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding SearchText}"
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding SearchText}"
|
||||
Margin="5"
|
||||
Grid.Row="1" Grid.Column="1"
|
||||
Visibility="{Binding SearchText_Visibility}"/>
|
||||
<Calendar SelectedDatesChanged="Calendar_SelectedDatesChanged"
|
||||
<Calendar SelectedDatesChanged="Calendar_SelectedDatesChanged"
|
||||
SelectionMode="MultipleRange"
|
||||
Grid.Row="1" Grid.Column="1"
|
||||
Visibility="{Binding SearchDate_Visibility}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>-->
|
||||
|
||||
<EgtBEAMWALL:EgtDataGrid Grid.Row="1"
|
||||
<EgtBEAMWALL:EgtDataGrid Grid.Row="1"
|
||||
ItemsSource="{Binding ProjectList}"
|
||||
SelectedItem="{Binding SelProject}"
|
||||
CanUserAddRows="False"
|
||||
@@ -85,6 +149,14 @@
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!-- Project Name -->
|
||||
<DataGridTextColumn x:Key="colPROJNAME" Binding="{Binding sDescription}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=DataContext.BTLFileName_Msg,RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OpenProjectFileDialogV}}}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
</DataGridTextColumn>
|
||||
<!-- BTL FileName -->
|
||||
<DataGridTextColumn x:Key="colBTLNAME" Binding="{Binding sBTLFileName}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
@@ -154,6 +226,7 @@
|
||||
</ListBox.ItemTemplate>-->
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="IsEnabled" Value="{Binding bIsEnabled}"/>
|
||||
<EventSetter Event="MouseDoubleClick" Handler="ProjectList_MouseDoubleClick"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
|
||||
@@ -5,6 +5,8 @@ Imports System.Windows.Controls
|
||||
Imports System.Windows.Input
|
||||
Imports EgtBEAMWALL.Core.ConstBeam
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtBEAMWALL
|
||||
|
||||
Public Class OpenProjectFileDialogV
|
||||
|
||||
@@ -19,6 +21,8 @@ Public Class OpenProjectFileDialogV
|
||||
Me.DataContext = OpenProjFileDialogVM
|
||||
' Assegno al riferimento locale al VM il VM preso dal DataContext
|
||||
m_OpenProjFileDialogVM = OpenProjFileDialogVM
|
||||
AddHandler Me.Loaded, AddressOf OpenProjectFileDialog_Loaded
|
||||
AddHandler Me.Closing, AddressOf OpenProjectFileDialog_Closing
|
||||
End Sub
|
||||
|
||||
#End Region ' CONSTRUCTOR
|
||||
@@ -42,6 +46,20 @@ Public Class OpenProjectFileDialogV
|
||||
Return Me.ShowDialog()
|
||||
End Function
|
||||
|
||||
Private Sub OpenProjectFileDialog_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
' Carico e imposto posizione finestra
|
||||
WinPosFromIniToWindow(S_OPENFILEDIALOG, K_VIEWOPTIMWINPLACE, Me)
|
||||
End Sub
|
||||
|
||||
Private Sub OpenProjectFileDialog_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs)
|
||||
If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then
|
||||
e.Cancel = True
|
||||
Return
|
||||
End If
|
||||
' Salvo posizione finestra (se non minimizzata)
|
||||
WinPosFromWindowToIni(Me, S_OPENFILEDIALOG, K_VIEWOPTIMWINPLACE)
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "EVENTS"
|
||||
@@ -60,10 +78,4 @@ Public Class OpenProjectFileDialogV
|
||||
Me.DialogResult = bDialogResult
|
||||
End Sub
|
||||
|
||||
Private Sub Calendar_SelectedDatesChanged(sender As Object, e As SelectionChangedEventArgs)
|
||||
Dim cal As System.Windows.Controls.Calendar = sender
|
||||
m_OpenProjFileDialogVM.m_SearchDate = cal.SelectedDates
|
||||
m_OpenProjFileDialogVM.m_ProjectList_View.Refresh()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -14,8 +14,36 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Public Enum BTLDateTypes As Integer
|
||||
CREATEDATE = 0
|
||||
EXPORTDATE = 1
|
||||
End Enum
|
||||
|
||||
Private Enum FilterTypes As Integer
|
||||
NULL = 0
|
||||
ID = 1
|
||||
BTLFILENAME = 2
|
||||
LISTNAME = 3
|
||||
MACHINE = 4
|
||||
End Enum
|
||||
|
||||
Public Enum DayTypes As Integer
|
||||
LASTMONTH = 0
|
||||
LAST3MONTHS = 1
|
||||
LAST6MONTHS = 2
|
||||
PERIOD = 3
|
||||
End Enum
|
||||
|
||||
Public Enum RowQuantities As Integer
|
||||
FIFTY = 0
|
||||
HUNDRED = 1
|
||||
HUNDREDANDFIFTY = 2
|
||||
End Enum
|
||||
|
||||
Friend Event m_CloseWindow(bDialogResult As Boolean)
|
||||
|
||||
Protected m_GoToProd As Boolean = False
|
||||
|
||||
Protected m_ProjectColumns As New ObservableCollection(Of EgtDataGridColumn)
|
||||
Public Property ProjectColumns As ObservableCollection(Of EgtDataGridColumn)
|
||||
Get
|
||||
@@ -83,18 +111,148 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' lista campi per ricerca testuale e con datepicker
|
||||
Protected m_SearchColumnList As New ObservableCollection(Of IdNameStruct)
|
||||
Public ReadOnly Property SearchColumnList As ObservableCollection(Of IdNameStruct)
|
||||
Private m_bFixedProjectList As Boolean
|
||||
Public ReadOnly Property bFixedProjectList As Boolean
|
||||
Get
|
||||
Return m_SearchColumnList
|
||||
Return m_bFixedProjectList
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetFixedProjectList(bValue As Boolean)
|
||||
m_bFixedProjectList = bValue
|
||||
NotifyPropertyChanged(NameOf(Filters_Visibility))
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property Filters_Visibility As Visibility
|
||||
Get
|
||||
Return If(m_bFixedProjectList, Visibility.Collapsed, Visibility.Visible)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelSearchColumn As IdNameStruct = Nothing
|
||||
Public Property SelSearchColumn As IdNameStruct
|
||||
Protected m_BTLDateTypeList As New List(Of String)
|
||||
Public ReadOnly Property BTLDateTypeList As List(Of String)
|
||||
Get
|
||||
Return m_SelSearchColumn
|
||||
Return m_BTLDateTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelBTLDateType As BTLDateTypes = Nothing
|
||||
Public Property SelBTLDateType As Integer
|
||||
Get
|
||||
Return m_SelBTLDateType
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Private m_DayTypeList As New List(Of String)({EgtMsg(62532), EgtMsg(62533), EgtMsg(62534), EgtMsg(62531)})
|
||||
Public ReadOnly Property DayTypeList As List(Of String)
|
||||
Get
|
||||
Return m_DayTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelDayType As DayTypes = DayTypes.LASTMONTH
|
||||
Public Property SelDayType As Integer
|
||||
Get
|
||||
Return m_SelDayType
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
Dim PrevSelDayType As DayTypes = m_SelDayType
|
||||
m_SelDayType = value
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_DAYTYPE, Convert.ToInt32(m_SelDayType))
|
||||
m_Date_Visibility = If(m_SelDayType = DayTypes.PERIOD, Visibility.Visible, Visibility.Collapsed)
|
||||
If m_SelDayType = DayTypes.PERIOD Then
|
||||
Select Case PrevSelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
m_dtStartDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtEndDate = m_dtStartDate - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
|
||||
Case DayTypes.LAST6MONTHS
|
||||
|
||||
End Select
|
||||
NotifyPropertyChanged(NameOf(dtStartDate))
|
||||
NotifyPropertyChanged(NameOf(dtEndDate))
|
||||
End If
|
||||
NotifyPropertyChanged(NameOf(Date_Visibility))
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dtStartDate As DateTime = DateTime.Today
|
||||
Public Property dtStartDate As DateTime
|
||||
Get
|
||||
Return m_dtStartDate
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtStartDate = value
|
||||
Dim lStartDate As Long = m_dtStartDate.ToFileTimeUtc()
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, lStartDate.ToString())
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dtEndDate As DateTime = DateTime.Today
|
||||
Public Property dtEndDate As DateTime
|
||||
Get
|
||||
Return m_dtEndDate
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtEndDate = value
|
||||
Dim lEndDate As Long = m_dtEndDate.ToFileTimeUtc()
|
||||
WriteMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, lEndDate.ToString())
|
||||
' aggiorno lista da Db
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Date_Visibility As Visibility = Visibility.Collapsed
|
||||
Public ReadOnly Property Date_Visibility As Visibility
|
||||
Get
|
||||
Return m_Date_Visibility
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_RowQuantityList As New List(Of String)({50, 100, 150})
|
||||
Public ReadOnly Property RowQuantityList As List(Of String)
|
||||
Get
|
||||
Return m_RowQuantityList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_SelRowQuantity As RowQuantities
|
||||
Public Property SelRowQuantity As Integer
|
||||
Get
|
||||
Return m_SelRowQuantity
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_SelRowQuantity = value
|
||||
RefreshProjectList()
|
||||
m_ProjectList_View.Refresh()
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' lista campi per ricerca testuale e con datepicker
|
||||
Protected m_FilterTypeList As New ObservableCollection(Of IdNameStruct)
|
||||
Public ReadOnly Property FilterTypeList As ObservableCollection(Of IdNameStruct)
|
||||
Get
|
||||
Return m_FilterTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_SelFilterType As IdNameStruct = Nothing
|
||||
Public Property SelFilterType As IdNameStruct
|
||||
Get
|
||||
Return m_SelFilterType
|
||||
End Get
|
||||
Set(value As IdNameStruct)
|
||||
' resetto il contenuto della barra di ricerca testuale
|
||||
@@ -103,15 +261,15 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
' resetto le selezioni sul calendario
|
||||
If Not IsNothing(SearchDate) Then SearchDate.Clear()
|
||||
' setto il Tipo Filtro a NULL e refresho la lista dei progetti (in modo da averli visibili tutti)
|
||||
m_SelSearchColumn = m_SearchColumnList(0)
|
||||
m_SelFilterType = m_FilterTypeList(0)
|
||||
m_ProjectList_View.Refresh()
|
||||
' ora setto il valore scelto come Tipo Filtro
|
||||
m_SelSearchColumn = value
|
||||
Select Case m_SelSearchColumn.Id
|
||||
Case OpenProjFileColumn.ID, OpenProjFileColumn.BTLFILENAME, OpenProjFileColumn.LISTNAME
|
||||
m_SelFilterType = value
|
||||
Select Case m_SelFilterType.Id
|
||||
Case FilterTypes.ID, FilterTypes.BTLFILENAME, FilterTypes.LISTNAME, FilterTypes.MACHINE
|
||||
SearchText_Visibility = Visibility.Visible
|
||||
SearchDate_Visibility = Visibility.Collapsed
|
||||
Case OpenProjFileColumn.EXPORTDATE, OpenProjFileColumn.CREATEDATE
|
||||
Case BTLDateTypes.EXPORTDATE, BTLDateTypes.CREATEDATE
|
||||
SearchText_Visibility = Visibility.Collapsed
|
||||
SearchDate_Visibility = Visibility.Visible
|
||||
Case Else
|
||||
@@ -161,17 +319,13 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Enum OpenProjFileColumn As Integer
|
||||
NULL = 0
|
||||
ID = 1
|
||||
BTLFILENAME = 2
|
||||
LISTNAME = 3
|
||||
EXPORTDATE = 4
|
||||
CREATEDATE = 5
|
||||
End Enum
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property Title As String
|
||||
Get
|
||||
Return "Open Project"
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property FilterType_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61836)
|
||||
@@ -235,6 +389,18 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property From_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62523)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property To_Msg As String
|
||||
Get
|
||||
Return EgtMsg(62524)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
' Definizione comandi
|
||||
@@ -243,29 +409,70 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
|
||||
#End Region ' FIELDS & PROPERTIES
|
||||
|
||||
Sub New()
|
||||
' leggo valori per filtri
|
||||
m_SelDayType = GetMainPrivateProfileInt(S_OPENFILEDIALOG, K_DAYTYPE, 0)
|
||||
Select Case m_SelDayType
|
||||
Case DayTypes.LASTMONTH
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5)
|
||||
Case DayTypes.LAST3MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 3)
|
||||
Case DayTypes.LAST6MONTHS
|
||||
m_dtEndDate = DateTime.Today + TimeSpan.FromDays(1)
|
||||
m_dtStartDate = m_dtEndDate - TimeSpan.FromDays(30.5 * 6)
|
||||
Case DayTypes.PERIOD
|
||||
Dim sStartDate As String = "0"
|
||||
Dim lStartDate As Long = 0
|
||||
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_STARTDATE, 0, sStartDate)
|
||||
Long.TryParse(sStartDate, lStartDate)
|
||||
m_dtStartDate = If(lStartDate > 0, DateTime.FromFileTimeUtc(lStartDate), DateTime.Today)
|
||||
Dim sEndDate As String = "0"
|
||||
Dim lEndDate As Long = 0
|
||||
GetMainPrivateProfileString(S_OPENFILEDIALOG, K_ENDDATE, 0, sEndDate)
|
||||
Long.TryParse(sEndDate, lEndDate)
|
||||
m_dtEndDate = If(lEndDate > 0, DateTime.FromFileTimeUtc(lEndDate), DateTime.Today)
|
||||
m_Date_Visibility = Visibility.Visible
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public MustOverride Function Init(ProjectType As ProjectType, Optional CurrProjectList As List(Of ProjectFileVM) = Nothing, Optional GoToProd As Boolean = False) As Boolean?
|
||||
Public Overridable Sub RefreshProjectList()
|
||||
End Sub
|
||||
|
||||
Protected Sub LoadColumns(ProjectType As ProjectType)
|
||||
If ProjectType = ProjectType.PROJ Then
|
||||
' carico le colonne della datagrid
|
||||
GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROJ, ProjectColumns)
|
||||
' carico campi su cui eseguire il filtro di ricerca
|
||||
m_SearchColumnList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(OpenProjFileColumn.NULL, ""),
|
||||
New IdNameStruct(OpenProjFileColumn.ID, Id_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.BTLFILENAME, BTLFileName_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.LISTNAME, ListName_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.EXPORTDATE, ExportDate_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.CREATEDATE, CreateDate_Msg)})
|
||||
m_BTLDateTypeList = New List(Of String)({CreateDate_Msg, ExportDate_Msg})
|
||||
m_SelBTLDateType = BTLDateTypes.CREATEDATE
|
||||
NotifyPropertyChanged(NameOf(BTLDateTypeList))
|
||||
NotifyPropertyChanged(NameOf(SelBTLDateType))
|
||||
m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
|
||||
New IdNameStruct(FilterTypes.ID, Id_Msg),
|
||||
New IdNameStruct(FilterTypes.BTLFILENAME, BTLFileName_Msg),
|
||||
New IdNameStruct(FilterTypes.LISTNAME, ListName_Msg),
|
||||
New IdNameStruct(FilterTypes.MACHINE, Machine_Msg)})
|
||||
m_SelFilterType = m_FilterTypeList.FirstOrDefault(Function(x) x.Id = FilterTypes.NULL)
|
||||
NotifyPropertyChanged(NameOf(SelFilterType))
|
||||
ElseIf ProjectType = ProjectType.PROD Then
|
||||
' carico le colonne della datagrid
|
||||
GetPrivateProfileColumns(S_OPENPROJFILEDLG_PROD, ProjectColumns)
|
||||
' carico campi su cui eseguire il filtro di ricerca
|
||||
m_SearchColumnList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(OpenProjFileColumn.NULL, ""),
|
||||
New IdNameStruct(OpenProjFileColumn.ID, Id_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.BTLFILENAME, BTLFileName_Msg),
|
||||
New IdNameStruct(OpenProjFileColumn.CREATEDATE, CreateDate_Msg)})
|
||||
m_BTLDateTypeList = New List(Of String)({CreateDate_Msg})
|
||||
m_SelBTLDateType = BTLDateTypes.CREATEDATE
|
||||
NotifyPropertyChanged(NameOf(BTLDateTypeList))
|
||||
NotifyPropertyChanged(NameOf(SelBTLDateType))
|
||||
m_FilterTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(FilterTypes.NULL, ""),
|
||||
New IdNameStruct(FilterTypes.ID, Id_Msg),
|
||||
New IdNameStruct(FilterTypes.BTLFILENAME, BTLFileName_Msg),
|
||||
New IdNameStruct(FilterTypes.MACHINE, Machine_Msg)})
|
||||
m_SelFilterType = m_FilterTypeList.FirstOrDefault(Function(x) x.Id = FilterTypes.NULL)
|
||||
NotifyPropertyChanged(NameOf(SelFilterType))
|
||||
End If
|
||||
' setto la visibilità delle colonne delle EgtDataGrid
|
||||
For Each col In ProjectColumns
|
||||
@@ -275,12 +482,16 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
|
||||
Friend Function VerifySelected() As Boolean
|
||||
If IsNothing(SelProject) Then Return False
|
||||
Dim AllFilesInDir As IEnumerable(Of String)
|
||||
Dim AllFilesInDir As IEnumerable(Of String) = Nothing
|
||||
If m_ProjectType = Core.ConstBeam.ProjectType.PROJ Then
|
||||
If String.IsNullOrWhiteSpace(SelProject.sProjDirPath) OrElse Not Directory.Exists(SelProject.sProjDirPath) Then Return False
|
||||
' verifico se esiste ProdId
|
||||
AllFilesInDir = IO.Directory.EnumerateFiles(SelProject.sProjDirPath)
|
||||
AllFilesInDir = Directory.EnumerateFiles(SelProject.sProjDirPath)
|
||||
ElseIf m_ProjectType = Core.ConstBeam.ProjectType.PROD Then
|
||||
AllFilesInDir = IO.Directory.EnumerateFiles(SelProject.sProdDirPath)
|
||||
If String.IsNullOrWhiteSpace(SelProject.sProdDirPath) OrElse Not Directory.Exists(SelProject.sProdDirPath) Then Return False
|
||||
AllFilesInDir = Directory.EnumerateFiles(SelProject.sProdDirPath)
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
For Each File In AllFilesInDir
|
||||
If Path.GetExtension(File).ToLower() = ".nge" Then
|
||||
@@ -294,20 +505,22 @@ Public MustInherit Class OpenProjectFileDialogVM
|
||||
Dim bProjectOk As Boolean = True
|
||||
If m_ProjectType = ProjectType.PROJ Then
|
||||
Dim CurrProj As ProjFileVM = DirectCast(Proj, ProjFileVM)
|
||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso (
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.EXPORTDATE AndAlso Not SearchDate.Contains(CurrProj.dtExportDate.Date)) OrElse
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.ID AndAlso CurrProj.sProjId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.LISTNAME AndAlso CurrProj.sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
|
||||
(m_SelFilterType.Id = BTLDateTypes.EXPORTDATE AndAlso Not SearchDate.Contains(CurrProj.dtExportDate.Date)) OrElse
|
||||
(m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
(m_SelFilterType.Id = FilterTypes.ID AndAlso CurrProj.sProjId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso CurrProj.sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
ElseIf m_ProjectType = ProjectType.PROD Then
|
||||
Dim CurrProj As ProdFileVM = DirectCast(Proj, ProdFileVM)
|
||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso (
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
If m_SelSearchColumn.Id <> OpenProjFileColumn.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelSearchColumn.Id = OpenProjFileColumn.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso (
|
||||
(m_SelFilterType.Id = BTLDateTypes.CREATEDATE AndAlso Not SearchDate.Contains(CurrProj.dtCreateDate.Date))) Then bProjectOk = False
|
||||
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso (
|
||||
(m_SelFilterType.Id = FilterTypes.ID AndAlso CurrProj.sProdId.ToString.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso CurrProj.sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0) OrElse
|
||||
(m_SelFilterType.Id = FilterTypes.MACHINE AndAlso CurrProj.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then bProjectOk = False
|
||||
End If
|
||||
Return bProjectOk
|
||||
End Function
|
||||
|
||||
@@ -10,12 +10,45 @@ Public Class ProdFileM
|
||||
Return m_nProjIdList
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetProjIdList(value As List(Of Integer))
|
||||
m_nProjIdList = value
|
||||
End Sub
|
||||
|
||||
Protected m_ProjMList As List(Of ProjFileM)
|
||||
Public ReadOnly Property ProjMList As List(Of ProjFileM)
|
||||
Get
|
||||
Return m_ProjMList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_sName As String
|
||||
Public ReadOnly Property sName As String
|
||||
Public Property sName As String
|
||||
Get
|
||||
Return m_sName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_bIsProduced As Boolean
|
||||
Public Property bIsProduced As Boolean
|
||||
Get
|
||||
Return m_bIsProduced
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bIsProduced = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nProjCloudId As Integer
|
||||
Public Property nProjCloudId As Integer
|
||||
Get
|
||||
Return m_nProjCloudId
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nProjCloudId = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
@@ -27,7 +60,8 @@ Public Class ProdFileM
|
||||
Return New ProdFileM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProdFileM(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType, sMachine As String) As ProdFileM
|
||||
Public Shared Function CreateProdFileM(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
|
||||
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean, Optional nProjCloudId As Integer = 0) As ProdFileM
|
||||
Dim NewProjectFileM As New ProdFileM
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
NewProjectFileM.m_nProjIdList = nProjIdList
|
||||
@@ -35,6 +69,30 @@ Public Class ProdFileM
|
||||
NewProjectFileM.m_sName = sName
|
||||
NewProjectFileM.m_nType = nType
|
||||
NewProjectFileM.m_sMachine = sMachine
|
||||
NewProjectFileM.m_sLockedBy = sLockedBy
|
||||
NewProjectFileM.m_dtLock = dtLock
|
||||
NewProjectFileM.m_bIsActive = bIsActive
|
||||
NewProjectFileM.m_bIsProduced = bIsProduced
|
||||
NewProjectFileM.m_bIsArchived = bIsArchived
|
||||
NewProjectFileM.m_nProjCloudId = nProjCloudId
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProdFileM(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
|
||||
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean, ProjMList As List(Of ProjFileM)) As ProdFileM
|
||||
Dim NewProjectFileM As New ProdFileM
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
NewProjectFileM.m_nProjIdList = nProjIdList
|
||||
NewProjectFileM.m_dtCreateDate = dtCreateProjDate
|
||||
NewProjectFileM.m_sName = sName
|
||||
NewProjectFileM.m_nType = nType
|
||||
NewProjectFileM.m_sMachine = sMachine
|
||||
NewProjectFileM.m_sLockedBy = sLockedBy
|
||||
NewProjectFileM.m_dtLock = dtLock
|
||||
NewProjectFileM.m_bIsActive = bIsActive
|
||||
NewProjectFileM.m_bIsProduced = bIsProduced
|
||||
NewProjectFileM.m_bIsArchived = bIsArchived
|
||||
NewProjectFileM.m_ProjMList = ProjMList
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
|
||||
Imports EgtWPFLib5
|
||||
Imports System.Windows
|
||||
|
||||
Public Class ProdItem
|
||||
Inherits VMBase
|
||||
|
||||
Public Shared m_delIsModifiedSetUp As Action(Of Boolean)
|
||||
|
||||
Protected m_ProdFileVM As ProdFileVM
|
||||
Public ReadOnly Property ProdFileVM As ProdFileVM
|
||||
Get
|
||||
Return m_ProdFileVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_ProjFileList As New List(Of ProjectFileVM)
|
||||
Public ReadOnly Property ProjFileList As List(Of ProjectFileVM)
|
||||
Get
|
||||
Return m_ProjFileList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sProdId As String
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sProdId, "")
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overridable Property sName As String
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), m_ProdFileVM.sName, "")
|
||||
End Get
|
||||
Set(value As String)
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
m_ProdFileVM.sName = value
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property dtCreateDate As Date
|
||||
Get
|
||||
Return If(Not IsNothing(m_ProdFileVM), {m_ProdFileVM.dtCreateDate, m_ProjFileList.Min(Function(x) x.dtCreateDate)}.Min(), m_ProjFileList.Min(Function(x) x.dtCreateDate))
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property sCreateDate As String
|
||||
Get
|
||||
Return dtCreateDate.ToString()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sMachine As String
|
||||
Get
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
Return m_ProdFileVM.sMachine
|
||||
ElseIf Not IsNothing(m_ProjFileList(0)) Then
|
||||
Return m_ProjFileList(0).sMachine
|
||||
Else Return ""
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property bIsArchived As Boolean
|
||||
Get
|
||||
If Not IsNothing(m_ProdFileVM) Then
|
||||
Return m_ProdFileVM.bIsArchived
|
||||
ElseIf Not IsNothing(m_ProjFileList(0)) Then
|
||||
Return m_ProjFileList(0).bIsArchived
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Archived_Visibility As Visibility
|
||||
Get
|
||||
Return If(bIsArchived, Visibility.Visible, Visibility.Collapsed)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(ProdFileVM As ProdFileVM, ProjFileVM As ProjFileVM)
|
||||
m_ProdFileVM = ProdFileVM
|
||||
m_ProjFileList.Add(ProjFileVM)
|
||||
End Sub
|
||||
|
||||
Sub New(ProjFileVM As ProjFileVM)
|
||||
m_ProjFileList = New List(Of ProjectFileVM)({ProjFileVM})
|
||||
End Sub
|
||||
|
||||
Sub New(ProdFileVM As ProjectFileVM, ProjFileVMList As List(Of ProjectFileVM))
|
||||
m_ProdFileVM = ProdFileVM
|
||||
m_ProjFileList = ProjFileVMList
|
||||
End Sub
|
||||
|
||||
|
||||
Public Shared Function CreateProdItem(nProdId As Integer, nProjIdList As List(Of Integer), dtCreateProjDate As DateTime, sName As String, nType As BWType,
|
||||
sMachine As String, sLockedBy As String, dtLock As DateTime, bIsActive As Boolean, bIsProduced As Boolean, bIsArchived As Boolean, ProjMList As List(Of ProjFileM)) As ProdItem
|
||||
|
||||
|
||||
Dim NewProdFileM = ProdFileM.CreateProdFileM(nProdId, nProjIdList, dtCreateProjDate, sName, nType, sMachine, sLockedBy, dtLock, bIsActive, bIsProduced, bIsArchived)
|
||||
Dim NewProdFileVM = New ProdFileVM(NewProdFileM)
|
||||
Dim NewProjFileVM As IEnumerable(Of ProjectFileVM)
|
||||
NewProjFileVM = ProjMList.Select(Of ProjFileVM)(Function(j) New ProjFileVM(j)).ToList
|
||||
Dim NewProdItem = New ProdItem(NewProdFileVM, NewProjFileVM.ToList)
|
||||
|
||||
Return NewProdItem
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProdItem(ProjFileM As ProjFileM) As ProdItem
|
||||
|
||||
Dim NewProdItem = New ProdItem(New ProjFileVM(ProjFileM))
|
||||
|
||||
Return NewProdItem
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -19,12 +19,32 @@ Public Class ProjFileM
|
||||
End Property
|
||||
|
||||
Protected m_sBTLFileName As String = String.Empty
|
||||
Public Property sBTLFileName As String
|
||||
Public Property sBTLFileName As String
|
||||
Get
|
||||
Return m_sBTLFileName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sBTLFileName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sDescription As String = String.Empty
|
||||
Public Property sDescription As String
|
||||
Get
|
||||
Return m_sBTLFileName
|
||||
Return m_sDescription
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sBTLFileName = value
|
||||
m_sDescription = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_nProjCloudId As Integer
|
||||
Public Property nProjCloudId As Integer
|
||||
Get
|
||||
Return m_nProjCloudId
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nProjCloudId = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
@@ -37,8 +57,7 @@ Public Class ProjFileM
|
||||
Return New ProjFileM
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateProjFileM(nProjId As Integer, nProdId As Integer, dtCreateProjDate As DateTime, dtExportDate As DateTime, sListName As String,
|
||||
sBTLFileName As String, IsNew As Boolean, IsLocked As Boolean, nType As BWType, sMachine As String) As ProjFileM
|
||||
Public Shared Function CreateProjFileM(nProjId As Integer, nProdId As Integer, dtCreateProjDate As DateTime, dtExportDate As DateTime, sListName As String, sBTLFileName As String, sDescription As String, IsNew As Boolean, IsLocked As Boolean, nType As BWType, sMachine As String, bIsActive As Boolean, bIsArchived As Boolean, Optional nProjCloudId As Integer = 0) As ProjFileM
|
||||
Dim NewProjectFileM As New ProjFileM
|
||||
NewProjectFileM.m_nProjId = nProjId
|
||||
NewProjectFileM.m_nProdId = nProdId
|
||||
@@ -46,10 +65,14 @@ Public Class ProjFileM
|
||||
NewProjectFileM.m_dtExportDate = dtExportDate
|
||||
NewProjectFileM.m_sListName = sListName
|
||||
NewProjectFileM.m_sBTLFileName = sBTLFileName
|
||||
NewProjectFileM.m_sDescription = sDescription
|
||||
NewProjectFileM.m_bIsNew = IsNew
|
||||
NewProjectFileM.m_bIsLocked = IsLocked
|
||||
NewProjectFileM.m_nType = nType
|
||||
NewProjectFileM.m_sMachine = sMachine
|
||||
NewProjectFileM.m_bIsActive = bIsActive
|
||||
NewProjectFileM.m_bIsArchived = bIsArchived
|
||||
NewProjectFileM.m_nProjCloudId = nProjCloudId
|
||||
Return NewProjectFileM
|
||||
End Function
|
||||
|
||||
|
||||
@@ -74,6 +74,46 @@ Public Class ProjectFileM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_sLockedBy As String
|
||||
Public Property sLockedBy As String
|
||||
Get
|
||||
Return m_sLockedBy
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sLockedBy = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dtLock As DateTime
|
||||
Public Property dtLock As DateTime
|
||||
Get
|
||||
Return m_dtLock
|
||||
End Get
|
||||
Set(value As DateTime)
|
||||
m_dtLock = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_bIsActive As Boolean
|
||||
Public Property bIsActive As Boolean
|
||||
Get
|
||||
Return m_bIsActive
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bIsActive = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_bIsArchived As Boolean
|
||||
Public Property bIsArchived As Boolean
|
||||
Get
|
||||
Return m_bIsArchived
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bIsArchived = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
#End Region ' CONSTRUCTORS
|
||||
|
||||
@@ -47,10 +47,13 @@ Public Class ProdFileVM
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sName As String
|
||||
Public Property sName As String
|
||||
Get
|
||||
Return ProdFileM.sName
|
||||
End Get
|
||||
Set(value As String)
|
||||
ProdFileM.sName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_sBTLFileName As String
|
||||
@@ -63,6 +66,12 @@ Public Class ProdFileVM
|
||||
m_sBTLFileName = value
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property bIsProduced As Boolean
|
||||
Get
|
||||
Return ProdFileM.bIsProduced
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "CONSTRUCTORS"
|
||||
|
||||
Sub New(ProdFileM As ProdFileM)
|
||||
|
||||
@@ -68,6 +68,12 @@ Public Class ProjFileVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sDescription As String
|
||||
Get
|
||||
Return ProjFileM.sDescription
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sListName As String
|
||||
Get
|
||||
Return ProjFileM.sListName
|
||||
|
||||
@@ -117,6 +117,18 @@ Public Class ProjectFileVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property bIsActive As Boolean
|
||||
Get
|
||||
Return m_ProjectFileM.bIsActive
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property bIsArchived As Boolean
|
||||
Get
|
||||
Return m_ProjectFileM.bIsArchived
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property Id_Msg As String
|
||||
|
||||
@@ -147,9 +147,9 @@ Public Module BTLIniFile
|
||||
Dim dMin As Double
|
||||
Dim dMax As Double
|
||||
Dim dDefault As Double
|
||||
StringToDouble(sBTLParamParams(2), dMin)
|
||||
StringToDouble(sBTLParamParams(3), dMax)
|
||||
StringToDouble(sBTLParamParams(4), dDefault)
|
||||
StringToDoubleAdv(sBTLParamParams(2), dMin)
|
||||
StringToDoubleAdv(sBTLParamParams(3), dMax)
|
||||
StringToDoubleAdv(sBTLParamParams(4), dDefault)
|
||||
Dim ParamType As BTLParamType
|
||||
If sBTLParamParams(0) = "d" Then
|
||||
ParamType = BTLParamType.DOUBLE_
|
||||
@@ -159,7 +159,7 @@ Public Module BTLIniFile
|
||||
IpBTLParam = BTLParamM.CreateBTLParam(IpParentFeature, IsP, ParamType, sBTLParamParams(1), dMin, dMax, dDefault, sBTLParamParams(5))
|
||||
Return Not IsNothing(IpBTLParam)
|
||||
ElseIf sBTLParamParams(0) = "s" Then
|
||||
IpBTLParam = BTLParamM.CreateBTLParam(IpParentFeature, IsP, BTLParamType.STRING_, sBTLParamParams(1), sBTLParamParams(5))
|
||||
IpBTLParam = BTLParamM.CreateBTLParam(IpParentFeature, IsP, BTLParamType.STRING_, sBTLParamParams(1), sBTLParamParams(4), sBTLParamParams(5))
|
||||
Return Not IsNothing(IpBTLParam)
|
||||
ElseIf sBTLParamParams(0) = "c" Then
|
||||
Dim nMin As Integer
|
||||
@@ -200,9 +200,9 @@ Public Module BTLIniFile
|
||||
Dim dMin As Double
|
||||
Dim dMax As Double
|
||||
Dim dDefault As Double
|
||||
StringToDouble(sBTLParamParams(2), dMin)
|
||||
StringToDouble(sBTLParamParams(3), dMax)
|
||||
StringToDouble(sBTLParamParams(4), dDefault)
|
||||
StringToDoubleAdv(sBTLParamParams(2), dMin)
|
||||
StringToDoubleAdv(sBTLParamParams(3), dMax)
|
||||
StringToDoubleAdv(sBTLParamParams(4), dDefault)
|
||||
Dim ParamType As BTLParamType
|
||||
If sBTLParamParams(0) = "d" Then
|
||||
ParamType = BTLParamType.DOUBLE_
|
||||
@@ -212,7 +212,7 @@ Public Module BTLIniFile
|
||||
IpBTLParam = BTLParamM.CreateBTLParam(IpParentFeature, IsP, ParamType, sBTLParamParams(1), dMin, dMax, dDefault, sBTLParamParams(5), sBWQParam)
|
||||
Return Not IsNothing(IpBTLParam)
|
||||
ElseIf sBTLParamParams(0) = "s" Then
|
||||
IpBTLParam = BTLParamM.CreateBTLParam(IpParentFeature, IsP, BTLParamType.STRING_, sBTLParamParams(1), sBTLParamParams(5), sBWQParam)
|
||||
IpBTLParam = BTLParamM.CreateBTLParam(IpParentFeature, IsP, BTLParamType.STRING_, sBTLParamParams(1), sBTLParamParams(4), sBTLParamParams(5), sBWQParam)
|
||||
Return Not IsNothing(IpBTLParam)
|
||||
ElseIf sBTLParamParams(0) = "c" Then
|
||||
Dim nMin As Integer
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtBEAMWALL.Core
|
||||
Imports EgtBEAMWALL.ViewerOptimizer
|
||||
|
||||
Public Module DbControllers
|
||||
|
||||
Public m_MaterialsController As DataLayer.Controllers.MaterialsController
|
||||
Public m_RawItemsController As DataLayer.Controllers.RawItemsController
|
||||
|
||||
Sub Init()
|
||||
End Sub
|
||||
|
||||
Sub New()
|
||||
End Sub
|
||||
|
||||
Sub LoadControllers(MaterialsController As DataLayer.Controllers.MaterialsController, RawItemsController As DataLayer.Controllers.RawItemsController)
|
||||
m_MaterialsController = MaterialsController
|
||||
m_RawItemsController = RawItemsController
|
||||
End Sub
|
||||
|
||||
End Module
|
||||
@@ -27,7 +27,7 @@ Public Module DimensionsIniFile
|
||||
Dim GridLenType As GridUnitType
|
||||
Integer.TryParse(sValueParams(0), nDimIndex)
|
||||
Integer.TryParse(sValueParams(1), nDimType)
|
||||
StringToDouble(sValueParams(2), GridLenValue)
|
||||
StringToDoubleAdv(sValueParams(2), GridLenValue)
|
||||
Integer.TryParse(sValueParams(3), GridLenType)
|
||||
GridDimsList.Add(New GridDimension(GridName, nDimIndex, nDimType, New GridLength(GridLenValue, GridLenType)))
|
||||
End If
|
||||
|
||||
@@ -58,9 +58,11 @@ Public Enum StatusMapOpType
|
||||
SupervisorReleaseStop = 11
|
||||
ResetPartStart = 12
|
||||
ResetPartEnd = 13
|
||||
ChangeProdInSupervisorRequest = 14
|
||||
ChangeProdInProdRequest = 15
|
||||
OpenPageInViewOptimRequest = 16
|
||||
SetPartScrapped = 14
|
||||
ChangeProdInSupervisorRequest = 15
|
||||
ChangeProdInProdRequest = 16
|
||||
OpenPageInViewOptimRequest = 17
|
||||
MachGroupValidationUpdate = 18
|
||||
End Enum
|
||||
|
||||
Public Enum DimensionType
|
||||
|
||||
@@ -14,7 +14,7 @@ Public Module LuaMsgManager
|
||||
If Not String.IsNullOrWhiteSpace(sMsg) Then
|
||||
Return sMsg
|
||||
Else
|
||||
EgtMsg(65000 + nMsg)
|
||||
Return EgtMsg(65000 + nMsg)
|
||||
End If
|
||||
Else
|
||||
Return EgtMsg(65000 + nMsg)
|
||||
@@ -25,6 +25,7 @@ Public Module LuaMsgManager
|
||||
Else
|
||||
Return LuaMsg
|
||||
End If
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
End Module
|
||||
|
||||
+100
-100
@@ -2,41 +2,98 @@
|
||||
|
||||
#Region "Private Fields"
|
||||
|
||||
Private m_AlarmCode As String
|
||||
Public Enum MachLogTypes
|
||||
NULL = 0
|
||||
PART_STATUS = 1
|
||||
MACHGROUP_STATUS = 2
|
||||
MACHINE_MODE = 3
|
||||
MACHINE_STATUS = 4
|
||||
MACHINE_COMMAND = 5
|
||||
READ_VAR = 6
|
||||
WRITE_VAR = 7
|
||||
ALARM = 8
|
||||
OPERATOR_MSG = 9
|
||||
PROGRAM_SEND = 10
|
||||
APPLICATION = 11
|
||||
End Enum
|
||||
|
||||
Private m_AlarmDateTime As DateTime
|
||||
Private m_AlarmMessage As String
|
||||
Private m_AlarmOperation As Integer
|
||||
Private m_AlarmType As Integer
|
||||
Private m_CommandExecutedCorrectly As Boolean
|
||||
Private m_CommandState As CommandStates
|
||||
Private m_CommandType As LogCommandTypes
|
||||
Private m_Description As String
|
||||
|
||||
Private m_newOpState As Integer
|
||||
|
||||
Private m_ResultType As ResultTypes
|
||||
|
||||
Private m_VarAddress As String
|
||||
|
||||
Private m_nProdId As Integer
|
||||
Private m_ResultType As MachLogTypes
|
||||
Private m_SupervisorId As String
|
||||
Private m_VarValue As String
|
||||
|
||||
' variabili del log macchina
|
||||
Public ReadOnly Property EventType As MachLogTypes
|
||||
Get
|
||||
Return m_ResultType
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property EventDateTime As DateTime
|
||||
Get
|
||||
Return m_AlarmDateTime
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property EventValue As String
|
||||
Get
|
||||
Return m_VarValue
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sEventType As String
|
||||
Get
|
||||
Select Case m_ResultType
|
||||
Case MachLogTypes.PART_STATUS
|
||||
Return String.Format("({0}) Stato pezzo", 1)
|
||||
Case MachLogTypes.MACHGROUP_STATUS
|
||||
Return String.Format("({0}) Stato barra", 2)
|
||||
Case MachLogTypes.MACHINE_MODE = 3
|
||||
Return String.Format("({0}) Modalità macchina", 3)
|
||||
Case MachLogTypes.MACHINE_STATUS = 4
|
||||
Return String.Format("({0}) Stato macchina", 4)
|
||||
Case MachLogTypes.MACHINE_COMMAND = 5
|
||||
Return String.Format("({0}) Comando macchina", 5)
|
||||
Case MachLogTypes.READ_VAR = 6
|
||||
Return String.Format("({0}) Lettura variabile", 6)
|
||||
Case MachLogTypes.WRITE_VAR = 7
|
||||
Return String.Format("({0}) Scrittura variabile", 7)
|
||||
Case MachLogTypes.ALARM = 8
|
||||
Return String.Format("({0}) Allarme", 8)
|
||||
Case MachLogTypes.OPERATOR_MSG = 9
|
||||
Return String.Format("({0}) Messaggio opertore", 9)
|
||||
Case MachLogTypes.PROGRAM_SEND = 10
|
||||
Return String.Format("({0}) Invio programma", 10)
|
||||
Case Else
|
||||
Return "Altro"
|
||||
End Select
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property sEventDateTime As String
|
||||
Get
|
||||
Return m_AlarmDateTime
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property sEventValue As String
|
||||
Get
|
||||
Return m_VarValue
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sPROD As String
|
||||
Get
|
||||
Return m_VarValue
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Protected Constructors"
|
||||
|
||||
Protected Sub New()
|
||||
m_AlarmCode = ""
|
||||
m_AlarmDateTime = DateTime.MinValue
|
||||
m_AlarmMessage = ""
|
||||
m_AlarmOperation = 0
|
||||
m_AlarmType = 0
|
||||
m_CommandExecutedCorrectly = False
|
||||
m_CommandState = CommandStates.NULL
|
||||
m_CommandType = LogCommandTypes.NULL
|
||||
m_Description = ""
|
||||
m_newOpState = 0
|
||||
m_nProdId = 0
|
||||
m_ResultType = ResultTypes.NULL
|
||||
m_VarAddress = ""
|
||||
m_SupervisorId = ""
|
||||
m_VarValue = ""
|
||||
End Sub
|
||||
|
||||
@@ -44,63 +101,15 @@
|
||||
|
||||
#Region "Public Properties"
|
||||
|
||||
Public ReadOnly Property AlarmCode As String
|
||||
Get
|
||||
Return m_AlarmCode
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property AlarmDateTime As Date
|
||||
Get
|
||||
Return m_AlarmDateTime
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property AlarmMessage As String
|
||||
Public ReadOnly Property ProdId As Integer
|
||||
Get
|
||||
Return m_AlarmMessage
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property AlarmOperation As Integer
|
||||
Get
|
||||
Return m_AlarmOperation
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property AlarmType As Integer
|
||||
Get
|
||||
Return m_AlarmType
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CommandExecutedCorrectly As Boolean
|
||||
Get
|
||||
Return m_CommandExecutedCorrectly
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CommandState As CommandStates
|
||||
Get
|
||||
Return m_CommandState
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CommandType As LogCommandTypes
|
||||
Get
|
||||
Return m_CommandType
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Description As String
|
||||
Get
|
||||
Return m_Description
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property newOpState As Integer
|
||||
Get
|
||||
Return m_newOpState
|
||||
Return m_nProdId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -112,7 +121,7 @@
|
||||
|
||||
Public ReadOnly Property VarAddress As String
|
||||
Get
|
||||
Return m_VarAddress
|
||||
Return m_SupervisorId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
@@ -128,28 +137,20 @@
|
||||
|
||||
Public Shared Function CreateAlarmLog(AlarmOperation As Integer, AlarmType As Integer, AlarmMessage As String, AlarmCode As String, AlarmDateTime As String)
|
||||
Dim NewMachLog As New MachLog
|
||||
NewMachLog.m_CommandType = LogCommandTypes.ALARM
|
||||
NewMachLog.m_AlarmOperation = AlarmOperation
|
||||
NewMachLog.m_AlarmType = AlarmType
|
||||
NewMachLog.m_AlarmMessage = AlarmMessage
|
||||
NewMachLog.m_AlarmCode = AlarmCode
|
||||
DateTime.TryParse(AlarmDateTime, NewMachLog.m_AlarmDateTime)
|
||||
Return NewMachLog
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateOPStateLog(newOpState As Integer)
|
||||
Dim NewMachLog As New MachLog
|
||||
NewMachLog.m_CommandType = LogCommandTypes.NEWOP
|
||||
NewMachLog.m_newOpState = newOpState
|
||||
NewMachLog.m_nProdId = newOpState
|
||||
NewMachLog.m_AlarmDateTime = DateTime.Now()
|
||||
Return NewMachLog
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateReadLog(CommandExecutedCorrectly As Boolean, VarAddress As String, VarValue As String)
|
||||
Dim NewMachLog As New MachLog
|
||||
NewMachLog.m_CommandType = CommandTypes.READ_TPA
|
||||
NewMachLog.m_CommandExecutedCorrectly = CommandExecutedCorrectly
|
||||
NewMachLog.m_VarAddress = VarAddress
|
||||
NewMachLog.m_SupervisorId = VarAddress
|
||||
NewMachLog.m_VarValue = VarValue
|
||||
NewMachLog.m_AlarmDateTime = DateTime.Now()
|
||||
Return NewMachLog
|
||||
@@ -157,33 +158,32 @@
|
||||
|
||||
Public Shared Function CreateResultLog(CommandType As LogCommandTypes, CommandState As CommandStates, ResultType As ResultTypes, Description As String)
|
||||
Dim NewMachLog As New MachLog
|
||||
NewMachLog.m_CommandType = CommandType
|
||||
NewMachLog.m_CommandState = CommandState
|
||||
NewMachLog.m_ResultType = ResultType
|
||||
NewMachLog.m_Description = Description
|
||||
NewMachLog.m_AlarmDateTime = DateTime.Now()
|
||||
Return NewMachLog
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateMachLog(EventType As MachLogTypes, EventDateTime As DateTime, Value As String, nProdId As Integer, SupervisorID As String)
|
||||
Dim NewMachEvent As New MachLog
|
||||
NewMachEvent.m_ResultType = EventType
|
||||
NewMachEvent.m_AlarmDateTime = EventDateTime
|
||||
NewMachEvent.m_VarValue = Value
|
||||
NewMachEvent.m_nProdId = nProdId
|
||||
NewMachEvent.m_SupervisorId = SupervisorID
|
||||
Return NewMachEvent
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Public Methods"
|
||||
|
||||
Public Shared Function CreateMacLog(AlarmCode As String, AlarmDateTime As Date, AlarmMessage As String, AlarmOperation As Integer, AlarmType As Integer, CommandExecutedCorrectly As Boolean, CommandState As CommandStates, CommandType As LogCommandTypes, Description As String, newOpState As Integer, ResultType As ResultTypes, VarAddress As String, VarValue As String) As MachLog
|
||||
Public Shared Function CreateMachLog(AlarmCode As String, AlarmDateTime As Date, AlarmMessage As String, AlarmOperation As Integer, AlarmType As Integer, CommandExecutedCorrectly As Boolean, CommandState As CommandStates, CommandType As LogCommandTypes, Description As String, newOpState As Integer, ResultType As ResultTypes, VarAddress As String, VarValue As String) As MachLog
|
||||
|
||||
Dim NewMachLog As New MachLog
|
||||
NewMachLog.m_AlarmCode = AlarmCode
|
||||
NewMachLog.m_AlarmDateTime = AlarmDateTime
|
||||
NewMachLog.m_AlarmMessage = AlarmMessage
|
||||
NewMachLog.m_AlarmOperation = AlarmOperation
|
||||
NewMachLog.m_AlarmType = AlarmType
|
||||
NewMachLog.m_CommandExecutedCorrectly = CommandExecutedCorrectly
|
||||
NewMachLog.m_CommandState = CommandState
|
||||
NewMachLog.m_CommandType = CommandType
|
||||
NewMachLog.m_Description = Description
|
||||
NewMachLog.m_newOpState = newOpState
|
||||
NewMachLog.m_nProdId = newOpState
|
||||
NewMachLog.m_ResultType = ResultType
|
||||
NewMachLog.m_VarAddress = VarAddress
|
||||
NewMachLog.m_SupervisorId = VarAddress
|
||||
NewMachLog.m_VarValue = VarValue
|
||||
|
||||
Return NewMachLog
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
Imports System.Windows
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class MaterialM
|
||||
|
||||
Protected m_nId As Integer = 0
|
||||
Public ReadOnly Property nId As Integer
|
||||
Get
|
||||
Return m_nId
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetId(nId As Integer)
|
||||
m_nId = nId
|
||||
End Sub
|
||||
|
||||
Protected m_sMaterial As String
|
||||
Public ReadOnly Property sMaterial As String
|
||||
Get
|
||||
Return m_sMaterial
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetMaterial(sMaterial As String)
|
||||
m_sMaterial = sMaterial
|
||||
End Sub
|
||||
|
||||
Protected m_sWarehouseMaterial As String
|
||||
Public ReadOnly Property sWarehouseMaterial As String
|
||||
Get
|
||||
Return m_sWarehouseMaterial
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetWarehouseMaterial(sWarehouseMaterial As String)
|
||||
m_sWarehouseMaterial = sWarehouseMaterial
|
||||
End Sub
|
||||
|
||||
Protected m_dW As Double = 0
|
||||
Public ReadOnly Property dW As Double
|
||||
Get
|
||||
Return m_dW
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_dH As Double = 0
|
||||
Public ReadOnly Property dH As Double
|
||||
Get
|
||||
Return m_dH
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_dL As Double = 0
|
||||
Public ReadOnly Property dL As Double
|
||||
Get
|
||||
Return m_dL
|
||||
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Shared Operator =(ByVal S1 As MaterialM, ByVal S2 As MaterialM) As Boolean
|
||||
If IsNothing(S1) OrElse IsNothing(S2) Then Return False
|
||||
Return (Math.Abs(S1.m_dH - S2.m_dH) < 100 * EPS_SMALL AndAlso
|
||||
Math.Abs(S1.m_dW - S2.m_dW) < 100 * EPS_SMALL AndAlso
|
||||
Math.Abs(S1.m_dL - S2.m_dL) < 100 * EPS_SMALL AndAlso
|
||||
S1.m_sWarehouseMaterial = S2.m_sWarehouseMaterial)
|
||||
End Operator
|
||||
|
||||
Shared Operator <>(ByVal S1 As MaterialM, ByVal S2 As MaterialM) As Boolean
|
||||
Return Not S1 = S2
|
||||
End Operator
|
||||
|
||||
Public Overrides Function Equals(ByVal obj As Object) As Boolean
|
||||
If TypeOf obj Is MaterialM Then
|
||||
Return Me = DirectCast(obj, MaterialM) '(m_dH = obj.dH AndAlso m_dW = obj.dW AndAlso m_dL = obj.dL AndAlso m_Material.Any(Function(x) DirectCast(obj.sMaterial, List(Of String)).Any(Function(y) y = x)))
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String)
|
||||
m_dW = dW
|
||||
m_dH = dH
|
||||
m_dL = dL
|
||||
m_sMaterial = sMaterial
|
||||
End Sub
|
||||
|
||||
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, sWarehouseMaterial As String)
|
||||
m_dW = dW
|
||||
m_dH = dH
|
||||
m_dL = dL
|
||||
m_sMaterial = sMaterial
|
||||
m_sWarehouseMaterial = sWarehouseMaterial
|
||||
End Sub
|
||||
|
||||
' costruttore per DataLayer
|
||||
Sub New(nId As Integer, dW As Double, dH As Double, dL As Double, sMaterial As String, sWarehouseMaterial As String)
|
||||
m_nId = nId
|
||||
m_dW = dW
|
||||
m_dH = dH
|
||||
m_dL = dL
|
||||
m_sMaterial = sMaterial
|
||||
m_sWarehouseMaterial = sWarehouseMaterial
|
||||
End Sub
|
||||
|
||||
Public Sub Update(dW As Double, dH As Double, dL As Double, sMaterial As String)
|
||||
m_dW = dW
|
||||
m_dH = dH
|
||||
m_dL = dL
|
||||
m_sMaterial = sMaterial
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Public Class RawPartM
|
||||
Inherits VMBase
|
||||
|
||||
Protected m_nId As Integer
|
||||
Public ReadOnly Property nId As Integer
|
||||
Get
|
||||
Return m_nId
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetId(nId As Integer)
|
||||
m_nId = nId
|
||||
End Sub
|
||||
|
||||
Private m_bActive As Boolean
|
||||
Public Property bActive As Boolean
|
||||
Get
|
||||
Return m_bActive
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bActive = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Material As MaterialM
|
||||
Public Property Material As MaterialM
|
||||
Get
|
||||
Return m_Material
|
||||
End Get
|
||||
Set(value As MaterialM)
|
||||
m_Material = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dW As Double
|
||||
Public Property dW As Double
|
||||
Get
|
||||
Return m_dW
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dW = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dL As Double
|
||||
Public Property dL As Double
|
||||
Get
|
||||
Return m_dL
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_nQuantity As Integer
|
||||
Public Property nQuantity As Integer
|
||||
Get
|
||||
Return m_nQuantity
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nQuantity = value
|
||||
End Set
|
||||
End Property
|
||||
Private m_bUseQuantity As Boolean
|
||||
Public Property bUseQuantity As Boolean
|
||||
Get
|
||||
Return m_bUseQuantity
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_bUseQuantity = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(Material As MaterialM, W As Double, L As Double, Qty As Integer, Active As Boolean)
|
||||
m_Material = Material
|
||||
m_dW = W
|
||||
m_dL = L
|
||||
m_nQuantity = Qty
|
||||
m_bActive = Active
|
||||
End Sub
|
||||
|
||||
Sub New(nId As Integer, Material As MaterialM, W As Double, L As Double, Qty As Integer, bUseQty As Boolean, Active As Boolean)
|
||||
m_nId = nId
|
||||
m_Material = Material
|
||||
m_dW = W
|
||||
m_dL = L
|
||||
m_nQuantity = Qty
|
||||
m_bUseQuantity = bUseQty
|
||||
m_bActive = Active
|
||||
End Sub
|
||||
|
||||
Sub New(Material As MaterialM, W As Double, L As Double)
|
||||
m_Material = Material
|
||||
m_dW = W
|
||||
m_dL = L
|
||||
m_nQuantity = 0
|
||||
m_bUseQuantity = False
|
||||
m_bActive = False
|
||||
End Sub
|
||||
|
||||
Public Sub Update(RawPart As RawPartM)
|
||||
m_Material = RawPart.m_Material
|
||||
m_dW = RawPart.dW
|
||||
m_dL = RawPart.dL
|
||||
m_nQuantity = RawPart.m_nQuantity
|
||||
m_bUseQuantity = RawPart.m_bUseQuantity
|
||||
m_bActive = RawPart.m_bActive
|
||||
End Sub
|
||||
|
||||
Public Sub Update(W As Double, L As Double)
|
||||
m_dW = W
|
||||
m_dL = L
|
||||
End Sub
|
||||
|
||||
Public Function Copy() As RawPartM
|
||||
Return New RawPartM(m_nId, m_Material, m_dW, m_dL, m_nQuantity, bUseQuantity, bActive)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
@@ -15,77 +15,91 @@ Public Class SectionXMaterial
|
||||
m_nType = nType
|
||||
End Sub
|
||||
|
||||
Protected m_Material As List(Of String)
|
||||
Public ReadOnly Property sMaterial As List(Of String)
|
||||
Public ReadOnly Property sMaterial As String
|
||||
Get
|
||||
Return m_Material
|
||||
Return m_MaterialM.sMaterial
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_MaterialForSameSection_List As New List(Of String)
|
||||
Public Property MaterialForSameSection_List As List(Of String)
|
||||
Public ReadOnly Property sWarehouseMaterial As String
|
||||
Get
|
||||
Return m_MaterialForSameSection_List
|
||||
Return m_MaterialM.sWarehouseMaterial
|
||||
End Get
|
||||
Set(value As List(Of String))
|
||||
m_MaterialForSameSection_List = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_SelMaterialForSameSection As String
|
||||
Public Property SelMaterialForSameSection As String
|
||||
'Protected m_MaterialForSameSection_List As New List(Of String)
|
||||
'Public Property MaterialForSameSection_List As List(Of String)
|
||||
' Get
|
||||
' Return m_MaterialForSameSection_List
|
||||
' End Get
|
||||
' Set(value As List(Of String))
|
||||
' m_MaterialForSameSection_List = value
|
||||
' End Set
|
||||
'End Property
|
||||
|
||||
'Protected m_SelMaterialForSameSection As String
|
||||
'Public Property SelMaterialForSameSection As String
|
||||
' Get
|
||||
' Return m_SelMaterialForSameSection
|
||||
' End Get
|
||||
' Set(value As String)
|
||||
' m_SelMaterialForSameSection = value
|
||||
' End Set
|
||||
'End Property
|
||||
|
||||
Protected m_MaterialM As MaterialM
|
||||
Public ReadOnly Property MaterialM As MaterialM
|
||||
Get
|
||||
Return m_SelMaterialForSameSection
|
||||
Return m_MaterialM
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_SelMaterialForSameSection = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_dW As Double = 0
|
||||
Public ReadOnly Property dW As Double
|
||||
Get
|
||||
Return m_dW
|
||||
Return m_MaterialM.dW
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_dH As Double = 0
|
||||
Public ReadOnly Property dH As Double
|
||||
Get
|
||||
Return m_dH
|
||||
Return m_MaterialM.dH
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_dL As Double = 0
|
||||
Public ReadOnly Property dL As Double
|
||||
Get
|
||||
Return m_dL
|
||||
Return m_MaterialM.dL
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sSectionXMaterial As String
|
||||
Get
|
||||
Dim sAlias As String = String.Empty
|
||||
For Each sMatItem In sMaterial
|
||||
sAlias &= sMatItem & ";"
|
||||
Next
|
||||
sAlias = sAlias.TrimEnd(";")
|
||||
If Me = Empty Then
|
||||
Return ""
|
||||
ElseIf m_nType = MachineType.BEAM Then
|
||||
Return LenToString(m_dW, 3) & " x " & LenToString(m_dH, 3) & " " & sAlias
|
||||
Return LenToString(m_MaterialM.dW, 3) & " x " & LenToString(m_MaterialM.dH, 3) & " " & If(GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) = 1, sWarehouseMaterial, sMaterial)
|
||||
ElseIf m_nType = MachineType.WALL Then
|
||||
Return LenToString(m_dH, 3) & " " & sAlias
|
||||
Return LenToString(m_MaterialM.dH, 3) & " " & If(GetMainPrivateProfileInt(S_WAREHOUSE, K_SHOWWAREHOUSEMATERIAL, 0) = 1, sWarehouseMaterial, sMaterial)
|
||||
Else Return ""
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property sWarehouseSectionXMaterial As String
|
||||
Get
|
||||
If Me = Empty Then
|
||||
Return ""
|
||||
ElseIf m_nType = MachineType.BEAM Then
|
||||
Return LenToString(m_MaterialM.dW, 3) & " x " & LenToString(m_MaterialM.dH, 3) & " " & sWarehouseMaterial
|
||||
ElseIf m_nType = MachineType.WALL Then
|
||||
Return LenToString(m_MaterialM.dH, 3) & " " & sWarehouseMaterial
|
||||
Else Return ""
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Shared Operator =(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean
|
||||
Return (Math.Abs( S1.m_dH - S2.m_dH) < 100 * EPS_SMALL AndAlso
|
||||
Math.Abs( S1.m_dW - S2.m_dW) < 100 * EPS_SMALL AndAlso
|
||||
Math.Abs( S1.m_dL - S2.m_dL) < 100 * EPS_SMALL AndAlso
|
||||
S1.m_Material.Any(Function(x) S2.m_Material.Any(Function(y) y = x)))
|
||||
Return S1.m_MaterialM = S2.m_MaterialM
|
||||
End Operator
|
||||
|
||||
Shared Operator <>(ByVal S1 As SectionXMaterial, ByVal S2 As SectionXMaterial) As Boolean
|
||||
@@ -99,122 +113,110 @@ Public Class SectionXMaterial
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String)
|
||||
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, sWarehouseMaterial As String)
|
||||
If m_nType = BWType.BEAM Then
|
||||
m_dW = dW
|
||||
m_dH = dH
|
||||
m_MaterialM = New MaterialM(dW, dH, 0, sMaterial, sWarehouseMaterial)
|
||||
ElseIf m_nType = BWType.WALL Then
|
||||
m_dH = dH
|
||||
m_MaterialM = New MaterialM(0, dH, 0, sMaterial, sWarehouseMaterial)
|
||||
Else
|
||||
m_dW = dW
|
||||
m_dH = dH
|
||||
m_dL = dL
|
||||
m_MaterialM = New MaterialM(dW, dH, dL, sMaterial, sWarehouseMaterial)
|
||||
End If
|
||||
m_Material = New List(Of String)
|
||||
Dim sMaterialArray() As String = Split(sMaterial, ";")
|
||||
For Each sMatItem In sMaterialArray
|
||||
m_Material.Add(sMatItem)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Shared Empty As New SectionXMaterial(-1, -1, -1, "")
|
||||
|
||||
#Region "Import BTL <-> Warehouse"
|
||||
|
||||
Private m_dNewW As Double
|
||||
Public Property dNewW As Double
|
||||
Get
|
||||
Return m_dNewW
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dNewW = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_dNewL As Double
|
||||
Public Property dNewL As Double
|
||||
Get
|
||||
Return m_dNewL
|
||||
End Get
|
||||
Set(value As Double)
|
||||
m_dNewL = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_nQuantity As Integer
|
||||
Public Property nQuantity As Integer
|
||||
Get
|
||||
Return m_nQuantity
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
m_nQuantity = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Alias_IsEnabled As Boolean
|
||||
Public Property Alias_IsEnabled As Boolean
|
||||
Get
|
||||
Return m_Alias_IsEnabled
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_Alias_IsEnabled = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Alias_IsChecked As Boolean
|
||||
Public Overridable Property Alias_IsChecked As Boolean
|
||||
Get
|
||||
Return m_Alias_IsChecked
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_Alias_IsChecked = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property L_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61604)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property W_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61605)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property H_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61606)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Quantity_Msg As String
|
||||
Get
|
||||
Return EgtMsg(61774)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, nQuantity As Integer)
|
||||
If m_nType = BWType.BEAM Then
|
||||
m_dW = dW
|
||||
m_dH = dH
|
||||
ElseIf m_nType = BWType.WALL Then
|
||||
m_dH = dH
|
||||
Else
|
||||
m_dW = dW
|
||||
m_dH = dH
|
||||
m_dL = dL
|
||||
End If
|
||||
m_Material = New List(Of String)
|
||||
Dim sMaterialArray() As String = Split(sMaterial, ";")
|
||||
For Each sMatItem In sMaterialArray
|
||||
m_Material.Add(sMatItem)
|
||||
Next
|
||||
m_nQuantity = nQuantity
|
||||
Sub New(MaterialM As MaterialM)
|
||||
m_MaterialM = MaterialM
|
||||
End Sub
|
||||
|
||||
#End Region ' Import BTL <-> Warehouse
|
||||
Public Shared Empty As New SectionXMaterial(-1, -1, -1, "", "")
|
||||
|
||||
'#Region "Import BTL <-> Warehouse"
|
||||
|
||||
' Private m_dNewW As Double
|
||||
' Public Property dNewW As Double
|
||||
' Get
|
||||
' Return m_dNewW
|
||||
' End Get
|
||||
' Set(value As Double)
|
||||
' m_dNewW = value
|
||||
' End Set
|
||||
' End Property
|
||||
|
||||
' Private m_dNewL As Double
|
||||
' Public Property dNewL As Double
|
||||
' Get
|
||||
' Return m_dNewL
|
||||
' End Get
|
||||
' Set(value As Double)
|
||||
' m_dNewL = value
|
||||
' End Set
|
||||
' End Property
|
||||
|
||||
' Private m_nQuantity As Integer
|
||||
' Public Property nQuantity As Integer
|
||||
' Get
|
||||
' Return m_nQuantity
|
||||
' End Get
|
||||
' Set(value As Integer)
|
||||
' m_nQuantity = value
|
||||
' End Set
|
||||
' End Property
|
||||
|
||||
' Private m_Alias_IsEnabled As Boolean
|
||||
' Public Property Alias_IsEnabled As Boolean
|
||||
' Get
|
||||
' Return m_Alias_IsEnabled
|
||||
' End Get
|
||||
' Set(value As Boolean)
|
||||
' m_Alias_IsEnabled = value
|
||||
' End Set
|
||||
' End Property
|
||||
|
||||
' Private m_Alias_IsChecked As Boolean
|
||||
' Public Overridable Property Alias_IsChecked As Boolean
|
||||
' Get
|
||||
' Return m_Alias_IsChecked
|
||||
' End Get
|
||||
' Set(value As Boolean)
|
||||
' m_Alias_IsChecked = value
|
||||
' End Set
|
||||
' End Property
|
||||
|
||||
' Public ReadOnly Property L_Msg As String
|
||||
' Get
|
||||
' Return EgtMsg(61604)
|
||||
' End Get
|
||||
' End Property
|
||||
|
||||
' Public ReadOnly Property W_Msg As String
|
||||
' Get
|
||||
' Return EgtMsg(61605)
|
||||
' End Get
|
||||
' End Property
|
||||
|
||||
' Public ReadOnly Property H_Msg As String
|
||||
' Get
|
||||
' Return EgtMsg(61606)
|
||||
' End Get
|
||||
' End Property
|
||||
|
||||
' Public ReadOnly Property Quantity_Msg As String
|
||||
' Get
|
||||
' Return EgtMsg(61774)
|
||||
' End Get
|
||||
' End Property
|
||||
|
||||
' Sub New(dW As Double, dH As Double, dL As Double, sMaterial As String, nQuantity As Integer, sWarehouseMaterial As String)
|
||||
' If m_nType = BWType.BEAM Then
|
||||
' m_MaterialM = New MaterialM(dW, dH, 0, sMaterial, sWarehouseMaterial)
|
||||
' ElseIf m_nType = BWType.WALL Then
|
||||
' m_MaterialM = New MaterialM(0, dH, 0, sMaterial, sWarehouseMaterial)
|
||||
' Else
|
||||
' m_MaterialM = New MaterialM(dW, dH, dL, sMaterial, sWarehouseMaterial)
|
||||
' End If
|
||||
' m_nQuantity = nQuantity
|
||||
' End Sub
|
||||
|
||||
'#End Region ' Import BTL <-> Warehouse
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
@@ -15,80 +15,80 @@ Public Class ViewPanelVM
|
||||
' Posizione vista
|
||||
Private Shared m_nViewDir As VT = VT.ISO_SW
|
||||
|
||||
Public Shared Function BWSetView(nView As VT, Optional bRedraw As Boolean = True)
|
||||
Public Shared Sub BWSetView(nView As VT, Optional bRedraw As Boolean = True)
|
||||
' condizioni che cambiano la vista del progetto
|
||||
Select Case m_Type
|
||||
Case BWType.BEAM
|
||||
Select Case nView
|
||||
Case VT.TOP
|
||||
EgtSetView(VT.TOP, bRedraw)
|
||||
Case VT.FRONT
|
||||
EgtSetView(VT.FRONT, bRedraw)
|
||||
Case VT.BACK
|
||||
EgtSetView(VT.BACK, bRedraw)
|
||||
Case VT.RIGHT
|
||||
EgtSetView(VT.RIGHT, bRedraw)
|
||||
Case VT.LEFT
|
||||
EgtSetView(VT.LEFT, bRedraw)
|
||||
Case VT.ISO_SW
|
||||
EgtSetView(VT.ISO_SW, bRedraw)
|
||||
Case Else ' VT.ISO_SW
|
||||
EgtSetView(VT.ISO_SW, bRedraw)
|
||||
'Select Case m_Type
|
||||
' Case BWType.BEAM
|
||||
' Select Case nView
|
||||
' Case VT.TOP
|
||||
' EgtSetView(VT.TOP, bRedraw)
|
||||
' Case VT.FRONT
|
||||
' EgtSetView(VT.FRONT, bRedraw)
|
||||
' Case VT.BACK
|
||||
' EgtSetView(VT.BACK, bRedraw)
|
||||
' Case VT.RIGHT
|
||||
' EgtSetView(VT.RIGHT, bRedraw)
|
||||
' Case VT.LEFT
|
||||
' EgtSetView(VT.LEFT, bRedraw)
|
||||
' Case VT.ISO_SW
|
||||
' EgtSetView(VT.ISO_SW, bRedraw)
|
||||
' Case Else ' VT.ISO_SW
|
||||
' EgtSetView(VT.ISO_SW, bRedraw)
|
||||
' End Select
|
||||
' Case BWType.WALL
|
||||
Select Case nView
|
||||
Case VT.TOP
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(0, -90, bRedraw) ' equivalente a vista TOP
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(0, 90, bRedraw) ' equivalente a vista TOP ruotata di 180 su Z
|
||||
End Select
|
||||
Case BWType.WALL
|
||||
Select Case nView
|
||||
Case VT.TOP
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(0, -90, bRedraw) ' equivalente a vista TOP
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(0, 90, bRedraw) ' equivalente a vista TOP ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.FRONT
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(90, -90, bRedraw) ' equivalente a vista FRONT
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(90, 90, bRedraw) ' equivalente a vista FRONT ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.BACK
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(-90, -90, bRedraw) ' equivalente a vista BACK
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(-90, 90, bRedraw) ' equivalente a vista BACK ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.RIGHT
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(90, 0, bRedraw) ' equivalente a vista RIGHT
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(-90, 0, bRedraw) ' equivalente a vista RIGHT ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.LEFT
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(-90, 0, bRedraw) ' equivalente a vista LEFT
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(90, 0, bRedraw) ' equivalente a vista LEFT ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.ISO_SW
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(60, 225, bRedraw) ' equivalente a vista ISO_SW
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(60, 45, bRedraw) ' equivalente a vista ISO_SW ruotata di 180 su Z
|
||||
End Select
|
||||
Case Else ' VT.ISO_SW
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(60, 225, bRedraw) ' equivalente a vista ISO_SW
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(60, 45, bRedraw) ' equivalente a vista ISO_SW ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.FRONT
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(90, -90, bRedraw) ' equivalente a vista FRONT
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(90, 90, bRedraw) ' equivalente a vista FRONT ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.BACK
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(-90, -90, bRedraw) ' equivalente a vista BACK
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(-90, 90, bRedraw) ' equivalente a vista BACK ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.RIGHT
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(90, 0, bRedraw) ' equivalente a vista RIGHT
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(-90, 0, bRedraw) ' equivalente a vista RIGHT ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.LEFT
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(-90, 0, bRedraw) ' equivalente a vista LEFT
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(90, 0, bRedraw) ' equivalente a vista LEFT ruotata di 180 su Z
|
||||
End Select
|
||||
Case VT.ISO_SW
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(60, 225, bRedraw) ' equivalente a vista ISO_SW
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(60, 45, bRedraw) ' equivalente a vista ISO_SW ruotata di 180 su Z
|
||||
End Select
|
||||
Case Else ' VT.ISO_SW
|
||||
Select Case m_nViewDir
|
||||
Case VT.ISO_SW, VT.ISO_SE
|
||||
EgtSetGenericView(60, 225, bRedraw) ' equivalente a vista ISO_SW
|
||||
Case VT.ISO_NW, VT.ISO_NE
|
||||
EgtSetGenericView(60, 45, bRedraw) ' equivalente a vista ISO_SW ruotata di 180 su Z
|
||||
End Select
|
||||
End Select
|
||||
End Function
|
||||
'End Select
|
||||
End Sub
|
||||
|
||||
Public Shared Sub UpdateMachParam(ViewDir As VT)
|
||||
m_nViewDir = ViewDir
|
||||
|
||||
@@ -1,26 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgtBEAMWALL.DataLayer.Migrations;
|
||||
using MySql.Data.EntityFramework;
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Migrations;
|
||||
using MySql.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgtBEAMWALL.DataLayer.Migrations;
|
||||
using System.ServiceProcess;
|
||||
using System.IO;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer
|
||||
{
|
||||
[DbConfigurationType(typeof(MySqlEFConfiguration))]
|
||||
//[DbConfigurationType(typeof(aMySqlConfiguration))]
|
||||
public class AdminContext : DbContext
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
[Obsolete("This constructor should never be used directly, and is only needed to generate entityframework stuff. Connection string can be adapted as pleased.")]
|
||||
public AdminContext() : base("DefaultConnection")
|
||||
public AdminContext() : base(DbConfig.ADMIN_CONNECTION_STRING)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -38,5 +33,67 @@ namespace EgtBEAMWALL.DataLayer
|
||||
public DbSet<UserPriv> UserList { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public bool SetUpDbConnectionAndDbConfig()
|
||||
{
|
||||
try
|
||||
{
|
||||
String serviceName = getDbServiceName();
|
||||
if (serviceName.Equals(""))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ServiceController service = new ServiceController(serviceName);
|
||||
try
|
||||
{
|
||||
TimeSpan timeout = TimeSpan.FromSeconds(DbConfig.DATABASE_PROCESS_TIMEOUT);
|
||||
service.WaitForStatus(ServiceControllerStatus.Running, timeout);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//Database.SetInitializer<DatabaseContext>(null);
|
||||
Database.SetInitializer(new MigrateDatabaseToLatestVersion<DatabaseContext, Configuration>());
|
||||
var migrator = new DbMigrator(new Configuration());
|
||||
|
||||
if (migrator.GetPendingMigrations().Any())
|
||||
{
|
||||
// Run migrations and seed.
|
||||
migrator.Update();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine(exc.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private static string getDbServiceName()
|
||||
{
|
||||
ServiceController[] services = ServiceController.GetServices();
|
||||
var service = services.FirstOrDefault(s => s.ServiceName == "MariaDB");
|
||||
if (service != null)
|
||||
return service.DisplayName;
|
||||
|
||||
service = services.FirstOrDefault(s => s.ServiceName == "MySQL");
|
||||
if (service != null)
|
||||
return service.DisplayName;
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,80 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</configSections>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
|
||||
<!--<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.EntityFramework" />-->
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
|
||||
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.4.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<connectionStrings>
|
||||
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=EgtUser;password=viacremasca;Persist Security Info=True;database=EgtBwDb;SslMode=none" providerName="MySql.Data.MySqlClient" />
|
||||
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=steamware;password=steamware_password;Persist Security Info=True;database=EgtBwDb_000470;SslMode=none" providerName="MySql.Data.MySqlClient" />
|
||||
</connectionStrings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.8.9.0" newVersion="1.8.9.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.27.0.0" newVersion="3.27.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="K4os.Compression.LZ4" publicKeyToken="2186fa9121ef231d" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.2.5.0" newVersion="1.2.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.3.8.0" newVersion="1.3.8.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="K4os.Hash.xxHash" publicKeyToken="32cd54395057cec3" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.0.8.0" newVersion="1.0.8.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.10.9.0" newVersion="6.10.9.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.32.0" newVersion="8.0.32.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.3" newVersion="8.0.0.3" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-111.2.0.0" newVersion="111.2.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="ZstdSharp" publicKeyToken="8d151af33a4ad5cf" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-0.8.1.0" newVersion="0.8.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
|
||||
@@ -0,0 +1,270 @@
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgwProxy.MagMan.DTO;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestione Alias su DB (es: materiali da BTL e su DB)
|
||||
/// </summary>
|
||||
public class AliasController : IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public AliasController()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Conversion of DB model class to base class
|
||||
/// </summary>
|
||||
/// <param name="coreMat"></param>
|
||||
/// <returns></returns>
|
||||
public static Core.AliasM ConvToCore(AliasModel dbRec)
|
||||
{
|
||||
Core.AliasM answ = new Core.AliasM(dbRec.ValueOriginal, dbRec.ValueAlias);
|
||||
return answ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione a DTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public static AliasDTO ConvToDto(AliasModel currRec)
|
||||
{
|
||||
AliasDTO answ = new AliasDTO()
|
||||
{
|
||||
ValOrig = currRec.ValueOriginal,
|
||||
ValAlias = currRec.ValueAlias,
|
||||
IsActive = true
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione da DTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <param name="family"></param>
|
||||
/// <returns></returns>
|
||||
public static AliasModel ConvToModel(AliasDTO currRec, string family)
|
||||
{
|
||||
AliasModel answ = new AliasModel()
|
||||
{
|
||||
Family = family,
|
||||
ValueOriginal = currRec.ValOrig,
|
||||
ValueAlias = currRec.ValAlias
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete by key
|
||||
/// </summary>
|
||||
/// <param name="Family"></param>
|
||||
/// <param name="ValueOriginal"></param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteByKey(string Family, string ValueOriginal)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var items2del = localDbCtx
|
||||
.AliasList
|
||||
.Where(x => x.Family == Family && x.ValueOriginal == ValueOriginal);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.AliasList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Alias.DeleteByKey: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ricerca record da chiave (=valore ALIAS)
|
||||
/// </summary>
|
||||
/// <param name="ValueOriginal">Valore ALIAS cercato</param>
|
||||
/// <param name="Family">Famiglia alias cercato (MatCode se non specificato)</param>
|
||||
/// <returns></returns>
|
||||
public AliasModel FindByDbId(string ValueOriginal, string Family = "MatCode")
|
||||
{
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.AliasList
|
||||
.Where(x => x.Family == Family && x.ValueOriginal.ToLower() == ValueOriginal.ToLower())
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Alias x famiglia
|
||||
/// </summary>
|
||||
/// <param name="Family">se "" restituisce tutti</param>
|
||||
/// <returns></returns>
|
||||
public List<AliasModel> GetFilt(string Family)
|
||||
{
|
||||
// retrieve
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.AliasList
|
||||
.Where(x => x.Family == Family)
|
||||
.OrderBy(x => x.ValueOriginal)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update or insert Alias record
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns></returns>
|
||||
public bool Upsert(AliasModel updItem)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.AliasList
|
||||
.Where(x => x.Family == updItem.Family && x.ValueOriginal.Equals(updItem.ValueOriginal, StringComparison.InvariantCulture))
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx.AliasList.Add(updItem);
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Alias.Upsert: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update or insert Alias record list
|
||||
/// </summary>
|
||||
/// <param name="updList"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpsertList(List<AliasModel> updList)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var updItem in updList)
|
||||
{
|
||||
|
||||
var item2update = localDbCtx
|
||||
.AliasList
|
||||
.Where(x => x.Family == updItem.Family && x.ValueOriginal.ToLower() == updItem.ValueOriginal.ToLower())
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
if (item2update.ValueAlias.ToLower() != updItem.ValueAlias.ToLower())
|
||||
{
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx.AliasList.Add(updItem);
|
||||
}
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Alias.UpsertList: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione eventuali record Alias nella lista (se presenti)
|
||||
/// </summary>
|
||||
/// <param name="updList"></param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteList(List<AliasModel> updList)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var updItem in updList)
|
||||
{
|
||||
|
||||
var item2del = localDbCtx
|
||||
.AliasList
|
||||
.Where(x => x.Family == updItem.Family && x.ValueOriginal.ToLower() == updItem.ValueOriginal.ToLower())
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2del != null)
|
||||
{
|
||||
localDbCtx.AliasList.Remove(item2del);
|
||||
}
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Alias.DeleteList: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,17 @@
|
||||
using System;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class BTLPartController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public BTLPartController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -32,7 +24,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <param name="corePart"></param>
|
||||
/// <param name="currProjDbId"></param>
|
||||
/// <returns></returns>
|
||||
public static BTLPartModel ConvertFromCore(Core.BTLPartM corePart, int currProjDbId)
|
||||
public BTLPartModel ConvertFromCore(Core.BTLPartM corePart, int currProjDbId)
|
||||
{
|
||||
BTLPartModel answ = new BTLPartModel();
|
||||
if (corePart != null)
|
||||
@@ -105,15 +97,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.BTLPartList.AddRange(partData);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.BTLPartList.AddRange(partData);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Create: {exc}");
|
||||
string errMessage = $"EXCEPTION on BTLPart.Create: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
return partData;
|
||||
}
|
||||
@@ -147,15 +143,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.BTLPartList.AddRange(partData);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.BTLPartList.AddRange(partData);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on CreateBaseObj: {exc}");
|
||||
string errMessage = $"EXCEPTION on BTLPart.CreateBaseObj: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
|
||||
return partData;
|
||||
@@ -169,22 +169,26 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Delete(int PartDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var item2del = dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var item2del = localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.BTLPartDbId == PartDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.BTLPartList.Remove(item2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Delete: {exc}");
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.BTLPartList.Remove(item2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on BTLPart.Delete: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
@@ -197,29 +201,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool DeleteByProject(int ProjDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var items2del = dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var items2del = localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.ProjDbId == ProjDbId);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.BTLPartList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on DeleteByProject: {exc}");
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.BTLPartList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on BTLPart.DeleteByProject: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -229,10 +235,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public BTLPartModel FindByDbId(int PartDbId)
|
||||
{
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.BTLPartDbId == PartDbId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -242,10 +251,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public BTLPartModel FindByPartId(int PartId)
|
||||
{
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.PartId == PartId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -256,10 +268,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public BTLPartModel FindByPartIdProjDbId(int PartId, int ProjDbId)
|
||||
{
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.PartId == PartId && x.ProjDbId == ProjDbId)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -269,12 +284,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<BTLPartModel> GetByProjectAsc(int ProjDbId)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.ProjDbId == ProjDbId)
|
||||
.OrderBy(x => x.BTLPartDbId)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -284,12 +302,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<BTLPartModel> GetByProjectDesc(int ProjDbId)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.ProjDbId == ProjDbId)
|
||||
.OrderByDescending(x => x.BTLPartDbId)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -300,17 +321,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<BTLPartModel> GetPaginatedAsc(int PartDbIdStart, int numRecord)
|
||||
{
|
||||
List<BTLPartModel> answ = new List<BTLPartModel>();
|
||||
int numEnd = PartDbIdStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.BTLPartDbId <= PartDbIdStart)
|
||||
.OrderBy(x => x.BTLPartDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
answ = localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.BTLPartDbId <= PartDbIdStart)
|
||||
.OrderBy(x => x.BTLPartDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -321,26 +347,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<BTLPartModel> GetPaginatedDesc(int PartDbIdStart, int numRecord)
|
||||
{
|
||||
List<BTLPartModel> answ = new List<BTLPartModel>();
|
||||
int numEnd = PartDbIdStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.BTLPartDbId <= PartDbIdStart)
|
||||
.OrderByDescending(x => x.BTLPartDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
answ = localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.BTLPartDbId <= PartDbIdStart)
|
||||
.OrderByDescending(x => x.BTLPartDbId)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -351,32 +373,44 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Update(BTLPartModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
var item2update = dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.BTLPartDbId == updItem.BTLPartDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
//// update, vers 2
|
||||
//dbCtx.BTLPartList.Remove(item2del);
|
||||
//dbCtx.BTLPartList.Add(updItem);
|
||||
//// update, vers 2
|
||||
//localDbCtx.BTLPartList.Remove(item2del);
|
||||
//localDbCtx.BTLPartList.Add(updItem);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
done = true;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on BTLPart.Update: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Update: {exc}");
|
||||
}
|
||||
// reset...
|
||||
ResetController();
|
||||
return done;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,97 +1,266 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using System.Runtime.Remoting.Contexts;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class DbController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
public class DbController : IDisposable
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
private AdminContext adbCtx;
|
||||
/// <summary>
|
||||
/// Singleton gestione
|
||||
/// </summary>
|
||||
public static DbController man = new DbController();
|
||||
|
||||
#endregion Private Fields
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Fields
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Singleton gestione
|
||||
/// </summary>
|
||||
public static DbController man = new DbController();
|
||||
public DbController()
|
||||
{
|
||||
// Initialize database context for ADMIN
|
||||
adbCtx = new AdminContext(DbConfig.ADMIN_CONNECTION_STRING);
|
||||
// DB standard utente
|
||||
dbCtx = new AdminContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Fields
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Constructors
|
||||
#region Public Methods
|
||||
|
||||
public DbController()
|
||||
{
|
||||
// Initialize database context for ADMIN
|
||||
adbCtx = new AdminContext(DbConfig.ADMIN_CONNECTION_STRING);
|
||||
}
|
||||
/// <summary>
|
||||
/// Verifica necessità creazione utente (locale o in rete)
|
||||
/// </summary>
|
||||
/// <param name="username"></param>
|
||||
/// <param name="pwd"></param>
|
||||
/// <param name="isNetwork"></param>
|
||||
/// <returns></returns>
|
||||
public bool checkCreateUser(string username, string pwd, bool isNetwork)
|
||||
{
|
||||
bool answ = false;
|
||||
string domain = isNetwork ? "%" : "localhost";
|
||||
answ = doCheckCreate(username, pwd, domain, false);
|
||||
if (answ)
|
||||
{
|
||||
doGrantPriv(username, domain, "ALL ON *.*");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
/// <summary>
|
||||
/// Migrazione esplicita del DB da parte dell'admin controller
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool checkMigrateDb()
|
||||
{
|
||||
return adbCtx.SetUpDbConnectionAndDbConfig();
|
||||
}
|
||||
|
||||
#region Public Methods
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
adbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica esistenza views + utente relativo eventualmente ricreandole + fornendo accesso
|
||||
/// all'utente ReadOnly Essetre
|
||||
/// </summary>
|
||||
/// <param name="dbName"></param>
|
||||
/// <param name="username"></param>
|
||||
/// <param name="pwd"></param>
|
||||
/// <returns></returns>
|
||||
public bool refreshViews(string dbName, string username = "S3_User", string pwd = "S3_P4ssw0rd")
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
try
|
||||
{
|
||||
// migrazione minima x eseguire refresh viste
|
||||
string minMigration = "202404261445205_UpdateLogMachineTable";
|
||||
//// cerco se ho la migration minima per proseguire...
|
||||
//var numRec = dbCtx
|
||||
// .MigrList
|
||||
// .Where(x => x.MigrationId == minMigration)
|
||||
// .ToList()
|
||||
// .Count;
|
||||
|
||||
//string sqlQuery = $"SELECT 'Migration' AS TableName, COUNT(*) AS Count FROM __MigrationHistory WHERE MigrationId = '{minMigration}' LIMIT 1;";
|
||||
//var table = dbCtx
|
||||
// .DbSetCounts
|
||||
// .SqlQuery(sqlQuery)
|
||||
// .AsNoTracking()
|
||||
//.ToList();
|
||||
|
||||
string sqlQuery = $"SELECT COUNT(*) AS Count FROM __MigrationHistory WHERE MigrationId = '{minMigration}' LIMIT 1;";
|
||||
var total = dbCtx.Database.SqlQuery<int>(sqlQuery).Single();
|
||||
|
||||
//if (table != null && table.Count > 0)
|
||||
if (total > 0)
|
||||
{
|
||||
// in primis refresh delle view
|
||||
string sqlCommand = @"CREATE OR REPLACE VIEW v_expProdRaw AS
|
||||
SELECT DbId, DtEvent, VarValue,
|
||||
SUBSTRING_INDEX(VarValue, ';', 1) AS Prod,
|
||||
SUBSTRING_INDEX(SUBSTRING_INDEX(VarValue, ';', 2), ';', -1) AS MachGroupId,
|
||||
SUBSTRING_INDEX(SUBSTRING_INDEX(VarValue, ';', -2), ';', 1) AS PartId,
|
||||
SUBSTRING_INDEX(VarValue, ';', -1) AS Status
|
||||
FROM logmachine
|
||||
WHERE EvType = 1
|
||||
AND SupervId = 1;
|
||||
|
||||
CREATE OR REPLACE VIEW v_expProd AS
|
||||
SELECT vp.DtEvent, vp.Prod, mgl.Name AS mgName, pl.PDN, vp.`Status`
|
||||
FROM v_expProdRaw AS vp
|
||||
INNER JOIN MachGroupList mgl ON vp.MachGroupId = mgl.Id
|
||||
INNER JOIN partlist pl ON vp.PartId = pl.Id;";
|
||||
dbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
Thread.Sleep(100);
|
||||
|
||||
// ora setup parametri x utente
|
||||
string domain = "%";
|
||||
|
||||
// ora controllo utente con diritti
|
||||
answ = doCheckCreate(username, pwd, domain, true);
|
||||
if (answ)
|
||||
{
|
||||
doGrantPriv(username, domain, "USAGE ON *.*");
|
||||
doGrantPriv(username, domain, $"SELECT ON {dbName}.v_expProd");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on DbController.refreshViews: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ATTENZIONE!!!! Procedura di Reset del DB
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ResetDb()
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
try
|
||||
{
|
||||
adbCtx
|
||||
.Database
|
||||
.SqlQuery<int>("CALL stp_ResetDb()");
|
||||
answ = true;
|
||||
|
||||
adbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on DbController.ResetDb: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private AdminContext adbCtx;
|
||||
private AdminContext dbCtx;
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Procedura interna effettiva di check utente ed eventuale creazione + grant level
|
||||
/// </summary>
|
||||
/// <param name="username"></param>
|
||||
/// <param name="pwd"></param>
|
||||
/// <param name="domain"></param>
|
||||
/// <param name="force">Force = esegue un drop prima...</param>
|
||||
/// <returns></returns>
|
||||
private bool doCheckCreate(string username, string pwd, string domain, bool force)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
// ricerca utente...
|
||||
var numUser = adbCtx
|
||||
.UserList
|
||||
.Where(x => x.User == username && x.Host == domain)
|
||||
.ToList()
|
||||
.Count;
|
||||
if (numUser > 0)
|
||||
{
|
||||
answ = true;
|
||||
}
|
||||
if (!answ)
|
||||
{
|
||||
// creo utente
|
||||
string sqlCommand = $"DROP USER IF EXISTS {username};";
|
||||
if (force)
|
||||
{
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
sqlCommand = "FLUSH PRIVILEGES;";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
Thread.Sleep(100);
|
||||
sqlCommand = $"CREATE USER '{username}'@'{domain}' IDENTIFIED BY '{pwd}';";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
Thread.Sleep(100);
|
||||
sqlCommand = "FLUSH PRIVILEGES;";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
Thread.Sleep(100);
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in doCheckCreate:{Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Procedura interna effettiva di grant level x utente
|
||||
/// </summary>
|
||||
/// <param name="username"></param>
|
||||
/// <param name="domain"></param>
|
||||
/// <param name="grantLevel"></param>
|
||||
/// <returns></returns>
|
||||
private bool doGrantPriv(string username, string domain, string grantLevel)
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
public bool checkCreateUser(string username, string pwd)
|
||||
{
|
||||
bool answ = false;
|
||||
// ricerca utente...
|
||||
var numUser = adbCtx
|
||||
.UserList
|
||||
.Where(x => x.User == username)
|
||||
.ToList()
|
||||
.Count;
|
||||
if (numUser > 0)
|
||||
{
|
||||
answ = true;
|
||||
}
|
||||
if (!answ)
|
||||
{
|
||||
// creo utente
|
||||
string sqlCommand = "FLUSH PRIVILEGES;";
|
||||
//string sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}'; GRANT ALL ON *.* TO '{username}'@'localhost'; FLUSH PRIVILEGES;";
|
||||
//string sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}'; GRANT ALL ON *.* TO '{username}'@'localhost'; FLUSH PRIVILEGES;";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}';";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
sqlCommand = $"GRANT ALL ON *.* TO '{username}'@'localhost';";
|
||||
Thread.Sleep(100);
|
||||
sqlCommand = $"GRANT {grantLevel} TO '{username}'@'{domain}';";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
Thread.Sleep(100);
|
||||
sqlCommand = "FLUSH PRIVILEGES;";
|
||||
adbCtx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
adbCtx.Dispose();
|
||||
}
|
||||
|
||||
public bool ResetDb()
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
try
|
||||
{
|
||||
adbCtx
|
||||
.Database
|
||||
.SqlQuery<int>("CALL stp_ResetDb()");
|
||||
Thread.Sleep(100);
|
||||
answ = true;
|
||||
|
||||
adbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on ResetDb: {exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,56 +1,72 @@
|
||||
using System;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgwProxy.MagMan.DTO;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class LogMachineController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public LogMachineController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione a LogMachineDTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public static LogMachineDTO ConvToItemDto(LogMachineModel currRec)
|
||||
{
|
||||
LogMachineDTO answ = new LogMachineDTO()
|
||||
{
|
||||
DtEvent = currRec.DtEvent,
|
||||
EvType = (EgwProxy.MagMan.MachLogTypes)currRec.EvType,
|
||||
ProjCloudId = currRec.ProjCloudId,
|
||||
SupervId = currRec.SupervId,
|
||||
VarValue = currRec.VarValue
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of base class to DB model class
|
||||
/// </summary>
|
||||
/// <param name="coreMacLog"></param>
|
||||
/// <returns></returns>
|
||||
public static LogMachineModel ConvertFromCore(Core.MachLog coreMacLog)
|
||||
public LogMachineModel ConvertFromCore(Core.MachLog coreMacLog)
|
||||
{
|
||||
int projCloudId = 0;
|
||||
// calcolo projCloudId da ProdId...
|
||||
using (var localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
var projRec = localDbCtx.ProdList.Where(x => x.ProdId == coreMacLog.ProdId).FirstOrDefault();
|
||||
if (projRec != null)
|
||||
{
|
||||
projCloudId = projRec.ProjCloudId;
|
||||
}
|
||||
}
|
||||
// converto!
|
||||
LogMachineModel answ = new LogMachineModel();
|
||||
if (coreMacLog != null)
|
||||
{
|
||||
answ = new LogMachineModel()
|
||||
{
|
||||
AlarmCode = coreMacLog.AlarmCode,
|
||||
AlarmDatetime = coreMacLog.AlarmDateTime,
|
||||
AlarmMessage = coreMacLog.AlarmMessage,
|
||||
AlarmOperation = coreMacLog.AlarmOperation,
|
||||
AlarmType = coreMacLog.AlarmType,
|
||||
CommandExecutedCorrectly = coreMacLog.CommandExecutedCorrectly,
|
||||
CommandState = coreMacLog.CommandState,
|
||||
CommandType = coreMacLog.CommandType,
|
||||
Description = coreMacLog.Description,
|
||||
NewOpState = coreMacLog.newOpState,
|
||||
ResultType = coreMacLog.ResultType,
|
||||
VarAddress = coreMacLog.VarAddress,
|
||||
VarValue = coreMacLog.VarValue
|
||||
EvType = coreMacLog.EventType,
|
||||
DtEvent = coreMacLog.AlarmDateTime,
|
||||
SupervId = coreMacLog.VarAddress,
|
||||
VarValue = coreMacLog.VarValue,
|
||||
ProdId = coreMacLog.ProdId,
|
||||
ProjCloudId = projCloudId
|
||||
};
|
||||
}
|
||||
return answ;
|
||||
@@ -61,9 +77,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// </summary>
|
||||
/// <param name="dbLog"></param>
|
||||
/// <returns></returns>
|
||||
public static Core.MachLog ConvertToCore(LogMachineModel dbLog)
|
||||
public Core.MachLog ConvertToCore(LogMachineModel dbLog)
|
||||
{
|
||||
var newRecord = Core.MachLog.CreateMacLog(dbLog.AlarmCode, dbLog.AlarmDatetime, dbLog.AlarmMessage, dbLog.AlarmOperation, dbLog.AlarmType, dbLog.CommandExecutedCorrectly, dbLog.CommandState, dbLog.CommandType, dbLog.Description, dbLog.NewOpState, dbLog.ResultType, dbLog.VarAddress, dbLog.VarValue);
|
||||
var newRecord = (Core.MachLog)Core.MachLog.CreateMachLog(dbLog.EvType, dbLog.DtEvent, dbLog.VarValue, dbLog.ProdId, dbLog.SupervId);
|
||||
return newRecord;
|
||||
}
|
||||
|
||||
@@ -74,37 +90,36 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public bool Create(LogMachineModel newLogMac)
|
||||
{
|
||||
bool fatto = false;
|
||||
bool done = false;
|
||||
try
|
||||
{
|
||||
try
|
||||
using (var locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
using (var currDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
currDbCtx.LogMachineList.Add(newLogMac);
|
||||
// Commit changes
|
||||
currDbCtx.SaveChanges();
|
||||
ResetController();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Create LogMachine: {exc}");
|
||||
// Add to database
|
||||
locDbCtx.LogMachineList.Add(newLogMac);
|
||||
// Commit changes
|
||||
locDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return fatto;
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on LogMachine.Create: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create machine LOG record (da modello dati CORE)
|
||||
/// </summary>
|
||||
/// <param name="newLogMac"></param>
|
||||
/// <param name="newLogMac">Record Log</param>
|
||||
/// <param name="projDbId">ProjID da DB (locale)</param>
|
||||
/// <returns></returns>
|
||||
public bool Create(Core.MachLog newMachLog)
|
||||
{
|
||||
// converto record
|
||||
var dbLogModel = ConvertFromCore(newMachLog);
|
||||
return Create(dbLogModel);
|
||||
}
|
||||
@@ -117,29 +132,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool DeleteByKey(int LogDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var items2del = dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var items2del = localDbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.LogDbId == LogDbId);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.LogMachineList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.LogMachineList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on LogMachine.DeleteByKey: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -149,10 +166,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public LogMachineModel FindByDbId(int LogDbId)
|
||||
{
|
||||
return dbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.LogDbId == LogDbId)
|
||||
.SingleOrDefault();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.LogDbId == LogDbId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -163,12 +183,41 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<LogMachineModel> GetAsc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
|
||||
.OrderBy(x => x.AlarmDatetime)
|
||||
.ToList();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
|
||||
.OrderBy(x => x.DtEvent)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (ASC ordered) in "core format"
|
||||
/// </summary>
|
||||
/// <param name="dtStart"></param>
|
||||
/// <param name="dtEnd"></param>
|
||||
/// <returns></returns>
|
||||
public List<Core.MachLog> GetCoreAsc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
var rawData = GetAsc(dtStart, dtEnd);
|
||||
var coreData = rawData.Select(x => ConvertToCore(x)).ToList();
|
||||
return coreData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get paginated data from DB (DESC ordered) in "core format"
|
||||
/// </summary>
|
||||
/// <param name="dtStart"></param>
|
||||
/// <param name="dtEnd"></param>
|
||||
/// <returns></returns>
|
||||
public List<Core.MachLog> GetCoreDesc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
var rawData = GetDesc(dtStart, dtEnd);
|
||||
var coreData = rawData.Select(x => ConvertToCore(x)).ToList();
|
||||
return coreData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -179,21 +228,197 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<LogMachineModel> GetDesc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
|
||||
.OrderByDescending(x => x.AlarmDatetime)
|
||||
.ToList();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
|
||||
.OrderByDescending(x => x.DtEvent)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// Recupero i dati NON sincronizzati in ordine crescente fino al num max indicato
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
/// <param name="numMax"></param>
|
||||
/// <returns></returns>
|
||||
public List<LogMachineModel> GetUnsentAsc(int numMax)
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.LogMachineList
|
||||
.Where(x => (x.DtSent == null || x.DtSent < x.DtEvent) && x.ProjCloudId > 0)
|
||||
.OrderBy(x => x.DtEvent)
|
||||
.Take(numMax)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creazione LOG record di avvio programma
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool RecordAppStartup()
|
||||
{
|
||||
bool done = false;
|
||||
try
|
||||
{
|
||||
using (var locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// cerco ultimo record registrato
|
||||
var lastRec = locDbCtx
|
||||
.LogMachineList
|
||||
.OrderByDescending(x => x.DtEvent)
|
||||
.FirstOrDefault();
|
||||
|
||||
// cerco ultimo evento chiusura
|
||||
var lastRecClose = locDbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.EvType == Core.MachLog.MachLogTypes.APPLICATION
|
||||
&& x.VarValue == "0")
|
||||
.OrderByDescending(x => x.DtEvent)
|
||||
.FirstOrDefault();
|
||||
|
||||
// preparo nuovo record avvio!
|
||||
LogMachineModel recStartApp = new LogMachineModel()
|
||||
{
|
||||
DtEvent = DateTime.Now.AddSeconds(-1),
|
||||
EvType = Core.MachLog.MachLogTypes.APPLICATION,
|
||||
VarValue = "1",
|
||||
ProdId = lastRec != null ? lastRec.ProdId : 0,
|
||||
ProjCloudId = lastRec != null ? lastRec.ProjCloudId : 0,
|
||||
SupervId = lastRec != null ? lastRec.SupervId : "1"
|
||||
};
|
||||
|
||||
// verifico esistenza record chiusura...
|
||||
if (lastRecClose != null && lastRec != null)
|
||||
{
|
||||
// se l'ultimo record registrato NON fosse di chiusura... lo genero!
|
||||
if (lastRecClose.DtEvent < lastRec.DtEvent)
|
||||
{
|
||||
var recCloseApp = new LogMachineModel()
|
||||
{
|
||||
DtEvent = lastRec.DtEvent.AddSeconds(1),
|
||||
EvType = recStartApp.EvType,
|
||||
VarValue = "0",
|
||||
ProdId = lastRec != null ? lastRec.ProdId : 0,
|
||||
ProjCloudId = lastRec != null ? lastRec.ProjCloudId : 0,
|
||||
SupervId = lastRec != null ? lastRec.SupervId : "1"
|
||||
};
|
||||
// aggiungo rec chiusura
|
||||
locDbCtx.LogMachineList.Add(recCloseApp);
|
||||
}
|
||||
}
|
||||
|
||||
// aggiungo rec avvio
|
||||
locDbCtx.LogMachineList.Add(recStartApp);
|
||||
// salvataggio
|
||||
locDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on LogMachine.RecordAppStartup: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna i record indicati inserendo dataora corrente x DtSent
|
||||
/// </summary>
|
||||
/// <param name="rec2upd"></param>
|
||||
/// <returns></returns>
|
||||
public bool SetDtSent(List<LogMachineModel> rec2upd)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
foreach (var item in rec2upd)
|
||||
{
|
||||
var currRec = localDbCtx
|
||||
.LogMachineList
|
||||
.Where(x => (x.DtSent == null || x.DtSent < x.DtEvent) && x.LogDbId == item.LogDbId)
|
||||
.FirstOrDefault();
|
||||
if (currRec != null)
|
||||
{
|
||||
currRec.DtSent = adesso;
|
||||
// indico modificato
|
||||
localDbCtx.Entry(currRec).State = System.Data.Entity.EntityState.Modified;
|
||||
}
|
||||
}
|
||||
// Salvataggio finale
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cerca di sistemare gli ID di Prod e ProjCloud mancanti
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool TryFixProjCloudId()
|
||||
{
|
||||
// init vars
|
||||
bool fatto = false;
|
||||
int prodId = 0;
|
||||
// vado sul DB
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
var list2proc = localDbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.ProjCloudId == 0 && (x.EvType == Core.MachLog.MachLogTypes.PART_STATUS || x.EvType == Core.MachLog.MachLogTypes.MACHGROUP_STATUS))
|
||||
.OrderBy(x => x.DtEvent)
|
||||
.ToList();
|
||||
// se ci sono...
|
||||
if (list2proc != null && list2proc.Count > 0)
|
||||
{
|
||||
// recupero elenco PROD
|
||||
List<ProdModel> prodList = localDbCtx
|
||||
.ProdList
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
|
||||
foreach (var item in list2proc)
|
||||
{
|
||||
prodId = 0;
|
||||
// cerco valore
|
||||
string[] dataList = item.VarValue.Split(';');
|
||||
if (dataList != null && dataList.Count() > 0)
|
||||
{
|
||||
int.TryParse(dataList[0], out prodId);
|
||||
// se trovato
|
||||
if (prodId > 0)
|
||||
{
|
||||
// salvo il valore prodId
|
||||
item.ProdId = prodId;
|
||||
// cerco il projCloudId in elenco
|
||||
var projRec = prodList.Where(x => x.ProdId == prodId).FirstOrDefault();
|
||||
if (projRec != null)
|
||||
{
|
||||
item.ProjCloudId = projRec.ProjCloudId;
|
||||
}
|
||||
// indico modificato
|
||||
localDbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
|
||||
}
|
||||
}
|
||||
}
|
||||
// salvo
|
||||
localDbCtx.SaveChanges();
|
||||
// registro
|
||||
fatto = true;
|
||||
}
|
||||
}
|
||||
// risultato
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -204,27 +429,40 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Update(LogMachineModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
var item2update = dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.LogMachineList
|
||||
.Where(x => x.LogDbId == updItem.LogDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Update: {exc}");
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on LogMachine.Update: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,17 @@
|
||||
using System;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class LogSupportController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public LogSupportController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -41,24 +33,28 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Create(DateTime dtCreated, Core.LogSupportLevel level, Core.LogSupportTarget target, string message)
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
LogSupportModel newItem = new LogSupportModel() { DtEvent = dtCreated, Level = level, Target = target, Message = message };
|
||||
// Add to database
|
||||
dbCtx.LogSupportList.Add(newItem);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Create LogSupport: {exc}");
|
||||
try
|
||||
{
|
||||
LogSupportModel newItem = new LogSupportModel() { DtEvent = dtCreated, Level = level, Target = target, Message = message };
|
||||
// Add to database
|
||||
localDbCtx.LogSupportList.Add(newItem);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on LogSupport.Create: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return fatto;
|
||||
}
|
||||
|
||||
@@ -70,29 +66,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool DeleteByKey(int LogDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var items2del = dbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.LogDbId == LogDbId);
|
||||
try
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.LogSupportList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
|
||||
var items2del = localDbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.LogDbId == LogDbId);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.LogSupportList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on LogSupport.DeleteByKey: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -102,10 +100,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public LogSupportModel FindByDbId(int LogDbId)
|
||||
{
|
||||
return dbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.LogDbId == LogDbId)
|
||||
.SingleOrDefault();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.LogDbId == LogDbId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -117,11 +118,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public List<LogSupportModel> GetPaginatedAsc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
|
||||
.OrderBy(x => x.DtEvent)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -133,20 +137,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public List<LogSupportModel> GetPaginatedDesc(DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
|
||||
.OrderByDescending(x => x.DtEvent)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -157,27 +155,40 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Update(LogSupportModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
var item2update = dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.LogSupportList
|
||||
.Where(x => x.LogDbId == updItem.LogDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Update: {exc}");
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on LogSupport.Update: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,24 +8,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class MachGroupController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
public static MachGroupController man = new MachGroupController();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public MachGroupController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -37,7 +24,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <param name="coreMachGroup"></param>
|
||||
/// <param name="currProdDbId"></param>
|
||||
/// <returns></returns>
|
||||
public static MachGroupModel ConvertFromCore(Core.MyMachGroupM coreMachGroup, int currProdDbId)
|
||||
public MachGroupModel ConvertFromCore(Core.MyMachGroupM coreMachGroup, int currProdDbId)
|
||||
{
|
||||
MachGroupModel answ = new MachGroupModel();
|
||||
if (coreMachGroup != null)
|
||||
@@ -63,21 +50,26 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add MachGroup as rebuilt from NeedRedo (on top of order priority)
|
||||
/// <param name="ProdId">Id del Prod</param>
|
||||
/// <param name="newMachGroup">Nuovo MachGroup da associare</param>
|
||||
/// <returns></returns>
|
||||
/// <summary> Add MachGroup as rebuilt from NeedRedo (on top of order priority) <param
|
||||
/// name="ProdId">Id del Prod</param> <param name="newMachGroup">Nuovo MachGroup da
|
||||
/// associare</param> <returns></returns>
|
||||
public ProdModel AddMachGroupRedo(int ProdId, Core.MyMachGroupM newMachGroup)
|
||||
{
|
||||
// Recupero il PROD
|
||||
ProdModel currData = ProdController.man.FindByProdId(ProdId);
|
||||
ProdModel currData = new ProdModel();
|
||||
List<PartModel> PartList2Add = new List<PartModel>();
|
||||
var myPartCtrl = new PartController();
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Recupero il PROD nel contesto
|
||||
currData = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
var convCurrMG = MachGroupController.ConvertFromCore(newMachGroup, currData.ProdDbId);
|
||||
var locMGCtrl = new MachGroupController();
|
||||
var convCurrMG = locMGCtrl.ConvertFromCore(newMachGroup, currData.ProdDbId);
|
||||
|
||||
convCurrMG.ProdIndex = 1;
|
||||
|
||||
@@ -86,15 +78,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
int MachGroupDbId = MachGroupController.man.FindByMachGroupId(ProdId, newMachGroup.Id).MachGroupDbId;
|
||||
int MachGroupDbId = FindByMachGroupId(ProdId, newMachGroup.Id).MachGroupDbId;
|
||||
// 2023.05.10 leggo elenco part in una sola volta
|
||||
|
||||
var currMgPartList = localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == newMachGroup.Id)
|
||||
.ToList();
|
||||
// verifico se uguali o meno...
|
||||
foreach (var currPartM in newMachGroup.PartMList)
|
||||
{
|
||||
var currPart = localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == newMachGroup.Id && x.PartId == currPartM.nPartId)
|
||||
//var currPart = localDbCtx
|
||||
// .PartList
|
||||
// .Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == newMachGroup.Id && x.PartId == currPartM.nPartId)
|
||||
// .SingleOrDefault();
|
||||
var currPart = currMgPartList
|
||||
.Where(x => x.PartId == currPartM.nPartId)
|
||||
.SingleOrDefault();
|
||||
var convCurrPartM = PartController.ConvertFromCore(currPartM, MachGroupDbId);
|
||||
|
||||
var convCurrPartM = myPartCtrl.ConvertFromCore(currPartM, MachGroupDbId);
|
||||
if (currPart != null)
|
||||
{
|
||||
// se non identico x equality limitata a ViewOptim...
|
||||
@@ -130,11 +132,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, newMachGroup.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, newMachGroup.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateMachGroup: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateMachGroup: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return currData;
|
||||
@@ -161,7 +165,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Create: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.Create: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return newMachGroup;
|
||||
@@ -178,6 +184,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
// inizio eliminando le part
|
||||
var parts2del = localDbCtx
|
||||
.PartList
|
||||
@@ -198,25 +205,25 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
// registro modifica StatusMap
|
||||
StatusMapController.man.UpdateAction(MG2Del.SupervisorId, ProdId, MG2Del.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
|
||||
myStatusMapCtrl.UpdateAction(MG2Del.SupervisorId, ProdId, MG2Del.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
|
||||
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId}{Environment.NewLine}{exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId}{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
|
||||
// se fatto aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRem, "");
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -226,10 +233,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public MachGroupModel FindByMachGroupDbId(int MachGroupDbId)
|
||||
{
|
||||
return dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.MachGroupDbId == MachGroupDbId)
|
||||
.SingleOrDefault();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.MachGroupDbId == MachGroupDbId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -239,7 +249,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public MachGroupModel FindByMachGroupId(int ProdId, int MachGroupId)
|
||||
{
|
||||
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
@@ -258,27 +267,34 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
// verificare fattibilità in 1 solo passo
|
||||
int ProdDbId = 0;
|
||||
try
|
||||
List<MachGroupModel> answ = new List<MachGroupModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var currProd = dbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.FirstOrDefault();
|
||||
if (currProd != null)
|
||||
try
|
||||
{
|
||||
ProdDbId = currProd.ProdDbId;
|
||||
var currProd = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.FirstOrDefault();
|
||||
if (currProd != null)
|
||||
{
|
||||
ProdDbId = currProd.ProdDbId;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on MachGroup.GetByProdAsc: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
answ = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderBy(x => x.ProdIndex)
|
||||
.ThenBy(x => x.MachGroupId)
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
|
||||
}
|
||||
return dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderBy(x => x.ProdIndex)
|
||||
.ThenBy(x => x.MachGroupId)
|
||||
.ToList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -290,29 +306,35 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
// recupero
|
||||
int ProdDbId = 0;
|
||||
|
||||
// verificare fattibilità in 1 solo passo
|
||||
try
|
||||
List<MachGroupModel> answ = new List<MachGroupModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var currProd = dbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.FirstOrDefault();
|
||||
if (currProd != null)
|
||||
// verificare fattibilità in 1 solo passo
|
||||
try
|
||||
{
|
||||
ProdDbId = currProd.ProdDbId;
|
||||
var currProd = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.FirstOrDefault();
|
||||
if (currProd != null)
|
||||
{
|
||||
ProdDbId = currProd.ProdDbId;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on MachGroup.GetByProdDesc: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
answ = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderByDescending(x => x.ProdIndex)
|
||||
.ThenByDescending(x => x.MachGroupId)
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on GetByProdDesc: {exc}");
|
||||
}
|
||||
return dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.ProdDbId == ProdDbId)
|
||||
.OrderByDescending(x => x.ProdIndex)
|
||||
.ThenByDescending(x => x.MachGroupId)
|
||||
.ToList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -323,12 +345,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public List<MachGroupModel> GetByProdSupervisor(int ProdId, string SupervisorId)
|
||||
{
|
||||
return dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.SupervisorId == SupervisorId)
|
||||
.OrderBy(x => x.ProdIndex)
|
||||
.ThenBy(x => x.MachGroupId)
|
||||
.ToList();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.SupervisorId == SupervisorId)
|
||||
.OrderBy(x => x.ProdIndex)
|
||||
.ThenBy(x => x.MachGroupId)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -356,7 +381,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateOrder: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateOrder: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,6 +401,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
@@ -386,31 +414,30 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
currRecord.State = Core.ItemState.ND;
|
||||
currRecord.SupervisorId = "";
|
||||
currRecord.ProdIndex = 0;
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRemovedFromSupervisor, "");
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupRemovedFromSupervisor, "");
|
||||
|
||||
done = true;
|
||||
done = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.RemoveFromSupervisor: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on RemoveFromSupervisor: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.RemoveFromSupervisor: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set MachGroup as NeedRedo (ripresa = da rigenerare)
|
||||
/// </summary>
|
||||
@@ -423,23 +450,35 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
localDbCtx
|
||||
var item2upd = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault()
|
||||
.State = newState;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupNeedRedo, Value);
|
||||
.FirstOrDefault();
|
||||
if (item2upd != null)
|
||||
{
|
||||
item2upd.State = newState;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupNeedRedo, Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.SetNeedRedo: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | newState {newState} | Value {Value}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.SetNeedRedo: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -455,24 +494,36 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.MachGroupDbId == updItem.MachGroupDbId)
|
||||
.SingleOrDefault();
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
var item2update = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.MachGroupDbId == updItem.MachGroupDbId)
|
||||
.SingleOrDefault();
|
||||
if (item2update != null)
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", updItem.Prod.ProdId, updItem.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", updItem.Prod.ProdId, updItem.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.Update: req item was not found | ProdDbId {updItem.ProdDbId} | MachGroupId {updItem.MachGroupId} | ProdIndex {updItem.ProdIndex}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Update: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.Update: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -490,6 +541,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
@@ -497,19 +549,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault();
|
||||
|
||||
currRecord.DtEnd = DtEnd;
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
|
||||
if (currRecord != null)
|
||||
{
|
||||
currRecord.DtEnd = DtEnd;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.UpdateEnd: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | DtEnd {DtEnd}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateEnd: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -530,19 +590,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
localDbCtx
|
||||
var item2upd = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault()
|
||||
.ProdIndex = newProdIndex;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
done = true;
|
||||
.FirstOrDefault();
|
||||
if (item2upd != null)
|
||||
{
|
||||
item2upd.ProdIndex = newProdIndex;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.UpdateOrder: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | newProdIndex {newProdIndex}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateOrder: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateOrder: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -561,6 +631,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
@@ -568,19 +639,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault();
|
||||
|
||||
currRecord.DtStart = DtStart;
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
|
||||
if (currRecord != null)
|
||||
{
|
||||
currRecord.DtStart = DtStart;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.UpdateStart: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | DtStart {DtStart}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateStart: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -599,6 +678,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
@@ -606,19 +686,28 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault();
|
||||
|
||||
currRecord.DtStart = DtStart;
|
||||
currRecord.DtEnd = DtEnd;
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
if (currRecord != null)
|
||||
{
|
||||
currRecord.DtStart = DtStart;
|
||||
currRecord.DtEnd = DtEnd;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.UpdateStartEnd: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | DtStart {DtStart} | DtEnd {DtEnd}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStartEnd: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateStartEnd: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -635,67 +724,93 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
localDbCtx
|
||||
var item2upd = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault()
|
||||
.State = newState;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
.FirstOrDefault();
|
||||
if (item2upd != null)
|
||||
{
|
||||
item2upd.State = newState;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.UpdateStatus: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | newState {newState}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateStatus: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set Supervisor & state for MachGroup
|
||||
/// </summary>
|
||||
/// <param name="ProdId"></param>
|
||||
/// <param name="MachGroupId"></param>
|
||||
/// <param name="SupervisorId"></param>
|
||||
/// <returns></returns>
|
||||
/// <summary> Set Supervisor & state for MachGroup </summary> <param name="ProdId"></param>
|
||||
/// <param name="MachGroupId"></param> <param name="SupervisorId"></param> <returns></returns>
|
||||
public bool UpdateSupervisor(int ProdId, int MachGroupId, string SupervisorId)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
var currRecord = localDbCtx
|
||||
var item2upd = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == MachGroupId)
|
||||
.FirstOrDefault();
|
||||
if (item2upd != null)
|
||||
{
|
||||
item2upd.SupervisorId = SupervisorId;
|
||||
item2upd.State = Core.ItemState.Assigned;
|
||||
|
||||
currRecord.SupervisorId = SupervisorId;
|
||||
currRecord.State = Core.ItemState.Assigned;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAssignedToSupervisor, "");
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAssignedToSupervisor, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on MachGroup.UpdateSupervisor: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | SupervisorId {SupervisorId}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateSupervisor: {exc}");
|
||||
string errMessage = $"EXCEPTION on MachGroup.UpdateSupervisor: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,291 @@
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgwProxy.MagMan.DTO;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestione MagmanSync su DB (registrazione operazioni di sync con MagMan online)
|
||||
/// </summary>
|
||||
public class MagmanSyncController : IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MagmanSyncController()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Purge dei record inviati oltre periodo di giorni indicato
|
||||
/// </summary>
|
||||
/// <param name="NumDayMax">Num gg max da mantenere in registro</param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteOlder(int NumDayMax)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
var items2del = localDbCtx
|
||||
.SyncList
|
||||
.Where(x => x.DtExe != null && adesso.Subtract(x.DtReq).TotalDays > NumDayMax);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.SyncList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on MagmanSync.DeleteOlder | NumDayMax: {NumDayMax}{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Purge dei record NON INVIATI date condizioni filtro
|
||||
/// </summary>
|
||||
/// <param name="ProjCloudId">Id progetto x cui filtrare</param>
|
||||
/// <param name="SyncType">Tipo di record da cercare</param>
|
||||
/// <param name="DtLimit">DataOra limite (max) x cui cercare record non inviati</param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteUnsentFilt(int ProjCloudId, string SyncType, DateTime DtLimit)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// cercl candidati
|
||||
var items2del = localDbCtx
|
||||
.SyncList
|
||||
.Where(x => x.DtExe == null && x.CloudId == ProjCloudId && x.SyncType == SyncType && x.DtReq <= DtLimit);
|
||||
// se ne ho trovato...
|
||||
if (items2del != null && items2del.Count() > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.SyncList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on MagmanSync.DeleteUnsentFilt | ProjCloudId: {ProjCloudId} | SyncType: {SyncType} | DtLimit: {DtLimit}{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista record filtrati
|
||||
/// </summary>
|
||||
/// <param name="SyncType">Tipo di record richiesti, se "" = tutti</param>
|
||||
/// <param name="DtMax">Data-Ora limite per recupero ordinato DESC</param>
|
||||
/// <param name="NumMax">num max di record da restituire</param>
|
||||
/// <returns></returns>
|
||||
public List<MagmanSyncModel> GetFilt(string SyncType, DateTime DtMax, int NumMax)
|
||||
{
|
||||
List<MagmanSyncModel> dbResult = new List<MagmanSyncModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.SyncList
|
||||
.Where(x => (string.IsNullOrEmpty(SyncType) || x.SyncType == SyncType) && x.DtReq <= DtMax)
|
||||
.OrderByDescending(x => x.DtReq)
|
||||
.Take(NumMax)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista record NON inviati filtrati x tipo e num max
|
||||
/// </summary>
|
||||
/// <param name="SyncType">Tipo di record richiesti, se "" = tutti</param>
|
||||
/// <param name="DtMax">Data-Ora limite per recupero ordinato ASC</param>
|
||||
/// <param name="NumMax">num max di record da restituire</param>
|
||||
/// <returns></returns>
|
||||
public List<MagmanSyncModel> GetUnsentFilt(string SyncType, DateTime DtMax, int NumMax)
|
||||
{
|
||||
List<MagmanSyncModel> dbResult = new List<MagmanSyncModel>();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.SyncList
|
||||
.Where(x => x.DtExe == null && (string.IsNullOrEmpty(SyncType) || x.SyncType == SyncType) && x.DtReq <= DtMax)
|
||||
.OrderBy(x => x.DtReq)
|
||||
.Take(NumMax)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert record MagmanSync
|
||||
/// </summary>
|
||||
/// <param name="newRec"></param>
|
||||
/// <returns>ID record inserito</returns>
|
||||
public int Insert(MagmanSyncModel newRec)
|
||||
{
|
||||
int newId = 0;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
// inserisco record
|
||||
localDbCtx.SyncList.Add(newRec);
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
newId = newRec.SyncId;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on MagmanSync.Insert: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update con indicazione DtExt di completamento
|
||||
/// </summary>
|
||||
/// <param name="SyncId">ID record</param>
|
||||
/// <param name="DtExe">Data-Ora exe</param>
|
||||
/// <returns></returns>
|
||||
public bool SetCompleted(int SyncId, DateTime DtExe)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.SyncList
|
||||
.Where(x => x.SyncId == SyncId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
// update
|
||||
item2update.DtExe = DtExe;
|
||||
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on MagmanSync.SetCompleted: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update or insert record MagmanSync
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns></returns>
|
||||
public bool Upsert(MagmanSyncModel updItem)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.SyncList
|
||||
.Where(x => x.SyncId == updItem.SyncId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx.SyncList.Add(updItem);
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on MagmanSync.Upsert: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update or insert Alias record list
|
||||
/// </summary>
|
||||
/// <param name="updList"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpsertList(List<MagmanSyncModel> updList)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var updItem in updList)
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.SyncList
|
||||
.Where(x => x.SyncId == updItem.SyncId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx.SyncList.Add(updItem);
|
||||
}
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on MagmanSync.UpsertList: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,529 @@
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgwProxy.MagMan.DTO;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static EgtBEAMWALL.DataLayer.Controllers.MaterialsController.SearchResult;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestione Materiali su DB (= magazzino locale)
|
||||
/// </summary>
|
||||
public class MaterialsController : IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MaterialsController()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of DB model class to base class
|
||||
/// </summary>
|
||||
/// <param name="coreMat"></param>
|
||||
/// <returns></returns>
|
||||
public static Core.MaterialM ConvToCore(MaterialModel dbRec)
|
||||
{
|
||||
Core.MaterialM answ = new Core.MaterialM(dbRec.MatId, (double)dbRec.WMm, (double)dbRec.HMm, (double)dbRec.LMm, "", dbRec.MatCode);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione a DTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public static MaterialDTO ConvToDto(MaterialModel currRec)
|
||||
{
|
||||
MaterialDTO answ = new MaterialDTO()
|
||||
{
|
||||
MatCloudId = currRec.MatCloudId,
|
||||
MatLocalId = currRec.MatId,
|
||||
MatCode = currRec.MatCode,
|
||||
MatDesc = currRec.MatDesc,
|
||||
HMm = currRec.HMm,
|
||||
LMm = currRec.LMm,
|
||||
WMm = currRec.WMm
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione da DTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public static MaterialModel ConvToModel(MaterialDTO currRec)
|
||||
{
|
||||
MaterialModel answ = new MaterialModel()
|
||||
{
|
||||
MatCloudId = currRec.MatCloudId,
|
||||
MatId = currRec.MatLocalId,
|
||||
MatCode = currRec.MatCode,
|
||||
MatDesc = currRec.MatDesc,
|
||||
HMm = currRec.HMm,
|
||||
LMm = currRec.LMm,
|
||||
WMm = currRec.WMm
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of base class to DB model class
|
||||
/// </summary>
|
||||
/// <param name="coreRec"></param>
|
||||
/// <returns></returns>
|
||||
public static MaterialModel ConvToModel(Core.MaterialM coreRec)
|
||||
{
|
||||
MaterialModel answ = new MaterialModel();
|
||||
if (coreRec != null)
|
||||
{
|
||||
answ = new MaterialModel()
|
||||
{
|
||||
MatId = coreRec.nId,
|
||||
MatCode = coreRec.sWarehouseMaterial,
|
||||
HMm = (decimal)Math.Round(coreRec.dH,2),
|
||||
LMm = (decimal)Math.Round(coreRec.dL,2),
|
||||
WMm = (decimal)Math.Round(coreRec.dW,2),
|
||||
};
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete by key
|
||||
/// </summary>
|
||||
/// <param name="MatId"></param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteByKey(int MatId)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var items2del = localDbCtx
|
||||
.MaterialsList
|
||||
.Where(x => x.MatId == MatId);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.MaterialsList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Materials.DeleteByKey: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by Key
|
||||
/// </summary>
|
||||
/// <param name="MatId"></param>
|
||||
/// <returns></returns>
|
||||
public Core.MaterialM FindByDbId(int MatId)
|
||||
{
|
||||
Core.MaterialM result = new Core.MaterialM(0, 0, 0, "", "");
|
||||
var rawData = FindByDbIdModel(MatId);
|
||||
if (rawData != null)
|
||||
{
|
||||
result = ConvToCore(rawData);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by Key in formato Model
|
||||
/// </summary>
|
||||
/// <param name="MatId"></param>
|
||||
/// <returns></returns>
|
||||
public MaterialModel FindByDbIdModel(int MatId)
|
||||
{
|
||||
MaterialModel result = new MaterialModel();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
result = localDbCtx
|
||||
.MaterialsList
|
||||
.Where(x => x.MatId == MatId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Material (filtro x MatId) in formato Core
|
||||
/// </summary>
|
||||
/// <param name="MatCode">se "" restituisce tutti</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.MaterialM> GetFilt(string MatCode)
|
||||
{
|
||||
// recupero e converto
|
||||
List<Core.MaterialM> result = new List<Core.MaterialM>();
|
||||
var rawData = GetFiltModel(MatCode);
|
||||
if (rawData != null)
|
||||
{
|
||||
result = rawData.Select(x => ConvToCore(x)).ToList();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Material (filtro x MatId) in formato Model
|
||||
/// </summary>
|
||||
/// <param name="MatCode">se "" restituisce tutti</param>
|
||||
/// <returns></returns>
|
||||
public List<MaterialModel> GetFiltModel(string MatCode)
|
||||
{
|
||||
List<MaterialModel> result = new List<MaterialModel>();
|
||||
// retrieve
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
result = localDbCtx
|
||||
.MaterialsList
|
||||
.Where(x => string.IsNullOrEmpty(MatCode) || x.MatCode == MatCode)
|
||||
.OrderBy(x => x.MatDesc)
|
||||
.ToList();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert Material record from CoreM if missing or return existing (for Id)
|
||||
/// </summary>
|
||||
/// <param name="coreItem"></param>
|
||||
/// <returns>MatId (existing or new)</returns>
|
||||
public int Insert(Core.MaterialM coreItem)
|
||||
{
|
||||
int newIdx = 0;
|
||||
// converto
|
||||
MaterialModel updItem = ConvToModel(coreItem);
|
||||
newIdx = Insert(updItem);
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert Material record
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns>MatId (existing or new)</returns>
|
||||
public int Insert(MaterialModel updItem)
|
||||
{
|
||||
int newIdx = 0;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.MaterialsList
|
||||
.Where(x => (updItem.MatId > 0 && x.MatId == updItem.MatId)
|
||||
|| (updItem.MatCloudId > 0 && x.MatCloudId == updItem.MatCloudId)
|
||||
|| (x.MatCode == updItem.MatCode && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
newIdx = item2update.MatId;
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx.MaterialsList.Add(updItem);
|
||||
// verifico se c'è già "alias original"
|
||||
var aliasOrig = localDbCtx
|
||||
.AliasList
|
||||
.Where(x => x.ValueOriginal == updItem.MatCode)
|
||||
.FirstOrDefault();
|
||||
if (aliasOrig == null || string.IsNullOrEmpty(aliasOrig.ValueOriginal) || aliasOrig.ValueOriginal != updItem.MatCode)
|
||||
{
|
||||
// inserisco alias!
|
||||
localDbCtx.AliasList.Add(new AliasModel() { Family = "MatCode", ValueOriginal = updItem.MatCode, ValueAlias = updItem.MatCode });
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
newIdx = updItem.MatId;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Materials.Insert: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Last RawItem used for Material
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns>Returns 0 if not found</returns>
|
||||
public int LastRawItemGet(int MatId)
|
||||
{
|
||||
int RawItemIdLast = 0;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.MaterialsList
|
||||
.Where(x => (MatId > 0 && x.MatId == MatId))
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
RawItemIdLast = item2update.RawItemIdLast;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Materials.LastRawItemGet: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return RawItemIdLast;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update Last RawItem used for Material record
|
||||
/// </summary>
|
||||
/// <param name="MatId">Id locale materiale</param>
|
||||
/// <param name="RawItemIdLast">Id del RawItem</param>
|
||||
/// <returns>Returns true if updated</returns>
|
||||
public bool LastRawItemSet(int MatId, int RawItemIdLast)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.MaterialsList
|
||||
.Where(x => (MatId > 0 && x.MatId == MatId))
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
item2update.RawItemIdLast = RawItemIdLast;
|
||||
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Materials.LastRawItemSet: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce il primo materiale (se esiste) per MatCode (diretto o tramite Alias)
|
||||
/// </summary>
|
||||
/// <param name="MatCode">Non accetta ""</param>
|
||||
/// <returns></returns>
|
||||
public SearchResult SearchFilt(string MatCode)
|
||||
{
|
||||
// init valori esito ricerca + risultato
|
||||
TypeFound esito = string.IsNullOrEmpty(MatCode) ? TypeFound.MISSING_CODE : TypeFound.NOT_FOUND;
|
||||
List<Core.MaterialM> result = new List<Core.MaterialM>();
|
||||
// solo se ho una VERA ricerca x MatCode
|
||||
if (!string.IsNullOrEmpty(MatCode))
|
||||
{
|
||||
// cerco nei materiali
|
||||
var rawData = GetFiltModel(MatCode);
|
||||
if (rawData != null && rawData.Count > 0)
|
||||
{
|
||||
// ...e converto
|
||||
result = rawData.Select(x => ConvToCore(x)).ToList();
|
||||
esito = TypeFound.MATERIAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// cerco negli alias...
|
||||
using (AliasController aliasDbContr = new AliasController())
|
||||
{
|
||||
var aliasRec = aliasDbContr.FindByDbId(MatCode);
|
||||
if (aliasRec != null)
|
||||
{
|
||||
rawData = GetFiltModel(aliasRec.ValueAlias);
|
||||
if (rawData != null && rawData.Count > 0)
|
||||
{
|
||||
// ...e converto
|
||||
result = rawData.Select(x => ConvToCore(x)).ToList();
|
||||
esito = TypeFound.ALIAS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// compongo risposta!
|
||||
SearchResult answ = new SearchResult()
|
||||
{
|
||||
Tipo = esito,
|
||||
Result = result
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update Material record from CoreM
|
||||
/// </summary>
|
||||
/// <param name="coreItem"></param>
|
||||
/// <returns>Returns 0 if not found</returns>
|
||||
public int Update(Core.MaterialM coreItem)
|
||||
{
|
||||
int newIdx = 0;
|
||||
// converto
|
||||
MaterialModel updItem = ConvToModel(coreItem);
|
||||
newIdx = Update(updItem);
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update Material record
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns>Returns 0 if not found</returns>
|
||||
public int Update(MaterialModel updItem)
|
||||
{
|
||||
int newIdx = 0;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.MaterialsList
|
||||
.Where(x => (updItem.MatId > 0 && x.MatId == updItem.MatId)
|
||||
|| (updItem.MatCloudId > 0 && x.MatCloudId == updItem.MatCloudId)
|
||||
|| (x.MatCode == updItem.MatCode && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
//// update, vers 1...
|
||||
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
item2update.MatCloudId = updItem.MatCloudId;
|
||||
item2update.MatDesc = updItem.MatDesc;
|
||||
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
newIdx = item2update.MatId;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Materials.Update: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upsert Material record
|
||||
/// </summary>
|
||||
/// <param name="updItem"></param>
|
||||
/// <returns>MatId (existing or new)</returns>
|
||||
public int Upsert(MaterialModel updItem)
|
||||
{
|
||||
int newIdx = 0;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.MaterialsList
|
||||
.Where(x => (updItem.MatId > 0 && x.MatId == updItem.MatId)
|
||||
|| (updItem.MatCloudId > 0 && x.MatCloudId == updItem.MatCloudId)
|
||||
|| (x.MatCode == updItem.MatCode && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
//// update, vers 1...
|
||||
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
item2update.MatCloudId = updItem.MatCloudId;
|
||||
item2update.MatDesc = updItem.MatDesc;
|
||||
localDbCtx.Entry(item2update).State = System.Data.Entity.EntityState.Modified;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
newIdx = item2update.MatId;
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx.MaterialsList.Add(updItem);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
newIdx = updItem.MatId;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on Materials.Insert: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Public Classes
|
||||
|
||||
/// <summary>
|
||||
/// Risultato ricerca materiali
|
||||
/// </summary>
|
||||
public class SearchResult
|
||||
{
|
||||
#region Public Enums
|
||||
|
||||
/// <summary>
|
||||
/// Enum del risultato della ricerca materiali
|
||||
/// </summary>
|
||||
public enum TypeFound
|
||||
{
|
||||
MISSING_CODE = 0,
|
||||
NOT_FOUND,
|
||||
ALIAS,
|
||||
MATERIAL
|
||||
}
|
||||
|
||||
#endregion Public Enums
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Materiali trovati
|
||||
/// </summary>
|
||||
public List<Core.MaterialM> Result { get; set; } = new List<Core.MaterialM>();
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia oggetto trovato
|
||||
/// </summary>
|
||||
public TypeFound Tipo { get; set; } = TypeFound.MISSING_CODE;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
#endregion Public Classes
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,105 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class PartController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
public static PartController man = new PartController();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public PartController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
{ }
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Get BtlPartDBId by ProjId + PDN
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="PDN"></param>
|
||||
/// <returns></returns>
|
||||
protected int FindBtlPart(int ProjId, int PDN)
|
||||
{
|
||||
int BtlPartDbId = 0;
|
||||
|
||||
#if false
|
||||
var currProj = dbCtx
|
||||
.ProjList
|
||||
.Where(x => x.ProjId == ProjId)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (currProj != null)
|
||||
{
|
||||
var btlPart = dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.ProjDbId == currProj.ProjDbId && x.PDN == PDN)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (btlPart != null)
|
||||
{
|
||||
BtlPartDbId = btlPart.BTLPartDbId;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
var btlPart = dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.Project.ProjId == ProjId && x.PDN == PDN)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (btlPart != null)
|
||||
{
|
||||
BtlPartDbId = btlPart.BTLPartDbId;
|
||||
}
|
||||
|
||||
return BtlPartDbId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get BtlPartDBId by ProjId + BtlPartId
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="BtlPartId"></param>
|
||||
/// <returns></returns>
|
||||
protected int FindBtlPartByBPI(int ProjId, int BtlPartId)
|
||||
{
|
||||
int BtlPartDbId = 0;
|
||||
|
||||
var btlPart = dbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.Project.ProjId == ProjId && x.PartId == BtlPartId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (btlPart != null)
|
||||
{
|
||||
BtlPartDbId = btlPart.BTLPartDbId;
|
||||
}
|
||||
|
||||
return BtlPartDbId;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -108,12 +22,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <param name="corePart"></param>
|
||||
/// <param name="currMachGroupDbId"></param>
|
||||
/// <returns></returns>
|
||||
public static PartModel ConvertFromCore(Core.PartM corePart, int currMachGroupDbId)
|
||||
public PartModel ConvertFromCore(Core.PartM corePart, int currMachGroupDbId)
|
||||
{
|
||||
PartModel answ = new PartModel();
|
||||
if (corePart != null)
|
||||
{
|
||||
int BTLPartId = man.FindBtlPartByBPI(corePart.nProjId, corePart.nBTLPartId);
|
||||
int BTLPartId = FindBtlPartByBPI(corePart.nProjId, corePart.nBTLPartId);
|
||||
answ = new PartModel()
|
||||
{
|
||||
PartId = corePart.nPartId,
|
||||
@@ -151,24 +65,39 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Delete(int ProdId, int MachGroupId, int PartId)
|
||||
{
|
||||
bool done = false;
|
||||
var item2del = dbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Remove from database
|
||||
dbCtx.PartList.Remove(item2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId} | PartId: {PartId}{Environment.NewLine}{exc}");
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
var item2del = localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2del != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Remove from database
|
||||
localDbCtx.PartList.Remove(item2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Part.Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId} | PartId: {PartId}{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Part.Delete (01): req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | PartId {PartId}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
@@ -181,22 +110,36 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Delete(int PartDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var item2del = dbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartDbId == PartDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.PartList.Remove(item2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on Delete: {exc}");
|
||||
var item2del = localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartDbId == PartDbId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2del != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.PartList.Remove(item2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Part.Delete: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Part.Delete (02): req item was not found | PartDbId {PartDbId}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
@@ -209,29 +152,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool DeleteByMachGroup(int MachGroupDbId)
|
||||
{
|
||||
bool done = false;
|
||||
var items2del = dbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroupDbId == MachGroupDbId);
|
||||
try
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.PartList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on DeleteByMachGroup: {exc}");
|
||||
var items2del = localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroupDbId == MachGroupDbId);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.PartList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Part.DeleteByMachGroup: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -241,10 +186,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public PartModel FindByDbId(int PartDbId)
|
||||
{
|
||||
return dbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartDbId == PartDbId)
|
||||
.SingleOrDefault();
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartDbId == PartDbId)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -255,9 +203,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public PartModel FindByPartId(int ProdId, int PartId)
|
||||
{
|
||||
PartModel answ = null;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
using (DatabaseContext locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
answ = localDbCtx
|
||||
answ = locDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.PartId == PartId)
|
||||
.FirstOrDefault();
|
||||
@@ -265,15 +213,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update single Part
|
||||
/// </summary>
|
||||
@@ -282,29 +221,43 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool Update(PartModel updItem)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
using (DatabaseContext locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
var item2upd = locDbCtx
|
||||
.PartList
|
||||
.Where(x => x.PartDbId == updItem.PartDbId)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
if (item2upd != null)
|
||||
{
|
||||
// update, vers 1...
|
||||
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
|
||||
try
|
||||
{
|
||||
// update, vers 1...
|
||||
locDbCtx.Entry(item2upd).CurrentValues.SetValues(updItem);
|
||||
|
||||
//// update, vers 2
|
||||
//dbCtx.PartList.Remove(item2del);
|
||||
//dbCtx.PartList.Add(updItem);
|
||||
//// update, vers 2
|
||||
//localDbCtx.PartList.Remove(item2del);
|
||||
//localDbCtx.PartList.Add(updItem);
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", updItem.MachGroup.Prod.ProdId, updItem.PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
|
||||
// Commit changes
|
||||
locDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", updItem.MachGroup.Prod.ProdId, updItem.PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Part.Update: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Part.Update (01): req item was not found | PartId {updItem.PartId} | PartDbId {updItem.PartDbId} | BTLPartDbId {updItem.BTLPartDbId}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return done;
|
||||
}
|
||||
@@ -318,25 +271,38 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool UpdateEnd(int ProdId, int MachGroupId, int PartId, DateTime DtEnd)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
using (DatabaseContext locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
localDbCtx
|
||||
var item2upd = locDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||
.FirstOrDefault()
|
||||
.DtEnd = DtEnd;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
|
||||
.FirstOrDefault();
|
||||
|
||||
if (item2upd != null)
|
||||
{
|
||||
item2upd.DtEnd = DtEnd;
|
||||
// Commit changes
|
||||
locDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Part.UpdateEnd: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | PartId {PartId} | DtEnd {DtEnd}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
||||
string errMessage = $"EXCEPTION on Part.UpdateEnd: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
return done;
|
||||
@@ -351,25 +317,37 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool UpdateStart(int ProdId, int MachGroupId, int PartId, DateTime DtStart)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
using (DatabaseContext locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
localDbCtx
|
||||
var item2upd = locDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||
.FirstOrDefault()
|
||||
.DtStart = DtStart;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
|
||||
.FirstOrDefault();
|
||||
if (item2upd != null)
|
||||
{
|
||||
item2upd.DtStart = DtStart;
|
||||
// Commit changes
|
||||
locDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Part.UpdateStart: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | PartId {PartId} | DtStart {DtStart}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
||||
string errMessage = $"EXCEPTION on Part.UpdateStart: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,25 +363,37 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public bool UpdateStatus(int ProdId, int MachGroupId, int PartId, Core.ItemState newState)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
using (DatabaseContext locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var myStatusMapCtrl = new StatusMapController();
|
||||
try
|
||||
{
|
||||
// aggiorno
|
||||
localDbCtx
|
||||
var item2upd = locDbCtx
|
||||
.PartList
|
||||
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
|
||||
.FirstOrDefault()
|
||||
.State = newState;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
|
||||
.FirstOrDefault();
|
||||
if (item2upd != null)
|
||||
{
|
||||
item2upd.State = newState;
|
||||
// Commit changes
|
||||
locDbCtx.SaveChanges();
|
||||
done = true;
|
||||
// aggiorno info sullo status
|
||||
myStatusMapCtrl.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, newState == Core.ItemState.Scrapped ? Core.StatusMapOpType.SetPartScrapped : Core.StatusMapOpType.MachGroupMod, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Part.UpdateStart: req item was not found | ProdId {ProdId} | MachGroupId {MachGroupId} | PartId {PartId} | newState {newState}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateStatus: {exc}");
|
||||
string errMessage = $"EXCEPTION on Part.UpdateStatus: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,5 +401,68 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Get BtlPartDBId by ProdId + PDN
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="PDN"></param>
|
||||
/// <returns></returns>
|
||||
protected int FindBtlPart(int ProjId, int PDN)
|
||||
{
|
||||
int BtlPartDbId = 0;
|
||||
|
||||
using (DatabaseContext locDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var btlPart = locDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.Project.ProjId == ProjId && x.PDN == PDN)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (btlPart != null)
|
||||
{
|
||||
BtlPartDbId = btlPart.BTLPartDbId;
|
||||
}
|
||||
}
|
||||
return BtlPartDbId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get BtlPartDBId by ProdId + BtlPartId
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="BtlPartId"></param>
|
||||
/// <returns></returns>
|
||||
protected int FindBtlPartByBPI(int ProjId, int BtlPartId)
|
||||
{
|
||||
int BtlPartDbId = 0;
|
||||
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var btlPart = localDbCtx
|
||||
.BTLPartList
|
||||
.Where(x => x.Project.ProjId == ProjId && x.PartId == BtlPartId)
|
||||
.SingleOrDefault();
|
||||
|
||||
if (btlPart != null)
|
||||
{
|
||||
BtlPartDbId = btlPart.BTLPartDbId;
|
||||
}
|
||||
}
|
||||
return BtlPartDbId;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,352 @@
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgwProxy.MagMan.DTO;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestione RawItem (barre) su DB (= magazzino locale)
|
||||
/// </summary>
|
||||
public class RawItemsController : IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public RawItemsController()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversion da DB model class a base class (VB)
|
||||
/// </summary>
|
||||
/// <param name="dbRec"></param>
|
||||
/// <returns></returns>
|
||||
public static Core.RawPartM ConvToCore(RawItemModel dbRec)
|
||||
{
|
||||
// converto in primis il materiale relativo
|
||||
Core.MaterialM matRec = MaterialsController.ConvToCore(dbRec.MaterialNav);
|
||||
Core.RawPartM answ = new Core.RawPartM(dbRec.RawItemId, matRec, (double)dbRec.WMm, (double)dbRec.LMm, dbRec.QtyAvail, dbRec.UseQty, dbRec.IsActive);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione a ItemDTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public static ItemDTO ConvToItemDto(RawItemModel currRec)
|
||||
{
|
||||
ItemDTO answ = new ItemDTO()
|
||||
{
|
||||
MatCloudId = currRec.MaterialNav != null ? currRec.MaterialNav.MatCloudId : 0,
|
||||
MatLocalId = currRec.MatId,
|
||||
RawItemCloudId = currRec.RawItemCloudId,
|
||||
RawItemLocalId = currRec.RawItemId,
|
||||
IsRemn = currRec.IsRemn,
|
||||
QtyAvail = currRec.QtyAvail,
|
||||
HMm = currRec.HMm,
|
||||
LMm = currRec.LMm,
|
||||
WMm = currRec.WMm,
|
||||
Note = currRec.Note
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione da ItemDTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <param name="isActive"></param>
|
||||
/// <returns></returns>
|
||||
public static RawItemModel ConvToModel(ItemDTO currRec, bool isActive)
|
||||
{
|
||||
RawItemModel answ = new RawItemModel()
|
||||
{
|
||||
RawItemCloudId = currRec.RawItemCloudId,
|
||||
RawItemId = currRec.RawItemLocalId,
|
||||
QtyAvail = currRec.QtyAvail,
|
||||
HMm = currRec.HMm,
|
||||
LMm = currRec.LMm,
|
||||
WMm = currRec.WMm,
|
||||
MatId = currRec.MatLocalId,
|
||||
IsRemn = currRec.IsRemn,
|
||||
IsActive = isActive,
|
||||
UseQty = true,
|
||||
Note = currRec.Note
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione da ResourceExpDTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <param name="matLocalId"></param>
|
||||
/// <returns></returns>
|
||||
public static RawItemModel ConvToModel(ResourceExpDTO currRec, int matLocalId)
|
||||
{
|
||||
RawItemModel answ = new RawItemModel()
|
||||
{
|
||||
RawItemCloudId = currRec.RawItemCloudId,
|
||||
RawItemId = currRec.RawItemLocalId,
|
||||
QtyAvail = currRec.Qty,
|
||||
HMm = currRec.HMm,
|
||||
LMm = currRec.LMm,
|
||||
WMm = currRec.WMm,
|
||||
MatId = matLocalId,
|
||||
IsRemn = currRec.IsRemn,
|
||||
IsActive = currRec.IsActive,
|
||||
UseQty = true,
|
||||
Note = currRec.Note
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conversion of base class to DB model class
|
||||
/// </summary>
|
||||
/// <param name="coreRec"></param>
|
||||
/// <returns></returns>
|
||||
public static RawItemModel ConvToModel(Core.RawPartM coreRec)
|
||||
{
|
||||
RawItemModel answ = new RawItemModel();
|
||||
if (coreRec != null)
|
||||
{
|
||||
answ = new RawItemModel()
|
||||
{
|
||||
RawItemId = coreRec.nId,
|
||||
MatId = coreRec.Material.nId,
|
||||
HMm = (decimal)Math.Round(coreRec.Material.dH,2),
|
||||
LMm = (decimal)Math.Round(coreRec.dL,2),
|
||||
WMm = coreRec.dW > 0 ? (decimal)Math.Round(coreRec.dW,2) : (decimal)Math.Round(coreRec.Material.dW,2),
|
||||
IsActive = coreRec.bActive,
|
||||
UseQty = coreRec.bUseQuantity,
|
||||
QtyAvail = coreRec.nQuantity
|
||||
};
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper conversione a ResourceDTO
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public static ResourceDTO ConvToResDto(RawItemModel currRec)
|
||||
{
|
||||
ResourceDTO answ = new ResourceDTO()
|
||||
{
|
||||
RawItemCloudId = currRec.RawItemCloudId,
|
||||
RawItemLocalId = currRec.RawItemId,
|
||||
Qty = currRec.QtyAvail
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Helper conversione a ResourceDTO con garanzia valori Qty negativi
|
||||
///// </summary>
|
||||
///// <param name="currRec"></param>
|
||||
///// <returns></returns>
|
||||
//public static ResourceDTO ConvToResDtoNeg(RawItemModel currRec)
|
||||
//{
|
||||
// ResourceDTO answ = new ResourceDTO()
|
||||
// {
|
||||
// RawItemCloudId = currRec.RawItemCloudId,
|
||||
// RawItemLocalId = currRec.RawItemId,
|
||||
// Qty = -Math.Abs(currRec.QtyAvail)
|
||||
// };
|
||||
// return answ;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Delete by key
|
||||
/// </summary>
|
||||
/// <param name="RawItemId"></param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteByKey(int RawItemId)
|
||||
{
|
||||
bool done = false;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
var items2del = localDbCtx
|
||||
.RawItemList
|
||||
.Where(x => x.RawItemId == RawItemId);
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
localDbCtx.RawItemList.RemoveRange(items2del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on RawItems.DeleteByKey: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by Key / Core
|
||||
/// </summary>
|
||||
/// <param name="RawItemId"></param>
|
||||
/// <returns></returns>
|
||||
public Core.RawPartM FindByDbId(int RawItemId)
|
||||
{
|
||||
var rawdata = FindByDbIdModel(RawItemId);
|
||||
var result = ConvToCore(rawdata);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by Key / Db Model
|
||||
/// </summary>
|
||||
/// <param name="RawItemId"></param>
|
||||
/// <returns></returns>
|
||||
public RawItemModel FindByDbIdModel(int RawItemId)
|
||||
{
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.RawItemList
|
||||
.Where(x => x.RawItemId == RawItemId)
|
||||
.Include(m => m.MaterialNav)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Material (filtro x MatId) / Core
|
||||
/// </summary>
|
||||
/// <param name="MatId">0 = tutti</param>
|
||||
/// <returns></returns>
|
||||
public List<Core.RawPartM> GetFilt(int MatId)
|
||||
{
|
||||
var rawList = GetFiltModel(MatId);
|
||||
var result = rawList.Select(x => ConvToCore(x)).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Material (filtro x MatId)
|
||||
/// </summary>
|
||||
/// <param name="MatId">0 = tutti</param>
|
||||
/// <returns></returns>
|
||||
public List<RawItemModel> GetFiltModel(int MatId)
|
||||
{
|
||||
// retrieve
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
return localDbCtx
|
||||
.RawItemList
|
||||
.Include(j => j.MaterialNav)
|
||||
.Where(x => MatId == 0 || x.MatId == MatId)
|
||||
.OrderBy(x => x.LMm)
|
||||
.ThenBy(x => x.WMm)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update or insert RawItem record
|
||||
/// </summary>
|
||||
/// <param name="updItem">Recorda da registrare</param>
|
||||
/// <param name="changeUseQty">Indica se, in caso di modifica, vada aggiornato UseQty</param>
|
||||
/// <param name="changeQtyAvail">Indica se, in caso di modifica, vada aggiornato QtyAvail</param>
|
||||
/// <returns></returns>
|
||||
public int Upsert(RawItemModel updItem, bool changeUseQty, bool changeQtyAvail)
|
||||
{
|
||||
int newIdx = 0;
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
var item2update = localDbCtx
|
||||
.RawItemList
|
||||
.Where(x => (updItem.RawItemId > 0 && x.RawItemId == updItem.RawItemId)
|
||||
|| (x.MatId == updItem.MatId && x.WMm == updItem.WMm && x.HMm == updItem.HMm && x.LMm == updItem.LMm))
|
||||
.SingleOrDefault();
|
||||
|
||||
if (item2update != null)
|
||||
{
|
||||
//// update, vers 1...
|
||||
//localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);\
|
||||
item2update.RawItemCloudId = updItem.RawItemCloudId;
|
||||
item2update.HMm = updItem.HMm;
|
||||
item2update.LMm = updItem.LMm;
|
||||
item2update.WMm = updItem.WMm;
|
||||
item2update.IsActive = updItem.IsActive;
|
||||
item2update.IsRemn = updItem.IsRemn;
|
||||
if (changeUseQty)
|
||||
{
|
||||
item2update.UseQty = updItem.UseQty;
|
||||
}
|
||||
if (changeQtyAvail)
|
||||
{
|
||||
item2update.QtyAvail = updItem.QtyAvail;
|
||||
item2update.LastSync = DateTime.Now;
|
||||
}
|
||||
localDbCtx.Entry(item2update).State = EntityState.Modified;
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx.RawItemList.Add(updItem);
|
||||
}
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
if (item2update != null)
|
||||
{
|
||||
newIdx = item2update.RawItemId;
|
||||
}
|
||||
else
|
||||
{
|
||||
newIdx = updItem.RawItemId;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"EXCEPTION on RawItems.Upsert: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update or insert RawItem record from CoreM
|
||||
/// </summary>
|
||||
/// <param name="coreItem"></param>
|
||||
/// <returns></returns>
|
||||
public int Upsert(Core.RawPartM coreItem)
|
||||
{
|
||||
int newIdx = 0;
|
||||
// converto
|
||||
RawItemModel updItem = ConvToModel(coreItem);
|
||||
newIdx = Upsert(updItem, true, true);
|
||||
return newIdx;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,27 +8,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
public class StatusMapController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto statico per gestione chiamate da altre classi
|
||||
/// </summary>
|
||||
public static StatusMapController man = new StatusMapController();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public StatusMapController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -37,7 +21,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <summary>
|
||||
/// Elimina i dati di una sessione (SupervisorId) precedente
|
||||
/// </summary>
|
||||
/// <param name="Session">Se vuoto --> tutti</param>
|
||||
/// <param name="Session">Se vuoto --> tutti</param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteSession(string Session)
|
||||
{
|
||||
@@ -45,41 +29,42 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
DateTime adesso = DateTime.Now;
|
||||
List<StatusMapModel> SM2Del = new List<StatusMapModel>();
|
||||
|
||||
// svuoto la tab mappa precedente (da rivalutare in futuro)
|
||||
if (string.IsNullOrEmpty(Session))
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
SM2Del = dbCtx
|
||||
.StatusMapList
|
||||
.ToList();
|
||||
// svuoto la tab mappa precedente (da rivalutare in futuro)
|
||||
if (string.IsNullOrEmpty(Session))
|
||||
{
|
||||
SM2Del = localDbCtx
|
||||
.StatusMapList
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SM2Del = localDbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.Session == Session)
|
||||
.ToList();
|
||||
}
|
||||
try
|
||||
{
|
||||
// Remove to database
|
||||
localDbCtx.StatusMapList.RemoveRange(SM2Del);
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on StatusMap.DeleteSession: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SM2Del = dbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.Session == Session)
|
||||
.ToList();
|
||||
}
|
||||
try
|
||||
{
|
||||
// Remove to database
|
||||
dbCtx.StatusMapList.RemoveRange(SM2Del);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on DeleteSession: {exc}");
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -87,44 +72,51 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// </summary>
|
||||
/// <param name="Session"></param>
|
||||
/// <returns></returns>
|
||||
public List<StatusMapModel> GetBySession(string Session = "")
|
||||
public List<StatusMapModel> GetBySession(string Session)
|
||||
{
|
||||
// retrieve
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.Session == Session)
|
||||
.OrderByDescending(x => x.Index)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get data for session where Index > minIndex ordered by index DESC
|
||||
/// Get data for session where Index > minIndex ordered by index DESC
|
||||
/// </summary>
|
||||
/// <param name="Session"></param>
|
||||
/// <param name="minIndex"></param>
|
||||
/// <returns></returns>
|
||||
public List<StatusMapModel> GetFrom(int minIndex = 0)
|
||||
public List<StatusMapModel> GetFrom(string Session, int minIndex = 0)
|
||||
{
|
||||
ResetController();
|
||||
// retrieve
|
||||
return dbCtx
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
return localDbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.Index >= minIndex)
|
||||
.Where(x => x.Session == Session && x.Index >= minIndex)
|
||||
.OrderBy(x => x.Index)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get PROD data for session
|
||||
/// Get PROD (all)
|
||||
/// </summary>
|
||||
/// <param name="Session"></param>
|
||||
/// <returns></returns>
|
||||
public List<StatusMapModel> GetProd()
|
||||
{
|
||||
List<StatusMapModel> answ = new List<StatusMapModel>();
|
||||
// Initialize database context
|
||||
using (DatabaseContext myDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// retrieve
|
||||
answ = myDbCtx
|
||||
answ = localDbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod)
|
||||
.OrderByDescending(x => x.Index)
|
||||
@@ -134,12 +126,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reinizializzaizone del controller
|
||||
/// Get PROD for session
|
||||
/// </summary>
|
||||
public void ResetController()
|
||||
/// <param name="Session"></param>
|
||||
/// <returns></returns>
|
||||
public List<StatusMapModel> GetProd(string Session)
|
||||
{
|
||||
// Re-Initialize database context
|
||||
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
List<StatusMapModel> answ = new List<StatusMapModel>();
|
||||
// Initialize database context
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
try
|
||||
{
|
||||
// retrieve
|
||||
answ = localDbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.Session == Session && x.ItemType == Core.StatusMapItemType.Prod)
|
||||
.OrderByDescending(x => x.Index)
|
||||
.ToList();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -163,23 +172,56 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
done = false;
|
||||
// inserisco dato prod
|
||||
StatusMapModel prodSMRecord = new StatusMapModel() { Session = SupervisorId, Index = 0, ItemId = ProdId, ItemType = Core.StatusMapItemType.Prod, Operation = Core.StatusMapOpType.Startup, DtEvent = adesso, Val = "" };
|
||||
// aggiungo
|
||||
dbCtx.StatusMapList.Add(prodSMRecord);
|
||||
// Initialize database context
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// per prima cosa indico come prodotto il PROD...
|
||||
var currProdData = localDbCtx
|
||||
.ProdList
|
||||
.Where(x => x.ProdId == ProdId)
|
||||
.SingleOrDefault();
|
||||
if (currProdData != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// aggiorno valore descrizione
|
||||
currProdData.IsProduced = true;
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on Prod.UpdateProduced:{Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Prod.UpdateProduced: req item was not found | ProdId {ProdId} | IsProduced: true";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
// resetto done
|
||||
done = false;
|
||||
// aggiungo in StatusMap
|
||||
localDbCtx.StatusMapList.Add(prodSMRecord);
|
||||
|
||||
// recupero MachGroup da PROD
|
||||
var MGList = dbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId)
|
||||
.ToList();
|
||||
// recupero MachGroup da PROD
|
||||
var MGList = localDbCtx
|
||||
.MachGroupList
|
||||
.Where(x => x.Prod.ProdId == ProdId)
|
||||
.ToList();
|
||||
|
||||
var mgSMRecords = MGList.Select(x => new StatusMapModel() { Session = SupervisorId, Index = 0, ItemId = x.MachGroupId, ItemType = Core.StatusMapItemType.MachGroup, Operation = Core.StatusMapOpType.Startup, DtEvent = adesso, Val = "" }).ToList();
|
||||
// aggiungo
|
||||
dbCtx.StatusMapList.AddRange(mgSMRecords);
|
||||
var mgSMRecords = MGList.Select(x => new StatusMapModel() { Session = SupervisorId, Index = 0, ItemId = x.MachGroupId, ItemType = Core.StatusMapItemType.MachGroup, Operation = Core.StatusMapOpType.Startup, DtEvent = adesso, Val = "" }).ToList();
|
||||
// aggiungo
|
||||
localDbCtx.StatusMapList.AddRange(mgSMRecords);
|
||||
|
||||
// salvo
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
done = true;
|
||||
// salvo
|
||||
localDbCtx.SaveChanges();
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
@@ -194,56 +236,70 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <param name="Operation"></param>
|
||||
/// <param name="Value"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateAction(String Session, int ProdId, int ItemId, Core.StatusMapItemType ItemType, Core.StatusMapOpType Operation, string Value)
|
||||
public bool UpdateAction(string Session, int ProdId, int ItemId, Core.StatusMapItemType ItemType, Core.StatusMapOpType Operation, string Value)
|
||||
{
|
||||
bool fatto = false;
|
||||
// Recupero il record PROD (che è ultimo indice)
|
||||
StatusMapModel prodData = new StatusMapModel();
|
||||
// se è un prod --> vado x ID
|
||||
if (Session == "")
|
||||
// Initialize database context
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
prodData = dbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.ItemId == ProdId)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
prodData = dbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.Session == Session)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
// se ho trovato
|
||||
if (prodData != null)
|
||||
{
|
||||
try
|
||||
// se è un prod --> vado x ID
|
||||
if (Session == "")
|
||||
{
|
||||
// aggiorno indice PROD
|
||||
prodData.Index++;
|
||||
// se session è nulla ma ho un PROD --> calcolo da li la sessione
|
||||
if (string.IsNullOrEmpty(Session))
|
||||
{
|
||||
Session = prodData.Session;
|
||||
}
|
||||
// creo un nuovo record
|
||||
DateTime adesso = DateTime.Now;
|
||||
var newRec = new StatusMapModel() { Session = Session, Index = prodData.Index, ItemId = ItemId, ItemType = ItemType, Operation = Operation, DtEvent = adesso, Val = Value };
|
||||
dbCtx.StatusMapList.Add(newRec);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
ResetController();
|
||||
fatto = true;
|
||||
prodData = localDbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.ItemId == ProdId)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
catch (Exception exc)
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"EXCEPTION on UpdateAction: {exc}");
|
||||
prodData = localDbCtx
|
||||
.StatusMapList
|
||||
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.Session == Session)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
// se ho trovato
|
||||
if (prodData != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// aggiorno indice PROD
|
||||
prodData.Index++;
|
||||
// se session è nulla ma ho un PROD --> calcolo da li la sessione
|
||||
if (string.IsNullOrEmpty(Session))
|
||||
{
|
||||
Session = prodData.Session;
|
||||
}
|
||||
// creo un nuovo record
|
||||
DateTime adesso = DateTime.Now;
|
||||
var newRec = new StatusMapModel() { Session = Session, Index = prodData.Index, ItemId = ItemId, ItemType = ItemType, Operation = Operation, DtEvent = adesso, Val = Value };
|
||||
localDbCtx.StatusMapList.Add(newRec);
|
||||
|
||||
// Commit changes
|
||||
localDbCtx.SaveChanges();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string errMessage = $"EXCEPTION on StatusMap.UpdateAction: {Environment.NewLine}{exc}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Istanza logger
|
||||
/// </summary>
|
||||
private NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using MySql.Data.EntityFramework;
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Migrations;
|
||||
using MySql.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EgtBEAMWALL.DataLayer.DatabaseModels;
|
||||
using EgtBEAMWALL.DataLayer.Migrations;
|
||||
using System.ServiceProcess;
|
||||
using System.IO;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
using System.IO;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer
|
||||
{
|
||||
#if false
|
||||
//[DbConfigurationType(typeof(MySqlEFConfiguration))]
|
||||
public class aMySqlConfiguration : MySqlEFConfiguration
|
||||
{
|
||||
@@ -25,7 +20,8 @@ namespace EgtBEAMWALL.DataLayer
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[DbConfigurationType(typeof(MySqlEFConfiguration))]
|
||||
public class DatabaseContext : DbContext
|
||||
@@ -33,19 +29,32 @@ namespace EgtBEAMWALL.DataLayer
|
||||
#region Public Constructors
|
||||
|
||||
[Obsolete("This constructor should never be used directly, and is only needed to generate entityframework stuff. Connection string can be adapted as pleased.")]
|
||||
public DatabaseContext() : base("DefaultConnection")
|
||||
public DatabaseContext() : base(DbConfig.CONNECTION_STRING)
|
||||
{
|
||||
}
|
||||
|
||||
public DatabaseContext(string connectionString) : base(connectionString)
|
||||
{
|
||||
//Database.CreateIfNotExists();
|
||||
////Database.SetInitializer(new MigrateDatabaseToLatestVersion<StratonLocalizerDatabase, Migrations.Configuration>());
|
||||
//Database.Initialize(false);
|
||||
Database.CreateIfNotExists();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
#if false
|
||||
// fix valori decimal
|
||||
modelBuilder.Entity<MaterialModel>().Property(x => x.HMm).HasPrecision(18, 6);
|
||||
modelBuilder.Entity<MaterialModel>().Property(x => x.LMm).HasPrecision(18, 6);
|
||||
modelBuilder.Entity<MaterialModel>().Property(x => x.WMm).HasPrecision(18, 6);
|
||||
modelBuilder.Entity<RawItemModel>().Property(x => x.HMm).HasPrecision(18, 6);
|
||||
modelBuilder.Entity<RawItemModel>().Property(x => x.LMm).HasPrecision(18, 6);
|
||||
modelBuilder.Entity<RawItemModel>().Property(x => x.WMm).HasPrecision(18, 6);
|
||||
#endif
|
||||
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
@@ -88,26 +97,29 @@ namespace EgtBEAMWALL.DataLayer
|
||||
/// </summary>
|
||||
public DbSet<StatusMapModel> StatusMapList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Wharehouse materials management
|
||||
/// </summary>
|
||||
public DbSet<MaterialModel> MaterialsList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Wharehouse items management
|
||||
/// </summary>
|
||||
public DbSet<RawItemModel> RawItemList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alias management
|
||||
/// </summary>
|
||||
public DbSet<AliasModel> AliasList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Alias management
|
||||
/// </summary>
|
||||
public DbSet<MagmanSyncModel> SyncList { get; set; }
|
||||
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private static string getDbServiceName()
|
||||
{
|
||||
ServiceController[] services = ServiceController.GetServices();
|
||||
var service = services.FirstOrDefault(s => s.ServiceName == "MariaDB");
|
||||
if (service != null)
|
||||
return service.DisplayName;
|
||||
|
||||
service = services.FirstOrDefault(s => s.ServiceName == "MySQL");
|
||||
if (service != null)
|
||||
return service.DisplayName;
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public static DatabaseContext Create()
|
||||
@@ -115,44 +127,6 @@ namespace EgtBEAMWALL.DataLayer
|
||||
return new DatabaseContext(DbConfig.CONNECTION_STRING);
|
||||
}
|
||||
|
||||
public static bool SetUpDbConnectionAndDbConfig()
|
||||
{
|
||||
try
|
||||
{
|
||||
String serviceName = getDbServiceName();
|
||||
if (serviceName.Equals(""))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ServiceController service = new ServiceController(serviceName);
|
||||
try
|
||||
{
|
||||
TimeSpan timeout = TimeSpan.FromSeconds(DbConfig.DATABASE_PROCESS_TIMEOUT);
|
||||
service.WaitForStatus(ServiceControllerStatus.Running, timeout);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
System.Data.Entity.Database.SetInitializer<DatabaseContext>(null);
|
||||
var migrator = new DbMigrator(new Configuration());
|
||||
|
||||
if (migrator.GetPendingMigrations().Any())
|
||||
{
|
||||
// Run migrations and seed.
|
||||
migrator.Update();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("AliasList")]
|
||||
public class AliasModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Famiglia di sinonimi
|
||||
/// </summary>
|
||||
[Column("Family", Order = 1), Key]
|
||||
public string Family { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Codice originale (da trasformare)
|
||||
/// </summary>
|
||||
[Column("ValueOriginal", Order = 2), Key]
|
||||
public string ValueOriginal { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Codice Alias in cui viene convertito
|
||||
/// </summary>
|
||||
public string ValueAlias { get; set; } = "";
|
||||
|
||||
}
|
||||
}
|
||||
@@ -16,94 +16,54 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Codice Allarme
|
||||
/// Chiave primaria evento LOG
|
||||
/// </summary>
|
||||
[Column("AlarmCode")]
|
||||
public string AlarmCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Data Evento
|
||||
/// </summary>
|
||||
[Column("AlarmDtEvent")]
|
||||
public DateTime AlarmDatetime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Messaggio Allarme
|
||||
/// </summary>
|
||||
[Column("AlarmMessage")]
|
||||
public string AlarmMessage { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Alarm Operation
|
||||
/// </summary>
|
||||
[Column("AlarmOperation")]
|
||||
public int AlarmOperation { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Alarm Type
|
||||
/// </summary>
|
||||
[Column("AlarmType")]
|
||||
public int AlarmType { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Esaecuzione comando corretta
|
||||
/// </summary>
|
||||
[Column("CommExecuted")]
|
||||
public bool CommandExecutedCorrectly { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Stato da enum Core
|
||||
/// </summary>
|
||||
[Column("CommandState")]
|
||||
public Core.ConstMachComm.CommandStates CommandState { get; set; } = Core.ConstMachComm.CommandStates.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Tipo Comando da enum Core
|
||||
/// </summary>
|
||||
[Column("CommandType")]
|
||||
public Core.ConstMachComm.LogCommandTypes CommandType { get; set; } = Core.ConstMachComm.LogCommandTypes.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione
|
||||
/// </summary>
|
||||
[Column("Description")]
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
[Key, Column("DbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int LogDbId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// New OP State
|
||||
/// </summary>
|
||||
[Column("NewOpState")]
|
||||
public int NewOpState { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Stato da enum Core
|
||||
/// </summary>
|
||||
[Column("ResultType")]
|
||||
public Core.ConstMachComm.ResultTypes ResultType { get; set; } = Core.ConstMachComm.ResultTypes.NULL;
|
||||
[Column("EvType")]
|
||||
public Core.MachLog.MachLogTypes EvType { get; set; } = Core.MachLog.MachLogTypes.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Indirizzo VAR
|
||||
/// Data Evento
|
||||
/// </summary>
|
||||
[Column("VarAddress")]
|
||||
public string VarAddress { get; set; } = "";
|
||||
[Column("DtEvent")]
|
||||
public DateTime DtEvent { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Valore VAR
|
||||
/// Key prod attivo (DB locale)
|
||||
/// </summary>
|
||||
[Column("ProdId")]
|
||||
public int ProdId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Key progetto (cloud)
|
||||
/// </summary>
|
||||
[Column("ProjCloudId")]
|
||||
public int ProjCloudId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ID Supervisore (Indirizzo VAR)
|
||||
/// </summary>
|
||||
[Column("SupervId")]
|
||||
public string SupervId { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Valore VAR (oggetto del log da decodificare)
|
||||
/// </summary>
|
||||
[Column("VarValue")]
|
||||
public string VarValue { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Data di invio evento (su cloud)
|
||||
/// </summary>
|
||||
[Column("DtSent")]
|
||||
public DateTime? DtSent { get; set; } = null;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// MachineId del BTL
|
||||
/// </summary>
|
||||
[Column("MachineId")]
|
||||
public string MachineId { get; set; } = "";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("MagmanSync")]
|
||||
public partial class MagmanSyncModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Primary Key AUTO
|
||||
/// </summary>
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int SyncId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia Sync
|
||||
/// </summary>
|
||||
public string SyncType { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Id riferimento remoto cloud x invio (es ProjCloudId)
|
||||
/// </summary>
|
||||
public int CloudId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra inserimento richiesta
|
||||
/// </summary>
|
||||
public DateTime DtReq { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra esecuzione richiesta
|
||||
/// </summary>
|
||||
public DateTime? DtExe { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Payload trasmesso/da trasmettere (serializzato)
|
||||
/// </summary>
|
||||
public string Payload { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Record inviato se DtExe != null && >= dtReq
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public bool Sent
|
||||
{
|
||||
get => DtExe != null && DtExe > DtReq;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("MaterialsList")]
|
||||
public partial class MaterialModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Init classe
|
||||
/// </summary>
|
||||
public MaterialModel()
|
||||
{
|
||||
RawItemList = new HashSet<RawItemModel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Primary Key AUTO
|
||||
/// </summary>
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int MatId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Codice materiale (Identificativo DB esterno del magazzino in sync)
|
||||
/// </summary>
|
||||
public int MatCloudId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Codice Materiale
|
||||
/// </summary>
|
||||
public string MatCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione Materiale
|
||||
/// </summary>
|
||||
public string MatDesc { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Lenght/Lunghezza in mm
|
||||
/// </summary>
|
||||
public decimal LMm { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Width/Larghezza in mm
|
||||
/// </summary>
|
||||
public decimal WMm { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Height (Thikness/Spessore) in mm
|
||||
/// </summary>
|
||||
public decimal HMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ID dell'ultimo articolo (variante) usato per il materiale
|
||||
/// </summary>
|
||||
public int RawItemIdLast { get; set; } = 0;
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Lenght/Lunghezza in inch
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public decimal LIn
|
||||
{
|
||||
get => Math.Round(LMm / (decimal)25.4, 3);
|
||||
}
|
||||
/// <summary>
|
||||
/// Width/Larghezza in inch
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public decimal WIn
|
||||
{
|
||||
get => Math.Round(WMm / (decimal)25.4, 3);
|
||||
}
|
||||
/// <summary>
|
||||
/// Height/Altezza (Thikness/Spessore) in inch
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public decimal HIn
|
||||
{
|
||||
get => Math.Round(HMm / (decimal)25.4, 3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Codice materiale x QR/Datamatrix
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public string MatDtmx
|
||||
{
|
||||
get => $"MT{MatExtId:00000000}";
|
||||
}
|
||||
#endif
|
||||
/// <summary>
|
||||
/// Verifica che sia Beam, quando L == 0
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public bool IsBeam
|
||||
{
|
||||
get => (LMm == 0 && (HMm > 0 && WMm > 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica che sia Wall, quando W/L == 0
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public bool IsWall
|
||||
{
|
||||
get => (LMm == 0 && WMm == 0);
|
||||
}
|
||||
|
||||
public virtual ICollection<RawItemModel> RawItemList { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Tabelal delle singole istsanze prodotte\
|
||||
/// Tabella delle singole istanze prodotte
|
||||
/// </summary>
|
||||
[Table("PartList")]
|
||||
public class PartModel
|
||||
@@ -97,6 +97,8 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
if (!(obj is PartModel item))
|
||||
return false;
|
||||
|
||||
if (BTLPartDbId != item.BTLPartDbId)
|
||||
return false;
|
||||
if (H != item.H)
|
||||
return false;
|
||||
if (L != item.L)
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using static EgtBEAMWALL.Core.ConstBeam;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
/// <summary>
|
||||
/// Tabella deiu raggruppamenti PROJ in forma di PROD
|
||||
/// </summary>
|
||||
@@ -16,12 +17,24 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public ProdModel()
|
||||
{
|
||||
ProjListNav = new HashSet<ProjModel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiave univoca DB
|
||||
/// </summary>
|
||||
[Key, Column("ProdDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProdDbId { get; set; }
|
||||
|
||||
[Column("Description")]
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Data Creazione
|
||||
/// </summary>
|
||||
[Index]
|
||||
[Column("DtCreated")]
|
||||
public DateTime DtCreated { get; set; }
|
||||
|
||||
@@ -32,11 +45,28 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
public bool IsNew { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Stato locked (quando aperto da un dispositivo in rete)
|
||||
/// Stato locked, quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("Lock")]
|
||||
public bool Locked { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Chiave univoca per EgtBM
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
[Index]
|
||||
public int ProdId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Codice Proj per sync info (Identificativo DB esterno del magazzino in sync)
|
||||
/// </summary>
|
||||
public int ProjCloudId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia del progetto (Travi, Pareti, ...)
|
||||
/// </summary>
|
||||
public BWType PType { get; set; } = BWType.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// </summary>
|
||||
@@ -44,21 +74,42 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
public string Machine { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Chiave univoca DB
|
||||
/// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
[Key, Column("ProdDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProdDbId { get; set; }
|
||||
[Column("LockedBy")]
|
||||
public string LockedBy { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// chiave univoca per EgtBM
|
||||
/// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
public int ProdId { get; set; }
|
||||
[Column("LockDate")]
|
||||
public DateTime LockDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia del progetto (Travi, Pareti, ...)
|
||||
/// Record attivo (se false == cancellazione logica)
|
||||
/// </summary>
|
||||
public BWType PType { get; set; } = BWType.NULL;
|
||||
[Index]
|
||||
[Column("IsActive")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Stato Prodotto = inviato ALMENO UNA VOLTA al supervisore --> NON eliminabile se non in modo logico
|
||||
/// </summary>
|
||||
[Index]
|
||||
[Column("IsProduced")]
|
||||
public bool IsProduced { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto
|
||||
/// </summary>
|
||||
[Index]
|
||||
[Column("IsArchived")]
|
||||
public bool IsArchived { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Collezione oggetti Proj associati (almeno 1 by design)
|
||||
/// </summary>
|
||||
public virtual ICollection<ProjModel> ProjListNav { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using static EgtBEAMWALL.Core.ConstBeam;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
/// <summary>
|
||||
/// Tabella dei PROJ caricati dal BTL
|
||||
/// </summary>
|
||||
@@ -16,6 +16,9 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProjDbId { get; set; }
|
||||
|
||||
[Column("BTLFileName")]
|
||||
public string BTLFileName { get; set; } = "";
|
||||
|
||||
@@ -23,17 +26,20 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
/// Data Creazione
|
||||
/// </summary>
|
||||
[Column("DtCreated")]
|
||||
[Index]
|
||||
public DateTime DtCreated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data Esportazione
|
||||
/// </summary>
|
||||
[Column("DtExported")]
|
||||
[Index]
|
||||
public DateTime DtExported { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Stato NEW = creato ma NON salvato
|
||||
/// </summary>
|
||||
[Index]
|
||||
[Column("IsNew")]
|
||||
public bool IsNew { get; set; } = true;
|
||||
|
||||
@@ -49,29 +55,67 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
[Column("Lock")]
|
||||
public bool Locked { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// </summary>
|
||||
[Column("Machine")]
|
||||
public string Machine { get; set; } = "";
|
||||
|
||||
[ForeignKey("ProdDbId")]
|
||||
public virtual ProdModel Prod { get; set; }
|
||||
|
||||
[Column("ProdDbId")]
|
||||
public int? ProdDbId { get; set; }
|
||||
|
||||
[Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ProjDbId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ID da modello ext
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
[Index]
|
||||
public int ProjId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Codice Proj per sync info (Identificativo DB esterno del magazzino in sync)
|
||||
/// </summary>
|
||||
public int ProjCloudId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia del progetto (Travi, Pareti, ...)
|
||||
/// </summary>
|
||||
public BWType PType { get; set; } = BWType.NULL;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// </summary>
|
||||
[Column("Machine")]
|
||||
public string Machine { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// ID utente che ha bloccato (NumKey), quando aperto da un dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("LockedBy")]
|
||||
public string LockedBy { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// DataOra ultima operazione di Lock (o di rimozione di lock), quando aperto da un
|
||||
/// dispositivo in rete
|
||||
/// </summary>
|
||||
[Column("LockDate")]
|
||||
public DateTime LockDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// Record attivo (se false == cancellazione logica)
|
||||
/// </summary>
|
||||
[Index]
|
||||
[Column("IsActive")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
/// <summary>
|
||||
/// Descrizione progetto (copiata da BTLFileName inizialmente)
|
||||
/// </summary>
|
||||
[Column("ProjDescription")]
|
||||
public string ProjDescription { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto
|
||||
/// </summary>
|
||||
[Index]
|
||||
[Column("IsArchived")]
|
||||
public bool IsArchived { get; set; } = false;
|
||||
|
||||
[ForeignKey("ProdDbId")]
|
||||
public virtual ProdModel Prod { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
//[Index(nameof(Installazione), nameof(Active), nameof(DiskStatus))]
|
||||
[Table("RawItemList")]
|
||||
public partial class RawItemModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Primary Key AUTO
|
||||
/// </summary>
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int RawItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Codice RawMat univoco e in sync (Identificativo DB esterno del magazzino in sync)
|
||||
/// </summary>
|
||||
public int RawItemCloudId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ForeignKey Materiale
|
||||
/// </summary>
|
||||
public int MatId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Qty available on wharehouse
|
||||
/// </summary>
|
||||
public int QtyAvail { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Active/ = can be used
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Remnant
|
||||
/// </summary>
|
||||
public bool IsRemn { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Lenght
|
||||
/// </summary>
|
||||
public decimal LMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Width
|
||||
/// </summary>
|
||||
public decimal WMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Item's Height (Thikness/Spessore) in mm
|
||||
/// </summary>
|
||||
public decimal HMm { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Note (optional)
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Indica se debba usare qty effettiva o indefinita (x nesting/schedulazione a capacita illimitata)
|
||||
/// </summary>
|
||||
public bool UseQty { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra ultimo aggiornamento dal cloud dei dati (in particolare giacenza)
|
||||
/// </summary>
|
||||
public DateTime LastSync { get; set; } = DateTime.Today.AddYears(-10);
|
||||
|
||||
#if false
|
||||
[NotMapped]
|
||||
public decimal LIn
|
||||
{
|
||||
get => Math.Round(LMm / (decimal)25.4, 3);
|
||||
}
|
||||
[NotMapped]
|
||||
public decimal WIn
|
||||
{
|
||||
get => Math.Round(WMm / (decimal)25.4, 3);
|
||||
}
|
||||
[NotMapped]
|
||||
public decimal HIn
|
||||
{
|
||||
get => Math.Round(HMm / (decimal)25.4, 3);
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public decimal Area
|
||||
{
|
||||
get => LMm * WMm;
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public string ItemDtmx
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = $"MT99999999-{LMm * 1000:00000000}";
|
||||
if (MaterialNav != null)
|
||||
{
|
||||
answ = $"MT{MaterialNav.MatExtId:00000000}-{LMm * 1000:00000000}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Navigation property to Material
|
||||
/// </summary>
|
||||
[ForeignKey("MatId")]
|
||||
public virtual MaterialModel MaterialNav { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ionic.Zip;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace EgtBEAMWALL.DataLayer
|
||||
{
|
||||
@@ -18,42 +21,280 @@ namespace EgtBEAMWALL.DataLayer
|
||||
public static string DATABASE_SERV = "127.0.0.1";
|
||||
|
||||
public static string DATABASE_USER = "EgtUser";
|
||||
public static string ZIP_PWD = "viacremasca-viacremasca-viacremasca-viacremasca";
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// DB Connection string per azioni amministrative
|
||||
/// DB Connection string per azioni amministrative:
|
||||
/// aggiunto parametro "allow user variables", da https://forums.mysql.com/read.php?38,609672,610320#msg-610320
|
||||
/// </summary>
|
||||
public static string ADMIN_CONNECTION_STRING { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// DB Connection string
|
||||
/// DB Connection string, per effettuare migration riportare valore connessione admin cablato
|
||||
/// DB Manu: server=localhost;port=3306;database=EgtBwDb_000102;uid=root;pwd=Egalware_24068!;
|
||||
/// DB Sam: server=localhost;port=3306;database=EgtBwDb_000470;uid=root;pwd=Egalware_24068!;
|
||||
/// DB Lovato: server=localhost;port=3306;database=EgtBwDb_000656;uid=root;pwd=Egalware_24068!;
|
||||
///
|
||||
/// DB RETE Lovato: server=mdb.ufficio;port=3306;database=EgtBwDb_000656;uid=steamware;pwd=Egalware_24068!;
|
||||
/// DB TET corelocal: server=corelocal.egalware.com;port=3306;database=EgtBwDb_000999;uid=steamware;pwd=Egalware_24068!;
|
||||
/// </summary>
|
||||
public static string CONNECTION_STRING { get; set; } = "";
|
||||
//public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000470;uid=root;pwd=Egalware_24068!;allow user variables=true";
|
||||
|
||||
//public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000656;uid=root;pwd=Egalware_24068!;allow user variables=true";
|
||||
//public static string CONNECTION_STRING { get; set; } = "server=corelocal.egalware.com;port=3306;database=EgtBwDb_000656;uid=root;pwd=Egalware_24068!;allow user variables=true";
|
||||
//public static string CONNECTION_STRING { get; set; } = "server=mdb.ufficio;port=3306;database=EgtBwDb_000656;uid=steamware;pwd=Egalware_24068!;allow user variables=true";
|
||||
|
||||
public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000656;uid=root;pwd=Egalware_24068!;allow user variables=true";
|
||||
//public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000102;uid=root;pwd=Egalware_24068!;allow user variables=true";
|
||||
//public static string CONNECTION_STRING { get; set; } = "server=localhost;port=3306;database=EgtBwDb_000999;uid=root;pwd=Egalware_24068!;allow user variables=true";
|
||||
//public static string CONNECTION_STRING { get; set; } = "server=corelocal.egalware.com;port=3306;database=EgtBwDb_000999;uid=root;pwd=Egalware_24068!;allow user variables=true";
|
||||
//public static string CONNECTION_STRING { get; set; } = "server=mdb.ufficio;port=3306;database=EgtBwDb_000999;uid=steamware;pwd=Egalware_24068!;allow user variables=true";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public static void InitDb(string server, string nKey, string sKey)
|
||||
/// <summary>
|
||||
/// Effettua migrazione esplicita del DB
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool CheckMigrateDb()
|
||||
{
|
||||
DATABASE_SERV = server;
|
||||
DATABASE_NAME = $"EgtBwDb_{nKey}";
|
||||
DATABASE_USER = $"user_{nKey}";
|
||||
DATABASE_PWD = $"pwd_{sKey}";
|
||||
CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None";
|
||||
// stringa admin con utente root egalware...
|
||||
ADMIN_CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database=mysql;uid=root;pwd=Egalware_24068!;sslmode=None;CHARSET=utf8";
|
||||
// esecuzione script di migrations del DB
|
||||
return Controllers.DbController.man.checkMigrateDb();
|
||||
}
|
||||
|
||||
public static bool CheckUser(string nKey, string sKey)
|
||||
{
|
||||
// esecuzione script di install locale
|
||||
return Controllers.DbController.man.checkCreateUser(DATABASE_USER, DATABASE_PWD);
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua verifica presenza utente
|
||||
/// </summary>
|
||||
/// <param name="nKey"></param>
|
||||
/// <param name="sKey"></param>
|
||||
/// <param name="isNetwork"></param>
|
||||
/// <returns></returns>
|
||||
public static bool CheckUser(string nKey, string sKey, bool isNetwork)
|
||||
{
|
||||
// esecuzione script di install locale
|
||||
return Controllers.DbController.man.checkCreateUser(DATABASE_USER, DATABASE_PWD, isNetwork);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua verifica presenza view prod + relativo utente
|
||||
/// </summary>
|
||||
/// <param name="nKey"></param>
|
||||
/// <param name="sKey"></param>
|
||||
/// <param name="isNetwork"></param>
|
||||
/// <returns></returns>
|
||||
public static bool CheckViews(string nKey, string sKey)
|
||||
{
|
||||
return false;
|
||||
// commento, scambiare con migrations da file?!?
|
||||
//// esecuzione script di install locale
|
||||
//return Controllers.DbController.man.refreshViews(DATABASE_NAME);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua DUMP del DB dato utente admin + percorso salvataggio (zip cifrato)
|
||||
/// </summary>
|
||||
/// <param name="zipFilePath">Percorso di salvataggio del dump (*.zip)</param>
|
||||
/// <param name="dbName">Nome del DB da processare (se vuoto quello di default calcolato)</param>
|
||||
/// <param name="mysqlDumpPath">Nome o Percorso Eseguibile mysqldump (opzionale)</param>
|
||||
/// <param name="exportOpt">Opzioni in fase di export | default: --add-drop-database --skip-extended-insert --hex-blob</param>
|
||||
/// <returns></returns>
|
||||
public static bool DataBaseDumpToFile(string zipFilePath, string dbName = "", string mysqlDumpPath = "mysqldump", string exportOpt = "--add-drop-database --skip-extended-insert --hex-blob")
|
||||
{
|
||||
bool fatto = false;
|
||||
// fix path eseguibile
|
||||
if (string.IsNullOrEmpty(mysqlDumpPath))
|
||||
{
|
||||
mysqlDumpPath = "mysqldump";
|
||||
}
|
||||
if (string.IsNullOrEmpty(dbName))
|
||||
{
|
||||
dbName = DATABASE_NAME;
|
||||
}
|
||||
// verifica zip finale
|
||||
if (!zipFilePath.EndsWith(".zip"))
|
||||
{
|
||||
zipFilePath = $"{zipFilePath}.zip";
|
||||
}
|
||||
// creo nome file per export sql (temporaneo)
|
||||
string tempSqlPath = zipFilePath.Replace(".zip", ".sql");
|
||||
// esecuzione script x dump del DB
|
||||
string dirPath = Path.GetDirectoryName(zipFilePath);
|
||||
if (!Directory.Exists(dirPath))
|
||||
{
|
||||
Directory.CreateDirectory(dirPath);
|
||||
}
|
||||
// se ci fosse già file elimino (sql/zip)
|
||||
if (File.Exists(tempSqlPath))
|
||||
{
|
||||
File.Delete(tempSqlPath);
|
||||
}
|
||||
if (File.Exists(zipFilePath))
|
||||
{
|
||||
File.Delete(zipFilePath);
|
||||
}
|
||||
// 2024.06.28 aggiunto --hex-blob x dati binary
|
||||
// creazione SQL, tramite script esterno... importante parametro "--skip-extended-insert" altrimenti problemi con restore (anche se + verboso e lento in backup...)
|
||||
string callScript = $"\"{mysqlDumpPath}\" -u{DATABASE_USER} -p{DATABASE_PWD} --databases {dbName} {exportOpt} > {tempSqlPath}";
|
||||
ExecuteCommand(callScript);
|
||||
// compressione con pwd!
|
||||
using (ZipFile zip = new ZipFile())
|
||||
{
|
||||
// non paiono necessarie x ripristino
|
||||
//zip.CompressionMethod = CompressionMethod.BZip2;
|
||||
//zip.UseUnicodeAsNecessary = true;
|
||||
// aggiungo pwd
|
||||
zip.Password = ZIP_PWD;
|
||||
// inserisco file
|
||||
zip.AddFile(tempSqlPath, "");
|
||||
zip.Save(zipFilePath);
|
||||
fatto = true;
|
||||
}
|
||||
// elimino file sql temporaneo...
|
||||
if (File.Exists(tempSqlPath))
|
||||
{
|
||||
File.Delete(tempSqlPath);
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua restore come overwrite del DB di DEFAULT... irreversibile
|
||||
/// </summary>
|
||||
/// <param name="zipFilePath">Percorso di lettura del dump cifrato (*.zip)</param>
|
||||
/// <param name="dbName">Nome del DB da processare (se vuoto quello di default calcolato)</param>
|
||||
/// <param name="tempFolder">Percorso cartella temp x esecuzione</param>
|
||||
/// <param name="mysqlPath">Nome o Percorso Eseguibile mysql (opzionale)</param>
|
||||
/// <param name="importOpt">Opzioni in fase di import (default: --force)</param>
|
||||
/// <returns></returns>
|
||||
public static bool DataBaseRestoreFromFile(string zipFilePath, string dbName = "", string tempFolder="", string mysqlPath = "mysql", string importOpt = "--force")
|
||||
{
|
||||
bool fatto = false;
|
||||
// fix path eseguibile
|
||||
if (string.IsNullOrEmpty(mysqlPath))
|
||||
{
|
||||
mysqlPath = "mysql";
|
||||
}
|
||||
if (string.IsNullOrEmpty(dbName))
|
||||
{
|
||||
dbName = DATABASE_NAME;
|
||||
}
|
||||
if (string.IsNullOrEmpty(tempFolder))
|
||||
{
|
||||
tempFolder = "C:\\Temp";
|
||||
}
|
||||
// verifica zip finale
|
||||
if (!zipFilePath.EndsWith(".zip"))
|
||||
{
|
||||
zipFilePath = $"{zipFilePath}.zip";
|
||||
}
|
||||
// elimino eventuale temp folder precedente...
|
||||
if (Directory.Exists(tempFolder))
|
||||
{
|
||||
Directory.Delete(tempFolder, true);
|
||||
}
|
||||
Directory.CreateDirectory(tempFolder);
|
||||
// scompatto file zip --> sql
|
||||
using (ZipFile zip = ZipFile.Read(zipFilePath))
|
||||
{
|
||||
zip.Password = ZIP_PWD;
|
||||
zip.ExtractAll(tempFolder, ExtractExistingFileAction.OverwriteSilently);
|
||||
}
|
||||
// verifico che ci sia 1 file sql...
|
||||
var sqlFiles = Directory.GetFiles(tempFolder, "*.sql");
|
||||
if (sqlFiles != null && sqlFiles.Length == 1)
|
||||
{
|
||||
// verifico nome file per export sql (temporaneo)
|
||||
string tempSqlPath = sqlFiles.FirstOrDefault();
|
||||
// chiamo script esterno...
|
||||
string callScript = $"\"{mysqlPath}\" -u{DATABASE_USER} -p{DATABASE_PWD} {importOpt} {dbName} < {tempSqlPath}";
|
||||
ExecuteCommand(callScript);
|
||||
// elimino il file sql importato...
|
||||
File.Delete(tempSqlPath);
|
||||
// elimino temp folder...
|
||||
Directory.Delete(tempFolder, true);
|
||||
fatto = true;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esecuzione di un comando esterno
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
public static void ExecuteCommand(string command)
|
||||
{
|
||||
int exitCode;
|
||||
ProcessStartInfo processInfo;
|
||||
Process process;
|
||||
|
||||
processInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
|
||||
processInfo.CreateNoWindow = true;
|
||||
processInfo.UseShellExecute = false;
|
||||
// *** Redirect the output ***
|
||||
processInfo.RedirectStandardError = true;
|
||||
processInfo.RedirectStandardOutput = true;
|
||||
|
||||
process = Process.Start(processInfo);
|
||||
process.WaitForExit();
|
||||
|
||||
// *** Read the streams ***
|
||||
// Warning: This approach can lead to deadlocks, see Edit #2
|
||||
string output = process.StandardOutput.ReadToEnd();
|
||||
string error = process.StandardError.ReadToEnd();
|
||||
|
||||
exitCode = process.ExitCode;
|
||||
|
||||
Console.WriteLine("output>>" + (String.IsNullOrEmpty(output) ? "(none)" : output));
|
||||
Console.WriteLine("error>>" + (String.IsNullOrEmpty(error) ? "(none)" : error));
|
||||
Console.WriteLine("ExitCode: " + exitCode.ToString(), "ExecuteCommand");
|
||||
process.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo di init standard per DB in rete con Master_Key
|
||||
/// </summary>
|
||||
/// <param name="server">Indirizzo del server (tipicamente indirizzo di rete)</param>
|
||||
/// <param name="nKey">Numero chiave</param>
|
||||
/// <param name="sKey">Codice/pwd associato a chiave</param>
|
||||
/// <param name="masterKey">Numero di chiave master con cui è creato il DB</param>
|
||||
public static void InitDb(string server, string nKey, string sKey, string masterKey = "")
|
||||
{
|
||||
// se nulla metto amster come nKey...
|
||||
masterKey = string.IsNullOrEmpty(masterKey) ? nKey : masterKey;
|
||||
DATABASE_SERV = server;
|
||||
DATABASE_NAME = $"EgtBwDb_{masterKey}";
|
||||
DATABASE_USER = $"user_{nKey}";
|
||||
DATABASE_PWD = $"pwd_{sKey}";
|
||||
ZIP_PWD = $"{DATABASE_USER}:{DATABASE_PWD}:{DATABASE_USER}:{DATABASE_PWD}";
|
||||
CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};SslMode=None;allow user variables=true";
|
||||
// stringa admin con utente root egalware...
|
||||
ADMIN_CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database=mysql;uid=root;pwd=Egalware_24068!;SslMode=none;CHARSET=utf8;allow user variables=true";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna conf NLog x target DIR
|
||||
/// </summary>
|
||||
/// <param name="logDir"></param>
|
||||
public static void SetupLogDir(string logDir)
|
||||
{
|
||||
string appDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
string filePath = Path.Combine(appDir, "NLog.config");
|
||||
// leggo il file NLog
|
||||
string rawData = File.ReadAllText(filePath);
|
||||
|
||||
// sostituzione livello minimo da selezione
|
||||
rawData = rawData.Replace("${basedir}", logDir);
|
||||
|
||||
// ri-scrivo file NLog
|
||||
File.WriteAllText(filePath, rawData);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ namespace EgtBEAMWALL.DataLayer
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public static DbManager obj = new DbManager();
|
||||
public Controllers.BTLPartController BtlPartCtr = new Controllers.BTLPartController();
|
||||
public Controllers.LogMachineController LogMacCtr = new Controllers.LogMachineController();
|
||||
public Controllers.LogSupportController LogSupCtr = new Controllers.LogSupportController();
|
||||
|
||||
@@ -37,8 +37,17 @@
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\BouncyCastle.Cryptography.2.4.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DotNetZip, Version=1.16.0.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgtWPFLib5">
|
||||
<HintPath>..\..\..\EgtProg\DllD32\EgtWPFLib5.dll</HintPath>
|
||||
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgwProxy.MagMan, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.MagMan.1.0.2406.2911\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||
@@ -46,36 +55,115 @@
|
||||
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.6.10.9\lib\net452\MySql.Data.dll</HintPath>
|
||||
<Reference Include="Google.Protobuf, Version=3.27.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Google.Protobuf.3.27.0\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.Entity.6.10.9\lib\net452\MySql.Data.Entity.EF6.dll</HintPath>
|
||||
<Reference Include="K4os.Compression.LZ4, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.1.3.8\lib\net462\K4os.Compression.LZ4.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.8\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=8.4.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.4.0\lib\net462\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data.EntityFramework, Version=8.4.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.EntityFramework.8.4.0\lib\net462\MySql.Data.EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.3.2\lib\net46\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Renci.SshNet, Version=2024.0.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SSH.NET.2024.0.0\lib\net462\Renci.SshNet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp, Version=111.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.111.2.0\lib\net471\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Configuration.ConfigurationManager, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Configuration.ConfigurationManager.8.0.0\lib\net462\System.Configuration.ConfigurationManager.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Drawing.Design" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Pipelines, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Pipelines.8.0.0\lib\net462\System.IO.Pipelines.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Json, Version=8.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Json.8.0.3\lib\net462\System.Text.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="ZstdSharp, Version=0.8.1.0, Culture=neutral, PublicKeyToken=8d151af33a4ad5cf, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ZstdSharp.Port.0.8.1\lib\net462\ZstdSharp.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminContext.cs" />
|
||||
<Compile Include="Controllers\MagmanSyncController.cs" />
|
||||
<Compile Include="Controllers\MagmanController.cs" />
|
||||
<Compile Include="Controllers\AliasController.cs" />
|
||||
<Compile Include="Controllers\RawItemsController.cs" />
|
||||
<Compile Include="Controllers\MaterialsController.cs" />
|
||||
<Compile Include="DatabaseModels\AliasModel.cs" />
|
||||
<Compile Include="DatabaseModels\MagmanSyncModel.cs" />
|
||||
<Compile Include="DatabaseModels\MaterialModel.cs" />
|
||||
<Compile Include="DatabaseModels\RawItemModel.cs" />
|
||||
<Compile Include="DatabaseModels\UserPrivModel.cs" />
|
||||
<Compile Include="DbConfig.cs" />
|
||||
<Compile Include="Controllers\LogMachineController.cs" />
|
||||
@@ -121,12 +209,79 @@
|
||||
<Compile Include="Migrations\202109141058345_AddMachine2ProjProd.designer.cs">
|
||||
<DependentUpon>202109141058345_AddMachine2ProjProd.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202207051703296_UpgradeLockModel.cs" />
|
||||
<Compile Include="Migrations\202207051703296_UpgradeLockModel.designer.cs">
|
||||
<DependentUpon>202207051703296_UpgradeLockModel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202306081452095_UpdateProjModel.cs" />
|
||||
<Compile Include="Migrations\202306081452095_UpdateProjModel.designer.cs">
|
||||
<DependentUpon>202306081452095_UpdateProjModel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202308241516227_AddProdStatusVarAndIndex.cs" />
|
||||
<Compile Include="Migrations\202308241516227_AddProdStatusVarAndIndex.designer.cs">
|
||||
<DependentUpon>202308241516227_AddProdStatusVarAndIndex.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202308250853396_AddProjArchivedField.cs" />
|
||||
<Compile Include="Migrations\202308250853396_AddProjArchivedField.designer.cs">
|
||||
<DependentUpon>202308250853396_AddProjArchivedField.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202401181534084_AddAliasMaterialRawItemsModel.cs" />
|
||||
<Compile Include="Migrations\202401181534084_AddAliasMaterialRawItemsModel.designer.cs">
|
||||
<DependentUpon>202401181534084_AddAliasMaterialRawItemsModel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202401291722150_FixMatItemCloudId.cs" />
|
||||
<Compile Include="Migrations\202401291722150_FixMatItemCloudId.designer.cs">
|
||||
<DependentUpon>202401291722150_FixMatItemCloudId.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202401310830146_FixItemRemn.cs" />
|
||||
<Compile Include="Migrations\202401310830146_FixItemRemn.designer.cs">
|
||||
<DependentUpon>202401310830146_FixItemRemn.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202402141003461_RawItemAddUseQty.cs" />
|
||||
<Compile Include="Migrations\202402141003461_RawItemAddUseQty.designer.cs">
|
||||
<DependentUpon>202402141003461_RawItemAddUseQty.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202402290716188_AddProjCloudId.cs" />
|
||||
<Compile Include="Migrations\202402290716188_AddProjCloudId.Designer.cs">
|
||||
<DependentUpon>202402290716188_AddProjCloudId.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202403120645357_RawItemAddLastSync.cs" />
|
||||
<Compile Include="Migrations\202403120645357_RawItemAddLastSync.Designer.cs">
|
||||
<DependentUpon>202403120645357_RawItemAddLastSync.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202403120803297_AddMagmanSyncTab.cs" />
|
||||
<Compile Include="Migrations\202403120803297_AddMagmanSyncTab.Designer.cs">
|
||||
<DependentUpon>202403120803297_AddMagmanSyncTab.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202404261445205_UpdateLogMachineTable.cs" />
|
||||
<Compile Include="Migrations\202404261445205_UpdateLogMachineTable.Designer.cs">
|
||||
<DependentUpon>202404261445205_UpdateLogMachineTable.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202404261505131_UpdateLogMachineTable02.cs" />
|
||||
<Compile Include="Migrations\202404261505131_UpdateLogMachineTable02.Designer.cs">
|
||||
<DependentUpon>202404261505131_UpdateLogMachineTable02.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202404290906337_UpdateLogMachineTable03.cs" />
|
||||
<Compile Include="Migrations\202404290906337_UpdateLogMachineTable03.Designer.cs">
|
||||
<DependentUpon>202404290906337_UpdateLogMachineTable03.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202404291620416_UpdateLogMachineTable04.cs" />
|
||||
<Compile Include="Migrations\202404291620416_UpdateLogMachineTable04.Designer.cs">
|
||||
<DependentUpon>202404291620416_UpdateLogMachineTable04.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202406070826284_AddStoredProc01.cs" />
|
||||
<Compile Include="Migrations\202406070826284_AddStoredProc01.Designer.cs">
|
||||
<DependentUpon>202406070826284_AddStoredProc01.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="NLog.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -154,6 +309,59 @@
|
||||
<EmbeddedResource Include="Migrations\202109141058345_AddMachine2ProjProd.resx">
|
||||
<DependentUpon>202109141058345_AddMachine2ProjProd.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202207051703296_UpgradeLockModel.resx">
|
||||
<DependentUpon>202207051703296_UpgradeLockModel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202306081452095_UpdateProjModel.resx">
|
||||
<DependentUpon>202306081452095_UpdateProjModel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202308241516227_AddProdStatusVarAndIndex.resx">
|
||||
<DependentUpon>202308241516227_AddProdStatusVarAndIndex.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202308250853396_AddProjArchivedField.resx">
|
||||
<DependentUpon>202308250853396_AddProjArchivedField.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202401181534084_AddAliasMaterialRawItemsModel.resx">
|
||||
<DependentUpon>202401181534084_AddAliasMaterialRawItemsModel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202401291722150_FixMatItemCloudId.resx">
|
||||
<DependentUpon>202401291722150_FixMatItemCloudId.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202401310830146_FixItemRemn.resx">
|
||||
<DependentUpon>202401310830146_FixItemRemn.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202402141003461_RawItemAddUseQty.resx">
|
||||
<DependentUpon>202402141003461_RawItemAddUseQty.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202402290716188_AddProjCloudId.resx">
|
||||
<DependentUpon>202402290716188_AddProjCloudId.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202403120645357_RawItemAddLastSync.resx">
|
||||
<DependentUpon>202403120645357_RawItemAddLastSync.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202403120803297_AddMagmanSyncTab.resx">
|
||||
<DependentUpon>202403120803297_AddMagmanSyncTab.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202404261445205_UpdateLogMachineTable.resx">
|
||||
<DependentUpon>202404261445205_UpdateLogMachineTable.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202404261505131_UpdateLogMachineTable02.resx">
|
||||
<DependentUpon>202404261505131_UpdateLogMachineTable02.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202404290906337_UpdateLogMachineTable03.resx">
|
||||
<DependentUpon>202404290906337_UpdateLogMachineTable03.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202404291620416_UpdateLogMachineTable04.resx">
|
||||
<DependentUpon>202404291620416_UpdateLogMachineTable04.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202406070826284_AddStoredProc01.resx">
|
||||
<DependentUpon>202406070826284_AddStoredProc01.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="SqlScripts\Stored\stp_LogMachineFixPid.sql">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class UpgradeLockModel : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(UpgradeLockModel));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202207051703296_UpgradeLockModel"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class UpgradeLockModel : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProjList", "LockedBy", c => c.String(unicode: false, nullable: false, defaultValueSql:""));
|
||||
AddColumn("dbo.ProjList", "LockDate", c => c.DateTime(nullable: false, precision: 0, defaultValueSql: "DATE('1900-01-01')"));
|
||||
AddColumn("dbo.ProdList", "LockedBy", c => c.String(unicode: false, nullable: false, defaultValueSql: ""));
|
||||
AddColumn("dbo.ProdList", "LockDate", c => c.DateTime(nullable: false, precision: 0, defaultValueSql: "DATE('1900-01-01')"));
|
||||
//AddColumn("dbo.ProjList", "LockedBy", c => c.String(unicode: false));
|
||||
//AddColumn("dbo.ProjList", "LockDate", c => c.DateTime(nullable: false, precision: 0, defaultValueSql: "DATE('1900 - 01 - 01')"));
|
||||
//AddColumn("dbo.ProdList", "LockedBy", c => c.String(unicode: false));
|
||||
//AddColumn("dbo.ProdList", "LockDate", c => c.DateTime(nullable: false, precision: 0, defaultValueSql: "DATE('1900 - 01 - 01')"));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.ProdList", "LockDate");
|
||||
DropColumn("dbo.ProdList", "LockedBy");
|
||||
DropColumn("dbo.ProjList", "LockDate");
|
||||
DropColumn("dbo.ProjList", "LockedBy");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class UpdateProjModel : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(UpdateProjModel));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202306081452095_UpdateProjModel"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class UpdateProjModel : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProjList", "IsActive", c => c.Boolean(nullable: false, defaultValueSql: "1"));
|
||||
AddColumn("dbo.ProjList", "ProjDescription", c => c.String(unicode: false));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.ProjList", "ProjDescription");
|
||||
DropColumn("dbo.ProjList", "IsActive");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class AddProdStatusVarAndIndex : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddProdStatusVarAndIndex));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202308241516227_AddProdStatusVarAndIndex"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddProdStatusVarAndIndex : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProdList", "IsActive", c => c.Boolean(nullable: false));
|
||||
AddColumn("dbo.ProdList", "IsProduced", c => c.Boolean(nullable: false));
|
||||
AddColumn("dbo.ProdList", "IsArchived", c => c.Boolean(nullable: false));
|
||||
CreateIndex("dbo.ProjList", "DtCreated");
|
||||
CreateIndex("dbo.ProjList", "DtExported");
|
||||
CreateIndex("dbo.ProjList", "IsActive");
|
||||
CreateIndex("dbo.ProjList", "IsNew");
|
||||
CreateIndex("dbo.ProjList", "Id");
|
||||
CreateIndex("dbo.ProdList", "DtCreated");
|
||||
CreateIndex("dbo.ProdList", "Id");
|
||||
CreateIndex("dbo.ProdList", "IsActive");
|
||||
CreateIndex("dbo.ProdList", "IsProduced");
|
||||
CreateIndex("dbo.ProdList", "IsArchived");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("dbo.ProdList", new[] { "IsArchived" });
|
||||
DropIndex("dbo.ProdList", new[] { "IsProduced" });
|
||||
DropIndex("dbo.ProdList", new[] { "IsActive" });
|
||||
DropIndex("dbo.ProdList", new[] { "Id" });
|
||||
DropIndex("dbo.ProdList", new[] { "DtCreated" });
|
||||
DropIndex("dbo.ProjList", new[] { "Id" });
|
||||
DropIndex("dbo.ProjList", new[] { "IsNew" });
|
||||
DropIndex("dbo.ProjList", new[] { "IsActive" });
|
||||
DropIndex("dbo.ProjList", new[] { "DtExported" });
|
||||
DropIndex("dbo.ProjList", new[] { "DtCreated" });
|
||||
DropColumn("dbo.ProdList", "IsArchived");
|
||||
DropColumn("dbo.ProdList", "IsProduced");
|
||||
DropColumn("dbo.ProdList", "IsActive");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class AddProjArchivedField : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddProjArchivedField));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202308250853396_AddProjArchivedField"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddProjArchivedField : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProjList", "IsArchived", c => c.Boolean(nullable: false));
|
||||
CreateIndex("dbo.ProjList", "IsArchived");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("dbo.ProjList", new[] { "IsArchived" });
|
||||
DropColumn("dbo.ProjList", "IsArchived");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Generated
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class AddAliasMaterialRawItemsModel : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(AddAliasMaterialRawItemsModel));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202401181534084_AddAliasMaterialRawItemsModel"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class AddAliasMaterialRawItemsModel : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
CreateTable(
|
||||
"dbo.AliasList",
|
||||
c => new
|
||||
{
|
||||
Family = c.String(nullable: false, maxLength: 128, storeType: "nvarchar"),
|
||||
ValueOriginal = c.String(nullable: false, maxLength: 128, storeType: "nvarchar"),
|
||||
ValueAlias = c.String(unicode: false),
|
||||
})
|
||||
.PrimaryKey(t => new { t.Family, t.ValueOriginal });
|
||||
|
||||
CreateTable(
|
||||
"dbo.MaterialsList",
|
||||
c => new
|
||||
{
|
||||
MatId = c.Int(nullable: false, identity: true),
|
||||
MatExtId = c.Int(nullable: false),
|
||||
MatCode = c.String(unicode: false),
|
||||
MatDesc = c.String(unicode: false),
|
||||
LMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
WMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
HMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
RawItemIdLast = c.Int(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.MatId);
|
||||
|
||||
CreateTable(
|
||||
"dbo.RawItemList",
|
||||
c => new
|
||||
{
|
||||
RawItemId = c.Int(nullable: false, identity: true),
|
||||
MatId = c.Int(nullable: false),
|
||||
QtyAvail = c.Int(nullable: false),
|
||||
IsActive = c.Boolean(nullable: false),
|
||||
LMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
WMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
HMm = c.Decimal(nullable: false, precision: 18, scale: 2),
|
||||
Note = c.String(unicode: false),
|
||||
})
|
||||
.PrimaryKey(t => t.RawItemId)
|
||||
.ForeignKey("dbo.MaterialsList", t => t.MatId, cascadeDelete: true)
|
||||
.Index(t => t.MatId);
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropForeignKey("dbo.RawItemList", "MatId", "dbo.MaterialsList");
|
||||
DropIndex("dbo.RawItemList", new[] { "MatId" });
|
||||
DropTable("dbo.RawItemList");
|
||||
DropTable("dbo.MaterialsList");
|
||||
DropTable("dbo.AliasList");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class FixMatItemCloudId : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(FixMatItemCloudId));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202401291722150_FixMatItemCloudId"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class FixMatItemCloudId : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.MaterialsList", "MatCloudId", c => c.Int(nullable: false));
|
||||
AddColumn("dbo.RawItemList", "RawItemCloudId", c => c.Int(nullable: false));
|
||||
DropColumn("dbo.MaterialsList", "MatExtId");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AddColumn("dbo.MaterialsList", "MatExtId", c => c.Int(nullable: false));
|
||||
DropColumn("dbo.RawItemList", "RawItemCloudId");
|
||||
DropColumn("dbo.MaterialsList", "MatCloudId");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class FixItemRemn : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(FixItemRemn));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202401310830146_FixItemRemn"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class FixItemRemn : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.RawItemList", "IsRemn", c => c.Boolean(nullable: false));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.RawItemList", "IsRemn");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class RawItemAddUseQty : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(RawItemAddUseQty));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202402141003461_RawItemAddUseQty"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class RawItemAddUseQty : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.RawItemList", "UseQty", c => c.Boolean(nullable: false));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.RawItemList", "UseQty");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user