guangdong_zhongshan.js 54 KB

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