Implementato criterio distribuzione in setup gest.
Implementata stampa di N colli una volta che essi vengono distribuiti.
This commit is contained in:
parent
0baee207ee
commit
0e503e3f23
@ -7,7 +7,7 @@ import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
public class ReportManager {
|
||||
|
||||
|
||||
public static void getRightReportNameByMtbColt(MtbColt mtbColt, RunnableArgs<String> onComplete, RunnableArgs<Exception> onFailed) throws Exception{
|
||||
public static void getRightReportNameByMtbColt(MtbColt mtbColt, RunnableArgs<String> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
if(mtbColt != null){
|
||||
|
||||
@ -28,7 +28,7 @@ public class ReportManager {
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new Exception("mtbColt cannot be NULL");
|
||||
onFailed.run(new Exception("mtbColt cannot be NULL"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.settings;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.REST.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.REST.model.DistribuzioneColloDTO;
|
||||
import it.integry.integrywmsnative.core.model.Azienda;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
@ -19,6 +20,7 @@ public class DBSettingsModel {
|
||||
private boolean flagMultiClienteOrdV;
|
||||
private String defaultCodAnag;
|
||||
private String defaultCausaleRettificaGiacenze;
|
||||
private DistribuzioneColloDTO.CriterioDistribuzione defaultCriterioDistribuzione;
|
||||
|
||||
public List<String> getAvailableProfiles() {
|
||||
return availableProfiles;
|
||||
@ -88,4 +90,13 @@ public class DBSettingsModel {
|
||||
this.defaultCausaleRettificaGiacenze = defaultCausaleRettificaGiacenze;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DistribuzioneColloDTO.CriterioDistribuzione getDefaultCriterioDistribuzione() {
|
||||
return defaultCriterioDistribuzione;
|
||||
}
|
||||
|
||||
public DBSettingsModel setDefaultCriterioDistribuzione(String defaultCriterioDistribuzione) {
|
||||
this.defaultCriterioDistribuzione = DistribuzioneColloDTO.CriterioDistribuzione.fromString(defaultCriterioDistribuzione);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,7 +184,15 @@ public class SettingsManager {
|
||||
GestSetupRESTConsumer.getValue("PICKING", "SETUP", "COD_ANAG_DEFAULT", valueCodAnagDefault -> {
|
||||
dbSettingsModelIstance.setDefaultCodAnag(valueCodAnagDefault.value);
|
||||
|
||||
GestSetupRESTConsumer.getValue("PICKING", "SETUP", "DEFAULT_CRITERIO_DISTRIBUZIONE", valueDefaultCriterioDistribuzione -> {
|
||||
dbSettingsModelIstance.setDefaultCriterioDistribuzione(valueDefaultCriterioDistribuzione.value);
|
||||
|
||||
if(onComplete != null) onComplete.run();
|
||||
|
||||
}, ex -> {
|
||||
if(onFailed != null) onFailed.run(ex);
|
||||
});
|
||||
|
||||
}, ex -> {
|
||||
if(onFailed != null) onFailed.run(ex);
|
||||
});
|
||||
|
||||
@ -748,7 +748,7 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
|
||||
dto.setShouldAskDataScad(true);
|
||||
}
|
||||
|
||||
DialogInputQuantity.makeBase(mActivity, dto, true, value -> onOrdineRowDispatched(item, value)).show();
|
||||
DialogInputQuantity.makeBase(mActivity, dto, true, value -> onOrdineRowDispatched(item, value), null).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
MtbColt recoveredMtbColt = ColliDataRecover.getSession(recoveredMtbColtID);
|
||||
|
||||
if(recoveredMtbColt != null && recoveredMtbColt.getGestioneEnum() == GestioneEnum.VENDITA && !UtilityString.isNullOrEmpty(recoveredMtbColt.getFiltroOrdini())) {
|
||||
ColliMagazzinoRESTConsumer.distribuisciCollo(recoveredMtbColt, DistribuzioneColloDTO.CriterioDistribuzione.UPDATE,
|
||||
ColliMagazzinoRESTConsumer.distribuisciCollo(recoveredMtbColt, SettingsManager.iDB().getDefaultCriterioDistribuzione(),
|
||||
mtbColts -> {
|
||||
ColliDataRecover.closeSession(recoveredMtbColtID);
|
||||
endRecoverMode();
|
||||
|
||||
@ -393,7 +393,6 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
.setMaxQta(mtbColr.getQtaCol());
|
||||
|
||||
DialogInputQuantity.makeBase(mContext, dto, false, quantityDTO -> {
|
||||
if(quantityDTO != null) {
|
||||
mtbColr
|
||||
.setQtaCol(new BigDecimal(quantityDTO.qtaTot.get()))
|
||||
.setQtaCnf(new BigDecimal(quantityDTO.qtaCnf.get()))
|
||||
@ -401,8 +400,7 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
.setDatetimeRow(new Date());
|
||||
|
||||
onComplete.run(mtbColr);
|
||||
} else onAbort.run();
|
||||
}).show();
|
||||
}, onAbort).show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -301,7 +301,7 @@ public class RettificaGiacenzeViewModel implements IRecyclerItemClicked<MtbColr>
|
||||
|
||||
DialogInputQuantity.makeBase(mContext, qtaDto, true, (quantityDTO) -> {
|
||||
onPostDispatch(mtbAart, quantityDTO);
|
||||
}).show();
|
||||
}, null).show();
|
||||
}
|
||||
|
||||
|
||||
@ -520,7 +520,7 @@ public class RettificaGiacenzeViewModel implements IRecyclerItemClicked<MtbColr>
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
});
|
||||
|
||||
}).show();
|
||||
}, null).show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ import com.annimon.stream.Stream;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -707,7 +708,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
||||
progress.show();
|
||||
|
||||
if(thereIsAnyRowInUL()) {
|
||||
updateDataFine(progress, () -> distribuisciCollo(progress, (generatedMtbColts) -> printCollo(progress)));
|
||||
updateDataFine(progress, () -> distribuisciCollo(progress, (generatedMtbColts) -> printCollo(progress, generatedMtbColts)));
|
||||
} else {
|
||||
ColliDataRecover.closeSession(mtbColtSessionID);
|
||||
deleteCollo(progress);
|
||||
@ -742,7 +743,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
||||
|
||||
MtbColt cloneMtbColt = (MtbColt) mArticoliInColloBottomSheetViewModel.mtbColt.get().clone();
|
||||
|
||||
ColliMagazzinoRESTConsumer.distribuisciCollo(cloneMtbColt, DistribuzioneColloDTO.CriterioDistribuzione.UPDATE,
|
||||
ColliMagazzinoRESTConsumer.distribuisciCollo(cloneMtbColt, SettingsManager.iDB().getDefaultCriterioDistribuzione(),
|
||||
mtbColts -> {
|
||||
ColliDataRecover.closeSession(mtbColtSessionID);
|
||||
onComplete.run(mtbColts);
|
||||
@ -750,7 +751,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
||||
ex -> UtilityExceptions.defaultException(mActivity, ex, progress));
|
||||
}
|
||||
|
||||
private void printCollo(ProgressDialog progress) {
|
||||
private void printCollo(ProgressDialog progress, List<MtbColt> mtbColtsToPrint) {
|
||||
DialogAskShouldPrint.make(mActivity, "Packing List", shouldPrint -> {
|
||||
|
||||
if(shouldPrint) {
|
||||
@ -760,20 +761,10 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
||||
|
||||
if (value.size() > 0) {
|
||||
try {
|
||||
MtbColt currentMtbColt = mArticoliInColloBottomSheetViewModel.mtbColt.get();
|
||||
|
||||
ReportManager.getRightReportNameByMtbColt(currentMtbColt, reportName -> {
|
||||
|
||||
PrinterRESTConsumer.printCollo(
|
||||
value.get(0),
|
||||
currentMtbColt,
|
||||
1, reportName, () -> {
|
||||
|
||||
postCloseOperations();
|
||||
cyclicPrint(mtbColtsToPrint.iterator(), value.get(0), () -> {
|
||||
postCloseOperations(mtbColtsToPrint);
|
||||
progress.dismiss();
|
||||
|
||||
}, ex -> {
|
||||
|
||||
progress.dismiss();
|
||||
String errorMessage = ex.getMessage();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(
|
||||
@ -782,19 +773,17 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
() -> postCloseOperations()).show();
|
||||
() -> postCloseOperations(mtbColtsToPrint)).show();
|
||||
});
|
||||
|
||||
}, ex -> UtilityExceptions.defaultException(mActivity, ex, progress)
|
||||
);
|
||||
} catch (Exception ex) {
|
||||
UtilityExceptions.defaultException(mActivity, ex, progress);
|
||||
postCloseOperations();
|
||||
postCloseOperations(mtbColtsToPrint);
|
||||
}
|
||||
} else {
|
||||
progress.dismiss();
|
||||
String errorMessage = "Nessuna stampante configurata";
|
||||
DialogSimpleMessageHelper.makeWarningDialog(mActivity, new SpannableString(errorMessage), null, () -> postCloseOperations()).show();
|
||||
DialogSimpleMessageHelper.makeWarningDialog(mActivity, new SpannableString(errorMessage), null, () -> postCloseOperations(mtbColtsToPrint)).show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -804,12 +793,36 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
||||
}
|
||||
});
|
||||
} else {
|
||||
postCloseOperations();
|
||||
postCloseOperations(mtbColtsToPrint);
|
||||
progress.dismiss();
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
||||
|
||||
private void cyclicPrint(Iterator<MtbColt> sourceMtbColts, String printerName, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
||||
if(sourceMtbColts.hasNext()){
|
||||
singlePrint(sourceMtbColts.next(), printerName, () -> {
|
||||
cyclicPrint(sourceMtbColts, printerName, onComplete, onAbort);
|
||||
}, onAbort);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
}
|
||||
|
||||
private void singlePrint(MtbColt mtbColtToPrint, String printerName, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
||||
ReportManager.getRightReportNameByMtbColt(mtbColtToPrint, reportName -> {
|
||||
|
||||
PrinterRESTConsumer.printCollo(
|
||||
printerName,
|
||||
mtbColtToPrint,
|
||||
1,
|
||||
reportName, onComplete, onAbort);
|
||||
|
||||
}, onAbort);
|
||||
}
|
||||
|
||||
|
||||
private void deleteCollo(ProgressDialog progress) {
|
||||
|
||||
ColliMagazzinoRESTConsumer.deleteCollo(mArticoliInColloBottomSheetViewModel.mtbColt.get(), () -> {
|
||||
@ -833,11 +846,11 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
||||
}
|
||||
|
||||
|
||||
private void postCloseOperations() {
|
||||
private void postCloseOperations(List<MtbColt> generatedMtbColt) {
|
||||
|
||||
MtbColt mtbColt = mArticoliInColloBottomSheetViewModel.mtbColt.get();
|
||||
|
||||
this.mColliRegistrati.add(mtbColt);
|
||||
this.mColliRegistrati.addAll(generatedMtbColt);
|
||||
|
||||
mArticoliInColloBottomSheetViewModel.mtbColt.set(null);
|
||||
isFabVisible.set(true);
|
||||
@ -965,7 +978,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
||||
|
||||
}
|
||||
|
||||
DialogInputQuantity.makeBase(mActivity, dto, false, value -> onOrdineRowDispatched(item, value)).show();
|
||||
DialogInputQuantity.makeBase(mActivity, dto, false, value -> onOrdineRowDispatched(item, value), null).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -333,7 +333,7 @@ public class VersamentoMerceViewModel {
|
||||
.setDatetimeRow(new Date());
|
||||
|
||||
onComplete.run(mtbColr);
|
||||
}).show();
|
||||
}, null).show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -188,7 +188,7 @@ public class ArticoliInColloBottomSheetViewModel {
|
||||
},
|
||||
ex -> UtilityExceptions.defaultException(mContext, ex, progress));
|
||||
|
||||
}).show();
|
||||
}, null).show();
|
||||
}
|
||||
|
||||
private void onItemDelete(int position) {
|
||||
|
||||
@ -214,11 +214,11 @@ public class DialogInputQuantity {
|
||||
private QuantityDTO currentQuantityDto;
|
||||
private DTO currentDTO;
|
||||
|
||||
public static AlertDialog makeBase(final Context context, final DTO dto, boolean canOverflowQuantity, final ISingleValueOperationCallback<QuantityDTO> dialogCallback) {
|
||||
return new DialogInputQuantity(context, dto, canOverflowQuantity, dialogCallback).currentAlert;
|
||||
public static AlertDialog makeBase(final Context context, final DTO dto, boolean canOverflowQuantity, final ISingleValueOperationCallback<QuantityDTO> dialogCallback, final Runnable onAbort) {
|
||||
return new DialogInputQuantity(context, dto, canOverflowQuantity, dialogCallback, onAbort).currentAlert;
|
||||
}
|
||||
|
||||
public DialogInputQuantity(Context context, final DTO dto, boolean canOverflowQuantity, final ISingleValueOperationCallback<QuantityDTO> dialogCallback) {
|
||||
public DialogInputQuantity(Context context, final DTO dto, boolean canOverflowQuantity, final ISingleValueOperationCallback<QuantityDTO> dialogCallback, final Runnable onAbort) {
|
||||
currentContext = context;
|
||||
currentMtbAart = dto.getMtbAart();
|
||||
currentDTO = dto;
|
||||
@ -253,7 +253,7 @@ public class DialogInputQuantity {
|
||||
.setView(currentBinding.getRoot())
|
||||
.setPositiveButton(context.getText(R.string.confirm), null)
|
||||
.setNegativeButton(context.getText(R.string.abort), (dialog, which) -> {
|
||||
dialogCallback.onResult(null);
|
||||
if(onAbort != null) onAbort.run();
|
||||
});
|
||||
|
||||
currentAlert = alertDialog.create();
|
||||
|
||||
@ -27,7 +27,8 @@
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -39,11 +40,12 @@
|
||||
android:id="@+id/print_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_margin="16dp"
|
||||
style="@style/TextInputLayout.OutlinePrimary"
|
||||
android:textColor="#5F6368"
|
||||
android:textSize="16sp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_horizontal"
|
||||
tools:text="La procedura stamperà una packing list"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -24,7 +24,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toStartOf="@+id/qta_box"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user