|
@@ -469,6 +469,13 @@ module.exports = app => {
|
|
const ledgerData = await ctx.service.ledger.getData(ctx.tender.id);
|
|
const ledgerData = await ctx.service.ledger.getData(ctx.tender.id);
|
|
const posData = this.ctx.tender.data.measure_type === measureType.tz.value
|
|
const posData = this.ctx.tender.data.measure_type === measureType.tz.value
|
|
? await ctx.service.pos.getPosData({ tid: ctx.tender.id }) : [];
|
|
? await ctx.service.pos.getPosData({ tid: ctx.tender.id }) : [];
|
|
|
|
+
|
|
|
|
+ const checkDataModel = require('../lib/ledger').checkData;
|
|
|
|
+ const checkData = new checkDataModel(ctx);
|
|
|
|
+ checkData.loadData(ledgerData, posData);
|
|
|
|
+ const sameCodeError = checkData.checkSameCode();
|
|
|
|
+ const siblingError = checkData.checkSibling();
|
|
|
|
+
|
|
const qtyData = ctx.helper.checkBillsWithPos(ledgerData, posData,
|
|
const qtyData = ctx.helper.checkBillsWithPos(ledgerData, posData,
|
|
['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity']);
|
|
['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity']);
|
|
qtyData.error.forEach(x => { x.errorType = 'qty'; });
|
|
qtyData.error.forEach(x => { x.errorType = 'qty'; });
|
|
@@ -478,7 +485,7 @@ module.exports = app => {
|
|
], this.ctx.tender.info.decimal);
|
|
], this.ctx.tender.info.decimal);
|
|
tpData.error.forEach(x => { x.errorType = 'tp'; });
|
|
tpData.error.forEach(x => { x.errorType = 'tp'; });
|
|
ctx.body = { err: 0, msg: '', data: {
|
|
ctx.body = { err: 0, msg: '', data: {
|
|
- error: [...qtyData.error, ...tpData.error],
|
|
|
|
|
|
+ error: [...qtyData.error, ...tpData.error, ...sameCodeError, ...siblingError],
|
|
source: {
|
|
source: {
|
|
bills: [...qtyData.source.bills, ...tpData.source.bills],
|
|
bills: [...qtyData.source.bills, ...tpData.source.bills],
|
|
pos: [...qtyData.source.pos, ...tpData.source.pos],
|
|
pos: [...qtyData.source.pos, ...tpData.source.pos],
|