Jelajahi Sumber

更新代码,床网、床垫复制报价,重算功能

MY 5 bulan lalu
induk
melakukan
13698dc1d1

+ 26 - 0
JLHHJSvr/Com/CopyMattressAudited.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    public sealed class CopyMattressAuditedRequest : ILJRequest<CopyMattressAuditedResponse>
+    {
+        public string GetApiName()
+        {
+            return "CopyMattressAudited";
+        }
+        public string token { get; set; }
+        /// <summary>
+        /// 床垫信息:主表
+        /// </summary>
+        public List<u_mattress> list { get; set; }
+    }
+
+    public sealed class CopyMattressAuditedResponse : LJResponse
+    {
+    }
+}

+ 1 - 0
JLHHJSvr/Com/Model/u_bednet.cs

@@ -195,6 +195,7 @@ namespace JLHHJSvr.Com.Model
         #region
         public int? pricelistid { get; set; }
         public string typename { get; set; }
+        public int? copy_id { get; set; }
         #endregion
     }
 }

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

@@ -136,6 +136,7 @@ namespace JLHHJSvr.Com.Model
 
         #region 其他
         public int? pricelistid { get; set; }
+        public int? copy_id { get; set; }
         #endregion
     }
 }

+ 25 - 0
JLHHJSvr/Com/Model/u_mattress_interface.cs

@@ -0,0 +1,25 @@
+using LJLib.DAL.SQL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace JLHHJSvr.Com.Model
+{
+    [PK(new[] { "mattressid", "printid" })]
+    public sealed class u_mattress_interface
+    {
+        public int? mattressid { get; set; }
+        public int? printid { get; set; }
+        public string itemname { get; set; }
+        public string bj_pzname { get; set; }
+        public string bj_namemx { get; set; }
+        public int? bj_inputtype { get; set; }
+        public string actual_size { get; set; }
+        public string sb_craft { get; set; }
+        public string actual_size_sb { get; set; }
+        public int? erp_pzid { get; set; }
+        public decimal? ss_rate { get; set; }
+        public decimal? ls_rate { get; set; }
+    }
+}

+ 30 - 0
JLHHJSvr/Com/Model/u_mattress_interface_qd.cs

@@ -0,0 +1,30 @@
+using LJLib.DAL.SQL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace JLHHJSvr.Com.Model
+{
+    [PK(new[] { "mattressid", "printid" })]
+    public sealed class u_mattress_interface_qd
+    {
+        public int? mattressid { get; set; }
+        public int? printid { get; set; }
+        public string itemname { get; set; }
+        public string bj_pzname { get; set; }
+        public string bj_pzname_mx { get; set; }
+        public string bj_pzname_mx_mx { get; set; }
+        public int? mtrlid { get; set; }
+        public int? erp_mtrlid { get; set; }
+        public int? wrkgrpid { get; set; }
+        public decimal? useqty { get; set; }
+        public string dscrp { get; set; }
+        public decimal? actual_useqty { get; set; }
+        public string qd_actual_size { get; set; }
+        public decimal? qd_pfgroupqty { get; set; }
+        public decimal? ss_rate { get; set; }
+        public decimal? ls_rate { get; set; }
+        public decimal? sh_rate { get; set; }
+    }
+}

+ 1 - 0
JLHHJSvr/Com/Model/u_mattress_mx_mtrl.cs

@@ -44,6 +44,7 @@ namespace JLHHJSvr.Com.Model
         public int? formulakind { get; set; }
         public string sortcode { get; set; }
         public string mtrlname { get; set; }
+        public int? copty_mtrlid { get; set; }
         #endregion
     }
 }

+ 26 - 0
JLHHJSvr/Com/ReCalculateBedNetNoAudit.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    public sealed class ReCalculateBedNetNoAuditRequest : ILJRequest<ReCalculateBedNetNoAuditResponse>
+    {
+        public string GetApiName()
+        {
+            return "ReCalculateBedNetNoAudit";
+        }
+        public string token { get; set; }
+        /// <summary>
+        /// 床垫信息:主表
+        /// </summary>
+        public List<u_bednet> list { get; set; }
+    }
+
+    public sealed class ReCalculateBedNetNoAuditResponse : LJResponse
+    {
+    }
+}

+ 26 - 0
JLHHJSvr/Com/ReCalculateNoAudit.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    public sealed class ReCalculateNoAuditRequest : ILJRequest<ReCalculateNoAuditResponse>
+    {
+        public string GetApiName()
+        {
+            return "ReCalculateNoAudit";
+        }
+        public string token { get; set; }
+        /// <summary>
+        /// 床垫信息:主表
+        /// </summary>
+        public List<u_mattress> list { get; set; }
+    }
+
+    public sealed class ReCalculateNoAuditResponse : LJResponse
+    {
+    }
+}

+ 76 - 0
JLHHJSvr/Excutor/CopyMattressAuditedExcutor.cs

@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.Com.Model;
+using JLHHJSvr.Helper;
+using JLHHJSvr.LJException;
+using JLHHJSvr.Tools;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class CopyMattressAuditedExcutor : ExcutorBase<CopyMattressAuditedRequest, CopyMattressAuditedResponse>
+    {
+        protected override void ExcuteInternal(CopyMattressAuditedRequest request, object state, CopyMattressAuditedResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+            if (request.list == null)
+            {
+                rslt.ErrMsg = "提交缺少列表参数,请检查!";
+                return;
+            }
+            if (!request.list.Any())
+            {
+                rslt.ErrMsg = "至少提交一条需要复制的记录";
+                return;
+            }
+
+            using (var con = new SqlConnection(GlobalVar.ConnectionString))
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                var helper = HelperBase.GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
+
+                foreach(var mattress in request.list)
+                {
+                    DbSqlHelper.SelectOne(cmd, mattress, "flag");
+
+                    if (mattress.flag == 0) throw new LJCommonException("存在报价单未财务审核,不能复制");
+
+                    if(mattress.deptid <= 0) throw new LJCommonException("存在报价单没有选择部门,不能复制");
+
+                    if (string.IsNullOrEmpty(mattress.area)) mattress.area = "维持原状";
+                    if (string.IsNullOrEmpty(mattress.cabinet_type)) mattress.cabinet_type = "维持原状";
+
+                    mattress.mattress_width = 0;
+                    mattress.mattress_length = 0;
+                }
+
+                using (cmd.Transaction = con.BeginTransaction())
+                {
+                    try
+                    {
+                        helper.CopyMattress(request.list, 0, 0);
+
+                        cmd.Transaction.Commit();
+                    }catch(Exception e)
+                    {
+                        cmd.Transaction.Rollback();
+                        rslt.ErrMsg = e.Message;
+                    }
+                }
+            }
+        }
+    }
+}

