refs #6275 fix: filter getTickets y driver

This commit is contained in:
Sergio De la torre 2024-01-10 09:37:44 +01:00
parent 6a8d702fcf
commit 11fc8ce52e
3 changed files with 65 additions and 79 deletions

View File

@ -127,14 +127,19 @@
</select>
</component>
<component name="ChangeListManager">
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="refs #6276: prepare Salixback">
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="version 24.2Beta">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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/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/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/presentation/base/BaseFragmentSalix.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseFragmentSalix.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferLoadFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferLoadFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapterNew.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapterNew.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/ubicador/adapter/UbicadorAdapter.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/UbicadorAdapter.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/res/layout/fragment_buffer_loadexpedition.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_buffer_loadexpedition.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -501,13 +506,6 @@
<option name="presentableId" value="Default" />
<updated>1618825571576</updated>
</task>
<task id="LOCAL-00178" summary="refs #5652 add dynamic buttons for mermas">
<created>1691048336702</created>
<option name="number" value="00178" />
<option name="presentableId" value="LOCAL-00178" />
<option name="project" value="LOCAL" />
<updated>1691048336702</updated>
</task>
<task id="LOCAL-00179" summary="refs #5996 cmrAdd">
<created>1691481694750</created>
<option name="number" value="00179" />
@ -844,7 +842,14 @@
<option name="project" value="LOCAL" />
<updated>1704786754497</updated>
</task>
<option name="localTasksCounter" value="227" />
<task id="LOCAL-00227" summary="version 24.2Beta">
<created>1704788589871</created>
<option name="number" value="00227" />
<option name="presentableId" value="LOCAL-00227" />
<option name="project" value="LOCAL" />
<updated>1704788589872</updated>
</task>
<option name="localTasksCounter" value="228" />
<servers />
</component>
<component name="Vcs.Log.History.Properties">
@ -945,7 +950,6 @@
</component>
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="refs #5867 sendPDF" />
<MESSAGE value="varios" />
<MESSAGE value="refs #5890" />
<MESSAGE value="refs #5802 ticketSetState" />
@ -970,7 +974,8 @@
<MESSAGE value="refs #5135 feat: refactor animation" />
<MESSAGE value="refs #6275 feat: back to Salix (delivery)" />
<MESSAGE value="refs #6276: prepare Salixback" />
<option name="LAST_COMMIT_MESSAGE" value="refs #6276: prepare Salixback" />
<MESSAGE value="version 24.2Beta" />
<option name="LAST_COMMIT_MESSAGE" value="version 24.2Beta" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>

View File

