This commit is contained in:
Enrique Blasco 2020-08-07 06:51:51 +02:00
parent 7bc6e93a84
commit 3032f8b721
8 changed files with 85 additions and 17 deletions

View File

@ -12,8 +12,8 @@ android {
applicationId "es.verdnatura"
minSdkVersion 21
targetSdkVersion 29
versionCode 25
versionName "5.1.5"
versionCode 26
versionName "5.1.6"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

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

View File

@ -66,6 +66,13 @@ class CustomDialogThreeButtons (context: Context) : Dialog(context, R.style.Dial
return this
}
fun setOkButtonFour(text: String, onButtonClicked: () -> Unit): CustomDialogThreeButtons {
custom_dialog_button_ok_four.visibility = View.VISIBLE
custom_dialog_button_ok_four.text = text
custom_dialog_button_ok_four.setOnClickListener { onButtonClicked() }
return this
}
fun setOkButtonAdd(text: String, onButtonClicked: () -> Unit): CustomDialogThreeButtons {
custom_dialog_button_add.visibility = View.VISIBLE
custom_dialog_button_add.text = text

View File

@ -920,8 +920,11 @@ class CollectionFragment(
var totalMark = 0
sales.forEach {
if (type == SACADOR){
if (it.isPrepared == "1" || it.isControlled == "1" || it.isPreviousPrepared == "1")
if (it.isPrepared == "1" || it.isControlled == "1" || it.isPreviousPrepared == "1") {
totalMark += 1
}else if (it.quantity == "0"){
totalMark += 1
}
}else if (type == CONTROLADOR){
if (it.isControlled == "1")
totalMark += 1
@ -938,7 +941,7 @@ class CollectionFragment(
//FALTAS / BASURA / SPLIT
private fun showQuantityDialog(position:Int) {
customDialogThreeButtons.setTitle(getString(R.string.Nuevacantidad)).setDescription(getString(R.string.txtnuevacantidad)).setValue("")
customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)).setValue("")
.setOkButton(getString(R.string.Faltas)){
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()){
getString(R.string.Indicanuevacantidad).toast(requireContext())
@ -955,7 +958,16 @@ class CollectionFragment(
scanRequest()
customDialogThreeButtons.dismiss()
}
}.setOkButtonThree("Split"){
}.setOkButtonThree(getString(R.string.Reject)){
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()){
getString(R.string.Indicanuevacantidad).toast(requireContext())
}else{
reject(position,customDialogThreeButtons.getValue())
scanRequest()
customDialogThreeButtons.dismiss()
}
}.setOkButtonFour("Split"){
if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()){
getString(R.string.Indicanuevacantidad).toast(requireContext())
}else{
@ -1064,6 +1076,34 @@ class CollectionFragment(
viewModel.sendChekingPresence(token = token,workerId = sales[position].salePersonFk,message = message)
}
private fun reject(position: Int,quantity:String){
var totalQuantity: Int = 0
try {
totalQuantity = sales[position].quantity.toInt() - quantity.toInt()
}catch (e:Exception){}
viewModel.collectionMissingTrash(
usuario = user,
password = password,
saleFk = sales[position].saleFk,
quantity = totalQuantity.toString(),
warehouseFk = warehouseFk,
type = "reject",
originalQuantity = quantity
)
//sales[position].originalQuantity = quantity
sales[position].quantity = quantity
//sales[position].startQuantity = quantity
saleAdapter!!.notifyDataSetChanged()
if (quantity == "0")
markLine(position,type)
//enviar mensaje a salix
val ticket = "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)"
val message = "Se ha modificado la cantidad original "+sales[position].originalQuantity+" del artículo "+sales[position].itemFk+" a nueva cantidad: "+ sales[position].quantity +" del ticket "+ticket
viewModel.sendChekingPresence(token = token,workerId = sales[position].salePersonFk,message = message)
}
private fun increaseQuantity(position:Int,quantity:String){
viewModel.collectionIncreaseQuantity(
usuario = user,
@ -1080,6 +1120,12 @@ class CollectionFragment(
}*/
}catch (e:Exception){}
saleAdapter?.notifyDataSetChanged()
//enviar mensaje a salix
val ticket = "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)"
val message = "Se ha modificado la cantidad original "+sales[position].originalQuantity+" del artículo "+sales[position].itemFk+" a nueva cantidad: "+ sales[position].quantity +" del ticket "+ticket
viewModel.sendChekingPresence(token = token,workerId = sales[position].salePersonFk,message = message)
}

View File

@ -99,11 +99,11 @@ class LoginFragment : BaseFragment<FragmentLoginBinding,LoginViewModel> (LoginVi
goToMain()
}else{
customDialog.setTitle("Actualizar").setDescription("Existe una versión nueva, es recomendable actualizar.").setOkButton("Actualizar"){
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-pickingV2.apk")
startActivity(openURL)
}.setKoButton("Omitir"){
}.setKoButton("Cancelar"){
customDialog.dismiss()
goToMain()
}.show()

View File

@ -18,8 +18,8 @@
android:id="@+id/custom_dialog_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_margin_3"
android:layout_marginBottom="@dimen/default_layout_margin"
android:layout_marginTop="@dimen/layout_margin_min"
android:layout_marginBottom="@dimen/layout_margin_min"
android:textAlignment="center"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/h6"
@ -63,7 +63,7 @@
android:id="@+id/custom_dialog_button_add"
style="@style/DefaultButton.NormalButtonThree"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/default_layout_margin"
android:layout_marginTop="@dimen/layout_margin_min"
android:visibility="gone"
tools:text="Agregar"
tools:visibility="visible" />
@ -72,7 +72,7 @@
android:id="@+id/custom_dialog_button_ok"
style="@style/DefaultButton.NormalButton"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/default_layout_margin"
android:layout_marginTop="@dimen/layout_margin_1"
android:visibility="gone"
tools:text="Falta"
tools:visibility="visible" />
@ -81,16 +81,25 @@
android:id="@+id/custom_dialog_button_ok_two"
style="@style/DefaultButton.NormalButton"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/default_layout_margin"
android:layout_marginTop="@dimen/layout_margin_1"
android:visibility="gone"
tools:text="Basura"
tools:visibility="visible" />
<Button
android:id="@+id/custom_dialog_button_ok_three"
style="@style/DefaultButton.NormalButton"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/layout_margin_1"
android:visibility="gone"
tools:text="RECHAZO"
tools:visibility="visible"/>
<Button
android:id="@+id/custom_dialog_button_ok_four"
style="@style/DefaultButton.NormalButtonTwo"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/default_layout_margin"
android:layout_marginTop="@dimen/layout_margin_1"
android:visibility="gone"
tools:text="Split"
tools:visibility="visible" />
@ -99,7 +108,7 @@
android:id="@+id/custom_dialog_button_ko"
style="@style/DefaultButton.TransparentButton"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/default_layout_margin"
android:layout_marginTop="@dimen/layout_margin_1"
android:layout_marginBottom="@dimen/default_layout_margin"
android:visibility="gone"
tools:text="Cancelar"

View File

@ -78,9 +78,12 @@
<string name="ArtículoparaTicket">Artículo para Ticket</string>
<string name="Escaneaelcarroparaelitemseleccionado">Escanea el carro para el item seleccionado</string>
<string name="txtnuevacantidad">Indica la nueva cantidad y la acción que quieres realizar con el resto.</string>
<string name="BasuraRechazar">Basura / Rechazar</string>
<string name="BasuraRechazar">Basura</string>
<string name="Indicanuevacantidad">Indica nueva cantidad</string>
<string name="Coleccióncompleta">Colección completa</string>
<string name="Parking">Parking</string>
<string name="ShelvingParking">Shelving Parking</string>
<string name="Reject">Rechazar</string>
<string name="updatemng">Existe una versión nueva, es recomendable actualizar.</string>
<string name="Actualizar">Actualizar</string>
</resources>

View File

@ -77,9 +77,12 @@
<string name="ArtículoparaTicket">Ticket Item</string>
<string name="Escaneaelcarroparaelitemseleccionado">Scan the cart for the selected item</string>
<string name="txtnuevacantidad">Indicate the new quantity and the action you want to take with the rest.</string>
<string name="BasuraRechazar">Garbage / Reject</string>
<string name="BasuraRechazar">Garbage</string>
<string name="Indicanuevacantidad">Indicates new quantity</string>
<string name="Coleccióncompleta">Complete collection</string>
<string name="Parking">Parking</string>
<string name="ShelvingParking">Shelving Parking</string>
<string name="Reject">Reject</string>
<string name="updatemng">There is a new version, it is recommended to update.</string>
<string name="Actualizar">Update</string>
</resources>