Explorar el Código

接口相关数据更新

zhongzewei hace 6 años
padre
commit
0109c31fd2
Se han modificado 1 ficheros con 120 adiciones y 27 borrados
  1. 120 27
      web/building_saas/main/js/models/exportStandardInterface.js

+ 120 - 27
web/building_saas/main/js/models/exportStandardInterface.js

@@ -302,6 +302,7 @@ const XMLStandard = (function () {
                 otherItemNo: [],               //其他列项序号
                 feeItemNo: [],                 //费用项序号
                 mainBillsCode: [],             //主要清单明细项目编码 (标准文件中constraint中没有定义此唯一性,但是主要清单明细的备注那里说明了,这里处理一下)
+                appraisalDetailCode: [],         //评审材料明细代码唯一(标准文件中constraint中没有定义此唯一性,但是评审材料明细的备注里说明了)
             };
             element.call(this, '单位工程', attrs);
         }
@@ -656,7 +657,7 @@ const XMLStandard = (function () {
                 {name: '计算基础', value: source.calcBase,  maxLen: 255},
                 {name: '费率', value: source.feeRate, type: TYPE.DECIMAL},
                 {name: '金额', value: source.commonTotalFee, type: TYPE.NUM2, required: true},
-                {name: '不计入合价标志', value: false, type: TYPE.BOOL},
+                {name: '不计入合价标志', value: source.notSummray, type: TYPE.BOOL},
                 {name: '招标人标志', value: false, type: TYPE.BOOL},
                 {name: '备注', value: source.remark, maxLen: 255}
             ];
@@ -690,7 +691,7 @@ const XMLStandard = (function () {
             let attrs = [
                 {name: '代码', value: source.code, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
-                {name: '规格', value: source.spec, maxLen: 255},
+                {name: '规格', value: source.specs, maxLen: 255},
                 {name: '单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
                 {name: '原始代码', value: source.orgCode, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE},
                 {name: '费用类别', value: source.feeType, enumeration: ['1', '2', '3', '4'], required: true},
@@ -698,12 +699,12 @@ const XMLStandard = (function () {
                 {name: '主要材料类别', value: source.mainMaterialType, type: TYPE.INT},
                 {name: '主要材料单位系数', value: source.materialCoe, type: TYPE.DECIMAL},
                 {name: '材料耗用类型', value: 0, type: TYPE.INT, required: true},
-                {name: '供货方式', value: source.supply, type: TYPE.INT},  //todo
-                {name: '暂估材料标志', value: !!source.is_evaluate, type: TYPE.BOOL},
-                {name: '不计税设备标志', value: !!source.is_adjust_price, type: TYPE.BOOL, required: true},  //todo
-                {name: '单价不从明细汇总标志', value: !!source.excludeRatio, type: TYPE.BOOL},  //todo
+                {name: '供货方式', value: source.supply, type: TYPE.INT},
+                {name: '暂估材料标志', value: source.is_evaluate, type: TYPE.BOOL},
+                {name: '不计税设备标志', value: source.no_tax_eqp, type: TYPE.BOOL, required: true},
+                {name: '单价不从明细汇总标志', value: source.notFromDetail, type: TYPE.BOOL},
                 {name: '定额价', value: source.basePrice, type: TYPE.DECIMAL, required: true},
-                {name: '定额价调整', value: source.adjPrice, type: TYPE.DECIMAL, required: true},   //todo
+                {name: '定额价调整', value: source.adjPrice, type: TYPE.DECIMAL, required: true},
                 {name: '市场价', value: source.marketPrice, type: TYPE.DECIMAL, required: true},
                 {name: '数量', value: source.quantity, type: TYPE.DECIMAL, required: true},
                 {name: '产地', value: source.originPlace, maxLen: 255},
@@ -722,6 +723,33 @@ const XMLStandard = (function () {
             ];
             element.call(this, '人材机配比', attrs);
         }
+        //评标材料表定义
+        function EvalBidMaterial() {
+            element.call(this, '评标材料表', []);
+        }
+        //暂估价材料表定义
+        function EvalEstimateMaterial() {
+            element.call(this, '暂估价材料表', []);
+        }
+        //材料明细定义
+        function MaterialDetail(source) {
+            let attrs = [
+                {name: '序号', value: source.serialNo, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
+                {name: '关联材料号', value: source.orgCode, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE},
+                {name: '材料名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
+                {name: '规格型号', value: source.specs, maxLen: 255},
+                {name: '计量单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
+                {name: '数量', value: source.quantity, type: TYPE.DECIMAL},
+                {name: '单价', value: source.marketPrice, type: TYPE.DECIMAL},
+                {name: '合价', value: source.totalPrice, type: TYPE.NUM2},
+                {name: '产地', value: source.originPlace, maxLen: 255},
+                {name: '厂家', value: source.vender, maxLen: 255},
+                {name: '品牌', value: source.brand, maxLen: 255},
+                {name: '质量等级', value: source.qualityGrace, maxLen: 255},
+                {name: '备注', value: source.remark, maxLen: 255},
+            ];
+            element.call(this, '材料明细', attrs);
+        }
         //清单综合单价计算程序定义
         function CalcProgram() {
             element.call(this, '清单综合单价计算程序', []);
@@ -766,6 +794,21 @@ const XMLStandard = (function () {
             ];
             element.call(this, '主要清单明细', attrs);
         }
+        //评审材料汇总定义
+        function AppraisalSummary(){
+            element.call(this, '评审材料汇总', []);
+        }
+        //评审材料明细定义
+        function AppraisalDetail(source) {
+            let attrs = [
+                {name: '代码', value: source.orgCode, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
+                {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
+                {name: '规格', value: source.specs, maxLen: 255},
+                {name: '单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE, required: true},
+                {name: '市场价', value: source.marketPrice, type: TYPE.DECIMAL, required: true}
+            ];
+            element.call(this, '评审材料明细', attrs);
+        }
 
         async function setTimeoutSync(handle, time) {
             return new Promise(function(resolve, reject) {
@@ -928,18 +971,31 @@ const XMLStandard = (function () {
             project.children.push(feeForm);
             //主要清单汇总    主要清单明细在loadTender中设置
             let mainBillsSummaryEle = new MainBillsSummary();
-            project.children.unshift(mainBillsSummaryEle);  //插入到第一个位置,必须要排在loadTender前,这样才能添加到明细数据,插在第一位方便后面排序
+            project.children.unshift(mainBillsSummaryEle);  //必须要排在loadTender前,这样才能添加到明细数据
+            //评审材料汇总    评审材料明细在loadTender中设置
+            let appraisalSummary = new AppraisalSummary();
+            project.children.unshift(appraisalSummary);
             //单项工程
             for (let eng of projectData.children) {
                 curPMData.engineering = eng;
                 let engElement = await loadEngineering(projectData.summaryInfo, eng);
                 project.children.push(engElement);
             }
-            //主要清单汇总 排在后面
-            project.children.shift(mainBillsSummaryEle);
-            project.children.push(mainBillsSummaryEle);
+            //主要清单汇总、评审材料汇总 排在后面
+            project.children = [...project.children.slice(2), mainBillsSummaryEle, appraisalSummary];
             return project;
         }
+        //单位工程内的人材机ID: 用于代码映射关系 //单位工程级别,C+数组下标 <==> gljID
+        let tenderGljs = [];
+        //获取人材机代码,eg: C0, C1....
+        function getGljCode(gljID) {
+            let idx = tenderGljs.findIndex(ID => ID === gljID);
+            if (~idx) {
+                return `C${idx}`;
+            }
+            tenderGljs.push(gljID);
+            return `C${tenderGljs.length - 1}`;
+        }
         /*
          * 加载单项工程数据
          * @param {Object}summaryInfo(项目汇总信息映射) {Object}engData(单项工程数据)
@@ -957,6 +1013,7 @@ const XMLStandard = (function () {
                 curPMData.tender = tenderData;
                 await setTimeoutSync(() => {},TIMEOUT_TIME);    //间隔一段时间再初始单位工程数据,减少服务器压力
                 let tender = await loadTender(summaryInfo, tenderData);
+                tenderGljs = [];    //清空单位工程内所有的人材机(ID)
                 engineering.children.push(tender);
             }
             return engineering;
@@ -979,6 +1036,10 @@ const XMLStandard = (function () {
                     tenderDetail.rationLibMap[lib.id] = lib;
                 }
             }
+            //初始化项目人材机代号(人材机生成的代号要由排序后的项目人材机从C0开始生成),定额下的人材机含量提前使用到了这个代码,所以需要先初始化
+            let allGljs = gljUtil.sortRationGLJ(tenderDetail.projectGLJ.datas.gljList); //人材机汇总排序
+            tenderGljs = allGljs.map(glj => glj.glj_id);
+
             //单位工程
             let tenderSource = {
                 code: getIncreamentData('projectCode'),
@@ -1014,10 +1075,21 @@ const XMLStandard = (function () {
             //规费和税金清单
             let chargeTax = loadChargeTax(tenderDetail);
             tender.children.push(chargeTax);
+            //建设项目下评审材料汇总设置评审材料明细
+            let curAppraisalSummary = curProjectEle.children.find(ele => ele.name === '评审材料汇总');
             //人材机汇总
-            let gljSummary = loadGlj(tenderDetail);
-            if (gljSummary) {
+            let gljSumarryInfo = loadGlj(curAppraisalSummary, tenderDetail);
+            if (gljSumarryInfo) {
+                let {gljSummary, evalBidMaterial, evalEstimateMaterial} = gljSumarryInfo;
                 tender.children.push(gljSummary);
+                //评标材料表
+                if (evalBidMaterial && evalBidMaterial.children.length) {
+                    tender.children.push(evalBidMaterial);
+                }
+                //暂估价材料表
+                if (evalEstimateMaterial && evalEstimateMaterial.children.length) {
+                    tender.children.push(evalEstimateMaterial);
+                }
             }
             //清单综合单价计算程序
             let calcProgram = loadCalcProgram(tenderDetail);
@@ -1212,7 +1284,8 @@ const XMLStandard = (function () {
                 rationGljData = gljUtil.sortRationGLJ(rationGljData);
                 for (let rGlj of rationGljData) {
                     let gljSource = {
-                        code: rGlj.code,
+                        //code: rGlj.code,
+                        code: getGljCode(rGlj.GLJID),
                         quantity: rGlj.quantity,
                         totalQuantity: gljUtil.getTotalQuantity(rGlj,  rationData, decimal.glj.quantity, decimal.ration.quantity)
                     };
@@ -1250,9 +1323,6 @@ const XMLStandard = (function () {
                 failList.push('不存在分部分项清单');
                 return fbfxBills;
             }
-            if (subEngNode.children.length === 0) {
-                failList.push('分部分项清单下必须要有清单分部或清单项目');
-            }
             for (let node of subEngNode.children) {
                 if (node.data.type === billType.FB) {
                     if (node.children.length === 0) {
@@ -1570,6 +1640,7 @@ const XMLStandard = (function () {
                         calcBase: node.data.calcBase,
                         feeRate: node.data.feeRate !== '' ? node.data.feeRate : 100,
                         commonTotalFee: totalFee,
+                        notSummary: belongFlag && belongFlag === fixedFlag.MATERIAL_PROVISIONAL,   //不计入合价,只有材料(工程设备)暂估价固定节点
                         remark: node.data.remark
                     });
                     otherItems.push(otherItemEle);
@@ -1643,15 +1714,21 @@ const XMLStandard = (function () {
             }
         }
         /*
-        * 加载人材机汇总
-        * @param {Object}detail
+        * 加载人材机汇总相关:人材机汇总、评标、暂估
+        * @param {Object}appraisalSummary(建设项目下的评审材料汇总) {Object}detail
         * @return {Object}
         * */
-        function loadGlj(detail) {
+        function loadGlj(appraisalSummary, detail) {
             let gljList = detail.projectGLJ.datas.gljList;
+            let evalBidSeq = 1,    //评标序号
+                evalEstSeq = 1;    //暂估序号
             if (gljList.length > 0) {
                 //创建人材机汇总节点
                 let gljSummary = new GljSummary();
+                //创建评标材料表节点
+                let evalBidMaterial = new EvalBidMaterial();
+                //创建暂估价材料表节点
+                let evalEstimateMaterial = new EvalEstimateMaterial();
                 //人材机节点
                 let allGljs = gljUtil.sortRationGLJ(gljList); //人材机汇总排序
                 //计算总消耗量
@@ -1687,19 +1764,21 @@ const XMLStandard = (function () {
                         feeType = '4';
                     }
                     let gljSource = {
-                        code: glj.code,
+                        //code: glj.code,
+                        code: getGljCode(glj.glj_id),
                         name: glj.name,
-                        spec: glj.spec,
+                        specs: glj.specs,
                         unit: glj.unit,
-                        orgCode: glj.original_code,
+                        orgCode: glj.code,  //不取原始编码了,直接取编码
                         feeType: feeType,
                         ratioType: ratioMapping[glj.type],
                         mainMaterialType: mainMaterialMapping[glj.materialType],
                         materialCoe: glj.materialCoe,
                         supply: glj.supply === 2 ? 2 : 1,   //供货方式为“完全甲供”,取“2”;否则取“1”。
-                        is_evaluate: glj.is_evaluate,
+                        is_evaluate: !!glj.is_evaluate,
+                        no_tax_eqp: !!glj.no_tax_eqp,
                         notFromDetail: !glj.ratio_data.length, //单价不从明细汇总标志,如果有配比组成,取“false”;否则取“true”。
-                        basePrice: price.base,
+                        basePrice: price.basePrice,
                         adjPrice: adjPrice,
                         marketPrice: price.marketPrice,
                         quantity: glj.quantity,
@@ -1717,13 +1796,27 @@ const XMLStandard = (function () {
                         ratioData = detail.projectGLJ.datas.mixRatioMap[connectKey];
                     if (ratioData && Array.isArray(ratioData)) {
                         for (let ratio of ratioData) {
-                            let gljRatio = new GljRatio({code: ratio.code, quantity: ratio.consumption});
+                            let gljRatio = new GljRatio({code: getGljCode(ratio.glj_id), quantity: ratio.consumption});
                             gljEle.children.push(gljRatio);
                         }
                     }
                     gljSummary.children.push(gljEle);
+                    gljSource.totalPrice = scMathUtil.roundForObj(gljSource.quantity * gljSource.marketPrice,
+                        detail.projectInfo.property.decimal.bills.totalPrice);
+                    //评标和暂估材料表下的材料明细中的人材机代码,要求单位工程内唯一,由于人材机汇总也有这个限制,所以这里不再处理
+                    if (glj.is_eval_material) { //评标
+                        gljSource.serialNo = evalBidSeq++;
+                        evalBidMaterial.children.push(new MaterialDetail(gljSource));
+                        //给建设项目下的评审材料汇总设置明细数据,这里需要检测代码(编号)唯一性,因为是汇总所有单位工程的,要求所有单位工程内评审材料代码唯一
+                        appraisalSummary.children.push(new AppraisalDetail(gljSource));
+                        checkUnique(curTenderEle.constraints.appraisalDetailCode, gljSource.code, '评审材料明细代码');
+                    }
+                    if (glj.is_evaluate) {  //暂估
+                        gljSource.serialNo = evalEstSeq++;
+                        evalEstimateMaterial.children.push(new MaterialDetail(gljSource));
+                    }
                 }
-                return gljSummary;
+                return {gljSummary, evalBidMaterial, evalEstimateMaterial};
             }
         }
         /*