浏览代码

更新代码

MY 5 月之前
父节点
当前提交
0ba4fb9c5e

+ 3 - 1
JLHHJSvr/Com/Model/u_factory_profitrate.cs

@@ -1,10 +1,12 @@
-using System;
+using LJLib.DAL.SQL;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 
 namespace JLHHJSvr.Com.Model
 {
+    [PK(new[] { "deptid", "bednet_or_mattress", "bednettypeid_mattresstypeid" })]
     public sealed class u_factory_profitrate
     {
         /// <summary>

+ 3 - 0
JLHHJSvr/Com/Model/u_mattress.cs

@@ -134,5 +134,8 @@ namespace JLHHJSvr.Com.Model
         public decimal? foreign_cost_bz { get; set; }
         public decimal? foreign_cost_dd { get; set; }
 
+        #region 其他
+        public int? pricelistid { get; set; }
+        #endregion
     }
 }

+ 2 - 0
JLHHJSvr/Excutor/SaveMattressExcutor.cs

@@ -54,6 +54,8 @@ namespace JLHHJSvr.Excutor
                         helper.SaveMattress(request.mattress, request.mattressMx);
                         
                         cmd.Transaction.Commit();
+
+                        rslt.mattressid = request.mattress.mattressid;
                     }
                     catch (Exception e)
                     {

+ 108 - 51
JLHHJSvr/Helper/BedNetHelper.cs

@@ -85,7 +85,7 @@ namespace JLHHJSvr.Helper
                         }
                         catch (Exception ex)
                         {
-                            throw new LJCommonException("弹簧材料总成本公式错误!");
+                            throw new LJCommonException($"弹簧材料总成本公式错误!expression: {mx.spring_mtrl_cost_replace_formula}");
                         }
                     }
                     else
@@ -111,7 +111,7 @@ namespace JLHHJSvr.Helper
                             }
                             catch (Exception ex)
                             {
-                                throw new LJCommonException("弹簧材料总成本公式错误!");
+                                throw new LJCommonException($"弹簧材料总成本公式错误!expression: {springItem.spring_mtrl_cost_replace_formula}");
                             }
                         }
                     }
