瀏覽代碼

工程量清单模式,计量单元,移除设计量相关

MaiXinRong 3 年之前
父節點
當前提交
f17fed0365

+ 0 - 5
app/const/spread.js

@@ -310,10 +310,6 @@ const stageCl = {
             {title: '计量单元', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 180, formatter: '@'},
             {title: 'ex_memo1', colSpan: '1', rowSpan: '2', field: 'ex_memo1', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'},
             {title: '位置', colSpan: '1', rowSpan: '2', field: 'position', hAlign: 0, width: 60, formatter: '@'},
-            {title: '台账数量|施工图复核', colSpan: '4|1', rowSpan: '1|1', field: 'sgfh_qty', hAlign: 2, width: 60, type: 'Number'},
-            {title: '|设计错漏增减', colSpan: '1', rowSpan: '|1', field: 'sjcl_qty', hAlign: 2, width: 60, type: 'Number'},
-            {title: '|其他错漏增减', colSpan: '1', rowSpan: '|1', field: 'qtcl_qty', hAlign: 2, width: 60, type: 'Number'},
-            {title: '|小计', colSpan: '1', rowSpan: '|1', field: 'quantity', hAlign: 2, width: 60, readOnly: true},
             {title: '现场实际数量', colSpan: '1', rowSpan: '2', field: 'real_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '预计变更数量', colSpan: '1', rowSpan: '2', field: 'estimate_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true},
             {title: '本期计量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
@@ -391,7 +387,6 @@ const stageNoCl = {
             {title: '计量单元', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 180, formatter: '@'},
             {title: '位置', colSpan: '1', rowSpan: '2', field: 'position', hAlign: 0, width: 60, formatter: '@'},
             {title: 'ex_memo1', colSpan: '1', rowSpan: '2', field: 'ex_memo1', hAlign: 0, width: 100, formatter: '@', cellType: 'ellipsisAutoTip'},
-            {title: '设计量', colSpan: '1', rowSpan: '2', field: 'sgfh_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '现场实际数量', colSpan: '1', rowSpan: '2', field: 'real_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '预计变更数量', colSpan: '1', rowSpan: '2', field: 'estimate_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true},
             {title: '本期计量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},

+ 2 - 13
app/controller/ledger_controller.js

@@ -90,23 +90,11 @@ module.exports = app => {
                     }
                 }
             }
-            function setColFormat(cols, field, formatter) {
-                const col = _.find(cols, function(c) {
-                    return c.field === field;
-                });
-                col.formatter = formatter;
-            }
-            // 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.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 = setting.pos ? JSON.parse(JSON.stringify(setting.pos)) : spreadConst.blank;
 
             if (this._ledgerReadOnly(tender.data)) {
@@ -502,7 +490,7 @@ module.exports = app => {
                 ctx.tender.info.ledger_check.same_code && checkData.checkSameCode();
                 ctx.tender.info.ledger_check.sibling && checkData.checkSibling();
 
-                checkData.checkBillsQty(['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity']);
+                if (ctx.tender.data.measure_type === measureType.tz.value) checkData.checkBillsQty(['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity']);
                 checkData.checkBillsTp([
                     {qty: 'sgfh_qty', tp: 'sgfh_tp'}, {qty: 'qtcl_qty', tp: 'qtcl_tp'},
                     {qty: 'sjcl_qty', tp: 'sjcl_tp'}, {qty: 'quantity', tp: 'total_price'}
@@ -726,6 +714,7 @@ module.exports = app => {
         async gather(ctx) {
             try {
                 const renderData = {
+                    measureType,
                     tender: ctx.tender.data,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.ledger.gather),
                 };

+ 6 - 4
app/controller/revise_controller.js

@@ -470,7 +470,7 @@ module.exports = app => {
                 ctx.tender.info.ledger_check.same_code && reviseCheck.checkSameCode();
                 ctx.tender.info.ledger_check.sibling && reviseCheck.checkSibling();
 
-                reviseCheck.checkBillsQty(['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity']);
+                if (ctx.tender.data.measure_type === measureType.tz.value) reviseCheck.checkBillsQty(['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity']);
                 reviseCheck.checkBillsTp([
                     {qty: 'sgfh_qty', tp: 'sgfh_tp'}, {qty: 'qtcl_qty', tp: 'qtcl_tp'},
                     {qty: 'sjcl_qty', tp: 'sjcl_tp'}, {qty: 'quantity', tp: 'total_price'}
@@ -735,11 +735,10 @@ module.exports = app => {
          */
         async deal2sgfh(ctx) {
             try {
-                const revise = await this.checkRevise(ctx);
                 if (this.ctx.tender.measure_type === measureType.tz.value) throw '该功能仅工程量清单模式可用';
 
-                await this.ctx.service.revise.deal2sgfh(ctx.tender.id);
-                const ledgerData = await ctx.service.revise.getData(ctx.tender.id);
+                await this.ctx.service.reviseBills.deal2sgfh(ctx.tender.id);
+                const ledgerData = await ctx.service.reviseBills.getData(ctx.tender.id);
                 ctx.body = { err: 0, msg: '', data: { bills: ledgerData } };
             } catch (err) {
                 this.log(err);
@@ -951,12 +950,14 @@ module.exports = app => {
                 case 'bills':
                     return ctx.revise.preHis ? await this.ctx.helper.loadLedgerDataFromOss(ctx.revise.preHis.bills_file) : [];
                 case 'pos':
+                    if (ctx.tender.data.measure_type === measureType.gcl.value) return [];
                     return ctx.revise.preHis ? await this.ctx.helper.loadLedgerDataFromOss(ctx.revise.preHis.pos_file) : [];
                 case 'reviseBills':
                     return ctx.revise.readOnly && ctx.revise.curHis
                         ? await this.ctx.helper.loadLedgerDataFromOss(ctx.revise.curHis.bills_file)
                         : await ctx.service.reviseBills.getAllDataByCondition({ where: { tender_id: ctx.tender.id } });
                 case 'revisePos':
+                    if (ctx.tender.data.measure_type === measureType.gcl.value) return [];
                     return ctx.revise.readOnly && ctx.revise.curHis
                         ? await this.ctx.helper.loadLedgerDataFromOss(ctx.revise.curHis.pos_file)
                         : await ctx.service.revisePos.getAllDataByCondition({ where: { tid: ctx.tender.id } });
@@ -1004,6 +1005,7 @@ module.exports = app => {
             if (!revise) throw '台账修订数据有误';
 
             const renderData = {
+                measureType,
                 preUrl: ctx.url.replace('/gcl-compare', ''),
                 revise,
                 jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.revise.gclCompare),

+ 2 - 27
app/controller/stage_controller.js

@@ -94,25 +94,12 @@ module.exports = app => {
                     return cols.indexOf(c.field) > -1;
                 });
             }
-            function setColFormat(cols, field, formatter) {
-                const filterCols = cols.filter(function(c) {
-                    return c.field.search(field) !== -1;
-                });
-                for (const col of filterCols) {
-                    col.formatter = formatter;
-                }
-            }
-            // 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 ledger = JSON.parse(JSON.stringify(stageSetting.ledger));
-            // setColFormat(ledger.cols, 'unit_price', upFormatter);
-            // setColFormat(ledger.cols, 'total_price', tpFormatter);
-            // setColFormat(ledger.cols, 'tp', tpFormatter);
             if (!tender.info.display.ledger.dgnQty) {
                 removeFieldCols(ledger, spreadConst.filterCols.stageDgnCols);
             }
@@ -382,7 +369,6 @@ module.exports = app => {
                 checkData.loadData(ledgerData, posData);
                 await this.ctx.service.s2bProj.refreshSessionS2b();
                 checkData.check3fLimit(ctx.tender.data);
-                checkData.checkBillsQty(['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity']);
 
                 projRela.banOver && ctx.tender.info.ledger_check.over && checkData.checkOverRange(['contract_qty', 'qc_qty']);
                 checkData.checkBillsTp([
@@ -1265,25 +1251,14 @@ module.exports = app => {
                     return cols.indexOf(c.field) > -1;
                 });
             }
-            function setColFormat(cols, field, formatter) {
-                const filterCols = cols.filter(function(c) {
-                    return c.field.search(field) !== -1;
-                });
-                for (const col of filterCols) {
-                    col.formatter = formatter;
-                }
-            }
-            // 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);
 
             const leafXmj = JSON.parse(JSON.stringify(spreadConst.stageGather.leafXmj));
             const tender = this.ctx.tender;
             if (tender.data.measure_type === measureType.tz.value) {
                 removeFieldCols(gcl, spreadConst.filterCols.tzWithoutCols);
+            } else {
+                removeFieldCols(leafXmj, ['quantity']);
             }
             return [gcl, leafXmj];
         }

+ 1 - 0
app/public/js/ledger_gather.js

@@ -98,6 +98,7 @@ $(document).ready(() => {
             colWidth: true,
         },
     };
+    if (!isTz) leafXmjSpreadSetting.cols.splice(1, 1);
     if (thousandth) sjsSettingObj.setTpThousandthFormat(leafXmjSpreadSetting);
     SpreadJsObj.initSheet(leafXmjSpread.getActiveSheet(), leafXmjSpreadSetting);
     const leafXmjSheet = leafXmjSpread.getActiveSheet();

+ 16 - 0
app/public/js/revise.js

@@ -1237,6 +1237,22 @@ $(document).ready(() => {
         billsContextMenuOptions.items.sprBlock = '----';
     }
     if (!readOnly) {
+        if (!isTz) {
+            billsContextMenuOptions.items.applyDeal2Sgfh = {
+                name: '填设计量',
+                icon: 'fa-pencil',
+                callback: function (key, opt) {
+                    postData(window.location.pathname + '/deal2sgfh', null, function (result) {
+                        billsTree.loadDatas(result.bills);
+                        treeCalc.calculateAll(billsTree);
+                        SpreadJsObj.loadSheetData(billsSheet, 'tree', billsTree);
+                    });
+                }
+            };
+            billsContextMenuOptions.items.sprSort = '----';
+        }
+    }
+    if (!readOnly) {
         billsContextMenuOptions.items.batchInsert = {
             name: '批量插入',
             type: 'batchInsert',

+ 1 - 0
app/public/js/revise_gcl_compare.js

@@ -101,6 +101,7 @@ $(document).ready(() => {
             colWidth: true,
         },
     };
+    if (!isTz) leafXmjSpreadSetting.cols.splice(1, 2);
     if (thousandth) sjsSettingObj.setTpThousandthFormat(leafXmjSpreadSetting);
     SpreadJsObj.initSheet(leafXmjSpread.getActiveSheet(), leafXmjSpreadSetting);
     const leafXmjSheet = leafXmjSpread.getActiveSheet();

+ 0 - 1
app/public/js/stage.js

@@ -4314,7 +4314,6 @@ $(document).ready(() => {
         checkOption: checkOption,
     };
     if (!checkTzMeasureType()) {
-        stageCheckerSetting.checkOption.calc.fields.push('sgfh_qty', 'sjcl_qty', 'qtcl_qty', 'quantity');
         stageCheckerSetting.checkOption.tp.fields.push(
             {qty: 'sgfh_qty', tp: 'sgfh_tp'},
             {qty: 'sjcl_qty', tp: 'sjcl_tp'},

+ 1 - 1
app/router.js

@@ -216,7 +216,6 @@ module.exports = app => {
     app.post('/tender/:id/revise/add', sessionAuth, tenderCheck, uncheckTenderCheck, 'reviseController.add');
     app.post('/tender/:id/revise/cancel', sessionAuth, tenderCheck, uncheckTenderCheck, 'reviseController.cancel');
     app.post('/tender/:id/revise/save', sessionAuth, tenderCheck, uncheckTenderCheck, 'reviseController.save');
-    // app.post('/tender/:id/revise/deal2sgfh', sessionAuth, tenderCheck, uncheckTenderCheck, 'reviseController.deal2sgfh');
 
     // 台账修订页面
     app.get('/tender/:id/revise/:rid/info', sessionAuth, tenderCheck, uncheckTenderCheck, reviseCheck, reviseAuditCheck, 'reviseController.info');
@@ -225,6 +224,7 @@ module.exports = app => {
     app.post('/tender/:id/revise/:rid/info/update', sessionAuth, tenderCheck, uncheckTenderCheck, reviseCheck, 'reviseController.update');
     app.post('/tender/:id/revise/:rid/info/upload-excel/:ueType', sessionAuth, tenderCheck, uncheckTenderCheck, reviseCheck, 'reviseController.uploadExcel');
     app.post('/tender/:id/revise/:rid/info/check', sessionAuth, tenderCheck, uncheckTenderCheck, reviseCheck, 'reviseController.checkData');
+    app.post('/tender/:id/revise/:rid/info/deal2sgfh', sessionAuth, tenderCheck, uncheckTenderCheck, reviseCheck, 'reviseController.deal2sgfh');
 
     app.get('/tender/:id/revise/:rid/compare', sessionAuth, tenderCheck, uncheckTenderCheck, reviseCheck, reviseAuditCheck, 'reviseController.compare');
     app.get('/tender/:id/revise/:rid/gcl-compare', sessionAuth, tenderCheck, uncheckTenderCheck, reviseCheck, reviseAuditCheck, 'reviseController.gclCompare');

+ 1 - 27
app/service/stage_pos.js

@@ -147,7 +147,7 @@ module.exports = app => {
          * @private
          */
         async _addStagePosData(data) {
-            let bills , precision, updateBills = null;
+            let bills , precision;
             const  result = {pos: [], ledger: []};
             const datas = data instanceof Array ? data : [data], calcStageBills = [];
             if (datas[0].sgfh_qty !== undefined || datas[0].sjcl_qty !== undefined || datas[0].qtcl_qty !== undefined
@@ -176,8 +176,6 @@ module.exports = app => {
                     if (d.sjcl_expr !== undefined) p.sjcl_expr = d.sjcl_expr;
                     if (d.qtcl_expr !== undefined) p.qtcl_expr = d.qtcl_expr;
                     p.quantity = this.ctx.helper.sum([p.sgfh_qty, p.sjcl_qty, p.qtcl_qty]);
-                    if (!updateBills)
-                        updateBills = {id: bills.id, sgfh_qty: bills.sgfh_qty, sjcl_qty: bills.sjcl_qty, qtcl_qty: bills.qtcl_qty};
                 }
                 if (d.real_qty!== undefined) p.real_qty = this.round(d.real_qty, precision.value);
                 insertPos.push(p);
@@ -203,34 +201,10 @@ module.exports = app => {
                     }
                 }
             }
-            if (updateBills) {
-                for (const d of insertPos) {
-                    if (d.sgfh_qty) {
-                        d.sgfh_qty = this.ctx.helper.round(d.sgfh_qty, precision.value);
-                        updateBills.sgfh_qty = this.ctx.helper.add(updateBills.sgfh_qty, d.sgfh_qty);
-                    }
-                    if (d.sjcl_qty) {
-                        d.sjcl_qty = this.ctx.helper.round(d.sjcl_qty, precision.value);
-                        updateBills.sjcl_qty = this.ctx.helper.add(updateBills.sjcl_qty, d.sjcl_qty);
-                    }
-                    if (d.qtcl_qty) {
-                        d.qtcl_qty = this.ctx.helper.round(d.qtcl_qty, precision.value);
-                        updateBills.qtcl_qty = this.ctx.helper.add(updateBills.qtcl_qty, d.qtcl_qty);
-                    }
-                    d.quantity = this.ctx.helper.sum([d.sgfh_qty, d.qtcl_qty, d.sjcl_qty]);
-                }
-                updateBills.quantity = this.ctx.helper.sum([updateBills.sgfh_qty, updateBills.qtcl_qty, updateBills.sjcl_qty]);
-                const info = this.ctx.tender.info;
-                updateBills.sgfh_tp = this.ctx.helper.mul(updateBills.sgfh_qty, bills.unit_price, info.decimal.tp);
-                updateBills.sjcl_tp = this.ctx.helper.mul(updateBills.sjcl_qty, bills.unit_price, info.decimal.tp);
-                updateBills.qtcl_tp = this.ctx.helper.mul(updateBills.qtcl_qty, bills.unit_price, info.decimal.tp);
-                updateBills.total_price = this.ctx.helper.mul(updateBills.quantity, bills.unit_price, info.decimal.tp);
-            }
 
             const transaction = await this.db.beginTransaction();
             try {
                 if (insertPos.length > 0) await transaction.insert(this.ctx.service.pos.tableName, insertPos);
-                if (updateBills) await transaction.update(this.ctx.service.ledger.tableName, updateBills);
                 if (insertPosStage.length > 0) await transaction.insert(this.tableName, insertPosStage);
 
                 for (const lid of calcStageBills) {

+ 1 - 0
app/view/ledger/gather.ejs

@@ -66,6 +66,7 @@
     </div>
 </div>
 <script>
+    const isTz = <%- ctx.tender.data.measure_type === measureType.tz.value %>;
     const chapter = JSON.parse('<%- JSON.stringify(ctx.tender.info.chapter) %>');
     const thousandth = <%- ctx.tender.info.display.thousandth %>;
 </script>

+ 1 - 0
app/view/revise/gcl_compare.ejs

@@ -74,6 +74,7 @@
     </div>
 </div>
 <script>
+    const isTz = <%- ctx.tender.data.measure_type === measureType.tz.value %>;
     const chapter = JSON.parse('<%- JSON.stringify(ctx.tender.info.chapter) %>');
     const thousandth = <%- ctx.tender.info.display.thousandth %>;
 </script>

+ 16 - 0
dev4gcl.js

@@ -0,0 +1,16 @@
+
+'use strict';
+
+/**
+ *
+ *
+ * @author Mai
+ * @date
+ * @version
+ */
+
+const fs = require('fs');
+const packageJSON = JSON.parse(fs.readFileSync(__dirname + '/package.json', 'utf8'));
+packageJSON.name = 'calc_gcl' ;
+packageJSON.scripts['start-qa-gcl'] = "egg-scripts start --daemon --port 7006";
+fs.writeFileSync(__dirname + '/package.json', JSON.stringify(packageJSON, '', '\t'));

+ 1 - 0
package.json

@@ -67,6 +67,7 @@
         "start": "egg-scripts start --daemon --port 7002",
         "stop": "egg-scripts stop",
         "start-qa": "set EGG_SERVER_ENV=qa&&egg-scripts start --daemon --port 7002",
+        "start-qa-gcl": "set EGG_SERVER_ENV=qa&&egg-scripts start --daemon --port 7006",
         "dev": "egg-bin dev --port 7002",
         "dev-local": "set EGG_SERVER_ENV=local&&egg-bin dev --port 7002",
         "dev-remoteqa": "set EGG_SERVER_ENV=remoteqa&&egg-bin dev --port 7002",