Aggiunto documento in TrasferimentoPedane
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"formatVersion": 1,
|
||||
"database": {
|
||||
"version": 20,
|
||||
"identityHash": "cc9ce7a63656299270eb6f768d6c0a5b",
|
||||
"identityHash": "4f475ef508f955bf14cf0c9807add68e",
|
||||
"entities": [
|
||||
{
|
||||
"tableName": "articoli_griglia",
|
||||
@@ -1196,7 +1196,7 @@
|
||||
},
|
||||
{
|
||||
"tableName": "trasferimento_pedane",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cod_mdep_dest` TEXT NOT NULL, `descrizione_depo_dest` TEXT NOT NULL, `status` INTEGER NOT NULL, `created_at` INTEGER DEFAULT CURRENT_TIMESTAMP, `_id` INTEGER PRIMARY KEY AUTOINCREMENT, `remote_sync_date` INTEGER)",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cod_mdep_dest` TEXT NOT NULL, `descrizione_depo_dest` TEXT NOT NULL, `status` INTEGER NOT NULL, `document_cod_anag` TEXT, `document_cod_dtip` TEXT, `document_num` INTEGER, `document_ser` TEXT, `document_data` INTEGER, `created_at` INTEGER DEFAULT CURRENT_TIMESTAMP, `_id` INTEGER PRIMARY KEY AUTOINCREMENT, `remote_sync_date` INTEGER)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "codMdepDest",
|
||||
@@ -1216,6 +1216,31 @@
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "documentCodAnag",
|
||||
"columnName": "document_cod_anag",
|
||||
"affinity": "TEXT"
|
||||
},
|
||||
{
|
||||
"fieldPath": "documentCodDtip",
|
||||
"columnName": "document_cod_dtip",
|
||||
"affinity": "TEXT"
|
||||
},
|
||||
{
|
||||
"fieldPath": "documentNum",
|
||||
"columnName": "document_num",
|
||||
"affinity": "INTEGER"
|
||||
},
|
||||
{
|
||||
"fieldPath": "documentSer",
|
||||
"columnName": "document_ser",
|
||||
"affinity": "TEXT"
|
||||
},
|
||||
{
|
||||
"fieldPath": "documentData",
|
||||
"columnName": "document_data",
|
||||
"affinity": "INTEGER"
|
||||
},
|
||||
{
|
||||
"fieldPath": "createdAt",
|
||||
"columnName": "created_at",
|
||||
@@ -1340,7 +1365,7 @@
|
||||
],
|
||||
"setupQueries": [
|
||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'cc9ce7a63656299270eb6f768d6c0a5b')"
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '4f475ef508f955bf14cf0c9807add68e')"
|
||||
]
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -53,7 +53,7 @@ import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRow
|
||||
TrasferimentoPedaneEntity.class,
|
||||
TrasferimentoPedaneRowEntity.class
|
||||
},
|
||||
version = 20)
|
||||
version = 21)
|
||||
@TypeConverters({
|
||||
DateConverter.class,
|
||||
BigDecimalConverter.class,
|
||||
@@ -85,7 +85,8 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
.addMigrations(MIGRATION_16_17)
|
||||
.addMigrations(MIGRATION_17_18)
|
||||
.addMigrations(MIGRATION_18_19)
|
||||
.addMigrations(MIGRATION_19_20);
|
||||
.addMigrations(MIGRATION_19_20)
|
||||
.addMigrations(MIGRATION_20_21);
|
||||
|
||||
sInstance = builder.build();
|
||||
}
|
||||
@@ -276,4 +277,24 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
database.execSQL("CREATE INDEX IF NOT EXISTS index_trasferimento_pedane_rows_parent_id ON trasferimento_pedane_rows (parent_id)");
|
||||
}
|
||||
};
|
||||
|
||||
static final Migration MIGRATION_20_21 = new Migration(20, 21) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||
database.execSQL("ALTER TABLE trasferimento_pedane"
|
||||
+ " ADD COLUMN document_cod_anag TEXT;");
|
||||
|
||||
database.execSQL("ALTER TABLE trasferimento_pedane"
|
||||
+ " ADD COLUMN document_cod_dtip TEXT");
|
||||
|
||||
database.execSQL("ALTER TABLE trasferimento_pedane"
|
||||
+ " ADD COLUMN document_num INTEGER");
|
||||
|
||||
database.execSQL("ALTER TABLE trasferimento_pedane"
|
||||
+ " ADD COLUMN document_ser TEXT");
|
||||
|
||||
database.execSQL("ALTER TABLE trasferimento_pedane"
|
||||
+ " ADD COLUMN document_data INTEGER");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.Ignore;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@@ -23,6 +24,12 @@ public class TrasferimentoPedaneEntity extends BaseSyncDTO implements EntityMode
|
||||
public static final String COD_MDEP_DEST = "cod_mdep_dest";
|
||||
public static final String DESCRIZIONE_DEPO_DEST = "descrizione_depo_dest";
|
||||
public static final String STATUS = "status";
|
||||
public static final String DOCUMENT_COD_ANAG = "document_cod_anag";
|
||||
public static final String DOCUMENT_COD_DTIP = "document_cod_dtip";
|
||||
public static final String DOCUMENT_NUM = "document_num";
|
||||
public static final String DOCUMENT_SER = "document_ser";
|
||||
public static final String DOCUMENT_DATA = "document_data";
|
||||
|
||||
public static final String CREATED_AT = "created_at";
|
||||
}
|
||||
|
||||
@@ -38,6 +45,21 @@ public class TrasferimentoPedaneEntity extends BaseSyncDTO implements EntityMode
|
||||
@ColumnInfo(name = Columns.STATUS)
|
||||
private short status = TrasferimentoPedaneStatusEnum.APERTO.getValue();
|
||||
|
||||
@ColumnInfo(name = Columns.DOCUMENT_COD_ANAG)
|
||||
private String documentCodAnag;
|
||||
|
||||
@ColumnInfo(name = Columns.DOCUMENT_COD_DTIP)
|
||||
private String documentCodDtip;
|
||||
|
||||
@ColumnInfo(name = Columns.DOCUMENT_NUM)
|
||||
private Integer documentNum;
|
||||
|
||||
@ColumnInfo(name = Columns.DOCUMENT_SER)
|
||||
private String documentSer;
|
||||
|
||||
@ColumnInfo(name = Columns.DOCUMENT_DATA)
|
||||
private LocalDate documentData;
|
||||
|
||||
@ColumnInfo(name = TrasferimentoPedaneEntity.Columns.CREATED_AT, defaultValue = "CURRENT_TIMESTAMP")
|
||||
private LocalDateTime createdAt = LocalDateTime.now();
|
||||
|
||||
@@ -70,6 +92,46 @@ public class TrasferimentoPedaneEntity extends BaseSyncDTO implements EntityMode
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDocumentCodAnag() {
|
||||
return documentCodAnag;
|
||||
}
|
||||
|
||||
public void setDocumentCodAnag(String documentCodAnag) {
|
||||
this.documentCodAnag = documentCodAnag;
|
||||
}
|
||||
|
||||
public String getDocumentCodDtip() {
|
||||
return documentCodDtip;
|
||||
}
|
||||
|
||||
public void setDocumentCodDtip(String documentCodDtip) {
|
||||
this.documentCodDtip = documentCodDtip;
|
||||
}
|
||||
|
||||
public Integer getDocumentNum() {
|
||||
return documentNum;
|
||||
}
|
||||
|
||||
public void setDocumentNum(Integer documentNum) {
|
||||
this.documentNum = documentNum;
|
||||
}
|
||||
|
||||
public String getDocumentSer() {
|
||||
return documentSer;
|
||||
}
|
||||
|
||||
public void setDocumentSer(String documentSer) {
|
||||
this.documentSer = documentSer;
|
||||
}
|
||||
|
||||
public LocalDate getDocumentData() {
|
||||
return documentData;
|
||||
}
|
||||
|
||||
public void setDocumentData(LocalDate documentData) {
|
||||
this.documentData = documentData;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.concurrent.ExecutorService;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.trasferimento_pedane.SaveTrasferimentoPedaneRequestDTO;
|
||||
@@ -24,15 +25,17 @@ public class TrasferimentoPedaneRESTConsumer extends _BaseRESTConsumer {
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
public void makeSynchronousSaveRequest(String codMdepDest, List<String> barcodeUlList) throws Exception {
|
||||
public MtbColt makeSynchronousSaveRequest(String codMdepDest, List<String> barcodeUlList) throws Exception {
|
||||
var service = restBuilder.getService(TrasferimentoPedaneRESTConsumerService.class);
|
||||
Response<ServiceRESTResponse<Void>> response = service.save(new SaveTrasferimentoPedaneRequestDTO() {{
|
||||
Response<ServiceRESTResponse<MtbColt>> response = service.save(new SaveTrasferimentoPedaneRequestDTO() {{
|
||||
setCodMdepDest(codMdepDest);
|
||||
setBarcodeUlList(barcodeUlList);
|
||||
}})
|
||||
.execute();
|
||||
|
||||
analyzeAnswer(response, "save-trasferimento-pedane");
|
||||
var data = analyzeAnswer(response, "save-trasferimento-pedane");
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.trasferimento_pedane.SaveTrasferimentoPedaneRequestDTO;
|
||||
import retrofit2.Call;
|
||||
@@ -9,7 +10,7 @@ import retrofit2.http.POST;
|
||||
public interface TrasferimentoPedaneRESTConsumerService {
|
||||
|
||||
@POST("wms/trasferimento/save")
|
||||
Call<ServiceRESTResponse<Void>> save(@Body SaveTrasferimentoPedaneRequestDTO requestData);
|
||||
Call<ServiceRESTResponse<MtbColt>> save(@Body SaveTrasferimentoPedaneRequestDTO requestData);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -206,6 +206,11 @@ public class TrasferimentoPedaneEditActivity extends BaseActivity implements Tra
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void printDocument() {
|
||||
String tmp = "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrasferimentoCompleted() {
|
||||
handler.post(this::finish);
|
||||
|
||||
@@ -41,6 +41,7 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
private TrasferimentoPedaneEntity currentTrasferimentoPedane;
|
||||
private MutableLiveData<List<TrasferimentoPedaneRowEntity>> rowsLiveData = new MutableLiveData<>();
|
||||
private MutableLiveData<Boolean> canBeModifiedLiveData = new MutableLiveData<>(false);
|
||||
private MutableLiveData<Boolean> canBePrintedLiveData = new MutableLiveData<>(false);
|
||||
|
||||
private Listener listener;
|
||||
|
||||
@@ -68,6 +69,7 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
executorService.execute(() -> {
|
||||
this.currentTrasferimentoPedane = trasferimentoPedaneRepository.retrieve(trasferimentoPedaneId);
|
||||
canBeModifiedLiveData.postValue(this.currentTrasferimentoPedane.getStatusEnum() == TrasferimentoPedaneStatusEnum.APERTO);
|
||||
canBePrintedLiveData.postValue(this.currentTrasferimentoPedane.getDocumentCodDtip() != null);
|
||||
|
||||
var tmpLiveData = trasferimentoPedaneRowRepository.retrieve(trasferimentoPedaneId);
|
||||
|
||||
@@ -210,7 +212,17 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
.map(TrasferimentoPedaneRowEntity::getBarcodeUl)
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
|
||||
trasferimentoPedaneRESTConsumer.makeSynchronousSaveRequest(currentTrasferimentoPedane.getCodMdepDest(), barcodes);
|
||||
var generatedMovement = trasferimentoPedaneRESTConsumer.makeSynchronousSaveRequest(currentTrasferimentoPedane.getCodMdepDest(), barcodes);
|
||||
|
||||
var documentKey = generatedMovement.getDocumentKey();
|
||||
|
||||
if(documentKey != null) {
|
||||
currentTrasferimentoPedane.setDocumentCodAnag(documentKey.getCodAnag());
|
||||
currentTrasferimentoPedane.setDocumentCodDtip(documentKey.getCodDtip());
|
||||
currentTrasferimentoPedane.setDocumentData(documentKey.getDataDoc());
|
||||
currentTrasferimentoPedane.setDocumentNum(documentKey.getNumDoc());
|
||||
currentTrasferimentoPedane.setDocumentSer(documentKey.getSerDoc());
|
||||
}
|
||||
|
||||
currentTrasferimentoPedane.setStatus(TrasferimentoPedaneStatusEnum.COMPLETATO.getValue());
|
||||
currentTrasferimentoPedane.setRemoteSyncDate(LocalDateTime.now());
|
||||
@@ -231,6 +243,10 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
return canBeModifiedLiveData;
|
||||
}
|
||||
|
||||
public LiveData<Boolean> canBePrintedLiveData() {
|
||||
return canBePrintedLiveData;
|
||||
}
|
||||
|
||||
public void setListener(Listener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@@ -126,6 +126,19 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
style="?attr/floatingActionButtonPrimaryStyle" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/complete_trasferimento_pedane_print"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
android:onClick="@{() -> view.printDocument()}"
|
||||
app:srcCompat="@drawable/ic_print_material3"
|
||||
app:visibility="@{viewModel.canBePrintedLiveData()}"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
style="?attr/floatingActionButtonPrimaryStyle" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user