瀏覽代碼

调差同步清单bug

laiguoran 5 年之前
父節點
當前提交
fc38fc6f9b
共有 2 個文件被更改,包括 9 次插入9 次删除
  1. 4 4
      app/public/js/material_list.js
  2. 5 5
      app/service/material_list.js

+ 4 - 4
app/public/js/material_list.js

@@ -430,7 +430,7 @@ $(document).ready(() => {
             }
             // 判断需要应用调差工料的清单明细
             const needAddList = [];
-            const gather_qty = [];
+            // const gather_qty = [];
             for (const xmj of ledgerSelect.leafXmjs) {
                 if (xmj.mx_id !== undefined) {
                     const notx = findNotJoinLeafXmj(xmj);
@@ -439,8 +439,8 @@ $(document).ready(() => {
                             return xmj.mx_id === item.mx_id && select.mb_id === item.mb_id;
                         });
                         if (ml === undefined) {
-                            needAddList.push(xmj.mx_id);
-                            gather_qty.push(xmj.gather_qty);
+                            needAddList.push(xmj);
+                            // gather_qty.push(xmj.gather_qty);
                         }
                     }
                 }
@@ -450,7 +450,7 @@ $(document).ready(() => {
                 return false;
             }
             // 更新至服务器
-            postData(window.location.pathname + '/save', { type:'useOther', postData: { mx_id: needAddList, select: select, gather_qty: gather_qty } }, function (result) {
+            postData(window.location.pathname + '/save', { type:'useOther', postData: { addXmj: needAddList, select: select } }, function (result) {
                 materialListData = result;
                 toastr.success('成功添加了' + needAddList.length + '条调差工料到其他清单明细中');
                 const index = gclGatherData.indexOf(ledgerSelect);

+ 5 - 5
app/service/material_list.js

@@ -114,16 +114,16 @@ module.exports = app => {
             try {
                 const list = [];
                 const select = data.select;
-                for (const index in data.mx_id) {
+                for (const xmj of data.addXmj) {
                     const newLists = {
                         tid: this.ctx.tender.id,
                         order: this.ctx.material.order,
                         mid: this.ctx.material.id,
                         mb_id: select.mb_id,
-                        gcl_id: select.gcl_id,
-                        xmj_id: select.xmj_id,
-                        mx_id: data.mx_id[index],
-                        gather_qty: data.gather_qty[index],
+                        gcl_id: xmj.gcl_id,
+                        xmj_id: xmj.id,
+                        mx_id: xmj.mx_id,
+                        gather_qty: xmj.gather_qty,
                         quantity: select.quantity,
                         in_time: new Date(),
                     };