anhui_chizhou.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. INTERFACE_EXPORT = (() => {
  2. 'use strict';
  3. /**
  4. *
  5. * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
  6. * @param {Number} exportKind - 导出类型,招标、投标、控制价
  7. * @param {Object} projectData - 项目表数据:{ 建设项目Data, children: [单位工程...] }
  8. * @param {Object} tenderDetailMap - 单位工程ID与getData接口数据(projectObj.project的结构)的映射。
  9. * @return {Promise<Array>} - 返回的数据结构必须按照规定:[{ data, exportKind, fileName }],参考web\building_saas\standard_interface\index.js中的注释说明
  10. */
  11. async function entry(areaKey, exportKind, projectData, tenderDetailMap) {
  12. const {
  13. CONFIG: {
  14. TYPE,
  15. WHITE_SPACE
  16. },
  17. UTIL: {
  18. getValueByKey,
  19. getHan,
  20. getFee,
  21. generateHardwareId,
  22. },
  23. Element,
  24. } = INTERFACE_EXPORT_BASE;
  25. const {
  26. EXPORT_KIND: { BID_INVITATION, BID_SUBMISSION, CONTROL },
  27. fixedFlag,
  28. RationType,
  29. } = window.commonConstants
  30. const GljType = gljUtil.gljType;
  31. const { isEmptyVal, isDef } = window.commonUtil;
  32. const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  33. const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  34. const isControl = exportKind === CONTROL; // 是否是控制价
  35. let serialNo;
  36. let vTree;
  37. // ------------------------------------------------------------------------------------------------------------
  38. // 提取字符串中的数字
  39. function getNum(str) {
  40. let num = str.replace(/[^0-9]/ig, "");
  41. return num;
  42. }
  43. function CheckNull(Value) {
  44. if (!Value)
  45. return 0
  46. else
  47. return Value;
  48. }
  49. function GetRationDataType(ration){
  50. let dt;
  51. if (calcTools.isRationItem(ration))
  52. dt = 3
  53. else if (calcTools.isGljRation(ration))
  54. dt = 1
  55. else if (calcTools.isVolumePrice(ration))
  56. dt = 4;
  57. return dt;
  58. }
  59. // ------------------------------------------------------------------------------------------------------------
  60. function CreateNode(nodeName, attrArr = []) {
  61. Element.call(this, nodeName, attrArr);
  62. }
  63. function GongCXX(information) {
  64. const attrs = [
  65. { name: '项目编号', value: getValueByKey(information, 'projNum') },
  66. { name: '项目名称', value: getValueByKey(information, '') },
  67. { name: '建设单位', value: getValueByKey(information, 'constructingUnits') },
  68. { name: '起始桩号', value: getValueByKey(information, 'startAndChainages') },
  69. { name: '终点桩号', value: getValueByKey(information, 'startAndChainages') },
  70. { name: '建设地址', value: getValueByKey(information, '') },
  71. { name: '项目概况', value: getValueByKey(information, '') },
  72. { name: '建设性质', value: getValueByKey(information, '') },
  73. { name: '专业划分', value: getValueByKey(information, '') },
  74. { name: '道路里程', value: getValueByKey(information, '') },
  75. { name: '设计单位', value: getValueByKey(information, '') },
  76. { name: '计税方式', value: getValueByKey(information, 'taxMode') },
  77. { name: '文件类型', value: getValueByKey(information, 'projType') },
  78. { name: '标准版本号', value: getValueByKey(information, '') },
  79. { name: 'GUID', value: getValueByKey(information, '') }
  80. ];
  81. Element.call(this, '工程信息', attrs);
  82. }
  83. function ZhaoBiaoXx(information) {
  84. const attrs = [
  85. { name: '招标人', value: getValueByKey(information, 'tendereeName') },
  86. { name: '招标人纳税识别号', value: getValueByKey(information, 'tendereeTaxpayerIdentificationNo') },
  87. { name: '招标法定代表人或其授权人', value: getValueByKey(information, 'tenderAuthorizer') },
  88. { name: '招标法人或其授权人身份证号', value: getValueByKey(information, 'tenderAuthorizerIDNo') },
  89. { name: '造价咨询人', value: getValueByKey(information, 'costConsultant') },
  90. { name: '造价咨询人纳税识别号', value: getValueByKey(information, 'costConsultantTaxpayerIdentificationNo') },
  91. { name: '造价咨询人法定代表人或其授权人', value: getValueByKey(information, 'consultantAuthorizer') },
  92. { name: '造价咨询法人或其授权人身份证号', value: getValueByKey(information, 'consultantAuthorizerTaxpayerIdentificationNo') },
  93. { name: '编制人', value: getValueByKey(information, 'tenderCompiler') },
  94. { name: '编制人资格证号', value: getValueByKey(information, '') },
  95. { name: '编制日期', value: getValueByKey(information, 'compilationTime'), type: TYPE.DATE},
  96. { name: '复核人', value: getValueByKey(information, 'tenderExaminer') },
  97. { name: '复核人资格证号', value: getValueByKey(information, '') },
  98. { name: '复核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE }
  99. ];
  100. Element.call(this, '招标信息', attrs);
  101. }
  102. function ZhaoBiaoKzXx(information, totalCost) {
  103. const attrs = [
  104. { name: '招标人', value: getValueByKey(information, 'tendereeName') },
  105. { name: '招标人纳税识别号', value: getValueByKey(information, 'tendereeTaxpayerIdentificationNo') },
  106. { name: '招标法定代表人或其授权人', value: getValueByKey(information, 'tenderAuthorizer') },
  107. { name: '招标法人或其授权人身份证号', value: getValueByKey(information, 'tenderAuthorizerIDNo') },
  108. { name: '造价咨询人', value: getValueByKey(information, 'costConsultant') },
  109. { name: '造价咨询人纳税识别号', value: getValueByKey(information, 'costConsultantTaxpayerIdentificationNo') },
  110. { name: '造价咨询人法定代表人或其授权人', value: getValueByKey(information, 'consultantAuthorizer') },
  111. { name: '造价咨询法人或其授权人身份证号', value: getValueByKey(information, 'consultantAuthorizerTaxpayerIdentificationNo') },
  112. { name: '编制人', value: getValueByKey(information, 'tenderCompiler') },
  113. { name: '编制人资格证号', value: getValueByKey(information, '') },
  114. { name: '编制日期', value: getValueByKey(information, 'compilationTime'), type: TYPE.DATE},
  115. { name: '复核人', value: getValueByKey(information, 'tenderExaminer') },
  116. { name: '复核人资格证号', value: getValueByKey(information, '') },
  117. { name: '复核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE },
  118. { name: '审核人', value: getValueByKey(information, 'tenderExaminer') },
  119. { name: '审核人资格证号', value: getValueByKey(information, '') },
  120. { name: '审核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE },
  121. { name: '控制价总价', value: totalCost, type: TYPE.DECIMAL },
  122. { name: '工期', value: getValueByKey(information, '') },
  123. { name: '质量要求', value: getValueByKey(information, '') }
  124. ];
  125. Element.call(this, '招标控制价', attrs);
  126. }
  127. function TouBiaoXx(information, totalCost) {
  128. const attrs = [
  129. { name: '投标人', value: getValueByKey(information, 'bidderName') },
  130. { name: '投标人纳税识别号', value: getValueByKey(information, '') },
  131. { name: '投标人法定代表或其授权人', value: getValueByKey(information, 'bidderAuthorizer') },
  132. { name: '投标人法人或其授权人身份证号', value: getValueByKey(information, '') },
  133. { name: '编制人', value: getValueByKey(information, 'tenderCompiler') },
  134. { name: '编制人资格证号', value: getValueByKey(information, '') },
  135. { name: '编制日期', value: getValueByKey(information, 'compilationTime'), type: TYPE.DATE},
  136. { name: '复核人', value: getValueByKey(information, 'tenderExaminer') },
  137. { name: '复核人资格证号', value: getValueByKey(information, '') },
  138. { name: '复核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE },
  139. { name: '审核人', value: getValueByKey(information, 'tenderExaminer') },
  140. { name: '审核人资格证号', value: getValueByKey(information, '') },
  141. { name: '审核日期', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE },
  142. { name: '投标总价', value: totalCost, type: TYPE.DECIMAL },
  143. { name: '工期', value: getValueByKey(information, '') },
  144. { name: '投标担保金额', value: getValueByKey(information, '') },
  145. { name: '质量承诺', value: getValueByKey(information, '') },
  146. { name: '投标担保方式', value: getValueByKey(information, '') },
  147. { name: '造价软件品牌', value: getValueByKey(information, '') },
  148. { name: '造价软件版本', value: getValueByKey(information, '') },
  149. { name: '造价软件加密锁编号', value: getValueByKey(information, '') },
  150. { name: '计算机硬件信息', value: getValueByKey(information, '') },
  151. { name: '', value: getValueByKey(information, '') }
  152. ];
  153. Element.call(this, '投标信息', attrs);
  154. }
  155. function addRationGLJs(rData, rationNode){
  156. for (let i = 0; i < rData.rationGLJList.length; i++) {
  157. let glj = rData.rationGLJList[i];
  158. const attrs = [
  159. { name: '人材机标识', value: glj.GLJID},
  160. { name: '人材机含量', value: glj.tenderQuantity}
  161. ];
  162. let gljNode = new CreateNode('定额人材机含量明细', attrs);
  163. rationNode.children.push(gljNode);
  164. }
  165. }
  166. function addRations(ABillItem, ABillNode){
  167. for (let i = 0; i < ABillItem.children.length; i++) {
  168. let r = ABillItem.children[i];
  169. let rData = ABillItem.children[i].data;
  170. const attrs = [
  171. { name: '序号', value: r.row()},
  172. { name: '定额编号', value: rData.code},
  173. { name: '定额名称', value: rData.name},
  174. { name: '单位', value: rData.unit},
  175. { name: '数量', value: rData.tenderQuantity},
  176. { name: '单价', value: rData.feesIndex && rData.feesIndex.common ? rData.feesIndex.common.tenderUnitFee : 0},
  177. { name: '合价', value: rData.feesIndex && rData.feesIndex.common ? rData.feesIndex.common.tenderTotalFee : 0},
  178. { name: '备注', value: ''},
  179. { name: '数据类型', value: GetRationDataType(r)},
  180. { name: '人工费', value: getFee(rData.fees, 'marketLabour.tenderTotalFee'), type: TYPE.DECIMAL},
  181. { name: '主材费', value: getFee(rData.fees, 'marketMaterial.tenderTotalFee'), type: TYPE.DECIMAL},
  182. { name: '辅材费', value: 0},
  183. { name: '机械使用费', value: getFee(rData.fees, 'marketMachine.tenderTotalFee'), type: TYPE.DECIMAL},
  184. { name: '设备费', value: 0},
  185. { name: '措施费1', value: getFee(rData.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL}, // FQuery2.FieldByName('OtherDirectFee'},
  186. { name: '措施费2', value: 0}, //getFee(r.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL
  187. { name: '企业管理费', value: getFee(rData.fees, 'manage.tenderTotalFee'), type: TYPE.DECIMAL},
  188. { name: '规费', value: getFee(rData.fees, 'force.tenderTotalFee'), type: TYPE.DECIMAL},
  189. { name: '利润', value: getFee(rData.fees, 'profit.tenderTotalFee'), type: TYPE.DECIMAL},
  190. { name: '税金', value: getFee(rData.fees, 'tax.tenderTotalFee'), type: TYPE.DECIMAL},
  191. ];
  192. let rationNode = new CreateNode('定额信息表', attrs);
  193. ABillNode.children.push(rationNode);
  194. addRationGLJs(rData, rationNode);
  195. }
  196. }
  197. function recursiveAddBills(AItem, AXMLParent) {
  198. if (AItem == undefined || !calcTools.isBill(AItem)) return;
  199. let vBillNode;
  200. function addBillNode () {
  201. serialNo++;
  202. let zmh = (AItem.parent == vTree.roots[0]) ? getNum(AItem.data.name) : AItem.data.code;
  203. const attrs = [
  204. {name: "序号", value: AItem.row()}, //AItem.data.ID
  205. {name: "清单章节号", value: zmh},
  206. {name: "子目号", value: zmh},
  207. {name: "子目名称", value: AItem.data.name},
  208. {name: "单位", value: AItem.data.unit},
  209. {name: "数量", value: AItem.data.quantity, type: TYPE.DECIMAL}
  210. ];
  211. let dj = 0, hj = 0;
  212. if ((isBidSubmission || isControl) || (AItem.data.specialProvisional == '专业工程')){
  213. hj = CheckNull(AItem.data.feesIndex && AItem.data.feesIndex.common ? AItem.data.feesIndex.common.tenderTotalFee : 0);
  214. dj = hj;
  215. }
  216. attrs.push({name: "单价", value: dj}, {name: "合价", value: hj});
  217. attrs.push({name: "备注", value: isBidInvitation ? '' : AItem.data.remark});
  218. let sjlx;
  219. if (AItem.data.specialProvisional == '专业工程') // 专项暂定
  220. sjlx = 21;
  221. else {
  222. if (calcTools.isLeafBill(AItem)) {
  223. if (AItem.data.code == '102-3') // 安全生产费
  224. sjlx = '22'
  225. else if ((AItem.data.code == '-a') && (AItem.parent && (AItem.parent.data.code == '101-1'))) // 工程一切险
  226. sjlx = '23'
  227. else if ((AItem.data.code == '-b') && (AItem.parent && (AItem.parent.data.code == '101-1'))) // 第三者责任险
  228. sjlx = '24'
  229. else
  230. sjlx = '20';
  231. }
  232. else {
  233. sjlx = '1'; // 父清单
  234. attrs.find(function getE(e) {return e.name == '单位'}).value = '项';
  235. }
  236. }
  237. attrs.push({name: "数据类型", value: sjlx});
  238. if (isBidSubmission || isControl){
  239. attrs.push(
  240. {name: "人工费", value: getFee(AItem.data.fees, 'marketLabour.tenderTotalFee'), type: TYPE.DECIMAL},
  241. {name: "主材费", value: getFee(AItem.data.fees, 'marketMaterial.tenderTotalFee'), type: TYPE.DECIMAL},
  242. {name: "辅材费", value: 0},
  243. {name: "机械使用费", value: getFee(AItem.data.fees, 'marketMachine.tenderTotalFee'), type: TYPE.DECIMAL},
  244. {name: "设备费", value: 0},
  245. {name: "措施费1", value: getFee(AItem.data.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL},
  246. {name: "措施费2", value: 0}, // getFee(AItem.data.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL},
  247. {name: "企业管理费", value: getFee(AItem.data.fees, 'manage.tenderTotalFee'), type: TYPE.DECIMAL},
  248. {name: "规费", value: getFee(AItem.data.fees, 'force.tenderTotalFee'), type: TYPE.DECIMAL},
  249. {name: "利润", value: getFee(AItem.data.fees, 'profit.tenderTotalFee'), type: TYPE.DECIMAL},
  250. {name: "税金", value: getFee(AItem.data.fees, 'tax.tenderTotalFee'), type: TYPE.DECIMAL}
  251. );
  252. }
  253. vBillNode = new CreateNode('工程量清单明细', attrs);
  254. AXMLParent.children.push(vBillNode);
  255. if (calcTools.isLeafBill(AItem))
  256. addRations(AItem, vBillNode)
  257. }
  258. addBillNode();
  259. recursiveAddBills(AItem.children[0], vBillNode);
  260. recursiveAddBills(AItem.nextSibling, AXMLParent);
  261. }
  262. // 清单表
  263. function createGCLQDB(tenderData, gongCLQDB){
  264. vTree = tenderDetailMap[tenderData.ID].mainTree;
  265. serialNo = 0;
  266. recursiveAddBills(vTree.roots[0].children[0], gongCLQDB);
  267. };
  268. function createJiRGXXB(tenderData, jiRGXXB){
  269. let vJRG, vKind, vChild;
  270. let vJRGNode, vKindNode, vChildNode;
  271. vJRG = vTree.roots.find(function getElement(e) {return e.getFlag() == fixedFlag.DAYWORK_LABOR});
  272. let attrs = [
  273. { name: '序号', value: vJRG.row() },
  274. { name: '名称', value: vJRG.data.name },
  275. { name: '数据类型', value: 0 },
  276. { name: '合价', value: isBidInvitation ? 0 : ( vJRG.data.feesIndex && vJRG.data.feesIndex.common ? vJRG.data.feesIndex.common.tenderTotalFee : 0) },
  277. ];
  278. vJRGNode = new CreateNode('计日工信息标题', attrs);
  279. jiRGXXB.children.push(vJRGNode);
  280. function getDataType_JRG(name) {
  281. if (name.includes('劳务'))
  282. return 1
  283. else if (name.includes('材料'))
  284. return 2
  285. else if (name.includes('机械'))
  286. return 3
  287. else
  288. return 0;
  289. }
  290. for (let i = 0; i < vJRG.children.length; i++) {
  291. vKind = vJRG.children[i];
  292. let attrs = [
  293. { name: '序号', value: vKind.row() },
  294. { name: '名称', value: vKind.data.name },
  295. { name: '数据类型', value: getDataType_JRG(vKind.data.name) },
  296. { name: '合价', value: isBidInvitation ? 0 : (vKind.data.feesIndex && vKind.data.feesIndex.common ? vKind.data.feesIndex.common.tenderTotalFee : 0) },
  297. ];
  298. vKindNode = new CreateNode('计日工信息标题', attrs);
  299. jiRGXXB.children.push(vKindNode);
  300. for (let j = 0; j < vKind.children.length; i++) {
  301. vChild = vKind.children[j];
  302. let attrs = [
  303. { name: '编号', value: vChild.data.code },
  304. { name: '名称', value: vChild.data.name },
  305. { name: '数据类型', value: getDataType_JRG(vKind.data.name) + 3},
  306. { name: '单位', value: vChild.data.unit },
  307. { name: '暂定数量', value: vChild.data.quantity },
  308. { name: '单价', value: isBidInvitation ? 0 : (vChild.data.feesIndex && vChild.data.feesIndex.common ? vChild.data.feesIndex.common.tenderUnitFee : 0) },
  309. { name: '合价', value: isBidInvitation ? 0 : (vChild.data.feesIndex && vChild.data.feesIndex.common ? vChild.data.feesIndex.common.tenderTotalFee : 0) }
  310. ];
  311. vChildNode = new CreateNode('计日工信息明细', attrs);
  312. vKindNode.children.push(vChildNode);
  313. }
  314. }
  315. }
  316. // 生成标段工程
  317. function createGLBDGC(tenderData, gongLGCSJ, gongLGCHZ, Num){
  318. let attrs0 = [
  319. { name: '序号', value: Num },
  320. { name: '标段名称', value: tenderData.name },
  321. { name: '金额', value: projectData.summaryInfo[tenderData.ID].totalCost }
  322. ];
  323. const attrs1 = [{ name: '唯一标识-Guid', value: tenderData._id }]; // 公路标段工程
  324. const gongLBDGC = new CreateNode('公路标段工程', attrs0.concat(attrs1));
  325. gongLGCSJ.children.push(gongLBDGC);
  326. const gongCLQDB = new CreateNode('工程量清单表');
  327. const jiRGXXB = new CreateNode('计日工信息表');
  328. const ZaoJHZB = new CreateNode('造价汇总表');
  329. const RenCJHZ = new CreateNode('人材机汇总');
  330. gongLBDGC.children = [gongCLQDB, jiRGXXB, ZaoJHZB, RenCJHZ];
  331. createGCLQDB(tenderData, gongCLQDB);
  332. createJiRGXXB(tenderData, jiRGXXB);
  333. // createZaoJHZB(tenderData, ZaoJHZB);
  334. // createRenCJHZ(tenderData, RenCJHZ);
  335. // 同步生成 公路工程汇总明细 数据
  336. const attrs2 = [{ name: '备注', value: '' }];
  337. const gongLGCHZMX = new CreateNode('公路工程汇总明细', attrs0.concat(attrs2));
  338. gongLGCHZ.children.push(gongLGCHZMX);
  339. }
  340. // 组装主体框架数据
  341. function setupConstruction() {
  342. const information = projectData.property && projectData.property.basicInformation || [];
  343. const summaryInfo = projectData.summaryInfo[projectData.ID];
  344. const chiZGLGC = new CreateNode('池州公路工程');
  345. const gongCXX = new GongCXX(information); // 工程信息
  346. const zhaoTBXX = new CreateNode('招投标信息');
  347. const gongLGCSJ = new CreateNode('公路工程数据');
  348. chiZGLGC.children = [gongCXX, zhaoTBXX, gongLGCSJ];
  349. if (isBidInvitation)
  350. zhaoTBXX.children.push(new ZhaoBiaoXx(information));
  351. else if (isControl)
  352. zhaoTBXX.children.push(new ZhaoBiaoKzXx(information, summaryInfo.totalCost));
  353. else
  354. zhaoTBXX.children.push(new TouBiaoXx(information, summaryInfo.totalCost));
  355. const gongLGCHZ = new CreateNode('公路工程汇总');
  356. gongLGCSJ.children.push(gongLGCHZ);
  357. let n = 0;
  358. for (const tenderData of projectData.children) {
  359. n++;
  360. createGLBDGC(tenderData, gongLGCSJ, gongLGCHZ, n);
  361. }
  362. gongLGCSJ.children.push(gongLGCSJ.children.shift());
  363. const suffix = INTERFACE_CONFIG[areaKey]['fileSuffix'][exportKind];
  364. return [{
  365. data: chiZGLGC,
  366. exportKind,
  367. fileName: `${projectData.name}${suffix}`
  368. }];
  369. }
  370. return setupConstruction();
  371. }
  372. return {
  373. entry
  374. };
  375. })();