@ -159,7 +159,7 @@ class RouteLoaded(
class RouteInfo(
@PrimaryKey var id: Long,
@SerializedName(value = "driver", alternate = ["workerUserName"])
var driver: String,
var driver: String?,
var hour: String?,
@TypeConverters(MapTypeConverter::class) var created: Date,
var m3: Double,

View File

@ -113,8 +113,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
override fun onSuccess(response: Response<List<ExpeditionInfoLog>>) {
if (response.body() != null) {
_expeditionInfoList.value =
response.body()?.let { ExpeditionInfoList(it) }
_expeditionInfoList.value = response.body()?.let { ExpeditionInfoList(it) }
} else {
_expeditionInfoList.value = ExpeditionInfoList()
}
@ -203,8 +202,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
.enqueue(object : SalixCallback<List<RouteDelivery>>(context) {
override fun onSuccess(response: Response<List<RouteDelivery>>) {
if (response.body() != null) {
_routeInfoList.value =
response.body()?.let { RouteDeliveryList(it) }
_routeInfoList.value = response.body()?.let { RouteDeliveryList(it) }
}
}
@ -217,29 +215,28 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
}
/* fun expeditionState_add(expeditions: Any?, state: String) {
silex.expeditionState_add(expeditions, state)
.enqueue(object : SilexCallback<Unit>(context) {
override fun onSuccess(response: Response<Unit>) {
_responseStateAdd.value = ResponseItemVO(state, false, "", 0)
}
/* fun expeditionState_add(expeditions: Any?, state: String) {
silex.expeditionState_add(expeditions, state)
.enqueue(object : SilexCallback<Unit>(context) {
override fun onSuccess(response: Response<Unit>) {
_responseStateAdd.value = ResponseItemVO(state, false, "", 0)
}
override fun onError(t: Throwable) {
super.onError(t)
_responseStateAdd.value = ResponseItemVO()
}
override fun onError(t: Throwable) {
super.onError(t)
_responseStateAdd.value = ResponseItemVO()
}
override fun onFailure(call: Call<Unit>, t: Throwable) {
_responseStateList.value = ResponseItemVO("", true, t.message.toString(), 0)
override fun onFailure(call: Call<Unit>, t: Throwable) {
_responseStateList.value = ResponseItemVO("", true, t.message.toString(), 0)
}
})
}*/
}
})
}*/
fun expeditionStateAddSalix(expeditions: Any) {
salix.addExpeditionState(expeditions)
.enqueue(object : SalixCallback<Unit>(context) {
salix.addExpeditionState(expeditions).enqueue(object : SalixCallback<Unit>(context) {
override fun onSuccess(response: Response<Unit>) {
_responseStateAdd.value = ResponseItemVO("", false, "", 0)
}
@ -281,8 +278,8 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
route: Int
) {
//Tarea 6275
salix.routeGetExpeditionSummary(route)
// silex.route_getExpeditionSummary(route)
salix.routeGetExpeditionSummary(route)
// silex.route_getExpeditionSummary(route)
.enqueue(object : SalixCallback<List<ExpeditionInfoSummary>>(context) {
override fun onSuccess(response: Response<List<ExpeditionInfoSummary>>) {
@ -308,14 +305,13 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
) {
//Redmine 6028 falta que le pongan el email y PR
salix.getRoutes()
// silex.getRoutes(workerFk)
// silex.getRoutes(workerFk)
.enqueue(object : SalixCallback<MutableList<RouteInfo>>(context) {
override fun onSuccess(response: Response<MutableList<RouteInfo>>) {
if (response.body() != null) {
_routeList.value =
response.body()?.let { RouteList(it) }
_routeList.value = response.body()?.let { RouteList(it) }
} else {
_routeList.value = RouteList()
}
@ -333,13 +329,10 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
fun getTickets(
routeId: Long
) {
//Tarea 6275
salix.getTickets("""{"id":$routeId}""")
// silex.getTickets(routeId)
salix.getTickets("""{"id":$routeId,"order":["priority","id"]}""")
.enqueue(object : SalixCallback<MutableList<ClientTicketSalix>>(context) {
override fun onSuccess(response: Response<MutableList<ClientTicketSalix>>) {
_clientTicketList.value =
response.body()?.let { ClientTicketList(it) }
_clientTicketList.value = response.body()?.let { ClientTicketList(it) }
}
override fun onError(t: Throwable) {
@ -350,8 +343,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
}
fun driverRouteEmail(
routeId: Long,
email: String
routeId: Long, email: String
) {
salix.driverRouteEmail(id = routeId, hashMapOf("recipient" to email))
.enqueue(object : SilexCallback<Any>(context) {
@ -368,30 +360,29 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
})
}
/* fun addNote(
ticketFk: Int
) {
silex.addNotes(ticketFk)
.enqueue(object : SilexCallback<Any>(context) {
/* fun addNote(
ticketFk: Int
) {
silex.addNotes(ticketFk)
.enqueue(object : SilexCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_responseStateAdd.value = ResponseItemVO()
override fun onSuccess(response: Response<Any>) {
_responseStateAdd.value = ResponseItemVO()
}
}
override fun onError(t: Throwable) {
_responseStateAdd.value = ResponseItemVO()
super.onError(t)
override fun onError(t: Throwable) {
_responseStateAdd.value = ResponseItemVO()
super.onError(t)
}
})
}*/
}
})
}*/
fun routeUpdate(
route: RouteInfo
) {
salix.routeUpdate(route.id, route)
.enqueue(object : SilexCallback<Any>(context) {
salix.routeUpdate(route.id, route).enqueue(object : SilexCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_responseUpdateRoute.value = ResponseItemVO()
@ -407,20 +398,17 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
}
fun addNotes(
listTickets: MutableList<Ticket>,
note: String
listTickets: MutableList<Ticket>, note: String
) {
salix.addNote(
arrayListOf(listTickets[0].Id, note).formatWithQuotes()
)
/* silex.addNotes(
)/* silex.addNotes(
mapOf(
"Tickets" to listTickets.map { it.Id },
"note" to note
)
)*/
.enqueue(object : SalixCallback<Any>(context) {
)*/.enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_response.value =
ResponseItemVO(response = context.getString(R.string.noteAddOk))
@ -448,15 +436,11 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
fun saveSign(filePath: String, mapQuery: Map<String?, String?>) {
val filePart = MultipartBody.Part.createFormData(
"file",
File(filePath).name,
RequestBody.create(
MediaType.parse("image/png"),
File(filePath)
"file", File(filePath).name, RequestBody.create(
MediaType.parse("image/png"), File(filePath)
)
)
salix.saveSign(filePart, mapQuery)
.enqueue(object : SalixCallback<Any>(context) {
salix.saveSign(filePart, mapQuery).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_responseSign.value = ResponseItemVO(filePath, false, "", 0)
@ -466,10 +450,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
//Otro fallo
override fun onError(t: Throwable) {
_responseSign.value = ResponseItemVO(
"",
true,
"Tickets:" + File(filePath).name + "" + t.message.toString(),
0
"", true, "Tickets:" + File(filePath).name + "" + t.message.toString(), 0
)
// super.onError(t)
}