添加EBS码盘入库
This commit is contained in:
parent
d8189e00d2
commit
72460817d3
|
|
@ -9,7 +9,7 @@ class WmsApiClient {
|
||||||
static Dio instance() {
|
static Dio instance() {
|
||||||
if(!initializeComplete) {
|
if(!initializeComplete) {
|
||||||
final options = BaseOptions(
|
final options = BaseOptions(
|
||||||
baseUrl: 'http://192.168.3.109:19990',
|
baseUrl: 'http://10.168.1.100:19990',
|
||||||
connectTimeout: const Duration(seconds: 5),
|
connectTimeout: const Duration(seconds: 5),
|
||||||
receiveTimeout: const Duration(seconds: 3),
|
receiveTimeout: const Duration(seconds: 3),
|
||||||
);
|
);
|
||||||
|
|
@ -51,7 +51,7 @@ class WmsApiClient {
|
||||||
return { "code" : response.statusCode, "data": response.data };
|
return { "code" : response.statusCode, "data": response.data };
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 绑定入库
|
/// MES绑定入库
|
||||||
static Future<dynamic> bindingVehicleIn(dynamic bindingVehicleData, {int timeOut = 5000}) async {
|
static Future<dynamic> bindingVehicleIn(dynamic bindingVehicleData, {int timeOut = 5000}) async {
|
||||||
instance();
|
instance();
|
||||||
final response = await dio.post<String>(
|
final response = await dio.post<String>(
|
||||||
|
|
@ -65,4 +65,35 @@ class WmsApiClient {
|
||||||
);
|
);
|
||||||
return { "code" : response.statusCode, "data": response.data };
|
return { "code" : response.statusCode, "data": response.data };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 获取EBS入库单信息
|
||||||
|
static Future<dynamic> getCuxData({int timeOut = 5000}) async {
|
||||||
|
instance();
|
||||||
|
final response = await dio.get<String>(
|
||||||
|
"/api/mobile/stockIn/getCuxData",
|
||||||
|
options: Options(
|
||||||
|
responseType: ResponseType.json,
|
||||||
|
sendTimeout: Duration(milliseconds: timeOut),
|
||||||
|
receiveTimeout: Duration(milliseconds: timeOut),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return { "code" : response.statusCode, "data": response.data };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// EBS绑定入库
|
||||||
|
static Future<dynamic> bindingVehicleInEbs(dynamic bindingVehicleData, {int timeOut = 5000}) async {
|
||||||
|
instance();
|
||||||
|
final response = await dio.post<String>(
|
||||||
|
"/api/mobile/stockIn/bindingVehicleInEbs",
|
||||||
|
data: jsonEncode(bindingVehicleData),
|
||||||
|
options: Options(
|
||||||
|
responseType: ResponseType.json,
|
||||||
|
sendTimeout: Duration(milliseconds: timeOut),
|
||||||
|
receiveTimeout: Duration(milliseconds: timeOut),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return { "code" : response.statusCode, "data": response.data };
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -20,15 +20,11 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
List<dynamic> tableData = []; // 表格数据类型
|
List<dynamic> tableData = []; // 表格数据类型
|
||||||
int tableIndex = 0; // 序号
|
int tableIndex = 0; // 序号
|
||||||
int selectCount = 0; // 已选择的数量
|
int selectCount = 0; // 已选择的数量
|
||||||
|
String inArea = "立体库"; // 入库位置
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
tableData.add({
|
|
||||||
"action":"",
|
|
||||||
"id":"1",
|
|
||||||
"vehicleNo":"测试"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -68,10 +64,10 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
),
|
),
|
||||||
BrnRadioInputFormItem(
|
BrnRadioInputFormItem(
|
||||||
title: "选择目的地:",
|
title: "选择目的地:",
|
||||||
options: const ["立体库", "装箱线"],
|
options: [inArea, "装箱线"],
|
||||||
value: "立体库",
|
value: inArea,
|
||||||
onChanged: (oldValue, newValue) {
|
onChanged: (oldValue, newValue) {
|
||||||
BrnToast.show("点击触发回调${oldValue}_${newValue}_onChanged", context);
|
inArea = newValue ?? "立体库";
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Padding(padding: const EdgeInsets.only(
|
Padding(padding: const EdgeInsets.only(
|
||||||
|
|
@ -99,25 +95,24 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
),
|
),
|
||||||
child: TDTable(
|
child: TDTable(
|
||||||
bordered: true,
|
bordered: true,
|
||||||
height: 300,
|
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
columns: [
|
columns: [
|
||||||
TDTableCol(title: '*', colKey: 'action', width: 45, align: TDTableColAlign.center),
|
TDTableCol(title: '*', colKey: 'action', width: 45, align: TDTableColAlign.center),
|
||||||
TDTableCol(title: '序号', colKey: 'id', align: TDTableColAlign.center, width: 80),
|
TDTableCol(title: '序号', colKey: 'id', align: TDTableColAlign.center, width: 80),
|
||||||
TDTableCol(title: '载具号', colKey: 'vehicleNo', align: TDTableColAlign.center, ellipsis: true, width: 80),
|
TDTableCol(title: '物料ID', colKey: 'itemId', align: TDTableColAlign.center, ellipsis: true, width: 80),
|
||||||
TDTableCol(title: '箱号', colKey: 'boxNo', align: TDTableColAlign.center, ellipsis: true, width: 80),
|
TDTableCol(title: '物料编码', colKey: 'itemCode', align: TDTableColAlign.center, ellipsis: true, width: 80),
|
||||||
TDTableCol(title: '包装数量', colKey: 'goodsNum', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
TDTableCol(title: '数量', colKey: 'quantity', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
||||||
TDTableCol(title: '产品编码', colKey: 'goodsId', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
TDTableCol(title: '已接收数量', colKey: 'quantityReceives', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
||||||
TDTableCol(title: '每包数量', colKey: 'numPerBox', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
TDTableCol(title: '物料描述', colKey: 'itemDesc', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
||||||
TDTableCol(title: '包数量', colKey: 'picketNum', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
TDTableCol(title: '订单头主键', colKey: 'poHeaderId', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
||||||
TDTableCol(title: '零包数量', colKey: 'otherNum', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
TDTableCol(title: '订单行主键', colKey: 'poLineId', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
||||||
TDTableCol(title: '销售订单', colKey: 'saleOrderNo', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
TDTableCol(title: '发运行主键', colKey: 'lineLocationId', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
||||||
TDTableCol(title: '包装层级', colKey: 'packetLevel', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
TDTableCol(title: '收货组织代码', colKey: 'shipToOrganization', align: TDTableColAlign.center, ellipsis: true, width: 110),
|
||||||
TDTableCol(title: '周期', colKey: 'cycle', align: TDTableColAlign.center, ellipsis: true, width: 80),
|
TDTableCol(title: '采购单位', colKey: 'purUomCode', align: TDTableColAlign.center, ellipsis: true, width: 80),
|
||||||
TDTableCol(title: '客户销售订单', colKey: 'customSaleOrderNo', align: TDTableColAlign.center, ellipsis: true, width: 110),
|
TDTableCol(title: '库存单位', colKey: 'invUomCode', align: TDTableColAlign.center, ellipsis: true, width: 110),
|
||||||
TDTableCol(title: '子库', colKey: 'minorWarehouseId', align: TDTableColAlign.center, ellipsis: true, width: 80),
|
TDTableCol(title: '发运行号', colKey: 'shipmentNum', align: TDTableColAlign.center, ellipsis: true, width: 80),
|
||||||
TDTableCol(title: '产品描述', colKey: 'goodsDesc', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
TDTableCol(title: '分配ID', colKey: 'poDistributionId', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
||||||
],
|
],
|
||||||
data: tableData,
|
data: tableData,
|
||||||
onCellTap: (index, dynamic, cell) {
|
onCellTap: (index, dynamic, cell) {
|
||||||
|
|
@ -140,28 +135,83 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
|
|
||||||
/// 获取入库单数据
|
/// 获取入库单数据
|
||||||
void getTableData() {
|
void getTableData() {
|
||||||
|
BrnLoadingDialog.show(context, content: "正在拉取数据", barrierDismissible: false);
|
||||||
|
setState(() {
|
||||||
|
tableData = [];
|
||||||
|
tableIndex = 0;
|
||||||
|
});
|
||||||
|
WmsApiClient.getCuxData().then((response){
|
||||||
|
if(response["code"] != 200) {
|
||||||
|
var thisContext = context;
|
||||||
|
if(thisContext.mounted) {
|
||||||
|
DialogUtils.showWarningMessage(thisContext, "警告", "服务器请求失败", btnLabel: "我知道了");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final data = Map<String, dynamic>.from(jsonDecode(response["data"]));
|
||||||
|
if(data["code"] == 200) {
|
||||||
|
// 服务器返回成功
|
||||||
|
final cuxData = data["data"] as List<dynamic>;
|
||||||
|
setState(() {
|
||||||
|
for (var item in cuxData) {
|
||||||
|
tableIndex ++;
|
||||||
|
tableData.add({
|
||||||
|
'id': (tableIndex).toString(),
|
||||||
|
'itemId': item["itemId"].toString(),
|
||||||
|
'itemCode': item["itemCode"],
|
||||||
|
'quantity': item["quantity"].toString(),
|
||||||
|
'quantityReceives': item["quantityReceives"].toString(),
|
||||||
|
'itemDesc': item["itemDesc"],
|
||||||
|
'poHeaderId': item["poHeaderId"].toString(),
|
||||||
|
'poLineId': item["poLineId"].toString(),
|
||||||
|
'lineLocationId': item["lineLocationId"].toString(),
|
||||||
|
'shipToOrganization': item["shipToOrganization"],
|
||||||
|
'purUomCode': item["purUomCode"],
|
||||||
|
'invUomCode': item["invUomCode"],
|
||||||
|
'shipmentNum': item["shipmentNum"].toString(),
|
||||||
|
'poDistributionId': item["poDistributionId"].toString(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 服务器返回失败
|
||||||
|
var thisContext = context;
|
||||||
|
if(thisContext.mounted) {
|
||||||
|
DialogUtils.showWarningMessage(thisContext, "警告", "服务器返回失败:${data["message"]}", btnLabel: "我知道了");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}).catchError((err){
|
||||||
|
var thisContext = context;
|
||||||
|
if(thisContext.mounted) {
|
||||||
|
DialogUtils.showErrorMessage(thisContext, "请求发生错误", "请求服务器发生错误:${err.toString()}", btnLabel: "我知道了");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}).whenComplete((){
|
||||||
|
var thisContext = context;
|
||||||
|
if(thisContext.mounted) {
|
||||||
|
BrnLoadingDialog.dismiss(thisContext);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// 显示详细信息
|
/// 显示详细信息
|
||||||
void showDetails(index, dynamic) {
|
void showDetails(index, dynamic) {
|
||||||
String goodsDetails = "";
|
String goodsDetails = "";
|
||||||
goodsDetails += "序号:${dynamic["id"]??""}\r\n";
|
goodsDetails += "序号:${dynamic["id"]??""}\r\n";
|
||||||
goodsDetails += "载具号:${dynamic["vehicleNo"]??""}\r\n";
|
goodsDetails += "物料ID:${dynamic["itemId"]??""}\r\n";
|
||||||
goodsDetails += "箱号:${dynamic["boxNo"]??""}\r\n";
|
goodsDetails += "物料编码:${dynamic["itemCode"]??""}\r\n";
|
||||||
goodsDetails += "包装数量:${dynamic["goodsNum"]??""}\r\n";
|
goodsDetails += "数量:${dynamic["quantity"]??""}\r\n";
|
||||||
goodsDetails += "产品编码:${dynamic["goodsId"]??""}\r\n";
|
goodsDetails += "已接收数量:${dynamic["quantityReceives"]??""}\r\n";
|
||||||
goodsDetails += "每包数量:${dynamic["numPerBox"]??""}\r\n";
|
goodsDetails += "物料描述:${dynamic["itemDesc"]??""}\r\n";
|
||||||
goodsDetails += "包数量:${dynamic["picketNum"]??""}\r\n";
|
goodsDetails += "订单头主键:${dynamic["poHeaderId"]??""}\r\n";
|
||||||
goodsDetails += "零包数量:${dynamic["otherNum"]??""}\r\n";
|
goodsDetails += "订单行主键:${dynamic["poLineId"]??""}\r\n";
|
||||||
goodsDetails += "销售订单:${dynamic["saleOrderNo"]??""}\r\n";
|
goodsDetails += "发运行主键:${dynamic["lineLocationId"]??""}\r\n";
|
||||||
goodsDetails += "包装层级:${dynamic["packetLevel"]??""}\r\n";
|
goodsDetails += "收货组织代码:${dynamic["shipToOrganization"]??""}\r\n";
|
||||||
goodsDetails += "周期:${dynamic["cycle"]??""}\r\n";
|
goodsDetails += "采购单位:${dynamic["purUomCode"]??""}\r\n";
|
||||||
goodsDetails += "客户销售订单:${dynamic["customSaleOrderNo"]??""}\r\n";
|
goodsDetails += "库存单位:${dynamic["invUomCode"]??""}\r\n";
|
||||||
goodsDetails += "子库:${dynamic["minorWarehouseId"]??""}\r\n";
|
goodsDetails += "发运行号:${dynamic["shipmentNum"]??""}\r\n";
|
||||||
goodsDetails += "产品描述:${dynamic["goodsDesc"]??""}";
|
goodsDetails += "分配ID:${dynamic["poDistributionId"]??""}";
|
||||||
DialogUtils.showMessage(context, "详情", goodsDetails, btnLabel: "我知道了");
|
DialogUtils.showMessage(context, "详情", goodsDetails, btnLabel: "我知道了");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,7 +221,8 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
DialogUtils.showWarningMessage(context, "警告", "您当前没有待入库的入库单", btnLabel: "确定");
|
DialogUtils.showWarningMessage(context, "警告", "您当前没有待入库的入库单", btnLabel: "确定");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(_vehicleTextController.text == "") {
|
String vehicleNo = _vehicleTextController.text;
|
||||||
|
if(vehicleNo == "") {
|
||||||
DialogUtils.showWarningMessage(context, "警告", "请先扫描载具号", btnLabel: "返回填写");
|
DialogUtils.showWarningMessage(context, "警告", "请先扫描载具号", btnLabel: "返回填写");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -181,8 +232,60 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DialogUtils.showConfirmMessage(context, "完成确认?", "当前选择了 $selectCount 条入库单,是否继续?", confirmBtn: "继续", confirm: () {
|
DialogUtils.showConfirmMessage(context, "完成确认?", "当前选择了 $selectCount 条入库单,是否继续?", confirmBtn: "继续", confirm: () {
|
||||||
|
int taskType = inArea == "立体库" ? 1 : 2; // 1 表示进库,2 表示进站台
|
||||||
|
List<dynamic> bindingGoods = [];
|
||||||
|
dynamic requestData = {"vehicleNo" : vehicleNo, "taskType" : taskType, "bindingGoods" : bindingGoods };
|
||||||
|
for (var item in selectData) {
|
||||||
|
bindingGoods.add({
|
||||||
|
"boxNo": item["itemId"],
|
||||||
|
"numPerBox": item["quantityReceives"],
|
||||||
|
"goodsNum": item["quantity"],
|
||||||
|
"picketNum": item["quantity"],
|
||||||
|
"otherNum": item["quantity"],
|
||||||
|
"goodsId": item["itemCode"],
|
||||||
|
"saleOrderNo": item["lineLocationId"],
|
||||||
|
"packetLevel": "",
|
||||||
|
"cycle": "",
|
||||||
|
"customSaleOrderNo": item["shipToOrganization"],
|
||||||
|
"minorWarehouseId": item["poDistributionId"],
|
||||||
|
"goodsDesc": item["itemDesc"],
|
||||||
|
"poHeaderId":item["poHeaderId"],
|
||||||
|
"poLineId":item["poLineId"],
|
||||||
|
"lineLocationId":item["lineLocationId"],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
BrnLoadingDialog.show(context, content: "正在请求入库");
|
||||||
|
WmsApiClient.bindingVehicleInEbs(requestData).then((response){
|
||||||
|
final data = Map<String, dynamic>.from(jsonDecode(response["data"]));
|
||||||
|
if(data["code"] == 200) {
|
||||||
|
// 请求成功
|
||||||
|
var thisContext = context;
|
||||||
|
if(thisContext.mounted) {
|
||||||
|
DialogUtils.showSuccessMessage(thisContext, "成功", "", btnLabel: "我知道了");
|
||||||
|
getTableData(); // 刷新信息
|
||||||
|
setState(() {
|
||||||
|
_vehicleTextController.text = "";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var thisContext = context;
|
||||||
|
if(thisContext.mounted) {
|
||||||
|
DialogUtils.showWarningMessage(thisContext, "警告", "服务器返回失败:${data["message"]}", btnLabel: "我知道了");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}).catchError((err){
|
||||||
|
var thisContext = context;
|
||||||
|
if(thisContext.mounted) {
|
||||||
|
DialogUtils.showErrorMessage(thisContext, "请求发生错误", "请求服务器发生错误:${err.toString()} \r\n ${jsonEncode(requestData)}", btnLabel: "我知道了");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}).whenComplete((){
|
||||||
|
var thisContext = context;
|
||||||
|
if(thisContext.mounted) {
|
||||||
|
BrnLoadingDialog.dismiss(thisContext);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,6 @@ class _StockInWheelMesPageState extends State<StockInWheelMes> {
|
||||||
),
|
),
|
||||||
child: TDTable(
|
child: TDTable(
|
||||||
bordered: true,
|
bordered: true,
|
||||||
height: 300,
|
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
columns: [
|
columns: [
|
||||||
|
|
@ -310,7 +309,6 @@ class _StockInWheelMesPageState extends State<StockInWheelMes> {
|
||||||
BrnLoadingDialog.dismiss(thisContext);
|
BrnLoadingDialog.dismiss(thisContext);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user