Compare commits
488 Commits
v1.43.01(4
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f54b375b9 | |||
| 9aa9b9121f | |||
| 268ce9fce9 | |||
| 4861d53031 | |||
| e27a4e840a | |||
| cc67ac5f47 | |||
| 8e2d110792 | |||
| 9924165362 | |||
| 0904388ffe | |||
| f86296d2a1 | |||
| 4d01a52590 | |||
| 638e8650ee | |||
| 36061faeeb | |||
| a88ddab405 | |||
| 9fb18215e3 | |||
| 2e3af6d1b3 | |||
| 663d172edf | |||
| 092fbd69b6 | |||
| 878584a619 | |||
| 5d52e2df46 | |||
| 809d4ef5af | |||
| faa45cd096 | |||
| 1ab9b10a13 | |||
| cce4d2dbb2 | |||
| db246e6a94 | |||
| 37ce428bf0 | |||
| bb1867b1c8 | |||
| c104313d89 | |||
| c8cc56bfd6 | |||
| 80b5b8db34 | |||
| e0b86db09d | |||
| 9d871f3ae4 | |||
| e025b234a7 | |||
| 809ef43445 | |||
| 1079c38a5f | |||
| f6388eff1c | |||
| 495a8dae92 | |||
| ed938815bb | |||
| 539e8b7c31 | |||
| 92da8cde53 | |||
| 3d0f7f16f9 | |||
| 501ca404ff | |||
| 5ad4fd7821 | |||
| 1ba2fb96ba | |||
| ffdd1a1df5 | |||
| 0205255f7d | |||
| c21e856a0f | |||
| b673940dd6 | |||
| b0ce11cbf7 | |||
| 4ef2c209c8 | |||
| 41d77b806f | |||
| 6b65c4a570 | |||
| 4d5c0e5509 | |||
| 21af5fc0a9 | |||
| 09b984f5d0 | |||
| dd473412cc | |||
| 4f0c5bf6dd | |||
| 90e4e2e464 | |||
| 50e2605ea5 | |||
| 4752e3a3a2 | |||
| 3fe903cc12 | |||
| 3f95a70039 | |||
| 067443698a | |||
| 990a4d1538 | |||
| 55c16e602d | |||
| 6097a7f736 | |||
| f8b92901fd | |||
| 6c6daa4809 | |||
| de8b48d938 | |||
| bfa69ca78b | |||
| bffb471015 | |||
| 087e3e261c | |||
| 2eff03dee6 | |||
| fc34a555bd | |||
| 0bf21c046f | |||
| 473ed536fb | |||
| dc342c1fee | |||
| 81507938b1 | |||
| cff52140bd | |||
| 24d90b58f9 | |||
| b5d049aa1d | |||
| 01028f9888 | |||
| 2774eaecbf | |||
| 648a572752 | |||
| 022a56a584 | |||
| ea97e8f249 | |||
| 571ad1590f | |||
| 03c02d6625 | |||
| ba1118fdd8 | |||
| 7878748548 | |||
| 172a8256b6 | |||
| c16f5c1747 | |||
| 33860a0cfe | |||
| 15a946dfb6 | |||
| 62adf49157 | |||
| 64fcb7ccc8 | |||
| 3ebdc72642 | |||
| aacf5ca76e | |||
| 4f134bfc8e | |||
| 6bd1e62190 | |||
| f9f02452d7 | |||
| b653ae39af | |||
| 63d1d9ecf0 | |||
| 9c72a2a628 | |||
| 5f1b7ef4a4 | |||
| c36bc9d8c2 | |||
| ba9da26ca0 | |||
| b2ad4fdb62 | |||
| 60e725f554 | |||
| 2f6f9b54c2 | |||
| a2ef35e353 | |||
| b06f058ecf | |||
| e67cbd3760 | |||
| ce9d304043 | |||
| fc30b8253d | |||
| e8da16cb8a | |||
| dff725ea92 | |||
| e4248c8c48 | |||
| 819cc97113 | |||
| 05d806f9f2 | |||
| 6fdadffe77 | |||
| 5ae9371c51 | |||
| 4861c689d7 | |||
| 1c63908b3b | |||
| a622e89058 | |||
| ac4500e2a2 | |||
| 6ebcbc2d6c | |||
| 150be3cae2 | |||
| 72edf5228a | |||
| b72a3321d9 | |||
| 5bf71a1b0c | |||
| ee10427048 | |||
| 7fb7cbf8ec | |||
| 3a43e9238b | |||
| 007d58a17e | |||
| 998a59cffc | |||
| 11b353a91d | |||
| 8772d11e02 | |||
| 3d772e3722 | |||
| 41cfbc273e | |||
| bc67098ae0 | |||
| 0e49c93678 | |||
| ed93b88ee8 | |||
| 2cb184f24b | |||
| 126846aef2 | |||
| 8ac595c6c5 | |||
| fc2c0fbe0c | |||
| 0aa0b09afa | |||
| 9436236eaa | |||
| fc5568a046 | |||
| 590e9ec24e | |||
| 984a4a156b | |||
| 04afb4cfca | |||
| 81eda94fe0 | |||
| 8f02dfbee4 | |||
| 75e1447a54 | |||
| d8f9886f82 | |||
| 3279c4e2af | |||
| 6f070e6998 | |||
| df4bfcc955 | |||
| c1983cf73c | |||
| da9bbd0b1c | |||
| cd84d3e9a8 | |||
| 595f4a8797 | |||
| 388f08a02f | |||
| c562735661 | |||
| ab137ad828 | |||
| b56f209084 | |||
| 5107897888 | |||
| d91eaf3412 | |||
| caa6a7cd75 | |||
| 567b288e4d | |||
| 86121bfa93 | |||
| 669a38732f | |||
| e3e7a7d7c6 | |||
| 75914ab9c9 | |||
| d1976f3e21 | |||
| 5ef5c4b28a | |||
| 2c3d4bbc22 | |||
| fd8bb8e7da | |||
| 60a088a7f4 | |||
| 8ca5207a58 | |||
| f2cc31e08a | |||
| e541031efe | |||
| d4b220d1e6 | |||
| 798835cb4c | |||
| ba72284c87 | |||
| 603c5dd8b7 | |||
| 43fc8be493 | |||
| 22bace2402 | |||
| 3b86460f48 | |||
| ddac54b513 | |||
| a385b01584 | |||
| 7920166110 | |||
| e6f4cc9d6d | |||
| 13d9c40119 | |||
| 1d7125a821 | |||
| deb4d77203 | |||
| 520a1cb07a | |||
| c620e9cb96 | |||
| 6ef4961074 | |||
| 688a8e4bad | |||
| 12796b11e5 | |||
| f7dc857587 | |||
| f99c0e5514 | |||
| f1c304eaeb | |||
| 7b3fde1d71 | |||
| 3c337fc138 | |||
| 021f6974f1 | |||
| 92abfe1da4 | |||
| 6338c1dfa6 | |||
| 657d85be86 | |||
| 97c907c992 | |||
| caed709b64 | |||
| 13800eecab | |||
| c4357f662c | |||
| 67a8ca94db | |||
| 0bfd56c011 | |||
| eead844ac1 | |||
| 65cfadcb6e | |||
| 00067ca1c9 | |||
| 73ca8bb366 | |||
| 3ffdb2c220 | |||
| a5479595c7 | |||
| cff971bef8 | |||
| a5d3388665 | |||
| 22ad23c5b7 | |||
| b1d5e10db4 | |||
| bde41d21be | |||
| 9d8228419c | |||
| ad7d9059c0 | |||
| 4831a7ce19 | |||
| 552b82feda | |||
| 6d62a7b10e | |||
| 667f4aea74 | |||
| f80225b7bf | |||
| 7a02e1d8ad | |||
| 9cc70f4ee6 | |||
| 7c4c5da1d6 | |||
| b960b6319a | |||
| 08ddaa7a11 | |||
| bcce40094c | |||
| 960388adf8 | |||
| e76722018f | |||
| fc30017021 | |||
| e1dd4f2140 | |||
| 67a0679de7 | |||
| dfc87f7aec | |||
| 886ef6ba08 | |||
| fe77f90a7a | |||
| 7a1f0d6cf6 | |||
| 004bc3b926 | |||
| 5a0b45c6f9 | |||
| be5ebb89d7 | |||
| f81d61c4c5 | |||
| 634bc502ce | |||
| d13dbf1ad3 | |||
| 2f9ee642da | |||
| afecc11364 | |||
| b33d566abd | |||
| 69d880b587 | |||
| aeadea42e1 | |||
| f5c3dcfdc9 | |||
| d30af1e2a6 | |||
| 71a18e9ffa | |||
| 40e1fb4f83 | |||
| f3f0fd8fd8 | |||
| ed53b9e3b4 | |||
| 37ac05b8ab | |||
| 823d0d7a33 | |||
| 5b07ff5efa | |||
| c5639a643a | |||
| 012f75198b | |||
| d7e0e858d2 | |||
| 339a5e5b68 | |||
| 02a13911d8 | |||
| b6f51971f1 | |||
| 57079c0062 | |||
| 63c353a83c | |||
| c069d21cbf | |||
| afeb9ecc23 | |||
| 2ff8d80da3 | |||
| 891e2641fa | |||
| ca79107809 | |||
| 5c37b986ce | |||
| c426250cd5 | |||
| f090c11146 | |||
| 5c90f22a49 | |||
| f1ddaa1fca | |||
| 8490553a32 | |||
| 66824fccb1 | |||
| 39dce4d23f | |||
| c1dbbde905 | |||
| 8d2d0ad195 | |||
| 927b14c9fc | |||
| f342cd0e5f | |||
| c287852ce6 | |||
| edc9470e9b | |||
| 7adeee589e | |||
| 52a393c260 | |||
| 60a405536c | |||
| 5f5117c0f6 | |||
| 0740faa964 | |||
| 2f40302791 | |||
| 13b3d5e63b | |||
| 58521997c1 | |||
| af64ca04f9 | |||
| 1e9d048264 | |||
| 6f202c0c7a | |||
| 94a9690045 | |||
| 2b4aa11021 | |||
| f2d5bb76c5 | |||
| 7bdb9b47f4 | |||
| 68bf6767b9 | |||
| 184d1f759c | |||
| 2a26236d94 | |||
| 71a00ac140 | |||
| f10aaaba6b | |||
| 296675f0b0 | |||
| 7f365be53d | |||
| 9e85204d04 | |||
| d5d80e71e7 | |||
| 73b360f427 | |||
| 722094bc3e | |||
| 645b2cfe5d | |||
| afcaa82069 | |||
| 393bffe14c | |||
| d44b6f00c6 | |||
| de68c3b49f | |||
| 0591b60fad | |||
| a6cebccad9 | |||
| 4186d90a32 | |||
| bb21441c3d | |||
| 12b1b89713 | |||
| 26512f5dc1 | |||
| 4d29e2ab41 | |||
| 6c6fd38482 | |||
| 2e37e874c3 | |||
| c99e32998b | |||
| 22ce078c74 | |||
| a93d80b2e2 | |||
| 1b4df1ecd1 | |||
| ce5ab1cfc2 | |||
| 3ac021d7ef | |||
| fa7d561189 | |||
| 2c59e9beec | |||
| 01af72bd2f | |||
| 2f42958394 | |||
| 4613f13eae | |||
| fba3801994 | |||
| 7ec722fc26 | |||
| 64295d565a | |||
| 2db0027fff | |||
| 71f077a617 | |||
| a80cf53f08 | |||
| 80dac639da | |||
| ff73a124f0 | |||
| a4fcc87088 | |||
| be1b993239 | |||
| 63f9912347 | |||
| b887172032 | |||
| 18937a3315 | |||
| fb6a74aef8 | |||
| cd89ce917e | |||
| 6229a1a4b1 | |||
| eb5ae8443d | |||
| a9028e65d9 | |||
| ba413e4d05 | |||
| 6f759d969d | |||
| 044bcbd852 | |||
| 53ba5a962b | |||
| 6f06eaf0a0 | |||
| 993191c083 | |||
| db178ce991 | |||
| 329d53f8d0 | |||
| 7c35e19ed4 | |||
| 326a3a00b2 | |||
| 086597985b | |||
| c3c3d32dfe | |||
| 1756124b89 | |||
| 5bc3619d6b | |||
| 7ec04ac8da | |||
| 8d93f3bb61 | |||
| b31ea475c6 | |||
| a7e8ec4d99 | |||
| 677ee127ff | |||
| d238cb1d88 | |||
| a02035e9b8 | |||
| b61948dac3 | |||
| deee26d55b | |||
| 00443b46c8 | |||
| 5694d8bd1c | |||
| e5a4cf59c4 | |||
| 9228eaf01b | |||
| 51f9e1f58c | |||
| 6747ee077b | |||
| e11e270101 | |||
| 12fe5059a6 | |||
| e75121b0bd | |||
| 0312f972bc | |||
| 9d48fec426 | |||
| 645045b492 | |||
| 1988fae4f9 | |||
| 6c621d5ca8 | |||
| b8c8a9d8ea | |||
| bc27355ed6 | |||
| 078d9af116 | |||
| 9b14e1186e | |||
| 779c606c2a | |||
| 002e855d82 | |||
| 1c6de11e04 | |||
| 581e56a245 | |||
| 7f468e19bd | |||
| e8a511d49e | |||
| 1988ad993f | |||
| 6105c44dab | |||
| d3b7cd8cd6 | |||
| ce3dfca6e0 | |||
| 706878b1e4 | |||
| 6c59e22101 | |||
| 36c48f28d1 | |||
| 93b18531ab | |||
| 27edd84442 | |||
| e24e6858fb | |||
| 2d48f6687c | |||
| fa10973626 | |||
| 521e2fe62b | |||
| 7e7938ea1a | |||
| 4fe48bd02a | |||
| f26bc28ba1 | |||
| aaf8b96070 | |||
| c5720059f3 | |||
| 361faf235d | |||
| f85f5d63a6 | |||
| 526bc11626 | |||
| 95d73b5bc5 | |||
| 73e0f03886 | |||
| 91bc82ed16 | |||
| c6a30588e6 | |||
| 26c09c02ab | |||
| c34e6723d8 | |||
| bf2a039700 | |||
| cebe5afd0a | |||
| 2e8e4c0ccc | |||
| 1c5c8c61cf | |||
| 726d9fd29c | |||
| d7eeeeeac2 | |||
| ee72f8364e | |||
| a95ff0b0e5 | |||
| 57ced048a0 | |||
| ca545e2d44 | |||
| 0b777137d5 | |||
| d19f4de424 | |||
| 56d509b07b | |||
| fe3a9d84d5 | |||
| dc38311125 | |||
| bce8f2a8b7 | |||
| 13ec0c745e | |||
| b5f7e12f5a | |||
| 90e8ff128c | |||
| 998b1057e0 | |||
| d4a7dee121 | |||
| e85e05a526 | |||
| 7f953e78cf | |||
| 8b536eb0b0 | |||
| f390548d66 | |||
| c6a2b8c6ea | |||
| a046e31412 | |||
| 716f6d4daa | |||
| 9b451ff1bc | |||
| 6d48182d90 | |||
| 09cebb1c7e | |||
| fbe9244000 | |||
| 7b0f7f16ba | |||
| d5c0f388db | |||
| 8ae3820aa2 | |||
| 482243ceff | |||
| 9890fbfec0 | |||
| 2b467f56d7 | |||
| a27db0ab68 | |||
| 7b9959e68d | |||
| 6c8fd2518e | |||
| 7ee59ea814 | |||
| 91bca90e5d | |||
| c5d09b0d8b | |||
| 0da31ef866 | |||
| 56f14c064e | |||
| 09c929803f |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -149,3 +149,6 @@ crashlytics.properties
|
|||||||
crashlytics-build.properties
|
crashlytics-build.properties
|
||||||
### AndroidStudio Patch ###
|
### AndroidStudio Patch ###
|
||||||
!/gradle/wrapper/gradle-wrapper.jar
|
!/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
copilot.*.xml
|
||||||
|
/.idea/dataSources.xml
|
||||||
6
.idea/AndroidProjectSystem.xml
generated
Normal file
6
.idea/AndroidProjectSystem.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AndroidProjectSystem">
|
||||||
|
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
2
.idea/appInsightsSettings.xml
generated
2
.idea/appInsightsSettings.xml
generated
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="AppInsightsSettings">
|
<component name="AppInsightsSettings">
|
||||||
<option name="selectedTabId" value="Android Vitals" />
|
<option name="selectedTabId" value="Firebase Crashlytics" />
|
||||||
<option name="tabSettings">
|
<option name="tabSettings">
|
||||||
<map>
|
<map>
|
||||||
<entry key="Android Vitals">
|
<entry key="Android Vitals">
|
||||||
|
|||||||
35
.idea/codeStyles/Project.xml
generated
35
.idea/codeStyles/Project.xml
generated
@@ -1,5 +1,40 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<code_scheme name="Project" version="173">
|
<code_scheme name="Project" version="173">
|
||||||
|
<JavaCodeStyleSettings>
|
||||||
|
<option name="IMPORT_LAYOUT_TABLE">
|
||||||
|
<value>
|
||||||
|
<package name="" withSubpackages="true" static="false" module="true" />
|
||||||
|
<package name="android" withSubpackages="true" static="true" />
|
||||||
|
<package name="androidx" withSubpackages="true" static="true" />
|
||||||
|
<package name="com" withSubpackages="true" static="true" />
|
||||||
|
<package name="junit" withSubpackages="true" static="true" />
|
||||||
|
<package name="net" withSubpackages="true" static="true" />
|
||||||
|
<package name="org" withSubpackages="true" static="true" />
|
||||||
|
<package name="java" withSubpackages="true" static="true" />
|
||||||
|
<package name="javax" withSubpackages="true" static="true" />
|
||||||
|
<package name="" withSubpackages="true" static="true" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="android" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="androidx" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="com" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="junit" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="net" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="org" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="java" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="javax" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
<package name="" withSubpackages="true" static="false" />
|
||||||
|
<emptyLine />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</JavaCodeStyleSettings>
|
||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
|
|||||||
4
.idea/deploymentTargetSelector.xml
generated
4
.idea/deploymentTargetSelector.xml
generated
@@ -4,10 +4,10 @@
|
|||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="app">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
<DropdownSelection timestamp="2025-01-17T09:18:08.345092200Z">
|
<DropdownSelection timestamp="2025-10-02T11:26:10.944286600Z">
|
||||||
<Target type="DEFAULT_BOOT">
|
<Target type="DEFAULT_BOOT">
|
||||||
<handle>
|
<handle>
|
||||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=21088B8EFD" />
|
<DeviceId pluginId="PhysicalDevice" identifier="serial=7da0808" />
|
||||||
</handle>
|
</handle>
|
||||||
</Target>
|
</Target>
|
||||||
</DropdownSelection>
|
</DropdownSelection>
|
||||||
|
|||||||
5
.idea/fileTemplates/Android Dialog.java
generated
5
.idea/fileTemplates/Android Dialog.java
generated
@@ -122,5 +122,10 @@ Create the following layout resource file [dialog_${dashName}.xml]
|
|||||||
alertDialog.setOnShowListener(this);
|
alertDialog.setOnShowListener(this);
|
||||||
return alertDialog;
|
return alertDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dismiss() {
|
||||||
|
if(getDialog() != null) getDialog().dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
11
.idea/runConfigurations/app.xml
generated
11
.idea/runConfigurations/app.xml
generated
@@ -1,6 +1,7 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="app" type="AndroidRunConfigurationType" factoryName="Android App">
|
<configuration default="false" name="app" type="AndroidRunConfigurationType" factoryName="Android App">
|
||||||
<module name="WMS.app.main" />
|
<module name="WMS.app" />
|
||||||
|
<option name="ANDROID_RUN_CONFIGURATION_SCHEMA_VERSION" value="1" />
|
||||||
<option name="DEPLOY" value="true" />
|
<option name="DEPLOY" value="true" />
|
||||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||||
@@ -8,14 +9,17 @@
|
|||||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||||
<option name="ALL_USERS" value="false" />
|
<option name="ALL_USERS" value="false" />
|
||||||
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
||||||
|
<option name="ALLOW_ASSUME_VERIFIED" value="false" />
|
||||||
<option name="CLEAR_APP_STORAGE" value="false" />
|
<option name="CLEAR_APP_STORAGE" value="false" />
|
||||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
|
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
|
||||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||||
<option name="MODE" value="default_activity" />
|
<option name="MODE" value="default_activity" />
|
||||||
|
<option name="RESTORE_ENABLED" value="false" />
|
||||||
|
<option name="RESTORE_FILE" value="" />
|
||||||
|
<option name="RESTORE_FRESH_INSTALL_ONLY" value="false" />
|
||||||
<option name="CLEAR_LOGCAT" value="false" />
|
<option name="CLEAR_LOGCAT" value="false" />
|
||||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
|
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
|
||||||
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" />
|
<option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
|
||||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
|
||||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||||
<option name="DEBUGGER_TYPE" value="Auto" />
|
<option name="DEBUGGER_TYPE" value="Auto" />
|
||||||
@@ -59,6 +63,7 @@
|
|||||||
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
||||||
</Profilers>
|
</Profilers>
|
||||||
<option name="DEEP_LINK" value="" />
|
<option name="DEEP_LINK" value="" />
|
||||||
|
<option name="ACTIVITY" value="" />
|
||||||
<option name="ACTIVITY_CLASS" value="" />
|
<option name="ACTIVITY_CLASS" value="" />
|
||||||
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
|
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
|
||||||
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
|
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
|
||||||
|
|||||||
72
Jenkinsfile.groovy
Normal file
72
Jenkinsfile.groovy
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
label 'master'
|
||||||
|
}
|
||||||
|
|
||||||
|
options {
|
||||||
|
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '10'))
|
||||||
|
disableConcurrentBuilds()
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
// ANDROID_HOME = "/usr/local/android/sdk" // Cambia in base al tuo sistema
|
||||||
|
JAVA_HOME = tool 'JDK 17.0.6 x64' // Nome dello strumento configurato in Jenkins
|
||||||
|
PATH = "${env.JAVA_HOME}\\bin;${env.PATH}"
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
|
||||||
|
stage('Preparing') {
|
||||||
|
when {
|
||||||
|
expression {
|
||||||
|
return env.GIT_BRANCH == "master-beta"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
bat "./gradlew addBetaSuffix"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
bat "./gradlew assembleRelease"
|
||||||
|
archiveArtifacts artifacts: 'app/build/outputs/apk/release/', onlyIfSuccessful: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Publish') {
|
||||||
|
steps {
|
||||||
|
azureUpload allowAnonymousAccess: true, fileShareName: 'storage-ci', filesPath: 'app/build/outputs/apk/release/*.apk,app/build/outputs/apk/release/*.txt', removePrefixPath: 'app/build/outputs/apk/release/', storageCredentialId: '83a86793-c1d6-4776-b20f-1ff652a57fee', storageType: 'filestorage', uploadArtifactsOnlyIfSuccessful: true, verbose: true, virtualPath: 'wms'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
script {
|
||||||
|
bat 'curl -k "https://devservices.studioml.it/ems-api/updateWMSApp?overrideForced=false"'
|
||||||
|
bat 'curl -k "https://devservices.studioml.it/ems-api/updateWMSApp?overrideForced=false&suffix=beta"'
|
||||||
|
bat 'curl -k "https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false"'
|
||||||
|
bat 'curl -k "https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false&suffix=beta"'
|
||||||
|
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
|
||||||
|
office365ConnectorSend adaptiveCards: true, color: '#008000', message: 'WMS è stato compilato con successo', status: 'SUCCESS', webhookUrl: 'https://default0b9c060c159c4e5f82a77459a72572.16.environment.api.powerplatform.com:443/powerautomate/automations/direct/workflows/a73f903a4044474c84ad9a0d68a9a479/triggers/manual/paths/invoke?api-version=1&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=gXc43FQXqIq7Xpfvis2XgFoPl8lpg0Sf5HtuxZG_jeI'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unstable {
|
||||||
|
script {
|
||||||
|
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
|
||||||
|
office365ConnectorSend adaptiveCards: true, color: '#FFDE21', message: 'WMS è INSTABILE', status: 'UNSTABLE', webhookUrl: 'https://default0b9c060c159c4e5f82a77459a72572.16.environment.api.powerplatform.com:443/powerautomate/automations/direct/workflows/a73f903a4044474c84ad9a0d68a9a479/triggers/manual/paths/invoke?api-version=1&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=gXc43FQXqIq7Xpfvis2XgFoPl8lpg0Sf5HtuxZG_jeI'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
failure {
|
||||||
|
script {
|
||||||
|
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
|
||||||
|
office365ConnectorSend adaptiveCards: true, color: '#FF2C2C', message: 'Errore di compilazione su WMS', status: 'FAILURE', webhookUrl: 'https://default0b9c060c159c4e5f82a77459a72572.16.environment.api.powerplatform.com:443/powerautomate/automations/direct/workflows/a73f903a4044474c84ad9a0d68a9a479/triggers/manual/paths/invoke?api-version=1&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=gXc43FQXqIq7Xpfvis2XgFoPl8lpg0Sf5HtuxZG_jeI'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
128
app/build.gradle
128
app/build.gradle
@@ -8,10 +8,11 @@ apply plugin: 'com.google.firebase.crashlytics'
|
|||||||
//apply plugin: 'kotlin-android'
|
//apply plugin: 'kotlin-android'
|
||||||
apply plugin: 'com.google.gms.google-services'
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
def appVersionCode = 466
|
def appVersionCode = 553
|
||||||
def appVersionName = '1.43.01'
|
def appVersionName = '1.50.04'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
@@ -34,7 +35,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "it.integry.integrywmsnative"
|
applicationId "it.integry.integrywmsnative"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 35
|
targetSdk 36
|
||||||
versionCode appVersionCode
|
versionCode appVersionCode
|
||||||
versionName appVersionName
|
versionName appVersionName
|
||||||
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
@@ -51,17 +52,26 @@ android {
|
|||||||
buildTypes {
|
buildTypes {
|
||||||
debug {
|
debug {
|
||||||
ext.enableCrashlytics = false
|
ext.enableCrashlytics = false
|
||||||
|
// minifyEnabled true // Abilita la minimizzazione del codice
|
||||||
|
// shrinkResources true // Rimuove risorse non utilizzate
|
||||||
|
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
release {
|
release {
|
||||||
minifyEnabled false
|
// minifyEnabled true // Abilita la minimizzazione del codice
|
||||||
|
// shrinkResources true // Rimuove risorse non utilizzate
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
|
firebaseCrashlytics {
|
||||||
|
mappingFileUploadEnabled true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
android.buildFeatures.dataBinding true
|
android.buildFeatures.dataBinding true
|
||||||
android.buildFeatures.buildConfig true
|
android.buildFeatures.buildConfig true
|
||||||
|
|
||||||
|
android.dataBinding.enabledForTests true
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_17
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
targetCompatibility JavaVersion.VERSION_17
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
@@ -72,12 +82,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
build {
|
|
||||||
doLast {
|
|
||||||
delete "$projectDir/build/outputs/apk/release/version.txt"
|
|
||||||
file("$projectDir/build/outputs/apk/release/version.txt").text = appVersionCode + '\n' + appVersionName + '\n' + 'forced=true'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gradle.projectsEvaluated {
|
gradle.projectsEvaluated {
|
||||||
tasks.withType(JavaCompile.class).tap {
|
tasks.withType(JavaCompile.class).tap {
|
||||||
@@ -90,7 +95,7 @@ android {
|
|||||||
abortOnError false
|
abortOnError false
|
||||||
}
|
}
|
||||||
namespace 'it.integry.integrywmsnative'
|
namespace 'it.integry.integrywmsnative'
|
||||||
compileSdk 35
|
compileSdk 36
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@@ -99,30 +104,33 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
// androidTestImplementation('androidx.test.espresso:espresso-core:3.6.1', {
|
// androidTestImplementation('androidx.test.espresso:espresso-core:3.6.1', {
|
||||||
// exclude group: 'com.android.support', module: 'support-annotations'
|
// exclude group: 'com.android.support', module: 'support-annotations'
|
||||||
// })
|
// })
|
||||||
// implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
// implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
|
|
||||||
implementation 'com.github.lupaulus:logger:2.3.2'
|
implementation 'com.github.lupaulus:logger:2.3.2'
|
||||||
|
|
||||||
//Firebase
|
|
||||||
|
|
||||||
// Import the Firebase BoM
|
// Import the Firebase BoM
|
||||||
implementation platform('com.google.firebase:firebase-bom:33.8.0')
|
implementation platform('com.google.firebase:firebase-bom:33.16.0')
|
||||||
implementation 'com.google.firebase:firebase-analytics'
|
implementation 'com.google.firebase:firebase-analytics'
|
||||||
implementation 'com.google.firebase:firebase-crashlytics'
|
implementation 'com.google.firebase:firebase-crashlytics'
|
||||||
implementation 'com.google.firebase:firebase-perf'
|
implementation 'com.google.firebase:firebase-perf'
|
||||||
implementation 'com.google.android.gms:play-services-basement:18.5.0'
|
implementation 'com.google.android.gms:play-services-basement:18.7.1'
|
||||||
|
|
||||||
|
//JJWT
|
||||||
|
implementation 'io.jsonwebtoken:jjwt-api:0.13.0'
|
||||||
|
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.13.0'
|
||||||
|
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.13.0'
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
implementation 'androidx.appcompat:appcompat:1.7.1'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
|
||||||
implementation 'com.google.android.material:material:1.12.0'
|
implementation 'com.google.android.material:material:1.12.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
|
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
|
||||||
implementation 'androidx.cardview:cardview:1.0.0'
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.4.0'
|
implementation 'androidx.recyclerview:recyclerview:1.4.0'
|
||||||
|
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||||
|
|
||||||
implementation('androidx.preference:preference-ktx:1.2.1') {
|
implementation('androidx.preference:preference-ktx:1.2.1') {
|
||||||
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel'
|
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel'
|
||||||
@@ -130,43 +138,35 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
|
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
|
implementation 'com.squareup.retrofit2:retrofit:3.0.0'
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
|
||||||
implementation 'com.annimon:stream:1.2.2'
|
implementation 'com.annimon:stream:1.2.2'
|
||||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7'
|
implementation 'androidx.lifecycle:lifecycle-runtime:2.9.3'
|
||||||
// implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
implementation 'org.apache.commons:commons-text:1.14.0'
|
||||||
implementation 'org.apache.commons:commons-text:1.9'
|
|
||||||
|
|
||||||
//MVVM
|
//MVVM
|
||||||
def dagger2_version = '2.55'
|
def dagger2_version = '2.57.1'
|
||||||
api "com.google.dagger:dagger:$dagger2_version"
|
implementation "com.google.dagger:dagger:$dagger2_version"
|
||||||
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
|
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
|
||||||
api "com.google.dagger:dagger-android:$dagger2_version"
|
implementation "com.google.dagger:dagger-android:$dagger2_version"
|
||||||
api "com.google.dagger:dagger-android-support:$dagger2_version"
|
implementation "com.google.dagger:dagger-android-support:$dagger2_version"
|
||||||
// if you use the support libraries
|
// if you use the support libraries
|
||||||
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger2_version"
|
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger2_version"
|
||||||
|
|
||||||
//FAB
|
//FAB
|
||||||
implementation 'com.github.clans:fab:1.6.4'
|
implementation 'com.github.clans:fab:1.6.4'
|
||||||
//CUSTOM VIEWS
|
//CUSTOM VIEWS
|
||||||
implementation 'com.github.NaimishTrivedi:FBToast:1.0'
|
|
||||||
implementation 'com.github.cachapa:ExpandableLayout:2.9.2'
|
implementation 'com.github.cachapa:ExpandableLayout:2.9.2'
|
||||||
implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
|
|
||||||
implementation 'com.github.fede87:StatusBarAlert:1.0.1'
|
|
||||||
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
|
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
|
||||||
implementation 'com.github.pedromassango:doubleClick:3.0'
|
implementation 'com.github.pedromassango:doubleClick:3.0'
|
||||||
|
|
||||||
//SQLite ROOM
|
//SQLite ROOM
|
||||||
def room_version = "2.6.1"
|
def room_version = "2.7.2"
|
||||||
|
|
||||||
implementation "androidx.room:room-runtime:$room_version"
|
implementation "androidx.room:room-runtime:$room_version"
|
||||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||||
implementation "androidx.room:room-rxjava3:$room_version"
|
implementation "androidx.room:room-rxjava3:$room_version"
|
||||||
|
|
||||||
//AppUpdate
|
|
||||||
implementation 'com.github.javiersantos:AppUpdater:2.7'
|
|
||||||
|
|
||||||
//Barcode
|
//Barcode
|
||||||
implementation project(':pointmobilescannerlibrary')
|
implementation project(':pointmobilescannerlibrary')
|
||||||
implementation project(':zebrascannerlibrary')
|
implementation project(':zebrascannerlibrary')
|
||||||
@@ -184,14 +184,16 @@ dependencies {
|
|||||||
|
|
||||||
|
|
||||||
//Bluetooth device manager
|
//Bluetooth device manager
|
||||||
implementation 'com.github.harry1453:android-bluetooth-serial:v1.1'
|
implementation 'com.github.harry1453:android-bluetooth-serial:v1.1.2'
|
||||||
|
|
||||||
// RxJava is also required.
|
// RxJava is also required.
|
||||||
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
|
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
|
||||||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
|
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||||
|
|
||||||
//Barcode generator
|
//Barcode generator
|
||||||
implementation group: 'com.google.zxing', name: 'core', version: '3.5.3'
|
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||||
|
|
||||||
|
implementation("org.javatuples:javatuples:1.2")
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -199,3 +201,49 @@ repositories {
|
|||||||
google()
|
google()
|
||||||
maven { url 'https://jitpack.io' }
|
maven { url 'https://jitpack.io' }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register('addBetaSuffix') {
|
||||||
|
doLast {
|
||||||
|
def gradleFile = file("build.gradle")
|
||||||
|
def content = gradleFile.text
|
||||||
|
|
||||||
|
// Modifica appVersionName
|
||||||
|
content = content.replaceAll(/appVersionName\s*=\s*'(.*?)'/) { fullMatch, version ->
|
||||||
|
"appVersionName = '${version}-beta'"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Modifica outputFileName
|
||||||
|
content = content.replaceAll(/output\.outputFileName\s*=\s*"(.*?)"/) { fullMatch, filename ->
|
||||||
|
"output.outputFileName = \"${filename.replace('.apk', '-beta.apk')}\""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Modifica direttamente la riga che crea 'version.txt' in 'version-beta.txt'
|
||||||
|
content = content.replace(
|
||||||
|
"def versionFile = new File(outputDir, \"version.txt\")",
|
||||||
|
"def versionFile = new File(outputDir, \"version-beta.txt\")"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Sovrascrivi il file
|
||||||
|
gradleFile.write(content)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register('createVersionFile') {
|
||||||
|
doLast {
|
||||||
|
def outputDir = file("${projectDir}/build/outputs/apk/release")
|
||||||
|
def versionFile = new File(outputDir, "version.txt")
|
||||||
|
|
||||||
|
// Cancella il file se esiste
|
||||||
|
if (versionFile.exists()) {
|
||||||
|
versionFile.delete()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crea il file con i contenuti desiderati
|
||||||
|
versionFile.write("${android.defaultConfig.versionCode}\n${android.defaultConfig.versionName}\nforced=true")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
tasks.assembleRelease.finalizedBy createVersionFile
|
||||||
|
}
|
||||||
|
|||||||
23
app/proguard-rules.pro
vendored
23
app/proguard-rules.pro
vendored
@@ -23,3 +23,26 @@
|
|||||||
# If you keep the line number information, uncomment this to
|
# If you keep the line number information, uncomment this to
|
||||||
# hide the original source file name.
|
# hide the original source file name.
|
||||||
#-renamesourcefileattribute SourceFile
|
#-renamesourcefileattribute SourceFile
|
||||||
|
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
|
||||||
|
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
|
||||||
|
-keep class * extends com.google.gson.TypeAdapter
|
||||||
|
-keep class * implements com.google.gson.TypeAdapterFactory
|
||||||
|
-keep class * implements com.google.gson.JsonSerializer
|
||||||
|
-keep class * implements com.google.gson.JsonDeserializer
|
||||||
|
# Prevent R8 from leaving Data object members always null
|
||||||
|
-keepclasseswithmembers class * {
|
||||||
|
<init>(...);
|
||||||
|
@com.google.gson.annotations.SerializedName <fields>;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Per JJWT
|
||||||
|
-keep class io.jsonwebtoken.** { *; }
|
||||||
|
-keepnames class io.jsonwebtoken.* { *; }
|
||||||
|
-keepnames interface io.jsonwebtoken.* { *; }
|
||||||
|
|
||||||
|
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
|
||||||
|
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
|
||||||
|
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
|
||||||
|
|
||||||
|
-keep class it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse { *; }
|
||||||
|
-keep class * extends it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse { *; }
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -71,6 +71,7 @@ import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMate
|
|||||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeModule;
|
import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeModule;
|
||||||
import it.integry.integrywmsnative.gest.prod_rientro_merce.ProdRientroMerceComponent;
|
import it.integry.integrywmsnative.gest.prod_rientro_merce.ProdRientroMerceComponent;
|
||||||
import it.integry.integrywmsnative.gest.prod_rientro_merce.order_detail.ProdRientroMerceOrderDetailComponent;
|
import it.integry.integrywmsnative.gest.prod_rientro_merce.order_detail.ProdRientroMerceOrderDetailComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.prod_rientro_merce.order_list.ProdRientroMerceOrderListComponent;
|
||||||
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.ProdRiposizionamentoDaProdComponent;
|
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.ProdRiposizionamentoDaProdComponent;
|
||||||
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.ProdRiposizionamentoDaProdModule;
|
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.ProdRiposizionamentoDaProdModule;
|
||||||
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.dialogs.info_giacenza.DialogInfoGiacenzaComponent;
|
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.dialogs.info_giacenza.DialogInfoGiacenzaComponent;
|
||||||
@@ -88,6 +89,8 @@ import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.selectArt
|
|||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaComponent;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaComponent;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaModule;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaModule;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs.DialogScanGrigliaAcquistoComponent;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs.DialogScanGrigliaAcquistoComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_verifica_giacenze.VerificaGiacenzeComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_verifica_giacenze.VerificaGiacenzeModule;
|
||||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeComponent;
|
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeComponent;
|
||||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeModule;
|
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeModule;
|
||||||
import it.integry.integrywmsnative.gest.settings.MainSettingsComponent;
|
import it.integry.integrywmsnative.gest.settings.MainSettingsComponent;
|
||||||
@@ -112,14 +115,25 @@ import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetM
|
|||||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditModalModule;
|
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditModalModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteComponent;
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteModule;
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_commessa.DialogAskCommessaComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_deposito.DialogAskDepositoComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_deposito.DialogAskDepositoModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.DialogAskLineaProdComponent;
|
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.DialogAskLineaProdComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.DialogAskLineaProdModule;
|
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.DialogAskLineaProdModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_livello_posizione.DialogAskLivelloPosizioneComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_livello_posizione.DialogAskLivelloPosizioneModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLUComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLUModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.DialogAskUnknownBarcodeNotesComponent;
|
import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.DialogAskUnknownBarcodeNotesComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.DialogAskUnknownBarcodeNotesModule;
|
import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.DialogAskUnknownBarcodeNotesModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_vettore.DialogAskVettoreComponent;
|
import it.integry.integrywmsnative.view.dialogs.ask_vettore.DialogAskVettoreComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_vettore.DialogAskVettoreModule;
|
import it.integry.integrywmsnative.view.dialogs.ask_vettore.DialogAskVettoreModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLUComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLUModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.bind_product_barcode_with_package.DialogBindProductBarcodeWithPackageComponent;
|
import it.integry.integrywmsnative.view.dialogs.bind_product_barcode_with_package.DialogBindProductBarcodeWithPackageComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.bind_product_barcode_with_package.DialogBindProductBarcodeWithPackageModule;
|
import it.integry.integrywmsnative.view.dialogs.bind_product_barcode_with_package.DialogBindProductBarcodeWithPackageModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArtsComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArtsModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListComponent;
|
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListModule;
|
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListComponent;
|
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListComponent;
|
||||||
@@ -128,6 +142,10 @@ import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBat
|
|||||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtComponent;
|
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtModule;
|
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.device_end_of_life.DialogDeviceEndOfLifeComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.device_end_of_life.DialogDeviceEndOfLifeModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.extra_info.DialogExtraInfoModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUComponent;
|
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUModule;
|
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdComponent;
|
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdComponent;
|
||||||
@@ -148,6 +166,8 @@ import it.integry.integrywmsnative.view.dialogs.switch_user_depo.DialogSwitchUse
|
|||||||
import it.integry.integrywmsnative.view.dialogs.switch_user_depo.DialogSwitchUserDepoModule;
|
import it.integry.integrywmsnative.view.dialogs.switch_user_depo.DialogSwitchUserDepoModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracciamentoImballiComponent;
|
import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracciamentoImballiComponent;
|
||||||
import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracciamentoImballiModule;
|
import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracciamentoImballiModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.update_available.DialogUpdateAvailableComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.update_available.DialogUpdateAvailableModule;
|
||||||
|
|
||||||
// Definition of the Application graph
|
// Definition of the Application graph
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -179,6 +199,7 @@ import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracc
|
|||||||
DialogInputLUProdModule.class,
|
DialogInputLUProdModule.class,
|
||||||
DialogScanArtModule.class,
|
DialogScanArtModule.class,
|
||||||
DialogScanOrCreateLUModule.class,
|
DialogScanOrCreateLUModule.class,
|
||||||
|
DialogBasketLUModule.class,
|
||||||
ProdFabbisognoLineeProdModule.class,
|
ProdFabbisognoLineeProdModule.class,
|
||||||
VersamentoMerceModule.class,
|
VersamentoMerceModule.class,
|
||||||
DialogAskMagazzinoProssimitaModule.class,
|
DialogAskMagazzinoProssimitaModule.class,
|
||||||
@@ -223,8 +244,17 @@ import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracc
|
|||||||
ArticoliInGiacenzaModule.class,
|
ArticoliInGiacenzaModule.class,
|
||||||
DialogTracciamentoImballiModule.class,
|
DialogTracciamentoImballiModule.class,
|
||||||
DialogAskVettoreModule.class,
|
DialogAskVettoreModule.class,
|
||||||
|
DialogAskVettoreModule.class,
|
||||||
DialogCreateNewArtModule.class,
|
DialogCreateNewArtModule.class,
|
||||||
DialogSwitchUserDepoModule.class
|
DialogSwitchUserDepoModule.class,
|
||||||
|
DialogUpdateAvailableModule.class,
|
||||||
|
DialogAskPositionOfLUModule.class,
|
||||||
|
DialogAskLivelloPosizioneModule.class,
|
||||||
|
VerificaGiacenzeModule.class,
|
||||||
|
DialogExtraInfoModule.class,
|
||||||
|
DialogAskDepositoModule.class,
|
||||||
|
DialogChooseArtFromListaArtsModule.class,
|
||||||
|
DialogDeviceEndOfLifeModule.class
|
||||||
})
|
})
|
||||||
public interface MainApplicationComponent {
|
public interface MainApplicationComponent {
|
||||||
|
|
||||||
@@ -280,6 +310,8 @@ public interface MainApplicationComponent {
|
|||||||
|
|
||||||
DialogScanOrCreateLUComponent.Factory dialogScanOrCreateLUComponent();
|
DialogScanOrCreateLUComponent.Factory dialogScanOrCreateLUComponent();
|
||||||
|
|
||||||
|
DialogBasketLUComponent.Factory dialogBasketLUComponent();
|
||||||
|
|
||||||
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
|
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
|
||||||
|
|
||||||
VersamentoMerceComponent.Factory versamentoMerceComponent();
|
VersamentoMerceComponent.Factory versamentoMerceComponent();
|
||||||
@@ -371,10 +403,30 @@ public interface MainApplicationComponent {
|
|||||||
|
|
||||||
DialogAskVettoreComponent.Factory dialogAskVettoreComponent();
|
DialogAskVettoreComponent.Factory dialogAskVettoreComponent();
|
||||||
|
|
||||||
|
DialogAskCommessaComponent.Factory dialogAskCommessaComponent();
|
||||||
|
|
||||||
DialogCreateNewArtComponent.Factory dialogCreateNewArtComponent();
|
DialogCreateNewArtComponent.Factory dialogCreateNewArtComponent();
|
||||||
|
|
||||||
DialogSwitchUserDepoComponent.Factory dialogSwitchUserDepoComponent();
|
DialogSwitchUserDepoComponent.Factory dialogSwitchUserDepoComponent();
|
||||||
|
|
||||||
|
ProdRientroMerceOrderListComponent.Factory prodRientroMerceOrderListComponent();
|
||||||
|
|
||||||
|
DialogUpdateAvailableComponent.Factory dialogUpdateAvailableComponent();
|
||||||
|
|
||||||
|
DialogAskPositionOfLUComponent.Factory dialogAskPositionOfLUComponent();
|
||||||
|
|
||||||
|
DialogAskLivelloPosizioneComponent.Factory dialogAskLivelloPosizioneComponent();
|
||||||
|
|
||||||
|
VerificaGiacenzeComponent.Factory verificaGiacenzeComponent();
|
||||||
|
|
||||||
|
DialogExtraInfoComponent.Factory dialogExtraInfoComponent();
|
||||||
|
|
||||||
|
DialogAskDepositoComponent.Factory dialogAskDepositoComponent();
|
||||||
|
|
||||||
|
DialogChooseArtFromListaArtsComponent.Factory dialogChooseArtFromListaArtsComponent();
|
||||||
|
|
||||||
|
DialogDeviceEndOfLifeComponent.Factory dialogDeviceEndOfLifeComponent();
|
||||||
|
|
||||||
void inject(MainApplication mainApplication);
|
void inject(MainApplication mainApplication);
|
||||||
|
|
||||||
void inject(AppContext mainApplication);
|
void inject(AppContext mainApplication);
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
|||||||
import it.integry.integrywmsnative.core.ean128.Ean128Service;
|
import it.integry.integrywmsnative.core.ean128.Ean128Service;
|
||||||
import it.integry.integrywmsnative.core.menu.MenuRESTConsumer;
|
import it.integry.integrywmsnative.core.menu.MenuRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||||
|
import it.integry.integrywmsnative.core.rest.AuthInterceptor;
|
||||||
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.AziendaRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.AziendaRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
@@ -31,25 +33,29 @@ import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
|||||||
import it.integry.integrywmsnative.core.rest.consumers.DocumentRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.DocumentRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.EntityRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.EntityRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoBufferRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoBufferRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.MaterialiRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PVOrdiniAcquistoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PVOrdiniAcquistoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ProductionLinesRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ProductionLinesRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.ProduzioneRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.VettoriRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.VettoriRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||||
import it.integry.integrywmsnative.core.services.inventario.InventarioService;
|
import it.integry.integrywmsnative.core.services.inventario.InventarioService;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.sound.SoundAlertService;
|
import it.integry.integrywmsnative.core.sound.SoundAlertService;
|
||||||
import it.integry.integrywmsnative.core.update.UpdatesManager;
|
import it.integry.integrywmsnative.core.update.UpdatesManager;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
|
import it.integry.integrywmsnative.gest.login.rest.AuthenticationRESTConsumer;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
|
|
||||||
@@ -94,8 +100,14 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer) {
|
ServerStatusChecker providesServerStatusChecker(Handler handler) {
|
||||||
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase, systemRESTConsumer);
|
return new ServerStatusChecker(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase, AuthenticationRESTConsumer authenticationRESTConsumer, ExecutorService executorService, Handler handler, ServerStatusChecker serverStatusChecker) {
|
||||||
|
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase, authenticationRESTConsumer, executorService, handler, serverStatusChecker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -112,6 +124,13 @@ public class MainApplicationModule {
|
|||||||
return new Ean128Service();
|
return new Ean128Service();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
RESTBuilder providesRESTBuilder(AuthInterceptor authInterceptor) {
|
||||||
|
return new RESTBuilder(authInterceptor);
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
MenuService provideMenuService(MenuRESTConsumer menuRESTConsumer) {
|
MenuService provideMenuService(MenuRESTConsumer menuRESTConsumer) {
|
||||||
@@ -120,8 +139,8 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
UpdatesManager provideUpdatesManager() {
|
UpdatesManager provideUpdatesManager(ExecutorService executorService, Handler handler, SystemRESTConsumer systemRESTConsumer) {
|
||||||
return new UpdatesManager();
|
return new UpdatesManager(executorService, handler, systemRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -138,71 +157,79 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
OrdiniRESTConsumer provideOrdiniRESTConsumer(SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
OrdiniRESTConsumer provideOrdiniRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||||
return new OrdiniRESTConsumer(systemRESTConsumer, entityRESTConsumer);
|
return new OrdiniRESTConsumer(restBuilder, executorService, systemRESTConsumer, entityRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
GestSetupRESTConsumer provideGestSetupRESTConsumer() {
|
GestSetupRESTConsumer provideGestSetupRESTConsumer(RESTBuilder restBuilder) {
|
||||||
return new GestSetupRESTConsumer();
|
return new GestSetupRESTConsumer(restBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
ArticoloRESTConsumer provideArticoloRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
ArticoloRESTConsumer provideArticoloRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||||
return new ArticoloRESTConsumer(systemRESTConsumer);
|
return new ArticoloRESTConsumer(restBuilder, executorService, systemRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
CommessaRESTConsumer provideCommessaRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
CommessaRESTConsumer provideCommessaRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||||
return new CommessaRESTConsumer(systemRESTConsumer);
|
return new CommessaRESTConsumer(executorService, systemRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
DepositoRESTConsumer provideDepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer, SystemRESTConsumer systemRESTConsumer) {
|
DepositoRESTConsumer provideDepositoRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||||
return new DepositoRESTConsumer(entityRESTConsumer, systemRESTConsumer);
|
return new DepositoRESTConsumer(executorService, systemRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
MenuRESTConsumer provideMenuRESTConsumer() {
|
MenuRESTConsumer provideMenuRESTConsumer(RESTBuilder restBuilder) {
|
||||||
return new MenuRESTConsumer();
|
return new MenuRESTConsumer(restBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
MagazzinoRESTConsumer provideMagazzinoRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
MagazzinoRESTConsumer provideMagazzinoRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||||
return new MagazzinoRESTConsumer(executorService, systemRESTConsumer);
|
return new MagazzinoRESTConsumer(restBuilder, executorService, systemRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
MesRESTConsumer provideMesRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
MesRESTConsumer provideMesRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||||
return new MesRESTConsumer(systemRESTConsumer);
|
return new MesRESTConsumer(restBuilder, systemRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
EntityRESTConsumer provideEntityRESTConsumer() {
|
EntityRESTConsumer provideEntityRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
return new EntityRESTConsumer();
|
return new EntityRESTConsumer(restBuilder, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(SystemRESTConsumer systemRESTConsumer,
|
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(ExecutorService executorService,
|
||||||
|
RESTBuilder restBuilder,
|
||||||
|
SystemRESTConsumer systemRESTConsumer,
|
||||||
ArticoloRESTConsumer articoloRESTConsumer,
|
ArticoloRESTConsumer articoloRESTConsumer,
|
||||||
EntityRESTConsumer entityRESTConsumer,
|
EntityRESTConsumer entityRESTConsumer,
|
||||||
SettingsManager settingsManager) {
|
SettingsManager settingsManager) {
|
||||||
return new ColliMagazzinoRESTConsumer(systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer, settingsManager);
|
return new ColliMagazzinoRESTConsumer(executorService, restBuilder, systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer, settingsManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
AziendaRESTConsumer provideAziendaRESTConsumer() {
|
AziendaRESTConsumer provideAziendaRESTConsumer(RESTBuilder restBuilder) {
|
||||||
return new AziendaRESTConsumer();
|
return new AziendaRESTConsumer(restBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
ProduzioneRESTConsumer provideProduzioneRESTConsumer(RESTBuilder restBuilder) {
|
||||||
|
return new ProduzioneRESTConsumer(restBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -213,56 +240,56 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
PrinterRESTConsumer providePrinterRESTConsumer() {
|
PrinterRESTConsumer providePrinterRESTConsumer(RESTBuilder restBuilder) {
|
||||||
return new PrinterRESTConsumer();
|
return new PrinterRESTConsumer(restBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
SystemRESTConsumer provideSystemRESTConsumer() {
|
SystemRESTConsumer provideSystemRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
return new SystemRESTConsumer();
|
return new SystemRESTConsumer(restBuilder, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
PVOrdiniAcquistoRESTConsumer providesPVOrdiniAcquistoRESTConsumer(MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
PVOrdiniAcquistoRESTConsumer providesPVOrdiniAcquistoRESTConsumer(RESTBuilder restBuilder, MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||||
return new PVOrdiniAcquistoRESTConsumer(magazzinoRESTConsumer);
|
return new PVOrdiniAcquistoRESTConsumer(restBuilder, magazzinoRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
PosizioniRESTConsumer providesPosizioniRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
PosizioniRESTConsumer providesPosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, ExecutorService executorService) {
|
||||||
return new PosizioniRESTConsumer(systemRESTConsumer);
|
return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
ProdFabbisognoLineeProdRESTConsumer providesProdFabbisognoLineeProdRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
DocInterniRESTConsumer provideDocInterniRESTConsumer(RESTBuilder restBuilder, MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||||
return new ProdFabbisognoLineeProdRESTConsumer(systemRESTConsumer);
|
return new DocInterniRESTConsumer(restBuilder, magazzinoRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
DocInterniRESTConsumer provideDocInterniRESTConsumer(MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
GiacenzaRESTConsumer provideGiacenzaRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||||
return new DocInterniRESTConsumer(magazzinoRESTConsumer);
|
return new GiacenzaRESTConsumer(restBuilder, executorService, articoloRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
GiacenzaRESTConsumer provideGiacenzaRESTConsumer(ArticoloRESTConsumer articoloRESTConsumer) {
|
GiacenzaPvRESTConsumer provideGiacenzaPvRESTConsumer(RESTBuilder restBuilder) {
|
||||||
return new GiacenzaRESTConsumer(articoloRESTConsumer);
|
return new GiacenzaPvRESTConsumer(restBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
ImballiRESTConsumer provideImballiRESTConsumer(ExecutorService executorService) {
|
ImballiRESTConsumer provideImballiRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
return new ImballiRESTConsumer(executorService);
|
return new ImballiRESTConsumer(restBuilder, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
VettoriRESTConsumer provideVettoriRESTConsumer(ExecutorService executorService) {
|
VettoriRESTConsumer provideVettoriRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
return new VettoriRESTConsumer(executorService);
|
return new VettoriRESTConsumer(restBuilder, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -273,44 +300,50 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
ProductionLinesRESTConsumer provideProductionLinesRESTConsumer() {
|
ProductionLinesRESTConsumer provideProductionLinesRESTConsumer(RESTBuilder restBuilder) {
|
||||||
return new ProductionLinesRESTConsumer();
|
return new ProductionLinesRESTConsumer(restBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
DocumentRESTConsumer provideDocumentiRESTConsumer() {
|
DocumentRESTConsumer provideDocumentiRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
return new DocumentRESTConsumer();
|
return new DocumentRESTConsumer(restBuilder, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
ColliAccettazioneRESTConsumer provideColliAccettazioneRESTConsumer() {
|
ColliAccettazioneRESTConsumer provideColliAccettazioneRESTConsumer(RESTBuilder restBuilder) {
|
||||||
return new ColliAccettazioneRESTConsumer();
|
return new ColliAccettazioneRESTConsumer(restBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer() {
|
ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
return new ColliSpedizioneRESTConsumer();
|
return new ColliSpedizioneRESTConsumer(restBuilder, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer(SettingsManager settingsManager) {
|
ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SettingsManager settingsManager) {
|
||||||
return new ColliLavorazioneRESTConsumer(settingsManager);
|
return new ColliLavorazioneRESTConsumer(restBuilder, executorService, settingsManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer() {
|
MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
|
||||||
return new MagazzinoAutomaticoRESTConsumer();
|
return new MagazzinoAutomaticoRESTConsumer(executorService, restBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
MagazzinoBufferRESTConsumer provideMagazzinoBufferRESTConsumer() {
|
MagazzinoBufferRESTConsumer provideMagazzinoBufferRESTConsumer(RESTBuilder restBuilder) {
|
||||||
return new MagazzinoBufferRESTConsumer();
|
return new MagazzinoBufferRESTConsumer(restBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
MaterialiRESTConsumer provideMaterialiRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
|
return new MaterialiRESTConsumer(restBuilder, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|||||||
@@ -4,15 +4,19 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@@ -26,6 +30,7 @@ import it.integry.integrywmsnative.databinding.ActivitySplashBinding;
|
|||||||
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
||||||
import it.integry.integrywmsnative.gest.main.MainActivity;
|
import it.integry.integrywmsnative.gest.main.MainActivity;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.device_end_of_life.DialogDeviceEndOfLifeView;
|
||||||
|
|
||||||
public class SplashActivity extends BaseActivity implements MainContext.Listener {
|
public class SplashActivity extends BaseActivity implements MainContext.Listener {
|
||||||
|
|
||||||
@@ -37,6 +42,9 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
|||||||
@Inject
|
@Inject
|
||||||
MainContext mainContext;
|
MainContext mainContext;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
Handler handler;
|
||||||
|
|
||||||
private RunnableArgsss<Integer, String[], List<Integer>> onRequestPermissionResult;
|
private RunnableArgsss<Integer, String[], List<Integer>> onRequestPermissionResult;
|
||||||
|
|
||||||
public static void startActivity(Context context) {
|
public static void startActivity(Context context) {
|
||||||
@@ -61,9 +69,24 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
|||||||
|
|
||||||
UtilityContext.initMainActivity(this);
|
UtilityContext.initMainActivity(this);
|
||||||
|
|
||||||
|
LocalDate endSupportDate = LocalDate.of(2026, 1, 31);
|
||||||
|
|
||||||
initAppVersion();
|
boolean isOldAndroid = Build.VERSION.SDK_INT < Build.VERSION_CODES.O;
|
||||||
initPermissions(this::init);
|
|
||||||
|
executorService.execute(() -> {
|
||||||
|
|
||||||
|
if (isOldAndroid)
|
||||||
|
showDeviceEndOfLifeMessage();
|
||||||
|
|
||||||
|
handler.post(() -> {
|
||||||
|
if (LocalDate.now().isBefore(endSupportDate) || !isOldAndroid) {
|
||||||
|
initAppVersion();
|
||||||
|
initPermissions(this::init);
|
||||||
|
} else {
|
||||||
|
this.finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initAppVersion() {
|
private void initAppVersion() {
|
||||||
@@ -101,14 +124,29 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void showDeviceEndOfLifeMessage() {
|
||||||
|
|
||||||
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
|
||||||
|
DialogDeviceEndOfLifeView.newInstance(latch::countDown)
|
||||||
|
.show(this.getSupportFragmentManager(), "dialog_device_end_of_life");
|
||||||
|
|
||||||
|
try {
|
||||||
|
latch.await();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDBDataLoading(String item) {
|
public void onDBDataLoading(String item) {
|
||||||
runOnUiThread(() -> mBinding.loadingInfoTextview.setText("Caricamento " + item));
|
handler.post(() -> mBinding.loadingInfoTextview.setText("Caricamento " + item));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMenuLoading() {
|
public void onMenuLoading() {
|
||||||
runOnUiThread(() -> mBinding.loadingInfoTextview.setText("Caricamento menù"));
|
handler.post(() -> mBinding.loadingInfoTextview.setText("Caricamento menù"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -151,11 +189,13 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Spanned message) {
|
public void onError(Spanned message) {
|
||||||
|
handler.post(() -> {
|
||||||
|
DialogSimpleMessageView.makeErrorDialog(
|
||||||
|
message, null, this::finish, R.string.logout, () -> {
|
||||||
|
this.mainContext.logout(MainApplication::exit);
|
||||||
|
})
|
||||||
|
.show(this.getSupportFragmentManager(), "tag");
|
||||||
|
|
||||||
DialogSimpleMessageView.makeErrorDialog(
|
});
|
||||||
message, null, this::finish, R.string.logout, () -> {
|
|
||||||
this.mainContext.logout(MainApplication::exit);
|
|
||||||
})
|
|
||||||
.show(this.getSupportFragmentManager(), "tag");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,19 +24,4 @@ public class CommonConst {
|
|||||||
public static String RECOVER_COLLO_FILE = "recover_ul.json";
|
public static String RECOVER_COLLO_FILE = "recover_ul.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Mail {
|
|
||||||
|
|
||||||
public static String[] forErrorsDebug = {
|
|
||||||
"g.scorrano@integry.it",
|
|
||||||
"v.castellana@integry.it"
|
|
||||||
};
|
|
||||||
|
|
||||||
public static String[] forErrors = {
|
|
||||||
// "syslogs@integry.it",
|
|
||||||
"g.scorrano@integry.it",
|
|
||||||
"v.castellana@integry.it"
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package it.integry.integrywmsnative.core.authentication;
|
||||||
|
|
||||||
|
import io.jsonwebtoken.Claims;
|
||||||
|
import io.jsonwebtoken.Jws;
|
||||||
|
import io.jsonwebtoken.Jwts;
|
||||||
|
import io.jsonwebtoken.io.Decoders;
|
||||||
|
import io.jsonwebtoken.security.Keys;
|
||||||
|
|
||||||
|
public class JwtUtils {
|
||||||
|
|
||||||
|
private final static String SIGNING_KEY = "gICy3bjD56i/YFnBZZKe5ibiz3Snsp08nybGGziCV4ZcvyXBbyqWUnJ2wTrRXhOuf/xdljPXX0yBaqdAgvKthQ==";
|
||||||
|
|
||||||
|
public static Claims parseJwt(String token) {
|
||||||
|
Jws<Claims> jws = Jwts.parser()
|
||||||
|
.verifyWith(Keys.hmacShaKeyFor(Decoders.BASE64.decode(SIGNING_KEY)))
|
||||||
|
.build()
|
||||||
|
.parseSignedClaims(token);
|
||||||
|
|
||||||
|
return jws.getPayload();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ public class BarcodeCallbackDTO {
|
|||||||
|
|
||||||
private int ID = -1;
|
private int ID = -1;
|
||||||
|
|
||||||
|
private boolean enabled = true;
|
||||||
private RunnableArgs<BarcodeScanDTO> onScanSuccessfull;
|
private RunnableArgs<BarcodeScanDTO> onScanSuccessfull;
|
||||||
private RunnableArgs<Exception> onScanFailed;
|
private RunnableArgs<Exception> onScanFailed;
|
||||||
|
|
||||||
@@ -19,6 +20,15 @@ public class BarcodeCallbackDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BarcodeCallbackDTO setEnabled(boolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public RunnableArgs<BarcodeScanDTO> getOnScanSuccessfull() {
|
public RunnableArgs<BarcodeScanDTO> getOnScanSuccessfull() {
|
||||||
return onScanSuccessfull;
|
return onScanSuccessfull;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,10 +24,15 @@ public class BarcodeManager {
|
|||||||
private static BarcodeReaderInterface mCurrentBarcodeInterface;
|
private static BarcodeReaderInterface mCurrentBarcodeInterface;
|
||||||
private static final List<BarcodeCallbackDTO> mBarcodeCallbacksStacktrace = new ArrayList<>();
|
private static final List<BarcodeCallbackDTO> mBarcodeCallbacksStacktrace = new ArrayList<>();
|
||||||
|
|
||||||
private static boolean mEnabled = true;
|
// private static boolean mEnabled = true;
|
||||||
|
|
||||||
|
|
||||||
private static final Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{PointMobileBarcodeReader.class, ZebraBarcodeReader.class, HoneyWellBarcodeReader.class, KeyboardEmulatorBarcodeReader.class};
|
private static final Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{
|
||||||
|
PointMobileBarcodeReader.class,
|
||||||
|
ZebraBarcodeReader.class,
|
||||||
|
HoneyWellBarcodeReader.class,
|
||||||
|
KeyboardEmulatorBarcodeReader.class
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
public static void init(Context applicationContext) throws Exception {
|
public static void init(Context applicationContext) throws Exception {
|
||||||
@@ -56,12 +61,12 @@ public class BarcodeManager {
|
|||||||
|
|
||||||
mCurrentBarcodeInterface.register(data -> {
|
mCurrentBarcodeInterface.register(data -> {
|
||||||
BarcodeCallbackDTO callback = getValidCallback();
|
BarcodeCallbackDTO callback = getValidCallback();
|
||||||
if (callback != null && mEnabled) {
|
if (callback != null && callback.isEnabled()) {
|
||||||
callback.getOnScanSuccessfull().run(data);
|
callback.getOnScanSuccessfull().run(data);
|
||||||
}
|
}
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
BarcodeCallbackDTO callback = getValidCallback();
|
BarcodeCallbackDTO callback = getValidCallback();
|
||||||
if (callback != null && mEnabled) {
|
if (callback != null && callback.isEnabled()) {
|
||||||
callback.getOnScanFailed().run(ex);
|
callback.getOnScanFailed().run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -85,7 +90,7 @@ public class BarcodeManager {
|
|||||||
|
|
||||||
private static BarcodeCallbackDTO getValidCallback() {
|
private static BarcodeCallbackDTO getValidCallback() {
|
||||||
|
|
||||||
if (mBarcodeCallbacksStacktrace.size() > 0) {
|
if (!mBarcodeCallbacksStacktrace.isEmpty()) {
|
||||||
return mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() - 1);
|
return mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() - 1);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
@@ -103,10 +108,9 @@ public class BarcodeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int addCallback(BarcodeCallbackDTO barcodeCallbackDTO) {
|
public static int addCallback(BarcodeCallbackDTO barcodeCallbackDTO) {
|
||||||
|
|
||||||
int newID = -1;
|
int newID = -1;
|
||||||
|
|
||||||
if (mBarcodeCallbacksStacktrace.size() > 0) {
|
if (!mBarcodeCallbacksStacktrace.isEmpty()) {
|
||||||
newID = mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() - 1).getID() + 1;
|
newID = mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() - 1).getID() + 1;
|
||||||
} else {
|
} else {
|
||||||
newID = 1;
|
newID = 1;
|
||||||
@@ -133,18 +137,39 @@ public class BarcodeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void disable() {
|
public static void disable(int instanceId) {
|
||||||
mEnabled = false;
|
mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
|
||||||
// UtilityLogger.info("Barcode reader disabled");
|
.findFirst().ifPresent(x -> x.setEnabled(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void enable() {
|
public static void disableLastCallback() {
|
||||||
mEnabled = true;
|
BarcodeCallbackDTO validCallback = getValidCallback();
|
||||||
// UtilityLogger.info("Barcode reader enabled");
|
if (validCallback != null) {
|
||||||
|
validCallback.setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEnabled() {
|
public static void enable(int instanceId) {
|
||||||
return mEnabled;
|
mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
|
||||||
|
.findFirst().ifPresent(x -> x.setEnabled(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void enableLastCallback() {
|
||||||
|
BarcodeCallbackDTO validCallback = getValidCallback();
|
||||||
|
if (validCallback != null) {
|
||||||
|
validCallback.setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isEnabled(int instanceId) {
|
||||||
|
return mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
|
||||||
|
.findFirst()
|
||||||
|
.map(BarcodeCallbackDTO::isEnabled)
|
||||||
|
.orElse(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isLastCallbackEnabled() {
|
||||||
|
return getValidCallback() != null && getValidCallback().isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void changeSettings(List<Pair<String, Object>> settings) {
|
public static void changeSettings(List<Pair<String, Object>> settings) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.ProdRiposi
|
|||||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeFragment;
|
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeFragment;
|
||||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale_su_mag_prossimita.ProdVersamentoMaterialeInBufferFragment;
|
import it.integry.integrywmsnative.gest.prod_versamento_materiale_su_mag_prossimita.ProdVersamentoMaterialeInBufferFragment;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaFragment;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaFragment;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_verifica_giacenze.VerificaGiacenzeFragment;
|
||||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeFragment;
|
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeFragment;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.info_situazione_articolo.DialogInfoSituazioneArticoloView;
|
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.info_situazione_articolo.DialogInfoSituazioneArticoloView;
|
||||||
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteFragment;
|
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteFragment;
|
||||||
@@ -88,7 +89,8 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
|||||||
.setTitleText(R.string.free_picking)
|
.setTitleText(R.string.free_picking)
|
||||||
.setTitleIcon(R.drawable.ic_dashboard_picking_libero)
|
.setTitleIcon(R.drawable.ic_dashboard_picking_libero)
|
||||||
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
|
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
|
||||||
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(R.string.free_picking, GestioneEnum.VENDITA, SettingsManager.iDB().isFlagAskClienteInPickingLibero(), false)))
|
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(R.string.free_picking, GestioneEnum.VENDITA,
|
||||||
|
SettingsManager.iDB().isFlagAskClienteInPickingLibero(), false, false)))
|
||||||
|
|
||||||
.addItem(new MenuItem()
|
.addItem(new MenuItem()
|
||||||
.setID(R.id.nav_resi_cliente)
|
.setID(R.id.nav_resi_cliente)
|
||||||
@@ -124,7 +126,8 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
|||||||
.setTitleText(R.string.free_lav_picking)
|
.setTitleText(R.string.free_lav_picking)
|
||||||
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_libero)
|
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_libero)
|
||||||
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
|
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
|
||||||
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(R.string.free_lav_picking, GestioneEnum.LAVORAZIONE, SettingsManager.iDB().isFlagAskClienteInPickingLibero(), false)))
|
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(R.string.free_lav_picking, GestioneEnum.LAVORAZIONE,
|
||||||
|
SettingsManager.iDB().isFlagAskClienteInPickingLibero(), false, SettingsManager.iDB().isFlagAskCommessaInPickingLiberoLav())))
|
||||||
|
|
||||||
.addItem(new MenuItem()
|
.addItem(new MenuItem()
|
||||||
.setID(R.id.nav_prod_posizionamento_da_ord)
|
.setID(R.id.nav_prod_posizionamento_da_ord)
|
||||||
@@ -180,7 +183,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
|||||||
.setTitleText(R.string.prod_versamento_su_ordine_title_fragment)
|
.setTitleText(R.string.prod_versamento_su_ordine_title_fragment)
|
||||||
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_su_ord)
|
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_su_ord)
|
||||||
.setDrawerIcon(R.drawable.ic_black_external)
|
.setDrawerIcon(R.drawable.ic_black_external)
|
||||||
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(R.string.prod_versamento_su_ordine_title_fragment, GestioneEnum.LAVORAZIONE, false, true)))
|
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(R.string.prod_versamento_su_ordine_title_fragment, GestioneEnum.LAVORAZIONE, false, true, false)))
|
||||||
|
|
||||||
.addItem(new MenuItem()
|
.addItem(new MenuItem()
|
||||||
.setID(R.id.nav_prod_riposizionamento_da_ord)
|
.setID(R.id.nav_prod_riposizionamento_da_ord)
|
||||||
@@ -240,6 +243,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
|||||||
.setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
|
.setTitleIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
|
||||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
|
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_purchase_orders_pv)
|
||||||
.setFragmentFactory(PVOrdiniAcquistoGrigliaFragment::newInstance))
|
.setFragmentFactory(PVOrdiniAcquistoGrigliaFragment::newInstance))
|
||||||
|
|
||||||
.addItem(new MenuItem()
|
.addItem(new MenuItem()
|
||||||
.setCodMenu("MG058")
|
.setCodMenu("MG058")
|
||||||
.setID(it.integry.integrywmsnative.R.id.nav_pv_doc_interni)
|
.setID(it.integry.integrywmsnative.R.id.nav_pv_doc_interni)
|
||||||
@@ -248,6 +252,14 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
|||||||
.setDrawerIcon(R.drawable.ic_documents_outline)
|
.setDrawerIcon(R.drawable.ic_documents_outline)
|
||||||
.setFragmentFactory(DocInterniFragment::newInstance))
|
.setFragmentFactory(DocInterniFragment::newInstance))
|
||||||
|
|
||||||
|
.addItem(new MenuItem()
|
||||||
|
.setCodMenu("MG075")
|
||||||
|
.setID(it.integry.integrywmsnative.R.id.nav_pv_verifica_giacenze)
|
||||||
|
.setTitleText(R.string.verifica_giacenze_menu)
|
||||||
|
.setTitleIcon(R.drawable.ic_dashboard_verifica_giacenze)
|
||||||
|
.setDrawerIcon(R.drawable.ic_drawer_verifica_giacenze)
|
||||||
|
.setFragmentFactory(VerificaGiacenzeFragment::newInstance))
|
||||||
|
|
||||||
// .addItem(new MenuItem()
|
// .addItem(new MenuItem()
|
||||||
// .setID(it.integry.integrywmsnative.R.id.nav_pv_ordini_acquisto_trasmessi)
|
// .setID(it.integry.integrywmsnative.R.id.nav_pv_ordini_acquisto_trasmessi)
|
||||||
// .setTitleText(it.integry.integrywmsnative.R.string.transmitted_orders)
|
// .setTitleText(it.integry.integrywmsnative.R.string.transmitted_orders)
|
||||||
|
|||||||
@@ -89,11 +89,25 @@ public class AppContext {
|
|||||||
private void initLogger() {
|
private void initLogger() {
|
||||||
Logger.addLogAdapter(new AndroidLogAdapter());
|
Logger.addLogAdapter(new AndroidLogAdapter());
|
||||||
|
|
||||||
logsFolder = new File(mApplicationContext.getExternalFilesDir(null).getAbsolutePath());
|
File dataDir = mApplicationContext.getExternalFilesDir(null);
|
||||||
int maxBytesSize = 5 * 1024 * 1024;
|
|
||||||
Logger.addLogAdapter(new DiskLogAdapter(logsFolder, maxBytesSize));
|
logsFolder = new File(dataDir, "logs");
|
||||||
|
|
||||||
|
if (!logsFolder.exists())
|
||||||
|
logsFolder.mkdirs();
|
||||||
|
|
||||||
|
//Temporary clean
|
||||||
|
File[] wrongFilesToBeDeleted = dataDir.listFiles((file, s) -> s.startsWith("logs_"));
|
||||||
|
|
||||||
|
if (wrongFilesToBeDeleted != null)
|
||||||
|
for (File fileToDelete : wrongFilesToBeDeleted) {
|
||||||
|
fileToDelete.delete();
|
||||||
|
}
|
||||||
|
|
||||||
removeOldLogs(logsFolder);
|
removeOldLogs(logsFolder);
|
||||||
|
|
||||||
|
int maxBytesSize = 5 * 1024 * 1024;
|
||||||
|
Logger.addLogAdapter(new DiskLogAdapter(logsFolder, maxBytesSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeOldLogs(File logsFolder) {
|
private void removeOldLogs(File logsFolder) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.core.context;
|
package it.integry.integrywmsnative.core.context;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Handler;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
@@ -9,16 +10,16 @@ import android.text.SpannedString;
|
|||||||
import com.google.firebase.installations.FirebaseInstallations;
|
import com.google.firebase.installations.FirebaseInstallations;
|
||||||
|
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
||||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityThread;
|
import it.integry.integrywmsnative.gest.login.rest.AuthenticationRESTConsumer;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class MainContext {
|
public class MainContext {
|
||||||
@@ -26,19 +27,24 @@ public class MainContext {
|
|||||||
private final Context applicationContext;
|
private final Context applicationContext;
|
||||||
private final MenuService menuService;
|
private final MenuService menuService;
|
||||||
private final AppDatabase appDatabase;
|
private final AppDatabase appDatabase;
|
||||||
private final SystemRESTConsumer systemRESTConsumer;
|
private final AuthenticationRESTConsumer authenticationRESTConsumer;
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
private final Handler handler;
|
||||||
|
private final ServerStatusChecker serverStatusChecker;
|
||||||
|
|
||||||
private Listener mListener;
|
private Listener mListener;
|
||||||
|
|
||||||
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer) {
|
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase, AuthenticationRESTConsumer authenticationRESTConsumer, ExecutorService executorService, Handler handler, ServerStatusChecker serverStatusChecker) {
|
||||||
this.applicationContext = applicationContext;
|
this.applicationContext = applicationContext;
|
||||||
this.menuService = menuService;
|
this.menuService = menuService;
|
||||||
this.appDatabase = appDatabase;
|
this.appDatabase = appDatabase;
|
||||||
this.systemRESTConsumer = systemRESTConsumer;
|
this.authenticationRESTConsumer = authenticationRESTConsumer;
|
||||||
|
this.executorService = executorService;
|
||||||
|
this.handler = handler;
|
||||||
|
this.serverStatusChecker = serverStatusChecker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
BarcodeManager.init(applicationContext);
|
BarcodeManager.init(applicationContext);
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
@@ -46,21 +52,40 @@ public class MainContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.initDeviceId(() -> {
|
executorService.execute(() -> {
|
||||||
this.initDBData(() -> {
|
|
||||||
this.initMenu(() -> {
|
|
||||||
|
|
||||||
if (mListener != null) mListener.onContextInitialized();
|
try {
|
||||||
});
|
this.initDBData();
|
||||||
});
|
this.initMenu();
|
||||||
|
serverStatusChecker.init();
|
||||||
|
|
||||||
|
if (mListener != null) mListener.onContextInitialized();
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Spanned message = null;
|
||||||
|
|
||||||
|
if (ex.getCause() != null && ex.getCause() instanceof ConnectException) {
|
||||||
|
message = Html.fromHtml("Impossibile collegarsi all'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
|
||||||
|
} else if (ex.getMessage().startsWith("Status 404:")) {
|
||||||
|
message = Html.fromHtml("Errore 404. Non è stato possibile soddisfare la richiesta sull'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
|
||||||
|
} else {
|
||||||
|
message = new SpannableString(ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mListener != null) mListener.onError(message);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.initServerStatusChecker();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initAuthSession(Runnable onComplete) {
|
||||||
|
this.authenticationRESTConsumer.me(obj -> {
|
||||||
|
onComplete.run();
|
||||||
|
}, ex -> {
|
||||||
|
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void initDeviceId(Runnable onComplete) {
|
private void initDeviceId(Runnable onComplete) {
|
||||||
if (SettingsManager.i().getUserSession().getDeviceId() != null) {
|
if (SettingsManager.i().getUserSession().getDeviceId() != null) {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
@@ -72,59 +97,37 @@ public class MainContext {
|
|||||||
SettingsManager.i().getUserSession().setDeviceId(fid.getResult());
|
SettingsManager.i().getUserSession().setDeviceId(fid.getResult());
|
||||||
SettingsManager.update();
|
SettingsManager.update();
|
||||||
|
|
||||||
systemRESTConsumer.registerDevice(onComplete, ex -> {
|
// systemRESTConsumer.registerDevice(onComplete, ex -> {
|
||||||
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
|
// if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
|
||||||
});
|
// });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void logout(Runnable onLoggedOut) {
|
public void logout(Runnable onLoggedOut) {
|
||||||
menuService.invalidateCache();
|
menuService.invalidateCache();
|
||||||
UtilityThread.executeParallel(() -> {
|
executorService.execute(() -> {
|
||||||
SettingsManager.i().setUser(null);
|
SettingsManager.i().setUser(null);
|
||||||
SettingsManager.i().setUserSession(null);
|
SettingsManager.i().setUserSession(null);
|
||||||
SettingsManager.update();
|
SettingsManager.update();
|
||||||
appDatabase.clearAllTables();
|
appDatabase.clearAllTables();
|
||||||
|
|
||||||
onLoggedOut.run();
|
handler.post(() -> {
|
||||||
}, true);
|
onLoggedOut.run();
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initServerStatusChecker() {
|
private void initDBData() throws Exception {
|
||||||
ServerStatusChecker.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initDBData(Runnable onComplete) {
|
|
||||||
|
|
||||||
|
|
||||||
SettingsManager.loadDBVariables(item -> {
|
SettingsManager.loadDBVariables(item -> {
|
||||||
if (mListener != null) mListener.onDBDataLoading(item);
|
if (mListener != null) mListener.onDBDataLoading(item);
|
||||||
},
|
});
|
||||||
onComplete,
|
|
||||||
ex -> {
|
|
||||||
|
|
||||||
Spanned message = null;
|
|
||||||
|
|
||||||
if (ex.getCause() != null && ex.getCause() instanceof ConnectException) {
|
|
||||||
message = Html.fromHtml("Impossibile collegarsi all'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
|
|
||||||
} else if (ex.getMessage().startsWith("Status 404:")) {
|
|
||||||
message = Html.fromHtml("Errore 404. Non è stato possibile soddisfare la richiesta sull'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
|
|
||||||
} else {
|
|
||||||
message = new SpannableString(ex.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mListener != null) mListener.onError(message);
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initMenu(Runnable onComplete) {
|
private void initMenu() throws Exception {
|
||||||
if (mListener != null) mListener.onMenuLoading();
|
if (mListener != null) mListener.onMenuLoading();
|
||||||
this.menuService.init(onComplete, ex -> {
|
this.menuService.init();
|
||||||
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class DataCache {
|
|||||||
|
|
||||||
Object foundDataCache = null;
|
Object foundDataCache = null;
|
||||||
|
|
||||||
if(dataCacheTemp != null && dataCacheTemp.size() > 0) {
|
if(dataCacheTemp != null && !dataCacheTemp.isEmpty()) {
|
||||||
foundDataCache = dataCacheTemp.get(0).getItem();
|
foundDataCache = dataCacheTemp.get(0).getItem();
|
||||||
dataCacheList.remove(dataCacheTemp.get(0));
|
dataCacheList.remove(dataCacheTemp.get(0));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.core.data_recover;
|
package it.integry.integrywmsnative.core.data_recover;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
@@ -10,7 +11,7 @@ public class ColliDataRecoverDTO {
|
|||||||
private int id;
|
private int id;
|
||||||
private int numCollo;
|
private int numCollo;
|
||||||
private String serCollo;
|
private String serCollo;
|
||||||
private String dataCollo;
|
private LocalDate dataCollo;
|
||||||
private String gestioneCollo;
|
private String gestioneCollo;
|
||||||
private String filtro;
|
private String filtro;
|
||||||
|
|
||||||
@@ -43,11 +44,11 @@ public class ColliDataRecoverDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataCollo() {
|
public LocalDate getDataCollo() {
|
||||||
return dataCollo;
|
return dataCollo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColliDataRecoverDTO setDataCollo(String dataCollo) {
|
public ColliDataRecoverDTO setDataCollo(LocalDate dataCollo) {
|
||||||
this.dataCollo = dataCollo;
|
this.dataCollo = dataCollo;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package it.integry.integrywmsnative.core.data_recover;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.annimon.stream.Optional;
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.google.android.gms.common.util.IOUtils;
|
import com.google.android.gms.common.util.IOUtils;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
@@ -14,6 +13,7 @@ import java.io.InputStream;
|
|||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -46,7 +46,7 @@ public class ColliDataRecoverService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean thereIsAnExistantSession() {
|
public boolean thereIsAnExistantSession() {
|
||||||
return mtbColtsSessions != null && mtbColtsSessions.size() > 0;
|
return mtbColtsSessions != null && !mtbColtsSessions.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getAllSessionIDs() {
|
public List<Integer> getAllSessionIDs() {
|
||||||
@@ -65,9 +65,9 @@ public class ColliDataRecoverService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ColliDataRecoverDTO getIfExists(int id) {
|
private ColliDataRecoverDTO getIfExists(int id) {
|
||||||
Optional<ColliDataRecoverDTO> recoverDTOOptional = Stream.of(mtbColtsSessions)
|
Optional<ColliDataRecoverDTO> recoverDTOOptional = mtbColtsSessions.stream()
|
||||||
.filter(x -> x.getId() == id)
|
.filter(x -> x.getId() == id)
|
||||||
.findSingle();
|
.findFirst();
|
||||||
|
|
||||||
|
|
||||||
return recoverDTOOptional.isPresent() ? recoverDTOOptional.get() : null;
|
return recoverDTOOptional.isPresent() ? recoverDTOOptional.get() : null;
|
||||||
@@ -85,7 +85,7 @@ public class ColliDataRecoverService {
|
|||||||
|
|
||||||
ColliDataRecoverDTO recoverDTO = new ColliDataRecoverDTO()
|
ColliDataRecoverDTO recoverDTO = new ColliDataRecoverDTO()
|
||||||
.setId(newId)
|
.setId(newId)
|
||||||
.setDataCollo(mtbColtSession.getDataColloS())
|
.setDataCollo(mtbColtSession.getDataColloLD())
|
||||||
.setNumCollo(mtbColtSession.getNumCollo())
|
.setNumCollo(mtbColtSession.getNumCollo())
|
||||||
.setSerCollo(mtbColtSession.getSerCollo())
|
.setSerCollo(mtbColtSession.getSerCollo())
|
||||||
.setGestioneCollo(mtbColtSession.getGestione())
|
.setGestioneCollo(mtbColtSession.getGestione())
|
||||||
|
|||||||
@@ -22,14 +22,18 @@ import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeRowDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRowRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRowRoomDTO;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
|
||||||
|
|
||||||
@Database(entities = {
|
@Database(entities = {
|
||||||
ArticoloGriglia.class,
|
ArticoloGriglia.class,
|
||||||
@@ -38,10 +42,12 @@ import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
|||||||
ArticoloOrdine.class,
|
ArticoloOrdine.class,
|
||||||
SqlMtbColt.class,
|
SqlMtbColt.class,
|
||||||
SqlMtbColr.class,
|
SqlMtbColr.class,
|
||||||
InventarioRoomDTO.class,
|
InventarioEntity.class,
|
||||||
InventarioRowRoomDTO.class
|
InventarioRowRoomDTO.class,
|
||||||
|
VerificaGiacenzeEntity.class,
|
||||||
|
VerificaGiacenzeRowEntity.class
|
||||||
},
|
},
|
||||||
version = 17)
|
version = 18)
|
||||||
@TypeConverters({
|
@TypeConverters({
|
||||||
DateConverter.class,
|
DateConverter.class,
|
||||||
BigDecimalConverter.class,
|
BigDecimalConverter.class,
|
||||||
@@ -70,7 +76,8 @@ public abstract class AppDatabase extends RoomDatabase {
|
|||||||
.addMigrations(MIGRATION_13_14)
|
.addMigrations(MIGRATION_13_14)
|
||||||
.addMigrations(MIGRATION_14_15)
|
.addMigrations(MIGRATION_14_15)
|
||||||
.addMigrations(MIGRATION_15_16)
|
.addMigrations(MIGRATION_15_16)
|
||||||
.addMigrations(MIGRATION_16_17);
|
.addMigrations(MIGRATION_16_17)
|
||||||
|
.addMigrations(MIGRATION_17_18);
|
||||||
|
|
||||||
sInstance = builder.build();
|
sInstance = builder.build();
|
||||||
}
|
}
|
||||||
@@ -95,6 +102,10 @@ public abstract class AppDatabase extends RoomDatabase {
|
|||||||
|
|
||||||
public abstract InventarioRowDao inventarioRowDao();
|
public abstract InventarioRowDao inventarioRowDao();
|
||||||
|
|
||||||
|
public abstract VerificaGiacenzeDao verificaGiacenzeDao();
|
||||||
|
|
||||||
|
public abstract VerificaGiacenzeRowDao verificaGiacenzeRowDao();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static final Migration MIGRATION_10_11 = new Migration(10, 11) {
|
static final Migration MIGRATION_10_11 = new Migration(10, 11) {
|
||||||
@@ -182,4 +193,28 @@ public abstract class AppDatabase extends RoomDatabase {
|
|||||||
database.execSQL("DROP TABLE _inventario_rows_old;");
|
database.execSQL("DROP TABLE _inventario_rows_old;");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
static final Migration MIGRATION_17_18 = new Migration(17, 18) {
|
||||||
|
@Override
|
||||||
|
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||||
|
database.execSQL("CREATE TABLE IF NOT EXISTS verifica_giacenze (_id INTEGER PRIMARY KEY AUTOINCREMENT, cod_mdep TEXT NOT NULL, data INTEGER, remote_sync_date INTEGER);");
|
||||||
|
database.execSQL("CREATE INDEX IF NOT EXISTS index_verifica_giacenze__id ON verifica_giacenze (_id);");
|
||||||
|
|
||||||
|
database.execSQL("CREATE TABLE IF NOT EXISTS verifica_giacenze_rows (" +
|
||||||
|
"_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
|
||||||
|
"parent_id INTEGER, " +
|
||||||
|
"created_at INTEGER DEFAULT CURRENT_TIMESTAMP, " +
|
||||||
|
"cod_mart TEXT, " +
|
||||||
|
"partita_mag TEXT, " +
|
||||||
|
"descrizione TEXT, " +
|
||||||
|
"qta_in_giacenza REAL NOT NULL DEFAULT 0, " +
|
||||||
|
"qta REAL NOT NULL DEFAULT 0, " +
|
||||||
|
"num_cnf REAL NOT NULL DEFAULT 0, " +
|
||||||
|
"qta_cnf REAL NOT NULL DEFAULT 0, " +
|
||||||
|
"scan_cod_barre TEXT, " +
|
||||||
|
"remote_sync_date INTEGER, " +
|
||||||
|
"FOREIGN KEY(parent_id) REFERENCES verifica_giacenze(_id) ON UPDATE NO ACTION ON DELETE CASCADE );");
|
||||||
|
database.execSQL("CREATE INDEX IF NOT EXISTS index_verifica_giacenze_rows__id ON verifica_giacenze_rows (_id)");
|
||||||
|
database.execSQL("CREATE INDEX IF NOT EXISTS index_verifica_giacenze_rows_parent_id ON verifica_giacenze_rows (parent_id)");
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeRowDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
|
||||||
@@ -32,10 +34,17 @@ import it.integry.integrywmsnative.core.data_store.db.repository.datasource.SqlM
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.repository.datasource.SqlMtbColtDataSource;
|
import it.integry.integrywmsnative.core.data_store.db.repository.datasource.SqlMtbColtDataSource;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRepository;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRowRepository;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRowRepository;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRepository;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRowRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioLocalDataSource;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioLocalDataSource;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioRowLocalDataSource;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioRowLocalDataSource;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.VerificaGiacenzeLocalDataSource;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.VerificaGiacenzeRowLocalDataSource;
|
||||||
import it.integry.integrywmsnative.core.mapper.InventarioMapper;
|
import it.integry.integrywmsnative.core.mapper.InventarioMapper;
|
||||||
import it.integry.integrywmsnative.core.mapper.InventarioRowMapper;
|
import it.integry.integrywmsnative.core.mapper.InventarioRowMapper;
|
||||||
|
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeMapper;
|
||||||
|
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeRowMapper;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.InventarioRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.InventarioRESTConsumer;
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@@ -108,6 +117,11 @@ public class RoomModule {
|
|||||||
return appDatabase.inventarioRowDao();
|
return appDatabase.inventarioRowDao();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
InventarioMapper providesInventarioMapper(InventarioRowMapper inventarioRowMapper) {
|
||||||
|
return new InventarioMapper(inventarioRowMapper);
|
||||||
|
}
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
@@ -117,8 +131,26 @@ public class RoomModule {
|
|||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
InventarioMapper providesInventarioMapper(InventarioRowMapper inventarioRowMapper) {
|
VerificaGiacenzeDao providesVerificaGiacenzeDao(AppDatabase appDatabase) {
|
||||||
return new InventarioMapper(inventarioRowMapper);
|
return appDatabase.verificaGiacenzeDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
VerificaGiacenzeRowDao providesVerificaGiacenzeRowDao(AppDatabase appDatabase) {
|
||||||
|
return appDatabase.verificaGiacenzeRowDao();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
VerificaGiacenzeMapper providesVerificaGiacenzeMapper(VerificaGiacenzeRowMapper verificaGiacenzeRowMapper) {
|
||||||
|
return new VerificaGiacenzeMapper(verificaGiacenzeRowMapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
VerificaGiacenzeRowMapper providesVerificaGiacenzeRowMapper() {
|
||||||
|
return new VerificaGiacenzeRowMapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -182,4 +214,20 @@ public class RoomModule {
|
|||||||
return new InventarioRowRepository(inventarioRowLocalDataSource, inventarioRESTConsumer, inventarioRowMapper, handler);
|
return new InventarioRowRepository(inventarioRowLocalDataSource, inventarioRESTConsumer, inventarioRowMapper, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
VerificaGiacenzeRepository providesVerificaGiacenzeRepository(ExecutorService executorService, Handler handler,
|
||||||
|
VerificaGiacenzeLocalDataSource verificaGiacenzeLocalDataSource,
|
||||||
|
GiacenzaPvRESTConsumer giacenzaPvRESTConsumer,
|
||||||
|
VerificaGiacenzeMapper verificaGiacenzeMapper) {
|
||||||
|
return new VerificaGiacenzeRepository(verificaGiacenzeLocalDataSource, giacenzaPvRESTConsumer, verificaGiacenzeMapper, handler, executorService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
VerificaGiacenzeRowRepository providesVerificaGiacenzeRowRepository(ExecutorService executorService, Handler handler,
|
||||||
|
VerificaGiacenzeRowLocalDataSource verificaGiacenzeRowLocalDataSource,
|
||||||
|
GiacenzaPvRESTConsumer giacenzaPvRESTConsumer,
|
||||||
|
VerificaGiacenzeRowMapper verificaGiacenzeRowMapper) {
|
||||||
|
return new VerificaGiacenzeRowRepository(verificaGiacenzeRowLocalDataSource, giacenzaPvRESTConsumer, verificaGiacenzeRowMapper, handler, executorService);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,21 +7,21 @@ import java.util.List;
|
|||||||
|
|
||||||
import io.reactivex.rxjava3.core.Flowable;
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.BaseSyncDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.BaseSyncDTO;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityDaoInterface;
|
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityDaoInterface;
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
public interface InventarioDao extends EntityDaoInterface<InventarioRoomDTO> {
|
public interface InventarioDao extends EntityDaoInterface<InventarioEntity> {
|
||||||
|
|
||||||
|
|
||||||
@Query("SELECT * FROM " + InventarioRoomDTO.TABLE_NAME +
|
@Query("SELECT * FROM " + InventarioEntity.TABLE_NAME +
|
||||||
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))")
|
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))")
|
||||||
List<InventarioRoomDTO> selectAll(boolean toBeSync);
|
List<InventarioEntity> selectAll(boolean toBeSync);
|
||||||
|
|
||||||
|
|
||||||
@Query("SELECT * FROM " + InventarioRoomDTO.TABLE_NAME +
|
@Query("SELECT * FROM " + InventarioEntity.TABLE_NAME +
|
||||||
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))" +
|
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))" +
|
||||||
" ORDER BY " + InventarioRoomDTO.Columns.DATA_INVENTARIO + " DESC")
|
" ORDER BY " + InventarioEntity.Columns.DATA_INVENTARIO + " DESC")
|
||||||
Flowable<List<InventarioRoomDTO>> selectAllFlowable(boolean toBeSync);
|
Flowable<List<InventarioEntity>> selectAllFlowable(boolean toBeSync);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.dao;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Transaction;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.BaseSyncDTO;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityDaoInterface;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.VerificaGiacenzeWithRowsWrapper;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface VerificaGiacenzeDao extends EntityDaoInterface<VerificaGiacenzeEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
@Transaction
|
||||||
|
@Query("SELECT * FROM " + VerificaGiacenzeEntity.TABLE_NAME +
|
||||||
|
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))")
|
||||||
|
List<VerificaGiacenzeWithRowsWrapper> selectAll(boolean toBeSync);
|
||||||
|
|
||||||
|
@Transaction
|
||||||
|
@Query("SELECT * FROM " + VerificaGiacenzeEntity.TABLE_NAME +
|
||||||
|
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))" +
|
||||||
|
" ORDER BY " + VerificaGiacenzeEntity.Columns.DATA + " DESC")
|
||||||
|
Flowable<List<VerificaGiacenzeWithRowsWrapper>> selectAllFlowable(boolean toBeSync);
|
||||||
|
|
||||||
|
@Transaction
|
||||||
|
@Query("SELECT * FROM " + VerificaGiacenzeEntity.TABLE_NAME +
|
||||||
|
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))" +
|
||||||
|
" ORDER BY " + VerificaGiacenzeEntity.Columns.DATA + " DESC" +
|
||||||
|
" LIMIT 1")
|
||||||
|
VerificaGiacenzeWithRowsWrapper selectLast(boolean toBeSync);
|
||||||
|
|
||||||
|
@Query("SELECT COALESCE(strftime('%s', 'now') - MAX(" + VerificaGiacenzeRowEntity.Columns.CREATED_AT + ") < :maxMinutes * 60, 0) as any_verifica_to_be_recovered" +
|
||||||
|
" FROM " + VerificaGiacenzeRowEntity.TABLE_NAME +
|
||||||
|
" WHERE (" + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL)")
|
||||||
|
boolean isAnotherVerificaGiacenzeInProgress(int maxMinutes);
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.dao;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Query;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.BaseSyncDTO;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityDaoInterface;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface VerificaGiacenzeRowDao extends EntityDaoInterface<VerificaGiacenzeRowEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
@Query("SELECT * FROM " + VerificaGiacenzeRowEntity.TABLE_NAME +
|
||||||
|
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))")
|
||||||
|
List<VerificaGiacenzeRowEntity> selectAll(boolean toBeSync);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM " + VerificaGiacenzeRowEntity.TABLE_NAME +
|
||||||
|
" WHERE ((:toBeSync = 1 AND " + BaseSyncDTO.Columns.COLUMN_REMOTE_SYNC_DATE + " IS NULL) OR (:toBeSync = 0))")
|
||||||
|
Flowable<List<VerificaGiacenzeRowEntity>> selectAllFlowable(boolean toBeSync);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,8 +12,8 @@ import java.util.List;
|
|||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
|
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
|
||||||
|
|
||||||
@Entity(tableName = InventarioRoomDTO.TABLE_NAME)
|
@Entity(tableName = InventarioEntity.TABLE_NAME)
|
||||||
public class InventarioRoomDTO extends BaseSyncDTO implements EntityModelInterface {
|
public class InventarioEntity extends BaseSyncDTO implements EntityModelInterface {
|
||||||
|
|
||||||
public static final String TABLE_NAME = "inventari";
|
public static final String TABLE_NAME = "inventari";
|
||||||
|
|
||||||
@@ -4,7 +4,6 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.room.ColumnInfo;
|
import androidx.room.ColumnInfo;
|
||||||
import androidx.room.Entity;
|
import androidx.room.Entity;
|
||||||
import androidx.room.ForeignKey;
|
import androidx.room.ForeignKey;
|
||||||
import androidx.room.PrimaryKey;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -12,10 +11,11 @@ import java.time.LocalDateTime;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
|
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
||||||
|
inheritSuperIndices = true,
|
||||||
tableName = InventarioRowRoomDTO.TABLE_NAME,
|
tableName = InventarioRowRoomDTO.TABLE_NAME,
|
||||||
foreignKeys = {
|
foreignKeys = {
|
||||||
@ForeignKey(
|
@ForeignKey(
|
||||||
entity = InventarioRoomDTO.class,
|
entity = InventarioEntity.class,
|
||||||
parentColumns = {BaseSyncDTO.Columns.ID},
|
parentColumns = {BaseSyncDTO.Columns.ID},
|
||||||
childColumns = {InventarioRowRoomDTO.Columns.PARENT_ID},
|
childColumns = {InventarioRowRoomDTO.Columns.PARENT_ID},
|
||||||
onDelete = ForeignKey.CASCADE
|
onDelete = ForeignKey.CASCADE
|
||||||
@@ -40,13 +40,6 @@ public class InventarioRowRoomDTO extends BaseSyncDTO implements EntityModelInte
|
|||||||
public static final String ZONA = "zona";
|
public static final String ZONA = "zona";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The unique ID
|
|
||||||
*/
|
|
||||||
@PrimaryKey(autoGenerate = true)
|
|
||||||
@ColumnInfo(index = true, name = BaseSyncDTO.Columns.ID)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ColumnInfo(index = true, name = Columns.PARENT_ID)
|
@ColumnInfo(index = true, name = Columns.PARENT_ID)
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.entity;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.room.ColumnInfo;
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.Ignore;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
|
||||||
|
|
||||||
|
@Entity(
|
||||||
|
inheritSuperIndices = true,
|
||||||
|
tableName = VerificaGiacenzeEntity.TABLE_NAME
|
||||||
|
)
|
||||||
|
public class VerificaGiacenzeEntity extends BaseSyncDTO implements EntityModelInterface {
|
||||||
|
|
||||||
|
public static final String TABLE_NAME = "verifica_giacenze";
|
||||||
|
|
||||||
|
public static class Columns {
|
||||||
|
public static final String COD_MDEP = "cod_mdep";
|
||||||
|
public static final String DATA = "data";
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@ColumnInfo(name = VerificaGiacenzeEntity.Columns.COD_MDEP)
|
||||||
|
private String codMdep;
|
||||||
|
|
||||||
|
@ColumnInfo(name = VerificaGiacenzeEntity.Columns.DATA)
|
||||||
|
private LocalDateTime data;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
private List<VerificaGiacenzeRowEntity> verificaGiacenzeRowList;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public String getCodMdep() {
|
||||||
|
return codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodMdep(@NonNull String codMdep) {
|
||||||
|
this.codMdep = codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(LocalDateTime data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<VerificaGiacenzeRowEntity> getVerificaGiacenzeRowList() {
|
||||||
|
return verificaGiacenzeRowList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVerificaGiacenzeRowList(List<VerificaGiacenzeRowEntity> verificaGiacenzeRowList) {
|
||||||
|
this.verificaGiacenzeRowList = verificaGiacenzeRowList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
VerificaGiacenzeEntity that = (VerificaGiacenzeEntity) o;
|
||||||
|
return getId().equals(that.getId()) && getCodMdep().equals(that.getCodMdep()) && Objects.equals(getData(), that.getData()) && Objects.equals(getVerificaGiacenzeRowList(), that.getVerificaGiacenzeRowList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = getId().hashCode();
|
||||||
|
result = 31 * result + getCodMdep().hashCode();
|
||||||
|
result = 31 * result + Objects.hashCode(getData());
|
||||||
|
result = 31 * result + Objects.hashCode(getVerificaGiacenzeRowList());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,211 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.room.ColumnInfo;
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.ForeignKey;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInterface;
|
||||||
|
|
||||||
|
@Entity(
|
||||||
|
inheritSuperIndices = true,
|
||||||
|
tableName = VerificaGiacenzeRowEntity.TABLE_NAME,
|
||||||
|
foreignKeys = {
|
||||||
|
@ForeignKey(
|
||||||
|
entity = VerificaGiacenzeEntity.class,
|
||||||
|
parentColumns = {BaseSyncDTO.Columns.ID},
|
||||||
|
childColumns = {VerificaGiacenzeRowEntity.Columns.PARENT_ID},
|
||||||
|
onDelete = ForeignKey.CASCADE
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
public class VerificaGiacenzeRowEntity extends BaseSyncDTO implements EntityModelInterface, Cloneable {
|
||||||
|
public static final String TABLE_NAME = "verifica_giacenze_rows";
|
||||||
|
|
||||||
|
public static class Columns {
|
||||||
|
public static final String PARENT_ID = "parent_id";
|
||||||
|
public static final String CREATED_AT = "created_at";
|
||||||
|
public static final String COD_MART = "cod_mart";
|
||||||
|
public static final String PARTITA_MAG = "partita_mag";
|
||||||
|
public static final String DESCRIZIONE = "descrizione";
|
||||||
|
public static final String QTA_IN_GIACENZA = "qta_in_giacenza";
|
||||||
|
public static final String QTA = "qta";
|
||||||
|
public static final String NUM_CNF = "num_cnf";
|
||||||
|
public static final String QTA_CNF = "qta_cnf";
|
||||||
|
public static final String SCAN_COD_BARRE = "scan_cod_barre";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ColumnInfo(index = true, name = Columns.PARENT_ID)
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@ColumnInfo(name = Columns.CREATED_AT, defaultValue = "CURRENT_TIMESTAMP")
|
||||||
|
private LocalDateTime createdAt = LocalDateTime.now();
|
||||||
|
|
||||||
|
@ColumnInfo(name = Columns.COD_MART)
|
||||||
|
private String codMart;
|
||||||
|
|
||||||
|
@ColumnInfo(name = Columns.PARTITA_MAG)
|
||||||
|
private String partitaMag;
|
||||||
|
|
||||||
|
@ColumnInfo(name = Columns.DESCRIZIONE)
|
||||||
|
private String descrizione;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@ColumnInfo(name = Columns.QTA_IN_GIACENZA, defaultValue = "0")
|
||||||
|
private BigDecimal qtaInGiacenza;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@ColumnInfo(name = Columns.QTA, defaultValue = "0")
|
||||||
|
private BigDecimal qta;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@ColumnInfo(name = Columns.NUM_CNF, defaultValue = "0")
|
||||||
|
private BigDecimal numConf;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@ColumnInfo(name = Columns.QTA_CNF, defaultValue = "0")
|
||||||
|
private BigDecimal qtaConf;
|
||||||
|
|
||||||
|
@ColumnInfo(name = Columns.SCAN_COD_BARRE)
|
||||||
|
private String scanCodBarre;
|
||||||
|
|
||||||
|
|
||||||
|
public Long getParentId() {
|
||||||
|
return parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentId(Long parentId) {
|
||||||
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAt(LocalDateTime createdAt) {
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPartitaMag() {
|
||||||
|
return partitaMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPartitaMag(String partitaMag) {
|
||||||
|
this.partitaMag = partitaMag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public BigDecimal getQtaInGiacenza() {
|
||||||
|
return qtaInGiacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaInGiacenza(@NonNull BigDecimal qtaInGiacenza) {
|
||||||
|
this.qtaInGiacenza = qtaInGiacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public BigDecimal getQta() {
|
||||||
|
return qta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQta(@NonNull BigDecimal qta) {
|
||||||
|
this.qta = qta;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public BigDecimal getNumConf() {
|
||||||
|
return numConf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumConf(@NonNull BigDecimal numConf) {
|
||||||
|
this.numConf = numConf;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public BigDecimal getQtaConf() {
|
||||||
|
return qtaConf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaConf(@NonNull BigDecimal qtaConf) {
|
||||||
|
this.qtaConf = qtaConf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScanCodBarre() {
|
||||||
|
return scanCodBarre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScanCodBarre(String scanCodBarre) {
|
||||||
|
this.scanCodBarre = scanCodBarre;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
VerificaGiacenzeRowEntity that = (VerificaGiacenzeRowEntity) o;
|
||||||
|
return getId().equals(that.getId()) && getParentId().equals(that.getParentId()) && getCodMart().equals(that.getCodMart()) && Objects.equals(getPartitaMag(), that.getPartitaMag()) && getQta().equals(that.getQta()) && getNumConf().equals(that.getNumConf()) && getQtaConf().equals(that.getQtaConf()) && Objects.equals(getScanCodBarre(), that.getScanCodBarre());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = getId().hashCode();
|
||||||
|
result = 31 * result + getParentId().hashCode();
|
||||||
|
result = 31 * result + getCodMart().hashCode();
|
||||||
|
result = 31 * result + Objects.hashCode(getPartitaMag());
|
||||||
|
result = 31 * result + getQta().hashCode();
|
||||||
|
result = 31 * result + getNumConf().hashCode();
|
||||||
|
result = 31 * result + getQtaConf().hashCode();
|
||||||
|
result = 31 * result + Objects.hashCode(getScanCodBarre());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public VerificaGiacenzeRowEntity clone() throws CloneNotSupportedException {
|
||||||
|
try {
|
||||||
|
VerificaGiacenzeRowEntity clone = (VerificaGiacenzeRowEntity) super.clone();
|
||||||
|
|
||||||
|
// Clona ID
|
||||||
|
clone.setId(getId() != null ? new Long(getId()) : null);
|
||||||
|
clone.setParentId(getParentId() != null ? new Long(getParentId()) : null);
|
||||||
|
|
||||||
|
// Clona le stringhe
|
||||||
|
clone.setCodMart(getCodMart() != null ? new String(getCodMart()) : null);
|
||||||
|
clone.setPartitaMag(getPartitaMag() != null ? new String(getPartitaMag()) : null);
|
||||||
|
clone.setDescrizione(getDescrizione() != null ? new String(getDescrizione()) : null);
|
||||||
|
clone.setScanCodBarre(getScanCodBarre() != null ? new String(getScanCodBarre()) : null);
|
||||||
|
|
||||||
|
// Clona i BigDecimal
|
||||||
|
clone.setQta(getQta() != null ? new BigDecimal(getQta().toString()) : null);
|
||||||
|
clone.setNumConf(getNumConf() != null ? new BigDecimal(getNumConf().toString()) : null);
|
||||||
|
clone.setQtaConf(getQtaConf() != null ? new BigDecimal(getQtaConf().toString()) : null);
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
} catch (CloneNotSupportedException e) {
|
||||||
|
throw new AssertionError(); // Can't happen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ import java.util.concurrent.ExecutorService;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioLocalDataSource;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.InventarioLocalDataSource;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.mapper.InventarioMapper;
|
import it.integry.integrywmsnative.core.mapper.InventarioMapper;
|
||||||
@@ -24,13 +24,13 @@ import it.integry.integrywmsnative.core.rest.consumers.InventarioRESTConsumer;
|
|||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityLiveData;
|
import it.integry.integrywmsnative.core.utility.UtilityLiveData;
|
||||||
|
|
||||||
public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioRoomDTO, InventarioMapper, InventarioLocalDataSource, InventarioRESTConsumer> {
|
public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioEntity, InventarioMapper, InventarioLocalDataSource, InventarioRESTConsumer> {
|
||||||
|
|
||||||
private final ExecutorService executorService;
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
private final Handler handler;
|
private final Handler handler;
|
||||||
|
|
||||||
private final MutableLiveData<List<InventarioRoomDTO>> internalLiveData = new MutableLiveData<>();
|
private final MutableLiveData<List<InventarioEntity>> internalLiveData = new MutableLiveData<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public InventarioRepository(InventarioLocalDataSource localDataSource,
|
public InventarioRepository(InventarioLocalDataSource localDataSource,
|
||||||
@@ -44,7 +44,7 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public LiveData<List<InventarioRoomDTO>> retrieve(Runnable onComplete, RunnableArgs<Exception> onError) {
|
public LiveData<List<InventarioEntity>> retrieve(Runnable onComplete, RunnableArgs<Exception> onError) {
|
||||||
localDataSource.makeSynchronousRetrieveAllLive(false)
|
localDataSource.makeSynchronousRetrieveAllLive(false)
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
.subscribe(internalLiveData::postValue);
|
.subscribe(internalLiveData::postValue);
|
||||||
@@ -84,13 +84,13 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insert(InventarioRoomDTO inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
|
public void insert(InventarioEntity inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
|
||||||
localDataSource.makeInsertRequest(inventarioDTO, localResult -> {
|
localDataSource.makeInsertRequest(inventarioDTO, localResult -> {
|
||||||
if (onComplete != null) handler.post(onComplete);
|
if (onComplete != null) handler.post(onComplete);
|
||||||
}, onError);
|
}, onError);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void export(InventarioRoomDTO inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
|
public void export(InventarioEntity inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
|
||||||
remoteDataSource.makeInsertRequest(dataMapper.mapRoomToRest(inventarioDTO), () -> {
|
remoteDataSource.makeInsertRequest(dataMapper.mapRoomToRest(inventarioDTO), () -> {
|
||||||
inventarioDTO.setRemoteSyncDate(new Date());
|
inventarioDTO.setRemoteSyncDate(new Date());
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
|
|||||||
}, onError);
|
}, onError);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(InventarioRoomDTO inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
|
public void delete(InventarioEntity inventarioDTO, Runnable onComplete, RunnableArgs<Exception> onError) {
|
||||||
localDataSource.makeDeleteRequest(inventarioDTO, onComplete, onError);
|
localDataSource.makeDeleteRequest(inventarioDTO, onComplete, onError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.respository_new;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.VerificaGiacenzeLocalDataSource;
|
||||||
|
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeMapper;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.VerificaGiacenzeDTO;
|
||||||
|
|
||||||
|
public class VerificaGiacenzeRepository extends _BaseRepository<VerificaGiacenzeDTO, VerificaGiacenzeEntity, VerificaGiacenzeMapper, VerificaGiacenzeLocalDataSource, GiacenzaPvRESTConsumer> {
|
||||||
|
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
private final Handler handler;
|
||||||
|
|
||||||
|
|
||||||
|
public VerificaGiacenzeRepository(VerificaGiacenzeLocalDataSource localDataSource,
|
||||||
|
GiacenzaPvRESTConsumer remoteDataSource,
|
||||||
|
VerificaGiacenzeMapper dataMapper,
|
||||||
|
Handler handler,
|
||||||
|
ExecutorService executorService) {
|
||||||
|
super(dataMapper, localDataSource, remoteDataSource);
|
||||||
|
this.handler = handler;
|
||||||
|
this.executorService = executorService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<VerificaGiacenzeEntity> retrieve() {
|
||||||
|
return localDataSource.makeSynchronousRetrieveAllRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificaGiacenzeEntity retrieveLast() {
|
||||||
|
return localDataSource.makeSynchronousRetrieveLastRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isAnotherVerificaGiacenzeInProgress(int maxMinutes) {
|
||||||
|
return localDataSource.isAnotherVerificaGiacenzeInProgress(maxMinutes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearPreviousSessions() {
|
||||||
|
var entities = retrieve();
|
||||||
|
for (var entity : entities) {
|
||||||
|
localDataSource.makeSynchronousDeleteRequest(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void insert(VerificaGiacenzeEntity entity) {
|
||||||
|
localDataSource.makeSynchronousInsertRequest(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(VerificaGiacenzeEntity entity) {
|
||||||
|
localDataSource.makeSynchronousDeleteRequest(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.respository_new;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.data_source.VerificaGiacenzeRowLocalDataSource;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeRowMapper;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.VerificaGiacenzeRowDTO;
|
||||||
|
|
||||||
|
public class VerificaGiacenzeRowRepository extends _BaseRepository<VerificaGiacenzeRowDTO, VerificaGiacenzeRowEntity, VerificaGiacenzeRowMapper, VerificaGiacenzeRowLocalDataSource, GiacenzaPvRESTConsumer> {
|
||||||
|
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
private final Handler handler;
|
||||||
|
|
||||||
|
|
||||||
|
public VerificaGiacenzeRowRepository(VerificaGiacenzeRowLocalDataSource localDataSource,
|
||||||
|
GiacenzaPvRESTConsumer remoteDataSource,
|
||||||
|
VerificaGiacenzeRowMapper dataMapper,
|
||||||
|
Handler handler,
|
||||||
|
ExecutorService executorService) {
|
||||||
|
super(dataMapper, localDataSource, remoteDataSource);
|
||||||
|
this.handler = handler;
|
||||||
|
this.executorService = executorService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void insertSynchronized(VerificaGiacenzeRowEntity entity) {
|
||||||
|
localDataSource.makeSynchronousInsertRequest(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insert(VerificaGiacenzeRowEntity entity, RunnableArgs<VerificaGiacenzeRowEntity> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
localDataSource.makeInsertRequest(entity, onComplete, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateSynchronized(VerificaGiacenzeRowEntity entity) {
|
||||||
|
localDataSource.makeSynchronousUpdateRequest(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(VerificaGiacenzeRowEntity entity, RunnableArgs<VerificaGiacenzeRowEntity> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
localDataSource.makeUpdateRequest(entity, onComplete, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteSynchronized(VerificaGiacenzeRowEntity entity) {
|
||||||
|
localDataSource.makeSynchronousDeleteRequest(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(VerificaGiacenzeRowEntity entity, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
localDataSource.makeDeleteRequest(entity, onComplete, onFailed);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,24 +8,24 @@ import javax.inject.Singleton;
|
|||||||
|
|
||||||
import io.reactivex.rxjava3.core.Flowable;
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.InventarioDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.InventarioDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class InventarioLocalDataSource extends _BaseRoomDataSource<InventarioRoomDTO, InventarioDao> {
|
public class InventarioLocalDataSource extends _BaseRoomDataSource<InventarioEntity, InventarioDao> {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public InventarioLocalDataSource(ExecutorService executorService, InventarioDao entityDao) {
|
public InventarioLocalDataSource(ExecutorService executorService, InventarioDao entityDao) {
|
||||||
super(executorService, entityDao, InventarioRoomDTO.TABLE_NAME);
|
super(executorService, entityDao, InventarioEntity.TABLE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<InventarioRoomDTO> makeSynchronousRetrieveAllRequest(boolean onlyToBeSync) {
|
public List<InventarioEntity> makeSynchronousRetrieveAllRequest(boolean onlyToBeSync) {
|
||||||
return entityDao
|
return entityDao
|
||||||
.selectAll(onlyToBeSync);
|
.selectAll(onlyToBeSync);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Flowable<List<InventarioRoomDTO>> makeSynchronousRetrieveAllLive(boolean onlyToBeSync) {
|
public Flowable<List<InventarioEntity>> makeSynchronousRetrieveAllLive(boolean onlyToBeSync) {
|
||||||
return entityDao
|
return entityDao
|
||||||
.selectAllFlowable(onlyToBeSync);
|
.selectAllFlowable(onlyToBeSync);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.respository_new.data_source;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.VerificaGiacenzeWithRowsWrapper;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class VerificaGiacenzeLocalDataSource extends _BaseRoomDataSource<VerificaGiacenzeEntity, VerificaGiacenzeDao> {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public VerificaGiacenzeLocalDataSource(ExecutorService executorService, VerificaGiacenzeDao entityDao) {
|
||||||
|
super(executorService, entityDao, VerificaGiacenzeEntity.TABLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VerificaGiacenzeEntity> makeSynchronousRetrieveAllRequest(boolean onlyToBeSync) {
|
||||||
|
var data = entityDao
|
||||||
|
.selectAll(onlyToBeSync);
|
||||||
|
|
||||||
|
return data.stream()
|
||||||
|
.map(x -> {
|
||||||
|
x.verificaGiacenze.setVerificaGiacenzeRowList(x.verificaGiacenzeRowList);
|
||||||
|
return x.verificaGiacenze;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Flowable<List<VerificaGiacenzeEntity>> makeSynchronousRetrieveAllLive(boolean onlyToBeSync) {
|
||||||
|
Flowable<List<VerificaGiacenzeWithRowsWrapper>> listFlowable = entityDao
|
||||||
|
.selectAllFlowable(onlyToBeSync);
|
||||||
|
|
||||||
|
return listFlowable.map(x ->
|
||||||
|
x.stream()
|
||||||
|
.map(y -> {
|
||||||
|
y.verificaGiacenze.setVerificaGiacenzeRowList(y.verificaGiacenzeRowList);
|
||||||
|
return y.verificaGiacenze;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerificaGiacenzeEntity makeSynchronousRetrieveLastRequest(boolean onlyToBeSync) {
|
||||||
|
var lastEntity = entityDao
|
||||||
|
.selectLast(onlyToBeSync);
|
||||||
|
|
||||||
|
lastEntity.verificaGiacenze.setVerificaGiacenzeRowList(lastEntity.verificaGiacenzeRowList);
|
||||||
|
|
||||||
|
return lastEntity.verificaGiacenze;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAnotherVerificaGiacenzeInProgress(int maxMinutes) {
|
||||||
|
return entityDao.isAnotherVerificaGiacenzeInProgress(maxMinutes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.respository_new.data_source;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.VerificaGiacenzeRowDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class VerificaGiacenzeRowLocalDataSource extends _BaseRoomDataSource<VerificaGiacenzeRowEntity, VerificaGiacenzeRowDao> {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public VerificaGiacenzeRowLocalDataSource(ExecutorService executorService, VerificaGiacenzeRowDao entityDao) {
|
||||||
|
super(executorService, entityDao, VerificaGiacenzeRowEntity.TABLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VerificaGiacenzeRowEntity> makeSynchronousRetrieveAllRequest(boolean onlyToBeSync) {
|
||||||
|
var data = entityDao
|
||||||
|
.selectAll(onlyToBeSync);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Flowable<List<VerificaGiacenzeRowEntity>> makeSynchronousRetrieveAllLive(boolean onlyToBeSync) {
|
||||||
|
return entityDao
|
||||||
|
.selectAllFlowable(onlyToBeSync);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.wrappers;
|
||||||
|
|
||||||
|
import androidx.room.DatabaseView;
|
||||||
|
import androidx.room.Embedded;
|
||||||
|
import androidx.room.Relation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.BaseSyncDTO;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
|
||||||
|
|
||||||
|
@DatabaseView
|
||||||
|
public class VerificaGiacenzeWithRowsWrapper {
|
||||||
|
|
||||||
|
@Embedded
|
||||||
|
public VerificaGiacenzeEntity verificaGiacenze;
|
||||||
|
|
||||||
|
@Relation(
|
||||||
|
parentColumn = BaseSyncDTO.Columns.ID,
|
||||||
|
entityColumn = VerificaGiacenzeRowEntity.Columns.PARENT_ID
|
||||||
|
)
|
||||||
|
public List<VerificaGiacenzeRowEntity> verificaGiacenzeRowList;
|
||||||
|
}
|
||||||
@@ -4,9 +4,6 @@ import androidx.databinding.BaseObservable;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.CommonConst;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
|
||||||
|
|
||||||
public class BindableFloat extends BaseObservable {
|
public class BindableFloat extends BaseObservable {
|
||||||
private Float value;
|
private Float value;
|
||||||
|
|
||||||
@@ -15,10 +12,6 @@ public class BindableFloat extends BaseObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getBigDecimal() {
|
public BigDecimal getBigDecimal() {
|
||||||
int numberOfDigits = UtilityNumber.countNumberOfDecimalDigits(get());
|
|
||||||
|
|
||||||
if(numberOfDigits > CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS) numberOfDigits = CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS;
|
|
||||||
|
|
||||||
return BigDecimal.valueOf(get());
|
return BigDecimal.valueOf(get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import android.widget.EditText;
|
|||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.ColorRes;
|
import androidx.annotation.ColorRes;
|
||||||
import androidx.appcompat.widget.AppCompatCheckBox;
|
import androidx.appcompat.widget.AppCompatCheckBox;
|
||||||
@@ -24,6 +25,10 @@ import androidx.databinding.BindingAdapter;
|
|||||||
import androidx.databinding.BindingConversion;
|
import androidx.databinding.BindingConversion;
|
||||||
import androidx.databinding.Observable;
|
import androidx.databinding.Observable;
|
||||||
import androidx.databinding.ObservableField;
|
import androidx.databinding.ObservableField;
|
||||||
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.lifecycle.Observer;
|
||||||
|
import androidx.lifecycle.ViewTreeLifecycleOwner;
|
||||||
|
|
||||||
import com.google.android.material.datepicker.MaterialDatePicker;
|
import com.google.android.material.datepicker.MaterialDatePicker;
|
||||||
import com.google.android.material.textfield.TextInputEditText;
|
import com.google.android.material.textfield.TextInputEditText;
|
||||||
@@ -33,6 +38,8 @@ import java.math.BigDecimal;
|
|||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -41,6 +48,7 @@ import it.integry.integrywmsnative.MainApplication;
|
|||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.LocaleDecimalKeyListener;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||||
@@ -257,7 +265,7 @@ public class Converters {
|
|||||||
BigDecimal value = null;
|
BigDecimal value = null;
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(s.toString()))
|
if (!UtilityString.isNullOrEmpty(s.toString()))
|
||||||
value = new BigDecimal(s.toString());
|
value = UtilityNumber.parseBigDecimal(s.toString(), Locale.getDefault());
|
||||||
|
|
||||||
observableBigDecimal.set(value);
|
observableBigDecimal.set(value);
|
||||||
}
|
}
|
||||||
@@ -267,7 +275,7 @@ public class Converters {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal newValue = observableBigDecimal.get();
|
BigDecimal newValue = observableBigDecimal.get();
|
||||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
|
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
|
||||||
|
|
||||||
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||||
view.setText(UtilityNumber.decimalToString(newValue));
|
view.setText(UtilityNumber.decimalToString(newValue));
|
||||||
@@ -288,7 +296,7 @@ public class Converters {
|
|||||||
String newValueString = s.toString().trim();
|
String newValueString = s.toString().trim();
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(newValueString))
|
if (!UtilityString.isNullOrEmpty(newValueString))
|
||||||
value = new BigDecimal(newValueString);
|
value = UtilityNumber.parseBigDecimal(newValueString, Locale.getDefault());
|
||||||
|
|
||||||
observableBigDecimal.set(value);
|
observableBigDecimal.set(value);
|
||||||
}
|
}
|
||||||
@@ -297,7 +305,7 @@ public class Converters {
|
|||||||
view.addTextChangedListener(watcher);
|
view.addTextChangedListener(watcher);
|
||||||
}
|
}
|
||||||
BigDecimal newValue = observableBigDecimal.get();
|
BigDecimal newValue = observableBigDecimal.get();
|
||||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
|
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
|
||||||
|
|
||||||
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||||
view.setText(UtilityNumber.decimalToString(newValue));
|
view.setText(UtilityNumber.decimalToString(newValue));
|
||||||
@@ -318,7 +326,7 @@ public class Converters {
|
|||||||
String newValueString = s.toString().trim();
|
String newValueString = s.toString().trim();
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(newValueString))
|
if (!UtilityString.isNullOrEmpty(newValueString))
|
||||||
value = new BigDecimal(newValueString);
|
value = UtilityNumber.parseBigDecimal(newValueString, Locale.getDefault());
|
||||||
|
|
||||||
observableBigDecimal.set(value);
|
observableBigDecimal.set(value);
|
||||||
}
|
}
|
||||||
@@ -327,7 +335,7 @@ public class Converters {
|
|||||||
view.addTextChangedListener(watcher);
|
view.addTextChangedListener(watcher);
|
||||||
}
|
}
|
||||||
BigDecimal newValue = observableBigDecimal.get();
|
BigDecimal newValue = observableBigDecimal.get();
|
||||||
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
|
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
|
||||||
|
|
||||||
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||||
view.setText(UtilityNumber.decimalToString(newValue));
|
view.setText(UtilityNumber.decimalToString(newValue));
|
||||||
@@ -346,7 +354,8 @@ public class Converters {
|
|||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
BigDecimal value = null;
|
BigDecimal value = null;
|
||||||
if (!UtilityString.isNullOrEmpty(s.toString()))
|
if (!UtilityString.isNullOrEmpty(s.toString()))
|
||||||
value = new BigDecimal(s.toString());
|
value = UtilityNumber.parseBigDecimal(s.toString(), Locale.getDefault());
|
||||||
|
|
||||||
bindableBigDecimal.set(value);
|
bindableBigDecimal.set(value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -354,7 +363,7 @@ public class Converters {
|
|||||||
view.addTextChangedListener(watcher);
|
view.addTextChangedListener(watcher);
|
||||||
}
|
}
|
||||||
BigDecimal newValue = bindableBigDecimal.get();
|
BigDecimal newValue = bindableBigDecimal.get();
|
||||||
BigDecimal viewValue = view.getText().toString().trim().length() > 0 ? new BigDecimal(view.getText().toString()) : null;
|
BigDecimal viewValue = !view.getText().toString().trim().isEmpty() ? UtilityNumber.parseBigDecimal(view.getText().toString(), Locale.getDefault()) : null;
|
||||||
|
|
||||||
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||||
view.setText(UtilityNumber.decimalToString(newValue));
|
view.setText(UtilityNumber.decimalToString(newValue));
|
||||||
@@ -381,7 +390,7 @@ public class Converters {
|
|||||||
view.addTextChangedListener(watcher);
|
view.addTextChangedListener(watcher);
|
||||||
}
|
}
|
||||||
Integer newValue = bindableInteger.get();
|
Integer newValue = bindableInteger.get();
|
||||||
Integer viewValue = view.getText().toString().trim().length() > 0 ? Integer.valueOf(view.getText().toString()) : Integer.valueOf(0);
|
Integer viewValue = !view.getText().toString().trim().isEmpty() ? Integer.valueOf(view.getText().toString()) : Integer.valueOf(0);
|
||||||
|
|
||||||
if (!(viewValue.compareTo(newValue) == 0)) {
|
if (!(viewValue.compareTo(newValue) == 0)) {
|
||||||
view.setText(newValue.toString());
|
view.setText(newValue.toString());
|
||||||
@@ -432,7 +441,7 @@ public class Converters {
|
|||||||
view.addTextChangedListener(watcher);
|
view.addTextChangedListener(watcher);
|
||||||
}
|
}
|
||||||
Integer newValue = observableInteger.get();
|
Integer newValue = observableInteger.get();
|
||||||
Integer viewValue = view.getText().toString().trim().length() > 0 ? Integer.valueOf(view.getText().toString()) : Integer.valueOf(0);
|
Integer viewValue = !view.getText().toString().trim().isEmpty() ? Integer.valueOf(view.getText().toString()) : Integer.valueOf(0);
|
||||||
|
|
||||||
if (!viewValue.equals(newValue) && newValue != null) {
|
if (!viewValue.equals(newValue) && newValue != null) {
|
||||||
view.setText(newValue.toString());
|
view.setText(newValue.toString());
|
||||||
@@ -459,7 +468,7 @@ public class Converters {
|
|||||||
view.addTextChangedListener(watcher);
|
view.addTextChangedListener(watcher);
|
||||||
}
|
}
|
||||||
Long newValue = observableLong.get();
|
Long newValue = observableLong.get();
|
||||||
Long viewValue = view.getText().toString().trim().length() > 0 ? Long.valueOf(view.getText().toString()) : Long.valueOf(0);
|
Long viewValue = !view.getText().toString().trim().isEmpty() ? Long.valueOf(view.getText().toString()) : Long.valueOf(0);
|
||||||
|
|
||||||
if (!viewValue.equals(newValue) && newValue != null) {
|
if (!viewValue.equals(newValue) && newValue != null) {
|
||||||
view.setText(newValue.toString());
|
view.setText(newValue.toString());
|
||||||
@@ -820,11 +829,11 @@ public class Converters {
|
|||||||
|
|
||||||
|
|
||||||
@BindingAdapter("visibilityWhenNotNull")
|
@BindingAdapter("visibilityWhenNotNull")
|
||||||
public static void bindViewVisibilityWhenNotNull(View view, ObservableField<?> bindableObject) {
|
public static void bindViewVisibilityObservableFieldWhenNotNull(View view, ObservableField<?> bindableObject) {
|
||||||
if(bindableObject == null) return;
|
if(bindableObject == null) return;
|
||||||
|
|
||||||
if (view.getTag(R.id.bound_observable) != bindableObject) {
|
if (view.getTag(R.id.bound_observable_visibility) != bindableObject) {
|
||||||
view.setTag(R.id.bound_observable, bindableObject);
|
view.setTag(R.id.bound_observable_visibility, bindableObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
bindableObject.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
bindableObject.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||||
@@ -838,8 +847,44 @@ public class Converters {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@BindingAdapter("visibilityWhenNotNull")
|
||||||
|
public static void bindViewVisibilityLiveDataWhenNotNull(View view, LiveData<?> liveData) {
|
||||||
|
// Se il LiveData è null, nascondi la view e esci
|
||||||
|
if (liveData == null) {
|
||||||
|
view.setVisibility(View.GONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ottieni il LifecycleOwner dalla view
|
||||||
|
LifecycleOwner lifecycleOwner = ViewTreeLifecycleOwner.get(view);
|
||||||
|
if (lifecycleOwner == null) return;
|
||||||
|
|
||||||
|
// Rimuovi eventuali observer precedenti
|
||||||
|
Observer<Object> oldObserver = (Observer<Object>) view.getTag(R.id.bound_observable_visibility);
|
||||||
|
if (oldObserver != null) {
|
||||||
|
liveData.removeObserver(oldObserver);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crea e registra il nuovo observer
|
||||||
|
Observer<Object> newObserver = value ->
|
||||||
|
view.setVisibility(value == null ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
|
liveData.observe(lifecycleOwner, newObserver);
|
||||||
|
view.setTag(R.id.bound_observable_visibility, newObserver);
|
||||||
|
|
||||||
|
// Imposta lo stato iniziale
|
||||||
|
view.setVisibility(liveData.getValue() == null ? View.GONE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@BindingAdapter("visibilityWhenNotNull")
|
||||||
|
public static void bindViewVisibilityWhenNotNull(View view, Object genericObject) {
|
||||||
|
view.setVisibility(genericObject == null ? View.GONE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@BindingAdapter("visibilityWhenNull")
|
@BindingAdapter("visibilityWhenNull")
|
||||||
public static void bindViewVisibilityWhenNull(View view, ObservableField<?> bindableObject) {
|
public static void bindViewVisibilityObservableFieldWhenNull(View view, ObservableField<?> bindableObject) {
|
||||||
|
|
||||||
if (view.getTag(R.id.bound_observable_visibility) != bindableObject) {
|
if (view.getTag(R.id.bound_observable_visibility) != bindableObject) {
|
||||||
view.setTag(R.id.bound_observable_visibility, bindableObject);
|
view.setTag(R.id.bound_observable_visibility, bindableObject);
|
||||||
@@ -858,6 +903,36 @@ public class Converters {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@BindingAdapter("visibilityWhenNull")
|
||||||
|
public static void bindViewVisibilityLiveDataWhenNull(View view, LiveData<?> liveData) {
|
||||||
|
// Se il LiveData è null, nascondi la view e esci
|
||||||
|
if (liveData == null) {
|
||||||
|
view.setVisibility(View.VISIBLE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ottieni il LifecycleOwner dalla view
|
||||||
|
LifecycleOwner lifecycleOwner = ViewTreeLifecycleOwner.get(view);
|
||||||
|
if (lifecycleOwner == null) return;
|
||||||
|
|
||||||
|
// Rimuovi eventuali observer precedenti
|
||||||
|
Observer<Object> oldObserver = (Observer<Object>) view.getTag(R.id.bound_observable_visibility);
|
||||||
|
if (oldObserver != null) {
|
||||||
|
liveData.removeObserver(oldObserver);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crea e registra il nuovo observer
|
||||||
|
Observer<Object> newObserver = value ->
|
||||||
|
view.setVisibility(value == null ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
|
liveData.observe(lifecycleOwner, newObserver);
|
||||||
|
view.setTag(R.id.bound_observable_visibility, newObserver);
|
||||||
|
|
||||||
|
// Imposta lo stato iniziale
|
||||||
|
view.setVisibility(liveData.getValue() == null ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@BindingAdapter({"reverse_visibility"})
|
@BindingAdapter({"reverse_visibility"})
|
||||||
public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) {
|
public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) {
|
||||||
if (view.getTag(R.id.bound_reverse_visibility) != bindableBoolean) {
|
if (view.getTag(R.id.bound_reverse_visibility) != bindableBoolean) {
|
||||||
@@ -904,4 +979,64 @@ public class Converters {
|
|||||||
view.setLayoutParams(layoutParams);
|
view.setLayoutParams(layoutParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* BindingAdapter per bindare una LocalDate diretta su una TextView con un formato specificato.
|
||||||
|
* Esempio di utilizzo in XML:
|
||||||
|
* app:localDateText="@{myLocalDate}" app:dateFormat="@{@string/my_date_format}"
|
||||||
|
*/
|
||||||
|
@BindingAdapter(value = {"localDateText", "dateFormat"}, requireAll = false)
|
||||||
|
public static void bindLocalDateText(TextView view, LocalDate date, String dateFormat) {
|
||||||
|
if (date == null) {
|
||||||
|
view.setText("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String pattern = dateFormat != null ? dateFormat : "dd/MM/yyyy";
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
view.setText(date.format(formatter));
|
||||||
|
}
|
||||||
|
|
||||||
|
@BindingAdapter(value = {"localDateTimeText", "dateFormat"}, requireAll = false)
|
||||||
|
public static void bindLocalDateText(TextView view, LocalDateTime date, String dateFormat) {
|
||||||
|
if (date == null) {
|
||||||
|
view.setText("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String pattern = dateFormat != null ? dateFormat : "dd/MM/yyyy hh:mm";
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
view.setText(date.format(formatter));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BindingAdapter per bindare una ObservableField<LocalDate> su una TextView con un formato specificato.
|
||||||
|
* Esempio di utilizzo in XML:
|
||||||
|
* app:localDateObservableText="@{myObservableLocalDate}" app:dateFormat="@{@string/my_date_format}"
|
||||||
|
*/
|
||||||
|
@BindingAdapter(value = {"localDateObservableText", "dateFormat"}, requireAll = false)
|
||||||
|
public static void bindObservableLocalDateText(TextView view, ObservableField<LocalDate> observableDate, String dateFormat) {
|
||||||
|
if (observableDate == null) {
|
||||||
|
view.setText("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LocalDate date = observableDate.get();
|
||||||
|
if (date == null) {
|
||||||
|
view.setText("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String pattern = dateFormat != null ? dateFormat : "dd/MM/yyyy";
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
view.setText(date.format(formatter));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BindingAdapter che applica automaticamente il KeyListener localizzato
|
||||||
|
* ai campi con inputType numberDecimal, permettendo l'uso della virgola
|
||||||
|
* come separatore decimale in base al locale del dispositivo.
|
||||||
|
*/
|
||||||
|
@BindingAdapter("useLocaleDecimalInput")
|
||||||
|
public static void setLocaleDecimalInput(EditText view, boolean useLocaleInput) {
|
||||||
|
if (useLocaleInput) {
|
||||||
|
view.setKeyListener(LocaleDecimalKeyListener.getInstance());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
package it.integry.integrywmsnative.core.di.binders.recyclerview;
|
package it.integry.integrywmsnative.core.di.binders.recyclerview;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
import androidx.databinding.ObservableList;
|
import androidx.databinding.ObservableList;
|
||||||
import androidx.databinding.ViewDataBinding;
|
import androidx.databinding.ViewDataBinding;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|||||||
@@ -66,9 +66,6 @@ public class Ean128Service {
|
|||||||
|
|
||||||
switch (aiModel.AI) {
|
switch (aiModel.AI) {
|
||||||
case SSCC -> {
|
case SSCC -> {
|
||||||
if (aiValue.length() > 0 && (aiValue.charAt(0) == '0' || aiValue.charAt(0) == '9')) {
|
|
||||||
aiValue = new StringBuilder(aiValue.substring(1));
|
|
||||||
}
|
|
||||||
model.Sscc = aiValue.toString();
|
model.Sscc = aiValue.toString();
|
||||||
}
|
}
|
||||||
case GTIN -> {
|
case GTIN -> {
|
||||||
@@ -228,13 +225,13 @@ public class Ean128Service {
|
|||||||
case SHIP_TO_POST -> model.ShipToPost = aiValue.toString();
|
case SHIP_TO_POST -> model.ShipToPost = aiValue.toString();
|
||||||
case SHIP_TO_POST_ISO ->
|
case SHIP_TO_POST_ISO ->
|
||||||
model.ShipToPostISO = convertToIsoValueModel(aiValue.toString(), 0,
|
model.ShipToPostISO = convertToIsoValueModel(aiValue.toString(), 0,
|
||||||
new Callable<String, String>() {
|
new Callable<>() {
|
||||||
@Override
|
@Override
|
||||||
public String call(String input) {
|
public String call(String input) {
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new CallableII<String, Integer, String>() {
|
new CallableII<>() {
|
||||||
@Override
|
@Override
|
||||||
public String call(String input, Integer input2) {
|
public String call(String input, Integer input2) {
|
||||||
return input;
|
return input;
|
||||||
@@ -300,7 +297,7 @@ public class Ean128Service {
|
|||||||
|
|
||||||
T value = castFunc.call(splitFunc.call(sourceString.substring(3), numberOfDecimalDigits));
|
T value = castFunc.call(splitFunc.call(sourceString.substring(3), numberOfDecimalDigits));
|
||||||
|
|
||||||
Ean128ISOValueModel<T> isoModel = new Ean128ISOValueModel<T>();
|
Ean128ISOValueModel<T> isoModel = new Ean128ISOValueModel<>();
|
||||||
isoModel.ISOCode = isoCode;
|
isoModel.ISOCode = isoCode;
|
||||||
isoModel.Value = value;
|
isoModel.Value = value;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package it.integry.integrywmsnative.core.event;
|
||||||
|
|
||||||
|
public class SessionExpiredEvent {
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package it.integry.integrywmsnative.core.exception;
|
||||||
|
|
||||||
|
public class InvalidCodMdepBarcodeException extends RuntimeException {
|
||||||
|
|
||||||
|
public InvalidCodMdepBarcodeException(String message) {
|
||||||
|
super("Il deposito scansionato non è valido: " + message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,13 @@ import it.integry.integrywmsnative.R;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
public final class InvalidCodMdepException extends Exception {
|
public final class InvalidCodMdepException extends Exception {
|
||||||
|
|
||||||
public InvalidCodMdepException() {
|
public InvalidCodMdepException() {
|
||||||
super(UtilityResources.getString(R.string.invalid_codmdep));
|
super(UtilityResources.getString(R.string.invalid_codmdep_error_message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InvalidCodMdepException(String codMdep) {
|
||||||
|
super(UtilityResources.getString(R.string.invalid_codmdep_error_message) + "(" + codMdep + ")");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package it.integry.integrywmsnative.core.exception;
|
||||||
|
|
||||||
|
public class UnauthorizedAccessException extends Exception {
|
||||||
|
public UnauthorizedAccessException() {
|
||||||
|
super("Accesso non autorizzato. Si prega di effettuare nuovamente l'accesso e riprovare");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,7 +34,6 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onLoadingStarted() {
|
public void onLoadingStarted() {
|
||||||
BarcodeManager.disable();
|
|
||||||
this.openProgress();
|
this.openProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,14 +51,14 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
private void openProgress() {
|
private void openProgress() {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disableLastCallback();
|
||||||
// executorService.execute(() -> {
|
// executorService.execute(() -> {
|
||||||
this.mCurrentProgress.show(getSupportFragmentManager());
|
this.mCurrentProgress.show(getSupportFragmentManager());
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeProgress() {
|
private void closeProgress() {
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enableLastCallback();
|
||||||
// executorService.execute(() -> {
|
// executorService.execute(() -> {
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
// });
|
// });
|
||||||
@@ -67,7 +66,7 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||||
if (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE && !isControlKey(event)) {
|
if (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE && !isControlKey(event)) {
|
||||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,11 @@ package it.integry.integrywmsnative.core.expansion;
|
|||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.pointmobilescannerlibrary.PointMobileBarcodeReader;
|
|
||||||
|
|
||||||
public class BaseDialog extends Dialog {
|
public class BaseDialog extends Dialog {
|
||||||
|
|
||||||
@@ -18,7 +14,7 @@ public class BaseDialog extends Dialog {
|
|||||||
|
|
||||||
public BaseDialog(@NonNull Context context) {
|
public BaseDialog(@NonNull Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||||
setOnKeyListener((dialog, keyCode, event) -> {
|
setOnKeyListener((dialog, keyCode, event) -> {
|
||||||
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
||||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||||
|
|||||||
@@ -65,25 +65,23 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onLoadingStarted() {
|
public void onLoadingStarted() {
|
||||||
BarcodeManager.disable();
|
|
||||||
this.openProgress();
|
this.openProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLoadingEnded() {
|
public void onLoadingEnded() {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
BarcodeManager.enable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void openProgress() {
|
private void openProgress() {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disableLastCallback();
|
||||||
// executorService.execute(() -> {
|
// executorService.execute(() -> {
|
||||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
|
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeProgress() {
|
private void closeProgress() {
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enableLastCallback();
|
||||||
// executorService.execute(() -> {
|
// executorService.execute(() -> {
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
// });
|
// });
|
||||||
@@ -91,9 +89,8 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
|
|||||||
|
|
||||||
|
|
||||||
public void onError(Exception ex) {
|
public void onError(Exception ex) {
|
||||||
this.onLoadingEnded();
|
|
||||||
|
|
||||||
requireActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
this.onLoadingEnded();
|
||||||
UtilityExceptions.defaultException(requireActivity(), ex);
|
UtilityExceptions.defaultException(requireActivity(), ex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -130,7 +127,7 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
|
|||||||
.create()
|
.create()
|
||||||
.inject(this);
|
.inject(this);
|
||||||
|
|
||||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator() && getDialog() != null) {
|
if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator() && getDialog() != null) {
|
||||||
getDialog().setOnKeyListener((dialog, keyCode, event) -> {
|
getDialog().setOnKeyListener((dialog, keyCode, event) -> {
|
||||||
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
||||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.core.expansion;
|
package it.integry.integrywmsnative.core.expansion;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -30,6 +31,9 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
@Inject
|
@Inject
|
||||||
public ExecutorService executorService;
|
public ExecutorService executorService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public Handler handler;
|
||||||
|
|
||||||
protected ElevatedToolbar mToolbar;
|
protected ElevatedToolbar mToolbar;
|
||||||
|
|
||||||
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||||
@@ -65,24 +69,23 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void openProgress() {
|
private void openProgress() {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disableLastCallback();
|
||||||
// executorService.execute(() -> {
|
// executorService.execute(() -> {
|
||||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
|
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeProgress() {
|
private void closeProgress() {
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enableLastCallback();
|
||||||
// executorService.execute(() -> {
|
// executorService.execute(() -> {
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onError(Exception ex) {
|
public void onError(Exception ex) {
|
||||||
requireActivity().runOnUiThread(() -> {
|
handler.post(() -> {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
UtilityExceptions.defaultException(getActivity(), ex);
|
UtilityExceptions.defaultException(getActivity(), ex);
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +105,7 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
|
|
||||||
protected void popMe() {
|
protected void popMe() {
|
||||||
if (requireActivity() instanceof IPoppableActivity) {
|
if (requireActivity() instanceof IPoppableActivity) {
|
||||||
requireActivity().runOnUiThread(() -> {
|
handler.post(() -> {
|
||||||
((IPoppableActivity) requireActivity()).pop();
|
((IPoppableActivity) requireActivity()).pop();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion.view;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
import androidx.databinding.ObservableList;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||||
|
|
||||||
|
public abstract class ExtendedSectionedRecyclerViewNew<T, SH extends RecyclerView.ViewHolder, VH extends RecyclerView.ViewHolder>
|
||||||
|
extends SectionedRecyclerViewAdapter<SH, VH> {
|
||||||
|
|
||||||
|
private View mEmptyView;
|
||||||
|
|
||||||
|
public ExtendedSectionedRecyclerViewNew(ObservableArrayList<T> myDataset) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback<T>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(ObservableList<T> sender) {
|
||||||
|
checkIfEmpty();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
checkIfEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExtendedSectionedRecyclerViewNew<T, SH, VH> setEmptyView(View emptyView) {
|
||||||
|
this.mEmptyView = emptyView;
|
||||||
|
this.checkIfEmpty();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void checkIfEmpty() {
|
||||||
|
if (mEmptyView != null) {
|
||||||
|
final boolean emptyViewVisible = getItemCount() == 0;
|
||||||
|
mEmptyView.setVisibility(emptyViewVisible ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,218 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion.view;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.util.SparseArray;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
public class RecyclerViewProfiler {
|
||||||
|
private static final String TAG = "RVProfiler";
|
||||||
|
private final SparseArray<Long> bindingTimes;
|
||||||
|
private final SparseArray<Long> creationTimes;
|
||||||
|
private final Handler mainHandler;
|
||||||
|
private WeakReference<RecyclerView> recyclerViewRef;
|
||||||
|
private boolean isProfilingEnabled = true;
|
||||||
|
|
||||||
|
// Metriche di performance
|
||||||
|
private long totalBindingTime = 0;
|
||||||
|
private long totalCreationTime = 0;
|
||||||
|
private int bindCount = 0;
|
||||||
|
private int createCount = 0;
|
||||||
|
private long firstBindTime = 0;
|
||||||
|
private final ArrayDeque<Long> recentBindTimes;
|
||||||
|
private static final int MAX_RECENT_TIMES = 50;
|
||||||
|
|
||||||
|
public RecyclerViewProfiler(RecyclerView recyclerView) {
|
||||||
|
this.recyclerViewRef = new WeakReference<>(recyclerView);
|
||||||
|
this.bindingTimes = new SparseArray<>();
|
||||||
|
this.creationTimes = new SparseArray<>();
|
||||||
|
this.mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
this.recentBindTimes = new ArrayDeque<>();
|
||||||
|
|
||||||
|
setupRecyclerViewCallbacks();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupRecyclerViewCallbacks() {
|
||||||
|
RecyclerView recyclerView = recyclerViewRef.get();
|
||||||
|
if (recyclerView == null) return;
|
||||||
|
|
||||||
|
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||||
|
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||||
|
logPerformanceMetrics();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Monitora il pre-layout
|
||||||
|
recyclerView.addOnLayoutChangeListener((v, left, top, right, bottom,
|
||||||
|
oldLeft, oldTop, oldRight, oldBottom) -> {
|
||||||
|
if (firstBindTime == 0) {
|
||||||
|
mainHandler.postDelayed(this::checkInitialPerformance, 500);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPreBind(int position) {
|
||||||
|
if (!isProfilingEnabled) return;
|
||||||
|
bindingTimes.put(position, System.nanoTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPostBind(int position) {
|
||||||
|
if (!isProfilingEnabled) return;
|
||||||
|
|
||||||
|
Long startTime = bindingTimes.get(position);
|
||||||
|
if (startTime != null) {
|
||||||
|
long bindTime = System.nanoTime() - startTime;
|
||||||
|
bindingTimes.remove(position);
|
||||||
|
|
||||||
|
if (firstBindTime == 0) {
|
||||||
|
firstBindTime = bindTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
totalBindingTime += bindTime;
|
||||||
|
bindCount++;
|
||||||
|
|
||||||
|
recentBindTimes.addLast(bindTime);
|
||||||
|
if (recentBindTimes.size() > MAX_RECENT_TIMES) {
|
||||||
|
recentBindTimes.removeFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Segnala binding lenti
|
||||||
|
if (bindTime > TimeUnit.MILLISECONDS.toNanos(16)) { // 1 frame
|
||||||
|
Log.w(TAG, String.format("Slow binding at position %d: %.2fms",
|
||||||
|
position, bindTime / 1_000_000.0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPreCreate(int viewType) {
|
||||||
|
if (!isProfilingEnabled) return;
|
||||||
|
creationTimes.put(viewType, System.nanoTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPostCreate(int viewType) {
|
||||||
|
if (!isProfilingEnabled) return;
|
||||||
|
|
||||||
|
Long startTime = creationTimes.get(viewType);
|
||||||
|
if (startTime != null) {
|
||||||
|
long createTime = System.nanoTime() - startTime;
|
||||||
|
creationTimes.remove(viewType);
|
||||||
|
|
||||||
|
totalCreationTime += createTime;
|
||||||
|
createCount++;
|
||||||
|
|
||||||
|
// Segnala creazioni lente
|
||||||
|
if (createTime > TimeUnit.MILLISECONDS.toNanos(8)) {
|
||||||
|
Log.w(TAG, String.format("Slow view creation for type %d: %.2fms",
|
||||||
|
viewType, createTime / 1_000_000.0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkInitialPerformance() {
|
||||||
|
RecyclerView recyclerView = recyclerViewRef.get();
|
||||||
|
if (recyclerView == null) return;
|
||||||
|
|
||||||
|
// Verifica inflazione layout
|
||||||
|
long avgBindTime = bindCount > 0 ? totalBindingTime / bindCount : 0;
|
||||||
|
if (avgBindTime > TimeUnit.MILLISECONDS.toNanos(8)) {
|
||||||
|
Log.w(TAG, String.format("High average binding time: %.2fms. " +
|
||||||
|
"Consider using AsyncLayoutInflater", avgBindTime / 1_000_000.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifica dimensione view pool
|
||||||
|
RecyclerView.RecycledViewPool pool = recyclerView.getRecycledViewPool();
|
||||||
|
if (pool != null) {
|
||||||
|
int[] viewTypes = getViewTypes(recyclerView);
|
||||||
|
for (int type : viewTypes) {
|
||||||
|
if (pool.getRecycledViewCount(type) == 0) {
|
||||||
|
Log.w(TAG, "ViewPool empty for type " + type +
|
||||||
|
". Consider increasing pool size");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifica prefetch
|
||||||
|
if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) {
|
||||||
|
LinearLayoutManager lm = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||||
|
if (!lm.isItemPrefetchEnabled()) {
|
||||||
|
Log.w(TAG, "Item prefetch is disabled. Enable it for better performance");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void logPerformanceMetrics() {
|
||||||
|
if (!isProfilingEnabled || recentBindTimes.isEmpty()) return;
|
||||||
|
|
||||||
|
// Calcola la varianza dei tempi di binding recenti
|
||||||
|
double mean = recentBindTimes.stream()
|
||||||
|
.mapToLong(Long::longValue)
|
||||||
|
.average()
|
||||||
|
.orElse(0.0);
|
||||||
|
|
||||||
|
double variance = recentBindTimes.stream()
|
||||||
|
.mapToDouble(time -> Math.pow(time - mean, 2))
|
||||||
|
.average()
|
||||||
|
.orElse(0.0);
|
||||||
|
|
||||||
|
Log.d(TAG, String.format("Performance metrics:\n" +
|
||||||
|
"Avg binding time: %.2fms\n" +
|
||||||
|
"Binding time variance: %.2f\n" +
|
||||||
|
"View creation rate: %.1f%%",
|
||||||
|
mean / 1_000_000.0,
|
||||||
|
variance / 1_000_000.0,
|
||||||
|
createCount * 100.0 / (bindCount + 1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private int[] getViewTypes(RecyclerView recyclerView) {
|
||||||
|
RecyclerView.Adapter<?> adapter = recyclerView.getAdapter();
|
||||||
|
if (adapter == null) return new int[0];
|
||||||
|
|
||||||
|
Set<Integer> types = new HashSet<>();
|
||||||
|
for (int i = 0; i < adapter.getItemCount(); i++) {
|
||||||
|
types.add(adapter.getItemViewType(i));
|
||||||
|
}
|
||||||
|
return types.stream().mapToInt(Integer::intValue).toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enableProfiling(boolean enabled) {
|
||||||
|
isProfilingEnabled = enabled;
|
||||||
|
if (!enabled) {
|
||||||
|
bindingTimes.clear();
|
||||||
|
creationTimes.clear();
|
||||||
|
recentBindTimes.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProfilingStats() {
|
||||||
|
if (bindCount == 0) return "No data collected yet";
|
||||||
|
|
||||||
|
return String.format(Locale.US,
|
||||||
|
"Profiling Statistics:\n" +
|
||||||
|
"Total bindings: %d\n" +
|
||||||
|
"Average binding time: %.2fms\n" +
|
||||||
|
"Total view creations: %d\n" +
|
||||||
|
"Average creation time: %.2fms\n" +
|
||||||
|
"First binding time: %.2fms\n" +
|
||||||
|
"Creation/Binding ratio: %.1f%%",
|
||||||
|
bindCount,
|
||||||
|
(totalBindingTime / bindCount) / 1_000_000.0,
|
||||||
|
createCount,
|
||||||
|
(totalCreationTime / createCount) / 1_000_000.0,
|
||||||
|
firstBindTime / 1_000_000.0,
|
||||||
|
createCount * 100.0 / bindCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,352 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion.view;
|
||||||
|
|
||||||
|
import android.util.SparseArray;
|
||||||
|
import android.util.SparseIntArray;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BuildConfig;
|
||||||
|
|
||||||
|
public abstract class SectionedRecyclerViewAdapter<H extends RecyclerView.ViewHolder,
|
||||||
|
I extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
private RecyclerViewProfiler profiler;
|
||||||
|
|
||||||
|
private static final int TYPE_HEADER = 0;
|
||||||
|
private static final int TYPE_ITEM = 1;
|
||||||
|
|
||||||
|
// Utilizziamo SparseArray invece di HashMap per migliori performance su Android
|
||||||
|
private final SparseArray<Section> sectionsByPosition;
|
||||||
|
private final ArrayList<Section> sections;
|
||||||
|
|
||||||
|
// Cache per le posizioni degli item per evitare ricalcoli frequenti
|
||||||
|
private final SparseIntArray positionCache;
|
||||||
|
private int lastCacheUpdateCount;
|
||||||
|
|
||||||
|
// Pool di View per riutilizzo
|
||||||
|
private final RecyclerView.RecycledViewPool sharedPool;
|
||||||
|
|
||||||
|
// Dimensione massima della cache delle posizioni
|
||||||
|
private static final int MAX_POSITION_CACHE_SIZE = 2000;
|
||||||
|
|
||||||
|
public SectionedRecyclerViewAdapter() {
|
||||||
|
this.sections = new ArrayList<>();
|
||||||
|
this.sectionsByPosition = new SparseArray<>();
|
||||||
|
this.positionCache = new SparseIntArray(MAX_POSITION_CACHE_SIZE);
|
||||||
|
this.sharedPool = new RecyclerView.RecycledViewPool();
|
||||||
|
|
||||||
|
// Aumentiamo il pool di ViewHolder per tipo
|
||||||
|
sharedPool.setMaxRecycledViews(TYPE_HEADER, 500);
|
||||||
|
sharedPool.setMaxRecycledViews(TYPE_ITEM, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
|
||||||
|
super.onAttachedToRecyclerView(recyclerView);
|
||||||
|
profiler = new RecyclerViewProfiler(recyclerView);
|
||||||
|
profiler.enableProfiling(BuildConfig.DEBUG);
|
||||||
|
|
||||||
|
recyclerView.setRecycledViewPool(sharedPool);
|
||||||
|
|
||||||
|
// Ottimizziamo il layout manager per le prestazioni
|
||||||
|
if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) {
|
||||||
|
LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||||
|
layoutManager.setItemPrefetchEnabled(true);
|
||||||
|
// layoutManager.setInitialPrefetchItemCount(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
// recyclerView.postDelayed(() -> {
|
||||||
|
// Precarica alcuni ViewHolder
|
||||||
|
// for (int i = 0; i < 100; i++) {
|
||||||
|
// sharedPool.putRecycledView(
|
||||||
|
// createViewHolder(recyclerView, TYPE_HEADER));
|
||||||
|
// }
|
||||||
|
// for (int i = 0; i < 100; i++) {
|
||||||
|
// sharedPool.putRecycledView(
|
||||||
|
// createViewHolder(recyclerView, TYPE_ITEM));
|
||||||
|
// }
|
||||||
|
// }, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static class Section {
|
||||||
|
private final Object headerData;
|
||||||
|
private final ArrayList<Object> itemsData;
|
||||||
|
private int globalStartPosition; // Posizione globale di inizio sezione
|
||||||
|
|
||||||
|
public Section(Object headerData, int initialCapacity) {
|
||||||
|
this.headerData = headerData;
|
||||||
|
this.itemsData = new ArrayList<>(initialCapacity);
|
||||||
|
this.globalStartPosition = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getHeaderData() {
|
||||||
|
return headerData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Object> getItemsData() {
|
||||||
|
return itemsData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addItem(Object item) {
|
||||||
|
itemsData.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getItemCount() {
|
||||||
|
return itemsData.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGlobalStartPosition(int position) {
|
||||||
|
this.globalStartPosition = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGlobalStartPosition() {
|
||||||
|
return globalStartPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ViewHolder pooling e caching
|
||||||
|
@Override
|
||||||
|
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
|
||||||
|
super.onViewRecycled(holder);
|
||||||
|
// Pulizia custom del ViewHolder se necessario
|
||||||
|
if (holder instanceof OnRecycleListener) {
|
||||||
|
((OnRecycleListener) holder).onRecycle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interfaccia per gestire la pulizia custom dei ViewHolder
|
||||||
|
public interface OnRecycleListener {
|
||||||
|
void onRecycle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@NonNull
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
profiler.onPreCreate(viewType);
|
||||||
|
RecyclerView.ViewHolder holder;
|
||||||
|
if (viewType == TYPE_HEADER) {
|
||||||
|
holder = onCreateHeaderViewHolder(parent);
|
||||||
|
} else {
|
||||||
|
holder = onCreateItemViewHolder(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Applichiamo ViewHolder pooling
|
||||||
|
if (holder.itemView.getLayoutParams() == null) {
|
||||||
|
holder.itemView.setLayoutParams(
|
||||||
|
new ViewGroup.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
profiler.onPostCreate(viewType);
|
||||||
|
return holder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||||
|
profiler.onPreBind(position);
|
||||||
|
PositionInfo posInfo = getItemPositionInfo(position);
|
||||||
|
|
||||||
|
if (getItemViewType(position) == TYPE_HEADER) {
|
||||||
|
onBindHeaderViewHolder((H) holder,
|
||||||
|
sections.get(posInfo.sectionPosition).getHeaderData(),
|
||||||
|
posInfo.sectionPosition);
|
||||||
|
} else {
|
||||||
|
Section section = sections.get(posInfo.sectionPosition);
|
||||||
|
onBindItemViewHolder((I) holder,
|
||||||
|
section.getItemsData().get(posInfo.itemPosition),
|
||||||
|
posInfo.sectionPosition,
|
||||||
|
posInfo.itemPosition);
|
||||||
|
}
|
||||||
|
profiler.onPostBind(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position, @NonNull List<Object> payloads) {
|
||||||
|
if (payloads.isEmpty()) {
|
||||||
|
super.onBindViewHolder(holder, position, payloads);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Supporto per aggiornamenti parziali
|
||||||
|
if (getItemViewType(position) == TYPE_HEADER) {
|
||||||
|
onBindHeaderViewHolderPartial((H) holder, position, payloads);
|
||||||
|
} else {
|
||||||
|
onBindItemViewHolderPartial((I) holder, position, payloads);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Metodi per gestire aggiornamenti parziali
|
||||||
|
protected void onBindHeaderViewHolderPartial(H holder, int position, List<Object> payloads) {
|
||||||
|
onBindViewHolder(holder, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onBindItemViewHolderPartial(I holder, int position, List<Object> payloads) {
|
||||||
|
onBindViewHolder(holder, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
int count = 0;
|
||||||
|
for (Section section : sections) {
|
||||||
|
count += section.getItemCount() + 1;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
return isHeader(position) ? TYPE_HEADER : TYPE_ITEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Metodi ottimizzati per la gestione delle sezioni
|
||||||
|
public <T> void addSection(T headerData, int expectedItems) {
|
||||||
|
sections.add(new Section(headerData, expectedItems));
|
||||||
|
updatePositionCache();
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addItem(int sectionPosition, Object item) {
|
||||||
|
if (sectionPosition >= 0 && sectionPosition < sections.size()) {
|
||||||
|
sections.get(sectionPosition).addItem(item);
|
||||||
|
updatePositionCache();
|
||||||
|
// Notifichiamo solo l'inserimento invece di un refresh completo
|
||||||
|
notifyItemInserted(getGlobalPositionForItem(sectionPosition,
|
||||||
|
sections.get(sectionPosition).getItemCount() - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends Object, S extends Object> void setSections(List<T> headers, Map<T, List<S>> items) {
|
||||||
|
sections.clear();
|
||||||
|
sectionsByPosition.clear();
|
||||||
|
|
||||||
|
int position = 0;
|
||||||
|
for (T header : headers) {
|
||||||
|
List<S> sectionItems = items.get(header);
|
||||||
|
Section section = new Section(header, sectionItems != null ? sectionItems.size() : 5);
|
||||||
|
if (sectionItems != null) {
|
||||||
|
section.getItemsData().addAll(sectionItems);
|
||||||
|
}
|
||||||
|
section.setGlobalStartPosition(position);
|
||||||
|
sections.add(section);
|
||||||
|
sectionsByPosition.put(position, section);
|
||||||
|
|
||||||
|
position += section.getItemCount() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
updatePositionCache();
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gestione efficiente della cache delle posizioni
|
||||||
|
private void updatePositionCache() {
|
||||||
|
if (sections.size() > MAX_POSITION_CACHE_SIZE) {
|
||||||
|
positionCache.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int currentPosition = 0;
|
||||||
|
for (int i = 0; i < sections.size(); i++) {
|
||||||
|
Section section = sections.get(i);
|
||||||
|
section.setGlobalStartPosition(currentPosition);
|
||||||
|
sectionsByPosition.put(currentPosition, section);
|
||||||
|
currentPosition += section.getItemCount() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastCacheUpdateCount = getItemCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isHeader(int position) {
|
||||||
|
Section section = sectionsByPosition.get(position);
|
||||||
|
if (section != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < sections.size(); i++) {
|
||||||
|
section = sections.get(i);
|
||||||
|
if (position == section.getGlobalStartPosition()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (position < section.getGlobalStartPosition() + section.getItemCount() + 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class PositionInfo {
|
||||||
|
final int sectionPosition;
|
||||||
|
final int itemPosition;
|
||||||
|
|
||||||
|
PositionInfo(int sectionPosition, int itemPosition) {
|
||||||
|
this.sectionPosition = sectionPosition;
|
||||||
|
this.itemPosition = itemPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PositionInfo getItemPositionInfo(int position) {
|
||||||
|
// Controllo cache
|
||||||
|
int cachedSection = positionCache.get(position, -1);
|
||||||
|
if (cachedSection != -1 && lastCacheUpdateCount == getItemCount()) {
|
||||||
|
Section section = sections.get(cachedSection);
|
||||||
|
int relativePos = position - section.getGlobalStartPosition();
|
||||||
|
if (relativePos == 0) {
|
||||||
|
return new PositionInfo(cachedSection, -1);
|
||||||
|
}
|
||||||
|
return new PositionInfo(cachedSection, relativePos - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ricerca ottimizzata
|
||||||
|
Section targetSection = sectionsByPosition.get(position);
|
||||||
|
if (targetSection != null) {
|
||||||
|
int sectionIndex = sections.indexOf(targetSection);
|
||||||
|
return new PositionInfo(sectionIndex, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ricerca binaria nelle sezioni
|
||||||
|
int left = 0;
|
||||||
|
int right = sections.size() - 1;
|
||||||
|
|
||||||
|
while (left <= right) {
|
||||||
|
int mid = (left + right) >>> 1;
|
||||||
|
Section section = sections.get(mid);
|
||||||
|
int sectionStart = section.getGlobalStartPosition();
|
||||||
|
int sectionEnd = sectionStart + section.getItemCount() + 1;
|
||||||
|
|
||||||
|
if (position >= sectionStart && position < sectionEnd) {
|
||||||
|
int relativePos = position - sectionStart;
|
||||||
|
if (relativePos == 0) {
|
||||||
|
return new PositionInfo(mid, -1);
|
||||||
|
}
|
||||||
|
return new PositionInfo(mid, relativePos - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position < sectionStart) {
|
||||||
|
right = mid - 1;
|
||||||
|
} else {
|
||||||
|
left = mid + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new IndexOutOfBoundsException("Position " + position + " is out of bounds");
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getGlobalPositionForItem(int sectionPosition, int itemPosition) {
|
||||||
|
return sections.get(sectionPosition).getGlobalStartPosition() + itemPosition + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Metodi astratti che devono essere implementati
|
||||||
|
protected abstract H onCreateHeaderViewHolder(ViewGroup parent);
|
||||||
|
protected abstract I onCreateItemViewHolder(ViewGroup parent);
|
||||||
|
protected abstract void onBindHeaderViewHolder(H holder, Object headerData, int sectionPosition);
|
||||||
|
protected abstract void onBindItemViewHolder(I holder, Object itemData, int sectionPosition, int itemPosition);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package it.integry.integrywmsnative.core.helper;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityContext;
|
||||||
|
|
||||||
|
public final class ContextHelper {
|
||||||
|
|
||||||
|
public static FragmentManager getFragmentManagerFromContext(Context context) {
|
||||||
|
if (context == null) {
|
||||||
|
throw new IllegalArgumentException("Context cannot be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context instanceof FragmentActivity) {
|
||||||
|
return ((FragmentActivity) context).getSupportFragmentManager();
|
||||||
|
} else if (UtilityContext.getMainActivity() != null) {
|
||||||
|
return UtilityContext.getMainActivity().getSupportFragmentManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,11 +2,11 @@ package it.integry.integrywmsnative.core.mapper;
|
|||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
|
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioEntity;
|
||||||
import it.integry.integrywmsnative.core.model.MtbInvent;
|
import it.integry.integrywmsnative.core.model.MtbInvent;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class InventarioMapper extends BaseMapper<MtbInvent, InventarioRoomDTO> {
|
public class InventarioMapper extends BaseMapper<MtbInvent, InventarioEntity> {
|
||||||
|
|
||||||
private final InventarioRowMapper inventarioRowMapper;
|
private final InventarioRowMapper inventarioRowMapper;
|
||||||
|
|
||||||
@@ -15,10 +15,10 @@ public class InventarioMapper extends BaseMapper<MtbInvent, InventarioRoomDTO> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InventarioRoomDTO mapRestToRoom(MtbInvent inputData) {
|
public InventarioEntity mapRestToRoom(MtbInvent inputData) {
|
||||||
if(inputData == null) return null;
|
if(inputData == null) return null;
|
||||||
|
|
||||||
var data = new InventarioRoomDTO();
|
var data = new InventarioEntity();
|
||||||
data.setIdInventario(inputData.getIdInventario());
|
data.setIdInventario(inputData.getIdInventario());
|
||||||
data.setCodMdep(inputData.getCodMdep());
|
data.setCodMdep(inputData.getCodMdep());
|
||||||
data.setDataInventario(inputData.getDataInventario());
|
data.setDataInventario(inputData.getDataInventario());
|
||||||
@@ -42,7 +42,7 @@ public class InventarioMapper extends BaseMapper<MtbInvent, InventarioRoomDTO> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MtbInvent mapRoomToRest(InventarioRoomDTO inputData) {
|
public MtbInvent mapRoomToRest(InventarioEntity inputData) {
|
||||||
if(inputData == null) return null;
|
if(inputData == null) return null;
|
||||||
|
|
||||||
var data = new MtbInvent();
|
var data = new MtbInvent();
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package it.integry.integrywmsnative.core.mapper;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeEntity;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.VerificaGiacenzeDTO;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class VerificaGiacenzeMapper extends BaseMapper<VerificaGiacenzeDTO, VerificaGiacenzeEntity> {
|
||||||
|
|
||||||
|
private final VerificaGiacenzeRowMapper verificaGiacenzeRowMapper;
|
||||||
|
|
||||||
|
public VerificaGiacenzeMapper(VerificaGiacenzeRowMapper verificaGiacenzeRowMapper) {
|
||||||
|
this.verificaGiacenzeRowMapper = verificaGiacenzeRowMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VerificaGiacenzeEntity mapRestToRoom(VerificaGiacenzeDTO inputData) {
|
||||||
|
if(inputData == null) return null;
|
||||||
|
|
||||||
|
var data = new VerificaGiacenzeEntity();
|
||||||
|
data.setCodMdep(inputData.getCodMdep());
|
||||||
|
data.setData(inputData.getDataVerifica());
|
||||||
|
|
||||||
|
data.setVerificaGiacenzeRowList(verificaGiacenzeRowMapper.mapRestsToRooms(inputData.getRows()));
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VerificaGiacenzeDTO mapRoomToRest(VerificaGiacenzeEntity inputData) {
|
||||||
|
if(inputData == null) return null;
|
||||||
|
|
||||||
|
var data = new VerificaGiacenzeDTO();
|
||||||
|
data.setCodMdep(inputData.getCodMdep());
|
||||||
|
data.setDataVerifica(inputData.getData());
|
||||||
|
|
||||||
|
data.setRows(verificaGiacenzeRowMapper.mapRoomsToRests(inputData.getVerificaGiacenzeRowList()));
|
||||||
|
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package it.integry.integrywmsnative.core.mapper;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRowEntity;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.VerificaGiacenzeRowDTO;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class VerificaGiacenzeRowMapper extends BaseMapper<VerificaGiacenzeRowDTO, VerificaGiacenzeRowEntity> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VerificaGiacenzeRowEntity mapRestToRoom(VerificaGiacenzeRowDTO inputData) {
|
||||||
|
if(inputData == null) return null;
|
||||||
|
|
||||||
|
var data = new VerificaGiacenzeRowEntity();
|
||||||
|
data.setCodMart(inputData.getCodMart());
|
||||||
|
data.setPartitaMag(inputData.getPartitaMag());
|
||||||
|
data.setQtaInGiacenza(inputData.getQtaInGiacenza());
|
||||||
|
data.setQta(inputData.getQta());
|
||||||
|
data.setNumConf(inputData.getNumCnf());
|
||||||
|
data.setQtaConf(inputData.getQtaCnf());
|
||||||
|
data.setScanCodBarre(inputData.getBarcode());
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VerificaGiacenzeRowDTO mapRoomToRest(VerificaGiacenzeRowEntity inputData) {
|
||||||
|
if(inputData == null) return null;
|
||||||
|
|
||||||
|
var data = new VerificaGiacenzeRowDTO();
|
||||||
|
data.setCodMart(inputData.getCodMart());
|
||||||
|
data.setPartitaMag(inputData.getPartitaMag());
|
||||||
|
data.setQtaInGiacenza(inputData.getQtaInGiacenza());
|
||||||
|
data.setQta(inputData.getQta());
|
||||||
|
data.setNumCnf(inputData.getNumConf());
|
||||||
|
data.setQtaCnf(inputData.getQtaConf());
|
||||||
|
data.setBarcode(inputData.getScanCodBarre());
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,31 +2,25 @@ package it.integry.integrywmsnative.core.menu;
|
|||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.model.StbMenu;
|
import it.integry.integrywmsnative.core.model.StbMenu;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class MenuRESTConsumer extends _BaseRESTConsumer {
|
public class MenuRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
public void retrieveMenu(String rootCodOpz, RunnableArgs<StbMenu> onComplete, RunnableArgs<Exception> onFailed) {
|
private final RESTBuilder restBuilder;
|
||||||
MenuRESTConsumerService menuRESTConsumerService = RESTBuilder.getService(MenuRESTConsumerService.class);
|
|
||||||
menuRESTConsumerService.retrieveMenuConfig(rootCodOpz).enqueue(new Callback<>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<StbMenu>> call, Response<ServiceRESTResponse<StbMenu>> response) {
|
|
||||||
analyzeAnswer(response, "retrieveMenu", onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public MenuRESTConsumer(RESTBuilder restBuilder) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<StbMenu>> call, Throwable t) {
|
this.restBuilder = restBuilder;
|
||||||
onFailed.run(new Exception(t));
|
}
|
||||||
}
|
|
||||||
});
|
public StbMenu retrieveMenuSynchronized(String rootCodOpz) throws Exception {
|
||||||
|
MenuRESTConsumerService menuRESTConsumerService = restBuilder.getService(MenuRESTConsumerService.class);
|
||||||
|
var response = menuRESTConsumerService.retrieveMenuConfig(rootCodOpz)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
return analyzeAnswer(response, "retrieveMenu");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import javax.inject.Singleton;
|
|||||||
|
|
||||||
import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration;
|
import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration;
|
||||||
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
|
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.menu.exception.MenuNotFoundException;
|
import it.integry.integrywmsnative.core.menu.exception.MenuNotFoundException;
|
||||||
import it.integry.integrywmsnative.core.model.StbMenu;
|
import it.integry.integrywmsnative.core.model.StbMenu;
|
||||||
|
|
||||||
@@ -29,20 +28,18 @@ public class MenuService {
|
|||||||
this.menuRESTConsumer = menuRESTConsumer;
|
this.menuRESTConsumer = menuRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(Runnable onMenuInitialized, RunnableArgs<Exception> onFailed) {
|
public void init() throws Exception {
|
||||||
menuRESTConsumer.retrieveMenu(MENU_COD_OPZ, menu -> {
|
var menu = menuRESTConsumer.retrieveMenuSynchronized(MENU_COD_OPZ);
|
||||||
if(menu != null) {
|
|
||||||
this.mInternalCachedMenu = menu.getStbMenuChildren();
|
|
||||||
this.mInternalCachedFlatMenu = new ArrayList<>();
|
|
||||||
flattenMenu(this.mInternalCachedMenu);
|
|
||||||
}
|
|
||||||
|
|
||||||
onMenuInitialized.run();
|
if (menu != null) {
|
||||||
}, onFailed);
|
this.mInternalCachedMenu = menu.getStbMenuChildren();
|
||||||
|
this.mInternalCachedFlatMenu = new ArrayList<>();
|
||||||
|
flattenMenu(this.mInternalCachedMenu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<StbMenu> getMenu() throws Exception {
|
public List<StbMenu> getMenu() throws Exception {
|
||||||
if(mInternalCachedMenu == null) throw new MenuNotFoundException();
|
if (mInternalCachedMenu == null) throw new MenuNotFoundException();
|
||||||
|
|
||||||
return mInternalCachedMenu;
|
return mInternalCachedMenu;
|
||||||
}
|
}
|
||||||
@@ -64,10 +61,10 @@ public class MenuService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void flattenMenu(List<StbMenu> menu) {
|
private void flattenMenu(List<StbMenu> menu) {
|
||||||
for(StbMenu stbMenu : menu) {
|
for (StbMenu stbMenu : menu) {
|
||||||
this.mInternalCachedFlatMenu.add(stbMenu);
|
this.mInternalCachedFlatMenu.add(stbMenu);
|
||||||
|
|
||||||
if(stbMenu.getStbMenuChildren() != null && !stbMenu.getStbMenuChildren().isEmpty()) {
|
if (stbMenu.getStbMenuChildren() != null && !stbMenu.getStbMenuChildren().isEmpty()) {
|
||||||
flattenMenu(stbMenu.getStbMenuChildren());
|
flattenMenu(stbMenu.getStbMenuChildren());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.core.model;
|
package it.integry.integrywmsnative.core.model;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DtbDoct {
|
public class DtbDoct {
|
||||||
@@ -10,7 +10,7 @@ public class DtbDoct {
|
|||||||
|
|
||||||
private String codAnag;
|
private String codAnag;
|
||||||
private String codDtip;
|
private String codDtip;
|
||||||
private Date dataDoc;
|
private LocalDate dataDoc;
|
||||||
private Integer numDoc;
|
private Integer numDoc;
|
||||||
private String serDoc;
|
private String serDoc;
|
||||||
private BigDecimal acconto;
|
private BigDecimal acconto;
|
||||||
@@ -41,14 +41,14 @@ public class DtbDoct {
|
|||||||
private String compilatoDa;
|
private String compilatoDa;
|
||||||
private String userName;
|
private String userName;
|
||||||
private String controllatoDa;
|
private String controllatoDa;
|
||||||
private Date dataChkDoc;
|
private LocalDate dataChkDoc;
|
||||||
private Date dataDocVal;
|
private LocalDate dataDocVal;
|
||||||
private Date dataInizTrasp;
|
private LocalDate dataInizTrasp;
|
||||||
private Date dataIns;
|
private LocalDate dataIns;
|
||||||
private Date dataOrd;
|
private LocalDate dataOrd;
|
||||||
private Date dataReg;
|
private LocalDate dataReg;
|
||||||
private Date dataRifScad;
|
private LocalDate dataRifScad;
|
||||||
private Date dataUltMod;
|
private LocalDate dataUltMod;
|
||||||
private String descrizionePaga;
|
private String descrizionePaga;
|
||||||
private String flagPrzScontati;
|
private String flagPrzScontati;
|
||||||
private String gestione;
|
private String gestione;
|
||||||
@@ -89,7 +89,7 @@ public class DtbDoct {
|
|||||||
private String targa;
|
private String targa;
|
||||||
private Integer postiPallet;
|
private Integer postiPallet;
|
||||||
private BigDecimal tempMedia;
|
private BigDecimal tempMedia;
|
||||||
private Date dataCons;
|
private LocalDate dataCons;
|
||||||
private BigDecimal nolo;
|
private BigDecimal nolo;
|
||||||
private BigDecimal nolo2;
|
private BigDecimal nolo2;
|
||||||
private String conducente;
|
private String conducente;
|
||||||
@@ -102,7 +102,7 @@ public class DtbDoct {
|
|||||||
private String setDataDecorrenza2DataRic;
|
private String setDataDecorrenza2DataRic;
|
||||||
private BigDecimal totSpese;
|
private BigDecimal totSpese;
|
||||||
private String chkArtListino;
|
private String chkArtListino;
|
||||||
private Date dataCmov;
|
private LocalDate dataCmov;
|
||||||
private String reso;
|
private String reso;
|
||||||
private Integer numCmovAutofattura;
|
private Integer numCmovAutofattura;
|
||||||
private Object dtbTipi;
|
private Object dtbTipi;
|
||||||
@@ -141,11 +141,11 @@ public class DtbDoct {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataDoc() {
|
public LocalDate getDataDoc() {
|
||||||
return dataDoc;
|
return dataDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataDoc(Date dataDoc) {
|
public DtbDoct setDataDoc(LocalDate dataDoc) {
|
||||||
this.dataDoc = dataDoc;
|
this.dataDoc = dataDoc;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -420,74 +420,74 @@ public class DtbDoct {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataChkDoc() {
|
public LocalDate getDataChkDoc() {
|
||||||
return dataChkDoc;
|
return dataChkDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataChkDoc(Date dataChkDoc) {
|
public DtbDoct setDataChkDoc(LocalDate dataChkDoc) {
|
||||||
this.dataChkDoc = dataChkDoc;
|
this.dataChkDoc = dataChkDoc;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataDocVal() {
|
public LocalDate getDataDocVal() {
|
||||||
return dataDocVal;
|
return dataDocVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataDocVal(Date dataDocVal) {
|
public DtbDoct setDataDocVal(LocalDate dataDocVal) {
|
||||||
this.dataDocVal = dataDocVal;
|
this.dataDocVal = dataDocVal;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataInizTrasp() {
|
public LocalDate getDataInizTrasp() {
|
||||||
return dataInizTrasp;
|
return dataInizTrasp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataInizTrasp(Date dataInizTrasp) {
|
public DtbDoct setDataInizTrasp(LocalDate dataInizTrasp) {
|
||||||
this.dataInizTrasp = dataInizTrasp;
|
this.dataInizTrasp = dataInizTrasp;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataIns() {
|
public LocalDate getDataIns() {
|
||||||
return dataIns;
|
return dataIns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataIns(Date dataIns) {
|
public DtbDoct setDataIns(LocalDate dataIns) {
|
||||||
this.dataIns = dataIns;
|
this.dataIns = dataIns;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataOrd() {
|
public LocalDate getDataOrd() {
|
||||||
return dataOrd;
|
return dataOrd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataOrd(Date dataOrd) {
|
public DtbDoct setDataOrd(LocalDate dataOrd) {
|
||||||
this.dataOrd = dataOrd;
|
this.dataOrd = dataOrd;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataReg() {
|
public LocalDate getDataReg() {
|
||||||
return dataReg;
|
return dataReg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataReg(Date dataReg) {
|
public DtbDoct setDataReg(LocalDate dataReg) {
|
||||||
this.dataReg = dataReg;
|
this.dataReg = dataReg;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataRifScad() {
|
public LocalDate getDataRifScad() {
|
||||||
return dataRifScad;
|
return dataRifScad;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataRifScad(Date dataRifScad) {
|
public DtbDoct setDataRifScad(LocalDate dataRifScad) {
|
||||||
this.dataRifScad = dataRifScad;
|
this.dataRifScad = dataRifScad;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataUltMod() {
|
public LocalDate getDataUltMod() {
|
||||||
return dataUltMod;
|
return dataUltMod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataUltMod(Date dataUltMod) {
|
public DtbDoct setDataUltMod(LocalDate dataUltMod) {
|
||||||
this.dataUltMod = dataUltMod;
|
this.dataUltMod = dataUltMod;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -852,11 +852,11 @@ public class DtbDoct {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataCons() {
|
public LocalDate getDataCons() {
|
||||||
return dataCons;
|
return dataCons;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataCons(Date dataCons) {
|
public DtbDoct setDataCons(LocalDate dataCons) {
|
||||||
this.dataCons = dataCons;
|
this.dataCons = dataCons;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -969,11 +969,11 @@ public class DtbDoct {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataCmov() {
|
public LocalDate getDataCmov() {
|
||||||
return dataCmov;
|
return dataCmov;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DtbDoct setDataCmov(Date dataCmov) {
|
public DtbDoct setDataCmov(LocalDate dataCmov) {
|
||||||
this.dataCmov = dataCmov;
|
this.dataCmov = dataCmov;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.core.model;
|
package it.integry.integrywmsnative.core.model;
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.model;
|
|||||||
public class JtbComt extends EntityBase {
|
public class JtbComt extends EntityBase {
|
||||||
|
|
||||||
private String codJcom;
|
private String codJcom;
|
||||||
|
private String codAnag;
|
||||||
private String codJfas;
|
private String codJfas;
|
||||||
private String codJflav;
|
private String codJflav;
|
||||||
private String descrizione;
|
private String descrizione;
|
||||||
@@ -20,6 +21,15 @@ public class JtbComt extends EntityBase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCodAnag() {
|
||||||
|
return codAnag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JtbComt setCodAnag(String codAnag) {
|
||||||
|
this.codAnag = codAnag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCodJfas() {
|
public String getCodJfas() {
|
||||||
return codJfas;
|
return codJfas;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.core.model;
|
package it.integry.integrywmsnative.core.model;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
@@ -96,6 +97,8 @@ public class MtbAart extends EntityBase {
|
|||||||
|
|
||||||
private List<MtbUntMis> mtbUntMis;
|
private List<MtbUntMis> mtbUntMis;
|
||||||
|
|
||||||
|
private List<MtbAartBarCode> mtbAartBarCode;
|
||||||
|
|
||||||
|
|
||||||
public enum UntMisRifPesoEnum {
|
public enum UntMisRifPesoEnum {
|
||||||
C,
|
C,
|
||||||
@@ -108,6 +111,104 @@ public class MtbAart extends EntityBase {
|
|||||||
this.type = "mtb_aart";
|
this.type = "mtb_aart";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbAart(MtbAart other) {
|
||||||
|
this();
|
||||||
|
|
||||||
|
this.codMart = other.codMart;
|
||||||
|
this.descrizione = other.descrizione;
|
||||||
|
this.untMis = other.untMis;
|
||||||
|
this.barCode = other.barCode;
|
||||||
|
this.pesoKg = other.pesoKg; // BigDecimal è immutabile
|
||||||
|
this.qtaCnf = other.qtaCnf;
|
||||||
|
this.codAliq = other.codAliq;
|
||||||
|
this.codScoArt = other.codScoArt;
|
||||||
|
this.codTcolUi = other.codTcolUi;
|
||||||
|
this.codTcolUl = other.codTcolUl;
|
||||||
|
this.articoloComposto = other.articoloComposto;
|
||||||
|
this.esposizioneComp = other.esposizioneComp;
|
||||||
|
this.descrizioneEstesa = other.descrizioneEstesa;
|
||||||
|
this.codUltForn = other.codUltForn;
|
||||||
|
this.dataUltCar = other.dataUltCar;
|
||||||
|
this.valUltCar = other.valUltCar;
|
||||||
|
this.codUltClie = other.codUltClie;
|
||||||
|
this.dataUltScar = other.dataUltScar;
|
||||||
|
this.valUltScar = other.valUltScar;
|
||||||
|
this.tipoCodice = other.tipoCodice;
|
||||||
|
this.note = other.note;
|
||||||
|
this.posizione = other.posizione;
|
||||||
|
this.colliPedana = other.colliPedana;
|
||||||
|
this.untMis2 = other.untMis2;
|
||||||
|
this.rapConv2 = other.rapConv2;
|
||||||
|
this.flagInclListino = other.flagInclListino;
|
||||||
|
this.untMis3 = other.untMis3;
|
||||||
|
this.rapConv3 = other.rapConv3;
|
||||||
|
this.codMartStat = other.codMartStat;
|
||||||
|
this.codMcon = other.codMcon;
|
||||||
|
this.codMgrp = other.codMgrp;
|
||||||
|
this.codMsfa = other.codMsfa;
|
||||||
|
this.codMsgr = other.codMsgr;
|
||||||
|
this.codMstp = other.codMstp;
|
||||||
|
this.codMtip = other.codMtip;
|
||||||
|
this.descrizioneStat = other.descrizioneStat;
|
||||||
|
this.flagStato = other.flagStato;
|
||||||
|
this.cambioDiviCar = other.cambioDiviCar;
|
||||||
|
this.cambioDiviScar = other.cambioDiviScar;
|
||||||
|
this.ggScadPartita = other.ggScadPartita;
|
||||||
|
this.volumeMc = other.volumeMc;
|
||||||
|
this.flagEsponiPrz = other.flagEsponiPrz;
|
||||||
|
this.dataUltVar = other.dataUltVar;
|
||||||
|
this.percSfrido = other.percSfrido;
|
||||||
|
this.codBarreImb = other.codBarreImb;
|
||||||
|
this.flagCalcPrz = other.flagCalcPrz;
|
||||||
|
this.esposizioneCompAcq = other.esposizioneCompAcq;
|
||||||
|
this.flagCalcPrzAcq = other.flagCalcPrzAcq;
|
||||||
|
this.diacod = other.diacod;
|
||||||
|
this.plu = other.plu;
|
||||||
|
this.partIvaProd = other.partIvaProd;
|
||||||
|
this.ragSocProd = other.ragSocProd;
|
||||||
|
this.flagRapConvVariabile = other.flagRapConvVariabile;
|
||||||
|
this.flagMovArtMag = other.flagMovArtMag;
|
||||||
|
this.flagTracciabilita = other.flagTracciabilita;
|
||||||
|
this.taraKg = other.taraKg;
|
||||||
|
this.colliStrato = other.colliStrato;
|
||||||
|
this.flagQtaCnfFissa = other.flagQtaCnfFissa;
|
||||||
|
this.flagColliPedanaFisso = other.flagColliPedanaFisso;
|
||||||
|
this.codCconCosti = other.codCconCosti;
|
||||||
|
this.codCconRicavi = other.codCconRicavi;
|
||||||
|
this.codDgrpArt = other.codDgrpArt;
|
||||||
|
this.codDiviCar = other.codDiviCar;
|
||||||
|
this.codDiviScar = other.codDiviScar;
|
||||||
|
this.codEcrCat = other.codEcrCat;
|
||||||
|
this.codEcrMcat = other.codEcrMcat;
|
||||||
|
this.codEcrRep = other.codEcrRep;
|
||||||
|
this.codEcrStipo = other.codEcrStipo;
|
||||||
|
this.codEcrTipo = other.codEcrTipo;
|
||||||
|
this.codGrpBolla = other.codGrpBolla;
|
||||||
|
this.ingredienti = other.ingredienti;
|
||||||
|
this.idArtEqui = other.idArtEqui;
|
||||||
|
this.descrCassa = other.descrCassa;
|
||||||
|
this.codNcIntracee = other.codNcIntracee;
|
||||||
|
this.marchio = other.marchio;
|
||||||
|
this.sezione = other.sezione;
|
||||||
|
this.untMisRifPeso = other.untMisRifPeso; // Enum è immutabile
|
||||||
|
|
||||||
|
this.qtaEsistente = other.qtaEsistente;
|
||||||
|
this.qtaImpegnata = other.qtaImpegnata;
|
||||||
|
this.numCnfEsistente = other.numCnfEsistente;
|
||||||
|
this.numCnfImpegnata = other.numCnfImpegnata;
|
||||||
|
|
||||||
|
// Deep copy della lista
|
||||||
|
if (other.mtbUntMis != null) {
|
||||||
|
this.mtbUntMis = new ArrayList<>();
|
||||||
|
for (MtbUntMis untMis : other.mtbUntMis) {
|
||||||
|
this.mtbUntMis.add(new MtbUntMis(untMis)); // Assicurati che MtbUntMis abbia un costruttore di copia
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isFlagTracciabilitaBoolean() {
|
public boolean isFlagTracciabilitaBoolean() {
|
||||||
return flagTracciabilita != null && flagTracciabilita.equalsIgnoreCase("S");
|
return flagTracciabilita != null && flagTracciabilita.equalsIgnoreCase("S");
|
||||||
}
|
}
|
||||||
@@ -866,6 +967,13 @@ public class MtbAart extends EntityBase {
|
|||||||
return getMtbUntMis() != null && !getMtbUntMis().isEmpty() ? getMtbUntMis().get(0) : null;
|
return getMtbUntMis() != null && !getMtbUntMis().isEmpty() ? getMtbUntMis().get(0) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<MtbAartBarCode> getMtbAartBarCode() {
|
||||||
|
return mtbAartBarCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMtbAartBarCode(List<MtbAartBarCode> mtbAartBarCode) {
|
||||||
|
this.mtbAartBarCode = mtbAartBarCode;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package it.integry.integrywmsnative.core.model;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class MtbAartBarCode extends EntityBase {
|
||||||
|
private String codBarre;
|
||||||
|
private String codMart;
|
||||||
|
private BigDecimal qtaCnf;
|
||||||
|
private String flagPrimario;
|
||||||
|
private String tipoCodBarre;
|
||||||
|
|
||||||
|
public MtbAartBarCode() {
|
||||||
|
this.type = "mtb_aart_bar_code";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodBarre() {
|
||||||
|
return codBarre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodBarre(String codBarre) {
|
||||||
|
this.codBarre = codBarre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaCnf() {
|
||||||
|
return qtaCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQtaCnf(BigDecimal qtaCnf) {
|
||||||
|
this.qtaCnf = qtaCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFlagPrimario() {
|
||||||
|
return flagPrimario;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlagPrimario(String flagPrimario) {
|
||||||
|
this.flagPrimario = flagPrimario;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipoCodBarre() {
|
||||||
|
return tipoCodBarre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoCodBarre(String tipoCodBarre) {
|
||||||
|
this.tipoCodBarre = tipoCodBarre;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ public class MtbColr extends EntityBase {
|
|||||||
private String gestione;
|
private String gestione;
|
||||||
private String serCollo;
|
private String serCollo;
|
||||||
private Integer numCollo;
|
private Integer numCollo;
|
||||||
private String dataCollo;
|
private LocalDate dataCollo;
|
||||||
private Integer riga;
|
private Integer riga;
|
||||||
private Integer rigaOrd;
|
private Integer rigaOrd;
|
||||||
private String codMart;
|
private String codMart;
|
||||||
@@ -26,8 +26,8 @@ public class MtbColr extends EntityBase {
|
|||||||
private String gestioneRif;
|
private String gestioneRif;
|
||||||
private String serColloRif;
|
private String serColloRif;
|
||||||
private String note;
|
private String note;
|
||||||
private String dataOrd;
|
private LocalDate dataOrd;
|
||||||
private String dataColloRif;
|
private LocalDate dataColloRif;
|
||||||
private BigDecimal qtaCnf;
|
private BigDecimal qtaCnf;
|
||||||
private BigDecimal qtaCol;
|
private BigDecimal qtaCol;
|
||||||
private Integer numOrd;
|
private Integer numOrd;
|
||||||
@@ -67,6 +67,58 @@ public class MtbColr extends EntityBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbColr(MtbColr other) {
|
||||||
|
this();
|
||||||
|
|
||||||
|
this.gestione = other.gestione;
|
||||||
|
this.serCollo = other.serCollo;
|
||||||
|
this.numCollo = other.numCollo;
|
||||||
|
this.dataCollo = other.dataCollo;
|
||||||
|
this.riga = other.riga;
|
||||||
|
this.rigaOrd = other.rigaOrd;
|
||||||
|
this.codMart = other.codMart;
|
||||||
|
this.codBarre = other.codBarre;
|
||||||
|
this.codCol = other.codCol;
|
||||||
|
this.codTagl = other.codTagl;
|
||||||
|
this.partitaMag = other.partitaMag;
|
||||||
|
this.gestioneRif = other.gestioneRif;
|
||||||
|
this.serColloRif = other.serColloRif;
|
||||||
|
this.note = other.note;
|
||||||
|
this.dataOrd = other.dataOrd; // LocalDate è immutabile
|
||||||
|
this.dataColloRif = other.dataColloRif;
|
||||||
|
this.qtaCnf = other.qtaCnf; // BigDecimal è immutabile
|
||||||
|
this.qtaCol = other.qtaCol;
|
||||||
|
this.numOrd = other.numOrd;
|
||||||
|
this.numEtich = other.numEtich;
|
||||||
|
this.numColloRif = other.numColloRif;
|
||||||
|
this.datetimeRow = other.datetimeRow;
|
||||||
|
this.codJcom = other.codJcom;
|
||||||
|
this.numCnf = other.numCnf;
|
||||||
|
this.insPartitaMag = other.insPartitaMag;
|
||||||
|
this.mtbPartitaMag_descrizione = other.mtbPartitaMag_descrizione;
|
||||||
|
this.dataScadPartita = other.dataScadPartita;
|
||||||
|
this.descrizione = other.descrizione;
|
||||||
|
this.untMis = other.untMis;
|
||||||
|
this.causale = other.causale;
|
||||||
|
this.utente = other.utente;
|
||||||
|
this.codAnagDoc = other.codAnagDoc;
|
||||||
|
this.codDtipDoc = other.codDtipDoc;
|
||||||
|
this.dataDoc = other.dataDoc;
|
||||||
|
this.serDoc = other.serDoc;
|
||||||
|
this.numDoc = other.numDoc;
|
||||||
|
this.idRigaDoc = other.idRigaDoc;
|
||||||
|
this.pesoNettoKg = other.pesoNettoKg;
|
||||||
|
this.pesoLordoKg = other.pesoLordoKg;
|
||||||
|
|
||||||
|
// Deep copy degli oggetti complessi
|
||||||
|
this.mtbAart = other.mtbAart != null ? new MtbAart(other.mtbAart) : null;
|
||||||
|
this.mtbPartitaMag = other.mtbPartitaMag != null ? new MtbPartitaMag(other.mtbPartitaMag) : null;
|
||||||
|
|
||||||
|
// Non copiamo i campi transient
|
||||||
|
// this.id = other.id;
|
||||||
|
// this.refMtbColr = other.refMtbColr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Causale {
|
public static class Causale {
|
||||||
public static final int DEFAULT = 0;
|
public static final int DEFAULT = 0;
|
||||||
@@ -112,21 +164,18 @@ public class MtbColr extends EntityBase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataColloS() {
|
|
||||||
|
public LocalDate getDataColloLD() {
|
||||||
return dataCollo;
|
return dataCollo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataColloD() {
|
|
||||||
return UtilityDate.recognizeDateWithExceptionHandler(getDataColloS());
|
|
||||||
}
|
|
||||||
|
|
||||||
public MtbColr setDataCollo(String dataCollo) {
|
public MtbColr setDataCollo(String dataCollo) {
|
||||||
this.dataCollo = dataCollo;
|
this.dataCollo = UtilityDate.recognizeLocalDateWithExceptionHandler(dataCollo);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColr setDataCollo(Date dataCollo) {
|
public MtbColr setDataCollo(LocalDate dataCollo) {
|
||||||
setDataCollo(UtilityDate.formatDate(dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH));
|
this.dataCollo = dataCollo;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,44 +274,34 @@ public class MtbColr extends EntityBase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataOrdS() {
|
public LocalDate getDataOrd() {
|
||||||
return dataOrd;
|
return dataOrd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataOrdD() {
|
public MtbColr setDataOrd(LocalDate dataOrd) {
|
||||||
return UtilityDate.recognizeDateWithExceptionHandler(getDataOrdS());
|
|
||||||
}
|
|
||||||
|
|
||||||
public MtbColr setDataOrd(String dataOrd) {
|
|
||||||
this.dataOrd = dataOrd;
|
this.dataOrd = dataOrd;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColr setDataOrd(Date dataOrd) {
|
|
||||||
this.dataOrd = UtilityDate.formatDate(dataOrd, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDataColloRifS() {
|
public String getDataColloRifS() {
|
||||||
return dataColloRif;
|
return dataColloRif != null ? UtilityDate.COMMONS_DATE_FORMATS.DATE_DMY_SLASHED_FORMATTER.format(dataColloRif) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataColloRifD() {
|
public Date getDataColloRifD() {
|
||||||
return UtilityDate.recognizeDateWithExceptionHandler(getDataColloRifS());
|
return UtilityDate.recognizeDateWithExceptionHandler(getDataColloRifS());
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColr setDataColloRif(String dataColloRif) {
|
public LocalDate getDataColloRifLD() {
|
||||||
this.dataColloRif = dataColloRif;
|
return dataColloRif;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColr setDataColloRif(Date dataColloRif) {
|
public MtbColr setDataColloRif(String dataColloRif) {
|
||||||
this.dataColloRif = UtilityDate.formatDate(dataColloRif, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH);
|
this.dataColloRif = UtilityDate.recognizeLocalDateWithExceptionHandler(dataColloRif);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColr setDataColloRif(LocalDate dataColloRif) {
|
public MtbColr setDataColloRif(LocalDate dataColloRif) {
|
||||||
this.dataColloRif = UtilityDate.formatDate(dataColloRif, UtilityDate.COMMONS_DATE_FORMATS.DMY_SLASH);
|
this.dataColloRif = dataColloRif;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package it.integry.integrywmsnative.core.model;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import androidx.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
import androidx.databinding.ObservableField;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import com.annimon.stream.Optional;
|
import com.annimon.stream.Optional;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
@@ -22,7 +22,6 @@ import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
|||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,7 +30,7 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
|
|||||||
|
|
||||||
public class MtbColt extends EntityBase {
|
public class MtbColt extends EntityBase {
|
||||||
private String gestione;
|
private String gestione;
|
||||||
private String dataCollo;
|
private LocalDate dataCollo;
|
||||||
private String serCollo;
|
private String serCollo;
|
||||||
private Integer numCollo;
|
private Integer numCollo;
|
||||||
private String rifOrd;
|
private String rifOrd;
|
||||||
@@ -66,7 +65,9 @@ public class MtbColt extends EntityBase {
|
|||||||
private BigDecimal altezzaCm;
|
private BigDecimal altezzaCm;
|
||||||
private String codJcom;
|
private String codJcom;
|
||||||
|
|
||||||
private final ObservableField<ObservableMtbTcol> mtbTCol = new ObservableField<>();
|
private String barcodeUl;
|
||||||
|
|
||||||
|
private final transient MutableLiveData<ObservableMtbTcol> mtbTCol = new MutableLiveData<>();
|
||||||
|
|
||||||
private Boolean disablePrint;
|
private Boolean disablePrint;
|
||||||
private String ragSocCliente;
|
private String ragSocCliente;
|
||||||
@@ -84,7 +85,7 @@ public class MtbColt extends EntityBase {
|
|||||||
|
|
||||||
public MtbColt() {
|
public MtbColt() {
|
||||||
type = "mtb_colt";
|
type = "mtb_colt";
|
||||||
setDataCollo(UtilityDate.getDateInstance());
|
setDataCollo(LocalDate.now());
|
||||||
setSerCollo("/");
|
setSerCollo("/");
|
||||||
|
|
||||||
if (SettingsManager.i().isUserLoggedIn()) {
|
if (SettingsManager.i().isUserLoggedIn()) {
|
||||||
@@ -143,20 +144,13 @@ public class MtbColt extends EntityBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getDataColloHumanLong() {
|
public String getDataColloHumanLong() {
|
||||||
Date dataColloD = null;
|
if (dataCollo != null) {
|
||||||
try {
|
return UtilityDate.COMMONS_DATE_FORMATS.DATE_DMY_HUMAN_FORMATTER.format(dataCollo);
|
||||||
dataColloD = getDataColloD();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
UtilityLogger.error(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dataColloD != null) {
|
|
||||||
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN_LONG);
|
|
||||||
} else return null;
|
} else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataColloS() {
|
public String getDataColloS() {
|
||||||
return dataCollo;
|
return dataCollo != null ? UtilityDate.COMMONS_DATE_FORMATS.DATE_DMY_SLASHED_FORMATTER.format(dataCollo) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDataColloD() {
|
public Date getDataColloD() {
|
||||||
@@ -164,21 +158,16 @@ public class MtbColt extends EntityBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LocalDate getDataColloLD() {
|
public LocalDate getDataColloLD() {
|
||||||
return UtilityDate.recognizeLocalDateWithExceptionHandler(getDataColloS());
|
return dataCollo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColt setDataCollo(String dataCollo) {
|
public MtbColt setDataCollo(String dataCollo) {
|
||||||
this.dataCollo = dataCollo;
|
this.dataCollo = UtilityDate.recognizeLocalDateWithExceptionHandler(dataCollo);
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MtbColt setDataCollo(Date dataCollo) {
|
|
||||||
this.dataCollo = UtilityDate.formatDate(dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColt setDataCollo(LocalDate dataCollo) {
|
public MtbColt setDataCollo(LocalDate dataCollo) {
|
||||||
this.dataCollo = UtilityDate.formatDate(dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_SLASH);
|
this.dataCollo = dataCollo;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +250,7 @@ public class MtbColt extends EntityBase {
|
|||||||
public MtbColt setCodTcol(String codTcol) {
|
public MtbColt setCodTcol(String codTcol) {
|
||||||
this.codTcol = codTcol;
|
this.codTcol = codTcol;
|
||||||
|
|
||||||
if(!UtilityString.isNullOrEmpty(codTcol)) {
|
if (!UtilityString.isNullOrEmpty(codTcol)) {
|
||||||
var fountMtbTcolObservable = SettingsManager.iDB().getInternalImballi().stream()
|
var fountMtbTcolObservable = SettingsManager.iDB().getInternalImballi().stream()
|
||||||
.filter(x -> x.getCodTcol().equalsIgnoreCase(codTcol))
|
.filter(x -> x.getCodTcol().equalsIgnoreCase(codTcol))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
@@ -544,16 +533,25 @@ public class MtbColt extends EntityBase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObservableMtbTcol getMtbTCol() {
|
public String getBarcodeUl() {
|
||||||
return mtbTCol.get();
|
return barcodeUl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColt setMtbTCol(ObservableMtbTcol mtbTCol) {
|
public MtbColt setBarcodeUl(String barcodeUl) {
|
||||||
this.mtbTCol.set(mtbTCol);
|
this.barcodeUl = barcodeUl;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObservableField<ObservableMtbTcol> mtbTcolProperty() {
|
public ObservableMtbTcol getMtbTCol() {
|
||||||
|
return mtbTCol.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbColt setMtbTCol(ObservableMtbTcol mtbTCol) {
|
||||||
|
this.mtbTCol.postValue(mtbTCol);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableLiveData<ObservableMtbTcol> mtbTcolProperty() {
|
||||||
return mtbTCol;
|
return mtbTCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,8 +629,20 @@ public class MtbColt extends EntityBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityBase clone() {
|
public EntityBase clone() {
|
||||||
|
return clone(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbColt clone(boolean withMtbColr) {
|
||||||
MtbColt mtbColt = (MtbColt) super.clone();
|
MtbColt mtbColt = (MtbColt) super.clone();
|
||||||
mtbColt.setMtbColr((ObservableArrayList<MtbColr>) mtbColt.getMtbColr().clone());
|
mtbColt.setMtbColr(new ObservableArrayList<>());
|
||||||
|
|
||||||
|
if(!withMtbColr) return mtbColt;
|
||||||
|
|
||||||
|
this.getMtbColr().stream()
|
||||||
|
.map(MtbColr::new) //Genera un clone
|
||||||
|
.forEach(mtbColr -> {
|
||||||
|
mtbColt.getMtbColr().add(mtbColr);
|
||||||
|
});
|
||||||
return mtbColt;
|
return mtbColt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import android.os.Parcelable;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
public class MtbDepo extends EntityBase implements Parcelable {
|
public class MtbDepo extends EntityBase {
|
||||||
|
|
||||||
|
|
||||||
private String codMdep;
|
private String codMdep;
|
||||||
@@ -41,79 +41,6 @@ public class MtbDepo extends EntityBase implements Parcelable {
|
|||||||
type = "mtb_depo";
|
type = "mtb_depo";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MtbDepo(Parcel in) {
|
|
||||||
codMdep = in.readString();
|
|
||||||
descrizione = in.readString();
|
|
||||||
flagVal = in.readString();
|
|
||||||
codAnag = in.readString();
|
|
||||||
indirizzo = in.readString();
|
|
||||||
cap = in.readString();
|
|
||||||
citta = in.readString();
|
|
||||||
prov = in.readString();
|
|
||||||
tel = in.readString();
|
|
||||||
nazione = in.readString();
|
|
||||||
fax = in.readString();
|
|
||||||
eMail = in.readString();
|
|
||||||
sitoWeb = in.readString();
|
|
||||||
codVdes = in.readString();
|
|
||||||
serie = in.readString();
|
|
||||||
flagMovimentabile = in.readString();
|
|
||||||
codJfas = in.readString();
|
|
||||||
codVlis = in.readString();
|
|
||||||
codCcau = in.readString();
|
|
||||||
codCcon = in.readString();
|
|
||||||
codDtip = in.readString();
|
|
||||||
codDtipFat = in.readString();
|
|
||||||
flagContoVendita = in.readString();
|
|
||||||
flagTipoNegozio = in.readString();
|
|
||||||
codMdepReso = in.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeString(codMdep);
|
|
||||||
dest.writeString(descrizione);
|
|
||||||
dest.writeString(flagVal);
|
|
||||||
dest.writeString(codAnag);
|
|
||||||
dest.writeString(indirizzo);
|
|
||||||
dest.writeString(cap);
|
|
||||||
dest.writeString(citta);
|
|
||||||
dest.writeString(prov);
|
|
||||||
dest.writeString(tel);
|
|
||||||
dest.writeString(nazione);
|
|
||||||
dest.writeString(fax);
|
|
||||||
dest.writeString(eMail);
|
|
||||||
dest.writeString(sitoWeb);
|
|
||||||
dest.writeString(codVdes);
|
|
||||||
dest.writeString(serie);
|
|
||||||
dest.writeString(flagMovimentabile);
|
|
||||||
dest.writeString(codJfas);
|
|
||||||
dest.writeString(codVlis);
|
|
||||||
dest.writeString(codCcau);
|
|
||||||
dest.writeString(codCcon);
|
|
||||||
dest.writeString(codDtip);
|
|
||||||
dest.writeString(codDtipFat);
|
|
||||||
dest.writeString(flagContoVendita);
|
|
||||||
dest.writeString(flagTipoNegozio);
|
|
||||||
dest.writeString(codMdepReso);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Creator<MtbDepo> CREATOR = new Creator<MtbDepo>() {
|
|
||||||
@Override
|
|
||||||
public MtbDepo createFromParcel(Parcel in) {
|
|
||||||
return new MtbDepo(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MtbDepo[] newArray(int size) {
|
|
||||||
return new MtbDepo[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public String getCodMdep() {
|
public String getCodMdep() {
|
||||||
return codMdep;
|
return codMdep;
|
||||||
|
|||||||
@@ -4,34 +4,60 @@ import java.math.BigDecimal;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
public class MtbPartitaMag extends EntityBase{
|
public class MtbPartitaMag extends EntityBase {
|
||||||
private String codMart;
|
private String codMart;
|
||||||
|
|
||||||
private String partitaMag;
|
private String partitaMag;
|
||||||
private String descrizione;
|
private String descrizione;
|
||||||
private LocalDateTime dataIns;
|
private LocalDateTime dataIns;
|
||||||
private LocalDate dataScad;
|
private LocalDate dataScad;
|
||||||
private Integer scelta;
|
private Integer scelta;
|
||||||
private BigDecimal costoUntUmMag;
|
private BigDecimal costoUntUmMag;
|
||||||
private BigDecimal valUntUmMag;
|
private BigDecimal valUntUmMag;
|
||||||
private BigDecimal taraCnfKg;
|
private BigDecimal taraCnfKg;
|
||||||
private BigDecimal qtaCnf;
|
private BigDecimal qtaCnf;
|
||||||
private String flagImballoArendere;
|
private String flagImballoArendere;
|
||||||
private String flagStato;
|
private String flagStato;
|
||||||
private String codDiviCont;
|
private String codDiviCont;
|
||||||
private BigDecimal cambioDiviCont;
|
private BigDecimal cambioDiviCont;
|
||||||
private String barcode;
|
private String barcode;
|
||||||
private String note;
|
private String note;
|
||||||
private BigDecimal rapConv2;
|
private BigDecimal rapConv2;
|
||||||
private BigDecimal rapConv3;
|
private BigDecimal rapConv3;
|
||||||
private String posizione;
|
private String posizione;
|
||||||
private String dataAggPrz;
|
private String dataAggPrz;
|
||||||
private String partitaMagSec;
|
private String partitaMagSec;
|
||||||
private BigDecimal qtaAttesa;
|
private BigDecimal qtaAttesa;
|
||||||
|
|
||||||
public MtbPartitaMag() {
|
public MtbPartitaMag() {
|
||||||
this.type = "mtb_partita_mag";
|
this.type = "mtb_partita_mag";
|
||||||
}
|
}
|
||||||
|
public MtbPartitaMag(MtbPartitaMag other) {
|
||||||
|
this();
|
||||||
|
|
||||||
|
this.codMart = other.codMart;
|
||||||
|
this.partitaMag = other.partitaMag;
|
||||||
|
this.descrizione = other.descrizione;
|
||||||
|
this.dataIns = other.dataIns; // LocalDateTime è immutabile
|
||||||
|
this.dataScad = other.dataScad; // LocalDate è immutabile
|
||||||
|
this.scelta = other.scelta;
|
||||||
|
this.costoUntUmMag = other.costoUntUmMag; // BigDecimal è immutabile
|
||||||
|
this.valUntUmMag = other.valUntUmMag;
|
||||||
|
this.taraCnfKg = other.taraCnfKg;
|
||||||
|
this.qtaCnf = other.qtaCnf;
|
||||||
|
this.flagImballoArendere = other.flagImballoArendere;
|
||||||
|
this.flagStato = other.flagStato;
|
||||||
|
this.codDiviCont = other.codDiviCont;
|
||||||
|
this.cambioDiviCont = other.cambioDiviCont;
|
||||||
|
this.barcode = other.barcode;
|
||||||
|
this.note = other.note;
|
||||||
|
this.rapConv2 = other.rapConv2;
|
||||||
|
this.rapConv3 = other.rapConv3;
|
||||||
|
this.posizione = other.posizione;
|
||||||
|
this.dataAggPrz = other.dataAggPrz;
|
||||||
|
this.partitaMagSec = other.partitaMagSec;
|
||||||
|
this.qtaAttesa = other.qtaAttesa;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getCodMart() {
|
public String getCodMart() {
|
||||||
|
|||||||
@@ -15,6 +15,18 @@ public class MtbUntMis extends EntityBase {
|
|||||||
this.type = "mtb_unt_mis";
|
this.type = "mtb_unt_mis";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Costruttore di copia
|
||||||
|
public MtbUntMis(MtbUntMis other) {
|
||||||
|
this();
|
||||||
|
|
||||||
|
this.untMis = other.untMis;
|
||||||
|
this.flagDig = other.flagDig;
|
||||||
|
this.cifreDec = other.cifreDec; // BigDecimal è immutabile
|
||||||
|
this.tipoUm = other.tipoUm;
|
||||||
|
this.flagUnitaKg = other.flagUnitaKg;
|
||||||
|
this.flagAttivo = other.flagAttivo;
|
||||||
|
}
|
||||||
|
|
||||||
public String getUntMis() {
|
public String getUntMis() {
|
||||||
return untMis;
|
return untMis;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import java.math.BigDecimal;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
|
||||||
@@ -306,7 +305,7 @@ public class MvwSitArtUdcDetInventario {
|
|||||||
return new MtbColr()
|
return new MtbColr()
|
||||||
.setCodJcom(getCodJcom())
|
.setCodJcom(getCodJcom())
|
||||||
.setCodMart(getCodMart())
|
.setCodMart(getCodMart())
|
||||||
.setDataCollo(UtilityDate.toDate(getDataCollo()))
|
.setDataCollo(getDataCollo())
|
||||||
.setNumCollo(getNumCollo())
|
.setNumCollo(getNumCollo())
|
||||||
.setSerCollo(getSerCollo())
|
.setSerCollo(getSerCollo())
|
||||||
.setGestione(getGestione())
|
.setGestione(getGestione())
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.core.model;
|
package it.integry.integrywmsnative.core.model;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class StbGestSetup extends EntityBase{
|
public class StbGestSetup extends EntityBase{
|
||||||
|
|
||||||
private String gestName;
|
private String gestName;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class VtbDest extends EntityBase implements Parcelable {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Creator<VtbDest> CREATOR = new Creator<VtbDest>() {
|
public static final Creator<VtbDest> CREATOR = new Creator<>() {
|
||||||
@Override
|
@Override
|
||||||
public VtbDest createFromParcel(Parcel in) {
|
public VtbDest createFromParcel(Parcel in) {
|
||||||
return new VtbDest(in);
|
return new VtbDest(in);
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.core.model;
|
package it.integry.integrywmsnative.core.model;
|
||||||
|
|
||||||
import android.os.Parcelable;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
public class VtbVetr extends EntityBase {
|
public class VtbVetr extends EntityBase {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package it.integry.integrywmsnative.core.model.dto;
|
|||||||
|
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
|
||||||
public class AlreadyRegisteredUDCDTO {
|
public class AlreadyRegisteredUlDTO {
|
||||||
|
|
||||||
private MtbColt mtbColt;
|
private MtbColt mtbColt;
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ public class AlreadyRegisteredUDCDTO {
|
|||||||
return mtbColt;
|
return mtbColt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlreadyRegisteredUDCDTO setMtbColt(MtbColt mtbColt) {
|
public AlreadyRegisteredUlDTO setMtbColt(MtbColt mtbColt) {
|
||||||
this.mtbColt = mtbColt;
|
this.mtbColt = mtbColt;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,7 @@ public class AlreadyRegisteredUDCDTO {
|
|||||||
return canBeRecovered;
|
return canBeRecovered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlreadyRegisteredUDCDTO setCanBeRecovered(boolean canBeRecovered) {
|
public AlreadyRegisteredUlDTO setCanBeRecovered(boolean canBeRecovered) {
|
||||||
this.canBeRecovered = canBeRecovered;
|
this.canBeRecovered = canBeRecovered;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import io.jsonwebtoken.Claims;
|
||||||
|
import it.integry.integrywmsnative.core.authentication.JwtUtils;
|
||||||
|
import it.integry.integrywmsnative.core.exception.UnauthorizedAccessException;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
|
import it.integry.integrywmsnative.gest.login.rest.RefreshRESTConsumer;
|
||||||
|
import okhttp3.Interceptor;
|
||||||
|
import okhttp3.Protocol;
|
||||||
|
import okhttp3.Response;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
|
||||||
|
public class AuthInterceptor implements Interceptor {
|
||||||
|
|
||||||
|
private final RefreshRESTConsumer refreshRESTConsumer;
|
||||||
|
|
||||||
|
public AuthInterceptor(RefreshRESTConsumer refreshRESTConsumer) {
|
||||||
|
this.refreshRESTConsumer = refreshRESTConsumer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Response intercept(@NonNull Chain chain) throws IOException {
|
||||||
|
var originalRequest = chain.request();
|
||||||
|
|
||||||
|
if (SettingsManager.i().getUserSession() != null && SettingsManager.i().getUserSession().getAccessToken() != null) {
|
||||||
|
|
||||||
|
var accessToken = SettingsManager.i().getUserSession().getAccessToken();
|
||||||
|
var accessTokenExpiryDate = SettingsManager.i().getUserSession().getAccessTokenExpiryDate();
|
||||||
|
|
||||||
|
if (accessToken != null && (accessTokenExpiryDate == null || UtilityDate.getNowTime().isAfter(accessTokenExpiryDate.minusSeconds(20)))) {
|
||||||
|
|
||||||
|
// Make the token refresh request
|
||||||
|
try {
|
||||||
|
var response = refreshRESTConsumer.makeSynchronousRefreshTokenRequest();
|
||||||
|
|
||||||
|
Claims claims = JwtUtils.parseJwt(response.getAccessToken());
|
||||||
|
|
||||||
|
SettingsManager.i().getUserSession()
|
||||||
|
.setAccessToken(response.getAccessToken())
|
||||||
|
.setAccessTokenExpiryDate(UtilityDate.toLocalDateTime(claims.getExpiration()))
|
||||||
|
.setRefreshToken(response.getRefreshToken())
|
||||||
|
.setRefreshTokenExpiryDate(response.getExpiryDate());
|
||||||
|
|
||||||
|
SettingsManager.update();
|
||||||
|
} catch (UnauthorizedAccessException uae) {
|
||||||
|
// Crea una risposta 401 manualmente
|
||||||
|
return new Response.Builder()
|
||||||
|
.request(originalRequest)
|
||||||
|
.protocol(Protocol.HTTP_1_1)
|
||||||
|
.code(401)
|
||||||
|
.message("Unauthorized")
|
||||||
|
.body(ResponseBody.create(okhttp3.MediaType.get("application/json"), new byte[0]))
|
||||||
|
.build();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return chain.proceed(originalRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Retrieve the new access token after refresh
|
||||||
|
accessToken = SettingsManager.i().getUserSession().getAccessToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the access token to the request header
|
||||||
|
var authorizedRequest = originalRequest.newBuilder()
|
||||||
|
.header("Authorization", "Bearer " + accessToken)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return chain.proceed(authorizedRequest);
|
||||||
|
} else
|
||||||
|
return chain.proceed(originalRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
package it.integry.integrywmsnative.core.rest;
|
package it.integry.integrywmsnative.core.rest;
|
||||||
|
|
||||||
import android.util.Base64;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
import okhttp3.Interceptor;
|
import okhttp3.Interceptor;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
@@ -19,26 +18,32 @@ public class HttpInterceptor implements Interceptor {
|
|||||||
@Override
|
@Override
|
||||||
public Response intercept(Chain chain) throws IOException {
|
public Response intercept(Chain chain) throws IOException {
|
||||||
|
|
||||||
final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB();
|
final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB();
|
||||||
final String USERNAME = SettingsManager.i().getUser().getUsername();
|
final String APP_TOKEN = "fa3a21af-606b-4129-a22b-aedc2a52c7b6";
|
||||||
final String PASSWORD = SettingsManager.i().getUser().getPassword();
|
|
||||||
final String DEVICE_ID = SettingsManager.i().getUserSession().getDeviceId();
|
|
||||||
|
|
||||||
final Request request = chain.request();
|
HttpUrl.Builder urlBuilder = chain.request().url().newBuilder();
|
||||||
final HttpUrl url = request.url().newBuilder()
|
|
||||||
.addQueryParameter("profileDb", PROFILE_DB)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
String string = "Basic " + Base64.encodeToString((USERNAME + ":" + PASSWORD).getBytes(), Base64.NO_WRAP);
|
if (!UtilityString.isNullOrEmpty(PROFILE_DB))
|
||||||
|
urlBuilder
|
||||||
|
.addQueryParameter("profileDb", PROFILE_DB);
|
||||||
|
|
||||||
final Request newRequest = chain.request().newBuilder()
|
HttpUrl url = urlBuilder.build();
|
||||||
.addHeader("Authorization", string)
|
|
||||||
|
final Request.Builder requestBuilder = chain.request().newBuilder();
|
||||||
|
|
||||||
|
Request.Builder builder = requestBuilder
|
||||||
.addHeader("Content-Type", "application/json")
|
.addHeader("Content-Type", "application/json")
|
||||||
.addHeader("Accept", "*/*")
|
.addHeader("Accept", "*/*")
|
||||||
.addHeader("username", USERNAME != null ? USERNAME : "")
|
.addHeader("x-app-token", APP_TOKEN);
|
||||||
.addHeader("password", PASSWORD != null ? PASSWORD : "")
|
|
||||||
.addHeader("device_id", DEVICE_ID != null ? DEVICE_ID : "")
|
if (SettingsManager.i().getUserSession() != null &&
|
||||||
.url(url).build();
|
SettingsManager.i().getUserSession().getDepo() != null &&
|
||||||
|
!UtilityString.isNullOrEmpty(SettingsManager.i().getUserSession().getDepo().getCodMdep()))
|
||||||
|
builder.addHeader("codMdep", SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||||
|
|
||||||
|
var newRequest = builder
|
||||||
|
.url(url)
|
||||||
|
.build();
|
||||||
|
|
||||||
return chain.proceed(newRequest);
|
return chain.proceed(newRequest);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.security.KeyManagementException;
|
|||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import javax.net.ssl.TrustManager;
|
import javax.net.ssl.TrustManager;
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
@@ -20,38 +21,48 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
|||||||
* Created by GiuseppeS on 06/03/2018.
|
* Created by GiuseppeS on 06/03/2018.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Singleton
|
||||||
public class RESTBuilder {
|
public class RESTBuilder {
|
||||||
|
|
||||||
private static final boolean ADD_LOGGER_INTERCEPTOR = false;
|
private final boolean ADD_LOGGER_INTERCEPTOR = false;
|
||||||
|
private final AuthInterceptor authInterceptor;
|
||||||
|
|
||||||
public static <T> T getService(final Class<T> service) {
|
public RESTBuilder(AuthInterceptor authInterceptor) {
|
||||||
|
this.authInterceptor = authInterceptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T getService(final Class<T> service) {
|
||||||
return getService(service, SettingsManager.i().getServer().getProtocol(), SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true);
|
return getService(service, SettingsManager.i().getServer().getProtocol(), SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T getService(final Class<T> service, int timeout) {
|
public <T> T getService(final Class<T> service, int timeout) {
|
||||||
return getService(service, SettingsManager.i().getServer().getProtocol(), SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, true, timeout);
|
return getService(service, SettingsManager.i().getServer().getProtocol(), SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, timeout);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors) {
|
public <T> T getService(final Class<T> service, String protocol, String host, int port) {
|
||||||
return getService(service, protocol, host, port, addInterceptors, true, 60);
|
return getService(service, protocol, host, port, true, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi) {
|
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addEmsApi) {
|
||||||
return getService(service, protocol, host, port, addInterceptors, addEmsApi, 60);
|
return getService(service, protocol, host, port, addEmsApi, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi, int timeout) {
|
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addEmsApi, int timeout) {
|
||||||
OkHttpClient.Builder clientBuilder = getDefaultHttpClient();
|
OkHttpClient.Builder clientBuilder = getDefaultHttpClient();
|
||||||
|
|
||||||
|
timeout = 0;
|
||||||
|
|
||||||
clientBuilder.connectTimeout(timeout, TimeUnit.SECONDS);
|
clientBuilder.connectTimeout(timeout, TimeUnit.SECONDS);
|
||||||
clientBuilder.readTimeout(timeout, TimeUnit.SECONDS);
|
clientBuilder.readTimeout(timeout, TimeUnit.SECONDS);
|
||||||
clientBuilder.writeTimeout(timeout, TimeUnit.SECONDS);
|
clientBuilder.writeTimeout(timeout, TimeUnit.SECONDS);
|
||||||
|
clientBuilder.callTimeout(timeout, TimeUnit.SECONDS);
|
||||||
|
|
||||||
clientBuilder.retryOnConnectionFailure(true);
|
clientBuilder.retryOnConnectionFailure(true);
|
||||||
|
|
||||||
if (addInterceptors) clientBuilder.addInterceptor(new HttpInterceptor());
|
clientBuilder.addInterceptor(authInterceptor);
|
||||||
|
clientBuilder.addInterceptor(new HttpInterceptor());
|
||||||
if (ADD_LOGGER_INTERCEPTOR) clientBuilder.addInterceptor(new HttpLoggerInterceptor());
|
if (ADD_LOGGER_INTERCEPTOR) clientBuilder.addInterceptor(new HttpLoggerInterceptor());
|
||||||
|
|
||||||
OkHttpClient client = clientBuilder.build();
|
OkHttpClient client = clientBuilder.build();
|
||||||
@@ -71,15 +82,6 @@ public class RESTBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getDefaultHost() {
|
|
||||||
return SettingsManager.i().getServer().getHost();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getDefaultPort() {
|
|
||||||
return SettingsManager.i().getServer().getPort();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static OkHttpClient.Builder getDefaultHttpClient() {
|
public static OkHttpClient.Builder getDefaultHttpClient() {
|
||||||
TrustManager[] trustAllCerts = new TrustManager[]{
|
TrustManager[] trustAllCerts = new TrustManager[]{
|
||||||
new X509TrustManager() {
|
new X509TrustManager() {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
@@ -8,6 +10,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -17,132 +22,153 @@ import it.integry.integrywmsnative.core.model.MtbGrup;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
||||||
import it.integry.integrywmsnative.core.model.dto.StatoArticoloDTO;
|
import it.integry.integrywmsnative.core.model.dto.StatoArticoloDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
|
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.articolo.ArticoloDTO;
|
import it.integry.integrywmsnative.core.rest.model.articolo.ArticoloDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.articolo.RetrieveArticoloByCodMartRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.articolo.RetrieveArticoloByCodMartRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeResponseDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.articolo.UpdateBarcodeImballoRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.articolo.UpdateBarcodeImballoRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
private final RESTBuilder restBuilder;
|
||||||
|
private final ExecutorService executorService;
|
||||||
private final SystemRESTConsumer systemRESTConsumer;
|
private final SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
public ArticoloRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
public ArticoloRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||||
|
this.restBuilder = restBuilder;
|
||||||
|
this.executorService = executorService;
|
||||||
this.systemRESTConsumer = systemRESTConsumer;
|
this.systemRESTConsumer = systemRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void retrieveAvailableUntMis(RunnableArgs<List<MtbUntMis>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void retrieveAvailableUntMis(RunnableArgs<List<MtbUntMis>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||||
articoloRESTConsumerService
|
articoloRESTConsumerService
|
||||||
.retrieveAvailableUntMis()
|
.retrieveAvailableUntMis()
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<MtbUntMis>> call, Response<ServiceRESTResponse<MtbUntMis>> response) {
|
public void onResponse(Call<ServiceRESTResponse<MtbUntMis>> call, Response<ServiceRESTResponse<MtbUntMis>> response) {
|
||||||
analyzeAnswerList(response, "retrieveAvailableUntMis", onComplete, onFailed);
|
analyzeAnswerList(response, "retrieveAvailableUntMis", onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<MtbUntMis>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<MtbUntMis>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void retrieveAvailableGruppiMerceologici(RunnableArgs<List<MtbGrup>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void retrieveAvailableGruppiMerceologici(RunnableArgs<List<MtbGrup>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||||
articoloRESTConsumerService
|
articoloRESTConsumerService
|
||||||
.retrieveAvailableGruppiMerceologici()
|
.retrieveAvailableGruppiMerceologici()
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<MtbGrup>> call, Response<ServiceRESTResponse<MtbGrup>> response) {
|
public void onResponse(Call<ServiceRESTResponse<MtbGrup>> call, Response<ServiceRESTResponse<MtbGrup>> response) {
|
||||||
analyzeAnswerList(response, "retrieveAvailableGruppiMerceologici", onComplete, onFailed);
|
analyzeAnswerList(response, "retrieveAvailableGruppiMerceologici", onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<MtbGrup>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<MtbGrup>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void searchByBarcode(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbAart> searchByBarcodeSynchronized(String barcodeProd) throws Exception {
|
||||||
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||||
|
|
||||||
var request = new SearchArticoloByBarcodeRequestDTO()
|
var request = new SearchArticoloByBarcodeRequestDTO()
|
||||||
.setBarcode(barcodeProd)
|
.setBarcode(barcodeProd)
|
||||||
.setOnlyActive(true);
|
.setOnlyActive(true);
|
||||||
|
|
||||||
articoloRESTConsumerService
|
var response = articoloRESTConsumerService
|
||||||
.searchByBarcode(request)
|
.searchByBarcode(request)
|
||||||
.enqueue(new Callback<>() {
|
.execute();
|
||||||
|
|
||||||
|
analyzeAnswer(response, "searchByBarcode");
|
||||||
|
return response.body().getDto().getArts();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void searchByBarcode(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var mtbAarts = searchByBarcodeSynchronized(barcodeProd);
|
||||||
|
if (onComplete != null) onComplete.run(mtbAarts);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void findIfIsKit(MtbAart mtbAart, RunnableArgs<MtbAart> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||||
|
|
||||||
|
articoloRESTConsumerService
|
||||||
|
.findIfIsKit(mtbAart)
|
||||||
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> call, Response<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> response) {
|
public void onResponse(@NonNull Call<ServiceRESTResponse<MtbAart>> call, @NonNull Response<ServiceRESTResponse<MtbAart>> response) {
|
||||||
analyzeAnswer(response, "searchByBarcode", (m) -> {
|
analyzeAnswer(response, "findIfIsKit", (m) -> {
|
||||||
onComplete.run(response.body().getDto().getArts());
|
onComplete.run(response.body().getDto());
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<MtbAart>> call, @NonNull Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<MtbAart> getByCodMartsSynchronized(List<String> codMartToFind) throws Exception {
|
||||||
public void getByCodMarts(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
var codMarts = codMartToFind.parallelStream()
|
||||||
getByCodMartsStatic(codMartToFind, onComplete, onFailed);
|
.filter(Objects::nonNull)
|
||||||
}
|
.distinct()
|
||||||
|
.collect(Collectors.toUnmodifiableList());
|
||||||
public static void getByCodMartsStatic(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||||
|
var response = articoloRESTConsumer
|
||||||
var codMarts = Stream.of(codMartToFind)
|
|
||||||
.withoutNulls()
|
|
||||||
.distinct().toList();
|
|
||||||
|
|
||||||
|
|
||||||
ArticoloRESTConsumerService articoloRESTConsumer = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
|
||||||
articoloRESTConsumer
|
|
||||||
.getByCodMart(new RetrieveArticoloByCodMartRequestDTO()
|
.getByCodMart(new RetrieveArticoloByCodMartRequestDTO()
|
||||||
.setCodMarts(codMarts))
|
.setCodMarts(codMarts))
|
||||||
.enqueue(new Callback<>() {
|
.execute();
|
||||||
@Override
|
return analyzeAnswer(response, "getByCodMart");
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<MtbAart>>> call, Response<ServiceRESTResponse<List<MtbAart>>> response) {
|
}
|
||||||
analyzeAnswer(response, "getByCodMart", onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public void getByCodMarts(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<MtbAart>>> call, Throwable t) {
|
executorService.execute(() -> {
|
||||||
onFailed.run(new Exception(t));
|
try {
|
||||||
}
|
var mtbAarts = getByCodMartsSynchronized(codMartToFind);
|
||||||
});
|
if (onComplete != null) onComplete.run(mtbAarts);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<StatoArticoloDTO> getStatoPartitaSynchronized(String codMart, String partitaMag) throws Exception {
|
||||||
|
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||||
|
var response = articoloRESTConsumer.getStatoPartita(codMart, partitaMag).execute();
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "getStatoPartita");
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getStatoPartita(String codMart, String partitaMag, RunnableArgs<List<StatoArticoloDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getStatoPartita(String codMart, String partitaMag, RunnableArgs<List<StatoArticoloDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
ArticoloRESTConsumerService articoloRESTConsumer = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
try {
|
||||||
articoloRESTConsumer.getStatoPartita(codMart, partitaMag).enqueue(new Callback<>() {
|
var response = getStatoPartitaSynchronized(codMart, partitaMag);
|
||||||
@Override
|
if (onComplete != null) onComplete.run(response);
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<StatoArticoloDTO>>> call, Response<ServiceRESTResponse<List<StatoArticoloDTO>>> response) {
|
} catch (Exception ex) {
|
||||||
analyzeAnswer(response, "getStatoPartita", onComplete, onFailed);
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<StatoArticoloDTO>>> call, Throwable t) {
|
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -154,7 +180,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getArtsGroups(List<String> groupsToFind, RunnableArgs<List<MtbGrup>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbGrup> getArtsGroupsSynchronized(List<String> groupsToFind) throws Exception {
|
||||||
var whereCondMap = Stream.of(groupsToFind)
|
var whereCondMap = Stream.of(groupsToFind)
|
||||||
.map(x -> {
|
.map(x -> {
|
||||||
HashMap<String, Object> vars = new HashMap<>();
|
HashMap<String, Object> vars = new HashMap<>();
|
||||||
@@ -168,29 +194,30 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbGrup>>() {
|
Type typeOfObjectsList = new TypeToken<ArrayList<MtbGrup>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
|
|
||||||
this.systemRESTConsumer.processSql("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getUntMisArts(List<String> inputUntMis, RunnableArgs<List<MtbUntMis>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbUntMis> getUntMisArtsSynchronized(List<String> inputUntMis) throws Exception {
|
||||||
List<HashMap<String, Object>> whereCondList = Stream.of(inputUntMis)
|
List<HashMap<String, Object>> whereCondList = inputUntMis.parallelStream()
|
||||||
.distinct()
|
.distinct()
|
||||||
.withoutNulls()
|
.filter(Objects::nonNull)
|
||||||
.map(x -> {
|
.map(x -> {
|
||||||
HashMap<String, Object> data = new HashMap<>();
|
HashMap<String, Object> data = new HashMap<>();
|
||||||
data.put("unt_mis", x);
|
data.put("unt_mis", x);
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
.toList();
|
.collect(Collectors.toUnmodifiableList());
|
||||||
|
|
||||||
var whereCond = whereCondList.isEmpty() ? "" : " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondList);
|
var whereCond = whereCondList.isEmpty() ? "" : " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondList);
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbUntMis>>() {
|
Type typeOfObjectsList = new TypeToken<ArrayList<MtbUntMis>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
this.systemRESTConsumer.processSql("SELECT * FROM mtb_unt_mis " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
|
||||||
|
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM mtb_unt_mis " + whereCond, typeOfObjectsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fillMtbAartsWithMtbUntMis(List<MtbAart> inputMtbAart, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbAart> fillMtbAartsWithMtbUntMisSynchronized(List<MtbAart> inputMtbAart) throws Exception {
|
||||||
var inputUntMis = new ArrayList<String>();
|
var inputUntMis = new ArrayList<String>();
|
||||||
|
|
||||||
if (inputMtbAart != null && !inputMtbAart.isEmpty()) {
|
if (inputMtbAart != null && !inputMtbAart.isEmpty()) {
|
||||||
@@ -202,26 +229,28 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inputUntMis.isEmpty()) {
|
if (inputUntMis.isEmpty()) {
|
||||||
onComplete.run(inputMtbAart);
|
return inputMtbAart;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getUntMisArts(inputUntMis, mtbUntMiss -> {
|
var mtbUntMiss = getUntMisArtsSynchronized(inputUntMis);
|
||||||
for (var item : inputMtbAart) {
|
|
||||||
var mtbUntMis = Stream.of(mtbUntMiss).filter(x -> x.getUntMis().equalsIgnoreCase(item.getUntMis()))
|
|
||||||
.findFirstOrElse(null);
|
|
||||||
|
|
||||||
if (mtbUntMis != null)
|
for (var item : inputMtbAart) {
|
||||||
item.setMtbUntMis(Collections.singletonList(mtbUntMis));
|
var mtbUntMis = mtbUntMiss.stream()
|
||||||
}
|
.filter(x -> x.getUntMis().equalsIgnoreCase(item.getUntMis()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
if (mtbUntMis != null)
|
||||||
|
item.setMtbUntMis(Collections.singletonList(mtbUntMis));
|
||||||
|
}
|
||||||
|
|
||||||
|
return inputMtbAart;
|
||||||
|
|
||||||
onComplete.run(inputMtbAart);
|
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateBarcodeImballo(String codMart, String newBarcodeImballo, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void updateBarcodeImballo(String codMart, String newBarcodeImballo, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||||
|
|
||||||
var request = new UpdateBarcodeImballoRequestDTO()
|
var request = new UpdateBarcodeImballoRequestDTO()
|
||||||
.setCodMart(codMart)
|
.setCodMart(codMart)
|
||||||
@@ -229,7 +258,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
articoloRESTConsumerService
|
articoloRESTConsumerService
|
||||||
.updateBarcodeImballo(request)
|
.updateBarcodeImballo(request)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||||
analyzeAnswer(response, "updateBarcodeImballo", m -> {
|
analyzeAnswer(response, "updateBarcodeImballo", m -> {
|
||||||
@@ -238,22 +267,22 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void saveArticolo(ArticoloDTO articoloToSave, RunnableArgs<String> onComplete, RunnableArgs<Exception> onFailed) {
|
public void saveArticolo(ArticoloDTO articoloToSave, RunnableArgs<String> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||||
|
|
||||||
var request = new SaveArticoloRequestDTO()
|
var request = new SaveArticoloRequestDTO()
|
||||||
.setArtToSave(articoloToSave);
|
.setArtToSave(articoloToSave);
|
||||||
|
|
||||||
articoloRESTConsumerService
|
articoloRESTConsumerService
|
||||||
.saveArticolo(request)
|
.saveArticolo(request)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<SaveArticoloResponseDTO>> call, Response<ServiceRESTResponse<SaveArticoloResponseDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<SaveArticoloResponseDTO>> call, Response<ServiceRESTResponse<SaveArticoloResponseDTO>> response) {
|
||||||
analyzeAnswer(response, "saveArticolo", data -> {
|
analyzeAnswer(response, "saveArticolo", data -> {
|
||||||
@@ -262,8 +291,8 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<SaveArticoloResponseDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<SaveArticoloResponseDTO>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ public interface ArticoloRESTConsumerService {
|
|||||||
@POST("wms/articolo/searchByBarcode")
|
@POST("wms/articolo/searchByBarcode")
|
||||||
Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> searchByBarcode(@Body() SearchArticoloByBarcodeRequestDTO searchArticoloByBarcodeRequest);
|
Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> searchByBarcode(@Body() SearchArticoloByBarcodeRequestDTO searchArticoloByBarcodeRequest);
|
||||||
|
|
||||||
|
@POST("wms/articolo/findIfIsKit")
|
||||||
|
Call<ServiceRESTResponse<MtbAart>> findIfIsKit(@Body MtbAart mtbAart);
|
||||||
|
|
||||||
@POST("wms/articolo/retrieveByCodMart")
|
@POST("wms/articolo/retrieveByCodMart")
|
||||||
Call<ServiceRESTResponse<List<MtbAart>>> getByCodMart(@Body RetrieveArticoloByCodMartRequestDTO retrieveArticoloByCodMartRequest);
|
Call<ServiceRESTResponse<List<MtbAart>>> getByCodMart(@Body RetrieveArticoloByCodMartRequestDTO retrieveArticoloByCodMartRequest);
|
||||||
|
|
||||||
|
|||||||
@@ -2,30 +2,24 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
|||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.model.Azienda;
|
import it.integry.integrywmsnative.core.model.Azienda;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class AziendaRESTConsumer extends _BaseRESTConsumer {
|
public class AziendaRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
public void retrieveAzienda(RunnableArgs<Azienda> onComplete, RunnableArgs<Exception> onFailed) {
|
private final RESTBuilder restBuilder;
|
||||||
AziendaRESTConsumerService aziendaRESTConsumerService = RESTBuilder.getService(AziendaRESTConsumerService.class);
|
|
||||||
aziendaRESTConsumerService.retrieveDefaultAzienda().enqueue(new Callback<>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<Azienda>> call, Response<ServiceRESTResponse<Azienda>> response) {
|
|
||||||
analyzeAnswer(response, "Retrieve default azienda", onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public AziendaRESTConsumer(RESTBuilder restBuilder) {
|
||||||
public void onFailure(Call<ServiceRESTResponse<Azienda>> call, Throwable t) {
|
this.restBuilder = restBuilder;
|
||||||
onFailed.run(new Exception(t));
|
}
|
||||||
}
|
|
||||||
});
|
public Azienda retrieveAziendaSynchronized() throws Exception {
|
||||||
|
AziendaRESTConsumerService aziendaRESTConsumerService = restBuilder.getService(AziendaRESTConsumerService.class);
|
||||||
|
var response = aziendaRESTConsumerService.retrieveDefaultAzienda()
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
return analyzeAnswer(response, "Retrieve default azienda");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ public class BarcodeRESTConsumer extends _BaseRESTConsumer {
|
|||||||
this.ean128Service = ean128Service;
|
this.ean128Service = ean128Service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Ean128Model decodeEan128Synchronized(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||||
|
return this.ean128Service.decode(barcodeScanDTO);
|
||||||
|
}
|
||||||
|
|
||||||
public void decodeEan128(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
|
public void decodeEan128(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
try {
|
try {
|
||||||
onComplete.run(this.ean128Service.decode(barcodeObj));
|
onComplete.run(this.ean128Service.decode(barcodeObj));
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
@@ -7,6 +9,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliCaricoRESTConsumerInterface;
|
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliCaricoRESTConsumerInterface;
|
||||||
|
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
|
||||||
@@ -18,25 +21,30 @@ import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowResponseDTO;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements ColliCaricoRESTConsumerInterface {
|
public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements ColliCaricoRESTConsumerInterface {
|
||||||
|
|
||||||
|
private final RESTBuilder restBuilder;
|
||||||
|
|
||||||
|
public ColliAccettazioneRESTConsumer(RESTBuilder restBuilder) {
|
||||||
|
this.restBuilder = restBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||||
|
|
||||||
colliAccettazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
colliAccettazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Response<ServiceRESTResponse<CreateUDCResponseDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Response<ServiceRESTResponse<CreateUDCResponseDTO>> response) {
|
||||||
analyzeAnswer(response, "accettazione/createUDC", data -> onComplete.run(data.getMtbColt()), onFailed);
|
analyzeAnswer(response, "accettazione/createUDC", data -> onComplete.run(data.getMtbColt()), onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -44,89 +52,89 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeUDC(CloseUDCRequestDTO closeUDCRequestDTO, RunnableArgs<CloseUDCResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void closeUDC(CloseUDCRequestDTO closeUDCRequestDTO, RunnableArgs<CloseUDCResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||||
|
|
||||||
colliAccettazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
|
colliAccettazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Response<ServiceRESTResponse<CloseUDCResponseDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Response<ServiceRESTResponse<CloseUDCResponseDTO>> response) {
|
||||||
analyzeAnswer(response, "accettazione/closeUDC", onComplete, onFailed);
|
analyzeAnswer(response, "accettazione/closeUDC", onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
public void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||||
|
|
||||||
colliAccettazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
colliAccettazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDCRowResponseDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDCRowResponseDTO>> response) {
|
||||||
analyzeAnswer(response, "accettazione/insertUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
analyzeAnswer(response, "accettazione/insertUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||||
|
|
||||||
colliAccettazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
colliAccettazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDCRowResponseDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDCRowResponseDTO>> response) {
|
||||||
analyzeAnswer(response, "accettazione/editUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
analyzeAnswer(response, "accettazione/editUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||||
|
|
||||||
colliAccettazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
colliAccettazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||||
analyzeAnswer(response, "accettazione/deleteUDCRow", data -> onComplete.run(), onFailed);
|
analyzeAnswer(response, "accettazione/deleteUDCRow", data -> onComplete.run(), onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkBarcodeUl(String barcodeUl, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed){
|
public void checkBarcodeUl(String barcodeUl, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed){
|
||||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||||
|
|
||||||
colliAccettazioneRESTConsumerService.checkIfBarcodeUlAlreadyRegistered(barcodeUl)
|
colliAccettazioneRESTConsumerService.checkIfBarcodeUlAlreadyRegistered(barcodeUl)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
|
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
|
||||||
analyzeAnswer(response, "accettazione/checkIfBarcodeUlAlreadyRegistered", onComplete, onFailed);
|
analyzeAnswer(response, "accettazione/checkIfBarcodeUlAlreadyRegistered", onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -12,6 +15,7 @@ import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
|||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliCaricoRESTConsumerInterface;
|
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliCaricoRESTConsumerInterface;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
|
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
|
||||||
|
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
|
||||||
@@ -24,204 +28,223 @@ import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSFromArtRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSFromArtRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements ColliCaricoRESTConsumerInterface, ColliScaricoRESTConsumerInterface {
|
public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements ColliCaricoRESTConsumerInterface, ColliScaricoRESTConsumerInterface {
|
||||||
|
|
||||||
|
|
||||||
|
private final RESTBuilder restBuilder;
|
||||||
|
private final ExecutorService executorService;
|
||||||
private final SettingsManager settingsManager;
|
private final SettingsManager settingsManager;
|
||||||
|
|
||||||
public ColliLavorazioneRESTConsumer(SettingsManager settingsManager) {
|
public ColliLavorazioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SettingsManager settingsManager) {
|
||||||
|
this.restBuilder = restBuilder;
|
||||||
|
this.executorService = executorService;
|
||||||
this.settingsManager = settingsManager;
|
this.settingsManager = settingsManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
|
|
||||||
colliLavorazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
colliLavorazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Response<ServiceRESTResponse<CreateUDCResponseDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Response<ServiceRESTResponse<CreateUDCResponseDTO>> response) {
|
||||||
analyzeAnswer(response, "lavorazione/createUDC", data -> onComplete.run(data.getMtbColt()), onFailed);
|
analyzeAnswer(response, "lavorazione/createUDC", data -> onComplete.run(data.getMtbColt()), onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeUDC(CloseUDCRequestDTO closeUDCRequestDTO, RunnableArgs<CloseUDCResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void closeUDC(CloseUDCRequestDTO closeUDCRequestDTO, RunnableArgs<CloseUDCResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
|
|
||||||
colliLavorazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
|
colliLavorazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Response<ServiceRESTResponse<CloseUDCResponseDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Response<ServiceRESTResponse<CloseUDCResponseDTO>> response) {
|
||||||
analyzeAnswer(response, "lavorazione/closeUDC", onComplete, onFailed);
|
analyzeAnswer(response, "lavorazione/closeUDC", onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
public void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
|
|
||||||
colliLavorazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
colliLavorazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDCRowResponseDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDCRowResponseDTO>> response) {
|
||||||
analyzeAnswer(response, "lavorazione/insertUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
analyzeAnswer(response, "lavorazione/insertUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
|
|
||||||
colliLavorazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
colliLavorazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDCRowResponseDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDCRowResponseDTO>> response) {
|
||||||
analyzeAnswer(response, "lavorazione/editUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
analyzeAnswer(response, "lavorazione/editUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||||
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
|
|
||||||
|
var response = colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "lavorazione/createUDS");
|
||||||
|
return data.getMtbColt();
|
||||||
|
}
|
||||||
|
|
||||||
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var response = createUDSSynchronized(createUDSRequestDTO);
|
||||||
|
if (onComplete != null) onComplete.run(response);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
public CloseUDSResponseDTO closeUDSSynchronized(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception {
|
||||||
.enqueue(new Callback<>() {
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
|
|
||||||
analyzeAnswer(response, "lavorazione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
var response = colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
||||||
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Throwable t) {
|
.execute();
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "lavorazione/closeUDS");
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var response = closeUDSSynchronized(closeUDSRequestDTO);
|
||||||
|
if (onComplete != null) onComplete.run(response);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public MtbColr insertUDSRowSynchronized(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
|
|
||||||
colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response = colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
|
|
||||||
analyzeAnswer(response, "lavorazione/closeUDS", onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
var data = analyzeAnswer(response, "lavorazione/insertUDSRow");
|
||||||
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Throwable t) {
|
return data.getSavedMtbColr();
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var response = insertUDSRowSynchronized(insertUDSRowRequestDTO);
|
||||||
|
if (onComplete != null) onComplete.run(response);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
public MtbColr editUDSRowSynchronized(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception {
|
||||||
.enqueue(new Callback<>() {
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
|
|
||||||
analyzeAnswer(response, "lavorazione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
var response = colliLavorazioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
||||||
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Throwable t) {
|
.execute();
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
var data = analyzeAnswer(response, "lavorazione/editUDSRow");
|
||||||
});
|
return data.getSavedMtbColr();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliLavorazioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
var response = editUDSRowSynchronized(editUDSRowRequestDTO);
|
||||||
.enqueue(new Callback<>() {
|
if (onComplete != null) onComplete.run(response);
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "lavorazione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
}
|
||||||
}
|
});
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Throwable t) {
|
public void deleteUDSRowSynchronized(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO) throws Exception {
|
||||||
onFailed.run(new Exception(t));
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
}
|
|
||||||
});
|
var response = colliLavorazioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
analyzeAnswer(response, "lavorazione/deleteUDSRow");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliLavorazioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
deleteUDSRowSynchronized(deleteUDSRowRequestDTO);
|
||||||
.enqueue(new Callback<>() {
|
if (onComplete != null) onComplete.run();
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "lavorazione/deleteUDSRow", data -> onComplete.run(), onFailed);
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
|
|
||||||
colliLavorazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
colliLavorazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||||
analyzeAnswer(response, "lavorazione/deleteUDCRow", data -> onComplete.run(), onFailed);
|
analyzeAnswer(response, "lavorazione/deleteUDCRow", data -> onComplete.run(), onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -249,18 +272,18 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
|||||||
createUDSFromArtRequestDTO
|
createUDSFromArtRequestDTO
|
||||||
.setCodJfas(posizione.getPosizione());
|
.setCodJfas(posizione.getPosizione());
|
||||||
}
|
}
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
|
|
||||||
colliLavorazioneRESTConsumerService.createUDSFromArt(createUDSFromArtRequestDTO)
|
colliLavorazioneRESTConsumerService.createUDSFromArt(createUDSFromArtRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||||
analyzeAnswer(response, "lavorazione/createUDSFromArt", data -> onComplete.run(), onFailed);
|
analyzeAnswer(response, "lavorazione/createUDSFromArt", data -> onComplete.run(), onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
|
||||||
import com.annimon.stream.Optional;
|
import com.annimon.stream.Optional;
|
||||||
@@ -10,11 +11,15 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -29,10 +34,12 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
|
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.UpdatePosizioneULRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
|
||||||
@@ -45,57 +52,57 @@ import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavorazioneDTO;
|
import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavorazioneDTO;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
private final RESTBuilder restBuilder;
|
||||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||||
private final EntityRESTConsumer mEntityRESTConsumer;
|
private final EntityRESTConsumer mEntityRESTConsumer;
|
||||||
private final SettingsManager mSettingsManager;
|
private final SettingsManager mSettingsManager;
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
public ColliMagazzinoRESTConsumer(SystemRESTConsumer systemRESTConsumer,
|
public ColliMagazzinoRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer,
|
||||||
ArticoloRESTConsumer articoloRESTConsumer,
|
ArticoloRESTConsumer articoloRESTConsumer,
|
||||||
EntityRESTConsumer entityRESTConsumer,
|
EntityRESTConsumer entityRESTConsumer,
|
||||||
SettingsManager settingsManager) {
|
SettingsManager settingsManager) {
|
||||||
|
this.restBuilder = restBuilder;
|
||||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||||
this.mEntityRESTConsumer = entityRESTConsumer;
|
this.mEntityRESTConsumer = entityRESTConsumer;
|
||||||
this.mSettingsManager = settingsManager;
|
this.mSettingsManager = settingsManager;
|
||||||
|
this.executorService = executorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveCollo(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public MtbColt saveColloSynchronized(MtbColt mtbColtToSave) throws Exception {
|
||||||
MtbColt mtbColtToSaveClone = (MtbColt) mtbColtToSave.clone();
|
MtbColt mtbColtToSaveClone = (MtbColt) mtbColtToSave.clone();
|
||||||
mtbColtToSaveClone.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
mtbColtToSaveClone.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||||
mtbColtToSaveClone.setOnlyPkMaster(false);
|
mtbColtToSaveClone.setOnlyPkMaster(false);
|
||||||
|
|
||||||
|
|
||||||
mtbColtToSaveClone.setMtbColr(new ObservableArrayList<>());
|
|
||||||
|
|
||||||
for (int i = 0; i < mtbColtToSave.getMtbColr().size(); i++) {
|
for (int i = 0; i < mtbColtToSave.getMtbColr().size(); i++) {
|
||||||
mtbColtToSaveClone.getMtbColr().add(
|
mtbColtToSaveClone.getMtbColr().get(i)
|
||||||
((MtbColr) mtbColtToSave.getMtbColr().get(i).clone())
|
.setMtbAart(null)
|
||||||
.setMtbAart(null)
|
.setMtbPartitaMag(null);
|
||||||
.setMtbPartitaMag(null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mEntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback<MtbColt>() {
|
return this.mEntityRESTConsumer.processEntitySynchronized(mtbColtToSaveClone, MtbColt.class);
|
||||||
@Override
|
}
|
||||||
public void onSuccess(MtbColt value) {
|
|
||||||
if (onComplete != null) onComplete.run(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public void saveCollo(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public void onFailed(Exception ex) {
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var mtbColt = saveColloSynchronized(mtbColtToSave);
|
||||||
|
if (onComplete != null) onComplete.run(mtbColt);
|
||||||
|
} catch (Exception ex) {
|
||||||
if (onFailed != null) onFailed.run(ex);
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
}, MtbColt.class);
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveColli(List<MtbColt> mtbColtsToSave, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbColt> saveColliSynchronized(List<MtbColt> mtbColtsToSave) throws Exception {
|
||||||
|
|
||||||
for (MtbColt mtbColt : mtbColtsToSave) {
|
for (MtbColt mtbColt : mtbColtsToSave) {
|
||||||
for (int i = 0; i < mtbColt.getMtbColr().size(); i++) {
|
for (int i = 0; i < mtbColt.getMtbColr().size(); i++) {
|
||||||
@@ -105,28 +112,22 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mEntityRESTConsumer.processEntityList(mtbColtsToSave, true, MtbColt.class, onComplete, onFailed);
|
return this.mEntityRESTConsumer.processEntityListSynchronized(mtbColtsToSave, true, MtbColt.class);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
|
||||||
MtbColt mtbColtToCreate = new MtbColt()
|
|
||||||
.setSegno(segno);
|
|
||||||
|
|
||||||
mtbColtToCreate.initDefaultFields(GestioneEnum.LAVORAZIONE);
|
|
||||||
|
|
||||||
mtbColtToCreate
|
|
||||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
|
||||||
|
|
||||||
|
|
||||||
saveCollo(mtbColtToCreate, value -> {
|
|
||||||
if (onComplete != null) onComplete.run(value);
|
|
||||||
}, ex -> {
|
|
||||||
if (onFailed != null) onFailed.run(ex);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var mtbColt = createColloScaricoDaCaricoSynchronized(sourceMtbColt, posizione);
|
||||||
|
if (onComplete != null) onComplete.run(mtbColt);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public MtbColt createColloScaricoDaCaricoSynchronized(MtbColt sourceMtbColt, MtbDepoPosizione posizione) throws Exception {
|
||||||
|
|
||||||
MtbColt newMtbColt = new MtbColt()
|
MtbColt newMtbColt = new MtbColt()
|
||||||
.initDefaultFields(GestioneEnum.LAVORAZIONE)
|
.initDefaultFields(GestioneEnum.LAVORAZIONE)
|
||||||
@@ -160,11 +161,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
mtbColrClone
|
mtbColrClone
|
||||||
.setNumCollo(null)
|
.setNumCollo(null)
|
||||||
.setDataCollo((String) null)
|
.setDataCollo((LocalDate) null)
|
||||||
.setRiga(null)
|
.setRiga(null)
|
||||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
.setGestione(GestioneEnum.LAVORAZIONE)
|
||||||
|
|
||||||
.setDataColloRif(sourceMtbColt.getDataColloD())
|
.setDataColloRif(sourceMtbColt.getDataColloLD())
|
||||||
.setNumColloRif(sourceMtbColt.getNumCollo())
|
.setNumColloRif(sourceMtbColt.getNumCollo())
|
||||||
.setGestioneRif(sourceMtbColt.getGestione())
|
.setGestioneRif(sourceMtbColt.getGestione())
|
||||||
.setSerColloRif(sourceMtbColt.getSerCollo())
|
.setSerColloRif(sourceMtbColt.getSerCollo())
|
||||||
@@ -175,7 +176,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
saveCollo(newMtbColt, onComplete, onFailed);
|
return saveColloSynchronized(newMtbColt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -206,7 +207,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if (sourceMtbColt.getMtbColr().size() != 1) {
|
// if (sourceMtbColt.getMtbColr().getValue().size() != 1) {
|
||||||
// onFailed.run(new Exception());
|
// onFailed.run(new Exception());
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
@@ -214,10 +215,10 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
MtbColr mtbColrClone = new MtbColr();
|
MtbColr mtbColrClone = new MtbColr();
|
||||||
mtbColrClone
|
mtbColrClone
|
||||||
.setNumCollo(null)
|
.setNumCollo(null)
|
||||||
.setDataCollo((String) null)
|
.setDataCollo((LocalDate) null)
|
||||||
.setRiga(null)
|
.setRiga(null)
|
||||||
.setGestione(GestioneEnum.LAVORAZIONE)
|
.setGestione(GestioneEnum.LAVORAZIONE)
|
||||||
.setDataColloRif(sourceMtbColt.getDataColloD())
|
.setDataColloRif(sourceMtbColt.getDataColloLD())
|
||||||
.setNumColloRif(sourceMtbColt.getNumCollo())
|
.setNumColloRif(sourceMtbColt.getNumCollo())
|
||||||
.setGestioneRif(sourceMtbColt.getGestione())
|
.setGestioneRif(sourceMtbColt.getGestione())
|
||||||
.setSerColloRif(sourceMtbColt.getSerCollo())
|
.setSerColloRif(sourceMtbColt.getSerCollo())
|
||||||
@@ -282,73 +283,112 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
saveCollo(mtbColtToCreate, onComplete, onFailed);
|
saveCollo(mtbColtToCreate, onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbColt getBySsccSynchronized(String ssccString, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
||||||
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
|
var colloResponse = colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull)
|
||||||
|
.execute();
|
||||||
|
var mtbColt = analyzeAnswer(colloResponse, "GetBySSCC");
|
||||||
|
|
||||||
|
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||||
|
List<MtbColt> mtbColtList = new ArrayList<>();
|
||||||
|
mtbColtList.add(mtbColt);
|
||||||
|
var mtbColts = fillMtbAartsOfMtbColtsSynchronized(mtbColtList);
|
||||||
|
return mtbColts.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mtbColt;
|
||||||
|
}
|
||||||
|
|
||||||
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull).enqueue(new Callback<>() {
|
try {
|
||||||
@Override
|
var mtbColt = getBySsccSynchronized(ssccString, onlyResiduo, throwExcIfNull);
|
||||||
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
|
if (onComplete != null) onComplete.run(mtbColt);
|
||||||
analyzeAnswer(response, "GetBySSCC", mtbColt -> {
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
|
||||||
List<MtbColt> mtbColtList = new ArrayList<>();
|
|
||||||
mtbColtList.add(mtbColt);
|
|
||||||
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
|
|
||||||
} else {
|
|
||||||
onComplete.run(mtbColt);
|
|
||||||
}
|
|
||||||
|
|
||||||
}, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, Throwable t) {
|
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbColr> fillMtbAartsOfMtbColrsSynchronized(List<MtbColr> mtbColrs) throws Exception {
|
||||||
fillMtbAartsOfMtbColtsStatic(mtbColts, onComplete, onFailed);
|
|
||||||
|
List<String> codMarts = new ArrayList<>(mtbColrs.stream()
|
||||||
|
.map(MtbColr::getCodMart)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toUnmodifiableList()));
|
||||||
|
|
||||||
|
var arts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||||
|
|
||||||
|
|
||||||
|
if (arts != null && !arts.isEmpty()) {
|
||||||
|
for (MtbColr mtbColr : mtbColrs) {
|
||||||
|
MtbAart foundMtbAart = null;
|
||||||
|
|
||||||
|
List<MtbAart> mtbAartStream = arts.stream()
|
||||||
|
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (!mtbAartStream.isEmpty()) {
|
||||||
|
foundMtbAart = mtbAartStream.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
mtbColr.setMtbAart(foundMtbAart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mtbColrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void fillMtbAartsOfMtbColtsStatic(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbColt> fillMtbAartsOfMtbColtsSynchronized(List<MtbColt> mtbColts) throws Exception {
|
||||||
List<String> codMarts = new ArrayList<>();
|
List<String> codMarts = new ArrayList<>();
|
||||||
|
|
||||||
for (MtbColt mtbColt : mtbColts) {
|
for (MtbColt mtbColt : mtbColts) {
|
||||||
codMarts.addAll(Stream.of(mtbColt.getMtbColr())
|
codMarts.addAll(mtbColt.getMtbColr().stream()
|
||||||
.map(MtbColr::getCodMart)
|
.map(MtbColr::getCodMart)
|
||||||
.withoutNulls()
|
.filter(x -> !UtilityString.isNullOrEmpty(x))
|
||||||
.distinct()
|
.distinct()
|
||||||
.toList());
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<MtbAart> mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||||
|
|
||||||
ArticoloRESTConsumer.getByCodMartsStatic(codMarts, arts -> {
|
for (MtbColt mtbColt : mtbColts) {
|
||||||
|
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
|
||||||
|
|
||||||
if (arts != null && arts.size() > 0) {
|
if (mtbAarts != null && !mtbAarts.isEmpty()) {
|
||||||
for (MtbColt mtbColt : mtbColts) {
|
MtbAart foundMtbAart = null;
|
||||||
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
|
|
||||||
|
|
||||||
MtbAart foundMtbAart = null;
|
List<MtbAart> mtbAartStream = mtbAarts.parallelStream()
|
||||||
|
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
List<MtbAart> mtbAartStream = Stream.of(arts)
|
if (!mtbAartStream.isEmpty()) {
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart())).toList();
|
foundMtbAart = mtbAartStream.get(0);
|
||||||
|
|
||||||
if (mtbAartStream != null && mtbAartStream.size() > 0) {
|
|
||||||
foundMtbAart = mtbAartStream.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
mtbColr.setMtbAart(foundMtbAart);
|
|
||||||
mtbColr.setGestione(mtbColt.getGestione());
|
|
||||||
mtbColr.setSerCollo(mtbColt.getSerCollo());
|
|
||||||
mtbColr.setNumCollo(mtbColt.getNumCollo());
|
|
||||||
mtbColr.setDataCollo(mtbColt.getDataColloS());
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onComplete.run(mtbColts);
|
mtbColr.setMtbAart(foundMtbAart);
|
||||||
}, onFailed);
|
}
|
||||||
|
|
||||||
|
mtbColr.setGestione(mtbColt.getGestione());
|
||||||
|
mtbColr.setSerCollo(mtbColt.getSerCollo());
|
||||||
|
mtbColr.setNumCollo(mtbColt.getNumCollo());
|
||||||
|
mtbColr.setDataCollo(mtbColt.getDataColloLD());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mtbColts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
List<MtbColt> returnedMtbColts = fillMtbAartsOfMtbColtsSynchronized(mtbColts);
|
||||||
|
if (onComplete != null) onComplete.run(returnedMtbColts);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getMultipleByTestate(List<MtbColt> testate, boolean onlyResiduo, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getMultipleByTestate(List<MtbColt> testate, boolean onlyResiduo, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
@@ -369,7 +409,17 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getByChiaveCollo(GestioneEnum gestione, int numCollo, String dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public MtbColt getByChiaveColloSynchronized(GestioneEnum gestione, int numCollo, LocalDate dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
||||||
|
MtbColt mtbColtToRetrieve = new MtbColt()
|
||||||
|
.setGestione(gestione)
|
||||||
|
.setNumCollo(numCollo)
|
||||||
|
.setDataCollo(dataCollo)
|
||||||
|
.setSerCollo(serCollo);
|
||||||
|
|
||||||
|
return getByTestataSynchronized(mtbColtToRetrieve, onlyResiduo, throwExcIfNull);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getByChiaveCollo(GestioneEnum gestione, int numCollo, LocalDate dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
MtbColt mtbColtToRetrieve = new MtbColt()
|
MtbColt mtbColtToRetrieve = new MtbColt()
|
||||||
.setGestione(gestione)
|
.setGestione(gestione)
|
||||||
.setNumCollo(numCollo)
|
.setNumCollo(numCollo)
|
||||||
@@ -379,35 +429,34 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
getByTestata(mtbColtToRetrieve, onlyResiduo, throwExcIfNull, onComplete, onFailed);
|
getByTestata(mtbColtToRetrieve, onlyResiduo, throwExcIfNull, onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getByTestata(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public MtbColt getByTestataSynchronized(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
||||||
testata.setMtbColr(new ObservableArrayList<>());
|
testata.setMtbColr(new ObservableArrayList<>());
|
||||||
|
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata).enqueue(new Callback<ServiceRESTResponse<MtbColt>>() {
|
var response = colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata)
|
||||||
@Override
|
.execute();
|
||||||
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
|
var mtbColt = analyzeAnswer(response, "getColloInGiac");
|
||||||
analyzeAnswer(response, "getColloInGiac", mtbColt -> {
|
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||||
|
var mtbColts = fillMtbAartsOfMtbColtsSynchronized(Collections.singletonList(mtbColt));
|
||||||
|
return mtbColts.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
|
return mtbColt;
|
||||||
List<MtbColt> mtbColtList = new ArrayList<>();
|
}
|
||||||
mtbColtList.add(mtbColt);
|
|
||||||
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
|
|
||||||
} else {
|
|
||||||
onComplete.run(mtbColt);
|
|
||||||
}
|
|
||||||
|
|
||||||
}, onFailed);
|
public void getByTestata(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
}
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
@Override
|
var data = getByTestataSynchronized(testata, onlyResiduo, throwExcIfNull);
|
||||||
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, Throwable t) {
|
if (onComplete != null) onComplete.run(data);
|
||||||
onFailed.run(new Exception(t));
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void spostaUlSynchronized(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically) throws Exception {
|
||||||
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
|
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
|
||||||
|
|
||||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||||
@@ -422,22 +471,24 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.setMtbColtsToMove(Collections.singletonList(mtbColtToMoveClone))
|
.setMtbColtsToMove(Collections.singletonList(mtbColtToMoveClone))
|
||||||
.setCreateDocAutomatically(createDocAutomatically);
|
.setCreateDocAutomatically(createDocAutomatically);
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService
|
Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
|
||||||
.spostaUL(spostaUlRequestDTO)
|
.spostaUL(spostaUlRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
|
||||||
analyzeAnswer(response, "spostaUL", mtbColts -> {
|
|
||||||
onComplete.run();
|
|
||||||
}, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
analyzeAnswer(response, "spostaUL");
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
}
|
||||||
if (onFailed != null) onFailed.run(new Exception(t));
|
|
||||||
}
|
|
||||||
});
|
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
spostaUlSynchronized(mtbColtToMove, codMdep, posizione, createDocAutomatically);
|
||||||
|
if (onComplete != null) onComplete.run();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spostaUL(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void spostaUL(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
@@ -448,7 +499,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
spostaUL(mtbColtToMove, codMdep, posizioneString, true, onComplete, onFailed);
|
spostaUL(mtbColtToMove, codMdep, posizioneString, true, onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTipoUL(MtbColt mtbColt, String codTcol, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void updateTipoULSynchronized(MtbColt mtbColt, String codTcol) throws Exception {
|
||||||
|
|
||||||
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
|
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
|
||||||
mtbColtClone.setMtbColr(new ObservableArrayList<>());
|
mtbColtClone.setMtbColr(new ObservableArrayList<>());
|
||||||
@@ -457,23 +508,53 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.setMtbColt(mtbColtClone)
|
.setMtbColt(mtbColtClone)
|
||||||
.setCodTcol(codTcol);
|
.setCodTcol(codTcol);
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService
|
Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
|
||||||
.updateTipoUL(updateTipoULRequest)
|
.updateTipoUL(updateTipoULRequest)
|
||||||
.enqueue(new Callback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
|
||||||
analyzeAnswer(response, "updateTipoUL", mtbColts -> {
|
|
||||||
onComplete.run();
|
|
||||||
}, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
analyzeAnswer(response, "updateTipoUL");
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
}
|
||||||
if (onFailed != null) onFailed.run(new Exception(t));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
public void updateTipoUL(MtbColt mtbColt, String codTcol, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
updateTipoULSynchronized(mtbColt, codTcol);
|
||||||
|
if (onComplete != null) onComplete.run();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePosizioneULSynchronized(MtbColt mtbColt, String posizione) throws Exception {
|
||||||
|
|
||||||
|
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
|
||||||
|
mtbColtClone.setMtbColr(new ObservableArrayList<>());
|
||||||
|
|
||||||
|
UpdatePosizioneULRequestDTO updateTipoULRequest = new UpdatePosizioneULRequestDTO()
|
||||||
|
.setMtbColt(mtbColtClone)
|
||||||
|
.setPosizione(posizione);
|
||||||
|
|
||||||
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
|
Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
|
||||||
|
.updatePosizioneUL(updateTipoULRequest)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
analyzeAnswer(response, "updatePosizioneUL");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void updatePosizioneUL(MtbColt mtbColt, String posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
updatePosizioneULSynchronized(mtbColt, posizione);
|
||||||
|
if (onComplete != null) onComplete.run();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
@@ -492,19 +573,19 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void retrieveBasketColli(RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void retrieveBasketColli(RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService.getColliInBasket(SettingsManager.i().getUserSession().getDepo().getCodMdep()).enqueue(new Callback<ServiceRESTResponse<List<MtbColt>>>() {
|
colliMagazzinoRESTConsumerService.getColliInBasket(SettingsManager.i().getUserSession().getDepo().getCodMdep()).enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<MtbColt>>> call, Response<ServiceRESTResponse<List<MtbColt>>> response) {
|
public void onResponse(Call<ServiceRESTResponse<List<MtbColt>>> call, Response<ServiceRESTResponse<List<MtbColt>>> response) {
|
||||||
analyzeAnswer(response, "getColliInBasket", mtbColts -> {
|
analyzeAnswer(response, "getColliInBasket", mtbColts -> {
|
||||||
fillMtbAartsOfMtbColtsStatic(mtbColts, onComplete, onFailed);
|
fillMtbAartsOfMtbColts(mtbColts, onComplete, onFailed);
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<MtbColt>>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<List<MtbColt>>> call, @NonNull final Exception e) {
|
||||||
if (onFailed != null) onFailed.run(new Exception(t));
|
if (onFailed != null) onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -519,58 +600,62 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.setNewNumCnf(newNumCnf)
|
.setNewNumCnf(newNumCnf)
|
||||||
.setNewQtaCol(newQtaTot);
|
.setNewQtaCol(newQtaTot);
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService.creaRettificaCollo(
|
colliMagazzinoRESTConsumerService.creaRettificaCollo(
|
||||||
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
|
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
|
||||||
rettificaULDTO
|
rettificaULDTO
|
||||||
).enqueue(new Callback<>() {
|
).enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<MtbColr>> call, Response<ServiceRESTResponse<MtbColr>> response) {
|
public void onResponse(Call<ServiceRESTResponse<MtbColr>> call, Response<ServiceRESTResponse<MtbColr>> response) {
|
||||||
analyzeAnswer(response, "creaRettificaCollo", onComplete, onFailed);
|
analyzeAnswer(response, "creaRettificaCollo", onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<MtbColr>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<MtbColr>> call, @NonNull final Exception e) {
|
||||||
if (onFailed != null) onFailed.run(new Exception(t));
|
if (onFailed != null) onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbColr> spostaArtsTraULSynchronized(MtbColt sourceMtbColt, MtbColt destMtbColt, boolean flagForceUseRefs) throws Exception {
|
||||||
new Thread(() -> {
|
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
||||||
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
|
||||||
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
|
|
||||||
|
|
||||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||||
mtbColtToMoveClone.getMtbColr().get(i)
|
mtbColtToMoveClone.getMtbColr().get(i)
|
||||||
.setMtbAart(null)
|
.setMtbAart(null)
|
||||||
.setMtbPartitaMag(null);
|
.setMtbPartitaMag(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
mtbColtDestClone.setMtbColr(null);
|
mtbColtDestClone.setMtbColr(null);
|
||||||
|
|
||||||
SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO()
|
SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO()
|
||||||
.setSourceMtbColt(mtbColtToMoveClone)
|
.setSourceMtbColt(mtbColtToMoveClone)
|
||||||
.setDestinationMtbColt(mtbColtDestClone);
|
.setDestinationMtbColt(mtbColtDestClone)
|
||||||
|
.setFlagForceUseRefs(flagForceUseRefs);
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new Callback<>() {
|
var response = colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO)
|
||||||
@Override
|
.execute();
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
|
||||||
analyzeAnswer(response, "spostaArtsTraUL", data -> {
|
|
||||||
onComplete.run();
|
|
||||||
}, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
var data = analyzeAnswer(response, "spostaArtsTraUL");
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
var mtbColrs = fillMtbAartsOfMtbColrsSynchronized(data.getGeneratedMtbColr());
|
||||||
if (onFailed != null) onFailed.run(new Exception(t));
|
|
||||||
}
|
return mtbColrs;
|
||||||
});
|
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assegnaLottoSuColloScarico(MtbColt sourceMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, boolean flagForceUseRefs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var result = spostaArtsTraULSynchronized(sourceMtbColt, destMtbColt, flagForceUseRefs);
|
||||||
|
if (onComplete != null) onComplete.run(result);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbColt assegnaLottoSuColloScaricoSynchronized(MtbColt sourceMtbColt) throws Exception {
|
||||||
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
|
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
|
||||||
|
|
||||||
for (int i = 0; i < sourceMtbColtClone.getMtbColr().size(); i++) {
|
for (int i = 0; i < sourceMtbColtClone.getMtbColr().size(); i++) {
|
||||||
@@ -579,18 +664,21 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.setMtbPartitaMag(null);
|
.setMtbPartitaMag(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone).enqueue(new Callback<>() {
|
var response = colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone)
|
||||||
@Override
|
.execute();
|
||||||
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
|
|
||||||
analyzeAnswer(response, "assegnaLottoSuColloScarico", data -> {
|
|
||||||
onComplete.run();
|
|
||||||
}, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
var data = analyzeAnswer(response, "assegnaLottoSuColloScarico");
|
||||||
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, Throwable t) {
|
return data;
|
||||||
if (onFailed != null) onFailed.run(new Exception(t));
|
}
|
||||||
|
|
||||||
|
public void assegnaLottoSuColloScarico(MtbColt sourceMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var result = assegnaLottoSuColloScaricoSynchronized(sourceMtbColt);
|
||||||
|
if (onComplete != null) onComplete.run();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -604,8 +692,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.setMtbPartitaMag(null);
|
.setMtbPartitaMag(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService.versamentoAutomaticoUL(sourceMtbColtClone).enqueue(new Callback<>() {
|
colliMagazzinoRESTConsumerService.versamentoAutomaticoUL(sourceMtbColtClone).enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Response<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Response<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> response) {
|
||||||
analyzeAnswer(response, "versamentoAutomaticoUL", data -> {
|
analyzeAnswer(response, "versamentoAutomaticoUL", data -> {
|
||||||
@@ -642,8 +730,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, @NonNull final Exception e) {
|
||||||
if (onFailed != null) onFailed.run(new Exception(t));
|
if (onFailed != null) onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -652,8 +740,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
|
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
|
||||||
sourceMtbColtClone.setMtbColr(new ObservableArrayList<>());
|
sourceMtbColtClone.setMtbColr(new ObservableArrayList<>());
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService.confirmGiacenzaUL(sourceMtbColtClone).enqueue(new Callback<>() {
|
colliMagazzinoRESTConsumerService.confirmGiacenzaUL(sourceMtbColtClone).enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||||
analyzeAnswer(response, "confirmGiacenzaUL", data -> {
|
analyzeAnswer(response, "confirmGiacenzaUL", data -> {
|
||||||
@@ -663,8 +751,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
|
||||||
if (onFailed != null) onFailed.run(new Exception(t));
|
if (onFailed != null) onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -696,42 +784,48 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void canULBeDeleted(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
public Boolean canULBeDeletedSynchronized(MtbColt mtbColt) throws Exception {
|
||||||
CanULBeDeletedRequestDTO canULBeDeletedRequestDTO = new CanULBeDeletedRequestDTO()
|
CanULBeDeletedRequestDTO canULBeDeletedRequestDTO = new CanULBeDeletedRequestDTO()
|
||||||
.setMtbColt(mtbColt);
|
.setMtbColt(mtbColt);
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
|
|
||||||
colliMagazzinoRESTConsumerService.canULBeDeleted(canULBeDeletedRequestDTO)
|
var response = colliMagazzinoRESTConsumerService.canULBeDeleted(canULBeDeletedRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
|
|
||||||
analyzeAnswer(response, "generic/canULBeDeleted", onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
var data = analyzeAnswer(response, "generic/canULBeDeleted");
|
||||||
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
|
return data;
|
||||||
onFailed.run(new Exception(t));
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
public void canULBeDeleted(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var result = canULBeDeletedSynchronized(mtbColt);
|
||||||
|
if (onComplete != null) onComplete.run(result);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteULSynchronized(DeleteULRequestDTO deleteULRequestDTO) throws Exception {
|
||||||
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
|
|
||||||
|
var response = colliMagazzinoRESTConsumerService.deleteUL(deleteULRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
analyzeAnswer(response, "generic/deleteUL");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteUL(DeleteULRequestDTO deleteULRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void deleteUL(DeleteULRequestDTO deleteULRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliMagazzinoRESTConsumerService.deleteUL(deleteULRequestDTO)
|
deleteULSynchronized(deleteULRequestDTO);
|
||||||
.enqueue(new Callback<>() {
|
if (onComplete != null) onComplete.run();
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "generic/deleteUL", Void -> onComplete.run(), onFailed);
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -741,18 +835,18 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
|
|
||||||
colliMagazzinoRESTConsumerService.printUL(printULRequestDTO)
|
colliMagazzinoRESTConsumerService.printUL(printULRequestDTO)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||||
analyzeAnswer(response, "generic/printUL", Void -> onComplete.run(), onFailed);
|
analyzeAnswer(response, "generic/printUL", Void -> onComplete.run(), onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.UpdatePosizioneULRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
|
||||||
@@ -36,11 +38,14 @@ public interface ColliMagazzinoRESTConsumerService {
|
|||||||
@POST("wms/updateTipoUL")
|
@POST("wms/updateTipoUL")
|
||||||
Call<ServiceRESTResponse<Void>> updateTipoUL(@Body UpdateTipoULRequestDTO requestDto);
|
Call<ServiceRESTResponse<Void>> updateTipoUL(@Body UpdateTipoULRequestDTO requestDto);
|
||||||
|
|
||||||
|
@POST("wms/updatePosizioneUL")
|
||||||
|
Call<ServiceRESTResponse<Void>> updatePosizioneUL(@Body UpdatePosizioneULRequestDTO requestDto);
|
||||||
|
|
||||||
@POST("wms/spostaUL")
|
@POST("wms/spostaUL")
|
||||||
Call<ServiceRESTResponse<Void>> spostaUL(@Body SpostaULRequestDTO requestDto);
|
Call<ServiceRESTResponse<Void>> spostaUL(@Body SpostaULRequestDTO requestDto);
|
||||||
|
|
||||||
@POST("wms/spostaArtsTraUL")
|
@POST("wms/spostaArtsTraUL")
|
||||||
Call<ServiceRESTResponse<Void>> spostaArtsTraUL(@Body SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO);
|
Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> spostaArtsTraUL(@Body SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO);
|
||||||
|
|
||||||
@POST("wms/assegnaLottoSuColloScarico")
|
@POST("wms/assegnaLottoSuColloScarico")
|
||||||
Call<ServiceRESTResponse<MtbColt>> assegnaLottoSuColloScarico(@Body MtbColt mtbColt);
|
Call<ServiceRESTResponse<MtbColt>> assegnaLottoSuColloScarico(@Body MtbColt mtbColt);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -13,125 +13,148 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface {
|
public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface {
|
||||||
|
|
||||||
|
private final RESTBuilder restBuilder;
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
|
public ColliSpedizioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
|
this.restBuilder = restBuilder;
|
||||||
|
this.executorService = executorService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||||
|
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||||
|
|
||||||
|
var response = colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "spedizione/createUDS");
|
||||||
|
return data.getMtbColt();
|
||||||
|
}
|
||||||
|
|
||||||
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var response = createUDSSynchronized(createUDSRequestDTO);
|
||||||
|
if (onComplete != null) onComplete.run(response);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
public CloseUDSResponseDTO closeUDSSynchronized(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception {
|
||||||
.enqueue(new Callback<>() {
|
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
|
|
||||||
analyzeAnswer(response, "spedizione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
var response = colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
||||||
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Throwable t) {
|
.execute();
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "spedizione/closeUDS");
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var response = closeUDSSynchronized(closeUDSRequestDTO);
|
||||||
|
if (onComplete != null) onComplete.run(response);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
public MtbColr insertUDSRowSynchronized(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
|
||||||
.enqueue(new Callback<>() {
|
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
|
|
||||||
analyzeAnswer(response, "spedizione/closeUDS", onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response = colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
||||||
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Throwable t) {
|
.execute();
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "spedizione/insertUDSRow");
|
||||||
|
return data.getSavedMtbColr();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var response = insertUDSRowSynchronized(insertUDSRowRequestDTO);
|
||||||
|
if (onComplete != null) onComplete.run(response);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
public MtbColr editUDSRowSynchronized(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception {
|
||||||
.enqueue(new Callback<>() {
|
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
|
|
||||||
analyzeAnswer(response, "spedizione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
var response = colliSpedizioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
||||||
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Throwable t) {
|
.execute();
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
var data = analyzeAnswer(response, "spedizione/editUDSRow");
|
||||||
});
|
return data.getSavedMtbColr();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var response = editUDSRowSynchronized(editUDSRowRequestDTO);
|
||||||
|
if (onComplete != null) onComplete.run(response);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
colliSpedizioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
public void deleteUDSRowSynchronized(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO) throws Exception {
|
||||||
.enqueue(new Callback<>() {
|
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) {
|
|
||||||
analyzeAnswer(response, "spedizione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
var response = colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
||||||
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Throwable t) {
|
.execute();
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
analyzeAnswer(response, "spedizione/deleteUDSRow");
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
deleteUDSRowSynchronized(deleteUDSRowRequestDTO);
|
||||||
|
if (onComplete != null) onComplete.run();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
public DuplicateUDSResponseDTO duplicateUDSSynchronized(DuplicateUDSRequestDTO duplicateUDSRequestDTO) throws Exception {
|
||||||
.enqueue(new Callback<>() {
|
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
|
||||||
analyzeAnswer(response, "spedizione/deleteUDSRow", data -> onComplete.run(), onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
var response = colliSpedizioneRESTConsumerService.duplicateUDS(duplicateUDSRequestDTO)
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
.execute();
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
var data = analyzeAnswer(response, "spedizione/duplicateUDS");
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void duplicateUDS(DuplicateUDSRequestDTO duplicateUDSRequestDTO, RunnableArgs<DuplicateUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void duplicateUDS(DuplicateUDSRequestDTO duplicateUDSRequestDTO, RunnableArgs<DuplicateUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
colliSpedizioneRESTConsumerService.duplicateUDS(duplicateUDSRequestDTO)
|
var data = duplicateUDSSynchronized(duplicateUDSRequestDTO);
|
||||||
.enqueue(new Callback<>() {
|
if (onComplete != null) onComplete.run(data);
|
||||||
@Override
|
} catch (Exception ex) {
|
||||||
public void onResponse(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull Response<ServiceRESTResponse<DuplicateUDSResponseDTO>> response) {
|
if (onFailed != null) onFailed.run(ex);
|
||||||
analyzeAnswer(response, "spedizione/duplicateUDS", onComplete, onFailed);
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull Throwable t) {
|
|
||||||
onFailed.run(new Exception());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -18,34 +19,42 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class CommessaRESTConsumer extends _BaseRESTConsumer {
|
public class CommessaRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
private final ExecutorService executorService;
|
||||||
private final SystemRESTConsumer systemRESTConsumer;
|
private final SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
public CommessaRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
public CommessaRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||||
|
this.executorService = executorService;
|
||||||
this.systemRESTConsumer = systemRESTConsumer;
|
this.systemRESTConsumer = systemRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getJtbComts(List<String> itemsToFind, RunnableArgs<List<JtbComt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<JtbComt> getJtbComtsSynchronized(List<String> itemsToFind) throws Exception {
|
||||||
var whereCondMap = Stream.of(itemsToFind)
|
List<HashMap<String, Object>> whereCondMap = itemsToFind.stream()
|
||||||
.withoutNulls()
|
|
||||||
.filter(x -> !UtilityString.isNullOrEmpty(x))
|
.filter(x -> !UtilityString.isNullOrEmpty(x))
|
||||||
.map(x -> {
|
.map(x -> new HashMap<String, Object>() {{
|
||||||
HashMap<String, Object> vars = new HashMap<>();
|
put("cod_jcom", x);
|
||||||
vars.put("cod_jcom", x);
|
}})
|
||||||
return vars;
|
.collect(Collectors.toUnmodifiableList());
|
||||||
})
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
if(whereCondMap.isEmpty()) {
|
if(whereCondMap.isEmpty()) {
|
||||||
onComplete.run(new ArrayList<>());
|
return new ArrayList<>();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var whereCond = " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap);
|
var whereCond = " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap);
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<JtbComt>>() {}.getType();
|
Type typeOfObjectsList = new TypeToken<ArrayList<JtbComt>>() {}.getType();
|
||||||
this.systemRESTConsumer.processSql("SELECT * FROM jtb_comt " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM jtb_comt " + whereCond, typeOfObjectsList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getJtbComts(List<String> itemsToFind, RunnableArgs<List<JtbComt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var data = getJtbComtsSynchronized(itemsToFind);
|
||||||
|
if (onComplete != null) onComplete.run(data);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,26 +5,26 @@ import com.google.gson.reflect.TypeToken;
|
|||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class DepositoRESTConsumer extends _BaseRESTConsumer {
|
public class DepositoRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
private final EntityRESTConsumer entityRESTConsumer;
|
private final ExecutorService executorService;
|
||||||
private final SystemRESTConsumer systemRESTConsumer;
|
private final SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
public DepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer, SystemRESTConsumer systemRESTConsumer) {
|
public DepositoRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||||
this.entityRESTConsumer = entityRESTConsumer;
|
this.executorService = executorService;
|
||||||
this.systemRESTConsumer = systemRESTConsumer;
|
this.systemRESTConsumer = systemRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getAll(RunnableArgs<List<MtbDepo>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MtbDepo> getAllSynchronized() throws Exception {
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbDepo>>() {
|
Type typeOfObjectsList = new TypeToken<ArrayList<MtbDepo>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
this.systemRESTConsumer.processSql("SELECT * FROM mtb_depo", typeOfObjectsList, onComplete, onFailed);
|
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM mtb_depo", typeOfObjectsList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,83 +2,95 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.DtbDoct;
|
import it.integry.integrywmsnative.core.model.DtbDoct;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
|
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||||
import it.integry.integrywmsnative.core.rest.model.LoadColliDTO;
|
import it.integry.integrywmsnative.core.rest.model.LoadColliDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.documento.RetrieveDocumentoArtsResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.documento.RetrieveDocumentoArtsResponseDTO;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class DocumentRESTConsumer extends _BaseRESTConsumer {
|
public class DocumentRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
private final RESTBuilder restBuilder;
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
|
public DocumentRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
|
this.restBuilder = restBuilder;
|
||||||
|
this.executorService = executorService;
|
||||||
|
}
|
||||||
|
|
||||||
public void createDocsFromColli(List<LoadColliDTO> listColli, RunnableArgs<List<DtbDoct>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createDocsFromColli(List<LoadColliDTO> listColli, RunnableArgs<List<DtbDoct>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
DocumentiRESTConsumerService documentiRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
|
DocumentiRESTConsumerService documentiRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
|
||||||
documentiRESTConsumerService.createDocsFromColli(listColli).enqueue(new Callback<>() {
|
documentiRESTConsumerService.createDocsFromColli(listColli).enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<DtbDoct>>> call, Response<ServiceRESTResponse<List<DtbDoct>>> response) {
|
public void onResponse(Call<ServiceRESTResponse<List<DtbDoct>>> call, Response<ServiceRESTResponse<List<DtbDoct>>> response) {
|
||||||
analyzeAnswer(response, "createDocsFromColli", onComplete, onFailed);
|
analyzeAnswer(response, "createDocsFromColli", onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<DtbDoct>>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<List<DtbDoct>>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createDocFromColli(LoadColliDTO loadColliDTO, RunnableArgs<DtbDoct> onComplete, RunnableArgs<Exception> onFailed) {
|
public DtbDoct makeSynchronousCreateDocFromColliRequest(LoadColliDTO loadColliDTO) throws Exception {
|
||||||
DocumentiRESTConsumerService documentiRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
|
DocumentiRESTConsumerService documentiRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
|
||||||
documentiRESTConsumerService.createDocFromColli(loadColliDTO).enqueue(new Callback<>() {
|
var response = documentiRESTConsumerService
|
||||||
@Override
|
.createDocFromColli(loadColliDTO)
|
||||||
public void onResponse(Call<ServiceRESTResponse<DtbDoct>> call, Response<ServiceRESTResponse<DtbDoct>> response) {
|
.execute();
|
||||||
analyzeAnswer(response, "createDocFromColli", onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
return analyzeAnswer(response, "createDocFromColli");
|
||||||
public void onFailure(Call<ServiceRESTResponse<DtbDoct>> call, Throwable t) {
|
}
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
|
public void makeCreateDocFromColliRequest(LoadColliDTO loadColliDTO, RunnableArgs<DtbDoct> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var result = makeSynchronousCreateDocFromColliRequest(loadColliDTO);
|
||||||
|
if (onComplete != null) onComplete.run(result);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkDocument(String fornitore, String numDoc, String dataDoc, String tipoDoc, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
public void checkDocument(String fornitore, String numDoc, String dataDoc, String tipoDoc, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
var inventarioRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
|
var inventarioRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
|
||||||
inventarioRESTConsumerService.checkDocument(fornitore, numDoc,tipoDoc, dataDoc)
|
inventarioRESTConsumerService.checkDocument(fornitore, numDoc,tipoDoc, dataDoc)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(@NonNull Call<ServiceRESTResponse<Boolean>> call, @NonNull Response<ServiceRESTResponse<Boolean>> response) {
|
public void onResponse(@NonNull Call<ServiceRESTResponse<Boolean>> call, @NonNull Response<ServiceRESTResponse<Boolean>> response) {
|
||||||
analyzeAnswer(response, "checkDocument", onComplete, onFailed);
|
analyzeAnswer(response, "checkDocument", onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<ServiceRESTResponse<Boolean>> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<ServiceRESTResponse<Boolean>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadDocumentAvailableArts(String codDtip, String codMgrp, String codAnagForn, RunnableArgs<RetrieveDocumentoArtsResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void loadDocumentAvailableArts(String codDtip, String codMgrp, String codAnagForn, RunnableArgs<RetrieveDocumentoArtsResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
var inventarioRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
|
var inventarioRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
|
||||||
inventarioRESTConsumerService.retrieveArts(codDtip, codMgrp, codAnagForn)
|
inventarioRESTConsumerService.retrieveArts(codDtip, codMgrp, codAnagForn)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> response) {
|
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> response) {
|
||||||
analyzeAnswer(response, "loadDocumentoArts", onComplete, onFailed);
|
analyzeAnswer(response, "loadDocumentoArts", onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.model.DtbDoct;
|
import it.integry.integrywmsnative.core.model.DtbDoct;
|
||||||
|
|||||||
@@ -2,119 +2,118 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.EntityBase;
|
import it.integry.integrywmsnative.core.model.EntityBase;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
|
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||||
import it.integry.integrywmsnative.core.rest.model.EsitoType;
|
import it.integry.integrywmsnative.core.rest.model.EsitoType;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityGson;
|
import it.integry.integrywmsnative.core.utility.UtilityGson;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class EntityRESTConsumer extends _BaseRESTConsumer {
|
public class EntityRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
private final RESTBuilder restBuilder;
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
|
public EntityRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
|
this.restBuilder = restBuilder;
|
||||||
|
this.executorService = executorService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends EntityBase> T processEntitySynchronized(T entityToSave, Class<T> type) throws Exception {
|
||||||
|
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
|
||||||
|
var response = service
|
||||||
|
.processEntity(entityToSave)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
if (response.body() != null) {
|
||||||
|
if (response.body().getEsito() == EsitoType.OK) {
|
||||||
|
Gson gson = UtilityGson.createObject();
|
||||||
|
|
||||||
|
return gson.fromJson(response.body().getEntity(), type);
|
||||||
|
} else {
|
||||||
|
Log.e("EntityRESTConsumer", response.body().getErrorMessage());
|
||||||
|
throw new Exception(response.body().getErrorMessage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.e("EntityRESTConsumer", response.message());
|
||||||
|
throw new Exception(response.message());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
||||||
|
throw new Exception("Status " + response.code() + ": " + response.message());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) {
|
public <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var data = processEntitySynchronized(entityToSave, type);
|
||||||
|
if (callback != null) callback.onSuccess(data);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (callback != null) callback.onFailed(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
RunnableArgs<Exception> tmpFailed = ex -> {
|
}
|
||||||
if (callback != null) callback.onFailed(ex);
|
|
||||||
};
|
|
||||||
|
|
||||||
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
public <T extends EntityBase> List<T> processEntityListSynchronized(List<T> entitiesToSave, boolean singleTransaction, Class<T> type) throws Exception {
|
||||||
service
|
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
|
||||||
.processEntity(entityToSave)
|
var response = service.processEntityList(singleTransaction, entitiesToSave)
|
||||||
.enqueue(new Callback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
|
||||||
if (response.isSuccessful()) {
|
|
||||||
|
|
||||||
if (response.body() != null) {
|
if (response.isSuccessful()) {
|
||||||
if (response.body().getEsito() == EsitoType.OK) {
|
|
||||||
Gson gson = UtilityGson.createObject();
|
|
||||||
T object = gson.fromJson(response.body().getEntity(), type);
|
|
||||||
|
|
||||||
callback.onSuccess(object);
|
if (response.body() != null) {
|
||||||
} else {
|
|
||||||
Log.e("EntityRESTConsumer", response.body().getErrorMessage());
|
ArrayList<T> responseList = new ArrayList<>();
|
||||||
tmpFailed.run(new Exception(response.body().getErrorMessage()));
|
Gson gson = UtilityGson.createObject();
|
||||||
}
|
|
||||||
} else {
|
for (ServiceRESTResponse<JsonObject> jsonSingleObject : response.body()) {
|
||||||
Log.e("EntityRESTConsumer", response.message());
|
|
||||||
tmpFailed.run(new Exception(response.message()));
|
if (jsonSingleObject.getEsito() == EsitoType.OK) {
|
||||||
}
|
String jsonText = gson.toJson(jsonSingleObject.getEntity());
|
||||||
} else {
|
responseList.add(gson.fromJson(jsonText, type));
|
||||||
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
} else {
|
||||||
tmpFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
Log.e("EntityRESTConsumer", jsonSingleObject.getErrorMessage());
|
||||||
}
|
throw new Exception(jsonSingleObject.getErrorMessage());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
return responseList;
|
||||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
} else {
|
||||||
Log.e("EntityRESTConsumer", t.toString());
|
Log.e("EntityRESTConsumer", response.message());
|
||||||
tmpFailed.run(new Exception(t));
|
throw new Exception(response.message());
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
|
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
||||||
|
throw new Exception("Status " + response.code() + ": " + response.message());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends EntityBase> void processEntityList(List<T> entitiesToSave, boolean singleTransaction, Class<T> type, final RunnableArgs<List<T>> onComplete, final RunnableArgs<Exception> onFailed) {
|
public <T extends EntityBase> void processEntityList(List<T> entitiesToSave, boolean singleTransaction, Class<T> type, final RunnableArgs<List<T>> onComplete, final RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
RunnableArgs<Exception> tmpFailed = ex -> {
|
try {
|
||||||
// UtilityExceptions.defaultException(null, ex);
|
var data = processEntityListSynchronized(entitiesToSave, singleTransaction, type);
|
||||||
if (onFailed != null) onFailed.run(ex);
|
if (onComplete != null) onComplete.run(data);
|
||||||
};
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
|
||||||
Call<List<ServiceRESTResponse<JsonObject>>> request = service.processEntityList(singleTransaction, entitiesToSave);
|
|
||||||
request.enqueue(new Callback<>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(Call<List<ServiceRESTResponse<JsonObject>>> call, Response<List<ServiceRESTResponse<JsonObject>>> response) {
|
|
||||||
if (response.isSuccessful()) {
|
|
||||||
|
|
||||||
if (response.body() != null) {
|
|
||||||
|
|
||||||
ArrayList<T> responseList = new ArrayList<>();
|
|
||||||
Gson gson = UtilityGson.createObject();
|
|
||||||
// Type typeOfObjectsList = new TypeToken<T>() {}.getType();
|
|
||||||
|
|
||||||
for (ServiceRESTResponse<JsonObject> jsonSingleObject : response.body()) {
|
|
||||||
|
|
||||||
if (jsonSingleObject.getEsito() == EsitoType.OK) {
|
|
||||||
String jsonText = gson.toJson(jsonSingleObject.getEntity());
|
|
||||||
responseList.add(gson.fromJson(jsonText, type));
|
|
||||||
} else {
|
|
||||||
Log.e("EntityRESTConsumer", jsonSingleObject.getErrorMessage());
|
|
||||||
tmpFailed.run(new Exception(jsonSingleObject.getErrorMessage()));
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onComplete.run(responseList);
|
|
||||||
} else {
|
|
||||||
Log.e("EntityRESTConsumer", response.message());
|
|
||||||
tmpFailed.run(new Exception(response.message()));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
|
||||||
tmpFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<List<ServiceRESTResponse<JsonObject>>> call, Throwable t) {
|
|
||||||
Log.e("EntityRESTConsumer", t.toString());
|
|
||||||
tmpFailed.run(new Exception(t));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -124,9 +123,9 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public <T extends EntityBase> void selectEntity(T entityToSave, final ISimpleOperationCallback<List<T>> callback, Class type) {
|
public <T extends EntityBase> void selectEntity(T entityToSave, final ISimpleOperationCallback<List<T>> callback, Class type) {
|
||||||
|
|
||||||
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
|
||||||
Call<ServiceRESTResponse<JsonObject>> request = service.processEntity(entityToSave);
|
Call<ServiceRESTResponse<JsonObject>> request = service.processEntity(entityToSave);
|
||||||
request.enqueue(new Callback<>() {
|
request.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
@@ -136,7 +135,7 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
|
|||||||
Gson gson = UtilityGson.createObject();
|
Gson gson = UtilityGson.createObject();
|
||||||
List<JsonObject> jsons = response.body().getEntityList();
|
List<JsonObject> jsons = response.body().getEntityList();
|
||||||
|
|
||||||
List<T> newList = new ArrayList<T>();
|
List<T> newList = new ArrayList<>();
|
||||||
|
|
||||||
if (jsons != null) {
|
if (jsons != null) {
|
||||||
for (int i = 0; i < jsons.size(); i++) {
|
for (int i = 0; i < jsons.size(); i++) {
|
||||||
@@ -163,9 +162,8 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, @NonNull final Exception e) {
|
||||||
Log.e("EntityRESTConsumer", t.toString());
|
callback.onFailed(e);
|
||||||
callback.onFailed(new Exception(t));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
import android.util.Log;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -10,32 +10,35 @@ import javax.inject.Singleton;
|
|||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.StbGestSetup;
|
import it.integry.integrywmsnative.core.model.StbGestSetup;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
|
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||||
import it.integry.integrywmsnative.core.rest.model.GestSetupDTO;
|
import it.integry.integrywmsnative.core.rest.model.GestSetupDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.settings.StbGestSetupReader;
|
import it.integry.integrywmsnative.core.settings.StbGestSetupReader;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
private final RESTBuilder restBuilder;
|
||||||
|
|
||||||
|
public GestSetupRESTConsumer(RESTBuilder restBuilder) {
|
||||||
|
this.restBuilder = restBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
public void getValue(String gestName, String sectionName, String keySection, RunnableArgs<GestSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getValue(String gestName, String sectionName, String keySection, RunnableArgs<GestSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
|
GestSetupRESTConsumerService service = restBuilder.getService(GestSetupRESTConsumerService.class);
|
||||||
|
|
||||||
service.getGestSetupValue(gestName, sectionName, keySection)
|
service.getGestSetupValue(gestName, sectionName, keySection)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<GestSetupDTO>> call, Response<ServiceRESTResponse<GestSetupDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<GestSetupDTO>> call, Response<ServiceRESTResponse<GestSetupDTO>> response) {
|
||||||
analyzeAnswer(response, "GestSetup", onComplete, onFailed);
|
analyzeAnswer(response, "GestSetup", onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, @NonNull final Exception e) {
|
||||||
Log.e("GestSetup", t.toString());
|
if (onFailed != null) onFailed.run(e);
|
||||||
// UtilityLogger.errorMe(new Exception(t));
|
|
||||||
if (onFailed != null) onFailed.run(new Exception(t));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -51,18 +54,16 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void getValue(String gestName, String sectionName, String keySection, String codMdep, RunnableArgs<GestSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getValue(String gestName, String sectionName, String keySection, String codMdep, RunnableArgs<GestSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
|
GestSetupRESTConsumerService service = restBuilder.getService(GestSetupRESTConsumerService.class);
|
||||||
service.getGestSetupValue(gestName, sectionName, keySection, codMdep).enqueue(new Callback<ServiceRESTResponse<GestSetupDTO>>() {
|
service.getGestSetupValue(gestName, sectionName, keySection, codMdep).enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<GestSetupDTO>> call, Response<ServiceRESTResponse<GestSetupDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<GestSetupDTO>> call, Response<ServiceRESTResponse<GestSetupDTO>> response) {
|
||||||
analyzeAnswer(response, "GestSetup", onComplete, onFailed);
|
analyzeAnswer(response, "GestSetup", onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, @NonNull final Exception e) {
|
||||||
Log.e("PrintCollo", t.toString());
|
if (onFailed != null) onFailed.run(e);
|
||||||
UtilityLogger.error(new Exception(t));
|
|
||||||
if (onFailed != null) onFailed.run(new Exception(t));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -78,33 +79,22 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getValues(String codMdep, List<StbGestSetupReader> stbGestSetupList, RunnableArgs<List<StbGestSetupReader>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<StbGestSetupReader> getValuesSynchronized(String codMdep, List<StbGestSetupReader> stbGestSetupList) throws Exception {
|
||||||
var stbGestSetups = stbGestSetupList.stream().map(x -> (StbGestSetup) x).collect(Collectors.toList());
|
var stbGestSetups = stbGestSetupList.stream().map(x -> (StbGestSetup) x).collect(Collectors.toList());
|
||||||
|
|
||||||
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
|
GestSetupRESTConsumerService service = restBuilder.getService(GestSetupRESTConsumerService.class);
|
||||||
service.getGestSetupValues(codMdep, stbGestSetups).enqueue(new Callback<>() {
|
var response = service.getGestSetupValues(codMdep, stbGestSetups)
|
||||||
@Override
|
.execute();
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Response<ServiceRESTResponse<List<StbGestSetup>>> response) {
|
var data = analyzeAnswer(response, "GestSetup");
|
||||||
analyzeAnswer(response, "GestSetup", data -> {
|
for (StbGestSetup stbGestSetup : data) {
|
||||||
|
stbGestSetupList.stream().filter(x -> stbGestSetup.getGestName().equalsIgnoreCase(x.getGestName()) &&
|
||||||
|
stbGestSetup.getSection().equalsIgnoreCase(x.getSection()) &&
|
||||||
|
stbGestSetup.getKeySection().equalsIgnoreCase(x.getKeySection()))
|
||||||
|
.findFirst()
|
||||||
|
.ifPresent(x -> x.setValue(stbGestSetup.getValue()));
|
||||||
|
}
|
||||||
|
|
||||||
for (StbGestSetup stbGestSetup : data) {
|
return stbGestSetupList;
|
||||||
stbGestSetupList.stream().filter(x -> stbGestSetup.getGestName().equalsIgnoreCase(x.getGestName()) &&
|
|
||||||
stbGestSetup.getSection().equalsIgnoreCase(x.getSection()) &&
|
|
||||||
stbGestSetup.getKeySection().equalsIgnoreCase(x.getKeySection()))
|
|
||||||
.findFirst()
|
|
||||||
.ifPresent(x -> x.setValue(stbGestSetup.getValue()));
|
|
||||||
}
|
|
||||||
|
|
||||||
onComplete.run(stbGestSetupList);
|
|
||||||
}, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Throwable t) {
|
|
||||||
UtilityLogger.error(new Exception(t));
|
|
||||||
if (onFailed != null) onFailed.run(new Exception(t));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.CloseVerificaRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.DeleteRowVerificaRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewRowVerificaRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
|
||||||
|
|
||||||
|
public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
private final RESTBuilder restBuilder;
|
||||||
|
|
||||||
|
public GiacenzaPvRESTConsumer(RESTBuilder restBuilder) {
|
||||||
|
this.restBuilder = restBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GiacenzaPvDTO> retrieveGiacenzeSynchronized(String codMdep, String codMart) throws Exception {
|
||||||
|
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 120);
|
||||||
|
var response = giacenzaPvRESTConsumerService.retrieve(codMdep, codMart).execute();
|
||||||
|
|
||||||
|
var giacenzeList = analyzeAnswer(response, "retrieve-giacenze-pv");
|
||||||
|
return giacenzeList != null ? giacenzeList : new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveNewRowSynchronized(SaveNewRowVerificaRequestDTO saveNewRowVerificaRequest) throws Exception {
|
||||||
|
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
|
||||||
|
var response = giacenzaPvRESTConsumerService.saveNewRowVerifica(saveNewRowVerificaRequest)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
analyzeAnswer(response, "save-row-verifica-pv");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateRowSynchronized(UpdateRowVerificaRequestDTO updateRowVerificaRequest) throws Exception {
|
||||||
|
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
|
||||||
|
var response = giacenzaPvRESTConsumerService.updateRowVerifica(updateRowVerificaRequest)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
analyzeAnswer(response, "update-row-verifica-pv");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteRowSynchronized(DeleteRowVerificaRequestDTO deleteRowVerificaRequest) throws Exception {
|
||||||
|
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
|
||||||
|
var response = giacenzaPvRESTConsumerService.deleteRowVerifica(deleteRowVerificaRequest)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
analyzeAnswer(response, "delete-row-verifica-pv");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void closeVerifica(CloseVerificaRequestDTO closeVerificaRequestDTO) throws Exception {
|
||||||
|
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class, 0);
|
||||||
|
var response = giacenzaPvRESTConsumerService.closeVerifica(closeVerificaRequestDTO)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
analyzeAnswer(response, "close-verifica-pv");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.CloseVerificaRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.DeleteRowVerificaRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewRowVerificaRequestDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
|
public interface GiacenzaPvRESTConsumerService {
|
||||||
|
|
||||||
|
@GET("wms/pv/verifica_giacenze/retrieve")
|
||||||
|
Call<ServiceRESTResponse<List<GiacenzaPvDTO>>> retrieve(@Query("codMdep") String codMdep, @Query("codMart") String codMart);
|
||||||
|
|
||||||
|
@POST("wms/pv/verifica_giacenze/save_new_row")
|
||||||
|
Call<ServiceRESTResponse<Void>> saveNewRowVerifica(@Body SaveNewRowVerificaRequestDTO saveNewRowVerificaRequest);
|
||||||
|
|
||||||
|
@POST("wms/pv/verifica_giacenze/update_row")
|
||||||
|
Call<ServiceRESTResponse<Void>> updateRowVerifica(@Body UpdateRowVerificaRequestDTO updateRowVerificaRequest);
|
||||||
|
|
||||||
|
@POST("wms/pv/verifica_giacenze/delete_row")
|
||||||
|
Call<ServiceRESTResponse<Void>> deleteRowVerifica(@Body DeleteRowVerificaRequestDTO deleteRowVerificaRequest);
|
||||||
|
|
||||||
|
@POST("wms/pv/verifica_giacenze/close_verifica")
|
||||||
|
Call<ServiceRESTResponse<Void>> closeVerifica(@Body CloseVerificaRequestDTO closeVerificaRequest);
|
||||||
|
}
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
package it.integry.integrywmsnative.core.rest.consumers;
|
package it.integry.integrywmsnative.core.rest.consumers;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.annimon.stream.Optional;
|
import com.annimon.stream.Optional;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -13,70 +17,75 @@ import it.integry.integrywmsnative.core.model.MtbAart;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||||
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
|
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationIncomingItemDto;
|
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationIncomingItemDto;
|
||||||
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationResponseDto;
|
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationResponseDto;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.dto.ArtsInGiacenzaDTO;
|
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.dto.ArtsInGiacenzaDTO;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
private final RESTBuilder restBuilder;
|
||||||
|
private final ExecutorService executorService;
|
||||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||||
|
|
||||||
public GiacenzaRESTConsumer(ArticoloRESTConsumer articoloRESTConsumer) {
|
public GiacenzaRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||||
|
this.restBuilder = restBuilder;
|
||||||
|
this.executorService = executorService;
|
||||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getGiacenzeInPosizione(MtbDepoPosizione posizione, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
|
public List<MvwSitArtUdcDetInventario> getGiacenzeInPosizioneSynchronized(MtbDepoPosizione posizione) throws Exception {
|
||||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
|
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||||
giacenzaRESTConsumerService.retrieveAvailableItems(posizione.getPosizione()).enqueue(new Callback<>() {
|
var response = giacenzaRESTConsumerService.retrieveAvailableItems(posizione.getPosizione())
|
||||||
@Override
|
.execute();
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Response<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> response) {
|
|
||||||
analyzeAnswer(response, "getGiacenzeInPosizione", inventarioList -> {
|
|
||||||
|
|
||||||
if(inventarioList != null && !inventarioList.isEmpty()){
|
var inventarioList = analyzeAnswer(response, "getGiacenzeInPosizione");
|
||||||
List<String> codMarts = Stream.of(inventarioList)
|
|
||||||
.map(x -> x.getCodMart().trim())
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
if (inventarioList != null && !inventarioList.isEmpty()) {
|
||||||
for (var row : inventarioList) {
|
List<String> codMarts = inventarioList.stream()
|
||||||
|
.map(x -> x.getCodMart().trim())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
MtbAart foundMtbAart = null;
|
var mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||||
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
|
for (var row : inventarioList) {
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(row.getCodMart()))
|
MtbAart foundMtbAart = null;
|
||||||
.findFirst();
|
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
|
||||||
|
.filter(x -> x.getCodMart().equalsIgnoreCase(row.getCodMart()))
|
||||||
|
.findFirst();
|
||||||
|
|
||||||
if (mtbAartOpt.isPresent()) {
|
if (mtbAartOpt.isPresent()) {
|
||||||
foundMtbAart = mtbAartOpt.get();
|
foundMtbAart = mtbAartOpt.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
row.setMtbAart(foundMtbAart);
|
row.setMtbAart(foundMtbAart);
|
||||||
}
|
|
||||||
|
|
||||||
onComplete.run(inventarioList);
|
|
||||||
}, onFailed);
|
|
||||||
}else{
|
|
||||||
onComplete.run(new ArrayList<>());
|
|
||||||
}
|
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
return inventarioList;
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Throwable t) {
|
}
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getGiacenzeInPosizione(MtbDepoPosizione posizione, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var result = getGiacenzeInPosizioneSynchronized(posizione);
|
||||||
|
if (onComplete != null) onComplete.run(result);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getGiacenzeInPosizione(List<String> posizioni, boolean withTestataCollo, RunnableArgs<List<ArtsInGiacenzaDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getGiacenzeInPosizione(List<String> posizioni, boolean withTestataCollo, RunnableArgs<List<ArtsInGiacenzaDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
|
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||||
giacenzaRESTConsumerService.retrieveAvailableItems(posizioni, withTestataCollo).enqueue(new Callback<>() {
|
giacenzaRESTConsumerService.retrieveAvailableItems(posizioni, withTestataCollo).enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> call, Response<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> response) {
|
public void onResponse(Call<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> call, Response<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> response) {
|
||||||
analyzeAnswer(response, "getGiacenzeInPosizione", inventarioList -> {
|
analyzeAnswer(response, "getGiacenzeInPosizione", inventarioList -> {
|
||||||
@@ -88,8 +97,8 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
|||||||
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||||
for (var articoli : inventarioList) {
|
for (var articoli : inventarioList) {
|
||||||
List<MvwSitArtUdcDetInventario> mvwSitArtUdcDetInventario = articoli.getMvwSitArtUdcDetInventarioDTO();
|
List<MvwSitArtUdcDetInventario> mvwSitArtUdcDetInventario = articoli.getMvwSitArtUdcDetInventarioDTO();
|
||||||
if (mvwSitArtUdcDetInventario != null && !mvwSitArtUdcDetInventario.isEmpty()){
|
if (mvwSitArtUdcDetInventario != null && !mvwSitArtUdcDetInventario.isEmpty()) {
|
||||||
for (var row : mvwSitArtUdcDetInventario){
|
for (var row : mvwSitArtUdcDetInventario) {
|
||||||
MtbAart foundMtbAart = null;
|
MtbAart foundMtbAart = null;
|
||||||
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
|
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(row.getCodMart()))
|
.filter(x -> x.getCodMart().equalsIgnoreCase(row.getCodMart()))
|
||||||
@@ -110,19 +119,19 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getGiacenzeByArticolo(String codMart, String partitaMag, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getGiacenzeByArticolo(String codMart, String partitaMag, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
|
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||||
var serviceRESTResponseCall =
|
var serviceRESTResponseCall =
|
||||||
UtilityString.isNullOrEmpty(partitaMag) ?
|
UtilityString.isNullOrEmpty(partitaMag) ?
|
||||||
giacenzaRESTConsumerService.retrieveAvailableItemsByArt(codMart) :
|
giacenzaRESTConsumerService.retrieveAvailableItemsByArt(codMart) :
|
||||||
giacenzaRESTConsumerService.retrieveAvailableItemsByArt(codMart, partitaMag);
|
giacenzaRESTConsumerService.retrieveAvailableItemsByArt(codMart, partitaMag);
|
||||||
serviceRESTResponseCall.enqueue(new Callback<>() {
|
serviceRESTResponseCall.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Response<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> response) {
|
public void onResponse(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Response<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> response) {
|
||||||
analyzeAnswer(response, "getGiacenzeByArticolo", inventarioList -> {
|
analyzeAnswer(response, "getGiacenzeByArticolo", inventarioList -> {
|
||||||
@@ -153,34 +162,35 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getInstantItemSituation(String codMdep, String codMart, String partitaMag, String codJcom, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
|
public InstantItemSituationResponseDto getInstantItemSituationSynchronized(String codMdep, String codMart, String partitaMag, String codJcom) throws Exception {
|
||||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
|
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||||
|
|
||||||
giacenzaRESTConsumerService.retrieveInstantItemSituation(codMdep, codMart, partitaMag, codJcom)
|
var response = giacenzaRESTConsumerService.retrieveInstantItemSituation(codMdep, codMart, partitaMag, codJcom)
|
||||||
.enqueue(new Callback<>() {
|
.execute();
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, Response<ServiceRESTResponse<InstantItemSituationResponseDto>> response) {
|
|
||||||
analyzeAnswer(response, "getInstantItemSituation", data -> {
|
|
||||||
|
|
||||||
fillInstantItemSituationWithMtbAarts(data, onComplete, onFailed);
|
var data = analyzeAnswer(response, "getInstantItemSituation");
|
||||||
}, onFailed);
|
return fillInstantItemSituationWithMtbAartsSynchronized(data);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, Throwable t) {
|
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillInstantItemSituationWithMtbAarts(InstantItemSituationResponseDto data, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getInstantItemSituation(String codMdep, String codMart, String partitaMag, String codJcom, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
executorService.execute(() -> {
|
||||||
|
try {
|
||||||
|
var response = getInstantItemSituationSynchronized(codMdep, codMart, partitaMag, codJcom);
|
||||||
|
if (onComplete != null) onComplete.run(response);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private InstantItemSituationResponseDto fillInstantItemSituationWithMtbAartsSynchronized(InstantItemSituationResponseDto data) throws Exception {
|
||||||
var inputCodMarts = new ArrayList<String>();
|
var inputCodMarts = new ArrayList<String>();
|
||||||
|
|
||||||
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
||||||
@@ -196,37 +206,33 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inputCodMarts.isEmpty()) {
|
if (inputCodMarts.isEmpty()) {
|
||||||
onComplete.run(data);
|
return null;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mArticoloRESTConsumer.getByCodMarts(inputCodMarts, mtbAarts -> {
|
var mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(inputCodMarts);
|
||||||
|
var newMtbAarts = mArticoloRESTConsumer.fillMtbAartsWithMtbUntMisSynchronized(mtbAarts);
|
||||||
|
|
||||||
mArticoloRESTConsumer.fillMtbAartsWithMtbUntMis(mtbAarts, newMtbAarts -> {
|
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
||||||
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
for (var item : data.getIncomingItems()) {
|
||||||
for (var item : data.getIncomingItems()) {
|
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
||||||
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
.findFirstOrElse(null);
|
||||||
.findFirstOrElse(null);
|
|
||||||
|
|
||||||
if (mtbAart != null)
|
if (mtbAart != null)
|
||||||
item.setMtbAart(mtbAart);
|
item.setMtbAart(mtbAart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.getAvailableItems() != null && !data.getAvailableItems().isEmpty()) {
|
if (data.getAvailableItems() != null && !data.getAvailableItems().isEmpty()) {
|
||||||
for (var item : data.getAvailableItems()) {
|
for (var item : data.getAvailableItems()) {
|
||||||
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
||||||
.findFirstOrElse(null);
|
.findFirstOrElse(null);
|
||||||
|
|
||||||
if (mtbAart != null)
|
if (mtbAart != null)
|
||||||
item.setMtbAart(mtbAart);
|
item.setMtbAart(mtbAart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onComplete.run(data);
|
return data;
|
||||||
}, onFailed);
|
|
||||||
|
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.model.DtbDoct;
|
|
||||||
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
||||||
import it.integry.integrywmsnative.core.rest.model.LoadColliDTO;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationResponseDto;
|
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationResponseDto;
|
||||||
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.dto.ArtsInGiacenzaDTO;
|
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.dto.ArtsInGiacenzaDTO;
|
||||||
|
|||||||
@@ -20,15 +20,17 @@ import retrofit2.Response;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class ImballiRESTConsumer extends _BaseRESTConsumer {
|
public class ImballiRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
private final RESTBuilder restBuilder;
|
||||||
private final ExecutorService executorService;
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
public ImballiRESTConsumer(ExecutorService executorService) {
|
public ImballiRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||||
|
this.restBuilder = restBuilder;
|
||||||
this.executorService = executorService;
|
this.executorService = executorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<ObservableMtbTcol> retrieveImballiSyncronized(MtbTCol.FlagUiUlEnum tipoImballo) throws Exception {
|
public List<ObservableMtbTcol> retrieveImballiSyncronized(MtbTCol.FlagUiUlEnum tipoImballo) throws Exception {
|
||||||
ImballiRESTConsumerService service = RESTBuilder.getService(ImballiRESTConsumerService.class);
|
ImballiRESTConsumerService service = restBuilder.getService(ImballiRESTConsumerService.class);
|
||||||
Response<ServiceRESTResponse<List<MtbTCol>>> response = service.retrieveImballi(tipoImballo)
|
Response<ServiceRESTResponse<List<MtbTCol>>> response = service.retrieveImballi(tipoImballo)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
@@ -50,7 +52,7 @@ public class ImballiRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
|
|
||||||
public void registraCaricoSyncronized(String codAnag, List<ImballoQuantityDTO> imballi) throws Exception {
|
public void registraCaricoSyncronized(String codAnag, List<ImballoQuantityDTO> imballi) throws Exception {
|
||||||
ImballiRESTConsumerService service = RESTBuilder.getService(ImballiRESTConsumerService.class);
|
ImballiRESTConsumerService service = restBuilder.getService(ImballiRESTConsumerService.class);
|
||||||
Response<ServiceRESTResponse<Void>> response = service.registraCarico(
|
Response<ServiceRESTResponse<Void>> response = service.registraCarico(
|
||||||
new RegistraCaricoImballiRequestDTO()
|
new RegistraCaricoImballiRequestDTO()
|
||||||
.setCodAnag(codAnag)
|
.setCodAnag(codAnag)
|
||||||
@@ -73,7 +75,7 @@ public class ImballiRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
|
|
||||||
public void registraScaricoSyncronized(String codVettore, List<ImballoQuantityDTO> imballi) throws Exception {
|
public void registraScaricoSyncronized(String codVettore, List<ImballoQuantityDTO> imballi) throws Exception {
|
||||||
ImballiRESTConsumerService service = RESTBuilder.getService(ImballiRESTConsumerService.class);
|
ImballiRESTConsumerService service = restBuilder.getService(ImballiRESTConsumerService.class);
|
||||||
Response<ServiceRESTResponse<Void>> response = service.registraScarico(
|
Response<ServiceRESTResponse<Void>> response = service.registraScarico(
|
||||||
new RegistraScaricoImballiRequestDTO()
|
new RegistraScaricoImballiRequestDTO()
|
||||||
.setCodVettore(codVettore)
|
.setCodVettore(codVettore)
|
||||||
|
|||||||
@@ -4,58 +4,65 @@ import androidx.annotation.NonNull;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.MtbInvent;
|
import it.integry.integrywmsnative.core.model.MtbInvent;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
|
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.rest.model.inventario.InsertInventarioRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.inventario.InsertInventarioRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.inventario.RetrieveInventarioArtsResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.inventario.RetrieveInventarioArtsResponseDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.inventario.RetrieveInventarioResponseDTO;
|
import it.integry.integrywmsnative.core.rest.model.inventario.RetrieveInventarioResponseDTO;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class InventarioRESTConsumer extends _BaseRESTConsumer {
|
public class InventarioRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
private final RESTBuilder restBuilder;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public InventarioRESTConsumer(RESTBuilder restBuilder) {
|
||||||
|
this.restBuilder = restBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
public void loadInventario(long inventoryId, RunnableArgs<RetrieveInventarioResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void loadInventario(long inventoryId, RunnableArgs<RetrieveInventarioResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
var inventarioRESTConsumerService = RESTBuilder.getService(InventarioRESTConsumerService.class);
|
var inventarioRESTConsumerService = restBuilder.getService(InventarioRESTConsumerService.class);
|
||||||
inventarioRESTConsumerService.retrieve(inventoryId)
|
inventarioRESTConsumerService.retrieve(inventoryId)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveInventarioResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveInventarioResponseDTO>> response) {
|
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveInventarioResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveInventarioResponseDTO>> response) {
|
||||||
analyzeAnswer(response, "loadInventario", onComplete, onFailed);
|
analyzeAnswer(response, "loadInventario", onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveInventarioResponseDTO>> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveInventarioResponseDTO>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void loadInventarioArts(long inventoryId, RunnableArgs<RetrieveInventarioArtsResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void loadInventarioArts(long inventoryId, RunnableArgs<RetrieveInventarioArtsResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
var inventarioRESTConsumerService = RESTBuilder.getService(InventarioRESTConsumerService.class);
|
var inventarioRESTConsumerService = restBuilder.getService(InventarioRESTConsumerService.class);
|
||||||
inventarioRESTConsumerService.retrieveArts(inventoryId)
|
inventarioRESTConsumerService.retrieveArts(inventoryId)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveInventarioArtsResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveInventarioArtsResponseDTO>> response) {
|
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveInventarioArtsResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveInventarioArtsResponseDTO>> response) {
|
||||||
analyzeAnswer(response, "loadInventarioArts", onComplete, onFailed);
|
analyzeAnswer(response, "loadInventarioArts", onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveInventarioArtsResponseDTO>> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveInventarioArtsResponseDTO>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MtbInvent> makeSynchronousRetrieveRequest() throws Exception {
|
public List<MtbInvent> makeSynchronousRetrieveRequest() throws Exception {
|
||||||
var inventarioRESTConsumerService = RESTBuilder.getService(InventarioRESTConsumerService.class, 120);
|
var inventarioRESTConsumerService = restBuilder.getService(InventarioRESTConsumerService.class, 120);
|
||||||
|
|
||||||
var response = inventarioRESTConsumerService.retrieve()
|
var response = inventarioRESTConsumerService.retrieve()
|
||||||
.execute();
|
.execute();
|
||||||
@@ -70,18 +77,18 @@ public class InventarioRESTConsumer extends _BaseRESTConsumer {
|
|||||||
var request = new InsertInventarioRequestDTO()
|
var request = new InsertInventarioRequestDTO()
|
||||||
.setMtbInvent(inventarioToInsert);
|
.setMtbInvent(inventarioToInsert);
|
||||||
|
|
||||||
var inventarioRESTConsumerService = RESTBuilder.getService(InventarioRESTConsumerService.class, 300);
|
var inventarioRESTConsumerService = restBuilder.getService(InventarioRESTConsumerService.class, 300);
|
||||||
inventarioRESTConsumerService
|
inventarioRESTConsumerService
|
||||||
.insert(inventarioToInsert.getIdInventario(), request)
|
.insert(inventarioToInsert.getIdInventario(), request)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new ManagedErrorCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||||
analyzeAnswer(response, "insertInventario", ignored -> onComplete.run(), onFailed);
|
analyzeAnswer(response, "insertInventario", ignored -> onComplete.run(), onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user