feat: Updates local reception record status
Marks the local stock picking record as synchronized and done after successful backorder confirmation. This ensures the client-side data accurately reflects the completion of the backorder process.
This commit is contained in:
parent
bac7acc185
commit
45f6db9479
@ -109,6 +109,9 @@ class ReceptionDetailsPageModel
|
|||||||
}) async {
|
}) async {
|
||||||
await save(receptionId: receptionId);
|
await save(receptionId: receptionId);
|
||||||
try {
|
try {
|
||||||
|
final stockPickingRecords = objectboxManager.store
|
||||||
|
.box<StockPickingRecordEntity>();
|
||||||
|
final stockPikingEntity = stockPickingRecords.get(receptionId);
|
||||||
state = state.copyWith(withBackorderLoading: true);
|
state = state.copyWith(withBackorderLoading: true);
|
||||||
final createBackorderConfirmationId =
|
final createBackorderConfirmationId =
|
||||||
await ApiCalls.createBackorderConfirmation(
|
await ApiCalls.createBackorderConfirmation(
|
||||||
@ -121,6 +124,9 @@ class ReceptionDetailsPageModel
|
|||||||
createBackorderConfirmationId: createBackorderConfirmationId,
|
createBackorderConfirmationId: createBackorderConfirmationId,
|
||||||
);
|
);
|
||||||
if (res) {
|
if (res) {
|
||||||
|
stockPikingEntity?.synchronized = true;
|
||||||
|
stockPikingEntity?.state = 'done';
|
||||||
|
stockPickingRecords.put(stockPikingEntity!);
|
||||||
await getReceptionById(id: receptionId);
|
await getReceptionById(id: receptionId);
|
||||||
onSuccess?.call();
|
onSuccess?.call();
|
||||||
} else {
|
} else {
|
||||||
@ -143,6 +149,9 @@ class ReceptionDetailsPageModel
|
|||||||
}) async {
|
}) async {
|
||||||
await save(receptionId: receptionId);
|
await save(receptionId: receptionId);
|
||||||
try {
|
try {
|
||||||
|
final stockPickingRecords = objectboxManager.store
|
||||||
|
.box<StockPickingRecordEntity>();
|
||||||
|
final stockPikingEntity = stockPickingRecords.get(receptionId);
|
||||||
state = state.copyWith(withBackorderLoading: true);
|
state = state.copyWith(withBackorderLoading: true);
|
||||||
final createBackorderConfirmationId =
|
final createBackorderConfirmationId =
|
||||||
await ApiCalls.createBackorderConfirmation(
|
await ApiCalls.createBackorderConfirmation(
|
||||||
@ -155,6 +164,9 @@ class ReceptionDetailsPageModel
|
|||||||
createBackorderConfirmationId: createBackorderConfirmationId,
|
createBackorderConfirmationId: createBackorderConfirmationId,
|
||||||
);
|
);
|
||||||
if (res) {
|
if (res) {
|
||||||
|
stockPikingEntity?.synchronized = true;
|
||||||
|
stockPikingEntity?.state = 'done';
|
||||||
|
stockPickingRecords.put(stockPikingEntity!);
|
||||||
await getReceptionById(id: receptionId);
|
await getReceptionById(id: receptionId);
|
||||||
onSuccess?.call();
|
onSuccess?.call();
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user