瀏覽代碼

修改取费专业的导入

olym 7 年之前
父節點
當前提交
a9d0e9d51e
共有 1 個文件被更改,包括 7 次插入3 次删除
  1. 7 3
      modules/ration_repository/models/ration_item.js

+ 7 - 3
modules/ration_repository/models/ration_item.js

@@ -660,14 +660,18 @@ rationItemDAO.prototype.batchUpdateSectionIdFromExcel = async function(data) {
     // 批量执行update
     const bulk = rationItemModel.collection.initializeOrderedBulkOp();
     for (const tmp of data) {
-        let rationId = parseInt(tmp[1]);
+        let rationId = parseInt(tmp[2]);
         rationId = isNaN(rationId) || rationId <= 0 ? 0 : rationId;
         let sectionId = parseInt(tmp[0]);
         sectionId = isNaN(sectionId) || sectionId <= 0 ? 0 : sectionId;
-        if (sectionId <= 0 || rationId <= 0) {
+        // 取费专业
+        let feeType = parseInt(tmp[1]);
+        feeType = isNaN(feeType) || feeType <= 0 ? 0 : feeType;
+        if (sectionId <= 0 || rationId <= 0 || feeType <= 0) {
             continue;
         }
-        bulk.find({"ID": rationId}).update({$set: { sectionId: sectionId }});
+
+        bulk.find({"ID": rationId}).update({$set: { sectionId: sectionId, feeType: feeType }});
     }
 
     const result = await bulk.execute();