update cargo type form from rate, update carton info and form

This commit is contained in:
tzw
2024-09-25 21:49:09 +06:30
parent 1be18c08a9
commit 02e079c514
51 changed files with 1407 additions and 643 deletions

View File

@@ -1,5 +1,6 @@
// ignore_for_file: deprecated_member_use
import 'package:fcs/pages/carton/model/carton_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
@@ -187,7 +188,35 @@ class _MixCartonFormState extends State<MixCartonForm> {
_isLoading = true;
});
try {
Navigator.pop(context, true);
double length = 0;
double width = 0;
double height = 0;
if (_cartonSizeType == standardCarton) {
if (_standardSize != null) {
length = _standardSize!.length;
width = _standardSize!.width;
height = _standardSize!.height;
}
} else if (_cartonSizeType == customCarton) {
length = _length;
width = _width;
height = _height;
} else {
length = 0;
width = 0;
height = 0;
}
var carton = Carton(
cartonType: mix_carton,
fcsShipmentID: _shipment?.id,
length: length,
width: width,
height: height,
cartons: _cartons);
var c = await context.read<CartonModel>().createMixCarton(carton);
Navigator.pop(context, c);
} catch (e) {
showMsgDialog(context, "Error", e.toString());
} finally {