+ 85 - 0
JLHHJSvr/Excutor/ReCalculateBedNetNoAuditExcutor.cs

@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.Com.Model;
+using JLHHJSvr.Helper;
+using JLHHJSvr.LJException;
+using JLHHJSvr.Tools;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class ReCalculateBedNetNoAuditExcutor : ExcutorBase<ReCalculateBedNetNoAuditRequest, ReCalculateBedNetNoAuditResponse>
+    {
+        protected override void ExcuteInternal(ReCalculateBedNetNoAuditRequest request, object state, ReCalculateBedNetNoAuditResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+            if (request.list == null)
+            {
+                rslt.ErrMsg = "提交缺少列表参数,请检查!";
+                return;
+            }
+            if (!request.list.Any())
+            {
+                rslt.ErrMsg = "至少提交一条需要重算的记录";
+                return;
+            }
+
+            using (var con = new SqlConnection(GlobalVar.ConnectionString))
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                var helper = HelperBase.GetHelper<BedNetHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
+
+                foreach (var bednet in request.list)
+                {
+                    DbSqlHelper.SelectOne(cmd, bednet, "flag,deptid");
+
+                    if (bednet.flag == 1) throw new LJCommonException("存在报价单已审核,不能重算!");
+
+                    if (bednet.deptid <= 0) throw new LJCommonException("存在报价单部门id错误,不能重算!");
+
+                    var dept = new u_dept() { deptid = bednet.deptid.Value };
+                    DbSqlHelper.SelectOne(cmd, dept, "pricelistid");
+
+                    if (dept.pricelistid <= 0) throw new LJCommonException("存在报价单部门pricelistid错误,不能重算!");
+
+                }
+
+                using (cmd.Transaction = con.BeginTransaction())
+                {
+                    try
+                    {
+                        foreach (var bednet in request.list)
+                        {
+                            var mxList = helper.GetBedNetMxList(bednet.bednetid.Value);
+                            var springList = helper.GetBedNetSpringList(bednet.bednetid.Value);
+                            helper.GetBedNet(bednet);
+
+                            helper.CalCulateFormula(bednet, mxList,springList);
+
+                            helper.SaveBedNet(bednet, mxList,springList);
+                        }
+                        cmd.Transaction.Commit();
+                    }
+                    catch (Exception e)
+                    {
+                        cmd.Transaction.Rollback();
+                        rslt.ErrMsg = e.Message;
+                    }
+                }
+            }
+        }
+    }
+}

+ 84 - 0
JLHHJSvr/Excutor/ReCalculateNoAuditExcutor.cs

@@ -0,0 +1,84 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.Com.Model;
+using JLHHJSvr.Helper;
+using JLHHJSvr.LJException;
+using JLHHJSvr.Tools;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class ReCalculateNoAuditExcutor : ExcutorBase<ReCalculateNoAuditRequest, ReCalculateNoAuditResponse>
+    {
+        protected override void ExcuteInternal(ReCalculateNoAuditRequest request, object state, ReCalculateNoAuditResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+            if (request.list == null)
+            {
+                rslt.ErrMsg = "提交缺少列表参数,请检查!";
+                return;
+            }
+            if (!request.list.Any())
+            {
+                rslt.ErrMsg = "至少提交一条需要重算的记录";
+                return;
+            }
+
+            using (var con = new SqlConnection(GlobalVar.ConnectionString))
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                var helper = HelperBase.GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
+
+                foreach (var mattress in request.list)
+                {
+                    DbSqlHelper.SelectOne(cmd, mattress, "flag,deptid");
+
+                    if (mattress.flag == 1) throw new LJCommonException("存在报价单已审核,不能重算!");
+
+                    if (mattress.deptid <= 0) throw new LJCommonException("存在报价单部门id错误,不能重算!");
+
+                    var dept = new u_dept() { deptid = mattress.deptid.Value };
+                    DbSqlHelper.SelectOne(cmd, dept, "pricelistid");
+
+                    if (dept.pricelistid <= 0) throw new LJCommonException("存在报价单部门pricelistid错误,不能重算!");
+
+                }
+
+                using (cmd.Transaction = con.BeginTransaction())
+                {
+                    try
+                    {
+                        foreach(var mattress in request.list)
+                        {
+                            var mattress_temp = helper.GetMattress(mattress.mattressid);
+                            var mxList = helper.GetMattressMxMtrl(mattress.mattressid);
+
+                            helper.CalCulateFormula(mattress_temp, mxList);
+
+                            helper.SaveMattress(mattress_temp, mxList);
+                        }
+                        cmd.Transaction.Commit();
+                    }
+                    catch (Exception e)
+                    {
+                        cmd.Transaction.Rollback();
+                        rslt.ErrMsg = e.Message;
+                    }
+                }
+            }
+        }
+    }
+}

+ 19 - 1
JLHHJSvr/Excutor/SaveBedNetExcutor.cs

@@ -66,7 +66,25 @@ namespace JLHHJSvr.Excutor
                 // 初始化属性
                 AutoInit.AutoInitS(cmd, request.bednet);
 
