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

feat:安徽-马鞍山、淮北、芜湖、黄山、宣称导出接口

vian 5 éve
szülő
commit
e030e5a480

+ 5 - 1
config/gulpConfig.js

@@ -181,7 +181,11 @@ module.exports = {
         'web/building_saas/main/js/views/material_calc_view.js',
         'web/building_saas/main/js/views/electrovalence_view.js',
         'web/building_saas/main/js/views/divide_view.js',
-        'public/web/storageUtil.js'
+        'public/web/storageUtil.js',
+        'web/building_saas/standard_interface/config.js',
+        'web/building_saas/standard_interface/index.js',
+        'web/building_saas/standard_interface/export/base.js',
+        'web/building_saas/standard_interface/export/view.js'
     ],
     compleGlj_css: [
         'lib/jquery-contextmenu/jquery.contextMenu.css',

+ 1 - 0
modules/main/routes/main_route.js

@@ -42,6 +42,7 @@ module.exports =function (app) {
                     {
                         userAccount: req.session.userAccount,
                         userID: req.session.sessionUser.id,
+                        userName: req.session.sessionUser.username,
                         projectData: projectData,
                         compilationName: req.session.sessionCompilation.name,
                         versionName: req.session.compilationVersion,

+ 2 - 0
web/building_saas/main/html/main.html

@@ -39,6 +39,7 @@
         let lockBills = '<%- projectData.property.lockBills %>';
         let userAccount = '<%- userAccount %>';
         let userID = '<%- userID %>';
+        const USER_NAME = '<%- userName %>';
         let projectReadOnly = JSON.parse('<%- projectReadOnly %>');
         let projectCooperate = JSON.parse('<%- projectCooperate %>');
         let projectOptins =  JSON.parse('<%- options %>');
@@ -2025,6 +2026,7 @@
     <script src="/lib/lz-string/lz-string.min.js"></script>
     <script src="/lib/fileSaver/FileSaver.min.js"></script>
     <script type="text/javascript" src="/lib/jspdf/jspdf.min.js"></script>
+    <script src="/lib/md5/md5.min.js"></script>
     <!-- inject:js -->
     <!--<script type="text/javascript" src="/test/tmp_data/test_ration_calc/ration_calc_base.js"></script>-->
     <script src="/lib/pinyinjs/pinyin_dict_firstletter.js"></script>

+ 68 - 15
web/building_saas/standard_interface/export/anhui_maanshan.js

@@ -23,6 +23,7 @@ INTERFACE_EXPORT = (() => {
                 getValueByKey,
                 getHan,
                 getFee,
+                generateHardwareId,
             },
             Element,
         } = INTERFACE_EXPORT_BASE;
@@ -30,7 +31,6 @@ INTERFACE_EXPORT = (() => {
         const {
             EXPORT_KIND: { BID_INVITATION, BID_SUBMISSION, CONTROL },
             fixedFlag,
-            SourceType,
             RationType,
         } = window.commonConstants
 
@@ -287,6 +287,7 @@ INTERFACE_EXPORT = (() => {
                 { name: 'Code', value: `F${row}` }, // 行引用
                 { name: 'Jsgs', value: node.data.calcBase }, // 计算基数
                 { name: 'Lb', value: BillsTitleType[node.getFlag()], type: TYPE.INT }, // 类别
+                { name: 'Bz', value: node.data.remark }, // 备注
             ];
             Element.call(this, 'QdBt', attrs);
         }
@@ -296,7 +297,7 @@ INTERFACE_EXPORT = (() => {
             const row = node.row();
             const attrs = [
                 { name: 'Xh', value: row, type: TYPE.INT }, // 序号
-                { name: 'Qdbm', value: node.data.code }, // 编码
+                { name: 'Qdbm', value: node.data.code, minLen: 1 }, // 编码
                 { name: 'Name', value: node.data.name }, // 名称
                 { name: 'Dw', value: node.data.unit }, // 单位
                 { name: 'Sl', value: node.data.quantity, type: TYPE.DECIMAL }, // 工程量
@@ -443,18 +444,23 @@ INTERFACE_EXPORT = (() => {
                 { name: 'Sl', value: BID_INVITATION ? '0' : glj.quantity, type: TYPE.DECIMAL }, // 工程量
                 { name: 'Dj', value: glj.marketPrice, type: TYPE.DECIMAL }, // 暂定价、单价
                 { name: 'Hj', value: BID_INVITATION ? '0' : glj.totalPrice, type: TYPE.DECIMAL }, // 合价
-                { name: 'Bz', value: glj.remark, type: TYPE.DECIMAL }, // 备注
+                { name: 'Bz', value: glj.remark }, // 备注
             ];
             Element.call(this, eleName, attrs);
         }
-        
+
         // 人材机汇总
         function Rcjhz() {
             Element.call(this, 'Rcjhz');
         }
-        
+
         // 人材机汇总明细
         function RcjhzMx(glj) {
+            const rootTypeReg = /\d/;
+            let rootType = rootTypeReg.exec(glj.type)[0];
+            if (!['1', '2', '3'].includes(rootType)) {
+                rootType = '2'; 
+            }
             const attrs = [
                 { name: 'RcjId', value: projectGLJIDToRcjID[glj.id] }, // 资源ID
                 { name: 'Bm', value: glj.code }, // 编码
@@ -466,14 +472,43 @@ INTERFACE_EXPORT = (() => {
                 { name: 'Hj', value: glj.totalPrice, type: TYPE.DECIMAL }, // 合价,人材料总消耗量*预算价
                 { name: 'Cd', value: '' }, // 产地
                 { name: 'Gycs', value: '' }, // 厂商
-                { name: 'Rcjlb', value: '', type: TYPE.INT }, // 人材机类型 1=人工;2=材料;3=机械
+                { name: 'Rcjlb', value: rootType, type: TYPE.INT }, // 人材机类型 1=人工;2=材料;3=机械
                 { name: 'Jgbz', value: 'false', type: TYPE.BOOL }, // 供材方
                 { name: 'Zyclbj', value: !!glj.is_main_material, type: TYPE.BOOL }, // 主要材料
                 { name: 'Zgjbz', value: !!glj.is_evaluate, type: TYPE.BOOL }, // 是否暂估
                 { name: 'Zcbz', value: 'false', type: TYPE.BOOL }, // 主材标记
-            ]
+            ];
             Element.call(this, 'RcjhzMx', attrs);
         }
+
+        // 配比组成
+        function PbZc() {
+            Element.call(this, 'PbZc');
+        }
+
+        // 配比明细
+        function PbZcMx(ratio) {
+            const attrs = [
+                { name: 'RcjId', value: projectGLJIDToRcjID[ratio.projectGLJID] }, // 组成物对应人材机汇总的资源ID
+                { name: 'Sl', value: ratio.consumption, type: TYPE.DECIMAL }, // 组成物消耗量
+            ];
+            Element.call(this, 'PbZcMx', attrs);
+        }
+        
+        // 校验信息
+        function Jyxx(cpuID, diskID, macID, toMD5Value) {
+            const attrs = [
+                { name: 'SoftName', value: '纵横创新软件有限公司' }, // 公司名
+                { name: 'SoftNum', value: md5(toMD5Value) }, // 校验数据
+                { name: 'MacAdress', value: macID }, // mac地址
+                { name: 'DogNum', value: userID }, // 加密锁号,取用户ID
+                { name: 'ComputerName', value: USER_NAME }, // 计算机名,取用户名称
+                { name: 'HDDSerial', value: diskID }, // 硬盘序列号
+                { name: 'CPUSerial', value: cpuID }, // CPU序列号
+            ];
+            Element.call(this, 'Jyxx', attrs);
+        }
+
         // 组装数据 --------------------------------------
 
         // 组装建设项目数据
@@ -500,7 +535,13 @@ INTERFACE_EXPORT = (() => {
                 }
                 midLayerMap[midLayerKey].children.push(setupTender(tenderData, feature));
             }
+            // 校验信息
+            const [cpuID, diskID, macID] = generateHardwareId().split(';');
             const suffix = INTERFACE_CONFIG[areaKey]['fileSuffix'][exportKind];
+            // 需要md5的值:MD5(“WHGLZTB”+项目名称+机器码+加密锁锁号)机器码取mac地址,加密锁锁号取用户账号id
+            const toMD5Suffix = suffix.split('.')[1];
+            const toMD5Value = `${toMD5Suffix}${constructionData.name}${macID}${userID}`;
+            jingJiBiao.children.push(new Jyxx(cpuID, diskID, macID, suffix, toMD5Value));
             return [{
                 data: jingJiBiao,
                 exportKind,
@@ -525,7 +566,8 @@ INTERFACE_EXPORT = (() => {
             const dwgcxx = new Dwgcxx(tenderData.name, feature);
             dwgcxx.children.push(
                 setupFeeRate(curDetail.FeeRate),
-                setupBills(curDetail.mainTree)
+                setupBills(curDetail.mainTree),
+                ...setupGLJList(curDetail)
             );
             return dwgcxx;
         }
@@ -667,21 +709,32 @@ INTERFACE_EXPORT = (() => {
         }
 
         // 组装人材机汇总相关表数据
-        function setupGLJList() {
+        function setupGLJList(tenderDetail) {
             // 暂估材料
             const zgcl = new gljRefRoot('ZgCl');
-            const zgclData = curDetail.evaluateMaterialData.map(glj => new gljRefElement('ZgClMx', glj));
-            zgcl.children.push(...zgclData);
-            
+            zgcl.children = tenderDetail.evaluateMaterialData.map(glj => new gljRefElement('ZgClMx', glj));
+
             // 评标材料
             const jpcl = new gljRefRoot('JpCl');
-            const jpclData = curDetail.bidMaterialData.map(glj => new gljRefElement('JpClMx', glj));
-            jpcl.children.push(...jpclData);
-            if (BID_INVITATION) {
+            jpcl.children = tenderDetail.bidMaterialData.map(glj => new gljRefElement('JpClMx', glj));
+            if (isBidInvitation) {
                 return [zgcl, jpcl];
             }
             // 人材机汇总 (招标不导出)
             const rcjhz = new Rcjhz();
+            rcjhz.children = tenderDetail.projectGLJ.datas.gljList.map(pGLJ => {
+                const gljElement = new RcjhzMx(pGLJ);
+                // 组成物
+                const connectKey = gljUtil.getIndex(pGLJ, gljKeyArray);
+                const ratioData = tenderDetail.projectGLJ.datas.mixRatioMap[connectKey];
+                if (ratioData && ratioData.length) {
+                    const pbzc = new PbZc();
+                    pbzc.children = ratioData.map(ratio => new PbZcMx(ratio));
+                    gljElement.children.push(pbzc);
+                }
+                return gljElement;
+            });
+            return [zgcl, jpcl, rcjhz];
         }
 
         return setupConstruction(projectData);

+ 22 - 2
web/building_saas/standard_interface/export/base.js

@@ -159,6 +159,14 @@ const INTERFACE_EXPORT_BASE = (() => {
                     ? DEFAULT_VALUE[data.type]
                     : ''
                 : String(data.value);
+            // 如果有限定最少长度,则当长度不够时,自动凑
+            const autoStr = '1';
+            if (data.minLen && data.value.length < data.minLen) {
+                let diff = data.minLen - data.value.length;
+                while (diff--) {
+                    data.value += autoStr;
+                }
+            }
             if (data.whiteSpace && data.whiteSpace === WHITE_SPACE.COLLAPSE) {  //处理空格相关
                 data.value = data.value.replace(/[\r\n\t]/g, ' ');
                 data.value = data.value.trim();
@@ -728,12 +736,24 @@ const INTERFACE_EXPORT_BASE = (() => {
             // 计算合价:人材料总消耗量*预算价
             glj.priceInfo.totalPrice = scMathUtil.roundForObj(glj.priceInfo.tenderPrice * glj.tenderQuantity, 2);
         });
+        // 为了方便后续导出处理,给组成物数据设置上对应项目人材机ID
+        const connectKeyMap = {};
+        projectGLJList.forEach(pGLJ => connectKeyMap[gljUtil.getIndex(pGLJ, gljKeyArray)] = pGLJ.id);
+        const ratiosArr = Object.values(tenderDetail.projectGLJ.datas.mixRatioMap);
+        ratiosArr.forEach(ratios => {
+            ratios.forEach(ratio => {
+                const ratioKey = gljUtil.getIndex(ratio, gljKeyArray);
+                const projectGLJID = connectKeyMap[ratioKey];
+                if (projectGLJID) {
+                    ratio.projectGLJID = projectGLJID;
+                }
+            });
+        });
+
         // 获取暂估价材料数据,getData原始数据evaluate_list.datas里的数据缺少一些价格数据,需要调用额外接口
         tenderDetail.evaluateMaterialData = configMaterialObj.getEvaluateMaterialDatas(projectGLJList, evaluateList, decimalInfo);
         // 获取评标材料数据
         tenderDetail.bidMaterialData = configMaterialObj.getBidMaterialDatas(projectGLJList, bidEvaluationList, decimalInfo);
-
-
     }
 
     /**