anhui_chizhou.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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].data;
  169. const attrs = [
  170. { name: '序号', value: i + 1},
  171. { name: '定额编号', value: r.code},
  172. { name: '定额名称', value: r.name},
  173. { name: '单位', value: r.unit},
  174. { name: '数量', value: r.tenderQuantity},
  175. { name: '单价', value: r.feesIndex && r.feesIndex.common ? r.feesIndex.common.tenderUnitFee : 0},
  176. { name: '合价', value: r.feesIndex && r.feesIndex.common ? r.feesIndex.common.tenderTotalFee : 0},
  177. { name: '备注', value: ''},
  178. { name: '数据类型', value: GetRationDataType(ABillItem.children[i])},
  179. { name: '人工费', value: getFee(r.fees, 'marketLabour.tenderTotalFee'), type: TYPE.DECIMAL},
  180. { name: '主材费', value: getFee(r.fees, 'marketMaterial.tenderTotalFee'), type: TYPE.DECIMAL},
  181. { name: '辅材费', value: 0},
  182. { name: '机械使用费', value: getFee(r.fees, 'marketMachine.tenderTotalFee'), type: TYPE.DECIMAL},
  183. { name: '设备费', value: 0},
  184. { name: '措施费1', value: getFee(r.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL}, // FQuery2.FieldByName('OtherDirectFee'},
  185. { name: '措施费2', value: 0}, //getFee(r.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL
  186. { name: '企业管理费', value: getFee(r.fees, 'manage.tenderTotalFee'), type: TYPE.DECIMAL},
  187. { name: '规费', value: getFee(r.fees, 'force.tenderTotalFee'), type: TYPE.DECIMAL},
  188. { name: '利润', value: getFee(r.fees, 'profit.tenderTotalFee'), type: TYPE.DECIMAL},
  189. { name: '税金', value: getFee(r.fees, 'tax.tenderTotalFee'), type: TYPE.DECIMAL},
  190. ];
  191. let rationNode = new CreateNode('定额信息表', attrs);
  192. ABillNode.children.push(rationNode);
  193. addRationGLJs(r, rationNode);
  194. }
  195. }
  196. function recursiveAddBills(AItem, AXMLParent) {
  197. if (AItem == undefined || !calcTools.isBill(AItem)) return;
  198. let vBillNode;
  199. function addBillNode () {
  200. serialNo++;
  201. let zmh = (AItem.parent == vTree.roots[0]) ? getNum(AItem.data.name) : AItem.data.code;
  202. const attrs = [
  203. {name: "序号", value: serialNo}, //AItem.data.ID
  204. {name: "清单章节号", value: zmh},
  205. {name: "子目号", value: zmh},
  206. {name: "子目名称", value: AItem.data.name},
  207. {name: "单位", value: AItem.data.unit},
  208. {name: "数量", value: AItem.data.quantity, type: TYPE.DECIMAL}
  209. ];
  210. let dj = 0, hj = 0;
  211. if ((isBidSubmission || isControl) || (AItem.data.specialProvisional == '专业工程')){
  212. hj = CheckNull(AItem.data.feesIndex && AItem.data.feesIndex.common ? AItem.data.feesIndex.common.tenderTotalFee : 0);
  213. dj = hj;
  214. }
  215. attrs.push({name: "单价", value: dj}, {name: "合价", value: hj});
  216. attrs.push({name: "备注", value: isBidInvitation ? '' : AItem.data.remark});
  217. let sjlx;
  218. if (AItem.data.specialProvisional == '专业工程') // 专项暂定
  219. sjlx = 21;
  220. else {
  221. if (calcTools.isLeafBill(AItem)) {
  222. if (AItem.data.code == '102-3') // 安全生产费
  223. sjlx = '22'
  224. else if ((AItem.data.code == '-a') && (AItem.parent && (AItem.parent.data.code == '101-1'))) // 工程一切险
  225. sjlx = '23'
  226. else if ((AItem.data.code == '-b') && (AItem.parent && (AItem.parent.data.code == '101-1'))) // 第三者责任险
  227. sjlx = '24'
  228. else
  229. sjlx = '20';
  230. }
  231. else {
  232. sjlx = '1'; // 父清单
  233. attrs.find(function getE(e) {return e.name == '单位'}).value = '项';
  234. }
  235. }
  236. attrs.push({name: "数据类型", value: sjlx});
  237. if (isBidSubmission || isControl){
  238. attrs.push(
  239. {name: "人工费", value: getFee(AItem.data.fees, 'marketLabour.tenderTotalFee'), type: TYPE.DECIMAL},
  240. {name: "主材费", value: getFee(AItem.data.fees, 'marketMaterial.tenderTotalFee'), type: TYPE.DECIMAL},
  241. {name: "辅材费", value: 0},
  242. {name: "机械使用费", value: getFee(AItem.data.fees, 'marketMachine.tenderTotalFee'), type: TYPE.DECIMAL},
  243. {name: "设备费", value: 0},
  244. {name: "措施费1", value: getFee(AItem.data.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL},
  245. {name: "措施费2", value: 0}, // getFee(AItem.data.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL},
  246. {name: "企业管理费", value: getFee(AItem.data.fees, 'manage.tenderTotalFee'), type: TYPE.DECIMAL},
  247. {name: "规费", value: getFee(AItem.data.fees, 'force.tenderTotalFee'), type: TYPE.DECIMAL},
  248. {name: "利润", value: getFee(AItem.data.fees, 'profit.tenderTotalFee'), type: TYPE.DECIMAL},
  249. {name: "税金", value: getFee(AItem.data.fees, 'tax.tenderTotalFee'), type: TYPE.DECIMAL}
  250. );
  251. }
  252. vBillNode = new CreateNode('工程量清单明细', attrs);
  253. AXMLParent.children.push(vBillNode);
  254. if (calcTools.isLeafBill(AItem))
  255. addRations(AItem, vBillNode)
  256. }
  257. addBillNode();
  258. recursiveAddBills(AItem.children[0], vBillNode);
  259. recursiveAddBills(AItem.nextSibling, AXMLParent);
  260. }
  261. // 清单表
  262. function createGCLQDB(tenderData, gongCLQDB){
  263. vTree = tenderDetailMap[tenderData.ID].mainTree;
  264. serialNo = 0;
  265. recursiveAddBills(vTree.roots[0].children[0], gongCLQDB);
  266. };
  267. // 生成标段工程
  268. function createGLBDGC(tenderData, gongLGCSJ, gongLGCHZ, Num){
  269. let attrs0 = [
  270. { name: '序号', value: Num },
  271. { name: '标段名称', value: tenderData.name },
  272. { name: '金额', value: projectData.summaryInfo[tenderData.ID].totalCost }
  273. ];
  274. const attrs1 = [{ name: '唯一标识-Guid', value: tenderData._id }]; // 公路标段工程
  275. const gongLBDGC = new CreateNode('公路标段工程', attrs0.concat(attrs1));
  276. gongLGCSJ.children.push(gongLBDGC);
  277. const gongCLQDB = new CreateNode('工程量清单表');
  278. const jiRGXXB = new CreateNode('计日工信息表');
  279. const ZaoJHZB = new CreateNode('造价汇总表');
  280. const RenCJHZ = new CreateNode('人材机汇总');
  281. gongLBDGC.children = [gongCLQDB, jiRGXXB, ZaoJHZB, RenCJHZ];
  282. createGCLQDB(tenderData, gongCLQDB);
  283. // createJiRGXXB(jiRGXXB);
  284. // 同步生成 公路工程汇总明细 数据
  285. const attrs2 = [{ name: '备注', value: '' }];
  286. const gongLGCHZMX = new CreateNode('公路工程汇总明细', attrs0.concat(attrs2));
  287. gongLGCHZ.children.push(gongLGCHZMX);
  288. }
  289. // 组装主体框架数据
  290. function setupConstruction() {
  291. const information = projectData.property && projectData.property.basicInformation || [];
  292. const summaryInfo = projectData.summaryInfo[projectData.ID];
  293. const chiZGLGC = new CreateNode('池州公路工程');
  294. const gongCXX = new GongCXX(information); // 工程信息
  295. const zhaoTBXX = new CreateNode('招投标信息');
  296. const gongLGCSJ = new CreateNode('公路工程数据');
  297. chiZGLGC.children = [gongCXX, zhaoTBXX, gongLGCSJ];
  298. if (isBidInvitation)
  299. zhaoTBXX.children.push(new ZhaoBiaoXx(information));
  300. else if (isControl)
  301. zhaoTBXX.children.push(new ZhaoBiaoKzXx(information, summaryInfo.totalCost));
  302. else
  303. zhaoTBXX.children.push(new TouBiaoXx(information, summaryInfo.totalCost));
  304. const gongLGCHZ = new CreateNode('公路工程汇总');
  305. gongLGCSJ.children.push(gongLGCHZ);
  306. let n = 0;
  307. for (const tenderData of projectData.children) {
  308. n++;
  309. createGLBDGC(tenderData, gongLGCSJ, gongLGCHZ, n);
  310. }
  311. gongLGCSJ.children.push(gongLGCSJ.children.shift());
  312. const suffix = INTERFACE_CONFIG[areaKey]['fileSuffix'][exportKind];
  313. return [{
  314. data: chiZGLGC,
  315. exportKind,
  316. fileName: `${projectData.name}${suffix}`
  317. }];
  318. }
  319. return setupConstruction();
  320. }
  321. return {
  322. entry
  323. };
  324. })();