Browse Source

仓库扫码功能接口对接,功能完成。

liujq 6 months ago
parent
commit
fc27ef9e4f
3 changed files with 60 additions and 12 deletions
  1. 5 0
      lib/network/api.dart
  2. 41 0
      lib/network/api.g.dart
  3. 14 12
      lib/page/home/store_house_page.dart

+ 5 - 0
lib/network/api.dart

@@ -6,6 +6,7 @@ import 'package:lszlgl/model/req/login_req.dart';
6 6
 import 'package:lszlgl/model/rsp/dict_rsp.dart';
7 7
 import 'package:lszlgl/model/rsp/login_rsp.dart';
8 8
 import 'package:lszlgl/model/rsp/sample_task_rsp.dart';
9
+import 'package:lszlgl/model/rsp/storehouse_rsp.dart';
9 10
 import 'package:lszlgl/model/rsp/user_rsp.dart';
10 11
 import 'package:lszlgl/network/base_dio.dart';
11 12
 import 'package:retrofit/http.dart';
@@ -37,6 +38,10 @@ abstract class Api {
37 38
   @PUT('/admin-api/system/user/profile/update-password')
38 39
   Future<ApiRsp<bool>> updatePassword(@Body() Map<String, dynamic> map);
39 40
 
41
+  /// 获取仓库详细信息
42
+  @GET('/admin-api/coding/fmxx/queryLsxxList')
43
+  Future<ApiRsp<List<storehouseRsp>>> getStoreMessage(@Query('ajbm') String ajbm,@Query('key') String key);
44
+
40 45
   /// 获取所有字典
41 46
   @GET('/admin-api/system/dict-data/simple-list')
42 47
   Future<ApiRsp<List<DictRsp>>> getAllDict();

+ 41 - 0
lib/network/api.g.dart

@@ -111,6 +111,47 @@ class _Api implements Api {
111 111
   }
112 112
 
113 113
   @override
114
+  Future<ApiRsp<List<storehouseRsp>>> getStoreMessage(
115
+    String ajbm,
116
+    String key,
117
+  ) async {
118
+    const _extra = <String, dynamic>{};
119
+    final queryParameters = <String, dynamic>{
120
+      r'ajbm': ajbm,
121
+      r'key': key,
122
+    };
123
+    final _headers = <String, dynamic>{};
124
+    final Map<String, dynamic>? _data = null;
125
+    final _result = await _dio.fetch<Map<String, dynamic>>(
126
+        _setStreamType<ApiRsp<List<storehouseRsp>>>(Options(
127
+      method: 'GET',
128
+      headers: _headers,
129
+      extra: _extra,
130
+    )
131
+            .compose(
132
+              _dio.options,
133
+              '/admin-api/coding/fmxx/queryLsxxList',
134
+              queryParameters: queryParameters,
135
+              data: _data,
136
+            )
137
+            .copyWith(
138
+                baseUrl: _combineBaseUrls(
139
+              _dio.options.baseUrl,
140
+              baseUrl,
141
+            ))));
142
+    final value = ApiRsp<List<storehouseRsp>>.fromJson(
143
+      _result.data!,
144
+      (json) => json is List<dynamic>
145
+          ? json
146
+              .map<storehouseRsp>(
147
+                  (i) => storehouseRsp.fromJson(i as Map<String, dynamic>))
148
+              .toList()
149
+          : List.empty(),
150
+    );
151
+    return value;
152
+  }
153
+
154
+  @override
114 155
   Future<ApiRsp<List<DictRsp>>> getAllDict() async {
115 156
     const _extra = <String, dynamic>{};
116 157
     final queryParameters = <String, dynamic>{};

+ 14 - 12
lib/page/home/store_house_page.dart

@@ -10,6 +10,7 @@ import 'package:lszlgl/config/borders.dart';
10 10
 import 'package:lszlgl/main.dart';
11 11
 import 'package:lszlgl/model/api_rsp.dart';
12 12
 import 'package:lszlgl/model/rsp/storehouse_rsp.dart';
13
+import 'package:lszlgl/network/my_api.dart';
13 14
 import 'package:lszlgl/widget/page_widget.dart';
14 15
 import 'package:lszlgl/widget/storehouse_item.dart';
15 16
 
@@ -41,18 +42,19 @@ class _StoreHousePageState extends BaseLifecycleState<StoreHousePage> {
41 42
   void loadData() async{
42 43
     pageState.update(pageState.value.loading());
43 44
     try{
44
-      String jsonStr = await Future.delayed(const Duration(seconds: 3),()async{
45
-        return rootBundle.loadString('assets/json/storehouse.json');
46
-      });
47
-      Map<String,dynamic> val = json.decode(jsonStr);
48
-      ApiRsp<List<storehouseRsp?>> res= ApiRsp<List<storehouseRsp>>.fromJson(
49
-        val,
50
-            (json) => json is List<dynamic>
51
-            ? json
52
-            .map<storehouseRsp>((i) => storehouseRsp.fromJson(i as Map<String, dynamic>))
53
-            .toList()
54
-            : List.empty(),
55
-      );
45
+      // String jsonStr = await Future.delayed(const Duration(seconds: 3),()async{
46
+      //   return rootBundle.loadString('assets/json/storehouse.json');
47
+      // });
48
+      // Map<String,dynamic> val = json.decode(jsonStr);
49
+      // ApiRsp<List<storehouseRsp?>> res= ApiRsp<List<storehouseRsp>>.fromJson(
50
+      //   val,
51
+      //       (json) => json is List<dynamic>
52
+      //       ? json
53
+      //       .map<storehouseRsp>((i) => storehouseRsp.fromJson(i as Map<String, dynamic>))
54
+      //       .toList()
55
+      //       : List.empty(),
56
+      // );
57
+      var res = await MyApi.get(baseUrl: 'http://101.36.160.117:28088').getStoreMessage(widget.houseNum, 'zhijian');
56 58
       if(res.data == null ){
57 59
         pageState.update(pageState.value.empty());
58 60
       }else{