Explorar o código

负变更,计量不计价,调用变更令时匹配规则调整

MaiXinRong %!s(int64=2) %!d(string=hai) anos
pai
achega
36530e458d

+ 1 - 1
app/controller/budget_controller.js

@@ -205,7 +205,7 @@ module.exports = app => {
                     {title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 180, formatter: '@', cellType: 'tree'},
                     {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 120, formatter: '@'},
                     {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 230, formatter: '@'},
-                    {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', cellType: 'unit'},
+                    {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', cellType: 'unit', comboEdit: true},
                     {title: '设计数量|数量1', colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 80, type: 'Number'},
                     {title: '|数量2', colSpan: '|1', rowSpan: '|1', field: 'dgn_qty2', hAlign: 2, width: 80, type: 'Number'},
                     {title: '经济指标', colSpan: '1', rowSpan: '2', field: 'dgn_price', hAlign: 2, width: 80, type: 'Number', readOnly: true},

+ 2 - 1
app/controller/stage_controller.js

@@ -522,7 +522,8 @@ module.exports = app => {
                 }
                 const bills = data.bills ? data.bills : await ctx.service.ledger.getDataById(data.pos.lid);
                 const pos = data.pos;
-                const changes = await ctx.service.change.getValidChanges(ctx.tender, ctx.stage, data);
+                const projectFunInfo = await this.ctx.service.project.getFunRela(ctx.session.sessionProject.id);
+                const changes = await ctx.service.change.getValidChanges(ctx.tender, ctx.stage, data, projectFunInfo.minusNoValue && ctx.tender.info.fun_rela.stage_change.minusNoValue);
                 const useChanges = ctx.stage.readOnly
                     ? await ctx.service.stageChange.getAuditorStageData(ctx.tender.id, ctx.stage.id, ctx.stage.curTimes, ctx.stage.curOrder, bills.id, pos ? pos.id : -1)
                     : await ctx.service.stageChange.getLastestStageData(ctx.tender.id, ctx.stage.id, bills.id, pos ? pos.id : -1);

+ 13 - 6
app/service/change.js

@@ -1190,7 +1190,7 @@ module.exports = app => {
          * @param pos - 查询的部位
          * @return {Promise<*>} - 可用的变更令列表
          */
-        async getValidChanges(tender, stage, data) {
+        async getValidChanges(tender, stage, data, minusNoValue) {
             const bills = data.bills, pos = data.pos;
             const self = this;
             const getFilterPart = function(field, value) {
@@ -1220,11 +1220,18 @@ module.exports = app => {
                 '  ORDER BY c.in_time';
             const sqlParam = [tender.id, stage.order, tender.id, audit.flow.status.checked];
             let changes = await this.db.query(sql, sqlParam);
-            if (data.minus) {
-                changes = changes.filter(c => {
-                    c.bamount = c.b_amount ? parseFloat(c.b_amount) : 0;
-                    return c.bamount < 0;
-                })
+            if (minusNoValue) {
+                if (data.minus) {
+                    changes = changes.filter(c => {
+                        c.bamount = c.b_amount ? parseFloat(c.b_amount) : 0;
+                        return c.bamount < 0;
+                    });
+                } else {
+                    changes = changes.filter(c => {
+                        c.bamount = c.b_amount ? parseFloat(c.b_amount) : 0;
+                        return c.bamount >= 0;
+                    });
+                }
             }
             for (const c of changes) {
                 let sSql = 'SELECT * FROM ' + this.ctx.service.stageChange.tableName + ' WHERE sid = ? and cbid = ?';