redux +
null-safety-migration
error500 2021-09-07 12:28:04 +06:00
parent b269c780e7
commit af22647320
3 changed files with 8 additions and 5 deletions

View File

@ -5,9 +5,10 @@ class TransactionData {
TransactionData(); TransactionData();
TransactionData.fromMap(dynamic map) { TransactionData.fromMap(dynamic map) {
contragentName = map['contragentName'] as String; contragentName = cast<String>(map['contragentName']) ?? '';
card = map['card'] as double; card = cast<double>(map['card']) ?? 0;
nal = map['nal'] as double; nal = cast<double>(map['nal']) ?? 0;
total = cast<double>(map['total']) ?? 0;
sellResponse = map['sellResponse'] != null sellResponse = map['sellResponse'] != null
? SellResponse.fromMap(map['sellResponse']) ? SellResponse.fromMap(map['sellResponse'])
: null; : null;
@ -24,6 +25,7 @@ class TransactionData {
'contragentName': contragentName, 'contragentName': contragentName,
'card': card, 'card': card,
'nal': nal, 'nal': nal,
'total' : total,
'sellResponse': sellResponse 'sellResponse': sellResponse
}; };
return map; return map;

View File

@ -48,10 +48,10 @@ Future<void> loadJournalData(Store<AppState> store) async {
final List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere( final List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere(
transactionTableName, transactionTableName,
'$transactionColumnAppCompanyId = ?' '$transactionColumnAppCompanyId = ?'
' and $transactionColumnStatus = ?' ' and $transactionColumnStatus = ?'
' and $transactionColumnType = ?', ' and $transactionColumnType = ?',
[appCompanyId, transactionStatusFinish, transactionTypeSell], [appCompanyId, transactionStatusFinish, transactionTypeSell],
orderBy: '$transactionColumnCreatedAt desc'); orderBy: '$transactionColumnCreatedAt asc');
log.i(set.length); log.i(set.length);
final List<TransactionDao> list = []; final List<TransactionDao> list = [];

View File

@ -81,6 +81,7 @@ class DataService extends BaseService {
data.nal = nal; data.nal = nal;
data.total = total; data.total = total;
transaction.data = jsonEncode(data.toMap()); transaction.data = jsonEncode(data.toMap());
log.i(jsonEncode(data.toMap()));
await _db.update(transactionTableName, transaction.toMap()); await _db.update(transactionTableName, transaction.toMap());
} }