request and response dart files
parent
b30e9240e7
commit
4e63ed0556
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
import 'package:satu/core/models/flow/rows_bean.dart';
|
||||
import 'package:satu/core/utils/utils_parse.dart';
|
||||
|
||||
class CheckBean {
|
||||
List<CheckRowsBean> rows =[];
|
||||
String? qr;
|
||||
String? link;
|
||||
|
||||
static CheckBean? fromMap(dynamic map) {
|
||||
if (map == null) return null;
|
||||
final CheckBean checkBean = CheckBean();
|
||||
checkBean.rows.addAll(
|
||||
(map['rows'] as List ?? []).map((o) => CheckRowsBean.fromMap(o))
|
||||
);
|
||||
checkBean.qr = cast<String>(map['qr']);
|
||||
checkBean.link = cast<String>(map['link']);
|
||||
return checkBean;
|
||||
}
|
||||
|
||||
Map toJson() => {
|
||||
'rows': rows,
|
||||
'qr': qr,
|
||||
'link': link,
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
import 'package:satu/core/utils/utils_parse.dart';
|
||||
|
||||
/// sn : "SL00100003"
|
||||
/// address : ""
|
||||
/// ticket_ad_ofd : ""
|
||||
/// name : "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> «qwe»"
|
||||
/// biniin : "123132131232"
|
||||
/// kkmreg : ""
|
||||
|
||||
|
||||
class InfoBean {
|
||||
String? sn;
|
||||
String? address;
|
||||
String? ticketAdOfd;
|
||||
String? name;
|
||||
String? biniin;
|
||||
String? kkmreg;
|
||||
|
||||
static InfoBean? fromMap(dynamic map) {
|
||||
if (map == null) return null;
|
||||
final InfoBean infoBean = InfoBean();
|
||||
infoBean.sn = cast<String>(map['sn']);
|
||||
infoBean.address = cast<String>(map['address']);
|
||||
infoBean.ticketAdOfd = cast<String>(map['ticket_ad_ofd']);
|
||||
infoBean.name = cast<String>(map['name']);
|
||||
infoBean.biniin = cast<String>(map['biniin']);
|
||||
infoBean.kkmreg = cast<String>(map['kkmreg']);
|
||||
return infoBean;
|
||||
}
|
||||
|
||||
Map toJson() => {
|
||||
'sn': sn,
|
||||
'address': address,
|
||||
'ticket_ad_ofd': ticketAdOfd,
|
||||
'name': name,
|
||||
'biniin': biniin,
|
||||
'kkmreg': kkmreg,
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
import 'package:satu/core/utils/utils_parse.dart';
|
||||
|
||||
/// id : 6
|
||||
/// name : "test"
|
||||
/// articul : "100"
|
||||
/// cnt : 1
|
||||
/// price : 200
|
||||
/// excise : "000000000000_gs1_excise_code"
|
||||
|
||||
class ItemsBean {
|
||||
int? id;
|
||||
String? name;
|
||||
String? articul;
|
||||
double? cnt;
|
||||
double? price;
|
||||
String? excise;
|
||||
|
||||
static ItemsBean fromMap(dynamic map) {
|
||||
final ItemsBean itemsBean = ItemsBean();
|
||||
itemsBean.id = cast<int>(map['id']);
|
||||
itemsBean.name = cast<String>(map['name']);
|
||||
itemsBean.articul = cast<String>(map['articul']);
|
||||
itemsBean.cnt = cast<double>(map['cnt']);
|
||||
itemsBean.price = cast<double>(map['price']);
|
||||
itemsBean.excise = cast<String>(map['excise']);
|
||||
return itemsBean;
|
||||
}
|
||||
|
||||
Map toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'articul': articul,
|
||||
'cnt': cnt,
|
||||
'price': price,
|
||||
'excise': excise,
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
import 'package:satu/core/utils/utils_parse.dart';
|
||||
|
||||
/// code : 1
|
||||
/// name : "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
|
||||
class OperatorBean {
|
||||
int? code;
|
||||
String? name;
|
||||
|
||||
static OperatorBean? fromMap(dynamic map) {
|
||||
if (map == null) return null;
|
||||
OperatorBean operatorBean = OperatorBean();
|
||||
operatorBean.code = cast<int>(map['code']);
|
||||
operatorBean.name = cast<String>(map['name']);
|
||||
return operatorBean;
|
||||
}
|
||||
|
||||
Map toJson() => {
|
||||
'code': code,
|
||||
'name': name,
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
import 'package:satu/core/utils/utils_parse.dart';
|
||||
|
||||
/// size : 14
|
||||
/// text : null
|
||||
/// center : true
|
||||
/// name : "toptext"
|
||||
/// value : null
|
||||
|
||||
class CheckRowsBean {
|
||||
late int size;
|
||||
String? text;
|
||||
late bool center;
|
||||
String? name;
|
||||
String? value;
|
||||
|
||||
static CheckRowsBean fromMap(dynamic map) {
|
||||
CheckRowsBean rowsBean = CheckRowsBean();
|
||||
rowsBean.size = cast<int>(map['size']) ?? 14;
|
||||
rowsBean.text = cast<String>(map['text']);
|
||||
rowsBean.center = cast<bool>(map['center']) ?? false;
|
||||
rowsBean.name = cast<String>(map['name']);
|
||||
rowsBean.value = cast<String>(map['value']);
|
||||
return rowsBean;
|
||||
}
|
||||
|
||||
Map toJson() => {
|
||||
'size': size,
|
||||
'text': text,
|
||||
'center': center,
|
||||
'name': name,
|
||||
'value': value,
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
import 'package:satu/core/utils/utils_parse.dart';
|
||||
|
||||
import 'items_bean.dart';
|
||||
import 'operator_bean.dart';
|
||||
|
||||
class SellRequest {
|
||||
String? type;
|
||||
List<ItemsBean> items = [];
|
||||
int card = 0;
|
||||
int nal = 0;
|
||||
String? invoiceId;
|
||||
String? section;
|
||||
OperatorBean? operator;
|
||||
String? contragent;
|
||||
|
||||
static SellRequest fromMap(dynamic map) {
|
||||
final SellRequest sellRequestBean = SellRequest();
|
||||
sellRequestBean.type = cast<String>(map['type']);
|
||||
sellRequestBean.items.addAll(
|
||||
(map['items'] as List ?? []).map((o) => ItemsBean.fromMap(o))
|
||||
);
|
||||
sellRequestBean.card = cast<int>(map['card']) ?? 0;
|
||||
sellRequestBean.nal = cast<int>(map['nal']) ?? 0;
|
||||
sellRequestBean.invoiceId = cast<String>(map['invoice_id']);
|
||||
sellRequestBean.section = cast<String>(map['section']);
|
||||
sellRequestBean.operator = OperatorBean.fromMap(map['operator']);
|
||||
sellRequestBean.contragent = cast<String>(map['contragent']);
|
||||
return sellRequestBean;
|
||||
}
|
||||
|
||||
Map toJson() => {
|
||||
'type': type,
|
||||
'items': items,
|
||||
'card': card,
|
||||
'nal': nal,
|
||||
'invoice_id': invoiceId,
|
||||
'section': section,
|
||||
'operator': operator,
|
||||
'contragent': contragent,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
import 'package:satu/core/utils/utils_parse.dart';
|
||||
|
||||
import 'check_bean.dart';
|
||||
import 'info_bean.dart';
|
||||
|
||||
class SellResponse {
|
||||
int? journalId;
|
||||
CheckBean? check;
|
||||
String? checkPng;
|
||||
String? checkTxt;
|
||||
InfoBean? info;
|
||||
String? message;
|
||||
late bool operation;
|
||||
|
||||
static SellResponse? fromMap(dynamic map) {
|
||||
if (map == null) return null;
|
||||
final SellResponse sellResponseBean = SellResponse();
|
||||
sellResponseBean.journalId = cast<int>(map['journal_id']);
|
||||
sellResponseBean.check = CheckBean.fromMap(map['check']);
|
||||
sellResponseBean.checkPng = cast<String>(map['check_png']);
|
||||
sellResponseBean.checkTxt = cast<String>(map['check_txt']);
|
||||
sellResponseBean.info = InfoBean.fromMap(map['info']);
|
||||
sellResponseBean.message = cast<String>(map['message']);
|
||||
sellResponseBean.operation = cast<bool>(map['operation']) ?? false;
|
||||
return sellResponseBean;
|
||||
}
|
||||
|
||||
Map toJson() => {
|
||||
'journal_id': journalId,
|
||||
'check': check,
|
||||
'check_png': checkPng,
|
||||
'check_txt': checkTxt,
|
||||
'info': info,
|
||||
'message': message,
|
||||
'operation': operation,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -13,4 +13,8 @@ class DataService extends BaseService {
|
|||
|
||||
|
||||
|
||||
Future<bool> sellBtnHandler() async {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,14 +62,11 @@ class _GoodEditState extends State<GoodEdit> {
|
|||
} else if (id == 0) {
|
||||
name = 'Корневая категория';
|
||||
} else {
|
||||
log.i('message $id');
|
||||
final Category? category = await _dictionaryService.getCategoryById(id);
|
||||
if (category != null) {
|
||||
name = category.name;
|
||||
}
|
||||
log.i('message $name');
|
||||
}
|
||||
|
||||
setState(() {
|
||||
parentCategoryName = name;
|
||||
parentCategoryId = id;
|
||||
|
|
|
|||
Loading…
Reference in New Issue