This commit is contained in:
Sergio De la torre 2023-03-27 10:20:59 +02:00
parent c43e4f7ccf
commit 6c58e8012f
9 changed files with 265 additions and 158 deletions

View File

@ -83,10 +83,16 @@
</select>
</component>
<component name="ChangeListManager">
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="EntrySalix">
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="refs #4021">
<change afterPath="$PROJECT_DIR$/app/beta/release/output-metadata.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt" 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/view/feature/collection/fragment/CollectionFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/InitPreSacadorFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/InitPreSacadorFragment.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.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/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -134,7 +140,7 @@
</option>
</component>
<component name="GenerateSignedApkSettings">
<option name="KEY_STORE_PATH" value="C:\Users\sergiodt\proyectos\androidkeys_quique\keystore.jks" />
<option name="KEY_STORE_PATH" value="Z:\KEYSTORE\keystore.jks" />
<option name="KEY_ALIAS" value="keystore" />
<option name="REMEMBER_PASSWORDS" value="true" />
<option name="BUILD_TARGET_KEY" value="apk" />
@ -242,7 +248,7 @@
&quot;ScreenRecorder.SavePath&quot;: &quot;C:\\Users\\sergiodt\\device-2023-03-17-114045.mp4&quot;,
&quot;cidr.known.project.marker&quot;: &quot;true&quot;,
&quot;com.google.services.firebase.aqiPopupShown&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;C:/Users/sergiodt&quot;,
&quot;last_opened_file_path&quot;: &quot;Z:/KEYSTORE/keystore.jks&quot;,
&quot;project.structure.last.edited&quot;: &quot;Modules&quot;,
&quot;project.structure.proportion&quot;: &quot;0.17&quot;,
&quot;project.structure.side.proportion&quot;: &quot;0.2&quot;,
@ -251,7 +257,7 @@
},
&quot;keyToStringList&quot;: {
&quot;ExportApk.BuildVariants&quot;: [
&quot;generalRelease&quot;
&quot;betaRelease&quot;
]
}
}</component>
@ -781,7 +787,7 @@
<entry key="branch">
<value>
<list>
<option value="testBeta_5109_Agrupar_sales_exandible_simple" />
<option value="testBeta" />
</list>
</value>
</entry>

View File

@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "es.verdnatura.sfusion",
"variantName": "betaRelease",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 174,
"versionName": "23.10.2Beta",
"outputFile": "app-beta-release.apk"
}
],
"elementType": "File"
}

View File

