Jelajahi Sumber

1. 截止本期完成率
2. 清单汇总页面,施工复核+变更令 改为 台账+变更令

MaiXinRong 5 tahun lalu
induk
melakukan
8db26a0702

+ 15 - 12
app/const/spread.js

@@ -113,8 +113,9 @@ const stageTz = {
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_contract_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '截止本期数量变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_qc_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_qc_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
-            {title: '截止本期完成计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_gather_qty', 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_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'},
@@ -122,7 +123,7 @@ const stageTz = {
             {title: '经济指标',  colSpan: '1', rowSpan: '2', field: 'final_dgn_price', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '本期批注', colSpan: '1', rowSpan: '2', field: 'postil', hAlign: 0, width: 100, formatter: '@', cellType: 'autoTip'},
             {title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@', readOnly: true},
-            {title: '累计完成率(%)', colSpan: '1', rowSpan: '2', field: 'percent', hAlign: 0, width: 100, readOnly: true, type: 'Number'},
+            //{title: '累计完成率(%)', colSpan: '1', rowSpan: '2', field: 'percent', hAlign: 0, width: 100, readOnly: true, type: 'Number'},
             {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip', readOnly: true},
         ],
         emptyRows: 0,
@@ -171,8 +172,9 @@ const stageCl = {
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_contract_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '截止本期数量变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_qc_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_qc_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
-            {title: '截止本期完成计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_gather_qty', 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_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'},
@@ -180,7 +182,7 @@ const stageCl = {
             {title: '经济指标',  colSpan: '1', rowSpan: '2', field: 'final_dgn_price', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '本期批注', colSpan: '1', rowSpan: '2', field: 'postil', hAlign: 0, width: 100, formatter: '@', cellType: 'autoTip'},
             {title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@', readOnly: true},
-            {title: '累计完成率(%)', colSpan: '1', rowSpan: '2', field: 'percent', hAlign: 0, width: 100, readOnly: true, type: 'Number'},
+            //{title: '累计完成率(%)', colSpan: '1', rowSpan: '2', field: 'percent', hAlign: 0, width: 100, readOnly: true, type: 'Number'},
             {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip', readOnly: true},
         ],
         emptyRows: 0,
@@ -233,8 +235,9 @@ const stageNoCl = {
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_contract_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '截止本期数量变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_qc_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_qc_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
-            {title: '截止本期完成计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_gather_qty', 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_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'},
@@ -242,7 +245,6 @@ const stageNoCl = {
             {title: '经济指标',  colSpan: '1', rowSpan: '2', field: 'final_dgn_price', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '本期批注', colSpan: '1', rowSpan: '2', field: 'postil', hAlign: 0, width: 100, formatter: '@', cellType: 'autoTip'},
             {title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@', readOnly: true},
-            {title: '累计完成率(%)', colSpan: '1', rowSpan: '2', field: 'percent', hAlign: 0, width: 100, readOnly: true, type: 'Number'},
             {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip', readOnly: true},
         ],
         emptyRows: 0,
@@ -295,11 +297,12 @@ const stageGather = {
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_contract_tp', hAlign: 2, width: 60, type: 'Number'},
             {title: '截止本期数量变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_qc_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_qc_tp', hAlign: 2, width: 60, type: 'Number'},
-            {title: '截止本期完成计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_gather_qty', hAlign: 2, width: 60, type: 'Number'},
+            {title: '截止本期完成计量|数量', colSpan: '3|1', rowSpan: '1|1', field: 'end_gather_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_gather_tp', hAlign: 2, width: 60, type: 'Number'},
-            {title: '施工图复核+变更令|数量', colSpan: '3|1', rowSpan: '1|1', field: 'final_qty', hAlign: 2, width: 60, type: 'Number'},
-            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'final_tp', hAlign: 2, width: 60, type: 'Number'},
-            {title: '|累计完成率(%)', colSpan: '|1', rowSpan: '|1', field: 'percent', hAlign: 0, width: 100, type: 'Number'},
+            {title: '|完成率(%)', colSpan: '1', rowSpan: '|1', field: 'end_gather_percent', hAlign: 2, width: 80, readOnly: true, type: 'Number'},
+            {title: '台账+变更令|数量', colSpan: '3|1', rowSpan: '1|1', field: 'end_final_qty', hAlign: 2, width: 60, type: 'Number'},
+            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_final_tp', hAlign: 2, width: 60, type: 'Number'},
+            //{title: '|累计完成率(%)', colSpan: '|1', rowSpan: '|1', field: 'percent', hAlign: 0, width: 100, type: 'Number'},
         ],
         emptyRows: 0,
         headRows: 2,
@@ -316,10 +319,10 @@ const stageGather = {
             {title: '本期计量数量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|完成', colSpan: '|1', rowSpan: '1|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number'},
-            {title: '截止本期计量数量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'end_contract_qty', hAlign: 2, width: 60, type: 'Number'},
+            {title: '截止本期计量数量|合同', colSpan: '4|1', rowSpan: '1|1', field: 'end_contract_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'end_qc_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|完成', colSpan: '|1', rowSpan: '|1', field: 'end_gather_qty', hAlign: 2, width: 60, type: 'Number'},
-            {title: '完成率(%)', colSpan: '1', rowSpan: '2', field: 'percent', hAlign: 0, width: 100, type: 'Number'},
+            {title: '|完成率(%)', colSpan: '1', rowSpan: '|1', field: 'end_gather_percent', hAlign: 2, width: 80, readOnly: true, type: 'Number'},
             {title: '单位工程', colSpan: '1', rowSpan: '2', field: 'dwgc', hAlign: 0, width: 80, formatter: '@'},
             {title: '分部工程', colSpan: '1', rowSpan: '2', field: 'fbgc', hAlign: 0, width: 80, formatter: '@'},
             {title: '分项工程', colSpan: '1', rowSpan: '2', field: 'fxgc', hAlign: 0, width: 80, formatter: '@'},

+ 15 - 6
app/controller/stage_controller.js

@@ -945,12 +945,12 @@ module.exports = app => {
                     col.formatter = formatter;
                 }
             }
-            const tpFormatter = this.ctx.helper.getNumberFormatter(this.ctx.tender.info.decimal.tp);
-            const upFormatter = this.ctx.helper.getNumberFormatter(2);
+            //const tpFormatter = this.ctx.helper.getNumberFormatter(this.ctx.tender.info.decimal.tp);
+            //const upFormatter = this.ctx.helper.getNumberFormatter(2);
             const gcl = JSON.parse(JSON.stringify(spreadConst.stageGather.gcl));
-            setColFormat(gcl.cols, 'unit_price', upFormatter);
-            setColFormat(gcl.cols, 'total_price', tpFormatter);
-            setColFormat(gcl.cols, 'tp', tpFormatter);
+            //setColFormat(gcl.cols, 'unit_price', upFormatter);
+            //setColFormat(gcl.cols, 'total_price', tpFormatter);
+            //setColFormat(gcl.cols, 'tp', tpFormatter);
 
             const leafXmj = JSON.parse(JSON.stringify(spreadConst.stageGather.leafXmj));
             const tender = this.ctx.tender;
@@ -971,12 +971,21 @@ module.exports = app => {
                 [renderData.gclSpread, renderData.leafXmjSpread] = this._getGatherSpreadSetting();
                 renderData.ledger = await ctx.service.ledger.getData(ctx.tender.id);
                 renderData.curLedgerData = await ctx.service.stageBills.getAuditorStageData(ctx.tender.id, ctx.stage.id, ctx.stage.curTimes, ctx.stage.curOrder);
+                if (ctx.stage.order > 1) {
+                    renderData.preLedgerData = await ctx.service.stageBillsFinal.getFinalData(ctx.tender.data, ctx.stage.order - 1);
+                } else {
+                    renderData.preLedgerData = [];
+                }
 
                 renderData.pos = await ctx.service.pos.getPosData({tid: ctx.tender.id});
                 // todo 根据当前人,或指定对象查询数据
                 renderData.curPosData = await ctx.service.stagePos.getAuditorStageData(ctx.tender.id,
                     ctx.stage.id, ctx.stage.curTimes, ctx.stage.curOrder);
-                //renderData.gcl = await this.ctx.service.ledger.getAllLeafGclBills(this.ctx.tender.id);
+                if (ctx.stage.order > 1) {
+                    renderData.prePosData = await ctx.service.stagePosFinal.getFinalData(ctx.tender.data, ctx.stage.order - 1);
+                } else {
+                    renderData.prePosData = [];
+                }
                 renderData.dealBills = await ctx.service.dealBills.getAllDataByCondition({ where: {tender_id: this.ctx.tender.id} });
 
                 renderData.jsFiles = this.app.jsFiles.common.concat(this.app.jsFiles.stage.gather);

+ 33 - 23
app/public/js/gcl_gather.js

@@ -12,9 +12,9 @@
 const gclGatherModel = (function () {
     // 需要汇总计算的字段
     const ledgerGatherFields = ['quantity', 'total_price', 'deal_qty', 'deal_tp',
-        'contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'gather_qty', 'gather_tp',
-        'end_contract_qty', 'end_contract_tp', 'end_qc_qty', 'end_qc_tp', 'end_gather_qty', 'end_gather_tp'];
-    const posGatherFields = ['quantity', 'contract_qty', 'qc_qty', 'gather_qty', 'end_contract_qty', 'end_qc_qty', 'end_gather_qty'];
+        'contract_qty', 'contract_tp', 'qc_qty', 'qc_tp',
+        'pre_contract_qty', 'pre_contract_tp', 'pre_qc_qty', 'pre_qc_tp'];
+    const posGatherFields = ['quantity', 'contract_qty', 'qc_qty', 'gather_qty', 'pre_contract_qty', 'pre_qc_qty'];
     // 初始化 清单树
     const gsTreeSetting = {
         id: 'ledger_id',
@@ -26,29 +26,12 @@ const gclGatherModel = (function () {
         stageId: 'id',
     };
     gsTreeSetting.updateFields = ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp'];
-    gsTreeSetting.calcFields = ['deal_tp', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp'];
-    gsTreeSetting.calcFun = function (node) {
-        if (node.children && node.children.length === 0) {
-            node.gather_qty = ZhCalc.add(node.contract_qty, node.qc_qty);
-            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.gather_tp = ZhCalc.add(node.contract_tp, node.qc_tp);
-        node.end_contract_tp = ZhCalc.add(node.pre_contract_tp, node.contract_tp);
-        node.end_qc_tp = ZhCalc.add(node.pre_qc_tp, node.qc_tp);
-        node.end_gather_tp = ZhCalc.add(node.pre_gather_tp, node.gather_tp);
-        node.dgn_price = ZhCalc.round(ZhCalc.div(node.total_price, node.dgn_qty1), 2);
-    };
     const gsTree = createNewPathTree('stage', gsTreeSetting);
     // 初始化 部位明细
     const posSetting = {
         id: 'id', ledgerId: 'lid',
         updateFields: ['contract_qty', 'qc_qty'],
     };
-    posSetting.calcFun = function (pos) {
-        pos.gather_qty = ZhCalc.add(pos.contract_qty, pos.qc_qty);
-    };
     const gsPos = new StagePosData(posSetting);
     let deal = [];
 
@@ -71,10 +54,10 @@ const gclGatherModel = (function () {
         if (curStage) {
             gsTree.loadCurStageData(curStage);
         }
-        // todo 加载截止上期计量数据
+        if (preStage) {
+            gsTree.loadPreStageData(preStage);
+        }
         // todo 加载变更令数据
-        // 根据设置 计算 台账树结构
-        treeCalc.calculateAll(gsTree);
     }
 
     function loadPosData(pos, curPos, prePos) {
@@ -329,6 +312,32 @@ const gclGatherModel = (function () {
         }
     }
 
+    function calculateGatherData() {
+        for (const gcl of gclList) {
+            gcl.pre_gather_qty = ZhCalc.add(gcl.pre_contract_qty, gcl.pre_qc_qty);
+            gcl.pre_gather_tp = ZhCalc.add(gcl.pre_contract_tp, gcl.pre_qc_tp);
+            gcl.gather_qty = ZhCalc.add(gcl.contract_qty, gcl.qc_qty);
+            gcl.end_contract_qty = ZhCalc.add(gcl.pre_contract_qty, gcl.contract_qty);
+            gcl.end_qc_qty = ZhCalc.add(gcl.pre_qc_qty, gcl.qc_qty);
+            gcl.end_gather_qty = ZhCalc.add(gcl.pre_gather_qty, gcl.gather_qty);
+            gcl.end_final_qty = ZhCalc.add(gcl.end_qc_qty, gcl.quantity);
+            gcl.gather_tp = ZhCalc.add(gcl.contract_tp, gcl.qc_tp);
+            gcl.end_contract_tp = ZhCalc.add(gcl.pre_contract_tp, gcl.contract_tp);
+            gcl.end_qc_tp = ZhCalc.add(gcl.pre_qc_tp, gcl.qc_tp);
+            gcl.end_gather_tp = ZhCalc.add(gcl.pre_gather_tp, gcl.gather_tp);
+            gcl.dgn_price = ZhCalc.round(ZhCalc.div(gcl.total_price, gcl.dgn_qty1), 2);
+            gcl.end_final_tp = ZhCalc.add(gcl.end_qc_tp, gcl.total_price);
+            gcl.end_gather_percent = ZhCalc.mul(ZhCalc.div(gcl.end_gather_tp, gcl.end_final_tp), 100, 2);
+            for (const xmj of gcl.leafXmjs) {
+                xmj.pre_gather_qty = ZhCalc.add(xmj.pre_contract_qty, xmj.pre_qc_qty);
+                xmj.gather_qty = ZhCalc.add(xmj.contract_qty, xmj.qc_qty);
+                xmj.end_gather_qty = ZhCalc.add(xmj.pre_gather_qty, xmj.gather_qty);
+                xmj.end_final_qty = ZhCalc.add(xmj.end_qc_qty, xmj.quantity);
+                xmj.end_gather_percent = ZhCalc.mul(ZhCalc.div(xmj.end_gather_qty, xmj.end_final_qty), 100, 2);
+            }
+        }
+    }
+
     /**
      * 根据树结构 清单汇总
      */
@@ -338,6 +347,7 @@ const gclGatherModel = (function () {
             gclList.length = 0; //splice(0, gclList.length);
         }
         recursiveGatherGclData(gsTree.children, null);
+        calculateGatherData();
         gatherDealBillsData();
         gclList.sort(function (a, b) {
             function compareCode(code1, code2) {

+ 7 - 4
app/public/js/stage.js

@@ -24,16 +24,15 @@ function customColDisplay () {
         { title: '本期完成计量', fields: ['gather_qty', 'gather_tp'], visible: true },
         { title: '截止本期计量合同', fields: ['end_contract_qty', 'end_contract_tp'], visible: true },
         { title: '截止本期数量变更', fields: ['end_qc_qty', 'end_qc_tp', 'end_qc_bgl'], visible: true },
-        { title: '截止本期完成计量', fields: ['end_gather_qty', 'end_gather_tp'], visible: true },
+        { title: '截止本期完成计量', fields: ['end_gather_qty', 'end_gather_tp', 'end_gather_percent'], visible: true },
         { title: '本期批注', fields: ['postil'], visible: true },
         { title: '图册号', fields: ['drawing_code'], visible: true },
-        { title: '累计完成率(%)', fields: ['percent'], visible: true },
         { title: '备注', fields: ['memo'], visible: true },
     ];
     if (checkTzMeasureType()) {
         defaultSetting.splice(0, 1);
     }
-    const settingStr = Cookies.get('stage-col-visible-1.0.1-' + tender.id);
+    const settingStr = Cookies.get('stage-col-visible-1.0.2-' + tender.id);
     return settingStr ? JSON.parse(settingStr) : defaultSetting;
 }
 
@@ -172,6 +171,8 @@ $(document).ready(() => {
         node.end_contract_tp = ZhCalc.add(node.pre_contract_tp, node.contract_tp);
         node.end_qc_tp = ZhCalc.add(node.pre_qc_tp, node.qc_tp);
         node.end_gather_tp = ZhCalc.add(node.pre_gather_tp, node.gather_tp);
+        node.end_final_tp = ZhCalc.add(node.end_qc_tp, node.total_price);
+        node.end_gather_percent = ZhCalc.mul(ZhCalc.div(node.end_gather_tp, node.end_final_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);
@@ -186,6 +187,8 @@ $(document).ready(() => {
         pos.end_contract_qty = ZhCalc.add(pos.pre_contract_qty, pos.contract_qty);
         pos.end_qc_qty = ZhCalc.add(pos.pre_qc_qty, pos.qc_qty);
         pos.end_gather_qty = ZhCalc.add(pos.pre_gather_qty, pos.gather_qty);
+        pos.sum = ZhCalc.add(pos.end_qc_qty, pos.quantity);
+        pos.end_gather_percent = ZhCalc.mul(ZhCalc.div(pos.end_gather_qty, pos.sum), 100, 2);
     };
     const stagePos = new StagePosData(stagePosSetting);
 
@@ -1403,7 +1406,7 @@ $(document).ready(() => {
                         }
                         if (checkEmpty) {
                             if (sd.quantity) {
-                                if (!sd.end_gather_qty || ZhCalc.sub(ZhCalc(sd.quantity, ad.end_qc_qty), sd.end_gather_qty) > 0) match = true;
+                                if (!sd.end_gather_qty || ZhCalc.sub(ZhCalc.add(sd.quantity, sd.end_qc_qty), sd.end_gather_qty) > 0) match = true;
                             }
                         }
                         if (keyword && keyword !== '' && sd.name && sd.name.indexOf(keyword) === -1) match = false;

+ 2 - 2
app/public/js/stage_gather.js

@@ -53,8 +53,8 @@ $(document).ready(function () {
         }
     });
     // 解析清单汇总数据
-    gclGatherModel.loadLedgerData(ledger, curLedgerData, []);
-    gclGatherModel.loadPosData(pos, curPosData);
+    gclGatherModel.loadLedgerData(ledger, curLedgerData, preLedgerData);
+    gclGatherModel.loadPosData(pos, curPosData, prePosData);
     gclGatherModel.loadDealBillsData(dealBills);
     const gclGatherData = gclGatherModel.gatherGclData();
     // 获取项目节数据

+ 2 - 0
app/view/stage/gather.ejs

@@ -85,7 +85,9 @@
     const leafXmjSpreadSetting = JSON.parse('<%- JSON.stringify(leafXmjSpread) %>');
     const ledger = JSON.parse('<%- JSON.stringify(ledger) %>');
     const curLedgerData = JSON.parse('<%- JSON.stringify(curLedgerData) %>');
+    const preLedgerData = JSON.parse('<%- JSON.stringify(preLedgerData) %>');
     const pos = JSON.parse('<%- JSON.stringify(pos) %>');
     const curPosData = JSON.parse('<%- JSON.stringify(curPosData) %>');
+    const prePosData = JSON.parse('<%- JSON.stringify(prePosData) %>');
     const dealBills = JSON.parse('<%- JSON.stringify(dealBills) %>');
 </script>