浏览代码

修复旧数据checked_amount值保存问题

ellisran 11 月之前
父节点
当前提交
c288931579
共有 2 个文件被更改,包括 5 次插入2 次删除
  1. 3 2
      db_script/change_bills.js
  2. 2 0
      sql/update.sql

+ 3 - 2
db_script/change_bills.js

@@ -2,6 +2,7 @@
 
 const defaultInfo = require('../app/const/tender_info');
 const BaseUtil = require('./baseUtils');
+const status = require('../app/const/audit').change.status;
 const querySql = BaseUtil.querySql;
 const ZhCalc = BaseUtil.ZhCalc;
 
@@ -23,7 +24,7 @@ const doComplete = async function() {
             const info = await querySql('Select * From zh_tender_info where tid = ?', [t.id]);
             const decimal = info.length > 0 && info[0].decimal ? JSON.parse(info[0].decimal) : defaultInfo.defaultInfo.decimal;
 
-            const changes = await querySql('Select * From zh_change where tid = ?', [t.id]);
+            const changes = await querySql('Select * From zh_change where tid = ? AND status = ?', [t.id, status.checked]);
             for (const c of changes) {
                 await checkChange(c, decimal);
             }
@@ -57,4 +58,4 @@ if (tenderId) {
     doCompleteTest(tenderId);
 } else {
     doComplete()
-}
+}

+ 2 - 0
sql/update.sql

@@ -10,6 +10,8 @@ ADD COLUMN `unvaluation_tp` decimal(30, 8) NULL DEFAULT 0 COMMENT '不计价金
 ALTER TABLE `zh_change`
 MODIFY COLUMN `positive_tp` decimal(30, 8) NOT NULL DEFAULT 0.00000000 COMMENT '正变更金额' AFTER `order_by`,
 MODIFY COLUMN `negative_tp` decimal(30, 8) NOT NULL DEFAULT 0.00000000 COMMENT '负变更金额' AFTER `positive_tp`,
+--修复转换值问题,并且需要再运行一次db_script/check_bills更新checked_price方法
+UPDATE `zh_change_audit_list` SET `checked_amount` = CONVERT(`samount`, DECIMAL(30, 8)) WHERE `samount` != '';
 
 ALTER TABLE `zh_ledger_attachment`
 MODIFY COLUMN `tid` int(11) UNSIGNED NOT NULL COMMENT '标段id' AFTER `id`,