Kaynağa Gözat

1、修复复制报价保存后没有关闭问题
2、修复顶部裥棉多面料保存报错问题

MY 3 hafta önce
ebeveyn
işleme
78cf1bf9d4

+ 2 - 1
JLHHJSvr/DataStore/_Mapper_softbed_mtrltype.xml

@@ -1,8 +1,9 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <select>
 	<selectstr>
-		SELECT u_mtrltype_erp.mtrltype AS value,u_mtrltype_erp.mtrltype AS label
+		SELECT u_mtrltype_erp.handtype AS value,u_mtrltype_erp.handtype AS label
 		FROM u_mtrltype_erp
+		WHERE typecode like ('%XWG%') or typecode like ('%XWX%') or typecode like ('%XZJ%')
 	</selectstr>
 	<where>
   </where>

+ 0 - 1
JLHHJSvr/DataStore/web_mattress_formulalist.xml

@@ -21,7 +21,6 @@ SELECT formulaid
 	,default_mtrlid1
 	,default_mtrlid2
 FROM u_mattress_formula
-WHERE formulatype = 101
   </selectstr>
   <where>
 	  <when notempty="@@arg_array_formulakind@@">

+ 2 - 0
JLHHJSvr/DataStore/web_mattress_interfacelist.xml

@@ -53,6 +53,7 @@ SELECT u_mattress.mattressid
 		,creatmtrlqd_auditingrep
 		,creatmtrlqd_auditingdate
 		,erp_mtrlcode AS erp_mtrlcode
+		,erp_mtrlname
 		,erp_mtrlid
 		,nottax_factory_cost / (dept_profitrate + dept_profitrate_rangli / 100) AS dijia_cost
 		,erp_mtrlengname
@@ -121,6 +122,7 @@ SELECT u_mattress.mattressid
     <field field="creatmtrl_flag" datatype="checkbox">生成L1产品</field>
     <field field="creatmtrlqd_flag" datatype="checkbox">生成L1清单</field>
     <field field="erp_mtrlcode">L1物料编码</field>
+    <field field="erp_mtrlname">L1物料名称</field>
     <field field="deptid" mapper="">部门</field>
     <field field="mattresscode">报价唯一码</field>
     <field field="mattressrelcode">床垫编码</field>

+ 45 - 9
JLHHJSvr/Helper/MattressHelper.cs

@@ -18,6 +18,7 @@ using System.Runtime.Remoting.Metadata.W3cXsd2001;
 using System.Text;
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
+using System.Windows.Forms;
 using static JLHHJSvr.Helper.CacheHelper;
 
 namespace JLHHJSvr.Helper
@@ -114,12 +115,42 @@ namespace JLHHJSvr.Helper
                     InitMxReplaceMents(mx);
 
                     // 顶替分组关键值:內布套、顶布裥棉
-                    if (thicknessDict.ContainsKey(mx.chastr))
+                    //if (thicknessDict.ContainsKey(mx.chastr))
+                    //{
+                    //    foreach(var rp in thicknessDict[mx.chastr])
+                    //    {
+                    //        AddKeyValue(rp.Key, rp.Value);
+                    //    }
+                    //}
+
+                    // 只处理 内布套(101,102)、顶布裥棉(103)
+                    if (new List<int>() { 101, 102, 103 }.Contains(mx.formulatype.Value))
                     {
-                        foreach(var rp in thicknessDict[mx.chastr])
+                        var keyStr = string.Empty;
+                        var keyValue = 0M;
+                        if (mx.formulatype == 101 || mx.formulatype == 102)
+                        {
+                            switch (mx.formulakind.Value)
+                            {
+                                case 0: // 面裥绵-布料
+                                    keyStr = "内布套上覆";
+                                    break;
+                                case 1: // 底裥绵-布料
+                                    keyStr = "内布套下覆";
+                                    break;
+                                case 2: // 大侧裥绵-布料
+                                    keyStr = "内布套侧覆";
+                                    break;
+                            }
+                            keyValue = mx.sidecover.Value;
+                        }
+                        else if (mx.formulatype == 103)
                         {
-                            AddKeyValue(rp.Key, rp.Value);
+                            keyStr = "物料厚度";
+                            keyValue = mx.thickness.Value;
                         }
+
+                        AddKeyValue(keyStr, keyValue);
                     }
 
                     string expression = ConvertToEnglishSymbols(mx.formula), use_expression = ConvertToEnglishSymbols(mx.useformula);
@@ -279,10 +310,10 @@ namespace JLHHJSvr.Helper
         /// 记录明细按分组读取厚度变量
         /// </summary>
         /// <param name="mxlist"></param>
