|  | @@ -42,10 +42,10 @@ function calcOneBQJC(xmj) {
 | 
	
		
			
				|  |  |      if (notx === undefined) {
 | 
	
		
			
				|  |  |          const list = xmj.mx_id !== undefined ? getMaterialListByLeafXmj(xmj.gcl_id, xmj.id, xmj.mx_id) : getMaterialListByLeafXmj(xmj.gcl_id, xmj.id);
 | 
	
		
			
				|  |  |          for (const l of list) {
 | 
	
		
			
				|  |  | -            jiacha = ZhCalc.round(ZhCalc.add(jiacha, ZhCalc.mul(ZhCalc.mul(xmj.gather_qty, l.quantity), getMpSpreadByMBData(l.mb_id))), 2);
 | 
	
		
			
				|  |  | +            jiacha = ZhCalc.add(jiacha, ZhCalc.mul(ZhCalc.mul(xmj.gather_qty, l.quantity), getMpSpreadByMBData(l.mb_id)));
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    return jiacha;
 | 
	
		
			
				|  |  | +    return ZhCalc.round(jiacha, 2);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  function getPasteHint (str, row = '') {
 | 
	
	
		
			
				|  | @@ -56,6 +56,31 @@ function getPasteHint (str, row = '') {
 | 
	
		
			
				|  |  |      return returnObj;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +// 重新计算列表的价差
 | 
	
		
			
				|  |  | +function calculateJiaCha(data, index) {
 | 
	
		
			
				|  |  | +    // 计算单条的
 | 
	
		
			
				|  |  | +    if (index) {
 | 
	
		
			
				|  |  | +        const gcld = data[index]
 | 
	
		
			
				|  |  | +        let total_jiacha = 0;
 | 
	
		
			
				|  |  | +        for (const [index, xmj] of gcld.leafXmjs.entries()) {
 | 
	
		
			
				|  |  | +            const jiacha = calcOneBQJC(xmj);
 | 
	
		
			
				|  |  | +            gcld.leafXmjs[index].jiacha = jiacha !== 0 ? jiacha : null;
 | 
	
		
			
				|  |  | +            total_jiacha += jiacha;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        gcld.total_jiacha = ZhCalc.round(total_jiacha, 2)
 | 
	
		
			
				|  |  | +    } else {
 | 
	
		
			
				|  |  | +        for(const gcld of data) {
 | 
	
		
			
				|  |  | +            let total_jiacha = 0;
 | 
	
		
			
				|  |  | +            for (const [index, xmj] of gcld.leafXmjs.entries()) {
 | 
	
		
			
				|  |  | +                const jiacha = calcOneBQJC(xmj);
 | 
	
		
			
				|  |  | +                gcld.leafXmjs[index].jiacha = jiacha !== 0 ? jiacha : null;
 | 
	
		
			
				|  |  | +                total_jiacha += jiacha;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            gcld.total_jiacha = ZhCalc.round(total_jiacha, 2)
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  const is_numeric = (value) => {
 | 
	
		
			
				|  |  |      if (typeof(value) === 'object') {
 | 
	
		
			
				|  |  |          return false;
 | 
	
	
		
			
				|  | @@ -113,6 +138,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              {title: '本期计量数量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 120, type: 'Number'},
 | 
	
		
			
				|  |  |              {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 120, type: 'Number'},
 | 
	
		
			
				|  |  |              {title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 120, type: 'Number'},
 | 
	
		
			
				|  |  | +            {title: '本期价差', colSpan: '1', rowSpan: '2', field: 'total_jiacha', hAlign:3, width: 150, type: 'Number'}
 | 
	
		
			
				|  |  |          ],
 | 
	
		
			
				|  |  |          emptyRows: 0,
 | 
	
		
			
				|  |  |          headRows: 2,
 | 
	
	
		
			
				|  | @@ -127,9 +153,11 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |      gclGatherModel.loadPosData(pos, curPosData);
 | 
	
		
			
				|  |  |      let gclGatherData = gclGatherModel.gatherGclData().filter(item => {
 | 
	
		
			
				|  |  |          return item.qc_qty || item.contract_qty
 | 
	
		
			
				|  |  | -    });
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    calculateJiaCha(gclGatherData)
 | 
	
		
			
				|  |  |      // let gclGatherData = gclGatherModel.gatherGclData()
 | 
	
		
			
				|  |  | -    // console.log(gclGatherData);
 | 
	
		
			
				|  |  |      // 获取项目节数据
 | 
	
		
			
				|  |  |      function loadLeafXmjData(iGclRow) {
 | 
	
		
			
				|  |  |          const gcl = gclGatherData[iGclRow];
 | 
	
	
		
			
				|  | @@ -138,7 +166,6 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                  const jiacha = calcOneBQJC(xmj);
 | 
	
		
			
				|  |  |                  gcl.leafXmjs[index].jiacha = jiacha !== 0 ? ZhCalc.round(jiacha, 2) : null;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            // console.log(gcl.leafXmjs);
 | 
	
		
			
				|  |  |              SpreadJsObj.loadSheetData(leafXmjSpread.getActiveSheet(), SpreadJsObj.DataType.Data, gcl.leafXmjs);
 | 
	
		
			
				|  |  |              // 对清单调差工料table的单位数量进行改变
 | 
	
		
			
				|  |  |              materialSpreadSetting.cols[materialSpreadSetting.cols.length - 1].title = '|' + gcl.unit + '数量 �';
 | 
	
	
		
			
				|  | @@ -214,7 +241,6 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |      const materialBase = {
 | 
	
		
			
				|  |  |          isEdit: function (data) {
 | 
	
		
			
				|  |  |              // 是否本期添加的工料
 | 
	
		
			
				|  |  | -            console.log(data);
 | 
	
		
			
				|  |  |              return data.order === stage_order;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      };
 | 
	
	
		
			
				|  | @@ -230,7 +256,6 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |      SpreadJsObj.initSpreadSettingEvents(materialSpreadSetting, materialCol);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      // 获取项目节数据
 | 
	
		
			
				|  |  |      let materialList = [];
 | 
	
		
			
				|  |  |      function loadMaterialData(iGclRow, iLXmjRow) {
 | 
	
	
		
			
				|  | @@ -355,9 +380,11 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                          notJoinList.push(result);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(select);
 | 
	
		
			
				|  |  | +                    calculateJiaCha(gclGatherData, iGclRow)
 | 
	
		
			
				|  |  |                      SpreadJsObj.reLoadRowData(sheet, iRow);
 | 
	
		
			
				|  |  |                      sheet.getRange(iRow, -1, 1, -1).backColor(color);
 | 
	
		
			
				|  |  |                      loadMaterialData(iGclRow, iRow);
 | 
	
		
			
				|  |  | +                    SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  |              },
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -422,7 +449,9 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      materialListData.splice(materialListIndex, 1);
 | 
	
		
			
				|  |  |                      const [iGclRow, iRow, lsheet, lselect] = leafXmjSpreadObj.getSelect();
 | 
	
		
			
				|  |  |                      gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(lselect);
 | 
	
		
			
				|  |  | +                    calculateJiaCha(gclGatherData, iGclRow)
 | 
	
		
			
				|  |  |                      SpreadJsObj.reLoadRowData(lsheet, iRow);
 | 
	
		
			
				|  |  | +                    SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  |              },
 | 
	
		
			
				|  |  |              deletePress: function (sheet) {
 | 
	
	
		
			
				|  | @@ -463,7 +492,9 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                          SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  |                          const [iGclRow, iRow, sheet, lselect] = leafXmjSpreadObj.getSelect();
 | 
	
		
			
				|  |  |                          gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(lselect);
 | 
	
		
			
				|  |  | +                        calculateJiaCha(gclGatherData, iGclRow)
 | 
	
		
			
				|  |  |                          SpreadJsObj.reLoadRowData(sheet, iRow);
 | 
	
		
			
				|  |  | +                        SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
 | 
	
		
			
				|  |  |                      }, function () {
 | 
	
		
			
				|  |  |                          SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
	
		
			
				|  |  |                      });
 | 
	
	
		
			
				|  | @@ -542,7 +573,9 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      materialListData = result;
 | 
	
		
			
				|  |  |                      const [iGclRow, iRow, sheet, lselect] = leafXmjSpreadObj.getSelect();
 | 
	
		
			
				|  |  |                      gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(lselect);
 | 
	
		
			
				|  |  | +                    calculateJiaCha(gclGatherData, iGclRow)
 | 
	
		
			
				|  |  |                      SpreadJsObj.reLoadRowData(sheet, iRow);
 | 
	
		
			
				|  |  | +                    SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
 | 
	
		
			
				|  |  |                  }, function () {
 | 
	
		
			
				|  |  |                      SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
 | 
	
		
			
				|  |  |                  });
 | 
	
	
		
			
				|  | @@ -597,12 +630,14 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              postData(window.location.pathname + '/save', { type:'useOther', postData: { addXmj: needAddList, select: select } }, function (result) {
 | 
	
		
			
				|  |  |                  materialListData = result;
 | 
	
		
			
				|  |  |                  toastr.success('成功添加了' + needAddList.length + '条调差工料到其他清单明细中');
 | 
	
		
			
				|  |  | +                calculateJiaCha(gclGatherData)
 | 
	
		
			
				|  |  |                  const index = gclGatherData.indexOf(ledgerSelect);
 | 
	
		
			
				|  |  |                  loadLeafXmjData(index);
 | 
	
		
			
				|  |  |                  const xmjSheet = leafXmjSpread.getActiveSheet();
 | 
	
		
			
				|  |  |                  const xmjSelect = SpreadJsObj.getSelectObject(xmjSheet);
 | 
	
		
			
				|  |  |                  const xmjIndex = gclGatherData[index].leafXmjs.indexOf(xmjSelect);
 | 
	
		
			
				|  |  |                  loadMaterialData(index, xmjIndex);
 | 
	
		
			
				|  |  | +                SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), index);
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |          $.contextMenu({
 | 
	
	
		
			
				|  | @@ -701,8 +736,11 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              gclGatherModel.loadLedgerData(ledger, curLedgerData);
 | 
	
		
			
				|  |  |              gclGatherModel.loadPosData(pos, curPosData);
 | 
	
		
			
				|  |  | -            gclGatherData = gclGatherModel.gatherGclData();
 | 
	
		
			
				|  |  | +            gclGatherData = gclGatherModel.gatherGclData().filter(item => {
 | 
	
		
			
				|  |  | +                return item.qc_qty || item.contract_qty
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        calculateJiaCha(gclGatherData);
 | 
	
		
			
				|  |  |          SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Data, gclGatherData);
 | 
	
		
			
				|  |  |          loadLeafXmjData(0);
 | 
	
		
			
				|  |  |          loadMaterialData(0, 0);
 | 
	
	
		
			
				|  | @@ -710,7 +748,6 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |          SpreadJsObj.resetTopAndSelect(leafXmjSpread.getActiveSheet());
 | 
	
		
			
				|  |  |          SpreadJsObj.resetTopAndSelect(materialSpread.getActiveSheet());
 | 
	
		
			
				|  |  |          checkNotJoinMaterialData();
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      $.subMenu({
 |