Kaynağa Gözat

1、修复刷新清单,复制清单,刷新配置,复制配置没有变化问题

MY 1 gün önce
ebeveyn
işleme
385ccfef12

+ 33 - 33
JLHHJSvr/Excutor/RefreshMattressInterfaceExcutor.cs

@@ -52,44 +52,44 @@ namespace JLHHJSvr.Excutor
 
                 var interfaceHelper = HelperBase.GetHelper<InterfaceHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
 
-                var interfaceList = interfaceHelper.RefreshMattressInterfaceList(request.mattressid.Value, request.configcodetype);
-
-                if (request.isPz != null && request.isPz == 1)
+                if (request.isPz != null && request.isPz == 0)
                 {
-                    var copyDict = copy_list.Where(mx2 => mx2.erp_pzid > 0)
-                                .ToDictionary(mx2 => mx2.erp_pzid, mx2 => mx2);
+                    var interfaceList = interfaceHelper.RefreshMattressInterfaceList(request.mattressid.Value, request.configcodetype);
+                    copy_list = interfaceList;
+                    //var copyDict = copy_list.Where(mx2 => mx2.erp_pzid > 0)
+                    //            .ToDictionary(mx2 => mx2.erp_pzid, mx2 => mx2);
 
-                    foreach (var mx in interfaceList)
-                    {
-                        if (mx.erp_pzid > 0 && copyDict.TryGetValue(mx.erp_pzid, out var mx2))
-                        {
-                            if (mx.bj_inputtype != 2 || (mx.bj_inputtype == 2 && mx2.bj_inputtype == 1))
-                            {
-                                mx.bj_namemx = mx2.bj_namemx;
-                                mx.actual_size = mx2.actual_size;
-                                mx.sb_craft = mx2.sb_craft;
-                                mx.actual_size_sb = mx2.actual_size_sb;
-                                mx.ss_rate = mx2.ss_rate;
-                                mx.ls_rate = mx2.ls_rate;
+                    //foreach (var mx in interfaceList)
+                    //{
+                    //    if (mx.erp_pzid > 0 && copyDict.TryGetValue(mx.erp_pzid, out var mx2))
+                    //    {
+                    //        if (mx.bj_inputtype != 2 || (mx.bj_inputtype == 2 && mx2.bj_inputtype == 1))
+                    //        {
+                    //            mx.bj_namemx = mx2.bj_namemx;
+                    //            mx.actual_size = mx2.actual_size;
+                    //            mx.sb_craft = mx2.sb_craft;
+                    //            mx.actual_size_sb = mx2.actual_size_sb;
+                    //            mx.ss_rate = mx2.ss_rate;
+                    //            mx.ls_rate = mx2.ls_rate;
 
-                                if (mx.bj_inputtype == 2 && mx2.bj_inputtype == 1)
-                                {
-                                    mx.bj_inputtype = 1;
-                                }
-                            }
-                            else
-                            {
-                                mx.actual_size = mx2.actual_size;
-                                mx.sb_craft = mx2.sb_craft;
-                                mx.actual_size_sb = mx2.actual_size_sb;
-                                mx.ss_rate = mx2.ss_rate;
-                                mx.ls_rate = mx2.ls_rate;
-                            }
-                        }
-                    }
+                    //            if (mx.bj_inputtype == 2 && mx2.bj_inputtype == 1)
+                    //            {
+                    //                mx.bj_inputtype = 1;
+                    //            }
+                    //        }
+                    //        else
+                    //        {
+                    //            mx.actual_size = mx2.actual_size;
+                    //            mx.sb_craft = mx2.sb_craft;
+                    //            mx.actual_size_sb = mx2.actual_size_sb;
+                    //            mx.ss_rate = mx2.ss_rate;
+                    //            mx.ls_rate = mx2.ls_rate;
+                    //        }
+                    //    }
+                    //}
                 }
 
-                rslt.mxList = interfaceList;
+                rslt.mxList = copy_list;
             }
         }
     }

+ 5 - 37
JLHHJSvr/Excutor/RefreshMattressInterfaceQdExcutor.cs

@@ -69,46 +69,14 @@ namespace JLHHJSvr.Excutor
 
                 var interfaceHelper = HelperBase.GetHelper<InterfaceHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
 
-                var qdList = interfaceHelper.RefreshMattressInterfaceQdList(request.mattressid.Value);
-
-                if (request.isPz != null && request.isPz == 1)
+                if (request.isPz != null && request.isPz == 0)
                 {
-                    var copyDict = new Dictionary<Tuple<string, string, string>, u_mattress_interface_qd>();
-
-                    foreach (var mx2 in copy_list)
-                    {
-                        var key = Tuple.Create(mx2.itemname, mx2.bj_pzname, mx2.bj_pzname_mx);
-                        if (!copyDict.ContainsKey(key))
-                        {
-                            copyDict[key] = mx2;
-                        }
-                    }
-
-                    // 遍历qdList
-                    foreach (var mx in qdList)
-                    {
-                        var key = Tuple.Create(mx.itemname, mx.bj_pzname, mx.bj_pzname_mx); // 创建复合键
-                        if (copyDict.TryGetValue(key, out var mx2)) // 高效查找对应的mx2
-                        {
-                            // 更新mx属性
-                            mx.erp_mtrlid = mx2.erp_mtrlid;
-                            mx.erp_mtrlcode = mx2.erp_mtrlcode;
-                            mx.erp_mtrlname = mx2.erp_mtrlname;
-                            mx.erp_mtrlmode = mx2.erp_mtrlmode;
-                            mx.erp_unit = mx2.erp_unit;
-                            mx.useqty = mx2.useqty;
-                            mx.actual_useqty = mx2.actual_useqty;
-                            mx.wrkgrpid = mx2.wrkgrpid;
-                            mx.qd_actual_size = mx2.qd_actual_size;
-                            mx.qd_pfgroupqty = mx2.qd_pfgroupqty;
-                            mx.dscrp = mx2.dscrp;
-                        }
-                    }
+                    var qdList = interfaceHelper.RefreshMattressInterfaceQdList(request.mattressid.Value);
+                    copy_list = qdList;
                 }
 
