|
@@ -9,21 +9,24 @@ let gljDao = require('./glj_repository');
|
|
|
let rationRepositoryDao = require('./repository_map');
|
|
|
const scMathUtil = require('../../../public/scMathUtil').getUtil();
|
|
|
const rationItemModel = mongoose.model('std_ration_lib_ration_items');
|
|
|
+const rationItemBackupModel = mongoose.model('std_ration_lib_ration_items_backup');
|
|
|
const stdRationLibModel = mongoose.model('std_ration_lib_map');
|
|
|
const stdRationSectionModel = mongoose.model('std_ration_lib_ration_chapter_trees');
|
|
|
+const stdRationSectionBackupModel = mongoose.model('std_ration_lib_ration_chapter_trees_backup');
|
|
|
const stdCoeModel = mongoose.model('std_ration_lib_coe_list');
|
|
|
+const stdCoeBackupModel = mongoose.model('std_ration_lib_coe_list_backup');
|
|
|
const compleRationModel = mongoose.model('complementary_ration_items');
|
|
|
import STDGLJListModel from '../../std_glj_lib/models/gljModel';
|
|
|
import InstallationDao from '../models/installation';
|
|
|
const installationDao = new InstallationDao();
|
|
|
import GljDao from "../../std_glj_lib/models/gljModel";
|
|
|
const stdGljDao = new GljDao();
|
|
|
-import stdgljutil from "../../../public/cache/std_glj_type_util";
|
|
|
+import stdgljutil from "../../../public/cache/std_glj_type_util";
|
|
|
//add
|
|
|
const stdGLJItemModel = mongoose.model('std_glj_lib_gljList');
|
|
|
// const _rationItemModelBackup = mongoose.model('std_ration_lib_ration_items_backup');
|
|
|
|
|
|
-var rationItemDAO = function(){};
|
|
|
+var rationItemDAO = function () { };
|
|
|
|
|
|
|
|
|
async function getIDMapping(counterName, data) {
|
|
@@ -38,7 +41,7 @@ async function getIDMapping(counterName, data) {
|
|
|
|
|
|
// 拷贝分类树
|
|
|
async function copyClassData(sourceLibID, targetLibID) {
|
|
|
- const sourceClassData = await stdRationSectionModel.find({ rationRepId: sourceLibID }, '-_id').lean();
|
|
|
+ const sourceClassData = await stdRationSectionBackupModel.find({ rationRepId: sourceLibID }, '-_id').lean();
|
|
|
const IDMapping = await getIDMapping(counter.moduleName.rationTree, sourceClassData);
|
|
|
const insertData = sourceClassData.map(item => ({
|
|
|
...item,
|
|
@@ -55,7 +58,7 @@ async function copyClassData(sourceLibID, targetLibID) {
|
|
|
|
|
|
// 拷贝子目换算
|
|
|
async function copyCoeData(sourceLibID, targetLibID) {
|
|
|
- const sourceCoeData = await stdCoeModel.find({ libID: sourceLibID }, '-_id').lean();
|
|
|
+ const sourceCoeData = await stdCoeBackupModel.find({ libID: sourceLibID }, '-_id').lean();
|
|
|
const IDMapping = await getIDMapping(counter.moduleName.coeList, sourceCoeData);
|
|
|
const insertData = sourceCoeData.map(item => ({
|
|
|
...item,
|
|
@@ -70,8 +73,8 @@ async function copyCoeData(sourceLibID, targetLibID) {
|
|
|
|
|
|
|
|
|
// 拷贝定额库
|
|
|
-rationItemDAO.prototype.copyLib = async function(sourceLibID, targetLibID, sourceGLJLibID, targetGLJLibID) {
|
|
|
- const sourceRationData = await rationItemModel.find({ rationRepId: sourceLibID }, '-_id').lean();
|
|
|
+rationItemDAO.prototype.copyLib = async function (sourceLibID, targetLibID, sourceGLJLibID, targetGLJLibID) {
|
|
|
+ const sourceRationData = await rationItemBackupModel.find({ rationRepId: sourceLibID }, '-_id').lean();
|
|
|
const rationIDMapping = await getIDMapping(counter.moduleName.rations, sourceRationData);
|
|
|
const classIDMapping = await copyClassData(sourceLibID, targetLibID);
|
|
|
const coeIDMapping = await copyCoeData(sourceLibID, targetLibID);
|
|
@@ -168,7 +171,7 @@ rationItemDAO.prototype.updateRationGLJByOrgID = async function (rationLibID, gl
|
|
|
// 处理部颁数据
|
|
|
rationItemDAO.prototype.handleBBData = async function (rationLibID, gljLibID) {
|
|
|
const rations = await rationItemModel.find({ rationRepId: rationLibID }, '-_id ID rationGljList').lean();
|
|
|
- const gljs = await stdGLJItemModel.find({ repositoryId: gljLibID, 'component.0': {$exists: true} }, '-_id ID component').lean();
|
|
|
+ const gljs = await stdGLJItemModel.find({ repositoryId: gljLibID, 'component.0': { $exists: true } }, '-_id ID component').lean();
|
|
|
const gljIDMap = {};
|
|
|
gljs.forEach(glj => gljIDMap[glj.ID] = gljs);
|
|
|
const updateData = [];
|
|
@@ -200,7 +203,7 @@ rationItemDAO.prototype.handleBBData = async function (rationLibID, gljLibID) {
|
|
|
if (diff <= errorRange) {
|
|
|
isChanged = true;
|
|
|
} else {
|
|
|
- newRationGljList.push(rGLJ);
|
|
|
+ newRationGljList.push(rGLJ);
|
|
|
}
|
|
|
} else {
|
|
|
newRationGljList.push(rGLJ);
|
|
@@ -221,10 +224,10 @@ rationItemDAO.prototype.handleBBData = async function (rationLibID, gljLibID) {
|
|
|
};
|
|
|
|
|
|
// 由于导入excel时,excel数据存在负的工程量,所以导入后一些定额人材机的消耗量可能为负,需要处理
|
|
|
-rationItemDAO.prototype.handleMinusQuantity = async function() {
|
|
|
+rationItemDAO.prototype.handleMinusQuantity = async function () {
|
|
|
const updateTask = [];
|
|
|
const repIDs = new Set();
|
|
|
- const rations = await rationItemModel.find({'rationGljList.consumeAmt': {$lt: 0}}).lean();
|
|
|
+ const rations = await rationItemModel.find({ 'rationGljList.consumeAmt': { $lt: 0 } }).lean();
|
|
|
for (const ration of rations) {
|
|
|
repIDs.add(ration.rationRepId);
|
|
|
const rationGLJList = [];
|
|
@@ -251,11 +254,11 @@ rationItemDAO.prototype.handleMinusQuantity = async function() {
|
|
|
|
|
|
rationItemDAO.prototype.prepareInitData = async function (rationRepId) {
|
|
|
// 定额库
|
|
|
- const libTask = stdRationLibModel.findOne({ID: rationRepId}, '-_id ID dispName gljLib');
|
|
|
+ const libTask = stdRationLibModel.findOne({ ID: rationRepId }, '-_id ID dispName gljLib');
|
|
|
// 定额编码
|
|
|
- const codesTask = rationItemModel.find({rationRepId}, '-_id code', {lean: true});
|
|
|
+ const codesTask = rationItemModel.find({ rationRepId }, '-_id code', { lean: true });
|
|
|
// 定额章节树
|
|
|
- const sectionTreeTask = stdRationSectionModel.find({rationRepId}, '-_id', {lean: true});
|
|
|
+ const sectionTreeTask = stdRationSectionModel.find({ rationRepId }, '-_id', { lean: true });
|
|
|
// 安装增加费
|
|
|
const installationTask = installationDao.getInstallation(rationRepId);
|
|
|
const [libInfo, codesArr, sectionTree, installationList] = await Promise.all([libTask, codesTask, sectionTreeTask, installationTask]);
|
|
@@ -282,7 +285,7 @@ rationItemDAO.prototype.prepareInitData = async function (rationRepId) {
|
|
|
|
|
|
//将消耗量为负的人材机改为正的
|
|
|
rationItemDAO.prototype.toPositive = async function (rationRepId) {
|
|
|
- let rations = await rationItemModel.find({rationRepId: rationRepId, 'rationGljList.consumeAmt': {$lt: 0}});
|
|
|
+ let rations = await rationItemModel.find({ rationRepId: rationRepId, 'rationGljList.consumeAmt': { $lt: 0 } });
|
|
|
let task = [];
|
|
|
for (let ration of rations) {
|
|
|
let update = false;
|
|
@@ -293,7 +296,7 @@ rationItemDAO.prototype.toPositive = async function (rationRepId) {
|
|
|
}
|
|
|
}
|
|
|
if (update) {
|
|
|
- task.push({updateOne: {filter: {ID: ration.ID}, update: {rationGljList: ration.rationGljList}}});
|
|
|
+ task.push({ updateOne: { filter: { ID: ration.ID }, update: { rationGljList: ration.rationGljList } } });
|
|
|
}
|
|
|
}
|
|
|
if (task.length > 0) {
|
|
@@ -302,53 +305,53 @@ rationItemDAO.prototype.toPositive = async function (rationRepId) {
|
|
|
};
|
|
|
|
|
|
rationItemDAO.prototype.getRationItemsByLib = async function (rationRepId, showHint = null, returnFields = '') {
|
|
|
- let rationLib = await stdRationLibModel.findOne({ID: rationRepId, deleted: false});
|
|
|
- if(!rationLib){
|
|
|
+ let rationLib = await stdRationLibModel.findOne({ ID: rationRepId, deleted: false });
|
|
|
+ if (!rationLib) {
|
|
|
return [];
|
|
|
}
|
|
|
let startDate = new Date();
|
|
|
- let rations = await rationItemModel.find({rationRepId: rationRepId}, returnFields);
|
|
|
+ let rations = await rationItemModel.find({ rationRepId: rationRepId }, returnFields);
|
|
|
console.log(`Date: ${new Date() - startDate}====================================`);
|
|
|
- if(!showHint){
|
|
|
+ if (!showHint) {
|
|
|
return rations;
|
|
|
}
|
|
|
else {
|
|
|
const stdBillsLibListsModel = new STDGLJListModel();
|
|
|
const stdGLJData = await stdBillsLibListsModel.getGljItemsByRepId(rationLib.gljLib, '-_id ID code name unit gljType');
|
|
|
let gljMapping = {};
|
|
|
- for(let glj of stdGLJData){
|
|
|
+ for (let glj of stdGLJData) {
|
|
|
gljMapping[glj.ID] = glj;
|
|
|
}
|
|
|
//设置悬浮
|
|
|
- for(let ration of rations){
|
|
|
+ for (let ration of rations) {
|
|
|
let hintsArr = [];
|
|
|
//对人材机进行排序
|
|
|
ration.rationGljList.sort(function (a, b) {
|
|
|
let gljA = gljMapping[a.gljId],
|
|
|
gljB = gljMapping[b.gljId];
|
|
|
- if(gljA && gljB){
|
|
|
+ if (gljA && gljB) {
|
|
|
let aV = gljA.gljType + gljA.code,
|
|
|
bV = gljB.gljType + gljB.code;
|
|
|
- if(aV > bV) {
|
|
|
+ if (aV > bV) {
|
|
|
return 1;
|
|
|
- } else if(aV < bV) {
|
|
|
+ } else if (aV < bV) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
return 0;
|
|
|
});
|
|
|
- for(let rationGlj of ration.rationGljList){
|
|
|
+ for (let rationGlj of ration.rationGljList) {
|
|
|
let subGlj = gljMapping[rationGlj.gljId];
|
|
|
- if(subGlj){
|
|
|
+ if (subGlj) {
|
|
|
hintsArr.push(` ${subGlj.code} ${subGlj.name}${subGlj.specs ? ' ' + subGlj.specs : ''}   ${subGlj.unit} ${rationGlj.consumeAmt}`);
|
|
|
}
|
|
|
}
|
|
|
hintsArr.push(`基价 元 ${ration.basePrice}`);
|
|
|
- if(ration.jobContent && ration.jobContent.toString().trim() !== ''){
|
|
|
+ if (ration.jobContent && ration.jobContent.toString().trim() !== '') {
|
|
|
hintsArr.push(`工作内容:`);
|
|
|
hintsArr = hintsArr.concat(ration.jobContent.split('\n'));
|
|
|
}
|
|
|
- if(ration.annotation && ration.annotation.toString().trim() !== ''){
|
|
|
+ if (ration.annotation && ration.annotation.toString().trim() !== '') {
|
|
|
hintsArr.push(`附注:`);
|
|
|
hintsArr = hintsArr.concat(ration.annotation.split('\n'));
|
|
|
}
|
|
@@ -359,38 +362,38 @@ rationItemDAO.prototype.getRationItemsByLib = async function (rationRepId, showH
|
|
|
};
|
|
|
|
|
|
rationItemDAO.prototype.sortToNumber = function (datas) {
|
|
|
- for(let i = 0, len = datas.length; i < len; i++){
|
|
|
+ for (let i = 0, len = datas.length; i < len; i++) {
|
|
|
let data = datas[i]._doc;
|
|
|
- if(_exist(data, 'labourPrice')){
|
|
|
+ if (_exist(data, 'labourPrice')) {
|
|
|
data['labourPrice'] = parseFloat(data['labourPrice']);
|
|
|
}
|
|
|
- if(_exist(data, 'materialPrice')){
|
|
|
+ if (_exist(data, 'materialPrice')) {
|
|
|
data['materialPrice'] = parseFloat(data['materialPrice']);
|
|
|
}
|
|
|
- if(_exist(data, 'machinePrice')){
|
|
|
+ if (_exist(data, 'machinePrice')) {
|
|
|
data['machinePrice'] = parseFloat(data['machinePrice']);
|
|
|
}
|
|
|
- if(_exist(data, 'basePrice')){
|
|
|
+ if (_exist(data, 'basePrice')) {
|
|
|
data['basePrice'] = parseFloat(data['basePrice']);
|
|
|
}
|
|
|
- if(_exist(data, 'rationGljList')){
|
|
|
- for(let j = 0, jLen = data['rationGljList'].length; j < jLen; j++){
|
|
|
+ if (_exist(data, 'rationGljList')) {
|
|
|
+ for (let j = 0, jLen = data['rationGljList'].length; j < jLen; j++) {
|
|
|
let raGljObj = data['rationGljList'][j]._doc;
|
|
|
- if(_exist(raGljObj, 'consumeAmt')){
|
|
|
+ if (_exist(raGljObj, 'consumeAmt')) {
|
|
|
raGljObj['consumeAmt'] = parseFloat(raGljObj['consumeAmt']);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- function _exist(data, attr){
|
|
|
+ function _exist(data, attr) {
|
|
|
return data && data[attr] !== undefined && data[attr];
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-rationItemDAO.prototype.getRationItemsBySection = async function(rationRepId, sectionId,callback){
|
|
|
+rationItemDAO.prototype.getRationItemsBySection = async function (rationRepId, sectionId, callback) {
|
|
|
let me = this;
|
|
|
try {
|
|
|
- let rations = await rationItemModel.find({rationRepId: rationRepId, sectionId: sectionId});
|
|
|
+ let rations = await rationItemModel.find({ rationRepId: rationRepId, sectionId: sectionId });
|
|
|
me.sortToNumber(rations);
|
|
|
let matchRationIDs = [],
|
|
|
matchRations = [];
|
|
@@ -404,7 +407,7 @@ rationItemDAO.prototype.getRationItemsBySection = async function(rationRepId, se
|
|
|
}
|
|
|
}
|
|
|
if (matchRationIDs.length > 0) {
|
|
|
- matchRations = await rationItemModel.find({ID: {$in: matchRationIDs}}, '-_id ID code name');
|
|
|
+ matchRations = await rationItemModel.find({ ID: { $in: matchRationIDs } }, '-_id ID code name');
|
|
|
}
|
|
|
for (let mr of matchRations) {
|
|
|
for (let ration of rations) {
|
|
@@ -418,29 +421,29 @@ rationItemDAO.prototype.getRationItemsBySection = async function(rationRepId, se
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- callback(false,"Get items successfully", rations);
|
|
|
+ callback(false, "Get items successfully", rations);
|
|
|
} catch (err) {
|
|
|
console.log(err);
|
|
|
callback(true, "Fail to get items", "");
|
|
|
}
|
|
|
- /* rationItemModel.find({"rationRepId": rationRepId, "sectionId": sectionId, "$or": [{"isDeleted": null}, {"isDeleted": false} ]},function(err,data){
|
|
|
- if(err) callback(true, "Fail to get items", "");
|
|
|
- else {
|
|
|
- me.sortToNumber(data);
|
|
|
- callback(false,"Get items successfully", data);
|
|
|
- }
|
|
|
- })*/
|
|
|
+ /* rationItemModel.find({"rationRepId": rationRepId, "sectionId": sectionId, "$or": [{"isDeleted": null}, {"isDeleted": false} ]},function(err,data){
|
|
|
+ if(err) callback(true, "Fail to get items", "");
|
|
|
+ else {
|
|
|
+ me.sortToNumber(data);
|
|
|
+ callback(false,"Get items successfully", data);
|
|
|
+ }
|
|
|
+ })*/
|
|
|
};
|
|
|
-rationItemDAO.prototype.mixUpdateRationItems = function(rationLibId, lastOpr, sectionId, updateItems, addItems, rIds, callback){
|
|
|
+rationItemDAO.prototype.mixUpdateRationItems = function (rationLibId, lastOpr, sectionId, updateItems, addItems, rIds, callback) {
|
|
|
var me = this;
|
|
|
if (updateItems.length == 0 && rIds.length == 0) {
|
|
|
me.addRationItems(rationLibId, lastOpr, sectionId, addItems, callback);
|
|
|
} else {
|
|
|
- me.removeRationItems(rationLibId, lastOpr, rIds, function(err, message, docs) {
|
|
|
+ me.removeRationItems(rationLibId, lastOpr, rIds, function (err, message, docs) {
|
|
|
if (err) {
|
|
|
callback(true, "Fail to remove", false);
|
|
|
} else {
|
|
|
- me.updateRationItems(rationLibId, lastOpr, sectionId, updateItems, function(err, results){
|
|
|
+ me.updateRationItems(rationLibId, lastOpr, sectionId, updateItems, function (err, results) {
|
|
|
if (err) {
|
|
|
callback(true, "Fail to save", false);
|
|
|
} else {
|
|
@@ -456,15 +459,15 @@ rationItemDAO.prototype.mixUpdateRationItems = function(rationLibId, lastOpr, se
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-rationItemDAO.prototype.removeRationItems = function(rationLibId, lastOpr, rIds,callback){
|
|
|
+rationItemDAO.prototype.removeRationItems = function (rationLibId, lastOpr, rIds, callback) {
|
|
|
if (rIds.length > 0) {
|
|
|
- rationItemModel.collection.remove({ID: {$in: rIds}}, null, function(err, docs){
|
|
|
+ rationItemModel.collection.remove({ ID: { $in: rIds } }, null, function (err, docs) {
|
|
|
if (err) {
|
|
|
callback(true, "Fail to remove", false);
|
|
|
} else {
|
|
|
- rationRepositoryDao.updateOprArr({ID: rationLibId}, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
|
|
|
- if(!err){
|
|
|
- rationItemModel.update({rationRepId: rationLibId}, {$pull: {rationTemplateList: {rationID: {$in: rIds}}}}, function (theErr) {
|
|
|
+ rationRepositoryDao.updateOprArr({ ID: rationLibId }, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
|
|
|
+ if (!err) {
|
|
|
+ rationItemModel.update({ rationRepId: rationLibId }, { $pull: { rationTemplateList: { rationID: { $in: rIds } } } }, function (theErr) {
|
|
|
if (!theErr) {
|
|
|
callback(false, "Remove successfully", docs);
|
|
|
} else {
|
|
@@ -483,10 +486,10 @@ rationItemDAO.prototype.removeRationItems = function(rationLibId, lastOpr, rIds,
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-rationItemDAO.prototype.getRationItemsByCode = function(repId, code,callback){
|
|
|
- rationItemModel.find({"rationRepId": repId, "code": {'$regex': code, $options: '$i'}, "$or": [{"isDeleted": null}, {"isDeleted": false}]},function(err,data){
|
|
|
- if(err) callback(true, "Fail to get items", "")
|
|
|
- else callback(false,"Get items successfully", data);
|
|
|
+rationItemDAO.prototype.getRationItemsByCode = function (repId, code, callback) {
|
|
|
+ rationItemModel.find({ "rationRepId": repId, "code": { '$regex': code, $options: '$i' }, "$or": [{ "isDeleted": null }, { "isDeleted": false }] }, function (err, data) {
|
|
|
+ if (err) callback(true, "Fail to get items", "")
|
|
|
+ else callback(false, "Get items successfully", data);
|
|
|
})
|
|
|
};
|
|
|
|
|
@@ -494,9 +497,9 @@ rationItemDAO.prototype.findRation = function (repId, keyword, callback) {
|
|
|
var filter = {
|
|
|
'rationRepId': repId,
|
|
|
'$and': [{
|
|
|
- '$or': [{'code': {'$regex': keyword, $options: '$i'}}, {'name': {'$regex': keyword, $options: '$i'}}]
|
|
|
+ '$or': [{ 'code': { '$regex': keyword, $options: '$i' } }, { 'name': { '$regex': keyword, $options: '$i' } }]
|
|
|
}, {
|
|
|
- '$or': [{'isDeleted': {"$exists":false}}, {'isDeleted': null}, {'isDeleted': false}]
|
|
|
+ '$or': [{ 'isDeleted': { "$exists": false } }, { 'isDeleted': null }, { 'isDeleted': false }]
|
|
|
}]
|
|
|
};
|
|
|
rationItemModel.find(filter, function (err, data) {
|
|
@@ -509,13 +512,13 @@ rationItemDAO.prototype.findRation = function (repId, keyword, callback) {
|
|
|
}
|
|
|
|
|
|
rationItemDAO.prototype.getRationItem = async function (repId, code) {
|
|
|
- let ration = await rationItemModel.findOne({rationRepId: repId, code: code});
|
|
|
+ let ration = await rationItemModel.findOne({ rationRepId: repId, code: code });
|
|
|
return ration;
|
|
|
};
|
|
|
|
|
|
-rationItemDAO.prototype.addRationItems = function(rationLibId, lastOpr, sectionId, items,callback){
|
|
|
+rationItemDAO.prototype.addRationItems = function (rationLibId, lastOpr, sectionId, items, callback) {
|
|
|
if (items && items.length > 0) {
|
|
|
- counter.counterDAO.getIDAfterCount(counter.moduleName.rations, items.length, function(err, result){
|
|
|
+ counter.counterDAO.getIDAfterCount(counter.moduleName.rations, items.length, function (err, result) {
|
|
|
var maxId = result.sequence_value;
|
|
|
var arr = [];
|
|
|
for (var i = 0; i < items.length; i++) {
|
|
@@ -525,15 +528,15 @@ rationItemDAO.prototype.addRationItems = function(rationLibId, lastOpr, sectionI
|
|
|
obj.rationRepId = rationLibId;
|
|
|
arr.push(obj);
|
|
|
}
|
|
|
- rationItemModel.collection.insert(arr, null, function(err, docs){
|
|
|
+ rationItemModel.collection.insert(arr, null, function (err, docs) {
|
|
|
if (err) {
|
|
|
callback(true, "Fail to save", false);
|
|
|
} else {
|
|
|
- rationRepositoryDao.updateOprArr({ID: rationLibId}, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
|
|
|
- if(err){
|
|
|
+ rationRepositoryDao.updateOprArr({ ID: rationLibId }, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
|
|
|
+ if (err) {
|
|
|
callback(true, "Fail to sava operator", false);
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
callback(false, "Save successfully", docs);
|
|
|
}
|
|
|
})
|
|
@@ -545,12 +548,12 @@ rationItemDAO.prototype.addRationItems = function(rationLibId, lastOpr, sectionI
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-rationItemDAO.prototype.updateRationItems = function(rationLibId, lastOpr, sectionId, items,callback){
|
|
|
+rationItemDAO.prototype.updateRationItems = function (rationLibId, lastOpr, sectionId, items, callback) {
|
|
|
console.log('enter============');
|
|
|
var functions = [];
|
|
|
- for (var i=0; i < items.length; i++) {
|
|
|
- functions.push((function(doc) {
|
|
|
- return function(cb) {
|
|
|
+ for (var i = 0; i < items.length; i++) {
|
|
|
+ functions.push((function (doc) {
|
|
|
+ return function (cb) {
|
|
|
var filter = {};
|
|
|
if (doc.ID) {
|
|
|
filter.ID = doc.ID;
|
|
@@ -565,26 +568,26 @@ rationItemDAO.prototype.updateRationItems = function(rationLibId, lastOpr, secti
|
|
|
}
|
|
|
functions.push((function () {
|
|
|
return function (cb) {
|
|
|
- rationRepositoryDao.updateOprArr({ID: rationLibId}, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
|
|
|
- if(err){
|
|
|
+ rationRepositoryDao.updateOprArr({ ID: rationLibId }, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
|
|
|
+ if (err) {
|
|
|
cb(err);
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
cb(null);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
})());
|
|
|
- async.parallel(functions, function(err, results) {
|
|
|
+ async.parallel(functions, function (err, results) {
|
|
|
callback(err, results);
|
|
|
});
|
|
|
};
|
|
|
//ration round func
|
|
|
-function round(v,e){
|
|
|
- var t=1;
|
|
|
- for(;e>0;t*=10,e--);
|
|
|
- for(;e<0;t/=10,e++);
|
|
|
- return Math.round(v*t)/t;
|
|
|
+function round(v, e) {
|
|
|
+ var t = 1;
|
|
|
+ for (; e > 0; t *= 10, e--);
|
|
|
+ for (; e < 0; t /= 10, e++);
|
|
|
+ return Math.round(v * t) / t;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -593,30 +596,30 @@ rationItemDAO.prototype.updateRationBasePrc = function (basePrcArr, callback) {
|
|
|
let adjGljId = basePrcObj.gljId, adjBasePrice = basePrcObj.basePrice, adjGljType = basePrcObj.gljType;
|
|
|
async.waterfall([
|
|
|
function (cb) {
|
|
|
- if(typeof basePrcObj.delete !== 'undefined' && basePrcObj.delete === 1){
|
|
|
- rationItemModel.find({'rationGljList.gljId': adjGljId},{ID: 1, rationGljList: 1}, function (err, result) {
|
|
|
- if(err){
|
|
|
+ if (typeof basePrcObj.delete !== 'undefined' && basePrcObj.delete === 1) {
|
|
|
+ rationItemModel.find({ 'rationGljList.gljId': adjGljId }, { ID: 1, rationGljList: 1 }, function (err, result) {
|
|
|
+ if (err) {
|
|
|
cb(err);
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
//删除
|
|
|
- rationItemModel.update({'rationGljList.gljId': adjGljId}, {$pull: {rationGljList: {gljId: adjGljId}}}, {multi: true}, function (err) {
|
|
|
- if(err){
|
|
|
+ rationItemModel.update({ 'rationGljList.gljId': adjGljId }, { $pull: { rationGljList: { gljId: adjGljId } } }, { multi: true }, function (err) {
|
|
|
+ if (err) {
|
|
|
cb(err);
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
//补充定额
|
|
|
- compleRationModel.find({'rationGljList.gljId': adjGljId},{ID: 1, rationGljList: 1}, function (err, compleRst) {
|
|
|
- if(err){
|
|
|
+ compleRationModel.find({ 'rationGljList.gljId': adjGljId }, { ID: 1, rationGljList: 1 }, function (err, compleRst) {
|
|
|
+ if (err) {
|
|
|
cb(err);
|
|
|
}
|
|
|
else {
|
|
|
- compleRationModel.update({'rationGljList.gljId': adjGljId}, {$pull: {rationGljList: {gljId: adjGljId}}}, {multi: true}, function (err) {
|
|
|
- if(err){
|
|
|
+ compleRationModel.update({ 'rationGljList.gljId': adjGljId }, { $pull: { rationGljList: { gljId: adjGljId } } }, { multi: true }, function (err) {
|
|
|
+ if (err) {
|
|
|
cb(err);
|
|
|
}
|
|
|
else {
|
|
|
- for(let i = 0, len = compleRst.length; i < len; i++){
|
|
|
+ for (let i = 0, len = compleRst.length; i < len; i++) {
|
|
|
compleRst[i]._doc.type = 'complementary';
|
|
|
}
|
|
|
cb(null, result.concat(compleRst));
|
|
@@ -629,18 +632,18 @@ rationItemDAO.prototype.updateRationBasePrc = function (basePrcArr, callback) {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- else{
|
|
|
- rationItemModel.find({'rationGljList.gljId': adjGljId}, {ID: 1, rationGljList: 1}, function (err, result) {
|
|
|
- if(err){
|
|
|
+ else {
|
|
|
+ rationItemModel.find({ 'rationGljList.gljId': adjGljId }, { ID: 1, rationGljList: 1 }, function (err, result) {
|
|
|
+ if (err) {
|
|
|
cb(err);
|
|
|
}
|
|
|
- else{
|
|
|
- compleRationModel.find({'rationGljList.gljId': adjGljId}, {ID: 1, rationGljList: 1}, function (err, compleRst) {
|
|
|
- if(err){
|
|
|
+ else {
|
|
|
+ compleRationModel.find({ 'rationGljList.gljId': adjGljId }, { ID: 1, rationGljList: 1 }, function (err, compleRst) {
|
|
|
+ if (err) {
|
|
|
cb(err);
|
|
|
}
|
|
|
else {
|
|
|
- for(let i = 0, len = compleRst.length; i < len; i++){
|
|
|
+ for (let i = 0, len = compleRst.length; i < len; i++) {
|
|
|
compleRst[i]._doc.type = 'complementary';
|
|
|
}
|
|
|
cb(null, result.concat(compleRst));
|
|
@@ -654,9 +657,9 @@ rationItemDAO.prototype.updateRationBasePrc = function (basePrcArr, callback) {
|
|
|
let compleRTasks = [], stdRTasks = [];
|
|
|
//重算时需要用到的所有工料机,一次性取
|
|
|
let compleGljIds = [], stdGljIds = [];
|
|
|
- for(let ration of result){
|
|
|
- for(let glj of ration.rationGljList){
|
|
|
- if(glj.type !== undefined && glj.type === 'complementary'){
|
|
|
+ for (let ration of result) {
|
|
|
+ for (let glj of ration.rationGljList) {
|
|
|
+ if (glj.type !== undefined && glj.type === 'complementary') {
|
|
|
compleGljIds.push(glj.gljId);
|
|
|
}
|
|
|
else {
|
|
@@ -665,28 +668,28 @@ rationItemDAO.prototype.updateRationBasePrc = function (basePrcArr, callback) {
|
|
|
}
|
|
|
}
|
|
|
gljDao.getStdCompleGljItems(compleGljIds, stdGljIds, function (err, allGljs) {
|
|
|
- if(err){
|
|
|
+ if (err) {
|
|
|
cb(err);
|
|
|
}
|
|
|
else {
|
|
|
let gljIndex = {};
|
|
|
- for(let glj of allGljs){
|
|
|
+ for (let glj of allGljs) {
|
|
|
gljIndex[glj.ID] = glj;
|
|
|
}
|
|
|
async.each(result, function (rationItem, ecb) {
|
|
|
let rationGljList = rationItem.rationGljList;
|
|
|
let gljArr = [];
|
|
|
- for(let i=0; i<rationGljList.length; i++){
|
|
|
+ for (let i = 0; i < rationGljList.length; i++) {
|
|
|
let theGlj = gljIndex[rationGljList[i].gljId];
|
|
|
- if(theGlj !== undefined && theGlj){
|
|
|
- if(theGlj.ID === adjGljId){
|
|
|
- gljArr.push({gljId: theGlj.ID, basePrice: adjBasePrice, consumeAmt: rationGljList[i].consumeAmt});
|
|
|
+ if (theGlj !== undefined && theGlj) {
|
|
|
+ if (theGlj.ID === adjGljId) {
|
|
|
+ gljArr.push({ gljId: theGlj.ID, basePrice: adjBasePrice, consumeAmt: rationGljList[i].consumeAmt });
|
|
|
} else {
|
|
|
- if(theGlj.priceProperty && Object.keys(theGlj.priceProperty).length > 0){
|
|
|
+ if (theGlj.priceProperty && Object.keys(theGlj.priceProperty).length > 0) {
|
|
|
let priceKeys = Object.keys(theGlj.priceProperty);
|
|
|
- gljArr.push({gljId: theGlj.ID, basePrice: parseFloat(theGlj.priceProperty[priceKeys[0]]), consumeAmt: rationGljList[i].consumeAmt});
|
|
|
+ gljArr.push({ gljId: theGlj.ID, basePrice: parseFloat(theGlj.priceProperty[priceKeys[0]]), consumeAmt: rationGljList[i].consumeAmt });
|
|
|
} else {
|
|
|
- gljArr.push({gljId: theGlj.ID, basePrice: parseFloat(theGlj.basePrice), consumeAmt: rationGljList[i].consumeAmt});
|
|
|
+ gljArr.push({ gljId: theGlj.ID, basePrice: parseFloat(theGlj.basePrice), consumeAmt: rationGljList[i].consumeAmt });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -708,7 +711,7 @@ rationItemDAO.prototype.updateRationBasePrc = function (basePrcArr, callback) {
|
|
|
}
|
|
|
};
|
|
|
//updateDataBase
|
|
|
- if(rationItem._doc.type !== undefined && rationItem._doc.type === 'complementary'){
|
|
|
+ if (rationItem._doc.type !== undefined && rationItem._doc.type === 'complementary') {
|
|
|
compleRTasks.push(task);
|
|
|
ecb(null);
|
|
|
}
|
|
@@ -716,21 +719,21 @@ rationItemDAO.prototype.updateRationBasePrc = function (basePrcArr, callback) {
|
|
|
stdRTasks.push(task);
|
|
|
ecb(null);
|
|
|
}
|
|
|
- }, async function(err){
|
|
|
- if(err){
|
|
|
+ }, async function (err) {
|
|
|
+ if (err) {
|
|
|
cb(err);
|
|
|
}
|
|
|
else {
|
|
|
//do sth
|
|
|
- try{
|
|
|
- if(compleRTasks.length > 0){
|
|
|
+ try {
|
|
|
+ if (compleRTasks.length > 0) {
|
|
|
await compleRationModel.bulkWrite(compleRTasks);
|
|
|
}
|
|
|
- if(stdRTasks.length > 0){
|
|
|
+ if (stdRTasks.length > 0) {
|
|
|
await rationItemModel.bulkWrite(stdRTasks);
|
|
|
}
|
|
|
}
|
|
|
- catch(e){
|
|
|
+ catch (e) {
|
|
|
cb(err);
|
|
|
}
|
|
|
cb(null);
|
|
@@ -740,18 +743,18 @@ rationItemDAO.prototype.updateRationBasePrc = function (basePrcArr, callback) {
|
|
|
});
|
|
|
},
|
|
|
], function (err) {
|
|
|
- if(err){
|
|
|
+ if (err) {
|
|
|
finalCb(err);
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
finalCb(null);
|
|
|
}
|
|
|
});
|
|
|
}, function (err) {
|
|
|
- if(err){
|
|
|
+ if (err) {
|
|
|
callback(err, 'Error');
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
callback(null, '');
|
|
|
}
|
|
|
});
|
|
@@ -759,21 +762,21 @@ rationItemDAO.prototype.updateRationBasePrc = function (basePrcArr, callback) {
|
|
|
|
|
|
rationItemDAO.prototype.getRationGljIds = function (data, callback) {
|
|
|
let repId = data.repId;
|
|
|
- rationItemModel.find({rationRepId: repId}, function (err, result) {
|
|
|
- if(err){
|
|
|
+ rationItemModel.find({ rationRepId: repId }, function (err, result) {
|
|
|
+ if (err) {
|
|
|
callback(err, 'Error', null);
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
let rstIds = [], newRst = [];
|
|
|
result.forEach(function (data) {
|
|
|
- if(data.rationGljList.length >0){
|
|
|
+ if (data.rationGljList.length > 0) {
|
|
|
data.rationGljList.forEach(function (gljObj) {
|
|
|
rstIds.push(gljObj.gljId);
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
- for(let i= 0; i< rstIds.length; i++){
|
|
|
- if(newRst.indexOf(rstIds[i]) === -1){
|
|
|
+ for (let i = 0; i < rstIds.length; i++) {
|
|
|
+ if (newRst.indexOf(rstIds[i]) === -1) {
|
|
|
newRst.push(rstIds[i]);
|
|
|
}
|
|
|
}
|
|
@@ -784,11 +787,11 @@ rationItemDAO.prototype.getRationGljIds = function (data, callback) {
|
|
|
|
|
|
rationItemDAO.prototype.getRationsCodes = function (data, callback) {
|
|
|
let repId = data.repId;
|
|
|
- rationItemModel.find({rationRepId: repId, isDeleted: false}, function (err, result) {
|
|
|
- if(err){
|
|
|
+ rationItemModel.find({ rationRepId: repId, isDeleted: false }, function (err, result) {
|
|
|
+ if (err) {
|
|
|
callback(err, 'Error', null);
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
let rstCodes = [];
|
|
|
result.forEach(function (rationItem) {
|
|
|
rstCodes.push(rationItem.code);
|
|
@@ -799,21 +802,21 @@ rationItemDAO.prototype.getRationsCodes = function (data, callback) {
|
|
|
};
|
|
|
|
|
|
rationItemDAO.prototype.updateJobContent = function (lastOpr, repId, updateArr, callback) {
|
|
|
- rationRepositoryDao.updateOprArr({ID: repId}, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
|
|
|
+ rationRepositoryDao.updateOprArr({ ID: repId }, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
|
|
|
async.each(updateArr, function (obj, cb) {
|
|
|
- rationItemModel.update({rationRepId: repId, code: obj.code}, {$set: {jobContent: obj.jobContent}}, function (err) {
|
|
|
- if(err){
|
|
|
+ rationItemModel.update({ rationRepId: repId, code: obj.code }, { $set: { jobContent: obj.jobContent } }, function (err) {
|
|
|
+ if (err) {
|
|
|
cb(err);
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
cb(null);
|
|
|
}
|
|
|
})
|
|
|
}, function (err) {
|
|
|
- if(err){
|
|
|
+ if (err) {
|
|
|
callback(err);
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
callback(null);
|
|
|
}
|
|
|
});
|
|
@@ -821,21 +824,21 @@ rationItemDAO.prototype.updateJobContent = function (lastOpr, repId, updateArr,
|
|
|
}
|
|
|
|
|
|
rationItemDAO.prototype.updateAnnotation = function (lastOpr, repId, updateArr, callback) {
|
|
|
- rationRepositoryDao.updateOprArr({ID: repId}, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
|
|
|
+ rationRepositoryDao.updateOprArr({ ID: repId }, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
|
|
|
async.each(updateArr, function (obj, cb) {
|
|
|
- rationItemModel.update({rationRepId: repId, code: obj.code}, {$set: {annotation: obj.annotation}}, function (err) {
|
|
|
- if(err){
|
|
|
+ rationItemModel.update({ rationRepId: repId, code: obj.code }, { $set: { annotation: obj.annotation } }, function (err) {
|
|
|
+ if (err) {
|
|
|
cb(err);
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
cb(null);
|
|
|
}
|
|
|
})
|
|
|
}, function (err) {
|
|
|
- if(err){
|
|
|
+ if (err) {
|
|
|
callback(err);
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
callback(null);
|
|
|
}
|
|
|
});
|
|
@@ -856,7 +859,7 @@ rationItemDAO.prototype.updateRationTemplate = async function (rationRepId, rati
|
|
|
}
|
|
|
matachCodes = Array.from(new Set(matachCodes));
|
|
|
if (matachCodes.length > 0) {
|
|
|
- matchRations = await rationItemModel.find({rationRepId: rationRepId, code: {$in: matachCodes}}, '-_id ID code name');
|
|
|
+ matchRations = await rationItemModel.find({ rationRepId: rationRepId, code: { $in: matachCodes } }, '-_id ID code name');
|
|
|
}
|
|
|
let validData = [];
|
|
|
//设置展示数据
|
|
@@ -879,10 +882,10 @@ rationItemDAO.prototype.updateRationTemplate = async function (rationRepId, rati
|
|
|
}
|
|
|
}
|
|
|
for (let data of validData) {
|
|
|
- saveData.push({rationID: data.rationID ? data.rationID : null, type: data.type, billsLocation: data.billsLocation});
|
|
|
+ saveData.push({ rationID: data.rationID ? data.rationID : null, type: data.type, billsLocation: data.billsLocation });
|
|
|
}
|
|
|
//更新
|
|
|
- await rationItemModel.update({ID: rationID}, {$set: {rationTemplateList: saveData}});
|
|
|
+ await rationItemModel.update({ ID: rationID }, { $set: { rationTemplateList: saveData } });
|
|
|
return validData;
|
|
|
};
|
|
|
|
|
@@ -890,7 +893,7 @@ rationItemDAO.prototype.updateRationTemplate = async function (rationRepId, rati
|
|
|
rationItemDAO.prototype.calcForRation = function (stdGljList, ration) {
|
|
|
let rationGljList = ration.rationGljList;
|
|
|
let basePrice = 0;
|
|
|
- for(let rationGlj of rationGljList) {
|
|
|
+ for (let rationGlj of rationGljList) {
|
|
|
let glj = stdGljList[rationGlj.gljId];
|
|
|
if (glj) {
|
|
|
basePrice += glj.basePrice * rationGlj.consumeAmt;
|
|
@@ -912,10 +915,10 @@ rationItemDAO.prototype.getRationItemByCondition = async function (condition, fi
|
|
|
if (Object.keys(condition).length <= 0) {
|
|
|
return result;
|
|
|
}
|
|
|
- result = await rationItemModel.find(condition, fields).sort({code: 1});
|
|
|
+ result = await rationItemModel.find(condition, fields).sort({ code: 1 });
|
|
|
if (indexBy !== null && result.length > 0) {
|
|
|
let tmpResult = {};
|
|
|
- for(let tmp of result) {
|
|
|
+ for (let tmp of result) {
|
|
|
tmpResult[tmp[indexBy]] = tmp;
|
|
|
}
|
|
|
result = tmpResult;
|
|
@@ -930,7 +933,7 @@ rationItemDAO.prototype.getRationItemByCondition = async function (condition, fi
|
|
|
* @param {Array} data
|
|
|
* @return {bool}
|
|
|
*/
|
|
|
-rationItemDAO.prototype.batchAddFromExcel = async function(rationRepId, data) {
|
|
|
+rationItemDAO.prototype.batchAddFromExcel = async function (rationRepId, data) {
|
|
|
if (data.length <= 0) {
|
|
|
return false;
|
|
|
}
|
|
@@ -1026,17 +1029,17 @@ rationItemDAO.prototype.batchAddFromExcel = async function(rationRepId, data) {
|
|
|
}
|
|
|
//更新定额
|
|
|
let updateBulk = [];
|
|
|
- for(let ration of updateData){
|
|
|
+ for (let ration of updateData) {
|
|
|
this.calcForRation(stdGLJListByID, ration);
|
|
|
updateBulk.push({
|
|
|
updateOne: {
|
|
|
- filter: {rationRepId: rationRepId, code: ration.code},
|
|
|
- update: {$set: {rationGljList: ration.rationGljList, basePrice: ration.basePrice}}
|
|
|
+ filter: { rationRepId: rationRepId, code: ration.code },
|
|
|
+ update: { $set: { rationGljList: ration.rationGljList, basePrice: ration.basePrice } }
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
//更新数据库
|
|
|
- if(updateBulk.length > 0){
|
|
|
+ if (updateBulk.length > 0) {
|
|
|
await rationItemModel.bulkWrite(updateBulk);
|
|
|
}
|
|
|
// 如果都已经存在,直接返回
|
|
@@ -1044,7 +1047,7 @@ rationItemDAO.prototype.batchAddFromExcel = async function(rationRepId, data) {
|
|
|
return true;
|
|
|
}
|
|
|
//计算价格
|
|
|
- for(let ration of insertData){
|
|
|
+ for (let ration of insertData) {
|
|
|
this.calcForRation(stdGLJListByID, ration);
|
|
|
}
|
|
|
|
|
@@ -1069,7 +1072,7 @@ rationItemDAO.prototype.batchAddFromExcel = async function(rationRepId, data) {
|
|
|
* @param {Number} rationRepId
|
|
|
* @return {Array}
|
|
|
*/
|
|
|
-rationItemDAO.prototype.exportExcelData = async function(rationRepId) {
|
|
|
+rationItemDAO.prototype.exportExcelData = async function (rationRepId) {
|
|
|
const condition = {
|
|
|
rationRepId: rationRepId
|
|
|
};
|
|
@@ -1159,7 +1162,7 @@ rationItemDAO.prototype.exportExcelData = async function(rationRepId) {
|
|
|
* @param {Object} data
|
|
|
* @return {bool}
|
|
|
*/
|
|
|
-rationItemDAO.prototype.batchUpdateSectionIdFromExcel = async function(data) {
|
|
|
+rationItemDAO.prototype.batchUpdateSectionIdFromExcel = async function (data) {
|
|
|
if (data.length <= 0) {
|
|
|
return false;
|
|
|
}
|
|
@@ -1183,18 +1186,23 @@ rationItemDAO.prototype.batchUpdateSectionIdFromExcel = async function(data) {
|
|
|
caption = caption ? caption : '';
|
|
|
let jobContent = tmp[7] ? tmp[7] : '';
|
|
|
let annotation = tmp[8] ? tmp[8] : '';
|
|
|
- rationTasks.push({updateOne: {
|
|
|
- filter: {ID: rationId},
|
|
|
- update: {$set: {
|
|
|
- sectionId,
|
|
|
- feeType,
|
|
|
- name,
|
|
|
- caption,
|
|
|
- jobContent,
|
|
|
- annotation
|
|
|
- }}}});
|
|
|
+ rationTasks.push({
|
|
|
+ updateOne: {
|
|
|
+ filter: { ID: rationId },
|
|
|
+ update: {
|
|
|
+ $set: {
|
|
|
+ sectionId,
|
|
|
+ feeType,
|
|
|
+ name,
|
|
|
+ caption,
|
|
|
+ jobContent,
|
|
|
+ annotation
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- if(rationTasks.length <= 0){
|
|
|
+ if (rationTasks.length <= 0) {
|
|
|
throw '无有效数据(树ID、定额ID不为空、且为数值)';
|
|
|
}
|
|
|
// 更新定额数据
|
|
@@ -1203,11 +1211,13 @@ rationItemDAO.prototype.batchUpdateSectionIdFromExcel = async function(data) {
|
|
|
sectionIDs = Array.from(new Set(sectionIDs));
|
|
|
if (sectionIDs.length) {
|
|
|
await stdRationSectionModel.updateMany(
|
|
|
- {ID: {$in: sectionIDs}},
|
|
|
- {$set: {
|
|
|
- jobContentSituation: 'ALL',
|
|
|
- annotationSituation: 'ALL'
|
|
|
- }}
|
|
|
+ { ID: { $in: sectionIDs } },
|
|
|
+ {
|
|
|
+ $set: {
|
|
|
+ jobContentSituation: 'ALL',
|
|
|
+ annotationSituation: 'ALL'
|
|
|
+ }
|
|
|
+ }
|
|
|
)
|
|
|
}
|
|
|
};
|