Implementato nuovo servizio di printEtichettaSSCC
This commit is contained in:
parent
e7334d358b
commit
f902439086
@ -11,12 +11,12 @@ import javax.inject.Singleton;
|
|||||||
|
|
||||||
import it.integry.integrywmsnative.BuildConfig;
|
import it.integry.integrywmsnative.BuildConfig;
|
||||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
|
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.JasperPairDTO;
|
import it.integry.integrywmsnative.core.rest.model.JasperPairDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
@ -32,26 +32,6 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getAvailablePrinters(String codMdep, final RunnableArgs<List<String>> onComplete, final RunnableArgs<Exception> onFailed) {
|
|
||||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
|
||||||
printerService.getAvailablePrinters(codMdep).enqueue(new Callback<>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<String>>> call, Response<ServiceRESTResponse<List<String>>> response) {
|
|
||||||
analyzeAnswer(response, "GetAvailablePrinters", printers -> {
|
|
||||||
onComplete.run(printers != null ? Stream.of(printers).withoutNulls().toList() : null);
|
|
||||||
}, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<String>>> call, Throwable t) {
|
|
||||||
Log.e("GetAvailablePrinters", t.toString());
|
|
||||||
UtilityLogger.errorMe(new Exception(t));
|
|
||||||
onFailed.run(new Exception(t));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void getAvailablePrinters(String codMdep, Type printerType, RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getAvailablePrinters(String codMdep, Type printerType, RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
String printerTypeStr = printerType != null ? printerType.toString() : null;
|
String printerTypeStr = printerType != null ? printerType.toString() : null;
|
||||||
@ -75,50 +55,43 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printCollo(String printerName, MtbColt testataColloToPrint, int quantity, String reportName, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void printCollo(Type printerType, MtbColt testataColloToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UtilityString.isNullOrEmpty(printerName)) {
|
|
||||||
onFailed.run(new Exception("Nessuna stampante configurata: valore null"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||||
printerService.printCollo(
|
Call<ServiceRESTResponse<Object>> callable = null;
|
||||||
printerName,
|
if (printerType != null)
|
||||||
testataColloToPrint.getDataColloS(),
|
callable = printerService.printCollo(printerType.toString(), testataColloToPrint);
|
||||||
testataColloToPrint.getGestione(),
|
else
|
||||||
testataColloToPrint.getSerCollo(),
|
callable = printerService.printCollo(testataColloToPrint);
|
||||||
testataColloToPrint.getNumCollo(),
|
|
||||||
quantity,
|
|
||||||
reportName)
|
|
||||||
|
|
||||||
.enqueue(new Callback<>() {
|
callable.enqueue(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||||
analyzeAnswer(response, "printCollo", data -> {
|
analyzeAnswer(response, "printCollo", data -> {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||||
if (t.getMessage().contains("Printer not found")) {
|
if (t.getMessage().contains("Printer not found")) {
|
||||||
onFailed.run(new NoPrintersFoundException());
|
onFailed.run(new NoPrintersFoundException());
|
||||||
} else onFailed.run(new Exception(t));
|
} else onFailed.run(new Exception(t));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void printReport(String printerName, String reportName, HashMap<String, Object> params, int quantity, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void printReport(String printerName, String reportName, HashMap<String, Object> params, int quantity, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
// if(BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
// onComplete.run();
|
onComplete.run();
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
JasperDTO jasperDTO = new JasperDTO();
|
JasperDTO jasperDTO = new JasperDTO();
|
||||||
jasperDTO.setReportName(reportName);
|
jasperDTO.setReportName(reportName);
|
||||||
|
|||||||
@ -2,20 +2,16 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
|
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
import retrofit2.http.Field;
|
|
||||||
import retrofit2.http.FormUrlEncoded;
|
|
||||||
import retrofit2.http.POST;
|
import retrofit2.http.POST;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
public interface PrinterRESTConsumerService {
|
public interface PrinterRESTConsumerService {
|
||||||
|
|
||||||
@POST("getAvailablePrinters")
|
|
||||||
Call<ServiceRESTResponse<List<String>>> getAvailablePrinters();
|
|
||||||
|
|
||||||
@POST("getAvailablePrinters")
|
@POST("getAvailablePrinters")
|
||||||
Call<ServiceRESTResponse<List<String>>> getAvailablePrinters(@Query("codMdep") String codMdep);
|
Call<ServiceRESTResponse<List<String>>> getAvailablePrinters(@Query("codMdep") String codMdep);
|
||||||
|
|
||||||
@ -23,19 +19,6 @@ public interface PrinterRESTConsumerService {
|
|||||||
Call<ServiceRESTResponse<List<String>>> getAvailablePrinters(@Query("codMdep") String codMdep, @Query("printerType") String printerType);
|
Call<ServiceRESTResponse<List<String>>> getAvailablePrinters(@Query("codMdep") String codMdep, @Query("printerType") String printerType);
|
||||||
|
|
||||||
|
|
||||||
@POST("pkgPrintLabel")
|
|
||||||
@FormUrlEncoded
|
|
||||||
Call<ServiceRESTResponse<Object>> printCollo(
|
|
||||||
@Query("printerName") String printerName,
|
|
||||||
@Field("dataCollo") String dataCollo,
|
|
||||||
@Field("gestione") String gestione,
|
|
||||||
@Field("serCollo") String serCollo,
|
|
||||||
@Field("numCollo") int numCollo,
|
|
||||||
@Query("printQuantity") int printQuantity,
|
|
||||||
@Query("reportName") String reportName
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
@POST("processPrintReport")
|
@POST("processPrintReport")
|
||||||
Call<ServiceRESTResponse<Object>> processPrintReport(
|
Call<ServiceRESTResponse<Object>> processPrintReport(
|
||||||
@Query("printerName") String printerName,
|
@Query("printerName") String printerName,
|
||||||
@ -43,4 +26,16 @@ public interface PrinterRESTConsumerService {
|
|||||||
@Body JasperDTO jasperDTO
|
@Body JasperDTO jasperDTO
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@POST("wms/printEtichettaSSCC")
|
||||||
|
Call<ServiceRESTResponse<Object>> printCollo(
|
||||||
|
@Query("printerType") String printerType,
|
||||||
|
@Body MtbColt mtbColtToPrint
|
||||||
|
);
|
||||||
|
|
||||||
|
@POST("wms/printEtichettaSSCC")
|
||||||
|
Call<ServiceRESTResponse<Object>> printCollo(
|
||||||
|
@Body MtbColt mtbColtToPrint
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,6 @@ import it.integry.integrywmsnative.core.exception.InvalidLUMultiGestioneExceptio
|
|||||||
import it.integry.integrywmsnative.core.exception.InvalidOrderTypeException;
|
import it.integry.integrywmsnative.core.exception.InvalidOrderTypeException;
|
||||||
import it.integry.integrywmsnative.core.exception.LUScanNotGrantedException;
|
import it.integry.integrywmsnative.core.exception.LUScanNotGrantedException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
|
||||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||||
import it.integry.integrywmsnative.core.expansion.AtomicBigDecimal;
|
import it.integry.integrywmsnative.core.expansion.AtomicBigDecimal;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
@ -37,7 +36,6 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
@ -532,10 +530,10 @@ public class AccettazionePickingViewModel {
|
|||||||
dataScad = c.getTime();
|
dataScad = c.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(partitaMag == null && dataScad == null) {
|
if (partitaMag == null && dataScad == null) {
|
||||||
HistoryMtbAartDTO historyMtbAartDTO = this.getHistoryItemIfExists(pickingObjectDTO.getMtbAart().getCodMart());
|
HistoryMtbAartDTO historyMtbAartDTO = this.getHistoryItemIfExists(pickingObjectDTO.getMtbAart().getCodMart());
|
||||||
|
|
||||||
if(historyMtbAartDTO != null) {
|
if (historyMtbAartDTO != null) {
|
||||||
partitaMag = historyMtbAartDTO.getPartitaMag();
|
partitaMag = historyMtbAartDTO.getPartitaMag();
|
||||||
dataScad = historyMtbAartDTO.getDataScad();
|
dataScad = historyMtbAartDTO.getDataScad();
|
||||||
}
|
}
|
||||||
@ -788,25 +786,13 @@ public class AccettazionePickingViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void printCollo(Runnable onComplete) {
|
private void printCollo(Runnable onComplete) {
|
||||||
this.mPrinterRESTConsumer.getAvailablePrinters(mDefaultCodMdep, PrinterRESTConsumer.Type.SECONDARIA, printerList -> {
|
this.mPrinterRESTConsumer.printCollo(
|
||||||
|
PrinterRESTConsumer.Type.SECONDARIA,
|
||||||
if (printerList == null || printerList.size() == 0) {
|
mCurrentMtbColt,
|
||||||
this.sendError(new NoPrintersFoundException());
|
() -> {
|
||||||
onComplete.run();
|
this.sendLUSuccessfullyPrinted();
|
||||||
return;
|
onComplete.run();
|
||||||
}
|
}, ex -> this.sendLUPrintError(ex, onComplete));
|
||||||
|
|
||||||
String reportName = ReportManager.getReportNameLUFromGestione(GestioneEnum.ACQUISTO);
|
|
||||||
|
|
||||||
this.mPrinterRESTConsumer.printCollo(
|
|
||||||
printerList.get(0),
|
|
||||||
mCurrentMtbColt,
|
|
||||||
1,
|
|
||||||
reportName, () -> {
|
|
||||||
this.sendLUSuccessfullyPrinted();
|
|
||||||
onComplete.run();
|
|
||||||
}, ex -> this.sendLUPrintError(ex, onComplete));
|
|
||||||
}, this::sendError);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,10 +18,8 @@ import it.integry.integrywmsnative.R;
|
|||||||
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
|
||||||
import it.integry.integrywmsnative.databinding.ActivityContenutoBancaleBinding;
|
import it.integry.integrywmsnative.databinding.ActivityContenutoBancaleBinding;
|
||||||
import it.integry.integrywmsnative.gest.contenuto_bancale.ui.ContenutoBancaleListAdapter;
|
import it.integry.integrywmsnative.gest.contenuto_bancale.ui.ContenutoBancaleListAdapter;
|
||||||
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
@ -144,39 +142,21 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
|||||||
public void printUL() {
|
public void printUL() {
|
||||||
this.bindings.contenutoBancaleFab.close(true);
|
this.bindings.contenutoBancaleFab.close(true);
|
||||||
this.onLoadingStarted();
|
this.onLoadingStarted();
|
||||||
|
try {
|
||||||
|
this.mPrinterRESTConsumer.printCollo(mPrinterType, mtbColt.get(),
|
||||||
|
() -> {
|
||||||
|
this.onLoadingEnded();
|
||||||
|
|
||||||
this.mPrinterRESTConsumer.getAvailablePrinters(SettingsManager.i().getUserSession().getDepo().getCodMdep(), mPrinterType, value -> {
|
Resources res = this.getResources();
|
||||||
if (value.size() > 0) {
|
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||||
|
DialogSimpleMessageView
|
||||||
try {
|
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||||
String reportName = ReportManager.getReportNameLUFromGestione(mtbColt.get().getGestioneEnum());
|
.show(getSupportFragmentManager(), "tag");
|
||||||
reportName = mReportName != null ? mReportName : reportName;
|
}, this::onError);
|
||||||
|
|
||||||
this.mPrinterRESTConsumer.printCollo(value.get(0),
|
|
||||||
mtbColt.get(),
|
|
||||||
1,
|
|
||||||
reportName,
|
|
||||||
() -> {
|
|
||||||
this.onLoadingEnded();
|
|
||||||
|
|
||||||
Resources res = this.getResources();
|
|
||||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
|
||||||
DialogSimpleMessageView
|
|
||||||
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
|
||||||
.show(getSupportFragmentManager(), "tag");
|
|
||||||
}, this::onError);
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
|
||||||
this.onError(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this.onLoadingEnded();
|
|
||||||
String errorMessage = "Nessuna stampante configurata";
|
|
||||||
this.onError(new Exception(errorMessage));
|
|
||||||
}
|
|
||||||
}, this::onError);
|
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
this.onError(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -19,7 +19,6 @@ import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
|||||||
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILUBaseOperationsListener;
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILUBaseOperationsListener;
|
||||||
@ -30,7 +29,6 @@ import it.integry.integrywmsnative.core.model.MtbAart;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
@ -209,26 +207,17 @@ public class PickingResiViewModel {
|
|||||||
if (!shouldPrint) {
|
if (!shouldPrint) {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
} else {
|
} else {
|
||||||
this.mPrinterRESTConsumer.getAvailablePrinters(mDefaultCodMdepOfLU, PrinterRESTConsumer.Type.PRIMARIA, printerList -> {
|
singlePrint(mtbColtToPrint, onComplete, ex -> this.sendLUPrintError(ex, onComplete));
|
||||||
if (printerList == null || printerList.size() == 0) {
|
|
||||||
this.sendError(new NoPrintersFoundException());
|
|
||||||
onComplete.run();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
singlePrint(mtbColtToPrint, printerList.get(0), onComplete, ex -> this.sendLUPrintError(ex, onComplete));
|
|
||||||
}, this::sendError);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void singlePrint(MtbColt mtbColtToPrint, String printerName, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
private void singlePrint(MtbColt mtbColtToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
String reportName = ReportManager.getReportNameLUFromGestione(mtbColtToPrint.getGestioneEnum());
|
|
||||||
|
|
||||||
this.mPrinterRESTConsumer.printCollo(
|
this.mPrinterRESTConsumer.printCollo(
|
||||||
printerName,
|
PrinterRESTConsumer.Type.PRIMARIA,
|
||||||
mtbColtToPrint,
|
mtbColtToPrint,
|
||||||
1,
|
onComplete, onFailed);
|
||||||
reportName, onComplete, onFailed);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
@ -109,8 +108,6 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void dispatchItem(HistoryVersamentoProdULDTO item, MtbColt sourceMtbColt) {
|
public void dispatchItem(HistoryVersamentoProdULDTO item, MtbColt sourceMtbColt) {
|
||||||
BigDecimal qtaDaEvadere = BigDecimal.ZERO;
|
BigDecimal qtaDaEvadere = BigDecimal.ZERO;
|
||||||
BigDecimal numCnfDaEvadere = BigDecimal.ZERO;
|
BigDecimal numCnfDaEvadere = BigDecimal.ZERO;
|
||||||
@ -214,8 +211,8 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
UtilityBigDecimal.divide(mtbColtScarico.getMtbColr().get(0).getQtaCol(), mtbColtScarico.getMtbColr().get(0).getNumCnf()));
|
UtilityBigDecimal.divide(mtbColtScarico.getMtbColr().get(0).getQtaCol(), mtbColtScarico.getMtbColr().get(0).getNumCnf()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < mtbColtScarico.getMtbColr().size(); i++) {
|
for (int i = 0; i < mtbColtScarico.getMtbColr().size(); i++) {
|
||||||
if(mtbColtScarico.getMtbColr().get(i).getQtaCol().equals(BigDecimal.ZERO)) {
|
if (mtbColtScarico.getMtbColr().get(i).getQtaCol().equals(BigDecimal.ZERO)) {
|
||||||
mtbColtScarico.getMtbColr().remove(i);
|
mtbColtScarico.getMtbColr().remove(i);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
@ -288,39 +285,19 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
|
|
||||||
|
|
||||||
private void printCollo(MtbColt mtbColtToPrint, Runnable onComplete) {
|
private void printCollo(MtbColt mtbColtToPrint, Runnable onComplete) {
|
||||||
|
singlePrint(mtbColtToPrint, onComplete, ex -> this.sendOnLUPrintError(ex, onComplete));
|
||||||
this.mPrinterRESTConsumer.getAvailablePrinters(SettingsManager.i().getUserSession().getDepo().getCodMdep(), PrinterRESTConsumer.Type.PRIMARIA, printerList -> {
|
|
||||||
|
|
||||||
if (printerList.size() > 0) {
|
|
||||||
try {
|
|
||||||
singlePrint(mtbColtToPrint, printerList.get(0), () -> {
|
|
||||||
onComplete.run();
|
|
||||||
}, ex -> this.sendOnLUPrintError(ex, onComplete));
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
|
||||||
this.sendError(ex);
|
|
||||||
onComplete.run();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.sendOnNoLUFound(onComplete);
|
|
||||||
}
|
|
||||||
}, this::sendError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void singlePrint(MtbColt mtbColtToPrint, String printerName, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
private void singlePrint(MtbColt mtbColtToPrint, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
||||||
String reportName = ReportManager.getReportNameLUFromGestione(mtbColtToPrint.getGestioneEnum());
|
|
||||||
|
|
||||||
this.mPrinterRESTConsumer.printCollo(
|
this.mPrinterRESTConsumer.printCollo(
|
||||||
printerName,
|
PrinterRESTConsumer.Type.PRIMARIA,
|
||||||
mtbColtToPrint,
|
mtbColtToPrint,
|
||||||
1,
|
onComplete, onAbort);
|
||||||
reportName, onComplete, onAbort);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public MutableLiveData<List<HistoryVersamentoProdULDTO>> getOrderList() {
|
public MutableLiveData<List<HistoryVersamentoProdULDTO>> getOrderList() {
|
||||||
return mUlList;
|
return mUlList;
|
||||||
}
|
}
|
||||||
@ -359,7 +336,8 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnLURequest(boolean canLUBeCreated, boolean shouldCheckIfDocExist, RunnableArgss<MtbColt, Boolean> onComplete) {
|
private void sendOnLURequest(boolean canLUBeCreated, boolean shouldCheckIfDocExist, RunnableArgss<MtbColt, Boolean> onComplete) {
|
||||||
if(this.mListener != null) mListener.onLURequest(canLUBeCreated, shouldCheckIfDocExist, onComplete);
|
if (this.mListener != null)
|
||||||
|
mListener.onLURequest(canLUBeCreated, shouldCheckIfDocExist, onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnLUPrintError(Exception ex, Runnable onComplete) {
|
private void sendOnLUPrintError(Exception ex, Runnable onComplete) {
|
||||||
@ -375,7 +353,6 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public interface Listener extends ILoadingListener {
|
public interface Listener extends ILoadingListener {
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
|
||||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
@ -26,7 +25,6 @@ import it.integry.integrywmsnative.core.model.MtbCols;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
@ -35,8 +33,8 @@ import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.rest.RettificaGiacenzeRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.dto.FornitoreDTO;
|
import it.integry.integrywmsnative.gest.rettifica_giacenze.dto.FornitoreDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.rettifica_giacenze.rest.RettificaGiacenzeRESTConsumer;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGException;
|
import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGException;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
||||||
@ -88,10 +86,10 @@ public class RettificaGiacenzeViewModel {
|
|||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
|
|
||||||
this.sendOnLUOpenRequest((mtbColt, created) -> {
|
this.sendOnLUOpenRequest((mtbColt, created) -> {
|
||||||
this.mCurrentMtbColt = mtbColt;
|
this.mCurrentMtbColt = mtbColt;
|
||||||
this.mIsCreatedLU = created;
|
this.mIsCreatedLU = created;
|
||||||
|
|
||||||
this.sendLUOpened(mtbColt);
|
this.sendLUOpened(mtbColt);
|
||||||
});
|
});
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
@ -113,7 +111,7 @@ public class RettificaGiacenzeViewModel {
|
|||||||
//Cerco tramite etichetta ean 128 (che può indicarmi un articolo o una UL)
|
//Cerco tramite etichetta ean 128 (che può indicarmi un articolo o una UL)
|
||||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||||
|
|
||||||
} else if(UtilityBarcode.isEtichettaArt(barcodeScanDTO)){
|
} else if (UtilityBarcode.isEtichettaArt(barcodeScanDTO)) {
|
||||||
this.searchArtInt(barcodeScanDTO.getStringValue(), onComplete);
|
this.searchArtInt(barcodeScanDTO.getStringValue(), onComplete);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -153,7 +151,7 @@ public class RettificaGiacenzeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.mArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
|
this.mArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
|
||||||
if(onComplete != null) onComplete.run();
|
if (onComplete != null) onComplete.run();
|
||||||
|
|
||||||
if (mtbAartList != null && mtbAartList.size() > 0) {
|
if (mtbAartList != null && mtbAartList.size() > 0) {
|
||||||
this.dispatchArt(mtbAartList.get(0), pickData);
|
this.dispatchArt(mtbAartList.get(0), pickData);
|
||||||
@ -183,7 +181,7 @@ public class RettificaGiacenzeViewModel {
|
|||||||
|
|
||||||
dispatchArts(listaArts);
|
dispatchArts(listaArts);
|
||||||
|
|
||||||
if(onComplete != null) onComplete.run();
|
if (onComplete != null) onComplete.run();
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,8 +228,8 @@ public class RettificaGiacenzeViewModel {
|
|||||||
if (mtbAart.isFlagQtaCnfFissaBoolean()) {
|
if (mtbAart.isFlagQtaCnfFissaBoolean()) {
|
||||||
qtaCnfDaPrelevare = mtbAart.getQtaCnf();
|
qtaCnfDaPrelevare = mtbAart.getQtaCnf();
|
||||||
|
|
||||||
if(manualPickDTO.isEanPeso()) {
|
if (manualPickDTO.isEanPeso()) {
|
||||||
if(mtbAart.getUntMisRifPeso() == MtbAart.UntMisRifPesoEnum.M) {
|
if (mtbAart.getUntMisRifPeso() == MtbAart.UntMisRifPesoEnum.M) {
|
||||||
if (UtilityBigDecimal.equalsTo(mtbAart.getPesoKg(), BigDecimal.ZERO)) {
|
if (UtilityBigDecimal.equalsTo(mtbAart.getPesoKg(), BigDecimal.ZERO)) {
|
||||||
this.sendError(new InvalidPesoKGException());
|
this.sendError(new InvalidPesoKGException());
|
||||||
} else {
|
} else {
|
||||||
@ -245,9 +243,10 @@ public class RettificaGiacenzeViewModel {
|
|||||||
|
|
||||||
|
|
||||||
if (qtaColDaPrelevare != null && numCnfDaPrelevare == null) {
|
if (qtaColDaPrelevare != null && numCnfDaPrelevare == null) {
|
||||||
if(!mtbAart.isFlagQtaCnfFissaBoolean()) {
|
if (!mtbAart.isFlagQtaCnfFissaBoolean()) {
|
||||||
numCnfDaPrelevare = UtilityBigDecimal.divideAndRoundToInteger(qtaColDaPrelevare, mtbAart.getQtaCnf());
|
numCnfDaPrelevare = UtilityBigDecimal.divideAndRoundToInteger(qtaColDaPrelevare, mtbAart.getQtaCnf());
|
||||||
if(UtilityBigDecimal.equalsTo(numCnfDaPrelevare, BigDecimal.ZERO)) numCnfDaPrelevare = BigDecimal.ONE;
|
if (UtilityBigDecimal.equalsTo(numCnfDaPrelevare, BigDecimal.ZERO))
|
||||||
|
numCnfDaPrelevare = BigDecimal.ONE;
|
||||||
qtaCnfDaPrelevare = UtilityBigDecimal.divide(qtaColDaPrelevare, numCnfDaPrelevare);
|
qtaCnfDaPrelevare = UtilityBigDecimal.divide(qtaColDaPrelevare, numCnfDaPrelevare);
|
||||||
} else {
|
} else {
|
||||||
numCnfDaPrelevare = UtilityBigDecimal.divideToInteger(qtaColDaPrelevare, mtbAart.getQtaCnf());
|
numCnfDaPrelevare = UtilityBigDecimal.divideToInteger(qtaColDaPrelevare, mtbAart.getQtaCnf());
|
||||||
@ -274,7 +273,7 @@ public class RettificaGiacenzeViewModel {
|
|||||||
initialQtaTot = UtilityBigDecimal.multiply(initialNumCnf, initialQtaCnf);
|
initialQtaTot = UtilityBigDecimal.multiply(initialNumCnf, initialQtaCnf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dataScad == null && pickingObjectDTO.getMtbAart().getGgScadPartita() != null && pickingObjectDTO.getMtbAart().getGgScadPartita() > 0) {
|
if (dataScad == null && pickingObjectDTO.getMtbAart().getGgScadPartita() != null && pickingObjectDTO.getMtbAart().getGgScadPartita() > 0) {
|
||||||
dataScad = UtilityDate.getDateInstance();
|
dataScad = UtilityDate.getDateInstance();
|
||||||
Calendar c = new GregorianCalendar();
|
Calendar c = new GregorianCalendar();
|
||||||
c.setTime(dataScad);
|
c.setTime(dataScad);
|
||||||
@ -323,35 +322,35 @@ public class RettificaGiacenzeViewModel {
|
|||||||
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||||
|
|
||||||
// if (!mIsCreatedLU && mCurrentMtbColt.isDocumentPresent()) {
|
// if (!mIsCreatedLU && mCurrentMtbColt.isDocumentPresent()) {
|
||||||
mtbColr
|
mtbColr
|
||||||
.setQtaCol(BigDecimal.ZERO)
|
.setQtaCol(BigDecimal.ZERO)
|
||||||
.setNumCnf(BigDecimal.ZERO)
|
.setNumCnf(BigDecimal.ZERO)
|
||||||
.setDataCollo(mCurrentMtbColt.getDataColloS())
|
.setDataCollo(mCurrentMtbColt.getDataColloS())
|
||||||
.setNumCollo(mCurrentMtbColt.getNumCollo())
|
.setNumCollo(mCurrentMtbColt.getNumCollo())
|
||||||
.setGestione(mCurrentMtbColt.getGestione())
|
.setGestione(mCurrentMtbColt.getGestione())
|
||||||
.setSerCollo(mCurrentMtbColt.getSerCollo());
|
.setSerCollo(mCurrentMtbColt.getSerCollo());
|
||||||
|
|
||||||
|
|
||||||
mColliMagazzinoRESTConsumer.creaRettificaCollo(mtbColr,
|
mColliMagazzinoRESTConsumer.creaRettificaCollo(mtbColr,
|
||||||
numCnf,
|
numCnf,
|
||||||
qtaTot,
|
qtaTot,
|
||||||
savedMtbColr -> {
|
savedMtbColr -> {
|
||||||
mtbColr
|
mtbColr
|
||||||
.setQtaCol(savedMtbColr.getQtaCol())
|
.setQtaCol(savedMtbColr.getQtaCol())
|
||||||
.setQtaCnf(savedMtbColr.getQtaCnf())
|
.setQtaCnf(savedMtbColr.getQtaCnf())
|
||||||
.setNumCnf(savedMtbColr.getNumCnf())
|
.setNumCnf(savedMtbColr.getNumCnf())
|
||||||
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
|
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
|
||||||
.setMtbAart(pickingObjectDTO.getMtbAart());
|
.setMtbAart(pickingObjectDTO.getMtbAart());
|
||||||
|
|
||||||
mCurrentMtbColt.getMtbColr().add(mtbColr);
|
mCurrentMtbColt.getMtbColr().add(mtbColr);
|
||||||
|
|
||||||
this.mAnyEditDone = true;
|
this.mAnyEditDone = true;
|
||||||
|
|
||||||
this.sendOnRowSaved();
|
this.sendOnRowSaved();
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
|
|
||||||
if (shouldCloseLU) closeLU(true, null);
|
if (shouldCloseLU) closeLU(true, null);
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
// } else {
|
// } else {
|
||||||
// mtbColr
|
// mtbColr
|
||||||
// .setQtaCol(qtaTot)
|
// .setQtaCol(qtaTot)
|
||||||
@ -394,7 +393,7 @@ public class RettificaGiacenzeViewModel {
|
|||||||
|
|
||||||
public void closeLU(boolean saveCausale, Runnable onComplete) {
|
public void closeLU(boolean saveCausale, Runnable onComplete) {
|
||||||
if (mCurrentMtbColt == null) {
|
if (mCurrentMtbColt == null) {
|
||||||
if(onComplete != null) onComplete.run();
|
if (onComplete != null) onComplete.run();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,7 +413,7 @@ public class RettificaGiacenzeViewModel {
|
|||||||
mCurrentMtbColt, () -> {
|
mCurrentMtbColt, () -> {
|
||||||
this.sendLUPositionChangeRequest((shouldChangePosition, mtbDepoPosizione) -> {
|
this.sendLUPositionChangeRequest((shouldChangePosition, mtbDepoPosizione) -> {
|
||||||
|
|
||||||
if(shouldChangePosition) {
|
if (shouldChangePosition) {
|
||||||
this.savePosizione(mtbDepoPosizione, () -> {
|
this.savePosizione(mtbDepoPosizione, () -> {
|
||||||
this.mAnyEditDone = false;
|
this.mAnyEditDone = false;
|
||||||
postSaveBehaviour(onComplete);
|
postSaveBehaviour(onComplete);
|
||||||
@ -440,7 +439,6 @@ public class RettificaGiacenzeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void saveCausaleRettificaGiacenze(Runnable onComplete) {
|
private void saveCausaleRettificaGiacenze(Runnable onComplete) {
|
||||||
final MtbCols mtbCols = new MtbCols()
|
final MtbCols mtbCols = new MtbCols()
|
||||||
.setCausale(this.mDefaultCausale);
|
.setCausale(this.mDefaultCausale);
|
||||||
@ -466,18 +464,18 @@ public class RettificaGiacenzeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void postSaveBehaviour(Runnable onComplete) {
|
private void postSaveBehaviour(Runnable onComplete) {
|
||||||
if(!mCurrentMtbColt.getDisablePrint()) {
|
if (!mCurrentMtbColt.getDisablePrint()) {
|
||||||
printLU(() -> {
|
printLU(() -> {
|
||||||
this.mCurrentMtbColt = null;
|
this.mCurrentMtbColt = null;
|
||||||
this.sendLUClosed();
|
this.sendLUClosed();
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
if(onComplete != null) onComplete.run();
|
if (onComplete != null) onComplete.run();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.mCurrentMtbColt = null;
|
this.mCurrentMtbColt = null;
|
||||||
this.sendLUClosed();
|
this.sendLUClosed();
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
if(onComplete != null) onComplete.run();
|
if (onComplete != null) onComplete.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,26 +489,14 @@ public class RettificaGiacenzeViewModel {
|
|||||||
|
|
||||||
private void printLU(Runnable onComplete) {
|
private void printLU(Runnable onComplete) {
|
||||||
this.sendLUPrintRequest(shouldPrint -> {
|
this.sendLUPrintRequest(shouldPrint -> {
|
||||||
|
if (!shouldPrint) {
|
||||||
if(!shouldPrint) {
|
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
} else {
|
} else {
|
||||||
this.mPrinterRESTConsumer.getAvailablePrinters(this.mCurrentCodMdep, printerList -> {
|
|
||||||
|
|
||||||
if (printerList == null || printerList.size() == 0) {
|
this.mPrinterRESTConsumer.printCollo(null, mCurrentMtbColt, () -> {
|
||||||
this.sendError(new NoPrintersFoundException());
|
this.sendLUSuccessfullyPrinted();
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
return;
|
}, ex -> this.sendLUPrintError(ex, onComplete));
|
||||||
}
|
|
||||||
|
|
||||||
String reportName = ReportManager.getReportNameLUFromGestione(mCurrentMtbColt.getGestioneEnum());
|
|
||||||
|
|
||||||
this.mPrinterRESTConsumer.printCollo(printerList.get(0), mCurrentMtbColt, 1, reportName, () -> {
|
|
||||||
this.sendLUSuccessfullyPrinted();
|
|
||||||
onComplete.run();
|
|
||||||
}, ex -> this.sendLUPrintError(ex, onComplete));
|
|
||||||
|
|
||||||
}, this::sendError);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -551,27 +537,27 @@ public class RettificaGiacenzeViewModel {
|
|||||||
|
|
||||||
// if(!mIsCreatedLU && mCurrentMtbColt.isDocumentPresent()) {
|
// if(!mIsCreatedLU && mCurrentMtbColt.isDocumentPresent()) {
|
||||||
|
|
||||||
this.mColliMagazzinoRESTConsumer.creaRettificaCollo(
|
this.mColliMagazzinoRESTConsumer.creaRettificaCollo(
|
||||||
mtbColrToUpdate,
|
mtbColrToUpdate,
|
||||||
numCnf,
|
numCnf,
|
||||||
qtaTot,
|
qtaTot,
|
||||||
savedMtbColr -> {
|
savedMtbColr -> {
|
||||||
mtbColrToUpdate
|
mtbColrToUpdate
|
||||||
.setQtaCol(qtaTot)
|
.setQtaCol(qtaTot)
|
||||||
.setQtaCnf(qtaCnf)
|
.setQtaCnf(qtaCnf)
|
||||||
.setNumCnf(numCnf)
|
.setNumCnf(numCnf)
|
||||||
.setOperation(CommonModelConsts.OPERATION.NO_OP);
|
.setOperation(CommonModelConsts.OPERATION.NO_OP);
|
||||||
|
|
||||||
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToUpdate);
|
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToUpdate);
|
||||||
this.mCurrentMtbColt.getMtbColr().add(mtbColrToUpdate);
|
this.mCurrentMtbColt.getMtbColr().add(mtbColrToUpdate);
|
||||||
|
|
||||||
this.mAnyEditDone = true;
|
this.mAnyEditDone = true;
|
||||||
|
|
||||||
this.sendOnRowSaved();
|
this.sendOnRowSaved();
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
},
|
},
|
||||||
this::sendError
|
this::sendError
|
||||||
);
|
);
|
||||||
|
|
||||||
// } else {
|
// } else {
|
||||||
//
|
//
|
||||||
@ -621,17 +607,17 @@ public class RettificaGiacenzeViewModel {
|
|||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
// if(!mIsCreatedLU && mCurrentMtbColt.isDocumentPresent()) {
|
// if(!mIsCreatedLU && mCurrentMtbColt.isDocumentPresent()) {
|
||||||
this.mColliMagazzinoRESTConsumer.creaRettificaCollo(
|
this.mColliMagazzinoRESTConsumer.creaRettificaCollo(
|
||||||
mtbColrToDelete,
|
mtbColrToDelete,
|
||||||
BigDecimal.ZERO,
|
BigDecimal.ZERO,
|
||||||
BigDecimal.ZERO,
|
BigDecimal.ZERO,
|
||||||
savedMtbColr -> {
|
savedMtbColr -> {
|
||||||
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
|
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
this.sendOnRowSaved();
|
this.sendOnRowSaved();
|
||||||
},
|
},
|
||||||
this::sendError
|
this::sendError
|
||||||
);
|
);
|
||||||
// } else {
|
// } else {
|
||||||
// MtbColt mtbColt = new MtbColt()
|
// MtbColt mtbColt = new MtbColt()
|
||||||
// .setNumCollo(mtbColrToDelete.getNumCollo())
|
// .setNumCollo(mtbColrToDelete.getNumCollo())
|
||||||
|
|||||||
@ -45,7 +45,6 @@ import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
@ -937,8 +936,8 @@ public class SpedizioneViewModel {
|
|||||||
if (UtilityBigDecimal.lowerThan(qtaColDaPrelevare, BigDecimal.ZERO))
|
if (UtilityBigDecimal.lowerThan(qtaColDaPrelevare, BigDecimal.ZERO))
|
||||||
qtaColDaPrelevare = BigDecimal.ZERO;
|
qtaColDaPrelevare = BigDecimal.ZERO;
|
||||||
|
|
||||||
partitaMag = scannedMtbColr.getPartitaMag();
|
partitaMag = mtbColrToUse.getPartitaMag();
|
||||||
dataScad = scannedMtbColr.getDataScadPartitaD();
|
dataScad = mtbColrToUse.getDataScadPartitaD();
|
||||||
|
|
||||||
} else if (pickingObjectDTO.getTempPickData() != null && pickingObjectDTO.getTempPickData().getManualPickDTO() != null) {
|
} else if (pickingObjectDTO.getTempPickData() != null && pickingObjectDTO.getTempPickData().getManualPickDTO() != null) {
|
||||||
//Oppure le info del barcode scansionato
|
//Oppure le info del barcode scansionato
|
||||||
@ -1722,42 +1721,29 @@ public class SpedizioneViewModel {
|
|||||||
if (!shouldPrint) {
|
if (!shouldPrint) {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
} else {
|
} else {
|
||||||
|
cyclicPrint(PrinterRESTConsumer.Type.PRIMARIA, mtbColtsToPrint.iterator(), onComplete, ex -> this.sendLUPrintError(ex, onComplete));
|
||||||
this.mPrinterRESTConsumer.getAvailablePrinters(mDefaultCodMdep, PrinterRESTConsumer.Type.PRIMARIA, printerList -> {
|
|
||||||
|
|
||||||
if (printerList == null || printerList.size() == 0) {
|
|
||||||
this.sendError(new NoPrintersFoundException());
|
|
||||||
onComplete.run();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cyclicPrint(mtbColtsToPrint.iterator(), printerList.get(0), onComplete, ex -> this.sendLUPrintError(ex, onComplete));
|
|
||||||
|
|
||||||
}, this::sendError);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cyclicPrint(@NotNull Iterator<MtbColt> sourceMtbColts, String printerName, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
private void cyclicPrint(PrinterRESTConsumer.Type printerType, @NotNull Iterator<MtbColt> sourceMtbColts, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
||||||
if (sourceMtbColts.hasNext()) {
|
if (sourceMtbColts.hasNext()) {
|
||||||
singlePrint(sourceMtbColts.next(), printerName, () -> {
|
singlePrint(printerType, sourceMtbColts.next(), () -> {
|
||||||
cyclicPrint(sourceMtbColts, printerName, onComplete, onAbort);
|
cyclicPrint(printerType, sourceMtbColts, onComplete, onAbort);
|
||||||
}, onAbort);
|
}, onAbort);
|
||||||
} else {
|
} else {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void singlePrint(MtbColt mtbColtToPrint, String printerName, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
private void singlePrint(PrinterRESTConsumer.Type printerType, MtbColt mtbColtToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
String reportName = ReportManager.getReportNameLUFromGestione(mtbColtToPrint.getGestioneEnum());
|
|
||||||
|
|
||||||
this.mPrinterRESTConsumer.printCollo(
|
this.mPrinterRESTConsumer.printCollo(
|
||||||
printerName,
|
printerType,
|
||||||
mtbColtToPrint,
|
mtbColtToPrint,
|
||||||
1,
|
onComplete,
|
||||||
reportName, onComplete, onFailed);
|
onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user