@@ -138,7 +138,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("弹簧总人工成本公式错误!");
+                        throw new LJCommonException($"弹簧总人工成本公式错误!expression: {mx.spring_hr_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 弹簧人工总成本 结束
@@ -163,7 +163,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("蛇线材料成本公式错误!");
+                        throw new LJCommonException($"蛇线材料成本公式错误!expression: {bednet.snake_wire_mtrl_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 蛇线材料成本 结束
@@ -187,7 +187,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("四周口袋弹簧成本公式错误!");
+                        throw new LJCommonException($"四周口袋弹簧成本公式错误!expression: {mx.pocket_around_spring_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 四周口袋弹簧成本 结束
@@ -211,7 +211,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("四周口袋无纺布成本公式错误!");
+                        throw new LJCommonException($"四周口袋无纺布成本公式错误!expression: {mx.pocket_around_fabrics_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 四周口袋无纺布成本 结束
@@ -235,7 +235,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("四周加硬材料成本公式错误!");
+                        throw new LJCommonException($"四周加硬材料成本公式错误!expression: {mx.hard_around_mtrl_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 四周加硬材料成本 结束
@@ -259,7 +259,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("四周加硬人力成本公式错误!");
+                        throw new LJCommonException($"四周加硬人力成本公式错误!expression: {mx.hard_around_hr_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 四周加硬人力成本 结束
@@ -285,7 +285,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("入袋无纺布材料成本公式错误!");
+                        throw new LJCommonException($"入袋无纺布材料成本公式错误!expression: {mx.fabrics1_mtrl_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 入袋无纺布材料成本 结束
@@ -308,7 +308,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("胶水材料成本公式错误!");
+                        throw new LJCommonException($"胶水材料成本公式错误!expression: {mx.glue_mtrl_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 胶水材料成本 结束
@@ -334,7 +334,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("底面无纺布材料成本公式错误!");
+                        throw new LJCommonException($"底面无纺布材料成本公式错误!expression: {mx.fabrics2_mtrl_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 底面无纺布材料成本 结束
@@ -358,7 +358,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("边铁人力成本公式错误!");
+                        throw new LJCommonException($"边铁人力成本公式错误!expression: {mx.side_iron_hr_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 边铁人力成本 结束
@@ -382,7 +382,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("边铁材料成本公式错误!");
+                        throw new LJCommonException($"边铁材料成本公式错误!expression: {mx.side_iron_mtrl_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 边铁材料成本 结束
@@ -406,7 +406,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("C钉/夹码材料成本公式错误!");
+                        throw new LJCommonException($"C钉/夹码材料成本公式错误!expression: {mx.cnail_mtrl_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 C钉/夹码材料 结束
@@ -430,7 +430,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("C钉/夹码人力成本公式错误!");
+                        throw new LJCommonException($"C钉/夹码人力成本公式错误!expression: {mx.cnail_hr_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 C钉/夹码人力成本 结束
@@ -456,7 +456,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("海绵包边材料成本公式错误!");
+                        throw new LJCommonException($"海绵包边材料成本公式错误!expression: {bednet.sponge_mtrl_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 海绵包边材料成本 结束
@@ -479,7 +479,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("海绵包边人力成本公式错误!");
+                        throw new LJCommonException($"海绵包边人力成本公式错误!expression: {bednet.sponge_hr_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 海绵包边人力成本 结束
@@ -504,7 +504,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("填充海绵成本公式错误!");
+                        throw new LJCommonException($"填充海绵成本公式错误!expression: {bednet.sponge_mtrl_tc_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 填充海绵成本 结束
@@ -529,7 +529,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("封边材料成本公式错误!");
+                        throw new LJCommonException($"封边材料成本公式错误!expression: {bednet.edge_mtrl_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 封边材料成本 结束
@@ -552,7 +552,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("封边人力成本公式错误!");
+                        throw new LJCommonException($"封边人力成本公式错误!expression: {bednet.edge_hr_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 封边人力成本 结束
@@ -575,7 +575,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("弹叉材料成本公式错误!");
+                        throw new LJCommonException($"弹叉材料成本公式错误!expression: {bednet.fork_mtrl_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 弹叉材料成本 结束
@@ -598,7 +598,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("弹叉材料成本公式错误!");
+                        throw new LJCommonException($"弹叉材料成本公式错误!expression: {bednet.fork_hr_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 弹叉人力成本 结束
@@ -621,7 +621,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("胶条/包角材料成本公式错误!");
+                        throw new LJCommonException($"胶条/包角材料成本公式错误!expression: {bednet.rsorwa_mtrl_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 胶条/包角材料成本 结束
@@ -644,7 +644,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("胶条/包角人力成本公式错误!");
+                        throw new LJCommonException($"胶条/包角人力成本公式错误!expression: {bednet.rsorwa_hr_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 胶条/包角人力成本 结束
@@ -667,7 +667,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("海绵打孔人力成本公式错误!");
+                        throw new LJCommonException($"海绵打孔人力成本公式错误!expression: {bednet.sponge_drilling_hr_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 海绵打孔人力成本 结束
@@ -692,7 +692,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("上垫层物料成本公式错误!");
+                        throw new LJCommonException($"上垫层物料成本公式错误!expression: {bednet.felt_mtrl_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 上垫层物料成本 结束
@@ -717,7 +717,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("下垫层物料成本公式错误!");
+                        throw new LJCommonException($"下垫层物料成本公式错误!expression: {bednet.felt_mtrl_x_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 下垫层物料成本 结束
@@ -740,7 +740,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("上垫层人力成本公式错误!");
+                        throw new LJCommonException($"上垫层人力成本公式错误!expression: {bednet.felt_hr_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 上垫层人力成本 结束
@@ -765,7 +765,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("下垫层物料成本公式错误!");
+                        throw new LJCommonException($"下垫层物料成本公式错误!expression: {bednet.felt_hr_x_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 下垫层人力成本 结束
@@ -775,6 +775,7 @@ namespace JLHHJSvr.Helper
                 {
                     bednet.packet_mtrl_formula = ConvertToEnglishSymbols(bednet.packet_mtrl_formula);
                     bednet.packet_mtrl_cost_replace_formula = bednet.packet_mtrl_formula;
+                    bool sqlCal = !string.IsNullOrEmpty(bednet.packet_mtrl_formula) && bednet.packet_mtrl_formula.Substring(0, 2) == "@@";
                     bednet.packet_mtrl_cost_replace_formula = ReplaceWith(bednet.packet_mtrl_cost_replace_formula, "@@", "");
 
                     foreach (var replacement in replacements)
@@ -784,12 +785,25 @@ namespace JLHHJSvr.Helper
 
                     try
                     {
-                        var res = LJExprParser.Parse(bednet.packet_mtrl_cost_replace_formula);
-                        bednet.packet_mtrl_cost += res.Result.DecimalValue;
+                        if (sqlCal)
+                        {
+                            cmd.CommandText = $@"{bednet.packet_mtrl_cost_replace_formula}";
+                            cmd.Parameters.Clear();
+                            var result = cmd.ExecuteScalar();
+                            if (result != null && result != DBNull.Value)
+                            {
+                                bednet.packet_mtrl_cost += Convert.ToDecimal(result);
+                            }
+                        }
+                        else
+                        {
+                            var res = LJExprParser.Parse(bednet.packet_mtrl_cost_replace_formula);
+                            bednet.packet_mtrl_cost += res.Result.DecimalValue;
+                        }
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("包装材料成本公式错误!");
+                        throw new LJCommonException($"包装材料成本公式错误!expression: {bednet.packet_mtrl_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 包装总成本 结束
@@ -799,6 +813,7 @@ namespace JLHHJSvr.Helper
                 {
                     bednet.packet_hr_formula = ConvertToEnglishSymbols(bednet.packet_hr_formula);
                     bednet.packet_hr_cost_replace_formula = bednet.packet_hr_formula;
+                    bool sqlCal = !string.IsNullOrEmpty(bednet.packet_hr_formula) && bednet.packet_hr_formula.Substring(0, 2) == "@@";
                     bednet.packet_hr_cost_replace_formula = ReplaceWith(bednet.packet_hr_cost_replace_formula, "@@", "");
 
                     foreach (var replacement in replacements)
@@ -808,12 +823,25 @@ namespace JLHHJSvr.Helper
 
                     try
                     {
-                        var res = LJExprParser.Parse(bednet.packet_hr_cost_replace_formula);
-                        bednet.packet_hr_cost += res.Result.DecimalValue;
+                        if (sqlCal)
+                        {
+                            cmd.CommandText = $@"{bednet.packet_hr_cost_replace_formula}";
+                            cmd.Parameters.Clear();
+                            var result = cmd.ExecuteScalar();
+                            if (result != null && result != DBNull.Value)
+                            {
+                                bednet.packet_hr_cost += Convert.ToDecimal(result);
+                            }
+                        }
+                        else
+                        {
+                            var res = LJExprParser.Parse(bednet.packet_hr_cost_replace_formula);
+                            bednet.packet_hr_cost += res.Result.DecimalValue;
+                        }
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("包装材料成本公式错误!");
+                        throw new LJCommonException($"包装材料成本公式错误!expression: {bednet.packet_hr_cost_replace_formula}");
                     }
                 }
                 #endregion 计算 包装人工成本 结束
@@ -921,7 +949,7 @@ namespace JLHHJSvr.Helper
                         }
                         catch (Exception ex)
                         {
-                            throw new LJCommonException("钢丝重量公式错误!");
+                            throw new LJCommonException($"钢丝重量公式错误!expression: {mx.spring_weight_replace_formula}");
                         }
                     }
                     else
@@ -944,7 +972,7 @@ namespace JLHHJSvr.Helper
                             }
                             catch (Exception ex)
                             {
-                                throw new LJCommonException("钢丝重量公式错误!");
+                                throw new LJCommonException($"钢丝重量公式错误!expression: {springItem.spring_mtrl_cost_replace_formula}");
                             }
                         }
                     }
@@ -969,7 +997,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("边铁重量公式错误!");
+                        throw new LJCommonException($"边铁重量公式错误!expression: {bednet.side_iron_weight_replace_formula}");
                     }
                 }
                 #endregion 计算 边铁重量 结束
@@ -992,7 +1020,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("四周加硬重量公式错误!");
+                        throw new LJCommonException($"四周加硬重量公式错误!expression: {bednet.hard_around_weight_replace_formula}");
                     }
                 }
                 #endregion 计算 四周加硬重量 结束
@@ -1015,7 +1043,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("入袋无纺布重量公式错误!");
+                        throw new LJCommonException($"入袋无纺布重量公式错误!expression: {bednet.fabrics1_weight_replace_formula}");
                     }
                 }
                 #endregion 计算 入袋无纺布重量 结束
@@ -1038,7 +1066,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("面底无纺布重量公式错误!");
+                        throw new LJCommonException($"面底无纺布重量公式错误!expression: {bednet.fabrics2_weight_replace_formula}");
                     }
                 }
                 #endregion 计算 面底无纺布重量 结束
@@ -1064,7 +1092,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("上垫层重量公式错误!");
+                        throw new LJCommonException($"上垫层重量公式错误!expression: {felt_weight_formula_replace_formula}");
                     }
                 }
                 #endregion 计算 上垫层重量 结束
@@ -1090,7 +1118,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("下垫层重量公式错误!");
+                        throw new LJCommonException($"下垫层重量公式错误!expression: {felt_x_weight_formula_replace_formula}");
                     }
                 }
 
@@ -1118,7 +1146,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("C钉/夹码重量公式错误!");
+                        throw new LJCommonException($"C钉/夹码重量公式错误!expression: {bednet.cnail_weight_replace_formula}");
                     }
                 }
                 #endregion 计算 C钉/夹码重量 结束
@@ -1141,7 +1169,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("海绵包边重量公式错误!");
+                        throw new LJCommonException($"海绵包边重量公式错误!expression: {bednet.sponge_weight_replace_formula}");
                     }
                 }
                 #endregion 计算 海绵包边重量 结束
@@ -1166,7 +1194,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("填充海绵重量公式错误!");
+                        throw new LJCommonException($"填充海绵重量公式错误!expression: {bednet.sponge_weight_tc_replace_formula}");
                     }
                 }
                 #endregion 计算 填充海绵重量 结束
@@ -1191,7 +1219,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("封边材料重量公式错误!");
+                        throw new LJCommonException($"封边材料重量公式错误!expression: {bednet.edge_weight_replace_formula}");
                     }
                 }
                 #endregion 计算 封边材料重量 结束
@@ -1214,7 +1242,7 @@ namespace JLHHJSvr.Helper
                     }
                     catch (Exception ex)
                     {
-                        throw new LJCommonException("弹叉材料重量公式错误!");
+                        throw new LJCommonException($"弹叉材料重量公式错误!expression: {bednet.fork_weight_replace_formula}");
                     }
                 }
                 #endregion 计算 弹叉材料重量 结束
@@ -1685,13 +1713,14 @@ namespace JLHHJSvr.Helper
 
         private void AddKeyValue(string key, object value, bool isReplace = true)
         {
+            key = $"【{key}】";
             if (!replacements.ContainsKey(key))
             {
-                replacements.Add($"【{key}】", value);
+                replacements.Add(key, value);
             }
             else if (isReplace)
             {
-                replacements[$"【{key}】"] = value;
+                replacements[key] = value;
             }
         }
         private string ReplaceWith(string input, string oldValue, string newValue)
@@ -1701,7 +1730,35 @@ namespace JLHHJSvr.Helper
 
         public void GetBedNet(u_bednet bednet)
         {
-            DbSqlHelper.SelectOne(cmd, bednet, "*");
+            var outputFields = @"bednetid,deptid,bednettypeid,mattress_width,mattress_length,mattress_height,if_doublenet,if_doublespring,snake_wire_diameter,
+                                snake_wire_mtrl_formula,snake_wire_mtrl_cost,pocket_around_spring_formula,pocket_around_spring_cost,pocket_around_fabrics_formula,
+                                pocket_around_fabrics_cost,hard_around_mtrl_formula,hard_around_mtrl_cost,hard_around_hr_formula,hard_around_hr_cost,
+                                spring_mtrl_cost,spring_hr_cost,glue_price,glue_mtrl_formula,glue_mtrl_cost,fabrics1_mtrl_formula,fabrics1_mtrl_cost,
+                                fabrics2_mtrl_formula,fabrics2_mtrl_cost,if_side_iron,side_iron_lossrate,side_iron_price,side_iron_mtrl_formula,
+                                side_iron_mtrl_cost,side_iron_hr_formula,side_iron_hr_cost,cnail_price,cnail_mtrl_formula,cnail_mtrl_cost,cnail_hr_formula,
+                                cnail_hr_cost,sponge_mtrlid,sponge_thickness,sponge_price,sponge_mtrl_formula,sponge_mtrl_cost,sponge_hr_formula,
+                                sponge_hr_cost,edge_mtrlid,edge_price,edge_mtrl_formula,edge_mtrl_cost,edge_hr_formula,edge_hr_cost,fork_qty,fork_price,
+                                fork_mtrl_formula,fork_mtrl_cost,fork_hr_formula,fork_hr_cost,if_rsORwa,rsORwa_price,rsORwa_mtrl_formula,rsORwa_mtrl_cost,
+                                rsORwa_hr_formula,rsORwa_hr_cost,if_sponge_drilling,sponge_drilling_hr_formula,sponge_drilling_hr_cost,total_hr_cost,
+                                total_mtrl_cost,total_fees_cost,total_cost,createtime,createby,bednetcode,bednetname,spring_mtrl_formula,spring_hr_formula,
+                                sponge_mtrl_cost_replace_formula,sponge_hr_cost_replace_formula,edge_mtrl_cost_replace_formula,edge_hr_cost_replace_formula,
+                                fork_mtrl_cost_replace_formula,fork_hr_cost_replace_formula,rsORwa_mtrl_cost_replace_formula,rsORwa_hr_cost_replace_formula,
+                                sponge_drilling_hr_cost_replace_formula,snake_wire_mtrl_cost_replace_formula,flag,taxrate,taxes,commissionrate,commission,fob,
+                                profitrate,nottax_factory_cost,nottax_dept_cost,dept_cost,foreign_cost,extras_cost,dept_profitrate,moneyrate,temp_flag,felt_mtrlid,
+                                felt_qty,felt_price,felt_dscrp,felt_mtrl_formula,felt_mtrl_cost,felt_hr_formula,felt_hr_cost,felt_mtrl_cost_replace_formula,
+                                felt_hr_cost_replace_formula,extras_cost_dscrp,iffork,ifsaleout,autotype,felt_mtrl_x_cost,felt_hr_x_cost,felt_x_qty,
+                                felt_mtrl_x_cost_replace_formula,felt_hr_x_cost_replace_formula,felt_x_mtrlid,sale_point,packtype,packqty,other_rate,
+                                transport_type,packmtrl,packet_mtrl_formula,packet_hr_formula,packet_mtrl_cost,packet_hr_cost,packet_mtrl_cost_replace_formula,
+                                packet_hr_cost_replace_formula,sponge_height,edge_height,sponge_tc_thickness,sponge_tc_height,sponge_tc_mtrlid,sponge_mtrl_tc_cost,
+                                sponge_mtrl_tc_formula,sponge_mtrl_tc_cost_replace_formula,sum_weight,spring_weight,snake_weight,side_weight,duo_qv_str,
+                                spring_weight_formula,side_iron_weight_formula,hard_around_weight_formula,fabrics1_weight_formula,fabrics2_weight_formula,
+                                felt_weight_formula,cnail_weight_formula,sponge_weight_formula,sponge_weight_tc_formula,edge_weight_formula,fork_weight_formula,
+                                spring_weight_replace_formula,side_iron_weight_replace_formula,hard_around_weight_replace_formula,fabrics1_weight_replace_formula,
+                                fabrics2_weight_replace_formula,felt_weight_replace_formula,cnail_weight_replace_formula,sponge_weight_replace_formula,
+                                sponge_weight_tc_replace_formula,edge_weight_replace_formula,fork_weight_replace_formula,spring_weight_qty,
+                                side_iron_weight_qty,hard_around_weight_qty,fabrics1_weight_qty,fabrics2_weight_qty,felt_weight_qty,
+                                cnail_weight_qty,sponge_weight_qty,sponge_weight_tc_qty,edge_weight_qty,fork_weight_qty,if_jb";
+            DbSqlHelper.SelectOne(cmd, bednet, outputFields);
         }
 
         public List<u_bednetmx_spring> GetBedNetSpringList(int bednetid)

+ 110 - 19
JLHHJSvr/Helper/MattressHelper.cs

@@ -20,10 +20,12 @@ namespace JLHHJSvr.Helper
 
         public void CalCulateFormula(u_mattress mattress, List<u_mattress_mx_mtrl> mxlist)
         {
-            //wf_cmp_bednet #TODO
             InitMattress(mattress);
 
-            InitMattressMx(mxlist);
+            InitMattressMx(mattress,mxlist);
+
+            // 重算床网价格
+            CalCulateBedNet(mxlist);
 
             InitReplaceMents(mattress);
 
@@ -36,6 +38,8 @@ namespace JLHHJSvr.Helper
             {
                 if (mx.mtrlid == 0 && mx.formulakind != 31) continue;
 
+                if (string.IsNullOrEmpty(mx.formula) && string.IsNullOrEmpty(mx.useformula)) continue;
+
                 InitMxReplaceMents(mx);
 
                 string expression = ConvertToEnglishSymbols(mx.formula), use_expression = ConvertToEnglishSymbols(mx.useformula);
@@ -95,32 +99,60 @@ namespace JLHHJSvr.Helper
                 }
 
                 #region 计算成本金额
+                // 判断expression前两个字符是否为@@
+                bool sqlCal = !string.IsNullOrEmpty(expression) && expression.Substring(0, 2) == "@@";
                 expression = expression.Replace("@@", "");
                 mx.replace_formula = expression;
 
                 try
                 {
-                    var res = LJExprParser.Parse(mx.replace_formula);
-                    mx.costamt = res.Result.DecimalValue;
+                    if (sqlCal)
+                    {
+                        cmd.CommandText = $@"{expression}";
+                        cmd.Parameters.Clear();
+                        var result = cmd.ExecuteScalar();
+                        if(result != null && result != DBNull.Value)
+                        {
+                            mx.costamt = Convert.ToDecimal(result);
+                        }
+                    } else
+                    {
+                        var res = LJExprParser.Parse(expression);
+                        mx.costamt = res.Result.DecimalValue;
+                    }
                 }
                 catch (Exception ex)
                 {
-                    throw new LJCommonException("计算成本金额公式错误!");
+                    throw new LJCommonException($"计算成本金额公式错误!expression: {expression}" );
                 }
                 #endregion
 
                 #region 计算清单用量
+                sqlCal = !string.IsNullOrEmpty(use_expression) && use_expression.Substring(0, 2) == "@@";
                 use_expression = use_expression.Replace("@@", "");
                 mx.replace_useformula = use_expression;
 
                 try
                 {
-                    var res = LJExprParser.Parse(mx.replace_useformula);
-                    mx.useqty = res.Result.DecimalValue;
+                    if (sqlCal)
+                    {
+                        cmd.CommandText = $@"{use_expression}";
+                        cmd.Parameters.Clear();
+                        var result = cmd.ExecuteScalar();
+                        if (result != null && result != DBNull.Value)
+                        {
+                            mx.useqty = Convert.ToDecimal(result);
+                        }
+                    }
+                    else
+                    {
+                        var res = LJExprParser.Parse(use_expression);
+                        mx.useqty = res.Result.DecimalValue;
+                    }
                 }
                 catch (Exception ex)
                 {
-                    throw new LJCommonException("计算清单用量公式错误!");
+                    throw new LJCommonException($"计算清单用量公式错误!expression: {use_expression}");
                 }
                 #endregion
             }
@@ -135,6 +167,7 @@ namespace JLHHJSvr.Helper
 
             foreach(var mx in bednetList)
             {
+                if (mx.mtrlid <= 0) continue;
                 var bednet = new u_bednet() { bednetid = mx.mtrlid };
                 DbSqlHelper.SelectOne(cmd, bednet, "flag");
 
@@ -149,15 +182,27 @@ namespace JLHHJSvr.Helper
                 bedNetHelper.CalCulateFormula(bednet, bednetMxlist, bednetSpringList);
 
                 bedNetHelper.SaveBedNet(bednet, bednetMxlist, bednetSpringList);
+
+                mx.price = bednet.nottax_factory_cost;
             }
         }
         private void InitMattress(u_mattress mattress)
         {
+            var dept = new u_dept() { deptid = mattress.deptid.Value };
+            DbSqlHelper.SelectOne(cmd, dept, "pricelistid,profitrate,moneyrate,discount");
+            var profirate = new u_factory_profitrate() { deptid = mattress.deptid, bednettypeid_mattresstypeid = mattress.mattresstypeid, bednet_or_mattress = 1 };
+            DbSqlHelper.SelectOne(cmd, profirate, "profitrate");
+
+            mattress.pricelistid = dept.pricelistid;
+
+            mattress.dept_profitrate = mattress.profitrate;
+            mattress.profitrate = profirate.profitrate;
+
+            mattress.moneyrate = mattress.if_moneyrate == 1 ? dept.moneyrate ?? 1 : 1;
+            mattress.discount = dept.discount ?? 1 ;
             mattress.commission = mattress.commission ?? 1;
             mattress.taxrate = mattress.taxrate ?? 1;
             mattress.other_rate = mattress.other_rate ?? 1;
-            mattress.moneyrate = mattress.moneyrate ?? 1;
-            mattress.discount = mattress.discount ?? 1;
             mattress.dept_profitrate = mattress.dept_profitrate ?? 0;
 
             // 检查佣金是否小于1
@@ -184,7 +229,7 @@ namespace JLHHJSvr.Helper
                 throw new LJCommonException("部门利润率不能为0!");
             }
         }
-        private void InitMattressMx(List<u_mattress_mx_mtrl> mxlist)
+        private void InitMattressMx(u_mattress mattress,List<u_mattress_mx_mtrl> mxlist)
         {
             foreach(var mx in mxlist)
             {
@@ -192,12 +237,57 @@ namespace JLHHJSvr.Helper
                 DbSqlHelper.SelectOne(cmd, formula, "formulakind,formulatype,sortcode");
 
                 var mtrldef = new u_mtrl_price() { mtrlid = mx.mtrlid };
-                DbSqlHelper.SelectOne(cmd, mtrldef, "name");
+                DbSqlHelper.SelectOne(cmd, mtrldef, "name,price,gram_weight,cloth_width,if_inputqty,priceunit,shrinkage,if_areaprice");
 
                 mx.formulakind = formula.formulakind;
                 mx.formulatype = formula.formulatype;
                 mx.sortcode = formula.sortcode.Trim();
                 mx.mtrlname = mtrldef.name ?? "";
+
+                var formula2 = new u_mattress_formula();
+                DbSqlHelper.SelectOne(cmd, "u_mattress_formula","formulakind = @formulakind",
+                    new Dictionary<string, object>() { { "@formulakind",mx.formulakind } },formula2, "formula,useformula,gydscrp");
+
+                mx.formula = formula2.formula;
+                mx.useformula = formula2.useformula;
+                mx.gydscrp = formula2.gydscrp;
+
+                cmd.CommandText = @"SELECT isnull(u_mtrl_price_pricelist.price, 0) AS pricelistprice
+	                                    ,u_mtrl_price.gram_weight
+	                                    ,u_mtrl_price.cloth_width
+	                                    ,u_mtrl_price.if_inputqty
+	                                    ,u_mtrl_price.priceunit
+	                                    ,u_mtrl_price.shrinkage
+	                                    ,isnull(u_mtrl_price_pricelist.price_formula, 0) AS price_formula
+	                                    ,isnull(u_mtrl_price_pricelist.qty_formula, 0) AS qty_formula
+	                                    ,u_mtrl_price.if_areaprice
+	                                    ,u_mtrl_price.thickness
+                                    FROM u_mtrl_price
+                                    INNER JOIN u_mtrl_price_pricelist ON u_mtrl_price.mtrlid = u_mtrl_price_pricelist.mtrlid
+                                    WHERE (u_mtrl_price.mtrlid = @mtrlid)
+	                                    AND (u_mtrl_price_pricelist.pricelistid = @pricelistid)";
+                cmd.Parameters.Clear();
+                cmd.Parameters.AddWithValue("@mtrlid", mx.mtrlid);
+                cmd.Parameters.AddWithValue("@pricelistid", mattress.pricelistid);
+                using(var reader = cmd.ExecuteReader())
+                {
+                    if (reader.Read())
+                    {
+                        mx.price = Convert.ToDecimal(reader["pricelistprice"]);
+                        mx.gram_weight = Convert.ToDecimal(reader["gram_weight"]);
+                        mx.cloth_width = Convert.ToDecimal(reader["cloth_width"]);
+                        mx.if_inputqty = Convert.ToInt32(reader["if_inputqty"]);
+                        mx.priceunit = reader["priceunit"].ToString();
+                        mx.shrinkage = Convert.ToDecimal(reader["shrinkage"]);
+                        mx.if_areaprice = Convert.ToByte(reader["if_areaprice"]);
+
+                        if(mx.if_inputqty == 1) mx.thickness = Convert.ToDecimal(reader["thickness"]);
+                        string price_formula = Convert.ToString(reader["price_formula"]);
+                        string qty_formula = Convert.ToString(reader["qty_formula"]);
+                        mx.formula = string.IsNullOrEmpty(price_formula) ? "" : price_formula;
+                        mx.useformula = string.IsNullOrEmpty(qty_formula) ? "" : qty_formula;
+                    }
+                }
             }
         }
         private void InitReplaceMents(u_mattress mattress)
@@ -273,7 +363,7 @@ namespace JLHHJSvr.Helper
         }
         private void InitMxReplaceMents(u_mattress_mx_mtrl mx)
         {
-            mx.mtrlname = string.IsNullOrEmpty(mx.mtrlname) ? mx.mtrlname.Trim() : "null";
+            mx.mtrlname = !string.IsNullOrEmpty(mx.mtrlname) ? mx.mtrlname.Trim() : "null";
 
             mx.shrinkage = mx.shrinkage ?? 1;
 
@@ -519,7 +609,7 @@ namespace JLHHJSvr.Helper
             }
             catch (Exception ex)
             {
-                throw new LJCommonException("计算FOB公式错误!");
+                throw new LJCommonException($"计算FOB公式错误!expression: {fob_expression}");
             }
             #endregion
 
