guangxi_common.js 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833
  1. // INTERFACE_EXPORT =,必须这么写,这样才能在导出时动态加载脚本后,覆盖前端代码
  2. INTERFACE_EXPORT = (() => {
  3. "use strict";
  4. const feeRateMap = {
  5. 冬季施工增加费: "DJSGZJFFL",
  6. 冬季施工: "DJSGZJFFL",
  7. 雨季施工增加费: "YUJSGZJFFL",
  8. 雨季施工: "YUJSGZJFFL",
  9. 夜间施工增加费: "YEJSGZJFFL",
  10. 夜间施工: "YEJSGZJFFL",
  11. 高原地区施工增加费: "GYDQSGZJFFL",
  12. 高原施工: "GYDQSGZJFFL",
  13. 风沙地区施工增加费: "FSDQSGZJFFL",
  14. 风沙施工: "FSDQSGZJFFL",
  15. 沿海地区施工增加费: "YHDQSGZJFFL",
  16. 沿海施工: "YHDQSGZJFFL",
  17. 行车干扰施工增加费: "XCGRGCSGZJFFL",
  18. 行车干扰: "XCGRGCSGZJFFL",
  19. 工地转移费: "GDZYFFL",
  20. '工地转移(km)': "GDZYFFL",
  21. 施工辅助费: "SGFZFFL",
  22. 施工辅助: "SGFZFFL",
  23. 基本费用: "JBFYFL",
  24. 主副食运费补贴: "ZFSYFBTFL",
  25. '综合里程(km)': "ZFSYFBTFL",
  26. 职工探亲路费: "ZGTQLFFL",
  27. 职工探亲: "ZGTQLFFL",
  28. 职工取暖补贴: "ZGQNBTFL",
  29. 职工取暖: "ZGQNBTFL",
  30. 财务费用: "CWFYFL",
  31. 养老保险费: "YANGLBXFFL",
  32. 失业保险费: "SYBXFFL",
  33. 医疗保险费: "YILBXFFL",
  34. 工伤保险费: "GSBXFL",
  35. 养老保险: "YANGLBXFFL",
  36. 失业保险: "SYBXFFL",
  37. 医疗保险: "YILBXFFL",
  38. 工伤保险: "GSBXFL",
  39. 住房公积金: "ZFGJJFL",
  40. 规费: "GFZHFL",
  41. 利润: "LRL",
  42. 税金: "SL",
  43. 土方: "TF",
  44. 石方: "SF",
  45. 运输: "YS",
  46. 路面: "LM",
  47. "路面(不计雨)": "LM",
  48. 隧道: "SD",
  49. 构造物I: "GZW1",
  50. "构造物I(不计冬)": "GZW1",
  51. "构造物I(不计雨)": "GZW1",
  52. 构造物II: "GZW2",
  53. "构造物III(桥梁)": "GZW3",
  54. "构造物III(除桥以外)": "GZW3",
  55. "构造物III(除桥以外不计雨夜)": "GZW3",
  56. 技术复杂大桥: "JSFZDQ",
  57. "钢材及钢结构(桥梁)": "GJG",
  58. "钢材及钢结构(除桥以外)": "GJG",
  59. "钢材及钢结构(除桥以外不计夜)": "GJG",
  60. };
  61. //计算程序有,这里没有:施工机械使用费\施工机械人工费\定额人工费\定额材料费\定额施工机械使用费
  62. const itemFeeMap = {
  63. 'marketLabour': 'RGF',
  64. 'marketMaterial': 'CLF',
  65. 'marketMachine':'JXSYF',
  66. 'marketEquipment': 'SBGZF',
  67. 'direct': 'DEZJF',
  68. 'equipment': 'DESBF',
  69. 'marketDirect': 'ZJF',
  70. 'measure': 'CSF',
  71. 'measure1': 'CSF1',
  72. 'measure2': 'CSF2',
  73. 'manage': 'QYGLF',
  74. 'force': 'GF',
  75. 'profit': 'LR',
  76. 'tax': 'SJ',
  77. 'common': 'JAF',
  78. 'rationCommon': 'DEJAF'
  79. };
  80. const feeLibNoMap = {
  81. 'eba0e7c0-cfe6-11ea-ba15-739be477d1fe': 'GYSFL-000000-2018-86',
  82. '451d3180-e02e-11ea-8056-1514dfc2f39e': 'GYSFL-340000-2019-210',
  83. '32923ff0-e912-11ea-8b20-d93bc370e960': 'GYSFL-440000-2019-544'
  84. };
  85. const FixedCostMap = {
  86. //折旧费、检修费、维护费、安拆辅助费
  87. '折旧费': 1,
  88. '检修费': 1,
  89. '维护费': 1,
  90. '安拆辅助费':1
  91. }
  92. const RoadGradeMap = {
  93. "高速公路": "0",
  94. "一级公路": "1",
  95. "二级公路": "2",
  96. "三级公路": "3",
  97. "四级公路": "4",
  98. "等外公路": "5",
  99. "独立桥梁": "6",
  100. "独立隧道": "7"
  101. }
  102. const sectionNameMap = {
  103. "清单 第100章 总则": true,
  104. "清单 第200章 路基": true,
  105. "清单 第300章 路面": true,
  106. "清单 第400章 桥梁、涵洞": true,
  107. "清单 第500章 隧道": true,
  108. "清单 第600章 安全设施及预埋管线": true,
  109. "清单 第700章 绿化及环境保护设施": true,
  110. // "清单 第800章 机电工程": true,
  111. // "清单 第900章 附属区房建工程":true
  112. }
  113. const ListCodeMap = {
  114. "第100章至700章清单合计":["1", "A"],
  115. "清单 第100章 总则": ["一", "A1"],
  116. "清单 第200章 路基": ["二", "A2"],
  117. "清单 第300章 路面": ["三", "A3"],
  118. "清单 第400章 桥梁、涵洞": ["四", "A4"],
  119. "清单 第500章 隧道": ["五", "A5"],
  120. "清单 第600章 安全设施及预埋管线": ["六", "A6"],
  121. "清单 第700章 绿化及环境保护设施": ["七", "A7"],
  122. // "清单 第800章 机电工程": "八",
  123. // "清单 第900章 附属区房建工程": "九",
  124. "已包含在清单合计中的材料、工程设备、专业工程暂估价合计": ["8", "B"],
  125. "清单合计减去材料、工程设备、专业工程暂估价合计": ["9", "C"],
  126. "计日工合计": ["10", "D"],
  127. "劳务": ["10.1", "D1"],
  128. "材料": ["10.2", "D2"],
  129. "机械": ["10.3", "D3"],
  130. "暂列金额(不含计日工总额)": ["11", "E"],
  131. "投标报价": ["12", "Total"]
  132. }
  133. const ratioCodeMap = {
  134. "01ZJF":"0",
  135. "02JXF":"1",
  136. "03WHF":"2",
  137. "04ACFZF":"3"
  138. }
  139. function getBasePrice(projectGLJID, tenderProject) {
  140. let glj = _.find(tenderProject.projectGLJ.datas.gljList, {
  141. id: projectGLJID
  142. })
  143. return glj ? gljUtil.getBasePrice(glj, null, null, null, decimalObj, false, _, scMathUtil) : 0;
  144. }
  145. function getFeeRate(programID, fieldName, tenderProject) {
  146. let rate = 0;
  147. let template = tenderProject.calcProgram.compiledTemplates;
  148. if (template[programID]) {
  149. let item = _.find(template[programID].calcItems, {
  150. fieldName: fieldName
  151. })
  152. if (item) rate = item.feeRate;
  153. }
  154. return rate
  155. }
  156. function billNameChecking(bNode,projectName,fixedFlag) {
  157. let data = bNode.data;
  158. let fail = null;
  159. let pass = true;
  160. if (data.flagsIndex && data.flagsIndex.fixed) {
  161. let flag = data.flagsIndex.fixed.flag;
  162. switch (flag) {
  163. case fixedFlag.ONE_SEVEN_BILLS:
  164. pass = data.name == "第100章至700章清单" || data.name == "第100章至700章清单合计";
  165. break;
  166. case fixedFlag.PROVISIONAL_TOTAL:
  167. pass = data.name == "已包含在清单合计中的材料、工程设备、专业工程暂估价合计";
  168. break;
  169. case fixedFlag.BILLS_TOTAL_WT_PROV:
  170. pass = data.name == "清单合计减去材料、工程设备、专业工程暂估价合计";
  171. break;
  172. case fixedFlag.DAYWORK_LABOR:
  173. pass = data.name == "计日工合计";
  174. break;
  175. /*
  176. case fixedFlag.LABOUR_SERVICE:
  177. pass = data.name == "劳务";
  178. break;
  179. case fixedFlag.MATERIAL:
  180. pass = data.name == "材料";
  181. break;
  182. case fixedFlag.CONSTRUCTION_MACHINE:
  183. pass = data.name == "机械";
  184. break;
  185. //*/
  186. case fixedFlag.PROVISIONAL:
  187. pass = data.name == "暂列金额(不含计日工总额)";
  188. break;
  189. case fixedFlag.TOTAL_COST:
  190. pass = data.name == "投标报价";
  191. break;
  192. case fixedFlag.ONE_HUNDRED_BILLS:
  193. pass = data.name == "清单 第100章 总则";
  194. break;
  195. }
  196. } else {
  197. if (bNode.parent) {
  198. const pdata = bNode.parent.data;
  199. if (pdata.flagsIndex && pdata.flagsIndex.fixed && pdata.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) {
  200. if (!sectionNameMap[data.name]) pass = false
  201. }
  202. }
  203. }
  204. if(pass == false)fail = { hint: `清单:"${data.name?data.name:""}",名字不符合规范!`, type: projectName }
  205. return fail;
  206. }
  207. /**
  208. *
  209. * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
  210. * @param {Number} exportKind - 导出类型,招标、投标、控制价
  211. * @param {Object} projectData - 项目表数据:{ 建设项目Data, children: [单位工程...] }
  212. * @param {Object} tenderDetailMap - 单位工程ID与getData接口数据(projectObj.project的结构)的映射。
  213. * @return {Promise<Array>} - 返回的数据结构必须按照规定:[{ data, exportKind, fileName }],参考web\building_saas\standard_interface\index.js中的注释说明
  214. */
  215. async function entry(areaKey, exportKind, projectData, tenderDetailMap) {
  216. const {
  217. CONFIG: {
  218. TYPE
  219. },
  220. UTIL,
  221. Element
  222. } = INTERFACE_EXPORT_BASE;
  223. const {
  224. EXPORT_KIND: {
  225. BID_INVITATION,
  226. BID_SUBMISSION,
  227. CONTROL
  228. },
  229. fixedFlag,
  230. } = window.commonConstants;
  231. let cprjType = {
  232. 1: "QDYS", // 招标
  233. 2: "QDYS", // 投标
  234. 3: "QDYS", // 控制价
  235. };
  236. const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  237. const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  238. const isControl = exportKind === CONTROL; // 是否是控制价
  239. function emptyElement(name) {
  240. this.name = name;
  241. this.attrs = [];
  242. this.children = [];
  243. }
  244. // 建设项目根节点信息
  245. function CprjInfo(projectName) {
  246. let baseInfo = _.find(projectData.property.basicInformation, {
  247. dispName: "基本信息",
  248. });
  249. let zbr = _.find(baseInfo.items, { "key": "tendereeName" });
  250. let Zbdljg = _.find(baseInfo.items, { "key": "proxy" });
  251. let Shijian = _.find(baseInfo.items, { "key": "compileDate" });
  252. let Zbbh = _.find(baseInfo.items, { "key": "projNum" });
  253. const attrs = [{
  254. name: "CprjName",
  255. value: projectName,
  256. },
  257. {
  258. name: "CprjType",
  259. value: cprjType[exportKind],
  260. },
  261. {
  262. name: "Zbbh",
  263. value: Zbbh?Zbbh.value:""
  264. },
  265. {
  266. name: "Zbr",
  267. value: zbr?zbr.value:""
  268. },
  269. {
  270. name: "Zbdljg",
  271. value: Zbdljg?Zbdljg.value:""
  272. },
  273. {
  274. name: "Shijian",
  275. value: Shijian?Shijian.value:""
  276. },
  277. {
  278. name: "KeyId",
  279. value: uuid.v1()
  280. }
  281. ];
  282. Element.call(this, "CprjInfo", attrs);
  283. }
  284. // 项目基本信息
  285. function SystemInfo(projectData) {
  286. let baseInfo = _.find(projectData.property.basicInformation, {
  287. dispName: "基本信息",
  288. });
  289. //“招标工程量清单”、“招标控制价”时,输出该字段,为导出该文件的当前时间
  290. let makeData = {
  291. value : UTIL.getNowFormatTime(true)
  292. }
  293. //投标的时候取基本信息的makeData字段
  294. if(isBidSubmission) makeData = _.find(baseInfo.items, { "key": "makeDate" });
  295. let hardID = UTIL.generateHardwareId();
  296. let [cpuId, diskId, macId] = hardID.split(";");
  297. const attrs = [{
  298. name: "Name",
  299. value: "广西公路工程造价文件数据交换标准化规定",
  300. },
  301. {
  302. name: "Version",
  303. value: "1.0",
  304. },
  305. {
  306. name: "SoftwareName",
  307. value: "纵横公路云造价",
  308. },
  309. {
  310. name: "SoftwareVer",
  311. value: "V" + VERSION,
  312. },
  313. {
  314. name: "SoftwareCompany",
  315. value: "珠海纵横创新软件有限公司",
  316. },
  317. {
  318. name: "MakeDate",
  319. value: makeData?makeData.value:"",
  320. },
  321. {
  322. name: "SoftwareNumber",
  323. value: window.btoa(userID),
  324. },
  325. {
  326. name: "HardNumber",
  327. value: window.btoa(diskId),
  328. },
  329. {
  330. name: "MacAddress",
  331. value: window.btoa(macId),
  332. },
  333. {
  334. name: "KeyId",
  335. value: uuid.v1()
  336. }
  337. ];
  338. if (isBidSubmission)
  339. attrs.splice(6, 0, {
  340. name: "BidderVer",
  341. value: UTIL.getNowFormatTime(true),
  342. });
  343. Element.call(this, "SystemInfo", attrs);
  344. }
  345. //造价依据
  346. function CostBasis() {
  347. // ItemStandardNo="GYSFX-000000-2018-86"
  348. const attrs = [{
  349. name: "MakeRuleNo",
  350. value: "GYSBB-000000-2018-86",
  351. },
  352. {
  353. name: "MakeRuleName",
  354. value: "公路工程建设项目概算预算编制办法",
  355. },
  356. {
  357. name: "ItemStandardNo",
  358. value: "GYSFX-000000-2018-86",
  359. },
  360. {
  361. name: "KeyId",
  362. value: uuid.v1()
  363. }
  364. ];
  365. Element.call(this, "CostBasis", attrs);
  366. //定额库信息
  367. //to do 改成实际的值
  368. function NormLib() {
  369. const attrs = [{
  370. name: "NormLibNo",
  371. value: "YSDE-000000-2018-86",
  372. },
  373. {
  374. name: "NormLibName",
  375. value: "部颁公路工程预算定额(2018)",
  376. },
  377. {
  378. name: "Type",
  379. value: "ZDEK",
  380. },
  381. {
  382. name: "KeyId",
  383. value: uuid.v1()
  384. },
  385. ];
  386. Element.call(this, "NormLib", attrs);
  387. }
  388. this.children.push(new NormLib());
  389. }
  390. function Rate(tenderProject, feeRateInfo, seirNo) {
  391. //RateNo="1" Name="纵横软件测试版本" RateLibNo="GYSFL-000000-2018-86"
  392. const attrs = [{
  393. name: "RateNo",
  394. value: seirNo,
  395. },
  396. {
  397. name: "Name",
  398. value: feeRateInfo.name,
  399. },
  400. {
  401. name: "RateLibNo",
  402. value: feeLibNoMap[feeRateInfo.libID],
  403. },
  404. {
  405. name: "KeyId",
  406. value: uuid.v1()
  407. }
  408. ];
  409. Element.call(this, "Rate", attrs);
  410. let RateParams = new emptyElement("RateParams");
  411. RateParams.attrs = [{
  412. name: "KeyId",
  413. value: uuid.v1()
  414. }];
  415. let subRates = projectObj.project.FeeRate.getAllSubRates(feeRateInfo.rates);
  416. for (let s of subRates) {
  417. let sname = s.name.replace("(%)", "");
  418. sname = sname.replace("(%)", "");
  419. if (feeRateMap[sname]) {
  420. let value = "";
  421. if (s.editable) {
  422. let sel = _.find(s.optionList, {
  423. selected: true,
  424. });
  425. if (sel) {
  426. value = sel.name;
  427. } else if (gljUtil.isDef(s.value)) {
  428. value = s.value;
  429. }
  430. } else {
  431. value = _.findIndex(s.optionList, {
  432. selected: true,
  433. });
  434. if (value == -1) value = 0;
  435. }
  436. /* if (sname == '利润') tenderProject.ProfitRate = value;
  437. if (sname == '税金') tenderProject.TaxRate = value; */
  438. RateParams.children.push(new RateParam(feeRateMap[sname], value));
  439. }
  440. }
  441. this.children.push(RateParams);
  442. function RateParam(RateTypeNo, RateParamNo) {
  443. //<RateParam RateTypeNo="DJSGZJFFL" RateParamNo="0" Ratio="100"/>
  444. const attrs = [{
  445. name: "RateTypeNo",
  446. value: RateTypeNo,
  447. },
  448. {
  449. name: "RateParamNo",
  450. value: RateParamNo,
  451. },
  452. {
  453. name: "Ratio",
  454. value: "100",
  455. },
  456. {
  457. name: "KeyId",
  458. value: uuid.v1()
  459. }
  460. ];
  461. Element.call(this, "RateParam", attrs);
  462. }
  463. let RateValues = new emptyElement("RateValues");
  464. RateValues.attrs = [{
  465. name: "KeyId",
  466. value: uuid.v1()
  467. }];
  468. function RateValue(CostTypeNo, RateTypeNo, value) {
  469. const attrs = [{
  470. name: "CostTypeNo",
  471. value: CostTypeNo,
  472. },
  473. {
  474. name: "RateTypeNo",
  475. value: RateTypeNo,
  476. },
  477. {
  478. name: "RateValue",
  479. value: value,
  480. },
  481. {
  482. name: "KeyId",
  483. value: uuid.v1()
  484. }
  485. ];
  486. Element.call(this, "RateValue", attrs);
  487. }
  488. let prefix = "";
  489. for (let r of feeRateInfo.rates) {
  490. if (!r.ParentID && feeRateMap[r.name]) prefix = feeRateMap[r.name];
  491. if (feeRateMap[r.name] && r.ParentID) {
  492. RateValues.children.push(new RateValue(prefix, feeRateMap[r.name], r.rate));
  493. }
  494. }
  495. this.children.push(RateValues);
  496. }
  497. function Pract(tpdata, seriNo) {
  498. let pgljData = tpdata.projectGLJ.datas;
  499. let decimalObj = tpdata.property.decimal;
  500. let ccsObj = $("#vvTax")[0];
  501. const attrs = [{
  502. name: "PractNo",
  503. value: seriNo,
  504. },
  505. {
  506. name: "Name",
  507. value: pgljData.constData.usedUnitPriceInfo.name,
  508. },
  509. {
  510. name: "TaxLibNo",
  511. value: ccsObj.options[ccsObj.selectedIndex].text //读取车船税标准名称
  512. },
  513. {
  514. name: "PriceFileNo",
  515. value: "JGXX"
  516. },
  517. {
  518. name: "KeyId",
  519. value: uuid.v1()
  520. }
  521. ];
  522. Element.call(this, "Pract", attrs);
  523. let Param = {
  524. name: "Param",
  525. attrs: [{
  526. name: "TaxLibNo",
  527. value: "CCSBZ-440000-2019-544",
  528. },
  529. {
  530. name: "AuxRate",
  531. value: pgljData.constData.assistProductionFeeRate,
  532. },
  533. ],
  534. children: [],
  535. };
  536. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  537. let elecDatas = electrovalenceObj.getElectrovalenceDatas(null, pgljData.com_electrovalence, pgljData.gljList);
  538. electrovalenceObj.calcPertElectrovalenceMarketPrice(elecDatas);
  539. for (let e of elecDatas) {
  540. let Electro = {
  541. name: "Electro",
  542. attrs: [{
  543. name: "Code",
  544. value: e.code,
  545. },
  546. {
  547. name: "Price",
  548. value: e.electPrice,
  549. },
  550. {
  551. name: "Ratio",
  552. value: e.coe,
  553. },
  554. ],
  555. children: [],
  556. };
  557. Param.children.push(Electro);
  558. }
  559. }
  560. // this.children.push(Param);
  561. function Mp(g) {
  562. const attrs = [{
  563. name: "Code",
  564. value: g.code,
  565. },
  566. {
  567. name: "PractName",
  568. value: g.name,
  569. },
  570. {
  571. name: "Spec",
  572. value: g.specs,
  573. },
  574. {
  575. name: "Unit",
  576. value: g.unit,
  577. },
  578. {
  579. name: "BudgetPrice",
  580. value: g.priceInfo.tenderPrice,
  581. },
  582. {
  583. name: "NormPrice",
  584. value: g.priceInfo.basePrice,
  585. },
  586. {
  587. name: "IsAdd",
  588. value: g.unit_price.is_add,
  589. },
  590. ];
  591. Element.call(this, "Mp", attrs);
  592. }
  593. function Material(g) {
  594. const attrs = [{
  595. name: "Code",
  596. value: g.code,
  597. },
  598. {
  599. name: "PractName",
  600. value: g.name,
  601. },
  602. {
  603. name: "Spec",
  604. value: g.specs,
  605. },
  606. {
  607. name: "Unit",
  608. value: g.unit,
  609. },
  610. {
  611. name: "BudgetPrice",
  612. value: g.priceInfo.tenderPrice,
  613. },
  614. {
  615. name: "NormPrice",
  616. value: g.priceInfo.basePrice,
  617. },
  618. {
  619. name: "IsAdd",
  620. value: g.unit_price.is_add,
  621. },
  622. {
  623. name: "OrgPrice",
  624. value: g.unit_price.originalPrice ? g.unit_price.originalPrice : 0,
  625. },
  626. {
  627. name: "TransFee",
  628. value: g.unit_price.unitFreight ? g.unit_price.unitFreight : 0,
  629. },
  630. {
  631. name: "GwRate",
  632. value: g.unit_price.grossWeightCoe_n ? g.unit_price.grossWeightCoe_n : 0,
  633. },
  634. {
  635. name: "OffSiteLf",
  636. value: g.unit_price.offSiteTransportLossRate_n ? g.unit_price.offSiteTransportLossRate_n : 0,
  637. },
  638. {
  639. name: "OnSiteLf",
  640. value: 0,
  641. },
  642. {
  643. name: "LoadLf",
  644. value: g.unit_price.handlingLossRate_n ? g.unit_price.handlingLossRate_n : 0,
  645. },
  646. {
  647. name: "StoreRate",
  648. value: g.unit_price.purchaseStorageRate_n ? g.unit_price.purchaseStorageRate_n : 0,
  649. },
  650. {
  651. name: "PackageRecycleFee",
  652. value: g.unit_price.packageRecoverValue ? g.unit_price.packageRecoverValue : 0,
  653. },
  654. ];
  655. Element.call(this, "Material", attrs);
  656. // if (g.unit_price.calcMaterial == 1) { //有材料计算
  657. // let index = gljUtil.getIndex(g);
  658. // let orList = [];
  659. // for (let o of pgljData.originalList) {
  660. // if (o.connect_key == index) orList.push(new OrgPrices(o));
  661. // }
  662. // if (orList.length > 0) this.children = orList;
  663. // }
  664. function CostStructure(r) {
  665. //待获取
  666. this.name = "CostStructure";
  667. this.attrs = [];
  668. this.children = [];
  669. }
  670. function Consume(r, o) {
  671. this.name = "Consume";
  672. this.attrs = [];
  673. this.children = [];
  674. for (let g of o.ration_gljs) {
  675. if (g.rationID == r.ID) {
  676. let r_quantity = scMathUtil.roundForObj(r.quantity, tpdata.property.decimal.ration.quantity);
  677. this.children.push(new ConsumeItem(g, r_quantity));
  678. }
  679. }
  680. }
  681. function ConsumeItem(g, ration_quantity) {
  682. const attrs = [{
  683. name: "Code", //待获取
  684. value: g.code,
  685. },
  686. {
  687. name: "Consumption",
  688. value: scMathUtil.roundForObj(ration_quantity * parseFloat(g.quantity), tpdata.property.decimal.glj.quantity),
  689. },
  690. ];
  691. Element.call(this, "ConsumeItem", attrs);
  692. }
  693. function Norm(r, o) {
  694. const attrs = [{
  695. name: "NormLibNo", //待获取
  696. value: "",
  697. },
  698. {
  699. name: "DisplayCode",
  700. value: r.code,
  701. },
  702. {
  703. name: "Name",
  704. value: r.name,
  705. },
  706. {
  707. name: "Unit",
  708. value: r.unit,
  709. },
  710. {
  711. name: "Num",
  712. value: r.quantity,
  713. },
  714. {
  715. name: "CostTypeNo",
  716. value: "", //待获取
  717. },
  718. {
  719. name: "FabricationCost", //待获取
  720. value: "",
  721. },
  722. {
  723. name: "AdjustStatus",
  724. value: "",
  725. },
  726. ];
  727. Element.call(this, "Norm", attrs);
  728. this.children.push(new CostStructure(r));
  729. this.children.push(new Consume(r, o));
  730. }
  731. function SelfCollect(o) {
  732. const attrs = [{
  733. name: "OtherCost",
  734. value: 0,
  735. }, ];
  736. Element.call(this, "SelfCollect", attrs);
  737. for (let r of o.rations) {
  738. this.children.push(new Norm(r, o));
  739. }
  740. }
  741. function OrgPrices(o) {
  742. const attrs = [{
  743. name: "OrgPricevalue",
  744. value: o.supplyPrice,
  745. },
  746. {
  747. name: "Ratio",
  748. value: o.coe,
  749. },
  750. ];
  751. Element.call(this, "OrgPrices", attrs);
  752. if (!o.rations) return;
  753. this.children.push(new SelfCollect(o));
  754. }
  755. }
  756. function Mech(g,gljKeyMap) {
  757. const attrs = [{
  758. name: "Code",
  759. value: g.code,
  760. },
  761. {
  762. name: "PractName",
  763. value: g.name,
  764. },
  765. {
  766. name: "Spec",
  767. value: g.specs,
  768. },
  769. {
  770. name: "Unit",
  771. value: g.unit,
  772. },
  773. {
  774. name: "BudgetPrice",
  775. value: g.priceInfo.tenderPrice,
  776. },
  777. {
  778. name: "NormPrice",
  779. value: g.priceInfo.basePrice,
  780. },
  781. {
  782. name: "IsAdd",
  783. value: g.unit_price.is_add,
  784. },
  785. ];
  786. Element.call(this, "Mech", attrs);
  787. let FixedCostItems = [];
  788. let fcsum = 0;
  789. let VariableCostItems = [];
  790. let vcsum = 0;
  791. if (g.ratio_data && g.ratio_data.length > 0) {
  792. for (let ratio of g.ratio_data) {
  793. let rIndex = gljUtil.getIndex(ratio);
  794. let rglj = gljKeyMap[rIndex];
  795. let ts = scMathUtil.roundForObj(parseFloat(ratio.consumption) * rglj.priceInfo.tenderPrice, decimalObj.glj.unitPrice);
  796. if (FixedCostMap[ratio.name]) {
  797. FixedCostItems.push(new FixedCostItem(ratio));
  798. fcsum = scMathUtil.roundForObj(fcsum + ts, decimalObj.glj.unitPrice);
  799. } else {
  800. VariableCostItems.push(new VariableCostItem(ratio));
  801. vcsum = scMathUtil.roundForObj(vcsum + ts, decimalObj.glj.unitPrice);
  802. }
  803. }
  804. }
  805. if (FixedCostItems.length > 0) {
  806. let fc = new FixedCost(fcsum);
  807. fc.children = FixedCostItems;
  808. this.children.push(fc);
  809. }
  810. if (VariableCostItems.length > 0) {
  811. let vc = new VariableCost(vcsum);
  812. vc.children = VariableCostItems;
  813. this.children.push(vc);
  814. }
  815. function VariableCost(sum) {
  816. const attrs = [{
  817. name: "VariableCostSum",
  818. value: sum,
  819. }];
  820. Element.call(this, "VariableCost", attrs);
  821. }
  822. function VariableCostItem(item) {
  823. const attrs = [{
  824. name: "VariableCostNo",
  825. value: item.code,
  826. },{
  827. name: "Consumption",
  828. value: item.consumption,
  829. }]
  830. Element.call(this, "VariableCostItem", attrs);
  831. }
  832. function FixedCost(sum) {
  833. const attrs = [{
  834. name: "FixedCostSum",
  835. value: sum,
  836. }, {
  837. name: "FixedRate",
  838. value: 1,
  839. }];
  840. Element.call(this, "FixedCost", attrs);
  841. }
  842. function FixedCostItem(item) {
  843. const attrs = [{
  844. name: "FixedCostNo",
  845. value: ratioCodeMap[item.code],
  846. },{
  847. name: "Sum",
  848. value: item.consumption,
  849. }]
  850. Element.call(this, "FixedCostItem", attrs);
  851. }
  852. }
  853. let Mps = new emptyElement("Mps");
  854. Mps.attrs = [{
  855. name: "KeyId",
  856. value: uuid.v1()
  857. }];
  858. let Materials = new emptyElement("Materials");
  859. Materials.attrs = [{
  860. name: "KeyId",
  861. value: uuid.v1()
  862. }];
  863. let Mechs = new emptyElement("Mechs");
  864. Mechs.attrs = [{
  865. name: "KeyId",
  866. value: uuid.v1()
  867. }];
  868. let gljKeyMap = {};
  869. let temMechs = [];
  870. if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
  871. for (let g of pgljData.gljList) {
  872. if (!g.quantity) {
  873. continue;
  874. }
  875. let type = g.type + "";
  876. gljKeyMap[gljUtil.getIndex(g)] = g;
  877. type = type.charAt(0);
  878. if (type == "1") {
  879. Mps.children.push(new Mp(g));
  880. } else if (type == "2" || type == 5) {
  881. Materials.children.push(new Material(g));
  882. } else if (type == "3") {
  883. temMechs.push(g);
  884. }
  885. }
  886. for (let t of temMechs) {
  887. Mechs.children.push(new Mech(t,gljKeyMap));
  888. }
  889. }
  890. this.children.push(Mps);
  891. this.children.push(Materials);
  892. this.children.push(Mechs);
  893. }
  894. function EprjInfo(tenderProject) {
  895. let bills = tenderProject.Bills.datas;
  896. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  897. let totalItem = null;
  898. let proItem = null; //暂列金额项
  899. let safeItem = null;
  900. let oneToSevenItem = null;
  901. for (let b of bills) {
  902. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.TOTAL_COST) totalItem = b;
  903. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.PROVISIONAL) proItem = b;
  904. if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) oneToSevenItem = b;
  905. if(b.code == "102-3" && b.name=="安全生产费") safeItem = b;
  906. }
  907. const attrs = [{
  908. name: "Name",
  909. value: tenderProject.projectInfo.name,
  910. },
  911. {
  912. name: "Sums",
  913. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  914. },
  915. {
  916. name: "KeyId",
  917. value: uuid.v1()
  918. }
  919. ];
  920. //输出控制价、投标文件时,取调价后的标段总造价。
  921. //输出招标文件时,取0
  922. if (isBidInvitation) attrs[1].value = 0;
  923. Element.call(this, "EprjInfo", attrs);
  924. // this.children.push(new SummaryOfCost(totalItem, proItem,safeItem,oneToSevenItem,feature));
  925. this.children.push(new MakeInfo(tenderProject));
  926. this.children.push(new Params(tenderProject));
  927. this.children.push(new getBillsItems(tenderProject));
  928. this.children.push(new getIndexs(tenderProject));
  929. let bidEvaluationMainMaterials = getBidEvaluationMainMaterial(tenderProject);
  930. if(bidEvaluationMainMaterials.length > 0) this.children.push(...bidEvaluationMainMaterials);
  931. }
  932. function _getNumValueByExportKind(orgSum) {
  933. let rst = orgSum;
  934. // const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  935. // const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  936. // const isControl = exportKind === CONTROL; // 是否是控制价
  937. //根据导出类型(上面3个),输出实际合计或price
  938. if (isBidInvitation) {
  939. rst = 0;
  940. }
  941. return rst;
  942. }
  943. function _getStrValueByExportKind(orgStr) {
  944. let rst = orgStr;
  945. if (isBidInvitation) {
  946. rst = '';
  947. }
  948. return rst;
  949. }
  950. function getBidEvaluationMainMaterial(tenderProject) {
  951. let bidMaterials = [];
  952. let i = 1;
  953. for (let b of tenderProject.bidMaterialData) {
  954. bidMaterials.push(new BidEvaluationMainMaterial(b, i));
  955. i++
  956. }
  957. return bidMaterials;
  958. function BidEvaluationMainMaterial(b, index) {
  959. const attrs = [{
  960. name: "Code",
  961. value: b.seq,
  962. },
  963. {
  964. name: "Number",
  965. value: b.code
  966. },
  967. {
  968. name: "Name",
  969. value: b.name
  970. },
  971. {
  972. name: "Specification",
  973. value: b.specs
  974. },
  975. {
  976. name: "Unit",
  977. value: b.unit
  978. },
  979. {
  980. name: "Price",
  981. value: b.marketPrice || '0',
  982. type: TYPE.DECIMAL
  983. },
  984. {
  985. name: "LimitedPrice",
  986. value: b.marketPrice || '0',
  987. type: TYPE.DECIMAL
  988. },
  989. {
  990. name: "Quantity",
  991. value: 0,//b.quantity
  992. type: TYPE.DECIMAL
  993. },
  994. {
  995. name: "Total",
  996. value: 0//b.totalPrice
  997. },
  998. {
  999. name: "Remark",
  1000. value: b.remark
  1001. }
  1002. ];
  1003. if (isBidSubmission || isControl) {
  1004. attrs[7].value = b.quantity;
  1005. attrs[8].value = b.totalPrice;
  1006. }
  1007. Element.call(this, "BidEvaluationMainMaterial", attrs);
  1008. }
  1009. }
  1010. function getIndexs(tenderProject) {
  1011. let Indexs = new emptyElement('Indexs');
  1012. Indexs.attrs = [{
  1013. name: "KeyId",
  1014. value: uuid.v1()
  1015. }];
  1016. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1017. for (let f of feature) {
  1018. if (f.code) Indexs.children.push(new IndexItem(f))
  1019. }
  1020. return Indexs;
  1021. function IndexItem(fea) {
  1022. const attrs = [{
  1023. name: "Code",
  1024. value: fea.code,
  1025. },
  1026. {
  1027. name: "Name",
  1028. value: fea.dispName,
  1029. },
  1030. {
  1031. name: "Unit",
  1032. value: fea.unit,
  1033. },
  1034. {
  1035. name: "Value",
  1036. value: fea.value,
  1037. },
  1038. {
  1039. name: "Remark",
  1040. value: fea.remark,
  1041. },
  1042. {
  1043. name: "KeyId",
  1044. value: uuid.v1()
  1045. }
  1046. ]
  1047. Element.call(this, "IndexItem", attrs);
  1048. }
  1049. }
  1050. function getBillsItems(tenderProject) {
  1051. let items = new emptyElement("Items");
  1052. items.attrs =[{
  1053. name: "KeyId",
  1054. value: uuid.v1()
  1055. }];
  1056. let rootNodes = tenderProject.mainTree.roots;
  1057. for (let r of rootNodes) {
  1058. setItem(r, -1, items.children);
  1059. }
  1060. return items;
  1061. function setItem(bNode, level, list) {
  1062. if (bNode.sourceType == ModuleNames.ration) return;
  1063. let item = new bill(bNode, level);
  1064. if (bNode.children && bNode.children.length > 0) {
  1065. level += 1;
  1066. for (let c of bNode.children) {
  1067. setItem(c, level, item.children);
  1068. }
  1069. }
  1070. list.push(item);
  1071. function getCalcType(node) {
  1072. /*
  1073. 判断是否父项:
  1074. 是父项,则取1;
  1075. 是叶子项,则判断其下有无套定额/量价/工料机:
  1076. 有则取1;
  1077. 无则判断有无基数计算:
  1078. 有则取2;
  1079. 无则取3 */
  1080. if (node.children && node.children.length > 0) {
  1081. return 1; //是父项,则取1, 有套定额/量价/工料机,也取1
  1082. } else {
  1083. return node.data.calcBase && node.data.calcBase != "" ? 2 : 3
  1084. }
  1085. }
  1086. function getItemType(node) {
  1087. let Bills = projectObj.project.Bills;
  1088. //是100~900章部分、或是计日工部分,叶子清单输出1,父项输出0;
  1089. if (Bills.isBelongOneToSeven(node)||Bills.isBelongDayWork(node)) {
  1090. if (node.children && node.children.length > 0) {
  1091. return node.children[0].sourceType == ModuleNames.ration ? 1 : 0
  1092. }
  1093. return 1 //叶子清单输出1
  1094. } else {
  1095. return 0;
  1096. /* //非100~900章部分,
  1097. // 是暂列金额,判断暂列金额的金额等于0,则输出为0;暂列金额的金额不等于0,则输出为1;
  1098. if (node.data.name && node.data.name.indexOf("暂列金额") != -1) {
  1099. let sum = node.data.feesIndex && node.data.feesIndex.common ? node.data.feesIndex.common.tenderTotalFee : "";
  1100. return gljUtil.isNotEmpty(sum) ? 1 : 0
  1101. } else { //非暂列金额,则判断清单的工程量是否等于0,等于0,则输出0;不等于0,则输出1
  1102. return gljUtil.isNotEmpty(node.data.quantity) ? 1 : 0
  1103. } */
  1104. }
  1105. }
  1106. function bill(bNode, level) {
  1107. let data = bNode.data;
  1108. let CostKind = 3;
  1109. if (data.name && data.name.indexOf("安全生产费") != -1) CostKind = 1;
  1110. if (data.name && data.name.indexOf("暂列金额") != -1) CostKind = 2;
  1111. //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
  1112. let CalcType = getCalcType(bNode);
  1113. //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
  1114. let ProvisionalType = "";
  1115. if (data.specialProvisional == "材料") ProvisionalType = 0;
  1116. if (data.specialProvisional == "工程设备") ProvisionalType = 1;
  1117. if (data.specialProvisional == "专业工程") ProvisionalType = 2;
  1118. //MpRatio
  1119. let MpRatio = "";
  1120. let MaterialRatio = "";
  1121. let MechRatio = "";
  1122. if (data.quantityCoe) {
  1123. if (data.quantityCoe["labour"]) MpRatio = data.quantityCoe["labour"];
  1124. if (data.quantityCoe["material"]) MaterialRatio = data.quantityCoe["material"];
  1125. if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
  1126. }
  1127. let fail = billNameChecking(bNode,tenderProject.projectInfo.name,fixedFlag)
  1128. //fail: { hint: '错误提示', type: '提示所属(基本就是单位工程名称)' }
  1129. let ListCode = "";
  1130. if (ListCodeMap[data.name]) ListCode = ListCodeMap[data.name][0];
  1131. if (data.code && data.code != "") ListCode = data.code;
  1132. let formulaCode = "";
  1133. if (ListCodeMap[data.name]) formulaCode = ListCodeMap[data.name][1];
  1134. let perKeyId = '';
  1135. if (data.ParentID != -1) perKeyId = data.ParentID;
  1136. const attrs = [{
  1137. name: "ListCode",
  1138. value: ListCode,
  1139. },
  1140. {
  1141. name: "ListName",
  1142. value: data.name,
  1143. fail:fail
  1144. },
  1145. {
  1146. name: "Unit",
  1147. value: data.unit,
  1148. },
  1149. {
  1150. name: "Num",
  1151. value: data.quantity,
  1152. type: TYPE.DECIMAL,
  1153. toFix:3
  1154. },
  1155. // {
  1156. // name: "QtyFormula",
  1157. // value: _getStrValueByExportKind(data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : ""),
  1158. // type: TYPE.DECIMAL,
  1159. // toFix:2
  1160. // },
  1161. {
  1162. name: "Price",
  1163. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
  1164. type: TYPE.DECIMAL,
  1165. toFix:2
  1166. },
  1167. {
  1168. name: "Sum",
  1169. value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
  1170. type: TYPE.DECIMAL,
  1171. toFix:2
  1172. },
  1173. {
  1174. name: "ProvisionalType",
  1175. value: ProvisionalType,
  1176. mustHasValue:true
  1177. },
  1178. {
  1179. name: "MeterRules",
  1180. value: "",
  1181. },
  1182. {
  1183. name: "Content",
  1184. value: data.jobContentText,
  1185. },
  1186. {
  1187. name: "Remarks",
  1188. value: data.remark,
  1189. },
  1190. {
  1191. name: "ItemType",
  1192. value: getItemType(bNode),
  1193. },
  1194. {
  1195. name: "FormulaCode",
  1196. value: formulaCode
  1197. },
  1198. {
  1199. name: "KeyId",
  1200. value: data.ID
  1201. },
  1202. {
  1203. name: "PerKeyId",
  1204. value: perKeyId
  1205. }
  1206. ];
  1207. //投标、招标控制价时。取单价。
  1208. //招标时,如果是“安全生产费”或“暂列金额”,取单价,否则取0。
  1209. if (isBidSubmission || isControl || CostKind==1 ||CostKind==2) {
  1210. attrs[4].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "";
  1211. attrs[5].value = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
  1212. //暂列金额 数量为0的时候,单价输出0
  1213. if( CostKind==2 && !gljUtil.isNotEmpty(data.quantity)) attrs[4].value = 0
  1214. }
  1215. Element.call(this, "Item", attrs);
  1216. let cc = CostComposition(bNode);
  1217. if (cc) this.children.push(cc);
  1218. this.children.push(CostStructure(data))
  1219. function CostComposition(bNode) {
  1220. if (isBidInvitation) return null;
  1221. let CostComposition = new emptyElement('CostComposition');
  1222. CostComposition.attrs =[{
  1223. name: "KeyId",
  1224. value: uuid.v1()
  1225. }];
  1226. let Norms = [];
  1227. let Costs = [];
  1228. if (bNode.children && bNode.children.length > 0 && bNode.children[0].sourceType == ModuleNames.ration) {
  1229. for (let r of bNode.children) {
  1230. if (r.data.type == rationType.ration) {
  1231. if(isEmptyRation(r.data)) continue;//定额空行不输出到接口文件中。
  1232. Norms.push(new Ration(r.data));
  1233. } else {
  1234. Costs.push(new Cost(r.data));
  1235. }
  1236. }
  1237. }
  1238. if (Norms.length > 0) CostComposition.children.push(...Norms);
  1239. if (Costs.length > 0) CostComposition.children.push(...Costs);
  1240. if (bNode.data.calcBase) CostComposition.children.push(new Formula(bNode.data));
  1241. return CostComposition.children.length > 0 ? CostComposition : null;
  1242. //定额空行不输出到接口文件中。 //定额空行的判断是:定额编码、定额名称、定额单位、定额单位、定额工程量为零或为空时
  1243. function isEmptyRation(ration){
  1244. return !gljUtil.isNotEmpty(ration.code)&&!gljUtil.isNotEmpty(ration.name)&&!gljUtil.isNotEmpty(ration.unit)&&(!gljUtil.isNotEmpty(ration.quantity)||ration.quantity == 0)
  1245. }
  1246. function Formula(bills) {
  1247. const attrs = [{
  1248. name: "Name",
  1249. value: bills.name
  1250. },
  1251. {
  1252. name: "Formulas",
  1253. value: bills.calcBase
  1254. },
  1255. {
  1256. name: "Ratio",
  1257. value: 1
  1258. },
  1259. {
  1260. name: "Sum",
  1261. value: bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : "",
  1262. type:TYPE.DECIMAL
  1263. },
  1264. {
  1265. name: "Remarks",
  1266. value: bills.remark
  1267. },
  1268. {
  1269. name: "KeyId",
  1270. value: uuid.v1()
  1271. }
  1272. ]
  1273. Element.call(this, "Formula", attrs);
  1274. // 1.Name
  1275. // 名称/描述。取清单的名称。
  1276. // 2.Formulas
  1277. // 计算式。读取计算基数的文本。
  1278. // 取基数计算窗口内容,基数直接转换为金额?参考标准文档的 7.11 及 7.12 节。
  1279. // 7.11是定额的费用,7.12是清单累进基数,主要是估概预算中用到,清单里的不同,所以中山的接口直接输出基数文本。
  1280. // 3.Ratio
  1281. // 系数。输出为1,非必填。
  1282. // 4.Sum
  1283. // 取金额。
  1284. // 5.Remarks
  1285. }
  1286. function Cost(item) {
  1287. let BasePrice = 0;
  1288. if (item.type == rationType.volumePrice) { // 当插入的是量价时,基价读取单价列。
  1289. BasePrice = item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1290. } else {
  1291. BasePrice = getBasePrice(item.projectGLJID, tenderProject)
  1292. }
  1293. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1294. let CostTypeNo = '';
  1295. if (feeRateMap[calcMap[item.programID]]) CostTypeNo = feeRateMap[calcMap[item.programID]];
  1296. const attrs = [{
  1297. name: "Code",
  1298. value: item.code,
  1299. }, {
  1300. name: 'Name',
  1301. value: item.name
  1302. }, {
  1303. name: 'Spec',
  1304. value: item.specs
  1305. }, {
  1306. name: 'Unit',
  1307. value: item.unit
  1308. }, {
  1309. name: 'Num',
  1310. value: item.tenderQuantity
  1311. }, {
  1312. name: 'BasePrice',
  1313. value: BasePrice
  1314. }, {
  1315. name: 'Price',
  1316. value: item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
  1317. }, {
  1318. name: 'IsEquipment',
  1319. value: item.subType == gljType.EQUIPMENT ? 1 : 0
  1320. }, {
  1321. name: 'CostTypeNo',
  1322. value: CostTypeNo
  1323. }, {
  1324. name: 'ProfitRate',
  1325. value: getFeeRate(item.programID, 'profit', tenderProject)
  1326. },
  1327. {
  1328. name: 'TaxRate',
  1329. value: getFeeRate(item.programID, 'tax', tenderProject)
  1330. },
  1331. {
  1332. name: 'MpRatio',
  1333. value: item.subType == gljType.LABOUR ? 100 : 0
  1334. },
  1335. {
  1336. name: 'MaterialRatio',
  1337. value: item.subType == gljType.GENERAL_MATERIAL ? 100 : 0
  1338. },
  1339. {
  1340. name: 'MechRatio',
  1341. value: item.subType == gljType.GENERAL_MACHINE ? 100 : 0
  1342. }
  1343. ]
  1344. Element.call(this, "Cost", attrs);
  1345. this.children.push(CostStructure(item));
  1346. }
  1347. function Ration(ration) {
  1348. let calcMap = tenderProject.calcProgram.compiledTemplateMaps
  1349. let CostTypeNo = '';
  1350. if (feeRateMap[calcMap[ration.programID]]) CostTypeNo = feeRateMap[calcMap[ration.programID]];
  1351. const attrs = [{
  1352. name: "NormLibNo",
  1353. value: 'YSDE-000000-2018-86',
  1354. }, {
  1355. name: 'DisplayCode',
  1356. value: ration.code
  1357. }, {
  1358. name: 'Name',
  1359. value: ration.name
  1360. }, {
  1361. name: 'Unit',
  1362. value: ration.unit
  1363. }, {
  1364. name: 'Num',
  1365. value: ration.tenderQuantity
  1366. },
  1367. {
  1368. name: 'CostTypeNo',
  1369. value: CostTypeNo
  1370. },
  1371. {
  1372. name: 'ProfitRate',
  1373. value: getFeeRate(ration.programID, 'profit', tenderProject) //tenderProject.ProfitRate
  1374. },
  1375. {
  1376. name: 'TaxRate',
  1377. value: getFeeRate(ration.programID, 'tax', tenderProject) //tenderProject.TaxRate
  1378. },
  1379. {
  1380. name: 'FabricationCost',
  1381. value: ration.feesIndex && ration.feesIndex.common ? ration.feesIndex.common.tenderTotalFee : 0
  1382. },
  1383. {
  1384. name: 'AdjustStatus',
  1385. value: ration.adjustState
  1386. }
  1387. ]
  1388. Element.call(this, "Norm", attrs);
  1389. this.children.push(CostStructure(ration));
  1390. this.children.push(Consume(ration));
  1391. }
  1392. }
  1393. function Consume(ration) {
  1394. let consume = new emptyElement('Consume');
  1395. for (let rg of ration.rationGLJList) {
  1396. consume.children.push(new ConsumeItem(rg));
  1397. }
  1398. return consume;
  1399. function ConsumeItem(rg) {
  1400. const attrs = [{
  1401. name: "Code",
  1402. value: rg.code,
  1403. }, {
  1404. name: "Consumption",
  1405. value: rg.tenderQuantity
  1406. }];
  1407. Element.call(this, "ConsumeItem", attrs);
  1408. }
  1409. }
  1410. function CostStructure(item) {
  1411. let CostStructure = new emptyElement('CostStructure');
  1412. CostStructure.attrs = [{
  1413. name: "KeyId",
  1414. value: uuid.v1()
  1415. }];
  1416. for (let f of cpFeeTypes) {
  1417. if(itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item,f.type))
  1418. }
  1419. if (CostStructure.children.length == 0) CostStructure.children.push(new CostItem({},""))
  1420. function CostItem(item,type) {
  1421. const attrs = [{
  1422. name: "ItemNo",
  1423. value: itemFeeMap[type],
  1424. }, {
  1425. name: 'Sum',
  1426. value: 0 //fee.tenderTotalFee
  1427. }, {
  1428. name: "KeyId",
  1429. value: uuid.v1()
  1430. }
  1431. ]
  1432. if ((isBidSubmission || isControl) && item.feesIndex && item.feesIndex[type]) attrs[1].value = item.feesIndex[type].tenderTotalFee;
  1433. Element.call(this, "CostItem", attrs);
  1434. }
  1435. return CostStructure;
  1436. }
  1437. }
  1438. }
  1439. }
  1440. function Params(tenderProject) {
  1441. let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
  1442. let featrueMap = {};
  1443. let baseMap = {};
  1444. for (let f of feature) {
  1445. featrueMap[f.key] = f;
  1446. }
  1447. let baseInfo = _.find(tenderProject.property.basicInformation, {
  1448. dispName: "基本信息",
  1449. });
  1450. for (let i of baseInfo.items) {
  1451. let key = i.key;
  1452. //if (i.dispName == "编制日期") key = "编制时间";
  1453. baseMap[key] = i;
  1454. }
  1455. let BuildType = "";
  1456. if (baseMap["natureConstruction"].value == "新建") BuildType = 0;
  1457. if (baseMap["natureConstruction"].value == "改扩建") BuildType = 1;
  1458. let Terrain = "";
  1459. if (baseMap["terrainCategory"].value == "平原微丘") Terrain = 0;
  1460. if (baseMap["terrainCategory"].value == "山岭重丘") Terrain = 1;
  1461. let DesignSpeed = featrueMap["designSpeed"].value;
  1462. let Structure = "";
  1463. if (featrueMap["pavementStructure"].value == "沥青路面") Structure = 0;
  1464. if (featrueMap["pavementStructure"].value == "水泥混凝土路面") Structure = 1;
  1465. if (featrueMap["pavementStructure"].value == "其他类型路面") Structure = 2;
  1466. let RoadGrade = "";
  1467. if (RoadGradeMap[baseMap["roadGrade"].value]) RoadGrade = RoadGradeMap[baseMap["roadGrade"].value];
  1468. const attrs = [{
  1469. name: "PrjArea",
  1470. value: baseMap["location"] ? baseMap["location"].value : ""
  1471. },
  1472. {
  1473. name: "StartPileNo",
  1474. value: baseMap["startChainages"] ? baseMap["startChainages"].value : "",
  1475. mustHasValue: true
  1476. },
  1477. {
  1478. name: "EndPileNo",
  1479. value: baseMap["endChainages"] ? baseMap["endChainages"].value : "",
  1480. mustHasValue: true
  1481. },
  1482. {
  1483. name: "BuildType",
  1484. value: BuildType,
  1485. },
  1486. {
  1487. name: "Terrain",
  1488. value: Terrain,
  1489. mustHasValue: true
  1490. },
  1491. {
  1492. name: "RoadGrade",
  1493. value: RoadGrade,
  1494. mustHasValue: true
  1495. },
  1496. {
  1497. name: "DesignSpeed",
  1498. value: DesignSpeed,
  1499. mustHasValue: true
  1500. },
  1501. {
  1502. name: "Structure",
  1503. value: Structure,
  1504. mustHasValue: true
  1505. },
  1506. {
  1507. name: "SubgradeWidth",
  1508. value: featrueMap["subgradeWidth"] ? featrueMap["subgradeWidth"].value : "",
  1509. mustHasValue: true
  1510. },
  1511. {
  1512. name: "RoadLength",
  1513. value: featrueMap["roadLength"] ? featrueMap["roadLength"].value : "",
  1514. mustHasValue: true
  1515. },
  1516. {
  1517. name: "BridgeLength",
  1518. value: featrueMap["bridgeLength"] ? featrueMap["bridgeLength"].value : "",
  1519. mustHasValue: true
  1520. },
  1521. {
  1522. name: "TunnelLength",
  1523. value: featrueMap["tunnelLength"] ? featrueMap["tunnelLength"].value : "",
  1524. mustHasValue: true
  1525. },
  1526. {
  1527. name: "BriTunRate",
  1528. value: featrueMap["briTunRate"] ? featrueMap["briTunRate"].value : "",
  1529. mustHasValue: true
  1530. },
  1531. {
  1532. name: "InterchangeNum",
  1533. value: featrueMap["interchangeNum"] ? featrueMap["interchangeNum"].value : "",
  1534. mustHasValue: true
  1535. },
  1536. {
  1537. name: "StubLengths",
  1538. value: featrueMap["stubLengths"] ? featrueMap["stubLengths"].value : "",
  1539. mustHasValue: true
  1540. },
  1541. {
  1542. name: "LaneLength",
  1543. value: featrueMap["laneLength"] ? featrueMap["laneLength"].value : "",
  1544. mustHasValue: true
  1545. },
  1546. {
  1547. name: "KeyId",
  1548. value: uuid.v1()
  1549. }
  1550. ];
  1551. Element.call(this, "Params", attrs);
  1552. }
  1553. function SummaryOfCost(totalItem, proItem,safeItem,oneToSevenItem,feature) {
  1554. let attrs = [{
  1555. name: "TenderSumLimit",
  1556. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1557. type: TYPE.DECIMAL,
  1558. toFix:2,
  1559. },
  1560. {
  1561. name: "BidTotal",
  1562. value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
  1563. type: TYPE.DECIMAL,
  1564. toFix:2,
  1565. },
  1566. {
  1567. name: "BillTotal",
  1568. value: oneToSevenItem.feesIndex && oneToSevenItem.feesIndex.common && oneToSevenItem.feesIndex.common.tenderTotalFee ? oneToSevenItem.feesIndex.common.tenderTotalFee : 0,
  1569. type: TYPE.DECIMAL,
  1570. toFix:2,
  1571. },
  1572. {
  1573. name: "CostForHSE",
  1574. value: safeItem && safeItem.feesIndex && safeItem.feesIndex.common && safeItem.feesIndex.common.tenderTotalFee ? safeItem.feesIndex.common.tenderTotalFee : 0,
  1575. type: TYPE.DECIMAL,
  1576. toFix:2,
  1577. },
  1578. {
  1579. name: "ProvisionalSums",
  1580. value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0,
  1581. type: TYPE.DECIMAL,
  1582. toFix:2,
  1583. },
  1584. {
  1585. name: "Appraisal",
  1586. value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0,
  1587. type: TYPE.DECIMAL,
  1588. toFix:2,
  1589. },
  1590. ];
  1591. if (isBidInvitation) {
  1592. attrs.splice(0, 3) //招标
  1593. }
  1594. //if (isControl) attrs.splice(1, 5); //控制价
  1595. if (isBidSubmission) { //投标文件时,读工程特征中的 招标控制价 值
  1596. let tenderSumLimit = _.find(feature, { "key": "tenderSumLimit" });
  1597. if(tenderSumLimit) attrs[0].value = tenderSumLimit.value
  1598. }
  1599. Element.call(this, "SummaryOfCost", attrs);
  1600. }
  1601. function MakeInfo(tenderProject) {
  1602. let property = tenderProject.property;
  1603. let baseMap = {};
  1604. let baseInfo = _.find(property.basicInformation, {
  1605. dispName: "基本信息",
  1606. });
  1607. for (let i of baseInfo.items) {
  1608. let key = i.key;
  1609. //if (i.dispName == "编制日期") key = "编制时间";
  1610. baseMap[key] = i;
  1611. }
  1612. //mustHasValue
  1613. const attrs = [
  1614. // {
  1615. // name: "ValuationModel",
  1616. // value: property.taxType,
  1617. // },
  1618. {
  1619. name: "Manage",
  1620. value: baseMap["constructingUnit"] ? baseMap["constructingUnit"].value : "",
  1621. },
  1622. {
  1623. name: "Designer",
  1624. value: baseMap["designUnit"] ? baseMap["designUnit"].value : "",
  1625. mustHasValue:true
  1626. },
  1627. {
  1628. name: "Compile",
  1629. value: baseMap["compileUnit"] ? baseMap["compileUnit"].value : "",
  1630. },
  1631. {
  1632. name: "CompileApprover",
  1633. value: baseMap["compileApprover"] ? baseMap["compileApprover"].value : "",
  1634. },
  1635. {
  1636. name: "CompileCertNo",
  1637. value: baseMap["compileCertNo"] ? baseMap["compileCertNo"].value : "",
  1638. mustHasValue:true
  1639. },
  1640. {
  1641. name: "CompileDate",
  1642. value: baseMap["compileDate"] && baseMap["compileDate"].value != "" ? baseMap["compileDate"].value + "T00:00:00" : "",
  1643. mustHasValue:true
  1644. },
  1645. {
  1646. name: "Review",
  1647. value: baseMap["reviewUnit"] ? baseMap["reviewUnit"].value : "",
  1648. mustHasValue:true
  1649. },
  1650. {
  1651. name: "ReviewApprover",
  1652. value: baseMap["reviewApprover"] ? baseMap["reviewApprover"].value : "",
  1653. mustHasValue:true
  1654. },
  1655. {
  1656. name: "ReviewCertNo",
  1657. value: baseMap["reviewCertNo"] ? baseMap["reviewCertNo"].value : "",
  1658. mustHasValue:true
  1659. },
  1660. {
  1661. name: "ReviewDate",
  1662. value: baseMap["reviewDate"] && baseMap["reviewDate"].value != "" ? baseMap["reviewDate"].value + "T00:00:00" : "",
  1663. mustHasValue:true
  1664. },
  1665. {
  1666. name: "Examine",
  1667. value: baseMap["examineUnit"] ? baseMap["examineUnit"].value : "",
  1668. mustHasValue:true
  1669. },
  1670. {
  1671. name: "ExamineApprover",
  1672. value: baseMap["examineApprover"] ? baseMap["examineApprover"].value : "",
  1673. mustHasValue:true
  1674. },
  1675. {
  1676. name: "ExamineCertNo",
  1677. value: baseMap["examineCertNo"] ? baseMap["examineCertNo"].value : "",
  1678. mustHasValue:true
  1679. },
  1680. {
  1681. name: "ExamineDate",
  1682. value: baseMap["examineDate"] && baseMap["examineDate"].value != "" ? baseMap["examineDate"].value + "T00:00:00" : "",
  1683. mustHasValue:true
  1684. },
  1685. {
  1686. name: "CompileExplain",
  1687. value: baseMap["compileExplain"] ? baseMap["compileExplain"].value : "",
  1688. mustHasValue:true
  1689. },
  1690. {
  1691. name: "ExamineExplain",
  1692. value: baseMap["examineExplain"] ? baseMap["examineExplain"].value : "",
  1693. mustHasValue:true
  1694. },
  1695. {
  1696. name: "ProjectExplain",
  1697. value: baseMap["projectExplain"] ? baseMap["projectExplain"].value : "",
  1698. mustHasValue:true
  1699. },
  1700. {
  1701. name: "KeyId",
  1702. value: uuid.v1()
  1703. }
  1704. ];
  1705. if (isBidInvitation) { //招标文件,则以下的8、12~18则不输出
  1706. attrs.splice(11, 7);
  1707. attrs.splice(7, 1);
  1708. }
  1709. Element.call(this, "MakeInfo", attrs);
  1710. }
  1711. let data = new CprjInfo(projectData.name);
  1712. data.children.push(new SystemInfo(projectData));
  1713. data.children.push(new CostBasis());
  1714. let seriNo = 1;
  1715. let Rates = [];
  1716. let Practs = [];
  1717. let EprjInfos = [];
  1718. for (let c of projectData.children) {
  1719. let tenderProject = tenderDetailMap[c.ID];
  1720. let feeRataDatas = tenderProject.FeeRate.datas;
  1721. Rates.push(new Rate(tenderProject, feeRataDatas, seriNo));
  1722. Practs.push(new Pract(tenderProject, seriNo));
  1723. EprjInfos.push(new EprjInfo(tenderProject));
  1724. seriNo++;
  1725. }
  1726. data.children.push(...Rates,...Practs,...EprjInfos);
  1727. return [{
  1728. data: data,
  1729. exportKind: exportKind,
  1730. fileName: projectData.name + INTERFACE_CONFIG[areaKey]["fileSuffix"][exportKind],
  1731. }, ];
  1732. }
  1733. return {
  1734. entry,
  1735. };
  1736. })();