|
@@ -96,64 +96,71 @@ module.exports = app => {
|
|
* @returns {Promise<{}>}
|
|
* @returns {Promise<{}>}
|
|
* @private
|
|
* @private
|
|
*/
|
|
*/
|
|
- async _addStagePosData(transaction, data) {
|
|
|
|
|
|
+ async _addStagePosData(data) {
|
|
let bills , precision;
|
|
let bills , precision;
|
|
const result = {pos: [], ledger: []};
|
|
const result = {pos: [], ledger: []};
|
|
const datas = data instanceof Array ? data : [data], calcBills = [], calcStageBills = [];
|
|
const datas = data instanceof Array ? data : [data], calcBills = [], calcStageBills = [];
|
|
|
|
|
|
- for (const d of datas) {
|
|
|
|
- if (d.sgfh_qty !== undefined || d.sjcl_qty !== undefined || d.qtcl_qty !== undefined) {
|
|
|
|
- if (!bills || bills.id !== data.lid) {
|
|
|
|
- bills = await this.ctx.service.ledger.getDataById(d.lid);
|
|
|
|
- precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, bills.unit);
|
|
|
|
|
|
+ const transaction = await this.db.beginTransaction();
|
|
|
|
+ try {
|
|
|
|
+ for (const d of datas) {
|
|
|
|
+ if (d.sgfh_qty !== undefined || d.sjcl_qty !== undefined || d.qtcl_qty !== undefined) {
|
|
|
|
+ if (!bills || bills.id !== data.lid) {
|
|
|
|
+ bills = await this.ctx.service.ledger.getDataById(d.lid);
|
|
|
|
+ precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, bills.unit);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- // 在主表pos中新增数据
|
|
|
|
- const p = {
|
|
|
|
- id: this.uuid.v4(), tid: this.ctx.tender.id, lid: d.lid, name: d.name, porder: d.porder,
|
|
|
|
- add_stage: this.ctx.stage.id,
|
|
|
|
- add_times: this.ctx.stage.curTimes,
|
|
|
|
- add_user: this.ctx.session.sessionUser.accountId,
|
|
|
|
- };
|
|
|
|
- if (d.sgfh_qty) p.sgfh_qty = this.round(d.sgfh_qty, precision.value);
|
|
|
|
- if (d.sjcl_qty) p.sjcl_qty = this.round(d.sjcl_qty, precision.value);
|
|
|
|
- if (d.qtcl_qty) p.qtcl_qty = this.round(d.qtcl_qty, precision.value);
|
|
|
|
- p.quantity = this.ctx.helper.sum([p.sgfh_qty, p.sjcl_qty, p.qtcl_qty]);
|
|
|
|
- const addRst = await transaction.insert(this.ctx.service.pos.tableName, p);
|
|
|
|
- result.pos.push(p.id);
|
|
|
|
- // 如果存在复核数据,更新计算主表清单
|
|
|
|
- if (p.sgfh_qty || p.sjcl_qty || p.qtcl_qty) {
|
|
|
|
- calcBills.push(p.lid);
|
|
|
|
- result.ledger.push(p.lid);
|
|
|
|
- }
|
|
|
|
- // 如果存在本期计算数据,更新计算清单本期计量数据
|
|
|
|
- if (d.contract_qty || d.qc_qty || d.postil) {
|
|
|
|
- const ps = {
|
|
|
|
- pid: d.id,
|
|
|
|
- lid: d.lid,
|
|
|
|
- tid: this.ctx.tender.id,
|
|
|
|
- sid: this.ctx.stage.id,
|
|
|
|
- said: this.ctx.session.sessionUser.accountId,
|
|
|
|
- times: this.ctx.stage.curTimes,
|
|
|
|
- order: this.ctx.stage.curOrder,
|
|
|
|
|
|
+ // 在主表pos中新增数据
|
|
|
|
+ const p = {
|
|
|
|
+ id: this.uuid.v4(), tid: this.ctx.tender.id, lid: d.lid, name: d.name, porder: d.porder,
|
|
|
|
+ add_stage: this.ctx.stage.id,
|
|
|
|
+ add_times: this.ctx.stage.curTimes,
|
|
|
|
+ add_user: this.ctx.session.sessionUser.accountId,
|
|
};
|
|
};
|
|
- if (d.contract_qty) ps.contract_qty = this.round(d.contract_qty, precision.value);
|
|
|
|
- if (d.qc_qty) ps.qc_qty = this.round(d.qc_qty, precision.value);
|
|
|
|
- if (d.postil) ps.postil = d.postil;
|
|
|
|
- await transaction.insert(ps);
|
|
|
|
- if (d.contract_qty || d.qc_qty) {
|
|
|
|
- calcStageBills.push(ps.lid);
|
|
|
|
|
|
+ if (d.sgfh_qty) p.sgfh_qty = this.round(d.sgfh_qty, precision.value);
|
|
|
|
+ if (d.sjcl_qty) p.sjcl_qty = this.round(d.sjcl_qty, precision.value);
|
|
|
|
+ if (d.qtcl_qty) p.qtcl_qty = this.round(d.qtcl_qty, precision.value);
|
|
|
|
+ p.quantity = this.ctx.helper.sum([p.sgfh_qty, p.sjcl_qty, p.qtcl_qty]);
|
|
|
|
+ const addRst = await transaction.insert(this.ctx.service.pos.tableName, p);
|
|
|
|
+ result.pos.push(p.id);
|
|
|
|
+ // 如果存在复核数据,更新计算主表清单
|
|
|
|
+ if (p.sgfh_qty || p.sjcl_qty || p.qtcl_qty) {
|
|
|
|
+ calcBills.push(p.lid);
|
|
|
|
+ result.ledger.push(p.lid);
|
|
|
|
+ }
|
|
|
|
+ // 如果存在本期计算数据,更新计算清单本期计量数据
|
|
|
|
+ if (d.contract_qty || d.qc_qty || d.postil) {
|
|
|
|
+ const ps = {
|
|
|
|
+ pid: d.id,
|
|
|
|
+ lid: d.lid,
|
|
|
|
+ tid: this.ctx.tender.id,
|
|
|
|
+ sid: this.ctx.stage.id,
|
|
|
|
+ said: this.ctx.session.sessionUser.accountId,
|
|
|
|
+ times: this.ctx.stage.curTimes,
|
|
|
|
+ order: this.ctx.stage.curOrder,
|
|
|
|
+ };
|
|
|
|
+ if (d.contract_qty) ps.contract_qty = this.round(d.contract_qty, precision.value);
|
|
|
|
+ if (d.qc_qty) ps.qc_qty = this.round(d.qc_qty, precision.value);
|
|
|
|
+ if (d.postil) ps.postil = d.postil;
|
|
|
|
+ await transaction.insert(ps);
|
|
|
|
+ if (d.contract_qty || d.qc_qty) {
|
|
|
|
+ calcStageBills.push(ps.lid);
|
|
|
|
+ }
|
|
|
|
+ result.stageUpdate = true;
|
|
}
|
|
}
|
|
- result.stageUpdate = true;
|
|
|
|
}
|
|
}
|
|
|
|
+ for (const lid of calcBills) {
|
|
|
|
+ await this.ctx.service.ledger.calc(this.ctx.tender.id, lid, transaction);
|
|
|
|
+ }
|
|
|
|
+ for (const lid of calcStageBills) {
|
|
|
|
+ await this.ctx.service.stageBills.calc(ctx.tender.id, ctx.stage.id, lid, transaction);
|
|
|
|
+ }
|
|
|
|
+ await transaction.commit();
|
|
|
|
+ return result;
|
|
|
|
+ } catch(err) {
|
|
|
|
+ await transaction.rollback();
|
|
|
|
+ throw err;
|
|
}
|
|
}
|
|
- for (const lid of calcBills) {
|
|
|
|
- await this.ctx.service.ledger.calc(this.ctx.tender.id, lid, transaction);
|
|
|
|
- }
|
|
|
|
- for (const lid of calcStageBills) {
|
|
|
|
- await this.ctx.service.stageBills.calc(ctx.tender.id, ctx.stage.id, lid, transaction);
|
|
|
|
- }
|
|
|
|
- return result;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -164,65 +171,73 @@ module.exports = app => {
|
|
* @returns {Promise<{ledger: Array, pos: Array}>}
|
|
* @returns {Promise<{ledger: Array, pos: Array}>}
|
|
* @private
|
|
* @private
|
|
*/
|
|
*/
|
|
- async _updateStagePosData(transaction, data) {
|
|
|
|
|
|
+ async _updateStagePosData(data) {
|
|
let bills, precision;
|
|
let bills, precision;
|
|
const result = {ledger: [], pos: [], stageUpdate: true}, ledgerCalc = [];
|
|
const result = {ledger: [], pos: [], stageUpdate: true}, ledgerCalc = [];
|
|
const datas = data instanceof Array ? data : [data];
|
|
const datas = data instanceof Array ? data : [data];
|
|
const orgPos = await this.ctx.service.pos.getPosDataByIds(this._.map(datas, 'pid'));
|
|
const orgPos = await this.ctx.service.pos.getPosDataByIds(this._.map(datas, 'pid'));
|
|
const orgStagePos = await this.getLastestStageData(this.ctx.tender.id, this.ctx.stage.id, {pid: this._.map(datas, 'pid')});
|
|
const orgStagePos = await this.getLastestStageData(this.ctx.tender.id, this.ctx.stage.id, {pid: this._.map(datas, 'pid')});
|
|
- for (const d of datas) {
|
|
|
|
- if (d.sgfh_qty || d.qtcl_qty || d.sjcl_qty || d.contract_qty || d.qc_qty) {
|
|
|
|
- if (!bills || bills.id !== data.lid) {
|
|
|
|
- bills = await this.ctx.service.ledger.getDataById(d.lid);
|
|
|
|
- precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, bills.unit);
|
|
|
|
|
|
+
|
|
|
|
+ const transaction = await this.db.beginTransaction();
|
|
|
|
+ try {
|
|
|
|
+ for (const d of datas) {
|
|
|
|
+ if (d.sgfh_qty || d.qtcl_qty || d.sjcl_qty || d.contract_qty || d.qc_qty) {
|
|
|
|
+ if (!bills || bills.id !== data.lid) {
|
|
|
|
+ bills = await this.ctx.service.ledger.getDataById(d.lid);
|
|
|
|
+ precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, bills.unit);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if (d.name !== undefined || d.sgfh_qty !== undefined || d.qtcl_qty !== undefined || d.sjcl_qty !== undefined) {
|
|
|
|
- const p = {id: d.pid};
|
|
|
|
- if (d.name !== undefined) p.name = d.name;
|
|
|
|
- if (d.sgfh_qty !== undefined || d.qtcl_qty !== undefined || d.sjcl_qty !== undefined) {
|
|
|
|
- const op = this._.find(orgPos, {id: d.pid});
|
|
|
|
- p.sgfh_qty = d.sgfh_qty !== undefined ? d.sgfh_qty : op.sgfh_qty;
|
|
|
|
- p.sjcl_qty = d.sjcl_qty !== undefined ? d.sjcl_qty : op.sjcl_qty;
|
|
|
|
- p.qtcl_qty = d.qtcl_qty !== undefined ? d.qtcl_qty : op.qtcl_qty;
|
|
|
|
- p.quantity = this.ctx.helper.sum([p.sgfh_qty, p.sjcl_qty, p.qtcl_qty]);
|
|
|
|
- if (ledgerCalc.indexOf(op.lid) === -1) {
|
|
|
|
- ledgerCalc.push(op.lid);
|
|
|
|
|
|
+ if (d.name !== undefined || d.sgfh_qty !== undefined || d.qtcl_qty !== undefined || d.sjcl_qty !== undefined) {
|
|
|
|
+ const p = {id: d.pid};
|
|
|
|
+ if (d.name !== undefined) p.name = d.name;
|
|
|
|
+ if (d.sgfh_qty !== undefined || d.qtcl_qty !== undefined || d.sjcl_qty !== undefined) {
|
|
|
|
+ const op = this._.find(orgPos, {id: d.pid});
|
|
|
|
+ p.sgfh_qty = d.sgfh_qty !== undefined ? d.sgfh_qty : op.sgfh_qty;
|
|
|
|
+ p.sjcl_qty = d.sjcl_qty !== undefined ? d.sjcl_qty : op.sjcl_qty;
|
|
|
|
+ p.qtcl_qty = d.qtcl_qty !== undefined ? d.qtcl_qty : op.qtcl_qty;
|
|
|
|
+ p.quantity = this.ctx.helper.sum([p.sgfh_qty, p.sjcl_qty, p.qtcl_qty]);
|
|
|
|
+ if (ledgerCalc.indexOf(op.lid) === -1) {
|
|
|
|
+ ledgerCalc.push(op.lid);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ await transaction.update(this.ctx.service.pos.tableName, p);
|
|
}
|
|
}
|
|
- await transaction.update(this.ctx.service.pos.tableName, p);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- if (d.contract_qty !== undefined || d.qc_qty !== undefined || d.postil !== undefined) {
|
|
|
|
- const sp = {pid: d.pid, lid: d.lid, contract_qty: d.contract_qty, qc_qty: d.qc_qty, postil: d.postil};
|
|
|
|
- const osp = this._.find(orgStagePos, function (p) { return p.pid === d.pid; });
|
|
|
|
- if (precision) {
|
|
|
|
- this.ctx.helper.checkFieldPrecision(sp, this.qtyFields, precision.value);
|
|
|
|
|
|
+ if (d.contract_qty !== undefined || d.qc_qty !== undefined || d.postil !== undefined) {
|
|
|
|
+ const sp = {pid: d.pid, lid: d.lid, contract_qty: d.contract_qty, qc_qty: d.qc_qty, postil: d.postil};
|
|
|
|
+ const osp = this._.find(orgStagePos, function (p) { return p.pid === d.pid; });
|
|
|
|
+ if (precision) {
|
|
|
|
+ this.ctx.helper.checkFieldPrecision(sp, this.qtyFields, precision.value);
|
|
|
|
+ }
|
|
|
|
+ if (osp && osp.times === this.ctx.stage.curTimes && osp.order === this.ctx.stage.curOrder) {
|
|
|
|
+ await transaction.update(this.tableName, d, {where: {id: osp.id}});
|
|
|
|
+ } else {
|
|
|
|
+ sp.tid = this.ctx.tender.id;
|
|
|
|
+ sp.sid = this.ctx.stage.id;
|
|
|
|
+ sp.said = this.ctx.session.sessionUser.accountId;
|
|
|
|
+ sp.times = this.ctx.stage.curTimes;
|
|
|
|
+ sp.order = this.ctx.stage.curOrder;
|
|
|
|
+ await transaction.insert(this.tableName, sp);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (osp && osp.times === this.ctx.stage.curTimes && osp.order === this.ctx.stage.curOrder) {
|
|
|
|
- await transaction.update(this.tableName, d, {where: {id: osp.id}});
|
|
|
|
- } else {
|
|
|
|
- sp.tid = this.ctx.tender.id;
|
|
|
|
- sp.sid = this.ctx.stage.id;
|
|
|
|
- sp.said = this.ctx.session.sessionUser.accountId;
|
|
|
|
- sp.times = this.ctx.stage.curTimes;
|
|
|
|
- sp.order = this.ctx.stage.curOrder;
|
|
|
|
- await transaction.insert(this.tableName, sp);
|
|
|
|
|
|
+ result.pos.push(d.pid);
|
|
|
|
+ if ((d.sgfh_qty !== undefined || d.qtcl_qty !== undefined || d.sjcl_qty !== undefined ||
|
|
|
|
+ d.contract_qty === undefined || d.qc_qty === undefined) && (result.ledger.indexOf(d.lid) === -1)) {
|
|
|
|
+ result.ledger.push(d.lid);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- result.pos.push(d.pid);
|
|
|
|
- if ((d.sgfh_qty !== undefined || d.qtcl_qty !== undefined || d.sjcl_qty !== undefined ||
|
|
|
|
- d.contract_qty === undefined || d.qc_qty === undefined) && (result.ledger.indexOf(d.lid) === -1)) {
|
|
|
|
- result.ledger.push(d.lid);
|
|
|
|
|
|
+ for (const lid of ledgerCalc) {
|
|
|
|
+ await this.ctx.service.ledger.calc(this.ctx.tender.id, lid, transaction);
|
|
}
|
|
}
|
|
|
|
+ for (const lid of result.ledger) {
|
|
|
|
+ await this.ctx.service.stageBills.calc(this.ctx.tender.id, this.ctx.stage.id, lid, transaction);
|
|
|
|
+ }
|
|
|
|
+ await transaction.commit();
|
|
|
|
+ return result;
|
|
|
|
+ } catch (err) {
|
|
|
|
+ await transaction.rollback();
|
|
|
|
+ throw err;
|
|
}
|
|
}
|
|
- for (const lid of ledgerCalc) {
|
|
|
|
- await this.ctx.service.ledger.calc(this.ctx.tender.id, lid, transaction);
|
|
|
|
- }
|
|
|
|
- for (const lid of result.ledger) {
|
|
|
|
- await this.ctx.service.stageBills.calc(this.ctx.tender.id, this.ctx.stage.id, lid, transaction);
|
|
|
|
- }
|
|
|
|
- return result;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -233,9 +248,9 @@ module.exports = app => {
|
|
* @returns {Promise<{}>}
|
|
* @returns {Promise<{}>}
|
|
* @private
|
|
* @private
|
|
*/
|
|
*/
|
|
- async _deleteStagePosData(transaction, data) {
|
|
|
|
- const result = {};
|
|
|
|
|
|
+ async _deleteStagePosData(data) {
|
|
const pos = await this.ctx.service.pos.getPosData({tid: this.ctx.tender.id, id: data});
|
|
const pos = await this.ctx.service.pos.getPosData({tid: this.ctx.tender.id, id: data});
|
|
|
|
+ const result = { pos: data, isDeletePos: true};
|
|
if (pos instanceof Array) {
|
|
if (pos instanceof Array) {
|
|
for (const p of pos) {
|
|
for (const p of pos) {
|
|
if (p.add_stage !== this.ctx.stage.id || p.add_times !== this.ctx.stage.curTimes || p.add_user !== this.ctx.session.sessionUser.accountId) {
|
|
if (p.add_stage !== this.ctx.stage.id || p.add_times !== this.ctx.stage.curTimes || p.add_user !== this.ctx.session.sessionUser.accountId) {
|
|
@@ -246,20 +261,28 @@ module.exports = app => {
|
|
throw '您无权删除该数据';
|
|
throw '您无权删除该数据';
|
|
}
|
|
}
|
|
const ledgerIds = this._.map(pos, 'lid');
|
|
const ledgerIds = this._.map(pos, 'lid');
|
|
- // 删除部位明细
|
|
|
|
- await transaction.delete(this.ctx.service.pos.tableName, {tid: this.ctx.tender.id, id: data});
|
|
|
|
- for (const lid of ledgerIds) {
|
|
|
|
- await this.ctx.service.ledger.calc(tid, lid, transaction);
|
|
|
|
- }
|
|
|
|
- // 删除部位明细计量数据
|
|
|
|
- await transaction.delete(this.tableName, {tid: this.ctx.tender.id, lid: data});
|
|
|
|
- for (const lid of ledgerIds) {
|
|
|
|
- await this.ctx.service.stageBills.calc(this.ctx.tender.id, this.ctx.stage.id, lid, transaction);
|
|
|
|
|
|
+
|
|
|
|
+ const transaction = await this.db.beginTransaction();
|
|
|
|
+ try {
|
|
|
|
+ // 删除部位明细
|
|
|
|
+ await transaction.delete(this.ctx.service.pos.tableName, {tid: this.ctx.tender.id, id: data});
|
|
|
|
+ for (const lid of ledgerIds) {
|
|
|
|
+ await this.ctx.service.ledger.calc(this.ctx.tender.id, lid, transaction);
|
|
|
|
+ }
|
|
|
|
+ // 删除部位明细计量数据
|
|
|
|
+ await transaction.delete(this.tableName, {tid: this.ctx.tender.id, lid: data});
|
|
|
|
+ for (const lid of ledgerIds) {
|
|
|
|
+ await this.ctx.service.stageBills.calc(this.ctx.tender.id, this.ctx.stage.id, lid, transaction);
|
|
|
|
+ }
|
|
|
|
+ await transaction.commit();
|
|
|
|
+ // 获取需要更新的数据
|
|
|
|
+ result.ledger = ledgerIds;
|
|
|
|
+ result.stageUpdate = true;
|
|
|
|
+ return result;
|
|
|
|
+ } catch (err) {
|
|
|
|
+ await transaction.rollback();
|
|
|
|
+ throw err;
|
|
}
|
|
}
|
|
- // 获取需要更新的数据
|
|
|
|
- result.ledger = ledgerIds;
|
|
|
|
- result.stageUpdate = true;
|
|
|
|
- return result;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -269,28 +292,21 @@ module.exports = app => {
|
|
* @returns {Promise<{ledger: {}, pos: {}}>}
|
|
* @returns {Promise<{ledger: {}, pos: {}}>}
|
|
*/
|
|
*/
|
|
async updateStageData(data) {
|
|
async updateStageData(data) {
|
|
|
|
+ if ((data.updateType === 'add' || data.upateType === 'delete') && this.ctx.tender.measure_type === measureType.tz) {
|
|
|
|
+ throw '台账模式下,不可在计量中新增或删除部位明细,如需操作,请进行台账修订';
|
|
|
|
+ }
|
|
let refreshData;
|
|
let refreshData;
|
|
- const transaction = await this.db.beginTransaction();
|
|
|
|
- try {
|
|
|
|
- if ((data.updateType === 'add' || data.upateType === 'delete') && this.ctx.tender.measure_type === measureType.tz) {
|
|
|
|
- throw '台账模式下,不可在计量中新增或删除部位明细,如需操作,请进行台账修订';
|
|
|
|
- }
|
|
|
|
- if (data.updateType === 'add') {
|
|
|
|
- refreshData = await this._addStagePosData(transaction, data.updateData);
|
|
|
|
- } else if (data.updateType === 'update') {
|
|
|
|
- refreshData = await this._updateStagePosData(transaction, data.updateData);
|
|
|
|
- } else if (data.updateType === 'delete') {
|
|
|
|
- if (!data.updateData || data.updateData.length === 0) {
|
|
|
|
- throw '提交数据错误';
|
|
|
|
- }
|
|
|
|
- refreshData = await this._deleteStagePosData(transaction, data.updateData);
|
|
|
|
- } else {
|
|
|
|
|
|
+ if (data.updateType === 'add') {
|
|
|
|
+ refreshData = await this._addStagePosData(data.updateData);
|
|
|
|
+ } else if (data.updateType === 'update') {
|
|
|
|
+ refreshData = await this._updateStagePosData(data.updateData);
|
|
|
|
+ } else if (data.updateType === 'delete') {
|
|
|
|
+ if (!data.updateData || data.updateData.length === 0) {
|
|
throw '提交数据错误';
|
|
throw '提交数据错误';
|
|
}
|
|
}
|
|
- await transaction.commit();
|
|
|
|
- } catch (err) {
|
|
|
|
- await transaction.rollback();
|
|
|
|
- throw err;
|
|
|
|
|
|
+ refreshData = await this._deleteStagePosData(data.updateData);
|
|
|
|
+ } else {
|
|
|
|
+ throw '提交数据错误';
|
|
}
|
|
}
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -301,10 +317,14 @@ module.exports = app => {
|
|
result.ledger.curStageData = await this.ctx.service.stageBills.getLastestStageData(this.ctx.tender.id, this.ctx.stage.id, refreshData.ledger);
|
|
result.ledger.curStageData = await this.ctx.service.stageBills.getLastestStageData(this.ctx.tender.id, this.ctx.stage.id, refreshData.ledger);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (refreshData.pos && refreshData.pos.length > 0) {
|
|
|
|
- result.pos.pos = await this.ctx.service.pos.getPosData({id: refreshData.pos});
|
|
|
|
- if (refreshData.stageUpdate) {
|
|
|
|
- result.pos.curStageData = await this.getLastestStageData(this.ctx.tender.id, this.ctx.stage.id, {pid: refreshData.pos});
|
|
|
|
|
|
+ if (refreshData.pos) {
|
|
|
|
+ if (refreshData.isDeletePos) {
|
|
|
|
+ result.pos.pos = refreshData.pos;
|
|
|
|
+ } else if (refreshData.pos.length > 0) {
|
|
|
|
+ result.pos.pos = await this.ctx.service.pos.getPosData({id: refreshData.pos});
|
|
|
|
+ if (refreshData.stageUpdate) {
|
|
|
|
+ result.pos.curStageData = await this.getLastestStageData(this.ctx.tender.id, this.ctx.stage.id, {pid: refreshData.pos});
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|