浏览代码

负变更相关

MaiXinRong 5 年之前
父节点
当前提交
9efcf1d9b9

+ 0 - 3
app/controller/report_controller.js

@@ -391,9 +391,6 @@ async function getReportData(ctx, params, filters, memFieldKeys) {
     const queryRst = await Promise.all(runnableRst);
     for (let idx = 0; idx < runnableKey.length; idx++) {
         rst[runnableKey[idx]] = queryRst[idx];
-        if (['change', 'change_audit_list'].indexOf(runnableKey[idx]) >= 0) {
-            await ctx.helper.saveBufferFile(JSON.stringify(queryRst[idx],"","\t"), ctx.app.baseDir + '/' + runnableKey[idx] +'.json');
-        }
     }
     for (const filter of filters) {
         switch (filter) {

+ 1 - 1
app/public/js/ledger.js

@@ -834,7 +834,7 @@ $(document).ready(function() {
                 if (!children || children.length === 0) return;
 
                 for (const [i, child] of children.entries()) {
-                    if (child.b_code && child.b_code !== 0) {
+                    if (!child.b_code || child.b_code === '') {
                         const code = parentCode + '-' + (i + 1);
                         const cData = tree.getNodeKeyData(child);
                         cData.code = code;

+ 12 - 3
app/public/js/stage.js

@@ -202,9 +202,11 @@ $(document).ready(() => {
                 getColor: function (sheet, data, col, defaultColor) {
                     if (col.field === 'uamount') {
                         if (!data.vamount) {
-                            return (data.uamount && data.uamount > 0) ? '#ff6f5c' : defaultColor;
+                            return (data.uamount && math.abs(data.uamount) > 0) ? '#ff6f5c' : defaultColor;
                         } else if (data.uamount) {
-                            return data.uamount > data.vamount ? '#ff6f5c' : defaultColor;
+                            return data.vamount > 0
+                                ? data.uamount > data.vamount ? '#ff6f5c' : defaultColor
+                                : data.uamount < data.vamount ? '#ff6f5c' : defaultColor;
                         } else {
                             return defaultColor;
                         }
@@ -298,7 +300,14 @@ $(document).ready(() => {
                 for (const c of self.displayChanges) {
                     if (c.uamount) {
                         const vamount = (!c.vamount || checkZero(c.vamount)) ? 0 : c.vamount;
-                        if (c.uamount > vamount) {
+                        if (vamount > 0 && c.uamount < 0) {
+                            toastr.error('变更令:' + c.code + ' 下,请勿进行负变更');
+                            return;
+                        } else if (vamount < 0 && c.uamount > 0) {
+                            toastr.error('变更令:' + c.code + ' 下,请勿进行正变更');
+                            return;
+                        }
+                        if ((vamount > 0 && c.uamount > vamount) || (vamount < 0 && c.uamount < vamount)) {
                             toastr.error('变更令:' + c.code + ' 超计,请修改本期计量后,再提交');
                             return;
                         }

+ 3 - 3
test/app/controller/report_controller.test.js

@@ -111,9 +111,9 @@ describe('test/app/service/report_memory.test.js', () => {
         const ctx = app.mockContext();
         // 模拟登录session
         const postData = {
-            account: '734406061@qq.com',
-            project: 'T201711273363',
-            project_password: 'mai654321',
+            account: 'fuqingqing',
+            project: 'P0505',
+            project_password: '123456',
         };
         // const postData = {
         //     account: 'chente',

+ 2 - 2
test/app/service/report_memory.test.js

@@ -18,7 +18,7 @@ const dataType = {
 };
 const addFields = function(table, name, field, type) {
     const data = {};
-    data.ID = table.ID + (table.items.length + 1);
+    data.ID = table.ID * 100 + table.items.length + 1;
     data.Name = name;
     data.DataType = type;
     data.TableName = table.key;
@@ -97,7 +97,7 @@ describe('test/app/service/report_memory.test.js', () => {
             const tableDefine = {};
             tableDefine.Name = '期 - 清单数据表(mem_stage_bills)';
             tableDefine.remark = '';
-            tableDefine.ID = '23';
+            tableDefine.ID = 25;
             tableDefine.key = 'mem_stage_bills';
             tableDefine.items = [];
             addFields(tableDefine, '台账ID', 'id', dataType.int);