|
@@ -1266,7 +1266,7 @@ module.exports = app => {
|
|
|
|
|
|
async _gatherStageJgcl(tender, stage) {
|
|
|
const data = await this.ctx.service.stageJgcl.getStageData(stage);
|
|
|
- const preData = stage.order > 1 ? await this.ctx.service.stageJgcl.getPreStageData(stage.order) : 0;
|
|
|
+ const preData = stage.order > 1 ? await this.ctx.service.stageJgcl.getPreStageData(stage.tid, stage.order) : 0;
|
|
|
for (const d of data) {
|
|
|
const pd = this.ctx.helper._.find(preData, {uuid: d.uuid});
|
|
|
if (pd) {
|
|
@@ -1331,7 +1331,7 @@ module.exports = app => {
|
|
|
}
|
|
|
|
|
|
async _gatherStageBonus(tender, stage) {
|
|
|
- const data = await this.ctx.service.stageBonus.getEndStageData(stage.order);
|
|
|
+ const data = await this.ctx.service.stageBonus.getEndStageData(tender.id, stage.order);
|
|
|
for (const d of data) {
|
|
|
const names = this.ctx.helper._.map(d.proof_file, function (x) {
|
|
|
return x.filename + x.fileext;
|
|
@@ -1369,6 +1369,7 @@ module.exports = app => {
|
|
|
this.resultStageBonus = [];
|
|
|
const gsSetting = JSON.parse(gsDefine.setting);
|
|
|
for (const tender of gsCustom.tenders) {
|
|
|
+ console.log(tender, gsSetting.type);
|
|
|
switch (gsSetting.type) {
|
|
|
case 'month':
|
|
|
await this._gatherMonthStageBonus(tender, gsCustom.month);
|
|
@@ -1389,7 +1390,7 @@ module.exports = app => {
|
|
|
|
|
|
async _gatherStageOther(tender, stage) {
|
|
|
const data = await this.ctx.service.stageOther.getStageData(stage);
|
|
|
- const preData = stage.order > 1 ? await this.ctx.service.stageOther.getPreStageData(stage.order) : [];
|
|
|
+ const preData = stage.order > 1 ? await this.ctx.service.stageOther.getPreStageData(stage.tid, stage.order) : [];
|
|
|
for (const d of data) {
|
|
|
const pd = this.ctx.helper._.find(preData, {uuid: d.uuid});
|
|
|
if (pd) {
|
|
@@ -1448,7 +1449,7 @@ module.exports = app => {
|
|
|
|
|
|
async _gatherStageSafeProd(tender, stage) {
|
|
|
const data = await this.ctx.service.stageSafeProd.getStageData(stage);
|
|
|
- const preData = stage.order > 1 ? await this.ctx.service.stageSafeProd.getPreStageData(stage.order) : [];
|
|
|
+ const preData = stage.order > 1 ? await this.ctx.service.stageSafeProd.getPreStageData(stage.tid, stage.order) : [];
|
|
|
for (const d of data) {
|
|
|
const pd = this.ctx.helper._.find(preData, {uuid: d.uuid});
|
|
|
if (pd) {
|
|
@@ -1461,11 +1462,11 @@ module.exports = app => {
|
|
|
const helper = this.ctx.helper;
|
|
|
for (const d of data) {
|
|
|
let gd = this.resultStageSafeProd.find(x => {
|
|
|
- return x.name === d.name && x.unit === d.unit && helper.checkNumEqual(x.unit_price, d.unit_price);
|
|
|
+ return x.name === d.name && x.unit === d.unit && helper.numEqual(x.unit_price, d.unit_price);
|
|
|
});
|
|
|
if (!gd) {
|
|
|
gd = { name: d.name, unit: d.unit, unit_price: d.unit_price };
|
|
|
- this.resultStageSafeProd.push(d);
|
|
|
+ this.resultStageSafeProd.push(gd);
|
|
|
}
|
|
|
gd.s_quantity = helper.add(gd.s_quantity, d.quantity);
|
|
|
gd.s_total_price = helper.add(gd.s_total_price, d.total_price);
|
|
@@ -1527,7 +1528,7 @@ module.exports = app => {
|
|
|
|
|
|
async _gatherStageTempLand(tender, stage) {
|
|
|
const data = await this.ctx.service.stageTempLand.getStageData(stage);
|
|
|
- const preData = stage.order > 1 ? await this.ctx.service.stageTempLand.getPreStageData(stage.order) : [];
|
|
|
+ const preData = stage.order > 1 ? await this.ctx.service.stageTempLand.getPreStageData(stage.tid, stage.order) : [];
|
|
|
for (const d of data) {
|
|
|
const pd = this.ctx.helper._.find(preData, {uuid: d.uuid});
|
|
|
if (pd) {
|
|
@@ -1541,11 +1542,11 @@ module.exports = app => {
|
|
|
const helper = this.ctx.helper;
|
|
|
for (const d of data) {
|
|
|
let gd = this.resultStageTempLand.find(x => {
|
|
|
- return x.name === d.name && x.unit === d.unit && helper.checkNumEqual(x.unit_price, d.unit_price);
|
|
|
+ return x.name === d.name && x.unit === d.unit && helper.numEqual(x.unit_price, d.unit_price);
|
|
|
});
|
|
|
if (!gd) {
|
|
|
gd = { name: d.name, unit: d.unit, unit_price: d.unit_price };
|
|
|
- this.resultStageTempLand.push(d);
|
|
|
+ this.resultStageTempLand.push(gd);
|
|
|
}
|
|
|
gd.s_qty = helper.add(gd.s_qty, d.qty);
|
|
|
gd.s_tp = helper.add(gd.s_tp, d.tp);
|