guangxi_common.js 58 KB

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