|
@@ -234,17 +234,7 @@ module.exports = app => {
|
|
|
searchsql.mid = midList;
|
|
|
}
|
|
|
// 取所有工料表
|
|
|
- const materialBillsData = await ctx.service.materialBills.getAllDataByCondition({ where: searchsql });
|
|
|
- // 取对应期的截取上期的调差金额和应耗数量
|
|
|
- if (ctx.material.highOrder !== ctx.material.order) {
|
|
|
- for (const [mindex, mb] of materialBillsData.entries()) {
|
|
|
- const result = await ctx.service.materialBillsHistory.getByMbId(ctx.material.id, ctx.material.order, mb.id);
|
|
|
- _.forEach(result, function(value, key) {
|
|
|
- materialBillsData[mindex][key] = result ? result[key] : null;
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- return materialBillsData;
|
|
|
+ return await ctx.service.materialBills.getAllDataByCondition({ where: searchsql });
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -267,7 +257,8 @@ module.exports = app => {
|
|
|
mb_id: mbd.id,
|
|
|
};
|
|
|
for (const m of material_month) {
|
|
|
- const one_mm = _.find(materialMonthList, { mb_id: mbd.mb_id, yearmonth: m });
|
|
|
+ const mb_id = ctx.material.highOrder !== ctx.material.order ? mbd.mb_id : mbd.id;
|
|
|
+ const one_mm = _.find(materialMonthList, { mb_id, yearmonth: m });
|
|
|
one_mb[m] = one_mm.msg_tp;
|
|
|
}
|
|
|
monthsList.push(one_mb);
|
|
@@ -286,6 +277,15 @@ module.exports = app => {
|
|
|
await this._getMaterialAuditViewData(ctx);
|
|
|
const renderData = await this._getDefaultRenderData(ctx);
|
|
|
renderData.materialBillsData = await this._getMaterialBillsData(ctx);
|
|
|
+ // 取对应期的截取上期的调差金额和应耗数量
|
|
|
+ if (ctx.material.highOrder !== ctx.material.order) {
|
|
|
+ for (const [mindex, mb] of renderData.materialBillsData.entries()) {
|
|
|
+ const result = await ctx.service.materialBillsHistory.getByMbId(ctx.material.id, ctx.material.order, mb.id);
|
|
|
+ _.forEach(result, function(value, key) {
|
|
|
+ renderData.materialBillsData[mindex][key] = result ? result[key] : null;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
// 取所有已被调用的工料清单表
|
|
|
renderData.materialListData = await ctx.service.materialList.getAllDataByCondition({ tid: ctx.tender.id, mid: ctx.material.id });
|
|
|
// 基数
|