ration_glj.js 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065
  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. projectObj.project.projectGLJ.calcQuantity();
  457. zmhs_obj.refreshStableDataIfNeeded();
  458. gljOprObj.refreshView();
  459. $.bootstrapLoading.end();
  460. installationFeeObj.calcInstallationFee();
  461. } else {
  462. let doc = data.doc;
  463. for (let key in doc) {
  464. recode[key] = doc[key];
  465. }
  466. me.refreshRationAfterEdit(data,recode.rationID, node);//更新名称和定额调整状态
  467. if (node) {//如果不是在造价书页面直接编辑,则不用刷新
  468. if (updateField == "type" && !(updateData['type'] == gljType.MAIN_MATERIAL || updateData['type'] == gljType.EQUIPMENT)) {//如果改变类型后不是主材或设备,则在造价书树中移除
  469. projectObj.mainController.deleteNode(node, true);
  470. }
  471. }
  472. projectObj.project.projectGLJ.loadData(function () {//等项目工料机加载完成后再给用户编辑
  473. me.refreshTreeNodeIfNeeded(recode);//刷新造价书上的树节点(如果需要)
  474. me.reCalcWhenGLJChange(recode);//触发计算定额以及父节点
  475. zmhs_obj.refreshStableDataIfNeeded();
  476. gljOprObj.refreshView();
  477. $.bootstrapLoading.end();
  478. installationFeeObj.calcInstallationFee();
  479. });
  480. }
  481. };
  482. $.bootstrapLoading.start();
  483. CommonAjax.post("/rationGlj/updateRationGLJByEdit", {
  484. query: query,
  485. doc: updateData,
  486. priceInfo: priceInfo
  487. }, callback, function (err) {
  488. $.bootstrapLoading.end();
  489. });
  490. };
  491. ration_glj.prototype.refreshAfterQuantityUpdate = function (data, node) {
  492. this.refreshQuantityAfterCalResult(data.glj_result);
  493. this.refreshRationAfterEdit(data, data.rationID, node);
  494. };
  495. ration_glj.prototype.refreshQuantityAfterCalResult = function (glj_result) {//后端计算后,前端刷新结果
  496. let me = this;
  497. glj_result.forEach(function (item) {
  498. me.refreshEachItme(item.doc, item.query);
  499. });
  500. };
  501. ration_glj.prototype.refreshRationAfterEdit= function(data,rationID,rnode){
  502. let nodes = [];
  503. let node = this.refreshRationNode(data.name,data.adjustState,rationID);
  504. if (node) nodes.push(node);
  505. if (rnode) nodes.push(rnode);
  506. projectObj.mainController.refreshTreeNode(nodes);
  507. };
  508. ration_glj.prototype.refreshRationNode = function(name,adjustState,rationID){
  509. let node = projectObj.project.mainTree.findNode(rationID);
  510. if (!node) return null;
  511. if(gljUtil.isDef(adjustState)){
  512. node.data.adjustState = adjustState;
  513. }
  514. if(gljUtil.isDef(name)){
  515. node.data.name = name;
  516. }
  517. return node
  518. };
  519. ration_glj.prototype.getGLJData = function (url, cb) {
  520. let property = projectObj.project.projectInfo.property;
  521. //let engineerID = property.engineering_id;
  522. CommonAjax.get(url, function (data) {
  523. //编办中有多单价设置
  524. if(data.datas.priceProperties && data.datas.priceProperties.length > 0){
  525. let tem = _.find(data.datas.priceProperties,{region:property.region,taxModel:parseInt(property.taxType)});
  526. if(tem){
  527. let dataCode = tem.price.dataCode;
  528. for(let glj of data.datas.stdGLJ){
  529. if(glj.priceProperty && gljUtil.isDef(glj.priceProperty[dataCode])) glj.basePrice = glj.priceProperty[dataCode];
  530. }
  531. }
  532. };
  533. cb(data);
  534. })
  535. };
  536. ration_glj.prototype.insertGLJAsRation = function (GLJSelection, selected,insertType, callback) {
  537. let gljList = [];
  538. let allGLJ = gljOprObj.AllRecode;
  539. let billsItemID = null, serialNo = 0,selectedSerialNo = null,nextNodeID = null, parentNodeID = null, billNode = null;
  540. let pEngineer = projectObj.project.projectInfo.property.projectEngineering;
  541. let children = [];
  542. if (selected.sourceType === project.Bills.getSourceType()) {
  543. billsItemID = selected.data.ID;
  544. parentNodeID = selected.getID();
  545. nextNodeID = selected.tree.rootID();
  546. billNode = selected;
  547. } else {
  548. billsItemID = selected.data.billsItemID;
  549. serialNo = selected.data.serialNo;
  550. selectedSerialNo = selected.data.serialNo;
  551. nextNodeID = selected.getNextSiblingID();
  552. parentNodeID = selected.getParentID();
  553. billNode = selected.parent;
  554. }
  555. children = project.Ration.getBillsSortRation(billsItemID);
  556. serialNo == 0 ? serialNo = children.length : "";
  557. for (let con_key of GLJSelection) {
  558. let glj = _.find(allGLJ, function (item) {
  559. let i_key = gljOprObj.getIndex(item, gljLibKeyArray);
  560. return i_key == con_key;
  561. });
  562. if (glj) {
  563. serialNo += 1;
  564. let new_glj = {
  565. ID: project.Ration.getNewRationID(),
  566. projectID: parseInt(project.ID()),
  567. billsItemID: billsItemID,
  568. type: rationType.gljRation,
  569. code: glj.code,
  570. name: glj.name,
  571. quantity: 0,
  572. unit: glj.unit,
  573. specs: glj.specs,
  574. subType: glj.gljType,
  575. model:glj.model,
  576. basePrice: glj.basePrice,
  577. marketPrice:glj.basePrice,
  578. original_code: glj.code,
  579. shortName: glj.shortName,
  580. serialNo: serialNo,
  581. GLJID: glj.ID,
  582. adjCoe: glj.adjCoe,
  583. materialType:glj.materialType,
  584. materialCoe:glj.materialCoe,
  585. grossWeightCoe:glj.grossWeightCoe,
  586. purchaseStorageRate:glj.purchaseStorageRate,
  587. offSiteTransportLossRate:glj.offSiteTransportLossRate,
  588. handlingLossRate:glj.handlingLossRate,
  589. repositoryId: glj.repositoryId
  590. };
  591. if(pEngineer) new_glj.programID = pEngineer;
  592. if(insertType=="insertEquipment") new_glj.programID = projectObj.project.calcProgram.compiledTemplateMaps['设备购置'];
  593. /* let belongFlag = cbTools.getBelongFlag(selected); 原来是在设备购置清单下插入设备才要取设备勾置费的,现在改成插入设备直接取
  594. if (belongFlag && belongFlag === fixedFlag.EQUIPMENT_ACQUISITION_FEE) {
  595. new_glj.programID = projectObj.project.calcProgram.compiledTemplateMaps['设备购置'];
  596. } */
  597. if (glj.hasOwnProperty("compilationId")) {
  598. new_glj.from = "cpt";
  599. if (glj.code.indexOf('-') != -1) {//这条工料机是用户通过修改名称、规格、型号等保存到补充工料机库的
  600. new_glj.original_code = glj.code.split('-')[0];//取-前的编号作为原始编号
  601. }
  602. }
  603. if(optionsOprObj.getOption(optionsOprObj.optionsTypes.GENERALOPTS, 'rationQuanACToBillsQuan')){//需要根据清单转换工程量
  604. new_glj.quantityEXP="QDL";
  605. if(billNode.data.quantity){
  606. new_glj.quantity = scMathUtil.roundForObj(billNode.data.quantity/FilterNumberFromUnit(glj.unit),getDecimal("glj.quantity"));
  607. new_glj.contain = scMathUtil.roundForObj(new_glj.quantity/billNode.data.quantity,6);
  608. }
  609. }
  610. gljList.push(new_glj);
  611. }
  612. }
  613. if (gljList.length == 0) {
  614. return;
  615. }
  616. let postData = {
  617. gljList: gljList,
  618. projectID: parseInt(project.ID()),
  619. billsItemID: billsItemID,
  620. rationCount: project.Ration.maxRationID()
  621. }
  622. selectedSerialNo == null ? "" : postData.selectedSerialNo = selectedSerialNo;
  623. CommonAjax.post("/ration/insertGLJAsRation", postData, function (data) {
  624. // 更新兄弟节点的序列号
  625. if (selectedSerialNo != null) {
  626. let selectIndex = _.findIndex(children, {"serialNo": selectedSerialNo});
  627. if (selectIndex + 1 < children.length) {
  628. for (let i = selectIndex + 1; i < children.length; i++) {
  629. children[i].serialNo += gljList.length;
  630. }
  631. }
  632. }
  633. callback(parentNodeID,nextNodeID,data);
  634. }, function () {
  635. $.bootstrapLoading.end();
  636. });
  637. };
  638. ration_glj.prototype.getGLJDataByCodes = function (codes,callback) {
  639. if(!gljUtil.isDef(codes)||codes.length ==0) {
  640. if(callback) callback([]);
  641. return
  642. }
  643. $.bootstrapLoading.start();
  644. CommonAjax.post("/rationGlj/getGLJDataByCodes", { 'engineerID':projectObj.project.projectInfo.property.engineering_id,projectID:projectObj.project.ID(),codes:codes}, function (result) {
  645. $.bootstrapLoading.end();
  646. callback(result)
  647. });
  648. };
  649. ration_glj.prototype.getAddDataByStd = function (glj,rationID,billsItemID,projectID) {//生成添加类型的定额工料机数据
  650. let ration_glj = {
  651. projectID: projectID,
  652. GLJID: glj.ID,
  653. rationID: rationID,
  654. billsItemID: billsItemID,
  655. rationItemQuantity: 0,
  656. quantity: 0,
  657. name: glj.name,
  658. code: glj.code,
  659. original_code: glj.code,
  660. unit: glj.unit,
  661. specs: glj.specs,
  662. basePrice: glj.basePrice,
  663. marketPrice:glj.basePrice,
  664. shortName: glj.shortName,
  665. type: glj.gljType,
  666. model:glj.model,
  667. adjCoe: glj.adjCoe,
  668. createType: 'add',
  669. materialType:glj.materialType,
  670. materialCoe:glj.materialCoe,
  671. grossWeightCoe:glj.grossWeightCoe,
  672. purchaseStorageRate:glj.purchaseStorageRate,
  673. offSiteTransportLossRate:glj.offSiteTransportLossRate,
  674. handlingLossRate:glj.handlingLossRate,
  675. repositoryId: glj.repositoryId
  676. };
  677. if (glj.hasOwnProperty("compilationId")) {
  678. ration_glj.from = "cpt";
  679. if (glj.code.indexOf('-') != -1) {//这条工料机是用户通过修改名称、规格、型号等保存到补充工料机库的
  680. ration_glj.original_code = glj.code.split('-')[0];//取-前的编号作为原始编号
  681. }
  682. }
  683. return ration_glj;
  684. };
  685. ration_glj.prototype.addGLJByLib = function (GLJSelection, ration, callback) {
  686. let me=this,gljList = [];
  687. let allGLJ = gljOprObj.AllRecode;
  688. GLJSelection.sort();
  689. _.forEach(GLJSelection, function (g) {
  690. let glj = _.find(allGLJ, function (item) {
  691. let i_key = gljOprObj.getIndex(item, gljLibKeyArray);
  692. return i_key == g;
  693. });
  694. let ration_glj = me.getAddDataByStd(glj,ration.ID,ration.billsItemID,ration.projectID);
  695. if (glj.userId) {
  696. ration_glj.fromUser = glj.userId;
  697. }
  698. gljList.push(ration_glj);
  699. });
  700. $.bootstrapLoading.start();
  701. CommonAjax.post("/rationGlj/addGLJ", gljList, callback, function () {
  702. $.bootstrapLoading.end();
  703. });
  704. };
  705. ration_glj.prototype.updateRationGLJByChangeCode = function (recode, updateField, newval) {
  706. let me = this;
  707. let priceMap = projectObj.project.projectGLJ.datas.unitPriceMap;
  708. let priceObj = priceMap[newval];
  709. if(priceObj){
  710. if (recode.createType===undefined || recode.createType == 'normal') {// createTypel 默认是normal 只有是定额下带的工料机才需把类型改成替换,其它的保持不变
  711. recode.rcode = recode.code;
  712. recode.createType = 'replace';
  713. }
  714. recode.code = priceObj.code;
  715. recode.name = priceObj.name;
  716. recode.type = priceObj.type;
  717. recode.unit = priceObj.unit;
  718. recode.shortName = priceObj.short_name;
  719. recode.specs = priceObj.specs;
  720. recode.GLJID=priceObj.glj_id;
  721. recode.original_code = priceObj.original_code;
  722. recode.basePrice = priceObj.base_price;
  723. recode.marketPrice = priceObj.market_price;
  724. }
  725. $.bootstrapLoading.start();
  726. CommonAjax.post("/rationGlj/replaceGLJ", recode, function (result) {
  727. if (result) {
  728. me.setDatasAfterReplace(result);
  729. let data = result.data;
  730. let rationNode = projectObj.project.mainTree.findNode(data.rationID);
  731. let nodes = [rationNode];
  732. gljOprObj.refreshView();
  733. if (project.ration_glj.needShowToTree(data)) {//当替换的是主材或设备时,刷新对应的树节点
  734. let node = project.ration_glj.findGLJNodeByID(data.ID);
  735. if (node) {
  736. project.ration_glj.transferToNodeData(data);
  737. node.source = data;
  738. node.data = data;
  739. }
  740. node ? nodes.push(node) : "";
  741. }
  742. rationNode.data.adjustState = result.adjustState;
  743. rationNode.data.name = result.name;
  744. projectObj.mainController.refreshTreeNode(nodes);
  745. project.calcProgram.calcAndSave(rationNode);
  746. $.bootstrapLoading.end();
  747. }
  748. }, function () {
  749. $.bootstrapLoading.end();
  750. });
  751. };
  752. ration_glj.prototype.setDatasAfterReplace = function(result){
  753. let me = this;
  754. me.addAndDeleteDatas(result.newRecodes,result.deleteList);
  755. let list_index = _.findIndex(me.datas, {'ID': result.data.ID});
  756. if(result.data) me.datas[list_index] = result.data;
  757. me.refreshQuantityAfterCalResult(result.glj_result);
  758. if(result.projectGLJ) project.projectGLJ.loadNewProjectGLJToCaches([result.projectGLJ],true);
  759. };
  760. ration_glj.prototype.addAndDeleteDatas = function (newRecodes,deleteList) {
  761. let oldData = [];
  762. if(newRecodes.length > 0 ) this.datas = this.datas.concat(newRecodes);
  763. if(deleteList.length > 0) {
  764. oldData = _.remove(this.datas,function (item) {
  765. return deleteList.indexOf(item.ID)!=-1;
  766. });
  767. }
  768. return oldData;
  769. };
  770. ration_glj.prototype.getReplaceDataByStd = function (oldData,glj) {
  771. if (oldData.createType===undefined || oldData.createType == 'normal') {// createTypel 默认是normal 只有是定额下带的工料机才需把类型改成替换,其它的保持不变
  772. oldData.rcode = oldData.code;
  773. oldData.createType = 'replace';
  774. oldData.mIndexObj ={code:oldData.code,name:oldData.name,type:oldData.type,unit:oldData.unit,specs:oldData.specs};
  775. }else if(oldData.createType == 'replace' && oldData.rcode == glj.code){//如果原数据已经是替换过的,这次替换又恢复成原数据,则把类型改回来
  776. oldData.createType = 'normal';
  777. oldData.mIndexObj = null;
  778. }
  779. oldData.GLJID = glj.ID;
  780. oldData.name = glj.name;
  781. oldData.type = glj.gljType;
  782. oldData.code = glj.code;
  783. oldData.original_code = glj.code;
  784. oldData.unit = glj.unit;
  785. oldData.specs = glj.specs;
  786. oldData.model = glj.model;
  787. oldData.basePrice = glj.basePrice;
  788. oldData.shortName=glj.shortName;
  789. oldData.marketPrice = glj.basePrice;
  790. oldData.repositoryId = glj.repositoryId;
  791. oldData.materialType = glj.materialType;
  792. oldData.materialCoe = glj.materialCoe;
  793. oldData.grossWeightCoe= glj.grossWeightCoe;
  794. oldData.purchaseStorageRate = glj.purchaseStorageRate;
  795. oldData.offSiteTransportLossRate = glj.offSiteTransportLossRate;
  796. oldData.handlingLossRate = glj.handlingLossRate;
  797. if (glj.hasOwnProperty("compilationId")) {
  798. oldData.from = "cpt";
  799. if (glj.userId) {
  800. oldData.fromUser = glj.userId;
  801. }
  802. if (glj.code.indexOf('-') != -1) {//这条工料机是用户通过修改包称、规格、型号等保存到补充工料机库的
  803. oldData.original_code = glj.code.split('-')[0];//取-前的编号作为原始编号
  804. }
  805. } else {
  806. oldData.from = "std";
  807. }
  808. return oldData;
  809. };
  810. ration_glj.prototype.replaceGLJ = function (selectCode, oldData, callback) {
  811. let allGLJ = gljOprObj.AllRecode;
  812. let glj = _.find(allGLJ, function (item) {
  813. let i_key = gljOprObj.getIndex(item, gljLibKeyArray);
  814. return i_key == selectCode;
  815. });
  816. if (selectCode == gljOprObj.getIndex(oldData, gljKeyArray)) {
  817. return callback(null);
  818. }
  819. //如果是从混凝土改成商品混凝土,并且混凝土的定额消耗量不为空,则原混凝土的自定义消耗改成0,插入一条新的商品混凝土自定义消耗量为原定额计算后的消耗量
  820. if(gljUtil.isAddCommercialForReplace(oldData.type,glj.gljType,oldData.rationItemQuantity)){
  821. let originalID = oldData.ID;
  822. let customQuantity = gljUtil.isDef(oldData.quantity)? oldData.quantity:0;
  823. oldData = this.getAddDataByStd(glj,oldData.rationID,oldData.billsItemID,oldData.projectID);
  824. oldData.toCommercial=true;
  825. oldData.originalID = originalID;
  826. oldData.customQuantity = customQuantity;
  827. }else {
  828. oldData = this.getReplaceDataByStd(oldData,glj);
  829. }
  830. $.bootstrapLoading.start();
  831. CommonAjax.post("/rationGlj/replaceGLJ", oldData, callback, function () {
  832. $.bootstrapLoading.end();
  833. });
  834. };
  835. ration_glj.prototype.mReplaceGLJ = function (selectCode, oldData, callback) {
  836. let allGLJ = gljOprObj.AllRecode,tasks = [],updateMap={},doc = null;
  837. let oldIndex = gljOprObj.getIndex(oldData, gljKeyArray);
  838. let glj = _.find(allGLJ, function (item) {
  839. let i_key = gljOprObj.getIndex(item, gljLibKeyArray);
  840. return i_key == selectCode;
  841. });
  842. if (selectCode == oldIndex) {
  843. return callback(null);
  844. }
  845. let query = {
  846. projectID: oldData.projectID,
  847. code: oldData.code,
  848. name: oldData.name,
  849. unit: oldData.unit,
  850. type: oldData.type
  851. };
  852. if (oldData.specs && oldData.specs != '') {
  853. query.specs = oldData.specs;
  854. }
  855. for(let d of this.datas){//查询出所有需替换的工料机
  856. if(!gljOprObj.scopeSelectedIDMap[d.billsItemID]) continue; //如果不在选中范围的,跳过
  857. let tem_index = gljOprObj.getIndex(d, gljKeyArray);
  858. if(tem_index == oldIndex){
  859. let tem_doc = {};
  860. //是否从混凝土改成商品混凝土,并且混凝土的定额消耗量不为空
  861. if(gljUtil.isAddCommercialForReplace(d.type,glj.gljType,d.rationItemQuantity)){
  862. tem_doc = {'customQuantity':'0'};
  863. //插入一条新的定额,这里的更新自定义消耗量操作由task完成了,不用像单条替换那样做标记,修改等
  864. let newDoc = this.getAddDataByStd(glj,d.rationID,d.billsItemID,d.projectID);
  865. let customQuantity = gljUtil.isDef(d.quantity)? d.quantity:0;
  866. newDoc.customQuantity = customQuantity;
  867. let tTask = {insertOne:{document: newDoc}};
  868. tasks.push(tTask);
  869. doc=newDoc//后台操作: 要根据nweDoc,插入项目工料机,修改insertOne里项目工料机ID,生成新的自身ID
  870. }else {
  871. tem_doc = this.getReplaceDataByStd(d,glj);
  872. if(gljUtil.isConcreteType(d.type)||gljUtil.isCommercialConcreteType(d.type)) tem_doc.isConcrete = true;//这里是在批量替换中有可能同时存在定额下的替换和添加的替换,对于添加的替换,要走替换混凝土的逻辑,定额下的替换又走另外的逻辑
  873. doc = tem_doc;
  874. }
  875. let task = {
  876. updateOne:{
  877. filter : {ID:d.ID,rationID:d.rationID},
  878. update : tem_doc
  879. }
  880. };
  881. tasks.push(task);
  882. updateMap[d.ID] = tem_doc;
  883. }
  884. }
  885. $.bootstrapLoading.start();
  886. CommonAjax.post("/rationGlj/mReplaceGLJ", {query: query, doc: doc,tasks:tasks}, function (result) {
  887. callback(result,updateMap);
  888. }, function () {
  889. $.bootstrapLoading.end();
  890. });
  891. };
  892. ration_glj.prototype.getMainAndEquGLJ = function (rationID) {
  893. let gljList = _.filter(this.datas, function (n) {
  894. return n.rationID == rationID && (n.type == gljType.MAIN_MATERIAL || n.type == gljType.EQUIPMENT)
  895. });
  896. gljList = gljUtil.sortRationGLJ(gljList);
  897. return gljOprObj.combineWithProjectGlj(gljList);
  898. };
  899. ration_glj.prototype.transferToNodeData = function (data) {
  900. data.contain=scMathUtil.roundForObj(data.quantity,getDecimal('glj.quantity'));
  901. data.subType = data.type;
  902. };
  903. ration_glj.prototype.combineRationAndGLJ = function (ration) {
  904. if (ration) {
  905. let projectGLJData = projectObj.project.projectGLJ.datas;
  906. let projectGljs = projectGLJData.gljList;
  907. let mixRatioMap = projectGLJData.mixRatioMap;
  908. let glj = _.find(projectGljs, {'id': ration.projectGLJID});
  909. if (glj) {
  910. if(projectObj.project.projectGLJ.isEstimateType(glj.type)){
  911. ration.isEstimate = glj.is_evaluate;
  912. }
  913. ration = gljOprObj.setGLJPrice(ration,glj);
  914. ration.isAdd = glj.unit_price.is_add;
  915. let connect_index = gljOprObj.getIndex(glj, gljKeyArray);
  916. if (mixRatioMap.hasOwnProperty(connect_index)) {
  917. let mixRatios = gljOprObj.getMixRationShowDatas(mixRatioMap[connect_index], projectGljs);
  918. ration.subList = mixRatios;
  919. }
  920. }
  921. }
  922. return ration;
  923. };
  924. ration_glj.prototype.updateFromMainSpread = function (value, node, fieldName) {
  925. if (node.data[fieldName] !== value) {
  926. if (fieldName == "marketUnitFee") {
  927. let decimal = getDecimal("glj.unitPrice");
  928. let newval = number_util.checkNumberValue(value, decimal);
  929. if (newval) {
  930. fieldName = "marketPrice";
  931. projectObj.project.projectGLJ.updatePriceFromRG(node.data, fieldName, newval);
  932. return;
  933. }
  934. } else {
  935. if(fieldName == "contain"){
  936. if(value==null){
  937. value="";
  938. }else {
  939. let decimal = getDecimal("glj.quantity");
  940. value = number_util.checkNumberValue(value, decimal);
  941. fieldName="customQuantity";//填入自定义消耗
  942. }
  943. }
  944. if (value !== undefined && value !== null) {
  945. if (fieldName == "subType") {
  946. node.data.subType = value;
  947. fieldName = "type";//转换成更新工料机类型
  948. }
  949. this.updateRationGLJByEdit(node.data, fieldName, value, node);
  950. return;
  951. }
  952. }
  953. }
  954. // node.data.subType = value;
  955. projectObj.mainController.refreshTreeNode([node]);
  956. };
  957. ration_glj.prototype.refreshTreeNodeIfNeeded = function (data) {
  958. if (this.needShowToTree(data)) {
  959. this.transferToNodeData(data);
  960. gljOprObj.refreshTreeNode({"type": ModuleNames.ration_glj, "ID": data.ID});
  961. }
  962. };
  963. ration_glj.prototype.needShowToTree = function (data) {
  964. if ((data.type == gljType.MAIN_MATERIAL || data.type == gljType.EQUIPMENT) && projectObj.project.projectInfo.property.displaySetting.disPlayMainMaterial == true) {
  965. return true
  966. }
  967. return false
  968. };
  969. ration_glj.prototype.findGLJNodeByID = function (ID) {
  970. return projectObj.project.mainTree.findNode(ID);
  971. };
  972. ration_glj.prototype.findRationNodeByID = function (ID) {
  973. return projectObj.project.mainTree.findNode(ID);
  974. };
  975. ration_glj.prototype.reCalcWhenGLJChange = function (ration_glj) {//当改变定额工料机时,重新计算定额以及其父节点
  976. let node = this.findRationNodeByID(ration_glj.rationID);
  977. if (node) {
  978. node.changed = true;
  979. project.calcProgram.calcAndSave(node);
  980. }
  981. };
  982. ration_glj.prototype.reCalcWhenVvTaxChange = function () {
  983. let rationIDs = [];
  984. for(let g of this.datas){
  985. if(g.type == gljType.GENERAL_MACHINE) rationIDs.push(g.rationID);
  986. }
  987. this.calcRationsByIDs(_.uniq(rationIDs))
  988. };
  989. ration_glj.prototype.calcRationsByIDs = function (rationIDs) {
  990. let nodes = [];
  991. for(let ID of rationIDs){
  992. let node = projectObj.project.mainTree.findNode(ID);
  993. if(node) nodes.push(node)
  994. }
  995. project.calcProgram.calcNodesAndSave(nodes);
  996. };
  997. ration_glj.prototype.updateProportion = function (proportionList, projectID, rationID) {
  998. const postData = {
  999. proportionList,
  1000. projectID,
  1001. rationID
  1002. };
  1003. $.bootstrapLoading.start();
  1004. CommonAjax.post('/rationGLJ/updateProportion', postData, function (rst) {
  1005. proportionList.forEach(item => {
  1006. const glj = zmhs_obj.stableSheetData.find(glj => glj.ID === item.ID);
  1007. if (glj) {
  1008. glj.adjustProportion = item.adjustProportion;
  1009. }
  1010. });
  1011. zmhs_obj.refreshStableDataIfNeeded();
  1012. zmhs_obj.refreshAfterUpdate(rst);
  1013. $.bootstrapLoading.end();
  1014. }, function () {
  1015. zmhs_obj.refreshStableDataIfNeeded();
  1016. $.bootstrapLoading.end();
  1017. });
  1018. };
  1019. return new ration_glj(project);
  1020. }
  1021. };