Refactoring dei servizi utilizzati nelle gestioni di Lavorazione / Vendita.

Fix su scansione articoli in Documenti Interni.
This commit is contained in:
Giuseppe Scorrano 2023-01-25 17:11:25 +01:00
parent b6c82c869e
commit ab14d6736c
44 changed files with 1383 additions and 438 deletions

View File

@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
android { android {
def appVersionCode = 325 def appVersionCode = 326
def appVersionName = '1.30.07' def appVersionName = '1.30.08'
signingConfigs { signingConfigs {
release { release {
@ -31,12 +31,12 @@ android {
} }
} }
compileSdkVersion 32 compileSdkVersion 33
defaultConfig { defaultConfig {
applicationId "it.integry.integrywmsnative" applicationId "it.integry.integrywmsnative"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 32 targetSdkVersion 33
versionCode appVersionCode versionCode appVersionCode
versionName appVersionName versionName appVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -66,7 +66,7 @@ android {
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_11 sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11 targetCompatibility JavaVersion.VERSION_11
coreLibraryDesugaringEnabled true //coreLibraryDesugaringEnabled true
} }
productFlavors { productFlavors {
@ -115,9 +115,9 @@ dependencies {
implementation 'com.google.android.gms:play-services-basement:18.1.0' implementation 'com.google.android.gms:play-services-basement:18.1.0'
implementation 'androidx.appcompat:appcompat:1.5.1' implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.6.1' implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.recyclerview:recyclerview:1.2.1'
@ -156,12 +156,12 @@ dependencies {
implementation 'com.github.pedromassango:doubleClick:3.0' implementation 'com.github.pedromassango:doubleClick:3.0'
//SQLite ROOM //SQLite ROOM
def room_version = "2.4.3" def room_version = "2.5.0"
implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version" annotationProcessor "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-rxjava3:$room_version" implementation "androidx.room:room-rxjava3:$room_version"
androidTestImplementation "androidx.room:room-testing:2.4.3" androidTestImplementation "androidx.room:room-testing:2.5.0"
//AppUpdate //AppUpdate
implementation 'com.github.javiersantos:AppUpdater:2.7' implementation 'com.github.javiersantos:AppUpdater:2.7'
@ -189,8 +189,6 @@ dependencies {
implementation 'io.reactivex.rxjava2:rxjava:2.1.12' implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2' implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.0'
} }
repositories { repositories {

View File

@ -22,7 +22,9 @@ import it.integry.integrywmsnative.core.menu.MenuService;
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.AziendaRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.AziendaRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.CommessaRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.CommessaRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.DocumentiRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.DocumentiRESTConsumer;
@ -254,4 +256,16 @@ public class MainApplicationModule {
return new DocumentiRESTConsumer(); return new DocumentiRESTConsumer();
} }
@Provides
@Singleton
ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer() {
return new ColliSpedizioneRESTConsumer();
}
@Provides
@Singleton
ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer() {
return new ColliLavorazioneRESTConsumer();
}
} }

View File

@ -6,8 +6,11 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColt; import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO; import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
public interface IOrdiniVendita { public interface OrdiniVenditaInterface {
boolean isTrasfOrder(List<OrdineUscitaInevasoDTO> testateOrdini);
@Deprecated
void distribuisciCollo(MtbColt mtbColt, List<OrdineUscitaInevasoDTO> testateOrdini, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed); void distribuisciCollo(MtbColt mtbColt, List<OrdineUscitaInevasoDTO> testateOrdini, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed);
} }

View File

@ -37,14 +37,12 @@ public class BaseActivity extends AppCompatActivity {
public void onLoadingEnded() { public void onLoadingEnded() {
this.closeProgress(); this.closeProgress();
BarcodeManager.enable();
} }
public void onError(Exception ex) { public void onError(Exception ex) {
this.runOnUiThread(() -> { this.runOnUiThread(() -> {
this.closeProgress(); this.closeProgress();
UtilityExceptions.defaultException(this, ex); UtilityExceptions.defaultException(this, ex);
BarcodeManager.enable();
}); });
} }

View File

@ -600,33 +600,6 @@ public class MtbColt extends EntityBase {
} }
} }
/*if (filtroOrdineDtos != null && filtroOrdineDtos.size() > 0) {
for (int i = 0; i < filtroOrdineDtos.size(); i++) {
FiltroOrdineDTO x = filtroOrdineDtos.get(i);
try {
whereCond.append("(");
whereCond.append(String.format("d.g = %s AND d.d = %s and d.n = %s",
UtilityDB.valueToString(x.getGestioneOrd()),
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataOrdD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH)),
UtilityDB.valueToString(x.getNumOrd())));
if (!UtilityString.isNullOrEmpty(x.getDataConsS())) {
whereCond.append(String.format(" AND dr.dc = %s",
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataConsD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH))));
}
whereCond.append(")");
if (i < filtroOrdineDtos.size() - 1) {
whereCond.append(" OR ");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}*/
whereCond = TextUtils.join(" OR ", conditions); whereCond = TextUtils.join(" OR ", conditions);
this.filtroOrdini = xmlPrefix + whereCond + xmlSuffix; this.filtroOrdini = xmlPrefix + whereCond + xmlSuffix;

View File

@ -0,0 +1,158 @@
package it.integry.integrywmsnative.core.rest.consumers;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.uds.CanUDSBeDeletedRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface {
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
@Override
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/closeUDS", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
@Override
public void canUDSBeDeleted(CanUDSBeDeletedRequestDTO canUDSBeDeletedRequestDTO, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.canUDSBeDeleted(canUDSBeDeletedRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
analyzeAnswer(response, "lavorazione/canUDSBeDeleted", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
@Override
public void deleteUDS(DeleteUDSRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.deleteUDS(deleteUDSRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "lavorazione/deleteUDS", Void -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
@Override
public void printUDS(PrintUDSRequestDTO printUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.printUDS(printUDSRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "lavorazione/printUDS", Void -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
@Override
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
@Override
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "lavorazione/deleteUDSRow", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
}

View File

@ -0,0 +1,41 @@
package it.integry.integrywmsnative.core.rest.consumers;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.uds.CanUDSBeDeletedRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
public interface ColliLavorazioneRESTConsumerService {
@POST("wms/lavorazione/createUDS")
Call<ServiceRESTResponse<CreateUDSResponseDTO>> createUDS(@Body CreateUDSRequestDTO createUDSRequestDTO);
@POST("wms/lavorazione/closeUDS")
Call<ServiceRESTResponse<CloseUDSResponseDTO>> closeUDS(@Body CloseUDSRequestDTO createUDSRequestDTO);
@POST("wms/lavorazione/canUDSBeDeleted")
Call<ServiceRESTResponse<Boolean>> canUDSBeDeleted(@Body CanUDSBeDeletedRequestDTO canUDSBeDeletedRequestDTO);
@POST("wms/lavorazione/deleteUDS")
Call<ServiceRESTResponse<Void>> deleteUDS(@Body DeleteUDSRequestDTO deleteUDSRequestDTO);
@POST("wms/lavorazione/printUDS")
Call<ServiceRESTResponse<Void>> printUDS(@Body PrintUDSRequestDTO printUDSRequestDTO);
@POST("wms/lavorazione/insertUDSRow")
Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> insertUDSRow(@Body InsertUDSRowRequestDTO insertUDSRowRequestDTO);
@POST("wms/lavorazione/deleteUDSRow")
Call<ServiceRESTResponse<Void>> deleteUDSRow(@Body DeleteUDSRowRequestDTO deleteUDSRowRequestDTO);
}

View File

@ -292,7 +292,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class); ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.distribuisciCollo(distribuzioneColloDTO) colliMagazzinoRESTConsumerService.distribuisciCollo(distribuzioneColloDTO)
.enqueue(new Callback<ServiceRESTResponse<JsonObject>>() { .enqueue(new Callback<>() {
@Override @Override
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) { public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
analyzeAnswerList(response, "DistribuzioneCollo", obj -> { analyzeAnswerList(response, "DistribuzioneCollo", obj -> {

View File

@ -0,0 +1,154 @@
package it.integry.integrywmsnative.core.rest.consumers;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.uds.CanUDSBeDeletedRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface {
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
analyzeAnswer(response, "spedizione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
analyzeAnswer(response, "spedizione/closeUDS", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
public void canUDSBeDeleted(CanUDSBeDeletedRequestDTO canUDSBeDeletedRequestDTO, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.canUDSBeDeleted(canUDSBeDeletedRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
analyzeAnswer(response, "spedizione/canUDSBeDeleted", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
public void deleteUDS(DeleteUDSRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.deleteUDS(deleteUDSRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "spedizione/deleteUDS", Void -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
public void printUDS(PrintUDSRequestDTO printUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.printUDS(printUDSRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "spedizione/printUDS", Void -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
analyzeAnswer(response, "spedizione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "spedizione/deleteUDSRow", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
}

View File

@ -0,0 +1,41 @@
package it.integry.integrywmsnative.core.rest.consumers;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.uds.CanUDSBeDeletedRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
public interface ColliSpedizioneRESTConsumerService {
@POST("wms/spedizione/createUDS")
Call<ServiceRESTResponse<CreateUDSResponseDTO>> createUDS(@Body CreateUDSRequestDTO createUDSRequestDTO);
@POST("wms/spedizione/closeUDS")
Call<ServiceRESTResponse<CloseUDSResponseDTO>> closeUDS(@Body CloseUDSRequestDTO createUDSRequestDTO);
@POST("wms/spedizione/canUDSBeDeleted")
Call<ServiceRESTResponse<Boolean>> canUDSBeDeleted(@Body CanUDSBeDeletedRequestDTO canUDSBeDeletedRequestDTO);
@POST("wms/spedizione/deleteUDS")
Call<ServiceRESTResponse<Void>> deleteUDS(@Body DeleteUDSRequestDTO deleteUDSRequestDTO);
@POST("wms/spedizione/printUDS")
Call<ServiceRESTResponse<Void>> printUDS(@Body PrintUDSRequestDTO printUDSRequestDTO);
@POST("wms/spedizione/insertUDSRow")
Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> insertUDSRow(@Body InsertUDSRowRequestDTO insertUDSRowRequestDTO);
@POST("wms/spedizione/deleteUDSRow")
Call<ServiceRESTResponse<Void>> deleteUDSRow(@Body DeleteUDSRowRequestDTO deleteUDSRowRequestDTO);
}

View File

@ -66,24 +66,23 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
} }
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class); PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
Call<ServiceRESTResponse<Object>> callable = null; printerService
callable = printerService.printCollo(testataColloToPrint); .printCollo(testataColloToPrint)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "printCollo", data -> {
onComplete.run();
}, onFailed);
}
callable.enqueue(new Callback<>() { @Override
@Override public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) { if (t.getMessage().contains("Printer not found")) {
analyzeAnswer(response, "printCollo", data -> { onFailed.run(new NoPrintersFoundException());
onComplete.run(); } else onFailed.run(new Exception(t));
}, onFailed); }
} });
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
if (t.getMessage().contains("Printer not found")) {
onFailed.run(new NoPrintersFoundException());
} else onFailed.run(new Exception(t));
}
});
} }

View File

@ -30,8 +30,9 @@ public abstract class _BaseRESTConsumer {
onComplete.run(dataObj); onComplete.run(dataObj);
} }
} else { } else {
Log.e(logTitle, response.body().getErrorMessage()); String errorMessage = UtilityString.isNull(response.body().getErrorMessage(), "Empty message");
onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage())); Log.e(logTitle, errorMessage);
onFailed.run(CommonRESTException.tryRecognizeException(errorMessage));
} }
} else { } else {
Log.e(logTitle, response.message()); Log.e(logTitle, response.message());

View File

@ -0,0 +1,30 @@
package it.integry.integrywmsnative.core.rest.consumers.interfaces;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.model.uds.CanUDSBeDeletedRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
public interface ColliScaricoRESTConsumerInterface {
void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed);
void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed);
void canUDSBeDeleted(CanUDSBeDeletedRequestDTO canUDSBeDeletedRequestDTO, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed);
void deleteUDS(DeleteUDSRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
void printUDS(PrintUDSRequestDTO printUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
}

View File

@ -0,0 +1,18 @@
package it.integry.integrywmsnative.core.rest.model.uds;
import it.integry.integrywmsnative.core.model.MtbColt;
public class CanUDSBeDeletedRequestDTO {
private MtbColt mtbColt;
public MtbColt getMtbColt() {
return mtbColt;
}
public CanUDSBeDeletedRequestDTO setMtbColt(MtbColt mtbColt) {
this.mtbColt = mtbColt;
return this;
}
}

View File

@ -0,0 +1,47 @@
package it.integry.integrywmsnative.core.rest.model.uds;
import it.integry.integrywmsnative.core.model.MtbColt;
public class CloseUDSRequestDTO {
private boolean printSSCC;
private boolean enableTransferLogic;
private String orderCodMdep;
private MtbColt mtbColt;
public boolean isPrintSSCC() {
return printSSCC;
}
public CloseUDSRequestDTO setPrintSSCC(boolean printSSCC) {
this.printSSCC = printSSCC;
return this;
}
public boolean isEnableTransferLogic() {
return enableTransferLogic;
}
public CloseUDSRequestDTO setEnableTransferLogic(boolean enableTransferLogic) {
this.enableTransferLogic = enableTransferLogic;
return this;
}
public String getOrderCodMdep() {
return orderCodMdep;
}
public CloseUDSRequestDTO setOrderCodMdep(String orderCodMdep) {
this.orderCodMdep = orderCodMdep;
return this;
}
public MtbColt getMtbColt() {
return mtbColt;
}
public CloseUDSRequestDTO setMtbColt(MtbColt mtbColt) {
this.mtbColt = mtbColt;
return this;
}
}

View File

@ -0,0 +1,24 @@
package it.integry.integrywmsnative.core.rest.model.uds;
import java.util.List;
import it.integry.integrywmsnative.core.model.MtbColt;
public class CloseUDSResponseDTO {
private boolean saved;
private boolean deleted;
private List<MtbColt> generatedMtbColts;
public boolean isSaved() {
return saved;
}
public boolean isDeleted() {
return deleted;
}
public List<MtbColt> getGeneratedMtbColts() {
return generatedMtbColts;
}
}

View File

@ -0,0 +1,85 @@
package it.integry.integrywmsnative.core.rest.model.uds;
import java.util.List;
public class CreateUDSRequestDTO {
private String codMdep;
private int segno;
private String ragSoc;
private Integer numCollo;
private String serCollo;
private int causaleCollo;
private List<CreateUDSRequestOrderDTO> orders;
public String getCodMdep() {
return codMdep;
}
public CreateUDSRequestDTO setCodMdep(String codMdep) {
this.codMdep = codMdep;
return this;
}
public int getSegno() {
return segno;
}
public CreateUDSRequestDTO setSegno(int segno) {
this.segno = segno;
return this;
}
public String getRagSoc() {
return ragSoc;
}
public CreateUDSRequestDTO setRagSoc(String ragSoc) {
this.ragSoc = ragSoc;
return this;
}
public Integer getNumCollo() {
return numCollo;
}
public CreateUDSRequestDTO setNumCollo(Integer numCollo) {
this.numCollo = numCollo;
return this;
}
public String getSerCollo() {
return serCollo;
}
public CreateUDSRequestDTO setSerCollo(String serCollo) {
this.serCollo = serCollo;
return this;
}
public int getCausaleCollo() {
return causaleCollo;
}
public CreateUDSRequestDTO setCausaleCollo(int causaleCollo) {
this.causaleCollo = causaleCollo;
return this;
}
public List<CreateUDSRequestOrderDTO> getOrders() {
return orders;
}
public CreateUDSRequestDTO setOrders(List<CreateUDSRequestOrderDTO> orders) {
this.orders = orders;
return this;
}
public static class Causale {
public static final int SCARICO = 0;
public static final int POSIZIONAMENTO = 1;
}
}

View File

@ -0,0 +1,49 @@
package it.integry.integrywmsnative.core.rest.model.uds;
import java.time.LocalDate;
public class CreateUDSRequestOrderDTO {
private String gestione;
private LocalDate dataOrd;
private LocalDate dataCons;
private int numOrd;
public String getGestione() {
return gestione;
}
public CreateUDSRequestOrderDTO setGestione(String gestione) {
this.gestione = gestione;
return this;
}
public LocalDate getDataOrd() {
return dataOrd;
}
public CreateUDSRequestOrderDTO setDataOrd(LocalDate dataOrd) {
this.dataOrd = dataOrd;
return this;
}
public LocalDate getDataCons() {
return dataCons;
}
public CreateUDSRequestOrderDTO setDataCons(LocalDate dataCons) {
this.dataCons = dataCons;
return this;
}
public int getNumOrd() {
return numOrd;
}
public CreateUDSRequestOrderDTO setNumOrd(int numOrd) {
this.numOrd = numOrd;
return this;
}
}

View File

@ -0,0 +1,12 @@
package it.integry.integrywmsnative.core.rest.model.uds;
import it.integry.integrywmsnative.core.model.MtbColt;
public class CreateUDSResponseDTO {
private MtbColt mtbColt;
public MtbColt getMtbColt() {
return mtbColt;
}
}

View File

@ -0,0 +1,17 @@
package it.integry.integrywmsnative.core.rest.model.uds;
import it.integry.integrywmsnative.core.model.MtbColt;
public class DeleteUDSRequestDTO {
private MtbColt mtbColt;
public MtbColt getMtbColt() {
return mtbColt;
}
public DeleteUDSRequestDTO setMtbColt(MtbColt mtbColt) {
this.mtbColt = mtbColt;
return this;
}
}

View File

@ -0,0 +1,17 @@
package it.integry.integrywmsnative.core.rest.model.uds;
import it.integry.integrywmsnative.core.model.MtbColr;
public class DeleteUDSRowRequestDTO {
private MtbColr mtbColrToDelete;
public MtbColr getMtbColrToDelete() {
return mtbColrToDelete;
}
public DeleteUDSRowRequestDTO setMtbColrToDelete(MtbColr mtbColrToDelete) {
this.mtbColrToDelete = mtbColrToDelete;
return this;
}
}

View File

@ -0,0 +1,92 @@
package it.integry.integrywmsnative.core.rest.model.uds;
import java.math.BigDecimal;
import java.time.LocalDate;
import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt;
public class InsertUDSRowRequestDTO {
private MtbColr sourceMtbColr;
private MtbColt targetMtbColt;
private String codMart;
private BigDecimal qtaTot;
private BigDecimal qtaCnf;
private BigDecimal numCnf;
private String partitaMag;
private LocalDate dataScad;
public MtbColr getSourceMtbColr() {
return sourceMtbColr;
}
public InsertUDSRowRequestDTO setSourceMtbColr(MtbColr sourceMtbColr) {
this.sourceMtbColr = sourceMtbColr;
return this;
}
public MtbColt getTargetMtbColt() {
return targetMtbColt;
}
public InsertUDSRowRequestDTO setTargetMtbColt(MtbColt targetMtbColt) {
this.targetMtbColt = targetMtbColt;
return this;
}
public String getCodMart() {
return codMart;
}
public InsertUDSRowRequestDTO setCodMart(String codMart) {
this.codMart = codMart;
return this;
}
public BigDecimal getQtaTot() {
return qtaTot;
}
public InsertUDSRowRequestDTO setQtaTot(BigDecimal qtaTot) {
this.qtaTot = qtaTot;
return this;
}
public BigDecimal getQtaCnf() {
return qtaCnf;
}
public InsertUDSRowRequestDTO setQtaCnf(BigDecimal qtaCnf) {
this.qtaCnf = qtaCnf;
return this;
}
public BigDecimal getNumCnf() {
return numCnf;
}
public InsertUDSRowRequestDTO setNumCnf(BigDecimal numCnf) {
this.numCnf = numCnf;
return this;
}
public String getPartitaMag() {
return partitaMag;
}
public InsertUDSRowRequestDTO setPartitaMag(String partitaMag) {
this.partitaMag = partitaMag;
return this;
}
public LocalDate getDataScad() {
return dataScad;
}
public InsertUDSRowRequestDTO setDataScad(LocalDate dataScad) {
this.dataScad = dataScad;
return this;
}
}

View File

@ -0,0 +1,12 @@
package it.integry.integrywmsnative.core.rest.model.uds;
import it.integry.integrywmsnative.core.model.MtbColr;
public class InsertUDSRowResponseDTO {
private MtbColr savedMtbColr;
public MtbColr getSavedMtbColr() {
return savedMtbColr;
}
}

View File

@ -0,0 +1,19 @@
package it.integry.integrywmsnative.core.rest.model.uds;
import java.util.List;
import it.integry.integrywmsnative.core.model.MtbColt;
public class PrintUDSRequestDTO {
private List<MtbColt> mtbColts;
public List<MtbColt> getMtbColts() {
return mtbColts;
}
public PrintUDSRequestDTO setMtbColts(List<MtbColt> mtbColts) {
this.mtbColts = mtbColts;
return this;
}
}

View File

@ -12,12 +12,12 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
public class ServerStatusChecker { public class ServerStatusChecker {
private static ServerStatusChecker instance = new ServerStatusChecker(); private static final ServerStatusChecker instance = new ServerStatusChecker();
private List<RunnableArgs<Boolean>> mCallback = new ArrayList<>(); private final List<RunnableArgs<Boolean>> mCallback = new ArrayList<>();
private RunnableArgs<Boolean> mInternalCallback = value -> { private final RunnableArgs<Boolean> mInternalCallback = value -> {
for (RunnableArgs callback : mCallback) { for (RunnableArgs<Boolean> callback : mCallback) {
callback.run(value); callback.run(value);
} }
}; };
@ -26,8 +26,8 @@ public class ServerStatusChecker {
private final long MILLIS_DELAY = 5 * 1000; private final long MILLIS_DELAY = 5 * 1000;
private Handler handler = new Handler(); private final Handler handler = new Handler();
private Runnable runnableCode = new Runnable() { private final Runnable runnableCode = new Runnable() {
@Override @Override
public void run() { public void run() {
if (shouldExecute && !UtilityString.isNullOrEmpty(SettingsManager.i().getServer().getHost())) { if (shouldExecute && !UtilityString.isNullOrEmpty(SettingsManager.i().getServer().getHost())) {

View File

@ -43,7 +43,7 @@ public class UtilityServer {
OkHttpClient client = new OkHttpClient(); OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder() Request request = new Request.Builder()
.url(String.format("http://%s:%d/ems-api/retail/status", serverAddress, serverTCPport)) .url(String.format("http://%s:%d/ems-api/system/ok", serverAddress, serverTCPport))
.build(); .build();
try { try {

View File

@ -30,7 +30,7 @@ import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.class_router.ClassRouter; import it.integry.integrywmsnative.core.class_router.ClassRouter;
import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration; import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration;
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration; import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
import it.integry.integrywmsnative.core.class_router.interfaces.IOrdiniVendita; import it.integry.integrywmsnative.core.class_router.interfaces.OrdiniVenditaInterface;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverDTO; import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverDTO;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService; import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
@ -196,7 +196,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
if (recoveredMtbColt != null && (recoveredMtbColt.getGestioneEnum() == GestioneEnum.VENDITA || recoveredMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && !UtilityString.isNullOrEmpty(recoveredMtbColt.getFiltroOrdini())) { if (recoveredMtbColt != null && (recoveredMtbColt.getGestioneEnum() == GestioneEnum.VENDITA || recoveredMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && !UtilityString.isNullOrEmpty(recoveredMtbColt.getFiltroOrdini())) {
IOrdiniVendita ordiniVendita = ClassRouter.getInstance(ClassRouter.PATH.ORDINI_VENDITA); OrdiniVenditaInterface ordiniVendita = ClassRouter.getInstance(ClassRouter.PATH.ORDINI_VENDITA);
this.colliMagazzinoRESTConsumer.updateDataFine(recoveredMtbColt, () -> { this.colliMagazzinoRESTConsumer.updateDataFine(recoveredMtbColt, () -> {
ordiniVendita.distribuisciCollo(recoveredMtbColt, recoveredMtbColtDto.getTestateOrdini(), ordiniVendita.distribuisciCollo(recoveredMtbColt, recoveredMtbColtDto.getTestateOrdini(),

View File

@ -187,12 +187,10 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
public void onItemDispatched(ArticoloOrdine articoloOrdine, Runnable onSuccess) { public void onItemDispatched(ArticoloOrdine articoloOrdine, Runnable onSuccess) {
DialogEditArticoloView DialogEditArticoloView
.newInstance(articoloOrdine, articolo -> { .newInstance(articoloOrdine, articolo -> {
runOnUiThread(() -> { if (articolo != null) {
if (articolo != null) { Toast.makeText(this, "Articolo aggiunto all'ordine!", Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Articolo aggiunto all'ordine!", Toast.LENGTH_SHORT).show(); }
} this.mViewModel.refreshListArticoli(onSuccess);
this.mViewModel.refreshListArticoli(onSuccess);
});
}, null).show(this.getSupportFragmentManager(), "DialogEditArticoloView"); }, null).show(this.getSupportFragmentManager(), "DialogEditArticoloView");
} }
@ -203,10 +201,8 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
public void exportOrdine() { public void exportOrdine() {
this.mViewModel.exportOrdine(() -> { this.mViewModel.exportOrdine(() -> {
runOnUiThread(() -> { Toast.makeText(this, "Ordine salvato con successo", Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Ordine salvato con successo", Toast.LENGTH_SHORT).show(); close();
close();
});
}); });
} }

View File

@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import javax.inject.Inject; import javax.inject.Inject;
@ -123,23 +124,21 @@ public class PVOrdineAcquistoEditViewModel {
public void processBarcode(String barcode) { public void processBarcode(String barcode) {
try { try {
BarcodeManager.disable();
this.sendOnLoadingStarted(); this.sendOnLoadingStarted();
ArticoloDTO articoloDTO = getArticoloFromBarcode(barcode); ArticoloDTO articoloDTO = getArticoloFromBarcode(barcode);
if (articoloDTO == null) { if (articoloDTO == null) {
throw new NoResultFromBarcodeException(barcode); throw new NoResultFromBarcodeException(barcode);
} }
this.addArticoloToOrdine( this.addArticoloToOrdine(
articoloDTO, articoloDTO,
BarcodeManager::enable, this::sendOnLoadingEnded,
e -> { this::sendError
this.sendError(e);
BarcodeManager.enable();
}
); );
} catch (Exception e) { } catch (Exception e) {
this.sendError(e); this.sendError(e);
BarcodeManager.enable(); BarcodeManager.enable();
} finally {
} }
} }
@ -154,26 +153,18 @@ public class PVOrdineAcquistoEditViewModel {
public void addArticoloToOrdine(ArticoloDTO art, Runnable onSuccess, RunnableArgs<Exception> onFail) { public void addArticoloToOrdine(ArticoloDTO art, Runnable onSuccess, RunnableArgs<Exception> onFail) {
try { try {
mArticoliOrdineRepository.findArticoloByScanAndOrdine(mCurrentOrdine, art.codMart, (articolo) -> { mArticoliOrdineRepository.findArticoloByScanAndOrdine(mCurrentOrdine, art.codMart, foundArt -> {
this.sendOnLoadingEnded();
if (articolo != null) {
if (isAutoOrderOnScan()) {
articolo.setQtaOrd(articolo.getQtaOrd() + articolo.getQtaCnf());
mArticoliOrdineRepository.saveArticoloToOrdine(articolo, () -> this.refreshListArticoli(onSuccess), onFail);
} else {
this.sendOnItemDispatched(articolo, onSuccess);
}
var articolo = foundArt != null ? foundArt : art.convertToArticoloOrdine(mCurrentOrdine);
if (isAutoOrderOnScan()) {
articolo.setQtaOrd(articolo.getQtaOrd() + articolo.getQtaCnf());
mArticoliOrdineRepository.saveArticoloToOrdine(articolo, () -> this.refreshListArticoli(onSuccess), onFail);
} else { } else {
articolo = art.convertToArticoloOrdine(mCurrentOrdine); this.sendOnItemDispatched(articolo, onSuccess);
if (isAutoOrderOnScan()) {
articolo.setQtaOrd(articolo.getQtaCnf());
mArticoliOrdineRepository.saveArticoloToOrdine(articolo, () -> this.refreshListArticoli(onSuccess), onFail);
} else {
this.sendOnItemDispatched(articolo, onSuccess);
}
} }
}, onFail); }, onFail);
@ -200,7 +191,9 @@ public class PVOrdineAcquistoEditViewModel {
} }
private List<ArticoloDTO> getNewArticoli() { private List<ArticoloDTO> getNewArticoli() {
return Stream.of(mArticoliGriglia).filter(x -> x.getQtaOrd() > 0f).toList(); return mArticoliGriglia.stream()
.filter(x -> x.getQtaOrd() > 0f)
.collect(Collectors.toList());
} }
public void orderNewProducts() { public void orderNewProducts() {

View File

@ -248,7 +248,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
} else if (!noLUPresent.get()) { } else if (!noLUPresent.get()) {
this.mShouldCloseActivity = true; this.mShouldCloseActivity = true;
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(barcodeScannerIstanceID);
this.mViewmodel.closeLU(true); this.mViewmodel.requestCloseLU(true);
} else { } else {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(barcodeScannerIstanceID);
super.onBackPressed(); super.onBackPressed();
@ -948,7 +948,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
@Override @Override
public void onBottomSheetLUClose() { public void onBottomSheetLUClose() {
this.mViewmodel.closeLU(true); this.mViewmodel.requestCloseLU(true);
} }
@Override @Override
@ -958,7 +958,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
@Override @Override
public void onMtbColrDelete(MtbColr mtbColr) { public void onMtbColrDelete(MtbColr mtbColr) {
this.mViewmodel.deleteRow(mtbColr); this.mViewmodel.requestDeleteRow(mtbColr);
} }

View File

@ -5,7 +5,9 @@ import dagger.Provides;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService; import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
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.ColliLavorazioneRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.DocumentiRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.DocumentiRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
@ -21,8 +23,26 @@ public class SpedizioneModule {
} }
@Provides @Provides
SpedizioneViewModel providesSpedizioneViewModel(ArticoloRESTConsumer articoloRESTConsumer, ColliDataRecoverService colliDataRecoverService, OrdiniRESTConsumer ordiniRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, PrinterRESTConsumer printerRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer, DocumentiRESTConsumer documentiRESTConsumer) { SpedizioneViewModel providesSpedizioneViewModel(ArticoloRESTConsumer articoloRESTConsumer,
return new SpedizioneViewModel(articoloRESTConsumer, barcodeRESTConsumer, colliDataRecoverService, ordiniRESTConsumer, colliMagazzinoRESTConsumer, printerRESTConsumer, posizioniRESTConsumer, documentiRESTConsumer); ColliDataRecoverService colliDataRecoverService,
OrdiniRESTConsumer ordiniRESTConsumer,
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
PrinterRESTConsumer printerRESTConsumer,
BarcodeRESTConsumer barcodeRESTConsumer,
PosizioniRESTConsumer posizioniRESTConsumer,
DocumentiRESTConsumer documentiRESTConsumer,
ColliSpedizioneRESTConsumer colliSpedizioneRESTConsumer,
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer) {
return new SpedizioneViewModel(articoloRESTConsumer,
barcodeRESTConsumer,
colliDataRecoverService,
ordiniRESTConsumer,
colliMagazzinoRESTConsumer,
printerRESTConsumer,
posizioniRESTConsumer,
documentiRESTConsumer,
colliSpedizioneRESTConsumer,
colliLavorazioneRESTConsumer);
} }
} }

View File

@ -6,6 +6,7 @@ import androidx.lifecycle.MutableLiveData;
import com.annimon.stream.Optional; import com.annimon.stream.Optional;
import com.annimon.stream.Stream; import com.annimon.stream.Stream;
import org.apache.commons.lang3.NotImplementedException;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -15,13 +16,14 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
import javax.inject.Inject; 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.CommonConst; import it.integry.integrywmsnative.core.CommonConst;
import it.integry.integrywmsnative.core.class_router.ClassRouter; import it.integry.integrywmsnative.core.class_router.ClassRouter;
import it.integry.integrywmsnative.core.class_router.interfaces.IOrdiniVendita; import it.integry.integrywmsnative.core.class_router.interfaces.OrdiniVenditaInterface;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService; import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
import it.integry.integrywmsnative.core.exception.EmptyLUException; import it.integry.integrywmsnative.core.exception.EmptyLUException;
import it.integry.integrywmsnative.core.exception.InvalidLUException; import it.integry.integrywmsnative.core.exception.InvalidLUException;
@ -51,16 +53,27 @@ import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
import it.integry.integrywmsnative.core.report.ReportType; import it.integry.integrywmsnative.core.report.ReportType;
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.ColliLavorazioneRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.DocumentiRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.DocumentiRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
import it.integry.integrywmsnative.core.rest.model.Ean128Model; import it.integry.integrywmsnative.core.rest.model.Ean128Model;
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel; import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
import it.integry.integrywmsnative.core.rest.model.LoadColliDTO; import it.integry.integrywmsnative.core.rest.model.LoadColliDTO;
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO; import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO; import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CanUDSBeDeletedRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestOrderDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager; import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityBarcode; import it.integry.integrywmsnative.core.utility.UtilityBarcode;
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal; import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
@ -88,12 +101,6 @@ public class SpedizioneViewModel {
private int mDefaultSegnoCol = -1; private int mDefaultSegnoCol = -1;
private String mDefaultCodMdep = null; private String mDefaultCodMdep = null;
private final List<FiltroOrdineDTO> mDefaultFiltroOrdine = new ArrayList<>(); private final List<FiltroOrdineDTO> mDefaultFiltroOrdine = new ArrayList<>();
private String mDefaultCodAnagOfUL = null;
private String mDefaultRagSocOfUL = null;
private String mDefaultRifOrdOfUL = null;
private Integer mDefaultNumOrdOfUL = null;
private Date mDefaultDataOrdOfUL = null;
private String mDefaultCodJFasOfUL = null;
private Integer mDefaultCausaleOfUL = null; private Integer mDefaultCausaleOfUL = null;
private boolean mEnableGiacenza; private boolean mEnableGiacenza;
@ -116,9 +123,13 @@ public class SpedizioneViewModel {
private final PrinterRESTConsumer mPrinterRESTConsumer; private final PrinterRESTConsumer mPrinterRESTConsumer;
private final PosizioniRESTConsumer mPosizioneRESTConsumer; private final PosizioniRESTConsumer mPosizioneRESTConsumer;
private final DocumentiRESTConsumer mDocumentiRESTConsumer; private final DocumentiRESTConsumer mDocumentiRESTConsumer;
private final ColliSpedizioneRESTConsumer mColliSpedizioneRESTConsumer;
private final ColliLavorazioneRESTConsumer mColliLavorazioneRESTConsumer;
private ColliScaricoRESTConsumerInterface mColliScaricoRESTConsumer;
@Inject @Inject
public SpedizioneViewModel(ArticoloRESTConsumer articoloRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, ColliDataRecoverService colliDataRecoverService, OrdiniRESTConsumer ordiniRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, PrinterRESTConsumer printerRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer, DocumentiRESTConsumer documentiRESTConsumer) { public SpedizioneViewModel(ArticoloRESTConsumer articoloRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, ColliDataRecoverService colliDataRecoverService, OrdiniRESTConsumer ordiniRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, PrinterRESTConsumer printerRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer, DocumentiRESTConsumer documentiRESTConsumer, ColliSpedizioneRESTConsumer colliSpedizioneRESTConsumer, ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer) {
this.mArticoloRESTConsumer = articoloRESTConsumer; this.mArticoloRESTConsumer = articoloRESTConsumer;
this.mBarcodeRESTConsumer = barcodeRESTConsumer; this.mBarcodeRESTConsumer = barcodeRESTConsumer;
this.mColliDataRecoverService = colliDataRecoverService; this.mColliDataRecoverService = colliDataRecoverService;
@ -127,6 +138,8 @@ public class SpedizioneViewModel {
this.mPrinterRESTConsumer = printerRESTConsumer; this.mPrinterRESTConsumer = printerRESTConsumer;
this.mPosizioneRESTConsumer = posizioniRESTConsumer; this.mPosizioneRESTConsumer = posizioniRESTConsumer;
this.mDocumentiRESTConsumer = documentiRESTConsumer; this.mDocumentiRESTConsumer = documentiRESTConsumer;
this.mColliSpedizioneRESTConsumer = colliSpedizioneRESTConsumer;
this.mColliLavorazioneRESTConsumer = colliLavorazioneRESTConsumer;
} }
@ -143,6 +156,7 @@ public class SpedizioneViewModel {
this.mDefaultCausaleOfUL = defaultCausaleUL; this.mDefaultCausaleOfUL = defaultCausaleUL;
this.mEnableQuantityReset = enableQuantityReset; this.mEnableQuantityReset = enableQuantityReset;
this.mUseQtaOrd = useQtaOrd; this.mUseQtaOrd = useQtaOrd;
if (testateOrdini != null) { if (testateOrdini != null) {
this.mIsOrdTrasf = Stream.of(testateOrdini).map(OrdineUscitaInevasoDTO::isOrdTrasf).withoutNulls().distinctBy(x -> x).findFirst().get(); this.mIsOrdTrasf = Stream.of(testateOrdini).map(OrdineUscitaInevasoDTO::isOrdTrasf).withoutNulls().distinctBy(x -> x).findFirst().get();
} }
@ -203,59 +217,31 @@ public class SpedizioneViewModel {
} }
} }
//Definizione del filtro ordine da applicare a tutti i colli generati //Definizione del filtro ordine da applicare a tutti i colli generati
Stream.of(mTestateOrdini).forEach(x -> { mTestateOrdini
FiltroOrdineDTO filtro = new FiltroOrdineDTO().setDataOrd(x.getDataOrdD()).setNumOrd(x.getNumOrd()).setGestioneOrd(x.getGestione()).setDataCons(x.getDataConsD()); .forEach(x -> {
var filtro = new FiltroOrdineDTO()
.setDataOrd(x.getDataOrdD())
.setNumOrd(x.getNumOrd())
.setGestioneOrd(x.getGestione())
.setDataCons(x.getDataConsD());
if (!mDefaultFiltroOrdine.contains(filtro)) mDefaultFiltroOrdine.add(filtro); if (!mDefaultFiltroOrdine.contains(filtro))
}); mDefaultFiltroOrdine.add(filtro);
});
//Definizione del codAnag if (mDefaultGestioneOfUL == GestioneEnum.VENDITA) {
List<String> foundCodAnag = Stream.of(mTestateOrdini).map(OrdineUscitaInevasoDTO::getCodAnagOrd).distinctBy(x -> x).toList(); mColliScaricoRESTConsumer = mColliSpedizioneRESTConsumer;
if (foundCodAnag != null && foundCodAnag.size() == 1) { } else if (mDefaultGestioneOfUL == GestioneEnum.LAVORAZIONE && mDefaultSegnoCol == -1) {
mDefaultCodAnagOfUL = foundCodAnag.get(0); mColliScaricoRESTConsumer = mColliLavorazioneRESTConsumer;
}
} else if (mDefaultGestioneOfUL == GestioneEnum.LAVORAZIONE && mDefaultSegnoCol == +1) {
//Definizione del codAnag mColliScaricoRESTConsumer = mColliLavorazioneRESTConsumer;
List<String> foundRagSoc = Stream.of(mTestateOrdini).map(OrdineUscitaInevasoDTO::getRagSocOrd).distinctBy(x -> x).toList(); } else {
this.sendError(new NotImplementedException(String.format("Gestione %s e segno %d non gestito", mDefaultGestioneOfUL.getText(), mDefaultSegnoCol)));
if (foundRagSoc != null && foundRagSoc.size() == 1) {
mDefaultRagSocOfUL = foundRagSoc.get(0);
}
//Definizione del rifOrd
List<String> foundRifOrd = Stream.of(mTestateOrdini).map(OrdineUscitaInevasoDTO::getRifOrd).distinctBy(x -> x).toList();
if (foundRifOrd != null && foundRifOrd.size() == 1) {
mDefaultRifOrdOfUL = foundRifOrd.get(0);
}
//Definizione del numOrd
List<Integer> foundNumOrd = Stream.of(mTestateOrdini).map(OrdineUscitaInevasoDTO::getNumOrd).withoutNulls().distinctBy(x -> x).toList();
if (foundNumOrd != null && foundNumOrd.size() == 1) {
mDefaultNumOrdOfUL = foundNumOrd.get(0);
}
//Definizione del dataOrd
List<Date> foundDataOrd = Stream.of(mTestateOrdini).map(OrdineUscitaInevasoDTO::getDataOrdD).withoutNulls().distinctBy(x -> x).toList();
if (foundDataOrd != null && foundDataOrd.size() == 1) {
mDefaultDataOrdOfUL = foundDataOrd.get(0);
}
//Definizione del codJfas
List<String> foundCodJfas = Stream.of(mTestateOrdini).map(OrdineUscitaInevasoDTO::getCodJfas).distinctBy(x -> x).toList();
if (foundCodJfas != null && foundCodJfas.size() == 1) {
mDefaultCodJFasOfUL = foundCodJfas.get(0);
} }
} }
@ -282,7 +268,6 @@ public class SpedizioneViewModel {
if (this.mListener != null) mListener.onCreateDocsRequest(); if (this.mListener != null) mListener.onCreateDocsRequest();
} }
private void sendOnOrderClosed() { private void sendOnOrderClosed() {
if (this.mListener != null) mListener.onOrderClosed(); if (this.mListener != null) mListener.onOrderClosed();
} }
@ -1126,98 +1111,128 @@ public class SpedizioneViewModel {
} }
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) { public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
MtbColt mtbColt = new MtbColt(); final List<CreateUDSRequestOrderDTO> orders = this.mTestateOrdini.stream()
mtbColt.initDefaultFields(mDefaultGestioneOfUL).setSegno(mDefaultSegnoCol).setRifOrd(mDefaultRifOrdOfUL).setNumOrd(mDefaultNumOrdOfUL).setDataOrdD(mDefaultDataOrdOfUL).setCodAnag(mDefaultCodAnagOfUL).setCodMdep(mDefaultCodMdep).setRagSocCliente(mDefaultRagSocOfUL).setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE); .map(x -> new CreateUDSRequestOrderDTO()
.setDataCons(UtilityDate.toLocalDate(x.getDataConsD()))
.setDataOrd(UtilityDate.toLocalDate(x.getDataOrdD()))
.setGestione(x.getGestione())
.setNumOrd(x.getNumOrd()))
.collect(Collectors.toList());
if (mDefaultGestioneOfUL == GestioneEnum.LAVORAZIONE && mDefaultSegnoCol == -1) final CreateUDSRequestDTO createUDSRequestDTO = new CreateUDSRequestDTO()
mtbColt.setPosizione(mDefaultCodJFasOfUL); .setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep())
if (customNumCollo != null) mtbColt.setNumCollo(customNumCollo); .setSegno(mDefaultSegnoCol)
if (!UtilityString.isNullOrEmpty(customSerCollo)) mtbColt.setSerCollo(customSerCollo); .setNumCollo(customNumCollo)
.setSerCollo(customSerCollo)
.setOrders(orders);
mtbColt.generaFiltroOrdineFromDTO(mDefaultFiltroOrdine); this.mColliScaricoRESTConsumer.createUDS(createUDSRequestDTO, createdUDS -> {
this.mCurrentMtbColt = createdUDS;
mColliMagazzinoRESTConsumer.saveCollo(mtbColt, value -> { mMtbColtSessionID = this.mColliDataRecoverService.startNewSession(createdUDS, mTestateOrdini);
mtbColt.setNumCollo(value.getNumCollo()).setDataCollo(value.getDataColloS()).setMtbColr(new ObservableArrayList<>());
this.mCurrentMtbColt = mtbColt;
mMtbColtSessionID = this.mColliDataRecoverService.startNewSession(mtbColt, mTestateOrdini);
this.mIsNewLU = true; this.mIsNewLU = true;
if (onComplete != null) onComplete.run(); if (onComplete != null) onComplete.run();
this.sendLUOpened(mtbColt); this.sendLUOpened(createdUDS);
}, this::sendError); }, this::sendError);
} }
public void saveNewRow(PickingObjectDTO pickingObjectDTO, MtbColt refMtbColt, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, Date dataScad, boolean shouldCloseLU) { public void saveNewRow(PickingObjectDTO pickingObjectDTO, MtbColt refMtbColt, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, Date dataScad, boolean shouldCloseLU) {
this.sendOnLoadingStarted(); this.sendOnLoadingStarted();
final MtbColr mtbColr = new MtbColr().setCausale(mDefaultCausaleOfUL).setCodMart(pickingObjectDTO.getMtbAart().getCodMart()).setPartitaMag(partitaMag).setDataScadPartita(dataScad).setQtaCol(qtaTot).setQtaCnf(qtaCnf).setNumCnf(numCnf).setDescrizione(pickingObjectDTO.getMtbAart().getDescrizioneEstesa()).setDatetimeRow(UtilityDate.getDateInstance());
// final MtbColr mtbColr = new MtbColr()
// .setCausale(mDefaultCausaleOfUL)
// .setCodMart(pickingObjectDTO.getMtbAart().getCodMart())
// .setPartitaMag(partitaMag)
// .setDataScadPartita(dataScad)
// .setQtaCol(qtaTot)
// .setQtaCnf(qtaCnf)
// .setNumCnf(numCnf)
// .setDescrizione(pickingObjectDTO.getMtbAart().getDescrizioneEstesa())
// .setDatetimeRow(UtilityDate.getDateInstance());
//TODO: Al posto di prelevare la prima riga bisognerebbe controllare se c'è ne una che corrisponde con la partita richiesta //TODO: Al posto di prelevare la prima riga bisognerebbe controllare se c'è ne una che corrisponde con la partita richiesta
final MtbColr mtbColrToDispatch = pickingObjectDTO.getTempPickData() != null && pickingObjectDTO.getTempPickData().getSourceMtbColt() != null && pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr() != null && pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().size() > 0 ? pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().get(0) : null; final MtbColr mtbColrToDispatch = pickingObjectDTO.getTempPickData() != null &&
pickingObjectDTO.getTempPickData().getSourceMtbColt() != null &&
if (mtbColrToDispatch != null) { pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr() != null &&
if (UtilityString.isNullOrEmpty(mCurrentMtbColt.getCodTcol())) pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().size() > 0 ?
mCurrentMtbColt.setCodTcol(UtilityString.empty2null(pickingObjectDTO.getTempPickData().getSourceMtbColt().getCodTcol())); pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().get(0) : null;
mtbColr.setCodJcom(UtilityString.empty2null(mtbColrToDispatch.getCodJcom())).setSerColloRif(UtilityString.empty2null(mtbColrToDispatch.getSerCollo())).setNumColloRif(mtbColrToDispatch.getNumCollo()).setGestioneRif(UtilityString.empty2null(mtbColrToDispatch.getGestione())).setDataColloRif(UtilityString.empty2null(mtbColrToDispatch.getDataColloS()));
if (mtbColrToDispatch.getPesoNettoKg() != null) { // if (mtbColrToDispatch != null) {
//Proporzione // if (UtilityString.isNullOrEmpty(mCurrentMtbColt.getCodTcol()))
BigDecimal pesoNettoKg = UtilityBigDecimal.divide(UtilityBigDecimal.multiply(qtaTot, mtbColrToDispatch.getPesoNettoKg()), mtbColrToDispatch.getQtaCol()); // mCurrentMtbColt.setCodTcol(UtilityString.empty2null(pickingObjectDTO.getTempPickData().getSourceMtbColt().getCodTcol()));
mtbColr.setPesoNettoKg(pesoNettoKg); //
} // mtbColr.setCodJcom(UtilityString.empty2null(mtbColrToDispatch.getCodJcom()))
// .setSerColloRif(UtilityString.empty2null(mtbColrToDispatch.getSerCollo()))
if (mtbColrToDispatch.getPesoLordoKg() != null) { // .setNumColloRif(mtbColrToDispatch.getNumCollo())
//Proporzione // .setGestioneRif(UtilityString.empty2null(mtbColrToDispatch.getGestione()))
BigDecimal pesoLordoKg = UtilityBigDecimal.divide(UtilityBigDecimal.multiply(qtaTot, mtbColrToDispatch.getPesoLordoKg()), mtbColrToDispatch.getQtaCol()); // .setDataColloRif(UtilityString.empty2null(mtbColrToDispatch.getDataColloS()));
mtbColr.setPesoLordoKg(pesoLordoKg); //
} //
// if (mtbColrToDispatch.getPesoNettoKg() != null) {
// //Proporzione
// BigDecimal pesoNettoKg = UtilityBigDecimal.divide(UtilityBigDecimal.multiply(qtaTot, mtbColrToDispatch.getPesoNettoKg()), mtbColrToDispatch.getQtaCol());
// mtbColr.setPesoNettoKg(pesoNettoKg);
// }
//
// if (mtbColrToDispatch.getPesoLordoKg() != null) {
// //Proporzione
// BigDecimal pesoLordoKg = UtilityBigDecimal.divide(UtilityBigDecimal.multiply(qtaTot, mtbColrToDispatch.getPesoLordoKg()), mtbColrToDispatch.getQtaCol());
// mtbColr.setPesoLordoKg(pesoLordoKg);
// }
// }
//
// mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
//
// MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
// cloneMtbColt.setOperation(CommonModelConsts.OPERATION.UPDATE);
//
// cloneMtbColt.setMtbColr(new ObservableArrayList<>());
// cloneMtbColt.getMtbColr().add((MtbColr) mtbColr.clone());
} else if (mEnableGiacenza && pickingObjectDTO.getMtbColts() != null && pickingObjectDTO.getMtbColts().size() > 0) { boolean shouldPrint = !shouldCloseLU || mCurrentMtbColt.getMtbColr().size() != 0;
// Vecchia logica di aggancio UL (se non ho sparato una etichetta UL comunque ti aggangio la prima UL suggerita)
// mtbColr
// .setCodJcom(UtilityString.empty2null(item.getCodJcom()))
// .setSerColloRif(UtilityString.empty2null(item.getSerCollo()))
// .setNumColloRif(item.getNumCollo())
// .setGestioneRif(UtilityString.empty2null(item.getGestione()))
// .setDataColloRif(UtilityString.empty2null(item.getDataColloS()));
}
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.UPDATE);
cloneMtbColt.setMtbColr(new ObservableArrayList<>());
cloneMtbColt.getMtbColr().add((MtbColr) mtbColr.clone());
boolean shouldPrint = true;
//Se è l'unico articolo del collo (controllo se è uguale a 0 perché ancora non è stato aggiunto nella lista delle righe) //Se è l'unico articolo del collo (controllo se è uguale a 0 perché ancora non è stato aggiunto nella lista delle righe)
if (shouldCloseLU && mCurrentMtbColt.getMtbColr().size() == 0) {
shouldPrint = false;
}
if (UtilityBigDecimal.equalsTo(numCnf, BigDecimal.ZERO) && UtilityBigDecimal.equalsTo(qtaTot, BigDecimal.ZERO)) { if (UtilityBigDecimal.equalsTo(numCnf, BigDecimal.ZERO) && UtilityBigDecimal.equalsTo(qtaTot, BigDecimal.ZERO)) {
resetMatchedRows(); resetMatchedRows();
this.sendOnLoadingEnded(); this.sendOnLoadingEnded();
if (shouldCloseLU) closeLU(shouldPrint); if (shouldCloseLU) requestCloseLU(shouldPrint);
return; return;
} }
boolean finalShouldPrint = shouldPrint;
mColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, value -> {
mtbColr.setDataCollo(value.getDataColloS()).setNumCollo(value.getNumCollo()).setGestione(value.getGestione()).setSerCollo(value.getSerCollo()).setRiga(value.getMtbColr().get(value.getMtbColr().size() - 1).getRiga()).setUntMis(pickingObjectDTO.getMtbAart().getUntMis()).setMtbAart(pickingObjectDTO.getMtbAart());
var insertUDSRowRequestDto = new InsertUDSRowRequestDTO()
.setSourceMtbColr(mtbColrToDispatch)
.setCodMart(pickingObjectDTO.getMtbAart().getCodMart())
.setQtaTot(qtaTot)
.setQtaCnf(qtaCnf)
.setNumCnf(numCnf)
.setPartitaMag(partitaMag)
.setTargetMtbColt(mCurrentMtbColt);
if(dataScad != null)
insertUDSRowRequestDto
.setDataScad(UtilityDate.toLocalDate(dataScad));
this.mColliScaricoRESTConsumer.insertUDSRow(insertUDSRowRequestDto, createdMtbColr -> {
pickingObjectDTO.getWithdrawMtbColrs().add(createdMtbColr);
this.mCurrentMtbColt.getMtbColr().add(createdMtbColr);
createdMtbColr
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
.setMtbAart(pickingObjectDTO.getMtbAart());
if (mEnableGiacenza) { if (mEnableGiacenza) {
MtbColr refMtbColr = new MtbColr().setCodMart(mtbColr.getCodMart()).setPartitaMag(mtbColr.getPartitaMag()).setCodTagl(mtbColr.getCodTagl()).setCodCol(mtbColr.getCodCol()); MtbColr refMtbColr = new MtbColr()
.setCodMart(createdMtbColr.getCodMart())
.setPartitaMag(createdMtbColr.getPartitaMag())
.setCodTagl(createdMtbColr.getCodTagl())
.setCodCol(createdMtbColr.getCodCol());
if (refMtbColt != null) { if (refMtbColt != null) {
@ -1227,23 +1242,76 @@ public class SpedizioneViewModel {
refMtbColr.setId(originalRefMtbColr.getId()); refMtbColr.setId(originalRefMtbColr.getId());
} }
refMtbColr.setNumCollo(refMtbColt.getNumCollo()).setDataCollo(refMtbColt.getDataColloS()).setSerCollo(refMtbColt.getSerCollo()).setGestione(refMtbColt.getGestione()); refMtbColr.setNumCollo(refMtbColt.getNumCollo())
.setDataCollo(refMtbColt.getDataColloS())
.setSerCollo(refMtbColt.getSerCollo())
.setGestione(refMtbColt.getGestione());
} }
mtbColr.setRefMtbColr(refMtbColr); createdMtbColr.setRefMtbColr(refMtbColr);
} }
pickingObjectDTO.getWithdrawMtbColrs().add(mtbColr);
mCurrentMtbColt.getMtbColr().add(mtbColr);
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei //Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
resetMatchedRows(); resetMatchedRows();
this.sendOnRowSaved(); this.sendOnRowSaved();
this.sendOnLoadingEnded(); this.sendOnLoadingEnded();
if (shouldCloseLU) closeLU(finalShouldPrint); if (shouldCloseLU) requestCloseLU(shouldPrint);
}, this::sendError); }, this::sendError);
// boolean finalShouldPrint = shouldPrint;
// mColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, value -> {
//
// mtbColr
// .setDataCollo(value.getDataColloS())
// .setNumCollo(value.getNumCollo())
// .setGestione(value.getGestione())
// .setSerCollo(value.getSerCollo())
// .setRiga(value.getMtbColr().get(value.getMtbColr().size() - 1).getRiga())
// .setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
// .setMtbAart(pickingObjectDTO.getMtbAart());
//
//
// if (mEnableGiacenza) {
// MtbColr refMtbColr = new MtbColr()
// .setCodMart(mtbColr.getCodMart())
// .setPartitaMag(mtbColr.getPartitaMag())
// .setCodTagl(mtbColr.getCodTagl())
// .setCodCol(mtbColr.getCodCol());
//
// if (refMtbColt != null) {
//
// MtbColr originalRefMtbColr = refMtbColt.getMtbColr() != null && refMtbColt.getMtbColr().size() > 0 ? refMtbColt.getMtbColr().get(0) : null;
//
// if (originalRefMtbColr != null) {
// refMtbColr.setId(originalRefMtbColr.getId());
// }
//
// refMtbColr.setNumCollo(refMtbColt.getNumCollo())
// .setDataCollo(refMtbColt.getDataColloS())
// .setSerCollo(refMtbColt.getSerCollo())
// .setGestione(refMtbColt.getGestione());
// }
// mtbColr.setRefMtbColr(refMtbColr);
// }
//
// pickingObjectDTO.getWithdrawMtbColrs().add(mtbColr);
// mCurrentMtbColt.getMtbColr().add(mtbColr);
//
// //Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
// resetMatchedRows();
//
// this.sendOnRowSaved();
// this.sendOnLoadingEnded();
//
// if (shouldCloseLU) requestCloseLU(finalShouldPrint);
// }, this::sendError);
} }
private void saveEditedRow(MtbColr mtbColrToUpdate, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, Date dataScad, boolean shouldCloseLU) { private void saveEditedRow(MtbColr mtbColrToUpdate, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, Date dataScad, boolean shouldCloseLU) {
@ -1281,159 +1349,254 @@ public class SpedizioneViewModel {
} }
public void deleteRow(MtbColr mtbColrToDelete) { public void requestDeleteRow(MtbColr mtbColrToDelete) {
this.sendMtbColrDeleteRequest(canDelete -> { this.sendMtbColrDeleteRequest(canDelete -> {
if(!canDelete)
return;
if (canDelete) { this.sendOnLoadingStarted();
this.sendOnLoadingStarted();
MtbColt mtbColt = new MtbColt().setNumCollo(mtbColrToDelete.getNumCollo()).setDataCollo(mtbColrToDelete.getDataColloS()).setSerCollo(mtbColrToDelete.getSerCollo()).setGestione(mtbColrToDelete.getGestione()).setMtbColr(new ObservableArrayList<>()); var deleteUDSRowRequestoDTO = new DeleteUDSRowRequestDTO()
mtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP); .setMtbColrToDelete(mtbColrToDelete);
MtbColr mtbColr = (MtbColr) mtbColrToDelete.clone(); this.mColliScaricoRESTConsumer.deleteUDSRow(deleteUDSRowRequestoDTO, () -> {
Optional<PickingObjectDTO> pickingObjectDTO = Stream.of(this.mPickingList.getValue())
.filter(x -> Stream.of(x.getWithdrawMtbColrs()).anyMatch(y -> y == mtbColrToDelete))
.findSingle();
if (mCurrentMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) { if (pickingObjectDTO.isPresent()) {
mtbColr.setOperation(CommonModelConsts.OPERATION.DELETE); pickingObjectDTO.get().getWithdrawMtbColrs().remove(mtbColrToDelete);
} else {
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT);
mtbColr.setQtaCol(mtbColr.getQtaCol().multiply(new BigDecimal(-1))).setNumCnf(mtbColr.getNumCnf().multiply(new BigDecimal(-1))).setRiga(null).setPesoLordoKg(null).setPesoNettoKg(null);
} }
mtbColt.getMtbColr().add(mtbColr); this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
this.mColliMagazzinoRESTConsumer.saveCollo(mtbColt, (value) -> { this.resetMatchedRows();
this.sendOnRowSaved();
Optional<PickingObjectDTO> pickingObjectDTO = Stream.of(this.mPickingList.getValue()).filter(x -> Stream.of(x.getWithdrawMtbColrs()).anyMatch(y -> y == mtbColrToDelete)).findSingle(); this.sendOnLoadingEnded();
}, this::sendError);
if (pickingObjectDTO.isPresent()) {
pickingObjectDTO.get().getWithdrawMtbColrs().remove(mtbColrToDelete);
}
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
this.resetMatchedRows();
this.sendOnRowSaved();
this.sendOnLoadingEnded();
}, this::sendError);
}
}); });
} }
public void closeLU(boolean shouldPrint) { public void requestCloseLU(boolean shouldPrint) {
if (mCurrentMtbColt == null) return; if (mCurrentMtbColt == null) return;
this.sendOnLoadingStarted(); this.sendOnLoadingStarted();
mColliMagazzinoRESTConsumer.canLUBeDeleted(mCurrentMtbColt, canBeDeleted -> { this.checkIfShouldBeDeleted(() -> {
deleteLU(() -> {
this.mCurrentMtbColt = null;
if (canBeDeleted) { if (mMtbColtSessionID != null)
deleteLU(() -> { this.mColliDataRecoverService.closeSession(mMtbColtSessionID);
this.mIsNewLU = false;
this.sendLUClosed();
this.sendOnLoadingEnded();
});
} else {
if (mDefaultSegnoCol == -1) {
Runnable saveAction = () -> {
if (SettingsManager.iDB().isFlagAskInfoAggiuntiveSpedizione()) {
this.mListener.onInfoAggiuntiveRequired(mCurrentMtbColt, (note, mtbTcol) -> {
mCurrentMtbColt.setAnnotazioni(note);
if (mtbTcol != null) {
mCurrentMtbColt.setMtbTCol(mtbTcol);
mCurrentMtbColt.setCodTcol(mtbTcol.getCodTcol());
} else {
mCurrentMtbColt.setMtbTCol(null);
mCurrentMtbColt.setCodTcol(null);
}
mColliMagazzinoRESTConsumer.updateDataFine(mCurrentMtbColt, () -> distribuisciLU((generatedMtbColts) -> {
if (shouldPrint)
printCollo(generatedMtbColts, () -> this.postCloseOperations(generatedMtbColts));
else {
postCloseOperations(generatedMtbColts);
}
}), this::sendError);
});
} else {
mColliMagazzinoRESTConsumer.updateDataFine(mCurrentMtbColt, () -> distribuisciLU((generatedMtbColts) -> { this.mIsNewLU = false;
if (shouldPrint) this.sendLUClosed();
printCollo(generatedMtbColts, () -> this.postCloseOperations(generatedMtbColts)); this.sendOnLoadingEnded();
else { });
postCloseOperations(generatedMtbColts);
}
}), this::sendError);
}
};
if (mShouldAskPesoLU) { }, () -> {
this.sendLUPesoRequired(mCurrentMtbColt.getCodTcol(), mCurrentMtbColt.getPesoNettoKg(), mCurrentMtbColt.getPesoKg(), (newCodTcol, newNetWeight, newGrossWeight) -> { this.askPeso(() -> {
mCurrentMtbColt.setCodTcol(newCodTcol); this.askInfoAggiuntive(() -> {
mCurrentMtbColt.setPesoNettoKg(newNetWeight);
mCurrentMtbColt.setPesoKg(newGrossWeight);
saveAction.run(); this.closeLU(generatedMtbColts -> {
});
} else {
saveAction.run();
}
} else {
distribuisciLU(mtbColts -> { this.mColliMagazzinoRESTConsumer.fillMtbAartsOfMtbColts(generatedMtbColts, filledMtbColts -> {
if (this.mIsNewLU) {
this.sendLUPositionChangeRequest((shouldChangePosition, mtbDepoPosizione) -> {
if (shouldChangePosition) { this.askPositionChange(
filledMtbColts,
positionedMtbColts -> {
if (mtbDepoPosizione != null) { this.askPrint(shouldPrint, positionedMtbColts, () -> {
if (mtbDepoPosizione.isFlagMonoCollo()) { positionedMtbColts.stream()
this.mPosizioneRESTConsumer.getBancaliInPosizione(mtbDepoPosizione, destMtbColtList -> { .filter(x -> !this.mColliRegistrati.contains(x))
if (destMtbColtList == null || destMtbColtList.size() != 1) { .forEach(x -> this.mColliRegistrati.add(x));
//Nessuna UL trovata oppure più UL nella stessa posizione
this.sendError(new NoLUFoundException());
} else {
if (destMtbColtList.get(0).getSegno() != mDefaultSegnoCol) {
this.sendError(new InvalidLUException());
} else {
moveLUtoLU(mtbColts, destMtbColtList.get(0), savedMtbColt -> {
ArrayList<MtbColt> savedMtbColtList = new ArrayList<>();
savedMtbColtList.add(savedMtbColt);
postCloseOperations(savedMtbColtList);
});
}
} postCloseOperations(positionedMtbColts);
}, this::sendError);
} else { this.mIsNewLU = false;
//La posizione non è Mono-UL
this.sendError(new CurrentMonoLUPositionIsNotCorrectException()); this.resetMatchedRows();
} this.sendLUClosed();
} else { this.sendOnLoadingEnded();
//Nessuna posizione trovata con questo barcode });
this.sendError(new ScannedPositionNotExistException());
} });
} else {
postCloseOperations(mtbColts); }, this::sendError);
}
});
} else {
postCloseOperations(mtbColts);
}
}); });
}
} });
}, this::sendError); });
});
} }
private void distribuisciLU(RunnableArgs<List<MtbColt>> onComplete) {
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
IOrdiniVendita ordiniVendita = ClassRouter.getInstance(ClassRouter.PATH.ORDINI_VENDITA); private void closeLU(RunnableArgs<List<MtbColt>> onComplete) {
ordiniVendita.distribuisciCollo(cloneMtbColt, mTestateOrdini, mtbColts -> { var closeUDSRequestDto = new CloseUDSRequestDTO()
mColliMagazzinoRESTConsumer.fillMtbAartsOfMtbColts(mtbColts, onComplete, this::sendError); .setMtbColt(this.mCurrentMtbColt)
// mColliMagazzinoRESTConsumer.getMultipleByTestate(mtbColts, false, onComplete, this::sendError); //.setPrintSSCC(shouldPrint)
.setOrderCodMdep(mTestateOrdini.get(0).getCodMdep())
.setEnableTransferLogic(isTrasfOrderLogicEnabled());
this.mColliSpedizioneRESTConsumer.closeUDS(closeUDSRequestDto, closeResponse -> {
onComplete.run(closeResponse.getGeneratedMtbColts());
}, this::sendError); }, this::sendError);
}
private void checkIfShouldBeDeleted(Runnable onDeleted, Runnable onContinue) {
var requestDto =
new CanUDSBeDeletedRequestDTO()
.setMtbColt(this.mCurrentMtbColt);
this.mColliSpedizioneRESTConsumer.canUDSBeDeleted(requestDto,
canBeDeleted -> {
if (canBeDeleted == null || !canBeDeleted)
onContinue.run();
else onDeleted.run();
}, this::sendError);
}
private void deleteLU(Runnable onComplete) {
this.mColliSpedizioneRESTConsumer.deleteUDS(
new DeleteUDSRequestDTO()
.setMtbColt(this.mCurrentMtbColt),
onComplete, this::sendError);
}
private boolean isTrasfOrderLogicEnabled() {
OrdiniVenditaInterface ordiniVendita = ClassRouter.getInstance(ClassRouter.PATH.ORDINI_VENDITA);
return ordiniVendita != null && ordiniVendita.isTrasfOrder(mTestateOrdini);
}
private void askPeso(Runnable onComplete) {
if (mDefaultSegnoCol != -1 || !mShouldAskPesoLU) {
onComplete.run();
return;
}
this.sendLUPesoRequired(mCurrentMtbColt.getCodTcol(), mCurrentMtbColt.getPesoNettoKg(), mCurrentMtbColt.getPesoKg(), (newCodTcol, newNetWeight, newGrossWeight) -> {
mCurrentMtbColt.setCodTcol(newCodTcol);
mCurrentMtbColt.setPesoNettoKg(newNetWeight);
mCurrentMtbColt.setPesoKg(newGrossWeight);
onComplete.run();
});
}
private void askInfoAggiuntive(Runnable onComplete) {
if (mDefaultSegnoCol != -1 || !SettingsManager.iDB().isFlagAskInfoAggiuntiveSpedizione()) {
onComplete.run();
return;
}
this.mListener.onInfoAggiuntiveRequired(mCurrentMtbColt, (note, mtbTcol) -> {
mCurrentMtbColt.setAnnotazioni(note);
if (mtbTcol != null) {
mCurrentMtbColt.setMtbTCol(mtbTcol);
mCurrentMtbColt.setCodTcol(mtbTcol.getCodTcol());
} else {
mCurrentMtbColt.setMtbTCol(null);
mCurrentMtbColt.setCodTcol(null);
}
onComplete.run();
});
}
private void askPositionChange(List<MtbColt> mtbColtsToMove, RunnableArgs<List<MtbColt>> onComplete) {
if (mDefaultGestioneOfUL != GestioneEnum.LAVORAZIONE || mDefaultSegnoCol != 1 || !this.mIsNewLU) {
onComplete.run(mtbColtsToMove);
return;
}
this.sendLUPositionChangeRequest((shouldChangePosition, mtbDepoPosizione) -> {
if (!shouldChangePosition) {
onComplete.run(mtbColtsToMove);
return;
}
if (mtbDepoPosizione == null) {
//Nessuna posizione trovata con questo barcode
this.sendError(new ScannedPositionNotExistException());
return;
}
if (!mtbDepoPosizione.isFlagMonoCollo()) {
//La posizione non è Mono-UL
this.sendError(new CurrentMonoLUPositionIsNotCorrectException());
return;
}
this.mPosizioneRESTConsumer.getBancaliInPosizione(mtbDepoPosizione, destMtbColtList -> {
if (destMtbColtList == null || destMtbColtList.size() != 1) {
//Nessuna UL trovata oppure più UL nella stessa posizione
this.sendError(new NoLUFoundException());
return;
}
if (destMtbColtList.get(0).getSegno() != mDefaultSegnoCol) {
this.sendError(new InvalidLUException());
return;
}
moveLUtoLU(mtbColtsToMove, destMtbColtList.get(0), savedMtbColt -> {
ArrayList<MtbColt> savedMtbColtList = new ArrayList<>();
savedMtbColtList.add(savedMtbColt);
onComplete.run(savedMtbColtList);
});
}, this::sendError);
});
}
private void askPrint(boolean canPrint, List<MtbColt> mtbColtsToPrint, Runnable onComplete) {
if (mDefaultGestioneOfUL != GestioneEnum.VENDITA ||
mDefaultSegnoCol != -1 ||
mtbColtsToPrint == null ||
mtbColtsToPrint.isEmpty() ||
!canPrint) {
onComplete.run();
return;
}
this.sendLUPrintRequest(shouldPrint -> {
if (!shouldPrint) {
onComplete.run();
return;
}
var printUDSRequestDto = new PrintUDSRequestDTO()
.setMtbColts(mtbColtsToPrint);
this.mColliSpedizioneRESTConsumer.printUDS(printUDSRequestDto, onComplete,
ex -> this.sendLUPrintError(ex, onComplete));
});
} }
@ -1462,33 +1625,6 @@ public class SpedizioneViewModel {
}, this::sendError); }, this::sendError);
} }
private void printCollo(List<MtbColt> mtbColtsToPrint, Runnable onComplete) {
this.sendLUPrintRequest(shouldPrint -> {
if (!shouldPrint) {
onComplete.run();
} else {
cyclicPrint(mtbColtsToPrint.iterator(), onComplete, ex -> this.sendLUPrintError(ex, onComplete));
}
});
}
private void cyclicPrint(@NotNull Iterator<MtbColt> sourceMtbColts, Runnable onComplete, RunnableArgs<Exception> onAbort) {
if (sourceMtbColts.hasNext()) {
singlePrint(sourceMtbColts.next(), () -> {
cyclicPrint(sourceMtbColts, onComplete, onAbort);
}, onAbort);
} else {
onComplete.run();
}
}
private void singlePrint(MtbColt mtbColtToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
this.mPrinterRESTConsumer.printCollo(mtbColtToPrint, onComplete, onFailed);
}
public void recoverLU(MtbColt mtbColt) { public void recoverLU(MtbColt mtbColt) {
this.sendOnLoadingStarted(); this.sendOnLoadingStarted();
@ -1505,18 +1641,14 @@ public class SpedizioneViewModel {
} }
private void postCloseOperations(List<MtbColt> mtbColtList) { private void postCloseOperations(List<MtbColt> mtbColtList) {
Stream.of(mtbColtList).filter(x -> !this.mColliRegistrati.contains(x)).forEach(x -> this.mColliRegistrati.add(x));
if (mTestateOrdini != null) { if (mTestateOrdini != null) {
for (MtbColt mtbColt : mtbColtList) { for (MtbColt mtbColt : mtbColtList) {
Stream.of(mTestateOrdini).filter(x -> x.getNumOrd().equals(mtbColt.getNumOrd()) && x.getDataOrdD().equals(mtbColt.getDataOrdD()) && x.getGestioneEnum() == mtbColt.getGestioneEnum()).forEach(x -> x.setExistColloBoolean(true)); mTestateOrdini.stream()
.filter(x -> x.getNumOrd().equals(mtbColt.getNumOrd()) && x.getDataOrdD().equals(mtbColt.getDataOrdD()) && x.getGestioneEnum() == mtbColt.getGestioneEnum())
.forEach(x -> x.setExistColloBoolean(true));
} }
} }
if (mMtbColtSessionID != null)
this.mColliDataRecoverService.closeSession(mMtbColtSessionID);
this.mCurrentMtbColt = null;
if (mEnableQuantityReset) { if (mEnableQuantityReset) {
for (PickingObjectDTO pickingObjectDTO : mPickingList.getValue()) { for (PickingObjectDTO pickingObjectDTO : mPickingList.getValue()) {
@ -1547,21 +1679,6 @@ public class SpedizioneViewModel {
pickingObjectDTO.setWithdrawMtbColrs(new ArrayList<>()); pickingObjectDTO.setWithdrawMtbColrs(new ArrayList<>());
} }
} }
this.mIsNewLU = false;
this.resetMatchedRows();
this.sendLUClosed();
this.sendOnLoadingEnded();
}
private void deleteLU(Runnable onComplete) {
mColliMagazzinoRESTConsumer.deleteCollo(mCurrentMtbColt, () -> {
this.mColliDataRecoverService.closeSession(mMtbColtSessionID);
this.mCurrentMtbColt = null;
if (onComplete != null) onComplete.run();
}, this::sendError);
} }
public void resetMatchedRows() { public void resetMatchedRows() {

View File

@ -42,7 +42,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintEnd_toStartOf="@id/qta_layout" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">

View File

@ -1,12 +1,12 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
android { android {
compileSdkVersion 32 compileSdkVersion 33
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 32 targetSdkVersion 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro' consumerProguardFiles 'consumer-rules.pro'
@ -33,9 +33,9 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.5.1' implementation 'androidx.appcompat:appcompat:1.6.0'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', { androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations'
}) })

View File

@ -2,7 +2,7 @@
buildscript { buildscript {
ext { ext {
kotlin_version = '1.7.10' kotlin_version = '1.7.21'
} }
repositories { repositories {
@ -12,12 +12,12 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.4.0' classpath 'com.android.tools.build:gradle:7.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.13' classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:perf-plugin:1.4.1' classpath 'com.google.firebase:perf-plugin:1.4.2'
// Add the Firebase Crashlytics Gradle plugin. // Add the Firebase Crashlytics Gradle plugin.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files

View File

@ -3,7 +3,7 @@ plugins {
} }
android { android {
compileSdkVersion 32 compileSdkVersion 33
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21

View File

@ -2,17 +2,23 @@ package it.integry.wms.dynamic_customization.extensions;
import java.util.List; import java.util.List;
import it.integry.integrywmsnative.core.class_router.interfaces.IOrdiniVendita; import it.integry.integrywmsnative.core.class_router.interfaces.OrdiniVenditaInterface;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColt; import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO; import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager; import it.integry.integrywmsnative.core.settings.SettingsManager;
public class OrdiniVendita implements IOrdiniVendita { public class OrdiniVendita implements OrdiniVenditaInterface {
@Override @Override
public boolean isTrasfOrder(List<OrdineUscitaInevasoDTO> testateOrdini) {
return false;
}
@Override
@Deprecated
public void distribuisciCollo(MtbColt mtbColt, List<OrdineUscitaInevasoDTO> testateOrdini, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) { public void distribuisciCollo(MtbColt mtbColt, List<OrdineUscitaInevasoDTO> testateOrdini, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
// UtilityToast.showToast("Avviato metodo in BaseFeature"); // UtilityToast.showToast("Avviato metodo in BaseFeature");

View File

@ -19,5 +19,5 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':app') implementation project(':app')
implementation 'androidx.appcompat:appcompat:1.5.1' implementation 'androidx.appcompat:appcompat:1.6.0'
} }

View File

@ -2,7 +2,7 @@ package it.integry.wms.dynamic_customization.extensions;
import java.util.List; import java.util.List;
import it.integry.integrywmsnative.core.class_router.interfaces.IOrdiniVendita; import it.integry.integrywmsnative.core.class_router.interfaces.OrdiniVenditaInterface;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColt; import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
@ -11,15 +11,26 @@ import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager; import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityString; import it.integry.integrywmsnative.core.utility.UtilityString;
public class OrdiniVendita implements IOrdiniVendita { public class OrdiniVendita implements OrdiniVenditaInterface {
@Override @Override
public boolean isTrasfOrder(List<OrdineUscitaInevasoDTO> testateOrdini) {
// Se il deposito del collo è diverso dal deposito dell'utente allora sto "evadendo"
// la merce per una vendita presente su un altro deposito
String codMdepOrder = testateOrdini.get(0).getCodMdep();
return !UtilityString.isNullOrEmpty(codMdepOrder) &&
!codMdepOrder.equalsIgnoreCase(SettingsManager.i().getUserSession().getDepo().getCodMdep());
}
@Override
@Deprecated
public void distribuisciCollo(MtbColt mtbColt, List<OrdineUscitaInevasoDTO> testateOrdini, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) { public void distribuisciCollo(MtbColt mtbColt, List<OrdineUscitaInevasoDTO> testateOrdini, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
String codMdepOrder = testateOrdini.get(0).getCodMdep(); String codMdepOrder = testateOrdini.get(0).getCodMdep();
//Se il deposito del collo è diverso dal deposito dell'utente allora sto "evadendo" la merce per una vendita presente //Se il deposito del collo è diverso dal deposito dell'utente allora sto "evadendo" la merce
//su un altro deposito // per una vendita presente su un altro deposito
if(!UtilityString.isNullOrEmpty(codMdepOrder) && if(!UtilityString.isNullOrEmpty(codMdepOrder) &&
!codMdepOrder.equalsIgnoreCase(SettingsManager.i().getUserSession().getDepo().getCodMdep())) { !codMdepOrder.equalsIgnoreCase(SettingsManager.i().getUserSession().getDepo().getCodMdep())) {

View File

@ -34,4 +34,4 @@ org.gradle.parallel=true
org.gradle.caching=true org.gradle.caching=true
# Increase memory allotted to JVM # Increase memory allotted to JVM
org.gradle.jvmargs=-Xmx4096m org.gradle.jvmargs=-Xmx4096m
org.gradle.unsafe.configuration-cache=true #org.gradle.unsafe.configuration-cache=true

View File

@ -1,11 +1,11 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
android { android {
compileSdkVersion 32 compileSdkVersion 33
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 32 targetSdkVersion 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -33,9 +33,9 @@ dependencies {
// implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) // implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation project(":honeywellsdk") implementation project(":honeywellsdk")
implementation 'androidx.appcompat:appcompat:1.5.1' implementation 'androidx.appcompat:appcompat:1.6.0'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.4.0' androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', { androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations'
}) })

View File

@ -1,11 +1,11 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
android { android {
compileSdkVersion 32 compileSdkVersion 33
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 32 targetSdkVersion 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro' consumerProguardFiles 'consumer-rules.pro'
@ -32,7 +32,7 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.5.1' implementation 'androidx.appcompat:appcompat:1.6.0'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', { androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {

View File

@ -1,11 +1,11 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
android { android {
compileSdkVersion 32 compileSdkVersion 33
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 32 targetSdkVersion 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
@ -30,9 +30,9 @@ android {
dependencies { dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.5.1' implementation 'androidx.appcompat:appcompat:1.6.0'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.4.0' androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', { androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations'
}) })

View File

@ -1,11 +1,11 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
android { android {
compileSdkVersion 32 compileSdkVersion 33
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 32 targetSdkVersion 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
@ -32,9 +32,9 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.5.1' implementation 'androidx.appcompat:appcompat:1.6.0'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.4.0' androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', { androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations'
}) })