This commit is contained in:
Enrique Blasco Blanquer 2020-09-16 23:09:44 +02:00
parent 145fad6f5f
commit 321dd9b963
10 changed files with 156 additions and 49 deletions

25
.idea/jarRepositories.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>

View File

@ -2,6 +2,8 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
@ -12,8 +14,8 @@ android {
applicationId "es.verdnatura"
minSdkVersion 21
targetSdkVersion 29
versionCode 32
versionName "5.2.2"
versionCode 34
versionName "5.2.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -78,4 +80,8 @@ dependencies {
implementation "com.github.bumptech.glide:okhttp3-integration:$glide"
kapt "com.github.bumptech.glide:compiler:$glide"
// Add the Firebase Crashlytics SDK.
implementation 'com.google.firebase:firebase-analytics:17.5.0'
implementation 'com.google.firebase:firebase-crashlytics:17.2.1'
}

40
app/google-services.json Normal file
View File

@ -0,0 +1,40 @@
{
"project_info": {
"project_number": "519813071137",
"firebase_url": "https://gestoralmacen-bfa2a.firebaseio.com",
"project_id": "gestoralmacen-bfa2a",
"storage_bucket": "gestoralmacen-bfa2a.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:519813071137:android:3de54686c580a6f79dfe60",
"android_client_info": {
"package_name": "es.verdnatura"
}
},
"oauth_client": [
{
"client_id": "519813071137-5099s9mme9juufnrkm88ajt5n7cmluqh.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyA74wQCwDCpCjWs49lCX5m2SsdqcYb_J8s"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "519813071137-5099s9mme9juufnrkm88ajt5n7cmluqh.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}

View File

@ -8,8 +8,8 @@ import java.util.concurrent.TimeUnit
class ApiUtils {
companion object {
const val BASE_URL:String = "http://192.168.1.33:8009/"
//const val BASE_URL:String = "https://app.verdnatura.es/"
//const val BASE_URL:String = "http://192.168.1.54:8009/"
const val BASE_URL:String = "https://app.verdnatura.es/"
fun getApiService():VerdnaturaService{
val retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)

View File

@ -241,10 +241,11 @@ class ItemCardFragment(
itemcard_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
scroll_view.post(Runnable {
val position:IntArray = IntArray(2)
itemcard_image.getLocationInWindow(position)
scroll_view.scrollTo(0, position[1])
val position = IntArray(2)
if (itemcard_image != null){
itemcard_image.getLocationInWindow(position)
scroll_view.scrollTo(0, position[1])
}
})
}
@ -280,27 +281,34 @@ class ItemCardFragment(
}
private fun prepareItemStockUpdate(itemB:ItemCardRowVO,value:String){
if (itemB.value!!.toInt() > value.toInt()) {
customDialogTwo.setTitle(itemB.title!!).setDescription("Indica la causa de eliminar stock:").setOkButton("Falta"){
try{
if (itemB.value!!.toInt() > value.toInt()) {
customDialogTwo.setTitle(itemB.title!!).setDescription("Indica la causa de eliminar stock:").setOkButton("Falta"){
viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0")
changeOfflineValue(itemB,value, listBarcodes)
customDialogTwo.dismiss()
}.setOkButtonTwo("Basura"){
viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "1")
changeOfflineValue(itemB,value, listBarcodes)
customDialogTwo.dismiss()
}.setKoButton("Cancelar"){
customDialogTwo.dismiss()
}.show()
}else{
changeOfflineValue(itemB,value, listBarcodes)
viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0")
changeOfflineValue(itemB,value, listBarcodes)
customDialogTwo.dismiss()
}.setOkButtonTwo("Basura"){
viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "1")
changeOfflineValue(itemB,value, listBarcodes)
customDialogTwo.dismiss()
}.setKoButton("Cancelar"){
customDialogTwo.dismiss()
}
}catch (e:Exception){
customDialog.setTitle("Error").setDescription("El elemento introducido no es un número").setKoButton("Cancelar"){
customDialog.dismiss()
}.show()
}else{
changeOfflineValue(itemB,value, listBarcodes)
viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0")
}
}
private fun prepareBarcodeDialog(itemB:ItemCardRowVO){

View File

@ -642,7 +642,7 @@ class CollectionFragment(
try {
customDialogList.setTitle("$shelving($item) $total de $longName").setOkButton("Coger") {
if (customDialogList.getValueTwo().isNotEmpty()) {
if (customDialogList.getValue().toInt() > total.toInt()) {
if (customDialogList.getValue().toBigInteger() > total.toBigInteger()) {
"La cantidad supera a la disponible".toast(requireContext())
} else {
if (checkItemScan(customDialogList.getValueTwo())) {
@ -686,23 +686,28 @@ class CollectionFragment(
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (customDialogList.getValueTwo().isNotEmpty()) {
if (customDialogList.getValue().toInt() > total.toInt()) {
"La cantidad supera a la disponible".toast(requireContext())
} else {
if (checkItemScan(customDialogList.getValueTwo())) {
onQuantityOfShelvingSelected(itemShelvingFk)
mpok?.start()
customDialogList.dismiss()
try {
if (customDialogList.getValue().toBigInteger() > total.toBigInteger()) {
"La cantidad supera a la disponible".toast(requireContext())
} else {
itemShelvingFkStored = itemShelvingFk
splash_progress.visibility = View.VISIBLE
viewModel.getIdFromCode(
usuario = user,
password = password,
code = customDialogList.getValueTwo()
)
customDialogList.dismiss()
if (checkItemScan(customDialogList.getValueTwo())) {
onQuantityOfShelvingSelected(itemShelvingFk)
mpok?.start()
customDialogList.dismiss()
} else {
itemShelvingFkStored = itemShelvingFk
splash_progress.visibility = View.VISIBLE
viewModel.getIdFromCode(
usuario = user,
password = password,
code = customDialogList.getValueTwo()
)
customDialogList.dismiss()
}
}
}catch (e:Exception){
}
} else {
@ -737,13 +742,15 @@ class CollectionFragment(
}
private fun checkItemScan(valueToCheck:String):Boolean{
val saleToCheck = sales[storedPosition]
if (saleToCheck.itemFk == valueToCheck)
return true
else{
saleToCheck.Barcodes.forEach { barcode ->
if (barcode == valueToCheck)
return true
if (storedPosition >= 0 && sales.size > storedPosition) {
val saleToCheck = sales[storedPosition]
if (saleToCheck.itemFk == valueToCheck)
return true
else {
saleToCheck.Barcodes.forEach { barcode ->
if (barcode == valueToCheck)
return true
}
}
}
return false
@ -889,7 +896,10 @@ class CollectionFragment(
private fun showDisponibility(){
customDialogInput.setTitle(getString(R.string.Verdisponible)).setDescription(getString(R.string.Escaneaetiqueta)).setOkButton(getString(R.string.Buscar)){
splash_progress.visibility = View.VISIBLE
try{
splash_progress.visibility = View.VISIBLE
}catch (e:Exception){}
hideKeyboards()
viewModel.itemGetAvailable(
usuario = user,

View File

@ -1,5 +1,7 @@
package es.verdnatura.presentation.view.feature.login.activity
import android.view.ViewGroup
import android.widget.Button
import es.verdnatura.R
import es.verdnatura.databinding.ActivityLoginBinding
import es.verdnatura.presentation.base.BaseActivity
@ -12,6 +14,16 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>() {
override fun getLayoutId(): Int = R.layout.activity_login
override fun init() {
/* val crashButton = Button(this)
crashButton.text = "Crash!"
crashButton.setOnClickListener {
throw RuntimeException("Test Crash") // Force a crash
}
addContentView(crashButton, ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT))*/
addFragment(LoginFragment.newInstance(),R.id.main_frame_layout,LoginFragment.TAG)
}

View File

@ -37,6 +37,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding,LoginViewModel> (LoginVi
switch_remember.isChecked = false
saveRemember(false)
}
}
private fun checkUser(){

View File

@ -241,7 +241,10 @@ class UbicadorFragment(
listItems = ArrayList()
var contEtiquetas:Int = 0
it.list.forEach { item ->
contEtiquetas += item.stickers.toInt()
try{
contEtiquetas += item.stickers.toInt()
}catch (e: Exception) {}
parking = item.code.toUpperCase()
listItems.add(item)
}

View File

@ -22,6 +22,8 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files