Version 7.6, no subida, fija estados ticket_setState, revisados databinding layouts y posibilidad de envio rockets desde previa.

This commit is contained in:
Sergio De la torre 2022-01-27 08:29:39 +01:00
parent 5b5171ab1d
commit 964850c4af
147 changed files with 1144 additions and 1992 deletions

View File

@ -10,6 +10,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/alpha_b_circle_outline.xml" value="0.2359375" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/alpha_b_circle_outline.xml" value="0.2359375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/alpha_f_circle_outline.xml" value="0.1" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/alpha_f_circle_outline.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/background_oval_checked.xml" value="0.2359375" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/background_oval_checked.xml" value="0.2359375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/background_oval_unchecked.xml" value="0.30052083333333335" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/barcode.xml" value="0.2359375" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/barcode.xml" value="0.2359375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/barcode_scan.xml" value="0.1" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/barcode_scan.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/border_parental.xml" value="0.11979166666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/border_parental.xml" value="0.11979166666666667" />
@ -22,6 +23,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_full.xml" value="0.18489583333333334" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_full.xml" value="0.18489583333333334" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_off.xml" value="0.1" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_off.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_outline.xml" value="0.22407407407407406" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_outline.xml" value="0.22407407407407406" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/car.xml" value="0.30052083333333335" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/car_control.xml" value="0.22407407407407406" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/car_control.xml" value="0.22407407407407406" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/car_info.xml" value="0.2916666666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/car_info.xml" value="0.2916666666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/circleshape.xml" value="0.11979166666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/circleshape.xml" value="0.11979166666666667" />
@ -84,8 +86,10 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/buyers_fragment.xml" value="0.18333333333333332" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/buyers_fragment.xml" value="0.18333333333333332" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_dialog.xml" value="0.1490036231884058" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_dialog.xml" value="0.1490036231884058" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_edit_dialog.xml" value="0.10208333333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_edit_dialog.xml" value="0.10208333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_hour.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_list_dialog.xml" value="0.1490036231884058" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_list_dialog.xml" value="0.1490036231884058" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_three_dialog.xml" value="0.12817028985507245" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_three_dialog.xml" value="0.12817028985507245" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/component_custom_two_dialog.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_ajustes.xml" value="0.3333333333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_ajustes.xml" value="0.3333333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_automatic_add_item.xml" value="0.20625" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_automatic_add_item.xml" value="0.20625" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_buffer.xml" value="0.1408514492753623" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_buffer.xml" value="0.1408514492753623" />
@ -95,9 +99,13 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_buscar_item_all.xml" value="0.3333333333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_buscar_item_all.xml" value="0.3333333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_collection.xml" value="0.23007246376811594" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_collection.xml" value="0.23007246376811594" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_controlador.xml" value="0.20153985507246377" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_controlador.xml" value="0.20153985507246377" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_expedition_pallet.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_expedition_pallet_detail.xml" value="0.15579710144927536" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_expedition_scan.xml" value="0.21666666666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_expedition_scan.xml" value="0.21666666666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_expedition_truck_list.xml" value="0.15579710144927536" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_expeditionscan_sorter.xml" value="0.196875" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_expeditionscan_sorter.xml" value="0.196875" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_expeditionstate.xml" value="0.1" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_expeditionstate.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_faltas.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_historico.xml" value="0.1734375" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_historico.xml" value="0.1734375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_historicovehiculo.xml" value="0.23052536231884058" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_historicovehiculo.xml" value="0.23052536231884058" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_inventary.xml" value="0.11271529888551166" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_inventary.xml" value="0.11271529888551166" />
@ -116,6 +124,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_qr.xml" value="0.19882246376811594" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_qr.xml" value="0.19882246376811594" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_sacador.xml" value="0.12952898550724637" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_sacador.xml" value="0.12952898550724637" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_sacador_associatesmarttag.xml" value="0.22" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_sacador_associatesmarttag.xml" value="0.22" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_shelving_parking.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_shelvinglog.xml" value="0.13269927536231885" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_shelvinglog.xml" value="0.13269927536231885" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_smarttag_register.xml" value="0.3118811881188119" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_smarttag_register.xml" value="0.3118811881188119" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_transferencia.xml" value="0.10666666666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_transferencia.xml" value="0.10666666666666667" />
@ -126,22 +135,36 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_ajustes_row.xml" value="0.10009057971014493" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_ajustes_row.xml" value="0.10009057971014493" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_article_row.xml" value="0.4466666666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_article_row.xml" value="0.4466666666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_article_row_presacador.xml" value="0.4466666666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_article_row_presacador.xml" value="0.4466666666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_barcode_row.xml" value="0.15579710144927536" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_buyer_row.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_card_row.xml" value="0.2269021739130435" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_card_row.xml" value="0.2269021739130435" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_collection_row.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_escaner_row.xml" value="0.15353260869565216" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_expedition_view_row.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_expeditionpallet_row.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_expeditionscan_row.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_expeditionstate_row.xml" value="0.23489583333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_expeditionstate_row.xml" value="0.23489583333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_expeditiontruck_row.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_faltas_row.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_historico_row.xml" value="0.15353260869565216" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_historicovehiculo_row.xml" value="0.18795289855072464" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_historicovehiculo_row.xml" value="0.18795289855072464" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_inventary_row.xml" value="0.22604166666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_inventary_row.xml" value="0.22604166666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_itemshelvingdayofsale_row.xml" value="0.18206521739130435" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_itemshelvingdayofsale_row.xml" value="0.18206521739130435" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_location_all_row.xml" value="0.12259371833839919" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_location_all_row.xml" value="0.12259371833839919" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_location_row.xml" value="0.16875" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_location_row.xml" value="0.16875" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_pasilleros_main_menu.xml" value="0.13829787234042554" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_pasilleros_main_menu.xml" value="0.13829787234042554" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_placement_row.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_proposal_row.xml" value="0.22604166666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_proposal_row.xml" value="0.22604166666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_reposicion.xml" value="0.1" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_reposicion.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_shelvingdayofsale_row.xml" value="0.2375" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_shelvingdayofsale_row.xml" value="0.2375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_shelvinglog_row.xml" value="0.21739130434782608" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_shelvinglog_row.xml" value="0.21739130434782608" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_shelvingparking_row.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_smarttag_row.xml" value="0.20153985507246377" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_smarttag_row.xml" value="0.20153985507246377" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_toolbar_row.xml" value="0.15307971014492755" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_toolbar_row.xml" value="0.15307971014492755" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_ubication_row.xml" value="0.11822916666666666" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_ubication_row.xml" value="0.11822916666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_worker_image.xml" value="0.23177083333333334" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_worker_image.xml" value="0.23177083333333334" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/qauality_fragment.xml" value="0.15353260869565216" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/reposicion_fragment.xml" value="0.15353260869565216" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/shelvinglog_row.xml" value="0.18385416666666668" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/shelvinglog_row.xml" value="0.18385416666666668" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/toolbar.xml" value="0.15353260869565216" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/toolbar.xml" value="0.15353260869565216" />
</map> </map>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RenderSettings">
<option name="showDecorations" value="true" />
</component>
</project>

View File

@ -14,32 +14,11 @@ android {
applicationId "es.verdnatura" applicationId "es.verdnatura"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode 97 versionCode 100
versionName "7.5.1" //VERSION CODE 97. Control de previa, Llamadas ok, menú ok y textos en iconos y imágenes. versionName "7.6" //VERSION CODE 100. Envios rocket a previa, revisados databinding layouts,
//versionName "7.5" //VERSION CODE 96. Control de previa, Llamadas ok, menú ok y textos en iconos y imágenes. //versionName "7.5.1" //VERSION CODE 97. Control de previa, Llamadas ok, menú ok y textos en iconos y imágenes.
//versionName "7.4" //VERSION CODE 95. Envio desde App enlaces correctos, un click controladores y llamadas sacador-controlador hecho pero no probado. //versionName "7.5.1" VERSION CODE 99 PARA TESTEAR APP-->INSTALADA EN VARIOS USUARIO 24-01-2022
//versionName "7.3" //VERSION CODE 94. Se ve productos en balda y posibilidad de modificarlo.
//versionName "7.2.1" //VERSION CODE 93. Si eliges sector en V no aparece insertar las baldas.
//versionName "7.2" //VERSION CODE 92. Ordena sales en presacador por pickingOrder, ya no llama siempre para poner numero de baldas.
//versionName "7" //VERSION CODE 88. Se añade llamadas a parkingsales,incorpora poner numero de baldas
//versionName "6.6" //VERSION CODE 87. Modificado parking presacador.faltaba ver el ticket y se añade carro al historico de shelving.
//versionName "6.5.1" //VERSION CODE 86. Modificado parking presacador.faltaba ver el ticket y se añade carro al historico de shelving.
//versionName "6.5" //VERSION CODE 85. Modificado parking presacador. Llama a saleParking.
//versionName "6.4" //VERSION CODE 84. Modificados menus buffer y añadido hsitorico carro por items y por carro.
//versionName "6.3" //VERSION CODE 83 Nueva funcionalidad Cargar expedición en buffer
//versionName "6.2.1" // VERSION CODE 82 Aparece mensaje de error completo en "Error al construir la colección".
//versionName "6.2" //VERSION CODE 81, arreglado el null de grouping en ubicador.
//versionName "6.1.9.1" //VERSION CODE 80, arreglado el null de grouping en ubicador.
//versionName "6.1.9" VERSION CODE 76, añadido grouping, reference, prioridad, controladores vs scadores, boton mensaje error,rocket salix y error al añadir elemento a colección.
// Sin subir, Modificado y añadido mensajes de error, añadido opcion Dia de venta y su parking, teclado numerico para controlador
//versionName "6.1.8.5" VERSION CODE 75 // 23-10-2021//VERSION CODE 74-75 .Pantalla "Dia de venta y parking" Modificado itemtrash, deprecated preferenceManager, quitados ;,puesto menu general al controlador
//versionName "6.1.8.4.1" //VERSION CODE 73 . Modificar itemtrash
//versionName "6.1.8.4" //VERSION CODE 72 . Se añade ExpedtionScan para el Sorter, y modificion llamadas itemtrash y collectionGetTicket.
//versionName "6.1.8.3.1"//(VERSION CODE 71) Se añade ViewModel.collectionGet cuando se hace un collectionNew y un refresco de adapter
//versionName "6.1.8.3" //(VERSION CODE 69) Tres campos más en pantalla cel1,cel2,cel3, obtener artículos similares con filtro, mostrar foto del sacador.
//versionName "6.1.8.2" //(VERSIONCODE 68) Menu Operaciones buffer, pantalla mas grande en control vehiculo, deletefragments a todos los menus.
//versionName "6.1.8.1" //(VERSIONCODE 67) Control vehiculo , visualizar y filtrar historico
// versionName "5.4.4" //version inicial
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
@ -71,6 +50,10 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
debugImplementation fileTree(dir: 'libs/debug', include: ['*.jar']) debugImplementation fileTree(dir: 'libs/debug', include: ['*.jar'])
releaseImplementation fileTree(dir: 'libs/release', include: ['*.jar']) releaseImplementation fileTree(dir: 'libs/release', include: ['*.jar'])
//navigation
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation("androidx.drawerlayout:drawerlayout:1.1.1")
// Kotlin and Android // Kotlin and Android
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

View File

@ -11,7 +11,7 @@
"type": "SINGLE", "type": "SINGLE",
"filters": [], "filters": [],
"attributes": [], "attributes": [],
"versionCode": 97, "versionCode": 99,
"versionName": "7.5.1", "versionName": "7.5.1",
"outputFile": "app-release.apk" "outputFile": "app-release.apk"
} }

Binary file not shown.

Binary file not shown.

View File

@ -16,36 +16,36 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="com.zebra.provider.READ"/>--> <uses-permission android:name="com.zebra.provider.READ"/>-->
<queries> <!--<queries>
<provider android:authorities="oem_info" /> <provider android:authorities="oem_info" />
</queries> </queries>-->
<application <application
android:name=".MobileApplication" android:name=".MobileApplication"
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"> android:usesCleartextTraffic="true">
<activity android:name=".presentation.view.feature.imageview.activity.ImageViewActivity" android:configChanges="orientation" <activity android:name=".presentation.view.feature.imageview.activity.ImageViewActivity" android:configChanges="orientation"
android:screenOrientation="portrait"/> android:screenOrientation="portrait"/>
<activity <activity
android:name=".presentation.view.feature.main.activity.MainActivity" android:name=".presentation.view.feature.main.activity.MainActivity"
android:windowSoftInputMode="stateHidden|adjustResize" android:windowSoftInputMode="stateHidden|adjustResize"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="portrait"/> android:screenOrientation="portrait"/>
<activity <activity
android:name=".presentation.view.feature.login.activity.LoginActivity" android:name=".presentation.view.feature.login.activity.LoginActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
</application> </application>
</manifest> </manifest>

View File

