Jelajahi Sumber

台账,签约相关

MaiXinRong 5 tahun lalu
induk
melakukan
02524780d7

+ 13 - 6
app/base/base_bills_service.js

@@ -16,6 +16,7 @@ const readOnlyFields = ['id', 'tender_id', 'ledger_id', 'ledger_pid', 'order', '
 const upFields = ['unit_price'];
 const qtyFields = ['sgfh_qty', 'sjcl_qty', 'qtcl_qty', 'quantity', 'deal_qty', 'dgn_qty1', 'dgn_qty2'];
 const tpFields = ['sgfh_tp', 'sjcl_tp', 'qtcl_tp', 'total_price', 'deal_tp'];
+const measureType = require('../const/tender').measureType;
 
 class BaseBillsSerivce extends TreeService {
 
@@ -462,7 +463,7 @@ class BaseBillsSerivce extends TreeService {
 
         const datas = [];
         for (const node of cacheData.items) {
-            datas.push({
+            const data = {
                 id: node.id, tender_id: this.ctx.tender.id,
                 ledger_id: node.ledger_id,
                 ledger_pid: node.ledger_pid,
@@ -473,13 +474,19 @@ class BaseBillsSerivce extends TreeService {
                 b_code: node.b_code,
                 name: node.name,
                 unit: node.unit,
-                sgfh_qty: node.sgfh_qty,
-                sgfh_tp: node.sgfh_tp,
-                quantity: node.quantity,
                 unit_price: node.unit_price,
-                total_price: node.total_price,
                 crid: node.crid,
-            });
+            };
+            if (this.ctx.tender.data.measure_type === measureType.tz.value) {
+                data.sgfh_qty = node.quantity;
+                data.sgfh_tp = node.total_price;
+                data.quantity = node.quantity;
+                data.total_price = node.total_price;
+            } else if (this.ctx.tender.data.measure_type === measureType.gcl.value) {
+                data.deal_qty = node.quantity;
+                data.deal_tp = node.total_price;
+            }
+            datas.push(data);
         }
         const conn = await this.db.beginTransaction();
         try {

+ 58 - 4
app/const/spread.js

@@ -98,6 +98,62 @@ const withoutCl = {
         font: '12px 微软雅黑',
     }
 };
+const withClGcl = {
+    ledger: {
+        cols: [
+            {title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 145, formatter: '@', cellType: 'tree'},
+            {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 70, formatter: '@'},
+            {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 185, formatter: '@'},
+            {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', cellType: 'unit'},
+            {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
+            {title: '项目节数量|数量1',  colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 60, type: 'Number'},
+            {title: '|数量2',  colSpan: '|1', rowSpan: '|1', field: 'dgn_qty2', hAlign: 2, width: 60, type: 'Number'},
+            {title: '经济指标',  colSpan: '1', rowSpan: '2', field: 'dgn_price', hAlign: 2, width: 60, type: 'Number', readOnly: true},
+            {title: '设计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'sgfh_qty', hAlign: 2, width: 60, type: 'Number'},
+            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'sgfh_tp', hAlign: 2, width: 60, type: 'Number', readOnly: true},
+            {title: '设计错漏增减|数量', colSpan: '2|1', rowSpan: '1|1', field: 'sjcl_qty', hAlign: 2, width: 60, type: 'Number'},
+            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'sjcl_tp', hAlign: 2, width: 60, type: 'Number', readOnly: true},
+            {title: '其他错漏增减|数量', colSpan: '2|1', rowSpan: '1|1', field: 'qtcl_qty', hAlign: 2, width: 60, type: 'Number'},
+            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'qtcl_tp', hAlign: 2, width: 60, type: 'Number', readOnly: true},
+            {title: '台账小计|数量', colSpan: '2|1', rowSpan: '1|1', field: 'quantity', hAlign: 2, width: 60, type: 'Number', readOnly: true},
+            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 60, type: 'Number', readOnly: true},
+            {title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@'},
+            {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'}
+        ],
+        emptyRows: 3,
+        headRows: 2,
+        headRowHeight: [25, 25],
+        defaultRowHeight: 21,
+        headerFont: '12px 微软雅黑',
+        font: '12px 微软雅黑',
+    }
+};
+const withoutClGcl = {
+    ledger: {
+        cols: [
+            {title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 145, formatter: '@', cellType: 'tree'},
+            {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 70, formatter: '@'},
+            {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 185, formatter: '@'},
+            {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', cellType: 'unit'},
+            {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
+            {title: '签约|数量', colSpan: '2|1', rowSpan: '1|1', field: 'deal_qty', hAlign: 2, width: 60, type: 'Number'},
+            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'deal_tp', hAlign: 2, width: 60, type: 'Number', readOnly: true},
+            {title: '项目节数量|数量1',  colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 60, type: 'Number'},
+            {title: '|数量2',  colSpan: '|1', rowSpan: '|1', field: 'dgn_qty2', hAlign: 2, width: 60, type: 'Number'},
+            {title: '经济指标',  colSpan: '1', rowSpan: '2', field: 'dgn_price', hAlign: 2, width: 60, type: 'Number', readOnly: true},
+            {title: '设计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'sgfh_qty', hAlign: 2, width: 60, type: 'Number'},
+            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'sgfh_tp', hAlign: 2, width: 60, type: 'Number', readOnly: true},
+            {title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 80, formatter: '@'},
+            {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'}
+        ],
+        emptyRows: 3,
+        headRows: 2,
+        headRowHeight: [25, 25],
+        defaultRowHeight: 21,
+        headerFont: '12px 微软雅黑',
+        font: '12px 微软雅黑',
+    }
+};
 // 期 -- 本期计量台账
 const stageTz = {
     ledger: {
@@ -292,10 +348,6 @@ const stageNoCl = {
         font: '12px 微软雅黑',
     }
 };
-// 期 -- 部位台账
-const stageBwtz = {
-
-};
 // 期 -- 清单汇总
 const stageGather = {
     gcl: {
@@ -449,6 +501,8 @@ measure.compare.pos = {
 module.exports = {
     withCl,
     withoutCl,
+    withClGcl,
+    withoutClGcl,
     stageTz,
     stageCl,
     stageNoCl,

+ 4 - 2
app/controller/ledger_controller.js

@@ -78,13 +78,15 @@ module.exports = app => {
             // const tpFormatter = this.ctx.helper.getNumberFormatter(this.ctx.tender.info.decimal.tp);
             // const upFormatter = this.ctx.helper.getNumberFormatter(this.ctx.tender.info.decimal.up);
             const tender = this.ctx.tender;
-            const setting = tender.info.display.ledger.clQty ? spreadConst.withCl : spreadConst.withoutCl;
+            const setting = tender.data.measure_type === measureType.tz.value
+                ? (tender.info.display.ledger.clQty ? spreadConst.withCl : spreadConst.withoutCl)
+                : (tender.info.display.ledger.clQty ? spreadConst.withClGcl : spreadConst.withoutClGcl);
             const ledger = JSON.parse(JSON.stringify(setting.ledger));
             // setColFormat(ledger.cols, 'unit_price', upFormatter);
             // setColFormat(ledger.cols, 'dgn_price', upFormatter);
             // setColFormat(ledger.cols, 'total_price', tpFormatter);
             // setColFormat(ledger.cols, 'deal_tp', tpFormatter);
-            const pos = JSON.parse(JSON.stringify(setting.pos));
+            const pos = setting.pos ? JSON.parse(JSON.stringify(setting.pos)) : {};
 
             if (this._ledgerReadOnly(tender.data)) {
                 ledger.readOnly = true;

+ 3 - 1
app/controller/revise_controller.js

@@ -189,7 +189,9 @@ module.exports = app => {
                 });
             }
             const tender = this.ctx.tender;
-            const setting = tender.info.display.ledger.clQty ? spreadConst.withCl : spreadConst.withoutCl;
+            const setting = tender.data.measure_type === measureType.tz.value
+                ? (tender.info.display.ledger.clQty ? spreadConst.withCl : spreadConst.withoutCl)
+                : (tender.info.display.ledger.clQty ? spreadConst.withClGcl : spreadConst.withoutClGcl);
             const ledger = JSON.parse(JSON.stringify(setting.ledger));
             const pos = JSON.parse(JSON.stringify(setting.pos));
 

+ 3 - 2
app/controller/stage_controller.js

@@ -87,8 +87,9 @@ module.exports = app => {
             // const tpFormatter = this.ctx.helper.getNumberFormatter(this.ctx.tender.info.decimal.tp);
             // const upFormatter = this.ctx.helper.getNumberFormatter(2);
             const tender = this.ctx.tender, stage = this.ctx.stage;
-            const stageSetting = tender.data.measure_type === measureType.tz.value ? spreadConst.stageTz :
-                (tender.info.display.ledger.clQty ? spreadConst.stageCl : spreadConst.stageNoCl);
+            const stageSetting = tender.data.measure_type === measureType.tz.value
+                ? spreadConst.stageTz
+                : (tender.info.display.ledger.clQty ? spreadConst.stageCl : spreadConst.stageNoCl);
             const ledger = JSON.parse(JSON.stringify(stageSetting.ledger));
             // setColFormat(ledger.cols, 'unit_price', upFormatter);
             // setColFormat(ledger.cols, 'total_price', tpFormatter);

+ 20 - 65
app/lib/analysis_excel.js

@@ -205,8 +205,7 @@ class ImportBaseTree {
             pos.add_user = this.ctx.session.sessionUser.accountId;
             this.finalNode.pos.push(pos);
             this.pos.push(pos);
-            pos.sgfh_qty = this.ctx.helper.round(pos.sgfh_qty, this.finalPrecision.value);
-            pos.quantity = pos.sgfh_qty;
+            pos.quantity = this.ctx.helper.round(pos.quantity, this.finalPrecision.value);
             return pos;
         }
     }
@@ -235,28 +234,12 @@ class ImportBaseTree {
         for (const node of this.items) {
             if (node.children && node.children.length > 0) { continue; }
             if (!node.pos || node.pos.length === 0) { continue; }
-            // node.sgfh_qty = this.ctx.helper.sum(_.map(node.pos, 'sgfh_qty'));
-            // if (node.sgfh_qty && node.unit_price) {
-            //     node.sgfh_tp = this.ctx.helper.round(this.ctx.helper.mul(node.sgfh_qty, node.unit_price),
-            //         this.ctx.tender.info.decimal.tp);
-            // } else {
-            //     node.sgfh_tp = null;
-            // }
-            // node.quantity = this.ctx.helper.sum(_.map(node.pos, 'quantity'));
-            // if (node.quantity && node.unit_price) {
-            //     node.total_price = this.ctx.helper.round(this.ctx.helper.mul(node.quantity, node.unit_price),
-            //         this.ctx.tender.info.decimal.tp);
-            // } else {
-            //     node.total_price = null;
-            // }
-            node.sgfh_qty = this.ctx.helper.sum(_.map(node.pos, 'sgfh_qty'));
-            if (node.sgfh_qty && node.unit_price) {
-                node.sgfh_tp = this.ctx.helper.mul(node.sgfh_qty, node.unit_price, this.ctx.tender.info.decimal.tp);
+            node.quantity = this.ctx.helper.sum(_.map(node.pos, 'quantity'));
+            if (node.quantity && node.unit_price) {
+                node.total_price = this.ctx.helper.mul(node.quantity, node.unit_price, this.ctx.tender.info.decimal.tp);
             } else {
-                node.sgfh_tp = null;
+                node.total_price = null;
             }
-            node.quantity = node.sgfh_qty;
-            node.total_price = node.sgfh_tp;
         }
     }
 }
@@ -274,7 +257,7 @@ class AnalysisExcelTree {
             pos: ['部位明细'],
             name: ['名称'],
             unit: ['单位'],
-            sgfh_qty: ['清单数量'], // 施工图复核数量
+            quantity: ['清单数量'],
             dgn_qty1: ['设计数量1'],
             dgn_qty2: ['设计数量2'],
             unit_price: ['单价'],
@@ -295,30 +278,17 @@ class AnalysisExcelTree {
         node.name = this.ctx.helper.replaceReturn(row[this.colsDef.name]);
         node.unit = this.ctx.helper.replaceReturn(row[this.colsDef.unit]);
         const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, node.unit);
-        node.sgfh_qty = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.sgfh_qty]), precision.value);
+        node.quantity = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.quantity]), precision.value);
         node.dgn_qty1 = aeUtils.toNumber(row[this.colsDef.dgn_qty1]);
         node.dgn_qty2 = aeUtils.toNumber(row[this.colsDef.dgn_qty2]);
         node.unit_price = aeUtils.toNumber(row[this.colsDef.unit_price]);
         node.drawing_code = this.ctx.helper.replaceReturn(row[this.colsDef.drawing_code]);
         node.memo = this.ctx.helper.replaceReturn(row[this.colsDef.memo]);
-        // if (node.sgfh_qty && node.unit_price) {
-        //     node.sgfh_tp = this.ctx.helper.round(this.ctx.helper.mul(node.sgfh_qty, node.unit_price), this.ctx.tender.info.decimal.tp);
-        // } else {
-        //     node.sgfh_tp = null;
-        // }
-        // node.quantity = node.sgfh_qty;
-        // if (node.quantity && node.unit_price) {
-        //     node.total_price = this.ctx.helper.round(this.ctx.helper.mul(node.quantity, node.unit_price), this.ctx.tender.info.decimal.tp);
-        // } else {
-        //     node.total_price = null;
-        // }
-        if (node.sgfh_qty && node.unit_price) {
-            node.sgfh_tp = this.ctx.helper.mul(node.sgfh_qty, node.unit_price, this.ctx.tender.info.decimal.tp);
+        if (node.quantity && node.unit_price) {
+            node.total_price = this.ctx.helper.mul(node.quantity, node.unit_price, this.ctx.tender.info.decimal.tp);
         } else {
-            node.sgfh_tp = null;
+            node.total_price = null;
         }
-        node.quantity = node.sgfh_qty;
-        node.total_price = node.sgfh_tp;
         return this.cacheTree.addXmjNode(node);
     }
     /**
@@ -333,28 +303,15 @@ class AnalysisExcelTree {
         node.name = this.ctx.helper.replaceReturn(row[this.colsDef.name]);
         node.unit = this.ctx.helper.replaceReturn(row[this.colsDef.unit]);
         const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, node.unit);
-        node.sgfh_qty = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.sgfh_qty]), precision.value);
+        node.quantity = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.quantity]), precision.value);
         node.unit_price = aeUtils.toNumber(row[this.colsDef.unit_price]);
         node.drawing_code = this.ctx.helper.replaceReturn(row[this.colsDef.drawing_code]);
         node.memo = this.ctx.helper.replaceReturn(row[this.colsDef.memo]);
-        // if (node.sgfh_qty && node.unit_price) {
-        //     node.sgfh_tp = this.ctx.helper.round(this.ctx.helper.mul(node.sgfh_qty, node.unit_price), this.ctx.tender.info.decimal.tp);
-        // } else {
-        //     node.sgfh_tp = null;
-        // }
-        // node.quantity = node.sgfh_qty;
-        // if (node.quantity && node.unit_price) {
-        //     node.total_price = this.ctx.helper.round(this.ctx.helper.mul(node.quantity, node.unit_price), this.ctx.tender.info.decimal.tp);
-        // } else {
-        //     node.total_price = null;
-        // }
-        if (node.sgfh_qty && node.unit_price) {
-            node.sgfh_tp = this.ctx.helper.mul(node.sgfh_qty, node.unit_price, this.ctx.tender.info.decimal.tp);
+        if (node.quantity && node.unit_price) {
+            node.total_price = this.ctx.helper.mul(node.quantity, node.unit_price, this.ctx.tender.info.decimal.tp);
         } else {
-            node.sgfh_tp = null;
+            node.total_price = null;
         }
-        node.quantity = node.sgfh_qty;
-        node.total_price = node.sgfh_tp;
         return this.cacheTree.addGclNode(node);
     }
     /**
@@ -366,7 +323,7 @@ class AnalysisExcelTree {
     _loadPos(row) {
         const pos = {};
         pos.name = this.ctx.helper.replaceReturn(row[this.colsDef.name]);
-        pos.sgfh_qty = aeUtils.toNumber(row[this.colsDef.sgfh_qty]);
+        pos.quantity = aeUtils.toNumber(row[this.colsDef.quantity]);
         pos.drawing_code = this.ctx.helper.replaceReturn(row[this.colsDef.drawing_code]);
         return this.cacheTree.addPos(pos);
     }
@@ -529,7 +486,7 @@ class AnalysisGclExcelTree {
             b_code: ['编号', '清单编号', '子目号'],
             name: ['名称'],
             unit: ['单位'],
-            sgfh_qty: ['清单数量'], // 施工图复核数量
+            quantity: ['清单数量'], // 施工图复核数量
             unit_price: ['单价'],
         };
     }
@@ -553,15 +510,13 @@ class AnalysisGclExcelTree {
 
         node.unit = this.ctx.helper.replaceReturn(row[this.colsDef.unit]);
         const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, node.unit);
-        node.sgfh_qty = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.sgfh_qty]), precision.value);
+        node.quantity = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.quantity]), precision.value);
         node.unit_price = aeUtils.toNumber(row[this.colsDef.unit_price]);
-        if (node.sgfh_qty && node.unit_price) {
-            node.sgfh_tp = this.ctx.helper.mul(node.sgfh_qty, node.unit_price, this.ctx.tender.info.decimal.tp);
+        if (node.quantity && node.unit_price) {
+            node.total_price = this.ctx.helper.mul(node.quantity, node.unit_price, this.ctx.tender.info.decimal.tp);
         } else {
-            node.sgfh_tp = null;
+            node.total_price = null;
         }
-        node.quantity = node.sgfh_qty;
-        node.total_price = node.sgfh_tp;
         return this.cacheTree.addNode(node);
     }
 

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

@@ -970,7 +970,7 @@ $(document).ready(function() {
             selector: '#ledger-spread',
             build: function ($trigger, e) {
                 const target = SpreadJsObj.safeRightClickSelection($trigger, e, ledgerSpread);
-                return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
+                return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader;
             },
             items: {
                 'create': {

+ 21 - 7
app/service/ledger.js

@@ -28,6 +28,7 @@ const qtyFields = ['sgfh_qty', 'sjcl_qty', 'qtcl_qty', 'quantity', 'deal_qty', '
 const tpFields = ['sgfh_tp', 'sjcl_tp', 'qtcl_tp', 'total_price', 'deal_tp'];
 const rootId = -1;
 const keyPre = 'tender_node_maxId:';
+const measureType = require('../const/tender').measureType;
 
 module.exports = app => {
 
@@ -478,6 +479,12 @@ module.exports = app => {
                         id: selectData.id,
                         is_leaf: false,
                         unit_price: null,
+                        sgfh_qty: null,
+                        sgfh_tp: null,
+                        sjcl_qty: null,
+                        sjcl_tp: null,
+                        qtcl_qty: null,
+                        qtcl_tp: null,
                         quantity: null,
                         total_price: null,
                         deal_qty: null,
@@ -684,7 +691,7 @@ module.exports = app => {
                 await transaction.delete(this.ctx.service.pos.tableName, {tid: this.ctx.tender.id});
                 const datas = [];
                 for (const node of cacheTree.items) {
-                    datas.push({
+                    const data = {
                         id: node.id,
                         tender_id: this.ctx.tender.id,
                         ledger_id: node.ledger_id,
@@ -697,19 +704,26 @@ module.exports = app => {
                         b_code: node.b_code,
                         name: node.name,
                         unit: node.unit,
-                        sgfh_qty: node.sgfh_qty,
-                        sgfh_tp: node.sgfh_tp,
-                        quantity: node.quantity,
                         unit_price: node.unit_price,
-                        total_price: node.total_price,
                         dgn_qty1: node.dgn_qty1,
                         dgn_qty2: node.dgn_qty2,
                         memo: node.memo,
                         drawing_code: node.drawing_code,
-                    });
+                    };
+                    if (this.ctx.tender.data.measure_type === measureType.tz.value) {
+                        data.sgfh_qty = node.quantity;
+                        data.sgfh_tp = node.total_price;
+                        data.quantity = node.quantity;
+                        data.total_price = node.total_price;
+                    } else if (this.ctx.tender.data.measure_type === measureType.gcl.value) {
+                        data.deal_qty = node.quantity;
+                        data.deal_tp = node.total_price;
+                    }
+                    datas.push(data);
                 }
                 await transaction.insert(this.tableName, datas);
-                if (cacheTree.pos && cacheTree.pos.length > 0) {
+                if (this.ctx.tender.data.measure_type === measureType.tz.value
+                    && cacheTree.pos && cacheTree.pos.length > 0) {
                     await transaction.insert(this.ctx.service.pos.tableName, cacheTree.pos);
                 }
                 await transaction.commit();