Pārlūkot izejas kodu

计量台账,切换空白计量单元,选中行颜色标记问题

MaiXinRong 1 gadu atpakaļ
vecāks
revīzija
66dafd8df1
2 mainītis faili ar 37 papildinājumiem un 34 dzēšanām
  1. 3 3
      app/public/js/stage.js
  2. 34 31
      db_script/depart_table.js

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

@@ -828,9 +828,9 @@ $(document).ready(() => {
                 });
                 if (def && def.color) return def.color;
             }
-        }
-        if (data.settle_status === settleStatus.finish) {
-            return spreadColor.stage.settle;
+            if (data.settle_status === settleStatus.finish) {
+                return spreadColor.stage.settle;
+            }
         }
         if (checkTzMeasureType()) {
             return hintOver && checkUtils.posOver(data)  ? spreadColor.stage.over : defaultColor;

+ 34 - 31
db_script/depart_table.js

@@ -1,14 +1,16 @@
 const BaseUtil = require('./baseUtils');
 
-const ledgerTables = ['zh_ledger', 'zh_ledger_extra', 'zh_revise_bills', 'zh_stage_bills', 'zh_stage_bills_final', 'zh_settle_bills'];
+const ledgerTables = ['zh_ledger', 'zh_ledger_extra', 'zh_revise_bills', 'zh_stage_bills', 'zh_stage_bills_final'];
 const ledgerDepartKey = ['tender_id', 'tid', 'tender_id', 'tid', 'tid', 'tid'];
-const posTables = ['zh_pos', 'zh_pos_extra', 'zh_revise_pos', 'zh_stage_pos', 'zh_stage_pos_final', 'zh_settle_pos'];
+const ledgerPrimaryKey = ['uuid', 'uuid', 'uuid', 'id', 'id', 'id'];
+const posTables = ['zh_pos', 'zh_pos_extra', 'zh_revise_pos', 'zh_stage_pos', 'zh_stage_pos_final'];
 const posDepartKey = ['tid', 'tid', 'tid', 'tid', 'tid', 'tid'];
+const posPrimaryKey = ['uuid', 'uuid', 'uuid', 'id', 'id', 'id'];
 const orgLedgerDepart = 10, orgPosDepart = 20;
-const tableDepart = 1000;
+const tableDepart = 100;
 
 const sqlArr = [];
-const getDepartSql = function (table, key, orgDepart, newDepart) {
+const getDepartSql = function (table, key, primaryKey, orgDepart, newDepart) {
     sqlArr.push(`-- ${table}`);
     sqlArr.push(`-- ${table} RENAME`);
     for (let i = 0; i < orgDepart; i++) {
@@ -17,41 +19,42 @@ const getDepartSql = function (table, key, orgDepart, newDepart) {
     sqlArr.push(`-- ${table} RE_DEPART`);
     for (let i = 0; i < newDepart; i++) {
         const orgDepartIndex = i % orgDepart;
-        sqlArr.push(`Create Table ${table}_${i} SELECT * FROM ${table}_bak_${orgDepartIndex} WHERE ${key} % 100 = ${i};`);
+        sqlArr.push(`Create Table ${table}_${i} LIKE ${table}_bak_${orgDepartIndex};`);
+        sqlArr.push(`INSERT INTO ${table}_${i} SELECT * FROM ${table}_bak_${orgDepartIndex} WHERE ${key} % 100 = ${i};`);
     }
     sqlArr.push('');
 };
-const getArrDepartSql = function(tableArr, keyArr, orgDepart, newDepart) {
+const getArrDepartSql = function(tableArr, keyArr, primaryKeyArr, orgDepart, newDepart) {
     for (let i = 0, iLen = tableArr.length; i < iLen; i++) {
-        getDepartSql(tableArr[i], keyArr[i], orgDepart, newDepart);
+        getDepartSql(tableArr[i], keyArr[i], primaryKeyArr[i], orgDepart, newDepart);
     }
 };
-getArrDepartSql(ledgerTables, ledgerDepartKey, orgLedgerDepart, tableDepart);
-getArrDepartSql(posTables, posDepartKey, orgPosDepart, tableDepart);
+getArrDepartSql(ledgerTables, ledgerDepartKey, ledgerPrimaryKey, orgLedgerDepart, tableDepart);
+getArrDepartSql(posTables, posDepartKey, posPrimaryKey, orgPosDepart, tableDepart);
 
-BaseUtil.saveBufferFile(sqlArr.join('\n'), BaseUtil.getFileName('depart_table.sql'));
+BaseUtil.saveBufferFile(sqlArr.join('\n'), BaseUtil.getFileName('depart_table_qa.sql'));
 
-Select Sum(amount) FROM (
-    Select Count(*) As amount From zh_settle_bills_bak_0
-    UNION ALL
-    Select Count(*) As amount From zh_settle_bills_bak_1
-    UNION ALL
-    Select Count(*) As amount From zh_settle_bills_bak_2
-    UNION ALL
-    Select Count(*) As amount From zh_settle_bills_bak_3
-    UNION ALL
-    Select Count(*) As amount From zh_settle_bills_bak_4
-    UNION ALL
-    Select Count(*) As amount From zh_settle_bills_bak_5
-    UNION ALL
-    Select Count(*) As amount From zh_settle_bills_bak_6
-    UNION ALL
-    Select Count(*) As amount From zh_settle_bills_bak_7
-    UNION ALL
-    Select Count(*) As amount From zh_settle_bills_bak_8
-    UNION ALL
-    Select Count(*) As amount From zh_settle_bills_bak_9
-) As temp;
+// Select Sum(amount) FROM (
+//     Select Count(*) As amount From zh_settle_bills_bak_0
+//     UNION ALL
+//     Select Count(*) As amount From zh_settle_bills_bak_1
+//     UNION ALL
+//     Select Count(*) As amount From zh_settle_bills_bak_2
+//     UNION ALL
+//     Select Count(*) As amount From zh_settle_bills_bak_3
+//     UNION ALL
+//     Select Count(*) As amount From zh_settle_bills_bak_4
+//     UNION ALL
+//     Select Count(*) As amount From zh_settle_bills_bak_5
+//     UNION ALL
+//     Select Count(*) As amount From zh_settle_bills_bak_6
+//     UNION ALL
+//     Select Count(*) As amount From zh_settle_bills_bak_7
+//     UNION ALL
+//     Select Count(*) As amount From zh_settle_bills_bak_8
+//     UNION ALL
+//     Select Count(*) As amount From zh_settle_bills_bak_9
+// ) As temp;
 
 // 数据量预估
 // qa执行时间(分表100)