-                interfaceHelper.MattressInterfaceFindERPPrdPf(qdList);
-
-                rslt.mxList = qdList;
+                interfaceHelper.MattressInterfaceFindERPPrdPf(copy_list);
+                rslt.mxList = copy_list;
             }
         }
     }

+ 2 - 2
JLHWEB/src/views/erpapi/mattressInterface/detail.vue

@@ -815,7 +815,7 @@ const orderDefaultAction = [
         return !orderStatus.value;
       },
       clickFunc: item => {
-        RefreshMattressInterfaceQdList(LjDetailRef.value?._mainData.mattressid, 0);
+        RefreshMattressInterfaceQdList(LjDetailRef.value?._mainData.mattressid, 1);
       }
     }),
     buttonDefault({
@@ -825,7 +825,7 @@ const orderDefaultAction = [
       },
       clickFunc: item => {
         fModelChoseMattress().then((res: any) => {
-          RefreshMattressInterfaceQdList(res.mattressid, 0, 0);
+          RefreshMattressInterfaceQdList(res.mattressid, 1, 0);
         });
       }
     }),

+ 46 - 4
JLHWEB/src/views/erpapi/mattressInterface/hooks/index.tsx

@@ -1860,8 +1860,48 @@ export const useHooks = (t?: any) => {
    * @param mattressid 床垫ID
    */
   const RefreshMattressInterfaceList = async (mattressid: number, isPz: number, configcodetype: number = 0) => {
-    let res = await RefreshMattressInterface({ mattressid, isPz, configcodetype });
-    state.mattressYWList = res.mxList;
+    let res = await RefreshMattressInterface({ mattressid, isPz: isPz, configcodetype });
+    // state.mattressYWList = res.mxList;
+
+    // 获取先有配置信息
+    const $table = state.YwTableRef?.element;
+    if ($table) {
+      let { visibleData } = $table.getTableData();
+      const copyMap = new Map();
+
+      res.mxList.forEach((mx: any) => {
+        const key = `${mx.erp_pzid}`;
+        if (!copyMap.has(key)) copyMap.set(key, mx);
+      });
+
+      visibleData.forEach((mx: any) => {
+        const key = `${mx.erp_pzid}`;
+        if (mx.erp_pzid > 0 && copyMap.has(key)) {
+          const mx2 = copyMap.get(key);
+
+          if (mx.bj_inputtype !== 2 || (mx.bj_inputtype === 2 && mx2.bj_inputtype === 1)) {
+            mx.bj_namemx = mx2.bj_namemx;
+            mx.actual_size = mx2.actual_size;
+            mx.sb_craft = mx2.sb_craft;
+            mx.actual_size_sb = mx2.actual_size_sb;
+            mx.ss_rate = mx2.ss_rate;
+            mx.ls_rate = mx2.ls_rate;
+
+            if (mx.bj_inputtype === 2 && mx2.bj_inputtype === 1) {
+              mx.bj_inputtype = 1;
+            }
+          } else {
+            mx.actual_size = mx2.actual_size;
+            mx.sb_craft = mx2.sb_craft;
+            mx.actual_size_sb = mx2.actual_size_sb;
+            mx.ss_rate = mx2.ss_rate;
+            mx.ls_rate = mx2.ls_rate;
+          }
+        }
+      });
+
+      $table.reloadData(visibleData);
+    }
 
     resetMergeCells();
 
@@ -1906,13 +1946,13 @@ export const useHooks = (t?: any) => {
       let { visibleData } = $table.getTableData();
       const copyMap = new Map();
 
-      visibleData.forEach(mx => {
+      res.mxList.forEach(mx => {
         const key = `${mx.itemname}|${mx.bj_pzname}|${mx.bj_pzname_mx}`;
 
         if (!copyMap.has(key)) copyMap.set(key, mx);
       });
 
-      res.mxList.forEach(mx => {
+      visibleData.forEach(mx => {
         // 创建复合键(使用模板字符串生成唯一标识)
         const key = `${mx.itemname}|${mx.bj_pzname}|${mx.bj_pzname_mx}`;
 
@@ -1935,6 +1975,8 @@ export const useHooks = (t?: any) => {
           });
         }
       });
+
+      $table.reloadData(visibleData);
     }
     // state.mattressQDList = res.mxList;