-                foreach(var mx in request.bednetMx)
+                if (request.bednet.copy_id != null && request.bednet.copy_id > 0)
+                {
+                    request.bednet.bednetid = 0;
+                    request.bednet.bednetcode = string.Empty;
+
+                    foreach (var mx in request.bednetMx)
+                    {
+                        mx.bednetid = 0;
+                        mx.bednetmxid = 0;
+                    }
+
+                    foreach (var mx in request.spring)
+                    {
+                        mx.bednetmxid = 0;
+                        mx.bednetmx_partid = 0;
+                    }
+                }
+
+                foreach (var mx in request.bednetMx)
                 {
                     AutoInit.AutoInitS(cmd, mx);
                 }

+ 18 - 2
JLHHJSvr/Excutor/SaveMattressExcutor.cs

@@ -38,6 +38,18 @@ namespace JLHHJSvr.Excutor
                 // 初始化属性
                 AutoInit.AutoInitS(cmd, request.mattress);
 
+                if(request.mattress.copy_id != null && request.mattress.copy_id > 0)
+                {
+                    request.mattress.mattressid = 0;
+                    request.mattress.mattresscode = string.Empty;
+
+                    foreach (var mx in request.mattressMx)
+                    {
+                        mx.mattressid = 0;
+                        mx.mattressmxid = 0;
+                    }
+                }
+
                 foreach(var mx in request.mattressMx)
                 {
                     AutoInit.AutoInitS(cmd, mx);
@@ -58,8 +70,12 @@ namespace JLHHJSvr.Excutor
 
                     try
                     {
-
                         helper.SaveMattress(request.mattress, request.mattressMx);
+
+                        if(request.mattress.copy_id != null && request.mattress.copy_id > 0)
+                        {
+                            helper.CopyMattressInterface(request.mattress.copy_id.Value, request.mattress.mattressid);
+                        }
                         
                         cmd.Transaction.Commit();
 
@@ -68,7 +84,7 @@ namespace JLHHJSvr.Excutor
                     catch (Exception e)
                     {
                         cmd.Transaction.Rollback();
-                        rslt.ErrMsg = e.ToString();
+                        rslt.ErrMsg = e.Message;
                     }
                 }
             }

+ 3 - 0
JLHHJSvr/GlobalVar/GlobalVar.cs

@@ -166,6 +166,9 @@ namespace JLHHJSvr
 
                 //excutorManager.AddMap("GetComputeMattress", typeof(GetComputeMattressRequest), new GetComputeMattressExcutor());// 计算床垫报价
                 excutorManager.AddMap("GetComputeBednet", typeof(GetComputeBednetRequest), new GetComputeBednetExcutor());// 计算床网报价
+                excutorManager.AddMap("CopyMattressAudited", typeof(CopyMattressAuditedRequest), new CopyMattressAuditedExcutor());// 复制审核床垫报价
+                excutorManager.AddMap("ReCalculateNoAudit", typeof(ReCalculateNoAuditRequest), new ReCalculateNoAuditExcutor());// 重算床垫报价
+                excutorManager.AddMap("ReCalculateBedNetNoAudit", typeof(ReCalculateBedNetNoAuditRequest), new ReCalculateBedNetNoAuditExcutor());// 重算床网报价
             }
             catch (Exception ex)
             {

+ 59 - 64
JLHHJSvr/Helper/BedNetHelper.cs

@@ -60,10 +60,10 @@ namespace JLHHJSvr.Helper
                             decimal hard_around_row = mx.hard_around_row.Value;
                             if (bednet.typename.IndexOf("袋装", StringComparison.Ordinal) >= 0) hard_around_row *= 2;
 
-                            mx.spring_mtrl_cost_replace_formula = ReplaceWith(mx.spring_mtrl_cost_replace_formula, "【弹簧排列个数-宽】", $"(【弹簧排列个数-宽】 - {hard_around_row})");
-                            mx.spring_mtrl_cost_replace_formula = ReplaceWith(mx.spring_mtrl_cost_replace_formula, "【弹簧计算个数(宽)】", $"(【弹簧计算个数(宽)】 - {hard_around_row})");
-                            mx.spring_mtrl_cost_replace_formula = ReplaceWith(mx.spring_mtrl_cost_replace_formula, "【弹簧排列个数-长】", $"(【弹簧排列个数-长】 - {hard_around_row})");
-                            mx.spring_mtrl_cost_replace_formula = ReplaceWith(mx.spring_mtrl_cost_replace_formula, "【弹簧计算个数(长)】", $"(【弹簧计算个数(长)】 - {hard_around_row})");
+                            mx.spring_mtrl_cost_replace_formula = mx.spring_mtrl_cost_replace_formula.Replace("【弹簧排列个数-宽】", $"(【弹簧排列个数-宽】 - {hard_around_row})");
+                            mx.spring_mtrl_cost_replace_formula = mx.spring_mtrl_cost_replace_formula.Replace("【弹簧计算个数(宽)】", $"(【弹簧计算个数(宽)】 - {hard_around_row})");
+                            mx.spring_mtrl_cost_replace_formula = mx.spring_mtrl_cost_replace_formula.Replace("【弹簧排列个数-长】", $"(【弹簧排列个数-长】 - {hard_around_row})");
+                            mx.spring_mtrl_cost_replace_formula = mx.spring_mtrl_cost_replace_formula.Replace("【弹簧计算个数(长)】", $"(【弹簧计算个数(长)】 - {hard_around_row})");
                         }
 
                         if (mx.if_pocket_around == 1)
@@ -71,10 +71,10 @@ namespace JLHHJSvr.Helper
                             decimal pocket_around_row = mx.pocket_around_row.Value;
                             if (bednet.typename.IndexOf("袋装", StringComparison.Ordinal) >= 0) pocket_around_row *= 2;
 
