Browse Source

移除负变更,完成率、超计还原

MaiXinRong 3 years ago
parent
commit
a07a5840dc

+ 3 - 3
app/const/spread.js

@@ -205,7 +205,7 @@ const stageTz = {
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_qc_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '截止本期完成计量|数量', colSpan: '3|1', rowSpan: '1|1', field: 'end_gather_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_gather_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
-            {title: '|完成率(%)', colSpan: '1', rowSpan: '|1', field: 'end_gather_1_percent', hAlign: 2, width: 80, readOnly: true, type: 'Number'},
+            {title: '|完成率(%)', colSpan: '1', rowSpan: '|1', field: 'end_gather_percent', hAlign: 2, width: 80, readOnly: true, type: 'Number'},
             {title: '合同|项目节数量1',  colSpan: '2|1', rowSpan: '1|1', field: 'deal_dgn_qty1', hAlign: 2, width: 60, type: 'Number'},
             {title: '|项目节数量2',  colSpan: '|1', rowSpan: '|1', field: 'deal_dgn_qty2', hAlign: 2, width: 60, type: 'Number'},
             {title: '变更|项目节数量1',  colSpan: '2|1', rowSpan: '1|1', field: 'c_dgn_qty1', hAlign: 2, width: 60, type: 'Number'},
@@ -283,7 +283,7 @@ const stageCl = {
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_qc_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '截止本期完成计量|数量', colSpan: '3|1', rowSpan: '1|1', field: 'end_gather_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_gather_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
-            {title: '|完成率(%)', colSpan: '1', rowSpan: '|1', field: 'end_gather_1_percent', hAlign: 2, width: 80, readOnly: true, type: 'Number'},
+            {title: '|完成率(%)', colSpan: '1', rowSpan: '|1', field: 'end_gather_percent', hAlign: 2, width: 80, readOnly: true, type: 'Number'},
             {title: '合同|项目节数量1',  colSpan: '2|1', rowSpan: '1|1', field: 'deal_dgn_qty1', hAlign: 2, width: 60, type: 'Number'},
             {title: '|项目节数量2',  colSpan: '|1', rowSpan: '|1', field: 'deal_dgn_qty2', hAlign: 2, width: 60, type: 'Number'},
             {title: '变更|项目节数量1',  colSpan: '2|1', rowSpan: '1|1', field: 'c_dgn_qty1', hAlign: 2, width: 60, type: 'Number'},
@@ -360,7 +360,7 @@ const stageNoCl = {
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_qc_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '截止本期完成计量|数量', colSpan: '3|1', rowSpan: '1|1', field: 'end_gather_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_gather_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
-            {title: '|完成率(%)', colSpan: '1', rowSpan: '|1', field: 'end_gather_1_percent', hAlign: 2, width: 80, readOnly: true, type: 'Number'},
+            {title: '|完成率(%)', colSpan: '1', rowSpan: '|1', field: 'end_gather_percent', hAlign: 2, width: 80, readOnly: true, type: 'Number'},
             {title: '合同|项目节数量1',  colSpan: '2|1', rowSpan: '1|1', field: 'deal_dgn_qty1', hAlign: 2, width: 60, type: 'Number'},
             {title: '|项目节数量2',  colSpan: '|1', rowSpan: '|1', field: 'deal_dgn_qty2', hAlign: 2, width: 60, type: 'Number'},
             {title: '变更|项目节数量1',  colSpan: '2|1', rowSpan: '1|1', field: 'c_dgn_qty1', hAlign: 2, width: 60, type: 'Number'},

+ 2 - 5
app/controller/revise_controller.js

@@ -435,18 +435,15 @@ module.exports = app => {
                                 p.used = usedPrePos.indexOf(p.id) >= 0;
                             }
                         } else {
-                            const minusChange = await this.ctx.service.stageChange.getStageMinusChange(lastStage);
                             const usedPreBills = lastStage.order > 1 ? await ctx.service.stageBillsFinal.getUsedBills(ctx.tender.id, lastStage.order - 1) : [];
                             const usedCurBills = await ctx.service.stageBills.getStageUsedBills(ctx.tender.id, lastStage.id);
-                            const minusChangeBills = minusChange.map(x => {return x.qty < 0 ? x.lid : undefined});
                             for (const b of reviseBills) {
-                                b.used = usedPreBills.indexOf(b.id) >= 0 || usedCurBills.indexOf(b.id) >= 0 || minusChangeBills.indexOf(b.id) >= 0;
+                                b.used = usedPreBills.indexOf(b.id) >= 0 || usedCurBills.indexOf(b.id) >= 0;
                             }
                             const usedPrePos = lastStage.order > 1 ? await ctx.service.stagePosFinal.getUsedPos(ctx.tender.id, lastStage.order - 1) : [];
                             const usedCurPos = await ctx.service.stagePos.getStageUsedPos(ctx.tender.id, lastStage.id);
-                            const minusChangePos = minusChange.map(x => {return x.qty < 0 ? x.pid : undefined});
                             for (const p of revisePos) {
-                                p.used = usedPrePos.indexOf(p.id) >= 0 || usedCurPos.indexOf(p.id) >= 0 || minusChangePos.indexOf(p.id) >= 0 ;
+                                p.used = usedPrePos.indexOf(p.id) >= 0 || usedCurPos.indexOf(p.id) >= 0;
                             }
                         }
                     }

+ 0 - 41
app/controller/stage_controller.js

@@ -350,9 +350,6 @@ module.exports = app => {
                         case 'changeBills':
                             responseData.data.changeBills = await this.ctx.service.changeAuditList.checkedChangeBills(ctx.stage.tid);
                             break;
-                        case 'minus_change':
-                            responseData.data.minus_change = await this.ctx.service.stageChangeFinal.getPreMinusChange(ctx.stage.tid, ctx.stage.order);
-                            break;
                         case 'import_change':
                             responseData.data.import_change = await this.ctx.service.stageImportChange.getStageImportData(this.ctx.stage);
                             break;
@@ -395,27 +392,6 @@ module.exports = app => {
             try {
                 const ledgerData = await this._getStageLedgerData(ctx);
                 const posData = await this._getStagePosData(ctx);
-                // 加载负变更,将台账变成1#台账
-                const minusChange = await this.ctx.service.stageChange.getStageMinusChange(ctx.stage);
-                const preMinusChange = await this.ctx.service.stageChangeFinal.getPreMinusChange(ctx.stage.tid, ctx.stage.order);
-                this.ctx.helper.assignSumRelaData(ledgerData, 'id', [
-                    {data: preMinusChange, fields: [{source: 'qty', target: 'pre_minus_qc_qty'}], relaField: 'lid'},
-                    {data: minusChange, fields: [{source: 'qty', target: 'minus_qc_qty'}], relaField: 'lid'},
-                ]);
-                this.ctx.helper.assignSumRelaData(posData, 'id', [
-                    {data: preMinusChange, fields: [{source: 'qty', target: 'pre_minus_qc_qty'}], relaField: 'pid'},
-                    {data: minusChange, fields: [{source: 'qty', target: 'minus_qc_qty'}], relaField: 'pid'},
-                ]);
-                const helper = this.ctx.helper;
-                posData.forEach(x => {
-                    x.end_minus_qc_qty = helper.add(x.pre_minus_qc_qty, x.minus_qc_qty);
-                    x.final_1_qty = helper.add(x.quantity, x.end_minus_qc_qty);
-                });
-                ledgerData.forEach(x => {
-                    x.end_minus_qc_qty = helper.add(x.pre_minus_qc_qty, x.minus_qc_qty);
-                    x.final_1_qty = helper.add(x.quantity, x.end_minus_qc_qty);
-                    x.deal_final_1_qty = helper.add(x.deal_qty, x.end_minus_qc_qty);
-                });
 
                 const projRela = await this.ctx.service.project.getFunRela(this.ctx.session.sessionProject.id);
                 const checkDataModel = require('../lib/ledger').checkData;
@@ -554,19 +530,12 @@ module.exports = app => {
                     result.change = { target: { lid: data.target.pos.lid, pid: data.target.pos.id } };
                     result.change.data = await ctx.service.stageChange.getLastestStageData(ctx.tender.id,
                         ctx.stage.id, data.target.pos.lid, data.target.pos.id);
-                    minus = await this.ctx.service.stageChange.getBillsMinusQty(ctx.stage, data.target.pos.lid);
-                    posMinus = await this.ctx.service.stageChange.getPosMinusQty(ctx.stage, data.target.pos.id);
-                    const pos = result.pos.curStageData.find(x => { return x.pid === posMinus.pid });
-                    if (pos) pos.minus_qc_qty = posMinus.qty;
                 } else {
                     result = await ctx.service.stageChange.billsChange(data.target.bills, data.change);
                     result.change = { target: { lid: data.target.bills.id, pid: '-1' } };
                     result.change.data = await ctx.service.stageChange.getLastestStageData(ctx.tender.id,
                         ctx.stage.id, data.target.bills.id, '-1');
-                    minus = await this.ctx.service.stageChange.getBillsMinusQty(ctx.stage, data.target.bills.id);
                 }
-                const bills = result.bills.curStageData.find(x => { return x.lid === minus.lid });
-                if (bills) bills.minus_qc_qty = minus.qty;
                 await ctx.service.stage.updateCheckCalcFlag(ctx.stage, true);
                 await ctx.service.stage.updateCacheTime(ctx.stage.id);
                 ctx.body = { err: 0, msg: '', data: result };
@@ -1441,16 +1410,6 @@ module.exports = app => {
                 const ledgerData = await this._getStageLedgerData(ctx);
                 const posData = await this._getStagePosData(ctx);
                 const changeData = await this._getStageChangeData(ctx);
-                const preMinusChange = await this.ctx.service.stageChangeFinal.getPreMinusChange(ctx.stage.tid, ctx.stage.order);
-                const minusChange = changeData.filter(x => { return x.minus });
-                this.ctx.helper.assignSumRelaData(ledgerData, 'id', [
-                    {data: preMinusChange, fields: [{source: 'qty', target: 'pre_minus_qc_qty'}], relaField: 'lid'},
-                    {data: minusChange, fields: [{source: 'qty', target: 'minus_qc_qty'}], relaField: 'lid'},
-                ]);
-                this.ctx.helper.assignSumRelaData(posData, 'id', [
-                    {data: preMinusChange, fields: [{source: 'qty', target: 'pre_minus_qc_qty'}], relaField: 'pid'},
-                    {data: minusChange, fields: [{source: 'qty', target: 'minus_qc_qty'}], relaField: 'pid'},
-                ]);
                 const convert = new billsPosConvert(ctx);
                 convert.loadData(ledgerData, posData, changeData);
                 const result = convert.convert(data.filter);

+ 0 - 16
app/lib/bills_pos_convert.js

@@ -98,9 +98,6 @@ class BillsPosConvert {
         node.pre_gather_qty = this.ctx.helper.add(node.pre_gather_qty, data.pre_gather_qty);
 
         node.real_qty = this.ctx.helper.add(node.real_qty, data.real_qty);
-
-        node.minus_qc_qty = this.ctx.helper.add(node.minus_qc_qty, data.minus_qc_qty);
-        node.pre_minus_qc_qty = this.ctx.helper.add(node.pre_minus_qc_qty, data.pre_minus_qc_qty);
     }
     _loadBillsCalcFields(node, data) {
         node.quantity = this.ctx.helper.add(node.quantity, data.quantity);
@@ -117,9 +114,6 @@ class BillsPosConvert {
         node.pre_qc_qty = this.ctx.helper.add(node.pre_qc_qty, data.pre_qc_qty);
         node.pre_qc_tp = this.ctx.helper.add(node.pre_qc_tp, data.pre_qc_tp);
         node.pre_gather_qty = this.ctx.helper.add(node.pre_gather_qty, data.pre_gather_qty);
-
-        node.minus_qc_qty = this.ctx.helper.add(node.minus_qc_qty, data.minus_qc_qty);
-        node.pre_minus_qc_qty = this.ctx.helper.add(node.pre_minus_qc_qty, data.pre_minus_qc_qty);
     }
     _convertGcl(node, xmj) {
         if (!xmj) return;
@@ -241,13 +235,6 @@ class BillsPosConvert {
         child.estimate_tp = this.ctx.helper.mul(child.estimate_qty, child.unit_price, tpDecimal);
 
         child.bgl_code = this.ctx.helper._.uniq(this.ctx.helper._.map(child.changes, 'c_code')).join(';');
-
-        // 1#台账相关
-        child.end_minus_qc_qty = this.ctx.helper.add(child.pre_minus_qc_qty, child.minus_qc_qty); // 1#台账 台账+负变更
-        child.final_1_qty = this.ctx.helper.add(child.end_minus_qc_qty, child.quantity); // 1#台账 台账+负变更
-        child.final_1_tp = this.ctx.helper.mul(child.unit_price, child.final_1_qty, tpDecimal);
-        child.end_final_1_tp = this.ctx.helper.add(child.end_qc_tp, child.final_1_tp);
-        child.end_gather_1_percent = this.ctx.helper.mul(this.ctx.helper.div(child.end_gather_tp, child.end_final_1_tp, 4), 100);
     }
     _calculateNode(node, children) {
         for (const child of children) {
@@ -263,14 +250,11 @@ class BillsPosConvert {
             node.end_gather_tp = this.ctx.helper.add(node.end_gather_tp, child.end_gather_tp);
             node.real_tp = this.ctx.helper.add(node.real_tp, child.real_tp);
             node.estimate_tp = this.ctx.helper.add(node.estimate_tp, child.estimate_tp);
-            node.final_1_tp = this.ctx.helper.add(node.final_1_tp, child.final_1_tp);
         }
         if (node.dgn_qty1)
             node.dgn_price = this.ctx.helper.div(node.total_price, node.dgn_qty1, this.ctx.tender.info.decimal.up);
         node.final_tp = this.ctx.helper.add(node.total_price, node.end_qc_tp);
         node.end_gather_percent = this.ctx.helper.mul(this.ctx.helper.div(node.end_gather_tp, node.final_tp, 4), 100);
-        node.end_final_1_tp = this.ctx.helper.add(node.end_qc_tp, node.final_1_tp);
-        node.end_gather_1_percent = this.ctx.helper.mul(this.ctx.helper.div(node.end_gather_tp, node.end_final_1_tp, 4), 100);
     }
     _recursiveCalcUnitNodes(nodes) {
         if (!nodes || !nodes instanceof Array || nodes.length === 0) return;

+ 4 - 4
app/lib/ledger.js

@@ -633,7 +633,7 @@ class checkData {
                 if (!data.contract_qty && !data.qc_qty && !data.pre_contract_qty && !data.pre_qc_qty) return 2; // 漏计
             } else {
                 const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, unit);
-                const checkQty = this.ctx.helper.mul(data.final_1_qty, this.ctx.helper.div(ratio, 100, 4), precision.value);
+                const checkQty = this.ctx.helper.mul(data.quantity, this.ctx.helper.div(ratio, 100, 4), precision.value);
                 const qty = this.ctx.helper.add(data.contract_qty, data.pre_contract_qty);
                 if (qty > checkQty) return 1; // 违规
                 if (qty < checkQty) return 2; // 漏计
@@ -901,9 +901,9 @@ class checkData {
                     const end_contract_qty = this.ctx.helper.add(p.pre_contract_qty, p.contract_qty);
                     if (!p.quantity && !!end_contract_qty) return true;
                     if (p.quantity > 0) {
-                        if (end_contract_qty > p.final_1_qty) return true;
+                        if (end_contract_qty > p.quantity) return true;
                     } else {
-                        if (end_contract_qty < p.final_1_qty || end_contract_qty > 0) return true;
+                        if (end_contract_qty < p.quantity || end_contract_qty > 0) return true;
                     }
                 }
                 return false;
@@ -916,7 +916,7 @@ class checkData {
                 if (!compare_tp) return !!end_contract_tp;
                 return compare_tp >= 0 ? end_contract_tp > compare_tp : end_contract_tp < compare_tp || end_contract_tp > 0;
             } else {
-                const compare_qty = isTz ? bills.final_1_qty : bills.deal_final_1_qty;
+                const compare_qty = isTz ? bills.quantity : bills.deal_qty;
                 if (!compare_qty) return !!end_contract_qty;
                 return compare_qty >= 0 ? end_contract_qty > compare_qty : end_contract_qty < compare_qty || end_contract_qty > 0;
             }

+ 6 - 6
app/public/js/global.js

@@ -1019,8 +1019,8 @@ const checkUtils = {
         if (!data) return false;
         if (!data.quantity) return !!data.end_contract_qty;
         return data.quantity > 0
-            ? data.end_contract_qty > data.final_1_qty
-            : data.end_contract_qty < data.final_1_qty || data.end_contract_qty > 0;
+            ? data.end_contract_qty > data.quantity
+            : data.end_contract_qty < data.quantity || data.end_contract_qty > 0;
     },
     billsOver(data, isTz, relaPos) {
         if (!data) return false;
@@ -1039,8 +1039,8 @@ const checkUtils = {
             } else {
                 if (!data.quantity) return !!data.end_contract_qty;
                 return data.quantity > 0
-                    ? data.end_contract_qty > data.final_1_qty
-                    : data.end_contract_qty < data.final_1_qty || data.end_contract_qty > 0;
+                    ? data.end_contract_qty > data.quantity
+                    : data.end_contract_qty < data.quantity || data.end_contract_qty > 0;
             }
         } else {
             if (data.is_tp) {
@@ -1051,8 +1051,8 @@ const checkUtils = {
             } else {
                 if (!data.deal_qty) return !!data.end_contract_qty;
                 return data.deal_qty > 0
-                    ? data.end_contract_qty > data.final_deal_1_qty
-                    : data.end_contract_qty < data.final_deal_1_qty || data.end_contract_qty > 0;
+                    ? data.end_contract_qty > data.deal_qty
+                    : data.end_contract_qty < data.deal_qty || data.end_contract_qty > 0;
             }
         }
     }

+ 1 - 1
app/public/js/ledger_check.js

@@ -217,7 +217,7 @@ const ledgerCheckUtil = {
                     if (!data.contract_qty && !data.qc_qty && !data.pre_contract_qty && !data.pre_qc_qty) return 2; // 漏计
                 } else {
                     const precision = findPrecision(tenderInfo.precision, unit);
-                    const checkQty = ZhCalc.mul(data.final_1_qty, ZhCalc.div(ratio, 100, 4), precision.value);
+                    const checkQty = ZhCalc.mul(data.quantity, ZhCalc.div(ratio, 100, 4), precision.value);
                     const qty = ZhCalc.add(data.contract_qty, data.pre_contract_qty) || 0;
                     if (qty > checkQty) return 1; // 违规
                     if (qty < checkQty) return 2; // 漏计

+ 5 - 47
app/public/js/stage.js

@@ -267,9 +267,9 @@ $(document).ready(() => {
         markExpandSubKey: window.location.pathname.split('/')[2],
     };
     // 台账树结构计算相关设置
-    stageTreeSetting.updateFields = ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'postil', 'used', 'contract_expr', 'minus_qc_qty'];
+    stageTreeSetting.updateFields = ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'postil', 'used', 'contract_expr'];
     stageTreeSetting.calcFields = ['deal_tp', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp',
-        'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp', 'end_correct_tp', 'final_1_tp'];
+        'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp', 'end_correct_tp'];
     stageTreeSetting.calcFun = function (node) {
         if (!node.children || node.children.length === 0) {
             node.pre_gather_qty = ZhCalc.add(node.pre_contract_qty, node.pre_qc_qty);
@@ -277,10 +277,6 @@ $(document).ready(() => {
             node.end_contract_qty = ZhCalc.add(node.pre_contract_qty, node.contract_qty);
             node.end_qc_qty = ZhCalc.add(node.pre_qc_qty, node.qc_qty);
             node.end_gather_qty = ZhCalc.add(node.pre_gather_qty, node.gather_qty);
-            node.end_minus_qc_qty = ZhCalc.add(node.pre_minus_qc_qty, node.minus_qc_qty);
-            node.final_1_qty = ZhCalc.add(node.end_minus_qc_qty, node.quantity); // 1#台账 台账+负变更
-            node.final_1_tp = ZhCalc.mul(node.unit_price, node.final_1_qty, tenderInfo.decimal.tp);
-            node.final_deal_1_qty = ZhCalc.add(node.end_minus_qc_qty, node.deal_qty);
         }
         node.pre_gather_tp = ZhCalc.add(node.pre_contract_tp, node.pre_qc_tp);
         node.gather_tp = ZhCalc.add(node.contract_tp, node.qc_tp);
@@ -298,15 +294,13 @@ $(document).ready(() => {
         }
         node.end_gather_percent = ZhCalc.mul(ZhCalc.div(node.end_gather_tp, node.end_final_tp), 100, 2);
         node.end_correct_percent = ZhCalc.mul(ZhCalc.div(node.end_correct_tp, node.end_final_tp), 100, 2);
-        node.end_gather_1_percent = ZhCalc.mul(ZhCalc.div(node.end_gather_tp, node.end_final_1_tp), 100, 2);
-        node.end_correct_1_percent = ZhCalc.mul(ZhCalc.div(node.end_correct_tp, node.end_final_1_tp), 100, 2);
         node.final_dgn_price = ZhCalc.round(ZhCalc.div(node.end_gather_tp, ZhCalc.add(node.deal_dgn_qty1, node.c_dgn_qty1)), tenderInfo.decimal.up);
     };
     const stageTree = createNewPathTree('stage', stageTreeSetting);
     // 初始化 计量单元 数据结构
     const stagePosSetting = {
         id: 'id', ledgerId: 'lid',
-        updateFields: ['contract_qty', 'qc_qty', 'postil', 'contract_expr', 'minus_qc_qty'],
+        updateFields: ['contract_qty', 'qc_qty', 'postil', 'contract_expr'],
     };
     stagePosSetting.calcFun = function (pos) {
         pos.pre_gather_qty = ZhCalc.add(pos.pre_contract_qty, pos.pre_qc_qty);
@@ -319,8 +313,6 @@ $(document).ready(() => {
         pos.estimate_qty = !checkZero(pos.real_qty)
             ? ZhCalc.sub(ZhCalc.sub(pos.real_qty, pos.quantity), pos.end_qc_qty)
             : null;
-        pos.end_minus_qc_qty = ZhCalc.add(pos.minus_qc_qty, pos.pre_minus_qc_qty);
-        pos.final_1_qty = ZhCalc.add(pos.end_minus_qc_qty, pos.quantity);
     };
     const stagePos = new StagePosData(stagePosSetting);
 
@@ -421,6 +413,7 @@ $(document).ready(() => {
             // 切换变更令,加载右侧明细数据
             this.spread.bind(spreadNS.Events.SelectionChanged, function (e, info) {
                 const change = SpreadJsObj.getSelectObject(info.sheet);
+                console.log(change);
                 if(change) {
                     self._loadChangeDetail(change);
                 }
@@ -661,8 +654,6 @@ $(document).ready(() => {
     };
     const ratioCol = ledgerSpreadSetting.cols.find(x => {return x.field === 'end_gather_percent' || x.field === 'end_correct_percent'});
     if (ratioCol) ratioCol.field = tenderInfo.display.stage.correct ? 'end_correct_percent' : 'end_gather_percent';
-    const ratioCol1 = ledgerSpreadSetting.cols.find(x => {return x.field === 'end_gather_1_percent' || x.field === 'end_correct_1_percent'});
-    if (ratioCol) ratioCol1.field = tenderInfo.display.stage.correct ? 'end_correct_1_percent' : 'end_gather_1_percent';
     ledgerSpreadSetting.imageClick = function (data, hitinfo) {
         const col = hitinfo.sheet.zh_setting.cols[hitinfo.col];
         switch (col.field) {
@@ -2045,38 +2036,11 @@ $(document).ready(() => {
     });
 
     // 加载计量单元数据 - 暂时统一加载,如有需要,切换成动态加载并缓存
-    postData(window.location.pathname + '/load', { filter: 'ledger;pos;detail;change;import_change;tag;cooperation;minus_change' }, function (result) {
+    postData(window.location.pathname + '/load', { filter: 'ledger;pos;detail;change;import_change;tag;cooperation' }, function (result) {
         // 加载树结构
         stageTree.loadDatas(result.ledgerData);
         // 加载部位明细
         stagePos.loadDatas(result.posData);
-        let mcIndex = {};
-        if (result.minus_change && result.minus_change.length > 0) {
-            for (const mc of result.minus_change) {
-                if (!mcIndex[mc.lid]) mcIndex[mc.lid] = stageTree.nodes.find(x => { return x.id === mc.lid; });
-                if (mcIndex[mc.lid]) {
-                    mcIndex[mc.lid].pre_minus_qc_qty = ZhCalc.add(mcIndex[mc.lid].pre_minus_qc_qty, mc.qty);
-                }
-                const mcP = stagePos.getPos(mc.pid);
-                if (mcP) {
-                    mcP.pre_minus_qc_qty = ZhCalc.add(mcP.pre_minus_qc_qty, mc.qty);
-                }
-            }
-        }
-        if (result.changeData && result.changeData.length > 0) {
-            for (const mc of result.changeData) {
-                if (!mc.minus || !mc.qty) continue;
-                if (!mcIndex[mc.lid]) mcIndex[mc.lid] = stageTree.nodes.find(x => { return x.id === mc.lid; });
-                if (mcIndex[mc.lid]) {
-                    mcIndex[mc.lid].minus_qc_qty = ZhCalc.add(mcIndex[mc.lid].minus_qc_qty, mc.qty);
-                }
-                const mcP = stagePos.getPos(mc.pid);
-                if (mcP) {
-                    mcP.minus_qc_qty = ZhCalc.add(mcP.minus_qc_qty, mc.qty);
-                }
-            }
-        }
-        mcIndex = null;
         checkShowLast(result.ledgerData.length);
         treeCalc.calculateAll(stageTree);
         // 加载解锁相关
@@ -3914,7 +3878,6 @@ $(document).ready(() => {
                             {title: '单价', field: 'unit_price', hAlign: 2, width: 50},
                             {title: '数量', field: 'quantity', hAlign: 2, width: 50},
                             {title: '完成率(%)', field: 'end_gather_percent', hAlign: 2, width: 70},
-                            {title: '本期负变更', field: 'minus_qc_qty', hAlign: 2, width: 50},
                         ],
                         emptyRows: 0,
                         headRows: 1,
@@ -3953,11 +3916,6 @@ $(document).ready(() => {
                                 }
                             }
                         }, {
-                            key: 'minus_qc_qty', title: '负变更', valid: true,
-                            check: function (node) {
-                                return node.end_minus_qc_qty;
-                            }
-                        }, {
                             key: 'estimate', title: '预计变更', valid: true,
                             check: function (node) {
                                 const posRange = stagePos.ledgerPos[itemsPre + node.id] || [];

+ 7 - 15
app/service/stage_change.js

@@ -156,9 +156,7 @@ module.exports = app => {
                 if (!nc || nc.qty !== oc.qty) {
                     const qty = nc ? this.round(nc.qty, precision.value) : null;
                     const change = getNewChange(oc.cid, oc.cbid, this.ctx.stage.curTimes, this.ctx.stage.curOrder, qty, nc ? nc.minus : oc.minus);
-                    if (!change.minus) {
-                        billsQty = this.ctx.helper.add(billsQty, change.qty);
-                    }
+                    billsQty = this.ctx.helper.add(billsQty, change.qty);
                     if (oc.stimes === this.ctx.stage.curTimes && oc.sorder === this.ctx.stage.curOrder) {
                         change.id = oc.id;
                         updateChanges.push(change);
@@ -166,18 +164,14 @@ module.exports = app => {
                         newChanges.push(change);
                     }
                 } else {
-                    if (!oc.minus) {
-                        billsQty = this.ctx.helper.add(billsQty, oc.qty);
-                    }
+                    billsQty = this.ctx.helper.add(billsQty, oc.qty);
                 }
             }
             for (const c of changes) {
                 const nc = this._.find(oldChanges, { cid: c.cid, cbid: c.cbid });
                 if (!nc) {
                     const change = getNewChange(c.cid, c.cbid, this.ctx.stage.curTimes, this.ctx.stage.curOrder, this.round(c.qty, precision.value), c.minus);
-                    if (!change.minus) {
-                        billsQty = this.ctx.helper.add(billsQty, change.qty);
-                    }
+                    billsQty = this.ctx.helper.add(billsQty, change.qty);
                     newChanges.push(change);
                 }
             }
@@ -234,7 +228,7 @@ module.exports = app => {
                 if (!nc || nc.qty !== oc.qty) {
                     const qty = nc ? this.round(nc.qty, precision.value) : null;
                     const change = getNewChange(oc.cid, oc.cbid, this.ctx.stage.curTimes, this.ctx.stage.curOrder, qty, nc ? nc.minus : oc.minus);
-                    if (!change.minus) posQty = this.ctx.helper.add(posQty, change.qty);
+                    posQty = this.ctx.helper.add(posQty, change.qty);
                     if (oc.stimes === this.ctx.stage.curTimes && oc.sorder === this.ctx.stage.curOrder) {
                         change.id = oc.id;
                         updateChanges.push(change);
@@ -242,16 +236,14 @@ module.exports = app => {
                         newChanges.push(change);
                     }
                 } else {
-                    if (!oc.minus) posQty = this.ctx.helper.add(posQty, oc.qty);
+                    posQty = this.ctx.helper.add(posQty, oc.qty);
                 }
             }
             for (const c of changes) {
                 const nc = this._.find(oldChanges, { cid: c.cid, cbid: c.cbid });
                 if (!nc) {
                     const change = getNewChange(c.cid, c.cbid, this.ctx.stage.curTimes, this.ctx.stage.curOrder, this.round(c.qty, precision.value), c.minus);
-                    if (!change.minus) {
-                        posQty = this.ctx.helper.add(posQty, change.qty);
-                    }
+                    posQty = this.ctx.helper.add(posQty, change.qty);
                     newChanges.push(change);
                 }
             }
@@ -399,7 +391,7 @@ module.exports = app => {
             data = helper.filterLastestData(data, ['lid', 'pid', 'cbid'], 'stimes', 'sorder');
             const bqData = [];
             for (const d of data) {
-                if (!d.qty || d.minus) continue;
+                if (!d.qty) continue;
                 let bd = bqData.find(x => { return x.lid === d.lid && x.quality === d.quality; });
                 if (!bd) {
                     const bills = await this.db.get(this.ctx.service.ledger.departTableName(tender.id), { id: d.lid });