Преглед изворни кода

1、修复刷新配置垫层顺序乱问题
2、修复刷新配置修改【选择】类型问题

MY пре 15 часа
родитељ
комит
0ea325eb03

+ 49 - 11
JLHHJSvr/Helper/InterfaceHelper.cs

@@ -749,24 +749,62 @@ namespace JLHHJSvr.Helper
                 }
             }
 
-            foreach (var mx in diancengList)
+            var orderedKeys = new List<string>();
+            foreach (var kind in kindDict.OrderBy(k => k.Key))
             {
-                var key = $"{mx.chastr}-{kindDict[mx.formulakind.Value]}";
-
-                if (mx.formulakind == 999)
+                foreach (var cha in chastrSet)
                 {
-                    this.ProcessChuangWangPz(mx, interfaceList, mx.chastr, ++countDict[key]);
+                    orderedKeys.Add($"{cha}-{kind.Value}");
                 }
-                else if (mx.mtrlid > 0 && mx.formulakind == 1201)
-                {
-                    this.ProcessDingbuLianMianPz(mx, interfaceList, mx.chastr, ++countDict[key]);
-                }
-                else if (mx.mtrlid > 0 && new int[] { 32, 12, 13, 14, 29 }.Contains(mx.formulakind.Value))
+            }
+
+            foreach (var key in orderedKeys)
+            {
+                var parts = key.Split('-');
+                var cha = parts[0];
+                var kindName = parts[1];
+
+                var kindId = kindDict.FirstOrDefault(x => x.Value == kindName).Key;
+                var items = diancengList.Where(mx =>
+                    mx.chastr == cha &&
+                    mx.formulakind == kindId);
+
+                foreach (var mx in items)
                 {
-                    this.ProcessWangMianBLPz(mx, interfaceList, mx.chastr, kindDict[mx.formulakind.Value], ++countDict[key]);
+                    if (mx.formulakind == 999)
+                    {
+                        this.ProcessChuangWangPz(mx, interfaceList, mx.chastr, countDict[key]);
+                    }
+                    else if (mx.mtrlid > 0 && mx.formulakind == 1201)
+                    {
+                        this.ProcessDingbuLianMianPz(mx, interfaceList, mx.chastr, countDict[key]);
+                    }
+                    else if (mx.mtrlid > 0 && new int[] { 32, 12, 13, 14, 29 }.Contains(mx.formulakind.Value))
+                    {
+                        this.ProcessWangMianBLPz(mx, interfaceList, mx.chastr, kindDict[mx.formulakind.Value], countDict[key]);
+                    }
+                    countDict[key]++;
                 }
             }
 
+            //foreach (var mx in diancengList)
+            //{
+            //    var key = $"{mx.chastr}-{kindDict[mx.formulakind.Value]}";
+
+            //    if (mx.formulakind == 999)
+            //    {
+            //        this.ProcessChuangWangPz(mx, interfaceList, mx.chastr, ++countDict[key]);
+            //    }
+            //    else if (mx.mtrlid > 0 && mx.formulakind == 1201)
+            //    {
+            //        this.ProcessDingbuLianMianPz(mx, interfaceList, mx.chastr, ++countDict[key]);
+            //    }
+            //    else if (mx.mtrlid > 0 && new int[] { 32, 12, 13, 14, 29 }.Contains(mx.formulakind.Value))
+            //    {
+            //        this.ProcessWangMianBLPz(mx, interfaceList, mx.chastr, kindDict[mx.formulakind.Value], ++countDict[key]);
+            //    }
+            //}
+
             if (countDict["大侧-垫层"] > 0)
             {
                 interfaceList.Add(InserMattressInterfacePz("垫层", "大侧垫层生产说明", 1, new string[1]));

+ 9 - 6
JLHWEB/src/views/erpapi/mattressInterface/hooks/index.tsx

@@ -23,6 +23,7 @@ import * as Exceljs from "exceljs";
 import { saveAs } from "file-saver";
 import { MattressYWAudit, MattressJSAudit, MattressJS2Audit } from "@/api/modules/quote";
 import { useRouter } from "vue-router";
+import { cloneDeep } from "lodash-es";
 
 interface defaultState {
   initParams: any;
@@ -1871,9 +1872,7 @@ export const useHooks = (t?: any) => {
     if (isPz === 0) {
       // 刷新配置 FEAT: 只刷新【带出】类型的配置,只刷新明细名称列,并检查核价是否有新增的【带出】类型资料,添加到配置
       visibleData.forEach(mx => {
-        if (mx.bj_inputtype === 2) {
-          copyMap.set(`${mx.erp_pzid}`, mx);
-        }
+        copyMap.set(`${mx.erp_pzid}`, mx);
       });
 
       const PRESERVE_PROPS = [
@@ -1891,9 +1890,13 @@ export const useHooks = (t?: any) => {
       state.mattressYWList = res.mxList.map(mx => {
         const key = `${mx.erp_pzid}`;
         if (copyMap.has(key)) {
-          PRESERVE_PROPS.forEach(prop => {
-            mx[prop] = copyMap.get(key)[prop];
-          });
+          const mx2 = copyMap.get(key);
+          if (mx2.bj_inputtype === 2) {
+            mx.bj_inputtype = mx2.bj_inputtype;
+            mx.bj_namemx = mx2.bj_namemx;
+          } else {
+            mx = cloneDeep(mx2);
+          }
         }
         return mx;
       });