-                            mx.spring_mtrl_cost_replace_formula = ReplaceWith(mx.spring_mtrl_cost_replace_formula, "【弹簧排列个数-宽】", $"(【弹簧排列个数-宽】 - {pocket_around_row})");
-                            mx.spring_mtrl_cost_replace_formula = ReplaceWith(mx.spring_mtrl_cost_replace_formula, "【弹簧计算个数(宽)】", $"(【弹簧计算个数(宽)】 - {pocket_around_row})");
-                            mx.spring_mtrl_cost_replace_formula = ReplaceWith(mx.spring_mtrl_cost_replace_formula, "【弹簧排列个数-长】", $"(【弹簧排列个数-长】 - {pocket_around_row})");
-                            mx.spring_mtrl_cost_replace_formula = ReplaceWith(mx.spring_mtrl_cost_replace_formula, "【弹簧计算个数(长)】", $"(【弹簧计算个数(长)】 - {pocket_around_row})");
+                            mx.spring_mtrl_cost_replace_formula = mx.spring_mtrl_cost_replace_formula.Replace("【弹簧排列个数-宽】", $"(【弹簧排列个数-宽】 - {pocket_around_row})");
+                            mx.spring_mtrl_cost_replace_formula = mx.spring_mtrl_cost_replace_formula.Replace("【弹簧计算个数(宽)】", $"(【弹簧计算个数(宽)】 - {pocket_around_row})");
+                            mx.spring_mtrl_cost_replace_formula = mx.spring_mtrl_cost_replace_formula.Replace("【弹簧排列个数-长】", $"(【弹簧排列个数-长】 - {pocket_around_row})");
+                            mx.spring_mtrl_cost_replace_formula = mx.spring_mtrl_cost_replace_formula.Replace("【弹簧计算个数(长)】", $"(【弹簧计算个数(长)】 - {pocket_around_row})");
                         }
 
                         mx.spring_mtrl_cost = Calculate(mx.spring_mtrl_cost_replace_formula, "弹簧材料总成本").DecimalValue;
@@ -374,7 +374,7 @@ namespace JLHHJSvr.Helper
                 {
                     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, "@@", "");
+                    bednet.packet_mtrl_cost_replace_formula = bednet.packet_mtrl_cost_replace_formula.Replace("@@", "");
 
                     if(sqlCal) bednet.packet_mtrl_cost += Convert.ToDecimal(SqlCalculate(bednet.packet_mtrl_cost_replace_formula, "包装总成本"));
                     else bednet.packet_mtrl_cost += Calculate(bednet.packet_mtrl_cost_replace_formula, "包装总成本").DecimalValue;
@@ -386,7 +386,7 @@ namespace JLHHJSvr.Helper
                 {
                     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, "@@", "");
+                    bednet.packet_hr_cost_replace_formula = bednet.packet_hr_cost_replace_formula.Replace("@@", "");
 
                     if (sqlCal) bednet.packet_hr_cost += Convert.ToDecimal(SqlCalculate(bednet.packet_hr_cost_replace_formula, "包装人工成本"));
                     else bednet.packet_hr_cost += Calculate(bednet.packet_hr_cost_replace_formula, "包装人工成本").DecimalValue;
@@ -1180,17 +1180,13 @@ namespace JLHHJSvr.Helper
                 formula_replacements[key] = value;
             }
         }
-        private string ReplaceWith(string input, string oldValue, string newValue)
-        {
-            return input.Replace(oldValue, newValue);
-        }
         private TData CalculateVarFormula(string varname)
         {
             varname = $"【{varname}】";
             if (!formula_replacements.ContainsKey(varname)) return null;
-            return Calculate(varname);
+            return Calculate(formula_replacements[varname], varname);
         }
-        private TData Calculate(string expression,string name = "")
+        private void FormatExpression(ref string expression)
         {
             ConvertToEnglishSymbols(expression);
 
@@ -1200,11 +1196,6 @@ namespace JLHHJSvr.Helper
             // 创建正则表达式对象
             Regex regex = new Regex(pattern);
 
-            foreach (var replacement in formula_replacements)
-            {
-                expression = expression.Replace(replacement.Key, replacement.Value);
-            }
-
             // 使用正则表达式匹配输入字符串
             MatchCollection matches = regex.Matches(expression);
 
@@ -1222,6 +1213,10 @@ namespace JLHHJSvr.Helper
             {
                 expression = expression.Replace(replacement.Key, Convert.ToString(replacement.Value));
             }
+        }
+        private TData Calculate(string expression,string name = "")
+        {
+            FormatExpression(ref expression);
 
             try
             {
@@ -1234,45 +1229,7 @@ namespace JLHHJSvr.Helper
 
         private object SqlCalculate(string expression, string name = "")
         {
-            ConvertToEnglishSymbols(expression);
-
-            expression = ReplaceWith(expression, "@@", "");
-
-            // 定义正则表达式模式,匹配包含【】的内容
-            string pattern = @"【(.*?)】";
-
-            // 创建正则表达式对象
-            Regex regex = new Regex(pattern);
-
-            // 使用正则表达式匹配输入字符串
-            MatchCollection matches = regex.Matches(expression);
-
-            var new_formula_replacements = new Dictionary<string, string>();
-            var new_replacements = new Dictionary<string, object>();
-
-            foreach (Match match in matches)
-            {
-                // 检查原始字典中是否存在该键,并添加到新字典中
-                if (formula_replacements.TryGetValue(match.Value, out string value))
-                {
-                    new_formula_replacements[match.Value] = value;
-                }
-
-                if (replacements.TryGetValue(match.Value, out object value2))
-                {
-                    new_replacements[match.Value] = value2;
-                }
-            }
-
-            foreach (var replacement in new_formula_replacements)
-            {
-                expression = expression.Replace(replacement.Key, replacement.Value);
-            }
-
-            foreach (var replacement in new_replacements)
-            {
-                expression = expression.Replace(replacement.Key, Convert.ToString(replacement.Value));
-            }
+            FormatExpression(ref expression);
 
             try
             {
@@ -1494,11 +1451,14 @@ namespace JLHHJSvr.Helper
                 bednet.createtime = dtNow;
                 bednet.createby = context.tokendata.username;
 
-                var nettype = new u_bednet_type() { bednettypeid = bednet.bednettypeid };
-                DbSqlHelper.SelectOne(cmd, nettype, "typecode");
+                if(string.IsNullOrEmpty(bednet.bednetcode))
+                {
+                    var nettype = new u_bednet_type() { bednettypeid = bednet.bednettypeid };
+                    DbSqlHelper.SelectOne(cmd, nettype, "typecode");
 
-                // 编号-年月日+流水
-                bednet.bednetcode = $"{nettype.typecode}-{dtNow.ToString("yyyyMMdd")}{(bednet.bednetid.Value % 10000).ToString("D4")}";
+                    // 编号-年月日+流水
+                    bednet.bednetcode = $"{nettype.typecode}-{dtNow.ToString("yyyyMMdd")}{(bednet.bednetid.Value % 10000).ToString("D4")}";
+                }
 
                 DbSqlHelper.Insert(cmd, "u_bednet", null, bednet, fields);
             }
@@ -1553,5 +1513,40 @@ namespace JLHHJSvr.Helper
             var fieldsHs = "bednetid_mattressid, typeid, cmpdate, cmpemp, nottax_dept_cost, dept_cost, foreign_cost";
             DbSqlHelper.Insert(cmd, "u_his_price", null, hisprice, fieldsHs);
         }
+
+        public void CopyBedNet(u_bednet bednet,u_bednetmx bednetmx,out int newId)
+        {
+            var bedNet_copy = new u_bednet() { bednetid = bednet.bednetid};
+
+            GetBedNet(bedNet_copy);
+
+            var bedNetMxList = GetBedNetMxList(bednet.bednetid.Value);
+            var springList = GetBedNetSpringList(bednet.bednetid.Value);
+
+            // 判断copy_bedNet.bednetcode是否存在@@字符串,如果存在,则删除@@后面的字符串,包括@@
+            if (bedNet_copy.bednetcode.IndexOf("@@") > -1)
+            {
+                bedNet_copy.bednetcode = bedNet_copy.bednetcode.Substring(bedNet_copy.bednetcode.IndexOf("@@"));
+            }
+
+            bedNet_copy.bednetcode += " @@";
+            bedNet_copy.bednetcode += DateTime.Now.ToString("yyyMMdd_mmhhss");
+            bedNet_copy.bednetid = 0;
+            bedNet_copy.mattress_width = bednet.mattress_width;
+            bedNet_copy.mattress_length = bednet.mattress_length;
+
+            foreach(var mx in bedNetMxList)
+            {
+                if(bednetmx.spring_qty_width > 0 && bednetmx.spring_qty_length > 0)
+                {
+                    mx.spring_qty_length = bednetmx.spring_qty_length;
+                    mx.spring_qty_width = bednetmx.spring_qty_width;
+                }
+            }
+
+            SaveBedNet(bedNet_copy, bedNetMxList, springList);
+
+            newId = bedNet_copy.bednetid.Value;
+        }
     }
 }

