| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835 |
- // INTERFACE_EXPORT =,必须这么写,这样才能在导出时动态加载脚本后,覆盖前端代码
- // 参考广东中山导出接口
- INTERFACE_EXPORT = (() => {
- "use strict";
- const feeRateMap = {
- 冬季施工增加费: "DJSGZJFFL",
- 冬季施工: "DJSGZJFFL",
- 雨季施工增加费: "YUJSGZJFFL",
- 雨季施工: "YUJSGZJFFL",
- 夜间施工增加费: "YEJSGZJFFL",
- 夜间施工: "YEJSGZJFFL",
- 高原地区施工增加费: "GYDQSGZJFFL",
- 高原施工: "GYDQSGZJFFL",
- 风沙地区施工增加费: "FSDQSGZJFFL",
- 风沙施工: "FSDQSGZJFFL",
- 沿海地区施工增加费: "YHDQSGZJFFL",
- 沿海施工: "YHDQSGZJFFL",
- 行车干扰施工增加费: "XCGRGCSGZJFFL",
- 行车干扰: "XCGRGCSGZJFFL",
- 工地转移费: "GDZYFFL",
- '工地转移(km)': "GDZYFFL",
- 施工辅助费: "SGFZFFL",
- 施工辅助: "SGFZFFL",
- 基本费用: "JBFYFL",
- 主副食运费补贴: "ZFSYFBTFL",
- '综合里程(km)': "ZFSYFBTFL",
- 职工探亲路费: "ZGTQLFFL",
- 职工探亲: "ZGTQLFFL",
- 职工取暖补贴: "ZGQNBTFL",
- 职工取暖: "ZGQNBTFL",
- 财务费用: "CWFYFL",
- 养老保险费: "YANGLBXFFL",
- 失业保险费: "SYBXFFL",
- 医疗保险费: "YILBXFFL",
- 工伤保险费: "GSBXFL",
- 养老保险: "YANGLBXFFL",
- 失业保险: "SYBXFFL",
- 医疗保险: "YILBXFFL",
- 工伤保险: "GSBXFL",
- 住房公积金: "ZFGJJFL",
- 规费: "GFZHFL",
- 利润: "LRL",
- 税金: "SL",
- 土方: "TF",
- 石方: "SF",
- 运输: "YS",
- 路面: "LM",
- "路面(不计雨)": "LM",
- 隧道: "SD",
- 构造物I: "GZW1",
- "构造物I(不计冬)": "GZW1",
- "构造物I(不计雨)": "GZW1",
- 构造物II: "GZW2",
- "构造物III(桥梁)": "GZW3",
- "构造物III(除桥以外)": "GZW3",
- "构造物III(除桥以外不计雨夜)": "GZW3",
- 技术复杂大桥: "JSFZDQ",
- "钢材及钢结构(桥梁)": "GJG",
- "钢材及钢结构(除桥以外)": "GJG",
- "钢材及钢结构(除桥以外不计夜)": "GJG",
- };
- //计算程序有,这里没有:施工机械使用费\施工机械人工费\定额人工费\定额材料费\定额施工机械使用费
- const itemFeeMap = {
- 'marketLabour': 'RGF',
- 'marketMaterial': 'CLF',
- 'marketMachine': 'JXSYF',
- 'marketEquipment': 'SBGZF',
- 'direct': 'DEZJF',
- 'equipment': 'DESBF',
- 'marketDirect': 'ZJF',
- 'measure': 'CSF',
- 'measure1': 'CSF1',
- 'measure2': 'CSF2',
- 'manage': 'QYGLF',
- 'force': 'GF',
- 'profit': 'LR',
- 'tax': 'SJ',
- 'common': 'JAF',
- 'rationCommon': 'DEJAF'
- };
- const feeLibNoMap = {
- 'eba0e7c0-cfe6-11ea-ba15-739be477d1fe': 'GYSFL-000000-2018-86',
- '451d3180-e02e-11ea-8056-1514dfc2f39e': 'GYSFL-340000-2019-210',
- '32923ff0-e912-11ea-8b20-d93bc370e960': 'GYSFL-440000-2019-544'
- };
- const FixedCostMap = {
- //折旧费、检修费、维护费、安拆辅助费
- '折旧费': 1,
- '检修费': 1,
- '维护费': 1,
- '安拆辅助费': 1
- }
- const RoadGradeMap = {
- "高速公路": "0",
- "一级公路": "1",
- "二级公路": "2",
- "三级公路": "3",
- "四级公路": "4",
- "等外公路": "5",
- "独立桥梁": "6",
- "独立隧道": "7"
- }
- const sectionNameMap = {
- "清单第100章总则": true,
- "清单第200章路基": true,
- "清单第300章路面": true,
- "清单第400章桥梁、涵洞": true,
- "清单第500章隧道": true,
- "清单第600章安全设施及预埋管线": true,
- "清单第700章绿化及环境保护设施": true,
- // "清单 第800章 机电工程": true,
- // "清单 第900章 附属区房建工程":true
- }
- const ListCodeMap = {
- "第100章至700章清单": "1",
- // "清单 第100章 总则": "一",
- // "清单 第200章 路基": "二",
- // "清单 第300章 路面": "三",
- // "清单 第400章 桥梁、涵洞": "四",
- // "清单 第500章 隧道": "五",
- // "清单 第600章 安全设施及预埋管线": "六",
- // "清单 第700章 绿化及环境保护设施": "七",
- // "清单 第800章 机电工程": "八",
- // "清单 第900章 附属区房建工程": "九",
- "清单第100章总则": "100",
- "清单第200章路基": "200",
- "清单第300章路面": "300",
- "清单第400章桥梁、涵洞": "400",
- "清单第500章隧道": "500",
- "清单第600章安全设施及预埋管线": "600",
- "清单第700章绿化及环境保护设施": "700",
- "已包含在清单合计中的材料、工程设备、专业工程暂估价合计": "13",
- "清单合计减去材料、工程设备、专业工程暂估价合计": "14",
- "计日工合计": "15",
- "劳务": "15.1",
- "材料": "15.2",
- "机械": "15.3",
- "暂列金额(不含计日工总额)": "16",
- "投标报价": "17"
- }
- const ratioCodeMap = {
- "01ZJF": "0",
- "02JXF": "1",
- "03WHF": "2",
- "04ACFZF": "3"
- }
- const reg1 = new RegExp('\n', 'g'), reg2 = new RegExp('\r', 'g')
- , reg3 = new RegExp(' ', 'g'), reg4 = new RegExp('\t', 'g')
- , reg5 = new RegExp('(', 'g'), reg6 = new RegExp(')', 'g')
- , regRt1 = new RegExp('\n\r', 'g'), regRt2 = new RegExp('\r\n', 'g')
- ;
- function getBasePrice(projectGLJID, tenderProject) {
- let glj = _.find(tenderProject.projectGLJ.datas.gljList, {
- id: projectGLJID
- })
- return glj ? gljUtil.getBasePrice(glj, null, null, null, decimalObj, false, _, scMathUtil) : 0;
- }
- function getFeeRate(programID, fieldName, tenderProject) {
- let rate = 0;
- let template = tenderProject.calcProgram.compiledTemplates;
- if (template[programID]) {
- let item = _.find(template[programID].calcItems, {
- fieldName: fieldName
- })
- if (item) rate = item.feeRate;
- }
- return rate;
- }
- function _billStrFilter(billStr) {
- let rst = billStr;
- if (typeof billStr === 'string') {
- rst = billStr.replace(reg1, '').replace(reg2, '').replace(reg3, '').replace(reg4, '').replace(reg5, '(').replace(reg6, ')');
- }
- return rst;
- }
- function _chkAdhocChapterBillCode(billStr) {
- let rst = false;
- rst = (typeof billStr === 'string' &&
- (billStr.indexOf('800章') >= 0 || billStr.indexOf('900章') >= 0 || billStr.indexOf('1000章') >= 0 || billStr.indexOf('1100章') >= 0 || billStr.indexOf('1200章') >= 0)
- )
- return rst;
- }
- function _extractAdhocChapter(billStr) {
- let rst = '';
- if (typeof billStr === 'string') {
- if (billStr.indexOf('800章') >= 0) {
- rst = '800';
- } else if (billStr.indexOf('900章') >= 0) {
- rst = '900';
- } else if (billStr.indexOf('1000章') >= 0) {
- rst = '1000';
- } else if (billStr.indexOf('1100章') >= 0) {
- rst = '1100';
- } else if (billStr.indexOf('1200章') >= 0) {
- rst = '1200';
- }
- }
- return rst;
- }
- function billNameChecking(bNode, projectName, fixedFlag) {
- let data = bNode.data;
- let fail = null;
- let pass = true;
- if (data.flagsIndex && data.flagsIndex.fixed) {
- let flag = data.flagsIndex.fixed.flag;
- switch (flag) {
- case fixedFlag.ONE_SEVEN_BILLS:
- // pass = data.name == "第100章至700章清单" || data.name == "第100章至700章清单合计";
- pass = typeof data.name === 'string' && data.name.includes('第100章至');
- break;
- case fixedFlag.PROVISIONAL_TOTAL:
- pass = data.name == "已包含在清单合计中的材料、工程设备、专业工程暂估价合计";
- break;
- case fixedFlag.BILLS_TOTAL_WT_PROV:
- pass = data.name == "清单合计减去材料、工程设备、专业工程暂估价合计";
- break;
- case fixedFlag.DAYWORK_LABOR:
- pass = data.name == "计日工合计";
- break;
- /* case fixedFlag.LABOUR_SERVICE:
- pass = data.name == "劳务";
- break;
- case fixedFlag.MATERIAL:
- pass = data.name == "材料";
- break;
- case fixedFlag.CONSTRUCTION_MACHINE:
- pass = data.name == "机械";
- break; */
- case fixedFlag.PROVISIONAL:
- pass = data.name == "暂列金额(不含计日工总额)";
- break;
- case fixedFlag.TOTAL_COST:
- pass = data.name == "投标报价";
- break;
- case fixedFlag.ONE_HUNDRED_BILLS:
- // pass = data.name == "清单 第100章 总则";
- pass = _billStrFilter(data.name) == "清单第100章总则";
- break;
- }
- } else {
- if (bNode.parent) {
- const pdata = bNode.parent.data;
- if (pdata.flagsIndex && pdata.flagsIndex.fixed && pdata.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) {
- if (!sectionNameMap[_billStrFilter(data.name)]) {
- pass = _chkAdhocChapterBillCode(data.name);
- }
- }
- }
- }
- // if(pass == false)fail = { hint: `清单:"${data.name?data.name:""}",名字不符合规范!`, type: projectName } // 不检测了,有问题不管,2022-12-28与潘林QQ中立贴为证
- return fail;
- }
- /**
- *
- * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
- * @param {Number} exportKind - 导出类型,招标、投标、控制价
- * @param {Object} projectData - 项目表数据:{ 建设项目Data, children: [单位工程...] }
- * @param {Object} tenderDetailMap - 单位工程ID与getData接口数据(projectObj.project的结构)的映射。
- * @return {Promise<Array>} - 返回的数据结构必须按照规定:[{ data, exportKind, fileName }],参考web\building_saas\standard_interface\index.js中的注释说明
- */
- async function entry(areaKey, exportKind, projectData, tenderDetailMap) {
- const {
- CONFIG: {
- TYPE
- },
- UTIL,
- Element
- } = INTERFACE_EXPORT_BASE;
- const {
- isGLYun
- } = window.commonUtil;
- const {
- EXPORT_KIND: {
- BID_INVITATION,
- BID_SUBMISSION,
- CONTROL
- },
- fixedFlag,
- } = window.commonConstants;
- let cprjType = {
- 1: "GCLQD", // 招标
- 2: "TBBJ", // 投标
- 3: "ZBKZJ", // 控制价
- }; // 默认是公路云的
- if (!isGLYun()) {
- // 养护云
- cprjType[1] = 'YHGCLQD';
- cprjType[2] = 'YHTBBJ';
- cprjType[3] = 'YHZBKZJ';
- }
- const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
- const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
- const isControl = exportKind === CONTROL; // 是否是控制价
- function emptyElement(name) {
- this.name = name;
- this.attrs = [];
- this.children = [];
- }
- // 建设项目根节点信息
- function CprjInfo(projectName) {
- const attrs = [{
- name: "CprjName",
- value: projectName,
- },
- {
- name: "CprjType",
- value: cprjType[exportKind],
- },
- ];
- Element.call(this, "CprjInfo", attrs);
- }
- // 项目基本信息
- function SystemInfo(projectData) {
- let baseInfo = _.find(projectData.property.basicInformation, {
- dispName: "基本信息",
- });
- //“招标工程量清单”、“招标控制价”时,输出该字段,为导出该文件的当前时间
- let makeData = {
- value: UTIL.getNowFormatTime(true)
- }
- //投标的时候取基本信息的makeData字段
- // if (isBidSubmission) makeData = _.find(baseInfo.items, { "key": "makeDate" });
- // 山东需求调整,取当前时间
- // 取编制软件序列号所属单位。读取项目属性-建设项目基本信息的“投标单位”字段。该字段需要模板中新增。等确定后再修改
- // let softwareNumHolder = _.find(baseInfo.items, { "key": "bidderName" });
- let softwareNumHolder = userCompany; // userCompany是在main界面上已经有现成的(类似userAccount, userID)
- let hardID = UTIL.generateHardwareId();
- let [cpuId, diskId, macId] = hardID.split(";");
- // const orgScretInfoStr = `SoftwareName=纵横公路工程造价管理软件,SoftwareVer=V${VERSION},SoftwareCompany=珠海纵横创新软件有限公司,SoftwareNumber=${userID},HardNumber=${diskId},MacAddress=${macId},SoftwareNumberHolder=${softwareNumHolder}`
- const orgScretInfoStr = `SoftwareName=纵横公路工程造价管理软件,SoftwareVer=V${VERSION},SoftwareCompany=珠海纵横创新软件有限公司,SoftwareNumber=${window.btoa(userID)},HardNumber=${window.btoa(diskId)},MacAddress=${window.btoa(macId)},SoftwareNumberHolder=${softwareNumHolder}`
- let scretInfo = sm3Digest(orgScretInfoStr);
- const attrs = [{
- name: "Name",
- value: "公路工程造价数据标准",
- },
- {
- name: "Version",
- value: "1.0",
- },
- {
- name: "SoftwareName",
- value: "纵横公路工程造价管理软件",
- },
- {
- name: "SoftwareVer",
- value: "V" + VERSION,
- },
- {
- name: "SoftwareCompany",
- value: "珠海纵横创新软件有限公司",
- },
- {
- name: "MakeDate",
- value: makeData ? makeData.value : "",
- },
- {
- name: "SoftwareNumber",
- value: window.btoa(userID),
- },
- {
- name: "HardNumber",
- value: window.btoa(diskId),
- },
- {
- name: "MacAddress",
- value: window.btoa(macId),
- },
- {
- name: "SoftwareNumberHolder",
- value: softwareNumHolder,
- },
- {
- name: "SecretInfo",
- value: scretInfo,
- },
- ];
- Element.call(this, "SystemInfo", attrs);
- }
- //造价依据
- function CostBasis() {
- // ItemStandardNo="GYSFX-000000-2018-86"
- const attrs = [{
- name: "MakeRuleNo",
- value: "GYSBB-000000-2018-86",
- },
- {
- name: "MakeRuleName",
- value: "公路工程建设项目概算预算编制办法",
- },
- {
- name: "ItemStandardNo",
- value: "GYSFX-000000-2018-86",
- },
- ];
- Element.call(this, "CostBasis", attrs);
- //定额库信息
- //to do 改成实际的值
- function NormLib() {
- const attrs = [{
- name: "NormLibNo",
- value: "YSDE-000000-2018-86",
- },
- {
- name: "NormLibName",
- value: "部颁公路工程预算定额(2018)",
- },
- {
- name: "Type",
- value: "ZDEK",
- },
- ];
- Element.call(this, "NormLib", attrs);
- }
- this.children.push(new NormLib());
- }
- function Rate(tenderProject, feeRateInfo, seirNo) {
- //RateNo="1" Name="纵横软件测试版本" RateLibNo="GYSFL-000000-2018-86"
- const attrs = [{
- name: "RateNo",
- value: seirNo,
- },
- {
- name: "Name",
- value: feeRateInfo.name,
- },
- {
- name: "RateLibNo",
- value: feeLibNoMap[feeRateInfo.libID],
- },
- ];
- Element.call(this, "Rate", attrs);
- let RateParams = new emptyElement("RateParams");
- let subRates = projectObj.project.FeeRate.getAllSubRates(feeRateInfo.rates);
- for (let s of subRates) {
- let sname = s.name.replace("(%)", "");
- sname = sname.replace("(%)", "");
- if (feeRateMap[sname]) {
- let value = "";
- if (s.editable) {
- let sel = _.find(s.optionList, {
- selected: true,
- });
- if (sel) {
- value = sel.name;
- } else if (gljUtil.isDef(s.value)) {
- value = s.value;
- }
- } else {
- value = _.findIndex(s.optionList, {
- selected: true,
- });
- if (value == -1) value = 0;
- }
- /* if (sname == '利润') tenderProject.ProfitRate = value;
- if (sname == '税金') tenderProject.TaxRate = value; */
- RateParams.children.push(new RateParam(feeRateMap[sname], value));
- }
- }
- this.children.push(RateParams);
- function RateParam(RateTypeNo, RateParamNo) {
- //<RateParam RateTypeNo="DJSGZJFFL" RateParamNo="0" Ratio="100"/>
- const attrs = [{
- name: "RateTypeNo",
- value: RateTypeNo,
- },
- {
- name: "RateParamNo",
- value: RateParamNo,
- },
- {
- name: "Ratio",
- value: "100",
- },
- ];
- Element.call(this, "RateParam", attrs);
- }
- let RateValues = new emptyElement("RateValues");
- function RateValue(CostTypeNo, RateTypeNo, value) {
- const attrs = [{
- name: "CostTypeNo",
- value: CostTypeNo,
- },
- {
- name: "RateTypeNo",
- value: RateTypeNo,
- },
- {
- name: "RateValue",
- value: value,
- },
- ];
- Element.call(this, "RateValue", attrs);
- }
- let prefix = "";
- for (let r of feeRateInfo.rates) {
- if (!r.ParentID && feeRateMap[r.name]) prefix = feeRateMap[r.name];
- if (feeRateMap[r.name] && r.ParentID) {
- RateValues.children.push(new RateValue(prefix, feeRateMap[r.name], r.rate));
- }
- }
- this.children.push(RateValues);
- }
- function Pract(tpdata, seriNo) {
- let pgljData = tpdata.projectGLJ.datas;
- let decimalObj = tpdata.property.decimal;
- const attrs = [{
- name: "PractNo",
- value: seriNo,
- },
- {
- name: "Name",
- value: pgljData.constData.usedUnitPriceInfo.name,
- },
- ];
- Element.call(this, "Pract", attrs);
- let Param = {
- name: "Param",
- attrs: [{
- name: "TaxLibNo",
- value: "CCSBZ-440000-2019-544",
- },
- {
- name: "AuxRate",
- value: pgljData.constData.assistProductionFeeRate,
- },
- ],
- children: [],
- };
- if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
- let elecDatas = electrovalenceObj.getElectrovalenceDatas(null, pgljData.com_electrovalence, pgljData.gljList);
- electrovalenceObj.calcPertElectrovalenceMarketPrice(elecDatas);
- for (let e of elecDatas) {
- let Electro = {
- name: "Electro",
- attrs: [{
- name: "Code",
- value: e.code,
- },
- {
- name: "Price",
- value: e.electPrice,
- },
- {
- name: "Ratio",
- value: e.coe,
- },
- ],
- children: [],
- };
- Param.children.push(Electro);
- }
- }
- this.children.push(Param);
- function Mp(g) {
- const attrs = [{
- name: "Code",
- value: g.code,
- },
- {
- name: "PractName",
- value: g.name,
- },
- {
- name: "Spec",
- value: g.specs,
- },
- {
- name: "Unit",
- value: g.unit,
- },
- {
- name: "BudgetPrice",
- value: g.priceInfo.tenderPrice,
- },
- {
- name: "NormPrice",
- value: g.priceInfo.basePrice,
- },
- {
- name: "IsAdd",
- value: g.unit_price.is_add,
- },
- ];
- Element.call(this, "Mp", attrs);
- }
- function Material(g) {
- const attrs = [{
- name: "Code",
- value: g.code,
- },
- {
- name: "PractName",
- value: g.name,
- },
- {
- name: "Spec",
- value: g.specs,
- },
- {
- name: "Unit",
- value: g.unit,
- },
- {
- name: "BudgetPrice",
- value: g.priceInfo.tenderPrice,
- },
- {
- name: "NormPrice",
- value: g.priceInfo.basePrice,
- },
- {
- name: "IsAdd",
- value: g.unit_price.is_add,
- },
- {
- name: "OrgPrice",
- value: g.unit_price.originalPrice ? g.unit_price.originalPrice : 0,
- },
- {
- name: "TransFee",
- value: g.unit_price.unitFreight ? g.unit_price.unitFreight : 0,
- },
- {
- name: "GwRate",
- value: g.unit_price.grossWeightCoe_n ? g.unit_price.grossWeightCoe_n : 0,
- },
- {
- name: "OffSiteLf",
- value: g.unit_price.offSiteTransportLossRate_n ? g.unit_price.offSiteTransportLossRate_n : 0,
- },
- {
- name: "OnSiteLf",
- value: 0,
- },
- {
- name: "LoadLf",
- value: g.unit_price.handlingLossRate_n ? g.unit_price.handlingLossRate_n : 0,
- },
- {
- name: "StoreRate",
- value: g.unit_price.purchaseStorageRate_n ? g.unit_price.purchaseStorageRate_n : 0,
- },
- {
- name: "PackageRecycleFee",
- value: g.unit_price.packageRecoverValue ? g.unit_price.packageRecoverValue : 0,
- },
- ];
- Element.call(this, "Material", attrs);
- // if (g.unit_price.calcMaterial == 1) { //有材料计算
- // let index = gljUtil.getIndex(g);
- // let orList = [];
- // for (let o of pgljData.originalList) {
- // if (o.connect_key == index) orList.push(new OrgPrices(o));
- // }
- // if (orList.length > 0) this.children = orList;
- // }
- function CostStructure(r) {
- //待获取
- this.name = "CostStructure";
- this.attrs = [];
- this.children = [];
- }
- function Consume(r, o) {
- this.name = "Consume";
- this.attrs = [];
- this.children = [];
- for (let g of o.ration_gljs) {
- if (g.rationID == r.ID) {
- let r_quantity = scMathUtil.roundForObj(r.quantity, tpdata.property.decimal.ration.quantity);
- this.children.push(new ConsumeItem(g, r_quantity));
- }
- }
- }
- function ConsumeItem(g, ration_quantity) {
- const attrs = [{
- name: "Code", //待获取
- value: g.code,
- },
- {
- name: "Consumption",
- value: scMathUtil.roundForObj(ration_quantity * parseFloat(g.quantity), tpdata.property.decimal.glj.quantity),
- },
- ];
- Element.call(this, "ConsumeItem", attrs);
- }
- function Norm(r, o) {
- const attrs = [{
- name: "NormLibNo", //待获取
- value: "",
- },
- {
- name: "DisplayCode",
- value: r.code,
- },
- {
- name: "Name",
- value: r.name,
- },
- {
- name: "Unit",
- value: r.unit,
- },
- {
- name: "Num",
- value: r.quantity,
- },
- {
- name: "CostTypeNo",
- value: "", //待获取
- },
- {
- name: "FabricationCost", //待获取
- value: "",
- },
- {
- name: "AdjustStatus",
- value: "",
- },
- ];
- Element.call(this, "Norm", attrs);
- this.children.push(new CostStructure(r));
- this.children.push(new Consume(r, o));
- }
- function SelfCollect(o) {
- const attrs = [{
- name: "OtherCost",
- value: 0,
- },];
- Element.call(this, "SelfCollect", attrs);
- for (let r of o.rations) {
- this.children.push(new Norm(r, o));
- }
- }
- function OrgPrices(o) {
- const attrs = [{
- name: "OrgPricevalue",
- value: o.supplyPrice,
- },
- {
- name: "Ratio",
- value: o.coe,
- },
- ];
- Element.call(this, "OrgPrices", attrs);
- if (!o.rations) return;
- this.children.push(new SelfCollect(o));
- }
- }
- function Mech(g, gljKeyMap) {
- const attrs = [{
- name: "Code",
- value: g.code,
- },
- {
- name: "PractName",
- value: g.name,
- },
- {
- name: "Spec",
- value: g.specs,
- },
- {
- name: "Unit",
- value: g.unit,
- },
- {
- name: "BudgetPrice",
- value: g.priceInfo.tenderPrice,
- },
- {
- name: "NormPrice",
- value: g.priceInfo.basePrice,
- },
- {
- name: "IsAdd",
- value: g.unit_price.is_add,
- },
- ];
- Element.call(this, "Mech", attrs);
- let FixedCostItems = [];
- let fcsum = 0;
- let VariableCostItems = [];
- let vcsum = 0;
- if (g.ratio_data && g.ratio_data.length > 0) {
- for (let ratio of g.ratio_data) {
- let rIndex = gljUtil.getIndex(ratio);
- let rglj = gljKeyMap[rIndex];
- let ts = scMathUtil.roundForObj(parseFloat(ratio.consumption) * rglj.priceInfo.tenderPrice, decimalObj.glj.unitPrice);
- if (FixedCostMap[ratio.name]) {
- FixedCostItems.push(new FixedCostItem(ratio));
- fcsum = scMathUtil.roundForObj(fcsum + ts, decimalObj.glj.unitPrice);
- } else {
- VariableCostItems.push(new VariableCostItem(ratio));
- vcsum = scMathUtil.roundForObj(vcsum + ts, decimalObj.glj.unitPrice);
- }
- }
- }
- if (FixedCostItems.length > 0) {
- let fc = new FixedCost(fcsum);
- fc.children = FixedCostItems;
- this.children.push(fc);
- }
- if (VariableCostItems.length > 0) {
- let vc = new VariableCost(vcsum);
- vc.children = VariableCostItems;
- this.children.push(vc);
- }
- function VariableCost(sum) {
- const attrs = [{
- name: "VariableCostSum",
- value: sum,
- }];
- Element.call(this, "VariableCost", attrs);
- }
- function VariableCostItem(item) {
- const attrs = [{
- name: "VariableCostNo",
- value: item.code,
- }, {
- name: "Consumption",
- value: item.consumption,
- }]
- Element.call(this, "VariableCostItem", attrs);
- }
- function FixedCost(sum) {
- const attrs = [{
- name: "FixedCostSum",
- value: sum,
- }, {
- name: "FixedRate",
- value: 1,
- }];
- Element.call(this, "FixedCost", attrs);
- }
- function FixedCostItem(item) {
- const attrs = [{
- name: "FixedCostNo",
- value: ratioCodeMap[item.code],
- }, {
- name: "Sum",
- value: item.consumption,
- }]
- Element.call(this, "FixedCostItem", attrs);
- }
- }
- let Mps = new emptyElement("Mps");
- let Materials = new emptyElement("Materials");
- let Mechs = new emptyElement("Mechs");
- let gljKeyMap = {};
- let temMechs = [];
- if (isBidSubmission || isControl) { //导出到招标文件中,不输出这一部分。
- for (let g of pgljData.gljList) {
- if (!g.quantity) {
- continue;
- }
- let type = g.type + "";
- gljKeyMap[gljUtil.getIndex(g)] = g;
- type = type.charAt(0);
- if (type == "1") {
- Mps.children.push(new Mp(g));
- } else if (type == "2" || type == 5) {
- Materials.children.push(new Material(g));
- } else if (type == "3") {
- temMechs.push(g);
- }
- }
- for (let t of temMechs) {
- Mechs.children.push(new Mech(t, gljKeyMap));
- }
- }
- this.children.push(Mps);
- this.children.push(Materials);
- this.children.push(Mechs);
- }
- function EprjInfo(tenderProject) {
- let bills = tenderProject.Bills.datas;
- let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
- let totalItem = null;
- let proItem = null; //暂列金额项
- let safeItem = null;
- let oneToSevenItem = null;
- for (let b of bills) {
- if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.TOTAL_COST) totalItem = b;
- if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.PROVISIONAL) proItem = b;
- if (b.flagsIndex && b.flagsIndex.fixed && b.flagsIndex.fixed.flag == fixedFlag.ONE_SEVEN_BILLS) oneToSevenItem = b;
- if (b.code == "102-3" && b.name == "安全生产费") safeItem = b;
- }
- const attrs = [{
- name: "Name",
- value: tenderProject.projectInfo.name,
- },
- {
- name: "Sums",
- value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
- },
- ];
- //输出控制价、投标文件时,取调价后的标段总造价。
- //输出招标文件时,取0
- if (isBidInvitation) attrs[1].value = 0;
- Element.call(this, "EprjInfo", attrs);
- this.children.push(new SummaryOfCost(totalItem, proItem, safeItem, oneToSevenItem, feature));
- this.children.push(new MakeInfo(tenderProject));
- this.children.push(new Params(tenderProject));
- const cacheForFormula = _preCodeingForBills(tenderProject);
- this.children.push(new getBillsItems(tenderProject, cacheForFormula));
- this.children.push(new getIndexs(tenderProject));
- let bidEvaluationMainMaterials = getBidEvaluationMainMaterial(tenderProject);
- if (bidEvaluationMainMaterials.length > 0) this.children.push(...bidEvaluationMainMaterials);
- //山东接口还需要增加几个表的数据(就是把原报表的显示数据转到投标文件里)
- // 1. 投标报价汇总表
- this.children.push(new quoteSummary(tenderProject));
- // 2. 计日工表
- let spdw = sporadicWork(tenderProject);
- if (spdw) {
- this.children.push(spdw);
- }
- // 3. 材料暂估价表
- let estMaterialRpt = materialEstimate(tenderProject);
- if (estMaterialRpt) {
- this.children.push(estMaterialRpt);
- }
- // 4. 工程设备暂估价表
- let estMachineRpt = getMachineTempEst(tenderProject);
- if (estMachineRpt) {
- this.children.push(estMachineRpt);
- }
- // 5. 专业工程暂估价表
- let estSpecPrjRpt = getSpecPrjEst(tenderProject);
- if (estSpecPrjRpt) {
- this.children.push(estSpecPrjRpt);
- }
- // 6. 工程量清单单价分析表
- let billAnalyzeRpt = getBillsAnalyze(tenderProject);
- if (billAnalyzeRpt) {
- this.children.push(billAnalyzeRpt);
- }
- }
- function _getBidGljCode(tenderProject, orgGlj) {
- let rst = orgGlj.code;
- if (tenderProject.bid_evaluation_list && tenderProject.bid_evaluation_list.datas) {
- for (let bGlj of tenderProject.bid_evaluation_list.datas) {
- if (bGlj.projectGLJID === orgGlj.id) {
- rst = bGlj.seq;
- break;
- }
- }
- }
- return rst;
- }
- function _getFee(bill, key = 'common', valueKey = 'tenderTotalFee') {
- let rstSum = 0;
- if (bill) {
- let dtlB = (bill.data) ? bill.data : bill;
- if (dtlB.fees) {
- for (let fee of dtlB.fees) {
- if (fee.fieldName === key) {
- rstSum = fee[valueKey];
- break;
- }
- }
- }
- }
- return rstSum;
- };
- function _getNumValueByExportKind(orgSum) {
- let rst = orgSum;
- // const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
- // const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
- // const isControl = exportKind === CONTROL; // 是否是控制价
- //根据导出类型(上面3个),输出实际合计或price
- if (isBidInvitation) {
- rst = 0;
- }
- return rst;
- }
- function _getStrValueByExportKind(orgStr) {
- let rst = orgStr;
- // const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
- // const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
- // const isControl = exportKind === CONTROL; // 是否是控制价
- //根据导出类型(上面3个),输出实际合计或price
- if (isBidInvitation) {
- rst = '';
- }
- return rst;
- }
- function _getFixedSum(tenderProject) {
- let rst = 0;
- tenderProject.Bills.datas.forEach((bill) => {
- if (bill.specialProvisional == "固定费用") {
- let bVal = _getFee(bill);
- rst += bVal;
- }
- });
- return rst;
- }
- function quoteSummary(tenderProject) {
- let quoteSummaryItem = new emptyElement('QuoteSummary');
- // let attrs = [];
- //1. 取固定清单,
- // 1.1 100~700章总清单(flags有属性为19的那个) -> topNode100To700
- // 1.2 已包含在清单合计中的材料、工程设备、专业工程暂估价合计 标记:20
- // 1.3 清单合计减去材料、工程设备、专业工程暂估价|合计 标记:21
- // 1.4 计日工合计 标记:22
- // 1.5 暂列金额(不含计日工总额) 标记:26
- // 1.6 投标报价 标记:9
- let topNode100To700, nodeZXZDJ, nodeQDKCZXZDJ, nodeJRG, nodeZLJE, nodeTBBJ, newAddedBill;
- let chapterNodes = [];
- let fixedSum = _getFixedSum(tenderProject); //山东有固定费用,此费用不参与到此项中去
- let nextBillID = '';
- tenderProject.Bills.datas.forEach((bill) => {
- if (bill.flags && bill.flags.length > 0) {
- for (let flag of bill.flags) {
- switch (flag.flag) {
- case 19:
- topNode100To700 = bill;
- break;
- case 20:
- nodeZXZDJ = bill;
- break;
- case 21:
- nodeQDKCZXZDJ = bill;
- break;
- case 22:
- nodeJRG = bill;
- break;
- case 26:
- nodeZLJE = bill;
- nextBillID = bill.NextSiblingID
- break;
- case 9:
- nodeTBBJ = bill;
- break;
- case 44:
- newAddedBill = bill;
- break;
- default:
- break;
- }
- }
- }
- });
- tenderProject.Bills.datas.forEach((bill) => {
- if (bill.type === 1 && bill.ID === nextBillID && nodeTBBJ && nodeTBBJ.ID !== nextBillID) {
- newAddedBill = bill;
- }
- });
- //2. 然后获取topNode100To700下的所有次一级清单(100章...700章)
- if (topNode100To700) {
- for (let rootBill of tenderProject.Bills.tree.roots) {
- // 100~700章总清单在top级别(山东养护)
- if (rootBill.data.ID === topNode100To700.ID) {
- rootBill.children.forEach((subBill) => {
- if (subBill.data.name.includes('00章')) {
- chapterNodes.push(subBill);
- }
- });
- break;
- }
- }
- }
- //3. 拼凑数据
- let nodeAttrs = [];
- if (topNode100To700) {
- let order = 1;
- //读取投标报价汇总表信息。1.ItemNo 序号。2.ChapterNo 章次。 3.Name 科目名称。 4.Sum 金额。
- chapterNodes.forEach((cnode) => {
- if (_chkIfValid100(cnode)) {
- let chapterIdx = cnode.data.name.indexOf("00章");
- nodeAttrs.push({ ItemNo: order, ChapterNo: cnode.data.name.substr(chapterIdx - 1, 3), Name: cnode.data.name, Sum: _getFee(cnode) });
- order++;
- }
- });
- // nodeAttrs.push({ ItemNo: order, ChapterNo: '', Name: '第100章至700章清单合计', Sum: _getFee(topNode100To700) });
- nodeAttrs.push({ ItemNo: order, ChapterNo: '', Name: topNode100To700.name, Sum: _getFee(topNode100To700) });
- order++;
- if (nodeZXZDJ) {
- // nodeAttrs.push({ItemNo: order, ChapterNo: '', Name: '已包含在清单合计中的材料、工程设备、专业工程暂估价合计', Sum: _getFee(nodeZXZDJ) - fixedSum});
- nodeAttrs.push({ ItemNo: order, ChapterNo: '', Name: '已包含在清单合计中的材料、工程设备、专业工程暂估价合计', Sum: _getFee(nodeZXZDJ) }); // 又不需要fixedSum了
- order++;
- }
- if (nodeQDKCZXZDJ) {
- nodeAttrs.push({ ItemNo: order, ChapterNo: '', Name: `清单合计减去材料、工程设备、专业工程暂估价合计(即${order - 2}-${order - 1})=${order}`, Sum: _getFee(nodeQDKCZXZDJ) });
- order++;
- }
- if (nodeJRG) {
- nodeAttrs.push({ ItemNo: order, ChapterNo: '', Name: `计日工合计`, Sum: _getFee(nodeJRG) });
- order++;
- }
- if (nodeZLJE) {
- nodeAttrs.push({ ItemNo: order, ChapterNo: '', Name: `暂列金额(不含计日工总额)`, Sum: _getFee(nodeZLJE) });
- order++;
- }
- if (newAddedBill) {
- nodeAttrs.push({ ItemNo: order, ChapterNo: '', Name: newAddedBill.name, Sum: _getFee(newAddedBill) });
- order++;
- }
- if (nodeTBBJ) {
- let nameStr = `投标报价(${chapterNodes.length + 1}+${order - 2}+${order - 1})=${order}`;
- if (newAddedBill && nodeTBBJ.calcBase && nodeTBBJ.calcBase.includes(newAddedBill.ID)) {
- nameStr = `投标报价(${chapterNodes.length + 1}+${order - 3}+${order - 2}+${order - 1})=${order}`;
- }
- nodeAttrs.push({ ItemNo: order, ChapterNo: '', Name: nameStr, Sum: _getFee(nodeTBBJ) });
- order++;
- }
- }
- function _Item(item) {
- const attrs = [
- {
- name: 'ItemNo',
- value: item.ItemNo
- },
- {
- name: 'ChapterNo',
- value: item.ChapterNo
- },
- {
- name: 'Name',
- value: item.Name
- },
- {
- name: 'Sum',
- value: scMathUtil.roundForObj(_getNumValueByExportKind(item.Sum), tenderProject.property.decimal.bills.totalPrice)
- // value: 0 // 所有清单的金额都是0
- }
- ];
- let rst = new emptyElement('Item');
- rst.attrs.push(...attrs);
- return rst;
- }
- for (let attr of nodeAttrs) {
- quoteSummaryItem.children.push(_Item(attr));
- }
- return quoteSummaryItem;
- }
- function sporadicWork(tenderProject) {
- //计日工表,含:劳务、材料、施工机械、计日工汇总
- let hasSporadicWork = false;
- let sporadicWorkItem = new Element('SporadicWork');
- let nodeLabour, nodeMaterial, nodeMachine;
- //首先收集过滤计日工相关清单
- tenderProject.Bills.datas.forEach((bill) => {
- if (bill.flags && bill.flags.length > 0) {
- for (let flag of bill.flags) {
- switch (flag.flag) {
- case 23:
- nodeLabour = bill;
- break;
- case 24:
- nodeMaterial = bill;
- break;
- case 25:
- nodeMachine = bill;
- break;
- default:
- break;
- }
- }
- }
- });
- const _buildWorkNodeItem = function (orgNode, subNodes, parentKey, childKey) {
- let parentNode = new Element(parentKey);
- sporadicWorkItem.children.push(parentNode);
- const pSumAttrs = [
- {
- name: 'Sum',
- value: _getNumValueByExportKind(_getFee(orgNode))
- // value: 0
- }
- ];
- // Element.call(this, parentKey, pSumAttrs);
- parentNode.attrs.push(...pSumAttrs);
- subNodes.forEach((node, index) => {
- let childNode = new Element(childKey);
- parentNode.children.push(childNode);
- const attrs = [
- {
- name: 'ItemNo',
- value: (node.code) ? node.code : `${index + 1}`
- }, {
- name: 'Name',
- value: node.name
- }, {
- name: 'Unit',
- value: node.unit
- }, {
- name: 'Num',
- value: node.quantity
- }, {
- name: 'Price',
- value: _getNumValueByExportKind(_getFee(node, 'common', 'tenderUnitFee'))
- // value: 0
- }, {
- name: 'Sum',
- value: _getNumValueByExportKind(_getFee(node))
- // value: 0
- }
- ];
- childNode.attrs.push(...attrs);
- });
- };
- //1. 判断劳务
- if (nodeLabour) {
- let subNodes = [];
- tenderProject.Bills.datas.forEach((bill) => {
- if (bill.ParentID === nodeLabour.ID) {
- subNodes.push(bill);
- }
- });
- if (subNodes.length > 0) {
- hasSporadicWork = true;
- //创建劳务Mps节点及劳务Mps下Mp子节点
- _buildWorkNodeItem(nodeLabour, subNodes, 'Mps', 'Mp');
- }
- }
- //2. 判断材料
- if (nodeMaterial) {
- let subNodes = [];
- tenderProject.Bills.datas.forEach((bill) => {
- if (bill.ParentID === nodeMaterial.ID) {
- subNodes.push(bill);
- }
- });
- if (subNodes.length > 0) {
- hasSporadicWork = true;
- //创建材料Materials节点及劳务Materials下Material子节点
- _buildWorkNodeItem(nodeMaterial, subNodes, 'Materials', 'Material');
- }
- }
- //3. 判断施工机械
- if (nodeMachine) {
- let subNodes = [];
- tenderProject.Bills.datas.forEach((bill) => {
- if (bill.ParentID === nodeMachine.ID) {
- subNodes.push(bill);
- }
- });
- if (subNodes.length > 0) {
- hasSporadicWork = true;
- //创建施工机械Meehs节点及劳务Meehs下Meeh子节点
- _buildWorkNodeItem(nodeMachine, subNodes, 'Mechs', 'Mech');
- }
- }
- //4. 判断计日工汇总
- if (hasSporadicWork) {
- let summaryNode = new Element('Summary');
- sporadicWorkItem.children.push(summaryNode);
- const pSumAttrs = [
- {
- name: 'Sum',
- // value: _getFee(nodeLabour) + _getFee(nodeMaterial) + _getFee(nodeMachine)
- value: _getNumValueByExportKind(_getFee(nodeLabour) + _getFee(nodeMaterial) + _getFee(nodeMachine))
- }
- ];
- summaryNode.attrs = pSumAttrs;
- //把劳务、材料、施工机械
- function _workItem(node, name, remark = '') {
- let childNode = new Element('Item');
- summaryNode.children.push(childNode);
- const attrs = [
- {
- name: "Name",
- value: name,
- },
- {
- name: "Sum",
- value: _getNumValueByExportKind(_getFee(node)),
- },
- {
- name: "Remark",
- value: remark,
- }
- ]
- childNode.attrs.push(...attrs);
- }
- _workItem(nodeLabour, '劳务');
- _workItem(nodeMaterial, '材料');
- _workItem(nodeMachine, '机械');
- }
- //返回
- if (hasSporadicWork) {
- return sporadicWorkItem;
- } else {
- return null;
- }
- }
- function materialEstimate(tenderProject) {
- let mEstNode = new emptyElement('MaterialEstimate');
- let items = [];
- let billItems = [];
- let itemNo = 1;
- //材料暂估价明细
- tenderProject.Bills.datas.forEach((bill) => {
- if (bill.specialProvisional === '材料暂估') {
- billItems.push(bill);
- }
- });
- if (billItems.length > 0) {
- billItems.forEach((bill) => {
- let mEstItemNode = new emptyElement('Item');
- mEstNode.children.push(mEstItemNode);
- let attrs = [
- { name: 'ItemNo', value: itemNo },
- { name: 'Code', value: bill.code },
- { name: 'Number', value: bill.code },
- { name: 'Name', value: bill.name },
- { name: 'Unit', value: bill.unit },
- { name: 'Num', value: bill.quantity },
- { name: 'Price', value: _getNumValueByExportKind(_getFee(bill, 'common', 'tenderUnitFee')) },
- { name: 'Sum', value: _getNumValueByExportKind(scMathUtil.roundForObj(_getFee(bill), 0)), type: TYPE.DECIMAL },
- // {name: 'Price', value: 0},
- // {name: 'Sum', value: 0},
- { name: 'Remark', value: (bill.remark) ? bill.remark : '' }
- ];
- itemNo++;
- mEstItemNode.attrs.push(...attrs);
- });
- }
- tenderProject.projectGLJ.datas.gljList.forEach((glj) => {
- if (glj.is_evaluate && glj.type !== 5 && glj.type !== 301) {
- items.push(glj);
- }
- });
- if (items.length > 0) {
- items.forEach((glj) => {
- let mEstItemNode = new emptyElement('Item');
- mEstNode.children.push(mEstItemNode);
- let gljName = glj.name;
- if (tenderProject.evaluate_list.datas && tenderProject.evaluate_list.datas.length > 0) {
- for (let relGlj of tenderProject.evaluate_list.datas) {
- if (relGlj.projectGLJID == glj.id) {
- gljName = relGlj.name;
- break;
- }
- }
- }
- let attrs = [
- { name: 'ItemNo', value: itemNo },
- { name: 'Code', value: _getBidGljCode(tenderProject, glj) },
- { name: 'Number', value: glj.code },
- { name: 'Name', value: gljName },
- { name: 'Unit', value: glj.unit },
- { name: 'Num', value: glj.tenderQuantity },
- // {name: 'Price', value: _getNumValueByExportKind(glj.unit_price.market_price)},
- { name: 'Price', value: glj.unit_price.market_price }, //暂估材料输出price,不需判断导出类型
- { name: 'Sum', value: _getNumValueByExportKind(scMathUtil.roundForObj(glj.tenderQuantity * glj.unit_price.market_price, 0)), type: TYPE.DECIMAL },
- // {name: 'Price', value: 0},
- // {name: 'Sum', value: 0},
- { name: 'Remark', value: (glj.remark) ? glj.remark : '' }
- ];
- itemNo++;
- mEstItemNode.attrs.push(...attrs);
- });
- }
- if (billItems.length > 0 || items.length > 0) {
- return mEstNode;
- } else {
- return null;
- }
- }
- function getMachineTempEst(tenderProject) {
- let mEstNode = new emptyElement('PrjDeviceEstimate');
- let items = [];
- let billItems = [];
- let itemNo = 1;
- //工程设备明细
- tenderProject.Bills.datas.forEach((bill) => {
- console.log(`bill.specialProvisional: ${bill.specialProvisional}`);
- if (bill.specialProvisional === '工程设备') {
- billItems.push(bill);
- }
- });
- if (billItems.length > 0) {
- billItems.forEach((bill) => {
- let mEstItemNode = new emptyElement('Item');
- mEstNode.children.push(mEstItemNode);
- let attrs = [
- { name: 'ItemNo', value: itemNo },
- { name: 'Code', value: bill.code },
- { name: 'Number', value: bill.code },
- { name: 'Name', value: bill.name },
- { name: 'Unit', value: bill.unit },
- { name: 'Num', value: bill.quantity },
- { name: 'Price', value: _getNumValueByExportKind(_getFee(bill, 'common', 'tenderUnitFee')) },
- { name: 'Sum', value: _getNumValueByExportKind(scMathUtil.roundForObj(_getFee(bill), 0)), type: TYPE.DECIMAL },
- // {name: 'Price', value: 0},
- // {name: 'Sum', value: 0},
- { name: 'Remark', value: (bill.remark) ? glj.remark : '' }
- ];
- itemNo++;
- mEstItemNode.attrs.push(...attrs);
- });
- }
- tenderProject.projectGLJ.datas.gljList.forEach((glj) => {
- if (glj.is_evaluate && glj.type === 5) {
- items.push(glj);
- }
- });
- if (items.length > 0) {
- items.forEach((glj, sno) => {
- let mEstItemNode = new emptyElement('Item');
- mEstNode.children.push(mEstItemNode);
- let attrs = [
- { name: 'ItemNo', value: itemNo },
- { name: 'Code', value: _getBidGljCode(tenderProject, glj) },
- { name: 'Number', value: glj.code },
- { name: 'Name', value: glj.name },
- { name: 'Unit', value: glj.unit },
- { name: 'Num', value: glj.tenderQuantity },
- // {name: 'Price', value: _getNumValueByExportKind(glj.unit_price.market_price)},
- { name: 'Price', value: glj.unit_price.market_price }, // 暂估设备直接输出price
- { name: 'Sum', value: _getNumValueByExportKind(scMathUtil.roundForObj(glj.tenderQuantity * glj.unit_price.market_price, 0)), type: TYPE.DECIMAL },
- // {name: 'Price', value: 0},
- // {name: 'Sum', value: 0},
- { name: 'Remark', value: (glj.remark) ? glj.remark : '' }
- ];
- itemNo++;
- mEstItemNode.attrs.push(...attrs);
- });
- }
- if (billItems.length > 0 || items.length > 0) {
- return mEstNode;
- } else {
- return null;
- }
- }
- function getSpecPrjEst(tenderProject) {
- let mEstNode = new emptyElement('SpecPrjEstimate');
- let sum = 0;
- let items = [];
- //专业工程暂估明细
- tenderProject.Bills.datas.forEach((bill) => {
- if (bill.specialProvisional === '专业工程') {
- items.push(bill);
- }
- });
- if (items.length > 0) {
- items.forEach((bill, sno) => {
- let mEstItemNode = new emptyElement('Item');
- mEstNode.children.push(mEstItemNode);
- let ttl = _getFee(bill);
- sum += ttl;
- let jobContent = '';
- if (bill.jobContent && bill.jobContent.length > 0) {
- jobContent = bill.jobContent.toString();
- } else {
- jobContent = (bill.jobContentText) ? bill.jobContentText : '';
- }
- jobContent = jobContent.replace(regRt1, '
').replace(regRt2, '
').replace(reg1, '
').replace(reg2, '
'); // 转成XML的换行转义符
- let attrs = [
- { name: 'ItemNo', value: sno + 1 },
- { name: 'Code', value: bill.code },
- { name: 'Number', value: bill.code },
- { name: 'Name', value: bill.name },
- { name: 'Content', value: jobContent },
- // {name: 'Sum', value: _getNumValueByExportKind(scMathUtil.roundForObj(ttl, 0)), type:TYPE.DECIMAL},
- { name: 'Sum', value: ttl, type: TYPE.DECIMAL },
- // {name: 'Sum', value: 0, type:TYPE.DECIMAL},
- ];
- mEstItemNode.attrs.push(...attrs);
- });
- mEstNode.attrs.push({ name: 'Sum', value: sum });
- return mEstNode;
- } else {
- return null;
- }
- }
- function getBillsAnalyze(tenderProject) {
- if (isBidInvitation) return null; // 招标不输出此部分
- // 本函数是尽量复刻【5.5表】工程量清单单价分析表的‘综合’计算式脚本的相关逻辑,具体细节根据实际环境有所调整(前端环境已有不少现成的结构及数据,能少跑不少逻辑)
- let djfxbNode = new emptyElement('ListUnitPriceAnalysis');
- let decimalObj = tenderProject.property.decimal;
- // 工程量清单单价分析(100~700章 清单下所有定额工料机的综合)
- let topNode100To700;
- let sno = 1;
- const prefix = '_';
- let filterMtlTypes = [202, 203, 204, 301];
- for (let bill of tenderProject.Bills.datas) {
- if (bill.flags && bill.flags.length > 0) {
- for (let flag of bill.flags) {
- if (flag.flag === 19) {
- for (let rootBill of tenderProject.Bills.tree.roots) {
- if (rootBill.data.ID === bill.ID) {
- topNode100To700 = rootBill;
- break;
- }
- }
- break;
- }
- }
- }
- }
- const cacheObj = {};
- const proKeysArr = [];
- const addedGljCodeCache = {};
- //说明:根据实际情况,用户会直接在清单下加工料机,此工料机属于定额层次,那么算工程量的时候要加上这个(沟通后这种几率很小,暂时返回0,如有再补上)
- const _getAdhocGljQty = function (billsId, rationCode, rstType = 1) {
- let rst = 0;
- // for (let nbidx = 0; nbidx < newRBillsIdArr.length; nbidx++) {
- // if (newRBillsIdArr[nbidx] === billsId && newRCodeArr[nbidx] === rationCode) {
- // rst = (rstType === 1) ? newRQtyArr[nbidx] : newTtlArr[nbidx];
- // break;
- // }
- // }
- return rst;
- };
- const _getCacheObjInitialedItem = function (bill = null, glj = null) {
- let rst = {
- code: (bill) ? bill.code : ((glj) ? glj.code : ''),
- name: (bill) ? bill.name : ((glj) ? glj.name : ''),
- quantity: (bill) ? bill.quantity : 1,
- labourConsume: 0,
- labourUnitPrice: 0,
- labourTotalPrice: 0,
- mainMaterialFee: 0,
- auxiliaryMaterialFee: 0,
- materialUnitFee: (bill) ? _getFee(bill, 'marketMaterial', 'unitFee') : 0,
- machineFee: (bill) ? _getFee(bill, 'marketMachine') : 0,
- otherFee: (bill) ? _getFee(bill, 'measure') : 0, //措施费
- managementFee: (bill) ? (_getFee(bill, 'manage') + _getFee(bill, 'force')) : 0, //管理+规费
- taxFee: (bill) ? _getFee(bill, 'tax') : 0,
- profitFee: (bill) ? _getFee(bill, 'profit') : 0,
- unitPrice: (bill) ? _getFee(bill, 'common', 'unitFee') : 0,
- items: []
- };
- return rst;
- };
- const _getPrjGLJ = function (gljID) {
- let rst = null;
- for (let glj of tenderProject.projectGLJ.datas.gljList) {
- if (glj.id === gljID) {
- rst = glj;
- break;
- }
- }
- return rst;
- };
- const _getRation = function (rationId) {
- let rst = null;
- for (let ration of tenderProject.Ration.datas) {
- if (ration.ID === rationId) {
- rst = ration;
- break;
- }
- }
- return rst;
- };
- const _createNode = function (billIdKey, bill) {
- if (cacheObj[billIdKey]) {
- //1. 叶子清单,先创建清单Item
- let bQtn = 1;
- if (bill.data.hasOwnProperty('quantity')) {
- bQtn = parseFloat(bill.data.quantity);
- if (isNaN(bQtn)) bQtn = 1;
- }
- let billMainMaterialTtl = cacheObj[billIdKey].mainMaterialFee / bQtn;
- let billAuxiliaryMaterialTtl = cacheObj[billIdKey].auxiliaryMaterialFee / bQtn;
- // scMathUtil.roundForObj(cacheObj[billIdKey].labourConsume / bQtn, decimalObj.glj.unitPrice)
- let leafBillAttrs = [
- { name: 'ItemNo', value: sno },
- { name: 'Code', value: cacheObj[billIdKey].code },
- { name: 'Name', value: cacheObj[billIdKey].name },
- { name: 'LaborWorkDays', value: _getNumValueByExportKind(scMathUtil.roundForObj(cacheObj[billIdKey].labourConsume / bQtn, decimalObj.glj.quantity)) },
- { name: 'LaborUnitPrice', value: _getNumValueByExportKind(scMathUtil.roundForObj(cacheObj[billIdKey].labourUnitPrice, decimalObj.glj.unitPrice)) },
- { name: 'LaborUnitTotal', value: _getNumValueByExportKind(scMathUtil.roundForObj(cacheObj[billIdKey].labourTotalPrice / bQtn, decimalObj.glj.unitPrice)) },
- { name: 'MainMaterialConsume', value: 0 },
- { name: 'MainMaterialUnit', value: '' },
- { name: 'MainMaterialUnitPrice', value: 0 },
- { name: 'MainMaterialTotal', value: _getNumValueByExportKind(scMathUtil.roundForObj(billMainMaterialTtl, decimalObj.glj.unitPrice)) },
- { name: 'AuxiliaryMaterialFee', value: _getNumValueByExportKind(scMathUtil.roundForObj(billAuxiliaryMaterialTtl, decimalObj.glj.unitPrice)) },
- { name: 'MaterialSum', value: _getNumValueByExportKind(scMathUtil.roundForObj(billMainMaterialTtl + billAuxiliaryMaterialTtl, decimalObj.glj.unitPrice)) },
- { name: 'MachUsageFee', value: _getNumValueByExportKind(scMathUtil.roundForObj(cacheObj[billIdKey].machineFee / bQtn, decimalObj.glj.unitPrice)) },
- { name: 'OtherFee', value: _getNumValueByExportKind(scMathUtil.roundForObj(cacheObj[billIdKey].otherFee / bQtn, decimalObj.glj.unitPrice)) },
- { name: 'ManageFee', value: _getNumValueByExportKind(scMathUtil.roundForObj(cacheObj[billIdKey].managementFee / bQtn, decimalObj.glj.unitPrice)) },
- { name: 'Tax', value: _getNumValueByExportKind(scMathUtil.roundForObj(cacheObj[billIdKey].taxFee / bQtn, decimalObj.glj.unitPrice)) },
- { name: 'Profit', value: _getNumValueByExportKind(scMathUtil.roundForObj(cacheObj[billIdKey].profitFee / bQtn, decimalObj.glj.unitPrice)) },
- { name: 'Price', value: _getNumValueByExportKind(scMathUtil.roundForObj(_getFee(bill, 'common', 'tenderUnitFee'), decimalObj.glj.unitPrice)) },
- ];
- sno++;
- let leafItemNode = new emptyElement('Item');
- djfxbNode.children.push(leafItemNode);
- // leafItemNode.attrs.push(...leafBillAttrs);
- leafItemNode.attrs = leafBillAttrs;
- //2. 清单下工料机
- cacheObj[billIdKey].items.forEach((gljItem) => {
- let showQty = gljItem.mainMaterialConsume / bQtn;
- showQty = Math.round(showQty * 1000000) / 1000000;
- let gljAttrs = [
- { name: 'ItemNo', value: sno },
- { name: 'Code', value: gljItem.code },
- { name: 'Name', value: gljItem.name },
- { name: 'LaborWorkDays', value: 0 },
- { name: 'LaborUnitPrice', value: 0 },
- { name: 'LaborUnitTotal', value: 0 },
- // {name: 'MainMaterialConsume', value: scMathUtil.roundForObj(showQty, decimalObj.glj.quantity)},
- { name: 'MainMaterialConsume', value: _getNumValueByExportKind(scMathUtil.roundForObj(showQty, decimalObj.glj.quantity)) },
- // {name: 'MainMaterialUnit', value: gljItem.mainMaterialUnit},
- { name: 'MainMaterialUnit', value: _getStrValueByExportKind(gljItem.mainMaterialUnit) },
- { name: 'MainMaterialUnitPrice', value: _getNumValueByExportKind(scMathUtil.roundForObj(gljItem.mainMaterialUnitPrice, decimalObj.glj.unitPrice)) },
- { name: 'MainMaterialTotal', value: _getNumValueByExportKind(scMathUtil.roundForObj(showQty * gljItem.mainMaterialUnitPrice, decimalObj.glj.unitPrice)) },
- { name: 'AuxiliaryMaterialFee', value: 0 },
- { name: 'MaterialSum', value: 0 },
- { name: 'MachUsageFee', value: 0 },
- { name: 'OtherFee', value: 0 },
- { name: 'ManageFee', value: 0 },
- { name: 'Tax', value: 0 },
- { name: 'Profit', value: 0 },
- // {name: 'Price', value: _getNumValueByExportKind(scMathUtil.roundForObj(_getFee(bill), decimalObj.glj.unitPrice))},
- { name: 'Price', value: 0 },
- ];
- sno++;
- let gljItemNode = new emptyElement('Item');
- djfxbNode.children.push(gljItemNode);
- // gljItemNode.attrs.push(...gljAttrs);
- gljItemNode.attrs = gljAttrs;
- });
- }
- };
- const _getAllGlj = function (parentBill) {
- if (parentBill.data.name === '挖除水泥混凝土路面(平面交叉)') {
- debugger;
- }
- if (parentBill.children.length > 0) {
- parentBill.children.forEach((subBill) => {
- _getAllGlj(subBill);
- });
- } else {
- let billIdKey = prefix + parentBill.data.ID;
- if (!cacheObj.hasOwnProperty(billIdKey)) {
- cacheObj[billIdKey] = _getCacheObjInitialedItem(parentBill.data);
- addedGljCodeCache[billIdKey] = [];
- proKeysArr.push(billIdKey);
- }
- tenderProject.ration_glj.datas.forEach((rglj) => {
- if (rglj.billsItemID === parentBill.data.ID) {
- let ration = _getRation(rglj.rationID);
- if (ration) {
- // 计算消耗量,否则定额人材机消耗量取值会不正确
- gljOprObj.getTotalQuantity(rglj, ration);
- }
- let gljQty = parseFloat(rglj.tenderQuantity || rglj.quantity);
- if (isNaN(gljQty)) gljQty = 0;
- let gljRationQty = 0;
- if (ration) gljRationQty = parseFloat(ration.tenderQuantity || ration.quantity);
- if (isNaN(gljRationQty)) gljRationQty = 0;
- let gljCns = gljQty * gljRationQty;
- let prjGlj = _getPrjGLJ(rglj.projectGLJID);
- let gljUnitPrice = parseFloat(prjGlj.unit_price.market_price);
- let gljTotalPrice = gljCns * gljUnitPrice;
- let gljCode = rglj.code;
- if (rglj.type === 1) {
- //人工
- cacheObj[billIdKey].labourConsume = cacheObj[billIdKey].labourConsume + gljCns;
- cacheObj[billIdKey].labourUnitPrice = gljUnitPrice;
- cacheObj[billIdKey].labourTotalPrice = cacheObj[billIdKey].labourTotalPrice + gljTotalPrice;
- } else if (filterMtlTypes.indexOf(rglj.type) < 0) {
- if (!addedGljCodeCache[billIdKey].includes(gljCode)) {
- addedGljCodeCache[billIdKey].push(gljCode);
- }
- if (prjGlj.is_main_material) {
- let dtlObj = {};
- dtlObj.code = gljCode;
- dtlObj.name = rglj.name;
- dtlObj.specs = rglj.specs;
- //
- let adhocGljQty = _getAdhocGljQty(parentBill.data.ID, dtlObj.code);
- let adhocGljTtl = adhocGljQty * gljUnitPrice;
- dtlObj.mainMaterialConsume = gljCns + adhocGljQty; //考虑清单单独加工料机的情况,需要补上消耗量
- dtlObj.mainMaterialUnitPrice = gljUnitPrice;
- dtlObj.mainMaterialTotalPrice = gljTotalPrice;
- dtlObj.mainMaterialUnit = rglj.unit;
- let isAdd = 0;
- for (let i = 0; i < cacheObj[billIdKey].items.length; i++) {
- //先比较对象中是否已存在同一条工料机,存在,则累加汇总消耗量和金额;否则添加。
- if (dtlObj.code === cacheObj[billIdKey].items[i].code && dtlObj.name === cacheObj[billIdKey].items[i].name && dtlObj.mainMaterialUnit === cacheObj[billIdKey].items[i].mainMaterialUnit && dtlObj.specs === cacheObj[billIdKey].items[i].specs) {
- cacheObj[billIdKey].items[i].mainMaterialConsume = cacheObj[billIdKey].items[i].mainMaterialConsume + gljCns;
- cacheObj[billIdKey].items[i].mainMaterialTotalPrice = cacheObj[billIdKey].items[i].mainMaterialTotalPrice + gljTotalPrice;
- isAdd = 1;
- break;
- }
- }
- if (isAdd === 0) {
- cacheObj[billIdKey].items.push(dtlObj);
- }
- cacheObj[billIdKey].mainMaterialFee = cacheObj[billIdKey].mainMaterialFee + gljTotalPrice + adhocGljTtl;
- } else {
- cacheObj[billIdKey].auxiliaryMaterialFee = cacheObj[billIdKey].auxiliaryMaterialFee + gljTotalPrice;
- }
- }
- }
- });
- // 整理完后,开始创建XML节点(这里与参考脚本逻辑不一样了,直接开始创建)
- _createNode(billIdKey, parentBill);
- }
- };
- if (topNode100To700) {
- topNode100To700.children.forEach((topChapterBill) => {
- _getAllGlj(topChapterBill);
- });
- }
- //...
- return djfxbNode;
- }
- function getBidEvaluationMainMaterial(tenderProject) {
- let bidMaterials = [];
- let i = 1;
- for (let b of tenderProject.bidMaterialData) {
- bidMaterials.push(new BidEvaluationMainMaterial(b, i));
- i++
- }
- return bidMaterials;
- function BidEvaluationMainMaterial(b, index) {
- const attrs = [{
- name: "Code",
- value: b.seq,
- },
- {
- name: "Number",
- value: b.code
- },
- {
- name: "Name",
- value: b.name
- },
- {
- name: "Specification",
- value: b.specs
- },
- {
- name: "Unit",
- value: b.unit
- },
- {
- name: "Price",
- value: _getNumValueByExportKind(b.marketPrice || '0'),
- type: TYPE.DECIMAL
- },
- {
- name: "LimitedPrice",
- value: _getNumValueByExportKind(b.marketPrice || '0'),
- type: TYPE.DECIMAL
- },
- {
- name: "Quantity",
- value: b.quantity,
- type: TYPE.DECIMAL
- },
- {
- name: "Total",
- value: 0
- },
- {
- name: "Remark",
- value: b.remark
- }
- ];
- if (isBidSubmission || isControl) {
- attrs[7].value = b.quantity;
- attrs[8].value = b.totalPrice;
- }
- Element.call(this, "BidEvaluationMainMaterial", attrs);
- }
- }
- function getIndexs(tenderProject) {
- let Indexs = new emptyElement('Indexs');
- let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
- for (let f of feature) {
- if (f.code) Indexs.children.push(new IndexItem(f))
- }
- return Indexs;
- function IndexItem(fea) {
- const attrs = [{
- name: "Code",
- value: fea.code,
- },
- {
- name: "Name",
- value: fea.dispName,
- },
- {
- name: "Unit",
- value: fea.unit,
- },
- {
- name: "Value",
- value: fea.value,
- },
- {
- name: "Remark",
- value: fea.remark,
- }
- ]
- Element.call(this, "IndexItem", attrs);
- }
- }
- function _chkIfValid100(node) {
- let rst = true;
- if (node.data.name.indexOf('第100章') >= 0 && node.data.name.indexOf('总则') >= 0) {
- let bVal = _getFee(node);
- rst = node.children.length > 0 || bVal !== 0;
- }
- return rst;
- }
- function getBillsItems(tenderProject, cacheForFormula) {
- let items = new emptyElement("Items");
- let rootNodes = tenderProject.mainTree.roots;
- for (let r of rootNodes) {
- setItem(r, -1, items.children);
- }
- return items;
- function setItem(bNode, level, list, dftListCodeSeq = -1) {
- const specialChkBillFlag = [fixedFlag.DAYWORK_LABOR, fixedFlag.LABOUR_SERVICE, fixedFlag.MATERIAL, fixedFlag.CONSTRUCTION_MACHINE];
- if (bNode.sourceType == ModuleNames.ration) return;
- // 判断: 1. 招标清单 2. 是否量价,都是的话,return
- if (isBidInvitation && (bNode.data.specialProvisional == "材料暂估" || bNode.data.specialProvisional == "工程设备")) {
- return;
- }
- // 判断: 100章下无子清单,且金额为0时,return
- if (!_chkIfValid100(bNode)) {
- return;
- }
- let item = new bill(bNode, level, dftListCodeSeq);
- if (bNode.children && bNode.children.length > 0) {
- level += 1;
- let dftLCStartSeq = -1;
- if (isFlag(bNode.data) && specialChkBillFlag.includes(bNode.data.flagsIndex.fixed.flag)) {
- dftLCStartSeq = 1;
- }
- for (let c of bNode.children) {
- setItem(c, level, item.children, dftLCStartSeq);
- if (dftLCStartSeq > 0) dftLCStartSeq++;
- }
- }
- list.push(item);
- function getCalcType(node) {
- /*
- 判断是否父项:
- 是父项,则取1;
- 是叶子项,则判断其下有无套定额/量价/工料机:
- 有则取1;
- 无则判断有无基数计算:
- 有则取2;
- 无则取3 */
- if (node.children && node.children.length > 0) {
- return 1; //是父项,则取1, 有套定额/量价/工料机,也取1
- } else {
- return node.data.calcBase && node.data.calcBase != "" ? 2 : 3
- }
- }
- function getItemType(node) {
- let Bills = projectObj.project.Bills;
- //是100~900章部分、或是计日工部分,叶子清单输出1,父项输出0;
- if (Bills.isBelongOneToSeven(node) || Bills.isBelongDayWork(node)) {
- if (node.children && node.children.length > 0) {
- return node.children[0].sourceType == ModuleNames.ration ? 1 : 0
- }
- //山东新需求:清单 第XXX章、计日工、劳务、材料、机械 输出0
- const bNodeName = _billStrFilter(node.data.name);
- if (bNodeName.indexOf('清单第') >= 0 && bNodeName.indexOf('00章') > 0) {
- return 0;
- } else if (isFlag(node.data) && specialChkBillFlag.includes(node.data.flagsIndex.fixed.flag)) {
- return 0;
- }
- return 1 //叶子清单输出1
- } else {
- return 0;
- /* //非100~900章部分,
- // 是暂列金额,判断暂列金额的金额等于0,则输出为0;暂列金额的金额不等于0,则输出为1;
- if (node.data.name && node.data.name.indexOf("暂列金额") != -1) {
- let sum = node.data.feesIndex && node.data.feesIndex.common ? node.data.feesIndex.common.tenderTotalFee : "";
- return gljUtil.isNotEmpty(sum) ? 1 : 0
- } else { //非暂列金额,则判断清单的工程量是否等于0,等于0,则输出0;不等于0,则输出1
- return gljUtil.isNotEmpty(node.data.quantity) ? 1 : 0
- } */
- }
- }
- function bill(bNode, level, dftListCodeSeq = -1) {
- let data = bNode.data;
- let CostKind = 3;
- if (data.name === undefined || data.name === null) data.name = '';
- if (data.name && data.name.indexOf("安全生产费") != -1) CostKind = 1;
- if (data.name && data.name.indexOf("暂列金额") != -1) CostKind = 2;
- //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
- let CalcType = getCalcType(bNode);
- //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
- let ProvisionalType = "";
- if (data.specialProvisional == "材料暂估") ProvisionalType = 0;
- if (data.specialProvisional == "工程设备") ProvisionalType = 1;
- if (data.specialProvisional == "专业工程") ProvisionalType = 2;
- if (data.specialProvisional == "固定费用") ProvisionalType = 3;
- //MpRatio
- let MpRatio = "";
- let MaterialRatio = "";
- let MechRatio = "";
- if (data.quantityCoe) {
- if (data.quantityCoe["labour"]) MpRatio = data.quantityCoe["labour"];
- if (data.quantityCoe["material"]) MaterialRatio = data.quantityCoe["material"];
- if (data.quantityCoe["machine"]) MechRatio = data.quantityCoe["machine"];
- }
- let fail = billNameChecking(bNode, tenderProject.projectInfo.name, fixedFlag)
- //fail: { hint: '错误提示', type: '提示所属(基本就是单位工程名称)' }
- let ListCode = "";
- // if (ListCodeMap[data.name]) ListCode = ListCodeMap[data.name];
- if (ListCodeMap[_billStrFilter(data.name)]) {
- ListCode = ListCodeMap[_billStrFilter(data.name)];
- } else if (_chkAdhocChapterBillCode(data.name)) {
- ListCode = _extractAdhocChapter(data.name);
- } else if (data.code && data.code != "") {
- ListCode = data.code;
- } else if (dftListCodeSeq > 0) {
- ListCode = `${dftListCodeSeq}`;
- }
- let qtyFormula = data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "";
- //data.calcBase //data.calcBase ? cbParser.toFExpr(data.calcBase, tenderProject.mainTree.items) : "",
- if (!data.name.includes('暂列金额') && isBidInvitation) {
- if (data.hasOwnProperty('calcBase')) {
- let chkNaN = parseFloat(data.calcBase);
- if (isNaN(chkNaN)) {
- qtyFormula = data.calcBase;
- } else {
- qtyFormula = '';
- }
- } else {
- qtyFormula = '';
- }
- //判断公式(calcBase)是否为正常的计算公式(即非直接输入数量),
- }
- let formulaCode = '';
- if (cacheForFormula['_' + data.ID] && cacheForFormula['_' + data.ID].formulaCode) {
- formulaCode = cacheForFormula['_' + data.ID].formulaCode;
- }
- const attrs = [{
- name: "ListCode",
- value: ListCode,
- },
- {
- name: "ListName",
- value: data.name,
- fail: fail
- },
- {
- name: "Unit",
- value: data.unit,
- },
- {
- name: "Num",
- value: data.quantity,
- type: TYPE.DECIMAL,
- toFix: 3
- },
- {
- name: "QtyFormula",
- value: qtyFormula,
- type: TYPE.DECIMAL,
- toFix: 2
- },
- {
- name: "Price",
- value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
- type: TYPE.DECIMAL,
- toFix: 2
- },
- {
- name: "Rate",
- value: 100,
- },
- {
- name: "Sum",
- value: 0,//data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
- type: TYPE.DECIMAL,
- toFix: 2
- },
- {
- name: "ChapterKind",
- value: level > 3 ? 3 : level,
- },
- {
- name: "CostKind",
- value: CostKind,
- },
- {
- name: "CalcType",
- value: CalcType,
- },
- {
- name: "ProvisionalType",
- value: ProvisionalType,
- mustHasValue: true
- },
- {
- name: "MeterRules",
- value: "",
- },
- {
- name: "Content",
- value: data.jobContentText,
- },
- {
- name: "Remarks",
- value: data.remark,
- },
- /* {
- name: "MpRatio",
- value: MpRatio,
- },
- {
- name: "MaterialRatio",
- value: MaterialRatio,
- },
- {
- name: "MechRatio",
- value: MechRatio,
- },
- {
- name: "AdjustedPrice",
- value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderUnitFee : "",
- },
- {
- name: "AdjustedSums",
- value: data.feesIndex && data.feesIndex.common ? data.feesIndex.common.tenderTotalFee : "",
- }, */
- {
- name: "ItemType",
- value: getItemType(bNode),
- },
- /* {
- name: "FomulaCode",
- value: ""
- }, */
- {
- name: "FormulaCode",
- value: formulaCode,
- },
- ];
- //投标、招标控制价时。取单价。
- //招标时,如果是“安全生产费”或“暂列金额”,取单价,否则取0。
- if (isBidSubmission || isControl || CostKind == 1 || CostKind == 2 || ProvisionalType === 2 || ProvisionalType === 3) {
- attrs[5].value = data.feesIndex && data.feesIndex.common ? scMathUtil.roundForObj(data.feesIndex.common.tenderUnitFee, tenderProject.property.decimal.bills.unitPrice) : "";
- attrs[7].value = data.feesIndex && data.feesIndex.common ? scMathUtil.roundForObj(data.feesIndex.common.tenderTotalFee, tenderProject.property.decimal.bills.totalPrice) : "";
- //暂列金额 数量为0的时候,单价输出0
- if (CostKind == 2 && !gljUtil.isNotEmpty(data.quantity)) attrs[5].value = 0
- }
- let fixedSumVal = _getFixedSum(tenderProject); // 固定费用
- Element.call(this, "Item", attrs);
- let cc = CostComposition(bNode);
- if (cc) this.children.push(cc);
- this.children.push(CostStructure(data, tenderProject.property.decimal.bills.totalPrice))
- function CostComposition(bNode) {
- // 山东逻辑:如果清单下有计算基数,则需要输出(废弃)
- // 新逻辑:
- // 标准接口文档里,写了只有招标清单,才是完全不输出定额相关数据的
- // 当清单有清单基数和费率,那么应该就是没有定额,不输出定额;
- // 清单没有基数和费率,也没有下挂定额,那么也不输出定额相关字段;
- // 清单有下挂定额、量价,那么输出定额相关数据。
- // if (isBidInvitation) return null; // 山东接口又要这个了
- let CostComposition = new emptyElement('CostComposition');
- let Norms = [];
- let Costs = [];
- if (bNode.children && bNode.children.length > 0 && bNode.children[0].sourceType == ModuleNames.ration) {
- for (let r of bNode.children) {
- if (r.data.type == rationType.ration) {
- if (isEmptyRation(r.data) || isBidInvitation) continue; // 招标 或者 定额空行不输出到接口文件中。
- Norms.push(new Ration(r.data));
- } else if (!isBidInvitation) {
- Costs.push(new Cost(r.data));
- }
- }
- }
- if (Norms.length > 0) CostComposition.children.push(...Norms);
- if (Costs.length > 0) CostComposition.children.push(...Costs);
- if (bNode.data.calcBase) CostComposition.children.push(new Formula(bNode.data));
- return CostComposition.children.length > 0 ? CostComposition : null;
- //定额空行不输出到接口文件中。 //定额空行的判断是:定额编码、定额名称、定额单位、定额单位、定额工程量为零或为空时
- function isEmptyRation(ration) {
- return !gljUtil.isNotEmpty(ration.code) && !gljUtil.isNotEmpty(ration.name) && !gljUtil.isNotEmpty(ration.unit) && (!gljUtil.isNotEmpty(ration.quantity) || ration.quantity == 0)
- }
- function Formula(bills) {
- let sumFix = (bills.name === '已包含在清单合计中的材料、工程设备、专业工程暂估价合计') ? fixedSumVal : 0;
- const attrs = [{
- name: "Name",
- value: bills.name
- },
- {
- name: "Formulas",
- value: _getFormulaDispName(cacheForFormula, bills)
- },
- {
- name: "Ratio",
- value: 1
- },
- {
- name: "Sum",
- // value: bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : "",
- // value: _getNumValueByExportKind(bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : "") - sumFix,
- value: _getNumValueByExportKind(bills.feesIndex && bills.feesIndex.common ? bills.feesIndex.common.tenderTotalFee : ""), // 不用再减一次sumFix
- type: TYPE.DECIMAL
- },
- {
- name: "Remarks",
- value: bills.remark
- }
- ]
- Element.call(this, "Formula", attrs);
- // 1.Name
- // 名称/描述。取清单的名称。
- // 2.Formulas
- // 计算式。读取计算基数的文本。
- // 取基数计算窗口内容,基数直接转换为金额?参考标准文档的 7.11 及 7.12 节。
- // 7.11是定额的费用,7.12是清单累进基数,主要是估概预算中用到,清单里的不同,所以中山的接口直接输出基数文本。
- // 3.Ratio
- // 系数。输出为1,非必填。
- // 4.Sum
- // 取金额。
- // 5.Remarks
- }
- function Cost(item) {
- let BasePrice = 0;
- if (item.type == rationType.volumePrice) { // 当插入的是量价时,基价读取单价列。
- BasePrice = item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
- } else {
- BasePrice = getBasePrice(item.projectGLJID, tenderProject)
- }
- let calcMap = tenderProject.calcProgram.compiledTemplateMaps
- let CostTypeNo = '';
- if (feeRateMap[calcMap[item.programID]]) CostTypeNo = feeRateMap[calcMap[item.programID]];
- const attrs = [{
- name: "Code",
- value: item.code,
- }, {
- name: 'Name',
- value: item.name
- }, {
- name: 'Spec',
- value: item.specs
- }, {
- name: 'Unit',
- value: item.unit
- }, {
- name: 'Num',
- value: item.tenderQuantity
- }, {
- name: 'BasePrice',
- value: BasePrice
- }, {
- name: 'Price',
- value: item.feesIndex && item.feesIndex.common ? item.feesIndex.common.tenderUnitFee : 0
- }, {
- name: 'IsEquipment',
- value: item.subType == gljType.EQUIPMENT ? 1 : 0
- }, {
- name: 'CostTypeNo',
- value: CostTypeNo
- }, {
- name: 'ProfitRate',
- value: getFeeRate(item.programID, 'profit', tenderProject)
- },
- {
- name: 'TaxRate',
- value: getFeeRate(item.programID, 'tax', tenderProject)
- },
- {
- name: 'MpRatio',
- value: item.subType == gljType.LABOUR ? 100 : 0
- },
- {
- name: 'MaterialRatio',
- value: item.subType == gljType.GENERAL_MATERIAL ? 100 : 0
- },
- {
- name: 'MechRatio',
- value: item.subType == gljType.GENERAL_MACHINE ? 100 : 0
- }
- ]
- Element.call(this, "Cost", attrs);
- this.children.push(CostStructure(item, tenderProject.property.decimal.ration.totalPrice));
- }
- function Ration(ration) {
- let calcMap = tenderProject.calcProgram.compiledTemplateMaps
- let CostTypeNo = '';
- if (feeRateMap[calcMap[ration.programID]]) CostTypeNo = feeRateMap[calcMap[ration.programID]];
- const attrs = [{
- name: "NormLibNo",
- value: 'YSDE-000000-2018-86',
- }, {
- name: 'DisplayCode',
- value: ration.code
- }, {
- name: 'Name',
- value: ration.name
- }, {
- name: 'Unit',
- value: ration.unit
- }, {
- name: 'Num',
- value: ration.tenderQuantity
- },
- {
- name: 'CostTypeNo',
- value: CostTypeNo
- },
- {
- name: 'ProfitRate',
- value: getFeeRate(ration.programID, 'profit', tenderProject) //tenderProject.ProfitRate
- },
- {
- name: 'TaxRate',
- value: getFeeRate(ration.programID, 'tax', tenderProject) //tenderProject.TaxRate
- },
- {
- name: 'FabricationCost',
- value: ration.feesIndex && ration.feesIndex.common ? ration.feesIndex.common.tenderTotalFee : 0
- },
- {
- name: 'AdjustStatus',
- value: ration.adjustState
- }
- ]
- Element.call(this, "Norm", attrs);
- this.children.push(CostStructure(ration, tenderProject.property.decimal.ration.totalPrice));
- this.children.push(Consume(ration));
- }
- }
- function Consume(ration) {
- let consume = new emptyElement('Consume');
- for (let rg of ration.rationGLJList) {
- consume.children.push(new ConsumeItem(rg));
- }
- return consume;
- function ConsumeItem(rg) {
- const attrs = [{
- name: "Code",
- value: rg.code,
- }, {
- name: "Consumption",
- value: rg.tenderQuantity
- }];
- Element.call(this, "ConsumeItem", attrs);
- }
- }
- function CostStructure(item, decimalNum) {
- let CostStructure = new emptyElement('CostStructure');
- for (let f of cpFeeTypes) {
- if (itemFeeMap[f.type]) CostStructure.children.push(new CostItem(item, f.type))
- }
- if (CostStructure.children.length == 0) CostStructure.children.push(new CostItem({}, ""))
- function CostItem(item, type) {
- const attrs = [{
- name: "ItemNo",
- value: itemFeeMap[type],
- }, {
- name: 'Sum',
- value: 0 //fee.tenderTotalFee
- }]
- if ((isBidSubmission || isControl) && item.feesIndex && item.feesIndex[type]) {
- attrs[1].value = scMathUtil.roundForObj(item.feesIndex[type].tenderTotalFee, decimalNum);
- if ((item.name === '已包含在清单合计中的材料、工程设备、专业工程暂估价合计') && (itemFeeMap[type] === 'JAF')) {
- attrs[1].value = scMathUtil.roundForObj(attrs[1].value - fixedSumVal, decimalNum);
- }
- }
- Element.call(this, "CostItem", attrs);
- }
- return CostStructure;
- }
- }
- }
- }
- function Params(tenderProject) {
- let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
- let featrueMap = {};
- let baseMap = {};
- for (let f of feature) {
- featrueMap[f.key] = f;
- }
- let baseInfo = _.find(tenderProject.property.basicInformation, {
- dispName: "基本信息",
- });
- for (let i of baseInfo.items) {
- let key = i.key;
- //if (i.dispName == "编制日期") key = "编制时间";
- baseMap[key] = i;
- }
- let BuildType = "";
- if (baseMap["natureConstruction"].value == "新建") BuildType = 0;
- if (baseMap["natureConstruction"].value == "改扩建") BuildType = 1;
- let Terrain = "";
- if (baseMap["terrainCategory"].value == "平原微丘") Terrain = 0;
- if (baseMap["terrainCategory"].value == "山岭重丘") Terrain = 1;
- let DesignSpeed = featrueMap["designSpeed"].value;
- let Structure = "";
- if (featrueMap["pavementStructure"].value == "沥青路面") Structure = 0;
- if (featrueMap["pavementStructure"].value == "水泥混凝土路面") Structure = 1;
- if (featrueMap["pavementStructure"].value == "其他类型路面") Structure = 2;
- let RoadGrade = "";
- if (RoadGradeMap[baseMap["roadGrade"].value]) RoadGrade = RoadGradeMap[baseMap["roadGrade"].value];
- const attrs = [{
- name: "PrjArea",
- value: baseMap["location"] ? baseMap["location"].value : ""
- },
- {
- name: "StartPileNo",
- value: baseMap["startChainages"] ? baseMap["startChainages"].value : "",
- mustHasValue: true
- },
- {
- name: "EndPileNo",
- value: baseMap["endChainages"] ? baseMap["endChainages"].value : "",
- mustHasValue: true
- },
- {
- name: "BuildType",
- value: BuildType,
- },
- {
- name: "Terrain",
- value: Terrain,
- mustHasValue: true
- },
- {
- name: "RoadGrade",
- value: RoadGrade,
- mustHasValue: true
- },
- {
- name: "DesignSpeed",
- value: DesignSpeed,
- mustHasValue: true
- },
- {
- name: "Structure",
- value: Structure,
- mustHasValue: true
- },
- {
- name: "SubgradeWidth",
- value: featrueMap["subgradeWidth"] ? featrueMap["subgradeWidth"].value : "",
- mustHasValue: true
- },
- {
- name: "RoadLength",
- value: featrueMap["roadLength"] ? featrueMap["roadLength"].value : "",
- mustHasValue: true
- },
- {
- name: "BridgeLength",
- value: featrueMap["bridgeLength"] ? featrueMap["bridgeLength"].value : "",
- mustHasValue: true
- },
- {
- name: "TunnelLength",
- value: featrueMap["tunnelLength"] ? featrueMap["tunnelLength"].value : "",
- mustHasValue: true
- },
- {
- name: "BriTunRate",
- value: featrueMap["briTunRate"] ? featrueMap["briTunRate"].value : "",
- mustHasValue: true
- },
- {
- name: "InterchangeNum",
- value: featrueMap["interchangeNum"] ? featrueMap["interchangeNum"].value : "",
- mustHasValue: true
- },
- {
- name: "StubLengths",
- value: featrueMap["stubLengths"] ? featrueMap["stubLengths"].value : "",
- mustHasValue: true
- },
- {
- name: "LaneLength",
- value: featrueMap["laneLength"] ? featrueMap["laneLength"].value : "",
- mustHasValue: true
- },
- ];
- Element.call(this, "Params", attrs);
- }
- function SummaryOfCost(totalItem, proItem, safeItem, oneToSevenItem, feature) {
- let attrs = [{
- name: "TenderSumLimit",
- value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
- type: TYPE.DECIMAL,
- toFix: 2,
- },
- {
- name: "BidTotal",
- value: totalItem.feesIndex && totalItem.feesIndex.common && totalItem.feesIndex.common.tenderTotalFee ? totalItem.feesIndex.common.tenderTotalFee : 0,
- type: TYPE.DECIMAL,
- toFix: 2,
- },
- {
- name: "BillTotal",
- value: oneToSevenItem.feesIndex && oneToSevenItem.feesIndex.common && oneToSevenItem.feesIndex.common.tenderTotalFee ? oneToSevenItem.feesIndex.common.tenderTotalFee : 0,
- type: TYPE.DECIMAL,
- toFix: 2,
- },
- {
- name: "CostForHSE",
- value: safeItem && safeItem.feesIndex && safeItem.feesIndex.common && safeItem.feesIndex.common.tenderTotalFee ? safeItem.feesIndex.common.tenderTotalFee : 0,
- type: TYPE.DECIMAL,
- toFix: 2,
- },
- {
- name: "ProvisionalSums",
- value: proItem.feesIndex && proItem.feesIndex.common && proItem.feesIndex.common.tenderTotalFee ? proItem.feesIndex.common.tenderTotalFee : 0,
- type: TYPE.DECIMAL,
- toFix: 2,
- },
- {
- name: "Appraisal",
- // value: totalItem.feesIndex && totalItem.feesIndex.estimate && totalItem.feesIndex.estimate.tenderTotalFee ? totalItem.feesIndex.estimate.tenderTotalFee : 0,
- value: 0,
- type: TYPE.DECIMAL,
- toFix: 2,
- },
- ];
- if (isBidInvitation) {
- attrs.splice(0, 3) //招标
- }
- //if (isControl) attrs.splice(1, 5); //控制价
- if (isBidSubmission) { //投标文件时,读工程特征中的 招标控制价 值
- let tenderSumLimit = _.find(feature, { "key": "tenderSumLimit" });
- if (tenderSumLimit) attrs[0].value = tenderSumLimit.value
- }
- Element.call(this, "SummaryOfCost", attrs);
- }
- function MakeInfo(tenderProject) {
- let property = tenderProject.property;
- let baseMap = {};
- let baseInfo = _.find(property.basicInformation, {
- dispName: "基本信息",
- });
- for (let i of baseInfo.items) {
- let key = i.key;
- //if (i.dispName == "编制日期") key = "编制时间";
- baseMap[key] = i;
- }
- //mustHasValue
- const attrs = [{
- name: "ValuationModel",
- value: property.taxType,
- },
- {
- name: "Manage",
- value: baseMap["constructingUnit"] ? baseMap["constructingUnit"].value : "",
- },
- {
- name: "Designer",
- value: baseMap["designUnit"] ? baseMap["designUnit"].value : "",
- mustHasValue: true
- },
- {
- name: "Compile",
- value: baseMap["compileUnit"] ? baseMap["compileUnit"].value : "",
- },
- {
- name: "CompileApprover",
- value: baseMap["compileApprover"] ? baseMap["compileApprover"].value : "",
- },
- {
- name: "CompileCertNo",
- value: baseMap["compileCertNo"] ? baseMap["compileCertNo"].value : "",
- mustHasValue: true
- },
- {
- name: "CompileDate",
- value: baseMap["compileDate"] && baseMap["compileDate"].value != "" ? baseMap["compileDate"].value + "T00:00:00" : "",
- mustHasValue: true
- },
- {
- name: "Review",
- value: baseMap["reviewUnit"] ? baseMap["reviewUnit"].value : "",
- mustHasValue: true
- },
- {
- name: "ReviewApprover",
- value: baseMap["reviewApprover"] ? baseMap["reviewApprover"].value : "",
- mustHasValue: true
- },
- {
- name: "ReviewCertNo",
- value: baseMap["reviewCertNo"] ? baseMap["reviewCertNo"].value : "",
- mustHasValue: true
- },
- {
- name: "ReviewDate",
- value: baseMap["reviewDate"] && baseMap["reviewDate"].value != "" ? baseMap["reviewDate"].value + "T00:00:00" : "",
- mustHasValue: true
- },
- {
- name: "Examine",
- value: baseMap["examineUnit"] ? baseMap["examineUnit"].value : "",
- mustHasValue: true
- },
- {
- name: "ExamineApprover",
- value: baseMap["examineApprover"] ? baseMap["examineApprover"].value : "",
- mustHasValue: true
- },
- {
- name: "ExamineCertNo",
- value: baseMap["examineCertNo"] ? baseMap["examineCertNo"].value : "",
- mustHasValue: true
- },
- {
- name: "ExamineDate",
- value: baseMap["examineDate"] && baseMap["examineDate"].value != "" ? baseMap["examineDate"].value + "T00:00:00" : "",
- mustHasValue: true
- },
- {
- name: "CompileExplain",
- value: baseMap["compileExplain"] ? baseMap["compileExplain"].value : "",
- mustHasValue: true
- },
- {
- name: "ExamineExplain",
- value: baseMap["examineExplain"] ? baseMap["examineExplain"].value : "",
- mustHasValue: true
- },
- {
- name: "ProjectExplain",
- value: baseMap["projectExplain"] ? baseMap["projectExplain"].value : "",
- mustHasValue: true
- },
- {
- name: "Bidder",
- // value: baseMap["bidderCompany"] ? baseMap["bidderCompany"].value : "",
- value: baseMap["bidderName"] ? baseMap["bidderName"].value : "",
- mustHasValue: true
- },
- ];
- if (isBidInvitation) { //招标文件,则以下的8、12~18则不输出
- attrs.splice(11, 7);
- attrs.splice(7, 1);
- }
- Element.call(this, "MakeInfo", attrs);
- }
- let data = new CprjInfo(projectData.name);
- data.children.push(new SystemInfo(projectData));
- data.children.push(new CostBasis());
- let seriNo = 1;
- let Rates = [];
- let Practs = [];
- let EprjInfos = [];
- for (let c of projectData.children) {
- let tenderProject = tenderDetailMap[c.ID];
- let feeRataDatas = tenderProject.FeeRate.datas;
- Rates.push(new Rate(tenderProject, feeRataDatas, seriNo));
- Practs.push(new Pract(tenderProject, seriNo));
- EprjInfos.push(new EprjInfo(tenderProject));
- seriNo++;
- }
- data.children.push(...Rates, ...Practs, ...EprjInfos);
- return [{
- data: data,
- exportKind: exportKind,
- fileName: projectData.name + INTERFACE_CONFIG[areaKey]["fileSuffix"][exportKind],
- },];
- }
- // 山东需求,要有密文校验信息(SM3算法,在界面上已导入sm3对象)
- /**
- * SM3加密主函数
- * @param msg
- * @returns
- */
- function sm3Digest(msg) {
- let hashHex = sm3(msg);
- // return hashHex;
- return hashHex.toUpperCase();
- }
- function _extractBillCalcRefs(currentBill) {
- const rst = [];
- function _extract(spliter, excluded = true, nextGap) {
- let currentBillCalcBase = currentBill.calcBase;
- let currentIdx = currentBillCalcBase.indexOf(spliter);
- let exCnt = 0;
- if (excluded) exCnt = spliter.length;
- while (currentIdx >= 0) {
- let bId = currentBillCalcBase.substr(currentIdx + excluded, nextGap);
- if (!rst.includes(bId)) {
- rst.push(bId);
- }
- currentBillCalcBase = currentBillCalcBase.substr(currentIdx + excluded + nextGap);
- currentIdx = currentBillCalcBase.indexOf(spliter);
- }
- }
- if (typeof currentBill.calcBase === 'string') {
- //1. 抽取@引用
- _extract('@', true, 36);
- //2. 抽取特殊引用
- // 2.1 {各章清单合计}
- _extract('{各章清单合计}', false, '{各章清单合计}'.length);
- // 2.2 {100章以外清单合计}
- _extract('{100章以外清单合计}', false, '{100章以外清单合计}'.length);
- }
- return rst;
- }
- function _preCodeingForBills(tenderProject) {
- const cacheObj = {};
- function _chkAdhocChapterBill(bill) {
- let rst = false;
- if (typeof bill.name === 'string' && bill.name.includes('00章') && bill.name.includes('清单')) {
- rst = true;
- }
- return rst;
- }
- function _setCache(bNode) {
- cacheObj['_' + bNode.data.ID] = bNode.data;
- if (bNode.children && bNode.children.length > 0) {
- for (let subNode of bNode.children) {
- _setCache(subNode);
- }
- }
- }
- let rootNodes = tenderProject.mainTree.roots;
- for (let rootNode of rootNodes) {
- _setCache(rootNode);
- }
- let cnt = 1;
- let billsForAcc = [];
- for (let bill of tenderProject.Bills.datas) {
- //这一步设置特殊清单(各章清单合计, 100章~1200章)
- cacheObj['_{100章以外清单合计}'] = {};
- if (_billStrFilter(bill.name).includes('第100章至700章清单') || sectionNameMap[_billStrFilter(bill.name)] || _chkAdhocChapterBill(bill)) {
- if (cacheObj['_' + bill.ID]) {
- if (!cacheObj['_' + bill.ID].hasOwnProperty('formulaCode')) {
- cacheObj['_' + bill.ID].formulaCode = `F${cnt}`;
- cnt++;
- }
- }
- // if (_billStrFilter(bill.name).includes('第100章至700章清单')) {
- if (_billStrFilter(bill.name).includes('第100章至') && _billStrFilter(bill.name).includes('00章清单')) {
- cacheObj['_{各章清单合计}'] = {};
- cacheObj['_{各章清单合计}'].formulaCode = `{F${cnt - 1}}`;
- } else if (!_billStrFilter(bill.name).includes('清单第100章')) {
- billsForAcc.push(`F${cnt - 1}`);
- }
- }
- }
- let tmpStr = ''
- for (let idx = 0; idx < billsForAcc.length; idx++) {
- if (idx === 0) {
- tmpStr = '( ' + `{${billsForAcc[idx]}}`;
- } else {
- tmpStr = tmpStr + ` + {${billsForAcc[idx]}}`;
- }
- if (idx === billsForAcc.length - 1) tmpStr = tmpStr + ' )';
- }
- cacheObj['_{100章以外清单合计}'].formulaCode = tmpStr;
- for (let bill of tenderProject.Bills.datas) {
- let billRefs = _extractBillCalcRefs(bill);
- for (let refBillId of billRefs) {
- if (cacheObj['_' + refBillId]) {
- if (!cacheObj['_' + refBillId].hasOwnProperty('formulaCode')) {
- cacheObj['_' + refBillId].formulaCode = `F${cnt}`;
- cnt++;
- }
- }
- }
- }
- return cacheObj;
- }
- function _getFormulaDispName(cacheForFormula, currentBill) {
- let rst = currentBill.calcBase;
- if (typeof currentBill.calcBase === 'string') {
- //1. @引用
- let currentBillCalcBase = currentBill.calcBase;
- let currentIdx = currentBillCalcBase.indexOf('@');
- let bIdArr = [], replaceArr = [];
- while (currentIdx >= 0) {
- let bId = currentBillCalcBase.substr(currentIdx + 1, 36);
- bIdArr.push(bId);
- if (cacheForFormula['_' + bId]) {
- if (cacheForFormula['_' + bId].hasOwnProperty('formulaCode')) {
- replaceArr.push(`{${cacheForFormula['_' + bId].formulaCode}}`);
- } else {
- replaceArr.push(`{无formulaCode错误:${bId}}`);
- }
- } else {
- replaceArr.push(`{引用错误:${bId}}`);
- }
- currentBillCalcBase = currentBillCalcBase.substr(currentIdx + 37);
- currentIdx = currentBillCalcBase.indexOf('@');
- }
- let tempBillCalcBase = currentBill.calcBase;
- for (let idx = 0; idx < bIdArr.length; idx++) {
- tempBillCalcBase = tempBillCalcBase.replace('@' + bIdArr[idx], replaceArr[idx]);
- }
- //2. 特殊引用
- //{各章清单合计} {100章以外清单合计}
- if (tempBillCalcBase.includes('{各章清单合计}')) {
- console.log(`特殊引用清单{各章清单合计}:${currentBill.name}(${currentBill.code} - ${tempBillCalcBase})`);
- tempBillCalcBase = tempBillCalcBase.replace('{各章清单合计}', cacheForFormula['_{各章清单合计}'].formulaCode);
- }
- if (tempBillCalcBase.includes('{100章以外清单合计}')) {
- console.log(`特殊引用清单{100章以外清单合计}:${currentBill.name}(${currentBill.code} - ${tempBillCalcBase})`);
- tempBillCalcBase = tempBillCalcBase.replace('{100章以外清单合计}', cacheForFormula['_{100章以外清单合计}'].formulaCode);
- }
- //
- rst = tempBillCalcBase;
- }
- return rst;
- }
- return {
- entry,
- };
- })();
|