Explorar el Código

增强工料机汇总逻辑

TonyKang hace 3 años
padre
commit
f5f2f366df
Se han modificado 1 ficheros con 12 adiciones y 0 borrados
  1. 12 0
      modules/main/facade/project_facade.js

+ 12 - 0
modules/main/facade/project_facade.js

@@ -747,6 +747,7 @@ async function getGLJSummayDatas(projectIDs) {
 function getSummaryGLJDatas(gljList, decimal, nameList, prjTypeNames, compilationScopes) {
   let datas = [],
     qdecimal = decimal.glj.quantity,
+    upDecimal = decimal.glj.unitPrice,
     process = decimal.process;
   for (let tem of gljList) {
     let d = {
@@ -756,18 +757,24 @@ function getSummaryGLJDatas(gljList, decimal, nameList, prjTypeNames, compilatio
       unit: tem.unit,
       specs: tem.specs,
       marketPrice: tem.marketPrice,
+      marketPriceList: [],
       prjNames: nameList,
       prjTypeNames: prjTypeNames,
       quantityList: [],
       '编制范围明细': compilationScopes
     };
     let totalQuantity = 0;
+    let totalPrice = 0;
     for (let n of nameList) {
       let q = tem.quantityMap[n] ? scMathUtil.roundForObj(tem.quantityMap[n], qdecimal) : 0;
       totalQuantity = scMathUtil.roundForObj(q + totalQuantity, process);
       d.quantityList.push(q);
+      let up = tem.unitPriceMap[n] ? scMathUtil.roundForObj(tem.unitPriceMap[n], upDecimal) : 0;
+      d.marketPriceList.push(up);
+      totalPrice = scMathUtil.roundForObj(q * up + totalPrice, process);
     }
     d.totalQuantity = scMathUtil.roundForObj(totalQuantity, qdecimal);
+    d.totalPrice = scMathUtil.roundForObj(totalPrice, upDecimal);
     datas.push(d);
   }
   return datas;
@@ -781,6 +788,8 @@ function mergeGLJ(mp, projects) {
   for (let g of mp.gljList) {
     g.quantityMap = {};
     g.quantityMap[mp.name] = g.tenderQuantity;
+    g.unitPriceMap = {};
+    g.unitPriceMap[mp.name] = g.marketPrice;
     gljMap[gljUtil.getIndex(g)] = g;
     gljList.push(g);
 
@@ -790,11 +799,14 @@ function mergeGLJ(mp, projects) {
     for (let t of temList) {
       t.quantityMap = {};
       t.quantityMap[projects[i].name] = t.tenderQuantity;
+      t.unitPriceMap = {};
+      t.unitPriceMap[projects[i].name] = t.marketPrice;
       //这里除了5个属性相同判断为同一个之外,还要判断市场价相同,才认为是同一个工料机
       let connect_key = gljUtil.getIndex(t);
       let g = gljMap[connect_key];
       if (g && g.marketPrice == t.marketPrice) {
         g.quantityMap[projects[i].name] = t.tenderQuantity;
+        g.unitPriceMap[projects[i].name] = t.marketPrice;
       } else {
         gljMap[connect_key] = t;
         gljList.push(t);