-        private Dictionary<string, Dictionary<string, object>> InitMxThicknessReplaceMents(List<u_mattress_mx_mtrl> mxlist)
+        private Dictionary<string, Dictionary<string, decimal>> InitMxThicknessReplaceMents(List<u_mattress_mx_mtrl> mxlist)
         {
             // 明细按分组读取厚度变量
-            var thicknessDict = new Dictionary<string, Dictionary<string, object>> () { };
+            var thicknessDict = new Dictionary<string, Dictionary<string, decimal>> () { };
 
             foreach (var mx in mxlist)
             {
@@ -291,9 +322,10 @@ namespace JLHHJSvr.Helper
 
                 if (mx.chastr.Contains("顶布裥棉") || mx.chastr.Contains("内布套"))
                 {
+                    var keyStr = $"{mx.chastr}-{mx.mtrlid}";
                     if(!thicknessDict.ContainsKey(mx.chastr))
                     {
-                        thicknessDict.Add(mx.chastr, new Dictionary<string, object>() {});
+                        thicknessDict.Add(mx.chastr, new Dictionary<string, decimal>() {});
                     }
                     var mxDict = thicknessDict[mx.chastr];
                     setMxThicknessValue(mx, ref mxDict);
@@ -303,7 +335,7 @@ namespace JLHHJSvr.Helper
 
             return thicknessDict;
         }
-        private void setMxThicknessValue(u_mattress_mx_mtrl mx, ref Dictionary<string, object> mxDict)
+        private void setMxThicknessValue(u_mattress_mx_mtrl mx, ref Dictionary<string, decimal> mxDict)
         {
             var keyStr = "";
             if (new List<int>() { 101, 102 }.Contains(mx.formulatype.Value))
@@ -322,7 +354,7 @@ namespace JLHHJSvr.Helper
                 }
                 if (!string.IsNullOrEmpty(keyStr))
                 {
-                    mxDict.Add(keyStr, mx.sidecover);
+                    mxDict.Add(keyStr, mx.sidecover.Value);
                 }
             } 
             else if (new List<int>() { 103 }.Contains(mx.formulatype.Value))
@@ -335,7 +367,11 @@ namespace JLHHJSvr.Helper
                 }
                 if (!string.IsNullOrEmpty(keyStr))
                 {
-                    mxDict.Add(keyStr, mx.thickness.Value);
+                    if (!mxDict.TryGetValue(keyStr,out decimal thickness))
+                    {
+                    }
+                    thickness += mx.thickness.Value;
+                    mxDict[keyStr] = thickness;
                 }
             }
         }

+ 37 - 0
JLHWEB/src/stores/modules/keepAlive.ts

@@ -448,6 +448,43 @@ export const useKeepAliveStore = defineStore({
         }
       }
 
+      // 情况5: 复制页跳转到详情页 (/copy -> /detail),复制保存后生成新单据
+      // 需要将复制tab替换为新单据的详情tab
+      const isCopyToDetail =
+        from &&
+        (from.fullPath.includes("/copy?") || from.fullPath.includes("/copy/")) &&
+        (to.fullPath.includes("/detail?") || to.fullPath.includes("/detail/"));
+
+      if (isCopyToDetail) {
+        console.log("复制页->详情页: 替换复制tab为新单据详情tab", {
+          from: from?.fullPath,
+          to: to.fullPath,
+          fromBillCode,
+          toBillCode,
+          note: "虽然单据编码不同,但需要替换当前复制页tab"
+        });
+
+        // 查找复制页tab的索引
+        const copyTabIndex = tabsMenuList.findIndex(item => {
+          const isCopyTab = item.path.includes("/copy?") || item.path.includes("/copy/");
+          // 通过from.fullPath匹配当前正在跳转的复制页
+          return isCopyTab && item.path === from.fullPath;
+        });
+
+        console.log("找到的复制页索引:", copyTabIndex);
+        if (copyTabIndex > -1) {
+          // 替换复制页为新单据详情页
+          console.log("复制页->详情页: 替换复制页", tabsMenuList[copyTabIndex].path, "=>", to.fullPath);
+          tabsMenuList[copyTabIndex] = tabsParams;
+          tabStore.setTabs(tabsMenuList);
+          isReplace = true;
+          to.meta.isKeepAlive && this.addKeepAliveName(to);
+          to.meta.isKeepAlive && this.updateKeepAliveName(to);
+        } else {
+          console.log("未找到复制页tab,将添加新tab");
+        }
+      }
+
       // 如果没有发生替换,则正常添加tab
       if (!isReplace) {
         tabStore.addTabs(tabsParams);