ration_facade.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. /**
  2. * Created by zhang on 2018/2/9.
  3. */
  4. let mongoose = require('mongoose');
  5. import SearchDao from '../../complementary_ration_lib/models/searchModel';
  6. const scMathUtil = require('../../../public/scMathUtil').getUtil();
  7. let ration_glj_facade = require("../../ration_glj/facade/ration_glj_facade");
  8. let quantity_detail = require("../facade/quantity_detail_facade");
  9. let ration_glj = mongoose.model('ration_glj');
  10. let ration_coe = mongoose.model('ration_coe');
  11. let ration_model = require('../models/ration');
  12. let bill_model = require('../models/bills');
  13. let decimal_facade = require('./decimal_facade');
  14. let installationFeeModel = mongoose.model("installation_fee");
  15. let rationInstallationModel = mongoose.model('ration_installation');
  16. const uuidV1 = require('uuid/v1');
  17. let std_glj_lib_gljList_model = mongoose.model('std_glj_lib_gljList');
  18. let complementary_glj_model = mongoose.model('complementary_glj_lib');
  19. let rationItemModel = mongoose.model("std_ration_lib_ration_items");
  20. let complementaryRationModel = mongoose.model('complementary_ration_items');
  21. let coeMolde = mongoose.model('std_ration_lib_coe_list');
  22. let compleCoeModel = mongoose.model('complementary_ration_coe_list');
  23. let _= require('lodash');
  24. const projectDao = require('../../pm/models/project_model').project;
  25. let projectModel = mongoose.model('projects');
  26. const fs = require('fs');
  27. module.exports = {
  28. replaceRations: replaceRations,
  29. addNewRation:addNewRation,
  30. addMultiRation: addMultiRation,
  31. getSameSectionRations:getSameSectionRations
  32. };
  33. async function addNewRation(data,compilation) {
  34. let query = data.itemQuery;
  35. let stdRation = null;
  36. let startTime = +new Date();
  37. if(query){
  38. let searchDao = new SearchDao();
  39. stdRation = await searchDao.getRationItem(query.userID, compilation._id, [query.rationRepId],query.code, query.ID);
  40. //data.newData.code = query.code;
  41. }
  42. let stdRationTime = +new Date();
  43. console.log("取std定额时间-------------------------------"+(stdRationTime - startTime));
  44. if(data.brUpdate.length>0){
  45. await updateSerialNo(data.brUpdate);
  46. }
  47. let newRation =await insertNewRation(data.newData,data.defaultLibID,stdRation,data.calQuantity);
  48. let addRationGLJTime = +new Date();
  49. console.log("插入新定额时间-------------------------------"+(addRationGLJTime - stdRationTime));
  50. if(stdRation){
  51. return await addRationSubList(stdRation,newRation,data.needInstall,compilation);
  52. }else {
  53. return {ration:newRation};
  54. }
  55. }
  56. async function addMultiRation(datas,compilation) {
  57. let rst = [];
  58. for(let data of datas){
  59. let r = await addNewRation(data,compilation);
  60. rst.push(r);
  61. }
  62. return rst;
  63. }
  64. async function getSameSectionRations(data,userId,compilationId){
  65. //let userId
  66. //要先根据定额获取所属章节的ID
  67. let from = data.from; //定额类型,是标准的还是用户定义的
  68. let code = data.code;
  69. let libID = data.libID;
  70. let sectionId,rations=[];
  71. if(from == 'std'){
  72. let ration = await rationItemModel.findOne({rationRepId:libID,code:code},['sectionId']);
  73. sectionId = ration? ration.sectionId:null;
  74. }else {
  75. let ration = await complementaryRationModel.findOne({userId:userId,compilationId: compilationId,code:code},['sectionId']);
  76. sectionId = ration?ration.sectionId:null;
  77. }
  78. if(sectionId){
  79. if (from == 'std') {
  80. rations = await rationItemModel.find({sectionId: sectionId});
  81. } else {
  82. rations = await complementaryRationModel.find({userId: userId, sectionId: sectionId});
  83. }
  84. rations = _.sortBy(rations,'code');
  85. }
  86. return rations
  87. }
  88. async function updateSerialNo(serialNoUpdate){
  89. let tasks=[];
  90. for(let data of serialNoUpdate){
  91. let task={
  92. updateOne:{
  93. filter:{
  94. ID:data.ID,
  95. projectID:data.projectID
  96. },
  97. update :{
  98. serialNo:data.serialNo
  99. }
  100. }
  101. };
  102. tasks.push(task);
  103. }
  104. await ration_model.model.bulkWrite(tasks);
  105. }
  106. async function insertNewRation(newData,defaultLibID,std,calQuantity) {//插入新的定额
  107. let startTime = +new Date();
  108. if(std){
  109. newData.code = std.code;
  110. newData.name = std.name;
  111. newData.caption = std.caption;
  112. newData.unit = std.unit;
  113. newData.libID = std.rationRepId;
  114. newData.content = std.jobContent;
  115. newData.annotation = std.annotation;
  116. if (std.chapter) {
  117. newData.comments = std.chapter.explanation;
  118. newData.ruleText = std.chapter.ruleText;
  119. }
  120. newData.prefix = '';
  121. newData.from = std.type === 'complementary' ? 'cpt' : 'std';
  122. if(defaultLibID !== std.rationRepId){//借
  123. newData.prefix = '借';
  124. }
  125. else if(std.rationRepId === defaultLibID && newData.from === 'cpt') {
  126. newData.prefix = '补';
  127. }
  128. if(std.feeType == undefined || std.feeType == null || std.feeType ==''){//定额取费专业为空的情况下,取项目属性中的定额取费专业ID
  129. newData.programID = await getProgramForProject(newData.projectID);
  130. }else {
  131. newData.programID = std.feeType;
  132. }
  133. newData.rationAssList = createRationAss(std);
  134. // calculate ration Quantity
  135. }
  136. if(calQuantity){
  137. await CalculateQuantity(newData,newData.billsItemID,newData.projectID);
  138. }
  139. let addRationGLJTime = +new Date();
  140. console.log("计算消耗量时间-------------------------------"+(addRationGLJTime - startTime));
  141. let newRation = await ration_model.model.create(newData);
  142. return newRation;
  143. /*ration_model.model.create(newData);
  144. return newData;*/
  145. }
  146. async function replaceRations(userID,data,compilation) {
  147. let searchDao = new SearchDao();
  148. let recodes = [];
  149. for(let recode of data.nodeInfo){
  150. let stdRation = await searchDao.getRationItem(userID,compilation._id,data.libIDs,recode.newCode, null);
  151. let newRecode = await replaceRation(recode,stdRation,data.defaultLibID,data.projectID,data.calQuantity,compilation);
  152. if(newRecode){
  153. recodes.push(newRecode);
  154. }else {
  155. break;
  156. }
  157. }
  158. return recodes;
  159. }
  160. async function replaceRation(nodeInfo,stdRation,defaultLibID,projectID,calQuantity,compilation) {
  161. if(nodeInfo.newCode == null||nodeInfo.newCode ==""){//说明是删除编号,则要变成一条空定额
  162. await deleRationSubRecode(projectID,nodeInfo.ID);//删除定额下挂的各种数据,如定额工料机等
  163. return await setEmptyRation(projectID,nodeInfo.ID);
  164. }else if(stdRation){
  165. await deleRationSubRecode(projectID,nodeInfo.ID);//删除定额下挂的各种数据,如定额工料机等
  166. let newRation = await updateRation(stdRation,defaultLibID,nodeInfo.ID,nodeInfo.billsItemID,projectID,calQuantity);//生成并插入新的定额
  167. return await addRationSubList(stdRation,newRation,nodeInfo.needInstall,compilation);
  168. }else {
  169. return null;
  170. }
  171. }
  172. async function addRationSubList(stdRation,newRation,needInstall,compilation) {
  173. let startTime = +new Date();
  174. let ration_gljs = await addRationGLJ(stdRation,newRation);
  175. let addRationGLJTime = +new Date();
  176. console.log("添加定额工料机时间-----"+(addRationGLJTime - startTime));
  177. let ration_coes = await addRationCoe(stdRation,newRation,compilation);
  178. let addRationCoeTime = +new Date();
  179. console.log("添加定额coe时间-----"+(addRationCoeTime - addRationGLJTime));
  180. let ration_installs = [];
  181. if(needInstall && stdRation.type == 'std'){//只有标准的定额才有安装增加费,补充的定额没有安装增加费
  182. ration_installs = await addRationInstallFee(stdRation,newRation);
  183. }
  184. let addRationInstallFeeTime = +new Date();
  185. console.log("添加定额install时间-----"+(addRationInstallFeeTime - addRationCoeTime));
  186. return {ration:newRation,ration_gljs:ration_gljs,ration_coes:ration_coes,ration_installs:ration_installs};
  187. }
  188. async function addRationInstallFee(std,newRation) {
  189. let install_fee_list = [];
  190. if(std.hasOwnProperty('rationInstList') && std.rationInstList.length > 0){
  191. let installFee = await installationFeeModel.findOne({'projectID': newRation.projectID});
  192. if(!installFee) return;//如果没有找到项目对应的安装增加费,则不添加
  193. for(let ri of std.rationInstList){
  194. let feeItem = _.find(installFee.installFeeItem,{'ID':ri.feeItemId});
  195. let section = _.find(installFee.installSection,{'ID':ri.sectionId});
  196. if(feeItem&&section){
  197. let tem_r_i = {
  198. libID:installFee.libID,
  199. projectID:newRation.projectID,
  200. rationID:newRation.ID,
  201. feeItemId:feeItem.ID,
  202. sectionId:section.ID,
  203. itemName:feeItem.feeItem,
  204. feeType:feeItem.feeType,
  205. sectionName:section.name,
  206. unifiedSetting:1,
  207. ruleId:''
  208. };
  209. if(feeItem.isCal==1&&section.feeRuleId&&section.feeRuleId!=''){//勾选记取时并且有规则ID时才读取
  210. let feeRule = _.find(installFee.feeRule,{'ID':section.feeRuleId});
  211. if(feeRule){
  212. tem_r_i.ruleId = feeRule.ID;
  213. }
  214. }
  215. tem_r_i.ID = uuidV1();
  216. install_fee_list.push(tem_r_i);
  217. }
  218. }
  219. if(install_fee_list.length>0){
  220. await rationInstallationModel.insertMany(install_fee_list);
  221. }
  222. }
  223. return install_fee_list;
  224. }
  225. async function addRationCoe(std,newRation,compilation) {
  226. let ration_coe_list = [];
  227. let seq = 0;
  228. if(std.hasOwnProperty('rationCoeList')&&std.rationCoeList.length>0){//添加标准库的工料机
  229. for(let sub of std.rationCoeList){
  230. let libCoe;
  231. if (std.type === 'std') {
  232. libCoe = await coeMolde.findOne({'libID':std.rationRepId,'ID':sub.ID,"$or": [{"isDeleted": null}, {"isDeleted": false}]});//std.rationRepId;
  233. } else {
  234. libCoe = await compleCoeModel.findOne({ID: sub.ID, $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}]});
  235. }
  236. if(libCoe){
  237. let newCoe = {};
  238. newCoe.ID = uuidV1();
  239. newCoe.coeID = sub.ID;
  240. newCoe.seq = seq;
  241. newCoe.name = libCoe.name;
  242. newCoe.content = libCoe.content;
  243. newCoe.isAdjust=0;
  244. newCoe.coes = libCoe.coes;
  245. newCoe.rationID = newRation.ID;
  246. newCoe.projectID = newRation.projectID;
  247. seq++;
  248. ration_coe_list.push(newCoe);
  249. }
  250. }
  251. }
  252. let lastCoe = await getCustomerCoe(newRation.projectID,newRation.ID,seq,compilation);
  253. ration_coe_list.push(lastCoe);
  254. await ration_coe.insertMany(ration_coe_list);
  255. return ration_coe_list;
  256. }
  257. function getCustomerCoeData() {
  258. var coeList = [
  259. {amount:1, operator:'*', gljCode:null, coeType:'定额'},
  260. { amount:1, operator:'*', gljCode:null, coeType:'人工'},
  261. { amount:1, operator:'*', gljCode:null, coeType:'材料'},
  262. { amount:1, operator:'*', gljCode:null, coeType:'机械'},
  263. { amount:1, operator:'*', gljCode:null, coeType:'主材'},
  264. { amount:1, operator:'*', gljCode:null, coeType:'设备'}
  265. ];
  266. return coeList;
  267. };
  268. async function getCustomerCoe(projectID,rationID,seq,compilation){//取自定义乘系数,根据编办不同,内容可能不同
  269. //生成默认的自定义乘系数
  270. let lastCoe ={
  271. coeID:-1,
  272. name : '自定义系数',
  273. content:'人工×1,材料×1,机械×1,主材×1,设备×1',
  274. isAdjust:0,
  275. seq:seq,
  276. rationID : rationID,
  277. projectID : projectID
  278. };
  279. lastCoe.ID = uuidV1();
  280. lastCoe.coes = getCustomerCoeData();
  281. try {
  282. //查看编办中有没有重写路径
  283. if(compilation.overWriteUrl && compilation.overWriteUrl!=""){
  284. let overWrite = require("../../.."+compilation.overWriteUrl);
  285. if(overWrite.getCusCoeContent) lastCoe.content = overWrite.getCusCoeContent();
  286. if(overWrite.getCustomerCoeData) lastCoe.coes = overWrite.getCustomerCoeData();
  287. }
  288. return lastCoe
  289. }catch (err){
  290. console.log("读取自定义系数重写文件失败");
  291. console.log(err.message);
  292. return lastCoe
  293. }
  294. }
  295. async function addRationGLJ(std,newRation) {
  296. let newRationGLJList = [];
  297. let rationGLJShowList = [];
  298. let unitPriceFileId = await projectDao.getUnitPriceFileId(newRation.projectID);
  299. let sum=0;
  300. let first = +new Date();
  301. if(std.hasOwnProperty('rationGljList') && std.rationGljList.length > 0){
  302. let stdGLJID =[];//标准工料机ID数组
  303. let cptGLJID=[];//补充工料机ID数组
  304. //let stdGLJID = _.map(std.rationGljList,'gljId');
  305. for(let tem_g of std.rationGljList){
  306. if(tem_g.type == 'complementary'){
  307. cptGLJID.push(tem_g.gljId);
  308. }else {
  309. stdGLJID.push(tem_g.gljId);
  310. }
  311. }
  312. let stdGLJList = stdGLJID.length > 0 ? await std_glj_lib_gljList_model.find({'ID':{'$in':stdGLJID}}):[];//速度优化-------先一次性取出所有的工料机列表
  313. let stdGLJMap = _.indexBy(stdGLJList, 'ID');
  314. let cptGLJList = cptGLJID.length > 0 ? await complementary_glj_model.find({'userId':std.userId,'ID':{'$in':cptGLJID}}):[];
  315. let cptGLJMap = _.indexBy(cptGLJList, 'ID');
  316. let stdGLJMapTime = +new Date();
  317. console.log("找到工料机映射表时间-------------------------------"+(stdGLJMapTime - first));
  318. for(let sub of std.rationGljList){
  319. let newGLJ = {};
  320. newGLJ.ID = uuidV1();
  321. newGLJ.projectID = newRation.projectID;
  322. newGLJ.GLJID = sub.gljId;
  323. newGLJ.rationID = newRation.ID;
  324. newGLJ.billsItemID = newRation.billsItemID;
  325. newGLJ.rationItemQuantity = sub.consumeAmt;
  326. newGLJ.quantity = sub.consumeAmt;
  327. newGLJ.glj_repository_id = std.rationRepId;
  328. let std_glj = null;
  329. if(sub.type == 'complementary'){//有可能来自标准工料机库或补充工料机库
  330. std_glj = cptGLJMap[sub.gljId];
  331. newGLJ.from = 'cpt';
  332. }else {
  333. std_glj = stdGLJMap[sub.gljId];
  334. newGLJ.from = 'std';
  335. }
  336. let std_gljTime = +new Date();
  337. if(std_glj){
  338. newGLJ.name = std_glj.name;
  339. newGLJ.code = std_glj.code;
  340. newGLJ.original_code = std_glj.code;
  341. newGLJ.unit = std_glj.unit;
  342. newGLJ.specs = std_glj.specs;
  343. newGLJ.model = std_glj.model;
  344. newGLJ.basePrice = std_glj.basePrice;
  345. newGLJ.marketPrice = std_glj.basePrice;
  346. newGLJ.shortName = std_glj.shortName;
  347. newGLJ.type = std_glj.gljType;
  348. newGLJ.repositoryId = std_glj.repositoryId;
  349. newGLJ.adjCoe = std_glj.adjCoe;
  350. newGLJ.materialType = std_glj.materialType;
  351. newGLJ.materialCoe = std_glj.materialCoe;
  352. newGLJ.createType = 'normal';
  353. let info = await ration_glj_facade.getInfoFromProjectGLJ(newGLJ,unitPriceFileId);
  354. newGLJ = ration_glj_facade.createNewRecord(info);
  355. newRationGLJList.push(newGLJ);
  356. rationGLJShowList.push(info);
  357. }
  358. let InfoFromProjectGLJ = +new Date();
  359. console.log("找到项目工料机时间-------------------------------"+(InfoFromProjectGLJ - std_gljTime));
  360. }
  361. }
  362. let before = +new Date();
  363. console.log("总查询时间为-------------------------------"+(before-first));
  364. if(newRationGLJList.length>0){
  365. await ration_glj.insertMany(newRationGLJList);
  366. }
  367. let after = +new Date();
  368. console.log("实际插入时间为-------------------------------"+(after-before));
  369. console.log("总操作时间为-------------------------------"+(after-first));
  370. return rationGLJShowList;
  371. }
  372. async function deleRationSubRecode(projectID,rationID) {//删除挂在定额下的数据,如工程量明细,定额工料机等
  373. let delete_query={projectID: projectID, rationID: rationID};
  374. //删除工程量明细
  375. await quantity_detail.deleteByQuery(delete_query) ;
  376. await ration_coe.deleteMany(delete_query);//删除附注条件
  377. await ration_glj.deleteMany(delete_query);//删除定额工料机
  378. await rationInstallationModel.deleteMany(delete_query);//删除安装增加费
  379. }
  380. async function updateRation(std,defaultLibID,rationID,billsItemID,projectID,calQuantity) {
  381. // insertNewRation
  382. let ration ={};
  383. ration.code = std.code;
  384. ration.name = std.name;
  385. ration.caption = std.caption;
  386. ration.unit = std.unit;
  387. if (std.type === 'std') {
  388. ration.libID = std.rationRepId;
  389. }
  390. ration.content = std.jobContent;
  391. ration.adjustState = '';
  392. ration.isFromDetail=0;
  393. ration.isSubcontract=false;
  394. ration.fees=[];
  395. if (std.chapter) {
  396. ration.comments = std.chapter.explanation;
  397. ration.ruleText = std.chapter.ruleText;
  398. }
  399. ration.from = std.type === 'complementary' ? 'cpt' : 'std';
  400. //定额前缀 none:0, complementary:1, borrow: 2
  401. ration.prefix = '';
  402. //借用优先级比补充高
  403. if(std.rationRepId !== parseInt(defaultLibID)){//借用
  404. ration.prefix = '借';
  405. }
  406. else if(std.rationRepId === defaultLibID && ration.from === 'cpt') {
  407. ration.prefix = '补';
  408. }
  409. if(std.feeType == undefined || std.feeType == null || std.feeType ==''){//定额取费专业为空的情况下,取项目属性中的定额取费专业ID
  410. ration.programID = await getProgramForProject(projectID);
  411. }else {
  412. ration.programID = std.feeType;
  413. }
  414. ration.rationAssList = createRationAss(std);//生成辅助定额
  415. if(calQuantity){
  416. await CalculateQuantity(ration,billsItemID,projectID);
  417. }
  418. let unsetObject = {
  419. "marketUnitFee":1,
  420. 'marketTotalFee':1,
  421. "maskName":1
  422. }
  423. let newRation = await ration_model.model.findOneAndUpdate({ID:rationID,projectID:projectID},{"$set":ration,"$unset":unsetObject},{new: true});//;
  424. return newRation;
  425. }
  426. async function setEmptyRation(projectID,rationID){
  427. let ration ={};
  428. ration.code = "";
  429. ration.name = "";
  430. ration.caption = "";
  431. ration.unit = "";
  432. ration.libID = null;
  433. ration.content = "";
  434. ration.adjustState = '';
  435. ration.isFromDetail=0;
  436. ration.isSubcontract=false;
  437. ration.fees=[];
  438. ration.comments = "";
  439. ration.ruleText = "";
  440. ration.quantity="";
  441. ration.contain="";
  442. ration.quantityEXP="";
  443. ration.from = 'std';
  444. //定额前缀 none:0, complementary:1, borrow: 2
  445. ration.prefix = '';
  446. ration.rationAssList = [];
  447. ration.marketUnitFee ="";
  448. ration.marketTotalFee ="";
  449. ration.maskName = "";
  450. ration.targetTotalFee ='';
  451. ration.targetUnitFee = "";
  452. ration.deleteInfo = null;
  453. ration.quantityCoe = {};
  454. ration.rationQuantityCoe="";
  455. ration.tenderQuantity = "";
  456. ration.programID = null;
  457. let newRation = await ration_model.model.findOneAndUpdate({ID:rationID,projectID:projectID},{"$set":ration},{new: true});//;
  458. return {ration:newRation,ration_gljs:[],ration_coes:[],ration_installs:[]};
  459. }
  460. function createRationAss(std) {
  461. let rationAssList = [];//生成辅助定额
  462. if(std.hasOwnProperty('rationAssList')&&std.rationAssList.length>0){
  463. for(let i=0;i<std.rationAssList.length;i++){
  464. let ass = std.rationAssList[i];
  465. ass.actualValue = ass.stdValue;
  466. rationAssList.push(ass);
  467. }
  468. }
  469. return rationAssList;
  470. }
  471. async function CalculateQuantity (ration,billsItemID,projectID) {
  472. // calculate ration Quantity
  473. let project = await projectModel.findOne({ID:projectID});
  474. let decimalObject =await decimal_facade.getProjectDecimal(projectID,project);
  475. let quantity_decimal = (decimalObject&&decimalObject.ration&&decimalObject.ration.quantity)?decimalObject.ration.quantity:3;
  476. let pbill = await bill_model.model.findOne({projectID:projectID,ID:billsItemID});
  477. let t_unit = ration.unit?ration.unit.replace(/^\d+/,""):"";
  478. if(t_unit!=pbill.unit){//如果定额工程量的单位去除前面的数字后不等于清单单位,定额工程量保持不变
  479. return ;
  480. }
  481. let billsQuantity = pbill.quantity ? pbill.quantity : 0;
  482. let bill_decimal = await decimal_facade.getBillsQuantityDecimal(projectID,pbill.unit,project);
  483. billsQuantity=scMathUtil.roundForObj(billsQuantity,bill_decimal);
  484. ration.quantityEXP="QDL";
  485. ration.quantity = scMathUtil.roundForObj(billsQuantity / FilterNumberFromUnit(ration.unit),quantity_decimal);//不管是否打勾都做转换
  486. ration.contain = scMathUtil.roundForObj(ration.quantity/billsQuantity,6);
  487. };
  488. async function getProgramForProject(projectID){
  489. let project = await projectModel.findOne({ID:projectID});
  490. return project.property.engineering;
  491. }
  492. function FilterNumberFromUnit (unit) {
  493. let reg = new RegExp('^[0-9]+');
  494. if (reg.test(unit)) {
  495. return parseInt(unit.match(reg)[0]);
  496. } else {
  497. return 1;
  498. }
  499. };