+ 100 - 0
JLHHJSvr/Helper/CalculateHepler.cs

@@ -0,0 +1,100 @@
+using CSUST.Data.Expr;
+using JLHHJSvr.BLL;
+using JLHHJSvr.LJException;
+using JLHHJSvr.LJFramework.Tools;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace JLHHJSvr.Helper
+{
+    internal class CalculateHepler : HelperBase
+    {
+        public static string ConvertToEnglishSymbols(string input)
+        {
+            input = input.Replace("(", "(")
+                 .Replace(")", ")")
+                 .Replace(",", ",")
+                 .Replace("。", ".")
+                 .Replace(":", ":")
+                 .Replace(";", ";")
+                 .Replace("“", "\"")
+                 .Replace("”", "\"")
+                 .Replace("‘", "'")
+                 .Replace("’", "'");
+
+            return input;
+        }
+        private TData CalculateVarFormula(string varname)
+        {
+            varname = $"【{varname}】";
+            if (!formula_replacements.ContainsKey(varname)) return null;
+            return Calculate(varname);
+        }
+        private void FormatExpression(ref string expression)
+        {
+            ConvertToEnglishSymbols(expression);
+
+            // 定义正则表达式模式,匹配包含【】的内容
+            string pattern = @"【(.*?)】";
+
+            // 创建正则表达式对象
+            Regex regex = new Regex(pattern);
+
+            foreach (var replacement in formula_replacements)
+            {
+                expression = expression.Replace(replacement.Key, replacement.Value);
+            }
+
+            // 使用正则表达式匹配输入字符串
+            MatchCollection matches = regex.Matches(expression);
+
+            var new_replacements = new Dictionary<string, object>();
+
+            foreach (Match match in matches)
+            {
+                if (replacements.TryGetValue(match.Value, out object value2))
+                {
+                    new_replacements[match.Value] = value2;
+                }
+            }
+
+            foreach (var replacement in new_replacements)
+            {
+                expression = expression.Replace(replacement.Key, Convert.ToString(replacement.Value));
+            }
+        }
+        private TData Calculate(string expression, string name = "")
+        {
+            FormatExpression(ref expression);
+
+            try
+            {
+                return LJExprParser.Parse(expression).Result;
+            }
+            catch (Exception ex)
+            {
+                throw new LJCommonException($"计算{name}公式错误!expression: {expression},exception: {ex.Message}");
+            }
+        }
+
+        private object SqlCalculate(string expression, string name = "")
+        {
+            FormatExpression(ref expression);
+
+            try
+            {
+                cmd.CommandText = $@"{expression}";
+                cmd.Parameters.Clear();
+                return cmd.ExecuteScalar();
+            }
+            catch (Exception ex)
+            {
+                throw new LJCommonException($"计算{name}公式错误!expression: {expression},exception: {ex.Message}");
+            }
+        }
+    }
+}

File diff ditekan karena terlalu besar
+ 321 - 146
JLHHJSvr/Helper/MattressHelper.cs


+ 10 - 2
JLHHJSvr/JLHHJSvr.csproj

@@ -75,6 +75,7 @@
     <Compile Include="Com\BanMtrlDef.cs" />
     <Compile Include="Com\BanMultiPrice.cs" />
     <Compile Include="Com\CommonDynamicSelect.cs" />
