diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d0fef2d3..6cad8606 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -83,10 +83,20 @@ - + + - + + + + + + + + + + + @@ -209,6 +220,7 @@ + @@ -831,7 +843,6 @@ @@ -911,6 +923,11 @@ 616 diff --git a/app/build.gradle b/app/build.gradle index de732cff..e7e95c63 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,10 +13,11 @@ android { applicationId "es.verdnatura" minSdkVersion 24 //21 targetSdkVersion 33 - versionCode 154 + versionCode 157 //versionName = "9.8Beta" version 148 - //versionName = "23.2Beta" 150 - versionName = "23.2Beta" + //versionName = "23.2Beta" 154 + //versionName = "23.2" 157 + versionName = "23.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -32,9 +33,9 @@ android { getByName("debug") { applicationIdSuffix = ".debug" }*/ - getByName("release") { + /* getByName("release") { applicationIdSuffix = ".sfusion" - } + }*/ } diff --git a/app/google-services.json b/app/google-services.json index 1f9a4fd1..57c27ec5 100644 --- a/app/google-services.json +++ b/app/google-services.json @@ -10,7 +10,7 @@ "client_info": { "mobilesdk_app_id": "1:519813071137:android:3de54686c580a6f79dfe60", "android_client_info": { - "package_name": "es.verdnatura.sfusion" + "package_name": "es.verdnatura" } }, "oauth_client": [ diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index 0f09309e..c9798366 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -4,15 +4,15 @@ "type": "APK", "kind": "Directory" }, - "applicationId": "es.verdnatura.sfusion", + "applicationId": "es.verdnatura", "variantName": "release", "elements": [ { "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 154, - "versionName": "23.2Beta", + "versionCode": 157, + "versionName": "23.2", "outputFile": "app-release.apk" } ], diff --git a/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt b/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt index 5ecef315..ce773840 100644 --- a/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt @@ -166,7 +166,6 @@ abstract class BaseFragment(viewModelCla } - private fun initDataBinding() { binding = DataBindingUtil.bind(requireView())!! binding.lifecycleOwner = viewLifecycleOwner @@ -227,7 +226,7 @@ abstract class BaseFragment(viewModelCla R.drawable.ic_logo_salix -> getString(R.string.accessSalix) R.drawable.ic_eye_ui -> getString(R.string.icViewCollection) R.drawable.ic_collection -> getString(R.string.icViewCollection) - R.drawable.ic_ubicator_check-> getString(R.string.checkerUbication) + R.drawable.ic_ubicator_check -> getString(R.string.checkerUbication) else -> { "" } @@ -501,11 +500,12 @@ abstract class BaseFragment(viewModelCla PRINTERFK -> prefs.getInt(name, 0) USERFK -> prefs.getInt(USERFK, 0) else -> { - 0 + 0 } } } + fun getData(name: String): String { val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) return when (name) { @@ -594,9 +594,15 @@ abstract class BaseFragment(viewModelCla } fun deleteWorkForm(nameWorkForm: String) { + var prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_SERVER, 0) var editor = prefs.edit() - editor.remove(nameWorkForm).commit() + + if (nameWorkForm == "all") { + editor.clear().apply() + } else { + editor.remove(nameWorkForm).commit() + } } @@ -647,7 +653,8 @@ abstract class BaseFragment(viewModelCla urlSalix = "https://test-salix.verdnatura.es/api/" ) ) - + var working_in_test = false + if (working_in_test) { saveWorkForm( WorkForms( "TestLocalhost", @@ -663,14 +670,14 @@ abstract class BaseFragment(viewModelCla urlSalix = "https://test-salix.verdnatura.es/api/" ) ) - saveWorkForm( - WorkForms( - "TestLOCAL", - "http://192.168.1.132:9000", - urlSalix = "http://localhost:3000/api/" + saveWorkForm( + WorkForms( + "TestLOCAL", + "http://192.168.1.132:9000", + urlSalix = "http://localhost:3000/api/" + ) ) - ) - + } saveWorkForm( WorkForms( "Añadir...", @@ -704,11 +711,11 @@ abstract class BaseFragment(viewModelCla editorPref.putString("base_urlSalix", value.toString()) editorPref.commit() } - DEPARTMENTMISTAKEID->{ - editor.putInt(name,value as Int) + DEPARTMENTMISTAKEID -> { + editor.putInt(name, value as Int) } - "SUPPLIERID"->{ - editor.putString(name,value.toString()) + "SUPPLIERID" -> { + editor.putString(name, value.toString()) } else -> { editor.putString(name, value.toString()) diff --git a/app/src/main/java/es/verdnatura/presentation/common/itemScanned.kt b/app/src/main/java/es/verdnatura/presentation/common/itemScanned.kt index 42ee1a46..d783c612 100644 --- a/app/src/main/java/es/verdnatura/presentation/common/itemScanned.kt +++ b/app/src/main/java/es/verdnatura/presentation/common/itemScanned.kt @@ -1,8 +1,34 @@ package es.verdnatura.presentation.common +import android.os.Build +import androidx.annotation.RequiresApi import org.json.JSONObject +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter data class itemScanned(var scanned: JSONObject) { var table: String = scanned.get("table").toString() var id: Int = scanned.get("id").toString().toInt() +} +//Tarea#5109 +@RequiresApi(Build.VERSION_CODES.O) +data class itemScannedAll(var scanned: JSONObject) { + var company: String = scanned.get("company").toString() + var user: Int = scanned.get("user").toString().toInt() + var created: LocalDateTime = LocalDateTime.parse(scanned.get("created").toString(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + var table: String = scanned.get("table").toString() + var id: String = scanned.get("id").toString() + var more: String = scanned.get("more").toString() +} +//Tarea #5109 +private fun itemScanIsQr(value: String): Boolean { + + return try { + itemScanned(JSONObject(value)) + return true + + } catch (Ex: Exception) { + return false + } + } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt index 82b5777a..d73edbb2 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt @@ -73,6 +73,7 @@ class LoginFragment : BaseFragment(LoginVi binding.edittextPassword.setText("nightmare") } // se crean/listan las opciones de formas de trabajo + deleteWorkForm("all") listForms = getWorkForm().sortedBy { it.created } binding.edittextServer.keyListener = null diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt index b355d698..ccfbbd76 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt @@ -119,7 +119,19 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) { ) ) - //Tarea #3754 --> Falta arreglar la colección que se le pasa a ReubicationCollectionFragment + //Tarea_5052 + /* _pasillerositem.add( + PasillerosItemVO( + 1, + R.drawable.ic_shopping_self, + contextApp.getString(R.string.selfConsumption), + R.string.titleSelfConsumption, + contextApp.getString( + R.string.titleSelfConsumption + ) + ) + )*/ + _pasillerositem.add( PasillerosItemVO( 1, @@ -510,7 +522,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) { ) )*/ - val working_in_test=true + val working_in_test=false if (working_in_test){ _pasillerositem.add( PasillerosItemVO( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt index 5110ef13..3f9ee972 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt @@ -114,7 +114,7 @@ class UbicadorFragment( iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp) - //Tarea#5052 binding.mainToolbar.switchButton.visibility = VISIBLE + //Tarea#5052 binding.mainToolbar.switchButton.visibility = VISIBLE binding.mainToolbar.switchButton.setOnCheckedChangeListener { buttonView, isChecked -> if (binding.mainToolbar.toolbarTitle.text == getString(R.string.titleUbicator)) { ma.messageWithSound(getString(R.string.scanShelving), false, false) @@ -218,6 +218,7 @@ class UbicadorFragment( shelvingFk = binding.editMatricula.text.toString() binding.editPrioridad.setText("") binding.splashProgress.visibility = VISIBLE + isShelvinLogfromMainScreen = true viewModel.itemShelvingList( binding.editMatricula.text.toString() ) @@ -514,6 +515,7 @@ class UbicadorFragment( if (isShelvinLogfromMainScreen) { viewModel.shelvinLog_add(shelvingFk) + } if (modeCheckUbication) { listItems.sortedBy { it.isChecked }.forEachIndexed { index, item -> @@ -531,7 +533,7 @@ class UbicadorFragment( } }) responseAddList.observe(viewLifecycleOwner, Observer { - + binding.splashProgress.visibility= GONE if (it.isError) { ma.messageWithSound(it.errorMessage, it.isError, false) @@ -548,10 +550,22 @@ class UbicadorFragment( } else { + viewModel.itemShelvingList(shelvingFk) ma.messageWithSound("", it.isError, true, isToasted = false) } }) + responseLog.observe(viewLifecycleOwner, Observer { + + if (it.isError) { + ma.messageWithSound(it.errorMessage, it.isError, false) + + + } else { + isShelvinLogfromMainScreen = false + + } + }) responseCode.observe(viewLifecycleOwner, Observer { binding.splashProgress.visibility = GONE if (it.isError) { @@ -821,6 +835,7 @@ class UbicadorFragment( .setDescription(getString(R.string.selectDestiny) + item.item).setValue("") .setOkButton(getString(R.string.transfer)) { if (customDialogInput.getValue().isNotEmpty()) { + binding.splashProgress.visibility= VISIBLE viewModel.itemShelvingTransfer( item.id, customDialogInput.getValue() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt index f0afb6a4..021a8eb3 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt @@ -21,9 +21,11 @@ import retrofit2.Response class UbicadorViewModel(val context: Context) : BaseViewModel(context) { private val _shelvingList by lazy { MutableLiveData() } + private val _response by lazy { MutableLiveData() } val response: LiveData get() = _response + private val _responsepriority by lazy { MutableLiveData() } val responsepriority: LiveData get() = _responsepriority @@ -44,6 +46,10 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) { private val _responseAddList by lazy { MutableLiveData() } val responseAddList: LiveData = _responseAddList + private val _responseLog by lazy { MutableLiveData() } + val responseLog: LiveData + get() = _responseLog + fun itemShelvingList( vShelvingFk: String ) { @@ -274,14 +280,14 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) { silex.shelvingLog_add(code) .enqueue(object : SilexCallback(context) { override fun onError(t: Throwable) { - _response.value = ResponseItemVO( + _responseLog.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) ) } override fun onSuccess(response: Response) { - _response.value = + _responseLog.value = ResponseItemVO(isError = false, response = response.message()!!) } diff --git a/app/src/main/res/drawable/ic_shopping_self.xml b/app/src/main/res/drawable/ic_shopping_self.xml new file mode 100644 index 00000000..2c03ef26 --- /dev/null +++ b/app/src/main/res/drawable/ic_shopping_self.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 6932c513..640a51f3 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -527,5 +527,8 @@ Formato expedición no válido Inserta la cantidad correctamente Operación realizada correctamente + Autoconsumo + Autoconsumo + Permite consumo de materiales del almacén diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 388e7f7e..9f4910ea 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -380,6 +380,8 @@ Replacement Consult item Ubicator + Self-autoconsumption + Self-autoconsumption from your warehouse Reubication Add Automatically items to shelving Quality @@ -525,5 +527,6 @@ Expedition format no valid Insert the amount correctly Operación realizada correctamente + Self-consumption