@@ -533,7 +623,7 @@ namespace JLHHJSvr.Helper
                 }
                 catch (Exception ex)
                 {
-                    throw new LJCommonException("计算体积公式错误!");
+                    throw new LJCommonException($"计算体积公式错误!expression: {cubage_expression}");
                 }
             }
             #endregion
@@ -567,7 +657,7 @@ namespace JLHHJSvr.Helper
             }
             catch (Exception ex)
             {
-                throw new LJCommonException("计算款式费用公式错误!");
+                throw new LJCommonException($"计算款式费用公式错误!expression: {mattress.hrcost_replace_formula}");
             }
             #endregion
 
@@ -583,7 +673,7 @@ namespace JLHHJSvr.Helper
             }
             catch (Exception ex)
             {
-                throw new LJCommonException("计算边带费用公式错误!");
+                throw new LJCommonException($"计算边带费用公式错误!expression: {mattress.biandaicost_replace_formula}");
             }
             #endregion
 
@@ -826,13 +916,14 @@ namespace JLHHJSvr.Helper
         }
         private void AddKeyValue(string key, object value, bool isReplace = true)
         {
+            key = $"【{key}】";
             if (!replacements.ContainsKey(key))
             {
-                replacements.Add($"【{key}】", value);
+                replacements.Add(key, value);
             }
             else if (isReplace)
             {
-                replacements[$"【{key}】"] = value;
+                replacements[key] = value;
             }
         }
         private string ConvertToEnglishSymbols(string input)