+    <Compile Include="Com\CopyMattressAudited.cs" />
     <Compile Include="Com\DelCarList.cs" />
     <Compile Include="Com\DeleteBedNet.cs" />
     <Compile Include="Com\DeleteBedNetArea.cs" />
@@ -99,6 +100,7 @@
     <Compile Include="Com\GetBedNetVarList.cs" />
     <Compile Include="Com\GetBillList.cs" />
     <Compile Include="Com\GetCarList.cs" />
+    <Compile Include="Com\GetComputeBednet.cs" />
     <Compile Include="Com\GetDept.cs" />
     <Compile Include="Com\GetDwLayout.cs" />
     <Compile Include="Com\GetFileByMd5.cs" />
@@ -122,6 +124,8 @@
     <Compile Include="Com\Model\u_dept.cs" />
     <Compile Include="Com\Model\u_factory_profitrate.cs" />
     <Compile Include="Com\Model\u_his_price.cs" />
+    <Compile Include="Com\Model\u_mattress_interface_qd.cs" />
+    <Compile Include="Com\Model\u_mattress_interface.cs" />
     <Compile Include="Com\Model\u_mattress_mx_mtrl.cs" />
     <Compile Include="Com\Model\u_mtrl_price.cs" />
     <Compile Include="Com\Model\u_mattress.cs" />
@@ -137,7 +141,8 @@
     <Compile Include="Com\Model\u_shrinkage.cs" />
     <Compile Include="Com\Model\u_spring.cs" />
     <Compile Include="Com\Model\u_workmanship_add.cs" />
-    <Compile Include="Com\GetComputeBednet.cs" />
+    <Compile Include="Com\ReCalculateBedNetNoAudit.cs" />
+    <Compile Include="Com\ReCalculateNoAudit.cs" />
     <Compile Include="Com\SaveBedNet.cs" />
     <Compile Include="Com\SaveBedNetArea.cs" />
     <Compile Include="Com\SaveBedNetType.cs" />
@@ -219,6 +224,7 @@
     <Compile Include="Excutor\BanMtrlDefExcutor.cs" />
     <Compile Include="Excutor\BanMultiPriceExcutor.cs" />
     <Compile Include="Excutor\CommonDynamicSelectExcutor.cs" />
+    <Compile Include="Excutor\CopyMattressAuditedExcutor.cs" />
     <Compile Include="Excutor\DelCarListExcutor.cs" />
     <Compile Include="Excutor\DeleteBedNetAreaExcutor.cs" />
     <Compile Include="Excutor\DeleteBedNetExcutor.cs" />
@@ -243,6 +249,7 @@
     <Compile Include="Excutor\GetBedNetVarListExcutor.cs" />
     <Compile Include="Excutor\GetBillListExcutor.cs" />
     <Compile Include="Excutor\GetCarListExcutor.cs" />
+    <Compile Include="Excutor\GetComputeBednetExcutor.cs" />
     <Compile Include="Excutor\GetDeptExcutor.cs" />
     <Compile Include="Excutor\GetDwLayoutExcutor.cs" />
     <Compile Include="Excutor\GetFileByMd5Excutor.cs" />
@@ -259,8 +266,9 @@
     <Compile Include="Excutor\LoginExcutor.cs" />
     <Compile Include="Excutor\ModPasswordExcutor.cs" />
     <Compile Include="Excutor\PostFileExcutor.cs" />
+    <Compile Include="Excutor\ReCalculateBedNetNoAuditExcutor.cs" />
+    <Compile Include="Excutor\ReCalculateNoAuditExcutor.cs" />
     <Compile Include="Excutor\SaveBedNetAreaExcutor.cs" />
-    <Compile Include="Excutor\GetComputeBednetExcutor.cs" />
     <Compile Include="Excutor\SaveBedNetExcutor.cs" />
     <Compile Include="Excutor\SaveBedNetTypeExcutor.cs" />
     <Compile Include="Excutor\SaveBedNetVarExcutor.cs" />

+ 21 - 0
JLHWEB/src/api/modules/quote.ts

@@ -23,6 +23,20 @@ export const DelMattress = (params: Mattress.ReqMultiMattress) => {
   return http.post(PORT1 + `/DelMattress`, params);
 };
 
+/**
+ * @name 床垫报价:已审批复制
+ */
+export const CopyMattressAudited = (params: Mattress.ReqMultiMattressBcp) => {
+  return http.post(PORT1 + `/CopyMattressAudited`, params);
+};
+
+/**
+ * @name 床垫报价:未审批重算
+ */
+export const ReCalculateNoAudit = (params: Mattress.ReqMultiMattressBcp) => {
+  return http.post(PORT1 + `/ReCalculateNoAudit`, params);
+};
+
 /**
  * @name 半成品报价保存
  */
@@ -78,3 +92,10 @@ export const GetComputeMattress = (params: Mattress.ReqSaveMattress) => {
 export const GetComputeBednet = (params: Mattress.ReqSaveBedNet) => {
   return http.post<Mattress.ResSaveBedNet>(PORT1 + `/GetComputeBednet`, params);
 };
+
+/**
+ * @name 床网报价:未审批重算
+ */
+export const ReCalculateBedNetNoAudit = (params: Mattress.ReqMultiMattressBcp) => {
+  return http.post(PORT1 + `/ReCalculateBedNetNoAudit`, params);
+};

+ 10 - 0
JLHWEB/src/components/LjDetail/index.vue

@@ -1136,6 +1136,16 @@ onMounted(async () => {
     });
     // 反向更新订单状态
     emit("update:orderStatus", orderStatus.value);
+  } else if (route.path.indexOf("copy") > -1) {
+    checkPowerFunc("copy", props.editPower, () => {
+      ElNotification({
+        title: t("sys.api.operationFailed"),
+        message: t("sys.errorLog.notPower") + ":" + props.editPower,
+        type: "warning"
+      });
+    });
+    // 反向更新订单状态
+    emit("update:orderStatus", orderStatus.value);
   }
   console.log("反向更新订单状态 orderStatus.value :>> ", orderStatus.value, props.orderStatus);
 

