add logic
parent
c76bc5f9d2
commit
8789160234
|
|
@ -36,17 +36,17 @@ ThunkAction<AppState> addSellItem({Good good, String excise}) {
|
|||
|
||||
Transaction transaction;
|
||||
|
||||
if (uuid != null && good !=null) {
|
||||
if (uuid != null && good != null) {
|
||||
List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere(
|
||||
TransactionTableName,
|
||||
'$TransactionColumnAppCompanyId = ? and $TransactionColumnStatus = ? and ${TransactionColumnType} = ?',
|
||||
[appCompanyId, TransactionStatusPrepare, TransactionTypeSell],
|
||||
orderBy: '$TransactionColumnCreatedAt desc');
|
||||
if (set.isNotEmpty) {
|
||||
for(Map<String, dynamic> map in set) {
|
||||
for (Map<String, dynamic> map in set) {
|
||||
Transaction _transaction = Transaction.fromMap(map);
|
||||
ProductDao _product = ProductDao.fromMap(jsonDecode(_transaction.data));
|
||||
if(_product.id == good.id) {
|
||||
if (_product.id == good.id && _product.excise == excise) {
|
||||
transaction = _transaction;
|
||||
break;
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ ThunkAction<AppState> addSellItem({Good good, String excise}) {
|
|||
}
|
||||
}
|
||||
|
||||
if(transaction !=null) {
|
||||
if (transaction != null) {
|
||||
ProductDao item = ProductDao.fromMap(jsonDecode(transaction.data));
|
||||
item..count = item.count + 1;
|
||||
transaction.data = jsonEncode(item.toMap());
|
||||
|
|
|
|||
Loading…
Reference in New Issue