Compare commits
2 Commits
2727c1b01c
...
45c64ad0ac
| Author | SHA1 | Date | |
|---|---|---|---|
| 45c64ad0ac | |||
| 398f0a9523 |
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -232,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 {
|
||||
|
||||
@ -154,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);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -182,10 +189,12 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
||||
|
||||
@Override
|
||||
public void onLUOpened(GetColloInGiacResponseDTO colloInGiac, boolean created) {
|
||||
this.openedMtbColt = colloInGiac.getMtbColt();
|
||||
mOnComplete.run(Result.completed(colloInGiac, created));
|
||||
handler.post(() -> {
|
||||
this.openedMtbColt = colloInGiac.getMtbColt();
|
||||
mOnComplete.run(Result.completed(colloInGiac, created));
|
||||
|
||||
dismiss();
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -65,153 +65,138 @@ public class DialogScanOrCreateLUViewModel {
|
||||
var createUdcRequest = new CreateUDCRequestDTO()
|
||||
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||
|
||||
var createResponse = this.mColliLavorazioneRESTConsumer.synchronousCreateUDC(createUdcRequest);
|
||||
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, response -> {
|
||||
onComplete.run();
|
||||
this.sendOnLUOpened(response);
|
||||
}, 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, response -> {
|
||||
var mtbColt = response.getMtbColt();
|
||||
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.sendOnLUCreated(createdMtbColt);
|
||||
}, 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(response);
|
||||
}
|
||||
}
|
||||
|
||||
}, 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, response -> {
|
||||
var mtbColt = response.getMtbColt();
|
||||
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(ean128Model.Sscc, mShouldCheckResiduo, false);
|
||||
if (response == null)
|
||||
throw new NoLUFoundException();
|
||||
|
||||
if (mtbColt != null) {
|
||||
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(response);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
onComplete.run();
|
||||
this.sendOnLUOpened(response);
|
||||
}
|
||||
var mtbColt = response.getMtbColt();
|
||||
|
||||
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.sendOnLUCreated(createdMtbColt);
|
||||
}, 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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user