|
|
@@ -117,7 +117,7 @@ module.exports = app => {
|
|
|
'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'final_1_tp',
|
|
|
'end_contract_pc_tp', 'end_qc_pc_tp', 'end_pc_tp',
|
|
|
'year_contract_tp', 'year_qc_tp', 'year_contract_pc_tp', 'year_qc_pc_tp', 'year_pc_tp', 'year_gather_tp',
|
|
|
- 'due_qc_tp', 'due_final_tp',
|
|
|
+ 'due_qc_tp', 'due_final_tp', 'tz_qc_tp',
|
|
|
],
|
|
|
calc: function (node, helper, decimal) {
|
|
|
if (node.children && node.children.length === 0) {
|
|
|
@@ -585,6 +585,17 @@ module.exports = app => {
|
|
|
{ data: yearStage, fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'qc_minus_qty', 'contract_pc_tp', 'qc_pc_tp', 'pc_tp', 'gather_qty', 'gather_tp'], prefix: 'year_', relaId: 'lid' },
|
|
|
{ data: changeData, fields: ['qc_qty', 'qc_tp', 'qc_minus_qty'], prefix: 'due_', relaId: 'gcl_id' },
|
|
|
]);
|
|
|
+ if (this._checkFieldsExistReg(fields, 'due_')) {
|
|
|
+ const selfChangeData = await this.ctx.service.changeAuditList.getSelfBillsSum(this.ctx.tender.id);
|
|
|
+ for (const scd of selfChangeData) {
|
|
|
+ const rb = billsData.find(x => { return x.b_code === scd.code && x.name === scd.name && x.unit === scd.unit && x.unit_price === scd.unit_price; });
|
|
|
+ if (rb) {
|
|
|
+ rb.due_qc_qty = this.ctx.helper.add(rb.due_qc_qty, scd.qc_qty);
|
|
|
+ rb.due_qc_tp = this.ctx.helper.add(rb.due_qc_tp, scd.qc_tp);
|
|
|
+ rb.due_qc_minus_qty = this.ctx.helper.add(rb.due_qc_minus_qty, scd.qc_minus_qty);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
billsData.forEach(x => {
|
|
|
if (x.org_price_his && x.org_price_his.length > 0) {
|
|
|
for (const prop of x.org_price_his) {
|
|
|
@@ -597,6 +608,9 @@ module.exports = app => {
|
|
|
|
|
|
const billsTree = this._getNewBillsTree();
|
|
|
billsTree.loadDatas(billsData);
|
|
|
+ const tenderInfo = await this.ctx.service.tenderInfo.getTenderInfo(tender.id);
|
|
|
+ const reCalcChange = await this.ctx.service.change.getReCalcChangeData(tender.id, tenderInfo);
|
|
|
+ Ledger.treeUtils.loadChangeData(billsTree, null, reCalcChange, tenderInfo, this.ctx.helper);
|
|
|
billsTree.calculateAll();
|
|
|
|
|
|
if (this._checkFieldsExist(fields, billsFields.bgl)) {
|
|
|
@@ -666,6 +680,22 @@ module.exports = app => {
|
|
|
{data: prePosStage, fields: ['contract_qty', 'qc_qty', 'qc_minus_qty'], prefix: 'pre_', relaId: 'pid'},
|
|
|
{data: changeData, fields: ['qc_qty', 'qc_minus_qty'], prefix: 'due_', relaId: 'mx_id'},
|
|
|
]);
|
|
|
+ if (this._checkFieldsExistReg(fields, 'due_')) {
|
|
|
+ const selfChangeData = await this.ctx.service.changeAuditList.getSelfBillsSum(this.ctx.tender.id);
|
|
|
+ const billsData = this.ctx.stage.ledgerHis
|
|
|
+ ? await this.ctx.helper.loadLedgerDataFromOss(this.ctx.stage.ledgerHis.bills_file)
|
|
|
+ : await this.ctx.service.ledger.getData(this.ctx.tender.id);
|
|
|
+ for (const scd of selfChangeData) {
|
|
|
+ const rb = billsData.find(x => { return x.b_code === scd.code && x.name === scd.name && x.unit === scd.unit && x.unit_price === scd.unit_price; });
|
|
|
+ if (rb) {
|
|
|
+ const rp = posData.find(x => { return x.lid === rb.id; });
|
|
|
+ if (rp) {
|
|
|
+ rp.due_qc_qty = this.ctx.helper.add(rp.due_qc_qty, scd.qc_qty);
|
|
|
+ rp.due_qc_minus_qty = this.ctx.helper.add(rp.due_qc_minus_qty, scd.qc_minus_qty);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
this.pos.loadDatas(posData);
|
|
|
this.pos.calculateAll();
|
|
|
|