Merge pull request #1 from androidappsergio/master

Master
This commit is contained in:
androidappsergio 2022-03-30 07:28:58 +02:00 committed by GitHub
commit 212879f340
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
116 changed files with 5051 additions and 1590 deletions

View File

@ -4,7 +4,8 @@
<option name="filePathToZoomLevelMap"> <option name="filePathToZoomLevelMap">
<map> <map>
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/background_gradient.xml" value="0.1" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/background_gradient.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/ic_history_orange_24dp.xml" value="0.38229166666666664" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/ic_history_orang.xml" value="0.22037037037037038" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/ic_history_orange_24dp.xml" value="0.16666666666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.13541666666666666" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.13541666666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/selector_bottombar_text.xml" value="0.13541666666666666" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/selector_bottombar_text.xml" value="0.13541666666666666" />
<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" />
@ -13,7 +14,9 @@
<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/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.xml" value="0.27447916666666666" />
<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" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/btn_blue.xml" value="0.27447916666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_accumulate.xml" value="0.18489583333333334" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_accumulate.xml" value="0.18489583333333334" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_accumulation.xml" value="0.19814814814814816" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_accumulation.xml" value="0.19814814814814816" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_desactivate.xml" value="0.1" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_desactivate.xml" value="0.1" />
@ -21,6 +24,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_fill.xml" value="0.19814814814814816" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_fill.xml" value="0.19814814814814816" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_flejado.xml" value="0.2916666666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/buffer_flejado.xml" value="0.2916666666666667" />
<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_load.xml" value="0.14666666666666667" />
<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.xml" value="0.30052083333333335" />
@ -31,6 +35,8 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/crane.xml" value="0.23802083333333332" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/crane.xml" value="0.23802083333333332" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/day_of_sale.xml" value="0.184375" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/day_of_sale.xml" value="0.184375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/delete.xml" value="0.19166666666666668" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/delete.xml" value="0.19166666666666668" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/drawable_white_circle.xml" value="0.1775" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/emoticon_error.xml" value="0.27447916666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/eraser.xml" value="0.26564102564102565" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/eraser.xml" value="0.26564102564102565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/face_man_outline.xml" value="0.22708333333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/face_man_outline.xml" value="0.22708333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/filter_outline.xml" value="0.22239583333333332" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/filter_outline.xml" value="0.22239583333333332" />
@ -38,12 +44,18 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_add_black_24dp.xml" value="0.22708333333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_add_black_24dp.xml" value="0.22708333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_arrow_back_black_24dp.xml" value="0.22708333333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_arrow_back_black_24dp.xml" value="0.22708333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_arrow_drop_down_black_24dp.xml" value="0.22708333333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_arrow_drop_down_black_24dp.xml" value="0.22708333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_autorenew_black_24dp.xml" value="0.1775" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_baseline_star_24.xml" value="0.1775" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_build_black_24dp.xml" value="0.22708333333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_build_black_24dp.xml" value="0.22708333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_chevron_right_black_24dp.xml" value="0.1775" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_dashboard_black_24dp.xml" value="0.1775" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_delete_black_24dp.xml" value="0.15052083333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_delete_black_24dp.xml" value="0.15052083333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_delete_forever_black_24dp.xml" value="0.15052083333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_delete_forever_black_24dp.xml" value="0.15052083333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_device_hub_black_24dp_selected.xml" value="0.15052083333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_device_hub_black_24dp.xml" value="0.22" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_device_hub_black_24dp_selected.xml" value="0.22" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_flash_auto_black_24dp.xml" value="0.15052083333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_flash_auto_black_24dp.xml" value="0.15052083333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_history_black_24dp.xml" value="0.15052083333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_history_black_24dp.xml" value="0.15052083333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_history_orange.xml" value="0.22037037037037038" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_launcher_background.xml" value="0.24010416666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_launcher_background.xml" value="0.24010416666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_local_florist_black_24dp.xml" value="0.15052083333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_local_florist_black_24dp.xml" value="0.15052083333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_local_florist_black_24dp_selected.xml" value="0.21041666666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_local_florist_black_24dp_selected.xml" value="0.21041666666666667" />
@ -66,6 +78,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_transaction.xml" value="0.22708333333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_transaction.xml" value="0.22708333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_verified_user_black_24dp.xml" value="0.1" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_verified_user_black_24dp.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_verified_user_black_24dp_selected.xml" value="0.1" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_verified_user_black_24dp_selected.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_visibility.xml" value="0.1775" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_visibility_black_24dp.xml" value="0.2546875" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_visibility_black_24dp.xml" value="0.2546875" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_visibility_black_24dp_white.xml" value="0.2546875" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_visibility_black_24dp_white.xml" value="0.2546875" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_visibility_white_24dp.xml" value="0.2546875" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_visibility_white_24dp.xml" value="0.2546875" />
@ -74,20 +87,23 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/pallet_shipping_black.xml" value="0.1" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/pallet_shipping_black.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/pallet_shipping_selected.xml" value="0.1" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/pallet_shipping_selected.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/phone_call.xml" value="0.26145833333333335" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/phone_call.xml" value="0.26145833333333335" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/previous_delete.xml" value="0.27447916666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/qrcode_scan.xml" value="0.17395833333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/qrcode_scan.xml" value="0.17395833333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/rectangle.xml" value="0.31979166666666664" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/rectangle.xml" value="0.31979166666666664" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/revision_icon.xml" value="0.1" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/revision_icon.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/round_av_timer_24.xml" value="0.15052083333333333" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/round_av_timer_24.xml" value="0.15052083333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/round_outline.xml" value="0.11979166666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/round_outline.xml" value="0.11979166666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/walk.xml" value="0.10885416666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/walk.xml" value="0.10885416666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/worker.xml" value="0.12" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/worker_mistake.xml" value="0.15364583333333334" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_imageview.xml" value="0.134375" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_imageview.xml" value="0.134375" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_login.xml" value="0.134375" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_login.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_main.xml" value="0.17916666666666667" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/activity_main.xml" value="0.17916666666666667" />
<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_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.3333333333333333" />
<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/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" />
@ -125,13 +141,14 @@
<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_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.3333333333333333" />
<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" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_ubicador.xml" value="0.22" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_ubicador.xml" value="0.22" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_vehiclecontrol.xml" value="0.1546875" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_vehiclecontrol.xml" value="0.1546875" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_vehiclecontrol_user.xml" value="0.23052536231884058" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_vehiclecontrol_user.xml" value="0.23052536231884058" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_web.xml" value="0.2463768115942029" /> <entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_web.xml" value="0.2463768115942029" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_workermistake.xml" value="0.2265625" />
<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" />
@ -146,6 +163,7 @@
<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_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_faltas_row.xml" value="0.1793478260869565" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_general_row.xml" value="0.13360507246376813" />
<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_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" />
@ -157,12 +175,13 @@
<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.3333333333333333" />
<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_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/item_workermistake_row.xml" value="0.4466666666666667" />
<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/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/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" />

View File