+ 1 - 1
JLHWEB/src/config/index.ts

@@ -18,7 +18,7 @@ export const TABLE_TYPE_FILTER = ["checkbox", "radio", "seq", "expand"];
 /**
  * @description 单据允许修改的状态
  */
-export const ALLOW_EDIT_STATE = ["new", "edit"];
+export const ALLOW_EDIT_STATE = ["new", "edit", "copy"];
 
 // 数组
 export const sys_arry_formulatype = [0, 1, 2, 3, 99, 104];

+ 16 - 0
JLHWEB/src/routers/modules/bednetQtuoteRouter.ts

@@ -97,6 +97,22 @@ export const bednetQtuoteRouter: Menu.MenuOptions[] = [
           funid: 62,
           activeMenu: "/bednetQuote"
         }
+      },
+      {
+        path: "/bednetQuote/copy",
+        name: "bednetQuoteEdit",
+        component: "/quote/bednetQuote/detail",
+        meta: {
+          icon: "iconuser-01",
+          title: "复制床网报价",
+          isLink: "",
+          isHide: true,
+          isFull: false,
+          isAffix: false,
+          isKeepAlive: true,
+          funid: 75,
+          activeMenu: "/bednetQuote"
+        }
       }
     ]
     //     }

+ 16 - 0
JLHWEB/src/routers/modules/mattressQtuoteRouter.ts

@@ -97,6 +97,22 @@ export const mattressQtuoteRouter: Menu.MenuOptions[] = [
           funid: 72,
           activeMenu: "/mattressQuote"
         }
+      },
+      {
+        path: "/mattressQuote/copy",
+        name: "mattressQuoteEdit",
+        component: "/quote/mattressQuote/detail",
+        meta: {
+          icon: "iconuser-01",
+          title: "复制床垫报价",
+          isLink: "",
+          isHide: true,
+          isFull: false,
+          isAffix: false,
+          isKeepAlive: true,
+          funid: 75,
+          activeMenu: "/mattressQuote"
+        }
       }
     ]
     //     }

+ 47 - 3
JLHWEB/src/views/quote/bednetQuote/index.vue

@@ -81,7 +81,7 @@
 <script setup lang="ts" name="bednetQuote">
 import { ref, onMounted, inject } from "vue";
 import { useRouter } from "vue-router";
-import { AuditBedNet, DeleteBedNet } from "@/api/modules/quote";
+import { AuditBedNet, DeleteBedNet, ReCalculateBedNetNoAudit } from "@/api/modules/quote";
 import { CommonDynamicSelect } from "@/api/modules/common";
 import { ColumnProps } from "@/components/LjVxeTable/interface";
 import LjDrawer from "@/components/LjDrawer/index.vue";
@@ -364,8 +364,22 @@ const action: detailAction[] = [
   ],
   buttonDefault({
     label: t("common.copyQuote"),
+    power: 75,
     clickFunc: item => {
-      router.push(`/bednetQuote/new?id=0`);
+      const { $table, curRecords } = getCurrentRecords(vxeTableRef.value);
+
+      if (!curRecords.length) {
+        ElMessage.warning(t("business.tips.mattress.records"));
+        return;
+      }
+
+      const _cur = $table.getCurrentRecord() ?? null;
+      if (_cur) {
+        router.push(`/bednetQuote/copy?id=${_cur.bednetid}&code=${_cur.bednetcode}`);
+      } else {
+        const _cur = curRecords[curRecords.length - 1];
+        router.push(`/bednetQuote/copy?id=${_cur.bednetid}&code=${_cur.bednetcode}`);
+      }
     }
   }),
   // [
@@ -411,7 +425,37 @@ const action: detailAction[] = [
     label: t("common.recalculateFromNotFlag"),
     power: 61,
     clickFunc: item => {
-      router.push(`/bednetQuote/new?id=0`);
+      const { curRecords } = getCurrentRecords(vxeTableRef.value);
+
+      console.log("curRecords :>> ", curRecords);
+      if (!curRecords.length) {
+        ElMessage.warning(t("business.tips.mattress.records"));
+        return;
+      }
+
+      let list = curRecords.map((item: any) => {
+        return { mattressid: Number(item.mattressid) };
+      });
+
+      ElMessageBox.confirm(`是否确定要批重算${curRecords.length}张床垫报价单吗?`, "询问", {
+        confirmButtonText: t("common.okText"),
+        cancelButtonText: "否",
+        type: "warning"
+      })
+        .then(() => {
+          ReCalculateBedNetNoAudit({ list }).then(() => {
+            ElMessage.success("批重算成功!");
+
+            vxeTableRef.value.refresh();
+          });
+        })
+        .catch((e: TypeError) => {
+          console.log("e :>> ", e);
+          ElMessage({
+            type: "info",
+            message: "操作取消"
+          });
+        });
     }
   }),
   buttonDefault({

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

@@ -975,6 +975,10 @@ const orderDefaultAction = [
           }
         });
 