+ 0 - 66
JLHWEB/src/views/quote/mattressQuote/detail.vue

@@ -939,47 +939,6 @@ const orderDefaultAction = [
         loadingStatus.save = true;
 
         let mattress = LjDetailRef.value._mainData;
-        // console.log("save cushionsMxData :>> ", LjDetailRef.value._mainData, mattress?.if_d_chai, Number(mattress.if_d_chai));
-        // mattress.mattressid = Number(mattress.mattressid ?? 0);
-        // mattress.if_moneyrate = Number(mattress.if_moneyrate ?? 0);
-        // mattress.if_bcp_type = Number(mattress.if_bcp_type ?? 0);
-        // mattress.if_d_chai = Number(mattress.if_d_chai ?? 0);
-        // mattress.if_m_chai = Number(mattress.if_m_chai ?? 0);
-        // mattress.if_m_wbutao_way = Number(mattress.if_m_wbutao_way ?? 0);
-        // mattress.if_moneyrate = Number(mattress.if_moneyrate ?? 0);
-        // mattress.if_moneyrate = Number(mattress.if_moneyrate ?? 0);
-        // mattress.if_n_butao = Number(mattress.if_n_butao ?? 0);
-        // mattress.if_w_butao = Number(mattress.if_w_butao ?? 0);
-        // mattress.if_z_chai = Number(mattress.if_z_chai ?? 0);
-        // mattress.if_zhedie_type = Number(mattress.if_zhedie_type ?? 0);
-        // mattress.packqty = Number(mattress.packqty ?? 0);
-        // mattress.woodpallettype = mattress?.woodpallettype ?? "0";
-        // mattress.total_hr_cost = mattress?.total_hr_cost ?? "0";
-        // mattress.total_material_cost = mattress?.total_material_cost ?? "0";
-        // mattress.total_hr_cost = mattress?.total_hr_cost ?? 0;
-        // mattress.total_material_cost = mattress?.total_material_cost ?? 0;
-        // mattress.total_fees_cost = mattress?.total_fees_cost ?? 0;
-        // mattress.total_cost = mattress?.total_cost ?? 0;
-        // mattress.commissionrate = mattress?.commissionrate ?? 0;
-        // mattress.fob = mattress?.fob ?? 0;
-        // mattress.profitrate = mattress?.profitrate ?? 0;
-        // mattress.nottax_factory_cost = mattress?.nottax_factory_cost ?? 0;
-        // mattress.nottax_dept_cost = mattress?.nottax_dept_cost ?? 0;
-        // mattress.foreign_cost = mattress?.foreign_cost ?? 0;
-        // mattress.diameter = mattress?.diameter ?? 0;
-        // mattress.area = mattress?.area ?? 0;
-        // mattress.cabinet_type = mattress?.cabinet_type ?? 0;
-        // mattress.hrcost = mattress?.hrcost ?? 0;
-        // mattress.biandaicost = mattress?.biandaicost ?? 0;
-        // mattress.flag = mattress?.flag ?? 0;
-        // mattress.dept_profitrate_rangli = mattress?.dept_profitrate_rangli ?? 0;
-        // mattress.profitrate_point = mattress?.profitrate_point ?? 0;
-        // mattress.chaizhuang_point = mattress?.chaizhuang_point ?? 0;
-        // mattress.haimian_point = mattress?.haimian_point ?? 0;
-        // mattress.qr_auditingdate = mattress?.qr_auditingdate ?? 0;
-        // mattress.zhizao_amt = mattress?.zhizao_amt ?? 0;
-        // mattress.foreign_cost_bz = mattress?.foreign_cost_bz ?? 0;
-        // mattress.cubage = mattress?.cubage ?? 0;
 
         let mattressMx = [];
         fabricMxTabList.value.map(t => {
@@ -997,31 +956,6 @@ const orderDefaultAction = [
           }
         });
 
-        mattressMx = mattressMx.map(t => {
-          t.formulaid = t.formulaid ?? 0;
-          t.formula = t.formula ?? "";
-          t.if_success = t.if_success ?? 0;
-          t.replace_formula = t.replace_formula ?? "";
-          t.priceunit = t.priceunit ?? "";
-          t.shrinkage = t.shrinkage ?? 0;
-          t.mtrlid = t.mtrlid ?? 0;
-          t.price = t.price ?? 0;
-          t.gram_weight = t.gram_weight ?? 0;
-          t.cloth_width = t.cloth_width ?? 0;
-          t.if_inputqty = t.if_inputqty ?? 0;
-          t.qty = t.qty ?? 0;
-          t.costamt = t.costamt ?? 0;
-          t.if_areaprice = t.if_areaprice ?? 0;
-          t.thickness = t.thickness ?? 0;
-          t.chastr = t.chastr ?? "";
-          t.useqty = t.useqty ?? 0;
-          t.useformula = t.useformula ?? "";
-          t.replace_useformula = t.replace_useformula ?? "";
-          t.gydscrp = t.gydscrp ?? "";
-          t.xu = t.xu ?? 0;
-          return t;
-        });
-
         let _param_mf = {
           mattress,
           mattressMx

+ 171 - 182
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

@@ -1980,10 +1980,6 @@ export const useHooks = (t?: any) => {
 
     wf_check_dianceng_ifright();
 
-    if (!wf_cmp_bednet()) {
-      return;
-    }
-
     // 佣金
     if (_mainData?.commission == 0 || !_mainData.commission) {
       _mainData.commission = 1;
@@ -2015,184 +2011,177 @@ export const useHooks = (t?: any) => {
       return;
     }
 
-    let _data = {
-      ls_mattress_width: _mainData.mattress_width,
-      ls_mattress_length: _mainData.mattress_length,
-      ls_mattress_height: _mainData.mattress_height,
-      ls_packqty: _mainData.packqty,
-      ls_diameter: _mainData.diameter,
-      ls_woodpallettype: _mainData.woodpallettype,
-      ls_if_m_wbutao_way: _mainData.if_m_wbutao_way ?? "0",
-      ls_if_db_wbutao_way: _mainData.if_db_wbutao_wa ?? "0",
-      ls_s_cover_qty: _mainData.s_cover_qty ?? "0",
-      ls_z_cover_qty: _mainData.z_cover_qty ?? "0",
-      ls_x_cover_qty: _mainData.x_cover_qty ?? "0",
-      ls_s_m_cover_qty: _mainData.s_m_cover_qty ?? "0",
-      ls_z_m_cover_qty: _mainData.z_m_cover_qty ?? "0",
-      ls_x_m_cover_qty: _mainData.x_m_cover_qty ?? "0",
-      ls_if_m_chai: _mainData.if_m_chai ?? "0",
-      ls_if_z_chai: _mainData.if_z_chai ?? "0",
-      ls_if_d_chai: _mainData.if_d_chai ?? "0"
-    };
-
-    state.fabricMxTabList.map(t => {
-      if (t.ref && state[t.ref]) {
-        let { fullData } = state[t.ref].element.getTableData();
-        fullData.map(item => {
-          if ((!item.mtrlid || Number(item.mtrlid) == 0) && Number(item.formulakind) != 31) {
-            let ls_Expression = item.formula;
-            let ls_Use_Expression = item.useformula;
-
-            let _mxData = {
-              ls_price: item.price,
-              ls_gram_weight: item.gram_weight,
-              ls_cloth_width: item.cloth_width,
-              ls_if_inputqty: item.if_inputqty,
-              ls_qty: item.qty,
-              ls_thickness: item.thickness,
-              ls_shrinkage: Number(item.shrinkage) == 0 ? "1" : item.shrinkage,
-              ls_if_areaprice: item.if_areaprice,
-              ls_mtrlname: item.mtrlname ?? "null"
-            };
-
-            ls_Expression = wf_replace_height_big_side(ls_Expression, item.chastr);
-            ls_Use_Expression = wf_replace_height_big_side(ls_Use_Expression, item.chastr);
-
-            ls_Expression = wf_replace_height_small_side(ls_Expression, item.chastr);
-            ls_Use_Expression = wf_replace_height_small_side(ls_Use_Expression, item.chastr);
-
-            ls_Expression = wf_replace_height_v_side(ls_Expression, item.chastr);
-            ls_Use_Expression = wf_replace_height_v_side(ls_Use_Expression, item.chastr);
-
-            // 替换布料幅宽start
-            let ls_bl_cloth_width = "";
-            let _formulakind = Number(item.formulakind);
-            // 大侧
-            if (t.name == "tabpage_10" && t.type.includes(_formulakind)) {
-              ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 2);
-
-              if (Number(ls_bl_cloth_width) > 0) {
-                ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
-                ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
-              }
-            }
-
-            //小侧
-            if (t.name == "tabpage_11" && t.type.includes(_formulakind)) {
-              ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 3);
-
-              if (Number(ls_bl_cloth_width) > 0) {
-                ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
-                ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
-              }
-            }
-
-            //V侧
-            if (t.name == "tabpage_12" && t.type.includes(_formulakind)) {
-              ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 4);
-
-              if (Number(ls_bl_cloth_width) > 0) {
-                ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
-                ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
-              }
-            }
-
-            //面裥绵
-            if (t.name == "tabpage_8" && t.type.includes(_formulakind)) {
-              ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 0);
-
-              if (Number(ls_bl_cloth_width) > 0) {
-                ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
-                ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
-              }
-            }
-
-            //底裥绵
-            if (t.name == "tabpage_9" && t.type.includes(_formulakind)) {
-              ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 1);
-
-              if (Number(ls_bl_cloth_width) > 0) {
-                ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
-                ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
-              }
-            }
-            //替换布料幅宽end
-
-            //替换布套高star
-            let ls_bl_bt_height = "";
-            // 内布套
-            let tabpage_14 = state.otherMxTabList.find(t => t.name == "tabpage_14");
-            if (tabpage_14.type.includes(_formulakind)) {
-              ls_bl_bt_height = "";
-
-              let { fullData: mlData } = state[t.ref].element.getTableData();
-              fullData.find(itm => {
-                if (itm.formulakind == 101) {
-                  ls_bl_bt_height = formatFixedNumber({ val: itm.thickness }, 4);
-                  return t;
-                }
-              });
-
-              if (Number(ls_bl_cloth_width) > 0) {
-                ls_Expression = ls_Expression.replaceAll("【布套高】", ls_bl_bt_height);
-                ls_Use_Expression = ls_Use_Expression.replaceAll("【布套高】", ls_bl_bt_height);
-              }
-            }
-            // 外布套
-            let tabpage_15 = state.otherMxTabList.find(t => t.name == "tabpage_15");
-            if (tabpage_15.type.includes(_formulakind)) {
-              ls_bl_bt_height = "";
-
-              let { fullData: mlData } = state[t.ref].element.getTableData();
-              fullData.find(itm => {
-                if (itm.formulakind == 101) {
-                  ls_bl_bt_height = formatFixedNumber({ val: itm.thickness }, 4);
-                  return t;
-                }
-              });
-
-              if (Number(ls_bl_cloth_width) > 0) {
-                ls_Expression = ls_Expression.replaceAll("【布套高】", ls_bl_bt_height);
-                ls_Use_Expression = ls_Use_Expression.replaceAll("【布套高】", ls_bl_bt_height);
-              }
-            }
-            //替换布套高end
-
-            //计算裥绵收缩率
-            if ([50, 0, 40, 60, 70, 80].includes(_formulakind)) {
-              //...
-            }
-
-            console.log("fullData item :>> ", item, item.formula);
-            console.log("fullData item useformula :>> ", item.useformula);
-            summaryMxData.value = summaryMxData.value.map(itm => {
-              if (itm.field == "costamt") {
-                itm.formula = ls_Expression;
-              } else if (itm.field == "useqty") {
-                itm.formula = ls_Use_Expression;
-              }
-              return itm;
-            });
-
-            let result = formulaPartsFormula(summaryMxData.value, fieldMxParams.value, { ..._data, ..._mxData });
-            console.log(
-              "fabricMxTabList formula result :>> ",
-              summaryMxData.value,
-              fieldMxParams.value,
-              { ..._data, ..._mxData },
-              result
-            );
-          }
-          // let tFormula = res?.datatable.find(itm => itm.formulakind == item.formulakind);
-
-          // state[t.ref].element.setRow(item, {
-          //   formula: tFormula.formula ?? "err",
-          //   useformula: tFormula.useformula ?? "",
-          //   gydscrp: tFormula.gydscrp ?? ""
-          // });
-        });
-      }
-    });
+    // let _data = {
+    //   ls_mattress_width: _mainData.mattress_width,
+    //   ls_mattress_length: _mainData.mattress_length,
+    //   ls_mattress_height: _mainData.mattress_height,
+    //   ls_packqty: _mainData.packqty,
+    //   ls_diameter: _mainData.diameter,
+    //   ls_woodpallettype: _mainData.woodpallettype,
+    //   ls_if_m_wbutao_way: _mainData.if_m_wbutao_way ?? "0",
+    //   ls_if_db_wbutao_way: _mainData.if_db_wbutao_wa ?? "0",
+    //   ls_s_cover_qty: _mainData.s_cover_qty ?? "0",
+    //   ls_z_cover_qty: _mainData.z_cover_qty ?? "0",
+    //   ls_x_cover_qty: _mainData.x_cover_qty ?? "0",
+    //   ls_s_m_cover_qty: _mainData.s_m_cover_qty ?? "0",
+    //   ls_z_m_cover_qty: _mainData.z_m_cover_qty ?? "0",
+    //   ls_x_m_cover_qty: _mainData.x_m_cover_qty ?? "0",
+    //   ls_if_m_chai: _mainData.if_m_chai ?? "0",
+    //   ls_if_z_chai: _mainData.if_z_chai ?? "0",
+    //   ls_if_d_chai: _mainData.if_d_chai ?? "0"
+    // };
+
+    // state.fabricMxTabList.map(t => {
+    //   if (t.ref && state[t.ref]) {
+    //     let { fullData } = state[t.ref].element.getTableData();
+    //     fullData.map(item => {
+    //       if ((!item.mtrlid || Number(item.mtrlid) == 0) && Number(item.formulakind) != 31) {
+    //         let ls_Expression = item.formula;
+    //         let ls_Use_Expression = item.useformula;
+
+    //         let _mxData = {
+    //           ls_price: item.price,
+    //           ls_gram_weight: item.gram_weight,
+    //           ls_cloth_width: item.cloth_width,
+    //           ls_if_inputqty: item.if_inputqty,
+    //           ls_qty: item.qty,
+    //           ls_thickness: item.thickness,
+    //           ls_shrinkage: Number(item.shrinkage) == 0 ? "1" : item.shrinkage,
+    //           ls_if_areaprice: item.if_areaprice,
+    //           ls_mtrlname: item.mtrlname ?? "null"
+    //         };
+
+    //         ls_Expression = wf_replace_height_big_side(ls_Expression, item.chastr);
+    //         ls_Use_Expression = wf_replace_height_big_side(ls_Use_Expression, item.chastr);
+
+    //         ls_Expression = wf_replace_height_small_side(ls_Expression, item.chastr);
+    //         ls_Use_Expression = wf_replace_height_small_side(ls_Use_Expression, item.chastr);
+
+    //         ls_Expression = wf_replace_height_v_side(ls_Expression, item.chastr);
+    //         ls_Use_Expression = wf_replace_height_v_side(ls_Use_Expression, item.chastr);
+
+    //         // 替换布料幅宽start
+    //         let ls_bl_cloth_width = "";
+    //         let _formulakind = Number(item.formulakind);
+    //         // 大侧
+    //         if (t.name == "tabpage_10" && t.type.includes(_formulakind)) {
+    //           ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 2);
+
+    //           if (Number(ls_bl_cloth_width) > 0) {
+    //             ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+    //             ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+    //           }
+    //         }
+
+    //         //小侧
+    //         if (t.name == "tabpage_11" && t.type.includes(_formulakind)) {
+    //           ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 3);
+
+    //           if (Number(ls_bl_cloth_width) > 0) {
+    //             ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+    //             ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+    //           }
+    //         }
+
+    //         //V侧
+    //         if (t.name == "tabpage_12" && t.type.includes(_formulakind)) {
+    //           ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 4);
+
+    //           if (Number(ls_bl_cloth_width) > 0) {
+    //             ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+    //             ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+    //           }
+    //         }
+
+    //         //面裥绵
+    //         if (t.name == "tabpage_8" && t.type.includes(_formulakind)) {
+    //           ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 0);
+
+    //           if (Number(ls_bl_cloth_width) > 0) {
+    //             ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+    //             ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+    //           }
+    //         }
+
+    //         //底裥绵
+    //         if (t.name == "tabpage_9" && t.type.includes(_formulakind)) {
+    //           ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 1);
+
+    //           if (Number(ls_bl_cloth_width) > 0) {
+    //             ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+    //             ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+    //           }
+    //         }
+    //         //替换布料幅宽end
+
+    //         //替换布套高star
+    //         let ls_bl_bt_height = "";
+    //         // 内布套
+    //         let tabpage_14 = state.otherMxTabList.find(t => t.name == "tabpage_14");
+    //         if (tabpage_14.type.includes(_formulakind)) {
+    //           ls_bl_bt_height = "";
+
+    //           let { fullData: mlData } = state[t.ref].element.getTableData();
+    //           fullData.find(itm => {
+    //             if (itm.formulakind == 101) {
+    //               ls_bl_bt_height = formatFixedNumber({ val: itm.thickness }, 4);
+    //               return t;
+    //             }
+    //           });
+
+    //           if (Number(ls_bl_cloth_width) > 0) {
+    //             ls_Expression = ls_Expression.replaceAll("【布套高】", ls_bl_bt_height);
+    //             ls_Use_Expression = ls_Use_Expression.replaceAll("【布套高】", ls_bl_bt_height);
+    //           }
+    //         }
+    //         // 外布套
+    //         let tabpage_15 = state.otherMxTabList.find(t => t.name == "tabpage_15");
+    //         if (tabpage_15.type.includes(_formulakind)) {
+    //           ls_bl_bt_height = "";
+
+    //           let { fullData: mlData } = state[t.ref].element.getTableData();
+    //           fullData.find(itm => {
+    //             if (itm.formulakind == 101) {
+    //               ls_bl_bt_height = formatFixedNumber({ val: itm.thickness }, 4);
+    //               return t;
+    //             }
+    //           });
+
+    //           if (Number(ls_bl_cloth_width) > 0) {
+    //             ls_Expression = ls_Expression.replaceAll("【布套高】", ls_bl_bt_height);
+    //             ls_Use_Expression = ls_Use_Expression.replaceAll("【布套高】", ls_bl_bt_height);
+    //           }
+    //         }
+    //         //替换布套高end
+
+    //         //计算裥绵收缩率
+    //         if ([50, 0, 40, 60, 70, 80].includes(_formulakind)) {
+    //           //...
+    //         }
+
+    //         console.log("fullData item :>> ", item, item.formula);
+    //         console.log("fullData item useformula :>> ", item.useformula);
+    //         summaryMxData.value = summaryMxData.value.map(itm => {
+    //           if (itm.field == "costamt") {
+    //             itm.formula = ls_Expression;
+    //           } else if (itm.field == "useqty") {
+    //             itm.formula = ls_Use_Expression;
+    //           }
+    //           return itm;
+    //         });
+
+    //         let result = formulaPartsFormula(summaryMxData.value, fieldMxParams.value, { ..._data, ..._mxData });
+    //         console.log(
+    //           "fabricMxTabList formula result :>> ",
+    //           summaryMxData.value,
+    //           fieldMxParams.value,
+    //           { ..._data, ..._mxData },
+    //           result
+    //         );
+    //       }
+    //     });
+    //   }
+    // });
   };
 
   /**