|
@@ -367,6 +367,15 @@ module.exports = app => {
|
|
|
}
|
|
|
searchsql.t_type = materialConst.t_type[0].value;
|
|
|
renderData.materialBillsData = await ctx.service.materialBills.getAllDataByCondition({ where: searchsql });
|
|
|
+ // 取对应期的截取上期的调差金额和应耗数量
|
|
|
+ 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.getMaterialData(ctx.tender.id, ctx.material.id);
|
|
|
renderData.materialNotJoinListData = await ctx.service.materialListNotjoin.getAllDataByCondition({ where: { tid: ctx.tender.id, mid: ctx.material.id } });
|