Completata ricerca da UL
This commit is contained in:
parent
434f9e8629
commit
c2ab0c9ec1
@ -560,4 +560,12 @@ public class MtbColt extends EntityBase {
|
|||||||
result = 31 * result + numCollo.hashCode();
|
result = 31 * result + numCollo.hashCode();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityBase clone() {
|
||||||
|
MtbColt mtbColt = (MtbColt) super.clone();
|
||||||
|
mtbColt.setMtbColr((ObservableArrayList<MtbColr>) mtbColt.getMtbColr().clone());
|
||||||
|
return mtbColt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,54 +22,54 @@ import retrofit2.Response;
|
|||||||
|
|
||||||
public class EntityRESTConsumer {
|
public class EntityRESTConsumer {
|
||||||
|
|
||||||
public static <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type){
|
public static <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) {
|
||||||
|
|
||||||
RunnableArgs<Exception> tmpFailed = ex -> {
|
RunnableArgs<Exception> tmpFailed = ex -> {
|
||||||
// UtilityExceptions.defaultException(null, ex);
|
if (callback != null) callback.onFailed(ex);
|
||||||
if(callback != null) callback.onFailed(ex);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
||||||
Call<ServiceRESTResponse<JsonObject>> request = service.processEntity(entityToSave);
|
service
|
||||||
request.enqueue(new Callback<ServiceRESTResponse<JsonObject>>() {
|
.processEntity(entityToSave)
|
||||||
@Override
|
.enqueue(new Callback<ServiceRESTResponse<JsonObject>>() {
|
||||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
@Override
|
||||||
if(response.isSuccessful()) {
|
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
|
||||||
if(response.body() != null) {
|
if (response.body() != null) {
|
||||||
if(response.body().getEsito() == EsitoType.OK) {
|
if (response.body().getEsito() == EsitoType.OK) {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
T object = gson.fromJson(response.body().getEntity(), type);
|
T object = gson.fromJson(response.body().getEntity(), type);
|
||||||
|
|
||||||
callback.onSuccess(object);
|
callback.onSuccess(object);
|
||||||
|
} else {
|
||||||
|
Log.e("EntityRESTConsumer", response.body().getErrorMessage());
|
||||||
|
tmpFailed.run(new Exception(response.body().getErrorMessage()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.e("EntityRESTConsumer", response.message());
|
||||||
|
tmpFailed.run(new Exception(response.message()));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("EntityRESTConsumer", response.body().getErrorMessage());
|
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
||||||
tmpFailed.run(new Exception(response.body().getErrorMessage()));
|
tmpFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Log.e("EntityRESTConsumer", response.message());
|
|
||||||
tmpFailed.run(new Exception(response.message()));
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
|
||||||
tmpFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
||||||
Log.e("EntityRESTConsumer", t.toString());
|
Log.e("EntityRESTConsumer", t.toString());
|
||||||
tmpFailed.run(new Exception(t));
|
tmpFailed.run(new Exception(t));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends EntityBase> void processEntityList(List<T> entitiesToSave, final ISimpleOperationCallback<List<T>> callback, boolean singleTransaction, Class<T> type){
|
public static <T extends EntityBase> void processEntityList(List<T> entitiesToSave, final ISimpleOperationCallback<List<T>> callback, boolean singleTransaction, Class<T> type) {
|
||||||
|
|
||||||
RunnableArgs<Exception> tmpFailed = ex -> {
|
RunnableArgs<Exception> tmpFailed = ex -> {
|
||||||
// UtilityExceptions.defaultException(null, ex);
|
// UtilityExceptions.defaultException(null, ex);
|
||||||
if(callback != null) callback.onFailed(ex);
|
if (callback != null) callback.onFailed(ex);
|
||||||
};
|
};
|
||||||
|
|
||||||
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
||||||
@ -77,15 +77,15 @@ public class EntityRESTConsumer {
|
|||||||
request.enqueue(new Callback<List<ServiceRESTResponse<JsonObject>>>() {
|
request.enqueue(new Callback<List<ServiceRESTResponse<JsonObject>>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<List<ServiceRESTResponse<JsonObject>>> call, Response<List<ServiceRESTResponse<JsonObject>>> response) {
|
public void onResponse(Call<List<ServiceRESTResponse<JsonObject>>> call, Response<List<ServiceRESTResponse<JsonObject>>> response) {
|
||||||
if(response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
|
|
||||||
if(response.body() != null) {
|
if (response.body() != null) {
|
||||||
|
|
||||||
ArrayList<T> responseList = new ArrayList<>();
|
ArrayList<T> responseList = new ArrayList<>();
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
// Type typeOfObjectsList = new TypeToken<T>() {}.getType();
|
// Type typeOfObjectsList = new TypeToken<T>() {}.getType();
|
||||||
|
|
||||||
for(ServiceRESTResponse<JsonObject> jsonSingleObject : response.body()) {
|
for (ServiceRESTResponse<JsonObject> jsonSingleObject : response.body()) {
|
||||||
|
|
||||||
if (jsonSingleObject.getEsito() == EsitoType.OK) {
|
if (jsonSingleObject.getEsito() == EsitoType.OK) {
|
||||||
String jsonText = gson.toJson(jsonSingleObject.getEntity());
|
String jsonText = gson.toJson(jsonSingleObject.getEntity());
|
||||||
@ -119,26 +119,24 @@ public class EntityRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static <T extends EntityBase> void selectEntity(T entityToSave, final ISimpleOperationCallback<List<T>> callback, Class type) {
|
||||||
|
|
||||||
public static <T extends EntityBase> void selectEntity(T entityToSave, final ISimpleOperationCallback<List<T>> callback, Class type){
|
|
||||||
|
|
||||||
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
||||||
Call<ServiceRESTResponse<JsonObject>> request = service.processEntity(entityToSave);
|
Call<ServiceRESTResponse<JsonObject>> request = service.processEntity(entityToSave);
|
||||||
request.enqueue(new Callback<ServiceRESTResponse<JsonObject>>() {
|
request.enqueue(new Callback<ServiceRESTResponse<JsonObject>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||||
if(response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
|
|
||||||
if(response.body() != null) {
|
if (response.body() != null) {
|
||||||
if(response.body().getEsito() == EsitoType.OK) {
|
if (response.body().getEsito() == EsitoType.OK) {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
List<JsonObject> jsons = response.body().getEntityList();
|
List<JsonObject> jsons = response.body().getEntityList();
|
||||||
|
|
||||||
List<T> newList = new ArrayList<T>();
|
List<T> newList = new ArrayList<T>();
|
||||||
|
|
||||||
if(jsons != null) {
|
if (jsons != null) {
|
||||||
for (int i = 0; i < jsons.size(); i ++){
|
for (int i = 0; i < jsons.size(); i++) {
|
||||||
JsonObject jsonTmp = jsons.get(i);
|
JsonObject jsonTmp = jsons.get(i);
|
||||||
|
|
||||||
newList.add((T) gson.fromJson(jsonTmp, type));
|
newList.add((T) gson.fromJson(jsonTmp, type));
|
||||||
|
|||||||
@ -32,6 +32,17 @@ public class DBSettingsModel {
|
|||||||
private boolean flagForceAllToColli;
|
private boolean flagForceAllToColli;
|
||||||
private boolean flagSpedizioneEnableManualPick;
|
private boolean flagSpedizioneEnableManualPick;
|
||||||
|
|
||||||
|
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||||
|
return flagSpedizioneEnableFakeGiacenza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagSpedizioneEnableFakeGiacenza(boolean flagSpedizioneEnableFakeGiacenza) {
|
||||||
|
this.flagSpedizioneEnableFakeGiacenza = flagSpedizioneEnableFakeGiacenza;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean flagSpedizioneEnableFakeGiacenza;
|
||||||
|
|
||||||
public List<String> getAvailableProfiles() {
|
public List<String> getAvailableProfiles() {
|
||||||
return availableProfiles;
|
return availableProfiles;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -238,6 +238,10 @@ public class SettingsManager {
|
|||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("SPEDIZIONE")
|
.setSection("SPEDIZIONE")
|
||||||
.setKeySection("ENABLE_MANUAL_PICK"));
|
.setKeySection("ENABLE_MANUAL_PICK"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("SPEDIZIONE")
|
||||||
|
.setKeySection("ENABLE_FAKE_GIACENZA"));
|
||||||
|
|
||||||
|
|
||||||
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
|
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
|
||||||
@ -256,6 +260,7 @@ public class SettingsManager {
|
|||||||
dbSettingsModelIstance.setFlagUseNewPickingListSpedizione(getValueFromList(list, "FLAG_USE_NEW_PICKING_LIST", Boolean.class));
|
dbSettingsModelIstance.setFlagUseNewPickingListSpedizione(getValueFromList(list, "FLAG_USE_NEW_PICKING_LIST", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagVersamentoDirettoProduzione(getValueFromList(list, "FLAG_VERSAMENTO_DIRETTO", Boolean.class));
|
dbSettingsModelIstance.setFlagVersamentoDirettoProduzione(getValueFromList(list, "FLAG_VERSAMENTO_DIRETTO", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagSpedizioneEnableManualPick(getValueFromList(list, "ENABLE_MANUAL_PICK", Boolean.class));
|
dbSettingsModelIstance.setFlagSpedizioneEnableManualPick(getValueFromList(list, "ENABLE_MANUAL_PICK", Boolean.class));
|
||||||
|
dbSettingsModelIstance.setFlagSpedizioneEnableFakeGiacenza(getValueFromList(list, "ENABLE_FAKE_GIACENZA", Boolean.class));
|
||||||
|
|
||||||
if(onComplete != null) onComplete.run();
|
if(onComplete != null) onComplete.run();
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
|
|||||||
@ -320,9 +320,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void applyFilter(String descriptionText) {
|
private void applyFilter(String descriptionText) {
|
||||||
|
|
||||||
this.mBindings.filteredArtsInListExpandableLayout.expand(true);
|
this.mBindings.filteredArtsInListExpandableLayout.expand(true);
|
||||||
|
|
||||||
this.mBindings.descriptionFilterText.setText(descriptionText);
|
this.mBindings.descriptionFilterText.setText(descriptionText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -105,7 +105,11 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
|||||||
|
|
||||||
|
|
||||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
mViewmodel.loadDataset(codMdep, mSitArtOrd, mTestateOrdini);
|
boolean enableGiacenza = !SettingsManager.iDB().isFlagSpedizioneEnableFakeGiacenza();
|
||||||
|
boolean enableCheckPartitaMag = SettingsManager.iDB().isEnableCheckPartitaMagCheckPickingV();
|
||||||
|
|
||||||
|
if(enableGiacenza) mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this);
|
||||||
|
mViewmodel.loadDataset(codMdep, enableGiacenza, enableCheckPartitaMag, mSitArtOrd, mTestateOrdini);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -145,37 +149,12 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
|||||||
.filter(x -> !x.isHidden())
|
.filter(x -> !x.isHidden())
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
|
List<SpedizioneListModel> spedizioneListModels = new ArrayList<>();
|
||||||
|
|
||||||
List<PickingObjectDTO> sortedList = Stream.of(tmpList)
|
Stream.of(tmpList)
|
||||||
.filter(x -> !x.isDeactivated() && (x.getMtbColt() != null && !UtilityString.isNullOrEmpty(x.getMtbColt().getPosizione())))
|
.forEach(x -> {
|
||||||
.sortBy(x -> x.getMtbColt().getPosizione())
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
sortedList.addAll(
|
|
||||||
Stream.of(tmpList)
|
|
||||||
.filter(x -> !x.isDeactivated() && x.getMtbColt() == null || (x.getMtbColt() != null && UtilityString.isNullOrEmpty(x.getMtbColt().getPosizione())))
|
|
||||||
.toList()
|
|
||||||
);
|
|
||||||
|
|
||||||
sortedList.addAll(
|
|
||||||
Stream.of(tmpList)
|
|
||||||
.filter(PickingObjectDTO::isDeactivated)
|
|
||||||
.toList()
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
return Stream.of(sortedList)
|
|
||||||
.map(x -> {
|
|
||||||
SpedizioneListModel spedizioneListModel = new SpedizioneListModel();
|
SpedizioneListModel spedizioneListModel = new SpedizioneListModel();
|
||||||
|
|
||||||
if (x.isDeactivated()) {
|
|
||||||
spedizioneListModel.setGroupTitle(getString(R.string.picking_not_available));
|
|
||||||
} else {
|
|
||||||
spedizioneListModel.setGroupTitle(String.format("%s: %s", getString(R.string.position_text), x.getMtbColt() == null || UtilityString.isNullOrEmpty(x.getMtbColt().getPosizione()) ? "N.A." : x.getMtbColt().getPosizione()));
|
|
||||||
}
|
|
||||||
|
|
||||||
spedizioneListModel.setActive(!x.isDeactivated());
|
|
||||||
|
|
||||||
String badge1 = "";
|
String badge1 = "";
|
||||||
if (mFlagShowCodForn) {
|
if (mFlagShowCodForn) {
|
||||||
badge1 += !UtilityString.isNullOrEmpty(x.getSitArtOrdDTO().getCodAlis()) ? (x.getSitArtOrdDTO().getCodAlis() + " - ") : "";
|
badge1 += !UtilityString.isNullOrEmpty(x.getSitArtOrdDTO().getCodAlis()) ? (x.getSitArtOrdDTO().getCodAlis() + " - ") : "";
|
||||||
@ -195,28 +174,75 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
|||||||
spedizioneListModel.setDescrizionePresente(true);
|
spedizioneListModel.setDescrizionePresente(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
MtbColr mtbColrToDispatch = x.getMtbColt() != null && x.getMtbColt().getMtbColr() != null && x.getMtbColt().getMtbColr().size() > 0 ? x.getMtbColt().getMtbColr().get(0) : null;
|
|
||||||
if (mtbColrToDispatch != null && !UtilityString.isNullOrEmpty(mtbColrToDispatch.getPartitaMag())) {
|
|
||||||
spedizioneListModel.setSubDescrizione1(String.format(getString(R.string.batch_lot_text), mtbColrToDispatch.getPartitaMag()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x.getMtbColt() != null) {
|
boolean anyLUPresent = x.getMtbColts() != null && x.getMtbColts().size() > 0;
|
||||||
spedizioneListModel.setSubDescrizione2(String.format(getString(R.string.lu_number_data_text), x.getMtbColt().getNumCollo(), UtilityDate.formatDate(x.getMtbColt().getDataColloD(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().getFlagQtaCnfFissaBoolean())) {
|
spedizioneListModel.setActive(anyLUPresent);
|
||||||
spedizioneListModel.setUntMis("col");
|
|
||||||
spedizioneListModel.setQtaTot(mtbColrToDispatch != null ? mtbColrToDispatch.getNumCnf() : x.getSitArtOrdDTO().getNumCnfOrd());
|
if (!anyLUPresent) {
|
||||||
|
spedizioneListModel.setGroupTitle(getString(R.string.picking_not_available));
|
||||||
|
|
||||||
|
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().getFlagQtaCnfFissaBoolean())) {
|
||||||
|
spedizioneListModel.setUntMis("col");
|
||||||
|
spedizioneListModel.setQtaTot(x.getSitArtOrdDTO().getNumCnfOrd());
|
||||||
|
} else {
|
||||||
|
spedizioneListModel.setQtaTot(x.getSitArtOrdDTO().getQtaOrd());
|
||||||
|
if (x.getMtbAart() != null)
|
||||||
|
spedizioneListModel.setUntMis(x.getMtbAart().getUntMis());
|
||||||
|
}
|
||||||
|
|
||||||
|
spedizioneListModel.setOriginalModel(x);
|
||||||
|
spedizioneListModels.add(spedizioneListModel);
|
||||||
} else {
|
} else {
|
||||||
spedizioneListModel.setQtaTot(mtbColrToDispatch != null ? mtbColrToDispatch.getQtaCol() : x.getSitArtOrdDTO().getQtaOrd());
|
|
||||||
if (x.getMtbAart() != null)
|
for (MtbColt mtbColtToPick : x.getMtbColts()) {
|
||||||
spedizioneListModel.setUntMis(x.getMtbAart().getUntMis());
|
|
||||||
|
SpedizioneListModel cloneModel = (SpedizioneListModel) spedizioneListModel.clone();
|
||||||
|
|
||||||
|
cloneModel.setGroupTitle(String.format("%s: %s", getString(R.string.position_text), UtilityString.isNullOrEmpty(mtbColtToPick.getPosizione()) ? "N.A." : mtbColtToPick.getPosizione()));
|
||||||
|
|
||||||
|
MtbColr mtbColrToDispatch = mtbColtToPick.getMtbColr() != null && mtbColtToPick.getMtbColr().size() > 0 ? mtbColtToPick.getMtbColr().get(0) : null;
|
||||||
|
if (mtbColrToDispatch != null && !UtilityString.isNullOrEmpty(mtbColrToDispatch.getPartitaMag())) {
|
||||||
|
cloneModel.setSubDescrizione1(String.format(getString(R.string.batch_lot_text), mtbColrToDispatch.getPartitaMag()));
|
||||||
|
}
|
||||||
|
|
||||||
|
cloneModel.setSubDescrizione2(String.format(getString(R.string.lu_number_data_text), mtbColtToPick.getNumCollo(), UtilityDate.formatDate(mtbColtToPick.getDataColloD(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)));
|
||||||
|
|
||||||
|
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().getFlagQtaCnfFissaBoolean())) {
|
||||||
|
cloneModel.setUntMis("col");
|
||||||
|
cloneModel.setQtaTot(mtbColrToDispatch != null ? mtbColrToDispatch.getNumCnf() : x.getSitArtOrdDTO().getNumCnfOrd());
|
||||||
|
} else {
|
||||||
|
cloneModel.setQtaTot(mtbColrToDispatch != null ? mtbColrToDispatch.getQtaCol() : x.getSitArtOrdDTO().getQtaOrd());
|
||||||
|
if (x.getMtbAart() != null)
|
||||||
|
cloneModel.setUntMis(x.getMtbAart().getUntMis());
|
||||||
|
}
|
||||||
|
|
||||||
|
cloneModel.setOriginalModel(x);
|
||||||
|
cloneModel.setSourceMtbColt(mtbColtToPick);
|
||||||
|
spedizioneListModels.add(cloneModel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// spedizioneListModel.setOriginalModel(x);
|
|
||||||
|
|
||||||
return spedizioneListModel;
|
List<SpedizioneListModel> sortedList = Stream.of(spedizioneListModels)
|
||||||
}).toList();
|
.filter(x -> x.isActive() && (x.getSourceMtbColt() != null && !UtilityString.isNullOrEmpty(x.getSourceMtbColt().getPosizione())))
|
||||||
|
.sortBy(x -> x.getSourceMtbColt().getPosizione())
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
sortedList.addAll(
|
||||||
|
Stream.of(spedizioneListModels)
|
||||||
|
.filter(x -> x.isActive() && x.getSourceMtbColt() == null || (x.getSourceMtbColt() != null && UtilityString.isNullOrEmpty(x.getSourceMtbColt().getPosizione())))
|
||||||
|
.toList()
|
||||||
|
);
|
||||||
|
|
||||||
|
sortedList.addAll(
|
||||||
|
Stream.of(spedizioneListModels)
|
||||||
|
.filter(x -> !x.isActive())
|
||||||
|
.toList()
|
||||||
|
);
|
||||||
|
|
||||||
|
return sortedList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isThereAnyItemToPick(List<PickingObjectDTO> dataList) {
|
private boolean isThereAnyItemToPick(List<PickingObjectDTO> dataList) {
|
||||||
@ -232,6 +258,7 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
|||||||
this.mViewmodel.processBarcodeDTO(data, () -> {
|
this.mViewmodel.processBarcodeDTO(data, () -> {
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
|
mCurrentProgress = null;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -247,7 +274,7 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeListFilter() {
|
public void removeListFilter() {
|
||||||
|
this.mViewmodel.resetMatchedRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -256,6 +283,7 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
|||||||
|
|
||||||
this.mViewmodel.createNewLU(null, null, () -> {
|
this.mViewmodel.createNewLU(null, null, () -> {
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
|
mCurrentProgress = null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,6 +292,14 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDatasetLoaded() {
|
||||||
|
if(mCurrentProgress != null) {
|
||||||
|
mCurrentProgress.dismiss();
|
||||||
|
mCurrentProgress = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUCreated(MtbColt mtbColt) {
|
public void onLUCreated(MtbColt mtbColt) {
|
||||||
noLUPresent.set(false);
|
noLUPresent.set(false);
|
||||||
@ -274,13 +310,18 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
|||||||
@Override
|
@Override
|
||||||
public void onLUClosed() {
|
public void onLUClosed() {
|
||||||
noLUPresent.set(true);
|
noLUPresent.set(true);
|
||||||
|
|
||||||
// if(mMtbColtSessionID != null) ColliDataRecover.closeSession(mMtbColtSessionID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFilterChanged(String newValue) {
|
public void onFilterApplied(String newValue) {
|
||||||
|
this.mBindings.filteredArtsInListExpandableLayout.expand(true);
|
||||||
|
this.mBindings.descriptionFilterText.setText(!UtilityString.isNullOrEmpty(newValue) ? newValue : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFilterRemoved() {
|
||||||
|
this.mBindings.filteredArtsInListExpandableLayout.collapse(true);
|
||||||
|
this.mBindings.descriptionFilterText.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -5,12 +5,12 @@ import androidx.lifecycle.MutableLiveData;
|
|||||||
|
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.annimon.stream.function.Function;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@ -22,6 +22,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|||||||
import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
||||||
import it.integry.integrywmsnative.core.model.FiltroOrdineDTO;
|
import it.integry.integrywmsnative.core.model.FiltroOrdineDTO;
|
||||||
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.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.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
@ -44,6 +45,7 @@ import it.integry.integrywmsnative.gest.spedizione_new.exceptions.NoOrdersSelect
|
|||||||
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.NoResultFromBarcodeException;
|
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.NoResultFromBarcodeException;
|
||||||
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.NotCurrentYearLUException;
|
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.NotCurrentYearLUException;
|
||||||
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.ScannedPositionNotExistException;
|
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.ScannedPositionNotExistException;
|
||||||
|
import it.integry.integrywmsnative.gest.spedizione_new.model.PickDataDTO;
|
||||||
import it.integry.integrywmsnative.gest.spedizione_new.model.PickingObjectDTO;
|
import it.integry.integrywmsnative.gest.spedizione_new.model.PickingObjectDTO;
|
||||||
import it.integry.integrywmsnative.gest.vendita.dto.OrdineVenditaInevasoDTO;
|
import it.integry.integrywmsnative.gest.vendita.dto.OrdineVenditaInevasoDTO;
|
||||||
import it.integry.integrywmsnative.gest.vendita.dto.PickingObjectDTOOld;
|
import it.integry.integrywmsnative.gest.vendita.dto.PickingObjectDTOOld;
|
||||||
@ -65,6 +67,9 @@ public class SpedizioneViewModel {
|
|||||||
private Date mDefaultDataOrdOfUL = null;
|
private Date mDefaultDataOrdOfUL = null;
|
||||||
private String mDefaultCodJFasOfUL = null;
|
private String mDefaultCodJFasOfUL = null;
|
||||||
|
|
||||||
|
private boolean mEnableGiacenza;
|
||||||
|
private boolean mEnableCheckPartitaMag;
|
||||||
|
|
||||||
private MtbColt mCurrentMtbColt = null;
|
private MtbColt mCurrentMtbColt = null;
|
||||||
|
|
||||||
private Integer mMtbColtSessionID;
|
private Integer mMtbColtSessionID;
|
||||||
@ -78,17 +83,23 @@ public class SpedizioneViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void loadDataset(String codMdep, List<SitArtOrdDTO> pickingList, List<OrdineVenditaInevasoDTO> testateOrdini) {
|
public void loadDataset(String codMdep, boolean enableGiacenza, boolean enableCheckPartitaMag, List<SitArtOrdDTO> pickingList, List<OrdineVenditaInevasoDTO> testateOrdini) {
|
||||||
this.mDefaultCodMdep = codMdep;
|
this.mDefaultCodMdep = codMdep;
|
||||||
this.mTestateOrdini = testateOrdini;
|
this.mTestateOrdini = testateOrdini;
|
||||||
|
this.mEnableGiacenza = enableGiacenza;
|
||||||
|
this.mEnableCheckPartitaMag = enableCheckPartitaMag;
|
||||||
|
|
||||||
mOrdiniRestConsumerService.getSuggestedPickingList(this.mDefaultCodMdep, pickingList, pickingObjectList -> {
|
if (enableGiacenza) {
|
||||||
this.mPickingList.postValue(pickingObjectList);
|
mOrdiniRestConsumerService.getSuggestedPickingList(this.mDefaultCodMdep, pickingList, pickingObjectList -> {
|
||||||
}, ex -> this.sendError(new OrdersLoadException()));
|
this.mPickingList.postValue(pickingObjectList);
|
||||||
|
this.sendDatasetLoaded();
|
||||||
// getEmptyPickingList(pickingList, pickingObjectList -> {
|
}, ex -> this.sendError(new OrdersLoadException(ex)));
|
||||||
// this.mPickingList.postValue(pickingObjectList);
|
} else {
|
||||||
// });
|
getEmptyPickingList(pickingList, pickingObjectList -> {
|
||||||
|
this.mPickingList.postValue(pickingObjectList);
|
||||||
|
this.sendDatasetLoaded();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.initDefaultVars();
|
this.initDefaultVars();
|
||||||
}
|
}
|
||||||
@ -218,6 +229,10 @@ public class SpedizioneViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void sendDatasetLoaded() {
|
||||||
|
for (Listeners listener : mListeners) listener.onDatasetLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
private void sendError(Exception ex) {
|
private void sendError(Exception ex) {
|
||||||
for (Listeners listener : mListeners) listener.onError(ex);
|
for (Listeners listener : mListeners) listener.onError(ex);
|
||||||
}
|
}
|
||||||
@ -230,8 +245,12 @@ public class SpedizioneViewModel {
|
|||||||
for (Listeners listener : mListeners) listener.onLUClosed();
|
for (Listeners listener : mListeners) listener.onLUClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendFilterChanged(String newValue) {
|
private void sendFilterApplied(String newValue) {
|
||||||
for (Listeners listener : mListeners) listener.onFilterChanged(newValue);
|
for (Listeners listener : mListeners) listener.onFilterApplied(newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendFilterRemoved() {
|
||||||
|
for (Listeners listener : mListeners) listener.onFilterRemoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnItemDispatched(MtbAart mtbAart, BigDecimal totalQtaOrd, BigDecimal totalNumCnfOrd, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable) {
|
private void sendOnItemDispatched(MtbAart mtbAart, BigDecimal totalQtaOrd, BigDecimal totalNumCnfOrd, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable) {
|
||||||
@ -242,7 +261,7 @@ public class SpedizioneViewModel {
|
|||||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
|
||||||
//Se non c'è una UL aperta
|
//Se non c'è una UL aperta
|
||||||
if (mCurrentMtbColt != null) {
|
if (mCurrentMtbColt == null) {
|
||||||
|
|
||||||
//Se è un'etichetta anonima
|
//Se è un'etichetta anonima
|
||||||
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||||
@ -251,7 +270,7 @@ public class SpedizioneViewModel {
|
|||||||
//dell'etichetta anonima
|
//dell'etichetta anonima
|
||||||
this.executeEtichettaAnonimaNotOpenedLU(barcodeScanDTO, onComplete);
|
this.executeEtichettaAnonimaNotOpenedLU(barcodeScanDTO, onComplete);
|
||||||
} else {
|
} else {
|
||||||
this.processBarcodeAlreadyOpenedLU(barcodeScanDTO, onComplete);
|
this.processBarcodeNotOpenedLU(barcodeScanDTO, onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -265,6 +284,13 @@ public class SpedizioneViewModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void processBarcodeNotOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
this.createNewLU(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
() -> processBarcodeAlreadyOpenedLU(barcodeScanDTO, onComplete));
|
||||||
|
}
|
||||||
|
|
||||||
private void processBarcodeAlreadyOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
private void processBarcodeAlreadyOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
|
||||||
if (UtilityBarcode.isEanPeso(barcodeScanDTO)) {
|
if (UtilityBarcode.isEanPeso(barcodeScanDTO)) {
|
||||||
@ -350,7 +376,6 @@ public class SpedizioneViewModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void executeEtichettaLU(String SSCC, Runnable onComplete) {
|
private void executeEtichettaLU(String SSCC, Runnable onComplete) {
|
||||||
ColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
|
ColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
|
||||||
|
|
||||||
@ -397,7 +422,6 @@ public class SpedizioneViewModel {
|
|||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
private void executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -430,93 +454,66 @@ public class SpedizioneViewModel {
|
|||||||
private void searchArtFromUL(MtbColt scannedUL, Runnable onComplete) {
|
private void searchArtFromUL(MtbColt scannedUL, Runnable onComplete) {
|
||||||
|
|
||||||
final List<PickingObjectDTO> pickingList = mPickingList.getValue();
|
final List<PickingObjectDTO> pickingList = mPickingList.getValue();
|
||||||
|
final List<PickingObjectDTO> matchPickingObject = new ArrayList<>();
|
||||||
|
|
||||||
// List<PickingObjectDTO> matchPickingObject = Stream.of(pickingList)
|
if (mEnableGiacenza) {
|
||||||
// .filter(x -> Objects.equals(x.getNumCollo(), scannedUL.getNumCollo()) &&
|
|
||||||
// x.getDataColloS().equals(scannedUL.getDataColloS()) &&
|
|
||||||
// x.getSerCollo().equalsIgnoreCase(scannedUL.getSerCollo()) &&
|
|
||||||
// (scannedUL.getGestioneEnum() == GestioneEnum.ACQUISTO || scannedUL.getGestioneEnum() == GestioneEnum.LAVORAZIONE)).toList();
|
|
||||||
//
|
|
||||||
// List<String> alreadyMatchedArts = Stream.of(matchPickingObject)
|
|
||||||
// .map(PickingObjectDTO::getCodMart).toList();
|
|
||||||
//
|
|
||||||
// //Cerco se devo fare pick dell'articolo tramite codMart perché forse non risulta in nessun collo
|
|
||||||
// List<String> listOfCodMartsInRowCollo = Stream.of(scannedUL.getMtbColr())
|
|
||||||
// .map(MtbColr::getCodMart)
|
|
||||||
// .withoutNulls()
|
|
||||||
// .toList();
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// List<PickingObjectDTO> matchPickingObjectByArt = Stream.of(pickingList)
|
|
||||||
// .filter(x -> //x.getNumCollo() == null &&
|
|
||||||
// (listOfCodMartsInRowCollo.contains(x.getCodMart()) && !alreadyMatchedArts.contains(x.getCodMart())))
|
|
||||||
// .toList();
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// if (SettingsManager.iDB().isEnableCheckPartitaMagCheckPickingV()) {
|
|
||||||
// for (int i = 0; i < matchPickingObjectByArt.size(); i++) {
|
|
||||||
// PickingObjectDTO tmpPickObj = matchPickingObjectByArt.get(i);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// List<MtbColr> matchWithPartitaMag = Stream.of(scannedUL.getMtbColr())
|
|
||||||
// .filter(x -> x.getCodMart().equalsIgnoreCase(tmpPickObj.getCodMart()) &&
|
|
||||||
// Objects.equals(x.getPartitaMag(), tmpPickObj.getPartitaMag())).toList();
|
|
||||||
//
|
|
||||||
// boolean anyMatch = matchWithPartitaMag.size() > 0;
|
|
||||||
//
|
|
||||||
// if (!anyMatch) {
|
|
||||||
// matchPickingObjectByArt.remove(i);
|
|
||||||
// i--;
|
|
||||||
// } else {
|
|
||||||
//
|
|
||||||
// for (int k = 0; k < matchWithPartitaMag.size(); k++) {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// MtbColr matchRow = matchWithPartitaMag.get(k);
|
|
||||||
//
|
|
||||||
// PickingObjectDTO.PickData pickData = new PickingObjectDTO.PickData()
|
|
||||||
// .setMtbPartitaMag(matchRow.getRifPartitaMag())
|
|
||||||
// .setNumCnf(matchRow.getNumCnf())
|
|
||||||
// .setQtaCnf(matchRow.getQtaCnf())
|
|
||||||
// .setQtaTot(matchRow.getQtaCol())
|
|
||||||
// .setSourceMtbColt(scannedUL);
|
|
||||||
//
|
|
||||||
// tmpPickObj.setTempPickData(pickData);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// for (int i = 0; i < matchPickingObjectByArt.size(); i++) {
|
|
||||||
//
|
|
||||||
// PickingObjectDTO tmpPickObj = matchPickingObjectByArt.get(i);
|
|
||||||
// List<MtbColr> matchWithColloRow = Stream.of(scannedUL.getMtbColr())
|
|
||||||
// .filter(x -> x.getCodMart().equalsIgnoreCase(tmpPickObj.getCodMart())).toList();
|
|
||||||
//
|
|
||||||
// for (int k = 0; k < matchWithColloRow.size(); k++) {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// MtbColr matchRow = matchWithColloRow.get(k);
|
|
||||||
// PickingObjectDTO.PickData pickData = new PickingObjectDTO.PickData()
|
|
||||||
// .setMtbPartitaMag(matchRow.getRifPartitaMag())
|
|
||||||
// .setNumCnf(matchRow.getNumCnf())
|
|
||||||
// .setQtaCnf(matchRow.getQtaCnf())
|
|
||||||
// .setQtaTot(matchRow.getQtaCol())
|
|
||||||
// .setSourceMtbColt(scannedUL);
|
|
||||||
//
|
|
||||||
// tmpPickObj.setTempPickData(pickData);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// matchPickingObject.addAll(matchPickingObjectByArt);
|
|
||||||
//
|
|
||||||
// this.loadMatchedRows(matchPickingObject);
|
|
||||||
|
|
||||||
|
Stream.of(pickingList)
|
||||||
|
.forEach(pickingObjectDTO -> {
|
||||||
|
if (Stream.of(pickingObjectDTO.getMtbColts())
|
||||||
|
.anyMatch(x -> Objects.equals(x.getNumCollo(), scannedUL.getNumCollo()) &&
|
||||||
|
x.getDataColloS().equals(scannedUL.getDataColloS()) &&
|
||||||
|
x.getSerCollo().equalsIgnoreCase(scannedUL.getSerCollo()) &&
|
||||||
|
(scannedUL.getGestioneEnum() == GestioneEnum.ACQUISTO || scannedUL.getGestioneEnum() == GestioneEnum.LAVORAZIONE))) {
|
||||||
|
|
||||||
|
matchPickingObject.add(pickingObjectDTO);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//Controllo se nel collo ho degli articoli che corrispondono per codice / taglia / colore / lotto
|
||||||
|
Stream.of(scannedUL.getMtbColr())
|
||||||
|
.filter(x -> !UtilityString.isNullOrEmpty(x.getCodMart()))
|
||||||
|
.forEach(x -> {
|
||||||
|
|
||||||
|
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()))) {
|
||||||
|
|
||||||
|
if (!matchPickingObject.contains(pickingObject)) {
|
||||||
|
matchPickingObject.add(pickingObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (PickingObjectDTO matchedObject : matchPickingObject) {
|
||||||
|
MtbColt cloneMtbColt = (MtbColt) scannedUL.clone();
|
||||||
|
ObservableArrayList<MtbColr> cloneMtbColrs = (ObservableArrayList<MtbColr>) cloneMtbColt.getMtbColr().clone();
|
||||||
|
|
||||||
|
|
||||||
|
Stream.of(cloneMtbColt.getMtbColr())
|
||||||
|
.filter(x -> !(UtilityString.equalsIgnoreCase(x.getCodMart(), matchedObject.getSitArtOrdDTO().getCodMart()) &&
|
||||||
|
UtilityString.equalsIgnoreCase(x.getCodTagl(), matchedObject.getSitArtOrdDTO().getCodTagl()) &&
|
||||||
|
UtilityString.equalsIgnoreCase(x.getCodCol(), matchedObject.getSitArtOrdDTO().getCodCol()) &&
|
||||||
|
(!mEnableCheckPartitaMag || UtilityString.equalsIgnoreCase(x.getPartitaMag(), matchedObject.getSitArtOrdDTO().getPartitaMag()))))
|
||||||
|
.forEach(x -> cloneMtbColrs.remove(x));
|
||||||
|
|
||||||
|
cloneMtbColt.setMtbColr(cloneMtbColrs);
|
||||||
|
|
||||||
|
PickDataDTO tempPickData = new PickDataDTO()
|
||||||
|
.setSourceMtbColt(cloneMtbColt);
|
||||||
|
|
||||||
|
matchedObject.setTempPickData(tempPickData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.loadMatchedRows(matchPickingObject);
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -551,14 +548,17 @@ public class SpedizioneViewModel {
|
|||||||
if (matchedRows == null || matchedRows.size() == 0) {
|
if (matchedRows == null || matchedRows.size() == 0) {
|
||||||
this.sendError(new NoArtsFoundException());
|
this.sendError(new NoArtsFoundException());
|
||||||
} else {
|
} else {
|
||||||
// List<PickingObjectDTO> pickingList = mPickingList.getValue();
|
List<PickingObjectDTO> pickingList = mPickingList.getValue();
|
||||||
//
|
|
||||||
// for (int i = 0; i < pickingList.size(); i++) {
|
for (int i = 0; i < pickingList.size(); i++) {
|
||||||
// if (!matchedRows.contains(pickingList.get(i))) {
|
if (!matchedRows.contains(pickingList.get(i))) {
|
||||||
// pickingList.get(i).setTempHidden(true);
|
pickingList.get(i).setHidden(true);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
|
this.sendFilterApplied(null);
|
||||||
|
this.getPickingList().postValue(pickingList);
|
||||||
|
|
||||||
// if (matchedRows.size() == 1) {
|
// if (matchedRows.size() == 1) {
|
||||||
//
|
//
|
||||||
// if (matchedRows.get(0).getTempPickData() != null &&
|
// if (matchedRows.get(0).getTempPickData() != null &&
|
||||||
@ -595,15 +595,15 @@ public class SpedizioneViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void dispatchOrdineRow(final PickingObjectDTOOld pickingObjectDTO) {
|
public void dispatchOrdineRow(final PickingObjectDTO pickingObjectDTO) {
|
||||||
|
|
||||||
BigDecimal totalQtaOrd = pickingObjectDTO.getQtaOrd();
|
BigDecimal totalQtaOrd = pickingObjectDTO.getSitArtOrdDTO().getQtaOrd();
|
||||||
BigDecimal totalNumCnfOrd = pickingObjectDTO.getNumCnfOrd();
|
BigDecimal totalNumCnfOrd = pickingObjectDTO.getSitArtOrdDTO().getNumCnfOrd();
|
||||||
|
|
||||||
AtomicBigDecimal numCnfWithdrawRows = new AtomicBigDecimal();
|
AtomicBigDecimal numCnfWithdrawRows = new AtomicBigDecimal();
|
||||||
AtomicBigDecimal qtaColWithdrawRows = new AtomicBigDecimal();
|
AtomicBigDecimal qtaColWithdrawRows = new AtomicBigDecimal();
|
||||||
|
|
||||||
Stream.of(pickingObjectDTO.getWithdrawRows())
|
Stream.of(pickingObjectDTO.getWithdrawMtbColr())
|
||||||
.forEach(row -> {
|
.forEach(row -> {
|
||||||
numCnfWithdrawRows.addAndGet(row.getNumCnf());
|
numCnfWithdrawRows.addAndGet(row.getNumCnf());
|
||||||
qtaColWithdrawRows.addAndGet(row.getQtaCol());
|
qtaColWithdrawRows.addAndGet(row.getQtaCol());
|
||||||
@ -618,13 +618,20 @@ public class SpedizioneViewModel {
|
|||||||
BigDecimal totalQtaAvailable = null;
|
BigDecimal totalQtaAvailable = null;
|
||||||
BigDecimal totalNumCnfAvailable = null;
|
BigDecimal totalNumCnfAvailable = null;
|
||||||
|
|
||||||
if (pickingObjectDTO.getNumCollo() != null) {
|
|
||||||
numCnfDaPrelevare = pickingObjectDTO.getNumCnfCollo().subtract(numCnfWithdrawRows.getBigDecimalValue());
|
|
||||||
qtaColDaPrelevare = pickingObjectDTO.getQtaCollo().subtract(qtaColWithdrawRows.getBigDecimalValue());
|
|
||||||
qtaCnfDaPrelevare = pickingObjectDTO.getQtaCnfCollo();
|
|
||||||
|
|
||||||
totalQtaAvailable = pickingObjectDTO.getQtaDisponibileCollo();
|
MtbColr mtbColrToDispatch = pickingObjectDTO.getTempPickData() != null &&
|
||||||
totalNumCnfAvailable = pickingObjectDTO.getNumCnfDisponibileCollo();
|
pickingObjectDTO.getTempPickData().getSourceMtbColt() != null &&
|
||||||
|
pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr() != null &&
|
||||||
|
pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().size() > 0 ?
|
||||||
|
pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().get(0) : null;
|
||||||
|
|
||||||
|
if (mtbColrToDispatch != null) {
|
||||||
|
numCnfDaPrelevare = pickingObjectDTO.getSitArtOrdDTO().getNumCnfOrd().subtract(numCnfWithdrawRows.getBigDecimalValue());
|
||||||
|
qtaColDaPrelevare = pickingObjectDTO.getSitArtOrdDTO().getQtaOrd().subtract(qtaColWithdrawRows.getBigDecimalValue());
|
||||||
|
// qtaCnfDaPrelevare = mtbColrToDispatch.getQtaCnfCollo();
|
||||||
|
|
||||||
|
totalQtaAvailable = mtbColrToDispatch.getQtaCol();
|
||||||
|
totalNumCnfAvailable = mtbColrToDispatch.getNumCnf();
|
||||||
|
|
||||||
|
|
||||||
if (UtilityBigDecimal.lowerThan(numCnfDaPrelevare, BigDecimal.ZERO))
|
if (UtilityBigDecimal.lowerThan(numCnfDaPrelevare, BigDecimal.ZERO))
|
||||||
@ -678,6 +685,17 @@ public class SpedizioneViewModel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetMatchedRows() {
|
||||||
|
for(PickingObjectDTO pickingObjectDTO : this.mPickingList.getValue()) {
|
||||||
|
pickingObjectDTO
|
||||||
|
.setTempPickData(null)
|
||||||
|
.setHidden(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mPickingList.postValue(this.mPickingList.getValue());
|
||||||
|
this.sendFilterRemoved();
|
||||||
|
}
|
||||||
|
|
||||||
public MutableLiveData<List<PickingObjectDTO>> getPickingList() {
|
public MutableLiveData<List<PickingObjectDTO>> getPickingList() {
|
||||||
return mPickingList;
|
return mPickingList;
|
||||||
}
|
}
|
||||||
@ -688,11 +706,15 @@ public class SpedizioneViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface Listeners {
|
public interface Listeners {
|
||||||
|
void onDatasetLoaded();
|
||||||
|
|
||||||
void onLUCreated(MtbColt mtbColt);
|
void onLUCreated(MtbColt mtbColt);
|
||||||
|
|
||||||
void onLUClosed();
|
void onLUClosed();
|
||||||
|
|
||||||
void onFilterChanged(String newValue);
|
void onFilterApplied(String newValue);
|
||||||
|
|
||||||
|
void onFilterRemoved();
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.databinding.SpedizioneMainListGroupHeaderBinding;
|
import it.integry.integrywmsnative.databinding.SpedizioneMainListGroupHeaderBinding;
|
||||||
import it.integry.integrywmsnative.databinding.SpedizioneMainListGroupItemBinding;
|
import it.integry.integrywmsnative.databinding.SpedizioneMainListGroupItemBinding;
|
||||||
|
import it.integry.integrywmsnative.gest.spedizione_new.model.PickingObjectDTO;
|
||||||
import it.integry.integrywmsnative.gest.vendita.dto.PickingObjectDTOOld;
|
import it.integry.integrywmsnative.gest.vendita.dto.PickingObjectDTOOld;
|
||||||
|
|
||||||
public class SpedizioneListAdapter extends SectionedRecyclerViewAdapter<SpedizioneListAdapter.SubheaderHolder, SpedizioneListAdapter.SingleItemViewHolder> {
|
public class SpedizioneListAdapter extends SectionedRecyclerViewAdapter<SpedizioneListAdapter.SubheaderHolder, SpedizioneListAdapter.SingleItemViewHolder> {
|
||||||
@ -33,7 +34,7 @@ public class SpedizioneListAdapter extends SectionedRecyclerViewAdapter<Spedizio
|
|||||||
private Context mContext;
|
private Context mContext;
|
||||||
private List<SpedizioneListModel> mDataset = new ArrayList<>();
|
private List<SpedizioneListModel> mDataset = new ArrayList<>();
|
||||||
|
|
||||||
private RunnableArgs<PickingObjectDTOOld> mOnItemClicked;
|
private RunnableArgs<PickingObjectDTO> mOnItemClicked;
|
||||||
|
|
||||||
static class SubheaderHolder extends RecyclerView.ViewHolder {
|
static class SubheaderHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
@ -71,7 +72,7 @@ public class SpedizioneListAdapter extends SectionedRecyclerViewAdapter<Spedizio
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnItemClicked(RunnableArgs<PickingObjectDTOOld> onItemClicked) {
|
public void setOnItemClicked(RunnableArgs<PickingObjectDTO> onItemClicked) {
|
||||||
this.mOnItemClicked = onItemClicked;
|
this.mOnItemClicked = onItemClicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
package it.integry.integrywmsnative.gest.spedizione_new.core;
|
package it.integry.integrywmsnative.gest.spedizione_new.core;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.gest.spedizione_new.model.PickingObjectDTO;
|
||||||
import it.integry.integrywmsnative.gest.vendita.dto.PickingObjectDTOOld;
|
import it.integry.integrywmsnative.gest.vendita.dto.PickingObjectDTOOld;
|
||||||
|
|
||||||
public class SpedizioneListModel {
|
public class SpedizioneListModel implements Cloneable{
|
||||||
|
|
||||||
private String groupTitle;
|
private String groupTitle;
|
||||||
|
|
||||||
@ -21,7 +25,18 @@ public class SpedizioneListModel {
|
|||||||
|
|
||||||
private boolean active;
|
private boolean active;
|
||||||
|
|
||||||
private PickingObjectDTOOld mOriginalModel;
|
private PickingObjectDTO mOriginalModel;
|
||||||
|
private MtbColt mSourceMtbColt;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Object clone() {
|
||||||
|
try {
|
||||||
|
return super.clone();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getGroupTitle() {
|
public String getGroupTitle() {
|
||||||
return groupTitle;
|
return groupTitle;
|
||||||
@ -122,12 +137,21 @@ public class SpedizioneListModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PickingObjectDTOOld getOriginalModel() {
|
public PickingObjectDTO getOriginalModel() {
|
||||||
return mOriginalModel;
|
return mOriginalModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpedizioneListModel setOriginalModel(PickingObjectDTOOld originalModel) {
|
public SpedizioneListModel setOriginalModel(PickingObjectDTO originalModel) {
|
||||||
this.mOriginalModel = originalModel;
|
this.mOriginalModel = originalModel;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbColt getSourceMtbColt() {
|
||||||
|
return mSourceMtbColt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpedizioneListModel setSourceMtbColt(MtbColt sourceMtbColt) {
|
||||||
|
this.mSourceMtbColt = sourceMtbColt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,9 @@ package it.integry.integrywmsnative.gest.spedizione_new.exceptions;
|
|||||||
|
|
||||||
public class OrdersLoadException extends Exception {
|
public class OrdersLoadException extends Exception {
|
||||||
|
|
||||||
public OrdersLoadException() {
|
public OrdersLoadException(Throwable cause) {
|
||||||
super("Errore durante il caricamento degli ordini");
|
super("Errore durante il caricamento degli ordini");
|
||||||
|
initCause(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,17 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.spedizione_new.model;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
|
||||||
|
public class PickDataDTO {
|
||||||
|
|
||||||
|
private MtbColt sourceMtbColt;
|
||||||
|
|
||||||
|
public MtbColt getSourceMtbColt() {
|
||||||
|
return sourceMtbColt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PickDataDTO setSourceMtbColt(MtbColt sourceMtbColt) {
|
||||||
|
this.sourceMtbColt = sourceMtbColt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,8 +1,11 @@
|
|||||||
package it.integry.integrywmsnative.gest.spedizione_new.model;
|
package it.integry.integrywmsnative.gest.spedizione_new.model;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
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.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||||
|
|
||||||
@ -10,13 +13,15 @@ public class PickingObjectDTO {
|
|||||||
|
|
||||||
private SitArtOrdDTO sitArtOrdDTO;
|
private SitArtOrdDTO sitArtOrdDTO;
|
||||||
private MtbAart mtbAart;
|
private MtbAart mtbAart;
|
||||||
private MtbColt mtbColt;
|
private List<MtbColt> mtbColts;
|
||||||
|
|
||||||
|
private PickDataDTO tempPickData;
|
||||||
|
private List<MtbColr> withdrawMtbColr = new ArrayList<>();
|
||||||
|
|
||||||
// private BigDecimal qtaDisponibileCollo;
|
// private BigDecimal qtaDisponibileCollo;
|
||||||
// private BigDecimal numCnfDisponibileCollo;
|
// private BigDecimal numCnfDisponibileCollo;
|
||||||
|
|
||||||
private boolean hidden = false;
|
private boolean hidden = false;
|
||||||
private boolean deactivated = false;
|
|
||||||
|
|
||||||
|
|
||||||
public SitArtOrdDTO getSitArtOrdDTO() {
|
public SitArtOrdDTO getSitArtOrdDTO() {
|
||||||
@ -37,12 +42,12 @@ public class PickingObjectDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColt getMtbColt() {
|
public List<MtbColt> getMtbColts() {
|
||||||
return mtbColt;
|
return mtbColts;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PickingObjectDTO setMtbColt(MtbColt mtbColt) {
|
public PickingObjectDTO setMtbColts(List<MtbColt> mtbColts) {
|
||||||
this.mtbColt = mtbColt;
|
this.mtbColts = mtbColts;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,12 +60,21 @@ public class PickingObjectDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDeactivated() {
|
public PickDataDTO getTempPickData() {
|
||||||
return deactivated;
|
return tempPickData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PickingObjectDTO setDeactivated(boolean deactivated) {
|
public PickingObjectDTO setTempPickData(PickDataDTO tempPickData) {
|
||||||
this.deactivated = deactivated;
|
this.tempPickData = tempPickData;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MtbColr> getWithdrawMtbColr() {
|
||||||
|
return withdrawMtbColr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PickingObjectDTO setWithdrawMtbColr(List<MtbColr> withdrawMtbColr) {
|
||||||
|
this.withdrawMtbColr = withdrawMtbColr;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,19 +98,20 @@
|
|||||||
android:paddingLeft="8dp"
|
android:paddingLeft="8dp"
|
||||||
android:paddingRight="8dp">
|
android:paddingRight="8dp">
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_toStartOf="@+id/remove_art_filter_list"
|
android:layout_toStartOf="@+id/remove_art_filter_list"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="14sp"
|
android:text="@string/filtered_arts_in_list"
|
||||||
android:text="@string/filtered_arts_in_list" />
|
style="@style/AppTheme.NewMaterial.Text.Small"/>
|
||||||
<TextView
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:id="@+id/description_filter_text"
|
android:id="@+id/description_filter_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -119,9 +120,10 @@
|
|||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
|
style="@style/AppTheme.NewMaterial.Text.Medium"
|
||||||
tools:text="COD_ART_HERE"/>
|
tools:text="COD_ART_HERE"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -148,6 +150,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:scrollbars="vertical"
|
android:scrollbars="vertical"
|
||||||
|
android:paddingBottom="72dp"
|
||||||
android:clipToPadding="false"/>
|
android:clipToPadding="false"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user