@ -13,9 +13,9 @@ android {
applicationId "es.verdnatura"
minSdkVersion 24 //21
targetSdkVersion 33
versionCode 172
versionName = "23.10Beta"
//versionName = "23.8Beta" versionCode 170
versionCode 174
versionName = "23.10.2Beta"
//versionName = "23.10Beta" versionCode 172
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -165,6 +165,12 @@ interface VerdnaturaService {
):
Call<List<CollectionVO>>
@POST("almacennew/ticket_printLabelPrevious") //NO SALIX
fun ticket_printLabelPrevious(
@Body vararg params: Any
):
Call<Any>
@POST("almacennew/collection_assign")//NO SALIX
fun collection_assign(
):

View File

@ -1120,7 +1120,7 @@ class CollectionFragment(
sales = salesList.sortedWith(compareBy({ it.saleOrder }))
myGroupList = groupSaleGroup(salesList).sortedWith(compareBy({ it.saleOrder }))
if (type == CONTROLADOR) {
if (type == CONTROLADOR || type == PRECHECKER) {
sales = salesList.sortedWith(compareBy({ it.picked }))
myGroupList = groupSaleGroup(salesList).sortedWith(compareBy({ it.picked }))
@ -1918,7 +1918,8 @@ class CollectionFragment(
}
private fun setStoredPosition(isFromBack: Boolean) {
if (type == SACADOR) {
/* if (type == SACADOR) {
for (indice in myGroupList.indices) {
if (myGroupList[indice].isPrepared == "0") {
storedPosition = if (indice != 0) {
@ -1928,8 +1929,8 @@ class CollectionFragment(
}
break
}
}
}
}*/
setListPosition(storedPosition, isFromBack)
}
@ -2842,7 +2843,7 @@ class CollectionFragment(
mySale.totalSales = value.size //total líneas
mySale.isParent = true
value as MutableList<SaleVO>
mySale.sonSales = value as MutableList<SaleVO>
mySale.sonSales = value.sortedWith(compareBy { it.picked }) as MutableList<SaleVO>
mySale.line1 = "Previa :${mySale.saleGroupFk}"
mySale.line2 = "Líneas: ${value.size}"

View File

@ -3,7 +3,6 @@ package es.verdnatura.presentation.view.feature.presacador.fragment
import android.content.Context
import android.graphics.drawable.Drawable
import android.os.Build
import android.util.Log.d
import android.view.View
import android.widget.ImageView
import androidx.lifecycle.Observer
@ -11,179 +10,222 @@ import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentSacadorBinding
import es.verdnatura.domain.ConstAndValues.PREITEMPICKER
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.presacador.adapter.PreCollectionAdapter
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.sacador.adapter.CollectionAdapter
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
class InitPreSacadorFragment (
var entrypoint:String = ""
class InitPreSacadorFragment(
var entrypoint: String = ""
) :
BaseFragment<FragmentSacadorBinding, PreSacadorViewModel>(PreSacadorViewModel::class) {
BaseFragment<FragmentSacadorBinding, PreSacadorViewModel>(PreSacadorViewModel::class) {
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
private var goBack: Boolean = false
private var goBack2: Boolean = false
private lateinit var customDialog: CustomDialog
private var collectionsList: ArrayList<CollectionVO> = ArrayList()
private var adapter: CollectionAdapter? = null
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
private var goBack: Boolean = false
private var goBack2: Boolean = false
private lateinit var customDialog: CustomDialog
private var collectionsList: ArrayList<CollectionVO> = ArrayList()
private var adapter: CollectionAdapter? = null
private lateinit var customDialogInput: CustomDialogInput
companion object {
fun newInstance(entryPoint:String) = InitPreSacadorFragment(entryPoint)
companion object {
fun newInstance(entryPoint: String) = InitPreSacadorFragment(entryPoint)
}
override fun onAttach(context: Context) {
super.onAttach(context)
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
}
override fun getLayoutId(): Int = R.layout.fragment_sacador
override fun init() {
customDialog = CustomDialog(requireContext())
customDialogInput = CustomDialogInput(requireContext())
binding.splashProgress.visibility = View.VISIBLE
binding.splashProgressTwo.visibility = View.GONE
setToolBar()
setEvents()
viewModel.sectorCollection_get()
super.init()
}
override fun onPause() {
goBack = true
goBack2 = true
super.onPause()
}
private fun setToolBar() {
ma.hideBottomNavigation(View.VISIBLE)
binding.mainToolbar.toolbarTitle.text = entrypoint
binding.mainToolbar.backButton.setOnClickListener {
ma.onBackPressed()
}
override fun onAttach(context: Context) {
super.onAttach(context)
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
}
val listIcons: ArrayList<ImageView> = ArrayList()
val iconAdd = ImageView(context)
val iconPrint = ImageView(context)
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
iconAdd.setImageResource(R.drawable.ic_add_black_24dp)
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
override fun getLayoutId(): Int = R.layout.fragment_sacador
override fun init() {
customDialog = CustomDialog(requireContext())
binding.splashProgress.visibility = View.VISIBLE
binding.splashProgressTwo.visibility = View.GONE
setToolBar()
setEvents()
viewModel.sectorCollection_get()
super.init()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconAdd.tooltipText = getTooltip(R.drawable.ic_add_black_24dp)
// Tarea 4731
// iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp)
}
override fun onPause() {
goBack = true
goBack2 = true
super.onPause()
}
private fun setToolBar() {
listIcons.add(iconAdd)
listIcons.add(iconPrint)
ma.hideBottomNavigation(View.VISIBLE)
binding.mainToolbar.toolbarTitle.text=entrypoint
binding.mainToolbar.backButton.setOnClickListener{
ma.onBackPressed()
}
val listIcons: ArrayList<ImageView> = ArrayList()
val iconAdd = ImageView(context)
iconAdd.setImageResource(R.drawable.ic_add_black_24dp)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconAdd.tooltipText=getTooltip(R.drawable.ic_add_black_24dp)
}
listIcons.add(iconAdd)
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
when(item){
when (item) {
iconAdd.drawable -> {
binding.splashProgress.visibility = View.VISIBLE
viewModel.sectorCollection_new(getDataInt(SECTORFK))
}
iconPrint.drawable -> {
showPrintPrevious()
}
}
}
})
binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun setEvents() {
binding.sacadorSwipe.setOnRefreshListener {
viewModel.sectorCollection_get()
binding.sacadorSwipe.isRefreshing = false
}
}
private fun showPrintPrevious() {
customDialogInput.setInputText()
customDialogInput.setTitle(getString(R.string.printTicket))
customDialogInput.setDescription(getString(R.string.printPreviousGroup))
.setValue("")
.setOkButton(getString(R.string.print)) {
try {
binding.splashProgress.visibility = View.VISIBLE
viewModel.ticket_printLabelPrevious(customDialogInput.getValue().toInt())
(getString(R.string.Imprimiendo) + getData(PRINTERNAME)).toast(
requireContext())
} catch (ex: Exception) {
override fun observeViewModel() {
with(viewModel) {
collectionList.observe(viewLifecycleOwner, Observer {
if (!goBack2) binding.splashProgress.visibility = View.GONE
createCollectionList(it.list)
binding.splashProgress.visibility = View.GONE
goBack2 = false
})
response.observe(viewLifecycleOwner, Observer {
binding.splashProgressTwo.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
if (it.isError) {
ma.messageWithSound(it.errorMessage,true,false)
} else {
if (goBack) addCollectionToList(it.response.toInt())
}
goBack = false
//sergio:para asegurarnos que aparece en pantalla. En mi movil personal y trabajo no hacia falta.
//viewModel.PrecollectionGetSalix(token=getData(TOKEN))
})
responseNew.observe(viewLifecycleOwner, Observer {
binding.splashProgressTwo.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
if (it.isError) {
ma.messageWithSound(getString(R.string.errorCollectionNew)+ it.errorMessage,true,false)
} else {
//if (goBack)
viewModel.sectorCollection_get()
}
goBack = false
//sergio:para asegurarnos que aparece en pantalla. En mi movil personal y trabajo no hacia falta.
//viewModel.PrecollectionGetSalix(token=getData(TOKEN))
})
}
}
private fun createCollectionList(collections: List<CollectionVO>) {
collectionsList = ArrayList()
collections.forEach {
collectionsList.add(it)
}
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
adapter = CollectionAdapter(collectionsList, onCollectionSelectedListener!!,PREITEMPICKER)
binding.fragmentSacadorCollections.layoutManager = lm
binding.fragmentSacadorCollections.adapter = adapter
}
private fun addCollectionToList(collection: Int) {
var isNew = true
collectionsList.forEach {
if (it.collectionFk == collection) {
isNew = false
}
}
if (isNew) {
collectionsList.add(CollectionVO(collectionFk = collection, created = getString(R.string.newCreated)))
adapter?.notifyDataSetChanged()
} else {
customDialog.setTitle(getString(R.string.info))
.setDescription(getString(R.string.collectionPending) + collection)
.setOkButton(getString(R.string.accept)) {
customDialog.dismiss()
}.show()
}
//sergio:para asegurarnos que se actualiza pantalla.
adapter?.notifyDataSetChanged()
customDialogInput.dismiss()
}.setKoButton(getString(R.string.cancel)) {
customDialogInput.dismiss()
}.show()
customDialogInput.setFocusText()
}
private fun setEvents() {
binding.sacadorSwipe.setOnRefreshListener {
viewModel.sectorCollection_get()
binding.sacadorSwipe.isRefreshing = false
}
}
override fun observeViewModel() {
with(viewModel) {
collectionList.observe(viewLifecycleOwner, Observer {
if (!goBack2) binding.splashProgress.visibility = View.GONE
createCollectionList(it.list)
binding.splashProgress.visibility = View.GONE
goBack2 = false
})
response.observe(viewLifecycleOwner, Observer {
binding.splashProgressTwo.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
if (it.isError) {
ma.messageWithSound(it.errorMessage, true, false)
} else {
if (goBack) addCollectionToList(it.response.toInt())
}
goBack = false
//sergio:para asegurarnos que aparece en pantalla. En mi movil personal y trabajo no hacia falta.
//viewModel.PrecollectionGetSalix(token=getData(TOKEN))
})
responseNew.observe(viewLifecycleOwner, Observer {
binding.splashProgressTwo.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
if (it.isError) {
ma.messageWithSound(
getString(R.string.errorCollectionNew) + it.errorMessage,
true,
false
)
} else {
//if (goBack)
viewModel.sectorCollection_get()
}
goBack = false
//sergio:para asegurarnos que aparece en pantalla. En mi movil personal y trabajo no hacia falta.
//viewModel.PrecollectionGetSalix(token=getData(TOKEN))
})
}
}
private fun createCollectionList(collections: List<CollectionVO>) {
collectionsList = ArrayList()
collections.forEach {
collectionsList.add(it)
}
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
adapter = CollectionAdapter(collectionsList, onCollectionSelectedListener!!, PREITEMPICKER)
binding.fragmentSacadorCollections.layoutManager = lm
binding.fragmentSacadorCollections.adapter = adapter
}
private fun addCollectionToList(collection: Int) {
var isNew = true
collectionsList.forEach {
if (it.collectionFk == collection) {
isNew = false
}
}
if (isNew) {
collectionsList.add(
CollectionVO(
collectionFk = collection,
created = getString(R.string.newCreated)
)
)
adapter?.notifyDataSetChanged()
} else {
customDialog.setTitle(getString(R.string.info))
.setDescription(getString(R.string.collectionPending) + collection)
.setOkButton(getString(R.string.accept)) {
customDialog.dismiss()
}.show()
}
//sergio:para asegurarnos que se actualiza pantalla.
adapter?.notifyDataSetChanged()
}
}

View File

@ -71,9 +71,9 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
val responseSalixMessage: LiveData<ResponseItemVO>
get() = _responseSalixMessage
/* private val _responseMissingTrash by lazy { MutableLiveData<ResponseItemVO>() }
val responseMissingTrash: LiveData<ResponseItemVO>
get() = _responseMissingTrash*/
/* private val _responseMissingTrash by lazy { MutableLiveData<ResponseItemVO>() }
val responseMissingTrash: LiveData<ResponseItemVO>
get() = _responseMissingTrash*/
private val _responseItemShelvingUpdate by lazy { MutableLiveData<ResponseItemVO>() }
val responseItemShelvingUpdate: LiveData<ResponseItemVO>
@ -456,6 +456,25 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
}
fun ticket_printLabelPrevious(saleGroup: Int) {
silex.ticket_printLabelPrevious(saleGroup).enqueue(object : SilexCallback<Any>(context) {
override fun onError(t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Any>) {
_response.value =
ResponseItemVO(isError = false, response = response.message()!!)
}
})
}
fun sectorCollection_get() {
silex.sectorCollection_get().enqueue(object :
@ -466,7 +485,10 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
CollectionVO(
0,
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
t.message!!
)
)
)
_collectionList.value = CollectionListVO(listError)
@ -622,9 +644,9 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
fun saleTracking_updateIsChecked(
vSaleFk: Int,
vIsChecked: Boolean,
vIsScanned:Boolean?
vIsScanned: Boolean?
) {
silex.saleTracking_updateIsChecked(vSaleFk, vIsChecked,vIsScanned)
silex.saleTracking_updateIsChecked(vSaleFk, vIsChecked, vIsScanned)
.enqueue(
object :
SilexCallback<Any>(context) {
@ -665,7 +687,10 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
_responseItemShelvingUpdate.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
t.message!!
)
)
}
@ -691,7 +716,10 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
override fun onError(t: Throwable) {
_responseSplit.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
t.message!!
)
)
}

View File

@ -546,5 +546,7 @@
<string name="deleteQuantity">Va a eliminar para Autoconsumo la cantidad del artículo:</string>
<string name="tickets">" Tickets:"</string>
<string name="problemUpdate">No es posible actualizar. Problema con la descarga de la app</string>
<string name="printPreviousGroup">Introduce el número de previa a imprimir</string>
<string name="print">Imprimir</string>
</resources>

View File

@ -81,6 +81,7 @@
<string name="txtnuevacantidad">Indicate the new quantity and the action you want to take with the rest.</string>
<string name="BasuraRechazar">Garbage</string>
<string name="Indicanuevacantidad">Indicates new quantity</string>
<string name="printPreviousGroup">Indicates previous number for printing</string>
<string name="Coleccióncompleta">Complete collection</string>
<string name="Parking">Parking</string>
<string name="titleShelvingParking">Shelving Parking</string>
@ -426,6 +427,7 @@
<string name="wagoons">Wagoons</string>
<string name="printerWithout">Without printer</string>
<string name="printerLabel">Label printers</string>
<string name="print">Print</string>
<string name="labelType">Label type</string>
<string name="vehicleControl">Vehicle control</string>
<string name="userNotPermission">User without permissions to perform the action</string>