refs #6460 fix:date

This commit is contained in:
Sergio De la torre 2023-12-11 16:44:20 +01:00
parent b13d6388f5
commit 3b8f06a3ba
23 changed files with 305 additions and 148 deletions

View File

@ -127,19 +127,31 @@
</select>
</component>
<component name="ChangeListManager">
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="refs #6275 modify call">
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="refs #6460 fix:date">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/beta/release/output-metadata.json" beforeDir="false" afterPath="$PROJECT_DIR$/app/beta/release/output-metadata.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/app/build.gradle" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/Extensions.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/Extensions.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixCallback.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixCallback.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixService.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixService.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SilexCallback.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SilexCallback.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values-es/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values-es/strings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values-fr/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values-fr/strings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values-pt/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values-pt/strings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/model/ItemLocationVO.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/model/ItemLocationVO.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPickerNew.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPickerNew.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/adapters/ExpeditionLogAdapter.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/adapters/ExpeditionLogAdapter.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/InfoCompany.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/InfoCompany.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/viewmodels/DeliveryViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/viewmodels/DeliveryViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/model/ItemShelvingSaleDate.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/model/ItemShelvingSaleDate.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/fragment/HistoricoArticuloFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/fragment/HistoricoArticuloFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelving/fragment/ItemShelvingLogViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelving/fragment/ItemShelvingLogViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelving/model/ItemShelvingLog.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelving/model/ItemShelvingLog.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/fragment/HistoricoVehiculoViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/fragment/HistoricoVehiculoViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/model/ItemHistoricoVehiculo.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/model/ItemHistoricoVehiculo.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -498,20 +510,6 @@
<option name="presentableId" value="Default" />
<updated>1618825571576</updated>
</task>
<task id="LOCAL-00167" summary="refs #5613 renew token">
<created>1688103597824</created>
<option name="number" value="00167" />
<option name="presentableId" value="LOCAL-00167" />
<option name="project" value="LOCAL" />
<updated>1688103597825</updated>
</task>
<task id="LOCAL-00168" summary="refs #5891">
<created>1688360978709</created>
<option name="number" value="00168" />
<option name="presentableId" value="LOCAL-00168" />
<option name="project" value="LOCAL" />
<updated>1688360978709</updated>
</task>
<task id="LOCAL-00169" summary="versionBeta 23.28 renovarToken">
<created>1689163182438</created>
<option name="number" value="00169" />
@ -841,7 +839,21 @@
<option name="project" value="LOCAL" />
<updated>1701432170349</updated>
</task>
<option name="localTasksCounter" value="216" />
<task id="LOCAL-00216" summary="refs #6004 add:saveData">
<created>1701936286579</created>
<option name="number" value="00216" />
<option name="presentableId" value="LOCAL-00216" />
<option name="project" value="LOCAL" />
<updated>1701936286580</updated>
</task>
<task id="LOCAL-00217" summary="refs #6460 fix:date">
<created>1701936308931</created>
<option name="number" value="00217" />
<option name="presentableId" value="LOCAL-00217" />
<option name="project" value="LOCAL" />
<updated>1701936308933</updated>
</task>
<option name="localTasksCounter" value="218" />
<servers />
</component>
<component name="Vcs.Log.History.Properties">
@ -942,8 +954,6 @@
</component>
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="refs #5890 newSacador" />
<MESSAGE value="refs #4815 ajustesSerial" />
<MESSAGE value="version 23.40Beta" />
<MESSAGE value="refs #5652" />
<MESSAGE value="strings" />
@ -967,7 +977,9 @@
<MESSAGE value="refs #6460" />
<MESSAGE value="version 23.48Beta" />
<MESSAGE value="refs #6275 modify call" />
<option name="LAST_COMMIT_MESSAGE" value="refs #6275 modify call" />
<MESSAGE value="refs #6004 add:saveData" />
<MESSAGE value="refs #6460 fix:date" />
<option name="LAST_COMMIT_MESSAGE" value="refs #6460 fix:date" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>

View File

@ -11,7 +11,7 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 239,
"versionCode": 242,
"versionName": "23.48Beta",
"outputFile": "app-beta-release.apk"
}

View File