+        if (orderStatus.value == "copy") {
+          mattress.copy_id = mattress.mattressid;
+        }
+
         let _param_mf = {
           mattress,
           mattressMx

+ 156 - 6
JLHWEB/src/views/quote/mattressQuote/index.vue

@@ -20,12 +20,41 @@
       </template>
     </LjVxeTable>
   </div>
+  <el-dialog v-model="dialogFormVisible" title="部门选择" width="500" draggable append-to-body>
+    <el-form :model="formParam" label-width="80px">
+      <el-form-item label="部门">
+        <el-select v-model="formParam.deptid" placeholder="请选择部门">
+          <el-option v-for="(col, index) in deptEnum" :key="index" :label="col.label" :value="col.value"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="地区">
+        <el-select v-model="formParam.area">
+          <el-option label="维持原状" value="维持原状" />
+          <el-option label="普通地区" value="普通地区" />
+          <el-option label="特定地区" value="特定地区" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="柜型">
+        <el-select v-model="formParam.cabinet_type">
+          <el-option label="维持原状" value="维持原状" />
+          <el-option label="大柜" value="大柜" />
+          <el-option label="小柜" value="小柜" />
+        </el-select>
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button @click="dialogFormVisible = false">取消</el-button>
+        <el-button type="primary" @click="BatchCopyMattressAudited">确认</el-button>
+      </div>
+    </template>
+  </el-dialog>
 </template>
 
 <script setup lang="ts" name="mattressQuote">
 import { ref, onMounted, inject } from "vue";
 import { useRouter } from "vue-router";
-import { SaveMattressAuditing, DelMattress } from "@/api/modules/quote";
+import { SaveMattressAuditing, DelMattress, CopyMattressAudited, ReCalculateNoAudit } from "@/api/modules/quote";
 import { CommonDynamicSelect } from "@/api/modules/common";
 import { ColumnProps } from "@/components/LjVxeTable/interface";
 import LjDrawer from "@/components/LjDrawer/index.vue";
@@ -58,6 +87,14 @@ const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 const initParams = ref({});
 const dialogVisible = ref(false);
 const vxeTableRef = ref();
+const dialogFormVisible = ref(false);
+const deptEnum = ref([]);
+
+const formParam = ref({
+  deptid: 0,
+  area: "维持原状",
+  cabinet_type: "维持原状"
+});
 
 const getData = (params: any) => {
   console.log("getData mattress params :>> ", params);
@@ -273,7 +310,20 @@ const action: detailAction[] = [
     label: t("common.copyQuote"),
     power: 75,
     clickFunc: item => {
-      router.push(`/mattressQuote/new?id=0`);
+      const { $table, curRecords } = getCurrentRecords(vxeTableRef.value);
+
+      if (!curRecords.length) {
+        ElMessage.warning(t("business.tips.mattress.records"));
+        return;
+      }
+
+      const _cur = $table.getCurrentRecord() ?? null;
+      if (_cur) {
+        router.push(`/mattressQuote/copy?id=${_cur.mattressid}&code=${_cur.mattresscode}`);
+      } else {
+        const _cur = curRecords[curRecords.length - 1];
+        router.push(`/mattressQuote/copy?id=${_cur.mattressid}&code=${_cur.mattresscode}`);
+      }
     }
   }),
   [
@@ -310,16 +360,54 @@ const action: detailAction[] = [
   ],
   buttonDefault({
     label: t("common.copyFromMulitFlag"),
-    power: 72,
-    clickFunc: item => {
-      router.push(`/mattressQuote/new?id=0`);
+    power: 75,
+    clickFunc: async item => {
+      const { curRecords } = getCurrentRecords(vxeTableRef.value);
+
+      console.log("curRecords :>> ", curRecords);
+      if (!curRecords.length) {
+        ElMessage.warning(t("business.tips.mattress.records"));
+        return;
+      }
+
+      await openDeptChoosen(curRecords);
     }
   }),
   buttonDefault({
     label: t("common.recalculateFromNotFlag"),
     power: 72,
     clickFunc: item => {
-      router.push(`/mattressQuote/new?id=0`);
+      const { curRecords } = getCurrentRecords(vxeTableRef.value);
+
+      console.log("curRecords :>> ", curRecords);
+      if (!curRecords.length) {
+        ElMessage.warning(t("business.tips.mattress.records"));
+        return;
+      }
+
+      let list = curRecords.map((item: any) => {
+        return { mattressid: Number(item.mattressid) };
+      });
+
+      ElMessageBox.confirm(`是否确定要批重算${curRecords.length}张床垫报价单吗?`, "询问", {
+        confirmButtonText: t("common.okText"),
+        cancelButtonText: "否",
+        type: "warning"
+      })
+        .then(() => {
+          ReCalculateNoAudit({ list }).then(() => {
+            ElMessage.success("批重算成功!");
+
+            vxeTableRef.value.refresh();
+          });
+        })
+        .catch((e: TypeError) => {
+          console.log("e :>> ", e);
+          ElMessage({
+            type: "info",
+            message: "操作取消"
+          });
+        });
     }
   }),
   buttonDefault({
@@ -386,6 +474,68 @@ const action: detailAction[] = [
   })
 ];
 
+const openDeptChoosen = async curRecords => {
+  try {
+    let newParams = {
+      dsname: "_Mapper_deptid",
+      queryparams: {}
+    };
+    let res = await CommonDynamicSelect(newParams);
+    if (res.datatable) {
+      deptEnum.value = res.datatable?.map((item: any) => {
+        return { label: item.deptname, value: item.deptid };
+      });
+    }
+
+    if (deptEnum.value.length > 0) {
+      formParam.value.deptid = curRecords[0].deptid;
+      dialogFormVisible.value = true;
+    } else {
+      console.error("获取部门列表为空");
+    }
+  } catch (error) {
+    console.error("获取部门列表失败", error);
+  }
+};
+
+const BatchCopyMattressAudited = () => {
+  const { curRecords } = getCurrentRecords(vxeTableRef.value);
+
+  console.log("curRecords :>> ", curRecords);
+  if (!curRecords.length) {
+    ElMessage.warning(t("business.tips.mattress.records"));
+    return;
+  }
+
+  let list = curRecords.map((item: any) => {
+    return {
+      mattressid: Number(item.mattressid),
+      deptid: formParam.value.deptid,
+      area: formParam.value.area,
+      cabinet_type: formParam.value.cabinet_type
+    };
+  });
+  ElMessageBox.confirm(`是否确定要批复制${curRecords.length}张床垫报价单吗?`, "询问", {
+    confirmButtonText: t("common.okText"),
+    cancelButtonText: "否",
+    type: "warning"
+  })
+    .then(() => {
+      CopyMattressAudited({ list }).then(() => {
+        ElMessage.success("批复制成功!");
+        dialogFormVisible.value = false;
+        vxeTableRef.value.refresh();
+      });
+    })
+    .catch((e: TypeError) => {
+      console.log("e :>> ", e);
+      ElMessage({
+        type: "info",
+        message: "操作取消"
+      });
+    });
+};
+
 /**
  * @description 监听框架属性变化
  */