|
@@ -643,9 +643,9 @@ module.exports = app => {
|
|
|
* @return {Promise<void>}
|
|
|
*/
|
|
|
async getStageUsedChangeId(sid) {
|
|
|
- const sql = 'SELECT lid, pid, cid, cbid, qty, stimes, sorder FROM ' + this.tableName + ' WHERE sid = ?';
|
|
|
+ const sql = 'SELECT lid, pid, cid, cbid, qty, stimes, sorder, no_value FROM ' + this.tableName + ' WHERE sid = ?';
|
|
|
const curAll = await this.db.query(sql, [sid]);
|
|
|
- const cur = this.ctx.helper.filterLastestData(curAll, ['lid', 'pid', 'cbid'], 'stimes', 'sorder');
|
|
|
+ const cur = this.ctx.helper.filterLastestData(curAll, ['lid', 'pid', 'cbid', 'no_value'], 'stimes', 'sorder');
|
|
|
return this._.map(this._.filter(cur, 'qty'), 'cid');
|
|
|
}
|
|
|
|
|
@@ -684,7 +684,7 @@ module.exports = app => {
|
|
|
' LEFT JOIN ' + this.ctx.service.change.tableName + ' c ON sc.cid = c.cid' +
|
|
|
' WHERE sid = ? ' + (stage.readOnly ? ` and (stimes < ${stage.curTimes} or (stimes = ${stage.curTimes} and sorder <= ${stage.curOrder}))` : '');
|
|
|
let data = await this.db.query(sql, [stage.id]);
|
|
|
- data = helper.filterLastestData(data, ['lid', 'pid', 'cbid'], 'stimes', 'sorder');
|
|
|
+ data = helper.filterLastestData(data, ['lid', 'pid', 'cbid', 'no_value'], 'stimes', 'sorder');
|
|
|
const bqData = [];
|
|
|
for (const d of data) {
|
|
|
if (!d.qty || d.no_value) continue;
|
|
@@ -773,18 +773,18 @@ module.exports = app => {
|
|
|
|
|
|
async getStageMinusChange(stage) {
|
|
|
const data = await this.getAllDataByCondition({ where: { sid: stage.id, minus: 1 } });
|
|
|
- return this.ctx.helper.filterLastestData(data, ['lid', 'pid', 'cbid'], 'stimes', 'sorder');
|
|
|
+ return this.ctx.helper.filterLastestData(data, ['lid', 'pid', 'cbid', 'no_value'], 'stimes', 'sorder');
|
|
|
};
|
|
|
|
|
|
async getBillsMinusQty(stage, lid) {
|
|
|
const data = await this.getAllDataByCondition({ where: { sid: stage.id, lid, minus: 1 } });
|
|
|
- const filter = this.ctx.helper.filterLastestData(data, ['lid', 'pid', 'cbid'], 'stimes', 'sorder');
|
|
|
+ const filter = this.ctx.helper.filterLastestData(data, ['lid', 'pid', 'cbid', 'no_value'], 'stimes', 'sorder');
|
|
|
return { lid, qty: this.ctx.helper.sum(filter.map(x => { return x.qty; })) };
|
|
|
};
|
|
|
|
|
|
async getPosMinusQty(stage, pid) {
|
|
|
const data = await this.getAllDataByCondition({ where: { sid: stage.id, pid, minus: 1 } });
|
|
|
- const filter = this.ctx.helper.filterLastestData(data, ['lid', 'pid', 'cbid'], 'stimes', 'sorder');
|
|
|
+ const filter = this.ctx.helper.filterLastestData(data, ['lid', 'pid', 'cbid', 'no_value'], 'stimes', 'sorder');
|
|
|
return { pid, qty: this.ctx.helper.sum(filter.map(x => { return x.qty; })) };
|
|
|
};
|
|
|
|