Merge branch 'testBeta' of https://gitea.verdnatura.es/verdnatura/vn-warehouse into testBeta
Conflicts: app/src/main/java/es/verdnatura/presentation/view/feature/packaging/fragment/PackagingViewModel/SupplierViewModel.kt app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt
This commit is contained in:
commit
e2f8e1e0a5
|
@ -60,6 +60,28 @@ interface SalixService {
|
|||
):
|
||||
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("Entries/{id}/addFromBuy")
|
||||
fun addFromBuy(
|
||||
@Path("id") id: Number,
|
||||
@Query("item") item: Number,
|
||||
@Query("printedStickers") printedStickers: Number
|
||||
):
|
||||
Call<Any>
|
||||
|
||||
|
||||
@POST("tickets/{idTicket}/transferSales") //-->saleMove en Silex
|
||||
fun transferSalesSalix(
|
||||
|
|
|
@ -9,6 +9,9 @@ import es.verdnatura.presentation.base.getMessageFromAllResponse
|
|||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.packaging.model.*
|
||||
import okhttp3.MultipartBody
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class PackagingViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
@ -102,74 +105,10 @@ class PackagingViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun supplier_getItemsSalix(supplierFk: Int, entryFk: Int) {
|
||||
|
||||
salix.getItemsPackaging(supplierFk, entryFk)
|
||||
.enqueue(object : SilexCallback<List<ItemSupplier>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<ItemSupplier> = ArrayList()
|
||||
listError.add(
|
||||
ItemSupplier(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
t.message!!
|
||||
)
|
||||
)
|
||||
)
|
||||
_itemSupplierList.value = itemSupplierList(listError)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<List<ItemSupplier>>) {
|
||||
if (response.body() != null) {
|
||||
_itemSupplierList.value =
|
||||
response.body()?.let { itemSupplierList(it) }
|
||||
} else {
|
||||
val listError: ArrayList<ItemSupplier> = ArrayList()
|
||||
listError.add(ItemSupplier(null, null))
|
||||
_itemSupplierList.value = itemSupplierList(listError)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/*fun entry_addSalix(entry: EntrySalix) {
|
||||
fun entry_addSalix(entry: EntrySalix) {
|
||||
salix.Entries(entry = entry)
|
||||
.enqueue(object :
|
||||
SilexCallback<EntrySalix>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_entry.value = EntrySalix(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
t.message!!
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<EntrySalix>) {
|
||||
if (response.body() != null) {
|
||||
_entry.value = response.body()
|
||||
} else {
|
||||
_entry.value = EntrySalix(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}*/
|
||||
|
||||
fun addFromPackaging(supplier: Int, isTravelReception: Boolean) {
|
||||
salix.addFromPackaging(supplier = supplier, isTravelReception = isTravelReception)
|
||||
.enqueue(object :
|
||||
SilexCallback<EntrySalix>(context) {
|
||||
SilexCallback<EntrySalix> (context){
|
||||
override fun onError(t: Throwable) {
|
||||
_entry.value = EntrySalix(
|
||||
isError = true,
|
||||
|
@ -197,4 +136,13 @@ 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){})
|
||||
}
|
||||
|
||||
fun entry_addFromBuy(id: Number, item: Number, printedStickers: Number) {
|
||||
salix.addFromBuy(id, item, printedStickers)
|
||||
.enqueue(object : SilexCallback<Any>(context){})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.pasillero.model.PasillerosItemVO
|
||||
import ir.mirrajabi.searchdialog.SimpleSearchDialogCompat
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.MultipartBody
|
||||
import okhttp3.RequestBody
|
||||
import java.io.File
|
||||
|
||||
|
||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||
|
@ -46,6 +50,23 @@ class SupplierFragment(
|
|||
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
|
||||
)*/
|
||||
// viewModel.entry_addFromBuy(8,1,100)
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue