ration_item.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. /**
  2. * Created by Tony on 2017/4/28.
  3. */
  4. let async = require("async");
  5. let moment = require('moment');
  6. let counter = require('../../../public/counter/counter');
  7. let gljDao = require('./glj_repository');
  8. let rationRepositoryDao = require('./repository_map');
  9. const scMathUtil = require('../../../public/scMathUtil').getUtil();
  10. import {rationItemModel} from './schemas';
  11. import STDGLJListModel from '../../std_glj_lib/models/gljModel';
  12. var rationItemDAO = function(){};
  13. rationItemDAO.prototype.sortToNumber = function (datas) {
  14. for(let i = 0, len = datas.length; i < len; i++){
  15. let data = datas[i]._doc;
  16. if(_exist(data, 'labourPrice')){
  17. data['labourPrice'] = parseFloat(data['labourPrice']);
  18. }
  19. if(_exist(data, 'materialPrice')){
  20. data['materialPrice'] = parseFloat(data['materialPrice']);
  21. }
  22. if(_exist(data, 'machinePrice')){
  23. data['machinePrice'] = parseFloat(data['machinePrice']);
  24. }
  25. if(_exist(data, 'basePrice')){
  26. data['basePrice'] = parseFloat(data['basePrice']);
  27. }
  28. if(_exist(data, 'rationGljList')){
  29. for(let j = 0, jLen = data['rationGljList'].length; j < jLen; j++){
  30. let raGljObj = data['rationGljList'][j]._doc;
  31. if(_exist(raGljObj, 'consumeAmt')){
  32. raGljObj['consumeAmt'] = parseFloat(raGljObj['consumeAmt']);
  33. }
  34. }
  35. }
  36. }
  37. function _exist(data, attr){
  38. return data && data[attr] !== undefined && data[attr];
  39. }
  40. };
  41. rationItemDAO.prototype.getRationItemsBySection = function(rationRepId, sectionId,callback){
  42. let me = this;
  43. rationItemModel.find({"rationRepId": rationRepId, "sectionId": sectionId, "$or": [{"isDeleted": null}, {"isDeleted": false} ]},function(err,data){
  44. if(err) callback(true, "Fail to get items", "");
  45. else {
  46. me.sortToNumber(data);
  47. callback(false,"Get items successfully", data);
  48. }
  49. })
  50. };
  51. rationItemDAO.prototype.mixUpdateRationItems = function(rationLibId, lastOpr, sectionId, updateItems, addItems, rIds, callback){
  52. var me = this;
  53. if (updateItems.length == 0 && rIds.length == 0) {
  54. me.addRationItems(rationLibId, lastOpr, sectionId, addItems, callback);
  55. } else {
  56. me.removeRationItems(rationLibId, lastOpr, rIds, function(err, message, docs) {
  57. if (err) {
  58. callback(true, "Fail to remove", false);
  59. } else {
  60. me.updateRationItems(rationLibId, lastOpr, sectionId, updateItems, function(err, results){
  61. if (err) {
  62. callback(true, "Fail to save", false);
  63. } else {
  64. if (addItems && addItems.length > 0) {
  65. me.addRationItems(rationLibId, lastOpr, sectionId, addItems, callback);
  66. } else {
  67. callback(false, "Save successfully", results);
  68. }
  69. }
  70. });
  71. }
  72. })
  73. }
  74. };
  75. rationItemDAO.prototype.removeRationItems = function(rationLibId, lastOpr, rIds,callback){
  76. if (rIds.length > 0) {
  77. rationItemModel.collection.remove({ID: {$in: rIds}}, null, function(err, docs){
  78. if (err) {
  79. callback(true, "Fail to remove", false);
  80. } else {
  81. rationRepositoryDao.updateOprArr({ID: rationLibId}, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
  82. if(!err){
  83. callback(false, "Remove successfully", docs);
  84. }
  85. })
  86. }
  87. })
  88. } else {
  89. callback(false, "No records were deleted!", null);
  90. }
  91. };
  92. rationItemDAO.prototype.getRationItemsByCode = function(repId, code,callback){
  93. rationItemModel.find({"rationRepId": repId, "code": {'$regex': code, $options: '$i'}, "$or": [{"isDeleted": null}, {"isDeleted": false}]},function(err,data){
  94. if(err) callback(true, "Fail to get items", "")
  95. else callback(false,"Get items successfully", data);
  96. })
  97. };
  98. rationItemDAO.prototype.findRation = function (repId, keyword, callback) {
  99. var filter = {
  100. 'rationRepId': repId,
  101. '$and': [{
  102. '$or': [{'code': {'$regex': keyword, $options: '$i'}}, {'name': {'$regex': keyword, $options: '$i'}}]
  103. }, {
  104. '$or': [{'isDeleted': {"$exists":false}}, {'isDeleted': null}, {'isDeleted': false}]
  105. }]
  106. };
  107. rationItemModel.find(filter, function (err, data) {
  108. if (err) {
  109. callback(true, 'Fail to find ration', null);
  110. } else {
  111. callback(false, '', data);
  112. }
  113. })
  114. }
  115. rationItemDAO.prototype.getRationItem = function (repId, code, callback) {
  116. if (callback) {
  117. rationItemModel.findOne({rationRepId: repId, code: code, "$or": [{"isDeleted": null}, {"isDeleted": false}]}, '-_id').exec()
  118. .then(function (result, err) {
  119. if (err) {
  120. callback(1, '找不到定额“' + code +'”' , null);
  121. } else {
  122. callback(0, '', result);
  123. }
  124. });
  125. return null;
  126. } else {
  127. return rationItemModel.findOne({rationRepId: repId, code: code, "$or": [{"isDeleted": null}, {"isDeleted": false}]}, '-_id').exec();
  128. }
  129. };
  130. rationItemDAO.prototype.addRationItems = function(rationLibId, lastOpr, sectionId, items,callback){
  131. if (items && items.length > 0) {
  132. counter.counterDAO.getIDAfterCount(counter.moduleName.rations, items.length, function(err, result){
  133. var maxId = result.value.sequence_value;
  134. var arr = [];
  135. for (var i = 0; i < items.length; i++) {
  136. var obj = new rationItemModel(items[i]);
  137. obj.ID = (maxId - (items.length - 1) + i);
  138. obj.sectionId = sectionId;
  139. obj.rationRepId = rationLibId;
  140. arr.push(obj);
  141. }
  142. rationItemModel.collection.insert(arr, null, function(err, docs){
  143. if (err) {
  144. callback(true, "Fail to save", false);
  145. } else {
  146. rationRepositoryDao.updateOprArr({ID: rationLibId}, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
  147. if(err){
  148. callback(true, "Fail to sava operator", false);
  149. }
  150. else{
  151. callback(false, "Save successfully", docs);
  152. }
  153. })
  154. }
  155. })
  156. });
  157. } else {
  158. callback(true, "Source error!", false);
  159. }
  160. };
  161. rationItemDAO.prototype.updateRationItems = function(rationLibId, lastOpr, sectionId, items,callback){
  162. var functions = [];
  163. for (var i=0; i < items.length; i++) {
  164. functions.push((function(doc) {
  165. return function(cb) {
  166. var filter = {};
  167. if (doc.ID) {
  168. filter.ID = doc.ID;
  169. } else {
  170. filter.sectionId = sectionId;
  171. if (rationLibId) filter.rationRepId = rationLibId;
  172. filter.code = doc.code;
  173. }
  174. rationItemModel.update(filter, doc, cb);
  175. };
  176. })(items[i]));
  177. }
  178. functions.push((function () {
  179. return function (cb) {
  180. rationRepositoryDao.updateOprArr({ID: rationLibId}, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
  181. if(err){
  182. cb(err);
  183. }
  184. else{
  185. cb(null);
  186. }
  187. });
  188. }
  189. })());
  190. async.parallel(functions, function(err, results) {
  191. callback(err, results);
  192. });
  193. };
  194. //ration round func
  195. function round(v,e){
  196. var t=1;
  197. for(;e>0;t*=10,e--);
  198. for(;e<0;t/=10,e++);
  199. return Math.round(v*t)/t;
  200. }
  201. rationItemDAO.prototype.updateRationBasePrc = function (basePrcArr, callback) {
  202. // let basePrcArr = data.basePrcArr;
  203. // adjGljId = data.gljId, adjBasePrice = data.basePrice, adjGljType = data.gljType,
  204. // repId = data.repId, lastOpr = data.lastOpr;
  205. //
  206. // let updateArr;
  207. async.each(basePrcArr, function (basePrcObj, finalCb) {
  208. let adjGljId = basePrcObj.gljId, adjBasePrice = basePrcObj.basePrice, adjGljType = basePrcObj.gljType;
  209. async.waterfall([
  210. function (cb) {
  211. if(typeof basePrcObj.delete !== 'undefined' && basePrcObj.delete === 1){
  212. rationItemModel.find({'rationGljList.gljId': adjGljId},{ID: 1, rationGljList: 1}, function (err, result) {
  213. if(err){
  214. cb(err);
  215. }
  216. else{
  217. //删除
  218. rationItemModel.update({'rationGljList.gljId': adjGljId}, {$pull: {rationGljList: {gljId: adjGljId}}}, {multi: true}, function (err) {
  219. if(err){
  220. cb(err);
  221. }
  222. else{
  223. cb(null, result);
  224. }
  225. });
  226. }
  227. });
  228. }
  229. else{
  230. rationItemModel.find({'rationGljList.gljId': adjGljId}, function (err, result) {
  231. if(err){
  232. cb(err);
  233. }
  234. else{
  235. cb(null, result);
  236. }
  237. });
  238. }
  239. /* rationItemModel.find({'rationGljList.gljId': adjGljId}, function (err, result) {
  240. if(err){
  241. cb(err);
  242. }
  243. else{
  244. cb(null, result);
  245. }
  246. });*/
  247. },
  248. function (result, cb) {
  249. async.each(result, function (rationItem, ecb) {
  250. let rationGljList = rationItem.rationGljList,
  251. gljIds = [];
  252. rationGljList.forEach(function (rationGlj) {
  253. gljIds.push(rationGlj.gljId);
  254. });
  255. gljDao.getGljItems(gljIds, function(err, gljItems){
  256. if(err){
  257. ecb(err);
  258. }
  259. else{
  260. let gljArr = [];
  261. for(let i=0; i<gljItems.length; i++){
  262. let gljParentType = -1;
  263. if(gljItems[i].ID === adjGljId){
  264. gljItems[i].gljType = adjGljType;
  265. }
  266. if(gljItems[i].gljType <= 3){
  267. gljParentType = gljItems[i].gljType;
  268. }
  269. if(gljItems[i].gljType > 200 && gljItems[i].gljType < 300){
  270. gljParentType = 2;
  271. }
  272. if(gljItems[i].gljType > 300 && gljItems[i].gljType < 400){
  273. gljParentType = 3;
  274. }
  275. if(gljItems[i].ID === adjGljId){
  276. gljArr.push({gljId: gljItems[i].ID, basePrice: adjBasePrice, gljParentType: gljParentType});
  277. }
  278. else {
  279. gljArr.push({gljId: gljItems[i].ID, basePrice: parseFloat(gljItems[i].basePrice), gljParentType: gljParentType});
  280. }
  281. }
  282. gljArr.forEach(function (gljItem) {
  283. rationGljList.forEach(function (rationGlj) {
  284. if(gljItem.gljId === rationGlj.gljId){
  285. gljItem.consumeAmt = parseFloat(rationGlj.consumeAmt);
  286. }
  287. })
  288. });
  289. //recalculate the price of ration
  290. let labourPrc = [], materialPrc = [], machinePrc = [], singlePrc, updatePrc = {labourPrice: 0, materialPrice: 0, machinePrice: 0, basePrice: 0};
  291. gljArr.forEach(function (gljItem) {
  292. if(gljItem.gljParentType !== -1){
  293. singlePrc = scMathUtil.roundTo(gljItem.basePrice * gljItem.consumeAmt, -3);
  294. if(gljItem.gljParentType === 1){
  295. labourPrc.push(singlePrc);
  296. }
  297. else if(gljItem.gljParentType ===2){
  298. materialPrc.push(singlePrc);
  299. }
  300. else{
  301. machinePrc.push(singlePrc);
  302. }
  303. }
  304. });
  305. if(labourPrc.length > 0){
  306. let sumLaP = 0;
  307. for(let i=0; i<labourPrc.length; i++){
  308. sumLaP += labourPrc[i];
  309. }
  310. updatePrc.labourPrice = scMathUtil.roundTo(sumLaP, -2);
  311. }
  312. if(materialPrc.length > 0){
  313. let sumMtP = 0;
  314. for(let i= 0; i<materialPrc.length; i++){
  315. sumMtP += materialPrc[i];
  316. }
  317. updatePrc.materialPrice = scMathUtil.roundTo(sumMtP, -2);
  318. }
  319. if(machinePrc.length > 0){
  320. let sumMaP = 0;
  321. for(let i =0; i< machinePrc.length; i++){
  322. sumMaP += machinePrc[i];
  323. }
  324. updatePrc.machinePrice = scMathUtil.roundTo(sumMaP, -2);
  325. }
  326. updatePrc.basePrice = scMathUtil.roundTo(updatePrc.labourPrice + updatePrc.materialPrice + updatePrc.machinePrice, -2);
  327. //updateDataBase
  328. rationItemModel.update({ID: rationItem.ID}, {$set: {labourPrice: updatePrc.labourPrice.toString(), materialPrice: updatePrc.materialPrice.toString(),
  329. machinePrice: updatePrc.machinePrice.toString(), basePrice: updatePrc.basePrice.toString()}},
  330. function (err, result) {
  331. if(err){
  332. ecb(err);
  333. }
  334. else {
  335. ecb(null);
  336. }
  337. });
  338. }
  339. });
  340. }, function(err){
  341. if(err){
  342. cb(err);
  343. }
  344. else {
  345. cb(null);
  346. }
  347. });
  348. },
  349. ], function (err) {
  350. if(err){
  351. finalCb(err);
  352. }
  353. else{
  354. finalCb(null);
  355. }
  356. });
  357. }, function (err) {
  358. if(err){
  359. callback(err, 'Error');
  360. }
  361. else{
  362. callback(null, '');
  363. }
  364. });
  365. };
  366. rationItemDAO.prototype.getRationGljIds = function (data, callback) {
  367. let repId = data.repId;
  368. rationItemModel.find({rationRepId: repId}, function (err, result) {
  369. if(err){
  370. callback(err, 'Error', null);
  371. }
  372. else{
  373. let rstIds = [], newRst = [];
  374. result.forEach(function (data) {
  375. if(data.rationGljList.length >0){
  376. data.rationGljList.forEach(function (gljObj) {
  377. rstIds.push(gljObj.gljId);
  378. })
  379. }
  380. });
  381. for(let i= 0; i< rstIds.length; i++){
  382. if(newRst.indexOf(rstIds[i]) === -1){
  383. newRst.push(rstIds[i]);
  384. }
  385. }
  386. callback(null, '', newRst);
  387. }
  388. });
  389. };
  390. rationItemDAO.prototype.getRationsCodes = function (data, callback) {
  391. let repId = data.repId;
  392. rationItemModel.find({rationRepId: repId}, function (err, result) {
  393. if(err){
  394. callback(err, 'Error', null);
  395. }
  396. else{
  397. let rstCodes = [];
  398. result.forEach(function (rationItem) {
  399. rstCodes.push(rationItem.code);
  400. });
  401. callback(null, 'get all rationCodes success', rstCodes);
  402. }
  403. })
  404. };
  405. rationItemDAO.prototype.updateJobContent = function (lastOpr, repId, updateArr, callback) {
  406. rationRepositoryDao.updateOprArr({ID: repId}, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
  407. async.each(updateArr, function (obj, cb) {
  408. rationItemModel.update({rationRepId: repId, code: obj.code}, {$set: {jobContent: obj.jobContent}}, function (err) {
  409. if(err){
  410. cb(err);
  411. }
  412. else{
  413. cb(null);
  414. }
  415. })
  416. }, function (err) {
  417. if(err){
  418. callback(err);
  419. }
  420. else{
  421. callback(null);
  422. }
  423. });
  424. });
  425. }
  426. rationItemDAO.prototype.updateAnnotation = function (lastOpr, repId, updateArr, callback) {
  427. rationRepositoryDao.updateOprArr({ID: repId}, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
  428. async.each(updateArr, function (obj, cb) {
  429. rationItemModel.update({rationRepId: repId, code: obj.code}, {$set: {annotation: obj.annotation}}, function (err) {
  430. if(err){
  431. cb(err);
  432. }
  433. else{
  434. cb(null);
  435. }
  436. })
  437. }, function (err) {
  438. if(err){
  439. callback(err);
  440. }
  441. else{
  442. callback(null);
  443. }
  444. });
  445. });
  446. };
  447. /**
  448. * 根据条件获取定额数据
  449. *
  450. * @param {Object} condition
  451. * @param {Object} fields
  452. * @param {String} indexBy
  453. * @return {Promise|Array}
  454. */
  455. rationItemDAO.prototype.getRationItemByCondition = async function (condition, fields = null, indexBy = null) {
  456. let result = [];
  457. if (Object.keys(condition).length <= 0) {
  458. return result;
  459. }
  460. result = await rationItemModel.find(condition, fields);
  461. if (indexBy !== null && result.length > 0) {
  462. let tmpResult = {};
  463. for(let tmp of result) {
  464. tmpResult[tmp[indexBy]] = tmp;
  465. }
  466. result = tmpResult;
  467. }
  468. return result;
  469. };
  470. /**
  471. * 从excel中批量新增数据
  472. *
  473. * @param {Number} rationRepId
  474. * @param {Array} data
  475. * @return {bool}
  476. */
  477. rationItemDAO.prototype.batchAddFromExcel = async function(rationRepId, data) {
  478. if (data.length <= 0) {
  479. return false;
  480. }
  481. // 获取定额库相关数据
  482. const rationRepository = await rationRepositoryDao.getRepositoryById(rationRepId);
  483. if (rationRepository.length !== 1 || rationRepository[0].gljLib === undefined) {
  484. return false;
  485. }
  486. // 获取标准工料机库数据
  487. const stdBillsLibListsModel = new STDGLJListModel();
  488. const stdGLJData = await stdBillsLibListsModel.getGljItemsByRep(rationRepository[0].gljLib);
  489. // 整理标准工料机库数据
  490. let stdGLJList = {};
  491. for (const tmp of stdGLJData) {
  492. stdGLJList[tmp.code.toString()] = tmp.ID;
  493. }
  494. let lastData = {};
  495. const rationData = [];
  496. // 编码列表,用于查找库中是否有对应数据
  497. let rationCodeList = [];
  498. let gljCodeList = [];
  499. for (const tmp of data) {
  500. if (tmp.length <= 0) {
  501. continue;
  502. }
  503. // 如果第一个字段为null则是工料机数据,放入上一个数据的工料机字段
  504. if (tmp[0] === undefined && Object.keys(lastData).length > 0) {
  505. // 如果不存在对应的工料机库数据则跳过
  506. if (stdGLJList[tmp[1]] === undefined) {
  507. continue;
  508. }
  509. const tmpRationGlj = {
  510. gljId: stdGLJList[tmp[1]],
  511. consumeAmt: tmp[4],
  512. proportion: 0,
  513. };
  514. lastData.rationGljList.push(tmpRationGlj);
  515. if (gljCodeList.indexOf(tmp[1]) < 0) {
  516. gljCodeList.push(tmp[1]);
  517. }
  518. continue;
  519. }
  520. if (tmp[0] === '定额' && Object.keys(lastData).length > 0) {
  521. rationData.push(lastData);
  522. }
  523. // 组装数据
  524. lastData = {
  525. code: tmp[1],
  526. name: tmp[2],
  527. unit: tmp[3],
  528. caption: tmp[2],
  529. rationRepId: rationRepId,
  530. sectionId: 0,
  531. rationGljList: []
  532. };
  533. // 防止重复加入
  534. if (rationCodeList.indexOf(tmp[1]) < 0) {
  535. rationCodeList.push(tmp[1]);
  536. }
  537. }
  538. // 最后一个入数组
  539. rationData.push(lastData);
  540. // 查找数据库中是否已存在待插入数据
  541. const condition = {
  542. rationRepId: rationRepId,
  543. code: { $in: rationCodeList }
  544. };
  545. const existCodeList = await this.getRationItemByCondition(condition, ['code'], 'code');
  546. // 过滤插入数据
  547. let insertData = [];
  548. for (const ration of rationData) {
  549. if (existCodeList[ration.code] !== undefined) {
  550. continue;
  551. }
  552. insertData.push(ration);
  553. }
  554. // 如果都已经存在,直接返回
  555. if (insertData.length <= 0) {
  556. return true;
  557. }
  558. // 组织id
  559. const counterInfo = await counter.counterDAO.getIDAfterCount(counter.moduleName.rations, insertData.length);
  560. let maxId = counterInfo.value.sequence_value;
  561. maxId = parseInt(maxId);
  562. let count = 0;
  563. for (const index in insertData) {
  564. insertData[index].ID = maxId - (insertData.length - 1) + count;
  565. count++;
  566. }
  567. // 插入数据库
  568. const result = await rationItemModel.create(insertData);
  569. return result.length > 0;
  570. };
  571. /**
  572. * 导出到excel的数据
  573. *
  574. * @param {Number} rationRepId
  575. * @return {Array}
  576. */
  577. rationItemDAO.prototype.exportExcelData = async function(rationRepId) {
  578. const condition = {
  579. rationRepId: rationRepId
  580. };
  581. // @todo 限制导出的数量以防内存溢出
  582. const rationDataList = await this.getRationItemByCondition(condition, ['name', 'code', 'ID']);
  583. // 整理数据
  584. let rationData = [];
  585. for (const tmp of rationDataList) {
  586. const ration = [null, tmp.ID, tmp.code, tmp.name];
  587. rationData.push(ration);
  588. }
  589. const excelData = [['树ID', '定额ID', '定额编码', '定额名']];
  590. excelData.push.apply(excelData, rationData);
  591. return excelData;
  592. };
  593. /**
  594. * 批量更改章节id
  595. *
  596. * @param {Object} data
  597. * @return {bool}
  598. */
  599. rationItemDAO.prototype.batchUpdateSectionIdFromExcel = async function(data) {
  600. if (data.length <= 0) {
  601. return false;
  602. }
  603. // 批量执行update
  604. const bulk = rationItemModel.collection.initializeOrderedBulkOp();
  605. for (const tmp of data) {
  606. let rationId = parseInt(tmp[1]);
  607. rationId = isNaN(rationId) || rationId <= 0 ? 0 : rationId;
  608. let sectionId = parseInt(tmp[0]);
  609. sectionId = isNaN(sectionId) || sectionId <= 0 ? 0 : sectionId;
  610. if (sectionId <= 0 || rationId <= 0) {
  611. continue;
  612. }
  613. bulk.find({"ID": rationId}).update({$set: { sectionId: sectionId }});
  614. }
  615. const result = await bulk.execute();
  616. return result.isOk();
  617. };
  618. module.exports = new rationItemDAO();