ration_glj.js 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  1. /**
  2. * Created by Mai on 2017/4/1.
  3. */
  4. let ration_glj = {
  5. createNew: function (project) {
  6. // 用户定义private方法
  7. let tools = {};
  8. // 所有通过this访问的属性,都不应在此单元外部进行写入操作
  9. let ration_glj = function (proj) {
  10. this.gljTree = cacheTree.createNew(this);
  11. // this.project = proj;
  12. this.datas = [];
  13. let sourceType = ModuleNames.ration_glj;
  14. this.getSourceType = function () {
  15. return sourceType;
  16. }
  17. proj.registerModule(ModuleNames.ration_glj, this);
  18. };
  19. // 从后台获取数据
  20. /*glj.prototype.pullData = function (){
  21. this.project.pullData(
  22. '/glj/getData',
  23. {projectID: this.project.ID},
  24. function(result){
  25. if (result.error ===0){
  26. this.loadDatas(result.data);
  27. }
  28. else {
  29. // to do: 错误处理需要细化
  30. alert(result.message);
  31. }
  32. },
  33. function (){}//to do: 错误处理需要细化
  34. )
  35. };*/
  36. // prototype用于定义public方法
  37. ration_glj.prototype.loadData = function (datas) {
  38. this.datas = datas;
  39. };
  40. ration_glj.prototype.getGLJListByRationID = function (rationID) {
  41. return _.filter(this.datas, {'rationID': rationID})
  42. };
  43. ration_glj.prototype.getGatherGljArrByRations = function (rations, needOneBill, billQuantity) {
  44. let result = [];
  45. let clone = function (obj) {
  46. if (obj === null) return null;
  47. let o = Object.prototype.toString.apply(obj) === "[object Array]" ? [] : {};
  48. for (let i in obj) {
  49. o[i] = (obj[i] instanceof Date) ? new Date(obj[i].getTime()) : (typeof obj[i] === "object" ? clone(obj[i]) : obj[i]);
  50. }
  51. return o;
  52. }
  53. let findGlj = function (sourceGlj, gljArr) {
  54. for (let glj of gljArr) {
  55. if (glj.projectGLJID === sourceGlj.projectGLJID) {
  56. return glj;
  57. }
  58. }
  59. return null;
  60. }
  61. for (let ration of rations) {
  62. if (ration.type == rationType.volumePrice || ration.type == rationType.gljRation){
  63. let glj = JSON.parse(JSON.stringify(ration));
  64. glj.type = glj.subType;
  65. glj.totalQuantity = parseFloatPlus(ration.quantity);
  66. glj.markertPrice = glj.marketUnitFee;
  67. glj.basePrice = glj.marketUnitFee;
  68. glj.adjustPrice = glj.marketUnitFee;
  69. result.push(glj);
  70. } else{
  71. let rationGljs = projectObj.project.calcProgram.getGljArrByRation(ration);
  72. for (let glj of rationGljs) {
  73. let sameGlj = findGlj(glj, result);
  74. if (!sameGlj) {
  75. sameGlj = clone(glj);
  76. sameGlj.quantity = (sameGlj.quantity * ration.quantity).toDecimal(4);
  77. result.push(sameGlj);
  78. } else {
  79. sameGlj.quantity = sameGlj.quantity + (glj.quantity * ration.quantity).toDecimal(4);
  80. sameGlj.totalQuantity = (parseFloat(sameGlj.totalQuantity) + parseFloat(glj.totalQuantity)).toDecimal(4);
  81. }
  82. }
  83. }
  84. }
  85. result = gljOprObj.combineWithProjectGlj(result,false);
  86. if (!needOneBill) return result;
  87. // 上面取的是清单下所有工料机的总量,我要算清单单价,所以要取单位清单的工料机数量,所以下面要除以清单数量。
  88. let oneBill = JSON.parse(JSON.stringify(result));
  89. for (let glj of oneBill){
  90. if (glj.type == rationType.volumePrice){ // 量价、工料机形式的定额要进行数据变换才能参与基数计算。
  91. glj.type = glj.subType;
  92. glj.basePrice = glj.marketUnitFee;
  93. glj.marketPrice = glj.marketUnitFee;
  94. glj.adjustPrice = glj.marketUnitFee;
  95. }
  96. else if (glj.type == rationType.gljRation){
  97. glj.type = glj.subType;
  98. };
  99. // glj.quantity = (glj.quantity / billQuantity).toDecimal(decimalObj.glj.quantity);
  100. glj.quantity = (glj.quantity / billQuantity).toDecimal(decimalObj.process); // 广联达这里没有取舍
  101. };
  102. return oneBill;
  103. }
  104. // 提交数据后返回数据处理
  105. ration_glj.prototype.doAfterUpdate = function (err, data) {
  106. let me = this;
  107. if (!err) {
  108. if (data.updateTpye == 'ut_update') {
  109. me.refreshAfterUpdate(data);
  110. } else if (data.updateTpye == 'ut_delete') {
  111. me.refreshAfterDelete(data);
  112. } else {
  113. me.refreshAfterSave(data);
  114. }
  115. }
  116. projectObj.project.projectGLJ.loadData();
  117. };
  118. ration_glj.prototype.getDataByID = function (ID) {
  119. return _.find(this.datas,{'ID':ID});
  120. };
  121. ration_glj.prototype.refreshAfterSave = function (data) {
  122. let me = projectObj.project.ration_glj;
  123. let neRecodes = [];
  124. if (data) {
  125. // neRecodes=data.newRecords;//原来是显示和缓存分开的,后来发现会导致数据不一致的问题所以改成统一的了,这里也只是会作为显示。
  126. neRecodes = data.showDatas;
  127. gljOprObj.sheetData = neRecodes;
  128. me.addDatasToList(neRecodes);
  129. }
  130. project.projectGLJ.loadData(function () {
  131. gljOprObj.showRationGLJSheetData(true);
  132. //add to mainTree;
  133. me.addToMainTree(neRecodes);
  134. let rationID = neRecodes[0].rationID;
  135. let node = project.mainTree.nodes['id_' + rationID];
  136. if(isDef(node)){
  137. project.calcProgram.calcAndSave(node);
  138. }
  139. if (activeSubSheetIsCalcProgram())
  140. calcProgramObj.refreshCalcProgram(node, 1);
  141. });
  142. };
  143. ration_glj.prototype.getGljByRationID = function(rationID){
  144. return _.filter(this.datas, {'rationID': rationID});
  145. };
  146. ration_glj.prototype.addDatasToList = function (datas) {
  147. let me = projectObj.project.ration_glj;
  148. if(datas&&datas.length>0){
  149. if (me.datas && Array.isArray(me.datas)) {
  150. me.datas = me.datas.concat(datas);
  151. } else {
  152. me.datas = datas;
  153. }
  154. }
  155. };
  156. ration_glj.prototype.updateGLJNodeAfterReplace = function(data){
  157. if(!data) return null;
  158. if (this.needShowToTree(data)) {//当替换的是主材或设备时,刷新对应的树节点
  159. var node = this.findGLJNodeByID(data.ID);
  160. if (node) {
  161. this.transferToNodeData(data);
  162. node.source = data;
  163. node.data = data;
  164. }
  165. return node;
  166. }
  167. };
  168. ration_glj.prototype.addToMainTree = function (datas) {
  169. datas = gljUtil.sortRationGLJ(datas);
  170. for (let data of datas) {
  171. if (this.needShowToTree(data)) {
  172. gljOprObj.setGLJPrice(data);
  173. this.transferToNodeData(data);
  174. let parentNode = projectObj.project.mainTree.findNode(data.rationID);
  175. if (parentNode) {
  176. let nextNodeID = null;
  177. if (parentNode.children.length > 0) {
  178. for (let br of parentNode.children) {
  179. if (compareRationGLJ(data, br.data)) {//如果有兄弟节点则找到添加位置。
  180. nextNodeID = br.getID();
  181. }
  182. }
  183. }
  184. nextNodeID = nextNodeID ? nextNodeID : parentNode.tree.rootID();
  185. let newNode = projectObj.project.mainTree.insert(parentNode.getID(), nextNodeID,data.ID);
  186. newNode.source = data;
  187. newNode.sourceType = this.getSourceType();
  188. newNode.data = data;
  189. ProjectController.syncDisplayNewRationGljNode(projectObj.mainController, newNode);
  190. }
  191. }
  192. }
  193. };
  194. ration_glj.prototype.removeNodeByRation = function(ration,controller){//删除主材或设备节点
  195. let glj_list = _.filter(projectObj.project.ration_glj.datas,{'rationID':ration.ID});
  196. let deleteNodes = [];
  197. for(let rg of glj_list){
  198. if(this.needShowToTree(rg)){
  199. let r_node = projectObj.project.mainTree.getNodeByID(rg.ID);
  200. deleteNodes.push(r_node);
  201. }
  202. }
  203. if(deleteNodes.length > 0){
  204. let rowIndex = deleteNodes[0].serialNo();
  205. if(controller.tree.m_delete(deleteNodes)){
  206. TREE_SHEET_HELPER.massOperationSheet(controller.sheet, function () {
  207. let rowCount = deleteNodes.length;
  208. controller.sheet.deleteRows(rowIndex, rowCount);
  209. });
  210. }
  211. }
  212. };
  213. ration_glj.prototype.refreshAfterUpdate = function (data) {
  214. let me = this;
  215. let rationID= me.updateCacheAfterAdjust(data);
  216. gljOprObj.showRationGLJSheetData(true);
  217. this.reCalcWhenGLJChange({rationID:rationID});
  218. };
  219. ration_glj.prototype.updateCacheAfterAdjust=function (data) {
  220. let me = this;
  221. let rationID=null;
  222. if (data.quantityRefresh) {
  223. data.glj_result.forEach(function (item) {
  224. rationID = me.refreshEachItme(item.doc, item.query);
  225. })
  226. } else {
  227. rationID = me.refreshEachItme(data.doc, data.query);
  228. }
  229. return rationID;
  230. };
  231. ration_glj.prototype.refreshEachItme = function (doc, query) {
  232. let glj = this.refreshByID(query.ID,doc);
  233. return glj.rationID;
  234. };
  235. ration_glj.prototype.refreshByID=function (ID,doc) {
  236. let glj_list = projectObj.project.ration_glj.datas;
  237. let glj_index = _.findIndex(glj_list,{"ID":ID});
  238. _.forEach(doc, function (n, key) {
  239. glj_list[glj_index][key] = n;
  240. });
  241. return glj_list[glj_index]
  242. };
  243. ration_glj.prototype.refreshAfterDelete = function (data) {
  244. let me = projectObj.project.ration_glj;
  245. let glj_list = me.datas;
  246. let oldData = _.remove(glj_list, data.query);
  247. _.remove(gljOprObj.sheetData, data.query);
  248. gljOprObj.showRationGLJSheetData();
  249. projectObj.project.projectGLJ.loadData();
  250. let rationNode = null;
  251. let next = null;
  252. let selected = projectObj.project.mainTree.selected;
  253. if (selected.sourceType == ModuleNames.ration) { //如果选中的是定额,说明是右键删除工料机操作,如果选中的是定额工料机,则说明是在造价书主界面中点击了删除按钮
  254. rationNode = selected;
  255. } else if (selected.sourceType == ModuleNames.ration_glj) {
  256. rationNode = selected.parent;
  257. next = true;
  258. }
  259. rationNode.data.adjustState = data.adjustState;
  260. projectObj.mainController.refreshTreeNode([rationNode]);
  261. for (let o of oldData) {
  262. if (this.needShowToTree(o)) {
  263. let node = me.findGLJNodeByID(o.ID); //找到对应的树节点
  264. projectObj.mainController.deleteNode(node, next);
  265. }
  266. }
  267. project.calcProgram.calcAndSave(rationNode,function () {
  268. installationFeeObj.calcInstallationFee();
  269. });
  270. };
  271. // CSL,2017.05.09
  272. ration_glj.prototype.modifyQuantity = function (data, newQuantity) {
  273. this.project.beginUpdate('modifyQuantity');
  274. data.quantity = newQuantity;
  275. data.customQuantity = newQuantity;
  276. data.updateType = 'ut_update';
  277. this.project.push(this.getSourceType, data);
  278. this.project.endUpdate();
  279. };
  280. ration_glj.prototype.modifyPrice = function (data, newPrice) {
  281. this.project.beginUpdate('modifyPrice');
  282. data.price = newPrice;
  283. data.updateType = 'ut_update';
  284. this.project.push(this.getSourceType, data);
  285. this.project.endUpdate();
  286. };
  287. ration_glj.prototype.deleteGLJ = function (data) {
  288. this.project.beginUpdate('deleteGLJ');
  289. data.customQuantity = 0;
  290. data.quantity = 0;
  291. data.rationItemQuantity = 0;
  292. data.updateType = 'ut_update';
  293. this.project.push(this.getSourceType, data);
  294. this.project.endUpdate();
  295. };
  296. ration_glj.prototype.addRationGLJ = function (newRation, data) {
  297. let souceTypeList = [];
  298. let criteriaDataList = [];
  299. if (data.hasOwnProperty('rationGljList') && data.rationGljList.length > 0) {
  300. let criteria = {};
  301. criteria.ration_glj_list = [];
  302. for (let i = 0; i < data.rationGljList.length; i++) {
  303. let temdata = data.rationGljList[i];
  304. let newGLJ = {};
  305. newGLJ.projectID = parseInt(newRation.projectID);
  306. newGLJ.GLJID = temdata.gljId;
  307. newGLJ.rationID = newRation.ID;
  308. newGLJ.billsItemID = newRation.billsItemID;
  309. newGLJ.rationItemQuantity = temdata.consumeAmt;
  310. newGLJ.quantity = temdata.consumeAmt;
  311. newGLJ.glj_repository_id = data.rationRepId;
  312. criteria.ration_glj_list.push(newGLJ);
  313. }
  314. criteria.updateType = 'ut_create';
  315. souceTypeList.push(this.getSourceType());
  316. criteriaDataList.push(criteria);
  317. }
  318. let ration_coe = projectObj.project.ration_coe;
  319. let rationCoeData = ration_coe.getRationCoedata(newRation, data);
  320. souceTypeList.push(ration_coe.getSourceType());
  321. criteriaDataList.push(rationCoeData);
  322. project.pushNow('addRationGLJAndRationCoe', souceTypeList, criteriaDataList);
  323. };
  324. ration_glj.prototype.getDeleteDataByRation = function (rationData) {
  325. let updateData = [];
  326. updateData.push({
  327. 'deleteType': 'RATION',
  328. 'updateType': 'ut_delete',
  329. 'updateData': {'ID': rationData.ID, 'projectID': rationData.projectID}
  330. });
  331. return updateData;
  332. };
  333. ration_glj.prototype.getDeleteDataByBills = function (datas) {
  334. let updateData = [];
  335. datas.forEach(function (deleteData) {
  336. if (deleteData.type == 'delete') {
  337. let billData = deleteData.data;
  338. updateData.push({
  339. 'deleteType': 'BILL',
  340. 'updateType': 'ut_delete',
  341. 'updateData': {'ID': billData.ID, 'projectID': billData.projectID}
  342. });
  343. }
  344. })
  345. return updateData;
  346. };
  347. ration_glj.prototype.deleteByRation = function (ration) {
  348. let glj_list = projectObj.project.ration_glj.datas;
  349. _.remove(glj_list,{'rationID':ration.ID});
  350. };
  351. ration_glj.prototype.deleteByBills = function (deleteData) {
  352. let rationList = projectObj.project.Ration.datas;
  353. let deleteRationList = [];
  354. for (let i = 0; i < deleteData.length; i++) {
  355. if (deleteData[i].type == 'delete') {
  356. let billID = deleteData[i].data.ID;
  357. let raList = _.filter(rationList, (ration) => {
  358. return ration.billsItemID == billID;
  359. });
  360. deleteRationList = deleteRationList.concat(raList);
  361. }
  362. }
  363. for (let i = 0; i < deleteRationList.length; i++) {
  364. this.deleteByRation(deleteRationList[i]);
  365. projectObj.project.ration_coe.deleteByRation(deleteRationList[i]);
  366. projectObj.project.quantity_detail.deleteByRation(deleteRationList[i]);
  367. projectObj.project.ration_installation.deleteByRation(deleteRationList[i]);
  368. projectObj.project.Ration.datas.splice(projectObj.project.Ration.datas.indexOf(deleteRationList[i]), 1);
  369. }
  370. }
  371. ration_glj.prototype.updataOrdelete = function (row) {
  372. let updateData = null;
  373. if (row.rationItemQuantity == 0) {
  374. /* updateData = this.getUpdateData('ut_delete', {
  375. 'ID': row.ID,
  376. 'projectID': row.projectID
  377. }, {rationID: row.rationID});
  378. project.pushNow('updateRationGLJ', [this.getSourceType()], updateData)*/
  379. this.deleteRationGLJ({ID:row.ID,rationID:row.rationID, projectID: row.projectID,type:row.type});
  380. } else {
  381. this.updateRationGLJByEdit(row, 'customQuantity', 0);
  382. //('ut_update',{'ID': row.ID, 'projectID': row.projectID},{'quantity':0,'customQuantity':0});
  383. }
  384. };
  385. ration_glj.prototype.deleteRationGLJ = async function(data){
  386. try {
  387. let result = await ajaxPost('/rationGlj/deleteRationGLJ',data);
  388. console.log(result);
  389. let oldData = this.addAndDeleteDatas([],result.deleteList);
  390. this.refreshQuantityAfterCalResult(result.glj_result);
  391. let rationNode = null;
  392. let next = null;
  393. let selected = projectObj.project.mainTree.findNode(result.rationID);
  394. if (selected.sourceType == ModuleNames.ration) { //如果选中的是定额,说明是右键删除工料机操作,如果选中的是定额工料机,则说明是在造价书主界面中点击了删除按钮
  395. rationNode = selected;
  396. } else if (selected.sourceType == ModuleNames.ration_glj) {
  397. rationNode = selected.parent;
  398. next = true;
  399. }
  400. rationNode.data.adjustState = result.adjustState;
  401. projectObj.mainController.refreshTreeNode([rationNode]);
  402. for (let o of oldData) {
  403. if (this.needShowToTree(o)) {
  404. let node = me.findGLJNodeByID(o.ID); //找到对应的树节点
  405. projectObj.mainController.deleteNode(node, next);
  406. }
  407. }
  408. project.calcProgram.calcAndSave(rationNode,function () {
  409. installationFeeObj.calcInstallationFee();
  410. });
  411. gljOprObj.refreshView();
  412. projectObj.project.projectGLJ.loadData();
  413. }catch (e){
  414. console.log(e)
  415. }
  416. };
  417. ration_glj.prototype.getUpdateData = function (type, query, doc, callfunction) {
  418. let updateData = [];
  419. let newobj = {
  420. 'updateType': type,
  421. 'query': query,
  422. }
  423. if (doc) {
  424. newobj['doc'] = doc;
  425. }
  426. if (callfunction) {
  427. newobj['updateFunction'] = callfunction;
  428. }
  429. updateData.push(newobj);
  430. return updateData;
  431. };
  432. ration_glj.prototype.updateRationGLJByEdit = function (recode, updateField, newval, node) {
  433. let me = this,doc = {};
  434. doc[updateField] = newval;
  435. me.submitChange(recode,doc,updateField,node);
  436. };
  437. ration_glj.prototype.submitChange = function(recode,updateData,updateField,node){
  438. let me = this;
  439. let query = {
  440. 'ID': recode.ID,
  441. 'projectID': recode.projectID,
  442. 'rationID': recode.rationID
  443. };
  444. let priceInfo = {
  445. base_price: recode.basePrice,
  446. market_price: recode.marketPrice
  447. };
  448. if(updateData['type'] != undefined || updateData['type'] != null){
  449. updateData.shortName = projectObj.project.projectGLJ.getShortNameByID(updateData['type']);
  450. }
  451. let callback = function (data) {
  452. if (updateField == 'customQuantity') {
  453. me.refreshAfterQuantityUpdate(data, node);
  454. me.refreshTreeNodeIfNeeded(recode);//刷新造价书上的树节点(如果需要)
  455. me.reCalcWhenGLJChange(recode);//触发计算定额以及父节点
  456. zmhs_obj.refreshStableDataIfNeeded();
  457. gljOprObj.refreshView();
  458. $.bootstrapLoading.end();
  459. installationFeeObj.calcInstallationFee();
  460. } else {
  461. let doc = data.doc;
  462. for (let key in doc) {
  463. recode[key] = doc[key];
  464. }
  465. me.refreshRationAfterEdit(data,recode.rationID, node);//更新名称和定额调整状态
  466. if (node) {//如果不是在造价书页面直接编辑,则不用刷新
  467. if (updateField == "type" && !(updateData['type'] == gljType.MAIN_MATERIAL || updateData['type'] == gljType.EQUIPMENT)) {//如果改变类型后不是主材或设备,则在造价书树中移除
  468. projectObj.mainController.deleteNode(node, true);
  469. }
  470. }
  471. projectObj.project.projectGLJ.loadData(function () {//等项目工料机加载完成后再给用户编辑
  472. me.refreshTreeNodeIfNeeded(recode);//刷新造价书上的树节点(如果需要)
  473. me.reCalcWhenGLJChange(recode);//触发计算定额以及父节点
  474. zmhs_obj.refreshStableDataIfNeeded();
  475. gljOprObj.refreshView();
  476. $.bootstrapLoading.end();
  477. installationFeeObj.calcInstallationFee();
  478. });
  479. }
  480. };
  481. $.bootstrapLoading.start();
  482. CommonAjax.post("/rationGlj/updateRationGLJByEdit", {
  483. query: query,
  484. doc: updateData,
  485. priceInfo: priceInfo
  486. }, callback, function (err) {
  487. $.bootstrapLoading.end();
  488. });
  489. };
  490. ration_glj.prototype.refreshAfterQuantityUpdate = function (data, node) {
  491. this.refreshQuantityAfterCalResult(data.glj_result);
  492. this.refreshRationAfterEdit(data, data.rationID, node);
  493. };
  494. ration_glj.prototype.refreshQuantityAfterCalResult = function (glj_result) {//后端计算后,前端刷新结果
  495. let me = this;
  496. glj_result.forEach(function (item) {
  497. me.refreshEachItme(item.doc, item.query);
  498. });
  499. };
  500. ration_glj.prototype.refreshRationAfterEdit= function(data,rationID,rnode){
  501. let nodes = [];
  502. let node = this.refreshRationNode(data.name,data.adjustState,rationID);
  503. if (node) nodes.push(node);
  504. if (rnode) nodes.push(rnode);
  505. projectObj.mainController.refreshTreeNode(nodes);
  506. };
  507. ration_glj.prototype.refreshRationNode = function(name,adjustState,rationID){
  508. let node = projectObj.project.mainTree.findNode(rationID);
  509. if (!node) return null;
  510. if(gljUtil.isDef(adjustState)){
  511. node.data.adjustState = adjustState;
  512. }
  513. if(gljUtil.isDef(name)){
  514. node.data.name = name;
  515. }
  516. return node
  517. };
  518. ration_glj.prototype.getGLJData = function (url, cb) {
  519. let property = projectObj.project.projectInfo.property;
  520. //let engineerID = property.engineering_id;
  521. CommonAjax.get(url, function (data) {
  522. //编办中有多单价设置
  523. if(data.datas.priceProperties && data.datas.priceProperties.length > 0){
  524. let tem = _.find(data.datas.priceProperties,{region:property.region,taxModel:parseInt(property.taxType)});
  525. if(tem){
  526. let dataCode = tem.price.dataCode;
  527. for(let glj of data.datas.stdGLJ){
  528. if(glj.priceProperty && gljUtil.isDef(glj.priceProperty[dataCode])) glj.basePrice = glj.priceProperty[dataCode];
  529. }
  530. }
  531. };
  532. cb(data);
  533. })
  534. };
  535. ration_glj.prototype.insertGLJAsRation = function (GLJSelection, selected,insertType, callback) {
  536. let gljList = [];
  537. let allGLJ = gljOprObj.AllRecode;
  538. let billsItemID = null, serialNo = 0,selectedSerialNo = null,nextNodeID = null, parentNodeID = null, billNode = null;
  539. let pEngineer = projectObj.project.projectInfo.property.projectEngineering;
  540. let children = [];
  541. if (selected.sourceType === project.Bills.getSourceType()) {
  542. billsItemID = selected.data.ID;
  543. parentNodeID = selected.getID();
  544. nextNodeID = selected.tree.rootID();
  545. billNode = selected;
  546. } else {
  547. billsItemID = selected.data.billsItemID;
  548. serialNo = selected.data.serialNo;
  549. selectedSerialNo = selected.data.serialNo;
  550. nextNodeID = selected.getNextSiblingID();
  551. parentNodeID = selected.getParentID();
  552. billNode = selected.parent;
  553. }
  554. children = project.Ration.getBillsSortRation(billsItemID);
  555. serialNo == 0 ? serialNo = children.length : "";
  556. for (let con_key of GLJSelection) {
  557. let glj = _.find(allGLJ, function (item) {
  558. let i_key = gljOprObj.getIndex(item, gljLibKeyArray);
  559. return i_key == con_key;
  560. });
  561. if (glj) {
  562. serialNo += 1;
  563. let new_glj = {
  564. ID: project.Ration.getNewRationID(),
  565. projectID: parseInt(project.ID()),
  566. billsItemID: billsItemID,
  567. type: rationType.gljRation,
  568. code: glj.code,
  569. name: glj.name,
  570. quantity: 0,
  571. unit: glj.unit,
  572. specs: glj.specs,
  573. subType: glj.gljType,
  574. model:glj.model,
  575. basePrice: glj.basePrice,
  576. marketPrice:glj.basePrice,
  577. original_code: glj.code,
  578. shortName: glj.shortName,
  579. serialNo: serialNo,
  580. GLJID: glj.ID,
  581. adjCoe: glj.adjCoe,
  582. materialType:glj.materialType,
  583. materialCoe:glj.materialCoe,
  584. grossWeightCoe:glj.grossWeightCoe,
  585. purchaseStorageRate:glj.purchaseStorageRate,
  586. offSiteTransportLossRate:glj.offSiteTransportLossRate,
  587. handlingLossRate:glj.handlingLossRate,
  588. repositoryId: glj.repositoryId
  589. };
  590. if(pEngineer) new_glj.programID = pEngineer;
  591. if(insertType=="insertEquipment") new_glj.programID = projectObj.project.calcProgram.compiledTemplateMaps['设备购置'];
  592. /* let belongFlag = cbTools.getBelongFlag(selected); 原来是在设备购置清单下插入设备才要取设备勾置费的,现在改成插入设备直接取
  593. if (belongFlag && belongFlag === fixedFlag.EQUIPMENT_ACQUISITION_FEE) {
  594. new_glj.programID = projectObj.project.calcProgram.compiledTemplateMaps['设备购置'];
  595. } */
  596. if (glj.hasOwnProperty("compilationId")) {
  597. new_glj.from = "cpt";
  598. if (glj.code.indexOf('-') != -1) {//这条工料机是用户通过修改名称、规格、型号等保存到补充工料机库的
  599. new_glj.original_code = glj.code.split('-')[0];//取-前的编号作为原始编号
  600. }
  601. }
  602. if(optionsOprObj.getOption(optionsOprObj.optionsTypes.GENERALOPTS, 'rationQuanACToBillsQuan')){//需要根据清单转换工程量
  603. new_glj.quantityEXP="QDL";
  604. if(billNode.data.quantity){
  605. new_glj.quantity = scMathUtil.roundForObj(billNode.data.quantity/FilterNumberFromUnit(glj.unit),getDecimal("glj.quantity"));
  606. new_glj.contain = scMathUtil.roundForObj(new_glj.quantity/billNode.data.quantity,6);
  607. }
  608. }
  609. gljList.push(new_glj);
  610. }
  611. }
  612. if (gljList.length == 0) {
  613. return;
  614. }
  615. let postData = {
  616. gljList: gljList,
  617. projectID: parseInt(project.ID()),
  618. billsItemID: billsItemID,
  619. rationCount: project.Ration.maxRationID()
  620. }
  621. selectedSerialNo == null ? "" : postData.selectedSerialNo = selectedSerialNo;
  622. CommonAjax.post("/ration/insertGLJAsRation", postData, function (data) {
  623. // 更新兄弟节点的序列号
  624. if (selectedSerialNo != null) {
  625. let selectIndex = _.findIndex(children, {"serialNo": selectedSerialNo});
  626. if (selectIndex + 1 < children.length) {
  627. for (let i = selectIndex + 1; i < children.length; i++) {
  628. children[i].serialNo += gljList.length;
  629. }
  630. }
  631. }
  632. callback(parentNodeID,nextNodeID,data);
  633. }, function () {
  634. $.bootstrapLoading.end();
  635. });
  636. };
  637. ration_glj.prototype.getGLJDataByCodes = function (codes,callback) {
  638. if(!gljUtil.isDef(codes)||codes.length ==0) {
  639. if(callback) callback([]);
  640. return
  641. }
  642. $.bootstrapLoading.start();
  643. CommonAjax.post("/rationGlj/getGLJDataByCodes", { 'engineerID':projectObj.project.projectInfo.property.engineering_id,projectID:projectObj.project.ID(),codes:codes}, function (result) {
  644. $.bootstrapLoading.end();
  645. callback(result)
  646. });
  647. };
  648. ration_glj.prototype.getAddDataByStd = function (glj,rationID,billsItemID,projectID) {//生成添加类型的定额工料机数据
  649. let ration_glj = {
  650. projectID: projectID,
  651. GLJID: glj.ID,
  652. rationID: rationID,
  653. billsItemID: billsItemID,
  654. rationItemQuantity: 0,
  655. quantity: 0,
  656. name: glj.name,
  657. code: glj.code,
  658. original_code: glj.code,
  659. unit: glj.unit,
  660. specs: glj.specs,
  661. basePrice: glj.basePrice,
  662. marketPrice:glj.basePrice,
  663. shortName: glj.shortName,
  664. type: glj.gljType,
  665. model:glj.model,
  666. adjCoe: glj.adjCoe,
  667. createType: 'add',
  668. materialType:glj.materialType,
  669. materialCoe:glj.materialCoe,
  670. grossWeightCoe:glj.grossWeightCoe,
  671. purchaseStorageRate:glj.purchaseStorageRate,
  672. offSiteTransportLossRate:glj.offSiteTransportLossRate,
  673. handlingLossRate:glj.handlingLossRate,
  674. repositoryId: glj.repositoryId
  675. };
  676. if (glj.hasOwnProperty("compilationId")) {
  677. ration_glj.from = "cpt";
  678. if (glj.code.indexOf('-') != -1) {//这条工料机是用户通过修改名称、规格、型号等保存到补充工料机库的
  679. ration_glj.original_code = glj.code.split('-')[0];//取-前的编号作为原始编号
  680. }
  681. }
  682. return ration_glj;
  683. };
  684. ration_glj.prototype.addGLJByLib = function (GLJSelection, ration, callback) {
  685. let me=this,gljList = [];
  686. let allGLJ = gljOprObj.AllRecode;
  687. GLJSelection.sort();
  688. _.forEach(GLJSelection, function (g) {
  689. let glj = _.find(allGLJ, function (item) {
  690. let i_key = gljOprObj.getIndex(item, gljLibKeyArray);
  691. return i_key == g;
  692. });
  693. let ration_glj = me.getAddDataByStd(glj,ration.ID,ration.billsItemID,ration.projectID);
  694. if (glj.userId) {
  695. ration_glj.fromUser = glj.userId;
  696. }
  697. gljList.push(ration_glj);
  698. });
  699. $.bootstrapLoading.start();
  700. CommonAjax.post("/rationGlj/addGLJ", gljList, callback, function () {
  701. $.bootstrapLoading.end();
  702. });
  703. };
  704. ration_glj.prototype.updateRationGLJByChangeCode = function (recode, updateField, newval) {
  705. let me = this;
  706. let priceMap = projectObj.project.projectGLJ.datas.unitPriceMap;
  707. let priceObj = priceMap[newval];
  708. if(priceObj){
  709. if (recode.createType===undefined || recode.createType == 'normal') {// createTypel 默认是normal 只有是定额下带的工料机才需把类型改成替换,其它的保持不变
  710. recode.rcode = recode.code;
  711. recode.createType = 'replace';
  712. }
  713. recode.code = priceObj.code;
  714. recode.name = priceObj.name;
  715. recode.type = priceObj.type;
  716. recode.unit = priceObj.unit;
  717. recode.shortName = priceObj.short_name;
  718. recode.specs = priceObj.specs;
  719. recode.GLJID=priceObj.glj_id;
  720. recode.original_code = priceObj.original_code;
  721. recode.basePrice = priceObj.base_price;
  722. recode.marketPrice = priceObj.market_price;
  723. }
  724. $.bootstrapLoading.start();
  725. CommonAjax.post("/rationGlj/replaceGLJ", recode, function (result) {
  726. if (result) {
  727. me.setDatasAfterReplace(result);
  728. let data = result.data;
  729. let rationNode = projectObj.project.mainTree.findNode(data.rationID);
  730. let nodes = [rationNode];
  731. gljOprObj.refreshView();
  732. if (project.ration_glj.needShowToTree(data)) {//当替换的是主材或设备时,刷新对应的树节点
  733. let node = project.ration_glj.findGLJNodeByID(data.ID);
  734. if (node) {
  735. project.ration_glj.transferToNodeData(data);
  736. node.source = data;
  737. node.data = data;
  738. }
  739. node ? nodes.push(node) : "";
  740. }
  741. rationNode.data.adjustState = result.adjustState;
  742. rationNode.data.name = result.name;
  743. projectObj.mainController.refreshTreeNode(nodes);
  744. project.calcProgram.calcAndSave(rationNode);
  745. $.bootstrapLoading.end();
  746. }
  747. }, function () {
  748. $.bootstrapLoading.end();
  749. });
  750. };
  751. ration_glj.prototype.setDatasAfterReplace = function(result){
  752. let me = this;
  753. me.addAndDeleteDatas(result.newRecodes,result.deleteList);
  754. let list_index = _.findIndex(me.datas, {'ID': result.data.ID});
  755. if(result.data) me.datas[list_index] = result.data;
  756. me.refreshQuantityAfterCalResult(result.glj_result);
  757. if(result.projectGLJ) project.projectGLJ.loadNewProjectGLJToCaches([result.projectGLJ],true);
  758. };
  759. ration_glj.prototype.addAndDeleteDatas = function (newRecodes,deleteList) {
  760. let oldData = [];
  761. if(newRecodes.length > 0 ) this.datas = this.datas.concat(newRecodes);
  762. if(deleteList.length > 0) {
  763. oldData = _.remove(this.datas,function (item) {
  764. return deleteList.indexOf(item.ID)!=-1;
  765. });
  766. }
  767. return oldData;
  768. };
  769. ration_glj.prototype.getReplaceDataByStd = function (oldData,glj) {
  770. if (oldData.createType===undefined || oldData.createType == 'normal') {// createTypel 默认是normal 只有是定额下带的工料机才需把类型改成替换,其它的保持不变
  771. oldData.rcode = oldData.code;
  772. oldData.createType = 'replace';
  773. oldData.mIndexObj ={code:oldData.code,name:oldData.name,type:oldData.type,unit:oldData.unit,specs:oldData.specs};
  774. }else if(oldData.createType == 'replace' && oldData.rcode == glj.code){//如果原数据已经是替换过的,这次替换又恢复成原数据,则把类型改回来
  775. oldData.createType = 'normal';
  776. oldData.mIndexObj = null;
  777. }
  778. oldData.GLJID = glj.ID;
  779. oldData.name = glj.name;
  780. oldData.type = glj.gljType;
  781. oldData.code = glj.code;
  782. oldData.original_code = glj.code;
  783. oldData.unit = glj.unit;
  784. oldData.specs = glj.specs;
  785. oldData.model = glj.model;
  786. oldData.basePrice = glj.basePrice;
  787. oldData.shortName=glj.shortName;
  788. oldData.marketPrice = glj.basePrice;
  789. oldData.repositoryId = glj.repositoryId;
  790. oldData.materialType = glj.materialType;
  791. oldData.materialCoe = glj.materialCoe;
  792. oldData.grossWeightCoe= glj.grossWeightCoe;
  793. oldData.purchaseStorageRate = glj.purchaseStorageRate;
  794. oldData.offSiteTransportLossRate = glj.offSiteTransportLossRate;
  795. oldData.handlingLossRate = glj.handlingLossRate;
  796. if (glj.hasOwnProperty("compilationId")) {
  797. oldData.from = "cpt";
  798. if (glj.userId) {
  799. oldData.fromUser = glj.userId;
  800. }
  801. if (glj.code.indexOf('-') != -1) {//这条工料机是用户通过修改包称、规格、型号等保存到补充工料机库的
  802. oldData.original_code = glj.code.split('-')[0];//取-前的编号作为原始编号
  803. }
  804. } else {
  805. oldData.from = "std";
  806. }
  807. return oldData;
  808. };
  809. ration_glj.prototype.replaceGLJ = function (selectCode, oldData, callback) {
  810. let allGLJ = gljOprObj.AllRecode;
  811. let glj = _.find(allGLJ, function (item) {
  812. let i_key = gljOprObj.getIndex(item, gljLibKeyArray);
  813. return i_key == selectCode;
  814. });
  815. if (selectCode == gljOprObj.getIndex(oldData, gljKeyArray)) {
  816. return callback(null);
  817. }
  818. //如果是从混凝土改成商品混凝土,并且混凝土的定额消耗量不为空,则原混凝土的自定义消耗改成0,插入一条新的商品混凝土自定义消耗量为原定额计算后的消耗量
  819. if(gljUtil.isAddCommercialForReplace(oldData.type,glj.gljType,oldData.rationItemQuantity)){
  820. let originalID = oldData.ID;
  821. let customQuantity = gljUtil.isDef(oldData.quantity)? oldData.quantity:0;
  822. oldData = this.getAddDataByStd(glj,oldData.rationID,oldData.billsItemID,oldData.projectID);
  823. oldData.toCommercial=true;
  824. oldData.originalID = originalID;
  825. oldData.customQuantity = customQuantity;
  826. }else {
  827. oldData = this.getReplaceDataByStd(oldData,glj);
  828. }
  829. $.bootstrapLoading.start();
  830. CommonAjax.post("/rationGlj/replaceGLJ", oldData, callback, function () {
  831. $.bootstrapLoading.end();
  832. });
  833. };
  834. ration_glj.prototype.mReplaceGLJ = function (selectCode, oldData, callback) {
  835. let allGLJ = gljOprObj.AllRecode,tasks = [],updateMap={},doc = null;
  836. let oldIndex = gljOprObj.getIndex(oldData, gljKeyArray);
  837. let glj = _.find(allGLJ, function (item) {
  838. let i_key = gljOprObj.getIndex(item, gljLibKeyArray);
  839. return i_key == selectCode;
  840. });
  841. if (selectCode == oldIndex) {
  842. return callback(null);
  843. }
  844. let query = {
  845. projectID: oldData.projectID,
  846. code: oldData.code,
  847. name: oldData.name,
  848. unit: oldData.unit,
  849. type: oldData.type
  850. };
  851. if (oldData.specs && oldData.specs != '') {
  852. query.specs = oldData.specs;
  853. }
  854. for(let d of this.datas){//查询出所有需替换的工料机
  855. if(!gljOprObj.scopeSelectedIDMap[d.billsItemID]) continue; //如果不在选中范围的,跳过
  856. let tem_index = gljOprObj.getIndex(d, gljKeyArray);
  857. if(tem_index == oldIndex){
  858. let tem_doc = {};
  859. //是否从混凝土改成商品混凝土,并且混凝土的定额消耗量不为空
  860. if(gljUtil.isAddCommercialForReplace(d.type,glj.gljType,d.rationItemQuantity)){
  861. tem_doc = {'customQuantity':'0'};
  862. //插入一条新的定额,这里的更新自定义消耗量操作由task完成了,不用像单条替换那样做标记,修改等
  863. let newDoc = this.getAddDataByStd(glj,d.rationID,d.billsItemID,d.projectID);
  864. let customQuantity = gljUtil.isDef(d.quantity)? d.quantity:0;
  865. newDoc.customQuantity = customQuantity;
  866. let tTask = {insertOne:{document: newDoc}};
  867. tasks.push(tTask);
  868. doc=newDoc//后台操作: 要根据nweDoc,插入项目工料机,修改insertOne里项目工料机ID,生成新的自身ID
  869. }else {
  870. tem_doc = this.getReplaceDataByStd(d,glj);
  871. if(gljUtil.isConcreteType(d.type)||gljUtil.isCommercialConcreteType(d.type)) tem_doc.isConcrete = true;//这里是在批量替换中有可能同时存在定额下的替换和添加的替换,对于添加的替换,要走替换混凝土的逻辑,定额下的替换又走另外的逻辑
  872. doc = tem_doc;
  873. }
  874. let task = {
  875. updateOne:{
  876. filter : {ID:d.ID,rationID:d.rationID},
  877. update : tem_doc
  878. }
  879. };
  880. tasks.push(task);
  881. updateMap[d.ID] = tem_doc;
  882. }
  883. }
  884. $.bootstrapLoading.start();
  885. CommonAjax.post("/rationGlj/mReplaceGLJ", {query: query, doc: doc,tasks:tasks}, function (result) {
  886. callback(result,updateMap);
  887. }, function () {
  888. $.bootstrapLoading.end();
  889. });
  890. };
  891. ration_glj.prototype.getMainAndEquGLJ = function (rationID) {
  892. let gljList = _.filter(this.datas, function (n) {
  893. return n.rationID == rationID && (n.type == gljType.MAIN_MATERIAL || n.type == gljType.EQUIPMENT)
  894. });
  895. gljList = gljUtil.sortRationGLJ(gljList);
  896. return gljOprObj.combineWithProjectGlj(gljList);
  897. };
  898. ration_glj.prototype.transferToNodeData = function (data) {
  899. data.contain=scMathUtil.roundForObj(data.quantity,getDecimal('glj.quantity'));
  900. data.subType = data.type;
  901. };
  902. ration_glj.prototype.combineRationAndGLJ = function (ration) {
  903. if (ration) {
  904. let projectGLJData = projectObj.project.projectGLJ.datas;
  905. let projectGljs = projectGLJData.gljList;
  906. let mixRatioMap = projectGLJData.mixRatioMap;
  907. let glj = _.find(projectGljs, {'id': ration.projectGLJID});
  908. if (glj) {
  909. if(projectObj.project.projectGLJ.isEstimateType(glj.type)){
  910. ration.isEstimate = glj.is_evaluate;
  911. }
  912. ration = gljOprObj.setGLJPrice(ration,glj);
  913. ration.isAdd = glj.unit_price.is_add;
  914. let connect_index = gljOprObj.getIndex(glj, gljKeyArray);
  915. if (mixRatioMap.hasOwnProperty(connect_index)) {
  916. let mixRatios = gljOprObj.getMixRationShowDatas(mixRatioMap[connect_index], projectGljs);
  917. ration.subList = mixRatios;
  918. }
  919. }
  920. }
  921. return ration;
  922. };
  923. ration_glj.prototype.updateFromMainSpread = function (value, node, fieldName) {
  924. if (node.data[fieldName] !== value) {
  925. if (fieldName == "marketUnitFee") {
  926. let decimal = getDecimal("glj.unitPrice");
  927. let newval = number_util.checkNumberValue(value, decimal);
  928. if (newval) {
  929. fieldName = "marketPrice";
  930. projectObj.project.projectGLJ.updatePriceFromRG(node.data, fieldName, newval);
  931. return;
  932. }
  933. } else {
  934. if(fieldName == "contain"){
  935. if(value==null){
  936. value="";
  937. }else {
  938. let decimal = getDecimal("glj.quantity");
  939. value = number_util.checkNumberValue(value, decimal);
  940. fieldName="customQuantity";//填入自定义消耗
  941. }
  942. }
  943. if (value !== undefined && value !== null) {
  944. if (fieldName == "subType") {
  945. node.data.subType = value;
  946. fieldName = "type";//转换成更新工料机类型
  947. }
  948. this.updateRationGLJByEdit(node.data, fieldName, value, node);
  949. return;
  950. }
  951. }
  952. }
  953. // node.data.subType = value;
  954. projectObj.mainController.refreshTreeNode([node]);
  955. };
  956. ration_glj.prototype.refreshTreeNodeIfNeeded = function (data) {
  957. if (this.needShowToTree(data)) {
  958. this.transferToNodeData(data);
  959. gljOprObj.refreshTreeNode({"type": ModuleNames.ration_glj, "ID": data.ID});
  960. }
  961. };
  962. ration_glj.prototype.needShowToTree = function (data) {
  963. if ((data.type == gljType.MAIN_MATERIAL || data.type == gljType.EQUIPMENT) && projectObj.project.projectInfo.property.displaySetting.disPlayMainMaterial == true) {
  964. return true
  965. }
  966. return false
  967. };
  968. ration_glj.prototype.findGLJNodeByID = function (ID) {
  969. return projectObj.project.mainTree.findNode(ID);
  970. };
  971. ration_glj.prototype.findRationNodeByID = function (ID) {
  972. return projectObj.project.mainTree.findNode(ID);
  973. };
  974. ration_glj.prototype.reCalcWhenGLJChange = function (ration_glj) {//当改变定额工料机时,重新计算定额以及其父节点
  975. let node = this.findRationNodeByID(ration_glj.rationID);
  976. if (node) {
  977. node.changed = true;
  978. project.calcProgram.calcAndSave(node);
  979. }
  980. };
  981. ration_glj.prototype.reCalcWhenVvTaxChange = function () {
  982. let rationIDs = [];
  983. for(let g of this.datas){
  984. if(g.type == gljType.GENERAL_MACHINE) rationIDs.push(g.rationID);
  985. }
  986. this.calcRationsByIDs(_.uniq(rationIDs))
  987. };
  988. ration_glj.prototype.calcRationsByIDs = function (rationIDs) {
  989. let nodes = [];
  990. for(let ID of rationIDs){
  991. let node = projectObj.project.mainTree.findNode(ID);
  992. if(node) nodes.push(node)
  993. }
  994. project.calcProgram.calcNodesAndSave(nodes);
  995. };
  996. ration_glj.prototype.updateProportion = function (proportionList, projectID, rationID) {
  997. const postData = {
  998. proportionList,
  999. projectID,
  1000. rationID
  1001. };
  1002. $.bootstrapLoading.start();
  1003. CommonAjax.post('/rationGLJ/updateProportion', postData, function (rst) {
  1004. proportionList.forEach(item => {
  1005. const glj = zmhs_obj.stableSheetData.find(glj => glj.ID === item.ID);
  1006. if (glj) {
  1007. glj.adjustProportion = item.adjustProportion;
  1008. }
  1009. });
  1010. zmhs_obj.refreshStableDataIfNeeded();
  1011. zmhs_obj.refreshAfterUpdate(rst);
  1012. $.bootstrapLoading.end();
  1013. }, function () {
  1014. zmhs_obj.refreshStableDataIfNeeded();
  1015. $.bootstrapLoading.end();
  1016. });
  1017. };
  1018. return new ration_glj(project);
  1019. }
  1020. };