Jelajahi Sumber

新版变更数据增加3列

laiguoran 4 tahun lalu
induk
melakukan
6f155116b7

+ 1 - 1
app/controller/schedule_controller.js

@@ -24,7 +24,7 @@ module.exports = app => {
 
         async _getLastPlanMonth(ctx) {
             const lastMonth = await ctx.service.scheduleMonth.getLastPlanMonth();
-            return lastMonth ? lastMonth[0].yearmonth : null;
+            return lastMonth && lastMonth[0] && lastMonth[0].yearmonth ? lastMonth[0].yearmonth : null;
         }
 
         async index(ctx) {

+ 41 - 8
app/public/js/change_information_set.js

@@ -361,7 +361,7 @@ $(document).ready(() => {
         let gcl_index = 0;
         for (const gcl of changeListData) {
             const unit = gcl.unit !== undefined && gcl.unit !== null ? gcl.unit : '';
-            const quantity = gcl.quantity !== null && gcl.quantity !== undefined ? (unit !== '' ? ZhCalc.round(gcl.quantity, findDecimal(gcl.unit)) : gcl.quantity) : 0;
+            const quantity = gcl.quantity !== 0 && gcl.quantity !== null && gcl.quantity !== undefined ? (unit !== '' ? ZhCalc.round(gcl.quantity, findDecimal(gcl.unit)) : gcl.quantity) : 0;
             const unit_price = gcl.unit_price !== null && gcl.unit_price !== undefined ? gcl.unit_price : 0;
             let gclhtml = gcl.leafXmjs !== undefined && gcl.leafXmjs !== null ? ' data-gcl="' + gcl_index + '"' : '';
             gcl_index = gclhtml !== '' ? ++gcl_index : gcl_index;
@@ -459,7 +459,12 @@ $(document).ready(() => {
                 const quantity = leaf.quantity !== undefined && leaf.quantity !== null ? leaf.quantity : 0;
                 const gcl_id = leaf.gcl_id ? leaf.gcl_id : '';
                 const bwmx = leaf.bwmx !== undefined ? leaf.bwmx : '';
-                const isChecked = data_bwmx.indexOf(leaf.code + '!_!' + (leaf.jldy ? leaf.jldy : '') + '!_!' + (leaf.gcl_id ? leaf.gcl_id : '0') + '!_!' + (bwmx !== '' ? bwmx : leaf.jldy ? leaf.jldy : '') + '*;*' + quantity) !== -1 && isCheck ? 'checked' : '';
+                const isChecked = data_bwmx.indexOf(
+                    leaf.code + '!_!' + (leaf.jldy ? leaf.jldy : '') + '!_!' +
+                    (leaf.dwgc ? leaf.dwgc : '') + '!_!' + (leaf.fbgc ? leaf.fbgc : '') + '!_!' + (leaf.fxgc ? leaf.fxgc : '')
+                    + '!_!' + (leaf.gcl_id ? leaf.gcl_id : '0') + '!_!' +
+                    (bwmx !== '' ? bwmx : leaf.jldy ? leaf.jldy : '') + '*;*' + quantity) !== -1 && isCheck ?
+                    'checked' : '';
                 codeHtml += '<tr quantity="' + quantity + '" gcl_id="' + gcl_id + '"><td>' + leaf.code + '</td>' +
                     '<td>' + (leaf.jldy ? leaf.jldy: '') + '</td>' +
                     '<td>' + (leaf.dwgc ? leaf.dwgc : '') + '</td>' +
@@ -494,7 +499,13 @@ $(document).ready(() => {
                 const tr = $(this).parents('tr');
                 const length = tr.children('td').length;
                 const gcl_id = tr.attr('gcl_id');
-                const bwmx = length === 8 ? tr.children('td').eq(0).text() + '!_!' + tr.children('td').eq(1).text() + '!_!' + gcl_id + '!_!' + (tr.children('td').eq(5).text() !== '' ? tr.children('td').eq(5).text() : tr.children('td').eq(1).text()) : '0';
+                const bwmx = length === 8 ?
+                    tr.children('td').eq(0).text() + '!_!' +
+                    tr.children('td').eq(1).text() + '!_!' +
+                    tr.children('td').eq(2).text() + '!_!' +
+                    tr.children('td').eq(3).text() + '!_!' +
+                    tr.children('td').eq(4).text() + '!_!' + gcl_id + '!_!' +
+                    (tr.children('td').eq(5).text() !== '' ? tr.children('td').eq(5).text() : tr.children('td').eq(1).text()) : '0';
                 const quantity = tr.attr('quantity');
                 const de_qu = bwmx + '*;*' + quantity;
                 data_bwmx.push(de_qu);
@@ -510,7 +521,13 @@ $(document).ready(() => {
                     const tr = $(this).parents('tr');
                     const length = tr.children('td').length;
                     const gcl_id = tr.attr('gcl_id');
-                    const bwmx = length === 8 ? tr.children('td').eq(0).text() + '!_!'+ tr.children('td').eq(1).text() + '!_!' + gcl_id + '!_!' + (tr.children('td').eq(5).text() !== '' ? tr.children('td').eq(5).text() : tr.children('td').eq(1).text()) : '0';
+                    const bwmx = length === 8 ?
+                        tr.children('td').eq(0).text() + '!_!' +
+                        tr.children('td').eq(1).text() + '!_!' +
+                        tr.children('td').eq(2).text() + '!_!' +
+                        tr.children('td').eq(3).text() + '!_!' +
+                        tr.children('td').eq(4).text() + '!_!' + gcl_id + '!_!' +
+                        (tr.children('td').eq(5).text() !== '' ? tr.children('td').eq(5).text() : tr.children('td').eq(1).text()) : '0';
                     const quantity = tr.attr('quantity');
                     const de_qu = bwmx + '*;*' + quantity;
                     data_bwmx.push(de_qu);
@@ -731,7 +748,12 @@ function tableDataRemake(changeListData) {
                         });
                         console.log(leafInfo);
                         if (leafInfo) {
-                            pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' + (leafInfo.gcl_id ? leafInfo.gcl_id : '') + '!_!' + (leafInfo.bwmx !== undefined ? leafInfo.bwmx : '') + '*;*' + (leafInfo.quantity !== null ? leafInfo.quantity : 0);
+                            pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
+                                (leafInfo.dwgc ? leafInfo.dwgc : '') + '!_!' +
+                                (leafInfo.fbgc ? leafInfo.fbgc : '') + '!_!' +
+                                (leafInfo.fxgc ? leafInfo.fxgc : '') + '!_!' +
+                                (leafInfo.gcl_id ? leafInfo.gcl_id : '') + '!_!' +
+                                (leafInfo.bwmx !== undefined ? leafInfo.bwmx : (leafInfo.jldy !== undefined ? leafInfo.jldy : '')) + '*;*' + (leafInfo.quantity !== null ? leafInfo.quantity : 0);
                         } else {
                             toastr.warning('台账清单列表已不存在'+ clinfo.code +',已更新变更清单列表');
                             changeList.splice(index, 1);
@@ -756,7 +778,12 @@ function tableDataRemake(changeListData) {
                             return (item.bwmx === undefined || item.bwmx === clinfo.bwmx || item.jldy === clinfo.bwmx) && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
                         });
                         if (leafInfo) {
-                            pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' + (leafInfo.gcl_id ? leafInfo.gcl_id : '') + '!_!' + (leafInfo.bwmx !== undefined ? leafInfo.bwmx : (leafInfo.jldy ? leafInfo.jldy : '')) + '*;*' + (leafInfo.quantity !== null ? leafInfo.quantity : 0);
+                            pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
+                                (leafInfo.dwgc ? leafInfo.dwgc : '') + '!_!' +
+                                (leafInfo.fbgc ? leafInfo.fbgc : '') + '!_!' +
+                                (leafInfo.fxgc ? leafInfo.fxgc : '') + '!_!' +
+                                (leafInfo.gcl_id ? leafInfo.gcl_id : '') + '!_!' +
+                                (leafInfo.bwmx !== undefined ? leafInfo.bwmx : (leafInfo.jldy !== undefined ? leafInfo.jldy : '')) + '*;*' + (leafInfo.quantity !== null ? leafInfo.quantity : 0);
                         } else {
                             toastr.warning('台账清单列表已不存在'+ clinfo.code +',已更新变更清单列表');
                             changeList.splice(index, 1);
@@ -833,10 +860,13 @@ function remakeChangeSpread() {
 
         for (const b of data_bwmx) {
             const oamount = b.split('*;*')[1] != '' ? b.split('*;*')[1] : 0;
-            let bwmx = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[3] : '';
+            let bwmx = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[6] : '';
             let xmj_code = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[0] : '';
             let xmj_jldy = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[1] : '';
-            let gcl_id = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[2] : '';
+            let xmj_dwgc = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[2] : '';
+            let xmj_fbgc = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[3] : '';
+            let xmj_fxgc = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[4] : '';
+            let gcl_id = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[5] : '';
             let trlist = {
                 code,
                 name,
@@ -849,6 +879,9 @@ function remakeChangeSpread() {
                 lid,
                 xmj_code,
                 xmj_jldy,
+                xmj_dwgc,
+                xmj_fbgc,
+                xmj_fxgc,
                 gcl_id,
             };
             const radionInfo = changeList.find(function (info) {

+ 3 - 0
app/service/change_audit_list.js

@@ -57,6 +57,9 @@ module.exports = app => {
                 spamount: 0,
                 xmj_code: null,
                 xmj_jldy: null,
+                xmj_dwgc: null,
+                xmj_fbgc: null,
+                xmj_fxgc: null,
                 gcl_id: '',
             };
             // 新增工料