@ -13,7 +13,7 @@ android {
applicationId "es.verdnatura"
minSdkVersion 24 //21
targetSdkVersion 33
versionCode 240
versionCode 242
versionName = "23.48Beta"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -8,6 +8,8 @@ import android.widget.EditText
import android.widget.Toast
import androidx.annotation.RequiresApi
import java.text.SimpleDateFormat
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import java.util.Date
import java.util.Locale
@ -48,9 +50,19 @@ fun toDateString(date: Date): String {
return format.format(date)
}
fun String?.isoToString(): String {
@RequiresApi(Build.VERSION_CODES.O)
fun String?.isoToString(returnOnlyDate: Boolean = false): String {
return if (!this.isNullOrEmpty() && this!!.contains("T")) {
this.replace("T", " ").substring(0, 10)
val utcZonedDateTime = ZonedDateTime.parse(this, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
val myDate = utcZonedDateTime.withZoneSameInstant(ZonedDateTime.now().zone)
.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
if (returnOnlyDate) {
(myDate.format(DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"))).replace("T", " ")
.substring(0, 10)
} else {
(myDate.format(DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"))).replace("T", " ")
}
} else if (!this.isNullOrEmpty() && !this!!.contains("T")) {
this
} else {

View File

@ -34,10 +34,9 @@ abstract class SalixCallback<T>(val context: Context) : Callback<T> {
onError(Error(response.message().toString()))
}
} else {
var myError = errorSalixMessage(response)
println("ErrorSalix:$myError")
//defaultErrorHandler(t)
onError(Error(errorSalixMessage(response)))
// onError(Error(response.message().toString()))
}
} catch (t: Throwable) {
defaultErrorHandler(t)

View File

@ -95,6 +95,7 @@ interface SalixService {
@GET("Buyers")
fun getBuyers(
@Query("filter") filter:String
): Call<List<BuyerVO>>
@POST("Applications/{routine}/execute-func")
@ -136,6 +137,18 @@ interface SalixService {
@Query("params") params: Any? = null
): Call<Any>
@POST("Applications/collection_addWithReservation/execute-proc")
fun collectionAddWithReservation(
@Query("schema") schema: String = "vn",
@Query("params") params: Any? = null
): Call<Any>
@POST("Applications/collection_get/execute-proc")
fun collectionGet(
@Query("schema") schema: String = "vn",
@Query("params") params: Any? = null
): Call<CollectionVO>
@GET("Routes/getExpeditionSummary")
fun routeGetExpeditionSummary(
@Query("routeFk") params: Int,
@ -259,6 +272,12 @@ interface SalixService {
@Query("schema") schema: String = "vn"
): Call<Unit>
@POST("Applications/itemShelvingSale_unpicked/execute-proc")
fun itemShelvingSaleUnpicked(
@Query("params") params: Any? = null,
@Query("schema") schema: String = "vn"
): Call<Unit>
@POST("Applications/setParking/execute-proc")
fun setParking(
@Query("params") params: Any? = null,
@ -707,6 +726,7 @@ interface SalixService {
@Body params: Any
): Call<Any>
@PATCH("ItemShelvingSales/{id}")
fun itemShelvingsReservedUpdate(
@Path("id") id: Number,

View File

@ -257,6 +257,8 @@ class AjustesFragment :
it.list.forEach {
listSectores.add(it.description)
}
// modificar
listSectores.sort()
val array = arrayOfNulls<String>(listSectores.size)
sectorListVO = it.list
showDialogSector(listSectores.toArray(array))
@ -452,8 +454,6 @@ class AjustesFragment :
private fun showDialogSector(array: Array<String>) {
val builder = AlertDialog.Builder(this.context)
builder.setTitle(getString(R.string.Seleccionaunsector))
builder.setItems(array) { _, which ->
val selected = array[which]

View File

@ -83,18 +83,34 @@ class BuscarItemFragment(
event.getContentIfNotHandled().notNull {
binding.splashProgress.visibility = GONE
adapter = LocationAdapter(it.list, pasillerosItemClickListener!!)
binding.locationRecyclerview.adapter = adapter
binding.locationRecyclerview.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
var totalVisible = 0
it.list.forEach {
totalVisible += it.visible
if (it.list.isNotEmpty()) {
if (it.list[0].isError) {
ma.messageWithSound(
it.list[0].errorMessage,
true,
true,
it.list[0].errorMessage
)
}
} else {
adapter = LocationAdapter(it.list, pasillerosItemClickListener!!)
binding.locationRecyclerview.adapter = adapter
binding.locationRecyclerview.layoutManager =
LinearLayoutManager(
requireContext(),
LinearLayoutManager.VERTICAL,
false
)
var totalVisible = 0
it.list.forEach {
totalVisible += it.visible
}
binding.mainToolbar.toolbarTitle.text =
getString(R.string.item) + itemFk + " " + getString(R.string.visibleTotal) + totalVisible
}
binding.mainToolbar.toolbarTitle.text =
getString(R.string.item) + itemFk + " " + getString(R.string.visibleTotal) + totalVisible
}
})
}

View File

@ -1,10 +1,13 @@
package es.verdnatura.presentation.view.feature.buscaritem.fragment
import android.content.Context
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.SilexCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
@ -23,13 +26,14 @@ class BuscarItemViewModel(val context: Context) : BaseViewModel(context) {
fun itemshelvingGetInfo(itemFk: Any) {
//salix falla fecha
silex.searchItemsUbicador(itemFk)
// salix.itemshelvingGetInfo(params = arrayListOf(itemFk).formatWithQuotes())
.enqueue(object : SalixCallback<List<ItemLocationVO>>(context) {
// silex.searchItemsUbicador(itemFk)
salix.itemshelvingGetInfo(params = arrayListOf(itemFk).formatWithQuotes())
.enqueue(object : SilexCallback<List<ItemLocationVO>>(context) {
override fun onSuccess(response: Response<List<ItemLocationVO>>) {
_locationList.value = response.body()?.let { LocationListVO(it) }
}
@RequiresApi(Build.VERSION_CODES.O)
override fun onError(t: Throwable) {
val listError: ArrayList<ItemLocationVO> = ArrayList()
listError.add(

View File

@ -1,19 +1,28 @@
package es.verdnatura.presentation.view.feature.buscaritem.model
import android.os.Build
import androidx.annotation.RequiresApi
import es.verdnatura.domain.isoToString
class ItemLocationVO (
var Parking:String = "",
var Matricula:String = "",
var visible:Int = 0,
//var Disponible:Int = 0,
//var level:String = "",
var created:String = "",
var itemFk:Int = 0,
val isError : Boolean = false,
var errorMessage : String = "",
var priority:Int = 0
)
class ItemLocationVO @RequiresApi(Build.VERSION_CODES.O) constructor(
var Parking: String = "",
var Matricula: String = "",
var visible: Int = 0,
var itemFk: Int = 0,
val isError: Boolean = false,
var errorMessage: String = "",
var priority: Int = 0
class LocationListVO (
var list: List<ItemLocationVO> = listOf()
) {
@RequiresApi(Build.VERSION_CODES.O)
var created: String = ""
@RequiresApi(Build.VERSION_CODES.O)
get(){
return field.isoToString()
}
}
class LocationListVO(
var list: List<ItemLocationVO> = listOf()
)

View File

@ -84,6 +84,14 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val responseConfirmReservedItemShelvingSale: LiveData<ResponseItemVO>
get() = _responseConfirmReservedItemShelvingSale
private val _responseItemShelvingSale by lazy { MutableLiveData<ResponseItemVO>() }
val responseItemShelvingSale: LiveData<ResponseItemVO>
get() = _responseItemShelvingSale
private val _responseCollectionAddItem by lazy { MutableLiveData<ResponseItemVO>() }
val responseCollectionAddItem: LiveData<ResponseItemVO>
get() = responseCollectionAddItem
private val _responseConfirmReservedUpdate by lazy { MutableLiveData<ResponseItemVO>() }
val responseConfirmReservedUpdate: LiveData<ResponseItemVO>
get() = _responseConfirmReservedUpdate
@ -256,37 +264,39 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
print: String,
type: String
) {
silex.collection_get(
collectionFk,
sectorFk,
print,
type
).enqueue(object :
SilexCallback<CollectionVO>(context) {
override fun onError(t: Throwable) {
_collectionTicketList.value = CollectionVO(
0,
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<CollectionVO>) {
if (response.body() != null) {
_collectionTicketList.value = response.body()?.let { it.map(contextApp) }
} else {
//Falta back de Salix
// salix.collectionGet(params = arrayListOf(collectionFk, sectorFk, print, type).formatWithQuotes())
silex.collection_get(
collectionFk,
sectorFk,
print,
type)
.enqueue(object :
SalixCallback<CollectionVO>(context) {
override fun onError(t: Throwable) {
_collectionTicketList.value = CollectionVO(
0,
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
}
})
override fun onSuccess(response: Response<CollectionVO>) {
if (response.body() != null) {
_collectionTicketList.value = response.body()?.let { it.map(contextApp) }
} else {
_collectionTicketList.value = CollectionVO(
0,
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
}
}
})
}
fun saleTrackingReplace(
@ -394,6 +404,29 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
})
}
fun collectionAddWithReservation(
item: Int,
quantity: Int,
ticketSelected: Int
) {
salix.collectionAddWithReservation(
params = arrayListOf(item, quantity, ticketSelected)
).enqueue(object : SilexCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_responseCollectionAddItem.value =
ResponseItemVO(isError = false, response = "")
}
override fun onError(t: Throwable) {
_responseCollectionAddItem.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
})
}
fun confirmItemShelvingReservedUpdate(
itemShelvingSaleFk: Int,
isPicked: Boolean
@ -520,6 +553,27 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
})
}
fun itemShelvingSaleUnpicked(
itemShelvingSaleFk: Int
) {
salix.itemShelvingSaleUnpicked(
arrayListOf(
itemShelvingSaleFk
)
).enqueue(object : SalixCallback<Unit>(context) {
override fun onError(t: Throwable) {
_responseItemShelvingSale.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Unit>) {
_responseItemShelvingSale.value = ResponseItemVO(isError = false)
}
})
}
fun saleTrackingAddPreparedSaleGroup(
saleGroupFk: Int
) {
@ -527,16 +581,16 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
arrayListOf(
saleGroupFk
)
).enqueue(object : SilexCallback<Unit>(context) {
).enqueue(object : SalixCallback<Unit>(context) {
override fun onError(t: Throwable) {
_responseSaleGroup.value = ResponseItemVO(
_responseItemShelvingSale.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Unit>) {
_responseSaleGroup.value = ResponseItemVO(isError = false)
_responseItemShelvingSale.value = ResponseItemVO(isError = false)
}
})
}

View File

@ -1,10 +1,11 @@
package es.verdnatura.presentation.view.feature.delivery.adapters
import android.os.Build
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemExpeditionlogRowBinding
import es.verdnatura.domain.isoToString
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLog
@ -25,6 +26,7 @@ class ExpeditionLogAdapter(
override fun getItemCount() = items.size
@RequiresApi(Build.VERSION_CODES.O)
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
}
@ -33,9 +35,9 @@ class ExpeditionLogAdapter(
val binding: ItemExpeditionlogRowBinding
) : RecyclerView.ViewHolder(binding.root) {
private val res = binding.root.context.resources
@RequiresApi(Build.VERSION_CODES.O)
fun bind(item: ExpeditionInfoLog) {
binding.apply {
item.created = item.created.isoToString()
this.item = item
}
}

View File

@ -13,7 +13,6 @@ import androidx.annotation.RequiresApi
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentExpeditionLogDeliveryBinding
import es.verdnatura.domain.isoToString
import es.verdnatura.domain.toInt
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
@ -200,7 +199,6 @@ class LogExpeditionFragment(
binding.routeLayout.visibility = View.VISIBLE
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
binding.route.text = routeDelivery.ticket.routeFk.toString()
binding.date.text = routeDelivery.ticket.route.created.isoToString()
binding.agency.text = routeDelivery.ticket.route.agencyMode.agency.name ?: ""
binding.scanInput.setText("")
}

View File

@ -1,10 +1,13 @@
package es.verdnatura.presentation.view.feature.delivery.model
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.room.Entity
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.google.gson.annotations.SerializedName
import es.verdnatura.db.MapTypeConverter
import es.verdnatura.domain.isoToString
import java.io.Serializable
import java.text.SimpleDateFormat
import java.util.Date
@ -42,10 +45,15 @@ class ExpeditionInfoList(
data class ExpeditionInfoLog(
var state: String,
var name: String,
var created: String,
//var created: String,
var routeSalix: RouteSalix
)
) {
var created: String = ""
@RequiresApi(Build.VERSION_CODES.O)
get() {
return field.isoToString()
}
}
class RouteDeliveryList(
var list: List<RouteDelivery> = listOf()
)
@ -72,11 +80,18 @@ class TicketSalix(
class RouteDelivery(
var id: Int,
var created: String,
//var created: String,
var name: String?,
var ticket: TicketSalix,
)
) {
var created: String = ""
@RequiresApi(Build.VERSION_CODES.O)
get(){
return field.isoToString(returnOnlyDate = true)
}
}
class
Expedition(

View File

@ -106,33 +106,12 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
expedition: Int
) {
salix.getExpeditionStates(
"""{
"where": {
"expeditionFk": $expedition
},
"include": [
{
"relation": "expeditionStateType",
"scope": {
"fields": [
"id",
"description"
]
}
}
],
"fields": {
"id": true,
"created": true,
"typeFk": true
}
}""".trim()
"""{"where": {"expeditionFk": $expedition},"include": [{"relation": "expeditionStateType","scope": {"fields": ["id","description"]}}],"fields": {"id": true,"created": true,"typeFk": true}}"""
)
// silex.expedition_getLog(expedition)
.enqueue(object : SilexCallback<List<ExpeditionInfoLog>>(context) {
.enqueue(object : SalixCallback<List<ExpeditionInfoLog>>(context) {
override fun onSuccess(response: Response<List<ExpeditionInfoLog>>) {
if (response.body() != null) {
_expeditionInfoList.value =
response.body()?.let { ExpeditionInfoList(it) }
@ -304,7 +283,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
) {
//Tarea 6275
//salix.routeGetExpeditionSummary(route)
silex.route_getExpeditionSummary(route)
silex.route_getExpeditionSummary(route)
.enqueue(object : SalixCallback<List<ExpeditionInfoSummary>>(context) {
override fun onSuccess(response: Response<List<ExpeditionInfoSummary>>) {
@ -381,6 +360,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
_response.value = ResponseItemVO(context.getString(R.string.sendRouteOk))
}
override fun onError(t: Throwable) {
_response.value = ResponseItemVO()
super.onError(t)
@ -477,7 +457,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
)
)
salix.saveSign(filePart, mapQuery)
.enqueue(object : SilexCallback<Any>(context) {
.enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_responseSign.value = ResponseItemVO(filePath, false, "", 0)

View File

@ -30,8 +30,8 @@ class DayOfSaleViewModel(val context: Context) : BaseViewModel(context) {
fun itemShelvingGetSaleDate(vShelvingFK: String) {
//salix falla fecha
silex.itemShelving_getSaleDate(vShelvingFK)
// salix.itemShelvingGetSaleDate(params = listOf(vShelvingFK).formatWithQuotes())
// silex.itemShelving_getSaleDate(vShelvingFK)
salix.itemShelvingGetSaleDate(params = listOf(vShelvingFK).formatWithQuotes())
.enqueue(object :
SalixCallback<List<ItemShelvingSaleDate>>(context) {
override fun onError(t: Throwable) {

View File

@ -1,16 +1,26 @@
package es.verdnatura.presentation.view.feature.diadeventa.model
import android.os.Build
import androidx.annotation.RequiresApi
import es.verdnatura.domain.isoToString
class ItemShelvingSaleDate (
class ItemShelvingSaleDate (
var itemFk:Int? = null,
var longName:String? = null,
var dated:String? = null,
// var dated:String? = null,
var amount:Int? = null,
var visible:Int? = null,
var stock:Int? = null,
var isError:Boolean = false,
var errorMessage:String = ""
)
) {
var dated: String = ""
@RequiresApi(Build.VERSION_CODES.O)
get(){
return field.isoToString(returnOnlyDate = true)
}
}
class ItemShelvingSaleDateList(
var list:List<ItemShelvingSaleDate> = listOf()

View File

@ -4,6 +4,7 @@ import android.graphics.drawable.Drawable
import android.os.Build
import android.view.View
import android.widget.ImageView
import androidx.annotation.RequiresApi
import androidx.core.content.ContextCompat.getColor
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
@ -11,7 +12,6 @@ import es.verdnatura.R
import es.verdnatura.R.color.verdnatura_pumpkin_orange
import es.verdnatura.R.color.verdnatura_white
import es.verdnatura.databinding.FragmentHistoricoBinding
import es.verdnatura.domain.isoToString
import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnOptionsSelectedListener
@ -150,6 +150,7 @@ class HistoricoArticuloFragment(
}
@RequiresApi(Build.VERSION_CODES.O)
override fun observeViewModel() {
with(viewModel) {
loadHistoricoList.observe(viewLifecycleOwner, Observer { event ->
@ -164,14 +165,12 @@ class HistoricoArticuloFragment(
}
}
@RequiresApi(Build.VERSION_CODES.O)
private fun listToAdapter(lista: List<ItemHistoricoVO>, filter: String) {
listHistoric.clear()
listHistoryAux.clear()
lista.forEach {
if (it.shipped != null) {
it.shipped = it.shipped!!.isoToString()
}
if (filter.equals("all")) {
listHistoric.add(it)
} else {

View File

@ -5,6 +5,7 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.SilexCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
@ -23,8 +24,8 @@ class ItemShelvingLogViewModel(val context: Context) : BaseViewModel(context) {
fun itemShelvingLogGet(vShelvingFK: String) {
//salix falla fecha
silex.itemShelvingLog_get(vShelvingFK)
// salix.itemShelvingLogGet(params = listOf(vShelvingFK).formatWithQuotes())
//silex.itemShelvingLog_get(vShelvingFK)
salix.itemShelvingLogGet(params = listOf(vShelvingFK).formatWithQuotes())
.enqueue(object :
SilexCallback<List<ItemShelvingLog>>(context) {
override fun onSuccess(response: Response<List<ItemShelvingLog>>) {

View File

@ -1,6 +1,8 @@
package es.verdnatura.presentation.view.feature.historicoshelving.model
import android.os.Build
import androidx.annotation.RequiresApi
import es.verdnatura.domain.isoToString
class ItemShelvingLog(
var itemFk:Int? = null,
@ -8,11 +10,19 @@ class ItemShelvingLog(
var shelvingFk:String? = null,
var visible:Int? = null,
var accion:String? = null,
var created:String? = null,
//var created:String? = null,
var code:String? = null,
var isError:Boolean = false,
var errorMessage:String = ""
)
){
@RequiresApi(Build.VERSION_CODES.O)
var created: String = ""
@RequiresApi(Build.VERSION_CODES.O)
get(){
return field.isoToString(returnOnlyDate = true)
}
}
class ItemShelvingSaleDateList(
var list:List<ItemShelvingLog> = listOf())

View File

@ -4,6 +4,7 @@ import android.content.Context
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
@ -19,8 +20,8 @@ class HistoricoVehiculoViewModel(var context: Context) : BaseViewModel(context)
fun machineWorkeGetHistorical(plateNumber: String, workerId:Int) {
//salix falla fecha
silex.machineWorker_getHistorical(plateNumber,workerId)
//salix.machineWorkerGetHistorical(arrayListOf(plateNumber,workerId).formatWithQuotes())
//silex.machineWorker_getHistorical(plateNumber,workerId)
salix.machineWorkerGetHistorical(arrayListOf(plateNumber,workerId).formatWithQuotes())
.enqueue(object :
SalixCallback<List<ItemHistoricoVehiculo>>(context) {
override fun onSuccess(response: Response<List<ItemHistoricoVehiculo>>) {

View File

@ -1,13 +1,28 @@
package es.verdnatura.presentation.view.feature.historicovehiculo.model
import android.os.Build
import androidx.annotation.RequiresApi
import es.verdnatura.domain.isoToString
class ItemHistoricoVehiculo(
var inTimed: String? = null,
//var inTimed: String? = null,
var workerName: String? = null,
var outTimed: String? = null,
//var outTimed: String? = null,
var isError: Boolean = false,
var errorMessage: String = ""
)
) {
var inTimed: String = ""
@RequiresApi(Build.VERSION_CODES.O)
get(){
return field.isoToString()
}
var outTimed: String = ""
@RequiresApi(Build.VERSION_CODES.O)
get(){
return field.isoToString()
}
}
class ItemHistoricoVehiculoList(
var list: List<ItemHistoricoVehiculo> = listOf()

View File

@ -79,7 +79,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
//sergio para obtener comprador
fun itemShelvingBuyerGet() {
salix.getBuyers().enqueue(object :
salix.getBuyers("""{"order":"nickname"}""").enqueue(object :
SilexCallback<List<BuyerVO>>(context) {
override fun onError(t: Throwable) {
val listError: ArrayList<BuyerVO> = ArrayList()