@ -5,8 +5,9 @@ import retrofit2.converter.gson.GsonConverterFactory
class ApiSalixUtils { class ApiSalixUtils {
companion object { companion object {
//const val BASE_URL:String = "http://192.168.1.108:8000/" //const val BASE_URL:String = "http://192.168.1.155:9009/"
const val BASE_URL: String = "https://salix.verdnatura.es/api/" const val BASE_URL: String = "https://salix.verdnatura.es/api/"
//const val BASE_URL: String = "https://test-salix.verdnatura.es/api/"
fun getApiService(): SalixService { fun getApiService(): SalixService {
val salixRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory( val salixRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(
GsonConverterFactory.create() GsonConverterFactory.create()

View File

@ -10,4 +10,7 @@ class GetAjustesUserCase(context: Context) : RestClient(context) {
return restClient!!.getSectors("json", "1", usuario, password, "application/json") return restClient!!.getSectors("json", "1", usuario, password, "application/json")
} }
fun getSectorsSalix(token:String): Call<List<SectorItemVO>> {
return salixClient!!.getSectorsSalix(content_type = "application/json", authorization = token)
}
} }

View File

@ -89,20 +89,20 @@ class GetLoginUserCase(context: Context) : RestClient(context)
*/ */
//SALIX SERGIO MENSAJE : PARA NO ENVIAR MENSAJES A COMERCIALES PONGO QUE LAS MODIFICACIONES SE ENVIAN AL CANAL CREADO. //SALIX SERGIO MENSAJE : PARA NO ENVIAR MENSAJES A COMERCIALES PONGO QUE LAS MODIFICACIONES SE ENVIAN AL CANAL CREADO.
/*fun sendChekingPresence(token:String,workerId:Int,message:String) : Call<Boolean>{ fun sendChekingPresence(token:String,workerId:Int,message:String) : Call<Boolean>{
return salixClient!!.sendChekingPresence(content_type = "application/json", authorization = token, params = SalixMessageVO(workerId = workerId,message = message)) return salixClient!!.sendChekingPresence(content_type = "application/json", authorization = token, params = SalixMessageVO(workerId = workerId,message = message))
}*/ }
// SERGIO: PARA DESARROLLO SE DESCOMENTA ESTAS LÍNEAS Y SE COMENTAN LAS DE ARRIBA // SERGIO: PARA DESARROLLO SE DESCOMENTA ESTAS LÍNEAS Y SE COMENTAN LAS DE ARRIBA
fun sendChekingPresence(token: String, workerId: Int, message: String): Call<Boolean> /*fun sendChekingPresence(token: String, workerId: Int, message: String): Call<Boolean>
{ {
return salixClient!!.sendGroup( return salixClient!!.sendGroup(
content_type = "application/json", content_type = "application/json",
authorization = token, authorization = token,
params = SalixGrupo(to = "#android-test", message = message) params = SalixGrupo(to = "#android-test", message = message)
) )
} }*/
fun checkVersion(usuario: String, password: String, nameApp: String): Call<versionApp> fun checkVersion(usuario: String, password: String, nameApp: String): Call<versionApp>
{ {

View File

@ -120,6 +120,10 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
// val params:ArrayList<String> = ArrayList() // val params:ArrayList<String> = ArrayList()
return restClient!!.collectionGet("json", "1", usuario, password, "application/json") return restClient!!.collectionGet("json", "1", usuario, password, "application/json")
} }
fun collectionGetSalix(token:String): Call<List<CollectionVO>> {
// val params:ArrayList<String> = ArrayList()
return salixClient!!.getCollectionSalix(content_type = "application/json",token)
}
fun saleTrackingReplace( fun saleTrackingReplace(
usuario: String, usuario: String,
@ -378,16 +382,16 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
) )
} }
fun collectionUpdateState( fun ticket_setState(
usuario: String, usuario: String,
password: String, password: String,
collectionFk: String, ticketFk: String,
state: String state: String
): Call<String> { ): Call<Unit> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(collectionFk) params.add(ticketFk)
params.add(state) params.add(state)
return restClient!!.collectionUpdateState( return restClient!!.ticket_setState(
"json", "json",
"1", "1",
usuario, usuario,

View File

@ -1,10 +1,13 @@
package es.verdnatura.domain package es.verdnatura.domain
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
import es.verdnatura.presentation.view.feature.login.model.SalixGrupo import es.verdnatura.presentation.view.feature.login.model.SalixGrupo
import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import retrofit2.Call import retrofit2.Call
import retrofit2.http.Body import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header import retrofit2.http.Header
import retrofit2.http.POST import retrofit2.http.POST
@ -30,5 +33,19 @@ interface SalixService {
): ):
Call<Boolean> Call<Boolean>
@GET("collections/getSectors")
fun getSectorsSalix(
@Header("Content-Type") content_type: String,
@Header("Authorization") authorization: String,
//@Body params: SalixGrupo
):
Call<List<SectorItemVO>>
@GET("collections/getCollection")
fun getCollectionSalix(
@Header("Content-Type") content_type: String,
@Header("Authorization") authorization: String,
):
Call<List<CollectionVO>>
} }

View File

@ -369,8 +369,8 @@ interface VerdnaturaService {
): ):
Call<String> Call<String>
@POST("almacennew/collectionUpdateState")//REVISADA @POST("almacennew/ticket_setState")//REVISADA
fun collectionUpdateState( fun ticket_setState(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@Header("version") version: String, @Header("version") version: String,
@Header("user") user: String, @Header("user") user: String,
@ -378,7 +378,7 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<Unit>
@POST("almacennew/barcodeToItem")//REVISADA @POST("almacennew/barcodeToItem")//REVISADA
fun getIdFromCode( fun getIdFromCode(
@ -470,7 +470,7 @@ interface VerdnaturaService {
): ):
Call<List<ItemPackingType>> Call<List<ItemPackingType>>
@POST("almacennew/itemStockUpdate")//REVISADA /* @POST("almacennew/itemStockUpdate")//REVISADA
fun itemStockUpdate( fun itemStockUpdate(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@Header("version") version: String, @Header("version") version: String,
@ -479,9 +479,9 @@ interface VerdnaturaService {
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Body params: List<String> @Body params: List<String>
): ):
Call<String> Call<String>*/
@POST("almacennew/itemTrash")//REVISADA @POST("almacennew/itemTrash")//REVISADA
fun itemTrash( fun itemTrash(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@Header("version") version: String, @Header("version") version: String,
@ -582,7 +582,7 @@ interface VerdnaturaService {
Call<List<ItemLocationVO>> Call<List<ItemLocationVO>>
// BUSCAR ITEM ALL // BUSCAR ITEM ALL
/* @POST("almacennew/getItemUbication")//REVISADA /* @POST("almacennew/getItemUbication")//REVISADAc
fun searchItemsUbicadorAll( fun searchItemsUbicadorAll(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@Header("version") version: String, @Header("version") version: String,

View File

@ -14,6 +14,7 @@ import android.speech.RecognizerIntent
import android.speech.SpeechRecognizer import android.speech.SpeechRecognizer
import android.speech.tts.TextToSpeech import android.speech.tts.TextToSpeech
import android.speech.tts.UtteranceProgressListener import android.speech.tts.UtteranceProgressListener
import android.text.Editable
import android.util.Log import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -26,6 +27,8 @@ import androidx.fragment.app.Fragment
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.domain.ConstAndValues
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.common.mediaCurrentVolume import es.verdnatura.presentation.common.mediaCurrentVolume
import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.androidx.viewmodel.ext.android.viewModel
@ -51,7 +54,6 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
protected val ANDROID_ID = "ANDROID_ID" protected val ANDROID_ID = "ANDROID_ID"
protected val DEVICENAME = "devicename" protected val DEVICENAME = "devicename"
protected val VOZ = "voz" protected val VOZ = "voz"
//nuevo campo número carros ajustes y campos para guardar el buyerid y buyernickname //nuevo campo número carros ajustes y campos para guardar el buyerid y buyernickname
protected val BUYER = "buyernickname" protected val BUYER = "buyernickname"
protected val BUYERID = "buyerid" protected val BUYERID = "buyerid"
@ -63,7 +65,6 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
protected lateinit var binding: T protected lateinit var binding: T
private var isOnReadyForSpeech = false private var isOnReadyForSpeech = false
private var textToSpeech: TextToSpeech? = null private var textToSpeech: TextToSpeech? = null
private var mAudioManager: AudioManager? = null private var mAudioManager: AudioManager? = null
protected var mSpeechRecognizer: SpeechRecognizer? = null protected var mSpeechRecognizer: SpeechRecognizer? = null
@ -117,6 +118,8 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
requestRecordAudioPermissionNew() requestRecordAudioPermissionNew()
requestCallPhonePermissionNew() requestCallPhonePermissionNew()
init() init()
} }
@LayoutRes @LayoutRes
@ -167,6 +170,7 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
} catch (e: Exception) { } catch (e: Exception) {
cancelSpeech() cancelSpeech()
} }
} }
private fun initDataBinding() { private fun initDataBinding() {
@ -176,6 +180,22 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
lifecycle.addObserver(this@BaseFragment.viewModel) lifecycle.addObserver(this@BaseFragment.viewModel)
addBindingVariables() addBindingVariables()
} }
fun textScanned_filterDouble(textScanned: String):String{
if (textScanned.length>13) {
var size = textScanned.length
if (textScanned!!.substring((size / 2), size)
.equals(textScanned.substring(0, size / 2))
) {
return textScanned.substring(0, size / 2)
}
}
return textScanned
}
fun getTooltip(image: Int):String { fun getTooltip(image: Int):String {
return when (image) { return when (image) {
@ -203,6 +223,7 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
R.drawable.alpha_f_circle_outline->"Ver movimientos de Faltas" R.drawable.alpha_f_circle_outline->"Ver movimientos de Faltas"
R.drawable.alpha_b_circle_outline->"Ver movimientos de Basura" R.drawable.alpha_b_circle_outline->"Ver movimientos de Basura"
R.drawable.filter_outline->"Filtra por tipo de flor"
else -> {""} else -> {""}
} }
@ -458,6 +479,29 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
} }
} }
fun getData(name:String):String{
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
return when (name){
TOKEN->prefs.getString(name, "").toString()
ANDROID_ID->prefs.getString(name, "0").toString()
USERFK->prefs.getString(USERFK, "").toString() //el id
USER->prefs.getString(USER, "").toString()
PASSWORD -> prefs.getString(PASSWORD, "").toString()
SECTORFK->prefs.getInt(name, SECTORFKDEFAULT).toString()
WAREHOUSEFK->prefs.getInt(name, ConstAndValues.WAREHOUSEFKDEFAULT).toString()
VOZ->prefs.getString(name, "NO").toString()
WAGON->prefs.getInt(name, 2).toString()
TAGSTYPE-> prefs.getString(name, "Stickers").toString()
SECTORDESCRIP->prefs.getString(name,getString(R.string.Sinsector)).toString()
BUYER->prefs.getString(name,"").toString()
BUYERID->prefs.getString(name,"").toString()
else -> {""}
}
}
fun saveBuyer(buyernickname: String) { fun saveBuyer(buyernickname: String) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val editor = prefs.edit() val editor = prefs.edit()
@ -478,23 +522,23 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
return imei.toString() return imei.toString()
} }
fun getANDROIDID(): String { /* fun getANDROIDID(): String {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val androidid = prefs.getString(ANDROID_ID, "0") val androidid = prefs.getString(ANDROID_ID, "0")
return androidid.toString() return androidid.toString()
} }*/
fun getWagons(): Int { /*fun getWagons(): Int {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val wagons = prefs.getInt(WAGON, 2) val wagons = prefs.getInt(WAGON, 2)
return wagons return wagons
} }*/
fun getTagsType(): String { /* fun getTagsType(): String {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val tagstype = prefs.getString(TAGSTYPE, "Stickers") val tagstype = prefs.getString(TAGSTYPE, "Stickers")
return tagstype.toString() return tagstype.toString()
} }*/
fun getMessageFromJSON(json: String): String { fun getMessageFromJSON(json: String): String {
val gson = Gson() val gson = Gson()

View File

@ -10,39 +10,10 @@ abstract class BaseViewModel : ViewModel(), LifecycleObserver
fun nameofFunction(function: Any): String fun nameofFunction(function: Any): String
{ {
// return Thread.currentThread().stackTrace[1].methodName // return Thread.currentThread().stackTrace[1].methodName
return function.javaClass.enclosingMethod!!.name return function.javaClass.enclosingMethod!!.name
} }
fun getMessageFromResponse(ResponseMessage: String): String
{
return try
{
val answerError = JSONObject(ResponseMessage)
answerError.get("Message").toString()
} catch (e: Exception)
{
ResponseMessage
}
}
fun getMessageError(callFunction: String): String
{
return when (callFunction)
{
"collection_getTickets" -> "No hay tickets para sacar. Llamada $callFunction."
"collection_new_wagon" -> "No hay tickets para sacar. Llamada $callFunction."
else ->
{
"Error en la llamada $callFunction."
}
}
}
fun getMessageFromAllResponse(callFunction: String, ResponseMessage: String): String fun getMessageFromAllResponse(callFunction: String, ResponseMessage: String): String
{ {
@ -58,8 +29,6 @@ fun getMessageFromAllResponse(callFunction: String, ResponseMessage: String): St
messageFromError = ResponseMessage messageFromError = ResponseMessage
} }
// if (messageFromError.isEmpty()) {
//sergio:para personalizar los mensajes de respuesta según la llamada. //sergio:para personalizar los mensajes de respuesta según la llamada.
when (callFunction) when (callFunction)
{ {
@ -72,4 +41,4 @@ fun getMessageFromAllResponse(callFunction: String, ResponseMessage: String): St
//} //}
return "$messageFromError.$returnMessage" return "$messageFromError.$returnMessage"
} }

View File

@ -29,9 +29,6 @@ import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
class AjustesFragment : class AjustesFragment :
BaseFragment<FragmentAjustesBinding, AjustesViewModel>(AjustesViewModel::class) { BaseFragment<FragmentAjustesBinding, AjustesViewModel>(AjustesViewModel::class) {
private var user: String? = ""
private var userFk: String? = ""
private var password: String? = ""
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var sectorListVO: List<SectorItemVO> = listOf() private var sectorListVO: List<SectorItemVO> = listOf()
private var vozList: List<String> = listOf() private var vozList: List<String> = listOf()
@ -53,7 +50,7 @@ class AjustesFragment :
prefs = requireActivity().getSharedPreferences(PREFS_USER, 0) prefs = requireActivity().getSharedPreferences(PREFS_USER, 0)
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
viewModel.inititializeDefaultAjusts( viewModel.inititializeDefaultAjusts(
prefs!!.getString( /*prefs!!.getString(
SECTORDESCRIP, SECTORDESCRIP,
getString(R.string.Sinsector) getString(R.string.Sinsector)
).toString(), ).toString(),
@ -61,7 +58,15 @@ class AjustesFragment :
prefs!!.getInt(WAREHOUSEFK, 0), prefs!!.getInt(WAREHOUSEFK, 0),
prefs!!.getString(VOZ, "NO").toString(), prefs!!.getString(VOZ, "NO").toString(),
prefs!!.getInt(WAGON, 2).toString(), prefs!!.getInt(WAGON, 2).toString(),
prefs!!.getString(TAGSTYPE, "Stickers").toString() prefs!!.getString(TAGSTYPE, "Stickers").toString()*/
getData(SECTORDESCRIP),
getData(SECTORFK).toInt(),
getData(WAREHOUSEFK).toInt(),
getData(VOZ),
getData(WAGON),
getData(TAGSTYPE)
) )
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -71,21 +76,19 @@ class AjustesFragment :
override fun init() { override fun init() {
(activity as MainActivity).hideBottomNavigation(View.VISIBLE) (activity as MainActivity).hideBottomNavigation(View.VISIBLE)
binding.userText.setText(prefs!!.getString(USERFK, "")) binding.userText.setText(getData(USER))
val versionName = requireActivity().packageManager.getPackageInfo( val versionName = requireActivity().packageManager.getPackageInfo(
requireActivity().packageName, requireActivity().packageName,
0 0
).versionName!! ).versionName!!
binding.itemVersion.setText(versionName) binding.itemVersion.setText(versionName)
user = prefs!!.getString(USER, "")
userFk = prefs!!.getString(USERFK, "")
password = prefs!!.getString(PASSWORD, "")
binding.androididText.setText( binding.androididText.setText(
Settings.Secure.getString( getData(ANDROID_ID)
/*Settings.Secure.getString(
context?.contentResolver, context?.contentResolver,
Settings.Secure.ANDROID_ID Settings.Secure.ANDROID_ID
) )*/
) )
binding.txtserver.setText(this.getDefaults("base_url", this.requireContext())) binding.txtserver.setText(this.getDefaults("base_url", this.requireContext()))
@ -108,7 +111,8 @@ class AjustesFragment :
override fun onAjustesItemClickListener(item: AjustesItemVO) { override fun onAjustesItemClickListener(item: AjustesItemVO) {
if (item.id == 0) { if (item.id == 0) {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getSectors(user!!, password!!) // viewModel.getSectors(getData(USER),getData(PASSWORD))
viewModel.getSectorsSalix(getData(TOKEN))
} else if (item.id == 5) { } else if (item.id == 5) {
requireActivity().onBackPressed() requireActivity().onBackPressed()
} else if (item.id == 1) { } else if (item.id == 1) {
@ -145,7 +149,7 @@ class AjustesFragment :
(activity as MainActivity).onPasillerosItemClickListener( (activity as MainActivity).onPasillerosItemClickListener(
PasillerosItemVO( PasillerosItemVO(
title = "Control de usuario de vehículo" title = "Control de usuario de vehículo"
), userFk!! ), getData(USERFK)
) )
} }

View File

@ -2,11 +2,14 @@ package es.verdnatura.presentation.view.feature.ajustes.fragment
import android.content.Context import android.content.Context
import android.util.Log
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetAjustesUserCase import es.verdnatura.domain.GetAjustesUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
@ -106,5 +109,31 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
}) })
} }
fun getSectorsSalix(token:String){
getAjustesUserCase.getSectorsSalix(token).enqueue(object : Callback<List<SectorItemVO>>{
override fun onFailure(call: Call<List<SectorItemVO>>, t: Throwable) {
val listError:ArrayList<SectorItemVO> = ArrayList()
listError.add(SectorItemVO(0,"",0,true,t.message!!))
_sectorList.value = SectorListVO(listError)
}
override fun onResponse(
call: Call<List<SectorItemVO>>,
response: Response<List<SectorItemVO>>
) {
if (response.body() != null){
_sectorList.value = response.body()?.let { SectorListVO(it) }
}else{
val listError:ArrayList<SectorItemVO> = ArrayList()
listError.add(SectorItemVO(0,"",0,true,
getMessageFromAllResponse(nameofFunction(this),response.message())
))
_sectorList.value = SectorListVO(listError)
}
}
})
}
} }

View File

@ -2,7 +2,6 @@ package es.verdnatura.presentation.view.feature.articulo.fragment
import android.app.AlertDialog import android.app.AlertDialog
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build import android.os.Build
import android.view.View import android.view.View
@ -14,7 +13,6 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentItemCardBinding import es.verdnatura.databinding.FragmentItemCardBinding
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
@ -32,6 +30,7 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
import es.verdnatura.presentation.view.feature.imageview.activity.ImageViewActivity import es.verdnatura.presentation.view.feature.imageview.activity.ImageViewActivity
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import timber.log.Timber.d
class ItemCardFragment( class ItemCardFragment(
var itemFk: String = "" var itemFk: String = ""
@ -103,14 +102,6 @@ class ItemCardFragment(
listIcons.add(iconReload) listIcons.add(iconReload)
listIcons.add(iconHistory) listIcons.add(iconHistory)
/*
val listIcons:ArrayList<Drawable> = ArrayList()
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
val iconHistory : Drawable = resources.getDrawable(R.drawable.ic_history_black_24dp,resources.newTheme())
listIcons.add(iconReload)
listIcons.add(iconHistory)*/
binding.mainToolbar.toolbarIcons.adapter = binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener { ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
@ -135,50 +126,12 @@ class ItemCardFragment(
} }
} }
/* if (item == iconReload.drawable) {
binding.splashProgress.visibility = View.VISIBLE
getItemCard(itemFk)
}
if (item == iconHistory.drawable) {
if (itemFk.isNullOrEmpty()) {
"Escanea un item".toast(requireActivity())
} else {
(activity as MainActivity).onPasillerosItemClickListener(
PasillerosItemVO(title = "Historico"),
itemInfoG!!.id
)
}
}*/
} }
}) })
/* binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
// binding.splashProgress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
getItemCard(itemFk)
}
if (item == iconHistory){
if (itemFk.isNullOrEmpty()){
"Escanea un item".toast(requireActivity())
}else{
// //Log.i("VERDNATURA:","el item es ${itemInfoG!!.id}")
//(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Historico"),itemFk)
(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Historico"),itemInfoG!!.id)
}
}
}
})*/
//toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
binding.mainToolbar.toolbarIcons.layoutManager = binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
} }
@ -215,16 +168,17 @@ class ItemCardFragment(
} }
private fun getItemCard(itemFk: String) { private fun getItemCard(itemFk: String) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString() user = getData(USER)
password = prefs.getString(PASSWORD, "").toString() password = getData(PASSWORD)
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString() warehouseFk = getData(WAREHOUSEFK)
this.itemFk = itemFk this.itemFk = itemFk
binding.splashProgressTwo.visibility = View.VISIBLE binding.splashProgressTwo.visibility = View.VISIBLE
viewModel.getItemCard(itemFk, warehouseFk, user, password, "item_card") viewModel.getItemCard(itemFk, warehouseFk, user, password, "item_card")
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getItemPackingType(user, password, "get_ItemPackingType") viewModel.getItemPackingType(getData(USER), getData(PASSWORD), "get_ItemPackingType")
} }

View File

@ -2,12 +2,10 @@ package es.verdnatura.presentation.view.feature.articulo.fragment
import android.content.Context import android.content.Context
import android.util.Log
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetItemCardUserCase import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO
@ -16,8 +14,6 @@ import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
import retrofit2.Response import retrofit2.Response
import timber.log.Timber import timber.log.Timber
import java.util.*
import kotlin.collections.ArrayList
class ItemCardViewModel(context: Context) : BaseViewModel() { class ItemCardViewModel(context: Context) : BaseViewModel() {
private val getItemCardUserCase:GetItemCardUserCase = GetItemCardUserCase(context) private val getItemCardUserCase:GetItemCardUserCase = GetItemCardUserCase(context)

View File

@ -1,12 +1,11 @@
package es.verdnatura.presentation.view.feature.articulo.fragment package es.verdnatura.presentation.view.feature.articulo.fragment
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.Gravity
import android.view.View import android.view.View
import android.widget.Toast import android.widget.ImageView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -16,15 +15,12 @@ import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnItemProposalClickListener import es.verdnatura.presentation.common.OnItemProposalClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.articulo.adapter.ItemProposalAdapter import es.verdnatura.presentation.view.feature.articulo.adapter.ItemProposalAdapter
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_buscar_item.*
import kotlinx.android.synthetic.main.toolbar.**/
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
@ -35,28 +31,22 @@ class ItemProposalFragment(
ItemCardViewModel::class ItemCardViewModel::class
) { ) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var adapter: ItemProposalAdapter? = null private var adapter: ItemProposalAdapter? = null
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private var listInvetory: ArrayList<ItemProposal> = ArrayList() private var listInvetory: ArrayList<ItemProposal> = ArrayList()
private var listInvetoryAux: ArrayList<ItemProposal> = ArrayList() private var listInvetoryAux: ArrayList<ItemProposal> = ArrayList()
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
private var reload = false
private var hideLoad = true private var hideLoad = true
private var layoutManager: LinearLayoutManager? = null private var layoutManager: LinearLayoutManager? = null
private var firstVisiblePosition = 0 private var firstVisiblePosition = 0
private var filter = "TRUE" private var filter = "TRUE"
private var prefs: SharedPreferences? = null
companion object { companion object {
fun newInstance(entryPoint: String) = ItemProposalFragment(entryPoint) fun newInstance(entryPoint: String) = ItemProposalFragment(entryPoint)
} }
//override fun getLayoutId(): Int = R.layout.fragment_inventary
override fun getLayoutId(): Int = R.layout.fragment_itemproposal override fun getLayoutId(): Int = R.layout.fragment_itemproposal
override fun onAttach(context: Context) { override fun onAttach(context: Context) {
@ -65,18 +55,13 @@ class ItemProposalFragment(
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
prefs = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs!!.getString(USER, "").toString()
password = prefs!!.getString(PASSWORD, "").toString()
warehouseFk = prefs!!.getInt(WAREHOUSEFK, 60).toString()
viewModel.item_getSimilar( viewModel.item_getSimilar(
itemFk, itemFk,
warehouseFk, getData(WAREHOUSEFK),
vShipped = currentDay(), vShipped = currentDay(),
vIsShowedByType = "TRUE", vIsShowedByType = "TRUE",
user = user, user = getData(USER),
password = password,"item_getSimilar" password = getData(PASSWORD),"item_getSimilar"
) )
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
@ -85,12 +70,6 @@ class ItemProposalFragment(
val calendar = Calendar.getInstance() val calendar = Calendar.getInstance()
val format = SimpleDateFormat("yyyy-MM-dd") val format = SimpleDateFormat("yyyy-MM-dd")
System.out.println(format.format(calendar.time))
/* val current = LocalDateTime.now()
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
val currentDay = current.format(formatter)*/
return format.format(calendar.time) return format.format(calendar.time)
} }
@ -99,7 +78,6 @@ class ItemProposalFragment(
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
//requireActivity().main_bottom_navigation.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE) (activity as MainActivity).hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
binding.mainToolbar.toolbarTitle.text = getString(R.string.ArticleSimilar) + ":" + itemFk binding.mainToolbar.toolbarTitle.text = getString(R.string.ArticleSimilar) + ":" + itemFk
@ -110,66 +88,54 @@ class ItemProposalFragment(
} }
private fun setToolBar() { private fun setToolBar() {
val listIcons: ArrayList<Drawable> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
val iconReload: Drawable = val iconFilter=ImageView(context)
resources.getDrawable(R.drawable.ic_autorenew_black_24dp, resources.newTheme()) iconFilter.setImageResource(R.drawable.filter_outline)
val iconFilter: Drawable =
resources.getDrawable(R.drawable.filter_outline, resources.newTheme()) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
/* listIcons.add(iconReload)*/ iconFilter.tooltipText = getTooltip(R.drawable.filter_outline)
}
resources.getDrawable(R.drawable.filter_outline, resources.newTheme())
listIcons.add(iconFilter) listIcons.add(iconFilter)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) { override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload) { when (item){
binding.splashProgress.visibility = View.VISIBLE iconFilter.drawable-> {
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0 binding.splashProgress.visibility = View.VISIBLE
viewModel.item_getSimilar( firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
itemFk,
warehouseFk,
vIsShowedByType = filter,
vShipped = currentDay(),
user = user,
password = password
,callFunction = "item_getSimilar")
} if (filter.equals("TRUE")) {
if (item == iconFilter) { filter = "FALSE"
iconFilter.drawable.setTint(ContextCompat.getColor(
binding.splashProgress.visibility = View.VISIBLE
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
if (filter.equals("TRUE")) {
showMessage("Sin Filtrar por tipo de flor")
filter = "FALSE"
iconFilter.setTint(
ContextCompat.getColor(
context!!, context!!,
R.color.verdnatura_white R.color.verdnatura_white))
)
) } else {
filter = "TRUE"
iconFilter.drawable.setTint(
ContextCompat.getColor(
context!!,
R.color.verdnatura_pumpkin_orange))
}
viewModel.item_getSimilar(
itemFk,
getData(WAREHOUSEFK),
vIsShowedByType = filter,
vShipped = currentDay(),
user = getData(USER),
password = getData(PASSWORD) ,
callFunction = "item_getSimilar")
} else {
filter = "TRUE"
showMessage("Filtrado por tipo de flor")
iconFilter.setTint(
ContextCompat.getColor(
context!!,
R.color.verdnatura_pumpkin_orange
)
)
} }
viewModel.item_getSimilar(
itemFk,
warehouseFk,
vIsShowedByType = filter,
vShipped = currentDay(),
user = user,
password = password ,
callFunction = "item_getSimilar")
} }
} }
}) })
@ -178,15 +144,6 @@ class ItemProposalFragment(
} }
private fun showMessage(message:String){
val mytoast = Toast.makeText(
requireContext(),
message,
Toast.LENGTH_SHORT
)
mytoast.setGravity(Gravity.TOP or Gravity.RIGHT, 0, -100)
mytoast.show()
}
private fun setEvents() { private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed() requireActivity().onBackPressed()

View File

@ -1,37 +1,23 @@
package es.verdnatura.presentation.view.feature.buffer.fragment package es.verdnatura.presentation.view.feature.buffer.fragment
import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentBufferBinding import es.verdnatura.databinding.FragmentBufferBinding
import es.verdnatura.domain.ConstAndValues
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
//import kotlinx.android.synthetic.main.fragment_controlador.*
//import kotlinx.android.synthetic.main.toolbar.*
class BufferFragment( class BufferFragment(
var entryPoint: String = "" var entryPoint: String = ""
) : BaseFragment<FragmentBufferBinding, BufferFragmentViewModel>(BufferFragmentViewModel::class) { ) : BaseFragment<FragmentBufferBinding, BufferFragmentViewModel>(BufferFragmentViewModel::class) {
private var user = ""
private var password = "" private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var goBack: Boolean = false private var goBack: Boolean = false
override fun getLayoutId(): Int = R.layout.fragment_buffer override fun getLayoutId(): Int = R.layout.fragment_buffer
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var type = ""
companion object { companion object {
fun newInstance(entryPoint: String) = BufferFragment(entryPoint) fun newInstance(entryPoint: String) = BufferFragment(entryPoint)
@ -52,18 +38,9 @@ class BufferFragment(
binding.mainToolbar.toolbarTitle.text = entryPoint binding.mainToolbar.toolbarTitle.text = entryPoint
} }
override fun onPause() {
goBack = true
super.onPause()
}
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString() password = getData(PASSWORD)
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
type = ConstAndValues.PRECHECKER
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
@ -76,7 +53,7 @@ class BufferFragment(
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
binding.scanInput.setOnEditorActionListener { _, actionId, _ -> binding.scanInput.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
goBack = false // goBack = false
if (! binding.scanInput.text.isNullOrEmpty()) { if (! binding.scanInput.text.isNullOrEmpty()) {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
@ -90,8 +67,8 @@ class BufferFragment(
} }
viewModel.buffer_setTypeByName( viewModel.buffer_setTypeByName(
user, getData(USER),
password, getData(PASSWORD),
binding.scanInput.text.toString(), binding.scanInput.text.toString(),
entryPoint, entryPoint,
"buffer_setTypeByName" "buffer_setTypeByName"
@ -115,11 +92,11 @@ class BufferFragment(
if (it.isError) { if (it.isError) {
(activity as MainActivity).messageWithSound( (activity as MainActivity).messageWithSound(
it.errorMessage,false) it.errorMessage,true,isPlayed = true)
} else { } else {
(activity as MainActivity).messageWithSound("Operación "+entryPoint.lowercase() + " buffer realizada correctamente",true) (activity as MainActivity).messageWithSound("Operación "+entryPoint.lowercase() + " buffer realizada correctamente",false,isPlayed = true)
binding.mainToolbar.backButton.performClick() binding.mainToolbar.backButton.performClick()
} }

View File

@ -1,12 +1,10 @@
package es.verdnatura.presentation.view.feature.buffer.fragment package es.verdnatura.presentation.view.feature.buffer.fragment
import android.content.Context import android.content.Context
import android.util.Log
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetPaletizadoresUserCase import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO

View File

@ -1,24 +1,17 @@
package es.verdnatura.presentation.view.feature.buffer.fragment package es.verdnatura.presentation.view.feature.buffer.fragment
import android.content.SharedPreferences
import android.media.MediaPlayer import android.media.MediaPlayer
import android.os.Bundle
import android.view.View.* import android.view.View.*
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentBufferLoadexpeditionBinding import es.verdnatura.databinding.FragmentBufferLoadexpeditionBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.component.CustomDialogList import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.component.CustomDialogThreeButtons
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.smarttag.adapter.SmartTagAdapter import es.verdnatura.presentation.view.feature.smarttag.adapter.SmartTagAdapter
import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag
@ -29,18 +22,9 @@ class BufferLoadFragment(
BufferFragmentViewModel::class BufferFragmentViewModel::class
) { ) {
private var user = ""
private var userFk = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var goBack: Boolean = false private var goBack: Boolean = false
override fun getLayoutId(): Int = R.layout.fragment_buffer_loadexpedition override fun getLayoutId(): Int = R.layout.fragment_buffer_loadexpedition
private lateinit var customDialog: CustomDialog
private lateinit var customDialogList: CustomDialogList private lateinit var customDialogList: CustomDialogList
private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogThreeButtons: CustomDialogThreeButtons
private var listTags: ArrayList<SmartTag> = ArrayList() private var listTags: ArrayList<SmartTag> = ArrayList()
private var tagsAdapter: SmartTagAdapter? = null private var tagsAdapter: SmartTagAdapter? = null
private var itemScaned: String = "" private var itemScaned: String = ""
@ -55,13 +39,11 @@ class BufferLoadFragment(
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext()) customDialogList = CustomDialogList(requireContext())
customDialogInput = CustomDialogInput(requireContext())
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
goBack = false goBack = false
(activity as MainActivity).hideBottomNavigation(GONE) (activity as MainActivity).hideBottomNavigation(GONE)
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error) mperror = MediaPlayer.create((activity as MainActivity),R.raw.error)
mpok= MediaPlayer.create((activity as MainActivity),R.raw.ok) mpok= MediaPlayer.create((activity as MainActivity),R.raw.ok)
@ -95,8 +77,8 @@ class BufferLoadFragment(
if (listTags.size==2) { if (listTags.size==2) {
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.expeditionLoading_add( viewModel.expeditionLoading_add(
usuario = user, usuario = getData(USER),
password=password, password=getData(PASSWORD),
vBufferFk = ExpeditionOrBuffer, vBufferFk = ExpeditionOrBuffer,
vExpeditionFk = listTags.first().code.toString(), vExpeditionFk = listTags.first().code.toString(),
callFunction = "expeditionLoading_add") callFunction = "expeditionLoading_add")
@ -107,19 +89,6 @@ class BufferLoadFragment(
} }
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
userFk = prefs.getString(USERFK, "0").toString()
super.onCreate(savedInstanceState)
}
private fun setEvents() { private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
@ -136,36 +105,22 @@ class BufferLoadFragment(
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
bufferloadresponse.observe(viewLifecycleOwner, Observer { bufferloadresponse.observe(viewLifecycleOwner, Observer {
if (it.isError) { if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage,it.isError,true)
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else { } else {
it.response.toast(requireContext())
if (it.response.equals("Registro añadido")){ if (it.response.equals("Registro añadido")){
mpok?.start()
(activity as MainActivity).messageWithSound(it.response,false,true)
}else{ }else{
mperror?.start() mperror?.start()
it.response.toast(requireContext())
} }
listTags.clear() listTags.clear()
tagsAdapter!!.notifyDataSetChanged() tagsAdapter!!.notifyDataSetChanged()
showExpeditionOrBufferScan() showExpeditionOrBufferScan()
/* var nameSmartTagwithWagon: String
nameSmartTagwithWagon =
getTextScaned(listTags.size + 1) + itemScaned
getTextScaned(1) + itemScaned
customDialogList.setTitle(getTextToPosition(listTags.size + 1))
listTags.add(SmartTag(itemScaned, nameSmartTagwithWagon))
tagsAdapter!!.notifyDataSetChanged()
customDialogList.setValue("")*/
} }
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
@ -176,33 +131,23 @@ class BufferLoadFragment(
} }
private fun getTextToPosition(TagsScaned: Int): String { private fun getTextToPosition(TagsScaned: Int): String {
var message = ""
when (TagsScaned) { return when (TagsScaned) {
1 -> message = "Escanea buffer" 1 -> "Escanea buffer"
//2 -> message = "Escanea etiqueta del medio" else -> {"Escanea buffer"}
//3 -> message = "Escanea etiqueta inferior"
//4 -> message = "Carro escaneado"
else -> { message="Escanea buffer"}
} }
return message
} }
private fun getTextScaned(TagScaned: Int): String { private fun getTextScaned(TagScaned: Int): String {
var message = ""
when (TagScaned) { return when (TagScaned) {
1 -> message = "Expedición:" 1 -> "Expedición:"
2 -> message = "Buffer:" 2 -> "Buffer:"
//3 -> message = "" else -> { ""}
//4 -> message = ""
else -> { message=""}
} }
return message
} }

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.buscaritem.fragment package es.verdnatura.presentation.view.feature.buscaritem.fragment
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.view.View import android.view.View
import android.view.View.GONE import android.view.View.GONE
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
@ -9,7 +8,6 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentBuscarItemBinding import es.verdnatura.databinding.FragmentBuscarItemBinding
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener
@ -22,9 +20,6 @@ class BuscarItemFragment(
var itemFk:String = "" var itemFk:String = ""
) : BaseFragment<FragmentBuscarItemBinding,BuscarItemViewModel>(BuscarItemViewModel::class) { ) : BaseFragment<FragmentBuscarItemBinding,BuscarItemViewModel>(BuscarItemViewModel::class) {
private var user = ""
private var password = ""
private var warehouseFk = ""
private var adapter : LocationAdapter? = null private var adapter : LocationAdapter? = null
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
@ -73,13 +68,9 @@ class BuscarItemFragment(
} }
private fun getLocations(itemFk:String){ private fun getLocations(itemFk:String){
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
this.itemFk = itemFk this.itemFk = itemFk
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getLocations(user,password,itemFk,"getItemUbication") viewModel.getLocations(getData(USER),getData(PASSWORD),itemFk,"getItemUbication")
} }
override fun observeViewModel() { override fun observeViewModel() {
@ -87,13 +78,12 @@ class BuscarItemFragment(
loadLocationList.observe(viewLifecycleOwner, Observer { event -> loadLocationList.observe(viewLifecycleOwner, Observer { event ->
event.getContentIfNotHandled().notNull { event.getContentIfNotHandled().notNull {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = GONE
adapter = LocationAdapter(it.list,pasillerosItemClickListener!!) adapter = LocationAdapter(it.list,pasillerosItemClickListener!!)
binding.locationRecyclerview.adapter = adapter binding.locationRecyclerview.adapter = adapter
binding.locationRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) binding.locationRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
var totalVisible:Int = 0 var totalVisible = 0
it.list.forEach { it.list.forEach {
if (!it.visible.isNullOrEmpty()) if (!it.visible.isNullOrEmpty())
totalVisible += it.visible.toInt() totalVisible += it.visible.toInt()

View File

@ -6,7 +6,6 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetBuscarItemUserCase import es.verdnatura.domain.GetBuscarItemUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event

View File

@ -11,8 +11,6 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.BuyersFragmentBinding import es.verdnatura.databinding.BuyersFragmentBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnAjustesItemClickListener import es.verdnatura.presentation.common.OnAjustesItemClickListener
import es.verdnatura.presentation.common.OnBuyerSelectedListener import es.verdnatura.presentation.common.OnBuyerSelectedListener
@ -22,22 +20,11 @@ import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.ajustes.adapter.AjustesAdapter import es.verdnatura.presentation.view.feature.ajustes.adapter.AjustesAdapter
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.buyers_fragment.*
import kotlinx.android.synthetic.main.buyers_fragment.splash_progress
import kotlinx.android.synthetic.main.fragment_ajustes.*
import kotlinx.android.synthetic.main.toolbar.**/
class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(BuyersViewModel::class) { class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(BuyersViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var onBuyerSelectedListener : OnBuyerSelectedListener? = null private var onBuyerSelectedListener : OnBuyerSelectedListener? = null
private var buyersAdapter: AjustesAdapter? = null private var buyersAdapter: AjustesAdapter? = null
@ -54,18 +41,12 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0) viewModel.itemShelvingBuyerGet(user = getData(USER),password = getData(PASSWORD),"itemShelving_BuyerGet")
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
viewModel.itemShelvingBuyerGet(user = user,password = password,"itemShelving_BuyerGet")
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
//requireActivity().main_bottom_navigation.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE) (activity as MainActivity).hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
binding.mainToolbar.toolbarTitle.text = getString(R.string.quality) binding.mainToolbar.toolbarTitle.text = getString(R.string.quality)
@ -88,16 +69,12 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
} }
listIcons.add(iconReload) listIcons.add(iconReload)
/* val listIcons:ArrayList<Drawable> = ArrayList()
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
listIcons.add(iconReload)*/
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener { binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) { override fun onOptionsItemSelected(item: Drawable) {
when(item){ when(item){
iconReload.drawable->{ iconReload.drawable->{
binding.splashProgress.visibility= View.VISIBLE binding.splashProgress.visibility= View.VISIBLE
viewModel.itemShelvingBuyerGet(user = user,password = password,"itemShelving_BuyerGet") viewModel.itemShelvingBuyerGet(user = getData(USER),password = getData(PASSWORD),"itemShelving_BuyerGet")
} }
} }

View File

@ -5,13 +5,10 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetQualityUserCase import es.verdnatura.domain.GetQualityUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.inventario.model.InventaryListVO
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import retrofit2.Call import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
import retrofit2.Response import retrofit2.Response

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.calidad.fragment package es.verdnatura.presentation.view.feature.calidad.fragment
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
@ -12,21 +11,12 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.QaualityFragmentBinding import es.verdnatura.databinding.QaualityFragmentBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.calidad.adapter.ItemBuyersAdapter import es.verdnatura.presentation.view.feature.calidad.adapter.ItemBuyersAdapter
import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_collection.*
import kotlinx.android.synthetic.main.qauality_fragment.*
import kotlinx.android.synthetic.main.qauality_fragment. binding.scanInput
import kotlinx.android.synthetic.main.qauality_fragment.binding.splashProgress
import kotlinx.android.synthetic.main.toolbar.**/
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
@ -35,10 +25,6 @@ class QaualityFragment(
var userFk : String = "0" var userFk : String = "0"
) : BaseFragment<QaualityFragmentBinding,QaualityViewModel>(QaualityViewModel::class) { ) : BaseFragment<QaualityFragmentBinding,QaualityViewModel>(QaualityViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var buyersAdapter: ItemBuyersAdapter? = null private var buyersAdapter: ItemBuyersAdapter? = null
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
@ -61,19 +47,13 @@ class QaualityFragment(
override fun getLayoutId(): Int = R.layout.qauality_fragment override fun getLayoutId(): Int = R.layout.qauality_fragment
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0) viewModel.itemShelvingBuyerTask(user = getData(USER),password = getData(PASSWORD),userFk = userFk,"itemShelving_BuyerTask")
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
viewModel.itemShelvingBuyerTask(user = user,password = password,userFk = userFk,"itemShelving_BuyerTask")
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
//requireActivity().main_bottom_navigation.visibility = View.GONE (activity as MainActivity).hideBottomNavigation(View.GONE)
(activity as MainActivity).hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
binding.mainToolbar.toolbarTitle.text = "itemShelving_BuyerTask" binding.mainToolbar.toolbarTitle.text = "itemShelving_BuyerTask"
setToolBar() setToolBar()
@ -88,10 +68,6 @@ class QaualityFragment(
} }
private fun setToolBar(){ private fun setToolBar(){
/*val listIcons:ArrayList<Drawable> = ArrayList()
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
listIcons.add(iconReload)
*/
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
val iconReload = ImageView(context) val iconReload = ImageView(context)
iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp) iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp)
@ -105,7 +81,7 @@ class QaualityFragment(
override fun onOptionsItemSelected(item: Drawable) { override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){ if (item == iconReload){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.itemShelvingBuyerTask(user = user,password = password,userFk = userFk,"itemShelving_BuyerTask") viewModel.itemShelvingBuyerTask(user = getData(USER),password = getData(PASSWORD),userFk = userFk,"itemShelving_BuyerTask")
} }
} }
}) })
@ -147,7 +123,7 @@ class QaualityFragment(
}) })
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
viewModel.itemShelvingBuyerTask(user = user,password = password,userFk = userFk,"itemShelving_BuyerTask") viewModel.itemShelvingBuyerTask(user = getData(USER),password = getData(PASSWORD),userFk = userFk,"itemShelving_BuyerTask")
}) })
} }
} }
@ -174,7 +150,7 @@ class QaualityFragment(
buyersAdapter = ItemBuyersAdapter(listItems,pasillerosItemClickListener!!,object: OnStarSelectedListener{ buyersAdapter = ItemBuyersAdapter(listItems,pasillerosItemClickListener!!,object: OnStarSelectedListener{
override fun onStarSelected(vId: String, vStars: String) { override fun onStarSelected(vId: String, vStars: String) {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.itemShelvingStarsUpdate(user,password,vId,vStars) viewModel.itemShelvingStarsUpdate(getData(USER),getData(PASSWORD),vId,vStars)
} }
}) })

View File

@ -5,12 +5,9 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetQualityUserCase import es.verdnatura.domain.GetQualityUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerListVO import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerListVO
import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO
import retrofit2.Call import retrofit2.Call

View File

@ -1,11 +1,8 @@
package es.verdnatura.presentation.view.feature.collection.fragment package es.verdnatura.presentation.view.feature.collection.fragment
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_collection.*
import kotlinx.android.synthetic.main.toolbar.**/
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.media.MediaPlayer import android.media.MediaPlayer
import android.net.Uri import android.net.Uri
@ -31,8 +28,6 @@ import es.verdnatura.domain.ConstAndValues.ON_CHECKING
import es.verdnatura.domain.ConstAndValues.ON_PREPARATION import es.verdnatura.domain.ConstAndValues.ON_PREPARATION
import es.verdnatura.domain.ConstAndValues.PRECHECKER import es.verdnatura.domain.ConstAndValues.PRECHECKER
import es.verdnatura.domain.ConstAndValues.SACADOR import es.verdnatura.domain.ConstAndValues.SACADOR
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
@ -44,7 +39,6 @@ import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
import es.verdnatura.presentation.view.feature.collection.ItemVO import es.verdnatura.presentation.view.feature.collection.ItemVO
import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapter import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapter
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.sacador.model.* import es.verdnatura.presentation.view.feature.sacador.model.*
@ -58,13 +52,13 @@ class CollectionFragment(
) : BaseFragment<FragmentCollectionBinding, CollectionViewModel>(CollectionViewModel::class) { ) : BaseFragment<FragmentCollectionBinding, CollectionViewModel>(CollectionViewModel::class) {
private lateinit var dataMessageSalix: DataMessageSalix private lateinit var dataMessageSalix: DataMessageSalix
private var user = "" /* private var user = ""
private var password = "" private var password = ""
private var sectorFk = "" private var sectorFk = ""
private var warehouseFk = "" private var warehouseFk = ""
private var SectorDescription = "" private var SectorDescription = ""
private var token = "" private var token = ""
private var voz = "" private var voz = ""*/
private var sales: List<SaleVO> = listOf() private var sales: List<SaleVO> = listOf()
private var saleAdapter: SaleAdapter? = null private var saleAdapter: SaleAdapter? = null
private var lm: LinearLayoutManager? = null private var lm: LinearLayoutManager? = null
@ -120,25 +114,15 @@ class CollectionFragment(
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, SECTORFKDEFAULT).toString()
token = prefs.getString(TOKEN, "").toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
voz = prefs.getString(VOZ, "NO").toString()
mperror = MediaPlayer.create((activity as MainActivity), R.raw.error) mperror = MediaPlayer.create((activity as MainActivity), R.raw.error)
mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok) mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok)
SectorDescription = prefs.getString(SECTORDESCRIP, "Sin Sector").toString()
if ((collection.collectionFk != null) && type.equals(CONTROLADOR)) { if ((collection.collectionFk != null) && type.equals(CONTROLADOR)) {
//sergio: comprueba si viene de la pantalla de controlador //sergio: comprueba si viene de la pantalla de controlador
viewModel.ticket_checkFullyControlled( viewModel.ticket_checkFullyControlled(
user, getData(USER),
password, getData(PASSWORD),
collection.collectionFk, collection.collectionFk,
"ticket_checkFullyControlled" "ticket_checkFullyControlled"
) )
@ -147,10 +131,10 @@ class CollectionFragment(
if (collection.tickets.isEmpty()) { if (collection.tickets.isEmpty()) {
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
user, getData(USER),
password, getData(PASSWORD),
collection.collectionFk, collection.collectionFk,
sectorFk, getData(SECTORFK),
type, type,
"collection_getTickets" "collection_getTickets"
) )
@ -177,7 +161,7 @@ class CollectionFragment(
setEvents() setEvents()
setToolBar() setToolBar()
if (type == SACADOR && voz != "NO") { if (type == SACADOR && getData(VOZ) != "NO") {
setSpeak() setSpeak()
} }
@ -200,20 +184,6 @@ class CollectionFragment(
binding.mainToolbar.toolbarTitle.text = collection.collectionFk binding.mainToolbar.toolbarTitle.text = collection.collectionFk
} }
/* val listIcons: ArrayList<Drawable> = ArrayList()
val iconPrint: Drawable =
resources.getDrawable(R.drawable.ic_print_black_24dp, resources.newTheme())
val iconAdd: Drawable =
resources.getDrawable(R.drawable.ic_playlist_add_black_24dp, resources.newTheme())
val iconFace: Drawable =
resources.getDrawable(R.drawable.face_man_outline, resources.newTheme())
val iconPhone: Drawable =
resources.getDrawable(R.drawable.phone_call, resources.newTheme())
*/
/*val iconSearch: Drawable =
resources.getDrawable(R.drawable.ic_visibility, resources.newTheme())*/
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
val iconPrint = ImageView(context) val iconPrint = ImageView(context)
@ -265,7 +235,8 @@ class CollectionFragment(
binding.splashProgress.visibility=VISIBLE binding.splashProgress.visibility=VISIBLE
viewModel.sip_getExtension(user,password, workerFkFromTicket,"sip_getExtension") viewModel.sip_getExtension(getData(USER),
getData(PASSWORD), workerFkFromTicket,"sip_getExtension")
} }
@ -300,23 +271,10 @@ class CollectionFragment(
binding.scanInput.setOnEditorActionListener { v, actionId, event -> binding.scanInput.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {//ID=0 ACTION_NEXT ID=5 ACTION_UNESPECEFIED) if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {//ID=0 ACTION_NEXT ID=5 ACTION_UNESPECEFIED)
if (!binding.scanInput.text.toString().isNullOrEmpty()) { if (!binding.scanInput.text.toString().isNullOrEmpty()) {
// d("La tecla es " + actionId)
//sergio:para ver si ha marcado dos veces el mismo ticket //sergio:para ver si ha marcado dos veces el mismo ticket
if (binding.scanInput.text!!.length > 13) { binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
var size = binding.scanInput.text!!.length
if (binding.scanInput.text!!.substring((size / 2), size)
.equals(binding.scanInput.text!!.substring(0, size / 2))
) {
binding.scanInput.setText(
binding.scanInput.text!!.substring(
0,
size / 2
)
)
}
}
findSale(binding.scanInput.text.toString()) findSale(binding.scanInput.text.toString())
@ -338,10 +296,10 @@ class CollectionFragment(
// if (type != PRECHECKER) { // if (type != PRECHECKER) {
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
user, getData(USER),
password, getData(PASSWORD),
collection.collectionFk, collection.collectionFk,
sectorFk, getData(SECTORFK),
type, "collection_getTickets" type, "collection_getTickets"
) )
binding.collectionSwipe.isRefreshing = false binding.collectionSwipe.isRefreshing = false
@ -399,7 +357,7 @@ class CollectionFragment(
(activity as MainActivity).messageWithSound( (activity as MainActivity).messageWithSound(
if (it.isError) it.errorMessage else "Baldas guardadas", if (it.isError) it.errorMessage else "Baldas guardadas",
it.isError it.isError,true
) )
}) })
@ -407,14 +365,14 @@ class CollectionFragment(
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
(activity as MainActivity).messageWithSound( (activity as MainActivity).messageWithSound(
if (it.isError) it.errorMessage else "Packing guardado", if (it.isError) it.errorMessage else "Packing guardado",
it.isError it.isError,!it.isError
) )
if (!it.isError) { if (!it.isError) {
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
user, getData(USER),
password, getData(PASSWORD),
collection.collectionFk, collection.collectionFk,
sectorFk, getData(SECTORFK),
type, type,
"collection_getTickets" "collection_getTickets"
) )
@ -426,15 +384,15 @@ class CollectionFragment(
if (it.isError) { if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, true) (activity as MainActivity).messageWithSound(it.errorMessage, true,true)
} else { } else {
(activity as MainActivity).messageWithSound("Previa recogida", false) (activity as MainActivity).messageWithSound("Previa recogida", false,true)
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
user, getData(USER),
password, getData(PASSWORD),
collection.collectionFk, collection.collectionFk,
sectorFk, getData(SECTORFK),
type, type,
"collection_getTickets" "collection_getTickets"
) )
@ -473,10 +431,10 @@ class CollectionFragment(
salePerson = dataMessageSalix.personSale salePerson = dataMessageSalix.personSale
) )
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
user, getData(USER),
password, getData(PASSWORD),
collection.collectionFk, collection.collectionFk,
sectorFk, getData(SECTORFK),
type, "collection_getTickets" type, "collection_getTickets"
) )
@ -519,24 +477,22 @@ class CollectionFragment(
responseMissingTrash.observe(viewLifecycleOwner, Observer { responseMissingTrash.observe(viewLifecycleOwner, Observer {
if (it.isError) { if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true) (activity as MainActivity).messageWithSound(it.errorMessage, isError = true,true)
} else { } else {
missingTrashSuccesful() missingTrashSuccesful()
} //sergio:esto ya estaba } //sergio:esto ya estaba
/* binding.splashProgress.visibility = View.VISIBLE /* binding.splashProgress.visibility = View.VISIBLE
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)*/ viewModel.collectionTicketGet(user,password,collection.collectionFk,getData(SECTORFK))*/
}) })
responseIncQuantity.observe(viewLifecycleOwner, Observer { responseIncQuantity.observe(viewLifecycleOwner, Observer {
if (it.isError) { if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true) (activity as MainActivity).messageWithSound(it.errorMessage, isError = true,true)
/*customDialog.setTitle("Error").setDescription(it.errorMessage) /*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") { .setOkButton("Aceptar") {
customDialog.dismiss() customDialog.dismiss()
@ -544,16 +500,14 @@ class CollectionFragment(
} else { } else {
incresaseSuccesful() incresaseSuccesful()
} }
//sergio:esto ya estaba
/* binding.splashProgress.visibility = View.VISIBLE
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)*/
}) })
responseGetExtensionFromUserId.observe(viewLifecycleOwner, Observer { responseGetExtensionFromUserId.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility=GONE binding.splashProgress.visibility=GONE
if (it.isError) { if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage+"Usuario:"+workerFkFromTicket, isError = true) (activity as MainActivity).messageWithSound(it.errorMessage+"Usuario:"+workerFkFromTicket, isError = true,true)
} else { } else {
@ -589,10 +543,10 @@ class CollectionFragment(
.setKoButton("Revisar") { .setKoButton("Revisar") {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
user, getData(USER),
password, getData(PASSWORD),
it.response, it.response,
sectorFk, getData(SECTORFK),
type, type,
"collection_getTickets" "collection_getTickets"
) )
@ -664,7 +618,7 @@ class CollectionFragment(
d("VERDNATURA:","la cantidad es " + quantity)*/ d("VERDNATURA:","la cantidad es " + quantity)*/
viewModel.sendChekingPresence( viewModel.sendChekingPresence(
token = token, token = getData(TOKEN),
workerId = salePerson, workerId = salePerson,
message = message, "sendChekingPresence" message = message, "sendChekingPresence"
) )
@ -673,7 +627,7 @@ class CollectionFragment(
//CREATE LIST //CREATE LIST
private fun createCollectionList() { private fun createCollectionList() {
state = 0 state = 0
if (type == SACADOR && voz != "NO") { if (type == SACADOR && getData(VOZ) != "NO") {
// initialize() // initialize()
speak("Colección cargada, diga listo para empezar.") speak("Colección cargada, diga listo para empezar.")
} }
@ -775,7 +729,8 @@ class CollectionFragment(
if (binding.splashProgress != null) binding.splashProgress.visibility = if (binding.splashProgress != null) binding.splashProgress.visibility =
View.VISIBLE View.VISIBLE
mistakeSale = sale mistakeSale = sale
viewModel.mistakeType(usuario = user, password = password) viewModel.mistakeType(usuario = getData(USER),
getData(PASSWORD))
} }
} }
}, object : onPackingClickListener { }, object : onPackingClickListener {
@ -841,8 +796,8 @@ class CollectionFragment(
// if (saleVO.ticketFk == txtscan ) { // if (saleVO.ticketFk == txtscan ) {
isOk = true isOk = true
viewModel.saleTracking_add( viewModel.saleTracking_add(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
txtscan, txtscan,
"saleTracking_add" "saleTracking_add"
) )
@ -897,8 +852,8 @@ class CollectionFragment(
if (txtscan.contains("-")) { if (txtscan.contains("-")) {
if (tickets.size > 0) { if (tickets.size > 0) {
viewModel.parking( viewModel.parking(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
ticketFk = tickets[0], ticketFk = tickets[0],
parking = txtscan, parking = txtscan,
"shelvingPark" "shelvingPark"
@ -941,8 +896,8 @@ class CollectionFragment(
if (txtscan.contains("-")) { if (txtscan.contains("-")) {
if (tickets.size > 0) { if (tickets.size > 0) {
viewModel.parking( viewModel.parking(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
ticketFk = tickets[0], ticketFk = tickets[0],
parking = txtscan, parking = txtscan,
"shelvingPark" "shelvingPark"
@ -958,18 +913,18 @@ class CollectionFragment(
// if (type != PRECHECKER) { // if (type != PRECHECKER) {
isMarking = false isMarking = false
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
user, getData(USER),
password, getData(PASSWORD),
txtscan, txtscan,
sectorFk, getData(SECTORFK),
type, type,
"collection_getTickets" "collection_getTickets"
) )
if (type.equals(CONTROLADOR)) { if (type.equals(CONTROLADOR)) {
viewModel.ticket_checkFullyControlled( viewModel.ticket_checkFullyControlled(
user, getData(USER),
password, getData(PASSWORD),
txtscan, txtscan,
"ticket_checkFullyControlled" "ticket_checkFullyControlled"
) )
@ -1026,8 +981,8 @@ class CollectionFragment(
if (txtscan.contains("-")) { if (txtscan.contains("-")) {
tickets.forEach { tickets.forEach {
viewModel.parking( viewModel.parking(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
ticketFk = it, ticketFk = it,
parking = txtscan, parking = txtscan,
"shelvingPark" "shelvingPark"
@ -1067,17 +1022,17 @@ class CollectionFragment(
saleAdapter!!.notifyDataSetChanged() saleAdapter!!.notifyDataSetChanged()
setListPosition(position, false) setListPosition(position, false)
if (type != PRECHECKER) { /* if (type != PRECHECKER) {
saleTrackingReplace(position, newType) saleTrackingReplace(position, newType)
isMarking = true isMarking = true
} }
*/
// sergio: a borrar. Solo para hacer pruebas // sergio
if (type == PRECHECKER) { /* if (type == PRECHECKER) {
saleTrackingReplace(position, newType) saleTrackingReplace(position, newType)
} }*/
saleTrackingReplace(position, newType)
setTotalLines() setTotalLines()
} }
@ -1104,8 +1059,8 @@ class CollectionFragment(
//////Log.i("VERDNATURA:","POSICION $position y el tipo $type") //////Log.i("VERDNATURA:","POSICION $position y el tipo $type")
//////Log.i("VERDNATURA:","El buyfk que no es real es $originalItemScan") //////Log.i("VERDNATURA:","El buyfk que no es real es $originalItemScan")
viewModel.saleTrackingReplace( viewModel.saleTrackingReplace(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
saleFk = sales[position].saleFk, saleFk = sales[position].saleFk,
vIsChecked = if (type == SACADOR) sales[position].isPrepared else if (type == CONTROLADOR ) sales[position].isControlled else if (type=="PRECHECKER") sales[position].isPreControlled else "1", vIsChecked = if (type == SACADOR) sales[position].isPrepared else if (type == CONTROLADOR ) sales[position].isControlled else if (type=="PRECHECKER") sales[position].isPreControlled else "1",
vOriginalQuantity = sales[position].pickedQuantity, vOriginalQuantity = sales[position].pickedQuantity,
@ -1128,8 +1083,8 @@ class CollectionFragment(
setListPosition(position, false) setListPosition(position, false)
if (type != PRECHECKER) { if (type != PRECHECKER) {
viewModel.saleTrackingDel( viewModel.saleTrackingDel(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
saleFk = sales[position].saleFk, saleFk = sales[position].saleFk,
"saleTracking_del" "saleTracking_del"
) )
@ -1158,8 +1113,8 @@ class CollectionFragment(
} }
//Log.i("VERDNATURA:","Aparece para enviar") //Log.i("VERDNATURA:","Aparece para enviar")
viewModel.itemPlacementSupplyAiming( viewModel.itemPlacementSupplyAiming(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
itemFk = sales[position].itemFk, itemFk = sales[position].itemFk,
quantity = quantityGet, quantity = quantityGet,
shelvingFk = sales[position].placements[shelvingPosition].shelving, shelvingFk = sales[position].placements[shelvingPosition].shelving,
@ -1220,9 +1175,8 @@ class CollectionFragment(
itemShelvingFkStored = itemShelvingFk itemShelvingFkStored = itemShelvingFk
if (binding.splashProgress != null) binding.splashProgress.visibility = if (binding.splashProgress != null) binding.splashProgress.visibility =
View.VISIBLE View.VISIBLE
viewModel.getIdFromCode( viewModel.getIdFromCode(usuario = getData(USER),
usuario = user, password = getData(PASSWORD),
password = password,
code = customDialogList.getValueTwo(), "barcodeToItem" code = customDialogList.getValueTwo(), "barcodeToItem"
) )
customDialogList.dismiss() customDialogList.dismiss()
@ -1291,8 +1245,8 @@ class CollectionFragment(
itemShelvingFkStored = itemShelvingFk itemShelvingFkStored = itemShelvingFk
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getIdFromCode( viewModel.getIdFromCode(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
code = customDialogList.getValueTwo(), "barcodeToItem" code = customDialogList.getValueTwo(), "barcodeToItem"
) )
customDialogList.dismiss() customDialogList.dismiss()
@ -1355,10 +1309,10 @@ class CollectionFragment(
// SalesSorter() // SalesSorter()
// Log.i("VERDNATURA::","Lanzamos collection para que refresque adaptador y ordene") // Log.i("VERDNATURA::","Lanzamos collection para que refresque adaptador y ordene")
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
user, getData(USER),
password, getData(PASSWORD),
collection.collectionFk, collection.collectionFk,
sectorFk, getData(SECTORFK),
type, type,
"collection_getTickets" "collection_getTickets"
) )
@ -1405,8 +1359,8 @@ class CollectionFragment(
} }
viewModel.itemShelvingSaleSupplyAdd( viewModel.itemShelvingSaleSupplyAdd(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
itemShelvingFk = itemShelvingFk, itemShelvingFk = itemShelvingFk,
saleFk = sales[storedPosition].saleFk, saleFk = sales[storedPosition].saleFk,
quantity = if (quantity != "0") quantity else customDialogList.getValue(), quantity = if (quantity != "0") quantity else customDialogList.getValue(),
@ -1443,15 +1397,15 @@ class CollectionFragment(
//OPTIONS //OPTIONS
private fun print() { private fun print() {
viewModel.collectionStickerPrint( viewModel.collectionStickerPrint(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
collectionFk = collection.collectionFk, collectionFk = collection.collectionFk,
sectorFk = sectorFk, sectorFk = getData(SECTORFK),
"collectionStickerPrint" "collectionStickerPrint"
) )
(getString(R.string.Imprimiendo) + " por " + SectorDescription).toast(requireContext()) (getString(R.string.Imprimiendo) + " por " + getData(SECTORDESCRIP)).toast(requireContext())
} }
private fun addItem() { private fun addItem() {
@ -1485,12 +1439,12 @@ class CollectionFragment(
) )
viewModel.collectionAddItem( viewModel.collectionAddItem(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
itemFk = customDialogList.getValue(), itemFk = customDialogList.getValue(),
ticketFk = ticketSelected, ticketFk = ticketSelected,
quantityFk = customDialogList.getValueTwo(), quantityFk = customDialogList.getValueTwo(),
warehouseFk = warehouseFk, warehouseFk = getData(WAREHOUSEFK),
callFunction = "collection_addItem" callFunction = "collection_addItem"
) )
@ -1540,12 +1494,12 @@ class CollectionFragment(
) )
viewModel.collectionAddItem( viewModel.collectionAddItem(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
itemFk = customDialogList.getValue(), itemFk = customDialogList.getValue(),
ticketFk = ticketSelected, ticketFk = ticketSelected,
quantityFk = customDialogList.getValueTwo(), quantityFk = customDialogList.getValueTwo(),
warehouseFk = warehouseFk, warehouseFk = getData(WAREHOUSEFK),
callFunction = "collection_addItem" callFunction = "collection_addItem"
) )
scanRequest() scanRequest()
@ -1672,14 +1626,15 @@ class CollectionFragment(
//showBottomNavigation(View.VISIBLE) //showBottomNavigation(View.VISIBLE)
//sergio: se quita porque se realiza desde triggers //sergio: se quita porque se realiza desde triggers
//changeTicketState()
changeTicketState()
} }
} }
private fun ticketCollection_setUsedShelves() { private fun ticketCollection_setUsedShelves() {
if (type.equals("CHECKER") && (isMarking && SectorDescription.uppercase() != "ALGEMESI V") if (type.equals("CHECKER") && (isMarking && getData(SECTORDESCRIP).uppercase() != "ALGEMESI V")
) { ) {
@ -1690,8 +1645,8 @@ class CollectionFragment(
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.ticketCollection_setUsedShelves( viewModel.ticketCollection_setUsedShelves(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
ticketFk = collection.collectionFk, ticketFk = collection.collectionFk,
usedShelves = customDialogInput.getValue(), usedShelves = customDialogInput.getValue(),
"ticketCollection_setUsedShelves" "ticketCollection_setUsedShelves"
@ -1722,8 +1677,8 @@ class CollectionFragment(
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.ticketCollection_setUsedShelves( viewModel.ticketCollection_setUsedShelves(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
ticketFk = collection.collectionFk, ticketFk = collection.collectionFk,
usedShelves = customDialogInput.getValue(), usedShelves = customDialogInput.getValue(),
"ticketCollection_setUsedShelves" "ticketCollection_setUsedShelves"
@ -1756,8 +1711,8 @@ class CollectionFragment(
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.item_updatePackingShelve( viewModel.item_updatePackingShelve(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
vSelf = itemFk, vSelf = itemFk,
vPacking = customDialogInput.getValue(), vPacking = customDialogInput.getValue(),
"item_updatePackingShelve" "item_updatePackingShelve"
@ -1788,8 +1743,8 @@ class CollectionFragment(
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.ticketCollection_setUsedShelves( viewModel.ticketCollection_setUsedShelves(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
ticketFk = collection.collectionFk, ticketFk = collection.collectionFk,
usedShelves = customDialogInput.getValue(), usedShelves = customDialogInput.getValue(),
"ticketCollection_setUsedShelves" "ticketCollection_setUsedShelves"
@ -1889,8 +1844,8 @@ class CollectionFragment(
} catch (e: Exception) { } catch (e: Exception) {
} }
viewModel.saleMove( viewModel.saleMove(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
saleFk = sales[position].saleFk, saleFk = sales[position].saleFk,
quantity = totalQuantity.toString(), quantity = totalQuantity.toString(),
originalQuantity = sales[position].quantity, originalQuantity = sales[position].quantity,
@ -1910,7 +1865,7 @@ class CollectionFragment(
val message = val message =
"Se ha enviado a Split el articulo " + sales[position].itemFk + " del ticket " + ticket "Se ha enviado a Split el articulo " + sales[position].itemFk + " del ticket " + ticket
viewModel.sendChekingPresence( viewModel.sendChekingPresence(
token = token, token = getData(TOKEN),
workerId = sales[position].salePersonFk, workerId = sales[position].salePersonFk,
message = message, "sendChekingPresence" message = message, "sendChekingPresence"
) )
@ -1933,11 +1888,11 @@ class CollectionFragment(
} }
viewModel.collectionMissingTrash( viewModel.collectionMissingTrash(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
saleFk = sales[position].saleFk, saleFk = sales[position].saleFk,
quantity = totalQuantity.toString(), quantity = totalQuantity.toString(),
warehouseFk = warehouseFk, warehouseFk = getData(WAREHOUSEFK),
type = typeCollectionTrashMissingReject, type = typeCollectionTrashMissingReject,
originalQuantity = quantity, originalQuantity = quantity,
callFunction = "collectionMissingTrash" callFunction = "collectionMissingTrash"
@ -2101,10 +2056,10 @@ class CollectionFragment(
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
user, getData(USER),
password, getData(PASSWORD),
collection.collectionFk, collection.collectionFk,
sectorFk, getData(SECTORFK),
type, type,
"collection_getTickets" "collection_getTickets"
) )
@ -2147,7 +2102,7 @@ class CollectionFragment(
private fun sendSalixMessageNew(message: String, workerId: String) { private fun sendSalixMessageNew(message: String, workerId: String) {
viewModel.sendChekingPresence( viewModel.sendChekingPresence(
token = token, token = getData(TOKEN),
workerId = workerId, workerId = workerId,
message = message, message = message,
"sendChekingPresence" "sendChekingPresence"
@ -2159,8 +2114,8 @@ class CollectionFragment(
quantityIncrease = quantity quantityIncrease = quantity
viewModel.collectionIncreaseQuantity( viewModel.collectionIncreaseQuantity(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
saleFk = sales[position].saleFk, saleFk = sales[position].saleFk,
quantity = quantity, "collection_increaseQuantity" quantity = quantity, "collection_increaseQuantity"
) )
@ -2169,35 +2124,37 @@ class CollectionFragment(
} }
//ESTADOS //ESTADOS
/* private fun changeTicketState() { private fun changeTicketState() {
if (type == CONTROLADOR) { if (type == CONTROLADOR) {
tickets.forEach { tickets.forEach {
viewModel.collectionUpdateState( viewModel.ticket_setState(
usuario = user, usuario=getData(USER),
password = password, password = getData(PASSWORD),
collectionFk = it, ticketFk = it,
state = CHECKED,"collection_updateState" state = "CHECKED",
callFunction = "ticket_setState"
) )
} }
} else if (type == SACADOR) { } else if (type == SACADOR) {
tickets.forEach { tickets.forEach {
viewModel.collectionUpdateState( viewModel.ticket_setState(
usuario = user, usuario=getData(USER),
password = password, password = getData(PASSWORD),
collectionFk = it, ticketFk = it,
state = PREPARED,"collection_updateState" state = "PREPARED",
callFunction = "ticket_setState"
) )
} }
} }
}*/ }
private fun changeInitTicketState() { /* private fun changeInitTicketState() {
if (type == CONTROLADOR) { if (type == CONTROLADOR) {
tickets.forEach { tickets.forEach {
viewModel.collectionUpdateState( viewModel.collectionUpdateState(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
collectionFk = it, collectionFk = it,
state = ON_CHECKING, "collection_updateState" state = ON_CHECKING, "collection_updateState"
) )
@ -2205,14 +2162,14 @@ class CollectionFragment(
} else if (type == SACADOR) { } else if (type == SACADOR) {
tickets.forEach { tickets.forEach {
viewModel.collectionUpdateState( viewModel.collectionUpdateState(
usuario = user, getData(USER),
password = password, getData(PASSWORD),
collectionFk = it, collectionFk = it,
state = ON_PREPARATION, "collection_updateState" state = ON_PREPARATION, "collection_updateState"
) )
} }
} }
} }*/
//OTROS //OTROS
private fun showScanner(index: Int, sale: SaleVO) { private fun showScanner(index: Int, sale: SaleVO) {
@ -2275,9 +2232,8 @@ class CollectionFragment(
override fun onBarcodeRowClickListener(item: BarcodeVO) { override fun onBarcodeRowClickListener(item: BarcodeVO) {
list.forEach { list.forEach {
if (it.description == item.code) { if (it.description == item.code) {
viewModel.saleMistakeAdd( viewModel.saleMistakeAdd(usuario = getData(USER),
usuario = user, password = getData(PASSWORD),
password = password,
vSaleFk = mistakeSale?.saleFk!!, vSaleFk = mistakeSale?.saleFk!!,
vUserFk = mistakeSale?.workerFk!!, vUserFk = mistakeSale?.workerFk!!,
vTypeFk = it.id, "saleMistake_Add" vTypeFk = it.id, "saleMistake_Add"

View File

@ -635,17 +635,17 @@ class CollectionViewModel(context: Context) : BaseViewModel()
}) })
} }
fun collectionUpdateState( fun ticket_setState(
usuario: String, usuario: String,
password: String, password: String,
collectionFk: String, ticketFk: String,
state: String,callFunction:String state: String,callFunction:String
) )
{ {
getSacadorControladorUserCase.collectionUpdateState(usuario, password, collectionFk, state) getSacadorControladorUserCase.ticket_setState(usuario, password, ticketFk, state)
.enqueue(object : Callback<String> .enqueue(object : Callback<Unit>
{ {
override fun onFailure(call: Call<String>, t: Throwable) override fun onFailure(call: Call<Unit>, t: Throwable)
{ {
_response.value = ResponseItemVO( _response.value = ResponseItemVO(
isError = true, isError = true,
@ -653,9 +653,9 @@ class CollectionViewModel(context: Context) : BaseViewModel()
) )
} }
override fun onResponse(call: Call<String>, response: Response<String>) override fun onResponse(call: Call<Unit>, response: Response<Unit>)
{ {
if (response.body() == null) if (!response.isSuccessful)
{ {
_response.value = ResponseItemVO( _response.value = ResponseItemVO(
isError = true, isError = true,
@ -664,7 +664,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
} else } else
{ {
_response.value = _response.value =
ResponseItemVO(isError = false, response = response.body()!!) ResponseItemVO(isError = false, response = "Cambiado estado")
} }
} }
}) })
@ -725,6 +725,15 @@ class CollectionViewModel(context: Context) : BaseViewModel()
override fun onResponse(call: Call<String>, response: Response<String>) override fun onResponse(call: Call<String>, response: Response<String>)
{ {
/* if (response.isSuccessful){
_responseIncQuantity.value =
ResponseItemVO(isError = false, response = response.body()!!)
}else{
_responseIncQuantity.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
}*/
if (response.body() == null) if (response.body() == null)
{ {
_responseIncQuantity.value = ResponseItemVO( _responseIncQuantity.value = ResponseItemVO(
@ -754,8 +763,8 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{ {
_responseSalixMessage.value = ResponseItemVO( _responseSalixMessage.value = ResponseItemVO(
isError = true, isError = true,
errorMessage = "Error en la llamada $calledFunction al enviar mensaje rocket." + getMessageFromResponse( errorMessage = "Error en la llamada $calledFunction al enviar mensaje rocket." + getMessageFromAllResponse(
response.message() nameofFunction(this),response.message()
)) ))
//Log.i("Salix","Mensaje enviado a salix") //Log.i("Salix","Mensaje enviado a salix")
} }
@ -764,7 +773,11 @@ class CollectionViewModel(context: Context) : BaseViewModel()
override fun onFailure(call: Call<Boolean>, t: Throwable) override fun onFailure(call: Call<Boolean>, t: Throwable)
{ {
/*_responseSalixMessage.value = ResponseItemVO(
isError = true,
errorMessage = "Error en la llamada $calledFunction al enviar mensaje rocket." + getMessageFromAllResponse(
nameofFunction(this),t.message!!))
*/
//Log.i("Salix Error",""+t.message) //Log.i("Salix Error",""+t.message)
} }
}) })

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.collection.fragment package es.verdnatura.presentation.view.feature.collection.fragment
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
@ -15,34 +14,21 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentCollectionBinding import es.verdnatura.databinding.FragmentCollectionBinding
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
import es.verdnatura.domain.ConstAndValues.PRECHECKER
import es.verdnatura.domain.ConstAndValues.SACADOR
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.VERTICKET import es.verdnatura.domain.ConstAndValues.VERTICKET
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapter import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapter
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
class CollectionShowTicketFragment( class CollectionShowTicketFragment(
var collection: CollectionVO = CollectionVO(), var collection: CollectionVO = CollectionVO(),
var type: String = VERTICKET var type: String = ""
) : BaseFragment<FragmentCollectionBinding, CollectionViewModel>(CollectionViewModel::class) { ) : BaseFragment<FragmentCollectionBinding, CollectionViewModel>(CollectionViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var SectorDescription = ""
private var token = ""
private var voz = ""
private var sales: List<SaleVO> = listOf() private var sales: List<SaleVO> = listOf()
private var saleAdapter: SaleAdapter? = null private var saleAdapter: SaleAdapter? = null
private var lm: LinearLayoutManager? = null private var lm: LinearLayoutManager? = null
@ -65,20 +51,12 @@ class CollectionShowTicketFragment(
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, SECTORFKDEFAULT).toString()
token = prefs.getString(TOKEN, "").toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
voz = prefs.getString(VOZ, "NO").toString()
SectorDescription = prefs.getString(SECTORDESCRIP, "Sin Sector").toString()
if (collection.tickets.isEmpty()) { if (collection.tickets.isEmpty()) {
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
user, getData(USER),
password, getData(PASSWORD),
collection.collectionFk, collection.collectionFk,
sectorFk, getData(SECTORFK),
type, type,
"collection_getTickets" "collection_getTickets"
) )
@ -104,13 +82,6 @@ class CollectionShowTicketFragment(
private fun setToolBarIcon() { private fun setToolBarIcon() {
binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
/*val listIcons: ArrayList<Drawable> = ArrayList()
val iconPrint: Drawable =
resources.getDrawable(R.drawable.ic_print_black_24dp, resources.newTheme())
listIcons.add(iconPrint)
*/
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
val iconPrint = ImageView(context) val iconPrint = ImageView(context)
iconPrint.setImageResource(R.drawable.ic_print_black_24dp) iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
@ -135,14 +106,14 @@ class CollectionShowTicketFragment(
private fun print() { private fun print() {
viewModel.collectionStickerPrint( viewModel.collectionStickerPrint(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
collectionFk = collection.collectionFk, collectionFk = collection.collectionFk,
sectorFk = sectorFk, sectorFk = getData(SECTORFK),
"collectionStickerPrint" "collectionStickerPrint"
) )
(getString(R.string.Imprimiendo) + " por " + SectorDescription).toast(requireContext()) (getString(R.string.Imprimiendo) + " por " + getData(SECTORDESCRIP)).toast(requireContext())
} }
private fun setEvents() { private fun setEvents() {
@ -156,10 +127,10 @@ class CollectionShowTicketFragment(
if (!binding.scanInput.text.toString().isNullOrEmpty()) { if (!binding.scanInput.text.toString().isNullOrEmpty()) {
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
user, getData(USER),
password, getData(PASSWORD),
binding.scanInput.text.toString(), binding.scanInput.text.toString(),
sectorFk, getData(SECTORFK),
type, "collection_getTickets" type, "collection_getTickets"
) )
@ -181,10 +152,10 @@ class CollectionShowTicketFragment(
binding.collectionSwipe.isRefreshing = false binding.collectionSwipe.isRefreshing = false
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
user, getData(USER),
password, getData(PASSWORD),
collection.collectionFk, collection.collectionFk,
sectorFk, getData(SECTORFK),
type, "collection_getTickets" type, "collection_getTickets"
) )
binding.collectionSwipe.isRefreshing = false binding.collectionSwipe.isRefreshing = false
@ -215,11 +186,9 @@ class CollectionShowTicketFragment(
binding.mainToolbar.toolbarSubtitle.text = "0/0" binding.mainToolbar.toolbarSubtitle.text = "0/0"
} }
} else { } else {
customDialog.setTitle("Error").setDescription(it.errorMessage) (activity as MainActivity).messageWithSound(it.errorMessage,it.isError,false)
.setOkButton("Aceptar") { if (activity != null) requireActivity().onBackPressed()
customDialog.dismiss()
if (activity != null) requireActivity().onBackPressed()
}.show()
} }
}) })

View File

@ -1,40 +1,25 @@
package es.verdnatura.presentation.view.feature.controlador.fragment package es.verdnatura.presentation.view.feature.controlador.fragment
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle
import android.util.Log
import android.view.View import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentControladorBinding import es.verdnatura.databinding.FragmentControladorBinding
import es.verdnatura.domain.ConstAndValues import es.verdnatura.domain.ConstAndValues
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnCollectionSelectedListener import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
/*
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_controlador.*
import kotlinx.android.synthetic.main.toolbar.*
*/
class ControladorFragment : class ControladorFragment :
BaseFragment<FragmentControladorBinding, ControladorViewModel>(ControladorViewModel::class) { BaseFragment<FragmentControladorBinding, ControladorViewModel>(ControladorViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var goBack: Boolean = false private var goBack: Boolean = false
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
override fun getLayoutId(): Int = R.layout.fragment_controlador override fun getLayoutId(): Int = R.layout.fragment_controlador
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var type = ""
companion object { companion object {
fun newInstance() = ControladorFragment() fun newInstance() = ControladorFragment()
@ -61,18 +46,6 @@ class ControladorFragment :
} }
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, 60).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
type = ConstAndValues.CONTROLADOR
super.onCreate(savedInstanceState)
}
private fun setEvents() { private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed() requireActivity().onBackPressed()
@ -87,23 +60,17 @@ class ControladorFragment :
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
//sergio: para ver si ha marcado dos veces el mismo ticket //sergio: para ver si ha marcado dos veces el mismo ticket. El laser falla
if (binding.scanInput.text!!.length > 13) { binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
var size = binding.scanInput.text!!.length
if (binding.scanInput.text!!.substring((size / 2), size).equals(binding.scanInput.text!!.substring( 0,size / 2))){
binding.scanInput.setText(binding.scanInput.text!!.substring(0, size / 2))
}
}
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
sectorFk = sectorFk, sectorFk = getData(SECTORFK),
collectionFk = binding.scanInput.text.toString(), collectionFk = binding.scanInput.text.toString(),
type = type, callFunction = "collection_getTickets" type = ConstAndValues.CONTROLADOR, callFunction = "collection_getTickets"
) )
// viewModel.ticket_checkControlled(user,password,scan_input.text.toString())
} }
binding.scanInput.setText("") binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput) (activity as MainActivity).hideKeyboard(binding.scanInput)
@ -134,7 +101,6 @@ class ControladorFragment :
} }
private fun navigateToCollectionList(collection: CollectionVO) { private fun navigateToCollectionList(collection: CollectionVO) {
////Log.i("VERDNATURA:","vamos a oncolecctionSelected ${collection.isError}")
onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.CONTROLADOR) onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.CONTROLADOR)
} }

View File

@ -1,12 +1,10 @@
package es.verdnatura.presentation.view.feature.controlador.fragment package es.verdnatura.presentation.view.feature.controlador.fragment
import android.content.Context import android.content.Context
import android.util.Log
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetSacadorControladorUserCase import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO

View File

@ -2,38 +2,20 @@ package es.verdnatura.presentation.view.feature.controlador.fragment
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences
import android.net.Uri import android.net.Uri
import android.os.Bundle
import android.webkit.WebChromeClient import android.webkit.WebChromeClient
import androidx.lifecycle.Observer
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentWebBinding import es.verdnatura.databinding.FragmentWebBinding
import es.verdnatura.domain.ConstAndValues
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
/*import kotlinx.android.synthetic.main.fragment_controlador.*
import kotlinx.android.synthetic.main.toolbar.*
import kotlinx.android.synthetic.main.fragment_web.**/
class WebFragment( class WebFragment(
var entryPoint: String = "" var entryPoint: String = ""
) : BaseFragment<FragmentWebBinding, ControladorViewModel>(ControladorViewModel::class) { ) : BaseFragment<FragmentWebBinding, ControladorViewModel>(ControladorViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var goBack: Boolean = false
override fun getLayoutId(): Int = R.layout.fragment_web override fun getLayoutId(): Int = R.layout.fragment_web
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var type = ""
private var itemscaned = ""
//private lateinit var webView: WebViewClient
companion object { companion object {
fun newInstance(entryPoint: String) = WebFragment(entryPoint) fun newInstance(entryPoint: String) = WebFragment(entryPoint)
@ -41,20 +23,17 @@ class WebFragment(
override fun init() { override fun init() {
// splash_progress.visibility = View.GONE
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
setToolbar() setToolbar()
//setEvents()
setWeb() setWeb()
super.init() super.init()
} }
private fun setWeb() { private fun setWeb() {
// webView = WebViewClient()
binding.webView.setWebChromeClient (WebChromeClient()) binding.webView.setWebChromeClient (WebChromeClient())
// webView.setWebViewClient (wvClient);
binding.webView.getSettings (). setJavaScriptEnabled (true) binding.webView.getSettings (). setJavaScriptEnabled (true)
// sergio:deprecated // sergio:deprecated
//webView.getSettings (). setPluginState (WebSettings.PluginState.ON) //webView.getSettings (). setPluginState (WebSettings.PluginState.ON)
@ -76,12 +55,6 @@ class WebFragment(
openURL.data = Uri.parse("https://salix.verdnatura.es/#!/item/index") openURL.data = Uri.parse("https://salix.verdnatura.es/#!/item/index")
startActivity(openURL) startActivity(openURL)
//webView.loadUrl("http://www.google.com")
//webView.loadUrl("https://test-salix.verdnatura.es/#!/ticket/3271614/tracking/index")
/* webView.loadUrl("https://test-salix.verdnatura.es/")
webView.settings.javaScriptEnabled = true
webView.settings.setSupportZoom(true)*/
} }
private fun setToolbar() { private fun setToolbar() {
@ -89,74 +62,8 @@ class WebFragment(
binding.mainToolbar.toolbarTitle.text = entryPoint binding.mainToolbar.toolbarTitle.text = entryPoint
} }
override fun onPause() {
goBack = true
super.onPause()
}
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
type = ConstAndValues.PRECHECKER
super.onCreate(savedInstanceState)
}
/* private fun setEvents() {
backButton.setOnClickListener {
requireActivity().onBackPressed()
}
scan_input.requestFocus()
scan_input.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
goBack = false;
if (!scan_input.text.isNullOrEmpty()) {
splash_progress.visibility = View.VISIBLE
viewModel.qr_getCall(user, password, scan_input.text.toString())
itemscaned = scan_input.text.toString()
}
}
scan_input.setText("")
(activity as MainActivity).hideKeyboard(scan_input)
return@setOnEditorActionListener true
}
false
}*/
/*
override fun observeViewModel() {
with(viewModel) {
response.observe(viewLifecycleOwner, Observer {
//splash_progress.visibility = View.GONE
if (it.isError) {
// getMessageFromJSON(it.errorMessage)
customDialog.setTitle("Error").setDescription( it.errorMessage+ " "+itemscaned)
.setOkButton("Aceptar") {
customDialog.dismiss()
}.show()
} else {
customDialog.setTitle("Mensaje")
.setDescription("Operación " + itemscaned + ". " + it.response)
.setOkButton("Aceptar") {
customDialog.dismiss()
binding.mainToolbar.backButton.performClick()
}.show()
}
})
}
}
*/
} }

View File

@ -1,11 +1,8 @@
package es.verdnatura.presentation.view.feature.controlvehiculo.fragment package es.verdnatura.presentation.view.feature.controlvehiculo.fragment
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build import android.os.Build
import android.os.Bundle
import android.util.Log
import android.util.TypedValue import android.util.TypedValue
import android.view.View.* import android.view.View.*
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
@ -14,28 +11,16 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentVehiclecontrolBinding import es.verdnatura.databinding.FragmentVehiclecontrolBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.component.CustomDialogThreeButtons import es.verdnatura.presentation.view.component.CustomDialogThreeButtons
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoFragment import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoFragment
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment
/*import kotlinx.android.synthetic.main.component_custom_three_dialog.*
import kotlinx.android.synthetic.main.fragment_collection.*
import kotlinx.android.synthetic.main.fragment_controlador.*
import kotlinx.android.synthetic.main.fragment_controlador.binding.scanInput
import kotlinx.android.synthetic.main.fragment_controlador.splash_progress
import kotlinx.android.synthetic.main.fragment_login.*
import kotlinx.android.synthetic.main.fragment_sacador.*
import kotlinx.android.synthetic.main.toolbar.**/
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
@ -45,18 +30,11 @@ class ControlVehiculoFragment(
ControlVehiculoViewModel::class ControlVehiculoViewModel::class
) { ) {
private var user = ""
private var userFk = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var goBack: Boolean = false private var goBack: Boolean = false
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
override fun getLayoutId(): Int = R.layout.fragment_vehiclecontrol override fun getLayoutId(): Int = R.layout.fragment_vehiclecontrol
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var isWorkedTimed = "UNREGISTERED" private var isWorkedTimed = "UNREGISTERED"
private lateinit var customDialogList: CustomDialogList
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogThreeButtons: CustomDialogThreeButtons private lateinit var customDialogThreeButtons: CustomDialogThreeButtons
@ -72,7 +50,6 @@ class ControlVehiculoFragment(
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext())
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
customDialogThreeButtons = CustomDialogThreeButtons(requireContext()) customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
goBack = false goBack = false
@ -108,11 +85,6 @@ class ControlVehiculoFragment(
binding.mainToolbar.toolbarTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13F) binding.mainToolbar.toolbarTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13F)
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
/* val iconHistory: Drawable =
resources.getDrawable(R.drawable.ic_history_black_24dp, resources.newTheme())
val iconVehicleIn: Drawable = resources.getDrawable(R.drawable.car, resources.newTheme())
val iconVehicleOut: Drawable =
resources.getDrawable(R.drawable.car_off, resources.newTheme())*/
val iconHistory = ImageView(context) val iconHistory = ImageView(context)
iconHistory.setImageResource(R.drawable.ic_history_black_24dp) iconHistory.setImageResource(R.drawable.ic_history_black_24dp)
val iconVehicleIn = ImageView(context) val iconVehicleIn = ImageView(context)
@ -129,9 +101,25 @@ class ControlVehiculoFragment(
} }
when (direction){
"OUT"-> {
listIcons.remove(iconVehicleIn)
listIcons.add(iconVehicleOut)
listIcons.add(iconHistory)
}
"IN"->{
listIcons.remove(iconVehicleOut)
listIcons.add(iconVehicleIn)
listIcons.add(iconHistory)
}
"OUT"->{
listIcons.remove(iconVehicleOut)
listIcons.remove(iconVehicleIn)
listIcons.add(iconHistory)
}
}
/* if (direction.equals("OUT")) {
if (direction.equals("OUT")) {
listIcons.remove(iconVehicleIn) listIcons.remove(iconVehicleIn)
listIcons.add(iconVehicleOut) listIcons.add(iconVehicleOut)
listIcons.add(iconHistory) listIcons.add(iconHistory)
@ -145,7 +133,7 @@ class ControlVehiculoFragment(
listIcons.remove(iconVehicleOut) listIcons.remove(iconVehicleOut)
listIcons.remove(iconVehicleIn) listIcons.remove(iconVehicleIn)
listIcons.add(iconHistory) listIcons.add(iconHistory)
} }*/
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener { binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
@ -156,17 +144,6 @@ class ControlVehiculoFragment(
iconVehicleIn.drawable-> showScanner("Escanea matrícula del vehículo", "IN") iconVehicleIn.drawable-> showScanner("Escanea matrícula del vehículo", "IN")
iconVehicleOut.drawable-> showScanner("Escanea matrícula para dejar vehículo", "OUT") iconVehicleOut.drawable-> showScanner("Escanea matrícula para dejar vehículo", "OUT")
} }
/* if (item == iconHistory.drawable) {
showScanner("Escanea matrícula para ver histórico", "HISTORY")
}
if (item == iconVehicleIn.drawable) {
showScanner("Escanea matrícula del vehículo", "IN")
}
if (item == iconVehicleOut.drawable) {
showScanner("Escanea matrícula para dejar vehículo", "OUT")
}*/
} }
}) })
binding.mainToolbar.toolbarIcons.layoutManager = binding.mainToolbar.toolbarIcons.layoutManager =
@ -197,8 +174,7 @@ class ControlVehiculoFragment(
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!customDialogInput.getValue().isNullOrEmpty()) { if (!customDialogInput.getValue().isNullOrEmpty()) {
// //Log.i("VERDNATURA:", "El valor es ${customDialogInput.getValue()}")
// "$description ${customDialogInput.getValue()} OK".toast(requireContext())
insertControlTimeVehicle(customDialogInput.getValue(), action) insertControlTimeVehicle(customDialogInput.getValue(), action)
} }
customDialogInput.setValue("") customDialogInput.setValue("")
@ -216,7 +192,7 @@ class ControlVehiculoFragment(
if (!goBack) { if (!goBack) {
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.workerMachinery_isRegistered(user, password,"workerMachinery_isRegistered") viewModel.workerMachinery_isRegistered(getData(USER),getData(PASSWORD),"workerMachinery_isRegistered")
} }
} }
@ -229,10 +205,10 @@ class ControlVehiculoFragment(
) )
} else if (direction.equals("IN")) { } else if (direction.equals("IN")) {
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.machineWorker_add(user, password, plateNumber,"machineWorker_add") viewModel.machineWorker_add(getData(USER),getData(PASSWORD), plateNumber,"machineWorker_add")
} else if (direction.equals("OUT")) { } else if (direction.equals("OUT")) {
viewModel.machineWorker_update(user, password, plateNumber,"machineWorker_update") viewModel.machineWorker_update(getData(USER),getData(PASSWORD), plateNumber,"machineWorker_update")
} else if (direction.equals("")) { } else if (direction.equals("")) {
(activity as MainActivity).openFragmentPickers() (activity as MainActivity).openFragmentPickers()
@ -254,15 +230,6 @@ class ControlVehiculoFragment(
} }
} }
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
userFk = prefs.getString(USERFK, "0").toString()
super.onCreate(savedInstanceState)
}
private fun setEvents() { private fun setEvents() {
@ -358,10 +325,6 @@ class ControlVehiculoFragment(
with(viewModel) { with(viewModel) {
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
responseinsert.observe(viewLifecycleOwner, Observer { responseinsert.observe(viewLifecycleOwner, Observer {
Log.i(
"VERDNATURA",
"Respuesta call vehicle_insert en el viewmodel es : ${it.response}"
)
if (it.isError) { if (it.isError) {

View File

@ -1,20 +1,13 @@
package es.verdnatura.presentation.view.feature.controlvehiculo.fragment package es.verdnatura.presentation.view.feature.controlvehiculo.fragment
import android.content.SharedPreferences
import android.os.Bundle
import android.view.View.* import android.view.View.*
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentVehiclecontrolUserBinding import es.verdnatura.databinding.FragmentVehiclecontrolUserBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.loadUrl import es.verdnatura.presentation.common.loadUrl
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
/*import kotlinx.android.synthetic.main.fragment_controlador.splash_progress
import kotlinx.android.synthetic.main.fragment_vehiclecontrol_user.*
import kotlinx.android.synthetic.main.toolbar.**/
class ControlVehiculoUsuarioFragment( class ControlVehiculoUsuarioFragment(
var vUserFK: String = "" var vUserFK: String = ""
@ -22,14 +15,8 @@ class ControlVehiculoUsuarioFragment(
ControlVehiculoViewModel::class ControlVehiculoViewModel::class
) { ) {
private var user = ""
private var userFk = "" private var userFk = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var token = ""
private var goBack: Boolean = false private var goBack: Boolean = false
private var android_id: String = ""
override fun getLayoutId(): Int = R.layout.fragment_vehiclecontrol_user override fun getLayoutId(): Int = R.layout.fragment_vehiclecontrol_user
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
@ -44,7 +31,6 @@ class ControlVehiculoUsuarioFragment(
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
setEvents() setEvents()
setControlVehicleUser() setControlVehicleUser()
super.init() super.init()
} }
@ -54,19 +40,15 @@ class ControlVehiculoUsuarioFragment(
} }
private fun setControlVehicleUser() { private fun setControlVehicleUser() {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString() userFk=getData(USERFK)
password = prefs.getString(PASSWORD, "").toString()
token = prefs.getString(TOKEN, "").toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
android_id = getANDROIDID()
if (userFk.equals(vUserFK)) { if (userFk.equals(vUserFK)) {
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.machine_getWorkerPlate(user, password,"machine_getWorkerPlate") viewModel.machine_getWorkerPlate(getData(USER),getData(PASSWORD),"machine_getWorkerPlate")
viewModel.deviceProduction_getnameDevice(user, password, android_id,"deviceProduction_getnameDevice") viewModel.deviceProduction_getnameDevice(getData(USER),getData(PASSWORD), getData(ANDROID_ID),"deviceProduction_getnameDevice")
viewModel.deviceProductionUser_getWorker(user, password, android_id,"deviceProductionUser_getWorker") viewModel.deviceProductionUser_getWorker(getData(USER),getData(PASSWORD), getData(ANDROID_ID),"deviceProductionUser_getWorker")
} else { } else {
userFk = vUserFK userFk = vUserFK
@ -76,27 +58,17 @@ class ControlVehiculoUsuarioFragment(
binding.userInformation.setOnClickListener({binding.mainToolbar.backButton.performClick()}) binding.userInformation.setOnClickListener({binding.mainToolbar.backButton.performClick()})
} }
binding.userImage.loadUrl("https://salix.verdnatura.es/api/Images/user/160x160/$userFk/download?access_token=$token") binding.userImage.loadUrl("https://salix.verdnatura.es/api/Images/user/160x160/$userFk/download?access_token=${getData(TOKEN)}")
viewModel.machine_getWorkerPlate(user, password,"machine_getWorkerPlate") viewModel.machine_getWorkerPlate(getData(USER),getData(PASSWORD),"machine_getWorkerPlate")
binding.nameVehiclecontrol.text = user binding.nameVehiclecontrol.text = getData(USER)
binding.registeredVehiclecontrol.text = "" binding.registeredVehiclecontrol.text = ""
binding.deviceName.text = "" binding.deviceName.text = ""
binding.assignedDevicename.text = "" binding.assignedDevicename.text = ""
} }
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
userFk = prefs.getString(USERFK, "0").toString()
super.onCreate(savedInstanceState)
}
private fun setEvents() { private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed() requireActivity().onBackPressed()
} }
@ -104,39 +76,6 @@ class ControlVehiculoUsuarioFragment(
} }
private fun setDialog(){
/* user_image.setOnClickListener({backButton.performClick()})
val builder = AlertDialog.Builder(requireContext())
val inflater = layoutInflater
val view: View = inflater.inflate(R.layout.item_worker_image, null)
builder.setView(view)
val imgView: ImageView = view.findViewById(R.id.workerimage) as ImageView
imgView.loadUrl("https://salix.verdnatura.es/api/Images/user/160x160/$userFk/download?access_token=$token")
val dialog = builder.create()
dialog.show()
*/
/* val image = ImageView(requireContext())
image.setImageResource(R.drawable.barcode_scan)
image.loadUrl("https://salix.verdnatura.es/api/Images/user/160x160/$userFk/download?access_token=$token")
val builderr: AlertDialog.Builder =
AlertDialog.Builder(requireContext(),R.style.DialogTheme)
.setMessage("Sacador:")
.setPositiveButton("Cerrar") { dialogInterface: DialogInterface, i: Int ->
fun onClick(dialog: DialogInterface, which: Int) {
dialog.dismiss()
}
}
.setView(image)
builderr.create().show()
// image.setOnClickListener { builderr.dismiss() }*/
}
override fun observeViewModel() { override fun observeViewModel() {
@ -159,7 +98,6 @@ private fun setDialog(){
} else { } else {
// Log.i("VERDNATURA::", "valor devuelto ${it.response}")
if (it.type.equals("getnameDevice")) { if (it.type.equals("getnameDevice")) {
binding.deviceName.text = it.response binding.deviceName.text = it.response

View File

@ -1,17 +1,14 @@
package es.verdnatura.presentation.view.feature.controlvehiculo.fragment package es.verdnatura.presentation.view.feature.controlvehiculo.fragment
import android.content.Context import android.content.Context
import android.util.Log
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetVehicleControlTimeUserCase import es.verdnatura.domain.GetVehicleControlTimeUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemMachineControl import es.verdnatura.presentation.common.ResponseItemMachineControl
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Call import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
import retrofit2.Response import retrofit2.Response

View File

@ -1,6 +1,5 @@
package es.verdnatura.presentation.view.feature.diadeventa.fragment package es.verdnatura.presentation.view.feature.diadeventa.fragment
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build import android.os.Build
import android.view.View import android.view.View
@ -10,7 +9,6 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentItemdayofsaleCardBinding import es.verdnatura.databinding.FragmentItemdayofsaleCardBinding
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnOptionsSelectedListener import es.verdnatura.presentation.common.OnOptionsSelectedListener
@ -18,28 +16,14 @@ import es.verdnatura.presentation.common.ToolBarAdapterTooltip
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogList import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.diadeventa.adapter.DayOfSaleAdapter import es.verdnatura.presentation.view.feature.diadeventa.adapter.DayOfSaleAdapter
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.buyers_fragment.*
import kotlinx.android.synthetic.main.fragment_historicovehiculo.*
import kotlinx.android.synthetic.main.fragment_item_card.*
import kotlinx.android.synthetic.main.fragment_item_card.edit_itemFk
import kotlinx.android.synthetic.main.fragment_item_card.splash_progress
import kotlinx.android.synthetic.main.fragment_itemexpeditionstate_card.*
import kotlinx.android.synthetic.main.fragment_itemshelvingdayofsale.*
import kotlinx.android.synthetic.main.fragment_parking.*
import kotlinx.android.synthetic.main.toolbar.**/
class DayOfSaleFragment( class DayOfSaleFragment(
var entryPoint: String = "" var entryPoint: String = ""
) : BaseFragment<FragmentItemdayofsaleCardBinding, DayOfSaleViewModel>(DayOfSaleViewModel::class) { ) : BaseFragment<FragmentItemdayofsaleCardBinding, DayOfSaleViewModel>(DayOfSaleViewModel::class) {
private lateinit var customDialogList: CustomDialogList private lateinit var customDialogList: CustomDialogList
private var user = ""
private var password = ""
private var warehouseFk = ""
private var adapter: DayOfSaleAdapter? = null private var adapter: DayOfSaleAdapter? = null
private var itemScan = "" private var itemScan = ""
@ -116,12 +100,8 @@ class DayOfSaleFragment(
private fun getItemsSaleDate(vShelvingFK: String) { private fun getItemsSaleDate(vShelvingFK: String) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.itemShelving_getSaleDate(user, password,vShelvingFK,"itemShelving_getSaleDate") viewModel.itemShelving_getSaleDate(getData(USER), getData(PASSWORD),vShelvingFK,"itemShelving_getSaleDate")
} }
@ -146,11 +126,12 @@ class DayOfSaleFragment(
}else{ }else{
if (it.list.get(0).isError){ if (it.list.get(0).isError){
customDialog.setTitle("Error") (activity as MainActivity).messageWithSound(it.list.get(0).errorMessage,it.list.get(0).isError,isPlayed = false)
/*customDialog.setTitle("Error")
.setDescription(it.list.get(0).errorMessage) .setDescription(it.list.get(0).errorMessage)
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} }
} }
@ -211,8 +192,8 @@ class DayOfSaleFragment(
fun parking(parking:String){ fun parking(parking:String){
viewModel.parking( viewModel.parking(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
parking = parking, parking = parking,
scanItem = itemScan, scanItem = itemScan,
callFunction="shelvingPark") callFunction="shelvingPark")

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.faltas.fragment package es.verdnatura.presentation.view.feature.faltas.fragment
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
@ -12,25 +11,17 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentFaltasBinding import es.verdnatura.databinding.FragmentFaltasBinding
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.faltas.adapter.FaltasAdapter import es.verdnatura.presentation.view.feature.faltas.adapter.FaltasAdapter
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_faltas.*
import kotlinx.android.synthetic.main.toolbar.**/
class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(FaltasViewModel::class) { class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(FaltasViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var adapter : FaltasAdapter? = null private var adapter : FaltasAdapter? = null
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private var listInvetory:ArrayList<ItemFaltasVO> = ArrayList() private var listInvetory:ArrayList<ItemFaltasVO> = ArrayList()
@ -52,12 +43,8 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
override fun getLayoutId(): Int = R.layout.fragment_faltas override fun getLayoutId(): Int = R.layout.fragment_faltas
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString() viewModel.getFaltas(getData(USER),getData(PASSWORD),getData(WAREHOUSEFK))
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,60).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
viewModel.getFaltas(user,password,warehouseFk)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
@ -74,7 +61,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
reload = false reload = false
hideLoad = false hideLoad = false
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getFaltas(user,password,warehouseFk) viewModel.getFaltas(getData(USER),getData(PASSWORD),getData(WAREHOUSEFK))
} }
super.init() super.init()
} }
@ -95,7 +82,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
override fun onOptionsItemSelected(item: Drawable) { override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload.drawable){ if (item == iconReload.drawable){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getFaltas(user,password,warehouseFk) viewModel.getFaltas(getData(USER),getData(PASSWORD),getData(WAREHOUSEFK))
} }
} }
@ -151,7 +138,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
adapter = FaltasAdapter(listInvetory,object: OnFaltasNichoClickListener { adapter = FaltasAdapter(listInvetory,object: OnFaltasNichoClickListener {
override fun onFaltasNichoClickListener(item: ItemFaltasVO) { override fun onFaltasNichoClickListener(item: ItemFaltasVO) {
customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){ customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0","temTrash") viewModel.itemStockUpdate(item.itemFk,getData(WAREHOUSEFK),getData(USER),getData(PASSWORD),customDialogInput.getValue(),"0","temTrash")
changeOfflineValue(item) changeOfflineValue(item)
customDialogInput.dismiss() customDialogInput.dismiss()
}.setKoButton("Cancelar"){ }.setKoButton("Cancelar"){
@ -162,7 +149,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!customDialogInput.getValue().isNullOrEmpty()){ if (!customDialogInput.getValue().isNullOrEmpty()){
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0","temTrash") viewModel.itemStockUpdate(item.itemFk,getData(WAREHOUSEFK),getData(USER),getData(PASSWORD),customDialogInput.getValue(),"0","temTrash")
changeOfflineValue(item) changeOfflineValue(item)
} }
customDialogInput.setValue("") customDialogInput.setValue("")
@ -176,7 +163,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
} }
},object: OnFaltasReviewClickListener{ },object: OnFaltasReviewClickListener{
override fun onFaltasReviewClickListener(item: ItemFaltasVO) { override fun onFaltasReviewClickListener(item: ItemFaltasVO) {
viewModel.faultsReview_isChecked(user,password,item.itemFk,warehouseFk,"faultsReview_isChecked") viewModel.faultsReview_isChecked(getData(USER),getData(PASSWORD),item.itemFk,getData(WAREHOUSEFK),"faultsReview_isChecked")
changeOfflineValue(item) changeOfflineValue(item)
} }
@ -189,9 +176,10 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
if (it.isError){ if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ (activity as MainActivity).messageWithSound(it.errorMessage,it.isError,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} }
}) })
} }

View File

@ -7,7 +7,6 @@ import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetInventaryUserCase import es.verdnatura.domain.GetInventaryUserCase
import es.verdnatura.domain.GetItemCardUserCase import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event

View File

@ -1,15 +1,5 @@
package es.verdnatura.presentation.view.feature.historicoarticulo.fragment package es.verdnatura.presentation.view.feature.historicoarticulo.fragment
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_buscar_item.*
import kotlinx.android.synthetic.main.fragment_historico.*
import kotlinx.android.synthetic.main.fragment_historico. binding.splashProgress
import kotlinx.android.synthetic.main.fragment_inventary.*
import kotlinx.android.synthetic.main.toolbar.*
import java.text.SimpleDateFormat*/
import android.content.SharedPreferences
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.Color.* import android.graphics.Color.*
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build import android.os.Build
@ -22,8 +12,6 @@ import es.verdnatura.R
import es.verdnatura.R.color.verdnatura_pumpkin_orange import es.verdnatura.R.color.verdnatura_pumpkin_orange
import es.verdnatura.R.color.verdnatura_white import es.verdnatura.R.color.verdnatura_white
import es.verdnatura.databinding.FragmentHistoricoBinding import es.verdnatura.databinding.FragmentHistoricoBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnOptionsSelectedListener import es.verdnatura.presentation.common.OnOptionsSelectedListener
@ -33,7 +21,6 @@ import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.historicoarticulo.adapter.HistoricoAdapter import es.verdnatura.presentation.view.feature.historicoarticulo.adapter.HistoricoAdapter
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoListVO import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoListVO
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
@ -44,11 +31,6 @@ class HistoricoArticuloFragment(
) : BaseFragment<FragmentHistoricoBinding, HistoricoArticuloViewModel>( ) : BaseFragment<FragmentHistoricoBinding, HistoricoArticuloViewModel>(
HistoricoArticuloViewModel::class HistoricoArticuloViewModel::class
) { ) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var adapter: HistoricoAdapter? = null private var adapter: HistoricoAdapter? = null
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
@ -63,16 +45,12 @@ class HistoricoArticuloFragment(
override fun getLayoutId(): Int = R.layout.fragment_historico override fun getLayoutId(): Int = R.layout.fragment_historico
override fun init() { override fun init() {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE) (activity as MainActivity).hideBottomNavigation(View.GONE)
filter = "all" filter = "all"
viewModel.itemDiary(user, password, itemFk, warehouseFk,"itemDiary") viewModel.itemDiary(getData(USER), getData(PASSWORD), itemFk, getData(WAREHOUSEFK),"itemDiary")
binding.mainToolbar.toolbarTitle.text = getString(R.string.itemdiary) + ":" + itemFk binding.mainToolbar.toolbarTitle.text = getString(R.string.itemdiary) + ":" + itemFk
setToolBar() setToolBar()
setEvents() setEvents()
@ -80,35 +58,8 @@ class HistoricoArticuloFragment(
super.init() super.init()
} }
fun generateColorStateList(
uncheckedColor: Int = Color.WHITE,
checkedColor: Int = verdnatura_pumpkin_orange
): ColorStateList {
val states = arrayOf(
intArrayOf(-android.R.attr.state_pressed),
intArrayOf(android.R.attr.state_pressed)
)
val colors = intArrayOf(
uncheckedColor,
checkedColor
)
return ColorStateList(states, colors)
}
private fun setToolBar() { private fun setToolBar() {
/* val listIcons: ArrayList<Drawable> = ArrayList()
val iconReload: Drawable =
resources.getDrawable(R.drawable.ic_transaction, resources.newTheme())
val iconGargabe: Drawable =
resources.getDrawable(R.drawable.alpha_b_circle_outline, resources.newTheme())
val iconFault: Drawable =
resources.getDrawable(R.drawable.alpha_f_circle_outline, resources.newTheme())*/
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
val iconReload = ImageView(context) val iconReload = ImageView(context)
@ -140,29 +91,14 @@ class HistoricoArticuloFragment(
item.setTint(getColor(context!!, verdnatura_pumpkin_orange))} item.setTint(getColor(context!!, verdnatura_pumpkin_orange))}
iconFault.drawable->viewModelwithFilter("falta") iconFault.drawable->viewModelwithFilter("falta")
} }
/* if (item == iconReload) {
binding.splashProgress.visibility = View.VISIBLE
viewModelwithFilter("all")
}
if (item == iconGargabe) {
binding.splashProgress.visibility = View.VISIBLE
viewModelwithFilter("contenedor")
view?.performLongClick()
}
if (item == iconFault) {
binding.splashProgress.visibility = View.VISIBLE
viewModelwithFilter("falta")
}*/
for (it in listIcons) { for (it in listIcons) {
if (it != item) { if (it != item) {
it.drawable.setTint(getColor(context!!, verdnatura_white)) it.drawable.setTint(getColor(context!!, verdnatura_white))
} }
} }
item.setTint(getColor(context!!, verdnatura_pumpkin_orange)) item.setTint(getColor(context!!, verdnatura_pumpkin_orange))
view?.performLongClick() view?.performLongClick()
} }
@ -175,7 +111,7 @@ class HistoricoArticuloFragment(
private fun viewModelwithFilter(keyfilter: String) { private fun viewModelwithFilter(keyfilter: String) {
filter = keyfilter filter = keyfilter
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.itemDiary(user, password, itemFk, warehouseFk,"itemDiary") viewModel.itemDiary(getData(USER), getData(PASSWORD), itemFk, getData(WAREHOUSEFK),"itemDiary")
} }
private fun setEvents() { private fun setEvents() {

View File

@ -1,40 +1,24 @@
package es.verdnatura.presentation.view.feature.historicoshelving.fragment package es.verdnatura.presentation.view.feature.historicoshelving.fragment
import android.content.SharedPreferences
import android.view.View import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentItemshelvinglogBinding import es.verdnatura.databinding.FragmentItemshelvinglogBinding
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogList import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.historicoshelving.adapter.ItemShelvingLogAdapter import es.verdnatura.presentation.view.feature.historicoshelving.adapter.ItemShelvingLogAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
/* import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.buyers_fragment.*
import kotlinx.android.synthetic.main.fragment_historicovehiculo.*
import kotlinx.android.synthetic.main.fragment_item_card.*
import kotlinx.android.synthetic.main.fragment_item_card.binding.scanInput
import kotlinx.android.synthetic.main.fragment_item_card.splash_progress
import kotlinx.android.synthetic.main.fragment_itemexpeditionstate_card.*
import kotlinx.android.synthetic.main.fragment_itemshelvingdayofsale.*
import kotlinx.android.synthetic.main.fragment_itemshelvinglog.*
import kotlinx.android.synthetic.main.fragment_parking.*
import kotlinx.android.synthetic.main.toolbar.**/
class itemShelvingLogFragment( class itemShelvingLogFragment(
var entryPoint: String = "" var entryPoint: String = ""
// ) : BaseFragment<FragmentItemdayofsaleCardBinding, itemShelvingLogViewModel>(itemShelvingLogViewModel::class) { // ) : BaseFragment<FragmentItemdayofsaleCardBinding, itemShelvingLogViewModel>(itemShelvingLogViewModel::class) {
) : BaseFragment<FragmentItemshelvinglogBinding, itemShelvingLogViewModel>(itemShelvingLogViewModel::class) { ) : BaseFragment<FragmentItemshelvinglogBinding, itemShelvingLogViewModel>(itemShelvingLogViewModel::class) {
private lateinit var customDialogList: CustomDialogList private lateinit var customDialogList: CustomDialogList
private var user = ""
private var password = ""
private var warehouseFk = ""
private var adapter: ItemShelvingLogAdapter? = null private var adapter: ItemShelvingLogAdapter? = null
private var itemScan = "" private var itemScan = ""
@ -87,12 +71,8 @@ class itemShelvingLogFragment(
private fun itemShelvingLog_get(vShelvingFK: String) { private fun itemShelvingLog_get(vShelvingFK: String) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.itemShelvingLog_get(user, password,vShelvingFK,"itemShelvingLog_get") viewModel.itemShelvingLog_get(getData(USER), getData(PASSWORD),vShelvingFK,"itemShelvingLog_get")
} }
@ -127,26 +107,7 @@ class itemShelvingLogFragment(
} }
}) })
/* response.observe(viewLifecycleOwner, Observer {
if (it.isError){
binding.splashProgress.visibility = View.GONE
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()
}else{
it.response.toast(requireContext())
*//* customDialog.setTitle("Información").setDescription(it.response).setOkButton("Cerrar") {
customDialog.dismiss()
}.show()*//*
}
})
*/
} }
} }

View File

@ -1,13 +1,11 @@
package es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment package es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment
import android.content.SharedPreferences
import android.view.View import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentShelvinglogBinding import es.verdnatura.databinding.FragmentShelvinglogBinding
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
@ -15,27 +13,12 @@ import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.historicoshelvinglog.adapter.ShelvingLogAdapter import es.verdnatura.presentation.view.feature.historicoshelvinglog.adapter.ShelvingLogAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.buyers_fragment.*
import kotlinx.android.synthetic.main.fragment_historicovehiculo.*
import kotlinx.android.synthetic.main.fragment_item_card.*
import kotlinx.android.synthetic.main.fragment_item_card.binding.scanInput
import kotlinx.android.synthetic.main.fragment_item_card.splash_progress
import kotlinx.android.synthetic.main.fragment_itemexpeditionstate_card.*
import kotlinx.android.synthetic.main.fragment_itemshelvingdayofsale.*
import kotlinx.android.synthetic.main.fragment_itemshelvinglog.*
import kotlinx.android.synthetic.main.fragment_parking.*
import kotlinx.android.synthetic.main.toolbar.**/
class shelvingLogFragment( class shelvingLogFragment(
var entryPoint: String = "" var entryPoint: String = ""
// ) : BaseFragment<FragmentItemdayofsaleCardBinding, itemShelvingLogViewModel>(itemShelvingLogViewModel::class) {
) : BaseFragment<FragmentShelvinglogBinding, shelvingLogViewModel>( ) : BaseFragment<FragmentShelvinglogBinding, shelvingLogViewModel>(
shelvingLogViewModel::class) { shelvingLogViewModel::class) {
private lateinit var customDialogList: CustomDialogList private lateinit var customDialogList: CustomDialogList
private var user = ""
private var password = ""
private var warehouseFk = ""
private var adapter: ShelvingLogAdapter? = null private var adapter: ShelvingLogAdapter? = null
private var itemScan = "" private var itemScan = ""
@ -91,12 +74,8 @@ class shelvingLogFragment(
private fun shelvingLog_get(vShelvingFK: String) { private fun shelvingLog_get(vShelvingFK: String) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.shelvingLog_get(user, password,vShelvingFK,"shelvingLog_get") viewModel.shelvingLog_get(getData(USER), getData(PASSWORD),vShelvingFK,"shelvingLog_get")
} }
@ -131,25 +110,6 @@ class shelvingLogFragment(
} }
}) })
/* response.observe(viewLifecycleOwner, Observer {
if (it.isError){
binding.splashProgress.visibility = View.GONE
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()
}else{
it.response.toast(requireContext())
customDialog.setTitle("Información").setDescription(it.response).setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}
})*/
} }

View File

@ -1,14 +1,10 @@
package es.verdnatura.presentation.view.feature.historicovehiculo.fragment package es.verdnatura.presentation.view.feature.historicovehiculo.fragment
import android.content.SharedPreferences
import android.view.View import android.view.View
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentHistoricovehiculoBinding import es.verdnatura.databinding.FragmentHistoricovehiculoBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
@ -16,9 +12,6 @@ import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.historicovehiculo.adapter.HistoricoVehiculoAdapter import es.verdnatura.presentation.view.feature.historicovehiculo.adapter.HistoricoVehiculoAdapter
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_historicovehiculo.*
import kotlinx.android.synthetic.main.toolbar.**/
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
@ -28,11 +21,6 @@ class HistoricoVehiculoFragment (
) : BaseFragment<FragmentHistoricovehiculoBinding, HistoricoVehiculoViewModel>( ) : BaseFragment<FragmentHistoricovehiculoBinding, HistoricoVehiculoViewModel>(
HistoricoVehiculoViewModel::class) { HistoricoVehiculoViewModel::class) {
private var user = ""
private var userFk = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var adapter : HistoricoVehiculoAdapter? = null private var adapter : HistoricoVehiculoAdapter? = null
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
@ -47,17 +35,12 @@ class HistoricoVehiculoFragment (
override fun init() override fun init()
{ {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
userFk=prefs.getString(USERFK,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE) (activity as MainActivity).hideBottomNavigation(View.GONE)
viewModel.machineWorker_getHistorical(user,password,numberPlate,"machineWorker_getHistorical") viewModel.machineWorker_getHistorical(getData(USER),getData(PASSWORD),numberPlate,"machineWorker_getHistorical")
binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclediary) binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclediary)
setEvents() setEvents()
super.init() super.init()

View File

@ -20,26 +20,14 @@ import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.inventario.adapter.InventoryAdapter import es.verdnatura.presentation.view.feature.inventario.adapter.InventoryAdapter
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import ir.mirrajabi.searchdialog.SimpleSearchDialogCompat import ir.mirrajabi.searchdialog.SimpleSearchDialogCompat
import ir.mirrajabi.searchdialog.core.SearchResultListener import ir.mirrajabi.searchdialog.core.SearchResultListener
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.buyers_fragment.*
import kotlinx.android.synthetic.main.fragment_ajustes.*
import kotlinx.android.synthetic.main.fragment_buscar_item.location_recyclerview
import kotlinx.android.synthetic.main.fragment_buscar_item.binding.splashProgress
import kotlinx.android.synthetic.main.fragment_inventary.*
import kotlinx.android.synthetic.main.fragment_inventary.binding.filterItemFk
import kotlinx.android.synthetic.main.toolbar.**/
class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewModel>(InventaryViewModel::class) { class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewModel>(InventaryViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var adapter : InventoryAdapter? = null private var adapter : InventoryAdapter? = null
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private var listInvetory:ArrayList<ItemInventaryVO> = ArrayList() private var listInvetory:ArrayList<ItemInventaryVO> = ArrayList()
@ -55,7 +43,6 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
//sergio : cmbios para insertar lista compradores en inventary en el searchable //sergio : cmbios para insertar lista compradores en inventary en el searchable
private val items=ArrayList<SearchBuyerModel>() private val items=ArrayList<SearchBuyerModel>()
private var prefs: SharedPreferences? = null
private lateinit var buyerId:String private lateinit var buyerId:String
@ -71,25 +58,20 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
prefs = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs!!.getString(USER,"").toString()
password = prefs!!.getString(PASSWORD,"").toString()
sectorFk = prefs!!.getInt(SECTORFK,1).toString()
warehouseFk = prefs!!.getInt(WAREHOUSEFK,1).toString()
//sergio. se quita para subir version.A la espera de como será el inventario //sergio. se quita para subir version.A la espera de como será el inventario
viewModel.itemShelvingBuyerGet(user = user,password = password,"itemShelvingBuyerGet") viewModel.itemShelvingBuyerGet(user = getData(USER),password = getData(PASSWORD),"itemShelvingBuyerGet")
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
override fun init() { override fun init() {
binding.filterBuyer.setText(prefs!!.getString(BUYER,"")) binding.filterBuyer.setText(getData(BUYER))
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
buyerId=prefs!!.getString(BUYERID,"").toString() buyerId=getData(BUYERID)
viewModel.getInventory(user,password,buyerId,warehouseFk,"itemShelving_filterBuyer") viewModel.getInventory(getData(USER),getData(PASSWORD),buyerId,getData(WAREHOUSEFK),"itemShelving_filterBuyer")
binding.filterBuyer.setOnClickListener{ binding.filterBuyer.setOnClickListener{
//SimpleSearchDialogCompat(context,getString(R.string.compradores),getString(R.string.escribirparteNombre),null,initData(), //SimpleSearchDialogCompat(context,getString(R.string.compradores),getString(R.string.escribirparteNombre),null,initData(),
SimpleSearchDialogCompat(context,getString(R.string.compradores),getString(R.string.escribirparteNombre),null,items, SimpleSearchDialogCompat(context,getString(R.string.compradores),getString(R.string.escribirparteNombre),null,items,
@ -99,7 +81,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
saveBuyer(nombre.getBuyerNickname()) saveBuyer(nombre.getBuyerNickname())
saveBuyerId(nombre.getBuyerId()) saveBuyerId(nombre.getBuyerId())
buyerId=nombre.getBuyerId() buyerId=nombre.getBuyerId()
viewModel.getInventory(user,password,nombre.getBuyerId(),warehouseFk,"itemShelving_filterBuyer") viewModel.getInventory(getData(USER),getData(PASSWORD),nombre.getBuyerId(),getData(WAREHOUSEFK),"itemShelving_filterBuyer")
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
baseSearchDialogCompat.dismiss() baseSearchDialogCompat.dismiss()
}).show() }).show()
@ -118,7 +100,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
reload = false reload = false
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
hideLoad = false hideLoad = false
viewModel.getInventory(user,password,buyerId,warehouseFk,"itemShelving_filterBuyer") viewModel.getInventory(getData(USER),getData(PASSWORD),buyerId,getData(WAREHOUSEFK),"itemShelving_filterBuyer")
} }
@ -144,7 +126,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
if (item == iconReload.drawable){ if (item == iconReload.drawable){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0 firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
viewModel.getInventory(user,password,buyerId,warehouseFk,"itemShelving_filterBuyer") viewModel.getInventory(getData(USER),getData(PASSWORD),buyerId,getData(WAREHOUSEFK),"itemShelving_filterBuyer")
} }
@ -232,7 +214,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
//sergio: cambiado customdialogInput pòr customdialog 6.1.4 //sergio: cambiado customdialogInput pòr customdialog 6.1.4
customDialog.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){ customDialog.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
//customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){ //customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
viewModel.itemTrash(item.itemFk,warehouseFk,user,password,item.nicho,"0","itemTrash") viewModel.itemTrash(item.itemFk,getData(WAREHOUSEFK),getData(USER),getData(PASSWORD),item.nicho,"0","itemTrash")
//viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,"0","0") //viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,"0","0")
// viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0") // viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
changeOfflineValue(item) changeOfflineValue(item)
@ -301,7 +283,6 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
if (!buyer.isError){ if (!buyer.isError){
try { try {
items.add(SearchBuyerModel(buyer.nickname,buyer.userFk)); items.add(SearchBuyerModel(buyer.nickname,buyer.userFk));
////Log.i("VERDNATURA:","Nombre comprador ${buyer.nickname} : ${buyer.userFk}")
}catch (e:Exception){} }catch (e:Exception){}
} }
}} }}

View File

@ -7,7 +7,6 @@ import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetInventaryUserCase import es.verdnatura.domain.GetInventaryUserCase
import es.verdnatura.domain.GetItemCardUserCase import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event
@ -16,7 +15,6 @@ import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.inventario.model.InventaryListVO import es.verdnatura.presentation.view.feature.inventario.model.InventaryListVO
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.login.model.errorMessage
import retrofit2.Call import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
import retrofit2.Response import retrofit2.Response

View File

@ -1,9 +1,5 @@
package es.verdnatura.presentation.view.feature.login.fragment package es.verdnatura.presentation.view.feature.login.fragment
//import android.preference.PreferenceManager
/*import kotlinx.android.synthetic.main.fragment_ajustes.*
import kotlinx.android.synthetic.main.fragment_login.*
import kotlinx.android.synthetic.main.fragment_login.binding.splashProgress*/
import android.app.AlarmManager import android.app.AlarmManager
import android.app.PendingIntent import android.app.PendingIntent
import android.content.Context import android.content.Context
@ -48,7 +44,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
viewModel.device_checkLogin( viewModel.device_checkLogin(
binding.edittextUsername.text.toString(), binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString(), binding.edittextPassword.text.toString(),
getANDROIDID(), callFunction = "device_checkLogin" getData(ANDROID_ID), callFunction = "device_checkLogin"
) )
}) })
@ -193,7 +189,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
binding.edittextPassword.text.toString(), binding.edittextPassword.text.toString(),
"warehouse", "warehouse",
getInfoVersionNameApp(), getInfoVersionNameApp(),
getANDROIDID(), "deviceLog_add" getData(ANDROID_ID), "deviceLog_add"
) )
//saveUserFkPref(it) //saveUserFkPref(it)

View File

@ -77,15 +77,21 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
var mperror: MediaPlayer? = null var mperror: MediaPlayer? = null
var mpok: MediaPlayer? = null var mpok: MediaPlayer? = null
override fun getLayoutId(): Int = R.layout.activity_main override fun getLayoutId(): Int = R.layout.activity_main
override fun init() { override fun init() {
mperror = MediaPlayer.create((this), R.raw.error) mperror = MediaPlayer.create((this), R.raw.error)
mpok = MediaPlayer.create((this), R.raw.ok) mpok = MediaPlayer.create((this), R.raw.ok)
customDialog = CustomDialogMainActivity(this) customDialog = CustomDialogMainActivity(this)
setBottomMenu() setBottomMenu()
if (haveSector()) addFragment(
if (haveSector()) addFragment(
PasilleroFragment.newInstance("Verdnatura"), PasilleroFragment.newInstance("Verdnatura"),
R.id.main_frame_layout, R.id.main_frame_layout,
PasilleroFragment.TAG, PasilleroFragment.TAG,
@ -104,12 +110,39 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
} }
} //navigationDrawer()
}
private fun navigationDrawer(){
val drawerLayout = binding.drawerLayout
drawerLayout.open()
/* val toggle = ActionBarDrawerToggle(
this,
drawerLayout,
toolbar,
"abierto",
"cerrado"
)
drawerLayout.addDrawerListener(toggle)
toggle.syncState()*/
}
/* private fun navigateToFragment(){
val navHostFragment =
supportFragmentManager.findFragmentById(R.id.main_frame_layout) as NavHostFragment
val navController = navHostFragment.navController
navController.navigate(R.id.action_pasilleroFragment_to_ajustesFragment)
}
*/
private fun haveSector(): Boolean { private fun haveSector(): Boolean {
val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0) val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0)
val sectorFk = prefs.getInt("sectorFk", -1) val sectorFk = prefs.getInt("sectorFk", -1)
return sectorFk != -1 return sectorFk != -1
} }
private fun setBottomMenu() { private fun setBottomMenu() {
@ -341,6 +374,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
} }
"Ver Ticket" -> { "Ver Ticket" -> {
addFragmentOnTop(ShowTicketFragment.newInstance()) addFragmentOnTop(ShowTicketFragment.newInstance())
} }
"Historial del vehículo" -> { "Historial del vehículo" -> {
@ -552,13 +586,15 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
binding.mainBottomNavigation.visibility = visible binding.mainBottomNavigation.visibility = visible
} }
fun messageWithSound(message: String, isError: Boolean) { fun messageWithSound(message: String, isError: Boolean,isPlayed:Boolean?) {
if (!isError) { if (!isError) {
mpok?.start() mpok?.start()
message.toast(this, Toast.LENGTH_SHORT) message.toast(this, Toast.LENGTH_SHORT)
} else { } else {
mperror?.start()
if (isPlayed == true)( mperror?.start())
customDialog.setTitle("Error").setDescription(message) customDialog.setTitle("Error").setDescription(message)
.setOkButton("Aceptar") { .setOkButton("Aceptar") {
customDialog.dismiss() customDialog.dismiss()
@ -568,5 +604,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
} }
} }
} }

View File

@ -1,19 +1,13 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment package es.verdnatura.presentation.view.feature.paletizador.fragment
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_expedition_pallet_detail.*
import kotlinx.android.synthetic.main.toolbar.**/
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Bundle
import android.view.View import android.view.View
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentExpeditionPalletDetailBinding import es.verdnatura.databinding.FragmentExpeditionPalletDetailBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
@ -37,11 +31,6 @@ class ExpeditionPalletDetailFragment(
) : BaseFragment<FragmentExpeditionPalletDetailBinding, ExpeditionPalletDetailViewModel>( ) : BaseFragment<FragmentExpeditionPalletDetailBinding, ExpeditionPalletDetailViewModel>(
ExpeditionPalletDetailViewModel::class) { ExpeditionPalletDetailViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var SectorDescription = ""
private var adapter : ExpeditionPalletViewAdapter? = null private var adapter : ExpeditionPalletViewAdapter? = null
private lateinit var customDialogList: CustomDialogList private lateinit var customDialogList: CustomDialogList
private var onPalletClickListener:OnPalletClickListener? = null private var onPalletClickListener:OnPalletClickListener? = null
@ -61,18 +50,6 @@ class ExpeditionPalletDetailFragment(
override fun getLayoutId(): Int = R.layout.fragment_expedition_pallet_detail override fun getLayoutId(): Int = R.layout.fragment_expedition_pallet_detail
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
SectorDescription=prefs.getString(SECTORDESCRIP,"Sin Sector").toString()
super.onCreate(savedInstanceState)
}
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext()) customDialogList = CustomDialogList(requireContext())
@ -84,7 +61,8 @@ class ExpeditionPalletDetailFragment(
setToolBar() setToolBar()
setEvents() setEvents()
viewModel.expeditionPallet_List(user,password,itemPallet!!.Pallet,"expeditionPallet_View") viewModel.expeditionPallet_List(getData(USER),
getData(PASSWORD),itemPallet!!.Pallet,"expeditionPallet_View")
super.init() super.init()
} }
@ -116,17 +94,20 @@ class ExpeditionPalletDetailFragment(
override fun onOptionsItemSelected(item: Drawable) { override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){ if (item == iconReload){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionPallet_List(user,password,itemPallet!!.Pallet,"expeditionPallet_View") viewModel.expeditionPallet_List(getData(USER),
getData(PASSWORD),itemPallet!!.Pallet,"expeditionPallet_View")
}else if(item == iconEditar){ }else if(item == iconEditar){
onPalletClickListener!!.onPalletClickListener(itemExpeditionTruckVO!!,itemPallet!!) onPalletClickListener!!.onPalletClickListener(itemExpeditionTruckVO!!,itemPallet!!)
}else if(item == iconBorrar){ }else if(item == iconBorrar){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionPalletDel(user,password,itemPallet!!.Pallet,"expeditionPallet_Del") viewModel.expeditionPalletDel(getData(USER),
getData(PASSWORD),itemPallet!!.Pallet,"expeditionPallet_Del")
}else if(item == iconPrint){ }else if(item == iconPrint){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
(getString(R.string.Imprimiendo)+" por " +SectorDescription).toast(requireContext()) (getString(R.string.Imprimiendo)+" por " +getData(SECTORDESCRIP)).toast(requireContext())
viewModel.expeditionPalletPrintSet(user,password,itemPallet!!.Pallet,sectorFk,"expeditionPallet_PrintSet") viewModel.expeditionPalletPrintSet(getData(USER),
getData(PASSWORD),itemPallet!!.Pallet,getData(SECTORFK),"expeditionPallet_PrintSet")
} }
} }

View File

@ -6,7 +6,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetPaletizadoresUserCase import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event

View File

@ -1,10 +1,7 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment package es.verdnatura.presentation.view.feature.paletizador.fragment
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_expedition_pallet.*
import kotlinx.android.synthetic.main.toolbar.**/
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.media.MediaPlayer import android.media.MediaPlayer
import android.os.Bundle import android.os.Bundle
@ -14,7 +11,6 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentExpeditionPalletBinding import es.verdnatura.databinding.FragmentExpeditionPalletBinding
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnBarcodeRowClickListener import es.verdnatura.presentation.common.OnBarcodeRowClickListener
@ -41,10 +37,7 @@ class ExpeditionPalletFragment(
) : BaseFragment<FragmentExpeditionPalletBinding, ExpeditionPalletViewModel>( ) : BaseFragment<FragmentExpeditionPalletBinding, ExpeditionPalletViewModel>(
ExpeditionPalletViewModel::class) { ExpeditionPalletViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var adapter : ExpeditionPalletAdapter? = null private var adapter : ExpeditionPalletAdapter? = null
private var onPalletClickListener: OnPalletClickListener? = null private var onPalletClickListener: OnPalletClickListener? = null
private var onComprobarPalletViewClickListener:OnComprobarPalletViewClickListener? = null private var onComprobarPalletViewClickListener:OnComprobarPalletViewClickListener? = null
@ -70,11 +63,6 @@ class ExpeditionPalletFragment(
override fun getLayoutId(): Int = R.layout.fragment_expedition_pallet override fun getLayoutId(): Int = R.layout.fragment_expedition_pallet
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,60).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error) mperror = MediaPlayer.create((activity as MainActivity),R.raw.error)
mpok = MediaPlayer.create((activity as MainActivity),R.raw.ok) mpok = MediaPlayer.create((activity as MainActivity),R.raw.ok)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -89,7 +77,8 @@ class ExpeditionPalletFragment(
binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino
setToolBar() setToolBar()
setEvents() setEvents()
viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List") viewModel.expeditionPallet_List(getData(USER),
getData(PASSWORD),itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List")
////Log.i("VERDNATURA:","4-listamos listado de pallets para la expedicion") ////Log.i("VERDNATURA:","4-listamos listado de pallets para la expedicion")
super.init() super.init()
} }
@ -111,7 +100,8 @@ class ExpeditionPalletFragment(
override fun onOptionsItemSelected(item: Drawable) { override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){ if (item == iconReload){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List") viewModel.expeditionPallet_List(getData(USER),
getData(PASSWORD),itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List")
}else if(item == iconPlus){ }else if(item == iconPlus){
expeditionScanAdd() expeditionScanAdd()
} }
@ -183,7 +173,8 @@ class ExpeditionPalletFragment(
private fun expeditionScanAdd(){ private fun expeditionScanAdd(){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionScanAdd(usuario = user,password = password,vPalletFk = "0",vTruckFk = itemExpeditionTruckVO!!.truckFk,"expeditionScan_Add") viewModel.expeditionScanAdd(getData(USER),
getData(PASSWORD),vPalletFk = "0",vTruckFk = itemExpeditionTruckVO!!.truckFk,"expeditionScan_Add")
} }
private fun showScanExpeditions(it:ItemScanList){ private fun showScanExpeditions(it:ItemScanList){
@ -217,7 +208,8 @@ class ExpeditionPalletFragment(
}.setKoButton("Cerrar"){ }.setKoButton("Cerrar"){
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) (activity as MainActivity).hideKeyboard(customDialogList.getEditText())
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionPallet_List(user,password,itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List") viewModel.expeditionPallet_List(getData(USER),
getData(PASSWORD),itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List")
listExpeditions = ArrayList() listExpeditions = ArrayList()
customDialogList.dismiss() customDialogList.dismiss()
}.setValue("").show() }.setValue("").show()
@ -233,9 +225,11 @@ class ExpeditionPalletFragment(
if(customDialogList.getValue().length >= 7){ if(customDialogList.getValue().length >= 7){
listExpeditions.add(0,BarcodeVO(code = customDialogList.getValue())) listExpeditions.add(0,BarcodeVO(code = customDialogList.getValue()))
customDialogList.setDescription("Total: "+listExpeditions.size) customDialogList.setDescription("Total: "+listExpeditions.size)
viewModel.expeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue(),"expeditionScan_Put") viewModel.expeditionScanPut(getData(USER),
getData(PASSWORD),it.list.get(0).palletFk,customDialogList.getValue(),"expeditionScan_Put")
////Log.i("VERDNATURA:"," palletizando ${it.list.get(0).palletFk} expedi: ${customDialogList.getValue()}") ////Log.i("VERDNATURA:"," palletizando ${it.list.get(0).palletFk} expedi: ${customDialogList.getValue()}")
viewModel.checkRouteExpeditionScanPut(user,password,it.list.get(0).palletFk,customDialogList.getValue(),"expedition_checkRoute") viewModel.checkRouteExpeditionScanPut(getData(USER),
getData(PASSWORD),it.list.get(0).palletFk,customDialogList.getValue(),"expedition_checkRoute")
}else{ }else{
if (mperror != null) mperror!!.start() if (mperror != null) mperror!!.start()
} }

View File

@ -6,7 +6,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetPaletizadoresUserCase import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event

View File

@ -1,10 +1,6 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment package es.verdnatura.presentation.view.feature.paletizador.fragment
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_expedition_scan.*
import kotlinx.android.synthetic.main.toolbar.**/
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.media.MediaPlayer import android.media.MediaPlayer
import android.os.Bundle import android.os.Bundle
@ -14,8 +10,6 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentExpeditionScanBinding import es.verdnatura.databinding.FragmentExpeditionScanBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
@ -38,10 +32,6 @@ class ExpeditionScanFragment (
) : BaseFragment<FragmentExpeditionScanBinding, ExpeditionScanViewModel>( ) : BaseFragment<FragmentExpeditionScanBinding, ExpeditionScanViewModel>(
ExpeditionScanViewModel::class) { ExpeditionScanViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var adapter : ExpeditionScanAdapter? = null private var adapter : ExpeditionScanAdapter? = null
private var onPalletClickListener: OnPalletClickListener? = null private var onPalletClickListener: OnPalletClickListener? = null
private var onComprobarPalletViewClickListener: OnComprobarPalletViewClickListener? = null private var onComprobarPalletViewClickListener: OnComprobarPalletViewClickListener? = null
@ -67,11 +57,6 @@ class ExpeditionScanFragment (
override fun getLayoutId(): Int = R.layout.fragment_expedition_scan override fun getLayoutId(): Int = R.layout.fragment_expedition_scan
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error) mperror = MediaPlayer.create((activity as MainActivity),R.raw.error)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -89,7 +74,8 @@ class ExpeditionScanFragment (
setToolBar() setToolBar()
setEvents() setEvents()
viewModel.expeditionScanList(user,password,itemPalletVO!!.Pallet) viewModel.expeditionScanList(getData(USER),
getData(PASSWORD),itemPalletVO!!.Pallet)
super.init() super.init()
} }
@ -110,7 +96,8 @@ class ExpeditionScanFragment (
override fun onOptionsItemSelected(item: Drawable) { override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){ if (item == iconReload){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionScanList(user,password,itemPalletVO!!.Pallet) viewModel.expeditionScanList(getData(USER),
getData(PASSWORD),itemPalletVO!!.Pallet)
}else if(item == iconPlus){ }else if(item == iconPlus){
//Log.i("VERDNATURA:","ENTRAMOS A SCAN ADD") //Log.i("VERDNATURA:","ENTRAMOS A SCAN ADD")
expeditionScanAdd () expeditionScanAdd ()
@ -177,7 +164,8 @@ class ExpeditionScanFragment (
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()
}else{ }else{
viewModel.expeditionScanList(user,password,itemPalletVO!!.Pallet) viewModel.expeditionScanList(getData(USER),
getData(PASSWORD),itemPalletVO!!.Pallet)
} }
}) })
} }
@ -193,7 +181,8 @@ class ExpeditionScanFragment (
.setDescription("Expedition: "+itemExpeditionScanVO!!.expeditionFk) .setDescription("Expedition: "+itemExpeditionScanVO!!.expeditionFk)
.setOkButton("Borrar"){ .setOkButton("Borrar"){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionScanDel(user,password,itemExpeditionScanVO.id) viewModel.expeditionScanDel(getData(USER),
getData(PASSWORD),itemExpeditionScanVO.id)
customDialogTwoButtons.dismiss() customDialogTwoButtons.dismiss()
}.setKoButton("Cancelar"){ }.setKoButton("Cancelar"){
customDialogTwoButtons.dismiss() customDialogTwoButtons.dismiss()
@ -209,7 +198,8 @@ class ExpeditionScanFragment (
private fun expeditionScanAdd(){ private fun expeditionScanAdd(){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionScanAdd(usuario = user,password = password,vPalletFk = itemPalletVO!!.Pallet,vTruckFk = itemExpeditionTruckVO!!.truckFk) viewModel.expeditionScanAdd(usuario = getData(USER),
getData(PASSWORD),vPalletFk = itemPalletVO!!.Pallet,vTruckFk = itemExpeditionTruckVO!!.truckFk)
//Log.i("VERDNATURA:","entramos a escanear ticket del pallet") //Log.i("VERDNATURA:","entramos a escanear ticket del pallet")
} }
@ -265,8 +255,8 @@ class ExpeditionScanFragment (
listExpeditions.add(BarcodeVO(code = customDialogList.getValue())) listExpeditions.add(BarcodeVO(code = customDialogList.getValue()))
viewModel.expeditionScanPut( viewModel.expeditionScanPut(
user, getData(USER),
password, getData(PASSWORD),
it.list.get(0).palletFk, it.list.get(0).palletFk,
customDialogList.getValue() customDialogList.getValue()
) )
@ -275,7 +265,8 @@ class ExpeditionScanFragment (
// ////Log.i("VERDNATURA:","misma ruta ?") // ////Log.i("VERDNATURA:","misma ruta ?")
//sergio:comprueba si es de la misma ruta. Check_route_expedition. //sergio:comprueba si es de la misma ruta. Check_route_expedition.
checkRouteExpeditionScanPut(user, password,it.list.get(0).palletFk,customDialogList.getValue()) checkRouteExpeditionScanPut(getData(USER),
getData(PASSWORD),it.list.get(0).palletFk,customDialogList.getValue())
////Log.i("VERDNATURA:", "scan put pallet ${it.list.get(0).palletFk}"); ////Log.i("VERDNATURA:", "scan put pallet ${it.list.get(0).palletFk}");
////Log.i("VERDNATURA:", "scan put list ${customDialogList.getValue()}"); ////Log.i("VERDNATURA:", "scan put list ${customDialogList.getValue()}");

View File

@ -84,8 +84,8 @@ class ExpeditionScanSorterFragment(
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString() user = getData(USER)
password = prefs.getString(PASSWORD, "").toString() password = getData(PASSWORD)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }

View File

@ -5,7 +5,7 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetPaletizadoresUserCase import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO

View File

@ -18,7 +18,6 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentItemexpeditionstateCardBinding import es.verdnatura.databinding.FragmentItemexpeditionstateCardBinding
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnItemExpeditionStateRowClickListener import es.verdnatura.presentation.common.OnItemExpeditionStateRowClickListener
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
@ -94,9 +93,9 @@ class ExpeditionStateFragment(
private fun getExpedtionState(expeditionFk: String) { private fun getExpedtionState(expeditionFk: String) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString() user = getData(USER)
password = prefs.getString(PASSWORD, "").toString() password = getData(PASSWORD)
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString() warehouseFk = getData(WAREHOUSEFK)
// this.itemFk = itemFk // this.itemFk = itemFk
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.expedition_getStateJSON(expeditionFk, user, password,"expedition_getState") viewModel.expedition_getStateJSON(expeditionFk, user, password,"expedition_getState")

View File

@ -12,7 +12,7 @@ import com.google.gson.JsonObject
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import es.verdnatura.domain.GetPaletizadoresUserCase import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO

View File

@ -1,19 +1,14 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment package es.verdnatura.presentation.view.feature.paletizador.fragment
/*import kotlinx.android.synthetic.main.fragment_expedition_truck_list.*
import kotlinx.android.synthetic.main.toolbar.**/
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Bundle
import android.view.View import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentExpeditionTruckListBinding import es.verdnatura.databinding.FragmentExpeditionTruckListBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnOptionsSelectedListener import es.verdnatura.presentation.common.OnOptionsSelectedListener
@ -32,10 +27,6 @@ import java.util.Calendar.getInstance as getInstance1
class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBinding, ExpeditionTruckListViewModel>( class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBinding, ExpeditionTruckListViewModel>(
ExpeditionTruckListViewModel::class) { ExpeditionTruckListViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var adapter : ExpeditionListAdapter? = null private var adapter : ExpeditionListAdapter? = null
private lateinit var customDialogHor: CustomDialogHour private lateinit var customDialogHor: CustomDialogHour
private var onTruckClickListener: OnTruckClickListener? = null private var onTruckClickListener: OnTruckClickListener? = null
@ -52,15 +43,6 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
override fun getLayoutId(): Int = R.layout.fragment_expedition_truck_list override fun getLayoutId(): Int = R.layout.fragment_expedition_truck_list
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
super.onCreate(savedInstanceState)
}
override fun init() { override fun init() {
customDialogHor = CustomDialogHour(requireContext()) customDialogHor = CustomDialogHour(requireContext())
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
@ -68,7 +50,8 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
binding.mainToolbar.backButton.visibility = View.GONE binding.mainToolbar.backButton.visibility = View.GONE
setToolBar() setToolBar()
////Log.i("VERDNATURA:","1-cargamos expediciones") ////Log.i("VERDNATURA:","1-cargamos expediciones")
viewModel.expeditionTruckList(user,password,"expeditionTruck_List") viewModel.expeditionTruckList(getData(USER),
getData(PASSWORD),"expeditionTruck_List")
super.init() super.init()
} }
@ -87,7 +70,8 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
override fun onOptionsItemSelected(item: Drawable) { override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){ if (item == iconReload){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionTruckList(user,password,"expeditionTruck_List") viewModel.expeditionTruckList(getData(USER),
getData(PASSWORD),"expeditionTruck_List")
}else if(item == iconPlus){ }else if(item == iconPlus){
addTruck() addTruck()
} }
@ -111,7 +95,8 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
event.getContentIfNotHandled().notNull {printExpeditionList(it) } event.getContentIfNotHandled().notNull {printExpeditionList(it) }
}) })
loadResponseExpeditionAdd.observe(viewLifecycleOwner, Observer { event -> loadResponseExpeditionAdd.observe(viewLifecycleOwner, Observer { event ->
viewModel.expeditionTruckList(user,password,"expeditionTruck_List") viewModel.expeditionTruckList(getData(USER),
getData(PASSWORD),"expeditionTruck_List")
}) })
} }
} }
@ -129,7 +114,8 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
customDialogHor.setTitle("Nuevo Camión").setOkButton("Guardar"){ customDialogHor.setTitle("Nuevo Camión").setOkButton("Guardar"){
(activity as MainActivity).hideKeyboard(customDialogHor.getDestinoEditText()) (activity as MainActivity).hideKeyboard(customDialogHor.getDestinoEditText())
if (!customDialogHor.getDestinoValue().isNullOrEmpty() && !customDialogHor.getHoraValue().isNullOrEmpty()){ if (!customDialogHor.getDestinoValue().isNullOrEmpty() && !customDialogHor.getHoraValue().isNullOrEmpty()){
viewModel.expeditionTruckAdd(user,password,customDialogHor.getHoraValue(),customDialogHor.getDestinoValue(),"expeditionTruck_Add") viewModel.expeditionTruckAdd(getData(USER),
getData(PASSWORD),customDialogHor.getHoraValue(),customDialogHor.getDestinoValue(),"expeditionTruck_Add")
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
customDialogHor.dismiss() customDialogHor.dismiss()
} }
@ -143,7 +129,8 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
customDialogHor.getDestinoEditText().setOnEditorActionListener { v, actionId, event -> customDialogHor.getDestinoEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!customDialogHor.getDestinoValue().isNullOrEmpty() && !customDialogHor.getHoraValue().isNullOrEmpty()){ if (!customDialogHor.getDestinoValue().isNullOrEmpty() && !customDialogHor.getHoraValue().isNullOrEmpty()){
viewModel.expeditionTruckAdd(user,password,customDialogHor.getHoraValue(),customDialogHor.getDestinoValue(),"expeditionTruck_Add") viewModel.expeditionTruckAdd(getData(USER),
getData(PASSWORD),customDialogHor.getHoraValue(),customDialogHor.getDestinoValue(),"expeditionTruck_Add")
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
customDialogHor.dismiss() customDialogHor.dismiss()
} }

View File

@ -6,7 +6,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetPaletizadoresUserCase import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.parking.fragment package es.verdnatura.presentation.view.feature.parking.fragment
/*import kotlinx.android.synthetic.main.fragment_parking.*
import kotlinx.android.synthetic.main.toolbar.**/
import android.content.SharedPreferences import android.content.SharedPreferences
import android.media.MediaPlayer import android.media.MediaPlayer
import android.os.Bundle import android.os.Bundle
@ -11,8 +10,6 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentParkingBinding import es.verdnatura.databinding.FragmentParkingBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnBarcodeRowClickListener import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.hideKeyboard import es.verdnatura.presentation.common.hideKeyboard
@ -23,10 +20,6 @@ import es.verdnatura.presentation.view.feature.parking.adapter.ParkingAdapter
class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(ParkingViewModel::class) { class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(ParkingViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var scanerList:ArrayList<BarcodeVO> = ArrayList() private var scanerList:ArrayList<BarcodeVO> = ArrayList()
private var adapter : ParkingAdapter? = null private var adapter : ParkingAdapter? = null
@ -135,8 +128,8 @@ class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(Pa
scanerList.forEach { scanerList.forEach {
// binding.splashProgress.visibility = View.VSIIBLE // binding.splashProgress.visibility = View.VSIIBLE
viewModel.parking( viewModel.parking(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
parking = txtScan, parking = txtScan,
scanItem = it.code!!,callFunction = "shelvingPark" scanItem = it.code!!,callFunction = "shelvingPark"
) )
@ -149,10 +142,6 @@ class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(Pa
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0) val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error) mperror = MediaPlayer.create((activity as MainActivity),R.raw.error)
mpok = MediaPlayer.create((activity as MainActivity),R.raw.ok) mpok = MediaPlayer.create((activity as MainActivity),R.raw.ok)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)

View File

@ -7,7 +7,7 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetUbicadorUserCase import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO

View File

@ -1,8 +1,5 @@
package es.verdnatura.presentation.view.feature.parking.fragment package es.verdnatura.presentation.view.feature.parking.fragment
/*import kotlinx.android.synthetic.main.fragment_parking.*
import kotlinx.android.synthetic.main.toolbar.**/
import android.content.SharedPreferences
import android.media.MediaPlayer import android.media.MediaPlayer
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
@ -11,8 +8,6 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentParkingBinding import es.verdnatura.databinding.FragmentParkingBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnBarcodeRowClickListener import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.hideKeyboard import es.verdnatura.presentation.common.hideKeyboard
@ -23,10 +18,7 @@ import es.verdnatura.presentation.view.feature.parking.adapter.ParkingAdapter
class ParkingSaleFragment : BaseFragment<FragmentParkingBinding,ParkingSaleViewModel>(ParkingSaleViewModel::class) { class ParkingSaleFragment : BaseFragment<FragmentParkingBinding,ParkingSaleViewModel>(ParkingSaleViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var scanerList:ArrayList<BarcodeVO> = ArrayList() private var scanerList:ArrayList<BarcodeVO> = ArrayList()
private var adapter : ParkingAdapter? = null private var adapter : ParkingAdapter? = null
@ -133,8 +125,8 @@ class ParkingSaleFragment : BaseFragment<FragmentParkingBinding,ParkingSaleViewM
scanerList.forEach { scanerList.forEach {
// binding.splashProgress.visibility = View.VSIIBLE // binding.splashProgress.visibility = View.VSIIBLE
viewModel.parking( viewModel.parking(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
parking = txtScan, parking = txtScan,
scanItem = it.code!!,callFunction = "shelvingPark" scanItem = it.code!!,callFunction = "shelvingPark"
) )
@ -146,11 +138,7 @@ class ParkingSaleFragment : BaseFragment<FragmentParkingBinding,ParkingSaleViewM
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error) mperror = MediaPlayer.create((activity as MainActivity),R.raw.error)
mpok = MediaPlayer.create((activity as MainActivity),R.raw.ok) mpok = MediaPlayer.create((activity as MainActivity),R.raw.ok)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)

View File

@ -7,7 +7,7 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetUbicadorUserCase import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO

View File

@ -10,9 +10,7 @@ import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.adapter.PasillerosAdapter import es.verdnatura.presentation.view.feature.pasillero.adapter.PasillerosAdapter
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_pasillero.*
import kotlinx.android.synthetic.main.toolbar.**/
class PasilleroFragment( class PasilleroFragment(
var tagName: String = "" var tagName: String = ""

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.precontrol package es.verdnatura.presentation.view.feature.precontrol
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
@ -9,23 +8,14 @@ import androidx.lifecycle.Observer
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentControladorBinding import es.verdnatura.databinding.FragmentControladorBinding
import es.verdnatura.domain.ConstAndValues import es.verdnatura.domain.ConstAndValues
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnCollectionSelectedListener import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
/*import kotlinx.android.synthetic.main.fragment_controlador.*
import kotlinx.android.synthetic.main.toolbar.**/
class PreControladorFragment: BaseFragment<FragmentControladorBinding,ShowTicketViewModel>(ShowTicketViewModel::class) { class PreControladorFragment: BaseFragment<FragmentControladorBinding,ShowTicketViewModel>(ShowTicketViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var goBack:Boolean = false private var goBack:Boolean = false
private var onCollectionSelectedListener : OnCollectionSelectedListener? = null private var onCollectionSelectedListener : OnCollectionSelectedListener? = null
override fun getLayoutId(): Int = R.layout.fragment_controlador override fun getLayoutId(): Int = R.layout.fragment_controlador
@ -58,11 +48,7 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,ShowTicket
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
type=ConstAndValues.PRECHECKER type=ConstAndValues.PRECHECKER
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
@ -81,9 +67,9 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,ShowTicket
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
sectorFk = sectorFk, sectorFk = getData(SECTORFK),
collectionFk = binding.scanInput.text.toString(), collectionFk = binding.scanInput.text.toString(),
type = type,callFunction = "collection_getTickets" type = type,callFunction = "collection_getTickets"
) )
@ -115,7 +101,7 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,ShowTicket
} }
private fun navigateToCollectionList(collection: CollectionVO){ private fun navigateToCollectionList(collection: CollectionVO){
onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.PRECHECKER) onCollectionSelectedListener?.onCollectionSelected(collection, type)
} }
} }

View File

@ -5,7 +5,7 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.domain.GetPreControladorUserCase import es.verdnatura.domain.GetPreControladorUserCase
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.view.feature.collection.mapper.map import es.verdnatura.presentation.view.feature.collection.mapper.map

View File

@ -38,20 +38,9 @@ import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_pre_sacador.*
import kotlinx.android.synthetic.main.fragment_pre_sacador.binding.fragmentSacadorCollections
import kotlinx.android.synthetic.main.fragment_pre_sacador.binding.splashProgress
import kotlinx.android.synthetic.main.fragment_sacador.*
import kotlinx.android.synthetic.main.toolbar.**/
class PreSacadorFragment : class PreSacadorFragment :
BaseFragment<FragmentPreSacadorBinding, PreSacadorViewModel>(PreSacadorViewModel::class) { BaseFragment<FragmentPreSacadorBinding, PreSacadorViewModel>(PreSacadorViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var SectorDescription = ""
var mperror: MediaPlayer? = null var mperror: MediaPlayer? = null
var mpok: MediaPlayer? = null var mpok: MediaPlayer? = null
//private var sales: ArrayList<PreSacadorItemVO> = ArrayList() //private var sales: ArrayList<PreSacadorItemVO> = ArrayList()
@ -73,9 +62,13 @@ class PreSacadorFragment :
private lateinit var customDialogInputParking: CustomDialogInput private lateinit var customDialogInputParking: CustomDialogInput
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogThreeButtons: CustomDialogThreeButtons private lateinit var customDialogThreeButtons: CustomDialogThreeButtons
private var token = ""
private var ticketFk = "" private var ticketFk = ""
private var originalScanned = "" private var originalScanned = ""
private var typeCollectionMissing = ""
private var positionCollectionMissing = 0
private var quantityCollectionMissing = ""
private var positionIncreaseQuantity = 0
private var quantityIncrease = ""
//sergio: se añada para leer el articulo leido que era el buyFk //sergio: se añada para leer el articulo leido que era el buyFk
private var originalItemScan: String = "" private var originalItemScan: String = ""
@ -86,15 +79,9 @@ class PreSacadorFragment :
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, 37).toString()
token = prefs.getString(TOKEN, "").toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
mperror = MediaPlayer.create((activity as MainActivity), R.raw.error) mperror = MediaPlayer.create((activity as MainActivity), R.raw.error)
mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok) mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok)
SectorDescription = prefs.getString(SECTORDESCRIP, "Sin Sector").toString()
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
@ -193,6 +180,17 @@ class PreSacadorFragment :
} }
}) })
responseIncQuantity.observe(viewLifecycleOwner, Observer {
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true,true)
} else {
incresaseSuccesful()
}
})
responseParkingAdd.observe(viewLifecycleOwner, Observer { responseParkingAdd.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
if (it.isError) { if (it.isError) {
@ -206,6 +204,16 @@ class PreSacadorFragment :
} }
}) })
responseMissingTrash.observe(viewLifecycleOwner, Observer {
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true,true)
} else {
missingTrashSuccesful()
}
})
responseCode.observe(viewLifecycleOwner, Observer { responseCode.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
if (!goBack2) { if (!goBack2) {
@ -238,6 +246,90 @@ class PreSacadorFragment :
} }
} }
private fun incresaseSuccesful() {
try {
sales[positionIncreaseQuantity].saldo = quantityIncrease.toInt()
} catch (e: Exception) {
sales[positionIncreaseQuantity].saldo = 0
}
saleAdapter?.notifyDataSetChanged()
val ticket =
"[" + sales[positionIncreaseQuantity].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionIncreaseQuantity].id + "/summary)"
val message =
"Se ha modificado desde previa la cantidad original " + sales[positionIncreaseQuantity].quantity + " del artículo " + sales[positionIncreaseQuantity].itemFk + " a nueva cantidad: " + quantityIncrease + " del ticket " + ticket
sendSalixMessageNew(message, sales[positionIncreaseQuantity].salesPersonFk)
}
private fun missingTrashSuccesful() {
var totalQuantity: Int = 0
try {
totalQuantity = sales[positionCollectionMissing].saldo.toInt() - quantityCollectionMissing.toInt()
} catch (e: Exception) {
}
try {
sales[positionCollectionMissing].saldo = quantityCollectionMissing.toInt()
} catch (e: Exception) {
sales[positionCollectionMissing].saldo = 0
}
if (quantityCollectionMissing == "0")
markLine(positionCollectionMissing)
saleAdapter!!.notifyDataSetChanged()
var message=""
val ticket =
"[" + sales[positionCollectionMissing].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionMissing].id + "/summary)"
when (typeCollectionMissing){
"TRUE"->{
message = "Se ha enviado desde previa a Basura " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket
}
"FALSE"->{
message= "Se ha enviado desde previa a Faltas la cantidad de " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket
}
"reject"->{
var quantityOriginal=totalQuantity.toInt()+quantityCollectionMissing.toInt()
message = "Se ha modificado desde previa la cantidad de " +quantityOriginal+ " del artículo " + sales[positionCollectionMissing].itemFk + " a nueva cantidad: " + quantityCollectionMissing+ " del ticket " + ticket
}
}
//sendSalixMessageNew(message, sales[positionCollectionMissing].trabajador)
sendSalixMessageNew(message, sales[positionCollectionMissing].salesPersonFk)
}
private fun sendSalixMessageNew(message: String, workerId: String) {
viewModel.sendChekingPresence(
token = getData(TOKEN),
workerId = workerId,
message = message,
"sendChekingPresence"
)
}
//CREATE LIST //CREATE LIST
private fun searchTicket(ticketFk: String) { private fun searchTicket(ticketFk: String) {
Log.i(TAG, "Escaneamos ticket en previa") Log.i(TAG, "Escaneamos ticket en previa")
@ -246,10 +338,10 @@ class PreSacadorFragment :
d("VERDNATURA::", "ticket:" + ticket) d("VERDNATURA::", "ticket:" + ticket)
viewModel.ticketToPrePrepare( viewModel.ticketToPrePrepare(
usuario = user, usuario = getData(USER),
password = password, getData(PASSWORD),
ticketFk = ticketFk, ticketFk = ticketFk,
sectorFk = sectorFk sectorFk = getData(SECTORFK)
) )
} }
@ -273,6 +365,7 @@ class PreSacadorFragment :
for (s in sales){ for (s in sales){
Log.d("VERDNATURA::","sales "+s.longName) Log.d("VERDNATURA::","sales "+s.longName)
Log.d("VERDNATURA::","sales "+s.salesPersonFk)
//sergio: para que no de error si no hay carros. Ya está asignado a 0 el pickingorder si no hay item en el carro //sergio: para que no de error si no hay carros. Ya está asignado a 0 el pickingorder si no hay item en el carro
if (!s.carros.isNullOrEmpty()){ if (!s.carros.isNullOrEmpty()){
s.pickingOrder=s.carros.get(0).pickingOrder s.pickingOrder=s.carros.get(0).pickingOrder
@ -441,8 +534,8 @@ class PreSacadorFragment :
private fun saleTrackingReplace(position: Int) { private fun saleTrackingReplace(position: Int) {
viewModel.saleTrackingReplace( viewModel.saleTrackingReplace(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
saleFk = sales[position].idMovimiento, saleFk = sales[position].idMovimiento,
vIsChecked = if (sales[position].picked == sales[position].quantity) "1" else "0", vIsChecked = if (sales[position].picked == sales[position].quantity) "1" else "0",
vOriginalQuantity = sales[position].picked.toString(), vOriginalQuantity = sales[position].picked.toString(),
@ -470,8 +563,8 @@ class PreSacadorFragment :
saleAdapter!!.notifyDataSetChanged() saleAdapter!!.notifyDataSetChanged()
setListPosition(position) setListPosition(position)
viewModel.saleTrackingDel( viewModel.saleTrackingDel(
usuario = user, usuario =getData(USER),
password = password, password = getData(PASSWORD),
saleFk = sales[position].idMovimiento, "saleTracking_del" saleFk = sales[position].idMovimiento, "saleTracking_del"
) )
setTotalLines() setTotalLines()
@ -497,8 +590,8 @@ class PreSacadorFragment :
} catch (e: Exception) { } catch (e: Exception) {
} }
viewModel.itemPlacementSupplyAiming( viewModel.itemPlacementSupplyAiming(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
itemFk = sales[position].itemFk, itemFk = sales[position].itemFk,
quantity = quantityGet, quantity = quantityGet,
shelvingFk = sales[position].carros[shelvingPosition].shelving, shelvingFk = sales[position].carros[shelvingPosition].shelving,
@ -539,8 +632,8 @@ class PreSacadorFragment :
itemShelvingFkStored = itemShelvingFk itemShelvingFkStored = itemShelvingFk
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getIdFromCode( viewModel.getIdFromCode(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
code = customDialogList.getValueTwo(), "barcodeToItem" code = customDialogList.getValueTwo(), "barcodeToItem"
) )
customDialogList.dismiss() customDialogList.dismiss()
@ -586,8 +679,8 @@ class PreSacadorFragment :
itemShelvingFkStored = itemShelvingFk itemShelvingFkStored = itemShelvingFk
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getIdFromCode( viewModel.getIdFromCode(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
code = customDialogList.getValueTwo(), "barcodeToItem" code = customDialogList.getValueTwo(), "barcodeToItem"
) )
customDialogList.dismiss() customDialogList.dismiss()
@ -633,8 +726,8 @@ class PreSacadorFragment :
(shelvingVisible.toInt() - customDialogList.getValue().toInt()).toString() (shelvingVisible.toInt() - customDialogList.getValue().toInt()).toString()
viewModel.itemShelvingSaleSupplyAdd( viewModel.itemShelvingSaleSupplyAdd(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
itemShelvingFk = itemShelvingFk, itemShelvingFk = itemShelvingFk,
saleFk = sales[storedPosition].idMovimiento, saleFk = sales[storedPosition].idMovimiento,
quantity = customDialogList.getValue(), callFunction = "itemShelvingSaleSupplyAdd" quantity = customDialogList.getValue(), callFunction = "itemShelvingSaleSupplyAdd"
@ -884,8 +977,99 @@ class PreSacadorFragment :
}.show() }.show()
} }
//FALTAS / BASURA / SPLIT
private fun showQuantityDialog(position: Int) { private fun showQuantityDialog(position: Int) {
customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)).setValue("")
.setOkButton(getString(R.string.Faltas)) {
checkAndCall(
position,
customDialogThreeButtons.getValue(),
getString(R.string.Faltas)
)
}.setOkButtonTwo(getString(R.string.BasuraRechazar)) {
checkAndCall(
position,
customDialogThreeButtons.getValue(),
getString(R.string.BasuraRechazar)
)
}.setOkButtonThree(getString(R.string.Reject)) {
checkAndCall(
position,
customDialogThreeButtons.getValue(),
getString(R.string.Reject)
)
}.setOkButtonFour(getString(R.string.Split)) {
checkAndCall(
position,
customDialogThreeButtons.getValue(),
getString(R.string.Split)
)
}.setOkButtonAdd(getString(R.string.Agregar)) {
checkAndCall(
position,
customDialogThreeButtons.getValue(),
getString(R.string.Agregar)
)
}.setKoButton("Cancelar") {
scanRequest()
customDialogThreeButtons.dismiss()
}.show()
}
private fun checkAndCall(position: Int, value: String, action: String) {
if (value.trim().isNullOrEmpty()) {
getString(R.string.Indicanuevacantidad).toast(requireContext())
} else {
when (action) {
getString(R.string.Agregar) -> increaseQuantity(position, value)
getString(R.string.BasuraRechazar) -> TrashMissingReject(position, value,"TRUE")
getString(R.string.Faltas) -> TrashMissingReject(position, value,"FALSE")
getString(R.string.Reject) -> TrashMissingReject(position, value,"reject")
getString(R.string.Split) -> split(position, value)
}
scanRequest()
customDialogThreeButtons.dismiss()
}
}
private fun TrashMissingReject(
position: Int,
quantity: String,
typeCollectionTrashMissingReject: String
) {
typeCollectionMissing = typeCollectionTrashMissingReject
positionCollectionMissing = position
quantityCollectionMissing = quantity
var totalQuantity: Int = 0
try {
totalQuantity = sales[position].saldo.toInt() - quantity.toInt()
} catch (e: Exception) {
}
viewModel.collectionMissingTrash(
usuario = getData(USER),
password = getData(PASSWORD),
saleFk = sales[position].idMovimiento,
quantity = totalQuantity.toString(),
warehouseFk = getData(WAREHOUSEFK),
type = "FALSE",
originalQuantity = quantity, callFunction = "collectionMissingTrash"
)
}
//FALTAS / BASURA / SPLIT
private fun showQuantityDialogOld(position: Int) {
customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)).setValue("") customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)).setValue("")
.setOkButton(getString(R.string.Faltas)) { .setOkButton(getString(R.string.Faltas)) {
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
@ -942,8 +1126,8 @@ class PreSacadorFragment :
} catch (e: Exception) { } catch (e: Exception) {
} }
viewModel.saleMove( viewModel.saleMove(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
saleFk = sales[position].idMovimiento, saleFk = sales[position].idMovimiento,
quantity = totalQuantity.toString(), quantity = totalQuantity.toString(),
originalQuantity = sales[position].quantity.toString(), "saleMove" originalQuantity = sales[position].quantity.toString(), "saleMove"
@ -963,12 +1147,12 @@ class PreSacadorFragment :
//enviar mensaje a salix //enviar mensaje a salix
val ticket = val ticket =
"[" + ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + ticketFk + "/summary)" "[" + sales[position].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].id + "/summary)"
val message = val message =
"Se ha enviado a Split el articulo " + sales[position].itemFk + " del ticket " + ticket "Se ha enviado a Split el articulo " + sales[position].itemFk + " del ticket " + ticket
viewModel.sendChekingPresence( viewModel.sendChekingPresence(
token = token, token = getData(TOKEN),
workerId = sales[position].trabajador, workerId = sales[position].salesPersonFk,
message = message, message = message,
"sendChekingPresence" "sendChekingPresence"
) )
@ -983,11 +1167,11 @@ class PreSacadorFragment :
} catch (e: Exception) { } catch (e: Exception) {
} }
viewModel.collectionMissingTrash( viewModel.collectionMissingTrash(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
saleFk = sales[position].idMovimiento, saleFk = sales[position].idMovimiento,
quantity = totalQuantity.toString(), quantity = totalQuantity.toString(),
warehouseFk = warehouseFk, warehouseFk = getData(WAREHOUSEFK),
type = "FALSE", type = "FALSE",
originalQuantity = quantity, callFunction = "collectionMissingTrash" originalQuantity = quantity, callFunction = "collectionMissingTrash"
) )
@ -1005,12 +1189,12 @@ class PreSacadorFragment :
//enviar mensaje a salix //enviar mensaje a salix
val ticket = val ticket =
"[" + ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + ticketFk + "/summary)" "[" + sales[position].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].id + "/summary)"
val message = val message =
"Se ha enviado a Faltas la cantidad de " + totalQuantity + " del articulo " + sales[position].itemFk + " ticket " + ticket "Se ha enviado a Faltas la cantidad de " + totalQuantity + " del articulo " + sales[position].itemFk + " ticket " + ticket
viewModel.sendChekingPresence( viewModel.sendChekingPresence(
token = token, token = getData(TOKEN),
workerId = sales[position].trabajador, workerId = sales[position].salesPersonFk,
message = message, message = message,
"sendChekingPresence" "sendChekingPresence"
) )
@ -1023,11 +1207,11 @@ class PreSacadorFragment :
} catch (e: Exception) { } catch (e: Exception) {
} }
viewModel.collectionMissingTrash( viewModel.collectionMissingTrash(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
saleFk = sales[position].idMovimiento, saleFk = sales[position].idMovimiento,
quantity = totalQuantity.toString(), quantity = totalQuantity.toString(),
warehouseFk = warehouseFk, warehouseFk = getData(WAREHOUSEFK),
type = "TRUE", type = "TRUE",
originalQuantity = quantity, callFunction = "collectionMissingTrash" originalQuantity = quantity, callFunction = "collectionMissingTrash"
) )
@ -1047,12 +1231,12 @@ class PreSacadorFragment :
//enviar mensaje a salix //enviar mensaje a salix
val ticket = val ticket =
"[" + ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + ticketFk + "/summary)" "[" + sales[position].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].id + "/summary)"
val message = val message =
"Se ha enviado a Basura " + totalQuantity + " del articulo " + sales[position].itemFk + " ticket " + ticket "Se ha enviado a Basura " + totalQuantity + " del articulo " + sales[position].itemFk + " ticket " + ticket
viewModel.sendChekingPresence( viewModel.sendChekingPresence(
token = token, token = getData(TOKEN),
workerId = sales[position].trabajador, workerId = sales[position].salesPersonFk,
message = message, message = message,
"sendChekingPresence" "sendChekingPresence"
) )
@ -1065,11 +1249,11 @@ class PreSacadorFragment :
} catch (e: Exception) { } catch (e: Exception) {
} }
viewModel.collectionMissingTrash( viewModel.collectionMissingTrash(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
saleFk = sales[position].idMovimiento, saleFk = sales[position].idMovimiento,
quantity = totalQuantity.toString(), quantity = totalQuantity.toString(),
warehouseFk = warehouseFk, warehouseFk = getData(WAREHOUSEFK),
type = "reject", type = "reject",
originalQuantity = quantity, callFunction = "collectionMissingTrash" originalQuantity = quantity, callFunction = "collectionMissingTrash"
) )
@ -1080,8 +1264,8 @@ class PreSacadorFragment :
val message = val message =
"Se ha modificado la cantidad original " + sales[position].saldo + " del artículo " + sales[position].itemFk + " a nueva cantidad: " + quantity + " del ticket " + ticket "Se ha modificado la cantidad original " + sales[position].saldo + " del artículo " + sales[position].itemFk + " a nueva cantidad: " + quantity + " del ticket " + ticket
viewModel.sendChekingPresence( viewModel.sendChekingPresence(
token = token, token = getData(TOKEN),
workerId = sales[position].trabajador, workerId = sales[position].salesPersonFk,
message = message, message = message,
"sendChekingPresence" "sendChekingPresence"
) )
@ -1099,10 +1283,10 @@ class PreSacadorFragment :
} }
private fun increaseQuantity(position: Int, quantity: String) { private fun increaseQuantityOld(position: Int, quantity: String) {
viewModel.collectionIncreaseQuantity( viewModel.collectionIncreaseQuantity(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
saleFk = sales[position].idMovimiento, saleFk = sales[position].idMovimiento,
quantity = quantity, quantity = quantity,
callFunction = "collection_increaseQuantity" callFunction = "collection_increaseQuantity"
@ -1111,16 +1295,17 @@ class PreSacadorFragment :
//enviar mensaje a salix //enviar mensaje a salix
val ticket = val ticket =
"[" + ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + ticketFk + "/summary)" "[" + sales[position].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].id + "/summary)"
val message = val message =
"Se ha modificado la cantidad original " + sales[position].saldo + " del artículo " + sales[position].itemFk + " a nueva cantidad: " + quantity + " del ticket " + ticket "Se ha modificado la cantidad original " + sales[position].saldo + " del artículo " + sales[position].itemFk + " a nueva cantidad: " + quantity + " del ticket " + ticket
viewModel.sendChekingPresence( viewModel.sendChekingPresence(
token = token, token = getData(TOKEN),
workerId = sales[position].trabajador, workerId = sales[position].salesPersonFk,
message = message, message = message,
"sendChekingPresence" "sendChekingPresence"
) )
Log.d("VERDNATURA","el trabajador es "+sales[position].salesPersonFk)
try { try {
sales[position].saldo = quantity.toInt() sales[position].saldo = quantity.toInt()
} catch (e: Exception) { } catch (e: Exception) {
@ -1131,6 +1316,20 @@ class PreSacadorFragment :
saleAdapter?.notifyDataSetChanged() saleAdapter?.notifyDataSetChanged()
}
private fun increaseQuantity(position: Int, quantity: String) {
positionIncreaseQuantity = position
quantityIncrease = quantity
viewModel.collectionIncreaseQuantity(
usuario = getData(USER),
password = getData(PASSWORD),
saleFk = sales[position].idMovimiento,
quantity = quantity,
callFunction = "collection_increaseQuantity"
)
} }
} }

View File

@ -56,6 +56,10 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
val responseSalixMessage: LiveData<ResponseItemVO> val responseSalixMessage: LiveData<ResponseItemVO>
get() = _responseSalixMessage get() = _responseSalixMessage
private val _responseMissingTrash by lazy { MutableLiveData<ResponseItemVO>() }
val responseMissingTrash: LiveData<ResponseItemVO>
get() = _responseMissingTrash
fun ticketToPrePrepare(usuario: String, password: String, ticketFk: String, sectorFk: String) fun ticketToPrePrepare(usuario: String, password: String, ticketFk: String, sectorFk: String)
{ {
getPreSacadorUseCase.ticketToPrePrepare(usuario, password, ticketFk, sectorFk) getPreSacadorUseCase.ticketToPrePrepare(usuario, password, ticketFk, sectorFk)
@ -433,7 +437,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{ {
override fun onFailure(call: Call<String>, t: Throwable) override fun onFailure(call: Call<String>, t: Throwable)
{ {
_response.value = ResponseItemVO( _responseMissingTrash.value = ResponseItemVO(
isError = true, isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
) )
@ -443,12 +447,12 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{ {
if (response.body() == null) if (response.body() == null)
{ {
_response.value = ResponseItemVO( _responseMissingTrash.value = ResponseItemVO(
isError = true, isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else } else
{ {
_response.value = ResponseItemVO(isError = false, response = response.body()!!) _responseMissingTrash.value = ResponseItemVO(isError = false, response = response.body()!!)
} }
} }
}) })
@ -509,8 +513,8 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{ {
_responseSalixMessage.value = ResponseItemVO( _responseSalixMessage.value = ResponseItemVO(
isError = true, isError = true,
errorMessage = "Error en la llamada $calledFunction al enviar mensaje rocket." + getMessageFromResponse( errorMessage = "Error en la llamada $calledFunction al enviar mensaje rocket." + getMessageFromAllResponse(
response.message() nameofFunction(this),response.message()
) )
) )
//Log.i("Salix","Mensaje enviado a salix") //Log.i("Salix","Mensaje enviado a salix")
@ -520,12 +524,16 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
override fun onFailure(call: Call<Boolean>, t: Throwable) override fun onFailure(call: Call<Boolean>, t: Throwable)
{ {
/* _responseSalixMessage.value = ResponseItemVO(
isError = true,
errorMessage = "Error en la llamada $calledFunction al enviar mensaje rocket." + getMessageFromAllResponse(
nameofFunction(this),t.message!!))*/
Log.i("Salix Error", "" + t.message)
} }
}) })
} catch (e: Exception) } catch (e: Exception)
{ {
Log.d("VERDNATURA","error "+e.message)
} }
} }

View File

@ -19,7 +19,10 @@ fun PreSacadorItemVO.toSale() : SaleVO {
originalQuantity = quantity.toString(), originalQuantity = quantity.toString(),
placements = carros, placements = carros,
agencyName = if (trabajador.isNullOrEmpty()) { "" } else trabajador, agencyName = if (trabajador.isNullOrEmpty()) { "" } else trabajador,
packingType=packingType packingType=packingType,
salePersonFk=if (salesPersonFk.isNullOrEmpty()){""}else salesPersonFk
) )
} }

View File

@ -15,7 +15,8 @@ class PreSacadorItemVO (
var trabajador : String = "", var trabajador : String = "",
var carros : List<PlacementVO> = listOf(), var carros : List<PlacementVO> = listOf(),
//var priority:Int =0, 7-1-2022 //var priority:Int =0, 7-1-2022
var pickingOrder:Int =0 var pickingOrder:Int =0,
var salesPersonFk:String= "sergio"
) )

View File

@ -1,36 +1,24 @@
package es.verdnatura.presentation.view.feature.qr package es.verdnatura.presentation.view.feature.qr
import android.content.SharedPreferences
import android.os.Bundle
import android.view.KeyEvent.* import android.view.KeyEvent.*
import android.view.View import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentQrBinding import es.verdnatura.databinding.FragmentQrBinding
import es.verdnatura.domain.ConstAndValues
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
/*import kotlinx.android.synthetic.main.fragment_controlador.*
import kotlinx.android.synthetic.main.toolbar.**/
class QrFragment( class QrFragment(
var entryPoint: String = "" var entryPoint: String = ""
) : BaseFragment<FragmentQrBinding, QrFragmentViewModel>(QrFragmentViewModel::class) { ) : BaseFragment<FragmentQrBinding, QrFragmentViewModel>(QrFragmentViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var goBack: Boolean = false private var goBack: Boolean = false
override fun getLayoutId(): Int = R.layout.fragment_qr override fun getLayoutId(): Int = R.layout.fragment_qr
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var type = ""
private var itemscaned = "" private var itemscaned = ""
companion object { companion object {
@ -58,16 +46,6 @@ class QrFragment(
super.onPause() super.onPause()
} }
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
type = ConstAndValues.PRECHECKER
super.onCreate(savedInstanceState)
}
private fun setEvents() { private fun setEvents() {
@ -84,7 +62,7 @@ class QrFragment(
goBack = false goBack = false
if (!binding.scanInput.text.isNullOrEmpty()) { if (!binding.scanInput.text.isNullOrEmpty()) {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.qr_getCall(user, password, binding.scanInput.text.toString(),"qr_getCall") viewModel.qr_getCall(getData(USER), getData(PASSWORD), binding.scanInput.text.toString(),"qr_getCall")
itemscaned = binding.scanInput.text.toString() itemscaned = binding.scanInput.text.toString()
} }
@ -95,11 +73,8 @@ class QrFragment(
} }
// false // false
} }
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {

View File

@ -7,7 +7,7 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetQrReaderUserCase import es.verdnatura.domain.GetQrReaderUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.reposicion.fragment package es.verdnatura.presentation.view.feature.reposicion.fragment
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.media.MediaPlayer import android.media.MediaPlayer
import android.os.Build import android.os.Build
@ -14,8 +13,6 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.ReposicionFragmentBinding import es.verdnatura.databinding.ReposicionFragmentBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
@ -25,25 +22,17 @@ import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.component.CustomDialogThreeButtons import es.verdnatura.presentation.view.component.CustomDialogThreeButtons
import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.reposicion.adapter.ReposicionAdapter import es.verdnatura.presentation.view.feature.reposicion.adapter.ReposicionAdapter
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.reposicion_fragment.*
import kotlinx.android.synthetic.main.toolbar.**/
class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionViewModel>( class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionViewModel>(
ReposicionViewModel::class){ ReposicionViewModel::class){
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
@ -95,12 +84,6 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
mperror = MediaPlayer.create((activity as MainActivity),R.raw.error) mperror = MediaPlayer.create((activity as MainActivity),R.raw.error)
mpok = MediaPlayer.create((activity as MainActivity),R.raw.ok) mpok = MediaPlayer.create((activity as MainActivity),R.raw.ok)
@ -121,7 +104,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
binding.btnObtener.setOnClickListener { binding.btnObtener.setOnClickListener {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.itemPlacementSupplyGetOrder(usuario = user,password = password,sectorFk = sectorFk,"itemPlacementSupplyGetOrder") viewModel.itemPlacementSupplyGetOrder(usuario = getData(USER),password = getData(PASSWORD),sectorFk = getData(SECTORFK),"itemPlacementSupplyGetOrder")
} }
binding.btnCancelar.setOnClickListener { binding.btnCancelar.setOnClickListener {
@ -132,7 +115,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
}.setOkButton("Cerrar"){ }.setOkButton("Cerrar"){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
if (sales.count() > 0){ if (sales.count() > 0){
viewModel.itemPlacementSupplyCloseOrder(usuario = user,password = password,id = sales[0].id,quantity = sales[0].quantity.toString(),"itemPlacementSupplyCloseOrder") viewModel.itemPlacementSupplyCloseOrder(usuario = getData(USER),password = getData(PASSWORD),id = sales[0].id,quantity = sales[0].quantity.toString(),"itemPlacementSupplyCloseOrder")
} }
customDialog.dismiss() customDialog.dismiss()
@ -170,7 +153,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
//LISTA ========= //LISTA =========
binding.collectionSwipe.setOnRefreshListener { binding.collectionSwipe.setOnRefreshListener {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.itemPlacementSupplyGetOrder(usuario = user,password = password,sectorFk = sectorFk,"itemPlacementSupplyGetOrder") viewModel.itemPlacementSupplyGetOrder(usuario = getData(USER),password = getData(PASSWORD),sectorFk = getData(SECTORFK),"itemPlacementSupplyGetOrder")
binding.collectionSwipe.isRefreshing = false binding.collectionSwipe.isRefreshing = false
} }
@ -353,8 +336,8 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
quantityGet = (sales[position].saldo - sales[position].picked).toString() quantityGet = (sales[position].saldo - sales[position].picked).toString()
}catch (e:Exception){} }catch (e:Exception){}
viewModel.itemPlacementSupplyAiming( viewModel.itemPlacementSupplyAiming(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
itemFk = sales[position].itemFk, itemFk = sales[position].itemFk,
quantity = quantityGet, quantity = quantityGet,
shelvingFk = sales[position].carros[shelvingPosition].shelving, shelvingFk = sales[position].carros[shelvingPosition].shelving,
@ -391,8 +374,8 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
itemShelvingFkStored = itemShelvingFk itemShelvingFkStored = itemShelvingFk
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getIdFromCode( viewModel.getIdFromCode(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
code = customDialogList.getValueTwo(),"barcodeToItem" code = customDialogList.getValueTwo(),"barcodeToItem"
) )
customDialogList.dismiss() customDialogList.dismiss()
@ -429,8 +412,8 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
itemShelvingFkStored = itemShelvingFk itemShelvingFkStored = itemShelvingFk
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getIdFromCode( viewModel.getIdFromCode(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
code = customDialogList.getValueTwo(),"barcodeToItem" code = customDialogList.getValueTwo(),"barcodeToItem"
) )
customDialogList.dismiss() customDialogList.dismiss()
@ -473,8 +456,8 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
sales[storedPosition].carros[storedShelvingPosition].stockTotal = (shelvingVisible.toInt() - customDialogList.getValue().toInt()).toString() sales[storedPosition].carros[storedShelvingPosition].stockTotal = (shelvingVisible.toInt() - customDialogList.getValue().toInt()).toString()
viewModel.itemShelvingPlacementSupplyAdd( viewModel.itemShelvingPlacementSupplyAdd(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
itemShelvingFk = itemShelvingFk, itemShelvingFk = itemShelvingFk,
itemPlacementSupplyFk = sales[storedPosition].id, itemPlacementSupplyFk = sales[storedPosition].id,
quantity = customDialogList.getValue(),"itemShelvingPlacementSupplyAdd" quantity = customDialogList.getValue(),"itemShelvingPlacementSupplyAdd"

View File

@ -7,7 +7,7 @@ import es.verdnatura.domain.GetPreSacadorUseCase
import es.verdnatura.domain.GetSacadorControladorUserCase import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.domain.GetUbicadorUserCase import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO

View File

@ -1,10 +1,8 @@
package es.verdnatura.presentation.view.feature.sacador.fragment package es.verdnatura.presentation.view.feature.sacador.fragment
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build import android.os.Build
import android.os.Bundle
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
@ -12,35 +10,24 @@ import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentSacadorBinding import es.verdnatura.databinding.FragmentSacadorBinding
import es.verdnatura.domain.ConstAndValues.SACADOR import es.verdnatura.domain.ConstAndValues.SACADOR
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.sacador.adapter.CollectionAdapter import es.verdnatura.presentation.view.feature.sacador.adapter.CollectionAdapter
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.AssociateSmartTagsFragment import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.AssociateSmartTagsFragment
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_sacador.*
import kotlinx.android.synthetic.main.toolbar.**/
class SacadorFragment : class SacadorFragment :
BaseFragment<FragmentSacadorBinding, SacadorViewModel>(SacadorViewModel::class) { BaseFragment<FragmentSacadorBinding, SacadorViewModel>(SacadorViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
private var goBack: Boolean = false private var goBack: Boolean = false
private var goBack2: Boolean = false private var goBack2: Boolean = false
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var collectionsList: ArrayList<CollectionVO> = ArrayList() private var collectionsList: ArrayList<CollectionVO> = ArrayList()
private var adapter: CollectionAdapter? = null private var adapter: CollectionAdapter? = null
private var wagons = ""
private var resultTagMode:String? = "" private var resultTagMode:String? = ""
@ -55,25 +42,6 @@ class SacadorFragment :
override fun getLayoutId(): Int = R.layout.fragment_sacador override fun getLayoutId(): Int = R.layout.fragment_sacador
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
wagons = prefs.getInt(WAGON, 2).toString()
//sergio:listener para collectionnew
/* setFragmentResultListener("requestKey") { key, bundle ->
resultTagMode = bundle.getString("tagMode")
Log.i("VERDNATURA:", "el result es ${resultTagMode}")
checkTagsMode()
}*/
super.onCreate(savedInstanceState)
}
override fun init() { override fun init() {
@ -83,8 +51,9 @@ class SacadorFragment :
binding.mainToolbar.toolbarTitle.text = getString(R.string.getcollection) binding.mainToolbar.toolbarTitle.text = getString(R.string.getcollection)
setToolBar() setToolBar()
setEvents() setEvents()
viewModel.collectionGet(user, password,"collection_get") viewModel.collectionGetSalix(token = getData(TOKEN))
/*viewModel.collectionGet( getData(USER),
getData(PASSWORD),"collection_get")*/
super.init() super.init()
} }
@ -127,7 +96,8 @@ class SacadorFragment :
iconAdd.drawable -> { iconAdd.drawable -> {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.collectionNew(user,password,sectorFk,wagons,getTagsType(),"collection_new_wagon") viewModel.collectionNew(getData(USER),
getData(PASSWORD),getData(SECTORFK),getData(WAGON),getData(TAGSTYPE),"collection_new_wagon")
} }
iconVehicleIn.drawable-> (activity as MainActivity).onVehicleSelected(SacadorFragment.TAG) iconVehicleIn.drawable-> (activity as MainActivity).onVehicleSelected(SacadorFragment.TAG)
} }
@ -150,8 +120,10 @@ class SacadorFragment :
private fun setEvents() { private fun setEvents() {
binding.sacadorSwipe.setOnRefreshListener { binding.sacadorSwipe.setOnRefreshListener {
viewModel.collectionGet(user, password,"collection_get") viewModel.collectionGetSalix(token = getData(TOKEN))
binding.sacadorSwipe.isRefreshing = false /* viewModel.collectionGet(getData(USER),
getData(PASSWORD),"collection_get")
binding.sacadorSwipe.isRefreshing = false*/
} }
} }
@ -161,13 +133,15 @@ class SacadorFragment :
// Log.i("VERDNATURA:", "Tag type: ${getTagsType()}") // Log.i("VERDNATURA:", "Tag type: ${getTagsType()}")
if (getTagsType().equals("Stickers")) { if (getData(TAGSTYPE).equals("Stickers")) {
//viewModel.collectionNew(user, password, sectorFk, wagons, "Stickers") //viewModel.collectionNew(user, password, sectorFk, wagons, "Stickers")
viewModel.collectionNew(user, password, sectorFk, wagons,"collection_new_wagon") viewModel.collectionNew(getData(USER),
getData(PASSWORD), getData(SECTORFK), getData(WAGON),"collection_new_wagon")
} else { } else {
// Log.i("VERDNATURA:", " el resultTagmode es ${resultTagMode}") // Log.i("VERDNATURA:", " el resultTagmode es ${resultTagMode}")
if (resultTagMode.equals("complete")) { if (resultTagMode.equals("complete")) {
viewModel.collectionNew(user, password, sectorFk, wagons, getTagsType(),"collection_new_wagon") viewModel.collectionNew(getData(USER),
getData(PASSWORD), getData(SECTORFK), getData(WAGON), getData(TAGSTYPE),"collection_new_wagon")
} else { } else {
requireActivity().addFragment( requireActivity().addFragment(
AssociateSmartTagsFragment.newInstance(AssociateSmartTagsFragment.TAG), AssociateSmartTagsFragment.newInstance(AssociateSmartTagsFragment.TAG),
@ -217,7 +191,8 @@ class SacadorFragment :
} }
goBack = false goBack = false
//sergio:para asegurarnos que aparece en pantalla. En mi movil personal y trabajo no hacia falta. //sergio:para asegurarnos que aparece en pantalla. En mi movil personal y trabajo no hacia falta.
viewModel.collectionGet(user,password,"collection_get") /* viewModel.collectionGet(getData(USER),getData(PASSWORD),"collection_get")*/
viewModel.collectionGetSalix(token=getData(TOKEN))
}) })
} }
} }

View File

@ -6,7 +6,7 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetSacadorControladorUserCase import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO
@ -175,4 +175,36 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
}) })
} }
fun collectionGetSalix(token:String){
getSacadorControladorUserCase.collectionGetSalix(token).enqueue(object :
Callback<List<CollectionVO>> {
override fun onFailure(call: Call<List<CollectionVO>>, t: Throwable) {
val listError: ArrayList<CollectionVO> = ArrayList()
listError.add(CollectionVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_collectionList.value = CollectionListVO(listError)
}
override fun onResponse(
call: Call<List<CollectionVO>>,
response: Response<List<CollectionVO>>
) {
if (response.body() != null) {
_collectionList.value =
response.body()?.let { CollectionListVO(it.toDateFormat()) }
} else {
val listError: ArrayList<CollectionVO> = ArrayList()
listError.add(
CollectionVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
)
_collectionList.value = CollectionListVO(listError)
}
}
})
}
} }

View File

@ -63,6 +63,7 @@ class SaleVO(
var saleGroupFk: String = "", var saleGroupFk: String = "",
var packingShelve:String="" var packingShelve:String=""
) )
class PlacementVO( class PlacementVO(

View File

@ -1,40 +1,23 @@
package es.verdnatura.presentation.view.feature.shelvingparking.fragment package es.verdnatura.presentation.view.feature.shelvingparking.fragment
import android.content.SharedPreferences
import android.view.View import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentShelvingParkingBinding import es.verdnatura.databinding.FragmentShelvingParkingBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.shelvingparking.adapter.ShelvingParkingAdapter import es.verdnatura.presentation.view.feature.shelvingparking.adapter.ShelvingParkingAdapter
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_shelving_parking.*
import kotlinx.android.synthetic.main.toolbar.**/
class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, ShelvingParkingViewModel>( class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, ShelvingParkingViewModel>(
ShelvingParkingViewModel::class) { ShelvingParkingViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var adapter : ShelvingParkingAdapter? = null private var adapter : ShelvingParkingAdapter? = null
private lateinit var customDialogInput: CustomDialogInput
private var listInvetory:ArrayList<ItemInventaryVO> = ArrayList()
private var listInvetoryAux:ArrayList<ItemInventaryVO> = ArrayList()
private lateinit var customDialog: CustomDialog
companion object { companion object {
fun newInstance() = ShelvingParkingFragment() fun newInstance() = ShelvingParkingFragment()
} }
@ -43,14 +26,8 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
override fun init() { override fun init() {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString() (activity as MainActivity).hideBottomNavigation(View.GONE)
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.shelvingParking_get) binding.mainToolbar.toolbarTitle.text = getString(R.string.shelvingParking_get)
setEvents() setEvents()
@ -69,7 +46,7 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
if (!binding.shelvingText.text.toString().isNullOrEmpty()){ if (!binding.shelvingText.text.toString().isNullOrEmpty()){
binding.mainToolbar.toolbarTitle.text = binding.shelvingText.text.toString() binding.mainToolbar.toolbarTitle.text = binding.shelvingText.text.toString()
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.shelvingParking_get(user,password,binding.shelvingText.text.toString(),warehouseFk,binding.dayrange.text.toString(),"shelvingParking_get") viewModel.shelvingParking_get( getData(USER),getData(PASSWORD),binding.shelvingText.text.toString(),getData(WAREHOUSEFK),binding.dayrange.text.toString(),"shelvingParking_get")
} }
binding.shelvingText.setText("") binding.shelvingText.setText("")
@ -88,7 +65,7 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
binding.shelvingText.requestFocus() binding.shelvingText.requestFocus()
binding.mainToolbar.toolbarTitle.text = binding.shelvingText.text.toString() binding.mainToolbar.toolbarTitle.text = binding.shelvingText.text.toString()
viewModel.shelvingParking_get(user,password,binding.shelvingText.text.toString(),warehouseFk,binding.dayrange.text.toString(),"shelvingParking_get") viewModel.shelvingParking_get( getData(USER),getData(PASSWORD),binding.shelvingText.text.toString(),getData(WAREHOUSEFK),binding.dayrange.text.toString(),"shelvingParking_get")
binding.shelvingText.setText("") binding.shelvingText.setText("")
(activity as MainActivity).hideKeyboard(binding.dayrange) (activity as MainActivity).hideKeyboard(binding.dayrange)
return@setOnEditorActionListener true return@setOnEditorActionListener true

View File

@ -6,7 +6,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetShelvingParkingUserCase import es.verdnatura.domain.GetShelvingParkingUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.showticket package es.verdnatura.presentation.view.feature.showticket
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
@ -9,25 +8,16 @@ import androidx.lifecycle.Observer
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentControladorBinding import es.verdnatura.databinding.FragmentControladorBinding
import es.verdnatura.domain.ConstAndValues import es.verdnatura.domain.ConstAndValues
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnCollectionSelectedListener import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.precontrol.ShowTicketViewModel import es.verdnatura.presentation.view.feature.precontrol.ShowTicketViewModel
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
/*import kotlinx.android.synthetic.main.fragment_controlador.*
import kotlinx.android.synthetic.main.toolbar.**/
class ShowTicketFragment: BaseFragment<FragmentControladorBinding, ShowTicketViewModel>( class ShowTicketFragment: BaseFragment<FragmentControladorBinding, ShowTicketViewModel>(
ShowTicketViewModel::class) { ShowTicketViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var goBack:Boolean = false private var goBack:Boolean = false
private var onCollectionSelectedListener : OnCollectionSelectedListener? = null private var onCollectionSelectedListener : OnCollectionSelectedListener? = null
override fun getLayoutId(): Int = R.layout.fragment_controlador override fun getLayoutId(): Int = R.layout.fragment_controlador
@ -58,11 +48,7 @@ class ShowTicketFragment: BaseFragment<FragmentControladorBinding, ShowTicketVie
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
type=ConstAndValues.VERTICKET type=ConstAndValues.VERTICKET
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
@ -81,9 +67,9 @@ class ShowTicketFragment: BaseFragment<FragmentControladorBinding, ShowTicketVie
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
usuario = user, usuario = getData(USER),
password = password, password = getData(PASSWORD),
sectorFk = sectorFk, sectorFk = getData(SECTORFK),
collectionFk = binding.scanInput.text.toString(), collectionFk = binding.scanInput.text.toString(),
type = type, type = type,
callFunction = "collection_getTickets" callFunction = "collection_getTickets"
@ -113,14 +99,11 @@ class ShowTicketFragment: BaseFragment<FragmentControladorBinding, ShowTicketVie
}) })
} }
} }
private fun navigateToCollectionList(collection: CollectionVO){ private fun navigateToCollectionList(collection: CollectionVO){
onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.VERTICKET) onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.VERTICKET)
} }

View File

@ -2,8 +2,6 @@ package es.verdnatura.presentation.view.feature.smarttag.register
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle
import android.view.View import android.view.View
import android.view.View.* import android.view.View.*
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
@ -12,8 +10,6 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentSacadorAssociatesmarttagBinding import es.verdnatura.databinding.FragmentSacadorAssociatesmarttagBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
@ -25,16 +21,6 @@ import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.smarttag.adapter.SmartTagAdapter import es.verdnatura.presentation.view.feature.smarttag.adapter.SmartTagAdapter
import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag
import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.SmartTagsViewModel import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.SmartTagsViewModel
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.component_custom_three_dialog.*
import kotlinx.android.synthetic.main.fragment_collection.*
import kotlinx.android.synthetic.main.fragment_controlador.*
import kotlinx.android.synthetic.main.fragment_controlador.scan_input
import kotlinx.android.synthetic.main.fragment_controlador.binding.splashProgress
import kotlinx.android.synthetic.main.fragment_expedition_scan.*
import kotlinx.android.synthetic.main.fragment_login.*
import kotlinx.android.synthetic.main.fragment_sacador.**/
//import kotlinx.android.synthetic.main.toolbar.*
class RegisterSmartTagsFragment( class RegisterSmartTagsFragment(
var entryPoint: String = "" var entryPoint: String = ""
@ -42,12 +28,6 @@ class RegisterSmartTagsFragment(
SmartTagsViewModel::class SmartTagsViewModel::class
) { ) {
private var user = ""
private var userFk = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var goBack: Boolean = false private var goBack: Boolean = false
//private var onCollectionSelectedListener: OnCollectionSelectedListener? = null //private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
override fun getLayoutId(): Int = R.layout.fragment_sacador_associatesmarttag override fun getLayoutId(): Int = R.layout.fragment_sacador_associatesmarttag
@ -123,7 +103,8 @@ class RegisterSmartTagsFragment(
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
//poner el bindshelving aqui //poner el bindshelving aqui
viewModel.workerShelving_add(user, password, shelvingOrSmarttag) viewModel.workerShelving_add(getData(USER),
getData(PASSWORD), shelvingOrSmarttag)
if (listSmartTags.size < 1) { if (listSmartTags.size < 1) {
} else { } else {
@ -165,20 +146,6 @@ class RegisterSmartTagsFragment(
} }
} }
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
userFk = prefs.getString(USERFK, "0").toString()
super.onCreate(savedInstanceState)
}
private fun setEvents() { private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {

View File

@ -1,8 +1,6 @@
package es.verdnatura.presentation.view.feature.smarttag.sacador.fragment package es.verdnatura.presentation.view.feature.smarttag.sacador.fragment
import android.content.Context import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle
import android.util.Log import android.util.Log
import android.view.View import android.view.View
import android.view.View.* import android.view.View.*
@ -14,8 +12,6 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentVehiclecontrolBinding import es.verdnatura.databinding.FragmentVehiclecontrolBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
@ -26,18 +22,6 @@ import es.verdnatura.presentation.view.component.CustomDialogThreeButtons
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.smarttag.adapter.SmartTagAdapter import es.verdnatura.presentation.view.feature.smarttag.adapter.SmartTagAdapter
import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.component_custom_three_dialog.*
import kotlinx.android.synthetic.main.fragment_collection.*
import kotlinx.android.synthetic.main.fragment_controlador.*
import kotlinx.android.synthetic.main.fragment_controlador.scan_input
import kotlinx.android.synthetic.main.fragment_controlador.binding.splashProgress
import kotlinx.android.synthetic.main.fragment_expedition_scan.*
import kotlinx.android.synthetic.main.fragment_login.*
import kotlinx.android.synthetic.main.fragment_sacador.*
import kotlinx.android.synthetic.main.fragment_sacador_associatesmarttag.*
import kotlinx.android.synthetic.main.toolbar.**/
import timber.log.Timber import timber.log.Timber
class AssociateSmartTagsFragment( class AssociateSmartTagsFragment(
@ -46,13 +30,8 @@ class AssociateSmartTagsFragment(
SmartTagsViewModel::class SmartTagsViewModel::class
) { ) {
private var user = ""
private var userFk = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var goBack: Boolean = false private var goBack: Boolean = false
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
override fun getLayoutId(): Int = R.layout.fragment_sacador_associatesmarttag override fun getLayoutId(): Int = R.layout.fragment_sacador_associatesmarttag
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private lateinit var customDialogList: CustomDialogList private lateinit var customDialogList: CustomDialogList
@ -122,7 +101,8 @@ class AssociateSmartTagsFragment(
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
//poner el bindshelving aqui //poner el bindshelving aqui
viewModel.workerShelving_add(user, password, shelvingOrSmarttag) viewModel.workerShelving_add(getData(USER),
getData(PASSWORD), shelvingOrSmarttag)
if (listSmartTags.size < 1) { if (listSmartTags.size < 1) {
} else { } else {
@ -140,7 +120,8 @@ class AssociateSmartTagsFragment(
//ponser el unbindshleving aqui //ponser el unbindshleving aqui
//sergio:esto se debe hacer en //sergio:esto se debe hacer en
viewModel.workerShelving_delete(user, password, listSmartTags.last().code.toString()) viewModel.workerShelving_delete(getData(USER),
getData(PASSWORD), listSmartTags.last().code.toString())
("http://localhost:7777/unbindShelving/${listSmartTags.first().code}" + "&" + listSmartTags.last().code + "&${listSmartTags.size}").toast( ("http://localhost:7777/unbindShelving/${listSmartTags.first().code}" + "&" + listSmartTags.last().code + "&${listSmartTags.size}").toast(
requireContext() requireContext()
@ -162,17 +143,6 @@ class AssociateSmartTagsFragment(
} }
} }
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
userFk = prefs.getString(USERFK, "0").toString()
super.onCreate(savedInstanceState)
}
private fun setEvents() { private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
@ -260,31 +230,32 @@ class AssociateSmartTagsFragment(
} }
private fun getTextToPosition(TagsScaned: Int): String { private fun getTextToPosition(TagsScaned: Int): String {
var message = ""
when (TagsScaned) {
0 -> message = "Escanea etiqueta/s electrónica/s o matrícula/s" return when (TagsScaned) {
1 -> message = "Escanea etiqueta superior" 0 -> "Escanea etiqueta/s electrónica/s o matrícula/s"
2 -> message = "Escanea etiqueta del medio" 1 -> "Escanea etiqueta superior"
3 -> message = "Escanea etiqueta inferior" 2 -> "Escanea etiqueta del medio"
4 -> message = "Carro escaneado" 3 -> "Escanea etiqueta inferior"
4 -> "Carro escaneado"
else -> {""}
} }
return message
} }
private fun getTextScaned(TagScaned: Int): String { private fun getTextScaned(TagScaned: Int): String {
var message = ""
when (TagScaned) { return when (TagScaned) {
0 -> message = "Escaneado:" 0 -> "Escaneado:"
1 -> message = "Carro:" 1 -> "Carro:"
2 -> message = "Etiqueta superior:" 2 -> "Etiqueta superior:"
3 -> message = "Escanea del medio:" 3 -> "Escanea del medio:"
4 -> message = "Etiqueta inferior:" 4 -> "Etiqueta inferior:"
else -> {""}
} }
return message
} }

View File

@ -1,14 +1,11 @@
package es.verdnatura.presentation.view.feature.ubicador.fragment package es.verdnatura.presentation.view.feature.ubicador.fragment
import android.content.SharedPreferences
import android.view.View import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentAutomaticAddItemBinding import es.verdnatura.databinding.FragmentAutomaticAddItemBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnAutomaticItemClickListener import es.verdnatura.presentation.common.OnAutomaticItemClickListener
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
@ -17,18 +14,12 @@ import es.verdnatura.presentation.view.component.CustomDialogUbicador
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.ubicador.adapter.AutomaticAdapter import es.verdnatura.presentation.view.feature.ubicador.adapter.AutomaticAdapter
import es.verdnatura.presentation.view.feature.ubicador.model.ItemEscanerVO import es.verdnatura.presentation.view.feature.ubicador.model.ItemEscanerVO
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_automatic_add_item.*
import kotlinx.android.synthetic.main.toolbar.**/
class AutomaticAddItemFragment( class AutomaticAddItemFragment(
var shelvingFk : String = "" var shelvingFk : String = ""
) : BaseFragment<FragmentAutomaticAddItemBinding,AutomaticAddItemViewModel>(AutomaticAddItemViewModel::class) { ) : BaseFragment<FragmentAutomaticAddItemBinding,AutomaticAddItemViewModel>(AutomaticAddItemViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var adapter : AutomaticAdapter? = null private var adapter : AutomaticAdapter? = null
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogUbicador : CustomDialogUbicador private lateinit var customDialogUbicador : CustomDialogUbicador
@ -45,15 +36,10 @@ class AutomaticAddItemFragment(
override fun init() { override fun init() {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogUbicador = CustomDialogUbicador(requireContext()) customDialogUbicador = CustomDialogUbicador(requireContext())
// requireActivity().main_bottom_navigation.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE) (activity as MainActivity).hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = "itemShelvingMake" binding.mainToolbar.toolbarTitle.text = "itemShelvingMake"
setEvents() setEvents()
@ -111,7 +97,7 @@ class AutomaticAddItemFragment(
} }
listItems = ArrayList() listItems = ArrayList()
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.itemShelvingMake_multi(user,password,shelvingFk,listString,deep.toString(),warehouseFk,"1") viewModel.itemShelvingMake_multi( getData(USER),getData(PASSWORD),shelvingFk,listString,deep.toString(),getData(WAREHOUSEFK),"1")
} }
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {

View File

@ -14,8 +14,6 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentUbicadorBinding import es.verdnatura.databinding.FragmentUbicadorBinding
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
@ -24,15 +22,11 @@ import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.component.CustomDialogTwoButtons import es.verdnatura.presentation.view.component.CustomDialogTwoButtons
import es.verdnatura.presentation.view.component.CustomDialogUbicador import es.verdnatura.presentation.view.component.CustomDialogUbicador
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.ubicador.adapter.UbicadorAdapter import es.verdnatura.presentation.view.feature.ubicador.adapter.UbicadorAdapter
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_ubicador.*
import kotlinx.android.synthetic.main.toolbar.**/
class UbicadorFragment( class UbicadorFragment(
var shelvingFk: String = "" var shelvingFk: String = ""
@ -40,10 +34,6 @@ class UbicadorFragment(
UbicadorViewModel::class UbicadorViewModel::class
) { ) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var adapter: UbicadorAdapter? = null private var adapter: UbicadorAdapter? = null
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogUbicador: CustomDialogUbicador private lateinit var customDialogUbicador: CustomDialogUbicador
@ -71,16 +61,11 @@ class UbicadorFragment(
override fun init() { override fun init() {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
sectorFk = prefs.getInt(SECTORFK, SECTORFKDEFAULT).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogUbicador = CustomDialogUbicador(requireContext()) customDialogUbicador = CustomDialogUbicador(requireContext())
customDialogTwoButtons = CustomDialogTwoButtons(requireContext()) customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
//requireActivity().main_bottom_navigation.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE) (activity as MainActivity).hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.locator) binding.mainToolbar.toolbarTitle.text = getString(R.string.locator)
setEvents() setEvents()
@ -88,7 +73,7 @@ class UbicadorFragment(
if (!shelvingFk.isNullOrEmpty()) { if (!shelvingFk.isNullOrEmpty()) {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
binding.mainToolbar.toolbarTitle.text = shelvingFk binding.mainToolbar.toolbarTitle.text = shelvingFk
viewModel.itemShelvingList(user, password, shelvingFk, "itemShelvingList") viewModel.itemShelvingList( getData(USER), getData(PASSWORD), shelvingFk, "itemShelvingList")
} }
super.init() super.init()
} }
@ -101,7 +86,6 @@ class UbicadorFragment(
private fun setToolBar() { private fun setToolBar() {
/* val listIcons:ArrayList<Drawable> = ArrayList() /* val listIcons:ArrayList<Drawable> = ArrayList()
val iconAdd : Drawable = resources.getDrawable(R.drawable.ic_add_black_24dp,resources.newTheme()) val iconAdd : Drawable = resources.getDrawable(R.drawable.ic_add_black_24dp,resources.newTheme())
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme()) val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
@ -128,8 +112,8 @@ class UbicadorFragment(
iconReload.drawable -> { iconReload.drawable -> {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.itemShelvingList( viewModel.itemShelvingList(
user, getData(USER),
password, getData(PASSWORD),
shelvingFk, shelvingFk,
"itemShelvingList" "itemShelvingList"
) )
@ -162,8 +146,8 @@ class UbicadorFragment(
shelvingFk = binding.editMatricula.text.toString() shelvingFk = binding.editMatricula.text.toString()
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.itemShelvingList( viewModel.itemShelvingList(
user, getData(USER),
password, getData(PASSWORD),
binding.editMatricula.text.toString(), binding.editMatricula.text.toString(),
"itemShelvingList" "itemShelvingList"
) )
@ -181,8 +165,8 @@ class UbicadorFragment(
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!binding.editPrioridad.text.toString().isNullOrEmpty()) { if (!binding.editPrioridad.text.toString().isNullOrEmpty()) {
viewModel.shelvingPriorityUpdate( viewModel.shelvingPriorityUpdate(
user, getData(USER),
password, getData(PASSWORD),
binding.editPrioridad.text.toString(), binding.editPrioridad.text.toString(),
shelvingFk, shelvingFk,
"shelvingPriority_update" "shelvingPriority_update"
@ -210,8 +194,8 @@ class UbicadorFragment(
binding.parkingImg.setOnClickListener { binding.parkingImg.setOnClickListener {
customDialogInput.setTitle("Aparcar carro").setValue("").setOkButton("Aparcar") { customDialogInput.setTitle("Aparcar carro").setValue("").setOkButton("Aparcar") {
viewModel.shelvingPark( viewModel.shelvingPark(
user, getData(USER),
password, getData(PASSWORD),
shelvingFk, shelvingFk,
customDialogInput.getValue(), customDialogInput.getValue(),
"shelvingPark" "shelvingPark"
@ -231,8 +215,8 @@ class UbicadorFragment(
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
viewModel.shelvingPark( viewModel.shelvingPark(
user, getData(USER),
password, getData(PASSWORD),
shelvingFk, shelvingFk,
customDialogInput.getValue(), customDialogInput.getValue(),
"shelvingPark" "shelvingPark"
@ -259,8 +243,8 @@ class UbicadorFragment(
binding.editImg.setOnClickListener { binding.editImg.setOnClickListener {
customDialogInput.setTitle("Cambiar matrícula").setValue("").setOkButton("Guardar") { customDialogInput.setTitle("Cambiar matrícula").setValue("").setOkButton("Guardar") {
viewModel.shelvingChange( viewModel.shelvingChange(
user, getData(USER),
password, getData(PASSWORD),
shelvingFk, shelvingFk,
customDialogInput.getValue(), customDialogInput.getValue(),
"shelvingChange" "shelvingChange"
@ -280,8 +264,8 @@ class UbicadorFragment(
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
viewModel.shelvingChange( viewModel.shelvingChange(
user, getData(USER),
password, getData(PASSWORD),
shelvingFk, shelvingFk,
customDialogInput.getValue(), customDialogInput.getValue(),
"shelvingChange" "shelvingChange"
@ -301,7 +285,8 @@ class UbicadorFragment(
binding.deleteImg.setOnClickListener { binding.deleteImg.setOnClickListener {
customDialog.setTitle("Vaciar carro") customDialog.setTitle("Vaciar carro")
.setDescription("Esta operación no se puede rectificar.").setOkButton("Vaciar") { .setDescription("Esta operación no se puede rectificar.").setOkButton("Vaciar") {
viewModel.clearShelvingList(user, password, shelvingFk, "clearShelvingList") viewModel.clearShelvingList(getData(USER),
getData(PASSWORD), shelvingFk, "clearShelvingList")
listItems.forEach { listItems.forEach {
it.stickers = "0" it.stickers = "0"
it.visible = "0" it.visible = "0"
@ -415,7 +400,8 @@ class UbicadorFragment(
if (!shelvingFk.isNullOrEmpty()) { if (!shelvingFk.isNullOrEmpty()) {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
binding.mainToolbar.toolbarTitle.text = shelvingFk binding.mainToolbar.toolbarTitle.text = shelvingFk
viewModel.itemShelvingList(user, password, shelvingFk, "itemShelvingList") viewModel.itemShelvingList(getData(USER),
getData(PASSWORD), shelvingFk, "itemShelvingList")
} }
}) })
} }
@ -510,14 +496,14 @@ class UbicadorFragment(
if (updatePacking == null) { if (updatePacking == null) {
if (!itemFk.isNullOrEmpty() && !visible.isNullOrEmpty()) { if (!itemFk.isNullOrEmpty() && !visible.isNullOrEmpty()) {
viewModel.itemShelvingMake( viewModel.itemShelvingMake(
user, getData(USER),
password, getData(PASSWORD),
shelvingFk, shelvingFk,
itemFk, itemFk,
deep.toString(), deep.toString(),
visible, visible,
packing, packing,
warehouseFk, getData(WAREHOUSEFK),
"1", "1",
"itemShelvingMake", "itemShelvingMake",
groupingPack groupingPack
@ -538,14 +524,14 @@ class UbicadorFragment(
} else if (!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty()) { } else if (!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty()) {
val visible_calc = (etiquetas.toInt() * packing.toInt()).toString() val visible_calc = (etiquetas.toInt() * packing.toInt()).toString()
viewModel.itemShelvingMake( viewModel.itemShelvingMake(
user, getData(USER),
password, getData(PASSWORD),
shelvingFk, shelvingFk,
itemFk, itemFk,
deep.toString(), deep.toString(),
visible_calc, visible_calc,
packing, packing,
warehouseFk, getData(WAREHOUSEFK),
"1", "1",
"itemShelvingMake", "itemShelvingMake",
groupingPack groupingPack
@ -573,14 +559,14 @@ class UbicadorFragment(
} else { } else {
if (!itemFk.isNullOrEmpty() && !visible.isNullOrEmpty() && !updatePacking) { if (!itemFk.isNullOrEmpty() && !visible.isNullOrEmpty() && !updatePacking) {
viewModel.itemShelvingMakeEdit( viewModel.itemShelvingMakeEdit(
user, getData(USER),
password, getData(PASSWORD),
shelvingFk, shelvingFk,
itemFk, itemFk,
deep.toString(), deep.toString(),
visible, visible,
packing, packing,
warehouseFk, getData(WAREHOUSEFK),
"1", "1",
itemShelvingFk, itemShelvingFk,
"itemShelvingMakeEdit", "itemShelvingMakeEdit",
@ -606,14 +592,14 @@ class UbicadorFragment(
} catch (e: Exception) { } catch (e: Exception) {
} }
viewModel.itemShelvingMakeEdit( viewModel.itemShelvingMakeEdit(
user, getData(USER),
password, getData(PASSWORD),
shelvingFk, shelvingFk,
itemFk, itemFk,
deep.toString(), deep.toString(),
visible_calc, visible_calc,
packing, packing,
warehouseFk, getData(WAREHOUSEFK),
"1", "1",
itemShelvingFk, itemShelvingFk,
"itemShelvingMakeEdit", "itemShelvingMakeEdit",
@ -683,8 +669,8 @@ class UbicadorFragment(
.setOkButton("Transferir") { .setOkButton("Transferir") {
if (customDialogInput.getValue().isNotEmpty()) { if (customDialogInput.getValue().isNotEmpty()) {
viewModel.itemShelvingTransfer( viewModel.itemShelvingTransfer(
user, getData(USER),
password, getData(PASSWORD),
item.id, item.id,
customDialogInput.getValue(), customDialogInput.getValue(),
"itemShelvingTransfer" "itemShelvingTransfer"
@ -705,8 +691,8 @@ class UbicadorFragment(
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
viewModel.itemShelvingTransfer( viewModel.itemShelvingTransfer(
user, getData(USER),
password, getData(PASSWORD),
item.id, item.id,
customDialogInput.getValue(), customDialogInput.getValue(),
"itemShelvingTransfer" "itemShelvingTransfer"
@ -725,7 +711,8 @@ class UbicadorFragment(
.setOkButton("Eliminar") { .setOkButton("Eliminar") {
listItems.remove(item) listItems.remove(item)
adapter!!.notifyDataSetChanged() adapter!!.notifyDataSetChanged()
viewModel.itemShelvingDelete(user, password, item.id, "itemShelvingDelete") viewModel.itemShelvingDelete(getData(USER),
getData(PASSWORD), item.id, "itemShelvingDelete")
customDialogTwoButtons.dismiss() customDialogTwoButtons.dismiss()
customDialog.dismiss() customDialog.dismiss()
}.setKoButton("Cancelar") { }.setKoButton("Cancelar") {

View File

@ -6,7 +6,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetUbicadorUserCase import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event

Binary file not shown.

View File

@ -2,7 +2,13 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_gravity="left"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -31,4 +37,5 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.drawerlayout.widget.DrawerLayout>
</layout> </layout>

View File

@ -3,12 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.calidad.fragment.BuyersViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -1,14 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tool="http://schemas.android.com/tools"> >
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -1,15 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.buffer.fragment.BufferFragmentViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View File

@ -1,13 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.smarttag.sacador.model.SmartTagScan" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">

View File

@ -3,12 +3,6 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">

View File

@ -4,11 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:clickable="false"> android:clickable="false">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.sacador.fragment.SacadorViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -1,14 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.controlador.fragment.ControladorViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View File

@ -3,12 +3,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -3,12 +3,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletDetailViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -3,12 +3,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"

Some files were not shown because too many files have changed in this diff Show More