Compare commits
31 Commits
5ffff22013
...
feature/Re
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b40bd1d60 | |||
| ab230425c3 | |||
| 2f54b375b9 | |||
| 9aa9b9121f | |||
| 268ce9fce9 | |||
| eddecc165d | |||
| 45c64ad0ac | |||
| 398f0a9523 | |||
| 4861d53031 | |||
| e27a4e840a | |||
| cc67ac5f47 | |||
| 8e2d110792 | |||
| 2727c1b01c | |||
| 9924165362 | |||
| 0904388ffe | |||
| f86296d2a1 | |||
| cfe2b85886 | |||
| 3614192ea9 | |||
| 4d01a52590 | |||
| 638e8650ee | |||
| 36061faeeb | |||
| 83a183c5a6 | |||
| fd15235e6e | |||
| a88ddab405 | |||
| 9fb18215e3 | |||
| 2e3af6d1b3 | |||
| ac38aaeea7 | |||
| ade18170ee | |||
| cc89441f0a | |||
| f612e1c402 | |||
| 663d172edf |
@@ -11,8 +11,8 @@ apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 548
|
||||
def appVersionName = '1.49.04'
|
||||
def appVersionCode = 553
|
||||
def appVersionName = '1.50.04'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
|
||||
@@ -276,8 +276,8 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
GiacenzaPvRESTConsumer provideGiacenzaPvRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
return new GiacenzaPvRESTConsumer(restBuilder, executorService);
|
||||
GiacenzaPvRESTConsumer provideGiacenzaPvRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new GiacenzaPvRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
|
||||
|
||||
public class AnomaliaUlException extends RuntimeException {
|
||||
public AnomaliaUlException(GetColloInGiacResponseDTO colloInGiac) {
|
||||
super(String.format("%s: %s", colloInGiac.getDescrizioneLivelloAnomalia(), colloInGiac.getDescrizioneAnomalia()));
|
||||
}
|
||||
}
|
||||
@@ -117,6 +117,18 @@ public class MtbColt extends EntityBase {
|
||||
@SerializedName("ragSocCliente")
|
||||
private String ragSocCliente;
|
||||
|
||||
@SerializedName("descrizioneAnomalia")
|
||||
private String descrizioneAnomalia;
|
||||
|
||||
@SerializedName("descrizioneLivelloAnomalia")
|
||||
private String descrizioneLivelloAnomalia;
|
||||
|
||||
@SerializedName("escludiPickingVendita")
|
||||
private Boolean escludiPickingVendita;
|
||||
|
||||
@SerializedName("escludiPickingLavorazione")
|
||||
private Boolean escludiPickingLavorazione;
|
||||
|
||||
@SerializedName("mtbColr")
|
||||
private ObservableArrayList<MtbColr> mtbColr = new ObservableArrayList<>();
|
||||
|
||||
@@ -595,6 +607,42 @@ public class MtbColt extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizioneAnomalia() {
|
||||
return descrizioneAnomalia;
|
||||
}
|
||||
|
||||
public MtbColt setDescrizioneAnomalia(String descrizioneAnomalia) {
|
||||
this.descrizioneAnomalia = descrizioneAnomalia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizioneLivelloAnomalia() {
|
||||
return descrizioneLivelloAnomalia;
|
||||
}
|
||||
|
||||
public MtbColt setDescrizioneLivelloAnomalia(String descrizioneLivelloAnomalia) {
|
||||
this.descrizioneLivelloAnomalia = descrizioneLivelloAnomalia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getEscludiPickingVendita() {
|
||||
return escludiPickingVendita;
|
||||
}
|
||||
|
||||
public MtbColt setEscludiPickingVendita(Boolean escludiPickingVendita) {
|
||||
this.escludiPickingVendita = escludiPickingVendita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getEscludiPickingLavorazione() {
|
||||
return escludiPickingLavorazione;
|
||||
}
|
||||
|
||||
public MtbColt setEscludiPickingLavorazione(Boolean escludiPickingLavorazione) {
|
||||
this.escludiPickingLavorazione = escludiPickingLavorazione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJcom() {
|
||||
return codJcom;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public MtbColt synchronousCreateUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||
public MtbColt createUDCSynchronized(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
var response = colliAccettazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||
@@ -48,7 +48,7 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
MtbColt result = synchronousCreateUDC(createUDCRequestDTO);
|
||||
MtbColt result = createUDCSynchronized(createUDCRequestDTO);
|
||||
onComplete.run(result);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
}
|
||||
|
||||
@Override
|
||||
public MtbColt synchronousCreateUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||
public MtbColt createUDCSynchronized(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
var response = colliLavorazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||
@@ -64,7 +64,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
MtbColt result = synchronousCreateUDC(createUDCRequestDTO);
|
||||
MtbColt result = createUDCSynchronized(createUDCRequestDTO);
|
||||
onComplete.run(result);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
|
||||
@@ -41,6 +41,7 @@ import it.integry.integrywmsnative.core.rest.model.UpdateDepositoULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.UpdatePosizioneULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.PrintULRequestDTO;
|
||||
@@ -265,55 +266,53 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
saveCollo(mtbColtToCreate, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public List<MtbColt> getBySsccListSynchronized(List<String> ssccList, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
||||
if (ssccList == null || ssccList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
public List<GetColloInGiacResponseDTO> getBySsccListSynchronized(List<String> ssccList, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
||||
if (ssccList == null || ssccList.isEmpty()) return null;
|
||||
|
||||
var requestData = new GetColliByBarcodesRequestDTO() {{
|
||||
setBarcodes(ssccList);
|
||||
setOnlyResiduo(onlyResiduo);
|
||||
}};
|
||||
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
var colloResponse = colliMagazzinoRESTConsumerService.getColliByBarcodes(requestData, throwExcIfNull)
|
||||
.execute();
|
||||
|
||||
var mtbColts = analyzeAnswer(colloResponse, "GetBySSCCList");
|
||||
var listResponseDto = analyzeAnswer(colloResponse, "GetBySSCCList");
|
||||
|
||||
if(mtbColts == null || mtbColts.isEmpty()) {
|
||||
if (throwExcIfNull) {
|
||||
if (listResponseDto == null || listResponseDto.isEmpty()) {
|
||||
if (throwExcIfNull)
|
||||
throw new Exception("Nessun collo trovato per i codici SSCC forniti");
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
fillMtbAartsOfMtbColrsSynchronized(mtbColts.stream()
|
||||
.flatMap(x -> x.getMtbColr().stream())
|
||||
.collect(Collectors.toList()));
|
||||
fillMtbAartsOfMtbColrsSynchronized(
|
||||
listResponseDto.stream()
|
||||
.flatMap(x -> x.getMtbColt().getMtbColr().stream())
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
|
||||
return mtbColts;
|
||||
return listResponseDto;
|
||||
}
|
||||
|
||||
public MtbColt getBySsccSynchronized(String ssccString, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
||||
public GetColloInGiacResponseDTO getBySsccSynchronized(String ssccString, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
var colloResponse = colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull)
|
||||
.execute();
|
||||
var mtbColt = analyzeAnswer(colloResponse, "GetBySSCC");
|
||||
var responseDto = analyzeAnswer(colloResponse, "GetBySSCC");
|
||||
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
if (responseDto != null && responseDto.getMtbColt().getMtbColr() != null && !responseDto.getMtbColt().getMtbColr().isEmpty()) {
|
||||
List<MtbColt> mtbColtList = new ArrayList<>();
|
||||
mtbColtList.add(mtbColt);
|
||||
mtbColtList.add(responseDto.getMtbColt());
|
||||
|
||||
var mtbColts = fillMtbAartsOfMtbColtsSynchronized(mtbColtList);
|
||||
return mtbColts.get(0);
|
||||
responseDto.setMtbColt(mtbColts.get(0));
|
||||
}
|
||||
|
||||
return mtbColt;
|
||||
return responseDto;
|
||||
}
|
||||
|
||||
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<GetColloInGiacResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var mtbColt = getBySsccSynchronized(ssccString, onlyResiduo, throwExcIfNull);
|
||||
@@ -367,7 +366,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
List<MtbAart> artList = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||
if(artList == null )
|
||||
if (artList == null)
|
||||
artList = new ArrayList<>();
|
||||
|
||||
Map<String, MtbAart> mtbAartsMap = artList.parallelStream()
|
||||
|
||||
@@ -14,6 +14,7 @@ import it.integry.integrywmsnative.core.rest.model.UpdateDepositoULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.UpdatePosizioneULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.PrintULRequestDTO;
|
||||
@@ -26,10 +27,10 @@ import retrofit2.http.Query;
|
||||
public interface ColliMagazzinoRESTConsumerService {
|
||||
|
||||
@POST("getColliByBarcodes")
|
||||
Call<ServiceRESTResponse<List<MtbColt>>> getColliByBarcodes(@Body GetColliByBarcodesRequestDTO requestData, @Query("throwExcIfNull") boolean throwExcIfNull);
|
||||
Call<ServiceRESTResponse<List<GetColloInGiacResponseDTO>>> getColliByBarcodes(@Body GetColliByBarcodesRequestDTO requestData, @Query("throwExcIfNull") boolean throwExcIfNull);
|
||||
|
||||
@POST("getColloByBarcode")
|
||||
Call<ServiceRESTResponse<MtbColt>> getColloByBarcode(@Query("codBarreCollo") String sscc, @Query("onlyResiduo") boolean onlyResiduo, @Query("throwExcIfNull") boolean throwExcIfNull);
|
||||
Call<ServiceRESTResponse<GetColloInGiacResponseDTO>> getColloByBarcode(@Query("codBarreCollo") String sscc, @Query("onlyResiduo") boolean onlyResiduo, @Query("throwExcIfNull") boolean throwExcIfNull);
|
||||
|
||||
@GET("getColliInBasket")
|
||||
Call<ServiceRESTResponse<List<MtbColt>>> getColliInBasket(@Query("codMdep") String codMdep);
|
||||
|
||||
@@ -13,23 +13,17 @@ import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDT
|
||||
|
||||
public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
public GiacenzaPvRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
public GiacenzaPvRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
|
||||
public List<GiacenzaPvDTO> retrieveGiacenzeSynchronized(String codMdep) throws Exception {
|
||||
public List<GiacenzaPvDTO> retrieveGiacenzeSynchronized(String codMdep, String codMart) throws Exception {
|
||||
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class);
|
||||
var response = giacenzaPvRESTConsumerService.retrieve(codMdep)
|
||||
.execute();
|
||||
var response = giacenzaPvRESTConsumerService.retrieve(codMdep, codMart).execute();
|
||||
|
||||
var giacenzeList = analyzeAnswer(response, "retrieve-giacenze-pv");
|
||||
|
||||
return giacenzeList != null ? giacenzeList : new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -64,5 +58,4 @@ public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
analyzeAnswer(response, "close-verifica-pv");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,8 +17,7 @@ import retrofit2.http.Query;
|
||||
public interface GiacenzaPvRESTConsumerService {
|
||||
|
||||
@GET("wms/pv/verifica_giacenze/retrieve")
|
||||
Call<ServiceRESTResponse<List<GiacenzaPvDTO>>> retrieve(@Query("codMdep") String codMdep);
|
||||
|
||||
Call<ServiceRESTResponse<List<GiacenzaPvDTO>>> retrieve(@Query("codMdep") String codMdep, @Query("codMart") String codMart);
|
||||
|
||||
@POST("wms/pv/verifica_giacenze/save_new_row")
|
||||
Call<ServiceRESTResponse<Void>> saveNewRowVerifica(@Body SaveNewRowVerificaRequestDTO saveNewRowVerificaRequest);
|
||||
|
||||
@@ -12,7 +12,7 @@ import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||
|
||||
public interface ColliCaricoRESTConsumerInterface {
|
||||
|
||||
MtbColt synchronousCreateUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception;
|
||||
MtbColt createUDCSynchronized(CreateUDCRequestDTO createUDCRequestDTO) throws Exception;
|
||||
void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
CloseUDCResponseDTO synchronousCloseUDC(CloseUDCRequestDTO closeUDCRequestDTO) throws Exception;
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.giacenza;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class GetColloInGiacResponseDTO {
|
||||
|
||||
@SerializedName("mtbColt")
|
||||
private MtbColt mtbColt;
|
||||
|
||||
@SerializedName("descrizioneAnomalia")
|
||||
private String descrizioneAnomalia;
|
||||
|
||||
@SerializedName("descrizioneLivelloAnomalia")
|
||||
private String descrizioneLivelloAnomalia;
|
||||
|
||||
@SerializedName("escludiPickingVendita")
|
||||
private Boolean escludiPickingVendita = false;
|
||||
|
||||
@SerializedName("escludiPickingLavorazione")
|
||||
private Boolean escludiPickingLavorazione = false;
|
||||
|
||||
public MtbColt getMtbColt() {
|
||||
return mtbColt;
|
||||
}
|
||||
|
||||
public GetColloInGiacResponseDTO setMtbColt(MtbColt mtbColt) {
|
||||
this.mtbColt = mtbColt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMessageAnomalia() {
|
||||
if (getDescrizioneAnomalia() == null && getDescrizioneLivelloAnomalia() == null)
|
||||
return null;
|
||||
|
||||
return String.format("<b>%s:</b> %s", getDescrizioneLivelloAnomalia(), getDescrizioneAnomalia());
|
||||
}
|
||||
|
||||
public String getDescrizioneAnomalia() {
|
||||
return descrizioneAnomalia;
|
||||
}
|
||||
|
||||
public GetColloInGiacResponseDTO setDescrizioneAnomalia(String descrizioneAnomalia) {
|
||||
this.descrizioneAnomalia = descrizioneAnomalia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizioneLivelloAnomalia() {
|
||||
return descrizioneLivelloAnomalia;
|
||||
}
|
||||
|
||||
public GetColloInGiacResponseDTO setDescrizioneLivelloAnomalia(String descrizioneLivelloAnomalia) {
|
||||
this.descrizioneLivelloAnomalia = descrizioneLivelloAnomalia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getEscludiPickingVendita() {
|
||||
return escludiPickingVendita;
|
||||
}
|
||||
|
||||
public GetColloInGiacResponseDTO setEscludiPickingVendita(Boolean escludiPickingVendita) {
|
||||
this.escludiPickingVendita = escludiPickingVendita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getEscludiPickingLavorazione() {
|
||||
return escludiPickingLavorazione;
|
||||
}
|
||||
|
||||
public GetColloInGiacResponseDTO setEscludiPickingLavorazione(Boolean escludiPickingLavorazione) {
|
||||
this.escludiPickingLavorazione = escludiPickingLavorazione;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -202,9 +202,9 @@ public class AccettazioneBollaPickingViewModel {
|
||||
}
|
||||
|
||||
private void executeEtichettaAnonimaNotOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), true, false, mtbColt -> {
|
||||
mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), true, false, response -> {
|
||||
|
||||
if (mtbColt == null) {
|
||||
if (response.getMtbColt() == null) {
|
||||
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
||||
this.sendError(new NotCurrentYearLUException());
|
||||
} else {
|
||||
|
||||
@@ -78,7 +78,6 @@ public class MainAccettazioneOrdiniElencoFragment extends BaseFragment implement
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
onLoadingEnded();
|
||||
outState.putString("mToolbar", DataCache.addItem(mToolbar));
|
||||
|
||||
super.onSaveInstanceState(outState);
|
||||
|
||||
@@ -11,7 +11,6 @@ import android.view.Gravity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
@@ -159,7 +158,17 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
boolean useQtaOrd = SettingsManager.iDB().isFlagAccettazioneUseQtaOrd();
|
||||
|
||||
mViewModel.setListeners(this);
|
||||
mViewModel.init(mOrders, mSitArts, useQtaOrd);
|
||||
|
||||
this.onLoadingStarted();
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
mViewModel.init(mOrders, mSitArts, useQtaOrd);
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initFab() {
|
||||
@@ -376,7 +385,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
|
||||
private void refreshList() {
|
||||
|
||||
runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
List<PickingObjectDTO> tmpList;
|
||||
|
||||
if (mAppliedFilterViewModel != null) {
|
||||
@@ -817,7 +826,13 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
this.mViewModel.resetMatchedRows();
|
||||
return;
|
||||
}
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO().setNumCnf(resultDTO.getNumCnf()).setQtaCnf(resultDTO.getQtaCnf()).setQtaTot(resultDTO.getQtaTot()).setPartitaMag(resultDTO.getPartitaMag()).setDataScad(resultDTO.getDataScad());
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
.setQtaTot(resultDTO.getQtaTot())
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad())
|
||||
.setShouldCloseLu(resultDTO.isShouldCloseLu());
|
||||
onComplete.run(pickedQuantityDTO, pickedQuantityDTO.isShouldCloseLu());
|
||||
})
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
|
||||
@@ -1,59 +1,9 @@
|
||||
package it.integry.integrywmsnative.gest.accettazione_ordini_picking;
|
||||
|
||||
import android.os.Handler;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.ean128.Ean128Service;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliAccettazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordini_picking.rest.AccettazioneOrdiniPickingRESTConsumer;
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
||||
|
||||
@Module(subcomponents = AccettazioneOrdiniPickingComponent.class)
|
||||
public class AccettazioneOrdiniPickingModule {
|
||||
|
||||
@Provides
|
||||
AccettazioneOrdiniPickingRESTConsumer providesAccettazionePickingRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new AccettazioneOrdiniPickingRESTConsumer(restBuilder, systemRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
BottomSheetFragmentLUContentViewModel providesBottomSheetFragmentLUContentViewModel() {
|
||||
return new BottomSheetFragmentLUContentViewModel();
|
||||
}
|
||||
|
||||
@Provides
|
||||
AccettazioneOrdiniPickingViewModel providesAccettazioneViewModel(
|
||||
Handler handler,
|
||||
ExecutorService executorService,
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
AccettazioneOrdiniPickingRESTConsumer accettazioneOrdiniPickingRESTConsumer,
|
||||
ColliAccettazioneRESTConsumer colliAccettazioneRESTConsumer,
|
||||
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
|
||||
Ean128Service ean128Service,
|
||||
ImballiRESTConsumer imballiRESTConsumer) {
|
||||
return new AccettazioneOrdiniPickingViewModel(
|
||||
handler,
|
||||
executorService,
|
||||
articoloRESTConsumer,
|
||||
barcodeRESTConsumer,
|
||||
colliMagazzinoRESTConsumer,
|
||||
accettazioneOrdiniPickingRESTConsumer,
|
||||
colliAccettazioneRESTConsumer,
|
||||
colliLavorazioneRESTConsumer,
|
||||
ean128Service,
|
||||
imballiRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,10 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -124,7 +127,7 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
}
|
||||
|
||||
|
||||
public void init(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts, boolean useQtaOrd) {
|
||||
public void init(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts, boolean useQtaOrd) throws Exception {
|
||||
this.mOrders = orders;
|
||||
this.mUseQtaOrd = useQtaOrd;
|
||||
|
||||
@@ -134,13 +137,14 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
getEmptyPickingList(mSitArts, this.mPickingList::postValue);
|
||||
var pickingList = getEmptyPickingList(mSitArts);
|
||||
this.mPickingList.postValue(pickingList);
|
||||
|
||||
//Definizione della gestione collo di default
|
||||
Boolean isOrdTrasf = Stream.of(mOrders)
|
||||
Boolean isOrdTrasf = mOrders.stream()
|
||||
.map(OrdineAccettazioneInevasoDTO::isOrdTrasf)
|
||||
.withoutNulls()
|
||||
.distinctBy(x -> x)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.findFirst()
|
||||
.get();
|
||||
|
||||
@@ -154,10 +158,10 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
|
||||
|
||||
//Definizione della gestione collo di default
|
||||
List<GestioneEnum> foundGestioni = Stream.of(mOrders)
|
||||
List<GestioneEnum> foundGestioni = mOrders.stream()
|
||||
.map(OrdineAccettazioneInevasoDTO::getGestioneEnum)
|
||||
.withoutNulls()
|
||||
.distinctBy(x -> x)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
if (foundGestioni.size() == 1) {
|
||||
@@ -166,7 +170,7 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
} else
|
||||
defaultGestioneOfUL = foundGestioni.get(0) == GestioneEnum.PRODUZIONE ? GestioneEnum.LAVORAZIONE : foundGestioni.get(0);
|
||||
} else {
|
||||
this.sendError(new InvalidLUMultiGestioneException());
|
||||
throw new InvalidLUMultiGestioneException();
|
||||
}
|
||||
|
||||
switch (defaultGestioneOfUL) {
|
||||
@@ -175,32 +179,31 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
private void getEmptyPickingList(List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<PickingObjectDTO>> onComplete) {
|
||||
private List<PickingObjectDTO> getEmptyPickingList(List<SitArtOrdDTO> sitArtOrdList) throws Exception {
|
||||
|
||||
List<String> codMarts = Stream.of(sitArtOrdList)
|
||||
List<String> codMarts = sitArtOrdList.stream()
|
||||
.map(SitArtOrdDTO::getCodMart)
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
|
||||
this.mArticoloRESTConsumer.getByCodMarts(codMarts, listMtbAarts -> {
|
||||
List<PickingObjectDTO> pickingList = Stream.of(sitArtOrdList)
|
||||
.map(sitArtOrdDTO -> {
|
||||
MtbAart mtbAart = null;
|
||||
var listMtbAarts = this.mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||
List<PickingObjectDTO> pickingList = sitArtOrdList.stream()
|
||||
.map(sitArtOrdDTO -> {
|
||||
MtbAart mtbAart = null;
|
||||
|
||||
for (MtbAart mtbAartItem : listMtbAarts) {
|
||||
if (mtbAartItem.getCodMart().equalsIgnoreCase(sitArtOrdDTO.getCodMart())) {
|
||||
mtbAart = mtbAartItem;
|
||||
break;
|
||||
}
|
||||
for (MtbAart mtbAartItem : listMtbAarts) {
|
||||
if (mtbAartItem.getCodMart().equalsIgnoreCase(sitArtOrdDTO.getCodMart())) {
|
||||
mtbAart = mtbAartItem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new PickingObjectDTO()
|
||||
.setSitArtOrdDTO(sitArtOrdDTO)
|
||||
.setMtbAart(mtbAart);
|
||||
})
|
||||
.toList();
|
||||
return new PickingObjectDTO()
|
||||
.setSitArtOrdDTO(sitArtOrdDTO)
|
||||
.setMtbAart(mtbAart);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
onComplete.run(pickingList);
|
||||
}, this::sendError);
|
||||
return pickingList;
|
||||
}
|
||||
|
||||
public MutableLiveData<List<PickingObjectDTO>> getPickingList() {
|
||||
@@ -271,9 +274,9 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
}
|
||||
|
||||
private void executeEtichettaAnonimaNotOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), true, false, mtbColt -> {
|
||||
mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), true, false, response -> {
|
||||
|
||||
if (mtbColt == null) {
|
||||
if (response.getMtbColt() == null) {
|
||||
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
||||
this.sendError(new NotCurrentYearLUException());
|
||||
} else {
|
||||
@@ -767,22 +770,24 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
if (!shouldDelete)
|
||||
return;
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
var deleteUDCRowRequest = new DeleteUDCRowRequestDTO()
|
||||
.setMtbColrToDelete(mtbColrToDelete);
|
||||
var deleteUDCRowRequest = new DeleteUDCRowRequestDTO()
|
||||
.setMtbColrToDelete(mtbColrToDelete);
|
||||
|
||||
this.mColliCaricoRESTConsumer.deleteUDCRow(deleteUDCRowRequest,
|
||||
() -> {
|
||||
Optional<PickingObjectDTO> pickingObjectDTO = Stream.of(this.mPickingList.getValue())
|
||||
.filter(x -> Stream.of(x.getWithdrawMtbColrs()).anyMatch(y -> y == mtbColrToDelete))
|
||||
.findSingle();
|
||||
this.mColliCaricoRESTConsumer.deleteUDCRow(deleteUDCRowRequest,
|
||||
() -> {
|
||||
Optional<PickingObjectDTO> pickingObjectDTO = Stream.of(this.mPickingList.getValue())
|
||||
.filter(x -> Stream.of(x.getWithdrawMtbColrs()).anyMatch(y -> y == mtbColrToDelete))
|
||||
.findSingle();
|
||||
|
||||
if (pickingObjectDTO.isPresent()) {
|
||||
pickingObjectDTO.get().getWithdrawMtbColrs().remove(mtbColrToDelete);
|
||||
}
|
||||
if (pickingObjectDTO.isPresent()) {
|
||||
pickingObjectDTO.get().getWithdrawMtbColrs().remove(mtbColrToDelete);
|
||||
}
|
||||
|
||||
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
|
||||
handler.post(() -> {
|
||||
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
|
||||
});
|
||||
|
||||
this.resetMatchedRows();
|
||||
this.sendOnRowSaved();
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ListaBancaliActivity extends BaseActivity implements ListaBancaliVi
|
||||
|
||||
|
||||
public static Intent createIntent(Context context, List<MtbColt> items, RunnableArgsWithReturn<MtbColt, Boolean> canRecoverUlAction, String reportName) {
|
||||
return createIntent(context, items, canRecoverUlAction, true, reportName);
|
||||
return createIntent(context, items, canRecoverUlAction, false, reportName);
|
||||
}
|
||||
|
||||
public static Intent createIntent(Context context, List<MtbColt> items, boolean canRecoverUl, boolean onlyResiduo) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
|
||||
|
||||
public class ListaBancaliViewModel {
|
||||
|
||||
@@ -53,11 +54,14 @@ public class ListaBancaliViewModel {
|
||||
}
|
||||
|
||||
public List<MtbColt> fillMtbColtWithMtbColr(List<MtbColt> mtbColts, boolean onlyResiduo) throws Exception {
|
||||
if (mtbColts == null || mtbColts.isEmpty()) return mtbColts;
|
||||
|
||||
List<String> ssccList = mtbColts.stream()
|
||||
.map(MtbColt::getBarcodeUl)
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
|
||||
return mColliMagazzinoRESTConsumer.getBySsccListSynchronized(ssccList, onlyResiduo, false);
|
||||
var bySsccListSynchronized = mColliMagazzinoRESTConsumer.getBySsccListSynchronized(ssccList, onlyResiduo, false);
|
||||
return bySsccListSynchronized.stream().map(GetColloInGiacResponseDTO::getMtbColt).toList();
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
|
||||
@@ -209,7 +209,8 @@ public class OrdiniUscitaElencoViewModel {
|
||||
|
||||
|
||||
private void executeEtichettaLU(String SSCC, RunnableArgs<List<OrdiniUscitaElencoDTO>> onComplete) {
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, response -> {
|
||||
var mtbColt = response.getMtbColt();
|
||||
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ package it.integry.integrywmsnative.gest.picking_libero;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -325,6 +326,15 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarning(String warningText, Runnable action) {
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(getContext(), new SpannableString(Html.fromHtml(warningText)), null, action)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort) {
|
||||
DialogAskClienteView.newInstance(onComplete, onAbort)
|
||||
|
||||
@@ -20,6 +20,7 @@ import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||
import it.integry.integrywmsnative.core.exception.AnomaliaUlException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidCodMdepException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidPositionException;
|
||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||
@@ -53,6 +54,7 @@ import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||
@@ -190,7 +192,7 @@ public class PickingLiberoViewModel {
|
||||
if (foundPosizione.isMagazzinoAutomatico()) {
|
||||
//Eseguo picking da magazzino automatico
|
||||
this.executeMagazzinoAutomatico(foundPosizione);
|
||||
} else if(foundPosizione.isFlagMonoCollo()) {
|
||||
} else if (foundPosizione.isFlagMonoCollo()) {
|
||||
this.executePosizioneMonoUL(foundPosizione, null);
|
||||
} else
|
||||
throw new InvalidPositionException("impossibile gestire una posizione non MONO-UL in fase di picking");
|
||||
@@ -243,7 +245,9 @@ public class PickingLiberoViewModel {
|
||||
throw new NoLUFoundException();
|
||||
}
|
||||
} else if (barcodeUlInPosizione.size() == 1) {
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizione.get(0), true, false);
|
||||
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizione.get(0), true, false);
|
||||
this.checkAnomalieUl(response);
|
||||
var mtbColt = response.getMtbColt();
|
||||
|
||||
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableDepos())
|
||||
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
|
||||
@@ -264,7 +268,9 @@ public class PickingLiberoViewModel {
|
||||
}
|
||||
|
||||
private void executeEtichettaLU(String sscc) throws Exception {
|
||||
var mtbColtScanned = mColliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
|
||||
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
|
||||
this.checkAnomalieUl(response);
|
||||
var mtbColtScanned = response.getMtbColt();
|
||||
|
||||
if (mtbColtScanned == null) {
|
||||
throw new NoLUFoundException();
|
||||
@@ -694,12 +700,9 @@ public class PickingLiberoViewModel {
|
||||
!UtilityString.isNullOrEmpty(mtbColr.getDataColloRifS()) &&
|
||||
mtbColr.getNumColloRif() != null) {
|
||||
|
||||
MtbColt mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(
|
||||
mtbColr.getBarcodeUlOut(),
|
||||
true,
|
||||
false);
|
||||
|
||||
return mtbColt;
|
||||
return mColliMagazzinoRESTConsumer.getBySsccSynchronized(
|
||||
mtbColr.getBarcodeUlOut(), true, false
|
||||
).getMtbColt();
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -894,6 +897,16 @@ public class PickingLiberoViewModel {
|
||||
this.mCurrentMtbColt = null;
|
||||
}
|
||||
|
||||
private void checkAnomalieUl(GetColloInGiacResponseDTO colloInGiac) {
|
||||
if (colloInGiac.getEscludiPickingVendita() && mDefaultGestione == GestioneEnum.VENDITA) {
|
||||
this.sendError(new AnomaliaUlException(colloInGiac));
|
||||
} else if (colloInGiac.getEscludiPickingLavorazione() && mDefaultGestione == GestioneEnum.LAVORAZIONE) {
|
||||
this.sendError(new AnomaliaUlException(colloInGiac));
|
||||
} else if (colloInGiac.getMessageAnomalia() != null) {
|
||||
this.onWarning(colloInGiac.getMessageAnomalia(), () -> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.mListener != null) mListener.onLoadingStarted();
|
||||
@@ -1042,15 +1055,20 @@ public class PickingLiberoViewModel {
|
||||
if (this.mListener != null) mListener.onRowSaved();
|
||||
}
|
||||
|
||||
private void onWarning(String warningText, Runnable action) {
|
||||
if (this.mListener != null) mListener.onWarning(warningText, action);
|
||||
}
|
||||
|
||||
public PickingLiberoViewModel setListener(Listener listener) {
|
||||
this.mListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener, ILUBaseOperationsListener {
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
void onWarning(String warningText, Runnable action);
|
||||
|
||||
void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort);
|
||||
|
||||
void onLULineaProdRequired(RunnableArgs<DialogAskLineaProdResponse> onComplete, Runnable onAbort);
|
||||
|
||||
@@ -148,7 +148,7 @@ public class PickingResiViewModel {
|
||||
|
||||
public void createNewLU(Integer customNumCollo, String customSerCollo) throws Exception {
|
||||
if (mTipologiaReso == Tipologia.VENDITA) {
|
||||
var createdUdc = mColliAccettazioneRESTConsumer.synchronousCreateUDC(new CreateUDCRequestDTO()
|
||||
var createdUdc = mColliAccettazioneRESTConsumer.createUDCSynchronized(new CreateUDCRequestDTO()
|
||||
.setCodAnag(mDefaultCodAnagOfLU)
|
||||
.setCodMdep(mDefaultCodMdepOfLU)
|
||||
.setNumCollo(customNumCollo)
|
||||
@@ -304,7 +304,7 @@ public class PickingResiViewModel {
|
||||
|
||||
|
||||
private void executeEtichettaAnonimaNotOpenedLU(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeScanDTO.getStringValue(), true, false);
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeScanDTO.getStringValue(), true, false).getMtbColt();
|
||||
|
||||
if (mtbColt == null) {
|
||||
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
||||
@@ -328,9 +328,7 @@ public class PickingResiViewModel {
|
||||
}
|
||||
|
||||
private void executeEtichettaLU(String SSCC) throws Exception {
|
||||
MtbColt mtbColt = null;
|
||||
|
||||
mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false).getMtbColt();
|
||||
|
||||
if (mTipologiaReso == Tipologia.VENDITA) {
|
||||
//Leggere i colli in cui ho barcode_ul_out uguale a SSCC scansionato (nel caso di reso da cliente)
|
||||
|
||||
@@ -55,7 +55,8 @@ public class ProdDettaglioLineaViewModel {
|
||||
}
|
||||
|
||||
private void handleSSCCBarcode(String sscc, Runnable onComplete) {
|
||||
this.colliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, mtbColt -> {
|
||||
this.colliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, response -> {
|
||||
var mtbColt = response.getMtbColt();
|
||||
|
||||
if (mtbColt == null) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
@@ -177,7 +178,7 @@ public class ProdDettaglioLineaViewModel {
|
||||
mBarcodeRESTConsumer.decodeEan128(dto, (ean128) -> {
|
||||
String codMart = ean128.Internal1;
|
||||
String partitaMag = ean128.BatchLot;
|
||||
if(prodLine == null) {
|
||||
if (prodLine == null) {
|
||||
this.sendError(new Exception("Impossibile leggere lo stato della linea"));
|
||||
|
||||
} else if (!prodLine.isStarted()) {
|
||||
|
||||
@@ -89,7 +89,7 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
this.sendOnLoadingStarted();
|
||||
Ean128Model ean128Model = this.mBarcodeRESTConsumer.decodeEan128Synchronized(barcodeScanDTO);
|
||||
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(ean128Model.Sscc, true, false);
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(ean128Model.Sscc, true, false).getMtbColt();
|
||||
|
||||
this.sendOnLoadingEnded();
|
||||
|
||||
@@ -147,8 +147,6 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
}
|
||||
|
||||
public void onItemDispatched(HistoryVersamentoProdULDTO item, PickedQuantityDTO pickedQuantityDTO, MtbColt sourceMtbColt) {
|
||||
|
||||
|
||||
mExecutorService.execute(() -> {
|
||||
MtbColt mtbColt = sourceMtbColt;
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ package it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -48,6 +50,7 @@ import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
||||
import it.integry.integrywmsnative.ui.filter_chips.FilterChipView;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLUView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
|
||||
public class ProdRiposizionamentoDaProdFragment extends BaseFragment implements ISearchableFragment, ITitledFragment, ProdRiposizionamentoDaProdViewModel.Listener {
|
||||
|
||||
@@ -362,4 +365,14 @@ public class ProdRiposizionamentoDaProdFragment extends BaseFragment implements
|
||||
public void onDataSaved() {
|
||||
mHandler.postDelayed(mRunnable, mInterval);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarning(String warningText, Runnable action) {
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(requireContext(),
|
||||
new SpannableString(Html.fromHtml(warningText)), null, action)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -102,11 +102,16 @@ public class ProdRiposizionamentoDaProdViewModel {
|
||||
}
|
||||
|
||||
private void executeEtichettaLU(String sscc, boolean isAnonima, Runnable onComplete) {
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, mtbColt -> {
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, response -> {
|
||||
var mtbColt = response.getMtbColt();
|
||||
|
||||
if (mtbColt == null && !isAnonima) {
|
||||
this.mSoundAlertService.warning();
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else {
|
||||
if (response.getDescrizioneAnomalia() != null)
|
||||
this.onWarning(response.getMessageAnomalia(), () -> {});
|
||||
|
||||
List<MvwSitArtUdcDetInventario> mvwSitArtUdcDetInventario = Stream.of(Objects.requireNonNull(itemsInventario.getValue()))
|
||||
.flatMap(item -> Stream.of(item.getMvwSitArtUdcDetInventarioDTO()))
|
||||
.toList();
|
||||
@@ -312,10 +317,16 @@ public class ProdRiposizionamentoDaProdViewModel {
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
public void onWarning(String warningText, Runnable action) {
|
||||
if (this.mListener != null) mListener.onWarning(warningText, action);
|
||||
}
|
||||
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
void onError(Exception ex);
|
||||
|
||||
void onWarning(String warningText, Runnable action);
|
||||
|
||||
void onInventoriesLoadingStarted();
|
||||
|
||||
void onInventoriesLoadingEnded();
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.exception.AnomaliaUlException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidCodMdepException;
|
||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
@@ -35,6 +36,7 @@ import it.integry.integrywmsnative.core.rest.consumers.MaterialiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiRequestDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
@@ -115,7 +117,9 @@ public class ProdVersamentoMaterialeViewModel {
|
||||
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty()) {
|
||||
throw new NoLUFoundException();
|
||||
} else if (barcodeUlInPosizioneList.size() == 1) {
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
|
||||
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
|
||||
this.checkAnomaliaUl(response);
|
||||
var mtbColt = response.getMtbColt();
|
||||
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableDepos().stream()
|
||||
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
|
||||
@@ -131,7 +135,9 @@ public class ProdVersamentoMaterialeViewModel {
|
||||
|
||||
|
||||
private void executeEtichettaLU(String sscc) throws Exception {
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
|
||||
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
|
||||
this.checkAnomaliaUl(response);
|
||||
var mtbColt = response.getMtbColt();
|
||||
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableDepos().stream()
|
||||
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
|
||||
@@ -419,6 +425,14 @@ public class ProdVersamentoMaterialeViewModel {
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void checkAnomaliaUl(GetColloInGiacResponseDTO colloInGiac) {
|
||||
if (colloInGiac.getEscludiPickingLavorazione()) {
|
||||
this.sendError(new AnomaliaUlException(colloInGiac));
|
||||
} else if (colloInGiac.getMessageAnomalia() != null) {
|
||||
this.sendWarning(colloInGiac.getMessageAnomalia(), () -> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public MutableLiveData<MtbColt> getMtbColtMutableLiveData() {
|
||||
return mtbColtMutableLiveData;
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.ravikoradiya.liveadapter.Type;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@@ -38,6 +39,7 @@ import it.integry.integrywmsnative.view.bottom_sheet__item_edit.BottomSheetItemD
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__item_edit.BottomSheetItemEditView;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_deposito.DialogAskDepositoView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArtsView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
import it.integry.integrywmsnative.view.dialogs.yes_no.DialogYesNoView;
|
||||
@@ -91,7 +93,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
||||
}
|
||||
|
||||
private void init() {
|
||||
|
||||
executorService.execute(() -> {
|
||||
|
||||
boolean recoveredSession = false;
|
||||
@@ -129,7 +130,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
||||
|
||||
try {
|
||||
this.onLoadingStarted();
|
||||
mViewModel.loadDeposito(codMdep);
|
||||
|
||||
if (!recoveredSession) mViewModel.createNew(codMdep);
|
||||
|
||||
@@ -162,7 +162,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
AtomicReference<String> codMdepAtomic = new AtomicReference<>();
|
||||
|
||||
|
||||
DialogAskDepositoView.newInstance(codMdep -> {
|
||||
codMdepAtomic.set(codMdep);
|
||||
countDownLatch.countDown();
|
||||
@@ -173,7 +172,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
||||
return codMdepAtomic.get();
|
||||
}
|
||||
|
||||
|
||||
private void initRecyclerView() {
|
||||
var itemType = new Type<VerificaGiacenzeRowEntity, ListaVerificaGiacenzePickedItemListModelBinding>(R.layout.lista_verifica_giacenze_picked_item_list_model, BR.item);
|
||||
|
||||
@@ -214,13 +212,12 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
} finally {
|
||||
handler.post(this::onLoadingEnded);
|
||||
}
|
||||
});
|
||||
|
||||
this.onLoadingEnded();
|
||||
};
|
||||
|
||||
|
||||
private void openItemAction(VerificaGiacenzeRowEntity item) {
|
||||
var anagrafica = mViewModel.searchAnagraficaByCodMart(item.getCodMart());
|
||||
|
||||
@@ -262,7 +259,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public PickedQuantityDTO onItemDispatched(MtbAart mtbAart,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
@@ -340,7 +336,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
@@ -351,4 +346,10 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
||||
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
||||
titleText.setText(R.string.verifica_giacenze_menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChooseArtRequest(List<MtbAart> artsList, RunnableArgs<MtbAart> onComplete) {
|
||||
DialogChooseArtFromListaArtsView.newInstance(true, artsList, onComplete)
|
||||
.show(requireActivity().getSupportFragmentManager(), "dialog-choose-art");
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,8 @@ import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
||||
public class VerificaGiacenzeModule {
|
||||
|
||||
@Provides
|
||||
VerificaGiacenzeViewModel providesVerificaGiacenzeViewModel(ExecutorService executorService, Handler handler, VerificaGiacenzeRowMapper verificaGiacenzeRowMapper, VerificaGiacenzeRepository verificaGiacenzeRepository, VerificaGiacenzeRowRepository verificaGiacenzeRowRepository, GiacenzaPvRESTConsumer giacenzaPvRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
return new VerificaGiacenzeViewModel(executorService, handler, verificaGiacenzeRowMapper, giacenzaPvRESTConsumer, verificaGiacenzeRepository, verificaGiacenzeRowRepository, articoloRESTConsumer);
|
||||
VerificaGiacenzeViewModel providesVerificaGiacenzeViewModel(Handler handler, VerificaGiacenzeRowMapper verificaGiacenzeRowMapper, VerificaGiacenzeRepository verificaGiacenzeRepository, VerificaGiacenzeRowRepository verificaGiacenzeRowRepository, GiacenzaPvRESTConsumer giacenzaPvRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
return new VerificaGiacenzeViewModel(handler, verificaGiacenzeRowMapper, giacenzaPvRESTConsumer, verificaGiacenzeRepository, verificaGiacenzeRowRepository, articoloRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,8 +11,8 @@ import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -22,8 +22,8 @@ import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRow
|
||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRowRepository;
|
||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeMapper;
|
||||
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeRowMapper;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
@@ -31,7 +31,6 @@ import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.CloseVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.DeleteRowVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewRowVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
@@ -39,8 +38,6 @@ import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
|
||||
public class VerificaGiacenzeViewModel {
|
||||
|
||||
private final ExecutorService executorService;
|
||||
private final Handler handler;
|
||||
private final VerificaGiacenzeRowMapper verificaGiacenzeRowMapper;
|
||||
private final GiacenzaPvRESTConsumer giacenzaPvRESTConsumer;
|
||||
@@ -50,21 +47,17 @@ public class VerificaGiacenzeViewModel {
|
||||
|
||||
private Listener listener;
|
||||
|
||||
private MutableLiveData<VerificaGiacenzeEntity> currentVerifica = new MutableLiveData<>();
|
||||
private final MutableLiveData<VerificaGiacenzeEntity> currentVerifica = new MutableLiveData<>();
|
||||
private final MutableLiveData<List<VerificaGiacenzeRowEntity>> currentVerificaRows = new MutableLiveData<>(new ArrayList<>());
|
||||
|
||||
private List<GiacenzaPvDTO> currentLoadedGiacenza = null;
|
||||
private List<MtbAart> currentLoadedAnagrafiche = null;
|
||||
private List<MtbAart> currentLoadedAnagrafiche = new ArrayList<>();
|
||||
|
||||
@Inject
|
||||
public VerificaGiacenzeViewModel(ExecutorService executorService,
|
||||
Handler handler,
|
||||
public VerificaGiacenzeViewModel(Handler handler,
|
||||
VerificaGiacenzeRowMapper verificaGiacenzeRowMapper,
|
||||
GiacenzaPvRESTConsumer giacenzaPvRESTConsumer,
|
||||
VerificaGiacenzeRepository verificaGiacenzeRepository,
|
||||
VerificaGiacenzeRowRepository verificaGiacenzeRowRepository,
|
||||
ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
this.executorService = executorService;
|
||||
this.handler = handler;
|
||||
this.verificaGiacenzeRowMapper = verificaGiacenzeRowMapper;
|
||||
this.giacenzaPvRESTConsumer = giacenzaPvRESTConsumer;
|
||||
@@ -87,8 +80,7 @@ public class VerificaGiacenzeViewModel {
|
||||
currentVerifica.postValue(null);
|
||||
currentVerificaRows.postValue(new ArrayList<>());
|
||||
|
||||
currentLoadedGiacenza = null;
|
||||
currentLoadedAnagrafiche = null;
|
||||
currentLoadedAnagrafiche = new ArrayList<>();
|
||||
}
|
||||
|
||||
public LiveData<VerificaGiacenzeEntity> getCurrentVerifica() {
|
||||
@@ -99,60 +91,6 @@ public class VerificaGiacenzeViewModel {
|
||||
return currentVerificaRows;
|
||||
}
|
||||
|
||||
public void loadDeposito(String codMdep) throws Exception {
|
||||
currentLoadedGiacenza = this.giacenzaPvRESTConsumer.retrieveGiacenzeSynchronized(codMdep);
|
||||
|
||||
if (currentLoadedGiacenza == null) {
|
||||
throw new Exception("Errore nel recupero delle giacenze");
|
||||
}
|
||||
|
||||
var codMartsToRetrieve = currentLoadedGiacenza.parallelStream()
|
||||
.map(GiacenzaPvDTO::getCodMart)
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
|
||||
currentLoadedAnagrafiche = this.articoloRESTConsumer.getByCodMartsSynchronized(codMartsToRetrieve);
|
||||
|
||||
if (currentLoadedAnagrafiche == null) {
|
||||
throw new Exception("Errore nel recupero delle anagrafiche");
|
||||
}
|
||||
|
||||
currentLoadedAnagrafiche.forEach(x -> x.setFlagTracciabilita("N"));
|
||||
}
|
||||
|
||||
public void randomizeElements(int elementsCount) {
|
||||
|
||||
for (int i = 0; i < elementsCount; i++) {
|
||||
var randomIndex = (int) (Math.random() * currentLoadedAnagrafiche.size());
|
||||
var randomAnagrafica = currentLoadedAnagrafiche.get(randomIndex);
|
||||
|
||||
var foundGiacenza = currentLoadedGiacenza.parallelStream()
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(randomAnagrafica.getCodMart()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
var qtaGiacenza = foundGiacenza != null ? foundGiacenza.getQtaInv() : BigDecimal.ZERO;
|
||||
|
||||
var rowToInsert = new VerificaGiacenzeRowEntity();
|
||||
rowToInsert.setParentId(currentVerifica.getValue().getId());
|
||||
rowToInsert.setCodMart(randomAnagrafica.getCodMart());
|
||||
rowToInsert.setDescrizione(randomAnagrafica.getDescrizione());
|
||||
rowToInsert.setScanCodBarre(randomAnagrafica.getBarCode());
|
||||
rowToInsert.setNumConf(BigDecimal.valueOf((int) (Math.random() * 100)));
|
||||
rowToInsert.setQtaConf(randomAnagrafica.getQtaCnf());
|
||||
rowToInsert.setQta(UtilityBigDecimal.multiply(rowToInsert.getNumConf(), randomAnagrafica.getQtaCnf()));
|
||||
rowToInsert.setQtaInGiacenza(qtaGiacenza);
|
||||
|
||||
|
||||
insertRow(rowToInsert);
|
||||
|
||||
try {
|
||||
Thread.sleep(50);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void createNew(String codMdep) {
|
||||
var verificaGiacenzeEntity = new VerificaGiacenzeEntity();
|
||||
verificaGiacenzeEntity.setCodMdep(codMdep);
|
||||
@@ -172,7 +110,7 @@ public class VerificaGiacenzeViewModel {
|
||||
}
|
||||
|
||||
public void close() throws Exception {
|
||||
if (currentVerificaRows.getValue().isEmpty()) {
|
||||
if (currentVerificaRows.getValue() == null || currentVerificaRows.getValue().isEmpty()) {
|
||||
delete();
|
||||
return;
|
||||
}
|
||||
@@ -187,32 +125,52 @@ public class VerificaGiacenzeViewModel {
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
|
||||
if (UtilityBarcode.isEanPeso(barcodeScanDTO)) {
|
||||
var ean13 = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
|
||||
this.loadArticolo(ean13.getPrecode());
|
||||
|
||||
} else {
|
||||
this.loadArticolo(barcodeScanDTO.getStringValue());
|
||||
}
|
||||
}
|
||||
|
||||
private void loadArticolo(String barcodeProd) throws Exception {
|
||||
var mtbAartList = this.articoloRESTConsumer.searchByBarcodeSynchronized(barcodeProd);
|
||||
|
||||
private void loadArticolo(String barcodeProd) throws NoArtsFoundException, CloneNotSupportedException {
|
||||
var foundMtbAart = searchAnagraficaByBarcode(barcodeProd);
|
||||
if (mtbAartList != null && !mtbAartList.isEmpty()) {
|
||||
MtbAart loadedArticolo;
|
||||
|
||||
if (foundMtbAart == null)
|
||||
throw new NoArtsFoundException();
|
||||
if (mtbAartList.size() == 1) loadedArticolo = mtbAartList.get(0);
|
||||
else loadedArticolo = this.sendChooseArtRequest(mtbAartList);
|
||||
|
||||
loadArticolo(foundMtbAart);
|
||||
if (loadedArticolo == null) return;
|
||||
loadedArticolo.setFlagTracciabilita("N");
|
||||
|
||||
this.updateCurrentAnagrafiche(loadedArticolo);
|
||||
this.loadArticolo(loadedArticolo);
|
||||
} else throw new NoArtsFoundException();
|
||||
}
|
||||
|
||||
public void loadArticolo(MtbAart mtbAart) throws NoArtsFoundException, CloneNotSupportedException {
|
||||
var foundGiacenza = currentLoadedGiacenza.parallelStream()
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
|
||||
private void updateCurrentAnagrafiche(MtbAart loadedArticolo) {
|
||||
MtbAart mtbAart = currentLoadedAnagrafiche.stream()
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(loadedArticolo.getCodMart()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (mtbAart != null) currentLoadedAnagrafiche.remove(mtbAart);
|
||||
|
||||
currentLoadedAnagrafiche.add(loadedArticolo);
|
||||
}
|
||||
|
||||
public void loadArticolo(MtbAart mtbAart) throws Exception {
|
||||
var foundGiacenzaList = giacenzaPvRESTConsumer.retrieveGiacenzeSynchronized(
|
||||
Objects.requireNonNull(currentVerifica.getValue()).getCodMdep(),
|
||||
mtbAart.getCodMart()
|
||||
);
|
||||
|
||||
if (foundGiacenzaList == null || foundGiacenzaList.isEmpty() || foundGiacenzaList.stream().count() > 1)
|
||||
throw new Exception("Errore nel recupero delle giacenze");
|
||||
var foundGiacenza = foundGiacenzaList.get(0);
|
||||
|
||||
var numCnfGiacenza = foundGiacenza != null ? UtilityBigDecimal.divide(foundGiacenza.getQtaInv(), mtbAart.getQtaCnf()) : BigDecimal.ZERO;
|
||||
var qtaCnfGiacenza = mtbAart.getQtaCnf();
|
||||
var qtaGiacenza = foundGiacenza != null ? foundGiacenza.getQtaInv() : BigDecimal.ZERO;
|
||||
@@ -226,7 +184,7 @@ public class VerificaGiacenzeViewModel {
|
||||
|
||||
boolean isNewRow = false;
|
||||
|
||||
var rowToSave = currentVerificaRows.getValue().parallelStream()
|
||||
var rowToSave = Objects.requireNonNull(currentVerificaRows.getValue()).parallelStream()
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
@@ -235,7 +193,7 @@ public class VerificaGiacenzeViewModel {
|
||||
isNewRow = true;
|
||||
|
||||
rowToSave = new VerificaGiacenzeRowEntity();
|
||||
rowToSave.setParentId(currentVerifica.getValue().getId());
|
||||
rowToSave.setParentId(Objects.requireNonNull(currentVerifica.getValue()).getId());
|
||||
rowToSave.setCodMart(mtbAart.getCodMart());
|
||||
rowToSave.setPartitaMag(null);
|
||||
rowToSave.setDescrizione(mtbAart.getDescrizione());
|
||||
@@ -246,21 +204,18 @@ public class VerificaGiacenzeViewModel {
|
||||
initialQtaTot = rowToSave.getQta();
|
||||
}
|
||||
|
||||
var pickedQuantity = this.sendOnItemDispatched(mtbAart,
|
||||
var pickedQuantity = this.sendOnItemDispatched(
|
||||
mtbAart,
|
||||
initialNumCnf,
|
||||
qtaCnfGiacenza,
|
||||
initialQtaTot,
|
||||
numCnfGiacenza,
|
||||
qtaGiacenza,
|
||||
incomingNumCnf,
|
||||
incomingQta,
|
||||
null,
|
||||
null
|
||||
incomingQta
|
||||
);
|
||||
|
||||
if (pickedQuantity == null)
|
||||
return;
|
||||
|
||||
if (pickedQuantity == null) return;
|
||||
|
||||
rowToSave.setNumConf(pickedQuantity.getNumCnf());
|
||||
rowToSave.setQtaConf(pickedQuantity.getQtaCnf());
|
||||
@@ -272,7 +227,6 @@ public class VerificaGiacenzeViewModel {
|
||||
} else {
|
||||
updateRow(rowToSave);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public MtbAart searchAnagraficaByCodMart(String codMart) {
|
||||
@@ -282,24 +236,6 @@ public class VerificaGiacenzeViewModel {
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
public MtbAart searchAnagraficaByBarcode(String barcode) {
|
||||
MtbAart mtbAart = currentLoadedAnagrafiche.parallelStream()
|
||||
.filter(x -> barcode.equals(x.getBarCode()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (mtbAart == null) {
|
||||
mtbAart = currentLoadedAnagrafiche.parallelStream()
|
||||
.filter(x -> x.getMtbAartBarCode() != null &&
|
||||
x.getMtbAartBarCode().stream()
|
||||
.anyMatch(y -> barcode.equals(y.getCodBarre())))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
return mtbAart;
|
||||
}
|
||||
|
||||
public void insertRow(VerificaGiacenzeRowEntity rowEntity) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
@@ -316,7 +252,7 @@ public class VerificaGiacenzeViewModel {
|
||||
|
||||
verificaGiacenzeRowRepository.insert(rowEntity, insertedData -> {
|
||||
handler.post(() -> {
|
||||
currentVerificaRows.getValue().add(insertedData);
|
||||
Objects.requireNonNull(currentVerificaRows.getValue()).add(insertedData);
|
||||
notifyRowChanged();
|
||||
});
|
||||
}, this::sendError);
|
||||
@@ -339,7 +275,7 @@ public class VerificaGiacenzeViewModel {
|
||||
var indexInList = -1;
|
||||
|
||||
List<VerificaGiacenzeRowEntity> value = currentVerificaRows.getValue();
|
||||
for (int i = 0; i < value.size(); i++) {
|
||||
for (int i = 0; i < Objects.requireNonNull(value).size(); i++) {
|
||||
VerificaGiacenzeRowEntity entity = value.get(i);
|
||||
|
||||
if (Objects.equals(entity.getId(), rowEntity.getId())) {
|
||||
@@ -374,7 +310,7 @@ public class VerificaGiacenzeViewModel {
|
||||
verificaGiacenzeRowRepository.delete(rowEntity, () -> {
|
||||
|
||||
handler.post(() -> {
|
||||
currentVerificaRows.getValue().remove(rowEntity);
|
||||
Objects.requireNonNull(currentVerificaRows.getValue()).remove(rowEntity);
|
||||
notifyRowChanged();
|
||||
});
|
||||
|
||||
@@ -386,6 +322,25 @@ public class VerificaGiacenzeViewModel {
|
||||
this.sendOnLoadingEnded();
|
||||
}
|
||||
|
||||
private MtbAart sendChooseArtRequest(List<MtbAart> mtbAarts) {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
AtomicReference<MtbAart> result = new AtomicReference<>();
|
||||
|
||||
listener.onChooseArtRequest(mtbAarts, data -> {
|
||||
result.set(data);
|
||||
latch.countDown();
|
||||
});
|
||||
|
||||
try {
|
||||
latch.await();
|
||||
return result.get();
|
||||
} catch (InterruptedException e) {
|
||||
this.sendError(e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private PickedQuantityDTO sendOnItemDispatched(MtbAart mtbAart,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
@@ -393,15 +348,13 @@ public class VerificaGiacenzeViewModel {
|
||||
BigDecimal inWarehouseNumCnf,
|
||||
BigDecimal inWarehouseQtaTot,
|
||||
BigDecimal incomingNumCnf,
|
||||
BigDecimal incomingQtaTot,
|
||||
String partitaMag,
|
||||
LocalDate dataScad) {
|
||||
BigDecimal incomingQtaTot) {
|
||||
if (listener != null)
|
||||
return this.listener.onItemDispatched(mtbAart,
|
||||
initialNumCnf, initialQtaCnf, initialQtaTot,
|
||||
inWarehouseNumCnf, inWarehouseQtaTot,
|
||||
incomingNumCnf, incomingQtaTot,
|
||||
partitaMag, dataScad);
|
||||
return this.listener.onItemDispatched(
|
||||
mtbAart, initialNumCnf, initialQtaCnf,
|
||||
initialQtaTot, inWarehouseNumCnf, inWarehouseQtaTot,
|
||||
incomingNumCnf, incomingQtaTot, null, null
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -435,5 +388,7 @@ public class VerificaGiacenzeViewModel {
|
||||
LocalDate dataScad);
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
void onChooseArtRequest(List<MtbAart> artsList, RunnableArgs<MtbAart> onComplete);
|
||||
}
|
||||
}
|
||||
@@ -774,12 +774,12 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
public void addExtraItem() {
|
||||
handler.post(() -> {
|
||||
DialogScanArtView
|
||||
.newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, mtbColt) -> {
|
||||
.newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, colloInGiac) -> {
|
||||
if (status == DialogConsts.Results.YES) {
|
||||
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColt);
|
||||
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, colloInGiac);
|
||||
} catch (Exception e) {
|
||||
onError(e);
|
||||
}
|
||||
@@ -1033,6 +1033,15 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarning(String warningText, Runnable action) {
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(this, new SpannableString(Html.fromHtml(warningText)), null, action)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFullItemDispatched(PickingObjectDTO pickingObjectDTO,
|
||||
MtbAart mtbAart,
|
||||
|
||||
@@ -27,6 +27,7 @@ import javax.inject.Inject;
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||
import it.integry.integrywmsnative.core.exception.AnomaliaUlException;
|
||||
import it.integry.integrywmsnative.core.exception.EmptyLUException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidCodMdepException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||
@@ -71,9 +72,11 @@ import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRE
|
||||
import it.integry.integrywmsnative.core.rest.model.CriterioDistribuzioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||
import it.integry.integrywmsnative.core.rest.model.GetColliByBarcodesRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.LoadColliDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.imballi.ImballoQuantityDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
|
||||
@@ -615,7 +618,9 @@ public class SpedizioneViewModel {
|
||||
throw new NoLUFoundException();
|
||||
}
|
||||
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
|
||||
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
|
||||
this.checkAnomaliaUl(response);
|
||||
var mtbColt = response.getMtbColt();
|
||||
|
||||
if (mtbColt.getSegno() != mDefaultSegnoCol) {
|
||||
throw new InvalidLUException();
|
||||
@@ -660,7 +665,9 @@ public class SpedizioneViewModel {
|
||||
|
||||
|
||||
private void executeEtichettaAnonimaNotOpenedLU(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeScanDTO.getStringValue(), true, false);
|
||||
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeScanDTO.getStringValue(), true, false);
|
||||
this.checkAnomaliaUl(response);
|
||||
var mtbColt = response.getMtbColt();
|
||||
|
||||
if (mtbColt == null) {
|
||||
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
||||
@@ -710,7 +717,9 @@ public class SpedizioneViewModel {
|
||||
throw new NoLUFoundException();
|
||||
}
|
||||
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
|
||||
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
|
||||
this.checkAnomaliaUl(response);
|
||||
var mtbColt = response.getMtbColt();
|
||||
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
|
||||
@@ -727,7 +736,9 @@ public class SpedizioneViewModel {
|
||||
}
|
||||
|
||||
private void executeEtichettaLU(String SSCC) throws Exception {
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
|
||||
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
|
||||
this.checkAnomaliaUl(response);
|
||||
var mtbColt = response.getMtbColt();
|
||||
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
if (mtbColt.getSegno() != -1) {
|
||||
@@ -896,10 +907,10 @@ public class SpedizioneViewModel {
|
||||
|
||||
for (PickingObjectDTO pickingObject : pickingList) {
|
||||
//Da verificare se il controllo per partita deve essere sempre effettuato
|
||||
if (UtilityString.equalsIgnoreCase(x.getCodMart(), pickingObject.getSitArtOrdDTO().getCodMart()) &&
|
||||
UtilityString.equalsIgnoreCase(x.getCodTagl(), pickingObject.getSitArtOrdDTO().getCodTagl()) &&
|
||||
UtilityString.equalsIgnoreCase(x.getCodCol(), pickingObject.getSitArtOrdDTO().getCodCol()) &&
|
||||
(!mEnableCheckPartitaMag || UtilityString.equalsIgnoreCase(x.getPartitaMag(), pickingObject.getSitArtOrdDTO().getPartitaMag()) || UtilityString.isNullOrEmpty(pickingObject.getSitArtOrdDTO().getPartitaMag()))) {
|
||||
if (UtilityString.equalsIgnoreCase(x.getCodMart(), pickingObject.getSitArtOrdDTO().getCodMart()) &&
|
||||
UtilityString.equalsIgnoreCase(x.getCodTagl(), pickingObject.getSitArtOrdDTO().getCodTagl()) &&
|
||||
UtilityString.equalsIgnoreCase(x.getCodCol(), pickingObject.getSitArtOrdDTO().getCodCol()) &&
|
||||
(!mEnableCheckPartitaMag || UtilityString.equalsIgnoreCase(x.getPartitaMag(), pickingObject.getSitArtOrdDTO().getPartitaMag()) || UtilityString.isNullOrEmpty(pickingObject.getSitArtOrdDTO().getPartitaMag()))) {
|
||||
|
||||
if (!matchPickingObject.contains(pickingObject)) {
|
||||
matchPickingObject.add(pickingObject);
|
||||
@@ -1282,7 +1293,8 @@ public class SpedizioneViewModel {
|
||||
return !stati.isEmpty() ? stati.get(0) : null;
|
||||
}
|
||||
|
||||
public void dispatchExtraItem(MtbAart mtbAart, Ean128Model ean128Model, MtbColt refMtbColt) throws Exception {
|
||||
public void dispatchExtraItem(MtbAart mtbAart, Ean128Model ean128Model, GetColloInGiacResponseDTO colloInGiac) throws Exception {
|
||||
this.checkAnomaliaUl(colloInGiac);
|
||||
|
||||
PickingObjectDTO pickingObjectDTO = new PickingObjectDTO().setMtbAart(mtbAart).setTempPickData(PickDataDTO.fromEan128(ean128Model));
|
||||
|
||||
@@ -1301,7 +1313,7 @@ public class SpedizioneViewModel {
|
||||
String partitaMag = null;
|
||||
LocalDate dataScad = null;
|
||||
|
||||
// MtbColt refMtbColt = null;
|
||||
MtbColt refMtbColt = colloInGiac.getMtbColt();
|
||||
|
||||
if (refMtbColt != null && refMtbColt.getMtbColr() != null && !refMtbColt.getMtbColr().isEmpty()) {
|
||||
MtbColr mtbColrToUse = refMtbColt.getMtbColr().get(0);
|
||||
@@ -1525,7 +1537,7 @@ public class SpedizioneViewModel {
|
||||
private MtbColt loadRifULFromMtbColr(MtbColr mtbColr) throws Exception {
|
||||
//Se ho dei riferimenti ad una UL devo leggere la QTA ancora disponibile sulla Ul
|
||||
if (mtbColr != null && !UtilityString.isNullOrEmpty(mtbColr.getGestioneRif()) && !UtilityString.isNullOrEmpty(mtbColr.getSerColloRif()) && !UtilityString.isNullOrEmpty(mtbColr.getDataColloRifS()) && mtbColr.getNumColloRif() != null) {
|
||||
return mColliMagazzinoRESTConsumer.getBySsccSynchronized(mtbColr.getBarcodeUlOut(), true, false);
|
||||
return mColliMagazzinoRESTConsumer.getBySsccSynchronized(mtbColr.getBarcodeUlOut(), true, false).getMtbColt();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -1867,6 +1879,17 @@ public class SpedizioneViewModel {
|
||||
return closeResponse.getGeneratedMtbColts();
|
||||
}
|
||||
|
||||
private void checkAnomaliaUl(GetColloInGiacResponseDTO colloInGiac) {
|
||||
if (colloInGiac.getEscludiPickingLavorazione() && mDefaultGestioneOfUL == GestioneEnum.LAVORAZIONE) {
|
||||
this.sendError(new AnomaliaUlException(colloInGiac));
|
||||
} else if (colloInGiac.getEscludiPickingVendita() && mDefaultGestioneOfUL == GestioneEnum.VENDITA) {
|
||||
this.sendError(new AnomaliaUlException(colloInGiac));
|
||||
} else if (colloInGiac.getMessageAnomalia() != null) {
|
||||
this.onWarning(colloInGiac.getMessageAnomalia(), () -> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private List<MtbColt> validateTheUdsToBeDuplicated(List<MtbColt> mtbColtList) throws Exception {
|
||||
var clonedLu = (MtbColt) this.mCurrentMtbColt.clone();
|
||||
|
||||
@@ -2077,7 +2100,7 @@ public class SpedizioneViewModel {
|
||||
private void moveLUtoLU(List<MtbColt> sourceMtbColts, String destBarcodeUl) throws Exception {
|
||||
for (MtbColt sourceMtbColt : sourceMtbColts) {
|
||||
|
||||
if(mIsApprovLinee) {
|
||||
if (mIsApprovLinee) {
|
||||
//Scambio i campi barcode_ul_in e barcode_ul_out per far funzionare il posizionamento dell'L+
|
||||
sourceMtbColt.getMtbColr()
|
||||
.forEach(x -> {
|
||||
@@ -2354,8 +2377,11 @@ public class SpedizioneViewModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface Listener extends ILUPrintListener, ILoadingListener, ILUBaseOperationsListener {
|
||||
private void onWarning(String warningText, Runnable action) {
|
||||
if (mListener != null) mListener.onWarning(warningText, action);
|
||||
}
|
||||
|
||||
public interface Listener extends ILUPrintListener, ILoadingListener, ILUBaseOperationsListener {
|
||||
void onLUPesoRequired(String codTcol, BigDecimal netWeightKG, BigDecimal grossWeightKG, RunnableArgsss<String, BigDecimal, BigDecimal> onComplete);
|
||||
|
||||
void onFilterApplied(String newValue);
|
||||
@@ -2364,6 +2390,8 @@ public class SpedizioneViewModel {
|
||||
|
||||
void onError(Exception ex, boolean useSnackbar);
|
||||
|
||||
void onWarning(String warningText, Runnable action);
|
||||
|
||||
void onFullItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaOrd, BigDecimal totalNumCnfOrd, BigDecimal qtaCnfOrd, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String partitaMag, LocalDate dataScad, boolean canOverflowOrderQuantity, boolean canBatchLotBeChanged, RunnableArgs<PickedQuantityDTO> onComplete, Runnable onAbort);
|
||||
|
||||
void onInfoAggiuntiveRequired(MtbColt currentMtbColt, RunnableArgss<String, ObservableMtbTcol> onComplete);
|
||||
|
||||
@@ -26,6 +26,7 @@ import it.integry.integrywmsnative.core.model.secondary.TrasferimentoPedaneStatu
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.TrasferimentoPedaneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLiveData;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
@@ -109,17 +110,17 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
});
|
||||
});
|
||||
|
||||
if (trasferimento.getStatusEnum() == TrasferimentoPedaneStatusEnum.APERTO) {
|
||||
UtilityLiveData.observeOnce(rowsLiveData, rowList -> {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
checkDataConsistency(rowList);
|
||||
} catch (Exception e) {
|
||||
this.sendError(e);
|
||||
}
|
||||
if (trasferimento.getStatusEnum() == TrasferimentoPedaneStatusEnum.APERTO) {
|
||||
UtilityLiveData.observeOnce(rowsLiveData, rowList -> {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
checkDataConsistency(rowList);
|
||||
} catch (Exception e) {
|
||||
this.sendError(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -143,14 +144,16 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
|
||||
if (!ssccList.isEmpty()) {
|
||||
|
||||
List<MtbColt> bySsccListSynchronized = colliMagazzinoRESTConsumer.getBySsccListSynchronized(ssccList, true, false);
|
||||
cacheMtbColtList.addAll(bySsccListSynchronized);
|
||||
var bySsccListSynchronized = colliMagazzinoRESTConsumer.getBySsccListSynchronized(ssccList, true, false);
|
||||
List<MtbColt> mtbColtList = bySsccListSynchronized.stream().map(GetColloInGiacResponseDTO::getMtbColt).toList();
|
||||
|
||||
cacheMtbColtList.addAll(mtbColtList);
|
||||
|
||||
rowList
|
||||
.stream()
|
||||
.filter(x -> x.getDetailMtbColt() == null)
|
||||
.forEach(row -> {
|
||||
MtbColt mtbColtDetail = bySsccListSynchronized.stream()
|
||||
MtbColt mtbColtDetail = mtbColtList.stream()
|
||||
.filter(x -> x.getBarcodeUl().equals(row.getBarcodeUl()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
@@ -200,7 +203,8 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
}
|
||||
|
||||
private void handleSSCCBarcode(String sscc) throws Exception {
|
||||
var mtbColt = this.colliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
|
||||
var mtbColt = this.colliMagazzinoRESTConsumer
|
||||
.getBySsccSynchronized(sscc, true, false).getMtbColt();
|
||||
|
||||
if (defaultSourceCodMdep != null && !mtbColt.getCodMdep().equalsIgnoreCase(defaultSourceCodMdep))
|
||||
throw new IllegalArgumentException("L'UL scansionata non appartiene al magazzino di partenza del trasferimento");
|
||||
|
||||
@@ -74,7 +74,7 @@ public class UltimiArriviFornitoreViewModel {
|
||||
|
||||
|
||||
private void executeEtichettaLU(String SSCC) throws Exception {
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false).getMtbColt();
|
||||
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
if (mtbColt.getSegno() > 0) {
|
||||
|
||||
@@ -146,8 +146,18 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
|
||||
public void openLU() {
|
||||
DialogScanOrCreateLUView.newInstance(true, false, true, false, true, scanOrCreateResult -> {
|
||||
var colloInGiac = scanOrCreateResult.getColloInGiac();
|
||||
var mtbColt = scanOrCreateResult.getMtbColt();
|
||||
|
||||
if (colloInGiac.getMessageAnomalia() != null) {
|
||||
DialogSimpleMessageView.makeWarningDialog(requireContext(),
|
||||
new SpannableString(
|
||||
Html.fromHtml(colloInGiac.getMessageAnomalia())),
|
||||
null, () -> {
|
||||
}
|
||||
).show();
|
||||
}
|
||||
|
||||
if (scanOrCreateResult.isAborted() || scanOrCreateResult.getMtbColt() == null) {
|
||||
((IPoppableActivity) getActivity()).pop();
|
||||
} else if (((mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && mtbColt.getSegno().equals(+1)) ||
|
||||
@@ -156,7 +166,7 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
executorService.execute(() -> {
|
||||
this.onLoadingStarted();
|
||||
try {
|
||||
mViewModel.initUL(mtbColt);
|
||||
mViewModel.initUL(colloInGiac);
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
|
||||
@@ -37,6 +37,7 @@ import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsu
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPutItemsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
@@ -50,6 +51,7 @@ import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
public class VersamentoMerceViewModel {
|
||||
|
||||
private final MutableLiveData<MtbColt> mCurrentMtbColt = new MutableLiveData<>();
|
||||
private final MutableLiveData<GetColloInGiacResponseDTO> mCurrentMtbColtWithAnomalia = new MutableLiveData<>();
|
||||
private final MutableLiveData<List<SuggestedULPositionDTO>> mSuggestedULPositions = new MutableLiveData<>();
|
||||
|
||||
private Listener mListener;
|
||||
@@ -69,16 +71,17 @@ public class VersamentoMerceViewModel {
|
||||
this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer;
|
||||
}
|
||||
|
||||
public void initUL(MtbColt mtbColt) throws Exception {
|
||||
this.mCurrentMtbColt.postValue(mtbColt);
|
||||
public void initUL(GetColloInGiacResponseDTO response) throws Exception {
|
||||
this.mCurrentMtbColtWithAnomalia.postValue(response);
|
||||
this.mCurrentMtbColt.postValue(response.getMtbColt());
|
||||
|
||||
refreshSuggestedULPositions(mtbColt);
|
||||
refreshSuggestedULPositions(response.getMtbColt());
|
||||
}
|
||||
|
||||
private void refreshSuggestedULPositions(MtbColt mtbColt) throws Exception {
|
||||
List<SuggestedULPositionDTO> suggestedULPositionDTOS = this.mPosizioniRESTConsumer.suggestUlPositionSynchronized(mtbColt.getBarcodeUl());
|
||||
// Handle the suggested positions if needed
|
||||
if(suggestedULPositionDTOS == null || suggestedULPositionDTOS.isEmpty()) {
|
||||
if (suggestedULPositionDTOS == null || suggestedULPositionDTOS.isEmpty()) {
|
||||
// If no positions are suggested, we can either throw an exception or handle it gracefully
|
||||
return;
|
||||
}
|
||||
@@ -159,12 +162,12 @@ public class VersamentoMerceViewModel {
|
||||
private void executePosizioneMonocollo(MtbDepoPosizione foundPosizione) throws Exception {
|
||||
var barcodeUlInPosizioneList = this.mPosizioniRESTConsumer.getBancaliInPosizioneSynchronized(foundPosizione);
|
||||
|
||||
|
||||
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty()) {
|
||||
throw new NoLUFoundException();
|
||||
} else if (barcodeUlInPosizioneList.size() == 1) {
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
|
||||
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(
|
||||
barcodeUlInPosizioneList.get(0), true, false
|
||||
).getMtbColt();
|
||||
|
||||
//TAKE HERE
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableDepos().stream()
|
||||
@@ -174,11 +177,9 @@ public class VersamentoMerceViewModel {
|
||||
pickMerceULtoUL(mtbColt);
|
||||
} else throw new InvalidCodMdepException();
|
||||
|
||||
|
||||
} else {
|
||||
throw new TooManyLUFoundInMonoLUPositionException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -210,8 +211,9 @@ public class VersamentoMerceViewModel {
|
||||
|
||||
|
||||
private void executeEtichettaLU(String sscc, boolean isAnonima) throws Exception {
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
|
||||
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(
|
||||
sscc, true, false
|
||||
).getMtbColt();
|
||||
|
||||
if (mtbColt == null && !isAnonima) {
|
||||
throw new NoLUFoundException();
|
||||
@@ -230,7 +232,7 @@ public class VersamentoMerceViewModel {
|
||||
.setSerCollo(CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE)
|
||||
.setBarcodeUl(sscc);
|
||||
|
||||
var mtbColtAnonimo = this.mColliLavorazioneRESTConsumer.synchronousCreateUDC(createUDCRequestDTO);
|
||||
var mtbColtAnonimo = this.mColliLavorazioneRESTConsumer.createUDCSynchronized(createUDCRequestDTO);
|
||||
pickMerceULtoUL(mtbColtAnonimo);
|
||||
|
||||
} else {
|
||||
@@ -249,9 +251,8 @@ public class VersamentoMerceViewModel {
|
||||
this.sendOnLoadingStarted();
|
||||
MtbColt sourceMtbColt = mCurrentMtbColt.getValue();
|
||||
|
||||
if (!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep())) {
|
||||
if (!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep()))
|
||||
throw new Exception("Impossibile spostare la merce tra UL di due depositi differenti");
|
||||
}
|
||||
|
||||
List<MtbColr> mtbColrsToPick = sourceMtbColt.getMtbColr().stream()
|
||||
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaCol(), BigDecimal.ZERO))
|
||||
|
||||
@@ -29,7 +29,6 @@ import it.integry.integrywmsnative.databinding.BottomSheetFragmentLuContentBindi
|
||||
import it.integry.integrywmsnative.databinding.BottomSheetFragmentLuContentListItemBinding;
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__base.BottomSheetFragmentBaseView;
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditModalView;
|
||||
import kotlin.Unit;
|
||||
|
||||
public class BottomSheetFragmentLUContentView extends BottomSheetFragmentBaseView implements BottomSheetMtbColrEditModalView.Listener {
|
||||
|
||||
@@ -85,10 +84,10 @@ public class BottomSheetFragmentLUContentView extends BottomSheetFragmentBaseVie
|
||||
|
||||
new LiveAdapter(mViewModel.getObservableMtbColt().get().getMtbColr(), BR.item)
|
||||
.map(MtbColr.class, itemType)
|
||||
.onNoData(noData -> {
|
||||
this.mBinding.emptyView.setVisibility(noData ? View.VISIBLE : View.GONE);
|
||||
return Unit.INSTANCE;
|
||||
})
|
||||
// .onNoData(noData -> {
|
||||
// this.mBinding.emptyView.setVisibility(noData ? View.VISIBLE : View.GONE);
|
||||
// return Unit.INSTANCE;
|
||||
// })
|
||||
.into(this.mBinding.mtbColrRecyclerView);
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
|
||||
import it.integry.integrywmsnative.databinding.DialogScanArtBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_mtb_colr.DialogChooseArtFromListaMtbColrView;
|
||||
@@ -54,15 +55,15 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
|
||||
private int mBarcodeScannerInstanceID;
|
||||
|
||||
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onPickingCompleted = null;
|
||||
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> onPickingCompleted = null;
|
||||
private RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest = null;
|
||||
|
||||
|
||||
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||
return new DialogScanArtView(forceOnlyUL, onPickingCompleted, onMagazzinoAutomaticoPickingRequest);
|
||||
}
|
||||
|
||||
private DialogScanArtView(boolean forceOnlyUL, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onItemChoosed, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||
private DialogScanArtView(boolean forceOnlyUL, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> onItemChoosed, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||
super();
|
||||
|
||||
mForceOnlyUL = forceOnlyUL;
|
||||
@@ -136,7 +137,7 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
|
||||
try {
|
||||
|
||||
Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> result = this.mViewModel.processBarcodeDTO(data, pickMagazzinoAutomaticoPosizione -> {
|
||||
Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> result = this.mViewModel.processBarcodeDTO(data, pickMagazzinoAutomaticoPosizione -> {
|
||||
handler.post(() -> {
|
||||
this.onMagazzinoAutomaticoPickingRequest.run(pickMagazzinoAutomaticoPosizione);
|
||||
|
||||
@@ -148,9 +149,9 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
var status = result.getValue0();
|
||||
var mtbAart = result.getValue1();
|
||||
var ean128Model = result.getValue2();
|
||||
var mtbColt = result.getValue3();
|
||||
var colloInGiac = result.getValue3();
|
||||
|
||||
List<MtbColr> filteredMtbColrList = mtbColt.getMtbColr();
|
||||
List<MtbColr> filteredMtbColrList = colloInGiac.getMtbColt().getMtbColr();
|
||||
|
||||
if (mtbAart != null && filteredMtbColrList != null) {
|
||||
filteredMtbColrList = filteredMtbColrList.stream()
|
||||
@@ -164,15 +165,15 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
if (finalFilteredMtbColrList != null && finalFilteredMtbColrList.size() > 1) {
|
||||
DialogChooseArtFromListaMtbColrView.make(getActivity(), finalFilteredMtbColrList, mtbColrChose -> {
|
||||
|
||||
mtbColt.setMtbColr(new ObservableArrayList<>());
|
||||
mtbColt.getMtbColr().add(mtbColrChose);
|
||||
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColt);
|
||||
colloInGiac.getMtbColt().setMtbColr(new ObservableArrayList<>());
|
||||
colloInGiac.getMtbColt().getMtbColr().add(mtbColrChose);
|
||||
onPickingCompleted.run(status, mtbAart, ean128Model, colloInGiac);
|
||||
}).show();
|
||||
|
||||
} else if (finalFilteredMtbColrList != null && finalFilteredMtbColrList.size() == 1) {
|
||||
mtbColt.setMtbColr(new ObservableArrayList<>());
|
||||
mtbColt.getMtbColr().add(finalFilteredMtbColrList.get(0));
|
||||
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColt);
|
||||
colloInGiac.getMtbColt().setMtbColr(new ObservableArrayList<>());
|
||||
colloInGiac.getMtbColt().getMtbColr().add(finalFilteredMtbColrList.get(0));
|
||||
onPickingCompleted.run(status, mtbAart, ean128Model, colloInGiac);
|
||||
|
||||
} else {
|
||||
onPickingCompleted.run(status, mtbAart, ean128Model, null);
|
||||
|
||||
@@ -21,6 +21,7 @@ import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTCo
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
||||
@@ -57,7 +58,7 @@ public class DialogScanArtViewModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
|
||||
public Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
|
||||
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
|
||||
return this.executeEtichettaLU(barcodeScanDTO.getStringValue());
|
||||
@@ -82,7 +83,7 @@ public class DialogScanArtViewModel {
|
||||
}
|
||||
|
||||
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
var ean128Model = this.mBarcodeRESTConsumer.decodeEan128Synchronized(barcodeScanDTO);
|
||||
|
||||
|
||||
@@ -109,27 +110,28 @@ public class DialogScanArtViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
Ean13PesoModel ean13PesoModel = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
|
||||
|
||||
return this.loadArticolo(ean13PesoModel.getPrecode(), ean13PesoModel.toEan128());
|
||||
}
|
||||
|
||||
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaLU(String SSCC) throws Exception {
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executeEtichettaLU(String SSCC) throws Exception {
|
||||
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
|
||||
var mtbColt = response.getMtbColt();
|
||||
|
||||
if (mtbColt == null || mtbColt.getMtbColr() == null || mtbColt.getMtbColr().isEmpty())
|
||||
throw new NoLUFoundException();
|
||||
|
||||
if (mtbColt.getSegno() == -1) throw new InvalidLUException();
|
||||
|
||||
return new Quartet<>(DialogConsts.Results.YES, null, null, mtbColt);
|
||||
return new Quartet<>(DialogConsts.Results.YES, null, null, response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaPosizione(String stringValue, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executeEtichettaPosizione(String stringValue, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
|
||||
MtbDepoPosizione foundPosizione = SettingsManager.iDB().getAvailablePosizioni().stream()
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(stringValue))
|
||||
.findFirst()
|
||||
@@ -150,7 +152,7 @@ public class DialogScanArtViewModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executePosizione(MtbDepoPosizione posizione, MtbAart articolo) throws Exception {
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executePosizione(MtbDepoPosizione posizione, MtbAart articolo) throws Exception {
|
||||
var barcodeUlInPosizioneList = this.mPosizioniRESTConsumer.getBancaliInPosizioneSynchronized(posizione);
|
||||
|
||||
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty())
|
||||
@@ -160,12 +162,12 @@ public class DialogScanArtViewModel {
|
||||
throw new TooManyLUFoundInMonoLUPositionException();
|
||||
}
|
||||
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
|
||||
return new Quartet<>(DialogConsts.Results.YES, articolo, null, mtbColt);
|
||||
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
|
||||
return new Quartet<>(DialogConsts.Results.YES, articolo, null, response);
|
||||
}
|
||||
|
||||
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> loadArticolo(@NotNull String barcodeProd, Ean128Model ean128Model) throws Exception {
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> loadArticolo(@NotNull String barcodeProd, Ean128Model ean128Model) throws Exception {
|
||||
var mtbAartList = this.mArticoloRESTConsumer.searchByBarcodeSynchronized(barcodeProd);
|
||||
|
||||
if (mtbAartList == null || mtbAartList.isEmpty())
|
||||
|
||||
@@ -24,6 +24,7 @@ import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
|
||||
import it.integry.integrywmsnative.databinding.DialogScanOrCreateLuBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLUView;
|
||||
@@ -110,7 +111,7 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
||||
|
||||
mBindings.viewBasket.setOnClickListener(v -> {
|
||||
new DialogBasketLUView(mtbColt -> {
|
||||
onLUOpened(mtbColt, false);
|
||||
onLUOpened(new GetColloInGiacResponseDTO().setMtbColt(mtbColt), false);
|
||||
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
});
|
||||
|
||||
@@ -153,7 +154,14 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, this::onLoadingEnded);
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewModel.processBarcodeDTO(data);
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception ex) {
|
||||
this.onError(ex);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -180,30 +188,34 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUOpened(MtbColt mtbColt, boolean created) {
|
||||
this.openedMtbColt = mtbColt;
|
||||
mOnComplete.run(Result.completed(mtbColt, created));
|
||||
public void onLUOpened(GetColloInGiacResponseDTO colloInGiac, boolean created) {
|
||||
handler.post(() -> {
|
||||
this.openedMtbColt = colloInGiac.getMtbColt();
|
||||
mOnComplete.run(Result.completed(colloInGiac, created));
|
||||
|
||||
dismiss();
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static class Result {
|
||||
private final GetColloInGiacResponseDTO colloInGiac;
|
||||
private final MtbColt mtbColt;
|
||||
private final boolean newLU;
|
||||
private boolean aborted = false;
|
||||
|
||||
private Result(MtbColt mtbColt, boolean isNewLU) {
|
||||
this.mtbColt = mtbColt;
|
||||
private Result(GetColloInGiacResponseDTO colloInGiac, boolean isNewLU) {
|
||||
this.mtbColt = colloInGiac.getMtbColt();
|
||||
this.colloInGiac = colloInGiac;
|
||||
this.newLU = isNewLU;
|
||||
}
|
||||
|
||||
public static Result completed(MtbColt mtbColt, boolean isNewLU) {
|
||||
return new Result(mtbColt, isNewLU);
|
||||
public static Result completed(GetColloInGiacResponseDTO colloInGiac, boolean isNewLU) {
|
||||
return new Result(colloInGiac, isNewLU);
|
||||
}
|
||||
|
||||
public static Result aborted() {
|
||||
Result result = new Result(null, false);
|
||||
Result result = new Result(new GetColloInGiacResponseDTO().setMtbColt(null), false);
|
||||
result.aborted = true;
|
||||
return result;
|
||||
}
|
||||
@@ -212,6 +224,10 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
||||
return mtbColt;
|
||||
}
|
||||
|
||||
public GetColloInGiacResponseDTO getColloInGiac() {
|
||||
return colloInGiac;
|
||||
}
|
||||
|
||||
public boolean isNewLU() {
|
||||
return newLU;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
@@ -64,161 +65,154 @@ public class DialogScanOrCreateLUViewModel {
|
||||
var createUdcRequest = new CreateUDCRequestDTO()
|
||||
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||
|
||||
var createResponse = this.mColliLavorazioneRESTConsumer.synchronousCreateUDC(createUdcRequest);
|
||||
this.sendOnLUOpened(createResponse, true);
|
||||
var createResponse = this.mColliLavorazioneRESTConsumer.createUDCSynchronized(createUdcRequest);
|
||||
this.sendOnLUCreated(createResponse);
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
||||
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
||||
this.executeEtichettaPosizione(barcodeScanDTO);
|
||||
|
||||
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||
this.executeEtichettaAnonima(barcodeScanDTO, onComplete);
|
||||
this.executeEtichettaAnonima(barcodeScanDTO);
|
||||
|
||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
this.executeEAN128(barcodeScanDTO, onComplete);
|
||||
this.executeEAN128(barcodeScanDTO);
|
||||
|
||||
} else if (UtilityBarcode.isEan13(barcodeScanDTO)) {
|
||||
this.executeEAN13(barcodeScanDTO, onComplete);
|
||||
} else {
|
||||
onComplete.run();
|
||||
this.executeEAN13(barcodeScanDTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
|
||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||
.single();
|
||||
this.executePosizione(foundPosizione, onComplete);
|
||||
|
||||
this.executePosizione(foundPosizione);
|
||||
}
|
||||
|
||||
private void executePosizione(MtbDepoPosizione posizione, Runnable onComplete) {
|
||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(posizione, barcodeUlInPosizioneList -> {
|
||||
private void executePosizione(MtbDepoPosizione posizione) throws Exception {
|
||||
var barcodeUlInPosizioneList = this.mPosizioniRESTConsumer.getBancaliInPosizioneSynchronized(posizione);
|
||||
|
||||
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty()) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (barcodeUlInPosizioneList.size() == 1) {
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeUlInPosizioneList.get(0), mShouldCheckResiduo, false, mtbColt -> {
|
||||
onComplete.run();
|
||||
this.sendOnLUOpened(mtbColt, false);
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty()) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (barcodeUlInPosizioneList.size() == 1) {
|
||||
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), mShouldCheckResiduo, false);
|
||||
this.sendOnLUOpened(response);
|
||||
} else {
|
||||
throw new TooManyLUFoundInMonoLUPositionException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false, mtbColt -> {
|
||||
private void executeEtichettaAnonima(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false);
|
||||
var mtbColt = response.getMtbColt();
|
||||
|
||||
if (mtbColt == null) {
|
||||
if (mEnableCreation) {
|
||||
Integer customNumCollo = null;
|
||||
if (mtbColt == null) {
|
||||
if (mEnableCreation) {
|
||||
Integer customNumCollo = null;
|
||||
|
||||
try {
|
||||
customNumCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
|
||||
} catch (Exception ex) {
|
||||
this.sendError(ex);
|
||||
}
|
||||
|
||||
var createUdcRequest = new CreateUDCRequestDTO()
|
||||
.setBarcodeUl(barcodeScanDTO.getStringValue())
|
||||
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep())
|
||||
.setNumCollo(customNumCollo)
|
||||
.setSerCollo(CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE);
|
||||
|
||||
this.mColliLavorazioneRESTConsumer.createUDC(createUdcRequest, createdMtbColt -> {
|
||||
onComplete.run();
|
||||
this.sendOnLUOpened(createdMtbColt, true);
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
try {
|
||||
customNumCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
|
||||
} catch (Exception ex) {
|
||||
this.sendError(ex);
|
||||
}
|
||||
} else {
|
||||
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||
this.sendError(new AlreadyAttachedDocumentToLUException());
|
||||
} else {
|
||||
mtbColt.setDisablePrint(true);
|
||||
onComplete.run();
|
||||
this.sendOnLUOpened(mtbColt, false);
|
||||
}
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
var createUdcRequest = new CreateUDCRequestDTO()
|
||||
.setBarcodeUl(barcodeScanDTO.getStringValue())
|
||||
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep())
|
||||
.setNumCollo(customNumCollo)
|
||||
.setSerCollo(CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE);
|
||||
|
||||
var createdMtbColt = this.mColliLavorazioneRESTConsumer.createUDCSynchronized(createUdcRequest);
|
||||
this.sendOnLUCreated(createdMtbColt);
|
||||
} else {
|
||||
throw new NoLUFoundException();
|
||||
}
|
||||
} else {
|
||||
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||
throw new AlreadyAttachedDocumentToLUException();
|
||||
} else {
|
||||
mtbColt.setDisablePrint(true);
|
||||
this.sendOnLUOpened(response);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void executeEAN128(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
private void executeEAN128(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
var ean128Model = this.mBarcodeRESTConsumer.decodeEan128Synchronized(barcodeScanDTO);
|
||||
|
||||
if (ean128Model != null && !UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
if (ean128Model == null || UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
throw new NoLUFoundException();
|
||||
}
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(ean128Model.Sscc, mShouldCheckResiduo, false, mtbColt -> {
|
||||
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(ean128Model.Sscc, mShouldCheckResiduo, false);
|
||||
if (response == null)
|
||||
throw new NoLUFoundException();
|
||||
|
||||
if (mtbColt != null) {
|
||||
var mtbColt = response.getMtbColt();
|
||||
|
||||
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||
this.sendError(new AlreadyAttachedDocumentToLUException());
|
||||
} else {
|
||||
if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA && mtbColt.getSegno() == -1 && mWarnOnOpeningVendita) {
|
||||
this.sendOnLUVenditaConfirmRequired(confirmed -> {
|
||||
if (confirmed) {
|
||||
onComplete.run();
|
||||
this.sendOnLUOpened(mtbColt, false);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
onComplete.run();
|
||||
this.sendOnLUOpened(mtbColt, false);
|
||||
}
|
||||
if (mtbColt != null) {
|
||||
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||
throw new AlreadyAttachedDocumentToLUException();
|
||||
} else {
|
||||
if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA && mtbColt.getSegno() == -1 && mWarnOnOpeningVendita) {
|
||||
this.sendOnLUVenditaConfirmRequired(confirmed -> {
|
||||
if (confirmed) {
|
||||
this.sendOnLUOpened(response);
|
||||
}
|
||||
|
||||
} else {
|
||||
var createUdcRequest = new CreateUDCRequestDTO()
|
||||
.setBarcodeUl(ean128Model.Sscc)
|
||||
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||
|
||||
this.mColliLavorazioneRESTConsumer.createUDC(createUdcRequest, createdMtbColt -> {
|
||||
onComplete.run();
|
||||
this.sendOnLUOpened(createdMtbColt, true);
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
});
|
||||
} else {
|
||||
this.sendOnLUOpened(response);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var createUdcRequest = new CreateUDCRequestDTO()
|
||||
.setBarcodeUl(ean128Model.Sscc)
|
||||
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||
|
||||
var createdMtbColt = this.mColliLavorazioneRESTConsumer.createUDCSynchronized(createUdcRequest);
|
||||
this.sendOnLUCreated(createdMtbColt);
|
||||
}
|
||||
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void executeEAN13(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
this.mArticoloRESTConsumer.searchByBarcode(barcodeScanDTO.getStringValue(), articoli -> {
|
||||
if (articoli != null && articoli.size() == 1) {
|
||||
MtbAart articolo = articoli.get(0);
|
||||
MtbDepoPosizione posizione = UtilityPosizione.getFromCache(articolo.getPosizione());
|
||||
if (posizione != null && posizione.isFlagMonoCollo()) {
|
||||
this.executePosizione(posizione, onComplete);
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
}
|
||||
private void executeEAN13(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
var articoli = this.mArticoloRESTConsumer.searchByBarcodeSynchronized(barcodeScanDTO.getStringValue());
|
||||
if (articoli != null && articoli.size() == 1) {
|
||||
MtbAart articolo = articoli.get(0);
|
||||
MtbDepoPosizione posizione = UtilityPosizione.getFromCache(articolo.getPosizione());
|
||||
if (posizione != null && posizione.isFlagMonoCollo()) {
|
||||
this.executePosizione(posizione);
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
throw new NoLUFoundException();
|
||||
}
|
||||
}, this::sendError);
|
||||
} else {
|
||||
throw new NoLUFoundException();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendOnLUVenditaConfirmRequired(RunnableArgs<Boolean> onConfirm) {
|
||||
if (this.mListener != null) mListener.onLUVenditaConfirmRequired(onConfirm);
|
||||
}
|
||||
|
||||
private void sendOnLUOpened(MtbColt mtbColt, boolean created) {
|
||||
if (this.mListener != null) mListener.onLUOpened(mtbColt, created);
|
||||
private void sendOnLUCreated(MtbColt mtbColt) {
|
||||
if (this.mListener != null) {
|
||||
mListener.onLUOpened(
|
||||
new GetColloInGiacResponseDTO().setMtbColt(mtbColt), true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void sendOnLUOpened(GetColloInGiacResponseDTO colloInGiac) {
|
||||
if (this.mListener != null) mListener.onLUOpened(colloInGiac, false);
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
@@ -241,7 +235,7 @@ public class DialogScanOrCreateLUViewModel {
|
||||
|
||||
void onLUVenditaConfirmRequired(RunnableArgs<Boolean> onConfirm);
|
||||
|
||||
void onLUOpened(MtbColt mtbColt, boolean created);
|
||||
void onLUOpened(GetColloInGiacResponseDTO colloInGiac, boolean created);
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
|
||||
@@ -846,7 +846,8 @@
|
||||
android:layout_marginBottom="16dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
android:padding="16dp"
|
||||
android:visibility="@{viewModel.mtbColt == null || viewModel.mtbColt.mtbColr.size() == 0 ? View.VISIBLE : View.GONE}">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
<import type="it.integry.integrywmsnative.core.utility.data.UntMisUtils" />
|
||||
<import type="it.integry.integrywmsnative.core.utility.data.MtbColrUtils" />
|
||||
|
||||
<import type="android.view.View" />
|
||||
|
||||
<variable
|
||||
name="item"
|
||||
type="it.integry.integrywmsnative.core.model.MtbColr" />
|
||||
@@ -52,6 +54,7 @@
|
||||
android:layout_marginStart="6dp"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:visibility="@{item.getPartitaMag() != null ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintBaseline_toBaselineOf="@id/articolo_textview"
|
||||
app:layout_constraintStart_toEndOf="@id/articolo_textview"
|
||||
app:text='@{"Lotto: " + item.partitaMag}'
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
buildscript {
|
||||
ext {
|
||||
kotlin_version = '2.1.0'
|
||||
agp_version = '8.13.0'
|
||||
agp_version = '8.13.1'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
Reference in New Issue
Block a user