Просмотр исходного кода

上报检查,提醒计算本期合同

MaiXinRong 21 часов назад
Родитель
Сommit
8b388e94a9

+ 7 - 0
app/controller/stage_controller.js

@@ -562,6 +562,12 @@ module.exports = app => {
                 if (ctx.stage.status === auditConst.status.uncheck || ctx.stage.status === auditConst.status.checkNo) {
                     await this._innerCheckChangeBillsOver(ctx, checkData);
                 }
+                if (!ctx.stage.update_expr_calc_time || (ctx.stage.update_calc_time && ctx.stage.update_expr_calc_time < ctx.stage.update_calc_time)) {
+                    const exprCount = await ctx.service.expr.count({ tid: ctx.stage.tid, calc_module: 'stage' });
+                    if (exprCount > 0) {
+                        checkData.checkResult.error.push({ errorType: 'expr_no_calc', name: '修改数据后,未计算本期合同计量' })
+                    }
+                }
                 ctx.body = { err: 0, msg: '', data: checkData.checkResult };
             } catch (err) {
                 this.log(err);
@@ -724,6 +730,7 @@ module.exports = app => {
                 }
                 await ctx.service.stage.updateCheckCalcFlag(ctx.stage, true);
                 await ctx.service.stage.updateCacheTime(ctx.stage.id);
+                if (data.isExprCalc) await ctx.service.stage.updateExprCalcTime(ctx.stage);
                 ctx.body = responseData;
             } catch (err) {
                 this.log(err);

+ 1 - 0
app/public/js/shares/cs_tools.js

@@ -87,6 +87,7 @@ const showSelectTab = function(select, spread, afterShow) {
                                 case 'minus_cb': return '负变更清单漏计';
                                 case 'change_over': return '变更令超计';
                                 case 'settle': return '结算清单';
+                                case 'expr_no_calc': return '公式计算';
                                 default: return '';
                             }
                         }

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

@@ -1884,7 +1884,7 @@ $(document).ready(() => {
                         return data;
                     });
 
-                    postData(window.location.pathname + '/update', {bills: { stage: updateData }}, function (result) {
+                    postData(window.location.pathname + '/update', {bills: { stage: updateData }, isExprCalc: true }, function (result) {
                         const nodes = stageTree.loadPostStageData(result);
                         stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes);
                         if (detail) {

+ 6 - 1
app/service/stage.js

@@ -756,7 +756,12 @@ module.exports = app => {
         }
 
         async updateCheckCalcFlag(stage, check) {
-            const result = await this.db.update(this.tableName, { id: stage.id, check_calc: check });
+            const result = await this.db.update(this.tableName, { id: stage.id, check_calc: check, update_calc_time: new Date() });
+            return result.affectedRows === 1;
+        }
+
+        async updateExprCalcTime(stage) {
+            const result = await this.db.update(this.tableName, { id: stage.id, update_expr_calc_time: new Date() });
             return result.affectedRows === 1;
         }
 

+ 3 - 0
sql/update.sql

@@ -15,6 +15,9 @@ ALTER TABLE `zh_tender`
 ADD COLUMN `share_token` varchar(20) NOT NULL DEFAULT '' COMMENT '标段分享token' AFTER `filter_fund`,
 ADD COLUMN `share_expiration` datetime NULL COMMENT '分享token到期时间' AFTER `share_token`;
 
+ALTER TABLE `zh_stage`
+ADD COLUMN `update_calc_time` timestamp NULL COMMENT '最后修改计算数据时间' AFTER `cache_time_l`,
+ADD COLUMN `update_expr_calc_time` timestamp NULL COMMENT '最后使用公式计算时间' AFTER `update_calc_time`;
 
 ------------------------------------
 -- 表数据