Forráskód Böngészése

导入数据兼容新结构(承包人材料、评标材料、暂估材料)

zhongzewei 6 éve
szülő
commit
28a234078f

+ 12 - 0
modules/pm/facade/pm_facade.js

@@ -1513,6 +1513,18 @@ async function importTenderDetail(tenderData) {
         if (tenderData.projectGLJ.length) {
         if (tenderData.projectGLJ.length) {
             task.push(gljListModel.insertMany(tenderData.projectGLJ));
             task.push(gljListModel.insertMany(tenderData.projectGLJ));
         }
         }
+        // 承包人材料
+        if (tenderData.contractorList.length) {
+           task.push(contractorListModel.insertMany(tenderData.contractorList));
+        }
+        // 评标材料表
+        if (tenderData.bidEvaluationList.length) {
+            task.push(bidListModel.insertMany(tenderData.bidEvaluationList));
+        }
+        // 暂估价材料表
+        if (tenderData.evaluationList.length) {
+            task.push(evaluateListModel.insertMany(tenderData.evaluationList));
+        }
         //组成物
         //组成物
         if (tenderData.mixRatio.length) {
         if (tenderData.mixRatio.length) {
             task.push(mixRatioModel.insertMany(tenderData.mixRatio));
             task.push(mixRatioModel.insertMany(tenderData.mixRatio));

+ 7 - 34
web/building_saas/main/js/models/exportStandardInterface.js

@@ -794,7 +794,7 @@ const XMLStandard = (function () {
         function DifferentiaGljDetail(adjustType, source) {
         function DifferentiaGljDetail(adjustType, source) {
             let attrs = [
             let attrs = [
                 //getGljCode(source.id)
                 //getGljCode(source.id)
-                {name: '关联材料号', value: exportKind === _config.EXPORT_KIND.Tender ? source.relCode : '', minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
+                {name: '关联材料号', value: source.relCode, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '规格', value: source.specs, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '规格', value: source.specs, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
@@ -821,7 +821,7 @@ const XMLStandard = (function () {
         function ExponentialGljDetail(adjustType, source) {
         function ExponentialGljDetail(adjustType, source) {
             let attrs = [
             let attrs = [
                 // getGljCode(source.id)
                 // getGljCode(source.id)
-                {name: '关联材料号', value: exportKind === _config.EXPORT_KIND.Tender ? source.relCode : '', minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
+                {name: '关联材料号', value: source.relCode, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '规格', value: source.specs, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '规格', value: source.specs, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '变值权重B', value: adjustType === _config.ADJUST_TYPE.coe ? source.varWeight : '0', type: _config.TYPE.DECIMAL, required: true},
                 {name: '变值权重B', value: adjustType === _config.ADJUST_TYPE.coe ? source.varWeight : '0', type: _config.TYPE.DECIMAL, required: true},
@@ -894,7 +894,7 @@ const XMLStandard = (function () {
         function MaterialDetail(source) {
         function MaterialDetail(source) {
             let attrs = [
             let attrs = [
                 {name: '序号', value: source.seq, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '序号', value: source.seq, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
-                {name: '关联材料号', value: exportKind === _config.EXPORT_KIND.Tender ? source.relCode : '', minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
+                {name: '关联材料号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '材料名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '材料名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '规格型号', value: source.specs, maxLen: 255},
                 {name: '规格型号', value: source.specs, maxLen: 255},
                 {name: '计量单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '计量单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
@@ -1904,10 +1904,7 @@ const XMLStandard = (function () {
          * */
          * */
         function loadGlj(appraisalSummary, detail) {
         function loadGlj(appraisalSummary, detail) {
             let gljList = detail.projectGLJ.datas.gljList;
             let gljList = detail.projectGLJ.datas.gljList;
-            let evalBidSeq = 1,    //评标序号
-                evalEstSeq = 1;    //暂估序号
             // 人材机提取数据映射 id-数据映射
             // 人材机提取数据映射 id-数据映射
-            const allGLJMapping = {};
             if (gljList.length > 0) {
             if (gljList.length > 0) {
                 //创建人材机汇总节点
                 //创建人材机汇总节点
                 let gljSummary = new GljSummary();
                 let gljSummary = new GljSummary();
@@ -1983,7 +1980,6 @@ const XMLStandard = (function () {
                         brand: glj.brand,
                         brand: glj.brand,
                         remark: glj.remark
                         remark: glj.remark
                     };
                     };
-                    allGLJMapping[glj.id] = gljSource;
                     let gljEle = new Glj(gljSource);
                     let gljEle = new Glj(gljSource);
                     //人材机代码唯一
                     //人材机代码唯一
                     _util.checkUnique(curTenderEle.constraints.gljCode, gljSource.code, '人材机代码', gljSource.orgCode);
                     _util.checkUnique(curTenderEle.constraints.gljCode, gljSource.code, '人材机代码', gljSource.orgCode);
@@ -2006,7 +2002,7 @@ const XMLStandard = (function () {
                     gljSummary.children.push(gljEle);
                     gljSummary.children.push(gljEle);
                 }
                 }
                 // 评标材料
                 // 评标材料
-                const bidEvaluationDetail = loadMaterialDetail(detail.bid_evaluation_list.datas);
+                const bidEvaluationDetail = loadMaterialDetail(configMaterialObj.getBidMaterialDatas());
                 evalBidMaterial.children.push(...bidEvaluationDetail);
                 evalBidMaterial.children.push(...bidEvaluationDetail);
                 // 给建设项目下的评审材料汇总设置明细数据 //code name specs unit marketPrice
                 // 给建设项目下的评审材料汇总设置明细数据 //code name specs unit marketPrice
                 const appraisalSummaryDetail = bidEvaluationDetail.map(ele => {
                 const appraisalSummaryDetail = bidEvaluationDetail.map(ele => {
@@ -2022,38 +2018,15 @@ const XMLStandard = (function () {
                 });
                 });
                 appraisalSummary.children.push(...appraisalSummaryDetail);
                 appraisalSummary.children.push(...appraisalSummaryDetail);
                 // 暂估材料
                 // 暂估材料
-                const evaluationDetail = loadMaterialDetail(detail.evaluate_list.datas);
+                const evaluationDetail = loadMaterialDetail(configMaterialObj.getEvaluateMaterialDatas());
                 evalEstimateMaterial.children.push(...evaluationDetail);
                 evalEstimateMaterial.children.push(...evaluationDetail);
                 return {gljSummary, evalBidMaterial, evalEstimateMaterial};
                 return {gljSummary, evalBidMaterial, evalEstimateMaterial};
             }
             }
             // 加载材料明细
             // 加载材料明细
-            // todo configMaterialObj.getEvaluateMaterialDatas
             function loadMaterialDetail(datas) {
             function loadMaterialDetail(datas) {
                 return datas.map(data => {
                 return datas.map(data => {
-                    const relGLJSrc = allGLJMapping[data.projectGLJID];
-                    const quantity = relGLJSrc ? relGLJSrc.quantity : data.quantity;
-                    const marketPrice = relGLJSrc ? relGLJSrc.marketPrice : data.marketPrice;
-                    const originPlace = relGLJSrc ? relGLJSrc.originPlace : '';
-                    const vender = relGLJSrc ? relGLJSrc.vender : '';
-                    const brand = relGLJSrc ? relGLJSrc.brand : '';
-                    const qualityGrace = relGLJSrc ? relGLJSrc.qualityGrace : '';
-                    const src = {
-                        seq: data.seq,
-                        relCode: relGLJSrc ? relGLJSrc.code : '',
-                        name: data.name,
-                        specs: data.specs,
-                        unit: data.unit,
-                        quantity: quantity,
-                        marketPrice: marketPrice,
-                        totalPrice: scMathUtil.roundForObj(quantity * marketPrice, detail.projectInfo.property.decimal.bills.totalPrice),
-                        originPlace: originPlace,
-                        vender: vender,
-                        brand: brand,
-                        qualityGrace: qualityGrace,
-                        remark: data.remark
-                    };
-                    _util.checkUnique(curTenderEle.constraints.detailCode, src.relCode, '材料明细关联材料号', src.relCode);
-                    return new MaterialDetail(src);
+                    _util.checkUnique(curTenderEle.constraints.detailCode, data.code, '材料明细关联材料号', data.code);
+                    return new MaterialDetail(data);
                 });
                 });
             }
             }
         }
         }

+ 85 - 29
web/building_saas/main/js/models/importStandardInterface.js

@@ -336,6 +336,7 @@ const ImportXML = (() => {
                     differentiaSummary: loadDifferentiaSummary(src) ,//承包人材料差额法表
                     differentiaSummary: loadDifferentiaSummary(src) ,//承包人材料差额法表
                     exponentialSummary: loadExponentialSummary(src) ,//承包人材料指数法表
                     exponentialSummary: loadExponentialSummary(src) ,//承包人材料指数法表
                     evalBidSummary: loadEvalBidSummary(src),    //评标材料表
                     evalBidSummary: loadEvalBidSummary(src),    //评标材料表
+                    evalSummary: loadEvalSummary(src) // 暂估价材料表
                 };
                 };
             });
             });
         }
         }
@@ -949,8 +950,13 @@ const ImportXML = (() => {
             return gljsSrc.map(gljSrc => {
             return gljsSrc.map(gljSrc => {
                 return {
                 return {
                     code: getValue(gljSrc, ['_关联材料号']),
                     code: getValue(gljSrc, ['_关联材料号']),
+                    name: getValue(gljSrc, ['_名称']),
+                    specs: getValue(gljSrc, ['_规格']),
+                    unit: getValue(gljSrc, ['_单位']),
+                    quantity: getValue(gljSrc, ['_数量']),
                     riskCoe: getValue(gljSrc, ['_风险系数']),
                     riskCoe: getValue(gljSrc, ['_风险系数']),
                     standardPrice: getValue(gljSrc, ['_基准单价']),
                     standardPrice: getValue(gljSrc, ['_基准单价']),
+                    market_price: getValue(gljSrc, ['_投标单价']),
                     remark: getValue(gljSrc, ['_备注']),
                     remark: getValue(gljSrc, ['_备注']),
                 };
                 };
             });
             });
@@ -961,6 +967,8 @@ const ImportXML = (() => {
             return gljsSrc.map(gljSrc => {
             return gljsSrc.map(gljSrc => {
                 return {
                 return {
                     code: getValue(gljSrc, ['_关联材料号']),
                     code: getValue(gljSrc, ['_关联材料号']),
+                    name: getValue(gljSrc, ['_名称']),
+                    specs: getValue(gljSrc, ['_规格']),
                     varWeight: getValue(gljSrc, ['_变值权重B']),
                     varWeight: getValue(gljSrc, ['_变值权重B']),
                     FO: getValue(gljSrc, ['_基本价格指数']),
                     FO: getValue(gljSrc, ['_基本价格指数']),
                     FI: getValue(gljSrc, ['_现行价格指数']),
                     FI: getValue(gljSrc, ['_现行价格指数']),
@@ -972,7 +980,38 @@ const ImportXML = (() => {
         function loadEvalBidSummary(tenderSrc) {
         function loadEvalBidSummary(tenderSrc) {
             let gljsSrc = arrayValue(tenderSrc, ['评标材料表', '材料明细']);
             let gljsSrc = arrayValue(tenderSrc, ['评标材料表', '材料明细']);
             return gljsSrc.map(gljSrc => {
             return gljsSrc.map(gljSrc => {
-                return {code: getValue(gljSrc, ['_关联材料号'])};
+                return {
+                    seq: getValue(gljSrc, ['_序号']),
+                    code: getValue(gljSrc, ['_关联材料号']),
+                    name: getValue(gljSrc, ['_材料名称']),
+                    specs: getValue(gljSrc, ['_规格型号']),
+                    unit: getValue(gljSrc, ['_计量单位']),
+                    quantity: getValue(gljSrc, ['_数量']),
+                    market_price: getValue(gljSrc, ['_单价']),
+                    // 由于数据库有这两个字段,暂时也导入(前端隐藏了,目前实际上应该是没用的,以防万一)
+                    originPlace: getValue(gljSrc, ['_产地']),
+                    vender: getValue(gljSrc, ['_厂家']),
+                    remark: getValue(gljSrc, ['_备注'])
+                };
+            });
+        }
+        // 暂估价材料
+        function loadEvalSummary(tenderSrc) {
+            const gljsSrc = arrayValue(tenderSrc, ['暂估价材料表', '材料明细']);
+            return gljsSrc.map(gljSrc => {
+                return {
+                    seq: getValue(gljSrc, ['_序号']),
+                    code: getValue(gljSrc, ['_关联材料号']),
+                    name: getValue(gljSrc, ['_材料名称']),
+                    specs: getValue(gljSrc, ['_规格型号']),
+                    unit: getValue(gljSrc, ['_计量单位']),
+                    quantity: getValue(gljSrc, ['_数量']),
+                    market_price: getValue(gljSrc, ['_单价']),
+                    // 由于数据库有这两个字段,暂时也导入(前端隐藏了,目前实际上应该是没用的,以防万一)
+                    originPlace: getValue(gljSrc, ['_产地']),
+                    vender: getValue(gljSrc, ['_厂家']),
+                    remark: getValue(gljSrc, ['_备注'])
+                }
             });
             });
         }
         }
 
 
@@ -1540,6 +1579,9 @@ const ImportXML = (() => {
                 rationGLJ: [],  //定额人材机
                 rationGLJ: [],  //定额人材机
                 rationCoe: [],   //定额系数,全为默认
                 rationCoe: [],   //定额系数,全为默认
                 projectGLJ: [], //项目人材机
                 projectGLJ: [], //项目人材机
+                contractorList: [], //承包人材料
+                bidEvaluationList: [], //评标材料
+                evaluationList: [], //暂估材料
                 unitPrice: [],  //单价文件
                 unitPrice: [],  //单价文件
                 mixRatio: []    //组成物
                 mixRatio: []    //组成物
             };
             };
@@ -1581,38 +1623,52 @@ const ImportXML = (() => {
                     rst.unitPrice.push(getUnitPrice(pGLJ));
                     rst.unitPrice.push(getUnitPrice(pGLJ));
 
 
                 });
                 });
-                //处理评标材料
-                tenderData.evalBidSummary.forEach(glj => {
-                    let pGLJ = projectGLJMap[glj.code];
-                    if (pGLJ) {
-                        pGLJ.is_eval_material = true;
-                    }
-                });
-                //处理承包人材料差额法表
-                tenderData.differentiaSummary.forEach(glj => {
-                    let pGLJ = projectGLJMap[glj.code];
-                    if (pGLJ) {
-                        pGLJ.is_info_adjust = 1;
-                        pGLJ.riskCoe = glj.riskCoe;
-                        pGLJ.standardPrice = glj.standardPrice;
-                        pGLJ.remark = glj.remark;
-                    }
-                });
-                //处理承包人材料指数法表
-                tenderData.exponentialSummary.forEach(glj => {
-                    let pGLJ = projectGLJMap[glj.code];
-                    if (pGLJ) {
-                        pGLJ.is_coe_adjust = 1;
-                        pGLJ.varWeight = glj.varWeight;
-                        pGLJ.FO = glj.FO;
-                        pGLJ.FI = glj.FI;
-                        pGLJ.remark = glj.remark;
-                    }
-                });
+                // 处理承包人材料(差额/指数)法表
+                handleContractorList();
+                // 处理评标材料
+                handleGLJRelatedList(tenderData.evalBidSummary, rst.bidEvaluationList, 'is_eval_material');
+                // 处理暂估价材料
+                handleGLJRelatedList(tenderData.evalSummary, rst.evaluationList, 'is_evaluate');
                 //处理定额数据
                 //处理定额数据
                 //获取含有定额数据的清单
                 //获取含有定额数据的清单
                 handleRation(billsData);
                 handleRation(billsData);
             }
             }
+            // 处理与项目人材机关联的承包人材料
+            function handleContractorList() {
+                const contractorType = getAdjustType(tenderData);
+                const contractorData = contractorType === AdjustType.info ? tenderData.differentiaSummary : tenderData.exponentialSummary;
+                // 指数材料的单位和数量需要在差额里取,xml中指数表没有这两个字段(差额法表有且相同),入库却需要
+                /*if (contractorType === AdjustType.coe) {
+                    const infoMap = {};
+                    tenderData.differentiaSummary.forEach(data => infoMap[data.code] = data);
+                    tenderData.exponentialSummary.forEach(data => {
+                        const infoData = infoMap[data.code];
+                        if (infoData) {
+                            data.unit = infoData.unit;
+                            data.quantity = infoData.quantity;
+                        }
+                    });
+                }*/
+                handleGLJRelatedList(contractorData, rst.contractorList, 'is_contractor_material');
+            }
+            // 处理与项目人材机关联的承包人材料、评标材料、暂估材料
+            function handleGLJRelatedList(list, container, relatedType) {
+                list.forEach(data => {
+                    data.ID = uuid.v1();
+                    data.projectID = tenderData.ID;
+                    data.projectGLJID = -1;
+                    if (typeof data.seq === 'undefined') {
+                        data.seq = data.code;
+                    }
+                    const projectGLJ = projectGLJMap[data.code];
+                    if (projectGLJ) {
+                        projectGLJ[relatedType] = 1;
+                        data.is_related = 1;
+                        data.projectGLJID = projectGLJ.id;
+                    }
+                    container.push(data);
+                });
+            }
             //处理清单 设置必要数据 删除无用属性
             //处理清单 设置必要数据 删除无用属性
             billsData.forEach(bills => {
             billsData.forEach(bills => {
                 //处理综合单价
                 //处理综合单价

+ 6 - 0
web/building_saas/main/js/views/config_material_view.js

@@ -250,6 +250,8 @@ let configMaterialObj = {
                 gljOprObj.setGLJPrice(t,pglj);
                 gljOprObj.setGLJPrice(t,pglj);
                 t.originPlace = pglj.originPlace;
                 t.originPlace = pglj.originPlace;
                 t.vender = pglj.vender;
                 t.vender = pglj.vender;
+                t.brand = pglj.brand;
+                t.qualityGrace = pglj.qualityGrace;
                 t.remark = pglj.remark;
                 t.remark = pglj.remark;
                 t.quantity = pglj.quantity;
                 t.quantity = pglj.quantity;
             }
             }
@@ -284,6 +286,10 @@ let configMaterialObj = {
             let pglj = gljMap[e.projectGLJID];
             let pglj = gljMap[e.projectGLJID];
             if(e.is_related && pglj){
             if(e.is_related && pglj){
                 gljOprObj.setGLJPrice(t,pglj);
                 gljOprObj.setGLJPrice(t,pglj);
+                t.originPlace = pglj.originPlace;
+                t.vender = pglj.vender;
+                t.brand = pglj.brand;
+                t.qualityGrace = pglj.qualityGrace;
                 t.quantity = pglj.quantity;
                 t.quantity = pglj.quantity;
                 t.is_evaluate = pglj.is_evaluate;
                 t.is_evaluate = pglj.is_evaluate;
             }
             }