@ -3,21 +3,22 @@ apply plugin: 'kotlin-android'
//apply plugin: 'kotlin-android-extensions'//deprecated:sergio //apply plugin: 'kotlin-android-extensions'//deprecated:sergio
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics' //apply plugin: 'com.google.firebase.crashlytics'
android { android {
compileSdkVersion 29 compileSdkVersion 30
// buildToolsVersion "29.0.3" // buildToolsVersion "29.0.3"
defaultConfig { defaultConfig {
applicationId "es.verdnatura" applicationId "es.verdnatura"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 30
versionCode 100 versionCode 107
versionName "7.6" //VERSION CODE 100. Envios rocket a previa, revisados databinding layouts, versionName "7.9" //VERSION CODE 107 Seleccionar impresora para imprimir
//versionName "7.5.1" //VERSION CODE 97. Control de previa, Llamadas ok, menú ok y textos en iconos y imágenes. //versionName "7.8" //VERSION CODE 106 Previa final,tiene en cuenta si hay varios carros donde coger,,
//versionName "7.5.1" VERSION CODE 99 PARA TESTEAR APP-->INSTALADA EN VARIOS USUARIO 24-01-2022 //versionName "7.7.2" //VERSION CODE 105 Previa final , si se pone a 0 un artículo se revisa el total de líneas
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
@ -110,7 +111,7 @@ dependencies {
// Add the Firebase Crashlytics SDK. // Add the Firebase Crashlytics SDK.
implementation 'com.google.firebase:firebase-analytics:17.5.0' implementation 'com.google.firebase:firebase-analytics:17.5.0'
implementation 'com.google.firebase:firebase-crashlytics:17.2.1' //implementation 'com.google.firebase:firebase-crashlytics:17.2.1'
//search //search
implementation 'com.github.mirrajabi:search-dialog:1.1' implementation 'com.github.mirrajabi:search-dialog:1.1'

View File

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

Binary file not shown.

View File

@ -29,11 +29,18 @@ import es.verdnatura.presentation.view.feature.shelvingparking.fragment.Shelving
import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.SmartTagsViewModel import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.SmartTagsViewModel
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemViewModel import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemViewModel
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewModel import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewModel
import es.verdnatura.presentation.view.feature.workermistake.fragment.WorkermistakeViewModel
import org.koin.android.ext.koin.androidContext import org.koin.android.ext.koin.androidContext
import org.koin.androidx.viewmodel.dsl.viewModel import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.dsl.module import org.koin.dsl.module
val viewModelModule = module { val viewModelModule = module {
viewModel{
WorkermistakeViewModel(androidContext())
}
// Login // Login
viewModel { viewModel {
LoginViewModel(androidContext()) LoginViewModel(androidContext())

View File

@ -7,7 +7,7 @@ class ApiNodeJsUtils {
companion object { companion object {
//const val BASE_URL:String = "http://192.168.1.108:8000/" //const val BASE_URL:String = "http://192.168.1.108:8000/"
const val BASE_URL:String = "http://10.2.2.49:7777" const val BASE_URL:String = "https://smart-tag.verdnatura.es"
fun getApiService():NodeJsService{ fun getApiService():NodeJsService{
val nodeJsRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory( val nodeJsRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(
GsonConverterFactory.create()).build() GsonConverterFactory.create()).build()

View File

@ -6,8 +6,8 @@ import retrofit2.converter.gson.GsonConverterFactory
class ApiSalixUtils { class ApiSalixUtils {
companion object { companion object {
//const val BASE_URL:String = "http://192.168.1.155:9009/" //const val BASE_URL:String = "http://192.168.1.155:9009/"
// const val BASE_URL: String = "https://test-salix.verdnatura.es/api/"
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

@ -8,6 +8,8 @@ object ConstAndValues {
const val ON_PREPARATION = "ON_PREPARATION" const val ON_PREPARATION = "ON_PREPARATION"
//const val CHECKED = "CHECKED" //const val CHECKED = "CHECKED"
const val PRESACADOR = "PRESACADOR" //PREITEMPICKER const val PRESACADOR = "PRESACADOR" //PREITEMPICKER
const val PREITEMPICKER = "PREITEMPICKER"
const val ON_CHECKING = "ON_CHECKING" const val ON_CHECKING = "ON_CHECKING"
const val PRECHECKER = "PRECHECKER" const val PRECHECKER = "PRECHECKER"
const val MAINACTIVITY = "MAIN" const val MAINACTIVITY = "MAIN"

View File

@ -1,6 +1,7 @@
package es.verdnatura.domain package es.verdnatura.domain
import android.content.Context import android.content.Context
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
import retrofit2.Call import retrofit2.Call
@ -13,4 +14,22 @@ class GetAjustesUserCase(context: Context) : RestClient(context) {
fun getSectorsSalix(token:String): Call<List<SectorItemVO>> { fun getSectorsSalix(token:String): Call<List<SectorItemVO>> {
return salixClient!!.getSectorsSalix(content_type = "application/json", authorization = token) return salixClient!!.getSectorsSalix(content_type = "application/json", authorization = token)
} }
fun worker_updateSector(usuario: String, password: String,sectorFk:String): Call<Unit> {
val params: ArrayList<String> = ArrayList()
params.add(sectorFk)
return restClient!!.worker_updateSector("json", "1", usuario, password, "application/json",params)
}
fun worker_updatePrinter(usuario: String, password: String,labelerFk:String): Call<Unit> {
val params: ArrayList<String> = ArrayList()
params.add(labelerFk)
return restClient!!.worker_updatePrinter("json", "1", usuario, password, "application/json",params)
}
fun printer_get(usuario: String, password: String): Call<List<Printers>> {
return restClient!!.printer_get("json", "1", usuario, password, "application/json")
}
} }

View File

@ -1,19 +1,17 @@
package es.verdnatura.domain package es.verdnatura.domain
import android.content.Context import android.content.Context
import com.google.gson.JsonObject
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
import retrofit2.Call import retrofit2.Call
class GetDayOfSaleUSerCase(context: Context) : RestClient(context) { class GetDayOfSaleUSerCase(context: Context) : RestClient(context) {
fun itemShelving_updateSpam(usuario: String, password: String,vShelvingFK:String): Call<Boolean> { /*fun itemShelving_updateSpam(usuario: String, password: String,vShelvingFK:String): Call<Boolean> {
val params: ArrayList<String> = ArrayList() val params: ArrayList<String> = ArrayList()
params.add(vShelvingFK) params.add(vShelvingFK)
return restClient!!.itemShelving_updateSpam("json", "1", usuario, password, "application/json",params=params) return restClient!!.itemShelving_updateSpam("json", "1", usuario, password, "application/json",params=params)
} }*/
/* fun itemShelving_getSaleDateOld( /* fun itemShelving_getSaleDateOld(
usuario: String, usuario: String,
password: String, password: String,

View File

@ -1,21 +1,13 @@
package es.verdnatura.domain package es.verdnatura.domain
import android.content.Context import android.content.Context
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
import es.verdnatura.presentation.view.feature.login.model.* import es.verdnatura.presentation.view.feature.login.model.*
import retrofit2.Call import retrofit2.Call
class GetLoginUserCase(context: Context) : RestClient(context) class GetLoginUserCase(context: Context) : RestClient(context)
{ {
fun login(usuario: String, password: String, androiid: String): Call<String>
{
val params: ArrayList<String> = ArrayList()
params.add(usuario)
params.add(password)
params.add(androiid)
return restClient!!.login("json", "1", usuario, password, "application/json", params)
}
fun device_checkLogin( fun device_checkLogin(
usuario: String, usuario: String,
password: String, password: String,
@ -69,31 +61,41 @@ class GetLoginUserCase(context: Context) : RestClient(context)
} }
//NODEJS TEST //NODEJS TEST
fun nodeJsTest( /*fun nodeJsTest(
smarttag: String, smarttag: String,
wagon: String, wagon: String,
shelving: String shelving: String
): Call<NodeJsService.SmartTagNode> ): Call<NodeJsService.SmartTagNode>
{ {
return nodejsClient!!.bindShelving("application/json", "A0A3B8224DBF", "ABC", "2") //https://smart-tag.verdnatura.es/bindShelving/A0A3B8224DBF&ABC&1
return nodejsClient!!.bindShelving("application/json", "A0A3B8224DBF", "AAA", "1")
// return nodejsClient!!.bindShelving("application/json", NodeJsService.SmartTagNode(smarttag, wagon, shelving),"A0A3B8224DBF","ABC","2") // return nodejsClient!!.bindShelving("application/json", NodeJsService.SmartTagNode(smarttag, wagon, shelving),"A0A3B8224DBF","ABC","2")
} }*/
// SALIX SERGIO MENSAJE : PARA NO ENVIAR MENSAJES A COMERCIALES PONGO QUE LAS MODIFICACIONES SE ENVIAN AL CANAL CREADO.
// SE CAMBIA VARIABLE A TRUE/FALSE
/* fun checkVersion_old(usuario: String, password: String, version: String): Call<Boolean>
{
val params: ArrayList<String> = ArrayList()
params.add(version)
return restClient!!.version("json", "1", usuario, password, "application/json", params)
*/
//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))
}
// SERGIO: PARA DESARROLLO SE DESCOMENTA ESTAS LÍNEAS Y SE COMENTAN LAS DE ARRIBA var working_in_test=false
if (!working_in_test) {
return salixClient!!.sendChekingPresence(
content_type = "application/json",
authorization = token,
params = SalixMessageVO(workerId = workerId, message = message)
)
}else{
return salixClient!!.sendGroup(
content_type = "application/json",
authorization = token,
params = SalixGrupo(to = "#android-test", message = message))
}
}
/*fun sendChekingPresence(token: String, workerId: Int, message: String): Call<Boolean> /*fun sendChekingPresence(token: String, workerId: Int, message: String): Call<Boolean>
{ {
@ -110,5 +112,9 @@ val params: ArrayList<String> = ArrayList()
params.add(nameApp) params.add(nameApp)
return restClient!!.getVersion("json", "1", usuario, password, "application/json", params) return restClient!!.getVersion("json", "1", usuario, password, "application/json", params)
} }
fun worker_getSector(usuario: String, password: String): Call<SectorItemVO> {
//val params: ArrayList<String> = ArrayList()
return restClient!!.worker_getSector("json", "1", usuario, password, "application/json")
}
} }

View File

@ -2,6 +2,7 @@ package es.verdnatura.domain
import android.content.Context import android.content.Context
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import retrofit2.Call import retrofit2.Call
class GetPreSacadorUseCase(context: Context) : RestClient(context) { class GetPreSacadorUseCase(context: Context) : RestClient(context) {
@ -61,4 +62,111 @@ class GetPreSacadorUseCase(context: Context) : RestClient(context) {
) )
} }
fun sectorCollection_new(
usuario: String,
password: String,
sectorFk: String
): Call<Unit> {
val params: ArrayList<String> = ArrayList()
params.add(sectorFk)
return restClient!!.sectorCollection_new(
"json",
"1",
usuario,
password,
"application/json",
params
)
}
fun sectorCollectionSaleGroup_add(
usuario: String,
password: String,
vSaleGroupFk: String,
vSectorCollectionFk:String
): Call<Unit> {
val params: ArrayList<String> = ArrayList()
params.add(vSaleGroupFk)
params.add(vSectorCollectionFk)
return restClient!!.sectorCollectionSaleGroup_add(
"json",
"1",
usuario,
password,
"application/json",
params
)
}
fun saleTracking_addPrevOK(
usuario: String,
password: String,
vSectorCollectionFk:String
): Call<Unit> {
val params: ArrayList<String> = ArrayList()
params.add(vSectorCollectionFk)
return restClient!!.saleTracking_addPrevOK(
"json",
"1",
usuario,
password,
"application/json",
params
)
}
fun saleTracking_updateIsChecked(
usuario: String,
password: String,
vSaleFk:String,
vIsChecked:String
): Call<Unit> {
val params: ArrayList<String> = ArrayList()
params.add(vSaleFk)
params.add(vIsChecked)
return restClient!!.saleTracking_updateIsChecked(
"json",
"1",
usuario,
password,
"application/json",
params
)
}
fun sectorCollection_get(usuario: String, password: String): Call<List<CollectionVO>> {
return restClient!!.sectorCollection_get("json", "1", usuario, password, "application/json")
}
fun sectorCollection_getSale(
usuario: String,
password: String,
sectorCollectionFK: String,
vSectorFk:String
): Call<List<PreSacadorItemVO>> {
val params: ArrayList<String> = ArrayList()
params.add(sectorCollectionFK)
params.add(vSectorFk)
return restClient!!.sectorCollection_getSale(
"json",
"1",
usuario,
password,
"application/json",
params
)
}
} }

View File

@ -120,6 +120,9 @@ 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>> { fun collectionGetSalix(token:String): Call<List<CollectionVO>> {
// val params:ArrayList<String> = ArrayList() // val params:ArrayList<String> = ArrayList()
return salixClient!!.getCollectionSalix(content_type = "application/json",token) return salixClient!!.getCollectionSalix(content_type = "application/json",token)
@ -150,6 +153,8 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
) )
} }
fun itemPlacementSupplyAiming( fun itemPlacementSupplyAiming(
usuario: String, usuario: String,
password: String, password: String,

View File

@ -1,6 +1,7 @@
package es.verdnatura.domain package es.verdnatura.domain
import android.content.Context import android.content.Context
import es.verdnatura.presentation.view.feature.smarttag.sacador.model.SmartTagRegister
import retrofit2.Call import retrofit2.Call
class GetSmarttagsUserCase(context: Context) : RestClient(context) { class GetSmarttagsUserCase(context: Context) : RestClient(context) {
@ -30,10 +31,24 @@ class GetSmarttagsUserCase(context: Context) : RestClient(context) {
params params
) )
} }
fun smartTagRegister(
smarttag: String,
shelving: String,
level: String
): Call<SmartTagRegister>
{
//https://smart-tag.verdnatura.es/bindShelving/A0A3B8224DBF&ABC&1
return nodejsClient!!.bindShelving("application/json", smarttag, shelving, level)
// return nodejsClient!!.bindShelving("application/json", NodeJsService.SmartTagNode(smarttag, wagon, shelving),"A0A3B8224DBF","ABC","2")
/* fun smartTag_nextLevel(usuario:String,password:String,vShelvingFk :String) : Call<String> { }
val params:ArrayList<String> = ArrayList(); fun smartTagInsertTicket(
params.add(vShelvingFk) smarttag: String,
return restClient!!.smartTag_nextLevel("json","1",usuario,password,"application/json",params)
}*/ ): Call<SmartTagRegister>
{
return nodejsClient!!.insertTicket("application/json", smarttag)
}
} }

View File

@ -0,0 +1,59 @@
package es.verdnatura.domain
import android.content.Context
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeWorkerType
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
import retrofit2.Call
class GetWokerMistakeUSerCase(context: Context) : RestClient(context) {
fun collectionGet(usuario: String, password: String): Call<List<CollectionVO>> {
// val params:ArrayList<String> = ArrayList()
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 workerMistake_Add(
usuario: String,
password: String,
vUserFk: String,
vTypeFk: String
): Call<Unit> {
val params: ArrayList<String> = ArrayList()
params.add(vUserFk)
params.add(vTypeFk)
return restClient!!.workerMistake_Add(
"json",
"1",
usuario,
password,
"application/json",
params
)
}
fun workerMistakeType_get(usuario: String, password: String): Call<List<MistakeWorkerType>> {
return restClient!!.workerMistakeType_get("json", "1", usuario, password, "application/json")
}
fun department_getHasMistake(usuario: String, password: String): Call<List<DepartmentMistake>> {
return restClient!!.department_getHasMistake("json", "1", usuario, password, "application/json")
}
fun worker_getFromHasMistake(usuario: String, password: String, department:String): Call<List<WorkerFromMistake>> {
val params: ArrayList<String> = ArrayList()
params.add(department)
return restClient!!.worker_getFromHasMistake("json", "1", usuario, password, "application/json",params)
}
}

View File

@ -1,9 +1,8 @@
package es.verdnatura.domain package es.verdnatura.domain
import es.verdnatura.presentation.view.feature.smarttag.sacador.model.SmartTagRegister
import retrofit2.Call import retrofit2.Call
import retrofit2.http.Header import retrofit2.http.*
import retrofit2.http.POST
import retrofit2.http.Path
interface NodeJsService { interface NodeJsService {
@ -14,16 +13,25 @@ interface NodeJsService {
//NODEJS TEST //NODEJS TEST
// @FormUrlEncoded //@FormUrlEncoded
@POST("/bindShelving/{Id1}&{Id2}&{Id3}") @GET("/bindShelving/{smarttag}&{shelvingFK}&{height}")
fun bindShelving( fun bindShelving(
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Path("Id1") id: String, @Path("smarttag") id: String,
@Path("Id2") id2: String, @Path("shelvingFK") id2: String,
@Path("Id3") id3: String @Path("height") id3: String
): ):
Call<SmartTagNode> Call<SmartTagRegister>
@GET("/insertTicket/{collectionFk}")
fun insertTicket(
@Header("Content-Type") content_type: String,
@Path("collectionFk") id: String
):
Call<SmartTagRegister>
class SmartTagNode( class SmartTagNode(
var message: String = "", var message: String = "",

View File

@ -37,7 +37,7 @@ interface SalixService {
fun getSectorsSalix( fun getSectorsSalix(
@Header("Content-Type") content_type: String, @Header("Content-Type") content_type: String,
@Header("Authorization") authorization: String, @Header("Authorization") authorization: String,
//@Body params: SalixGrupo
): ):
Call<List<SectorItemVO>> Call<List<SectorItemVO>>
@ -48,4 +48,12 @@ interface SalixService {
): ):
Call<List<CollectionVO>> Call<List<CollectionVO>>
@GET("collections/sectorCollection_get")
fun sectorCollection_get(
@Header("Content-Type") content_type: String,
@Header("Authorization") authorization: String,
):
Call<List<CollectionVO>>
} }

View File

@ -1,6 +1,7 @@
package es.verdnatura.domain package es.verdnatura.domain
import com.google.gson.JsonObject import com.google.gson.JsonObject
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
@ -25,6 +26,9 @@ import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingVO import es.verdnatura.presentation.view.feature.shelvingparking.model.ItemShelvingParkingVO
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeWorkerType
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
import retrofit2.Call import retrofit2.Call
import retrofit2.http.Body import retrofit2.http.Body
import retrofit2.http.Header import retrofit2.http.Header
@ -111,6 +115,48 @@ interface VerdnaturaService {
): ):
Call<List<SectorItemVO>> Call<List<SectorItemVO>>
@POST("almacennew/printer_get")//REVISADA
fun printer_get(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String
):
Call<List<Printers>>
@POST("almacennew/worker_updatePrinter")//REVISADA
fun worker_updatePrinter(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params:List<String>
):
Call<Unit>
@POST("almacennew/worker_updateSector")//REVISADA
fun worker_updateSector(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params:List<String>
):
Call<Unit>
@POST("almacennew/worker_getSector")//REVISADA
fun worker_getSector(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String
):
Call<SectorItemVO>
//PRESACADORES ========================================================================> //PRESACADORES ========================================================================>
@POST("almacennew/ticketToPrePrepare")//REVISADA @POST("almacennew/ticketToPrePrepare")//REVISADA
@ -124,6 +170,17 @@ interface VerdnaturaService {
): ):
Call<List<PreSacadorItemVO>> Call<List<PreSacadorItemVO>>
@POST("almacennew/sectorCollection_getSale")//REVISADA
fun sectorCollection_getSale(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>
):
Call<List<PreSacadorItemVO>>
@POST("almacennew/itemPlacementSupplyGetOrder")//REVISADA @POST("almacennew/itemPlacementSupplyGetOrder")//REVISADA
fun itemPlacementSupplyGetOrder( fun itemPlacementSupplyGetOrder(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@ -157,6 +214,17 @@ interface VerdnaturaService {
): ):
Call<List<CollectionVO>> Call<List<CollectionVO>>
@POST("almacennew/sectorCollection_get") //REVISADA
fun sectorCollection_get(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String
):
Call<List<CollectionVO>>
@POST("almacennew/collectionNew")//REVISADA @POST("almacennew/collectionNew")//REVISADA
fun collectionNew( fun collectionNew(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@ -168,6 +236,50 @@ interface VerdnaturaService {
): ):
Call<String> Call<String>
@POST("almacennew/sectorCollection_new")//REVISADA
fun sectorCollection_new(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>
):
Call<Unit>
@POST("almacennew/sectorCollectionSaleGroup_add")//REVISADA
fun sectorCollectionSaleGroup_add(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>
):
Call<Unit>
@POST("almacennew/saleTracking_addPrevOK")//REVISADA
fun saleTracking_addPrevOK(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>
):
Call<Unit>
@POST("almacennew/saleTracking_updateIsChecked")//REVISADA
fun saleTracking_updateIsChecked(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>
):
Call<Unit>
/* @POST("almacennew/collectionTicketGet")//REVISADA-ANULADA POT collection_getTickets /* @POST("almacennew/collectionTicketGet")//REVISADA-ANULADA POT collection_getTickets
fun collectionTicketGet( fun collectionTicketGet(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@ -235,6 +347,17 @@ interface VerdnaturaService {
): ):
Call<String> Call<String>
/* @POST("almacennew/saleTracking_update")//REVISADA
fun saleTracking_update(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>
):
Call<Unit>*/
@POST("almacennew/itemPlacementSupplyAiming")//REVISADA @POST("almacennew/itemPlacementSupplyAiming")//REVISADA
fun itemPlacementSupplyAiming( fun itemPlacementSupplyAiming(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@ -413,6 +536,17 @@ interface VerdnaturaService {
): ):
Call<String> Call<String>
@POST("almacennew/workerMistake_Add")//REVISADA
fun workerMistake_Add(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>
):
Call<Unit>
@POST("almacennew/mistakeType")//REVISADA @POST("almacennew/mistakeType")//REVISADA
fun mistakeType( fun mistakeType(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@ -423,6 +557,39 @@ interface VerdnaturaService {
): ):
Call<List<MistakeTypeVO>> Call<List<MistakeTypeVO>>
@POST("almacennew/workerMistakeType_get")//REVISADA
fun workerMistakeType_get(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String
):
Call<List<MistakeWorkerType>>
@POST("almacennew/department_getHasMistake")//REVISADA
fun department_getHasMistake(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
):
Call<List<DepartmentMistake>>
@POST("almacennew/worker_getFromHasMistake")//REVISADA
fun worker_getFromHasMistake(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>
):
Call<List<WorkerFromMistake>>
//PASILLEROS ========================================================================> //PASILLEROS ========================================================================>
//CONSULTAR ARTICULO ========================================================================> //CONSULTAR ARTICULO ========================================================================>
@ -595,7 +762,8 @@ interface VerdnaturaService {
//INVENTARIO ========================================================================> //INVENTARIO ========================================================================>
@POST("almacennew/itemShelvingRadar")//REVISADA
/* @POST("almacennew/itemShelvingRadar")//REVISADA
fun itemShelvingRadar( fun itemShelvingRadar(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,
@Header("version") version: String, @Header("version") version: String,
@ -605,7 +773,7 @@ interface VerdnaturaService {
@Body params: List<String> @Body params: List<String>
): ):
Call<List<ItemInventaryVO>> Call<List<ItemInventaryVO>>
*/
@POST("almacennew/itemShelving_filterBuyer")//REVISADA @POST("almacennew/itemShelving_filterBuyer")//REVISADA
fun itemShelvingRadarFilterBuyer( fun itemShelvingRadarFilterBuyer(
@Header("aplicacion") aplicacion: String, @Header("aplicacion") aplicacion: String,

View File

@ -14,7 +14,6 @@ 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
@ -24,6 +23,7 @@ import androidx.annotation.LayoutRes
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.preference.PreferenceManager
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
@ -31,6 +31,7 @@ import es.verdnatura.domain.ConstAndValues
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT 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 es.verdnatura.presentation.view.feature.main.activity.MainActivity
import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.androidx.viewmodel.ext.android.viewModel
import timber.log.Timber import timber.log.Timber
import java.util.* import java.util.*
@ -49,6 +50,10 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
protected val TOKEN = "token" protected val TOKEN = "token"
protected val SECTORDESCRIP = "sectordescrip" protected val SECTORDESCRIP = "sectordescrip"
protected val SECTORFK = "sectorFk" protected val SECTORFK = "sectorFk"
protected val PRINTERNAME= "printername"
protected val PRINTERFK = "printerFk"
protected val WAREHOUSEFK = "warehouseFk" protected val WAREHOUSEFK = "warehouseFk"
protected val RECORDAR = "recordar" protected val RECORDAR = "recordar"
protected val ANDROID_ID = "ANDROID_ID" protected val ANDROID_ID = "ANDROID_ID"
@ -60,10 +65,14 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
protected val WAGON = "wagon" protected val WAGON = "wagon"
protected val TAGSTYPE = "tagstype" protected val TAGSTYPE = "tagstype"
protected val WAREHOUSEFK_DEFAULT = 60 protected val WAREHOUSEFK_DEFAULT = 60
protected val DATENOVEHICLE="DATENOVEHICLE"
protected val DEPARTMENTMISTAKE="DEPARTMENTMISTAKE"
protected val DEPARTMENTMISTAKEID="DEPARTMENTMISTAKEID"
protected val viewModel: V by viewModel(viewModelClass) protected val viewModel: V by viewModel(viewModelClass)
protected lateinit var binding: T protected lateinit var binding: T
private var isOnReadyForSpeech = false private var isOnReadyForSpeech = false
protected lateinit var ma: MainActivity
private var textToSpeech: TextToSpeech? = null private var textToSpeech: TextToSpeech? = null
private var mAudioManager: AudioManager? = null private var mAudioManager: AudioManager? = null
@ -89,6 +98,16 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
) )
override fun onAttach(context: Context) {
super.onAttach(context)
if ((requireActivity().componentName).toString().contains("MainActivity")){
ma=activity as MainActivity
}
}
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, inflater: LayoutInflater,
container: ViewGroup?, container: ViewGroup?,
@ -115,11 +134,14 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
observeViewModel() observeViewModel()
runSound() runSound()
//requestRecordAudioPermission() //requestRecordAudioPermission()
requestRecordAudioPermissionNew() //requestRecordAudioPermissionNew()
requestCallPhonePermissionNew()
//sergio: para llamadas con SIP
//requestCallPhonePermissionNew()
init() init()
} }
@LayoutRes @LayoutRes
@ -185,9 +207,8 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
if (textScanned.length>13) { if (textScanned.length>13) {
var size = textScanned.length var size = textScanned.length
if (textScanned!!.substring((size / 2), size) if (textScanned.substring((size / 2), size) == textScanned.substring(0, size / 2)
.equals(textScanned.substring(0, size / 2)) ) {
) {
return textScanned.substring(0, size / 2) return textScanned.substring(0, size / 2)
} }
@ -224,6 +245,7 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
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" R.drawable.filter_outline->"Filtra por tipo de flor"
R.drawable.previous_delete->"Quita de pantalla lo que ya está sacado ( misma función que escanear 2.000.000)"
else -> {""} else -> {""}
} }
@ -478,7 +500,10 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
mSpeechRecognizer = null mSpeechRecognizer = null
} }
} }
private fun getDefaults(key: String?, context: Context?): String? {
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
return preferences.getString(key, null)
}
fun getData(name:String):String{ fun getData(name:String):String{
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
return when (name){ return when (name){
@ -495,12 +520,71 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
SECTORDESCRIP->prefs.getString(name,getString(R.string.Sinsector)).toString() SECTORDESCRIP->prefs.getString(name,getString(R.string.Sinsector)).toString()
BUYER->prefs.getString(name,"").toString() BUYER->prefs.getString(name,"").toString()
BUYERID->prefs.getString(name,"").toString() BUYERID->prefs.getString(name,"").toString()
DATENOVEHICLE->prefs.getString(name,"0").toString()
DEPARTMENTMISTAKE->prefs.getString(name,"").toString()
DEPARTMENTMISTAKEID->prefs.getString(name,"").toString()
PRINTERFK->prefs.getInt(name,0).toString()
PRINTERNAME->prefs.getString(name,"Sin impresora").toString()
"base_url"->{
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
preferences.getString("base_url","").toString()
}
else -> {""} else -> {""}
} }
} }
fun setDefaults(key: String?, value: String?, context: Context?) {
val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
val editor = preferences.edit()
editor.putString(key, value)
editor.commit()
}
fun saveData(name:String,value:String){
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val editor = prefs.edit()
// Log.d("VERDNATURA::","El name es "+name+":"+ "y el valor "+value)
when (name) {
ANDROID_ID -> editor.putString(name, value)
"base_url" -> {
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
val editorPref = preferences.edit()
editorPref.putString("base_url", value)
editorPref.commit()
}
else -> {
editor.putString(name, value)
}
}
editor.commit()
}
fun saveDataInt(name:String,value:Int){
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val editor = prefs.edit()
when (name){
name-> editor.putInt(name, value)
ANDROID_ID->editor.putInt(name, value)
}
editor.apply()
}
fun saveBuyer(buyernickname: String) { fun saveBuyer(buyernickname: String) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
@ -522,23 +606,6 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
return imei.toString() return imei.toString()
} }
/* fun getANDROIDID(): String {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val androidid = prefs.getString(ANDROID_ID, "0")
return androidid.toString()
}*/
/*fun getWagons(): Int {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val wagons = prefs.getInt(WAGON, 2)
return wagons
}*/
/* fun getTagsType(): String {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val tagstype = prefs.getString(TAGSTYPE, "Stickers")
return tagstype.toString()
}*/
fun getMessageFromJSON(json: String): String { fun getMessageFromJSON(json: String): String {
val gson = Gson() val gson = Gson()

View File

@ -29,6 +29,7 @@ fun getMessageFromAllResponse(callFunction: String, ResponseMessage: String): St
messageFromError = ResponseMessage messageFromError = ResponseMessage
} }
//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)
{ {

View File

@ -0,0 +1,47 @@
package es.verdnatura.presentation.common
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemGeneralRowBinding
class GeneralAdapter(
private val items: List<GeneralItem>,
private val OnGeneralItemRowClickListener: OnGeneralItemRowClickListener,
// private var showDelete: Boolean = true
): RecyclerView.Adapter<GeneralAdapter.ItemHolder> () {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
return ItemHolder(
ItemGeneralRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
)
}
override fun getItemCount() =items.size
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
holder.binding.root.setOnClickListener {
OnGeneralItemRowClickListener.OnGeneralItemRowClickListener(items[position])
}
}
inner class ItemHolder(
val binding: ItemGeneralRowBinding
) : RecyclerView.ViewHolder(binding.root){
//private val res = binding.root.context.resources
fun bind(item: GeneralItem) {
binding.apply {
this.item = item
/* if (showDelete) itemImage.visibility = View.VISIBLE
else itemImage.visibility = View.GONE*/
itemTitle.visibility=View.GONE
}
}
}
}

View File

@ -20,3 +20,8 @@ class DataMessageSalix(
var personSale: String = "" var personSale: String = ""
) )
class GeneralItem(
var code:String? = "",
var text:String? = ""
)

View File

@ -17,6 +17,7 @@ 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
import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
interface OnOptionsSelectedListener { interface OnOptionsSelectedListener {
fun onOptionsItemSelected(item: Drawable) fun onOptionsItemSelected(item: Drawable)
@ -27,6 +28,10 @@ interface OnPasillerosItemClickListener {
fun onPasillerosItemClickListener(item: PasillerosItemVO,entryPoint:String) fun onPasillerosItemClickListener(item: PasillerosItemVO,entryPoint:String)
} }
interface onMistakeWorkerClickListener {
fun onMistakeWorkerClickListener(item: WorkerFromMistake)
}
interface hideBottomNavigation{ interface hideBottomNavigation{
fun hideBottomNavigation(entryPoint:String) fun hideBottomNavigation(entryPoint:String)
@ -40,9 +45,9 @@ interface OnAjustesItemClickListener {
interface OnItemCardRowClickListener { interface OnItemCardRowClickListener {
fun onItemCardRowClickListener(item: ItemCardRowVO) fun onItemCardRowClickListener(item: ItemCardRowVO)
} }
interface OnItemExpeditionStateRowClickListener { /*interface OnItemExpeditionStateRowClickListener {
fun OnItemExpeditionStateRowClickListener(item: ItemExpeditionStateRow) fun OnItemExpeditionStateRowClickListener(item: ItemExpeditionStateRow)
} }*/
interface OnBarcodeRowClickListener { interface OnBarcodeRowClickListener {
fun onBarcodeRowClickListener(item: BarcodeVO) fun onBarcodeRowClickListener(item: BarcodeVO)
@ -52,6 +57,10 @@ interface OnSmartTagRowClickListener {
fun OnSmartTagRowClickListener(item: SmartTag) fun OnSmartTagRowClickListener(item: SmartTag)
} }
interface OnGeneralItemRowClickListener {
fun OnGeneralItemRowClickListener(item: GeneralItem)
}
interface OnLocationRowClickListener { interface OnLocationRowClickListener {
fun onLocationRowClickListener(item: ItemLocationVO) fun onLocationRowClickListener(item: ItemLocationVO)
} }

View File

@ -8,6 +8,7 @@ import android.content.Context.CLIPBOARD_SERVICE
import android.content.SharedPreferences import android.content.SharedPreferences
import android.os.Bundle import android.os.Bundle
import android.provider.Settings import android.provider.Settings
import android.util.Log
import android.view.KeyEvent import android.view.KeyEvent
import android.view.View import android.view.View
import androidx.appcompat.widget.TooltipCompat.setTooltipText import androidx.appcompat.widget.TooltipCompat.setTooltipText
@ -22,15 +23,18 @@ import es.verdnatura.presentation.common.hideKeyboard
import es.verdnatura.presentation.view.component.CustomDialog 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.ajustes.model.Printers
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
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 AjustesFragment : class AjustesFragment :
BaseFragment<FragmentAjustesBinding, AjustesViewModel>(AjustesViewModel::class) { BaseFragment<FragmentAjustesBinding, AjustesViewModel>(AjustesViewModel::class) {
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var sectorListVO: List<SectorItemVO> = listOf() private var sectorListVO: List<SectorItemVO> = listOf()
private var printersList: List<Printers> = listOf()
private var vozList: List<String> = listOf() private var vozList: List<String> = listOf()
private var prefs: SharedPreferences? = null private var prefs: SharedPreferences? = null
private var ajustesAdapter: AjustesAdapter? = null private var ajustesAdapter: AjustesAdapter? = null
@ -50,21 +54,13 @@ 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(
SECTORDESCRIP,
getString(R.string.Sinsector)
).toString(),
prefs!!.getInt(SECTORFK, 0),
prefs!!.getInt(WAREHOUSEFK, 0),
prefs!!.getString(VOZ, "NO").toString(),
prefs!!.getInt(WAGON, 2).toString(),
prefs!!.getString(TAGSTYPE, "Stickers").toString()*/
getData(SECTORDESCRIP), getData(SECTORDESCRIP),
getData(SECTORFK).toInt(), getData(SECTORFK).toInt(),
getData(WAREHOUSEFK).toInt(), getData(WAREHOUSEFK).toInt(),
getData(VOZ),
getData(WAGON), getData(WAGON),
getData(TAGSTYPE) getData(TAGSTYPE),
getData(PRINTERFK).toInt(),
getData(PRINTERNAME),
) )
@ -75,7 +71,7 @@ class AjustesFragment :
override fun init() { override fun init() {
(activity as MainActivity).hideBottomNavigation(View.VISIBLE) ma.hideBottomNavigation(View.VISIBLE)
binding.userText.setText(getData(USER)) binding.userText.setText(getData(USER))
val versionName = requireActivity().packageManager.getPackageInfo( val versionName = requireActivity().packageManager.getPackageInfo(
requireActivity().packageName, requireActivity().packageName,
@ -85,16 +81,12 @@ class AjustesFragment :
binding.androididText.setText( binding.androididText.setText(
getData(ANDROID_ID) getData(ANDROID_ID)
/*Settings.Secure.getString(
context?.contentResolver,
Settings.Secure.ANDROID_ID
)*/
) )
binding.txtserver.setText(this.getDefaults("base_url", this.requireContext())) binding.txtserver.setText(getData("base_url"))
super.init() super.init()
setEvents() setEvents()
} }
fun setEvents() { fun setEvents() {
@ -131,12 +123,13 @@ class AjustesFragment :
} else if (item.id == 2) { } else if (item.id == 2) {
val listVoz: ArrayList<String> = ArrayList() viewModel.printer_get(getData(USER),getData(PASSWORD))
/* val listVoz: ArrayList<String> = ArrayList()
listVoz.add("NO") listVoz.add("NO")
listVoz.add("YES") listVoz.add("YES")
vozList = listVoz vozList = listVoz
val array = arrayOfNulls<String>(listVoz.size) val array = arrayOfNulls<String>(listVoz.size)
showDialogVoz(array = listVoz.toArray(array)) showDialogVoz(array = listVoz.toArray(array))*/
} else if (item.id == 3) { } else if (item.id == 3) {
val listTagsType: ArrayList<String> = ArrayList() val listTagsType: ArrayList<String> = ArrayList()
@ -146,7 +139,7 @@ class AjustesFragment :
val array = arrayOfNulls<String>(listTagsType.size) val array = arrayOfNulls<String>(listTagsType.size)
showItemPickerType(array = listTagsType.toArray(array)) showItemPickerType(array = listTagsType.toArray(array))
} else if (item.id == 4) { } else if (item.id == 4) {
(activity as MainActivity).onPasillerosItemClickListener( ma.onPasillerosItemClickListener(
PasillerosItemVO( PasillerosItemVO(
title = "Control de usuario de vehículo" title = "Control de usuario de vehículo"
), getData(USERFK) ), getData(USERFK)
@ -155,11 +148,24 @@ class AjustesFragment :
} }
} }
}) })
workerupdateSector.observe(viewLifecycleOwner, {
binding.splashProgress.visibility = View.GONE
ma.messageWithSound(it.errorMessage,it.isError,false)
})
workerupdatePrinter.observe(viewLifecycleOwner, {
binding.splashProgress.visibility = View.GONE
ma.messageWithSound(it.errorMessage,it.isError,false)
})
binding.ajustessItems.adapter = ajustesAdapter binding.ajustessItems.adapter = ajustesAdapter
binding.ajustessItems.layoutManager = binding.ajustessItems.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
loadSectorList.observe(viewLifecycleOwner, { event -> loadSectorList.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { event.getContentIfNotHandled().notNull {
binding.splashProgress.visibility = View.INVISIBLE binding.splashProgress.visibility = View.INVISIBLE
if (it.list.isNotEmpty() && it.list.get(0).isError) { if (it.list.isNotEmpty() && it.list.get(0).isError) {
@ -188,11 +194,69 @@ class AjustesFragment :
} }
} }
}) }
loadprintersList.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
binding.splashProgress.visibility = View.INVISIBLE
if (it.list.isNotEmpty() && it.list.get(0).isError) {
customDialog.setTitle("Error").setDescription(it.list.get(0).errorMessage)
.setOkButton(getString(R.string.Close)) {
customDialog.dismiss()
}.show()
} else {
if (it.list != null && it.list.size > 0) {
val listPrinters: ArrayList<String> = ArrayList()
it.list.forEach {
listPrinters.add(it.name)
}
val array = arrayOfNulls<String>(listPrinters.size)
printersList= it.list
showDialogPrinters(listPrinters.toArray(array))
} else {
customDialog.setTitle("Impresoras")
.setDescription(getString(R.string.Noprinters))
.setOkButton(getString(R.string.Close)) {
customDialog.dismiss()
}.show()
}
}
}
}
} }
super.observeViewModel() super.observeViewModel()
} }
private fun showDialogPrinters(array: Array<String>) {
val builder = AlertDialog.Builder(this.context)
builder.setTitle(getString(R.string.Selecccionaimpresoara))
builder.setItems(array) { _, which ->
val selected = array[which]
printersList.forEach {
if (it.name.equals(selected)) {
val editor = prefs!!.edit()
editor.putString(PRINTERNAME, it.name)
editor.putInt(PRINTERFK, it.id)
editor.apply()
viewModel.ajustesitem.get(2).selected = it.name
viewModel.worker_updatePrinter(getData(USER),getData(PASSWORD),it.id.toString())
ajustesAdapter!!.notifyDataSetChanged()
return@forEach
}
}
}
val dialog = builder.create()
dialog.show()
}
private fun showDialogSector(array: Array<String>) { private fun showDialogSector(array: Array<String>) {
val builder = AlertDialog.Builder(this.context) val builder = AlertDialog.Builder(this.context)
@ -211,6 +275,8 @@ class AjustesFragment :
viewModel.ajustesitem.get(0).sectorFk = it.id viewModel.ajustesitem.get(0).sectorFk = it.id
viewModel.ajustesitem.get(0).warehouse = it.warehouseFk viewModel.ajustesitem.get(0).warehouse = it.warehouseFk
viewModel.ajustesitem.get(0).selected = it.description viewModel.ajustesitem.get(0).selected = it.description
d("El sector marcado es "+it.id.toString())
viewModel.worker_updateSector(getData(USER),getData(PASSWORD),it.id.toString())
ajustesAdapter!!.notifyDataSetChanged() ajustesAdapter!!.notifyDataSetChanged()
return@forEach return@forEach
@ -234,7 +300,10 @@ class AjustesFragment :
val editor = prefs!!.edit() val editor = prefs!!.edit()
editor.putString(VOZ, it) editor.putString(VOZ, it)
editor.apply() editor.apply()
viewModel.ajustesitem.get(2).selected = it viewModel.ajustesitem.get(2).selected = it
ajustesAdapter!!.notifyDataSetChanged() ajustesAdapter!!.notifyDataSetChanged()
return@forEach return@forEach
@ -301,17 +370,17 @@ class AjustesFragment :
} }
fun setDefaults(key: String?, value: String?, context: Context?) { /* fun setDefaults(key: String?, value: String?, context: Context?) {
val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
val editor = preferences.edit() val editor = preferences.edit()
editor.putString(key, value) editor.putString(key, value)
editor.commit() editor.commit()
} }*/
private fun getDefaults(key: String?, context: Context?): String? { /* private fun getDefaults(key: String?, context: Context?): String? {
val preferences = PreferenceManager.getDefaultSharedPreferences(context) val preferences = PreferenceManager.getDefaultSharedPreferences(context)
return preferences.getString(key, null) return preferences.getString(key, null)
} }*/
private fun copyanddrag(string: String): Boolean { private fun copyanddrag(string: String): Boolean {

View File

@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.ajustes.fragment
import android.content.Context import android.content.Context
import android.util.Log import android.util.Log
import android.util.Printer
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.Transformations
@ -11,12 +12,12 @@ import es.verdnatura.presentation.base.BaseViewModel
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
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO import es.verdnatura.presentation.view.feature.ajustes.model.*
import es.verdnatura.presentation.view.feature.ajustes.model.SectorListVO
import retrofit2.Call import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
import retrofit2.Response import retrofit2.Response
import timber.log.Timber.d
class AjustesViewModel(context: Context) : BaseViewModel() { class AjustesViewModel(context: Context) : BaseViewModel() {
@ -32,19 +33,34 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
val sectorList: LiveData<SectorListVO> val sectorList: LiveData<SectorListVO>
get() = _sectorList get() = _sectorList
private val _workerupdateSector by lazy { MutableLiveData<ResponseItemVO>() }
val workerupdateSector: LiveData<ResponseItemVO>
get() = _workerupdateSector
private val _workerupdatePrinter by lazy { MutableLiveData<ResponseItemVO>() }
val workerupdatePrinter: LiveData<ResponseItemVO>
get() = _workerupdatePrinter
private val _printerList by lazy { MutableLiveData<PrintersList>() }
val printerList: LiveData<PrintersList>
get() = _printerList
val loadSectorList = Transformations.map(_sectorList) {Event(it)} val loadSectorList = Transformations.map(_sectorList) {Event(it)}
val loadprintersList = Transformations.map(_printerList) {Event(it)}
fun inititializeDefaultAjusts(sectorDescrip: String,sectorFk : Int, warehouseFk : Int,vozDescrip:String,carroDescrip:String,TypeTags:String) { fun inititializeDefaultAjusts(sectorDescrip: String,sectorFk : Int, warehouseFk : Int,carroDescrip:String,TypeTags:String,printerFk:Int,printerSelected:String) {
_ajustesitem.add( _ajustesitem.add(
AjustesItemVO(0, AjustesItemVO(0,
"Sector", "Sector",
sectorDescrip, sectorDescrip,
sectorFk, sectorFk,
warehouseFk) warehouseFk,
0,
printerSelected)
) )
@ -53,35 +69,40 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
"Carros", "Carros",
carroDescrip, carroDescrip,
0, 0,
0) 0,
0,"Sin impresora")
) )
_ajustesitem.add( _ajustesitem.add(
AjustesItemVO(2, AjustesItemVO(2,
"Voz", "Impresora etiquetas",
vozDescrip, printerSelected,
0, 0,
0) 0,
printerFk,printerSelected)
) )
_ajustesitem.add( _ajustesitem.add(
AjustesItemVO(3, AjustesItemVO(3,
"Tipo etiqueta", "Tipo etiqueta",
TypeTags, TypeTags,
0, 0,
0) 0,
0,"Sin impresora")
) )
_ajustesitem.add( _ajustesitem.add(
AjustesItemVO(4, AjustesItemVO(4,
"Control de vehículos", "Control de vehículos",
"", "",
0, 0,
0) 0,
0,"Sin impresora")
) )
_ajustesitem.add( _ajustesitem.add(
AjustesItemVO(5, AjustesItemVO(5,
"Cerrar Sesión", "Cerrar Sesión",
"", "",
0, 0,
0) 0,
0,"Sin impresora")
) )
} }
@ -136,4 +157,93 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
}) })
} }
fun printer_get(user:String,password:String){
getAjustesUserCase.printer_get(user,password).enqueue(object : Callback<List<Printers>>{
override fun onFailure(call: Call<List<Printers>>, t: Throwable) {
val listError:ArrayList<Printers> = ArrayList()
listError.add(Printers(0,"",true,t.message!!))
_printerList.value = PrintersList(listError)
}
override fun onResponse(
call: Call<List<Printers>>,
response: Response<List<Printers>>
) {
if (response.body() != null){
_printerList.value = response.body()?.let { PrintersList (it) }
}else{
val listError:ArrayList<Printers> = ArrayList()
listError.add(Printers(0,"",true,
getMessageFromAllResponse(nameofFunction(this),response.message())
))
_printerList.value = PrintersList(listError)
}
}
})
}
fun worker_updateSector(user:String,password:String,sectorFk:String){
d("El sector marcado dentro es "+sectorFk)
getAjustesUserCase.worker_updateSector(user,password,sectorFk).enqueue(object : Callback<Unit>{
override fun onFailure(call: Call<Unit>, t: Throwable) {
_workerupdateSector.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(
call: Call<Unit>,
response: Response<Unit>
) {
if (!response.isSuccessful()){
_workerupdateSector.value=ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}else{
_workerupdateSector.value=ResponseItemVO(response="Actualizado sector",isError = false, errorMessage ="Actualizado sector")
}
/*if (response.body() != null){
_sectorList.value = response.body()?.let { SectorListVO(it) }
}else{
val listError:ArrayList<SectorItemVO> = ArrayList()
listError.add(SectorItemVO(0,"",0,true,"Error en la llamada sector_get"))
_sectorList.value = SectorListVO(listError)
}*/
}
})
}
fun worker_updatePrinter(user:String,password:String,printerFk:String){
d("La impresora marcada "+printerFk)
getAjustesUserCase.worker_updatePrinter(user,password,printerFk).enqueue(object : Callback<Unit>{
override fun onFailure(call: Call<Unit>, t: Throwable) {
_workerupdatePrinter.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(
call: Call<Unit>,
response: Response<Unit>
) {
if (!response.isSuccessful()){
_workerupdatePrinter.value=ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}else{
_workerupdatePrinter.value=ResponseItemVO(response="Actualizada impresora",isError = false, errorMessage ="Actualizada impresora")
}
}
})
}
} }

View File

@ -5,12 +5,14 @@ class AjustesItemVO (
var title: String = "", var title: String = "",
var selected: String = "", var selected: String = "",
var sectorFk : Int?, var sectorFk : Int?,
var warehouse: Int? var warehouse: Int?,
var printerFk:Int?,
var printerSelected:String=""
) )
class SectorItemVO ( class SectorItemVO (
var id: Int, var id: Int,
var description:String = "", var description:String = "des",
val warehouseFk:Int?, val warehouseFk:Int?,
val isError : Boolean = false, val isError : Boolean = false,
var errorMessage : String = "" var errorMessage : String = ""
@ -19,3 +21,14 @@ class SectorItemVO (
class SectorListVO ( class SectorListVO (
var list: List<SectorItemVO> = listOf() var list: List<SectorItemVO> = listOf()
) )
class PrintersList (
var list: List<Printers> = listOf()
)
class Printers(
var id: Int,
var name: String="",
val isError : Boolean = false,
var errorMessage : String = ""
)

View File

@ -44,9 +44,9 @@ class ItemProposalAdapter(
/* itemNicho.setOnClickListener { /* itemNicho.setOnClickListener {
onInvetoryNichoClickListener.onInvetoryNichoClickListener(item) onInvetoryNichoClickListener.onInvetoryNichoClickListener(item)
}*/ }*/
itemNicho.setOnClickListener { /* itemNicho.setOnClickListener {
onItemProposalClickListener.onItemProposalClickListener(item) onItemProposalClickListener.onItemProposalClickListener(item)
} }*/
itemFk.setOnClickListener { itemFk.setOnClickListener {
onPasillerosItemClickListener.onPasillerosItemClickListener( onPasillerosItemClickListener.onPasillerosItemClickListener(
PasillerosItemVO( PasillerosItemVO(

View File

@ -54,7 +54,7 @@ class ItemCardFragment(
fun newInstance(entryPoint: String) = ItemCardFragment(entryPoint) fun newInstance(entryPoint: String) = ItemCardFragment(entryPoint)
} }
private lateinit var customDialog: CustomDialog // private lateinit var customDialog: CustomDialog
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogList: CustomDialogList private lateinit var customDialogList: CustomDialogList
private lateinit var customDialogTwo: CustomDialogTwoButtons private lateinit var customDialogTwo: CustomDialogTwoButtons
@ -66,13 +66,13 @@ class ItemCardFragment(
override fun init() { override fun init() {
binding.itemcardLayout.visibility = View.GONE binding.itemcardLayout.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
setEvents() setEvents()
//toolbar_title.text = getString(R.string.ConsultarArticulo) //toolbar_title.text = getString(R.string.ConsultarArticulo)
binding.mainToolbar.toolbarTitle.text = getString(R.string.ConsultarArticulo) binding.mainToolbar.toolbarTitle.text = getString(R.string.ConsultarArticulo)
customDialog = CustomDialog(requireContext()) //customDialog = CustomDialog(requireContext())
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
customDialogList = CustomDialogList(requireContext()) customDialogList = CustomDialogList(requireContext())
customDialogTwo = CustomDialogTwoButtons(requireContext()) customDialogTwo = CustomDialogTwoButtons(requireContext())
@ -117,7 +117,7 @@ class ItemCardFragment(
if (itemFk.isNullOrEmpty()) { if (itemFk.isNullOrEmpty()) {
"Escanea un item".toast(requireActivity()) "Escanea un item".toast(requireActivity())
} else { } else {
(activity as MainActivity).onPasillerosItemClickListener( ma.onPasillerosItemClickListener(
PasillerosItemVO(title = "Historico"), PasillerosItemVO(title = "Historico"),
itemInfoG!!.id itemInfoG!!.id
) )
@ -147,7 +147,7 @@ class ItemCardFragment(
if (!binding.editItemFk.text.toString().isNullOrEmpty()) if (!binding.editItemFk.text.toString().isNullOrEmpty())
getItemCard(binding.editItemFk.text.toString()) getItemCard(binding.editItemFk.text.toString())
binding.editItemFk.setText("") binding.editItemFk.setText("")
(activity as MainActivity).hideKeyboard(binding.editItemFk) ma.hideKeyboard(binding.editItemFk)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false
@ -190,10 +190,8 @@ class ItemCardFragment(
binding.itemcardLayout.visibility = GONE binding.itemcardLayout.visibility = GONE
binding.splashProgressTwo.visibility = GONE binding.splashProgressTwo.visibility = GONE
binding.mainToolbar.toolbarTitle.text = "ItemCard" binding.mainToolbar.toolbarTitle.text = "ItemCard"
customDialog.setTitle("Error").setDescription(it.errorMessage) ma.messageWithSound(it.errorMessage,true,false)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else { } else {
if (it.id != "0") { if (it.id != "0") {
binding.itemcardLayout.visibility = View.VISIBLE binding.itemcardLayout.visibility = View.VISIBLE
@ -202,11 +200,8 @@ class ItemCardFragment(
binding.splashProgressTwo.visibility = GONE binding.splashProgressTwo.visibility = GONE
binding.itemcardLayout.visibility = View.GONE binding.itemcardLayout.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = "ItemCard" binding.mainToolbar.toolbarTitle.text = "ItemCard"
customDialog.setTitle("Sin resultados") ma.messageWithSound("No hemos podido encontrar el articulo. Revisa el sector.",true,false,"Sin resultados")
.setDescription("No hemos podido encontrar el articulo. Revisa el sector.")
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} }
} }
@ -221,10 +216,7 @@ class ItemCardFragment(
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
if (it.isError) { if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage) ma.messageWithSound(it.errorMessage,true,false)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else { } else {
getItemCard(itemFk) getItemCard(itemFk)
} }
@ -361,7 +353,7 @@ class ItemCardFragment(
listItemsRow.add( listItemsRow.add(
ItemCardRowVO( ItemCardRowVO(
title = getString(R.string.Referencia), title = getString(R.string.Referencia),
value = itemInfo.referencia, value = itemInfo.reference,
isEditable = true, isEditable = true,
action = "item_saveReference" action = "item_saveReference"
) )
@ -394,7 +386,7 @@ class ItemCardFragment(
if (item.action == "itemProposal") { if (item.action == "itemProposal") {
(activity as MainActivity).onPasillerosItemClickListener( ma.onPasillerosItemClickListener(
PasillerosItemVO( PasillerosItemVO(
title = "Buscar artículos similares" title = "Buscar artículos similares"
), itemFk ), itemFk
@ -408,12 +400,12 @@ class ItemCardFragment(
customDialogInput.setTitle(item.title!!) customDialogInput.setTitle(item.title!!)
.setDescription("Valor actual: " + item.value!!) .setDescription("Valor actual: " + item.value!!)
.setOkButton("Guardar") { .setOkButton("Guardar") {
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
editItemCardRow(item, customDialogInput.getValue()) editItemCardRow(item, customDialogInput.getValue())
customDialogInput.dismiss() customDialogInput.dismiss()
}.setKoButton("Cancelar") { }.setKoButton("Cancelar") {
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.dismiss() customDialogInput.dismiss()
}.setValue("").show() }.setValue("").show()
customDialogInput.getEditText().requestFocus() customDialogInput.getEditText().requestFocus()
@ -424,7 +416,7 @@ class ItemCardFragment(
editItemCardRow(item, customDialogInput.getValue()) editItemCardRow(item, customDialogInput.getValue())
customDialogInput.setValue("") customDialogInput.setValue("")
customDialogInput.dismiss() customDialogInput.dismiss()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false
@ -433,7 +425,7 @@ class ItemCardFragment(
//BARCODE ROW //BARCODE ROW
prepareBarcodeDialog(item) prepareBarcodeDialog(item)
} else if (item.action == "buscarItem") { } else if (item.action == "buscarItem") {
(activity as MainActivity).onPasillerosItemClickListener( ma.onPasillerosItemClickListener(
PasillerosItemVO( PasillerosItemVO(
title = "Buscar item" title = "Buscar item"
), itemFk ), itemFk
@ -442,12 +434,12 @@ class ItemCardFragment(
customDialogInput.setTitle(item.title!!) customDialogInput.setTitle(item.title!!)
.setDescription("Indica la cantidad a dar de alta") .setDescription("Indica la cantidad a dar de alta")
.setOkButton("Guardar") { .setOkButton("Guardar") {
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
editItemCardRow(item, customDialogInput.getValue()) editItemCardRow(item, customDialogInput.getValue())
customDialogInput.dismiss() customDialogInput.dismiss()
}.setKoButton("Cancelar") { }.setKoButton("Cancelar") {
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.dismiss() customDialogInput.dismiss()
}.setValue("").show() }.setValue("").show()
customDialogInput.getEditText().requestFocus() customDialogInput.getEditText().requestFocus()
@ -458,7 +450,7 @@ class ItemCardFragment(
editItemCardRow(item, customDialogInput.getValue()) editItemCardRow(item, customDialogInput.getValue())
customDialogInput.setValue("") customDialogInput.setValue("")
customDialogInput.dismiss() customDialogInput.dismiss()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false
@ -467,12 +459,12 @@ class ItemCardFragment(
customDialogInput.setTitle(item.title!!) customDialogInput.setTitle(item.title!!)
.setDescription("Indica la cantidad a dar de baja ") .setDescription("Indica la cantidad a dar de baja ")
.setOkButton("Guardar") { .setOkButton("Guardar") {
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
editItemCardRow(item, customDialogInput.getValue()) editItemCardRow(item, customDialogInput.getValue())
customDialogInput.dismiss() customDialogInput.dismiss()
}.setKoButton("Cancelar") { }.setKoButton("Cancelar") {
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.dismiss() customDialogInput.dismiss()
}.setValue("").show() }.setValue("").show()
customDialogInput.getEditText().requestFocus() customDialogInput.getEditText().requestFocus()
@ -483,7 +475,7 @@ class ItemCardFragment(
editItemCardRow(item, customDialogInput.getValue()) editItemCardRow(item, customDialogInput.getValue())
customDialogInput.setValue("") customDialogInput.setValue("")
customDialogInput.dismiss() customDialogInput.dismiss()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false
@ -556,7 +548,7 @@ class ItemCardFragment(
} }
if (item.action != "itemStockUpdate") if (item.action != "itemStockUpdate" && item.action != "itemStockUpdateRemove" && item.action !="itemStockUpdateAdd")
// changeOfflineValue(item,value, listBarcodes) // changeOfflineValue(item,value, listBarcodes)
showProgress() showProgress()
} }
@ -620,6 +612,7 @@ class ItemCardFragment(
private fun prepareItemStockUpdate2(itemB: ItemCardRowVO, value: String) { private fun prepareItemStockUpdate2(itemB: ItemCardRowVO, value: String) {
try { try {
value.toInt()
if (itemB.action == "itemStockUpdateRemove") { if (itemB.action == "itemStockUpdateRemove") {
customDialogTwo.setTitle(itemB.title!!) customDialogTwo.setTitle(itemB.title!!)
@ -669,36 +662,34 @@ class ItemCardFragment(
) )
} }
} catch (e: Exception) { } catch (e: Exception) {
binding.itemcardLayout.visibility = View.GONE // binding.itemcardLayout.visibility = View.GONE
customDialog.setTitle("Error").setDescription("El elemento introducido no es un número") ma.messageWithSound("El elemento introducido no es un número",true,true)
.setKoButton("Cancelar") {
customDialog.dismiss()
}.show()
} }
} }
private fun prepareBarcodeDialog(itemB: ItemCardRowVO) { private fun prepareBarcodeDialog(itemB: ItemCardRowVO) {
customDialogList.setTitle("Barcodes").setOkButton("Guardar") { customDialogList.setTitle("Barcodes").setOkButton("Guardar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
if (!customDialogList.getValue().isNullOrEmpty()) if (!customDialogList.getValue().isNullOrEmpty())
updateBarcode(customDialogList.getValue(), "0", itemB) updateBarcode(customDialogList.getValue(), "0", itemB)
customDialogList.dismiss() customDialogList.dismiss()
}.setKoButton("Cerrar") { }.setKoButton("Cerrar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
customDialogList.dismiss() customDialogList.dismiss()
}.setValue("").show() }.setValue("").show()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogList.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 (!customDialogList.getValue().isNullOrEmpty()) if (!customDialogList.getValue().isNullOrEmpty())
updateBarcode(customDialogList.getValue(), "0", itemB) updateBarcode(customDialogList.getValue(), "0", itemB)
customDialogList.setValue("") customDialogList.setValue("")
customDialogList.dismiss() customDialogList.dismiss()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false

View File

@ -7,7 +7,6 @@ import android.os.Bundle
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
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.FragmentItemproposalBinding import es.verdnatura.databinding.FragmentItemproposalBinding
@ -16,8 +15,6 @@ 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.common.ToolBarAdapterTooltip
import es.verdnatura.presentation.view.component.CustomDialog
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.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
@ -31,17 +28,12 @@ class ItemProposalFragment(
ItemCardViewModel::class ItemCardViewModel::class
) { ) {
private var adapter: ItemProposalAdapter? = null private var adapter: ItemProposalAdapter? = null
private lateinit var customDialogInput: CustomDialogInput private var listProposal: ArrayList<ItemProposal> = ArrayList()
private var listInvetory: ArrayList<ItemProposal> = ArrayList()
private var listInvetoryAux: ArrayList<ItemProposal> = ArrayList()
private lateinit var customDialog: CustomDialog
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
private var hideLoad = true private var hideLoad = true
private var layoutManager: LinearLayoutManager? = null private var layoutManager: LinearLayoutManager? = null
private var firstVisiblePosition = 0 private var filter = "1"
private var filter = "TRUE"
companion object { companion object {
fun newInstance(entryPoint: String) = ItemProposalFragment(entryPoint) fun newInstance(entryPoint: String) = ItemProposalFragment(entryPoint)
@ -59,7 +51,7 @@ class ItemProposalFragment(
itemFk, itemFk,
getData(WAREHOUSEFK), getData(WAREHOUSEFK),
vShipped = currentDay(), vShipped = currentDay(),
vIsShowedByType = "TRUE", vIsShowedByType = filter,
user = getData(USER), user = getData(USER),
password = getData(PASSWORD),"item_getSimilar" password = getData(PASSWORD),"item_getSimilar"
) )
@ -69,18 +61,16 @@ class ItemProposalFragment(
private fun currentDay(): String { private fun currentDay(): String {
val calendar = Calendar.getInstance() val calendar = Calendar.getInstance()
val format = SimpleDateFormat("yyyy-MM-dd") val format = SimpleDateFormat("yyyy-MM-dd",Locale.getDefault())
return format.format(calendar.time) return format.format(calendar.time)
} }
override fun init() { override fun init() {
customDialogInput = CustomDialogInput(requireContext()) ma.hideBottomNavigation(View.GONE)
customDialog = CustomDialog(requireContext())
(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 "${getString(R.string.ArticleSimilar)}:$itemFk".also { it -> it.also { binding.mainToolbar.toolbarTitle.text = it } }
setToolBar() setToolBar()
setEvents() setEvents()
@ -104,21 +94,11 @@ class ItemProposalFragment(
when (item){ when (item){
iconFilter.drawable-> { iconFilter.drawable-> {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0 iconFilter.drawable.setTint(ContextCompat.getColor(
context!!,if (filter=="1") R.color.verdnatura_white else R.color.verdnatura_pumpkin_orange
))
filter = if (filter=="1") "0" else "1"
if (filter.equals("TRUE")) {
filter = "FALSE"
iconFilter.drawable.setTint(ContextCompat.getColor(
context!!,
R.color.verdnatura_white))
} else {
filter = "TRUE"
iconFilter.drawable.setTint(
ContextCompat.getColor(
context!!,
R.color.verdnatura_pumpkin_orange))
}
viewModel.item_getSimilar( viewModel.item_getSimilar(
itemFk, itemFk,
getData(WAREHOUSEFK), getData(WAREHOUSEFK),
@ -129,7 +109,6 @@ class ItemProposalFragment(
callFunction = "item_getSimilar") callFunction = "item_getSimilar")
} }
@ -151,52 +130,29 @@ class ItemProposalFragment(
} }
override fun onPause() {
super.onPause()
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
}
override fun onResume() {
super.onResume()
if (binding.locationRecyclerview.layoutManager != null) {
if (firstVisiblePosition <= listInvetory.size) {
binding.locationRecyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition)
}
}
}
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
itemProposallist.observe(viewLifecycleOwner, Observer { itemProposallist.observe(viewLifecycleOwner, { it ->
if (hideLoad) { if (hideLoad) {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
} else { } else {
hideLoad = true hideLoad = true
} }
listInvetory = ArrayList() listProposal= ArrayList()
listInvetoryAux = ArrayList() if (!it.list.isNullOrEmpty()){
it.list.forEach { it.list.forEach {
if (it.longName != "0") {
listInvetory.add(it)
listInvetoryAux.add(it)
}
}
adapter = ItemProposalAdapter(listInvetory, object : OnItemProposalClickListener { listProposal.add(it)
}}
adapter = ItemProposalAdapter(listProposal, object : OnItemProposalClickListener {
override fun onItemProposalClickListener(item: ItemProposal) { override fun onItemProposalClickListener(item: ItemProposal) {
customDialog.setTitle(item.itemFk + "\n" + item.longName + " " + item.subName)
.setDescription("Cantidad real(" + item.available + ")")
.setOkButton("Prueba") {
customDialog.dismiss()
}.setKoButton("Cancelar") {
// customDialogInput.dismiss()
customDialog.dismiss()
}.show()
} }
}, onPasillerosItemClickListener = pasillerosItemClickListener!!) }, onPasillerosItemClickListener = pasillerosItemClickListener!!)
@ -205,9 +161,6 @@ class ItemProposalFragment(
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.locationRecyclerview.layoutManager = layoutManager binding.locationRecyclerview.layoutManager = layoutManager
if (firstVisiblePosition <= listInvetory.size) {
binding.locationRecyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition)
}
}) })

View File

@ -31,7 +31,7 @@ class ItemCardVO (
var urlImage200:String = "", var urlImage200:String = "",
var urlImage:String = "", var urlImage:String = "",
var itemPackingTypeFk:String =" ", var itemPackingTypeFk:String =" ",
var referencia:String="", var reference:String="",
//sergio para modificar la llamada de itemCard a item_getInfo //sergio para modificar la llamada de itemCard a item_getInfo

View File

@ -17,7 +17,7 @@ class BufferFragment(
private var password = "" private var password = ""
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
companion object { companion object {
fun newInstance(entryPoint: String) = BufferFragment(entryPoint) fun newInstance(entryPoint: String) = BufferFragment(entryPoint)
@ -27,7 +27,7 @@ class BufferFragment(
override fun init() { override fun init() {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
customDialog = CustomDialog(requireContext()) //customDialog = CustomDialog(requireContext())
setToolbar() setToolbar()
setEvents() setEvents()
super.init() super.init()
@ -77,7 +77,7 @@ class BufferFragment(
} }
binding.scanInput.setText("") binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard( binding.scanInput) ma.hideKeyboard( binding.scanInput)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false
@ -91,12 +91,12 @@ class BufferFragment(
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
if (it.isError) { if (it.isError) {
(activity as MainActivity).messageWithSound( ma.messageWithSound(
it.errorMessage,true,isPlayed = true) it.errorMessage,true,isPlayed = true)
} else { } else {
(activity as MainActivity).messageWithSound("Operación "+entryPoint.lowercase() + " buffer realizada correctamente",false,isPlayed = true) ma.messageWithSound("Operación "+entryPoint.lowercase() + " buffer realizada correctamente",false,isPlayed = true)
binding.mainToolbar.backButton.performClick() binding.mainToolbar.backButton.performClick()
} }

View File

@ -41,7 +41,7 @@ class BufferLoadFragment(
customDialogList = CustomDialogList(requireContext()) customDialogList = CustomDialogList(requireContext())
goBack = false goBack = false
(activity as MainActivity).hideBottomNavigation(GONE) ma.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)
@ -107,12 +107,12 @@ class BufferLoadFragment(
if (it.isError) { if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage,it.isError,true) ma.messageWithSound(it.errorMessage,it.isError,true)
} else { } else {
if (it.response.equals("Registro añadido")){ if (it.response.equals("Registro añadido")){
(activity as MainActivity).messageWithSound(it.response,false,true) ma.messageWithSound(it.response,false,true)
}else{ }else{
mperror?.start() mperror?.start()
it.response.toast(requireContext()) it.response.toast(requireContext())
@ -156,7 +156,7 @@ class BufferLoadFragment(
customDialogList.setTitle("Escanea etiqueta de la expedición.") customDialogList.setTitle("Escanea etiqueta de la expedición.")
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
listTags.clear() listTags.clear()
@ -168,7 +168,7 @@ class BufferLoadFragment(
customDialogList.getEditText().requestFocus() customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
@ -179,7 +179,7 @@ class BufferLoadFragment(
} }
customDialogList.setValue("") customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false

View File

@ -21,7 +21,6 @@ class BuscarItemFragment(
) : BaseFragment<FragmentBuscarItemBinding,BuscarItemViewModel>(BuscarItemViewModel::class) { ) : BaseFragment<FragmentBuscarItemBinding,BuscarItemViewModel>(BuscarItemViewModel::class) {
private var adapter : LocationAdapter? = null private var adapter : LocationAdapter? = null
private lateinit var customDialog: CustomDialog
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
companion object { companion object {
@ -36,9 +35,8 @@ class BuscarItemFragment(
override fun init() { override fun init() {
(activity as MainActivity).hideBottomNavigation(GONE) ma.hideBottomNavigation(GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.getubicaition) binding.mainToolbar.toolbarTitle.text = getString(R.string.getubicaition)
customDialog = CustomDialog(requireContext())
setEvents() setEvents()
if (!itemFk.isNullOrEmpty()){ if (!itemFk.isNullOrEmpty()){
getLocations(itemFk) getLocations(itemFk)
@ -54,7 +52,7 @@ class BuscarItemFragment(
if (!binding.editItemFk.text.toString().isNullOrEmpty()) if (!binding.editItemFk.text.toString().isNullOrEmpty())
getLocations(binding.editItemFk.text.toString()) getLocations(binding.editItemFk.text.toString())
binding.editItemFk.setText("") binding.editItemFk.setText("")
(activity as MainActivity).hideKeyboard(binding.editItemFk) ma.hideKeyboard(binding.editItemFk)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false

View File

@ -10,7 +10,8 @@ class ItemLocationVO (
var created:String = "", var created:String = "",
var itemFk:String = "", var itemFk:String = "",
val isError : Boolean = false, val isError : Boolean = false,
var errorMessage : String = "" var errorMessage : String = "",
var priority:String = ""
) )
class LocationListVO ( class LocationListVO (

View File

@ -25,7 +25,7 @@ import es.verdnatura.presentation.view.feature.main.activity.MainActivity
class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(BuyersViewModel::class) { class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(BuyersViewModel::class) {
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
@ -46,8 +46,8 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
} }
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext()) // customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE) ma.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)
@ -108,8 +108,9 @@ class BuyersFragment : BaseFragment<BuyersFragmentBinding,BuyersViewModel>(Buyer
id = buyer.userFk.toInt(), id = buyer.userFk.toInt(),
title = buyer.nickname, title = buyer.nickname,
sectorFk = 0, sectorFk = 0,
warehouse = 0 warehouse = 0,
) printerFk=0,
printerSelected ="")
) )
}catch (e:Exception){} }catch (e:Exception){}
} }

View File

@ -53,7 +53,7 @@ class QaualityFragment(
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE) ma.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()

View File

@ -52,13 +52,6 @@ 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 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
@ -88,6 +81,8 @@ class CollectionFragment(
private var positionCollectionMissing = 0 private var positionCollectionMissing = 0
private var quantityCollectionMissing = "" private var quantityCollectionMissing = ""
private var isMarking = false private var isMarking = false
private var positionCollectionSplit = 0
private var quantityCollectionSplit = ""
//private var myKM: KeyguardManager? = null //private var myKM: KeyguardManager? = null
private var state = 0 private var state = 0
@ -154,8 +149,7 @@ class CollectionFragment(
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogThreeButtons = CustomDialogThreeButtons(requireContext()) customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
//requireActivity().main_bottom_navigation.visibility = View.GONE ma.hideBottomNavigation(View.GONE)
(activity as MainActivity).hideBottomNavigation(View.GONE)
if (binding.splashProgress != null) binding.splashProgress.visibility = VISIBLE if (binding.splashProgress != null) binding.splashProgress.visibility = VISIBLE
setEvents() setEvents()
@ -250,7 +244,7 @@ class CollectionFragment(
private fun showUser() { private fun showUser() {
(activity as MainActivity).onPasillerosItemClickListener( ma.onPasillerosItemClickListener(
PasillerosItemVO(title = "Control de usuario de vehículo"), PasillerosItemVO(title = "Control de usuario de vehículo"),
workerFkFromTicket workerFkFromTicket
) )
@ -355,15 +349,16 @@ class CollectionFragment(
responseUsedShelves.observe(viewLifecycleOwner, Observer { responseUsedShelves.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
(activity as MainActivity).messageWithSound( if (!goBack){
ma.messageWithSound(
if (it.isError) it.errorMessage else "Baldas guardadas", if (it.isError) it.errorMessage else "Baldas guardadas",
it.isError,true it.isError,true
) )}
}) })
responseItem_updatePackingShelve.observe(viewLifecycleOwner, Observer { responseItem_updatePackingShelve.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
(activity as MainActivity).messageWithSound( ma.messageWithSound(
if (it.isError) it.errorMessage else "Packing guardado", if (it.isError) it.errorMessage else "Packing guardado",
it.isError,!it.isError it.isError,!it.isError
) )
@ -384,9 +379,9 @@ class CollectionFragment(
if (it.isError) { if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, true,true) ma.messageWithSound(it.errorMessage, true,true)
} else { } else {
(activity as MainActivity).messageWithSound("Previa recogida", false,true) ma.messageWithSound("Previa recogida", false,true)
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.collectionTicketGet( viewModel.collectionTicketGet(
getData(USER), getData(USER),
@ -424,6 +419,8 @@ class CollectionFragment(
if (binding.splashProgress != null) binding.splashProgress.visibility = if (binding.splashProgress != null) binding.splashProgress.visibility =
View.VISIBLE View.VISIBLE
if (!goBack){
sendSalixMessage( sendSalixMessage(
item = dataMessageSalix.item, item = dataMessageSalix.item,
ticketFk = dataMessageSalix.ticket, ticketFk = dataMessageSalix.ticket,
@ -440,6 +437,7 @@ class CollectionFragment(
// //Log.i("VERDNATURA:","La collection es ${collection.collectionFk}") // //Log.i("VERDNATURA:","La collection es ${collection.collectionFk}")
} }
}
// } // }
goBack = false goBack = false
@ -476,14 +474,16 @@ class CollectionFragment(
responseMissingTrash.observe(viewLifecycleOwner, Observer { responseMissingTrash.observe(viewLifecycleOwner, Observer {
if (it.isError) { if (!goBack){
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true,true) if (it.isError) {
ma.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,getData(SECTORFK))*/ viewModel.collectionTicketGet(user,password,collection.collectionFk,getData(SECTORFK))*/
}) })
@ -492,13 +492,23 @@ class CollectionFragment(
responseIncQuantity.observe(viewLifecycleOwner, Observer { responseIncQuantity.observe(viewLifecycleOwner, Observer {
if (it.isError) { if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true,true) ma.messageWithSound(it.errorMessage, isError = true,true)
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") {
customDialog.dismiss()
}.show()*/
} else { } else {
incresaseSuccesful() if (!goBack){ incresaseSuccesful()}else{goBack=false}
}
})
responseSaleMove.observe(viewLifecycleOwner, Observer {
if (it.isError) {
ma.messageWithSound(it.errorMessage, isError = true,true)
} else {
if (!goBack)
responseSaleMoveSuccesful()
goBack=false
} }
}) })
@ -507,11 +517,13 @@ class CollectionFragment(
binding.splashProgress.visibility=GONE binding.splashProgress.visibility=GONE
if (it.isError) { if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage+"Usuario:"+workerFkFromTicket, isError = true,true) if (!goBack)
ma.messageWithSound(it.errorMessage+"Usuario:"+workerFkFromTicket, isError = true,true)
goBack = false
} else { } else {
if (!goBack)
callPicker(it.response) callPicker(it.response)
goBack = false
} }
}) })
@ -519,7 +531,8 @@ class CollectionFragment(
mistakeList.observe(viewLifecycleOwner, Observer { mistakeList.observe(viewLifecycleOwner, Observer {
if (binding.splashProgress != null) binding.splashProgress.visibility = GONE if (binding.splashProgress != null) binding.splashProgress.visibility = GONE
/*sergio:se quita esta comprobacion if (!goBack) */ /*sergio:se quita y se pone esta comprobacion porque si no aparece de nuevo otra vez al volver atrás */
if (!goBack)
showMistakeList(it.list) showMistakeList(it.list)
goBack = false goBack = false
}) })
@ -527,13 +540,15 @@ class CollectionFragment(
responsecheckfully.observe(viewLifecycleOwner, Observer { responsecheckfully.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
if (it.isError) { if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage) ma.messageWithSound(it.errorMessage,it.isError,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") { .setOkButton("Aceptar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} else { } else {
//sergio: devuelve false si no hay para revisar y <> false. //sergio: devuelve false si no hay para revisar y <> false.
if (it.response != "false") { if (it.response != "false") {
customDialog.setTitle("Aviso") customDialog.setTitle("Aviso")
.setDescription("Pendiente de revisar : " + it.response) .setDescription("Pendiente de revisar : " + it.response)
.setOkButton("Aceptar") { .setOkButton("Aceptar") {
@ -560,11 +575,17 @@ class CollectionFragment(
}) })
responseSalixMessage.observe(viewLifecycleOwner, Observer { responseSalixMessage.observe(viewLifecycleOwner, Observer {
if (it.isError) { if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
if (!goBack){
ma.messageWithSound(it.errorMessage,it.isError,false)}else{goBack=false}
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") { .setOkButton("Aceptar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} }
}) })
@ -572,6 +593,22 @@ class CollectionFragment(
} }
} }
private fun responseSaleMoveSuccesful() {
sales[positionCollectionSplit].quantity = quantityCollectionSplit
if (quantityCollectionSplit == "0")
markLine(positionCollectionSplit, type)
saleAdapter!!.notifyDataSetChanged()
val ticket =
"[" + sales[positionCollectionSplit].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionSplit].ticketFk + "/summary)"
val message =
"Se ha enviado a Split el articulo " + sales[positionCollectionSplit].itemFk + " del ticket " + ticket
sendSalixMessageNew(message,sales[positionCollectionSplit].salePersonFk)
}
private fun callPicker(extensionNumber:String) { private fun callPicker(extensionNumber:String) {
@ -656,31 +693,12 @@ class CollectionFragment(
observations = observations + " " + ticket.observations observations = observations + " " + ticket.observations
} }
//sales = salesList.sortedWith(compareBy({it.placements.get(0).placement}))
sales = salesList.sortedWith(compareBy({ it.saleOrder })) sales = salesList.sortedWith(compareBy({ it.saleOrder }))
//sales=salesList
/* for (s in sales)
{
Log.i("VERDNATURA:","La sale del ticket ${s.ticketFk} es ${s.saleOrder}")
for (p in s.placements){
Log.i("VERDNATURA:","La sale del ticket ${s.saleOrder} es ${p.placement}")
//s.placements=s.placements.sortedBy { it.saleOrder}.sortedBy { !it.visible.equals("0") }
s.placements=s.placements.sortedBy { !it.visible.equals("0") }
// Log.i("VERDNATURA:","La sale del ticket ${s.saleOrder} es saleorder ${p.saleOrder}")
}
}*/
/*for (s in salesList)
{
Log.i("VERDNATURA:","La sale del ticket ${s.ticketFk} es ${s.saleOrder}")
for (p in s.placements){
Log.i("VERDNATURA:","La sale del ticket ${s.saleOrder} es ${p.placement}")
// Log.i("VERDNATURA:","La sale del ticket ${s.saleOrder} es saleorder ${p.saleOrder}")
}
}*/
//pruebas sergio //pruebas sergio
// sales = salesList.sortedWith(compareBy({it.placements.get(0).created})) // sales = salesList.sortedWith(compareBy({it.placements.get(0).created}))
//sales = salesList.sortedWith(compareBy({it.placements.get(0).placement}))
// SalesSorter() // SalesSorter()
@ -709,8 +727,7 @@ class CollectionFragment(
markLine(index, type) markLine(index, type)
//////Log.i("VERDNATURA:","marcamos linea") //////Log.i("VERDNATURA:","marcamos linea")
} else if (type == SACADOR) { } else if (type == SACADOR) {
Log.d("VERDNATURA", "El tipo es sacador")
Log.d("VERDNATURA", "La sale es" + sale.isPrepared)
if (sale.isPrepared == "0" || sale.isPrepared.isNullOrEmpty()) { if (sale.isPrepared == "0" || sale.isPrepared.isNullOrEmpty()) {
showScanner(index, sale) showScanner(index, sale)
} else { } else {
@ -1033,6 +1050,7 @@ class CollectionFragment(
}*/ }*/
saleTrackingReplace(position, newType) saleTrackingReplace(position, newType)
isMarking = true
setTotalLines() setTotalLines()
} }
@ -1056,8 +1074,7 @@ class CollectionFragment(
} }
private fun saleTrackingReplace(position: Int, type: String) { private fun saleTrackingReplace(position: Int, type: String) {
//////Log.i("VERDNATURA:","POSICION $position y el tipo $type")
//////Log.i("VERDNATURA:","El buyfk que no es real es $originalItemScan")
viewModel.saleTrackingReplace( viewModel.saleTrackingReplace(
getData(USER), getData(USER),
getData(PASSWORD), getData(PASSWORD),
@ -1405,7 +1422,7 @@ class CollectionFragment(
) )
(getString(R.string.Imprimiendo) + " por " + getData(SECTORDESCRIP)).toast(requireContext()) (getString(R.string.Imprimiendo) + " por " + getData(PRINTERNAME)).toast(requireContext())
} }
private fun addItem() { private fun addItem() {
@ -1598,7 +1615,7 @@ class CollectionFragment(
} }
private fun setTotalLines() { private fun setTotalLines() {
// Log.d("VERDNTURA::","el itempacking ggg es "+collection.tickets.get(0).itemPackingTypeFk)
var totalMark = 0 var totalMark = 0
sales.forEach { sales.forEach {
if (type == SACADOR) { if (type == SACADOR) {
@ -1618,11 +1635,12 @@ class CollectionFragment(
if (collection.collectionFk != null) collection.collectionFk else "" if (collection.collectionFk != null) collection.collectionFk else ""
if (binding.mainToolbar.toolbarSubtitle != null && totalMark != null && sales != null) binding.mainToolbar.toolbarSubtitle.text = if (binding.mainToolbar.toolbarSubtitle != null && totalMark != null && sales != null) binding.mainToolbar.toolbarSubtitle.text =
"" + totalMark + "/" + sales.size "" + totalMark + "/" + sales.size
if (totalMark == sales.size) { if (totalMark == sales.size) {
getString(R.string.Coleccióncompleta).toast(this.context, Toast.LENGTH_SHORT) getString(R.string.Coleccióncompleta).toast(this.context, Toast.LENGTH_SHORT)
if (!goBack)
ticketCollection_setUsedShelves() ticketCollection_setUsedShelves()
goBack=false
//showBottomNavigation(View.VISIBLE) //showBottomNavigation(View.VISIBLE)
//sergio: se quita porque se realiza desde triggers //sergio: se quita porque se realiza desde triggers
@ -1775,13 +1793,7 @@ class CollectionFragment(
customDialogThreeButtons.getValue(), customDialogThreeButtons.getValue(),
getString(R.string.Faltas) getString(R.string.Faltas)
) )
/*if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
getString(R.string.Indicanuevacantidad).toast(requireContext())
} else {
trash(position, customDialogThreeButtons.getValue())
scanRequest()
customDialogThreeButtons.dismiss()
}*/
}.setOkButtonTwo(getString(R.string.BasuraRechazar)) { }.setOkButtonTwo(getString(R.string.BasuraRechazar)) {
checkAndCall( checkAndCall(
@ -1838,6 +1850,10 @@ class CollectionFragment(
} }
private fun split(position: Int, quantity: String) { private fun split(position: Int, quantity: String) {
quantityCollectionSplit=quantity
positionCollectionSplit=position
var totalQuantity: Int = 0 var totalQuantity: Int = 0
try { try {
totalQuantity = sales[position].quantity.toInt() - quantity.toInt() totalQuantity = sales[position].quantity.toInt() - quantity.toInt()
@ -1851,9 +1867,8 @@ class CollectionFragment(
originalQuantity = sales[position].quantity, originalQuantity = sales[position].quantity,
"saleMove" "saleMove"
) )
//sales[position].originalQuantity = quantity
sales[position].quantity = quantity /* sales[position].quantity = quantity
//sales[position].startQuantity = quantity
if (quantity == "0") if (quantity == "0")
markLine(position, type) markLine(position, type)
@ -1868,7 +1883,7 @@ class CollectionFragment(
token = getData(TOKEN), token = getData(TOKEN),
workerId = sales[position].salePersonFk, workerId = sales[position].salePersonFk,
message = message, "sendChekingPresence" message = message, "sendChekingPresence"
) )*/
} }
@ -2042,9 +2057,11 @@ class CollectionFragment(
"TRUE"->{ "TRUE"->{
message = "Se ha enviado a Basura " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket message = "Se ha enviado a Basura " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket
} }
"FALSE"->{ "FALSE"->{
message= "Se ha enviado a Faltas la cantidad de " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket message= "Se ha enviado a Faltas la cantidad de " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket
} }
"reject"->{ "reject"->{
message = "Se ha modificado la cantidad de " + sales[positionCollectionMissing].originalQuantity + " del artículo " + sales[positionCollectionMissing].itemFk + " a nueva cantidad: " + sales[positionCollectionMissing].quantity + " del ticket " + ticket message = "Se ha modificado la cantidad de " + sales[positionCollectionMissing].originalQuantity + " del artículo " + sales[positionCollectionMissing].itemFk + " a nueva cantidad: " + sales[positionCollectionMissing].quantity + " del ticket " + ticket
@ -2068,9 +2085,12 @@ class CollectionFragment(
private fun incresaseSuccesful() { private fun incresaseSuccesful() {
try { try {
//val quantityPicked = (quantity.toInt() - sales[position].quantity.toInt()).toString() //val quantityPicked = (quantity.toInt() - sales[position].quantitytoInt()).toString()
//sales[position].originalQuantity = quantity
sales[positionIncreaseQuantity].quantity = quantityIncrease // sergio: se añade linea para que se actualice la originalQuantity
//sales[positionIncreaseQuantity].originalQuantity = quantityIncrease
sales[positionIncreaseQuantity].quantity = quantityIncrease
/*if (type == CONTROLADOR){ /*if (type == CONTROLADOR){
showShelving(position,0,quantityPicked) showShelving(position,0,quantityPicked)
}*/ }*/
@ -2084,6 +2104,7 @@ class CollectionFragment(
val message = val message =
"Se ha modificado la cantidad original " + sales[positionIncreaseQuantity].originalQuantity + " del artículo " + sales[positionIncreaseQuantity].itemFk + " a nueva cantidad: " + sales[positionIncreaseQuantity].quantity + " del ticket " + ticket "Se ha modificado la cantidad original " + sales[positionIncreaseQuantity].originalQuantity + " del artículo " + sales[positionIncreaseQuantity].itemFk + " a nueva cantidad: " + sales[positionIncreaseQuantity].quantity + " del ticket " + ticket
sendSalixMessageNew(message, sales[positionIncreaseQuantity].salePersonFk) sendSalixMessageNew(message, sales[positionIncreaseQuantity].salePersonFk)
/* val ticket = /* val ticket =
"[" + sales[positionIncreaseQuantity].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionIncreaseQuantity].ticketFk + "/summary)" "[" + sales[positionIncreaseQuantity].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionIncreaseQuantity].ticketFk + "/summary)"
@ -2094,6 +2115,7 @@ class CollectionFragment(
workerId = sales[positionIncreaseQuantity].salePersonFk, workerId = sales[positionIncreaseQuantity].salePersonFk,
message = message, "sendChekingPresence" message = message, "sendChekingPresence"
)*/ )*/
sales[positionIncreaseQuantity].originalQuantity = quantityIncrease
} }
@ -2220,7 +2242,7 @@ class CollectionFragment(
} }
customDialogList.setTitle("Causa de error").setKoButton("Cerrar") { customDialogList.setTitle("Causa de error").setKoButton("Cancelar") {
scanRequest() scanRequest()
hideKeyboards() hideKeyboards()
customDialogList.dismiss() customDialogList.dismiss()

View File

@ -37,6 +37,10 @@ class CollectionViewModel(context: Context) : BaseViewModel()
val response: LiveData<ResponseItemVO> val response: LiveData<ResponseItemVO>
get() = _response get() = _response
private val _responseSaleMove by lazy { MutableLiveData<ResponseItemVO>() }
val responseSaleMove: LiveData<ResponseItemVO>
get() = _responseSaleMove
private val _responseUsedShelves by lazy { MutableLiveData<ResponseItemVO>() } private val _responseUsedShelves by lazy { MutableLiveData<ResponseItemVO>() }
val responseUsedShelves: LiveData<ResponseItemVO> val responseUsedShelves: LiveData<ResponseItemVO>
get() = _responseUsedShelves get() = _responseUsedShelves
@ -508,7 +512,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{ {
override fun onFailure(call: Call<String>, t: Throwable) override fun onFailure(call: Call<String>, t: Throwable)
{ {
_response.value = ResponseItemVO( _responseSaleMove.value = ResponseItemVO(
isError = true, isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
) )
@ -518,13 +522,13 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{ {
if (response.body() == null) if (response.body() == null)
{ {
_response.value = ResponseItemVO( _responseSaleMove.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()!!) _responseSaleMove.value = ResponseItemVO(isError = false, response = response.body()!!)
} }
} }
}) })

View File

@ -67,7 +67,7 @@ class CollectionShowTicketFragment(
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(GONE) ma.hideBottomNavigation(GONE)
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
setEvents() setEvents()
setToolBarIcon() setToolBarIcon()
@ -113,7 +113,7 @@ class CollectionShowTicketFragment(
"collectionStickerPrint" "collectionStickerPrint"
) )
(getString(R.string.Imprimiendo) + " por " + getData(SECTORDESCRIP)).toast(requireContext()) (getString(R.string.Imprimiendo) + " por " + getData(PRINTERNAME)).toast(requireContext())
} }
private fun setEvents() { private fun setEvents() {
@ -186,7 +186,7 @@ class CollectionShowTicketFragment(
binding.mainToolbar.toolbarSubtitle.text = "0/0" binding.mainToolbar.toolbarSubtitle.text = "0/0"
} }
} else { } else {
(activity as MainActivity).messageWithSound(it.errorMessage,it.isError,false) ma.messageWithSound(it.errorMessage,it.isError,false)
if (activity != null) requireActivity().onBackPressed() if (activity != null) requireActivity().onBackPressed()
} }

View File

@ -19,7 +19,7 @@ class ControladorFragment :
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
companion object { companion object {
fun newInstance() = ControladorFragment() fun newInstance() = ControladorFragment()
@ -33,10 +33,10 @@ class ControladorFragment :
override fun init() { override fun init() {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
customDialog = CustomDialog(requireContext()) // customDialog = CustomDialog(requireContext())
binding.mainToolbar.toolbarTitle.text = getString(R.string.controlticket) binding.mainToolbar.toolbarTitle.text = getString(R.string.controlticket)
setEvents() setEvents()
(activity as MainActivity).hideBottomNavigation(View.VISIBLE) ma.hideBottomNavigation(View.VISIBLE)
super.init() super.init()
} }
@ -73,7 +73,7 @@ class ControladorFragment :
} }
binding.scanInput.setText("") binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput) ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false
@ -85,10 +85,11 @@ class ControladorFragment :
collectionTicketList.observe(viewLifecycleOwner, Observer { collectionTicketList.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
if (it.isError) { if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage) ma.messageWithSound(it.errorMessage,isError = true, isPlayed = false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") { .setOkButton("Aceptar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} else { } else {
if (!goBack) navigateToCollectionList(it) if (!goBack) navigateToCollectionList(it)

View File

@ -7,7 +7,6 @@ import android.util.TypedValue
import android.view.View.* import android.view.View.*
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import android.widget.ImageView import android.widget.ImageView
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
@ -18,9 +17,9 @@ 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.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.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 java.text.SimpleDateFormat
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
@ -36,7 +35,7 @@ class ControlVehiculoFragment(
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private var isWorkedTimed = "UNREGISTERED" private var isWorkedTimed = "UNREGISTERED"
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogThreeButtons: CustomDialogThreeButtons private lateinit var customDialogThreeButtons: CustomDialogThreeButtons
companion object { companion object {
fun newInstance(tagName: String) = ControlVehiculoFragment(tagName) fun newInstance(tagName: String) = ControlVehiculoFragment(tagName)
@ -58,7 +57,7 @@ class ControlVehiculoFragment(
/* if (getWagons() < 2 && !tagName.equals(SacadorFragment.TAG)) /* if (getWagons() < 2 && !tagName.equals(SacadorFragment.TAG))
{ {
(activity as MainActivity).openFragmentPickers() ma.openFragmentPickers()
}*/ }*/
@ -66,20 +65,24 @@ class ControlVehiculoFragment(
setToolBar("HISTORY") setToolBar("HISTORY")
showScanner("Escanea matrícula para ver histórico", "HISTORY") showScanner("Escanea matrícula para ver histórico", "HISTORY")
} else { } else {
checkControlTimeVehicle() checkControlTimeVehicle()
setToolBar("ALL") setToolBar("ALL")
} }
setEvents()
setEvents()
super.init() super.init()
} }
override fun onPause() { override fun onPause() {
goBack = true goBack = true
super.onPause() super.onPause()
} }
private fun setToolBar(direction: String) { private fun setToolBar(direction: String?) {
binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclecontrol) binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclecontrol)
binding.mainToolbar.toolbarTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13F) binding.mainToolbar.toolbarTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13F)
@ -112,29 +115,8 @@ class ControlVehiculoFragment(
listIcons.add(iconVehicleIn) listIcons.add(iconVehicleIn)
listIcons.add(iconHistory) listIcons.add(iconHistory)
} }
"OUT"->{
listIcons.remove(iconVehicleOut)
listIcons.remove(iconVehicleIn)
listIcons.add(iconHistory)
}
} }
/* if (direction.equals("OUT")) {
listIcons.remove(iconVehicleIn)
listIcons.add(iconVehicleOut)
listIcons.add(iconHistory)
}
if (direction.equals("IN")) {
listIcons.remove(iconVehicleOut)
listIcons.add(iconVehicleIn)
listIcons.add(iconHistory)
}
if (direction.equals("HISTORY")) {
listIcons.remove(iconVehicleOut)
listIcons.remove(iconVehicleIn)
listIcons.add(iconHistory)
}*/
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) {
@ -154,7 +136,7 @@ class ControlVehiculoFragment(
customDialogInput.setTitle(getString(R.string.vehiclecontrol)).setDescription(description) customDialogInput.setTitle(getString(R.string.vehiclecontrol)).setDescription(description)
.setOkButton("Aceptar") { .setOkButton("Aceptar") {
if (!customDialogInput.getValue().isNullOrEmpty()) { if (customDialogInput.getValue().isNotEmpty()) {
// "$description ${customDialogInput.getValue()} OK".toast(requireContext()) // "$description ${customDialogInput.getValue()} OK".toast(requireContext())
insertControlTimeVehicle(customDialogInput.getValue(), action) insertControlTimeVehicle(customDialogInput.getValue(), action)
} }
@ -166,14 +148,18 @@ class ControlVehiculoFragment(
.setKoButton("Cancelar") { .setKoButton("Cancelar") {
customDialogInput.dismiss() customDialogInput.dismiss()
if (tagName.equals(HistoricoVehiculoFragment.TAG)) {
ma.onBackPressed()
}
}.setValue("").show() }.setValue("").show()
customDialogInput.getEditText().requestFocus() customDialogInput.setFocusText()
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().isNotEmpty()) {
insertControlTimeVehicle(customDialogInput.getValue(), action) insertControlTimeVehicle(customDialogInput.getValue(), action)
} }
@ -191,15 +177,20 @@ class ControlVehiculoFragment(
private fun checkControlTimeVehicle() { private fun checkControlTimeVehicle() {
if (!goBack) { if (!goBack) {
// d("la fecha es "+getData("DATENOVEHICLE"))
//if (!IsNoVehicleDataToday()){
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.workerMachinery_isRegistered(getData(USER),getData(PASSWORD),"workerMachinery_isRegistered") viewModel.workerMachinery_isRegistered(getData(USER),getData(PASSWORD),"workerMachinery_isRegistered")
/*}else{
ma.openFragmentPickers()
}*/
} }
} }
private fun insertControlTimeVehicle(plateNumber: String, direction: String) { private fun insertControlTimeVehicle(plateNumber: String, direction: String) {
if (direction.equals("HISTORY")) { if (direction.equals("HISTORY")) {
(activity as MainActivity).onPasillerosItemClickListener( ma.onPasillerosItemClickListener(
PasillerosItemVO(title = "Historico Vehículo"), PasillerosItemVO(title = "Historico Vehículo"),
plateNumber plateNumber
) )
@ -211,15 +202,15 @@ class ControlVehiculoFragment(
viewModel.machineWorker_update(getData(USER),getData(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() ma.openFragmentPickers(true)
} }
} }
private fun scanRequest() { private fun scanRequest() {
if (binding.scanInput != null) { // if (binding.scanInput != null) {
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
} //}
hideKeyboards() hideKeyboards()
} }
@ -234,7 +225,9 @@ class ControlVehiculoFragment(
private fun setEvents() { private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed() ma.openFragmentPickers(true)
//requireActivity().onBackPressed()
} }
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
@ -249,7 +242,7 @@ class ControlVehiculoFragment(
} }
} }
binding.scanInput.setText("") binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput) ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false
@ -264,7 +257,7 @@ class ControlVehiculoFragment(
.setValue(plate) .setValue(plate)
if (isWorkedTimed.equals("UNREGISTERED")) { if (isWorkedTimed.equals("UNREGISTERED")) {
customDialogThreeButtons.setOkButtonTwo("COGER") { customDialogThreeButtons.setOkButtonTwo("COGER") {
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { if (customDialogThreeButtons.getValue().trim().isEmpty()) {
"Vuelva a escanear".toast(requireContext()) "Vuelva a escanear".toast(requireContext())
} else { } else {
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
@ -275,7 +268,7 @@ class ControlVehiculoFragment(
} else { } else {
customDialogThreeButtons.setOkButtonThree("DEJAR") { customDialogThreeButtons.setOkButtonThree("DEJAR") {
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { if (customDialogThreeButtons.getValue().trim().isEmpty()) {
"Vuelva a escanear".toast(requireContext()) "Vuelva a escanear".toast(requireContext())
} else { } else {
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
@ -284,7 +277,7 @@ class ControlVehiculoFragment(
} }
} }
}.setOkButtonFour("HISTÓRICO") { }.setOkButtonFour("HISTÓRICO") {
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { if (customDialogThreeButtons.getValue().trim().isEmpty()) {
"Vuelva a escanear".toast(requireContext()) "Vuelva a escanear".toast(requireContext())
} else { } else {
customDialogThreeButtons.dismiss() customDialogThreeButtons.dismiss()
@ -306,7 +299,7 @@ class ControlVehiculoFragment(
.setValue(plate) .setValue(plate)
.setOkButtonFour("HISTÓRICO") { .setOkButtonFour("HISTÓRICO") {
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) { if (customDialogThreeButtons.getValue().trim().isEmpty()) {
"Vuelva a escanear".toast(requireContext()) "Vuelva a escanear".toast(requireContext())
} else { } else {
customDialogThreeButtons.dismiss() customDialogThreeButtons.dismiss()
@ -324,16 +317,16 @@ class ControlVehiculoFragment(
with(viewModel) { with(viewModel) {
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
responseinsert.observe(viewLifecycleOwner, Observer { responseinsert.observe(viewLifecycleOwner, {
if (it.isError) { if (it.isError) {
ma.messageWithSound(it.errorMessage,true,false)
customDialog.setTitle("Error").setDescription(it.errorMessage) /*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} else { } else {
if (it.response == null || it.response == "false") { if (it.response == "false") {
customDialog.setTitle("Error") customDialog.setTitle("Error")
.setDescription("Revisar llamada del registro de vehículos") .setDescription("Revisar llamada del registro de vehículos")
@ -350,8 +343,8 @@ class ControlVehiculoFragment(
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
customDialog.dismiss() customDialog.dismiss()
}.show()*/ }.show()*/
(activity as MainActivity).openFragmentPickers() ma.openFragmentPickers(true)
//(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Sacadores"),"CONTROL") //ma.onPasillerosItemClickListener( PasillerosItemVO(title = "Sacadores"),"CONTROL")
//checkControlTimeVehicle() //checkControlTimeVehicle()
} }
@ -360,54 +353,68 @@ class ControlVehiculoFragment(
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
}) })
responsecontrol.observe(viewLifecycleOwner, Observer { responsecontrol.observe(viewLifecycleOwner, {
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
// Log.i("VERDNATURA:","${it.response}") // Log.i("VERDNATURA:","${it.response}")
if (it.isError) { if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage) ma.messageWithSound(it.errorMessage,true,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} else { } else {
if (it.response == null) { if (it.response.equals("1")) {
customDialog.setTitle("Error") isWorkedTimed = "REGISTERED"
.setDescription("Revisar llamada de control de vehículos") setToolBar("OUT")
.setOkButton("Cerrar") { /* customDialog.setTitle("Control de vehículos")
customDialog.dismiss() .setDescription("SI Tienes coche asignado")
}.show() .setOkButton("Cerrar") {
} else { customDialog.dismiss()
if (it.response.equals("1")) { }.show()*/
isWorkedTimed = "REGISTERED" if (!tagName.equals(SacadorFragment.TAG)) {
setToolBar("OUT") ma.openFragmentPickers(true)
/* customDialog.setTitle("Control de vehículos")
.setDescription("SI Tienes coche asignado")
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()*/
if (!tagName.equals(SacadorFragment.TAG)) {
(activity as MainActivity).openFragmentPickers()
}
} else {
if (it.response.equals("0")) {
setToolBar("IN")
customDialog.setTitle("Control de vehículos")
.setDescription("Escanea la matrícula del vehículo o elige sin vehículo")
.setOkButton("Escanear vehículo") {
customDialog.dismiss()
showScanner("Escanea matrícula del vehículo", "IN")
}
.setKoButton("SIN VEHÍCULO") {
customDialog.dismiss()
(activity as MainActivity).openFragmentPickers()
// getActivity()?.getFragmentManager()?.popBackStack();
}.show()
}
} }
} else {
if (it.response.equals("0")) {
setToolBar("IN")
/* customDialog.setTitle("Control de vehículos")
.setDescription("Escanea la matrícula del vehículo o elige sin vehículo")
.setOkButton("Escanear vehículo") {
customDialog.dismiss()
showScanner("Escanea matrícula del vehículo", "IN")
}
.setKoButton("SIN VEHÍCULO") {
customDialog.dismiss()
saveData(DATENOVEHICLE, SimpleDateFormat("yyyy-MM-dd",Locale.getDefault()).format(Date()).toString())
ma.openFragmentPickers(true)
}.show()*/
customDialogInput.setTitle(getString(R.string.vehiclecontrol)).setDescription("Escanea la matrícula del vehículo o elige sin vehículo")
.setOkButton("Coger vehículo") {
if (customDialogInput.getValue().isNotEmpty()) {
// "$description ${customDialogInput.getValue()} OK".toast(requireContext())
insertControlTimeVehicle(customDialogInput.getValue(), "IN")
}
customDialogInput.setValue("")
scanRequest()
customDialogInput.dismiss()
hideKeyboards()
}
.setKoButton("Sin vehículo") {
customDialogInput.dismiss()
ma.openFragmentPickers(true)
/* if (tagName.equals(HistoricoVehiculoFragment.TAG)) {
ma.onBackPressed()
}*/
}.setValue("").show()
customDialogInput.setFocusText()
}
} }
} }
}) })
@ -415,6 +422,13 @@ class ControlVehiculoFragment(
} }
} }
private fun IsNoVehicleDataToday(): Boolean {
return (getData(DATENOVEHICLE)==SimpleDateFormat("yyyy-MM-dd",Locale.getDefault()).format(Date()))
}
} }

View File

@ -7,6 +7,7 @@ import es.verdnatura.databinding.FragmentVehiclecontrolUserBinding
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 es.verdnatura.presentation.view.feature.main.activity.MainActivity
class ControlVehiculoUsuarioFragment( class ControlVehiculoUsuarioFragment(
@ -18,7 +19,7 @@ class ControlVehiculoUsuarioFragment(
private var userFk = "" private var userFk = ""
private var goBack: Boolean = false private var goBack: Boolean = false
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
companion object { companion object {
fun newInstance(vUserFK: String) = ControlVehiculoUsuarioFragment(vUserFK) fun newInstance(vUserFK: String) = ControlVehiculoUsuarioFragment(vUserFK)
@ -26,7 +27,7 @@ class ControlVehiculoUsuarioFragment(
override fun init() { override fun init() {
binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclecontroluser) binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclecontroluser)
customDialog = CustomDialog(requireContext()) // customDialog = CustomDialog(requireContext())
goBack = false goBack = false
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
setEvents() setEvents()
@ -86,10 +87,11 @@ class ControlVehiculoUsuarioFragment(
responsemachine.observe(viewLifecycleOwner, Observer { responsemachine.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
if (it.isError) { if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage) ma.messageWithSound(it.errorMessage,true,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} else { } else {
//sergio: se modifica el response = null. En casi todas las llamadas se utilizaba para ver si había error. //sergio: se modifica el response = null. En casi todas las llamadas se utilizaba para ver si había error.
// Ahora ya no. // Ahora ya no.

View File

@ -24,6 +24,7 @@ class DayOfSaleFragment(
) : BaseFragment<FragmentItemdayofsaleCardBinding, DayOfSaleViewModel>(DayOfSaleViewModel::class) { ) : BaseFragment<FragmentItemdayofsaleCardBinding, DayOfSaleViewModel>(DayOfSaleViewModel::class) {
private lateinit var customDialogList: CustomDialogList private lateinit var customDialogList: CustomDialogList
private lateinit var customDialog: CustomDialog
private var adapter: DayOfSaleAdapter? = null private var adapter: DayOfSaleAdapter? = null
private var itemScan = "" private var itemScan = ""
@ -31,7 +32,6 @@ class DayOfSaleFragment(
fun newInstance(entryPoint: String) = DayOfSaleFragment(entryPoint) fun newInstance(entryPoint: String) = DayOfSaleFragment(entryPoint)
} }
private lateinit var customDialog: CustomDialog
override fun getLayoutId(): Int = R.layout.fragment_itemdayofsale_card override fun getLayoutId(): Int = R.layout.fragment_itemdayofsale_card
@ -83,7 +83,7 @@ class DayOfSaleFragment(
itemScan = binding.scanInput.text.toString() itemScan = binding.scanInput.text.toString()
} }
binding.scanInput.setText("") binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput) ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false
@ -126,7 +126,7 @@ class DayOfSaleFragment(
}else{ }else{
if (it.list.get(0).isError){ if (it.list.get(0).isError){
(activity as MainActivity).messageWithSound(it.list.get(0).errorMessage,it.list.get(0).isError,isPlayed = false) ma.messageWithSound(it.list.get(0).errorMessage,it.list.get(0).isError,isPlayed = false)
/*customDialog.setTitle("Error") /*customDialog.setTitle("Error")
.setDescription(it.list.get(0).errorMessage) .setDescription(it.list.get(0).errorMessage)
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
@ -141,9 +141,10 @@ class DayOfSaleFragment(
if (it.isError){ if (it.isError){
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ ma.messageWithSound(it.errorMessage,true,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
}else{ }else{
@ -165,7 +166,7 @@ class DayOfSaleFragment(
customDialogList.setTitle("Escanea el parking") customDialogList.setTitle("Escanea el parking")
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
customDialogList.dismiss() customDialogList.dismiss()
@ -173,7 +174,7 @@ class DayOfSaleFragment(
customDialogList.getEditText().requestFocus() customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ -> customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
@ -181,7 +182,7 @@ class DayOfSaleFragment(
parking(customDialogList.getValue()) parking(customDialogList.getValue())
} }
customDialogList.setValue("") customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false

View File

@ -26,7 +26,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private var listInvetory:ArrayList<ItemFaltasVO> = ArrayList() private var listInvetory:ArrayList<ItemFaltasVO> = ArrayList()
private var listInvetoryAux:ArrayList<ItemFaltasVO> = ArrayList() private var listInvetoryAux:ArrayList<ItemFaltasVO> = 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 reload = false
private var hideLoad = true private var hideLoad = true
@ -50,12 +50,12 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
override fun init() { override fun init() {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
(activity as MainActivity).hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.faultsReview) binding.mainToolbar.toolbarTitle.text = getString(R.string.faultsReview)
setToolBar() setToolBar()
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext()) // customDialog = CustomDialog(requireContext())
setEvents() setEvents()
if (reload){ if (reload){
reload = false reload = false
@ -154,7 +154,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
} }
customDialogInput.setValue("") customDialogInput.setValue("")
customDialogInput.dismiss() customDialogInput.dismiss()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false
@ -176,7 +176,7 @@ class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(Falt
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
if (it.isError){ if (it.isError){
(activity as MainActivity).messageWithSound(it.errorMessage,it.isError,false) ma.messageWithSound(it.errorMessage,it.isError,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ /* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss() customDialog.dismiss()
}.show()*/ }.show()*/

View File

@ -32,8 +32,8 @@ class HistoricoArticuloFragment(
HistoricoArticuloViewModel::class HistoricoArticuloViewModel::class
) { ) {
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
private var listHistoric: ArrayList<ItemHistoricoVO> = ArrayList() private var listHistoric: ArrayList<ItemHistoricoVO> = ArrayList()
private var listHistoryAux: ArrayList<ItemHistoricoVO> = ArrayList() private var listHistoryAux: ArrayList<ItemHistoricoVO> = ArrayList()
private var filter: String = "" private var filter: String = ""
@ -46,9 +46,9 @@ class HistoricoArticuloFragment(
override fun init() { override fun init() {
customDialogInput = CustomDialogInput(requireContext()) // customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext()) // customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
filter = "all" filter = "all"
viewModel.itemDiary(getData(USER), getData(PASSWORD), itemFk, getData(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

View File

@ -18,7 +18,7 @@ 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 adapter: ItemShelvingLogAdapter? = null private var adapter: ItemShelvingLogAdapter? = null
private var itemScan = "" private var itemScan = ""
@ -33,7 +33,7 @@ class itemShelvingLogFragment(
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext()) // customDialogList = CustomDialogList(requireContext())
setEvents() setEvents()
setToolBar(getString(R.string.itemShelvingLog)) setToolBar(getString(R.string.itemShelvingLog))
super.init() super.init()
@ -56,7 +56,7 @@ class itemShelvingLogFragment(
itemScan = binding.scanInput.text.toString() itemScan = binding.scanInput.text.toString()
} }
binding.scanInput.setText("") binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput) ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false

View File

@ -18,7 +18,7 @@ class shelvingLogFragment(
) : BaseFragment<FragmentShelvinglogBinding, shelvingLogViewModel>( ) : BaseFragment<FragmentShelvinglogBinding, shelvingLogViewModel>(
shelvingLogViewModel::class) { shelvingLogViewModel::class) {
private lateinit var customDialogList: CustomDialogList // private lateinit var customDialogList: CustomDialogList
private var adapter: ShelvingLogAdapter? = null private var adapter: ShelvingLogAdapter? = null
private var itemScan = "" private var itemScan = ""
@ -33,7 +33,7 @@ class shelvingLogFragment(
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext()) // customDialogList = CustomDialogList(requireContext())
setEvents() setEvents()
setToolBar(getString(R.string.shelvingLog)) setToolBar(getString(R.string.shelvingLog))
super.init() super.init()
@ -57,7 +57,7 @@ class shelvingLogFragment(
itemScan = binding.scanInput.text.toString() itemScan = binding.scanInput.text.toString()
} }
binding.scanInput.setText("") binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput) ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false

View File

@ -12,6 +12,7 @@ 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 timber.log.Timber.d
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
@ -22,9 +23,6 @@ class HistoricoVehiculoFragment (
HistoricoVehiculoViewModel::class) { HistoricoVehiculoViewModel::class) {
private var adapter : HistoricoVehiculoAdapter? = null private var adapter : HistoricoVehiculoAdapter? = null
private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialog: CustomDialog
companion object { companion object {
fun newInstance(entryPoint:String) = HistoricoVehiculoFragment(entryPoint) fun newInstance(entryPoint:String) = HistoricoVehiculoFragment(entryPoint)
@ -36,9 +34,7 @@ class HistoricoVehiculoFragment (
override fun init() override fun init()
{ {
customDialogInput = CustomDialogInput(requireContext()) ma.hideBottomNavigation(View.GONE)
customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE)
viewModel.machineWorker_getHistorical(getData(USER),getData(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)
@ -63,6 +59,10 @@ class HistoricoVehiculoFragment (
binding.historicovehiculoRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) binding.historicovehiculoRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
navigateToToday(it) navigateToToday(it)
if (it.list.isEmpty()){
ma.messageWithSound("Solo puedes visualizar cuando has cogido tu mismo el vehículo a no ser que tengas permisos para ello.",true,true,"Información")
}
} }
}) })
} }

View File

@ -12,7 +12,7 @@ class ImageViewActivity : BaseActivity<ActivityImageviewBinding>(){
override fun init() { override fun init() {
binding.mainToolbar.toolbarTitle.text = (intent.getStringExtra("title")) binding.mainToolbar.toolbarTitle.text = (intent.getStringExtra("title"))
binding.imgView.loadUrl(intent.getStringExtra("url")) binding.imgView.loadUrl(intent.getStringExtra("url")!!)
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
onBackPressed() onBackPressed()

View File

@ -90,7 +90,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
binding.mainToolbar.toolbarTitle.text = getString(R.string.itemShelvingRadar) binding.mainToolbar.toolbarTitle.text = getString(R.string.itemShelvingRadar)
setToolBar() setToolBar()
@ -241,9 +241,10 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
if (it.isError){ if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} }
}) })
} }

View File

@ -6,6 +6,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations 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.domain.GetWokerMistakeUSerCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
@ -13,17 +14,24 @@ import es.verdnatura.presentation.common.Event
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.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.historicovehiculo.model.ItemHistoricoVehiculo
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
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.sacador.model.MistakeTypeListVO
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
import es.verdnatura.presentation.view.feature.workermistake.model.*
import retrofit2.Call import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
import retrofit2.Response import retrofit2.Response
import timber.log.Timber.d
class InventaryViewModel(context: Context) : BaseViewModel() { class InventaryViewModel(context: Context) : BaseViewModel() {
private val getInventaryUserCase: GetInventaryUserCase = GetInventaryUserCase(context) private val getInventaryUserCase: GetInventaryUserCase = GetInventaryUserCase(context)
private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase(context) private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase(context)
private val getWorkerMistakeUserCase:GetWokerMistakeUSerCase= GetWokerMistakeUSerCase(context)
private val _inventaryList by lazy { MutableLiveData<InventaryListVO>() } private val _inventaryList by lazy { MutableLiveData<InventaryListVO>() }
val inventaryList: LiveData<InventaryListVO> val inventaryList: LiveData<InventaryListVO>
@ -38,6 +46,22 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
val buyersList: LiveData<BuyerListVO> val buyersList: LiveData<BuyerListVO>
get() = _buyersList get() = _buyersList
//********************** a borrar, solo para montar fragment ****************/
private val _mistakeDepartmentList by lazy { MutableLiveData<departmentMistakeList>() }
val mistakeDepartmentList: LiveData<departmentMistakeList>
get() = _mistakeDepartmentList
private val _workerFromMistakeList by lazy { MutableLiveData<workerFromMistakeList>() }
val workerFromMistakeList: LiveData<workerFromMistakeList>
get() = _workerFromMistakeList
private val _mistakeWorkerList by lazy { MutableLiveData<workerMistakeTypeList>()}
val mistakeWorkerList: LiveData<workerMistakeTypeList>
get() = _mistakeWorkerList
private val _responseAddMistake by lazy { MutableLiveData<ResponseItemVO>() }
val responseAddMistake: LiveData<ResponseItemVO>
get() = _responseAddMistake
//sergio para obtener comprador //sergio para obtener comprador
fun itemShelvingBuyerGet(user:String,password:String,callFunction:String){ fun itemShelvingBuyerGet(user:String,password:String,callFunction:String){
@ -172,4 +196,136 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
} }
fun department_getHasMistake(usuario: String, password: String)
{
getWorkerMistakeUserCase.department_getHasMistake(usuario, password)
.enqueue(object : Callback<List<DepartmentMistake>>
{
override fun onFailure(call: Call<List<DepartmentMistake>>, t: Throwable)
{
val listError: ArrayList<DepartmentMistake> = ArrayList()
listError.add(DepartmentMistake(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_mistakeDepartmentList.value = departmentMistakeList(listError)
}
override fun onResponse(
call: Call<List<DepartmentMistake>>,
response: Response<List<DepartmentMistake>>
)
{
if (response.body() != null)
{
_mistakeDepartmentList.value = response.body()?.let { departmentMistakeList(it) }
} else
{
val listError: ArrayList<DepartmentMistake> = ArrayList()
listError.add(DepartmentMistake("0", ""))
_mistakeDepartmentList.value = departmentMistakeList(listError)
}
}
})
}
fun worker_getFromHasMistake(usuario:String,password:String,departmentFk:String,callFunction:String){
getWorkerMistakeUserCase.worker_getFromHasMistake(usuario,password,departmentFk).enqueue(object :
Callback<List<WorkerFromMistake>> {
override fun onFailure(call: Call<List<WorkerFromMistake>>, t: Throwable) {
val listError:ArrayList<WorkerFromMistake> = ArrayList()
listError.add(WorkerFromMistake(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_workerFromMistakeList.value = workerFromMistakeList(listError)
}
override fun onResponse(
call: Call<List<WorkerFromMistake>>,
response: Response<List<WorkerFromMistake>>
) {
if (response.body() != null){
_workerFromMistakeList.value = response.body()?.let { workerFromMistakeList(it) }
}else{
val listError:ArrayList<WorkerFromMistake> = ArrayList()
listError.add(WorkerFromMistake(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_workerFromMistakeList.value = workerFromMistakeList(listError)
}
}
})
}
fun workerMistakeType_get(usuario: String, password: String)
{
getWorkerMistakeUserCase.workerMistakeType_get(usuario, password)
.enqueue(object : Callback<List<MistakeWorkerType>>
{
override fun onFailure(call: Call<List<MistakeWorkerType>>, t: Throwable)
{
val listError: ArrayList<MistakeWorkerType> = ArrayList()
listError.add(MistakeWorkerType(isError=true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!),id="0", description = ""))
_mistakeWorkerList.value = workerMistakeTypeList(listError)
}
override fun onResponse(
call: Call<List<MistakeWorkerType>>,
response: Response<List<MistakeWorkerType>>
)
{
if (response.body() != null)
{
_mistakeWorkerList.value = response.body()?.let { workerMistakeTypeList(it) }
} else
{
val listError: ArrayList<MistakeWorkerType> = ArrayList()
listError.add(MistakeWorkerType(isError=true,errorMessage =getMessageFromAllResponse(nameofFunction(this),response.message()),id="0", description = ""))
_mistakeWorkerList.value = workerMistakeTypeList(listError)
}
}
})
}
fun workerMistake_Add(
usuario: String,
password: String,
vUserFk: String,
vTypeFk: String,callFunction:String
)
{
getWorkerMistakeUserCase.workerMistake_Add(usuario, password, vUserFk, vTypeFk)
.enqueue(object :
Callback<Unit>
{
override fun onFailure(call: Call<Unit>, t: Throwable)
{
d("Error message "+t.message)
_responseAddMistake.value = ResponseItemVO(
isError = true,
errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
override fun onResponse(
call: Call<Unit>,
response: Response<Unit>
)
{
if (!response.isSuccessful)
{
d("Error message:"+{response.errorBody()}+"-"+response.message()+"-"+response.raw())
_responseAddMistake.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
// sergio:refactor:solo debería haber un mensaje no un response o errorMessage
_responseAddMistake.value =
ResponseItemVO(isError = false, response ="Causa del error registrada", errorMessage = "Causa del error registrada")
}
}
})
}
} }

View File

@ -20,3 +20,22 @@ class SearchBuyerModel(private var nickname: String?, private var buyerId: Strin
} }
} }
class SearchDepartmentModel(private var name: String?, private var departmentId: String?) : Searchable {
override fun getTitle(): String {
return name!!
}
fun getDepartmentId(): String {
return departmentId!!
}
fun getDepartmentName(): String {
return name!!
}
}

View File

@ -1,8 +1,7 @@
package es.verdnatura.presentation.view.feature.login.fragment package es.verdnatura.presentation.view.feature.login.fragment
import android.app.AlarmManager //import es.verdnatura.presentation.view.feature.login.model.LoginItemVO
import android.app.PendingIntent import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
import android.content.pm.PackageInfo import android.content.pm.PackageInfo
@ -11,16 +10,13 @@ import android.net.Uri
import android.provider.Settings import android.provider.Settings
import android.view.KeyEvent import android.view.KeyEvent
import android.view.View import android.view.View
import androidx.lifecycle.Observer
import androidx.preference.PreferenceManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentLoginBinding import es.verdnatura.databinding.FragmentLoginBinding
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.hideKeyboard import es.verdnatura.presentation.common.hideKeyboard
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
import es.verdnatura.presentation.view.feature.login.model.LoginItemVO
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import timber.log.Timber.d
import java.lang.Boolean.TRUE import java.lang.Boolean.TRUE
import kotlin.system.exitProcess import kotlin.system.exitProcess
@ -39,13 +35,20 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
saveIdentifiers() saveIdentifiers()
checkUser() checkUser()
binding.buttonLogin.setOnClickListener(View.OnClickListener { binding.buttonLogin.setOnClickListener({
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.device_checkLogin( /* viewModel.device_checkLogin(
binding.edittextUsername.text.toString(), binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString(), binding.edittextPassword.text.toString(),
getData(ANDROID_ID), callFunction = "device_checkLogin" getData(ANDROID_ID), callFunction = "device_checkLogin"
) )
*/
viewModel.loginSalix(
user = binding.edittextUsername.text.toString(),
password = binding.edittextPassword.text.toString(),
callFunction = "login de Salix"
)
}) })
@ -58,23 +61,22 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
binding.edittextServer.setText(this.getDefaults("base_url", this.requireContext())) binding.edittextServer.setText(getData("base_url"))
binding.edittextServer.setOnKeyListener(View.OnKeyListener { v, keyCode, event -> binding.edittextServer.setOnKeyListener { _, keyCode, event ->
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) { if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) {
this.setDefaults(
saveData(
"base_url", "base_url",
binding.edittextServer.text.toString(), binding.edittextServer.text.toString()
this.requireContext()
) )
this.hideKeyboard() this.hideKeyboard()
//sergio: deberia lanzar la funcion nueva creada por mi restartapp de BaseFragment. Pero no vuelve a arrancar //sergio: deberia lanzar la funcion nueva creada por mi restartapp de BaseFragment. Pero no vuelve a arrancar
exitProcess(0) exitProcess(0)
restartapp()
return@OnKeyListener false
} }
false false
}) }
binding.textviewWelcome.setOnLongClickListener { binding.textviewWelcome.setOnLongClickListener {
@ -82,24 +84,14 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
true true
} }
//NODEJS TEST
// Log.i("VERDNATURA:","NODEJS in")
// viewModel.nodeJsTest("A0A3B8224DBF","ABC","1")
} }
@SuppressLint("HardwareIds")
private fun saveIdentifiers() { private fun saveIdentifiers() {
val resolver = requireActivity().contentResolver val AndroidId: String = Settings.Secure.getString(requireActivity().contentResolver, Settings.Secure.ANDROID_ID)
saveData(ANDROID_ID,AndroidId)
val AndroidId: String = Settings.Secure.getString(resolver, Settings.Secure.ANDROID_ID)
var deviceName = Settings.Secure.getString(resolver, "bluetooth_name")
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val editor = prefs.edit()
editor.putString(ANDROID_ID, AndroidId)
editor.putString(DEVICENAME, deviceName)
editor.apply()
} }
@ -118,17 +110,17 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
versionappitem.observe(viewLifecycleOwner, Observer { versionappitem.observe(viewLifecycleOwner, {
if (it.isError) { if (it.isError) {
binding.splashProgress.visibility = View.INVISIBLE binding.splashProgress.visibility = View.GONE
customDialog.setTitle("Error").setDescription(it.errorMessage) customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()
} else { } else {
if (it.version.equals(getInfoVersionNameApp())) { if (it.version == getInfoVersionNameApp()) {
goToMain() goToMain()
} else { } else {
@ -159,21 +151,21 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
} }
}) })
logindevice.observe(viewLifecycleOwner, Observer { logindevice.observe(viewLifecycleOwner, {
if (it.isError) { if (it.isError) {
binding.splashProgress.visibility = View.INVISIBLE binding.splashProgress.visibility = View.GONE
customDialog.setTitle("Error").setDescription(it.errorMessage) customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()
} else { } else {
if (it.vIsAuthorized.equals("0")) { if (it.vIsAuthorized == "0") {
customDialog.setTitle("Error").setDescription(it.vMessage!!) customDialog.setTitle("Error").setDescription(it.vMessage!!)
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
customDialog.dismiss() customDialog.dismiss()
binding.splashProgress.visibility = View.INVISIBLE binding.splashProgress.visibility = View.GONE
// goToMain() // goToMain()
}.show() }.show()
@ -184,6 +176,11 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
binding.edittextPassword.text.toString(), binding.edittextPassword.text.toString(),
callFunction = "worker_getId" callFunction = "worker_getId"
) )
viewModel.worker_getSector(
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString())
deviceLog_add( deviceLog_add(
binding.edittextUsername.text.toString(), binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString(), binding.edittextPassword.text.toString(),
@ -192,12 +189,11 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
getData(ANDROID_ID), "deviceLog_add" getData(ANDROID_ID), "deviceLog_add"
) )
//saveUserFkPref(it) if (binding.switchRemember.isChecked) {
if (binding.switchRemember.isChecked) { saveRemember(true)
saveRemember(true) } else {
} else { saveRemember(false)
saveRemember(false) }
}
saveUserAccesPref( saveUserAccesPref(
binding.edittextUsername.text.toString(), binding.edittextUsername.text.toString(),
@ -205,26 +201,23 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
) )
if (it.vIsAuthorized.equals("1") && it.vMessage.isNullOrEmpty()) { if (it.vIsAuthorized == "1" && it.vMessage.isNullOrEmpty()) {
loginSalix( getVersion()
user = binding.edittextUsername.text.toString(),
password = binding.edittextPassword.text.toString(),
callFunction = "login de Salix"
)
} }
if (it.vIsAuthorized.equals("1") && !it.vMessage.isNullOrEmpty()) { if (it.vIsAuthorized == "1" && !it.vMessage.isNullOrEmpty()) {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
customDialog.setTitle("Mensaje").setDescription(it.vMessage) customDialog.setTitle("Mensaje").setDescription(it.vMessage)
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
customDialog.dismiss() customDialog.dismiss()
binding.splashProgress.visibility = View.VISIBLE /* binding.splashProgress.visibility = View.VISIBLE
loginSalix( loginSalix(
user = binding.edittextUsername.text.toString(), user = binding.edittextUsername.text.toString(),
password = binding.edittextPassword.text.toString(), password = binding.edittextPassword.text.toString(),
"login de Salix" "login de Salix"
) )*/
getVersion()
}.show() }.show()
} }
@ -237,7 +230,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
workerId.observe(viewLifecycleOwner, Observer { workerId.observe(viewLifecycleOwner, {
if (!it.isError) { if (!it.isError) {
saveUserFkPref(it.Id.toString()) saveUserFkPref(it.Id.toString())
@ -246,37 +239,8 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
}) })
loginitem.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.INVISIBLE
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else {
binding.splashProgress.visibility = View.VISIBLE
saveUserFkPref(it)
if (binding.switchRemember.isChecked) {
saveRemember(true)
} else {
saveRemember(false)
}
saveUserAccesPref( devicelogresponse.observe(viewLifecycleOwner, {
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString()
)
loginSalix(
user = binding.edittextUsername.text.toString(),
password = binding.edittextPassword.text.toString(),
callFunction = "login de Salix"
)
}
})
devicelogresponse.observe(viewLifecycleOwner, Observer {
if (it.isError) { if (it.isError) {
customDialog.setTitle("Error") customDialog.setTitle("Error")
@ -290,48 +254,46 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
} }
}) })
loginsalixitem.observe(viewLifecycleOwner, Observer { workergetSector.observe(viewLifecycleOwner, {
binding.splashProgress.visibility = View.GONE
if (it.id!=0){
d("El sector guardado es"+it.id)
d("El sector description es"+it.description.toString())
d("El sector warehouse es"+it.warehouseFk.toString())
saveDataInt("sectorFk",it.id)
saveData("sectordescrip",it.description)
it.warehouseFk?.let { it1 -> saveDataInt("warehouseFk", it1) }
}
})
loginsalixitem.observe(viewLifecycleOwner, {
if (it.isError) { if (it.isError) {
binding.splashProgress.visibility = View.GONE
saveTokenPref("") saveTokenPref("")
customDialog.setTitle("Error") customDialog.setTitle("Error")
.setDescription(it.errorMessage + ". Puedes continuar pero algunas funcionalidades no estarán disponibles.") // .setDescription(it.errorMessage + ". Puedes continuar pero algunas funcionalidades no estarán disponibles.")
.setDescription(it.errorMessage)
.setOkButton( .setOkButton(
"Entendido" "Entendido"
) { ) {
customDialog.dismiss() customDialog.dismiss()
getVersion() //getVersion()
//exitProcess(0)
}.show() }.show()
} else { } else {
saveTokenPref(it.token) saveTokenPref(it.token)
getVersion() viewModel.device_checkLogin(
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString(),
getData(ANDROID_ID), callFunction = "device_checkLogin"
)
} }
}) })
/* version.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.INVISIBLE
if (it) {
binding.constrainlayoutLogin.visibility=INVISIBLE
goToMain()
binding.splashProgress.visibility = View.INVISIBLE
} else {
binding.splashProgress.visibility = View.INVISIBLE
customDialog.setTitle(getString(R.string.Actualizar))
.setDescription(getString(R.string.updatemng)).setOkButton(
getString(
R.string.Actualizar
)
) {
val openURL = Intent(Intent.ACTION_VIEW)
openURL.data = Uri.parse("https://app.verdnatura.es/bin/vn-picking.apk")
startActivity(openURL)
}.setKoButton("Cancelar") {
customDialog.dismiss()
goToMain()
}.show()
}
})*/
} }
super.observeViewModel() super.observeViewModel()
} }
@ -349,12 +311,12 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
editor.apply() editor.apply()
} }
private fun saveUserFkPref(loginitem: LoginItemVO) { /* private fun saveUserFkPref(loginitem: LoginItemVO) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
val editor = prefs.edit() val editor = prefs.edit()
editor.putString(USERFK, loginitem.id) editor.putString(USERFK, loginitem.id)
editor.apply() editor.apply()
} }*/
private fun saveUserFkPref(workerId: String) { private fun saveUserFkPref(workerId: String) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
@ -395,31 +357,20 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
} }
fun setDefaults(key: String?, value: String?, context: Context?) { /*fun setDefaults(key: String?, value: String?, context: Context?) {
val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
val editor = preferences.edit() val editor = preferences.edit()
editor.putString(key, value) editor.putString(key, value)
editor.commit() editor.commit()
} }*/
fun getDefaults(key: String?, context: Context?): String? { /* fun getDefaults(key: String?, context: Context?): String? {
val preferences = PreferenceManager.getDefaultSharedPreferences(context) val preferences = PreferenceManager.getDefaultSharedPreferences(context)
return preferences.getString(key, null) return preferences.getString(key, null)
} }*/
// sergio:creada restart en BaseFragment para AjustesFragment... // sergio:creada restart en BaseFragment para AjustesFragment...
fun restartapp() {
val mStartActivity = Intent(context, LoginActivity::class.java)
val mPendingIntentId = 123456
val mPendingIntent = PendingIntent.getActivity(
context,
mPendingIntentId,
mStartActivity,
PendingIntent.FLAG_CANCEL_CURRENT
)
val mgr = requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager
mgr[AlarmManager.RTC, System.currentTimeMillis() + 100] = mPendingIntent
exitProcess(0)
}
} }

View File

@ -9,36 +9,36 @@ import com.google.gson.JsonObject
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import es.verdnatura.domain.GetLoginUserCase import es.verdnatura.domain.GetLoginUserCase
import es.verdnatura.domain.NodeJsService import es.verdnatura.domain.NodeJsService
import es.verdnatura.presentation.base.* import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.login.model.* import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
import es.verdnatura.presentation.view.feature.login.model.LoginDevice
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
import es.verdnatura.presentation.view.feature.login.model.versionApp
import es.verdnatura.presentation.view.feature.login.model.workerId
import es.verdnatura.presentation.view.feature.paletizador.model.itemsExpeditionDynamics import es.verdnatura.presentation.view.feature.paletizador.model.itemsExpeditionDynamics
import retrofit2.Call import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
import retrofit2.Response import retrofit2.Response
import timber.log.Timber
import timber.log.Timber.d
class LoginViewModel(context: Context) : BaseViewModel() class LoginViewModel(context: Context) : BaseViewModel()
{ {
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context) private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
private val _loginitem by lazy { MutableLiveData<LoginItemVO>() }
val loginitem: LiveData<LoginItemVO>
get() = _loginitem
private val _loginsalixitem by lazy { MutableLiveData<LoginSalixVO>() } private val _loginsalixitem by lazy { MutableLiveData<LoginSalixVO>() }
val loginsalixitem: LiveData<LoginSalixVO> val loginsalixitem: LiveData<LoginSalixVO>
get() = _loginsalixitem get() = _loginsalixitem
/* private val _version by lazy { MutableLiveData<Boolean>() }
val version: LiveData<Boolean>
get() = _version*/
private val _devicelogresponse by lazy { MutableLiveData<ResponseItemVO>() } private val _devicelogresponse by lazy { MutableLiveData<ResponseItemVO>() }
val devicelogresponse: LiveData<ResponseItemVO> val devicelogresponse: LiveData<ResponseItemVO>
get() = _devicelogresponse get() = _devicelogresponse
//sergio: nueva version para actualizar
private val _versionappitem by lazy { MutableLiveData<versionApp>() } private val _versionappitem by lazy { MutableLiveData<versionApp>() }
val versionappitem: LiveData<versionApp> val versionappitem: LiveData<versionApp>
get() = _versionappitem get() = _versionappitem
@ -56,55 +56,9 @@ class LoginViewModel(context: Context) : BaseViewModel()
get() = _nodejs get() = _nodejs
//sergio:anterior login private val _workergetSector by lazy { MutableLiveData<SectorItemVO>() }
fun login(user: String, password: String, androiid: String) val workergetSector: LiveData<SectorItemVO>
{ get() = _workergetSector
getLoginUserCase.login(user, password, androiid).enqueue(object : Callback<String>
{
override fun onResponse(call: Call<String>, response: Response<String>)
{
var loginItemVO: LoginItemVO?
if (response.raw().code() == 555)
{
var message = response.raw().message().toString()
if (message.contains("autorizado"))
{
loginItemVO = LoginItemVO(
id = "0",
isError = true,
errorMessage = "Usuario no autorizado para este dispositivo"
)
} else
{
loginItemVO = LoginItemVO(
id = "0",
isError = true,
errorMessage = "Usuario o contraseña incorrectos"
)
}
} else if (!response.body().isNullOrEmpty())
{
loginItemVO = response.body()?.let { LoginItemVO(id = it) }
} else
{
loginItemVO =
LoginItemVO(id = "0", isError = true, errorMessage = "Error desconocido")
}
_loginitem.value = loginItemVO!!
}
override fun onFailure(call: Call<String>, t: Throwable)
{
val loginItemVO: LoginItemVO? =
LoginItemVO(id = "0", isError = true, errorMessage = t.message!!)
_loginitem.value = loginItemVO
}
})
}
fun loginSalix(user: String, password: String,callFunction:String) fun loginSalix(user: String, password: String,callFunction:String)
{ {
@ -113,9 +67,10 @@ class LoginViewModel(context: Context) : BaseViewModel()
override fun onResponse(call: Call<LoginSalixVO>, response: Response<LoginSalixVO>) override fun onResponse(call: Call<LoginSalixVO>, response: Response<LoginSalixVO>)
{ {
var loginSalixVO: LoginSalixVO? val loginSalixVO: LoginSalixVO?
if (response.body() != null) if (response.body() != null)
{ {
loginSalixVO = response.body()?.token?.let { loginSalixVO = response.body()?.token?.let {
LoginSalixVO( LoginSalixVO(
user, user,
@ -127,12 +82,15 @@ class LoginViewModel(context: Context) : BaseViewModel()
} }
} else } else
{ {
loginSalixVO = LoginSalixVO( loginSalixVO = LoginSalixVO(
user, user,
password, password,
isError = true, isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) errorMessage = getMessageFromAllResponse(nameofFunction(this),if (response.message()=="Unauthorized"){"Revisa tu usuario y contraseña. En caso de no poder acceder contacta co Informática"}else{response.message()
) }))
} }
_loginsalixitem.value = loginSalixVO _loginsalixitem.value = loginSalixVO
@ -155,7 +113,6 @@ class LoginViewModel(context: Context) : BaseViewModel()
fun device_checkLogin(user: String, password: String, android_id: String,callFunction:String) fun device_checkLogin(user: String, password: String, android_id: String,callFunction:String)
{ {
//var name=nameofFunction(object{})
getLoginUserCase.device_checkLogin(user, password, android_id) getLoginUserCase.device_checkLogin(user, password, android_id)
.enqueue(object : Callback<LoginDevice> .enqueue(object : Callback<LoginDevice>
@ -163,7 +120,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
override fun onResponse(call: Call<LoginDevice>, response: Response<LoginDevice>) override fun onResponse(call: Call<LoginDevice>, response: Response<LoginDevice>)
{ {
var loginDevice: LoginDevice? val loginDevice: LoginDevice?
if (!response.isSuccessful) if (!response.isSuccessful)
@ -201,6 +158,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
override fun onFailure(call: Call<LoginDevice>, t: Throwable) override fun onFailure(call: Call<LoginDevice>, t: Throwable)
{ {
val loginDevice = val loginDevice =
LoginDevice( LoginDevice(
"", "",
@ -223,7 +181,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
override fun onResponse(call: Call<String>, response: Response<String>) override fun onResponse(call: Call<String>, response: Response<String>)
{ {
var workerId: workerId? val workerId: workerId?
if (response.body() != null) if (response.body() != null)
@ -295,22 +253,6 @@ class LoginViewModel(context: Context) : BaseViewModel()
} }
/*fun checkVersion_old(user:String,password:String,version:String){
getLoginUserCase.checkVersion(user,password,version).enqueue(object : Callback<Boolean>{
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
if (response.body() != null){
_version.value = response.body()
}else{
_version.value = true
}
}
override fun onFailure(call: Call<Boolean>, t: Throwable) {
_version.value = true
}
})
}*/
//sergio:checkVersion new
fun checkVersion(user: String, password: String, nameApp: String,callFunction: String) fun checkVersion(user: String, password: String, nameApp: String,callFunction: String)
{ {
getLoginUserCase.checkVersion(user, password, nameApp) getLoginUserCase.checkVersion(user, password, nameApp)
@ -319,12 +261,12 @@ class LoginViewModel(context: Context) : BaseViewModel()
override fun onResponse(call: Call<versionApp>, response: Response<versionApp>) override fun onResponse(call: Call<versionApp>, response: Response<versionApp>)
{ {
var versionApp: versionApp? //var versionApp: versionApp?
if (response.body() != null) if (response.body() != null)
{ {
versionApp = response.body()?.let { _versionappitem.value = response.body()?.let {
versionApp( versionApp(
it.appname, it.appname,
@ -338,32 +280,33 @@ class LoginViewModel(context: Context) : BaseViewModel()
} else } else
{ {
versionApp = versionApp( _versionappitem.value = versionApp(
user, user,
password, password,
isError = true, isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
) )
} }
_versionappitem.value = versionApp
// _versionappitem.value = versionApp
} }
override fun onFailure(call: Call<versionApp>, t: Throwable) override fun onFailure(call: Call<versionApp>, t: Throwable)
{ {
val versionApp = _versionappitem.value =
versionApp( versionApp(
nameApp, nameApp,
"", "",
isError = true, isError = true,
errorMessage =getMessageFromAllResponse(nameofFunction(this), t.message!!) errorMessage =getMessageFromAllResponse(nameofFunction(this), t.message!!)
) )
_versionappitem.value = versionApp //_versionappitem.value = versionApp
} }
}) })
} }
fun nodeJsTest(smarttag: String, wagon: String, shelving: String) /* fun nodeJsTest(smarttag: String, wagon: String, shelving: String)
{ {
getLoginUserCase.nodeJsTest(smarttag, wagon, shelving) getLoginUserCase.nodeJsTest(smarttag, wagon, shelving)
.enqueue(object : Callback<NodeJsService.SmartTagNode> .enqueue(object : Callback<NodeJsService.SmartTagNode>
@ -374,19 +317,20 @@ class LoginViewModel(context: Context) : BaseViewModel()
) )
{ {
var workerId: NodeJsService.SmartTagNode?
/* if (response.isSuccessful()){ val workerId: NodeJsService.SmartTagNode?
*//* if (response.isSuccessful()){
Log.i("VERDNATURA::","OK") Log.i("VERDNATURA::","OK")
} }
if (!response.errorBody().toString().isEmpty()){ if (!response.errorBody().toString().isEmpty()){
}*/ }*//*
if (response.body() != null) if (response.body() != null)
{ {
Log.i("VERDNATURA::", "el valor nodejs no es nulo ")
workerId = NodeJsService.SmartTagNode( workerId = NodeJsService.SmartTagNode(
response.body().toString(), response.body().toString(),
isError = false, isError = false,
@ -399,7 +343,6 @@ class LoginViewModel(context: Context) : BaseViewModel()
isError = true, isError = true,
errorMessage = "Error al llamar al servicio Node." errorMessage = "Error al llamar al servicio Node."
) )
Log.i("VERDNATURA::", "el valor nodejs es NULL")
} }
_nodejs.value = workerId _nodejs.value = workerId
@ -410,13 +353,13 @@ class LoginViewModel(context: Context) : BaseViewModel()
val workerId = val workerId =
NodeJsService.SmartTagNode(isError = true, errorMessage = t.message!!) NodeJsService.SmartTagNode(isError = true, errorMessage = t.message!!)
// Log.i("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString()) Log.i("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString())
_nodejs.value = workerId _nodejs.value = workerId
} }
}) })
} }*/
fun getListFromJSON(json: JsonObject): MutableList<itemsExpeditionDynamics> fun getListFromJSON(json: JsonObject): MutableList<itemsExpeditionDynamics>
{ {
@ -435,5 +378,36 @@ class LoginViewModel(context: Context) : BaseViewModel()
} }
return list return list
} }
fun worker_getSector(user:String,password:String){
getLoginUserCase.worker_getSector(user,password).enqueue(object : Callback<SectorItemVO>{
override fun onFailure(call: Call<SectorItemVO>, t: Throwable) {
Timber.d("El sector failure " + t.message!!)
_workergetSector.value = SectorItemVO(0,"",0,isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(
call: Call<SectorItemVO>,
response: Response<SectorItemVO>
) {
if (!response.isSuccessful()){
d("El sector is not successfull")
_workergetSector.value= SectorItemVO(0,"",0,
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}else{
d("El sector is successfull")
_workergetSector.value = response.body()?.let { SectorItemVO(it.id,it.description,it.warehouseFk,isError = false) }
}
}
})
}
} }

View File

@ -2,11 +2,11 @@ package es.verdnatura.presentation.view.feature.login.model
class LoginItemVO( /*class LoginItemVO(
val id: String = "", val id: String = "",
var isError: Boolean = false, var isError: Boolean = false,
var errorMessage: String = "" var errorMessage: String = ""
) )*/
class LoginSalixVO( class LoginSalixVO(
val user: String = "", val user: String = "",

View File

@ -13,6 +13,7 @@ import es.verdnatura.BuildConfig
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.ActivityMainBinding import es.verdnatura.databinding.ActivityMainBinding
import es.verdnatura.domain.ConstAndValues.MAINACTIVITY import es.verdnatura.domain.ConstAndValues.MAINACTIVITY
import es.verdnatura.domain.ConstAndValues.PREITEMPICKER
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseActivity import es.verdnatura.presentation.base.BaseActivity
import es.verdnatura.presentation.common.* import es.verdnatura.presentation.common.*
@ -43,22 +44,23 @@ import es.verdnatura.presentation.view.feature.paletizador.fragment.*
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
import es.verdnatura.presentation.view.feature.parking.fragment.ParkingFragment import es.verdnatura.presentation.view.feature.parking.fragment.ParkingFragment
import es.verdnatura.presentation.view.feature.parking.fragment.ParkingSaleFragment
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroFragment import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroFragment
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.precontrol.PreControladorFragment import es.verdnatura.presentation.view.feature.precontrol.PreControladorFragment
import es.verdnatura.presentation.view.feature.showticket.ShowTicketFragment import es.verdnatura.presentation.view.feature.presacador.fragment.EndSacadorFragment
import es.verdnatura.presentation.view.feature.presacador.fragment.InitPreSacadorFragment
import es.verdnatura.presentation.view.feature.presacador.fragment.PreSacadorFragment import es.verdnatura.presentation.view.feature.presacador.fragment.PreSacadorFragment
import es.verdnatura.presentation.view.feature.qr.QrFragment import es.verdnatura.presentation.view.feature.qr.QrFragment
import es.verdnatura.presentation.view.feature.reposicion.fragment.ReposicionFragment import es.verdnatura.presentation.view.feature.reposicion.fragment.ReposicionFragment
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment
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.shelvingparking.fragment.ShelvingParkingFragment import es.verdnatura.presentation.view.feature.shelvingparking.fragment.ShelvingParkingFragment
import es.verdnatura.presentation.view.feature.showticket.ShowTicketFragment
import es.verdnatura.presentation.view.feature.smarttag.register.RegisterSmartTagsFragment import es.verdnatura.presentation.view.feature.smarttag.register.RegisterSmartTagsFragment
import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.AssociateSmartTagsFragment import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.AssociateSmartTagsFragment
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemFragment import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemFragment
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorFragment import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorFragment
import es.verdnatura.presentation.view.feature.workermistake.adapter.WorkermistakeFragment
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -91,7 +93,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
if (haveSector()) addFragment( if (haveSector() && havePrinter()) addFragment(
PasilleroFragment.newInstance("Verdnatura"), PasilleroFragment.newInstance("Verdnatura"),
R.id.main_frame_layout, R.id.main_frame_layout,
PasilleroFragment.TAG, PasilleroFragment.TAG,
@ -116,18 +118,18 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
private fun navigationDrawer(){ private fun navigationDrawer(){
val drawerLayout = binding.drawerLayout /* val drawerLayout = binding.drawerLayout
drawerLayout.open() drawerLayout.open()
/* val toggle = ActionBarDrawerToggle( val toggle = ActionBarDrawerToggle(
this, this,
drawerLayout, drawerLayout,
toolbar, toolbar,
"abierto", "abierto",
"cerrado" "cerrado"
) )
drawerLayout.addDrawerListener(toggle) drawerLayout.addDrawerListener(toggle)
toggle.syncState()*/ toggle.syncState()*/
} }
/* private fun navigateToFragment(){ /* private fun navigateToFragment(){
@ -142,6 +144,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
val sectorFk = prefs.getInt("sectorFk", -1) val sectorFk = prefs.getInt("sectorFk", -1)
return sectorFk != -1 return sectorFk != -1
}
private fun havePrinter(): Boolean {
val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0)
val printerFk = prefs.getInt("printerFk", -1)
return printerFk != -1
} }
@ -318,7 +325,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
true true
} }
bottomMenu!!.setOnNavigationItemReselectedListener { bottomMenu.setOnNavigationItemReselectedListener {
} }
} }
@ -343,16 +350,16 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
} }
"Registrar SmartTags" -> { "Registrar SmartTags" -> {
addFragmentOnTop(RegisterSmartTagsFragment.newInstance(entryPoint)) addFragmentOnTop(RegisterSmartTagsFragment.newInstance(item.title))
} }
//BUFFERS //BUFFERS
"Paletizar" -> { "Paletizar" -> {
addFragmentOnTop(ExpeditionTruckListFragment.newInstance()) addFragmentOnTop(ExpeditionTruckListFragment.newInstance())
} }
"Consultar expedición" -> { getString(R.string.ExpeditionState) -> {
// addFragment(ExpeditionStateFragment.newInstance(entryPoint),R.id.main_frame_layout, ExpeditionTruckListFragment.TAG,false) // addFragment(ExpeditionStateFragment.newInstance(entryPoint),R.id.main_frame_layout, ExpeditionTruckListFragment.TAG,false)
addFragmentOnTop(ExpeditionStateFragment.newInstance(entryPoint)) addFragmentOnTop(ExpeditionStateFragment.newInstance(item.title))
} }
"Escanear expedición" -> { "Escanear expedición" -> {
addFragmentOnTop(ExpeditionScanSorterFragment.newInstance(item.title)) addFragmentOnTop(ExpeditionScanSorterFragment.newInstance(item.title))
@ -470,8 +477,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
"Log Shelving" -> { "Log Shelving" -> {
addFragmentOnTop(shelvingLogFragment.newInstance("Log Shelving")) addFragmentOnTop(shelvingLogFragment.newInstance("Log Shelving"))
} }
"Fallo del trabajador" -> {
addFragmentOnTop(WorkermistakeFragment.newInstance(item.title))
}
// sergio: previa nuevo
"Obtener colección previa"->{
addFragmentOnTop(InitPreSacadorFragment.newInstance(item.title))
}
} }
} }
@ -529,45 +541,73 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
} }
fun onParkingSaleSelected(sales: SaleVO) { /* fun onParkingSaleSelected(sales: SaleVO) {
addFragmentOnTop(ParkingSaleFragment.newInstance(SaleVO = sales)) addFragmentOnTop(ParkingSaleFragment.newInstance(SaleVO = sales))
} }*/
override fun onCollectionSelected(collection: CollectionVO, type: String) { override fun onCollectionSelected(collection: CollectionVO, type: String) {
// fm.popBackStack() // fm.popBackStack()
when (type){
PREITEMPICKER->{
// d("VERDNATURA::"," entrando en preitempicker")
// d("VERDNATURA::"," entrando en preitempicker, la colecc es "+collection.collectionFk)
addFragmentOnTop(EndSacadorFragment.newInstance(collection,type))
}
"SHOWTICKET"->{
addFragmentOnTop(CollectionShowTicketFragment.newInstance(collection, type))
}
else->{
addFragmentOnTop(CollectionFragment.newInstance(collection, type))
}
}
/*if (type.equals(PREITEMPICKER)){
d("VERDNATURA::"," entrando en preitempicker")
addFragmentOnTop(PreSacadorFragment.newInstance(collection,type))
}
if (type.equals("SHOWTICKET")) { if (type.equals("SHOWTICKET")) {
addFragmentOnTop(CollectionShowTicketFragment.newInstance(collection, type)) addFragmentOnTop(CollectionShowTicketFragment.newInstance(collection, type))
} else { } else {
addFragmentOnTop(CollectionFragment.newInstance(collection, type)) addFragmentOnTop(CollectionFragment.newInstance(collection, type))
} }*/
} }
override fun onBuyerSelected(userFk: String) { override fun onBuyerSelected(userFk: String) {
addFragmentOnTop(QaualityFragment.newInstance(userFk)) addFragmentOnTop(QaualityFragment.newInstance(userFk))
} }
//sergio:se llama al pulsar sobre el coche IN desde Sacador
fun onVehicleSelected(tag: String) { fun onVehicleSelected(tag: String) {
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
// se pone a true en la pila para que cuando se vuelva atrás permanezca ya que se borran todos los fragmentos desde otras opciones
addFragment( addFragment(
ControlVehiculoFragment.newInstance(tag), ControlVehiculoFragment.newInstance(tag),
R.id.main_frame_layout, R.id.main_frame_layout,
ControlVehiculoFragment.TAG, ControlVehiculoFragment.TAG,
false true
) )
//sergio: de esta manera la llamada del fragment no se vuelve a repetir. //sergio: de esta manera la llamada del fragment no se vuelve a repetir.
// addFragmentOnTop(ControlVehiculoFragment.newInstance(tag)) // addFragmentOnTop(ControlVehiculoFragment.newInstance(tag))
} }
fun openFragmentPickers() { fun openFragmentPickers(delete:Boolean) {
//delete_Fragments() //delete_Fragments()
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
if (delete){delete_Fragments()}
addFragment( addFragment(
SacadorFragment.newInstance(), SacadorFragment.newInstance(),
R.id.main_frame_layout, R.id.main_frame_layout,
SacadorFragment.TAG, SacadorFragment.TAG,
false false
) )
//addFragmentOnTop(SacadorFragment.newInstance()) //addFragmentOnTop(SacadorFragment.newInstance())
@ -578,7 +618,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
// fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE) // fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
// addFragment(ExpeditionStateFragment.newInstance("main"),R.id.main_frame_layout, ExpeditionStateFragment.TAG,false) // addFragment(ExpeditionStateFragment.newInstance("main"),R.id.main_frame_layout, ExpeditionStateFragment.TAG,false)
addFragmentOnTop(ExpeditionStateFragment.newInstance("main")) addFragmentOnTop(ExpeditionStateFragment.newInstance("Consultar estado expedición"))
} }
@ -586,19 +626,24 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
binding.mainBottomNavigation.visibility = visible binding.mainBottomNavigation.visibility = visible
} }
fun messageWithSound(message: String, isError: Boolean,isPlayed:Boolean?) { fun messageWithSound(message: String, isError: Boolean,isPlayed:Boolean?,titleWithError:String="Error",isToasted:Boolean?=false) {
if (!isError) { if (!isError) {
mpok?.start()
if (isPlayed == true)(mpok?.start())
message.toast(this, Toast.LENGTH_SHORT) message.toast(this, Toast.LENGTH_SHORT)
} else { } else {
if (isPlayed == true)( mperror?.start()) if (isPlayed == true)( mperror?.start())
customDialog.setTitle("Error").setDescription(message) if (isToasted==true){
.setOkButton("Aceptar") { message.toast(this, Toast.LENGTH_SHORT)
customDialog.dismiss() }else{
}.show() customDialog.setTitle(titleWithError).setDescription(message)
.setOkButton("Aceptar") {
customDialog.dismiss()
}.show()
}
} }

View File

@ -5,19 +5,15 @@ import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemExpeditionstateRowBinding import es.verdnatura.databinding.ItemExpeditionstateRowBinding
import es.verdnatura.presentation.common.OnItemExpeditionStateRowClickListener
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionStateRow import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionStateRow
class ExpeditionStateAdapter ( class ExpeditionStateAdapter (
private val items: List<ItemExpeditionStateRow>, private val items: List<ItemExpeditionStateRow>,
private val OnItemExpeditionStateRowClickListener: OnItemExpeditionStateRowClickListener
): RecyclerView.Adapter<ExpeditionStateAdapter.ItemHolder> () { ): RecyclerView.Adapter<ExpeditionStateAdapter.ItemHolder> () {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
return ItemHolder( return ItemHolder(
//ItemCardRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
ItemExpeditionstateRowBinding.inflate(LayoutInflater.from(parent.context),parent,false) ItemExpeditionstateRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
) )
} }
@ -26,34 +22,20 @@ class ExpeditionStateAdapter (
override fun onBindViewHolder(holder: ItemHolder, position: Int) { override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position]) holder.bind(items[position])
if (items[position].isEditable){ /* if (items[position].isEditable){
holder.binding.root.setOnClickListener { holder.binding.root.setOnClickListener {
OnItemExpeditionStateRowClickListener.OnItemExpeditionStateRowClickListener(items[position]) // OnItemExpeditionStateRowClickListener.OnItemExpeditionStateRowClickListener(items[position])
} }
} }*/
} }
class ItemHolder( class ItemHolder(
val binding: ItemExpeditionstateRowBinding val binding: ItemExpeditionstateRowBinding
) : RecyclerView.ViewHolder(binding.root){ ) : RecyclerView.ViewHolder(binding.root){
private val res = binding.root.context.resources
fun bind(item: ItemExpeditionStateRow) { fun bind(item: ItemExpeditionStateRow) {
binding.apply { binding.apply {
if (item.barcodes.isNotEmpty()){
item.value = ""
item.barcodes.forEach {
item.value = item.value + it.code + "\n"
}
}
this.item = item this.item = item
/* if (item.isEditable){
itemImage.visibility = View.VISIBLE
itemRowLayout.setBackgroundColor(res.getColor(R.color.verdnatura_black_5))
}else{
itemImage.visibility = View.INVISIBLE
itemRowLayout.setBackgroundColor(res.getColor(R.color.verdnatura_black_9))
}*/
} }
} }

View File

@ -32,7 +32,7 @@ class ExpeditionPalletDetailFragment(
ExpeditionPalletDetailViewModel::class) { ExpeditionPalletDetailViewModel::class) {
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
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
@ -52,11 +52,11 @@ class ExpeditionPalletDetailFragment(
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext()) //customDialogList = CustomDialogList(requireContext())
binding.expeditionPalletDetailPallet.text = "Pallet "+itemPallet!!.Pallet binding.expeditionPalletDetailPallet.text = "Pallet "+itemPallet!!.Pallet
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
//requireActivity().main_bottom_navigation.visibility = View.GONE //requireActivity().main_bottom_navigation.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino
setToolBar() setToolBar()
@ -105,7 +105,7 @@ class ExpeditionPalletDetailFragment(
}else if(item == iconPrint){ }else if(item == iconPrint){
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
(getString(R.string.Imprimiendo)+" por " +getData(SECTORDESCRIP)).toast(requireContext()) (getString(R.string.Imprimiendo)+" por " +getData(PRINTERNAME)).toast(requireContext())
viewModel.expeditionPalletPrintSet(getData(USER), viewModel.expeditionPalletPrintSet(getData(USER),
getData(PASSWORD),itemPallet!!.Pallet,getData(SECTORFK),"expeditionPallet_PrintSet") getData(PASSWORD),itemPallet!!.Pallet,getData(SECTORFK),"expeditionPallet_PrintSet")
@ -131,9 +131,10 @@ class ExpeditionPalletDetailFragment(
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
if (it.isError){ if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
}else{ }else{
requireActivity().onBackPressed() requireActivity().onBackPressed()
} }

View File

@ -73,7 +73,7 @@ class ExpeditionPalletFragment(
customDialogList = CustomDialogList(requireContext()) customDialogList = CustomDialogList(requireContext())
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
//requireActivity().main_bottom_navigation.visibility = View.GONE //requireActivity().main_bottom_navigation.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino
setToolBar() setToolBar()
setEvents() setEvents()
@ -130,18 +130,20 @@ class ExpeditionPalletFragment(
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
if (it.isError){ if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} }
}) })
responseCheckexpeditionScanPut.observe(viewLifecycleOwner, Observer { responseCheckexpeditionScanPut.observe(viewLifecycleOwner, Observer {
if (it.isError){ if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
}else{ }else{
if (it.response=="0") { if (it.response=="0") {
@ -190,7 +192,7 @@ class ExpeditionPalletFragment(
} }
customDialogList.setTitle("Expedition ("+binding.mainToolbar.toolbarTitle.text+")").setOkButton("Comprobar"){ customDialogList.setTitle("Expedition ("+binding.mainToolbar.toolbarTitle.text+")").setOkButton("Comprobar"){
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
if (listExpeditions.size > 0){ if (listExpeditions.size > 0){
@ -206,7 +208,7 @@ class ExpeditionPalletFragment(
}.setKoButton("Cerrar"){ }.setKoButton("Cerrar"){
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionPallet_List(getData(USER), viewModel.expeditionPallet_List(getData(USER),
getData(PASSWORD),itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List") getData(PASSWORD),itemExpeditionTruckVO!!.truckFk,"expeditionPallet_List")
@ -215,7 +217,7 @@ class ExpeditionPalletFragment(
}.setValue("").show() }.setValue("").show()
customDialogList.getEditText().requestFocus() customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
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) {
@ -241,7 +243,7 @@ class ExpeditionPalletFragment(
expeditionAdapter!!.notifyDataSetChanged() expeditionAdapter!!.notifyDataSetChanged()
} }
customDialogList.setValue("") customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false

View File

@ -37,11 +37,11 @@ class ExpeditionScanFragment (
private var onComprobarPalletViewClickListener: OnComprobarPalletViewClickListener? = null private var onComprobarPalletViewClickListener: OnComprobarPalletViewClickListener? = null
private lateinit var customDialogList: CustomDialogList private lateinit var customDialogList: CustomDialogList
private lateinit var customDialogTwoButtons: CustomDialogTwoButtons private lateinit var customDialogTwoButtons: CustomDialogTwoButtons
private var listExpeditions:ArrayList<BarcodeVO> = ArrayList() private var listExpeditions:ArrayList<BarcodeVO> = ArrayList()
private var expeditionAdapter : BarcodeAdapter? = null private var expeditionAdapter : BarcodeAdapter? = null
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
var mperror: MediaPlayer? = null var mperror: MediaPlayer? = null
var mpok: MediaPlayer? = null
companion object { companion object {
fun newInstance(item: ItemExpeditionTruckVO,itemPalletVO: ItemPalletVO) = fun newInstance(item: ItemExpeditionTruckVO,itemPalletVO: ItemPalletVO) =
@ -68,8 +68,7 @@ class ExpeditionScanFragment (
customDialogTwoButtons = CustomDialogTwoButtons(requireContext()) customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
binding.expeditionScanDetailPallet.text = "Pallet "+itemPalletVO!!.Pallet binding.expeditionScanDetailPallet.text = "Pallet "+itemPalletVO!!.Pallet
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
//requireActivity().main_bottom_navigation.visibility = View.GONE ma.hideBottomNavigation(View.GONE)
(activity as MainActivity).hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino binding.mainToolbar.toolbarTitle.text = getCURDATE(itemExpeditionTruckVO!!.ETD) + " " + itemExpeditionTruckVO!!.Destino
setToolBar() setToolBar()
@ -99,7 +98,6 @@ class ExpeditionScanFragment (
viewModel.expeditionScanList(getData(USER), viewModel.expeditionScanList(getData(USER),
getData(PASSWORD),itemPalletVO!!.Pallet) getData(PASSWORD),itemPalletVO!!.Pallet)
}else if(item == iconPlus){ }else if(item == iconPlus){
//Log.i("VERDNATURA:","ENTRAMOS A SCAN ADD")
expeditionScanAdd () expeditionScanAdd ()
} }
@ -128,41 +126,29 @@ class ExpeditionScanFragment (
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
if (it.isError){ if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ ma.messageWithSound(it.errorMessage,true,false)
customDialog.dismiss()
}.show()
} }
}) })
responseCheckexpeditionScanPut.observe(viewLifecycleOwner, Observer { responseCheckexpeditionScanPut.observe(viewLifecycleOwner, Observer {
if (it.isError){ if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ ma.messageWithSound(it.errorMessage,true,false)
customDialog.dismiss()
}.show()
}else{ }else{
////Log.i("VERDNATURA:"," Resultado llamada es ${it.response.toString()}")
if (it.response=="0") {
//"Rutas iguales ${it.response}".toast(requireActivity())
////Log.i("VERDNATURA:","Rutas iguales")
}
if (it.response=="1"){ if (it.response=="1"){
mperror?.start() mperror?.start()
// "Resultado llamada $it.response".toast(requireActivity())
// customDialog.setTitle("Rutas distintas").setDescription(it.response).setOkButton("Cerrar"){
// customDialog.dismiss()
// }.show()
}} }}
}) })
responseDeleteScan.observe(viewLifecycleOwner, Observer { responseDeleteScan.observe(viewLifecycleOwner, Observer {
if (it.isError){ if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ ma.messageWithSound(it.errorMessage,true,false)
customDialog.dismiss()
}.show()
}else{ }else{
viewModel.expeditionScanList(getData(USER), viewModel.expeditionScanList(getData(USER),
getData(PASSWORD),itemPalletVO!!.Pallet) getData(PASSWORD),itemPalletVO!!.Pallet)
@ -200,28 +186,23 @@ class ExpeditionScanFragment (
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.expeditionScanAdd(usuario = getData(USER), viewModel.expeditionScanAdd(usuario = getData(USER),
getData(PASSWORD),vPalletFk = itemPalletVO!!.Pallet,vTruckFk = itemExpeditionTruckVO!!.truckFk) getData(PASSWORD),vPalletFk = itemPalletVO!!.Pallet,vTruckFk = itemExpeditionTruckVO!!.truckFk)
//Log.i("VERDNATURA:","entramos a escanear ticket del pallet")
} }
private fun showScanExpeditions(it: ItemScanList){ private fun showScanExpeditions(it: ItemScanList){
//sergio para smarttags:
// Log.i("VERDNATURA:","muestra expediciones y a escanear")
listExpeditions = ArrayList() listExpeditions = ArrayList()
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
it.list.forEach { it.list.forEach {
if(it.expeditionFk != "0") if(it.expeditionFk != "0")
listExpeditions.add(BarcodeVO(code = it.expeditionFk)) listExpeditions.add(BarcodeVO(code = it.expeditionFk))
} }
//sergio:Comprueba si el numero es mayor>0
customDialogList.setTitle("Pallet"+itemPalletVO!!.Pallet+" ("+binding.mainToolbar.toolbarTitle.text+")").setOkButton("Comprobar"){ customDialogList.setTitle("Pallet"+itemPalletVO!!.Pallet+" ("+binding.mainToolbar.toolbarTitle.text+")").setOkButton("Comprobar"){
//Log.i("VERDNATURA:","Añadida etiqueta")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
ma.hideKeyboard(customDialogList.getEditText())
if (listExpeditions.size > 0){ if (listExpeditions.size > 0){
////Log.i("VERDNATURA:","boton comprobar . si las expediciones >0 muetra DetailFragment")
onComprobarPalletViewClickListener!!.onComprobarPalletViewClickListener(itemExpeditionTruckVO!!, onComprobarPalletViewClickListener!!.onComprobarPalletViewClickListener(itemExpeditionTruckVO!!,
ItemPalletVO(Pallet = it.list.get(0).palletFk) ItemPalletVO(Pallet = it.list.get(0).palletFk)
) )
@ -235,24 +216,18 @@ class ExpeditionScanFragment (
}.setKoButton("Cerrar"){ }.setKoButton("Cerrar"){
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
listExpeditions = ArrayList() listExpeditions = ArrayList()
customDialogList.dismiss() customDialogList.dismiss()
}.setValue("").show() }.setValue("").show()
customDialogList.getEditText().requestFocus() customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
//sergio: seguimos escaneando id=0 -> sin especificar id=5->next
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
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 (!customDialogList.getValue().isNullOrEmpty()) { if (!customDialogList.getValue().isNullOrEmpty()) {
////Log.i("VERDNATURA:", "scan put pallet ${it.list.get(0).palletFk}");
////Log.i("VERDNATURA:", "scan put list ${customDialogList.getValue()}");
listExpeditions.add(BarcodeVO(code = customDialogList.getValue())) listExpeditions.add(BarcodeVO(code = customDialogList.getValue()))
viewModel.expeditionScanPut( viewModel.expeditionScanPut(
getData(USER), getData(USER),
@ -260,22 +235,15 @@ class ExpeditionScanFragment (
it.list.get(0).palletFk, it.list.get(0).palletFk,
customDialogList.getValue() customDialogList.getValue()
) )
////Log.i("VERDNATURA:", "scan put pallet ${it.list.get(0).palletFk}");
////Log.i("VERDNATURA:", "scan put list ${customDialogList.getValue()}");
// ////Log.i("VERDNATURA:","misma ruta ?")
//sergio:comprueba si es de la misma ruta. Check_route_expedition.
checkRouteExpeditionScanPut(getData(USER), checkRouteExpeditionScanPut(getData(USER),
getData(PASSWORD),it.list.get(0).palletFk,customDialogList.getValue()) 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 list ${customDialogList.getValue()}");
expeditionAdapter!!.notifyDataSetChanged() expeditionAdapter!!.notifyDataSetChanged()
} }
customDialogList.setValue("") customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false

View File

@ -1,60 +1,35 @@
package es.verdnatura.presentation.view.feature.paletizador.fragment package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.SharedPreferences
import android.os.Bundle
import android.view.View
import android.view.View.* import android.view.View.*
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
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.FragmentExpeditionscanSorterBinding import es.verdnatura.databinding.FragmentExpeditionscanSorterBinding
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.CustomDialogList import es.verdnatura.presentation.view.component.CustomDialogList
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.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.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.**/
class ExpeditionScanSorterFragment( class ExpeditionScanSorterFragment(
var entryPoint: String = "" var title: String = ""
) : BaseFragment<FragmentExpeditionscanSorterBinding, ExpeditionScanSorterViewModel>( ) : BaseFragment<FragmentExpeditionscanSorterBinding, ExpeditionScanSorterViewModel>(
ExpeditionScanSorterViewModel::class ExpeditionScanSorterViewModel::class
) { ) {
private var user = ""
private var password = ""
private var goBack: Boolean = false
override fun getLayoutId(): Int = R.layout.fragment_expeditionscan_sorter override fun getLayoutId(): Int = R.layout.fragment_expeditionscan_sorter
private lateinit var customDialog: CustomDialog
private lateinit var customDialogList: CustomDialogList private lateinit var customDialogList: CustomDialogList
private var listExpeditionScan: ArrayList<SmartTag> = ArrayList() private var listExpeditionScan: ArrayList<GeneralItem> = ArrayList()
private var expeditionScanAdapter: SmartTagAdapter? = null private var expeditionScanAdapter: GeneralAdapter? = null
private var itemScaned: String = "" private var itemScaned: String = ""
companion object { companion object {
fun newInstance(entryPoint: String) = ExpeditionScanSorterFragment(entryPoint) fun newInstance(title: String) = ExpeditionScanSorterFragment(title)
} }
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext()) customDialogList = CustomDialogList(requireContext())
ma.hideBottomNavigation(GONE)
goBack = false
//requireActivity().main_bottom_navigation.visibility = GONE
(activity as MainActivity).hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
setEvents() setEvents()
@ -63,64 +38,46 @@ class ExpeditionScanSorterFragment(
super.init() super.init()
} }
override fun onPause() {
goBack = true
super.onPause()
}
private fun setToolBar() { private fun setToolBar() {
binding.mainToolbar.toolbarTitle.text = title
binding.mainToolbar.toolbarTitle.text = entryPoint
} }
private fun expeditionscan(ExpeditionScan: String) { private fun expeditionscan(ExpeditionScan: String) {
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
viewModel.expedition_scan(user, password, ExpeditionScan,"expedition_scan") viewModel.expedition_scan(getData(USER),getData(PASSWORD), ExpeditionScan,"expedition_scan")
itemScaned = ExpeditionScan itemScaned = ExpeditionScan
} }
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = getData(USER)
password = getData(PASSWORD)
super.onCreate(savedInstanceState)
}
private fun setEvents() { private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed() requireActivity().onBackPressed()
} }
} }
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
responsescan.observe(viewLifecycleOwner, Observer { responsescan.observe(viewLifecycleOwner, {
if (it.isError) { if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage) ma.messageWithSound(it.errorMessage,true,false)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else { } else {
listExpeditionScan.add(SmartTag(itemScaned, itemScaned)) listExpeditionScan.add(GeneralItem(itemScaned, itemScaned))
customDialogList.setDescription("Total:" + listExpeditionScan.size) customDialogList.setDescription("Total:" + listExpeditionScan.size)
expeditionScanAdapter!!.notifyItemInserted(listExpeditionScan.size-1) expeditionScanAdapter!!.notifyItemInserted(listExpeditionScan.size-1)
customDialogList.setValue("") customDialogList.setValue("")
ma.messageWithSound("Añadida",false,true)
} }
binding.splashProgress.visibility = GONE
}) })
} }
@ -132,23 +89,16 @@ class ExpeditionScanSorterFragment(
customDialogList.setTitle("Escanea expediciones que no han pasado por el Sorter") customDialogList.setTitle("Escanea expediciones que no han pasado por el Sorter")
.setOkButton("Finalizar") { .setOkButton("Finalizar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
/* if (listExpeditionScan.size > 0) {
customDialogList.dismiss()
backButton.performClick()
} else {*/
customDialogList.dismiss() customDialogList.dismiss()
binding.mainToolbar.backButton.performClick() binding.mainToolbar.backButton.performClick()
// }
}.setValue("").show() }.setValue("").show()
customDialogList.getEditText().requestFocus() customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ -> customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
@ -156,17 +106,18 @@ class ExpeditionScanSorterFragment(
expeditionscan(customDialogList.getValue()) expeditionscan(customDialogList.getValue())
} }
customDialogList.setValue("") customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false
} }
expeditionScanAdapter = expeditionScanAdapter =
SmartTagAdapter(listExpeditionScan, object : OnSmartTagRowClickListener { GeneralAdapter(listExpeditionScan, object : OnGeneralItemRowClickListener {
override fun OnSmartTagRowClickListener(item: SmartTag) { override fun OnGeneralItemRowClickListener(item: GeneralItem) {
} }
}, showDelete = false) })
customDialogList.getRecyclerView().adapter = expeditionScanAdapter customDialogList.getRecyclerView().adapter = expeditionScanAdapter
customDialogList.getRecyclerView().layoutManager = customDialogList.getRecyclerView().layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)

View File

@ -1,41 +1,21 @@
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.buyers_fragment.*
import kotlinx.android.synthetic.main.fragment_item_card.*
import kotlinx.android.synthetic.main.fragment_item_card.binding.editItemFk
import kotlinx.android.synthetic.main.fragment_item_card.binding.itemcardImage
import kotlinx.android.synthetic.main.fragment_item_card. binding.itemcardLayout
import kotlinx.android.synthetic.main.fragment_item_card.binding.splashProgress
import kotlinx.android.synthetic.main.fragment_itemexpeditionstate_card.*
import kotlinx.android.synthetic.main.toolbar.**/
import android.content.Intent
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.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.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnItemExpeditionStateRowClickListener
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.imageview.activity.ImageViewActivity
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionStateAdapter import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionStateAdapter
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionStateRow import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionStateRow
import es.verdnatura.presentation.view.feature.paletizador.model.itemExpedetionState import es.verdnatura.presentation.view.feature.paletizador.model.itemExpedetionState
class ExpeditionStateFragment( class ExpeditionStateFragment(
var entryPoint: String = "" var title: String = ""
// ) : BaseFragment<FragmentExpeditionstateBinding, ExpeditionStateViewModel>(ExpeditionStateViewModel::class) {
) : BaseFragment<FragmentItemexpeditionstateCardBinding, ExpeditionStateViewModel>(ExpeditionStateViewModel::class) { ) : BaseFragment<FragmentItemexpeditionstateCardBinding, ExpeditionStateViewModel>(ExpeditionStateViewModel::class) {
private var urlLarge: String = ""
private var titleImage: String = ""
private var user = ""
private var password = ""
private var warehouseFk = ""
private var adapter: ExpeditionStateAdapter? = null private var adapter: ExpeditionStateAdapter? = null
private var listItemsRow: ArrayList<ItemExpeditionStateRow> = ArrayList() private var listItemsRow: ArrayList<ItemExpeditionStateRow> = ArrayList()
private var itemScan = "" private var itemScan = ""
@ -44,16 +24,11 @@ class ExpeditionStateFragment(
fun newInstance(entryPoint: String) = ExpeditionStateFragment(entryPoint) fun newInstance(entryPoint: String) = ExpeditionStateFragment(entryPoint)
} }
private lateinit var customDialog: CustomDialog
override fun getLayoutId(): Int = R.layout.fragment_itemexpeditionstate_card override fun getLayoutId(): Int = R.layout.fragment_itemexpeditionstate_card
override fun init() { override fun init() {
binding.itemcardLayout.visibility = View.GONE
customDialog = CustomDialog(requireContext())
setEvents() setEvents()
setToolBar(getString(R.string.ExpeditionState)) setToolBar(title)
super.init() super.init()
} }
@ -66,12 +41,12 @@ class ExpeditionStateFragment(
binding.editItemFk.requestFocus() binding.editItemFk.requestFocus()
binding.editItemFk.setOnEditorActionListener { v, actionId, event -> binding.editItemFk.setOnEditorActionListener { v, actionId, event ->
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.editItemFk.text.toString().isNullOrEmpty()) { if (binding.editItemFk.text.toString().isNotEmpty()) {
getExpedtionState(binding.editItemFk.text.toString()) getExpedtionState(binding.editItemFk.text.toString())
itemScan = binding.editItemFk.text.toString() itemScan = binding.editItemFk.text.toString()
} }
binding.editItemFk.setText("") binding.editItemFk.setText("")
(activity as MainActivity).hideKeyboard(binding.editItemFk) ma.hideKeyboard(binding.editItemFk)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false
@ -82,58 +57,26 @@ class ExpeditionStateFragment(
requireActivity().onBackPressed() requireActivity().onBackPressed()
} }
binding.itemcardImage.setOnClickListener {
val i: Intent = Intent(activity, ImageViewActivity::class.java)
i.putExtra("url", urlLarge)
i.putExtra("title", titleImage)
startActivity(i)
}
} }
private fun getExpedtionState(expeditionFk: String) { private fun getExpedtionState(expeditionFk: String) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = getData(USER)
password = getData(PASSWORD)
warehouseFk = getData(WAREHOUSEFK)
// 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, getData(USER), getData(PASSWORD),"expedition_getState")
} }
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
// itemcard.observe(viewLifecycleOwner, Observer { itemexpedition.observe(viewLifecycleOwner,{
itemexpedition.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
if (it.isError) { if (it.isError) {
binding.itemcardLayout.visibility = View.GONE binding.itemcardLayout.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = "Estado de la expedición" binding.mainToolbar.toolbarTitle.text = title
customDialog.setTitle("Error") ma.messageWithSound("No se ha podido obtener el estado de la expedición escaneada.",true,false,"Sin resultados")
.setDescription("No se ha podido obtener el estado de la expedición escaneada. ")
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else { } else {
if (it != null) {
binding.itemcardLayout.visibility = View.VISIBLE
setItemExpeditionState(it) setItemExpeditionState(it)
} else {
binding.itemcardLayout.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = "Estado de la expedición"
customDialog.setTitle("Sin resultados")
.setDescription("No hemos podido encontrar el estado de la expedición.")
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
}
} }
}) })
@ -143,25 +86,19 @@ class ExpeditionStateFragment(
private fun setItemExpeditionState(itemInfo: itemExpedetionState) { private fun setItemExpeditionState(itemInfo: itemExpedetionState) {
setToolBar(getString(R.string.expedition) + itemScan) setToolBar(getString(R.string.expedition) + itemScan)
binding.itemcardLayout.visibility = View.VISIBLE
listItemsRow = ArrayList() listItemsRow = ArrayList()
for (i in itemInfo.list) { for (i in itemInfo.list) {
listItemsRow.add( listItemsRow.add(
ItemExpeditionStateRow( ItemExpeditionStateRow(
title = i.key, title = i.key,
value = i.value.replace(".0",""), value = i.value?.replace(".0",""),
isEditable = false isEditable = false
) )
) )
} }
adapter = ExpeditionStateAdapter(listItemsRow)
adapter = ExpeditionStateAdapter(listItemsRow, object :
OnItemExpeditionStateRowClickListener {
override fun OnItemExpeditionStateRowClickListener(item: ItemExpeditionStateRow) {
}
})
binding.itemexpeditionstateRecyclerview.adapter = adapter binding.itemexpeditionstateRecyclerview.adapter = adapter
binding.itemexpeditionstateRecyclerview.layoutManager = binding.itemexpeditionstateRecyclerview.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
@ -172,4 +109,3 @@ class ExpeditionStateFragment(
} }

View File

@ -157,7 +157,7 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel() {
gson.fromJson(json, object : TypeToken<Map<String, Any>>() {}.type) gson.fromJson(json, object : TypeToken<Map<String, Any>>() {}.type)
expeditionState.forEach { expeditionState.forEach {
list.add(itemsExpeditionDynamics(key=it.key,value=it.value.toString())) list.add(itemsExpeditionDynamics(key=it.key,it.value?.toString()))
} }
return list return list

View File

@ -76,7 +76,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
addTruck() addTruck()
} }
if (item == iconState){ if (item == iconState){
(activity as MainActivity).openFragmentExpeditionState() ma.openFragmentExpeditionState()
} }
} }
}) })
@ -112,14 +112,14 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
private fun addTruck(){ private fun addTruck(){
customDialogHor.setTitle("Nuevo Camión").setOkButton("Guardar"){ customDialogHor.setTitle("Nuevo Camión").setOkButton("Guardar"){
(activity as MainActivity).hideKeyboard(customDialogHor.getDestinoEditText()) ma.hideKeyboard(customDialogHor.getDestinoEditText())
if (!customDialogHor.getDestinoValue().isNullOrEmpty() && !customDialogHor.getHoraValue().isNullOrEmpty()){ if (!customDialogHor.getDestinoValue().isNullOrEmpty() && !customDialogHor.getHoraValue().isNullOrEmpty()){
viewModel.expeditionTruckAdd(getData(USER), viewModel.expeditionTruckAdd(getData(USER),
getData(PASSWORD),customDialogHor.getHoraValue(),customDialogHor.getDestinoValue(),"expeditionTruck_Add") getData(PASSWORD),customDialogHor.getHoraValue(),customDialogHor.getDestinoValue(),"expeditionTruck_Add")
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
customDialogHor.dismiss() customDialogHor.dismiss()
} }
(activity as MainActivity).hideKeyboard(customDialogHor.getDestinoEditText()) ma.hideKeyboard(customDialogHor.getDestinoEditText())
customDialogHor.dismiss() customDialogHor.dismiss()
}.setKoButton("Cancelar"){ }.setKoButton("Cancelar"){
customDialogHor.dismiss() customDialogHor.dismiss()
@ -137,7 +137,7 @@ class ExpeditionTruckListFragment : BaseFragment<FragmentExpeditionTruckListBin
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
(activity as MainActivity).hideKeyboard(customDialogHor.getDestinoEditText()) ma.hideKeyboard(customDialogHor.getDestinoEditText())
false false
} }
} }

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.paletizador.model package es.verdnatura.presentation.view.feature.paletizador.model
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
class ItemExpeditionTruckVO ( class ItemExpeditionTruckVO (
var truckFk:String = "", var truckFk:String = "",
@ -17,19 +16,6 @@ class ItemExpeditionTruckList(
) )
class itemExpedetionState( class itemExpedetionState(
/* var ticket: String = "",
var cliente : String = "",
var ciudad : String = "",
var provincia : String ="",
var zonaTicket : String = "",
var zonaRuta : String = "",
var ruta : String ="",
var ubicacion : String="",
var ETD : String="",
var camion : String="",
var ticketsPendientes : String= "",
var etiquetasTotales : String = "",
var etiquetasEscaneadas : String="",*/
var isError:Boolean = false, var isError:Boolean = false,
var errorMessage:String = "", var errorMessage:String = "",
var list:MutableList<itemsExpeditionDynamics> var list:MutableList<itemsExpeditionDynamics>
@ -38,16 +24,9 @@ class itemExpedetionState(
class itemsExpeditionDynamics( class itemsExpeditionDynamics(
var key: String = "", var key: String = "",
var value:String = "" var value: String? = null
)
/*
class itemExpeditionDynamicsList(
var list: List<itemsExpeditionDynamics> = listOf()
) )
class itemExpedetionStateList (
var list: List<itemExpedetionState> = listOf()
)*/
class ItemExpeditionStateRow ( class ItemExpeditionStateRow (
var title:String? = "", var title:String? = "",
var value:String? = "", var value:String? = "",

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.parking.fragment package es.verdnatura.presentation.view.feature.parking.fragment
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
@ -13,14 +12,13 @@ import es.verdnatura.databinding.FragmentParkingBinding
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
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.parking.adapter.ParkingAdapter import es.verdnatura.presentation.view.feature.parking.adapter.ParkingAdapter
class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(ParkingViewModel::class) { class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(ParkingViewModel::class) {
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
private var numParking : Int = 0 private var numParking : Int = 0
@ -41,7 +39,7 @@ class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(Pa
//viewModel.hideProgressLoading() //viewModel.hideProgressLoading()
binding.splashProgress.visibility=View.GONE binding.splashProgress.visibility=View.GONE
setList() setList()
customDialog = CustomDialog(requireContext()) //customDialog = CustomDialog(requireContext())
super.init() super.init()
} }
@ -68,11 +66,12 @@ class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(Pa
with(viewModel){ with(viewModel){
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
if (it.isError){ if (it.isError){
mperror?.start() // mperror?.start()
// binding.splashProgress.visibility = View.GONE // binding.splashProgress.visibility = View.GONE
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ ma.messageWithSound(it.errorMessage, isError = true,isPlayed = true)
/*customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
}else{ }else{
numParking -= 1 numParking -= 1
if (numParking <= 0) { if (numParking <= 0) {
@ -141,7 +140,7 @@ 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)
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

@ -66,14 +66,13 @@ class ParkingSaleFragment : BaseFragment<FragmentParkingBinding,ParkingSaleViewM
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
if (it.isError){ if (it.isError){
mperror?.start() mperror?.start()
// binding.splashProgress.visibility = View.GONE ma.messageWithSound(it.errorMessage,true,false)
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ /* customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
}else{ }else{
numParking -= 1 numParking -= 1
if (numParking <= 0) { if (numParking <= 0) {
// binding.splashProgress.visibility = View.GONE
//viewModel.hideProgressLoading() //viewModel.hideProgressLoading()
mpok?.start() mpok?.start()
setList() setList()

View File

@ -8,6 +8,7 @@ import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemPasillerosMainMenuBinding import es.verdnatura.databinding.ItemPasillerosMainMenuBinding
import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import timber.log.Timber.d
class PasillerosAdapter ( class PasillerosAdapter (
private val items: List<PasillerosItemVO>, private val items: List<PasillerosItemVO>,
@ -40,7 +41,12 @@ class PasillerosAdapter (
binding.apply { binding.apply {
this.item = item this.item = item
this.title = context?.getString(item.titleToShow) this.title = context?.getString(item.titleToShow)
itemImage.setImageResource(item.iconResource)
try {
itemImage.setImageResource(item.iconResource)
}catch(exception:Exception){
d("Exception::"+exception.message)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
itemImage.tooltipText=item.description itemImage.tooltipText=item.description

View File

@ -8,7 +8,6 @@ import es.verdnatura.R
import es.verdnatura.databinding.FragmentPasilleroBinding import es.verdnatura.databinding.FragmentPasilleroBinding
import es.verdnatura.presentation.base.BaseFragment 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.pasillero.adapter.PasillerosAdapter import es.verdnatura.presentation.view.feature.pasillero.adapter.PasillerosAdapter
@ -30,7 +29,7 @@ class PasilleroFragment(
override fun getLayoutId(): Int = R.layout.fragment_pasillero override fun getLayoutId(): Int = R.layout.fragment_pasillero
override fun init() { override fun init() {
(activity as MainActivity).hideBottomNavigation(View.VISIBLE) ma.hideBottomNavigation(View.VISIBLE)
binding.mainToolbar.toolbarTitle.text = tagName binding.mainToolbar.toolbarTitle.text = tagName
binding.mainToolbar.backButton.visibility = View.GONE binding.mainToolbar.backButton.visibility = View.GONE
super.init() super.init()

View File

@ -12,37 +12,32 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
fun inititializeDefaultData() { fun inititializeDefaultData() {
/* _pasillerositem.add( /* _pasillerositem.add(
PasillerosItemVO(20, PasillerosItemVO(20,
R.drawable.barcode_scan, R.drawable.barcode_scan,
"Visor web",R.string.SmarttagAssociate) "Visor web",R.string.SmarttagAssociate)
*/
_pasillerositem.add( /* _pasillerositem.add(
PasillerosItemVO(20, PasillerosItemVO(20,
R.drawable.barcode_scan, R.drawable.barcode_scan,
"Asociar Sacador SmartTags",R.string.SmarttagAssociate) "Asociar Sacador SmartTags",R.string.SmarttagAssociate)
) )
_pasillerositem.add( _pasillerositem.add(
PasillerosItemVO(21, PasillerosItemVO(21,
R.drawable.barcode, R.drawable.barcode_scan,
"Registrar SmartTags",R.string.SmarttagRegister) "Registrar SmartTags",R.string.SmarttagRegister)
) )*/
*/
//sergio para que aparezca el nuevo menu //sergio para que aparezca el nuevo menu
_pasillerositem.add(
_pasillerositem.add( PasillerosItemVO(
PasillerosItemVO( 7,
7, R.drawable.ic_streetview_black_24dp,
R.drawable.ic_streetview_black_24dp, "Obtener colección previa", R.string.PreSacador,"Obtiene colecciones para sacar en previa"
"Pre Sacador", R.string.PreSacador,"Carga un ticket de previa para sacarlo" )
) )
)
//precontrol //precontrol
_pasillerositem.add( _pasillerositem.add(
PasillerosItemVO(7, PasillerosItemVO(7,
@ -109,6 +104,14 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
) )
) )
_pasillerositem.add(
PasillerosItemVO(
7,
R.drawable.worker_mistake,
"Fallo del trabajador", R.string.workermistake,"Permite añadir fallos a un trabajador"
)
)
_pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
10, 10,
@ -118,7 +121,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
) )
_pasillerositem.add( _pasillerositem.add(
PasillerosItemVO(7, PasillerosItemVO(7,
R.drawable.ic_history_orange_24dp, R.drawable.ic_history_orange,
"Log Shelving",R.string.shelvingLog,"Permite conocer los movimientos en un carro" "Log Shelving",R.string.shelvingLog,"Permite conocer los movimientos en un carro"
) )
) )
@ -187,7 +190,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO( PasillerosItemVO(
31, 31,
R.drawable.ic_visibility_black_24dp, R.drawable.ic_visibility_black_24dp,
"Consultar expedición", R.string.ExpeditionState,"Permite conocer el estado de una expedición" "Consultar estado expedición", R.string.ExpeditionState,"Permite conocer el estado de una expedición"
) )
) )
_pasillerositem.add( _pasillerositem.add(

View File

@ -19,7 +19,6 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,ShowTicket
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 var type = "" private var type = ""
companion object { companion object {
@ -36,7 +35,6 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,ShowTicket
override fun init() { override fun init() {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
customDialog = CustomDialog(requireContext())
binding.mainToolbar.toolbarTitle.text = getString(R.string.precontrolprevious) binding.mainToolbar.toolbarTitle.text = getString(R.string.precontrolprevious)
setEvents() setEvents()
super.init() super.init()
@ -76,7 +74,7 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,ShowTicket
} }
binding.scanInput.setText("") binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput) ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false
@ -88,9 +86,8 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,ShowTicket
collectionTicketList.observe(viewLifecycleOwner, Observer { collectionTicketList.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
if (it.isError){ if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Aceptar"){ ma.messageWithSound(it.errorMessage,true,false)
customDialog.dismiss()
}.show()
}else{ }else{
if (!goBack)navigateToCollectionList(it) if (!goBack)navigateToCollectionList(it)
goBack = false goBack = false

View File

@ -0,0 +1,46 @@
package es.verdnatura.presentation.view.feature.presacador.adapter
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemCollectionRowBinding
import es.verdnatura.domain.ConstAndValues.PREITEMPICKER
import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
class PreCollectionAdapter (
private val items: List<CollectionVO>,
private val onCollectionSelected: OnCollectionSelectedListener
): RecyclerView.Adapter<PreCollectionAdapter.AjustesItemHolder> () {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
return AjustesItemHolder(
ItemCollectionRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
)
}
override fun getItemCount() =items.size
override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) {
holder.bind(items[position])
holder.binding.root.setOnClickListener {
onCollectionSelected.onCollectionSelected(items[position],PREITEMPICKER)
Log.d("VERDNATURA::","2-Click item ${items[position].collectionFk}+PREITEMPICKER")
}
}
class AjustesItemHolder(
val binding: ItemCollectionRowBinding
) : RecyclerView.ViewHolder(binding.root){
fun bind(item: CollectionVO) {
binding.apply {
this.item = item
}
}
}
}

View File

@ -0,0 +1,190 @@
package es.verdnatura.presentation.view.feature.presacador.fragment
import android.content.Context
import android.graphics.drawable.Drawable
import android.os.Build
import android.view.View
import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentSacadorBinding
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.presacador.adapter.PreCollectionAdapter
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
class InitPreSacadorFragment (
var entrypoint:String = ""
) :
BaseFragment<FragmentSacadorBinding, PreSacadorViewModel>(PreSacadorViewModel::class) {
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
private var goBack: Boolean = false
private var goBack2: Boolean = false
private lateinit var customDialog: CustomDialog
private var collectionsList: ArrayList<CollectionVO> = ArrayList()
private var adapter: PreCollectionAdapter? = null
companion object {
fun newInstance(entryPoint:String) = InitPreSacadorFragment(entryPoint)
}
override fun onAttach(context: Context) {
super.onAttach(context)
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
}
override fun getLayoutId(): Int = R.layout.fragment_sacador
override fun init() {
customDialog = CustomDialog(requireContext())
binding.splashProgress.visibility = View.VISIBLE
binding.splashProgressTwo.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = getString(R.string.getcollection)
setToolBar()
setEvents()
viewModel.sectorCollection_get(getData(USER),getData(PASSWORD),"sectorCollection_get")
super.init()
}
override fun onPause() {
goBack = true
goBack2 = true
super.onPause()
}
private fun setToolBar() {
ma.hideBottomNavigation(View.VISIBLE)
binding.mainToolbar.backButton.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text=entrypoint
val listIcons: ArrayList<ImageView> = ArrayList()
val iconAdd = ImageView(context)
iconAdd.setImageResource(R.drawable.ic_add_black_24dp)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconAdd.tooltipText=getTooltip(R.drawable.ic_add_black_24dp)
}
listIcons.add(iconAdd)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
when(item){
iconAdd.drawable -> {
binding.splashProgress.visibility = View.VISIBLE
viewModel.sectorCollection_new(getData(USER),
getData(PASSWORD),getData(SECTORFK),"sectorCollection_new")
}
}
}
})
binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun setEvents() {
binding.sacadorSwipe.setOnRefreshListener {
viewModel.sectorCollection_get(getData(USER),getData(PASSWORD),"sectorCollection_get")
binding.sacadorSwipe.isRefreshing = false
}
}
override fun observeViewModel() {
with(viewModel) {
collectionList.observe(viewLifecycleOwner, Observer {
if (!goBack2) binding.splashProgress.visibility = View.GONE
createCollectionList(it.list)
binding.splashProgress.visibility = View.GONE
goBack2 = false
})
response.observe(viewLifecycleOwner, Observer {
binding.splashProgressTwo.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
if (it.isError) {
ma.messageWithSound(it.errorMessage,true,false)
} else {
if (goBack) addCollectionToList(it.response)
}
goBack = false
//sergio:para asegurarnos que aparece en pantalla. En mi movil personal y trabajo no hacia falta.
//viewModel.PrecollectionGetSalix(token=getData(TOKEN))
})
responseNew.observe(viewLifecycleOwner, Observer {
binding.splashProgressTwo.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
if (it.isError) {
ma.messageWithSound(it.errorMessage,true,false)
} else {
//if (goBack)
viewModel.sectorCollection_get(getData(USER),getData(PASSWORD),getData(SECTORFK))
}
goBack = false
//sergio:para asegurarnos que aparece en pantalla. En mi movil personal y trabajo no hacia falta.
//viewModel.PrecollectionGetSalix(token=getData(TOKEN))
})
}
}
private fun createCollectionList(collections: List<CollectionVO>) {
collectionsList = ArrayList()
collections.forEach {
collectionsList.add(it)
}
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
adapter = PreCollectionAdapter(collectionsList, onCollectionSelectedListener!!)
binding.fragmentSacadorCollections.layoutManager = lm
binding.fragmentSacadorCollections.adapter = adapter
}
private fun addCollectionToList(collection: String) {
var isNew = true
collectionsList.forEach {
if (it.collectionFk == collection) {
isNew = false
}
}
if (isNew) {
collectionsList.add(CollectionVO(collectionFk = collection, created = "Nuevo"))
adapter?.notifyDataSetChanged()
} else {
customDialog.setTitle("Atención")
.setDescription("La colección " + collection + " sigue pendiente de preparar")
.setOkButton("Aceptar") {
customDialog.dismiss()
}.show()
}
//sergio:para asegurarnos que se actualiza pantalla.
adapter?.notifyDataSetChanged()
}
}

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.presacador.fragment package es.verdnatura.presentation.view.feature.presacador.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
@ -20,7 +19,6 @@ import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentPreSacadorBinding import es.verdnatura.databinding.FragmentPreSacadorBinding
import es.verdnatura.domain.ConstAndValues.PRESACADOR import es.verdnatura.domain.ConstAndValues.PRESACADOR
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.*
@ -30,7 +28,6 @@ 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.adapter.PreSacadorAdapter import es.verdnatura.presentation.view.feature.presacador.adapter.PreSacadorAdapter
@ -64,11 +61,19 @@ class PreSacadorFragment :
private lateinit var customDialogThreeButtons: CustomDialogThreeButtons private lateinit var customDialogThreeButtons: CustomDialogThreeButtons
private var ticketFk = "" private var ticketFk = ""
private var originalScanned = "" private var originalScanned = ""
fun changevariables(){
TODO("Refactor llevar variables i deixar soles una com positionToChange i quantityToChange")
}
private var typeCollectionMissing = "" private var typeCollectionMissing = ""
private var positionCollectionMissing = 0 private var positionCollectionMissing = 0
private var quantityCollectionMissing = "" private var quantityCollectionMissing = ""
private var positionIncreaseQuantity = 0 private var positionIncreaseQuantity = 0
private var quantityIncrease = "" private var quantityIncrease = ""
private var quantityCollectionSplit = ""
private var positionCollectionSplit = 0
// private val listIcons:ArrayList<ImageView> = ArrayList()
//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,14 +91,13 @@ class PreSacadorFragment :
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
override fun init() { override fun init() {
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext()) customDialogList = CustomDialogList(requireContext())
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
customDialogInputParking = CustomDialogInput(requireContext()) customDialogInputParking = CustomDialogInput(requireContext())
customDialogThreeButtons = CustomDialogThreeButtons(requireContext()) customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
//requireActivity().main_bottom_navigation.visibility = View.GONE
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = getString(R.string.getticketpre) binding.mainToolbar.toolbarTitle.text = getString(R.string.getticketpre)
setToolBar() setToolBar()
@ -173,17 +177,18 @@ class PreSacadorFragment :
responseSalixMessage.observe(viewLifecycleOwner, Observer { responseSalixMessage.observe(viewLifecycleOwner, Observer {
if (it.isError) { if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage) ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") { .setOkButton("Aceptar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} }
}) })
responseIncQuantity.observe(viewLifecycleOwner, Observer { responseIncQuantity.observe(viewLifecycleOwner, Observer {
if (it.isError) { if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true,true) ma.messageWithSound(it.errorMessage, isError = true,true)
} else { } else {
incresaseSuccesful() incresaseSuccesful()
} }
@ -194,20 +199,46 @@ class PreSacadorFragment :
responseParkingAdd.observe(viewLifecycleOwner, Observer { responseParkingAdd.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
if (it.isError) { if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage) ma.messageWithSound(it.errorMessage,true,false)
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Aceptar") { .setOkButton("Aceptar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} else { } else {
if (mpok != null) mpok!!.start() if (mpok != null) mpok!!.start()
"Sale/s aparcada/s".toast(requireContext()) "Sale/s aparcada/s".toast(requireContext())
} }
}) })
responseSaleTrackingUpdate.observe(viewLifecycleOwner, Observer {
ma.messageWithSound(it.errorMessage, isError = it.isError,true)
try {
sales.clear()
}
catch(e:Exception)
{
}
})
responseSaleMove.observe(viewLifecycleOwner, Observer {
if (it.isError) {
ma.messageWithSound(it.errorMessage, isError = true,true)
} else {
responseSaleMoveSuccesful()
}
})
responseMissingTrash.observe(viewLifecycleOwner, Observer { responseMissingTrash.observe(viewLifecycleOwner, Observer {
if (it.isError) { if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true,true) ma.messageWithSound(it.errorMessage, isError = true,true)
} else { } else {
missingTrashSuccesful() missingTrashSuccesful()
@ -246,6 +277,35 @@ class PreSacadorFragment :
} }
} }
private fun responseSaleMoveSuccesful() {
try {
sales[positionCollectionSplit].saldo = quantityCollectionSplit.toInt()
} catch (e: Exception) {
sales[positionCollectionSplit].saldo = 0
}
//sales[position].startQuantity = quantity
if (quantityCollectionSplit == "0")
markLine(positionCollectionSplit)
saleAdapter!!.notifyDataSetChanged()
//enviar mensaje a salix
val ticket =
"[" + sales[positionCollectionSplit].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionSplit].id + "/summary)"
val message =
"Se ha enviado a Split el articulo " + sales[positionCollectionSplit].itemFk + " del ticket " + ticket
/* viewModel.sendChekingPresence(
token = getData(TOKEN),
workerId = sales[positionCollectionSplit].salesPersonFk,
message = message,
"sendChekingPresence"
)*/
sendSalixMessageNew(message,sales[positionCollectionSplit].salesPersonFk)
}
private fun incresaseSuccesful() { private fun incresaseSuccesful() {
@ -348,11 +408,14 @@ class PreSacadorFragment :
private fun createSaleList(salesList: List<PreSacadorItemVO>) { private fun createSaleList(salesList: List<PreSacadorItemVO>) {
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
if (salesList.isNullOrEmpty()) { if (salesList.isNullOrEmpty()) {
customDialog.setTitle("Pre Sacador")
ma.messageWithSound("No hemos podido obtener movimientos para el ticket escaneado",true,false,"Pre Sacador")
/* customDialog.setTitle("Pre Sacador")
.setDescription("No hemos podido obtener movimientos para el ticket escaneado") .setDescription("No hemos podido obtener movimientos para el ticket escaneado")
.setKoButton("Cancelar") { .setKoButton("Cancelar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} else { } else {
binding.mainToolbar.toolbarTitle.text = ticket binding.mainToolbar.toolbarTitle.text = ticket
sales = ArrayList() sales = ArrayList()
@ -532,6 +595,7 @@ class PreSacadorFragment :
setTotalLines() setTotalLines()
} }
private fun saleTrackingReplace(position: Int) { private fun saleTrackingReplace(position: Int) {
viewModel.saleTrackingReplace( viewModel.saleTrackingReplace(
usuario = getData(USER), usuario = getData(USER),
@ -540,15 +604,20 @@ class PreSacadorFragment :
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(),
vStateFk = PRESACADOR, vStateFk = PRESACADOR,
//sergio: se añade originalItemScan para
vBuyFk = originalItemScan, callFunction = "saleTrackingReplace" vBuyFk = originalItemScan, callFunction = "saleTrackingReplace"
) )
// ////Log.i("VERDNATURA:","El id movimiento es ${sales[position].idMovimiento}") viewModel.saleTrackingReplace(
// ////Log.i("VERDNATURA:","Checked is ${if (sales[position].picked == sales[position].quantity) "1" else "0"}") usuario = getData(USER),
// ////Log.i("VERDNATURA:","Position is ${position}") password = getData(PASSWORD),
saleFk = sales[position].idMovimiento,
vIsChecked = if (sales[position].picked == sales[position].quantity) "1" else "0",
vOriginalQuantity = sales[position].picked.toString(),
vStateFk = PRESACADOR,
vBuyFk = originalItemScan, callFunction = "saleTrackingReplace"
)
} }
@ -874,37 +943,30 @@ class PreSacadorFragment :
val iconParking = ImageView(context) val iconParking = ImageView(context)
iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp) iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp)
val iconEraser = ImageView(context)
iconEraser.setImageResource(R.drawable.previous_delete)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconParking.tooltipText=getTooltip(R.drawable.ic_local_parking_black_24dp) iconParking.tooltipText=getTooltip(R.drawable.ic_local_parking_black_24dp)
iconEraser.tooltipText=getTooltip(R.drawable.previous_delete)
} }
//listIcons.add(iconEraser)
listIcons.add(iconParking) listIcons.add(iconParking)
/*val listIcons: ArrayList<Drawable> = ArrayList()
val iconEraser: Drawable = resources.getDrawable(R.drawable.eraser, resources.newTheme())
val iconParking: Drawable =
resources.getDrawable(R.drawable.ic_local_parking_black_24dp, resources.newTheme())*/
//sergio para hacer el presacador como sacador
//val iconAdd : Drawable = resources.getDrawable(R.drawable.ic_add_black_24dp,resources.newTheme())
//val iconTransferir : Drawable = resources.getDrawable(R.drawable.ic_swap_horiz_black_24dp,resources.newTheme())
// listIcons.add(iconEraser)
//listIcons.add(iconParking)
//listIcons.add(iconAdd)
//listIcons.add(iconTransferir)
binding.mainToolbar.toolbarIcons.adapter = binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener { ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) { override fun onOptionsItemSelected(item: Drawable) {
/*if (item == iconEraser) {
// saleTracking_update()
} else*/
when (item){ when (item){
iconParking.drawable-> pasillerosItemClickListener?.onPasillerosItemClickListener( iconParking.drawable-> pasillerosItemClickListener?.onPasillerosItemClickListener(
PasillerosItemVO( PasillerosItemVO(
title = "Parking" title = "Parking"
), "" ), ""
) )
} }
} }
@ -1120,6 +1182,10 @@ class PreSacadorFragment :
} }
private fun split(position: Int, quantity: String) { private fun split(position: Int, quantity: String) {
positionCollectionSplit=position
quantityCollectionSplit=quantity
var totalQuantity: Int = 0 var totalQuantity: Int = 0
try { try {
totalQuantity = sales[position].saldo.toInt() - quantity.toInt() totalQuantity = sales[position].saldo.toInt() - quantity.toInt()
@ -1132,13 +1198,13 @@ class PreSacadorFragment :
quantity = totalQuantity.toString(), quantity = totalQuantity.toString(),
originalQuantity = sales[position].quantity.toString(), "saleMove" originalQuantity = sales[position].quantity.toString(), "saleMove"
) )
//sales[position].originalQuantity = quantity /*
try { try {
sales[position].saldo = quantity.toInt() sales[position].saldo = quantity.toInt()
} catch (e: Exception) { } catch (e: Exception) {
sales[position].saldo = 0 sales[position].saldo = 0
} }
//sales[position].startQuantity = quantity
if (quantity == "0") if (quantity == "0")
markLine(position) markLine(position)
@ -1156,7 +1222,7 @@ class PreSacadorFragment :
message = message, message = message,
"sendChekingPresence" "sendChekingPresence"
) )
*/
} }

View File

@ -12,6 +12,9 @@ import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.* import es.verdnatura.presentation.base.*
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormat
import es.verdnatura.presentation.view.feature.sacador.model.CollectionListVO
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
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.PlacementSupplyVO import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
import retrofit2.Call import retrofit2.Call
@ -36,6 +39,15 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
get() = _response get() = _response
private val _responseSaleTrackingUpdate by lazy { MutableLiveData<ResponseItemVO>() }
val responseSaleTrackingUpdate: LiveData<ResponseItemVO>
get() = _responseSaleTrackingUpdate
private val _responseSaleMove by lazy { MutableLiveData<ResponseItemVO>() }
val responseSaleMove: LiveData<ResponseItemVO>
get() = _responseSaleMove
private val _responseParkingAdd by lazy { MutableLiveData<ResponseItemVO>() } private val _responseParkingAdd by lazy { MutableLiveData<ResponseItemVO>() }
val responseParkingAdd: LiveData<ResponseItemVO> val responseParkingAdd: LiveData<ResponseItemVO>
get() = _responseParkingAdd get() = _responseParkingAdd
@ -60,6 +72,29 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
val responseMissingTrash: LiveData<ResponseItemVO> val responseMissingTrash: LiveData<ResponseItemVO>
get() = _responseMissingTrash get() = _responseMissingTrash
//sergio: previa nuevo
private val _collectionList by lazy { MutableLiveData<CollectionListVO>() }
val collectionList: LiveData<CollectionListVO>
get() = _collectionList
private val _responseNew by lazy { MutableLiveData<ResponseItemVO>() }
val responseNew: LiveData<ResponseItemVO>
get() = _responseNew
private val _responseSaleGroupAdd by lazy { MutableLiveData<ResponseItemVO>() }
val responseSaleGroupAdd: LiveData<ResponseItemVO>
get() = _responseSaleGroupAdd
private val _responseSaleAddPrevOK by lazy { MutableLiveData<ResponseItemVO>() }
val responseSaleAddPrevOK: LiveData<ResponseItemVO>
get() = _responseSaleAddPrevOK
private val _responseSaleupdateIsChecked by lazy { MutableLiveData<ResponseItemVO>() }
val responseSaleupdateIsChecked: LiveData<ResponseItemVO>
get() = _responseSaleupdateIsChecked
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)
@ -281,7 +316,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
vStateFk: String, vStateFk: String,
vIsChecked: String, vIsChecked: String,
vBuyFk: String,callFunction:String vBuyFk: String,callFunction:String
) )
{ {
//Lo ultimo que se envia //Lo ultimo que se envia
//sergio: se quita el 0 que habia por defecto para la previa se añada el buyFk que sera el item escaneado. //sergio: se quita el 0 que habia por defecto para la previa se añada el buyFk que sera el item escaneado.
@ -294,14 +329,14 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
vStateFk, vStateFk,
vIsChecked, vIsChecked,
vBuyFk vBuyFk
).enqueue(object : Callback<String> ).enqueue(object : Callback<String>
{ {
override fun onFailure(call: Call<String>, t: Throwable) override fun onFailure(call: Call<String>, t: Throwable)
{ {
_response.value = ResponseItemVO( _response.value = ResponseItemVO(
isError = true, isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
) )
} }
override fun onResponse(call: Call<String>, response: Response<String>) override fun onResponse(call: Call<String>, response: Response<String>)
@ -311,7 +346,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
_response.value = ResponseItemVO( _response.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()!!) _response.value = ResponseItemVO(isError = false, response = response.body()!!)
@ -395,7 +430,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( _responseSaleMove.value = ResponseItemVO(
isError = true, isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
) )
@ -405,12 +440,12 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{ {
if (response.body() == null) if (response.body() == null)
{ {
_response.value = ResponseItemVO( _responseSaleMove.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()!!) _responseSaleMove.value = ResponseItemVO(isError = false, response = response.body()!!)
} }
} }
}) })
@ -537,4 +572,229 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
} }
} }
fun sectorCollection_get(usuario: String, password: String,callFunction:String){
getPreSacadorUseCase.sectorCollection_get(usuario, password).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)
}
}
})
}
fun sectorCollection_new(usuario: String, password: String, sectorFk: String,callFunction:String){
getPreSacadorUseCase.sectorCollection_new(usuario, password, sectorFk).enqueue(
object :
Callback<Unit> {
override fun onFailure(call: Call<Unit>, t: Throwable) {
_responseNew.value =
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(
call: Call<Unit>,
response: Response<Unit>
) {
if (!response.isSuccessful){
_responseNew.value=ResponseItemVO(
isError = true,
errorMessage = "Error en la llamada al añadir colección." + getMessageFromAllResponse(
nameofFunction(this),response.message()
))
}else{
_responseNew.value=ResponseItemVO(
isError = false,
errorMessage = "" + getMessageFromAllResponse(
nameofFunction(this),response.message()
))
}
//Log.i("Salix","Mensaje enviado a salix")
/*if (response.body() != null) {
_response.value =
ResponseItemVO(isError = false, response = response.body()!!)
} else {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}*/
}
})
}
fun sectorCollection_getSale(usuario: String, password: String, sectorCollectionFK:String,vSectorFk:String)
{
getPreSacadorUseCase.sectorCollection_getSale(usuario, password, sectorCollectionFK,vSectorFk)
.enqueue(object :
Callback<List<PreSacadorItemVO>>
{
override fun onFailure(call: Call<List<PreSacadorItemVO>>, t: Throwable)
{
d("VERDNATURA::","ha fallado")
_salesList.value = listOf()
}
override fun onResponse(
call: Call<List<PreSacadorItemVO>>,
response: Response<List<PreSacadorItemVO>>
)
{
if (response.body() != null)
{
d("VERDNATURA::","entra con lineas")
_salesList.value = response.body()?.let { it }
} else
{
d("VERDNATURA::","ES NULO")
_salesList.value = listOf()
}
}
})
}
fun sectorCollectionSaleGroup_add(usuario: String, password: String, vSaleGroupFk: String,vSectorCollectionFk:String,callFunction:String){
getPreSacadorUseCase.sectorCollectionSaleGroup_add(usuario, password, vSaleGroupFk,vSectorCollectionFk).enqueue(
object :
Callback<Unit> {
override fun onFailure(call: Call<Unit>, t: Throwable) {
_response.value =
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(
call: Call<Unit>,
response: Response<Unit>
) {
if (!response.isSuccessful){
_responseSaleGroupAdd.value=ResponseItemVO(
isError = true,
errorMessage = "Error al añadir ticket a la colección." + getMessageFromAllResponse(
nameofFunction(this),response.message()
))
}else{
_responseSaleGroupAdd.value=ResponseItemVO(
isError = false,
errorMessage = "" + getMessageFromAllResponse(
nameofFunction(this),response.message()
))
}
}
})
}
fun saleTracking_addPrevOK(usuario: String, password: String, vSectorCollectionFk:String,callFunction:String){
getPreSacadorUseCase.saleTracking_addPrevOK(usuario, password,vSectorCollectionFk).enqueue(
object :
Callback<Unit> {
override fun onFailure(call: Call<Unit>, t: Throwable) {
_responseSaleAddPrevOK.value =
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(
call: Call<Unit>,
response: Response<Unit>
) {
if (!response.isSuccessful){
_responseSaleAddPrevOK.value=ResponseItemVO(
isError = true,
errorMessage = "Error al cambiar el estado a la colección de previa." + getMessageFromAllResponse(
nameofFunction(this),response.message()
))
}else{
_responseSaleAddPrevOK.value=ResponseItemVO(
isError = false,
errorMessage = ""
+ getMessageFromAllResponse(
nameofFunction(this),response.message()
))
}
}
})
}
fun saleTracking_updateIsChecked(usuario: String, password: String, vSaleFk:String,vIsChecked:String,callFunction:String){
getPreSacadorUseCase.saleTracking_updateIsChecked(usuario, password,vSaleFk,vIsChecked).enqueue(
object :
Callback<Unit> {
override fun onFailure(call: Call<Unit>, t: Throwable) {
_responseSaleupdateIsChecked.value =
ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(
call: Call<Unit>,
response: Response<Unit>
) {
if (!response.isSuccessful){
_responseSaleupdateIsChecked.value=ResponseItemVO(
isError = true,
errorMessage = "Error al cambiar el estado a la colección de previa." + getMessageFromAllResponse(
nameofFunction(this),response.message()
))
}else{
_responseSaleupdateIsChecked.value=ResponseItemVO(
isError = false,
errorMessage = ""
+ getMessageFromAllResponse(
nameofFunction(this),response.message()
))
}
}
})
}
} }

View File

@ -20,8 +20,7 @@ fun PreSacadorItemVO.toSale() : SaleVO {
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 salePersonFk=if (salesPersonFk.isNullOrEmpty()){""}else salesPersonFk,
) )

View File

@ -16,7 +16,9 @@ class PreSacadorItemVO (
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" var salesPersonFk:String= "",
var reference:String=""
) )

View File

@ -68,7 +68,7 @@ class QrFragment(
} }
binding.scanInput.setText("") binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput) ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
// false // false
@ -83,10 +83,11 @@ class QrFragment(
if (it.isError) { if (it.isError) {
// getMessageFromJSON(it.errorMessage) // getMessageFromJSON(it.errorMessage)
customDialog.setTitle("Error").setDescription( it.errorMessage+ " "+itemscaned) ma.messageWithSound(it.errorMessage+ " "+itemscaned,true,false)
/*customDialog.setTitle("Error").setDescription( it.errorMessage+ " "+itemscaned)
.setOkButton("Aceptar") { .setOkButton("Aceptar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} else { } else {
customDialog.setTitle("Mensaje") customDialog.setTitle("Mensaje")

View File

@ -38,7 +38,6 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
private lateinit var customDialog: CustomDialog private lateinit var customDialog: CustomDialog
private lateinit var customDialogList: CustomDialogList private lateinit var customDialogList: CustomDialogList
private lateinit var customDialogInput: CustomDialogInput private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogThreeButtons: CustomDialogThreeButtons
private var sales:ArrayList<PreSacadorItemVO> = ArrayList() private var sales:ArrayList<PreSacadorItemVO> = ArrayList()
@ -73,9 +72,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext()) customDialogList = CustomDialogList(requireContext())
customDialogInput = CustomDialogInput(requireContext()) customDialogInput = CustomDialogInput(requireContext())
customDialogThreeButtons = CustomDialogThreeButtons(requireContext()) ma.hideBottomNavigation(View.GONE)
//requireActivity().main_bottom_navigation.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = getString(R.string.itemPlacementSupplyGetOrder) binding.mainToolbar.toolbarTitle.text = getString(R.string.itemPlacementSupplyGetOrder)
setToolBar() setToolBar()
@ -522,7 +519,6 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
} }
private fun showScanner(index:Int, sale:PreSacadorItemVO){ private fun showScanner(index:Int, sale:PreSacadorItemVO){
//////Log.i("VERDNATURA:","CUSTOMDIALOG para enviar")
customDialogInput.setTitle(""+sale.itemFk).setDescription("Escanea el carro para el item seleccionado").setOkButton("Aceptar"){ customDialogInput.setTitle(""+sale.itemFk).setDescription("Escanea el carro para el item seleccionado").setOkButton("Aceptar"){
if (!customDialogInput.getValue().isNullOrEmpty()) { if (!customDialogInput.getValue().isNullOrEmpty()) {
findSale(customDialogInput.getValue(),index) findSale(customDialogInput.getValue(),index)

View File

@ -27,7 +27,7 @@ class CollectionAdapter (
holder.bind(items[position]) holder.bind(items[position])
holder.binding.root.setOnClickListener { holder.binding.root.setOnClickListener {
onCollectionSelected.onCollectionSelected(items[position],SACADOR) onCollectionSelected.onCollectionSelected(items[position],SACADOR)
//////Log.i("VERDNATURA:","2-Click item ${items[position].collectionFk}") Log.d("VERDNATURA::","2-Click item ${items[position].collectionFk}")
} }
} }

View File

@ -3,8 +3,11 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
import android.content.Context import android.content.Context
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.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView
import androidx.fragment.app.setFragmentResultListener
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
@ -13,7 +16,6 @@ import es.verdnatura.domain.ConstAndValues.SACADOR
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.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
@ -51,12 +53,36 @@ class SacadorFragment :
binding.mainToolbar.toolbarTitle.text = getString(R.string.getcollection) binding.mainToolbar.toolbarTitle.text = getString(R.string.getcollection)
setToolBar() setToolBar()
setEvents() setEvents()
viewModel.collectionGetSalix(token = getData(TOKEN))
/*viewModel.collectionGet( getData(USER),
getData(PASSWORD),"collection_get")*/
super.init()
}
var working_in_test=false
if (!working_in_test) {
viewModel.collectionGetSalix(token = getData(TOKEN))
}else{
viewModel.collectionGet( getData(USER),
getData(PASSWORD),"collection_get")
}
super.init()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Use the Kotlin extension in the fragment-ktx artifact
setFragmentResultListener("requestKey") { requestKey, bundle ->
val result = bundle.getString("tagMode")
resultTagMode=result
Log.d("VERDNATURA::","el result es "+result)
if (result.equals("complete") && getData(TAGSTYPE).equals("SmartTags")) {
viewModel.collectionNew(getData(USER),
getData(PASSWORD), getData(SECTORFK), getData(WAGON), getData(TAGSTYPE),"collection_new_wagon")
}
}
}
override fun onPause() { override fun onPause() {
goBack = true goBack = true
goBack2 = true goBack2 = true
@ -66,7 +92,7 @@ class SacadorFragment :
private fun setToolBar() { private fun setToolBar() {
// requireActivity().main_bottom_navigation.visibility = View.VISIBLE // requireActivity().main_bottom_navigation.visibility = View.VISIBLE
(activity as MainActivity).hideBottomNavigation(View.VISIBLE) ma.hideBottomNavigation(View.VISIBLE)
binding.mainToolbar.backButton.visibility = View.GONE binding.mainToolbar.backButton.visibility = View.GONE
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
@ -96,22 +122,13 @@ class SacadorFragment :
iconAdd.drawable -> { iconAdd.drawable -> {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
// checkTagsMode()
viewModel.collectionNew(getData(USER), viewModel.collectionNew(getData(USER),
getData(PASSWORD),getData(SECTORFK),getData(WAGON),getData(TAGSTYPE),"collection_new_wagon") getData(PASSWORD),getData(SECTORFK),getData(WAGON),getData(TAGSTYPE),"collection_new_wagon")
} }
iconVehicleIn.drawable-> (activity as MainActivity).onVehicleSelected(SacadorFragment.TAG) iconVehicleIn.drawable-> ma.onVehicleSelected(SacadorFragment.TAG)
}
/* if (item == iconAdd) {
binding.splashProgress.visibility = View.VISIBLE
//viewModel.collectionNew(user, password, sectorFk, wagons)
viewModel.collectionNew(user,password,sectorFk,wagons,getTagsType(),"collection_new_wagon")
//checkTagsMode()
} }
if (item.drawable == iconVehicleIn) {
(activity as MainActivity).onVehicleSelected(SacadorFragment.TAG)
}*/
} }
}) })
binding.mainToolbar.toolbarIcons.layoutManager = binding.mainToolbar.toolbarIcons.layoutManager =
@ -121,9 +138,9 @@ class SacadorFragment :
private fun setEvents() { private fun setEvents() {
binding.sacadorSwipe.setOnRefreshListener { binding.sacadorSwipe.setOnRefreshListener {
viewModel.collectionGetSalix(token = getData(TOKEN)) viewModel.collectionGetSalix(token = getData(TOKEN))
/* viewModel.collectionGet(getData(USER), /* viewModel.collectionGet(getData(USER),
getData(PASSWORD),"collection_get") getData(PASSWORD),"collection_get")*/
binding.sacadorSwipe.isRefreshing = false*/ binding.sacadorSwipe.isRefreshing = false
} }
} }
@ -131,14 +148,13 @@ class SacadorFragment :
private fun checkTagsMode() { private fun checkTagsMode() {
// Log.i("VERDNATURA:", "Tag type: ${getTagsType()}")
if (getData(TAGSTYPE).equals("Stickers")) { if (getData(TAGSTYPE).equals("Stickers")) {
//viewModel.collectionNew(user, password, sectorFk, wagons, "Stickers")
viewModel.collectionNew(getData(USER), viewModel.collectionNew(getData(USER),
getData(PASSWORD), getData(SECTORFK), getData(WAGON),"collection_new_wagon") getData(PASSWORD), getData(SECTORFK), getData(WAGON),"collection_new_wagon")
} else { } else {
// Log.i("VERDNATURA:", " el resultTagmode es ${resultTagMode}") Log.d("VERDNATURA::","ResultMode"+resultTagMode)
if (resultTagMode.equals("complete")) { if (resultTagMode.equals("complete")) {
viewModel.collectionNew(getData(USER), viewModel.collectionNew(getData(USER),
getData(PASSWORD), getData(SECTORFK), getData(WAGON), getData(TAGSTYPE),"collection_new_wagon") getData(PASSWORD), getData(SECTORFK), getData(WAGON), getData(TAGSTYPE),"collection_new_wagon")
@ -182,18 +198,41 @@ class SacadorFragment :
binding.splashProgressTwo.visibility = View.GONE binding.splashProgressTwo.visibility = View.GONE
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
if (it.isError) { if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage) ma.messageWithSound(it.errorMessage,true,false)
.setOkButton("Aceptar") {
customDialog.dismiss()
}.show()
} else { } else {
if (goBack) addCollectionToList(it.response) if (goBack) addCollectionToList(it.response)
} }
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.
/* viewModel.collectionGet(getData(USER),getData(PASSWORD),"collection_get")*/
viewModel.collectionGetSalix(token=getData(TOKEN))
var working_in_test=false
if (!working_in_test) {
viewModel.collectionGetSalix(token=getData(TOKEN))
}else{
viewModel.collectionGet(getData(USER),getData(PASSWORD),"collection_get")
}
/*viewModel.collectionGetSalix(token=getData(TOKEN))*/
}) })
registerSmarttagInsert.observe(viewLifecycleOwner, Observer {
if (!goBack){
if (it.isError) {
ma.messageWithSound(it.errorMessage,true,false)
} else {
ma.messageWithSound(it.errorMessage,false,false)
}
goBack = false}
})
} }
} }
@ -211,6 +250,7 @@ class SacadorFragment :
private fun addCollectionToList(collection: String) { private fun addCollectionToList(collection: String) {
var isNew = true var isNew = true
collectionsList.forEach { collectionsList.forEach {
if (it.collectionFk == collection) { if (it.collectionFk == collection) {
isNew = false isNew = false
@ -218,6 +258,9 @@ class SacadorFragment :
} }
if (isNew) { if (isNew) {
collectionsList.add(CollectionVO(collectionFk = collection, created = "Nuevo")) collectionsList.add(CollectionVO(collectionFk = collection, created = "Nuevo"))
Log.d("VERDNATURA::","llamada nodejs insert")
viewModel.smartTagInsertTicket(collection)
adapter?.notifyDataSetChanged() adapter?.notifyDataSetChanged()
} else { } else {
customDialog.setTitle("Atención") customDialog.setTitle("Atención")

View File

@ -2,9 +2,11 @@ package es.verdnatura.presentation.view.feature.sacador.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.domain.GetSmarttagsUserCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
@ -14,6 +16,7 @@ import es.verdnatura.presentation.view.feature.collection.mapper.map
import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormat import es.verdnatura.presentation.view.feature.sacador.mapper.toDateFormat
import es.verdnatura.presentation.view.feature.sacador.model.CollectionListVO import es.verdnatura.presentation.view.feature.sacador.model.CollectionListVO
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.model.SmartTagRegister
import retrofit2.Call import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
import retrofit2.Response import retrofit2.Response
@ -26,6 +29,10 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
context context
) )
private val GetSmarttagsUserCase: GetSmarttagsUserCase = GetSmarttagsUserCase(
context
)
private val _collectionList by lazy { MutableLiveData<CollectionListVO>() } private val _collectionList by lazy { MutableLiveData<CollectionListVO>() }
val collectionList: LiveData<CollectionListVO> val collectionList: LiveData<CollectionListVO>
get() = _collectionList get() = _collectionList
@ -38,6 +45,9 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
val response: LiveData<ResponseItemVO> val response: LiveData<ResponseItemVO>
get() = _response get() = _response
private val _registerSmarttagInsert by lazy { MutableLiveData<SmartTagRegister>() }
val registerSmarttagInsert: LiveData<SmartTagRegister>
get() = _registerSmarttagInsert
fun collectionTicketGet( fun collectionTicketGet(
@ -207,4 +217,53 @@ class SacadorViewModel(context: Context) : BaseViewModel() {
}) })
} }
fun smartTagInsertTicket(collectionFk: String)
{
GetSmarttagsUserCase.smartTagInsertTicket(collectionFk)
.enqueue(object : Callback<SmartTagRegister>
{
override fun onResponse(
call: Call<SmartTagRegister>,
response: Response<SmartTagRegister>
)
{
val responseSmart: SmartTagRegister
if (response.isSuccessful()){
Log.i("VERDNATURA::","El mensaje es "+response.message())
responseSmart = SmartTagRegister(
message="Ticket insertado OK.",
isError = false,
errorMessage = ""
)
}else{
responseSmart = SmartTagRegister(
isError = true,
errorMessage = response.message()
)
}
_registerSmarttagInsert.value = responseSmart
}
override fun onFailure(call: Call<SmartTagRegister>, t: Throwable)
{
val responseSmart =
SmartTagRegister(isError = true, errorMessage = t.message!!)
Log.i("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString())
_registerSmarttagInsert.value = responseSmart
}
})
}
} }

View File

@ -27,7 +27,7 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
override fun init() { override fun init() {
(activity as MainActivity).hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.shelvingParking_get) binding.mainToolbar.toolbarTitle.text = getString(R.string.shelvingParking_get)
setEvents() setEvents()
@ -50,7 +50,7 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
} }
binding.shelvingText.setText("") binding.shelvingText.setText("")
(activity as MainActivity).hideKeyboard(binding.shelvingText) ma.hideKeyboard(binding.shelvingText)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
@ -67,7 +67,7 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
binding.mainToolbar.toolbarTitle.text = binding.shelvingText.text.toString() binding.mainToolbar.toolbarTitle.text = binding.shelvingText.text.toString()
viewModel.shelvingParking_get( getData(USER),getData(PASSWORD),binding.shelvingText.text.toString(),getData(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) ma.hideKeyboard(binding.dayrange)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }

View File

@ -10,7 +10,6 @@ import es.verdnatura.databinding.FragmentControladorBinding
import es.verdnatura.domain.ConstAndValues import es.verdnatura.domain.ConstAndValues
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.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
@ -21,7 +20,6 @@ class ShowTicketFragment: BaseFragment<FragmentControladorBinding, ShowTicketVie
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 var type = "" private var type = ""
companion object { companion object {
@ -36,7 +34,6 @@ class ShowTicketFragment: BaseFragment<FragmentControladorBinding, ShowTicketVie
override fun init() { override fun init() {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
customDialog = CustomDialog(requireContext())
binding.mainToolbar.toolbarTitle.text = getString(R.string.verticket) binding.mainToolbar.toolbarTitle.text = getString(R.string.verticket)
setEvents() setEvents()
super.init() super.init()
@ -76,7 +73,7 @@ class ShowTicketFragment: BaseFragment<FragmentControladorBinding, ShowTicketVie
) )
} }
binding.scanInput.setText("") binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput) ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false
@ -88,9 +85,7 @@ class ShowTicketFragment: BaseFragment<FragmentControladorBinding, ShowTicketVie
collectionTicketList.observe(viewLifecycleOwner, Observer { collectionTicketList.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
if (it.isError){ if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Aceptar"){ ma.messageWithSound(it.errorMessage,true,false)
customDialog.dismiss()
}.show()
}else{ }else{
if (!goBack)navigateToCollectionList(it) if (!goBack)navigateToCollectionList(it)
goBack = false goBack = false

View File

@ -2,6 +2,7 @@ package es.verdnatura.presentation.view.feature.smarttag.register
import android.content.Context import android.content.Context
import android.util.Log
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
@ -14,9 +15,7 @@ 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.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,12 +28,10 @@ class RegisterSmartTagsFragment(
) { ) {
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
private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogThreeButtons: CustomDialogThreeButtons
private var listSmartTags: ArrayList<SmartTag> = ArrayList() private var listSmartTags: ArrayList<SmartTag> = ArrayList()
private var smartAdapter: SmartTagAdapter? = null private var smartAdapter: SmartTagAdapter? = null
private var itemScaned: String = "" private var itemScaned: String = ""
@ -44,6 +41,7 @@ class RegisterSmartTagsFragment(
fun newInstance(entryPoint: String) = RegisterSmartTagsFragment(entryPoint) fun newInstance(entryPoint: String) = RegisterSmartTagsFragment(entryPoint)
} }
override fun onAttach(context: Context) { override fun onAttach(context: Context) {
super.onAttach(context) super.onAttach(context)
// sergio: en test: Log.i("VERDNATURA:","attached") // sergio: en test: Log.i("VERDNATURA:","attached")
@ -70,11 +68,8 @@ class RegisterSmartTagsFragment(
customDialog = CustomDialog(requireContext()) customDialog = CustomDialog(requireContext())
customDialogList = CustomDialogList(requireContext()) customDialogList = CustomDialogList(requireContext())
customDialogInput = CustomDialogInput(requireContext())
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
goBack = false goBack = false
//requireActivity().main_bottom_navigation.visibility = GONE ma.hideBottomNavigation(View.GONE)
(activity as MainActivity).hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
setEvents() setEvents()
@ -91,9 +86,9 @@ class RegisterSmartTagsFragment(
private fun setToolBar() { private fun setToolBar() {
// toolbar_title.text = getString(R.string.SmarttagAssociate)
// Log.d("VERDNATURA::","Title"+entryPoint)
binding.mainToolbar.toolbarTitle.text = entryPoint binding.mainToolbar.toolbarTitle.text = entryPoint
// Log.i("VERDNATURA:", "el entrypoint es ${entryPoint}")
} }
@ -101,32 +96,49 @@ class RegisterSmartTagsFragment(
private fun bindShelving_add(shelvingOrSmarttag: String) { private fun bindShelving_add(shelvingOrSmarttag: String) {
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
//poner el bindshelving aqui
viewModel.workerShelving_add(getData(USER), Log.d("VERDNATURA::","El selvingORSmarttag es "+shelvingOrSmarttag)
getData(PASSWORD), shelvingOrSmarttag)
if (listSmartTags.size < 1) { if (listSmartTags.size < 1) {
} else { } else {
("http://localhost:7777/bindShelving/${listSmartTags.first().code}" + "&" + shelvingOrSmarttag + "&${listSmartTags.size}").toast( /* ("https://smart-tag.verdnatura.es/bindShelving/$shelvingOrSmarttag&${listSmartTags.first().code}&${listSmartTags.size}").toast(
requireContext() requireContext()
) )*/
viewModel.smartTagRegister(shelvingOrSmarttag,listSmartTags.first().code!!,listSmartTags.size.toString())
// Log.d("VERDNATURA::","https://smart-tag.verdnatura.es/bindShelving/$shelvingOrSmarttag&${listSmartTags.first().code}&${listSmartTags.size}")
} }
itemScaned = shelvingOrSmarttag itemScaned = shelvingOrSmarttag
add_item()
} }
private fun add_item(){
var nameSmartTagwithWagon: String
nameSmartTagwithWagon =
getTextScaned(listSmartTags.size + 1) + itemScaned
customDialogList.setTitle(getTextToPosition(listSmartTags.size + 1))
listSmartTags.add(SmartTag(itemScaned, nameSmartTagwithWagon))
smartAdapter!!.notifyDataSetChanged()
customDialogList.setValue("")
}
private fun bindShelving_remove() { private fun bindShelving_remove() {
// binding.splashProgress.visibility = VISIBLE // binding.splashProgress.visibility = VISIBLE
//ponser el unbindshleving aqui //poner el unbindshleving aqui
//sergio:esto se debe hacer en //sergio:esto se debe hacer en
("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()
) )
listSmartTags.removeAt(listSmartTags.size - 1)
listSmartTags.removeAt(listSmartTags.size - 1)
smartAdapter!!.notifyDataSetChanged() smartAdapter!!.notifyDataSetChanged()
@ -149,8 +161,10 @@ class RegisterSmartTagsFragment(
private fun setEvents() { private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
// Log.i("VERDNATURA:","PULSADO")
customDialogList.dismiss()
requireActivity().onBackPressed() requireActivity().onBackPressed()
} }
} }
@ -161,22 +175,27 @@ class RegisterSmartTagsFragment(
with(viewModel) { with(viewModel) {
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
registerSmarttagNode.observe(viewLifecycleOwner, Observer {
if (it.isError){
ma.messageWithSound(it.errorMessage,true,false)
}else{
ma.messageWithSound(it.message,false,false)
}
})
responseadd.observe(viewLifecycleOwner, Observer { responseadd.observe(viewLifecycleOwner, Observer {
// Log.i("VERDNATURA", "Revisar llamada de las etiquetas smarttags : ${it.response}") // Log.i("VERDNATURA", "Revisar llamada de las etiquetas smarttags : ${it.response}")
if (it.isError) { if (it.isError) {
ma.messageWithSound(it.errorMessage,true,false)
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else { } else {
var nameSmartTagwithWagon: String var nameSmartTagwithWagon: String
//"Etiqueta/matrícula añadida correctamente".toast(context)
//var sizeSmartTags = listSmartTags.size + 1
nameSmartTagwithWagon = nameSmartTagwithWagon =
getTextScaned(listSmartTags.size + 1) + itemScaned getTextScaned(listSmartTags.size + 1) + itemScaned
customDialogList.setTitle(getTextToPosition(listSmartTags.size + 1)) customDialogList.setTitle(getTextToPosition(listSmartTags.size + 1))
@ -227,28 +246,30 @@ class RegisterSmartTagsFragment(
customDialogList.setTitle("Escanea matrícula del carro y etiquetas smartTags de arriba a abajo.") customDialogList.setTitle("Escanea matrícula del carro y etiquetas smartTags de arriba a abajo.")
.setOkButton("Finalizar") { .setOkButton("Finalizar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
if (listSmartTags.size > 0) { if (listSmartTags.size > 0) {
// setFragmentResult("requestkey", bundleOf("tagMode" to "SmartTag")) // setFragmentResult("requestkey", bundleOf("tagMode" to "SmartTag"))
customDialogList.dismiss() customDialogList.dismiss()
// (activity as MainActivity).openFragmentPickers() requireActivity().onBackPressed()
// ma.openFragmentPickers()
/*listSmartTags.forEach { /*listSmartTags.forEach {
Log.i("VERDNATURA:","El codigo es :${it.code}") Log.i("VERDNATURA:","El codigo es :${it.code}")
} }
workerShelving_add(userFk, it.code!!)*/ workerShelving_add(userFk, it.code!!)*/
} else { } else {
customDialog.setTitle("Atención").setDescription("No ha escaneado Smartags") /* customDialog.setTitle("Atención").setDescription("No ha escaneado Smartags")
.setOkButton("Ok") .setOkButton("Ok")
{ {*/
customDialog.dismiss() customDialogList.dismiss()
requireActivity().onBackPressed()
}.show() /* }.show()*/
} }
}.setKoButton("Deshacer") { /* }.setKoButton("Deshacer") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
if (!listSmartTags.isEmpty()) { if (!listSmartTags.isEmpty()) {
@ -258,14 +279,14 @@ class RegisterSmartTagsFragment(
customDialogList.dismiss() customDialogList.dismiss()
requireActivity().onBackPressed() requireActivity().onBackPressed()
} }*/
// //
}.setValue("").show() }.setValue("").show()
customDialogList.getEditText().requestFocus() customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event -> customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
@ -293,7 +314,7 @@ class RegisterSmartTagsFragment(
} else { } else {
bindShelving_add(customDialogList.getValue()) bindShelving_add(customDialogList.getValue().uppercase())
} }
// showScanSmartTags(SmartTag(customDialogList.getValue())) // showScanSmartTags(SmartTag(customDialogList.getValue()))
@ -302,7 +323,7 @@ class RegisterSmartTagsFragment(
} }
customDialogList.setValue("") customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false

View File

@ -11,6 +11,8 @@ import androidx.fragment.app.setFragmentResult
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.FragmentSacadorAssociatesmarttagBinding
import es.verdnatura.databinding.FragmentSacadorAssociatesmarttagBindingImpl
import es.verdnatura.databinding.FragmentVehiclecontrolBinding import es.verdnatura.databinding.FragmentVehiclecontrolBinding
import es.verdnatura.domain.toast import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
@ -26,7 +28,7 @@ import timber.log.Timber
class AssociateSmartTagsFragment( class AssociateSmartTagsFragment(
var entryPoint: String = "" var entryPoint: String = ""
) : BaseFragment<FragmentVehiclecontrolBinding, SmartTagsViewModel>( ) : BaseFragment<FragmentSacadorAssociatesmarttagBinding, SmartTagsViewModel>(
SmartTagsViewModel::class SmartTagsViewModel::class
) { ) {
@ -73,7 +75,7 @@ class AssociateSmartTagsFragment(
customDialogThreeButtons = CustomDialogThreeButtons(requireContext()) customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
goBack = false goBack = false
//requireActivity().main_bottom_navigation.visibility = GONE //requireActivity().main_bottom_navigation.visibility = GONE
(activity as MainActivity).hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
setEvents() setEvents()
@ -103,13 +105,7 @@ class AssociateSmartTagsFragment(
viewModel.workerShelving_add(getData(USER), viewModel.workerShelving_add(getData(USER),
getData(PASSWORD), shelvingOrSmarttag) getData(PASSWORD), shelvingOrSmarttag)
if (listSmartTags.size < 1) {
} else {
("http://localhost:7777/bindShelving/${listSmartTags.first().code}" + "&" + shelvingOrSmarttag + "&${listSmartTags.size}").toast(
requireContext()
)
}
itemScaned = shelvingOrSmarttag itemScaned = shelvingOrSmarttag
} }
@ -123,9 +119,9 @@ class AssociateSmartTagsFragment(
viewModel.workerShelving_delete(getData(USER), viewModel.workerShelving_delete(getData(USER),
getData(PASSWORD), listSmartTags.last().code.toString()) 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()
) )*/
} }
@ -160,25 +156,11 @@ class AssociateSmartTagsFragment(
// Log.i("VERDNATURA::", "Revisar llamada de las etiquetas smarttags : ${it.response}") // Log.i("VERDNATURA::", "Revisar llamada de las etiquetas smarttags : ${it.response}")
if (it.isError) { if (it.isError) {
ma.messageWithSound(it.errorMessage,true,false)
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else { } else {
/* if (it.response != null) {
customDialog.setTitle("Error")
.setDescription("Etiqueta o carro no válido")
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else {*/
//"Etiqueta/matrícula añadida correctamente".toast(context)
//var sizeSmartTags = listSmartTags.size + 1
ma.messageWithSound("Carro/etiqueta insertado",false,false)
var nameSmartTagwithWagon = var nameSmartTagwithWagon =
getTextScaned(0) + itemScaned getTextScaned(0) + itemScaned
customDialogList.setTitle(getTextToPosition(0)) customDialogList.setTitle(getTextToPosition(0))
@ -188,17 +170,18 @@ class AssociateSmartTagsFragment(
customDialogList.setValue("") customDialogList.setValue("")
// }
} }
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
}) })
responseremove.observe(viewLifecycleOwner, Observer { responseremove.observe(viewLifecycleOwner, Observer {
if (it.isError) { if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage) ma.messageWithSound(it.errorMessage,true,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} else { } else {
if (it.response == null) { if (it.response == null) {
@ -209,18 +192,13 @@ class AssociateSmartTagsFragment(
}.show() }.show()
} else { } else {
//var nameSmartTagwithWagon = ""
/* nameSmartTagwithWagon =
getTextScaned(listSmartTags.size + 1) + itemScaned
customDialogList.setTitle(getTextToPosition(listSmartTags.size + 1))
listSmartTags.add(SmartTag(itemScaned, nameSmartTagwithWagon))*/
listSmartTags.removeAt(listSmartTags.size - 1) listSmartTags.removeAt(listSmartTags.size - 1)
smartAdapter!!.notifyDataSetChanged() smartAdapter!!.notifyDataSetChanged()
customDialogList.setValue("") customDialogList.setValue("")
ma.messageWithSound("Carro/etiqueta borrada",false,false)
} }
} }
binding.splashProgress.visibility = GONE binding.splashProgress.visibility = GONE
@ -264,31 +242,34 @@ class AssociateSmartTagsFragment(
customDialogList.setTitle("Escanea etiqueta/s electrónica/s o matrícula/s.") customDialogList.setTitle("Escanea etiqueta/s electrónica/s o matrícula/s.")
.setOkButton("Finalizar") { .setOkButton("Finalizar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
if (listSmartTags.size > 0) { if (listSmartTags.size > 0) {
// setFragmentResult("requestkey", bundleOf("tagMode" to "SmartTag")) // setFragmentResult("requestkey", bundleOf("tagMode" to "SmartTag"))
customDialogList.dismiss() customDialogList.dismiss()
Log.d("VERDNATURA::","Vamos a abrrir Sacadores")
val result = "complete" val result = "complete"
setFragmentResult("requestKey", bundleOf("tagMode" to result)) setFragmentResult("requestKey", bundleOf("tagMode" to result))
(activity as MainActivity).openFragmentPickers() ma.openFragmentPickers(true)
/*listSmartTags.forEach { /*listSmartTags.forEach {
Log.i("VERDNATURA:","El codigo es :${it.code}") Log.i("VERDNATURA:","El codigo es :${it.code}")
} }
workerShelving_add(userFk, it.code!!)*/ workerShelving_add(userFk, it.code!!)*/
} else { } else {
customDialog.setTitle("Atención").setDescription("No ha escaneado Smartags") /* customDialog.setTitle("Atención").setDescription("No ha escaneado Smartags")
.setOkButton("Ok") .setOkButton("Ok")
{ {*/
customDialog.dismiss() customDialogList.dismiss()
requireActivity().onBackPressed()
}.show() // }.show()
} }
}.setKoButton("Deshacer") { }.setKoButton("Deshacer") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
if (!listSmartTags.isEmpty()) { if (!listSmartTags.isEmpty()) {
@ -304,15 +285,15 @@ class AssociateSmartTagsFragment(
}.setValue("").show() }.setValue("").show()
customDialogList.getEditText().requestFocus() customDialogList.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ -> customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
if (!customDialogList.getValue().isNullOrEmpty()) { if (!customDialogList.getValue().isNullOrEmpty()) {
bindShelving_add(customDialogList.getValue()) bindShelving_add(customDialogList.getValue().uppercase())
} }
customDialogList.setValue("") customDialogList.setValue("")
(activity as MainActivity).hideKeyboard(customDialogList.getEditText()) ma.hideKeyboard(customDialogList.getEditText())
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
false false

View File

@ -2,12 +2,15 @@ package es.verdnatura.presentation.view.feature.smarttag.sacador.fragment
import android.content.Context import android.content.Context
import android.os.Message import android.os.Message
import android.util.Log
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetSmarttagsUserCase import es.verdnatura.domain.GetSmarttagsUserCase
import es.verdnatura.domain.GetVehicleControlTimeUserCase import es.verdnatura.domain.GetVehicleControlTimeUserCase
import es.verdnatura.domain.NodeJsService
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.smarttag.sacador.model.SmartTagRegister
import retrofit2.Call import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
@ -38,6 +41,10 @@ class SmartTagsViewModel(context: Context) : BaseViewModel() {
val responselevel: LiveData<ResponseItemVO> val responselevel: LiveData<ResponseItemVO>
get() = _responselevel get() = _responselevel
private val _registerSmarttagNode by lazy { MutableLiveData<SmartTagRegister>() }
val registerSmarttagNode: LiveData<SmartTagRegister>
get() = _registerSmarttagNode
fun workerShelving_add(usuario:String,password:String,shelvingFK:String){ fun workerShelving_add(usuario:String,password:String,shelvingFK:String){
GetSmarttagsUserCase.workerShelving_add(usuario,password,shelvingFK).enqueue(object : Callback<Void>{ GetSmarttagsUserCase.workerShelving_add(usuario,password,shelvingFK).enqueue(object : Callback<Void>{
@ -100,6 +107,49 @@ class SmartTagsViewModel(context: Context) : BaseViewModel() {
}) })
} }
fun smartTagRegister(smarttag: String, wagon: String, shelving: String)
{
GetSmarttagsUserCase.smartTagRegister(smarttag, wagon, shelving)
.enqueue(object : Callback<SmartTagRegister>
{
override fun onResponse(
call: Call<SmartTagRegister>,
response: Response<SmartTagRegister>
)
{
val responseSmart: SmartTagRegister
if (response.isSuccessful()){
Log.i("VERDNATURA::","El mensaje es "+response.message())
responseSmart = SmartTagRegister(
message="Registrada smartTag.",
isError = false,
errorMessage = ""
)
}else{
responseSmart = SmartTagRegister(
isError = true,
errorMessage = response.message()
)
}
_registerSmarttagNode.value = responseSmart
}
override fun onFailure(call: Call<SmartTagRegister>, t: Throwable)
{
val responseSmart =
SmartTagRegister(isError = true, errorMessage = t.message!!)
Log.i("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString())
_registerSmarttagNode.value = responseSmart
}
})
}
} }

View File

@ -11,18 +11,13 @@ class SmartTagScan (
class SmartTagScanList( class SmartTagScanList(
var list:List<SmartTagScan> = listOf() var list:List<SmartTagScan> = listOf()
) )
/*
class ItemExpeditionScanVO( class SmartTagRegister(
var id:String = "", var message: String = "",
var expeditionFk:String = "", var smarttag: String = "",
var Ruta:String = "", var wagon: String = "",
var Ticket:String = "", var shelving: String = "",
var Caja:String = "", var isError: Boolean = false,
var isError:Boolean = false, var errorMessage: String = ""
var errorMessage:String = ""
) )
class ItemExpeditionScanList(
var list:List<ItemExpeditionScanVO> = listOf()
)*/

View File

@ -21,10 +21,7 @@ class AutomaticAddItemFragment(
) : BaseFragment<FragmentAutomaticAddItemBinding,AutomaticAddItemViewModel>(AutomaticAddItemViewModel::class) { ) : BaseFragment<FragmentAutomaticAddItemBinding,AutomaticAddItemViewModel>(AutomaticAddItemViewModel::class) {
private var adapter : AutomaticAdapter? = null private var adapter : AutomaticAdapter? = null
private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogUbicador : CustomDialogUbicador
private var listItems:ArrayList<ItemEscanerVO> = ArrayList() private var listItems:ArrayList<ItemEscanerVO> = ArrayList()
private lateinit var customDialog: CustomDialog
private var deep:Int = 1 private var deep:Int = 1
private var contador = 0 private var contador = 0
@ -36,11 +33,7 @@ class AutomaticAddItemFragment(
override fun init() { override fun init() {
ma.hideBottomNavigation(View.GONE)
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
customDialogUbicador = CustomDialogUbicador(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = "itemShelvingMake" binding.mainToolbar.toolbarTitle.text = "itemShelvingMake"
setEvents() setEvents()
setViews() setViews()
@ -83,7 +76,7 @@ class AutomaticAddItemFragment(
adapter!!.notifyDataSetChanged() adapter!!.notifyDataSetChanged()
} }
binding.editMatricula.setText("") binding.editMatricula.setText("")
(activity as MainActivity).hideKeyboard(binding.editMatricula) ma.hideKeyboard(binding.editMatricula)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
@ -110,9 +103,10 @@ class AutomaticAddItemFragment(
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
if (it.isError){ if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){ ma.messageWithSound(it.errorMessage,true,false)
/*customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
}else{ }else{
requireActivity().onBackPressed() requireActivity().onBackPressed()
} }

View File

@ -66,7 +66,7 @@ class UbicadorFragment(
customDialogUbicador = CustomDialogUbicador(requireContext()) customDialogUbicador = CustomDialogUbicador(requireContext())
customDialogTwoButtons = CustomDialogTwoButtons(requireContext()) customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
(activity as MainActivity).hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.locator) binding.mainToolbar.toolbarTitle.text = getString(R.string.locator)
setEvents() setEvents()
setToolBar() setToolBar()
@ -154,7 +154,7 @@ class UbicadorFragment(
} }
binding.editMatricula.setText("") binding.editMatricula.setText("")
(activity as MainActivity).hideKeyboard(binding.editMatricula) ma.hideKeyboard(binding.editMatricula)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
@ -173,7 +173,7 @@ class UbicadorFragment(
) )
} }
(activity as MainActivity).hideKeyboard(binding.editPrioridad) ma.hideKeyboard(binding.editPrioridad)
return@setOnEditorActionListener true return@setOnEditorActionListener true
} }
@ -183,7 +183,7 @@ class UbicadorFragment(
binding.automaticImg.setOnClickListener { binding.automaticImg.setOnClickListener {
if (!shelvingFk.isNullOrEmpty()) if (!shelvingFk.isNullOrEmpty())
(activity as MainActivity).onPasillerosItemClickListener( ma.onPasillerosItemClickListener(
PasillerosItemVO(title = "Automatic"), PasillerosItemVO(title = "Automatic"),
entryPoint = shelvingFk entryPoint = shelvingFk
) )
@ -210,7 +210,7 @@ class UbicadorFragment(
}.show() }.show()
customDialogInput.getEditText().requestFocus() customDialogInput.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
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) {
@ -259,7 +259,7 @@ class UbicadorFragment(
}.show() }.show()
customDialogInput.getEditText().requestFocus() customDialogInput.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
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) {
@ -375,17 +375,24 @@ class UbicadorFragment(
}) })
response.observe(viewLifecycleOwner, Observer { response.observe(viewLifecycleOwner, Observer {
if (it.isError) {
mperror!!.start() if (it.isError) {
ma.messageWithSound(it.errorMessage,it.isError,false)
/* mperror!!.start()
customDialog.setTitle("Error").setDescription(it.errorMessage) customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
customDialog.dismiss() customDialog.dismiss()
}.show() }.show()*/
} }
}) })
responsepriority.observe(viewLifecycleOwner, Observer { responsepriority.observe(viewLifecycleOwner, Observer {
if (it.isError) {
ma.messageWithSound(
if (it.isError) it.errorMessage else{it.response},it.isError,true)
/* if (it.isError) {
mperror!!.start() mperror!!.start()
customDialog.setTitle("Error").setDescription(it.errorMessage) customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") { .setOkButton("Cerrar") {
@ -393,7 +400,7 @@ class UbicadorFragment(
}.show() }.show()
} else { } else {
(it.response).toast(requireContext()) (it.response).toast(requireContext())
} }*/
}) })
responseMake.observe(viewLifecycleOwner, Observer { responseMake.observe(viewLifecycleOwner, Observer {
@ -439,7 +446,7 @@ class UbicadorFragment(
}.show() }.show()
customDialogUbicador.getEditItem().requestFocus() customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) ma.hideKeyboard(customDialogUbicador.getEditItem())
customDialogUbicador.getVisibleItem().setOnEditorActionListener { v, actionId, event -> customDialogUbicador.getVisibleItem().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) {
@ -518,7 +525,7 @@ class UbicadorFragment(
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("") customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("")
.setEtiquetaValue("").setVisibleValue("") .setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus() customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) ma.hideKeyboard(customDialogUbicador.getEditItem())
customDialogUbicador.dismiss() customDialogUbicador.dismiss()
} else if (!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty()) { } else if (!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty()) {
@ -547,7 +554,7 @@ class UbicadorFragment(
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("") customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("")
.setEtiquetaValue("").setVisibleValue("") .setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus() customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) ma.hideKeyboard(customDialogUbicador.getEditItem())
customDialogUbicador.dismiss() customDialogUbicador.dismiss()
} else { } else {
@ -582,7 +589,7 @@ class UbicadorFragment(
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("") customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("")
.setEtiquetaValue("").setVisibleValue("") .setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus() customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) ma.hideKeyboard(customDialogUbicador.getEditItem())
customDialogUbicador.dismiss() customDialogUbicador.dismiss()
} else if (!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty() && updatePacking) { } else if (!itemFk.isNullOrEmpty() && !etiquetas.isNullOrEmpty() && updatePacking) {
@ -616,7 +623,7 @@ class UbicadorFragment(
customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("") customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("")
.setEtiquetaValue("").setVisibleValue("") .setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus() customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) ma.hideKeyboard(customDialogUbicador.getEditItem())
customDialogUbicador.dismiss() customDialogUbicador.dismiss()
} else { } else {
@ -639,14 +646,14 @@ class UbicadorFragment(
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible,packing = packing)) changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible,packing = packing))
customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("") customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus() customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) ma.hideKeyboard(customDialogUbicador.getEditItem())
}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(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1","itemShelvingMake") viewModel.itemShelvingMake(user,password,shelvingFk,itemFk,deep.toString(),visible_calc,packing,warehouseFk,"1","itemShelvingMake")
changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible_calc,packing = packing,stickers = etiquetas)) changeOfflineValue(ItemUbicadorVO(item = itemFk,visible = visible_calc,packing = packing,stickers = etiquetas))
customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("") customDialogUbicador.setItemValue("").setPackingValue("").setEtiquetaValue("").setVisibleValue("")
customDialogUbicador.getEditItem().requestFocus() customDialogUbicador.getEditItem().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogUbicador.getEditItem()) ma.hideKeyboard(customDialogUbicador.getEditItem())
}else{ }else{
"Rellena campos obligatorios".toast((activity as MainActivity), Toast.LENGTH_LONG) "Rellena campos obligatorios".toast((activity as MainActivity), Toast.LENGTH_LONG)
} }
@ -687,7 +694,7 @@ class UbicadorFragment(
customDialogInput.dismiss() customDialogInput.dismiss()
}.show() }.show()
customDialogInput.getEditText().requestFocus() customDialogInput.getEditText().requestFocus()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText()) ma.hideKeyboard(customDialogInput.getEditText())
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(

View File

@ -0,0 +1,71 @@
package es.verdnatura.presentation.view.feature.workermistake.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContentProviderCompat.requireContext
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemInventaryRowBinding
import es.verdnatura.databinding.ItemWorkermistakeRowBinding
import es.verdnatura.domain.toast
import es.verdnatura.presentation.common.OnInvetoryNichoClickListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.onMistakeWorkerClickListener
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
import timber.log.Timber.d
class WorkermistakeAdapter (
private val items: List<WorkerFromMistake>,
private val onMistakeWorkerClickListener: onMistakeWorkerClickListener
//private val onPasillerosItemClickListener: OnPasillerosItemClickListener*/
): RecyclerView.Adapter<WorkermistakeAdapter.ItemHolder> () {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
return ItemHolder(
ItemWorkermistakeRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
)
}
override fun getItemCount() =items.size
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
}
inner class ItemHolder(
val binding: ItemWorkermistakeRowBinding
) : RecyclerView.ViewHolder(binding.root){
private val res = binding.root.context.resources
fun bind(item: WorkerFromMistake) {
binding.apply {
this.item = item
itemFirstname.visibility = View.VISIBLE
itemLastname.visibility = View.VISIBLE
}
/* itemNicho.setOnClickListener {
onInvetoryNichoClickListener.onInvetoryNichoClickListener(item)
}
itemFk.setOnClickListener {
onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Consultar artículo"),item.itemFk)
}
itemUp.setOnClickListener {
onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Buscar item"),item.itemFk)
}
itemDown.setOnClickListener {
onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Buscar item"),item.itemFk)
}*/
binding.imageErrorMessage.setOnClickListener {
d("test_imageError")
onMistakeWorkerClickListener.onMistakeWorkerClickListener(item)
//false
}
}
}
}

View File

@ -0,0 +1,261 @@
package es.verdnatura.presentation.view.feature.workermistake.adapter
import android.content.Context
import android.os.Bundle
import android.view.View
import androidx.core.widget.addTextChangedListener
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentWorkermistakeBinding
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.common.onMistakeWorkerClickListener
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.feature.articulo.adapter.BarcodeAdapter
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
import es.verdnatura.presentation.view.feature.inventario.fragment.SearchDepartmentModel
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeWorkerType
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
import ir.mirrajabi.searchdialog.SimpleSearchDialogCompat
class WorkermistakeFragment( var entryPoint: String = ""
) : BaseFragment<FragmentWorkermistakeBinding, InventaryViewModel>(
InventaryViewModel::class) {
private var adapterworker:WorkermistakeAdapter? = null
private lateinit var customDialogInput: CustomDialogInput
private var listWorker:MutableList<WorkerFromMistake> = ArrayList()
private var listWorkerAuxiliary:MutableList<WorkerFromMistake> = ArrayList()
private lateinit var customDialog: CustomDialog
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
private var layoutManager : LinearLayoutManager? = null
// private var firstVisiblePosition = 0
private lateinit var customDialogList: CustomDialogList
private var listMistakes: ArrayList<BarcodeVO> = ArrayList()
private var listMistakesAdapter: BarcodeAdapter? = null
private var workerMistakeName: WorkerFromMistake? = null
private val departments=ArrayList<SearchDepartmentModel>()
private lateinit var departmentId:String
companion object {
fun newInstance(entryPoint:String) = WorkermistakeFragment(entryPoint)
}
override fun getLayoutId(): Int = R.layout.fragment_workermistake
override fun onAttach(context: Context) {
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
super.onAttach(context)
}
override fun onCreate(savedInstanceState: Bundle?) {
viewModel.department_getHasMistake(usuario = getData(USER),password = getData(PASSWORD))
super.onCreate(savedInstanceState)
}
override fun init() {
binding.filterDepartment.setText(getData(DEPARTMENTMISTAKE))
binding.splashProgress.visibility = View.VISIBLE
departmentId=getData(DEPARTMENTMISTAKEID)
customDialogList = CustomDialogList(requireContext())
if (!departmentId.isEmpty()){
viewModel.worker_getFromHasMistake(getData(USER),getData(PASSWORD),getData(DEPARTMENTMISTAKEID),"worker_getFromHasMistake")
}
binding.filterDepartment.setOnClickListener{
SimpleSearchDialogCompat(context,getString(R.string.departamentos),getString(R.string.escribirparteNombre),null,departments,
{ baseSearchDialogCompat, nombre, position ->
binding.filterDepartment.setText((nombre.title))
saveData(DEPARTMENTMISTAKE,nombre.getDepartmentName())
saveData(DEPARTMENTMISTAKEID,nombre.getDepartmentId())
viewModel.worker_getFromHasMistake(getData(USER),getData(PASSWORD),nombre.getDepartmentId(),"worker_getFromHasMistake")
binding.splashProgress.visibility = View.VISIBLE
binding.filterItemFk.isEnabled = true
baseSearchDialogCompat.dismiss()
}).show()
}
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
ma.hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.VISIBLE
setToolBar()
setEvents()
super.init()
}
private fun setToolBar(){
binding.mainToolbar.toolbarTitle.text=entryPoint
}
private fun setEvents(){
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()
}
if (binding.filterDepartment.text.isNullOrEmpty()){binding.filterItemFk.isEnabled = false}
binding.filterItemFk.addTextChangedListener{ filter()}
}
private fun filter() {
if (!listWorker.isNullOrEmpty())
{listWorker.clear()
listWorker.addAll(listWorkerAuxiliary.filter{it.firstName.uppercase().contains(binding.filterItemFk.text.toString().uppercase()) || it.lastName.uppercase().contains(binding.filterItemFk.text.toString().uppercase())} as MutableList<WorkerFromMistake>)
adapterworker!!.notifyDataSetChanged()}
}
/* override fun onPause() {
super.onPause()
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
}*/
/* override fun onResume() {
super.onResume()
if (binding.workermistakeRecyclerview.layoutManager != null){
if (firstVisiblePosition <= listInvetory.size){
binding.workermistakeRecyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition)
}
}
}*/
override fun observeViewModel() {
with(viewModel){
mistakeDepartmentList.observe(viewLifecycleOwner, {
binding.splashProgress.visibility = View.GONE
createDepartmentList(it.list)
})
workerFromMistakeList.observe(viewLifecycleOwner, {
binding.splashProgress.visibility = View.GONE
createWorkerList(it.list)
adapterworker= WorkermistakeAdapter(listWorker,object:onMistakeWorkerClickListener{
override fun onMistakeWorkerClickListener(item: WorkerFromMistake) {
viewModel.workerMistakeType_get(usuario = getData(USER), password = getData(PASSWORD))
workerMistakeName=WorkerFromMistake(item.id,item.firstName,item.lastName,true,"")
}
})
binding.workermistakeRecyclerview.adapter = adapterworker
layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.workermistakeRecyclerview.layoutManager = layoutManager
})
mistakeWorkerList.observe(viewLifecycleOwner,{
binding.splashProgress.visibility = View.GONE
showMistakeList(it.list)
//goBack = false
})
responseAddMistake.observe(viewLifecycleOwner, {
ma.messageWithSound(it.errorMessage,it.isError,true)
})
response.observe(viewLifecycleOwner, {
if (it.isError){
ma.messageWithSound(it.errorMessage,true,false)
}
})
}
}
private fun showMistakeList(list: List<MistakeWorkerType>) {
binding.splashProgress.visibility = View.GONE
listMistakes = ArrayList()
list.forEach {
listMistakes.add(BarcodeVO(code = it.description))
}
customDialogList.setTitle("Causa de error para : ${workerMistakeName!!.firstName}").setKoButton("Cancelar") {
customDialogList.dismiss()
}.hideDialog().show()
listMistakesAdapter =
BarcodeAdapter(listMistakes, object : OnBarcodeRowClickListener {
override fun onBarcodeRowClickListener(item: BarcodeVO) {
list.forEach {
if (it.description == item.code) {
viewModel.workerMistake_Add(usuario = getData(USER),
password = getData(PASSWORD),
vUserFk = workerMistakeName!!.id,
vTypeFk = it.code, callFunction ="workerMistake_Add"
)
// "Causa del error registrado".toast(requireContext())
customDialogList.dismiss()
}
}
}
}, showDelete = false)
customDialogList.getRecyclerView().adapter = listMistakesAdapter
customDialogList.getRecyclerView().layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}
private fun createDepartmentList(list: List<DepartmentMistake>){
departments.clear()
list.forEach { department ->
if (!department.isError){
try {
departments.add(SearchDepartmentModel(department.name,department.id))
}catch (e:Exception){}
}
}}
private fun createWorkerList(list: List<WorkerFromMistake>){
listWorker.clear()
list.forEach { worker ->
if (!worker.isError){
try {
listWorker.add(worker)
}catch (e:Exception){}
}
}
listWorkerAuxiliary.clear()
listWorkerAuxiliary.addAll(listWorker)
}
}

View File

@ -0,0 +1,90 @@
package es.verdnatura.presentation.view.feature.workermistake.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetWokerMistakeUSerCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
import es.verdnatura.presentation.view.feature.workermistake.model.departmentMistakeList
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class WorkermistakeViewModel (context: Context) : BaseViewModel() {
private val getWorkerMistakeUserCase: GetWokerMistakeUSerCase = GetWokerMistakeUSerCase(context)
private val _mistakeDepartmentList by lazy { MutableLiveData<departmentMistakeList>() }
val mistakeDepartmentList: LiveData<departmentMistakeList>
get() = _mistakeDepartmentList
/* fun mistakeWorker(usuario: String, password: String)
{
getWorkerMistakeUserCase.mistakeType(usuario, password)
.enqueue(object : Callback<List<mistakeWorkerType>>
{
override fun onFailure(call: Call<List<mistakeWorkerType>>, t: Throwable)
{
val listError: ArrayList<mistakeWorkerType> = ArrayList()
listError.add(mistakeWorkerType("0", ""))
_mistakeDepartmentList.value = workerMistakeTypeList(listError)
}
override fun onResponse(
call: Call<List<mistakeWorkerType>>,
response: Response<List<mistakeWorkerType>>
)
{
if (response.body() != null)
{
_mistakeDepartmentList.value = response.body()?.let { workerMistakeTypeList(it) }
} else
{
val listError: ArrayList<mistakeWorkerType> = ArrayList()
listError.add(mistakeWorkerType("0", ""))
_mistakeDepartmentList.value = workerMistakeTypeList(listError)
}
}
})
}*/
fun department_getHasMistake(usuario: String, password: String)
{
getWorkerMistakeUserCase.department_getHasMistake(usuario, password)
.enqueue(object : Callback<List<DepartmentMistake>>
{
override fun onFailure(call: Call<List<DepartmentMistake>>, t: Throwable)
{
val listError: ArrayList<DepartmentMistake> = ArrayList()
listError.add(DepartmentMistake("0", ""))
_mistakeDepartmentList.value = departmentMistakeList(listError)
}
override fun onResponse(
call: Call<List<DepartmentMistake>>,
response: Response<List<DepartmentMistake>>
)
{
if (response.body() != null)
{
_mistakeDepartmentList.value = response.body()?.let { departmentMistakeList(it) }
} else
{
val listError: ArrayList<DepartmentMistake> = ArrayList()
listError.add(DepartmentMistake("0", ""))
_mistakeDepartmentList.value = departmentMistakeList(listError)
}
}
})
}
}

View File

@ -0,0 +1,40 @@
package es.verdnatura.presentation.view.feature.workermistake.model
class MistakeWorkerType (
var id: String = "",
var code:String = "",
var description: String = "",
var isError:Boolean = false,
var errorMessage:String = ""
)
class DepartmentMistake(
var id:String ="",
var name:String="",
var isError:Boolean = false,
var errorMessage:String = ""
)
class WorkerFromMistake(
var id:String="",
var firstName: String="",
var lastName: String="",
var isError:Boolean = false,
var errorMessage:String = ""
)
class workerMistakeTypeList(
var list: List<MistakeWorkerType> = listOf()
)
class departmentMistakeList(
var list: List<DepartmentMistake> = listOf()
)
class workerFromMistakeList(
var list: List<WorkerFromMistake> = listOf()
)

View File

@ -1,7 +1,8 @@
<vector android:height="24dp" <vector
android:height="24dp"
android:viewportHeight="24.0" android:width="24dp"
android:viewportWidth="24.0" android:viewportHeight="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> android:viewportWidth="24"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#F7931E" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/> <path android:fillColor="#F7931E" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
</vector> </vector>

View File

@ -1,5 +1,8 @@
<vector android:height="24dp" android:tint="#FFFFFF" <vector
android:viewportHeight="24.0" android:viewportWidth="24.0" android:height="24dp"
android:tint="#FFFFFF"
android:viewportHeight="24.0"
android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/> <path android:fillColor="#FFFFFF" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
</vector> </vector>

View File

@ -0,0 +1,8 @@
<vector
android:height="24dp"
android:width="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#F7931E" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
</vector>

View File

@ -0,0 +1,8 @@
<!-- drawable/playlist_remove.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#FFF" android:pathData="M2,6V8H14V6H2M2,10V12H11V10H2M14.17,10.76L12.76,12.17L15.59,15L12.76,17.83L14.17,19.24L17,16.41L19.83,19.24L21.24,17.83L18.41,15L21.24,12.17L19.83,10.76L17,13.59L14.17,10.76M2,14V16H11V14H2Z" />
</vector>

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