refs #5509 upload entry photo endpoint

This commit is contained in:
Alexandre Riera 2023-06-01 14:42:20 +02:00
parent 5cb66d89d1
commit 2b112b51e6
4 changed files with 44 additions and 3 deletions

View File

@ -9,11 +9,11 @@ import es.verdnatura.presentation.view.feature.collection.listSaleSalix
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
import es.verdnatura.presentation.view.feature.login.model.SalixGrupo import es.verdnatura.presentation.view.feature.login.model.SalixGrupo
import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO
import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix
import es.verdnatura.presentation.view.feature.packaging.model.Supplier import es.verdnatura.presentation.view.feature.packaging.model.Supplier
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
import okhttp3.MultipartBody
import retrofit2.Call import retrofit2.Call
import retrofit2.http.* import retrofit2.http.*
@ -59,6 +59,20 @@ interface SalixService {
): ):
Call<Any> Call<Any>
@Multipart
@POST("Entries/{id}/uploadFile")
fun uploadEntryPhoto(
@Path("id") id: Number,
@Query("warehouseId") warehouseId: Number,
@Query("companyId") companyId: Number,
@Query("dmsTypeId") dmsTypeId: Number,
@Query("reference") reference: String,
@Query("description") description: String,
@Query("hasFile") hasFile: Boolean,
@Part file: MultipartBody.Part,
):
Call<Any>
@POST("tickets/{idTicket}/transferSales") //-->saleMove en Silex @POST("tickets/{idTicket}/transferSales") //-->saleMove en Silex
fun transferSalesSalix( fun transferSalesSalix(

View File

@ -9,6 +9,7 @@ import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.packaging.model.* import es.verdnatura.presentation.view.feature.packaging.model.*
import okhttp3.MultipartBody
import retrofit2.Call import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
import retrofit2.Response import retrofit2.Response
@ -134,4 +135,9 @@ class PackagingViewModel(val context: Context) : BaseViewModel(context) {
} }
}) })
} }
fun entry_uploadPhotoSalix(id: Number, warehouseId: Number, companyId: Number, dmsTypeId: Number, reference: String, description: String, hasFile: Boolean, file: MultipartBody.Part) {
salix.uploadEntryPhoto(id, warehouseId, companyId, dmsTypeId, reference, description, hasFile, file)
.enqueue(object : SilexCallback<Any>(context){})
}
} }

View File

@ -14,6 +14,10 @@ import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix
import es.verdnatura.presentation.view.feature.packaging.model.Supplier import es.verdnatura.presentation.view.feature.packaging.model.Supplier
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import ir.mirrajabi.searchdialog.SimpleSearchDialogCompat import ir.mirrajabi.searchdialog.SimpleSearchDialogCompat
import okhttp3.MediaType
import okhttp3.MultipartBody
import okhttp3.RequestBody
import java.io.File
@Suppress("UNUSED_ANONYMOUS_PARAMETER") @Suppress("UNUSED_ANONYMOUS_PARAMETER")
@ -46,6 +50,23 @@ class SupplierFragment(
viewModel.getSuppliers( viewModel.getSuppliers(
) )
/*val file = File(data.getSign())
val filePart = MultipartBody.Part.createFormData(
"file",
file.getName(),
RequestBody.create(MediaType.parse("image/png"), file)
)
viewModel.entry_uploadPhotoSalix(
1,
1,
442,
21,
"1",
"Example description",
false,
file = filePart
)*/
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }

View File

@ -512,7 +512,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
)*/ )*/
//#tarea4021 //#tarea4021
/* _pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
6, 6,
R.drawable.ic_packaging, R.drawable.ic_packaging,
@ -520,7 +520,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
R.string.titlePackaging, R.string.titlePackaging,
contextApp.getString(R.string.titlePackagingDescrip) contextApp.getString(R.string.titlePackagingDescrip)
) )
)*/ )
val working_in_test=false val working_in_test=false
if (working_in_test){ if (working_in_test){