فهرست منبع

1、新增软床报价页面,接口(开发中)
2、新增软床报价部件选配弹窗(开发中)
3、床垫报价-新增限制卷包包装必须有卷包直径
4、床垫报价-新增辅料设置主副规格调整可以修改数量
5、床垫报价-拉手刺绣及其他工艺增加添加/删除工艺按钮
6、床垫报价-垫层床网默认数量/长度为1

MY 18 ساعت پیش
والد
کامیت
98e2cffe2b
33فایلهای تغییر یافته به همراه1740 افزوده شده و 629 حذف شده
  1. 30 0
      JLHHJSvr/Com/AuditSoftBedQuote.cs
  2. 23 0
      JLHHJSvr/Com/DeleteSoftBedQuote.cs
  3. 56 0
      JLHHJSvr/Com/Model/CalCulationFormula.cs
  4. 3 0
      JLHHJSvr/Com/Model/u_softbed.cs
  5. 24 0
      JLHHJSvr/Com/SaveSoftBedQuote.cs
  6. 42 0
      JLHHJSvr/DataStore/web_softbed_list.xml
  7. 57 0
      JLHHJSvr/Excutor/AuditSoftBedQuoteExcutor.cs
  8. 56 0
      JLHHJSvr/Excutor/DeleteSoftBedQuoteExcutor.cs
  9. 2 1
      JLHHJSvr/Excutor/ReCalculateBedNetNoAuditExcutor.cs
  10. 2 1
      JLHHJSvr/Excutor/ReCalculateERPCostExcutor.cs
  11. 2 1
      JLHHJSvr/Excutor/ReCalculateNoAuditExcutor.cs
  12. 15 505
      JLHHJSvr/Excutor/SaveMattressExcutor.cs
  13. 45 0
      JLHHJSvr/Excutor/SaveSoftBedQuoteExcutor.cs
  14. 3 0
      JLHHJSvr/GlobalVar/GlobalVar.cs
  15. 10 9
      JLHHJSvr/Helper/BedNetHelper.cs
  16. 82 29
      JLHHJSvr/Helper/CacheHelper.cs
  17. 4 18
      JLHHJSvr/Helper/InterfaceHelper.cs
  18. 38 30
      JLHHJSvr/Helper/MattressHelper.cs
  19. 154 15
      JLHHJSvr/Helper/SoftBedHelper.cs
  20. 7 0
      JLHHJSvr/JLHHJSvr.csproj
  21. 3 0
      JLHWEB/src/api/interface/index.ts
  22. 35 0
      JLHWEB/src/api/modules/quote.ts
  23. 9 1
      JLHWEB/src/enums/dwnameEnum.ts
  24. 5 1
      JLHWEB/src/enums/mittEnum.ts
  25. 6 1
      JLHWEB/src/languages/modules/zh-cn/menu.json
  26. 87 0
      JLHWEB/src/routers/modules/softbedQuoteRouter.ts
  27. 66 5
      JLHWEB/src/views/quote/mattressQuote/detail.vue
  28. 160 12
      JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx
  29. 200 0
      JLHWEB/src/views/quote/softbedQuote/components/BedConfigModal.vue
  30. 148 0
      JLHWEB/src/views/quote/softbedQuote/components/ConfigSection.vue
  31. 0 0
      JLHWEB/src/views/quote/softbedQuote/detail.vue
  32. 40 0
      JLHWEB/src/views/quote/softbedQuote/hooks/index.tsx
  33. 326 0
      JLHWEB/src/views/quote/softbedQuote/index.vue

+ 30 - 0
JLHHJSvr/Com/AuditSoftBedQuote.cs

@@ -0,0 +1,30 @@
+using System.Collections.Generic;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    public sealed class AuditSoftBedQuoteRequest : ILJRequest<AuditSoftBedQuoteResponse>
+    {
+        public override string GetApiName()
+        {
+            return "AuditSoftBedQuote";
+        }
+        /// <summary>
+        /// 登录token
+        /// </summary>
+        public string token { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public List<u_softbed> list { get; set; }
+        /// <summary>
+        /// 0 - 撤审 1 - 审核
+        /// </summary>
+        public byte type { get; set; }
+    }
+
+    public sealed class AuditSoftBedQuoteResponse : LJResponse
+    {
+    }
+}

+ 23 - 0
JLHHJSvr/Com/DeleteSoftBedQuote.cs

@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    public sealed class DeleteSoftBedQuoteRequest : ILJRequest<DeleteSoftBedQuoteResponse>
+    {
+        public override string GetApiName()
+        {
+            return "DeleteSoftBedQuote";
+        }
+        /// <summary>
+        /// 登录token
+        /// </summary>
+        public string token { get; set; }
+        public List<u_softbed> list { get; set; }
+    }
+
+    public sealed class DeleteSoftBedQuoteResponse : LJResponse
+    {
+    }
+}

+ 56 - 0
JLHHJSvr/Com/Model/CalCulationFormula.cs

@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace JLHHJSvr.Com.Model
+{
+    public sealed class CalCulationFormula
+    {
+        /// <summary>
+        /// 公式id
+        /// </summary>
+        public int formula_id { get; set; }
+        /// <summary>
+        /// 公式名
+        /// </summary>
+        public string formula_name { get; set; }
+        /// <summary>
+        /// 公式
+        /// </summary>
+        public string formula { get; set; }
+        /// <summary>
+        /// 转换后公式
+        /// </summary>
+        public string formula_transform { get; set; }
+        /// <summary>
+        /// 计算后值
+        /// </summary>
+        public object value { get; set; }
+
+        public override bool Equals(object o)
+        {
+            if (this == o)
+            {
+                return true;
+            }
+            //内存地址不相等,就得比属性
+            if (o is CalCulationFormula)
+            {
+                CalCulationFormula item = (CalCulationFormula)o;
+                return formula_id == item.formula_id &&
+                formula_name.Equals(item.formula_name);
+            }
+            return false;
+        }
+
+        public override int GetHashCode()
+        {
+            int hash = 17;
+            hash = hash * 23 + formula_id.GetHashCode();
+            hash = hash * 23 + formula_name.GetHashCode();
+            return hash;
+        }
+    }
+}

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

@@ -14,6 +14,7 @@ namespace JLHHJSvr.Com.Model
         public string softbed_code { get; set; }
         public string softbed_name { get; set; }
         public int deptid { get; set; }
+        public byte flag { get; set; }
         public DateTime? create_time { get; set; }
         public string create_by { get; set; }
         public string mtrlmode { get; set; }
@@ -36,6 +37,8 @@ namespace JLHHJSvr.Com.Model
         public decimal nottax_dept_cost { get; set; }
         public decimal dept_cost { get; set; }
         public decimal foreign_cost { get; set; }
+
+        public List<u_softbed_mx> mxList { get; set; }
     }
 
 }

+ 24 - 0
JLHHJSvr/Com/SaveSoftBedQuote.cs

@@ -0,0 +1,24 @@
+using System.Collections.Generic;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    public sealed class SaveSoftBedQuoteRequest : ILJRequest<SaveSoftBedQuoteResponse>
+    {
+        public override string GetApiName()
+        {
+            return "SaveSoftBedQuote";
+        }
+        public string token { get; set; }
+        /// <summary>
+        /// 软床信息:主表
+        /// </summary>
+        public u_softbed softbed { get; set; }
+    }
+
+    public sealed class SaveSoftBedQuoteResponse : LJResponse
+    {
+        public u_softbed softbed { get; set; }
+    }
+}

+ 42 - 0
JLHHJSvr/DataStore/web_softbed_list.xml

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<select>
+  <selectstr>
+SELECT u_softbed.softbed_id
+	,u_softbed.softbed_code
+	,u_softbed.softbed_name
+	,u_softbed.deptid
+	,u_softbed.create_date
+	,u_softbed.create_emp
+	,u_softbed.mtrlmode
+	,u_softbed.mtrltype
+	,u_softbed.has_headboard
+	,u_softbed.has_nightstand
+	,u_softbed.has_bedframe
+	,u_softbed.is_template
+	,u_softbed.template_id
+	,u_softbed.template_code
+	,u_softbed.template_name
+	,u_softbed.commission
+	,u_softbed.taxes
+	,u_softbed.other_rate
+	,u_softbed.extras_cost
+	,u_softbed.moneyrate
+	,u_softbed.dscrp
+	,u_softbed.costamt
+	,u_softbed.nottax_factory_cost
+	,u_softbed.nottax_dept_cost
+	,u_softbed.dept_cost
+	,u_softbed.foreign_cost
+	,u_softbed.flag
+	,u_softbed.audit_date
+	,u_softbed.audit_emp
+	,u_softbed.update_date
+	,u_softbed.update_emp
+FROM u_softbed
+  </selectstr>
+  <where>
+  </where>
+  <orderstr>create_date DESC,softbed_id DESC</orderstr>
+  <displayfields>
+  </displayfields>
+</select>

+ 57 - 0
JLHHJSvr/Excutor/AuditSoftBedQuoteExcutor.cs

@@ -0,0 +1,57 @@
+using System;
+using System.Linq;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.Helper;
+using JLHHJSvr.LJException;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+using LJLib.SQLEX;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class AuditSoftBedQuoteExcutor : ExcutorBase<AuditSoftBedQuoteRequest, AuditSoftBedQuoteResponse>
+    {
+        protected override void ExcuteInternal(AuditSoftBedQuoteRequest request, object state, AuditSoftBedQuoteResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+            if (!request.list.Any())
+            {
+                rslt.ErrMsg = "至少提交一条需要审核/撤审的记录";
+                return;
+            }
+
+            using (var con = GlobalVar.ConnectionString.NewSqlConnection())
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                var softBedHelper = HelperBase.GetHelper<SoftBedHelper>(cmd);
+
+                using (cmd.Transaction = con.BeginTransaction())
+                {
+                    try
+                    {
+                        foreach (var mx in request.list)
+                        {
+                            if(request.type == 1) softBedHelper.AuditSoftBed(mx.softbed_id);
+                            else softBedHelper.CAuditSoftBed(mx.softbed_id);
+                        }
+
+                        cmd.Transaction.Commit();
+                    }
+                    catch (Exception e)
+                    {
+                        cmd.Transaction?.Rollback();
+                        rslt.ErrMsg = e.Message;
+                    }
+                }
+            }
+        }
+    }
+}

+ 56 - 0
JLHHJSvr/Excutor/DeleteSoftBedQuoteExcutor.cs

@@ -0,0 +1,56 @@
+using System;
+using System.Linq;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.Helper;
+using JLHHJSvr.LJException;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+using LJLib.SQLEX;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class DeleteSoftBedQuoteExcutor : ExcutorBase<DeleteSoftBedQuoteRequest, DeleteSoftBedQuoteResponse>
+    {
+        protected override void ExcuteInternal(DeleteSoftBedQuoteRequest request, object state, DeleteSoftBedQuoteResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+            if (!request.list.Any())
+            {
+                rslt.ErrMsg = "至少提交一条需要删除的记录";
+                return;
+            }
+
+            using (var con = GlobalVar.ConnectionString.NewSqlConnection())
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                var softBedHelper = HelperBase.GetHelper<SoftBedHelper>(cmd);
+
+                using (cmd.Transaction = con.BeginTransaction())
+                {
+                    try
+                    {
+                        foreach(var mx in request.list)
+                        {
+                            softBedHelper.DeleteSoftBed(mx.softbed_id);
+                        }
+
+                        cmd.Transaction.Commit();
+                    }
+                    catch (Exception e)
+                    {
+                        cmd.Transaction?.Rollback();
+                        rslt.ErrMsg = e.Message;
+                    }
+                }
+            }
+        }
+    }
+}

+ 2 - 1
JLHHJSvr/Excutor/ReCalculateBedNetNoAuditExcutor.cs

@@ -12,6 +12,7 @@ using JLHHJSvr.Tools;
 using LJLib.DAL.SQL;
 using LJLib.Net.SPI.Server;
 using LJLib.SQLEX;
+using static JLHHJSvr.Helper.CacheHelper;
 
 namespace JLHHJSvr.Excutor
 {
@@ -51,7 +52,7 @@ namespace JLHHJSvr.Excutor
 
                     if (bednet.deptid <= 0) throw new LJCommonException("存在报价单部门id错误,不能重算!");
 
-                    var dept = helper.Cache.getdept(bednet.deptid.Value);
+                    var dept = helper.Cache.GetData<int,u_dept,DeptMapping>(bednet.deptid.Value);
 
                     if (dept.pricelistid <= 0) throw new LJCommonException("存在报价单部门pricelistid错误,不能重算!");
 

+ 2 - 1
JLHHJSvr/Excutor/ReCalculateERPCostExcutor.cs

@@ -14,6 +14,7 @@ using LJLib.DAL.SQL;
 using LJLib.Net.SPI.Server;
 using LJLib.SQLEX;
 using NPOI.OpenXml4Net.OPC.Internal;
+using static JLHHJSvr.Helper.CacheHelper;
 
 namespace JLHHJSvr.Excutor
 {
@@ -55,7 +56,7 @@ namespace JLHHJSvr.Excutor
                     //if (mattress.flag == 1) throw new LJCommonException("存在报价单已审核,不能重算!");
                     if (mattress.deptid <= 0) throw new LJCommonException("存在报价单部门id错误,不能重算!");
 
-                    var dept = helper.Cache.getdept(mattress.deptid.Value);
+                    var dept = helper.Cache.GetData<int,u_dept,DeptMapping>(mattress.deptid.Value);
                     if (dept.pricelistid <= 0) throw new LJCommonException("存在报价单部门pricelistid错误,不能重算!");
                 }
                 

+ 2 - 1
JLHHJSvr/Excutor/ReCalculateNoAuditExcutor.cs

@@ -12,6 +12,7 @@ using JLHHJSvr.Tools;
 using LJLib.DAL.SQL;
 using LJLib.Net.SPI.Server;
 using LJLib.SQLEX;
+using static JLHHJSvr.Helper.CacheHelper;
 
 namespace JLHHJSvr.Excutor
 {
@@ -51,7 +52,7 @@ namespace JLHHJSvr.Excutor
 
                     if (mattress.deptid <= 0) throw new LJCommonException("存在报价单部门id错误,不能重算!");
 
-                    var dept = helper.Cache.getdept(mattress.deptid.Value);
+                    var dept = helper.Cache.GetData<int,u_dept,DeptMapping>(mattress.deptid.Value);
 
                     if (dept.pricelistid <= 0) throw new LJCommonException("存在报价单部门pricelistid错误,不能重算!");
 

+ 15 - 505
JLHHJSvr/Excutor/SaveMattressExcutor.cs

@@ -19,479 +19,6 @@ namespace JLHHJSvr.Excutor
 {
     internal sealed class SaveMattressExcutor : ExcutorBase<SaveMattressRequest, SaveMattressResponse>
     {
-        /*protected override void ExcuteInternal(SaveMattressRequest request, object state, SaveMattressResponse rslt)
-        {
-            var tokendata = BllHelper.GetToken(request.token);
-            if (tokendata == null)
-            {
-                rslt.ErrMsg = "会话已经中断,请重新登录";
-                return;
-            }
-            if (request.mattress == null)
-            {
-                rslt.ErrMsg = "缺少主表信息";
-                return;
-            }
-
-            using (var con = GlobalVar.ConnectionString.NewSqlConnection())
-            using (var cmd = con.CreateCommand())
-            {
-                con.Open();
-
-                // 初始化属性
-                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;
-                    request.mattress.yw_flag = 0;
-                    request.mattress.yw_auditingrep = "";
-                    request.mattress.yw_auditingdate = null;
-                    request.mattress.js1_flag = 0;
-                    request.mattress.js1_auditingrep = "";
-                    request.mattress.js1_auditingdate = null;
-                    request.mattress.js2_flag = 0;
-                    request.mattress.js2_auditingrep = "";
-                    request.mattress.js2_auditingdate = null;
-                    request.mattress.xd_flag = 0;
-                    request.mattress.xd_auditingrep = "";
-                    request.mattress.xd_auditingdate = null;
-                    request.mattress.flag = 0;
-                    request.mattress.auditingrep = "";
-                    request.mattress.auditingdate = null;
-                    request.mattress.qr_auditingrep = "";
-                    request.mattress.qr_auditingdate = null;
-                    request.mattress.erp_mtrlid = 0;
-                    request.mattress.erp_mtrlcode = "";
-                    request.mattress.erp_piccode = "";
-                    request.mattress.erp_mtrlname = "";
-
-                    foreach (var mx in request.mattressMx)
-                    {
-                        mx.mattressid = 0;
-                        mx.mattressmxid = 0;
-                    }
-                }
-                else
-                {
-                    #region 状态判断
-                    if (request.mattress.mattressid > 0) {
-                        var mattressInfo = new u_mattress() { mattressid = request.mattress.mattressid };
-                        if (DbSqlHelper.SelectOne(cmd, mattressInfo, "flag, xd_flag, yw_flag, mattresscode, parentid") == 1)
-                        {
-                            if (mattressInfo.xd_flag == 1)
-                            {
-                                rslt.ErrMsg = "床垫报价单【" + mattressInfo.mattresscode + "】已业务下单,不能修改";
-                                return;
-                            }
-                        }
-                    }
-                    if (request.subspecs != null && request.subspecs.Count > 0)
-                    {
-                        foreach (var submx in request.subspecs)
-                        {
-                            var itemid = Convert.ToInt32(submx["mattressid"]);
-                            if (itemid == 0) continue;
-                            var mattressInfo = new u_mattress() { mattressid = itemid };
-                            if (DbSqlHelper.SelectOne(cmd, mattressInfo, "flag, xd_flag, yw_flag, mattresscode, parentid") == 1)
-                            {
-                                if (mattressInfo.xd_flag == 1)
-                                {
-                                    rslt.ErrMsg = "副规格-床垫报价单【" + mattressInfo.mattresscode + "】已业务下单,不能修改";
-                                    return;
-                                }
-                            }
-
-                        }
-                    }
-                    #endregion
-                }
-
-                foreach (var mx in request.mattressMx)
-                {
-                    AutoInit.AutoInitS(cmd, mx);
-                }
-
-                using (cmd.Transaction = con.BeginTransaction())
-                {
-
-                    var helper = HelperBase.GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
-
-                    var bednetHelper = HelperBase.GetHelper<BedNetHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
-
-                    try
-                    {
-                        rslt.mxmessage = new List<string>();
-
-                        rslt.mxmessage = toSaveMattress(cmd, request.mattress, request.mattressMx, request.extraProcesses, request.extraCosts, tokendata,true);
-
-                        rslt.mattressid = request.mattress.mattressid;
-                        rslt.mattresscode = request.mattress.mattresscode;
-
-                        var subspecsList = helper.GetMattressSubspecs(request.mattress.mattressid);
-
-                        //if (subspecsList.Count > 0)
-                        //{
-
-                        //    foreach (var submx in subspecsList)
-                        //    {
-                        //        // 删除副规格特殊工艺表
-                        //        cmd.CommandText = @"DELETE u_mattress_mx_extra WHERE mattressid = @mattressid";
-                        //        cmd.Parameters.Clear();
-                        //        cmd.Parameters.AddWithValue("@mattressid", submx.mattressid);
-                        //        cmd.ExecuteNonQuery();
-
-                        //        // 删除副规格明细
-                        //        cmd.CommandText = @"DELETE u_mattress_mx_mtrl WHERE mattressid = @mattressid";
-                        //        cmd.Parameters.Clear();
-                        //        cmd.Parameters.AddWithValue("@mattressid", submx.mattressid);
-                        //        cmd.ExecuteNonQuery();
-
-                        //        // 删除副规格
-                        //        cmd.CommandText = @"DELETE u_mattress WHERE mattressid = @mattressid";
-                        //        cmd.Parameters.Clear();
-                        //        cmd.Parameters.AddWithValue("@mattressid", submx.mattressid);
-                        //        cmd.ExecuteNonQuery();
-                        //    }
-                        //}
-
-                        if (request.subspecs != null && request.subspecs.Count > 0)
-                        {
-                            // 排序:宽、长,从小到大
-                            var _subspecs = request.subspecs.OrderBy(o => o["mattress_width"]).ThenBy(o => o["mattress_length"]).ToList();
-                            // 副规格
-                            foreach (var submx in _subspecs)
-                            {
-
-                                var _mattressid = 0;
-                                var _mattresscode = "";
-                                if (submx.Value<int>("mattressid") > 0)
-                                {
-                                    _mattressid = Convert.ToInt32(submx["mattressid"]);
-                                }
-                                if (!string.IsNullOrEmpty(submx.Value<string>("mattresscode")))
-                                {
-                                    _mattresscode = Convert.ToString(submx["mattresscode"]);
-                                }
-
-                                var _mattress = ObjectHelper.DeepCopy(request.mattress);
-                                _mattress.parentid = request.mattress.mattressid;
-                                _mattress.createby = request.mattress.createby;
-                                _mattress.mattressid = _mattressid;
-                                _mattress.mattresscode = _mattresscode;
-                                _mattress.mattress_width = Convert.ToInt32(submx["mattress_width"]);
-                                _mattress.mattress_length = Convert.ToInt32(submx["mattress_length"]);
-                                _mattress.mattress_height = Convert.ToInt32(submx["mattress_height"]);
-                                _mattress.mattressrelcode = Convert.ToString(submx["mattressrelcode"]);
-                                _mattress.mattressname = Convert.ToString(submx["mattressname"]);
-
-                                if (submx.Value<int>("erp_mtrlid") > 0)
-                                {
-                                    _mattress.erp_mtrlid = Convert.ToInt32(submx["erp_mtrlid"]);
-                                }
-                                if (!string.IsNullOrEmpty(submx.Value<string>("erp_mtrlcode")))
-                                {
-                                    _mattress.erp_mtrlcode = Convert.ToString(submx["erp_mtrlcode"]);
-                                }
-                                if (submx.Value<int>("erp_configcodetype") > 0)
-                                {
-                                    _mattress.erp_configcodetype = Convert.ToInt32(submx["erp_configcodetype"]);
-                                }
-                                if (!string.IsNullOrEmpty(submx.Value<string>("erp_mtrlengname")))
-                                {
-                                    _mattress.erp_mtrlengname = Convert.ToString(submx["erp_mtrlengname"]);
-                                }
-                                if (!string.IsNullOrEmpty(submx.Value<string>("erp_mtrlmode")))
-                                {
-                                    _mattress.erp_mtrlmode = Convert.ToString(submx["erp_mtrlmode"]);
-                                }
-                                if (!string.IsNullOrEmpty(submx.Value<string>("erp_mtrlname")))
-                                {
-                                    _mattress.erp_mtrlname = Convert.ToString(submx["erp_mtrlname"]);
-                                }
-                                if (!string.IsNullOrEmpty(submx.Value<string>("erp_mtrltype")))
-                                {
-                                    _mattress.erp_mtrltype = Convert.ToString(submx["erp_mtrltype"]);
-                                }
-                                if (submx.Value<int>("erp_mtrltypeid") > 0)
-                                {
-                                    _mattress.erp_mtrltypeid = Convert.ToInt32(submx["erp_mtrltypeid"]);
-                                }
-                                if (!string.IsNullOrEmpty(submx.Value<string>("erp_mtrlunit")))
-                                {
-                                    _mattress.erp_mtrlunit = Convert.ToString(submx["erp_mtrlunit"]);
-                                }
-                                if (!string.IsNullOrEmpty(submx.Value<string>("erp_piccode")))
-                                {
-                                    _mattress.erp_piccode = Convert.ToString(submx["erp_piccode"]);
-                                }
-
-                                var _mattressMx = new List<u_mattress_mx_mtrl>();
-                                if (request.mattressMx != null && request.mattressMx.Any())
-                                {
-                                    var bednetIndex = 0; // 床网索引
-                                    var ifSubspecsIndex = 0; // 垫层主副规格物料索引
-                                    foreach (var itemMx in request.mattressMx)
-                                    {
-                                        var item = ObjectHelper.DeepCopy(itemMx);
-                                        item.mattressid = _mattress.mattressid;
-                                        item.mattressmxid = 0;
-                                        item.message = "";
-
-                                        #region 副规格床网自动匹配/新增逻辑
-                                        if (item.formulatype == 99 && item.mtrlid > 0)
-                                        {
-                                            bednetIndex++;
-                                            var oBednet = new u_bednet();
-                                            var _bednet = bednetHelper.GetBedNet(item.mtrlid.Value);
-                                            var _bednetMx = bednetHelper.GetBedNetMxList(item.mtrlid.Value);
-                                            var _bednetSpring = bednetHelper.GetBedNetSpringList(item.mtrlid.Value);
-
-                                            //_bednet.mattress_width = Convert.ToInt32(submx["mattress_width"]) - (request.mattress.mattress_width - _bednet.mattress_width);
-                                            //_bednet.mattress_length = Convert.ToInt32(submx["mattress_length"]) - (request.mattress.mattress_length - _bednet.mattress_length);
-                                            _bednet.mattress_width = Convert.ToInt32(submx["mattress_width"]);
-                                            _bednet.mattress_length = Convert.ToInt32(submx["mattress_length"]);
-
-                                            var _spring_qty_width = Convert.ToInt32(submx["spring_qty_width_" + bednetIndex]);
-                                            var _spring_qty_length = Convert.ToInt32(submx["spring_qty_length_" + bednetIndex]);
-                                            var _bednet_fork_qty = _bednet.fork_qty;
-                                            if (!string.IsNullOrEmpty(submx.Value<string>("bednet_fork_qty_" + bednetIndex)))
-                                            {
-                                                _bednet_fork_qty = Convert.ToInt32(submx["bednet_fork_qty_" + bednetIndex]);
-                                            }
-
-                                            //if (_bednetMx.Count > 0)
-                                            //{
-
-                                            //    cmd.CommandText = @"SELECT TOP 1 u_bednet.bednetid
-                                            //                                ,u_bednet_type.typename
-                                            //                                ,bednetcode
-                                            //                                ,mattress_width
-                                            //                                ,mattress_length
-                                            //                                ,mattress_height
-                                            //                                ,nottax_factory_cost
-                                            //                        FROM u_bednetmx
-                                            //                        INNER JOIN u_bednet on u_bednet.bednetid = u_bednetmx.bednetid
-                                            //                        INNER JOIN u_bednet_type on u_bednet_type.bednettypeid = u_bednet.bednettypeid
-                                            //                        WHERE u_bednet.bednettypeid = @bednettypeid
-                                            //                            AND u_bednet.mattress_width = @mattress_width
-                                            //                            AND u_bednet.mattress_length = @mattress_length
-                                            //                            AND u_bednet.if_doublenet = @if_doublenet
-                                            //                            AND u_bednet.if_doublespring = @if_doublespring
-                                            //                            AND u_bednet.snake_wire_diameter = @snake_wire_diameter
-                                            //                            AND u_bednet.if_rsorwa = @if_rsorwa
-                                            //                            AND u_bednet.if_sponge_drilling = @if_sponge_drilling
-                                            //                            AND u_bednet.ifsaleout = 0
-                                            //                            AND u_bednet.sponge_mtrlid = @sponge_mtrlid
-                                            //                            AND u_bednet.sponge_thickness = @sponge_thickness
-                                            //                            AND u_bednet.sponge_height = @sponge_height
-                                            //                            AND u_bednet.sponge_tc_mtrlid = @sponge_tc_mtrlid
-                                            //                            AND u_bednet.sponge_tc_thickness = @sponge_tc_thickness
-                                            //                            AND u_bednet.sponge_tc_height = @sponge_tc_height
-                                            //                            AND u_bednet.edge_mtrlid = @edge_mtrlid
-                                            //                            AND u_bednet.edge_height = @edge_height
-                                            //                            AND u_bednet.felt_mtrlid = @felt_mtrlid
-                                            //                            AND u_bednet.felt_qty = @felt_qty
-                                            //                            AND u_bednet.felt_x_mtrlid = @felt_x_mtrlid
-                                            //                            AND u_bednet.felt_x_qty = @felt_x_qty
-                                            //                            AND u_bednet.fork_qty = @fork_qty
-                                            //                            AND u_bednet.felt_dscrp = @felt_dscrp
-                                            //                            AND u_bednet.duo_qv_str = @duo_qv_str
-                                            //                            AND u_bednetmx.bednet_height = @bednet_height
-                                            //                            AND u_bednetmx.springid = @springid
-                                            //                            AND u_bednetmx.spring_qty_width = @spring_qty_width
-                                            //                            AND u_bednetmx.spring_qty_length = @spring_qty_length
-                                            //                            AND u_bednetmx.if_side_iron = @if_side_iron
-                                            //                            AND u_bednetmx.side_iron_qty = @side_iron_qty
-                                            //                            AND u_bednetmx.fabrics2_mtrlid = @fabrics2_mtrlid
-                                            //                            AND u_bednetmx.fabrics1_mtrlid = @fabrics1_mtrlid
-                                            //                            AND u_bednetmx.if_hard_around = @if_hard_around
-                                            //                            AND u_bednetmx.hard_around_springid = @hard_around_springid
-                                            //                            AND u_bednetmx.hard_around_row = @hard_around_row
-                                            //                            AND u_bednetmx.if_15strip = @if_15strip
-                                            //                        ";
-                                            //    cmd.Parameters.Clear();
-                                            //    cmd.Parameters.AddWithValue("@bednettypeid", _bednet.bednettypeid);
-                                            //    cmd.Parameters.AddWithValue("@mattress_width", _bednet.mattress_width);
-                                            //    cmd.Parameters.AddWithValue("@mattress_length", _bednet.mattress_length);
-                                            //    cmd.Parameters.AddWithValue("@if_doublenet", _bednet.if_doublenet);
-                                            //    cmd.Parameters.AddWithValue("@if_doublespring", _bednet.if_doublespring);
-                                            //    cmd.Parameters.AddWithValue("@snake_wire_diameter", _bednet.snake_wire_diameter);
-                                            //    cmd.Parameters.AddWithValue("@if_rsorwa", _bednet.if_rsorwa);
-                                            //    cmd.Parameters.AddWithValue("@if_sponge_drilling", _bednet.if_sponge_drilling);
-                                            //    cmd.Parameters.AddWithValue("@sponge_mtrlid", _bednet.sponge_mtrlid);
-                                            //    cmd.Parameters.AddWithValue("@sponge_thickness", _bednet.sponge_thickness);
-                                            //    cmd.Parameters.AddWithValue("@sponge_height", _bednet.sponge_height);
-                                            //    cmd.Parameters.AddWithValue("@sponge_tc_mtrlid", _bednet.sponge_tc_mtrlid);
-                                            //    cmd.Parameters.AddWithValue("@sponge_tc_thickness", _bednet.sponge_tc_thickness);
-                                            //    cmd.Parameters.AddWithValue("@sponge_tc_height", _bednet.sponge_tc_height);
-                                            //    cmd.Parameters.AddWithValue("@edge_mtrlid", _bednet.edge_mtrlid);
-                                            //    cmd.Parameters.AddWithValue("@edge_height", _bednet.edge_height);
-                                            //    cmd.Parameters.AddWithValue("@felt_mtrlid", _bednet.felt_mtrlid);
-                                            //    cmd.Parameters.AddWithValue("@felt_qty", _bednet.felt_qty);
-                                            //    cmd.Parameters.AddWithValue("@felt_x_mtrlid", _bednet.felt_x_mtrlid);
-                                            //    cmd.Parameters.AddWithValue("@felt_x_qty", _bednet.felt_x_qty);
-                                            //    cmd.Parameters.AddWithValue("@felt_dscrp", _bednet.felt_dscrp);
-                                            //    cmd.Parameters.AddWithValue("@duo_qv_str", _bednet.duo_qv_str);
-                                            //    cmd.Parameters.AddWithValue("@fork_qty", _bednet.iffork == 1 ? _bednet_fork_qty : 0);
-                                            //    cmd.Parameters.AddWithValue("@bednet_height", _bednetMx[0].bednet_height);
-                                            //    cmd.Parameters.AddWithValue("@springid", _bednetMx[0].springid);
-                                            //    cmd.Parameters.AddWithValue("@spring_qty_width", _spring_qty_width);
-                                            //    cmd.Parameters.AddWithValue("@spring_qty_length", _spring_qty_length);
-                                            //    cmd.Parameters.AddWithValue("@if_side_iron", _bednetMx[0].if_side_iron);
-                                            //    cmd.Parameters.AddWithValue("@side_iron_qty", _bednetMx[0].side_iron_qty);
-                                            //    cmd.Parameters.AddWithValue("@fabrics2_mtrlid", _bednetMx[0].fabrics2_mtrlid);
-                                            //    cmd.Parameters.AddWithValue("@fabrics1_mtrlid", _bednetMx[0].fabrics1_mtrlid);
-                                            //    cmd.Parameters.AddWithValue("@if_hard_around", _bednetMx[0].if_hard_around);
-                                            //    cmd.Parameters.AddWithValue("@hard_around_springid", _bednetMx[0].hard_around_springid);
-                                            //    cmd.Parameters.AddWithValue("@hard_around_row", _bednetMx[0].hard_around_row);
-                                            //    cmd.Parameters.AddWithValue("@if_15strip", _bednetMx[0].if_15strip);
-                                            //    using (var reader = cmd.ExecuteReader())
-                                            //    {
-                                            //        if (reader.Read())
-                                            //        {
-                                            //            oBednet = new u_bednet() {
-                                            //                bednetid = Convert.ToInt32(reader["bednetid"]),
-                                            //                typename = Convert.ToString(reader["typename"]),
-                                            //                bednetcode = Convert.ToString(reader["bednetcode"]),
-                                            //                mattress_width = Convert.ToInt32(reader["mattress_width"]),
-                                            //                mattress_length = Convert.ToInt32(reader["mattress_length"]),
-                                            //                mattress_height = Convert.ToInt32(reader["mattress_height"]),
-                                            //                nottax_factory_cost = Convert.ToDecimal(reader["nottax_factory_cost"])
-                                            //            };
-                                            //        }
-                                            //    }
-
-                                            //    if (_bednetSpring.Count>0)
-                                            //    {
-
-                                            //    }
-                                            //}
-
-                                            // 匹配失败,自动新建 
-                                            //if (oBednet.bednetid == null)
-                                            //{
-                                            /// 20250714 副规格的床网,不匹配查找,直接新建
-                                                oBednet = _bednet;
-                                                _bednetMx[0].spring_qty_width = _spring_qty_width;
-                                                _bednetMx[0].spring_qty_length = _spring_qty_length;
-                                                oBednet.fork_qty = _bednet_fork_qty;
-                                                oBednet.bednetid = 0;
-
-                                                // 袋装网,多个分区时,重新分配弹簧
-                                                bednetHelper.GetSpringListQty(oBednet, _bednetMx[0], ref _bednetSpring);
-
-                                                bednetHelper.SaveBedNet(oBednet, _bednetMx, _bednetSpring);
-                                            //}
-
-                                            var _mtrlname = oBednet.typename +
-                                                            " " +
-                                                            oBednet.bednetcode +
-                                                            " " +
-                                                            oBednet.mattress_width +
-                                                            "*" +
-                                                            oBednet.mattress_length +
-                                                            "*" +
-                                                            oBednet.mattress_height;
-
-                                            item.mtrlid = oBednet.bednetid;
-                                            item.mtrlname = _mtrlname;
-                                            item.price = oBednet.nottax_factory_cost;
-                                            item.qty = 1;
-
-                                        }
-                                        #endregion
-
-                                        #region 垫层改动逻辑
-                                        if (item.formulatype == 1 && item.mtrlid > 0 )
-                                        {
-                                            // 规格长/宽,按比例缩放
-                                            if (item.mattress_width > 0)
-                                            {
-                                                item.mattress_width = (int)Math.Floor((decimal)item.mattress_width * (Convert.ToDecimal(submx["mattress_width"]) / (decimal)request.mattress.mattress_width));
-                                            }
-                                            if (item.mattress_length > 0)
-                                            {
-                                                item.mattress_length = (int)Math.Floor((decimal)item.mattress_length * (Convert.ToDecimal(submx["mattress_length"]) / (decimal)request.mattress.mattress_length));
-                                            }
-
-                                            // 副规格-垫层物料替换
-                                            if (item.if_subspecs == 1)
-                                            {
-                                                ifSubspecsIndex++;
-                                                item.mtrlid = Convert.ToInt32(submx["cushions_subspecs_" + ifSubspecsIndex]);
-                                            }
-                                        }
-                                        #endregion
-
-                                        _mattressMx.Add(item);
-                                    }
-
-                                    #region FEAT:内布套/顶部裥棉逻辑
-                                    var butaoList = _mattressMx.Where(t => (t.formulatype == 101 || t.formulatype == 102 || t.formulatype == 103) && t.mtrlid > 0 && (t.mattress_width > 0 || t.mattress_length > 0));
-                                    foreach(var itemMx in butaoList)
-                                    {
-                                        itemMx.mattress_width += _mattress.mattress_width - request.mattress.mattress_width;
-                                        itemMx.mattress_length += _mattress.mattress_length - request.mattress.mattress_length;
-                                    }
-                                    #endregion
-                                }
-
-                                toSaveMattress(cmd, _mattress, _mattressMx, request.extraProcesses, request.extraCosts, tokendata,false);
-                            }
-                        }
-
-                        cmd.Transaction.Commit();
-                    }
-                    catch (Exception e)
-                    {
-                        cmd.Transaction.Rollback();
-                        rslt.ErrMsg = e.ToString();
-                        Trace.Write(e);
-                    }
-
-
-
-                }
-            }
-        }*/
-
-        /*public List<string> toSaveMattress(SqlCommand cmd, u_mattress mattress, List<u_mattress_mx_mtrl> mattressMx, List<u_mattress_mx_extra> extraProcesses, List<u_mattress_mx_extra> extraCosts, TokenData tokendata,bool iferpmtrl)
-        {
-            var helper = HelperBase.GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
-
-            List<string> message = new List<string>();
-
-            helper.MattressCalculateCost(mattress, mattressMx, extraProcesses, extraCosts);
-
-            var mxmessageList = mattressMx.Where(item => !string.IsNullOrEmpty(item.message)).ToList();
-            if (mxmessageList.Any())
-            {
-                foreach (var mx in mxmessageList)
-                {
-                    message.Add(mx.message);
-                }
-            }
-
-            try
-            {
-                helper.SaveMattress(mattress, mattressMx, extraProcesses, extraCosts, iferpmtrl);
-
-                if (mattress.copy_id != null && mattress.copy_id > 0)
-                {
-                    helper.CopyMattressInterface(mattress.copy_id.Value,mattress.mattressid);
-                }
-
-            }
-            catch (Exception e)
-            {
-                throw new LJCommonException(e.Message);
-            }
-
-            return message;
-        }*/
-
         protected override void ExcuteInternal(SaveMattressRequest request, object state, SaveMattressResponse rslt)
         {
             var tokendata = BllHelper.GetToken(request.token);
@@ -516,37 +43,6 @@ namespace JLHHJSvr.Excutor
 
                 var subspecsList = new List<u_mattress>();
 
-                // 状态判断
-                if (request.mattress.copy_id != null && request.mattress.copy_id > 0)
-                {
-                }
-                else
-                {
-                    var mattressInfo = new u_mattress() { mattressid = request.mattress.mattressid };
-                    if (DbSqlHelper.SelectOne(cmd, mattressInfo, "flag, xd_flag, yw_flag, mattresscode, parentid") == 1)
-                    {
-                        if (mattressInfo.xd_flag == 1)
-                        {
-                            rslt.ErrMsg = "床垫报价单【" + mattressInfo.mattresscode + "】已业务下单,不能修改";
-                            return;
-                        }
-                    }
-
-                    // 副规格
-                    //if (mattressInfo.parentid != null && mattressInfo.parentid > 0)
-                    //{
-                    //    subspecsList = mattressHelper.GetMattressSubspecs(mattressInfo.parentid.Value, "flag, xd_flag, yw_flag, mattresscode, parentid,mattressid,mattress_width,mattress_length,mattress_height,mattressname,mattressrelcode");
-                    //    foreach(var submx in subspecsList)
-                    //    {
-                    //        if (submx.xd_flag == 1)
-                    //        {
-                    //            rslt.ErrMsg = "副规格-床垫报价单【" + submx.mattresscode + "】已业务下单,不能修改";
-                    //            return;
-                    //        }
-                    //    }
-                    //}
-                }
-
                 var _mattress = ObjectHelper.DeepCopy(request.mattress);
                 _mattress.mxList = request.mattressMx;
                 _mattress.extraList = request.extraProcesses;
@@ -560,6 +56,20 @@ namespace JLHHJSvr.Excutor
                     AutoInit.AutoInitS(cmd, mx);
                 }
 
+                // 状态判断
+                if (!(request.mattress.copy_id != null && request.mattress.copy_id > 0))
+                {
+                    // 业务下单无法修改
+                    if (_mattress.mattressid > 0)
+                    {
+                        var temp_mattress = mattressHelper.GetMattress(_mattress.mattressid, "flag, xd_flag, yw_flag, mattresscode, parentid");
+                        if (temp_mattress.xd_flag != null && temp_mattress.xd_flag == 1)
+                        {
+                            throw new LJCommonException($"床垫报价单【{temp_mattress.mattresscode}】已业务下单,不能修改!");
+                        }
+                    }
+                }
+
                 #region TODO:需要优化
                 List<string> message = new List<string>();
                 mattressHelper.MattressCalculateCost(_mattress, _mattress.mxList, _mattress.extraList, _mattress.extraCostList);
@@ -645,7 +155,7 @@ namespace JLHHJSvr.Excutor
                     }
                     catch (Exception e)
                     {
-                        rslt.ErrMsg = e.ToString();
+                        rslt.ErrMsg = e.Message;
                         Trace.Write(e);
                         cmd.Transaction?.Rollback();
                     }

+ 45 - 0
JLHHJSvr/Excutor/SaveSoftBedQuoteExcutor.cs

@@ -0,0 +1,45 @@
+using System;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.Helper;
+using LJLib.Net.SPI.Server;
+using LJLib.SQLEX;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class SaveSoftBedQuoteExcutor : ExcutorBase<SaveSoftBedQuoteRequest, SaveSoftBedQuoteResponse>
+    {
+        protected override void ExcuteInternal(SaveSoftBedQuoteRequest request, object state, SaveSoftBedQuoteResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+
+            using (var con = GlobalVar.ConnectionString.NewSqlConnection())
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                var softBedHelper = HelperBase.GetHelper<SoftBedHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
+
+                using (cmd.Transaction = con.BeginTransaction())
+                {
+                    try
+                    {
+                        softBedHelper.SaveSoftBed(request.softbed);
+
+                        cmd.Transaction.Commit();
+                    }
+                    catch (Exception e)
+                    {
+                        cmd.Transaction?.Rollback();
+                        rslt.ErrMsg = e.ToString();
+                    }
+                }
+            }
+        }
+    }
+}

+ 3 - 0
JLHHJSvr/GlobalVar/GlobalVar.cs

@@ -253,6 +253,9 @@ namespace JLHHJSvr
 
                 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                 excutorManager.AddMap("CopyConfigureCodeMxList", typeof(CopyConfigureCodeMxListRequest), new CopyConfigureCodeMxListExcutor()); // 复制部件选配项值
+                excutorManager.AddMap("SaveSoftBedQuote", typeof(SaveSoftBedQuoteRequest), new SaveSoftBedQuoteExcutor()); // 保存/修改软床报价
+                excutorManager.AddMap("DeleteSoftBedQuote", typeof(DeleteSoftBedQuoteRequest), new DeleteSoftBedQuoteExcutor()); // 删除软床报价
+                excutorManager.AddMap("AuditSoftBedQuote", typeof(AuditSoftBedQuoteRequest), new AuditSoftBedQuoteExcutor()); // 审核软床报价
             }
             catch (Exception ex)
             {

+ 10 - 9
JLHHJSvr/Helper/BedNetHelper.cs

@@ -13,6 +13,7 @@ using System.Runtime.InteropServices;
 using System.Text;
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
+using static JLHHJSvr.Helper.CacheHelper;
 
 namespace JLHHJSvr.Helper
 {
@@ -176,7 +177,7 @@ namespace JLHHJSvr.Helper
 
             foreach (var mx in mxlist)
             {
-                var spring = Cache.getspring(mx.springid.Value);
+                var spring = Cache.GetData<int,u_spring,SpringMapping>(mx.springid.Value);
 
                 // 处理相同公式部分
                 InitMxReplaceMents(bednet, mx, spring);
@@ -1132,7 +1133,7 @@ namespace JLHHJSvr.Helper
 
         private void InitBedNet(u_bednet bednet, Boolean isCalBed = true)
         {
-            var dept = Cache.getdept(bednet.deptid.Value);
+            var dept = Cache.GetData<int,u_dept,DeptMapping>(bednet.deptid.Value);
 
             //var profirate = new u_factory_profitrate() { deptid = bednet.deptid, bednettypeid_mattresstypeid = bednet.bednettypeid, bednet_or_mattress = 0 };
             //DbSqlHelper.SelectOne(cmd, profirate, "profitrate");
@@ -1398,7 +1399,7 @@ namespace JLHHJSvr.Helper
             AddKeyValue("边铁条数", mx.side_iron_qty);
             AddKeyValue("条数", mx.side_iron_qty);
 
-            var spring = Cache.getspring(mx2.springid.Value);
+            var spring = Cache.GetData<int,u_spring,SpringMapping>(mx2.springid.Value);
 
             spring.gram_weight /= 1000;
             if (spring.gram_weight > 0)
@@ -1443,7 +1444,7 @@ namespace JLHHJSvr.Helper
         /// <param name="mx"></param>
         private void CalSpringMtrlCol2(u_bednet bednet, u_bednetmx mx, List<u_bednetmx_spring> springList, string type)
         {
-            var spring = Cache.getspring(mx.springid.Value);
+            var spring = Cache.GetData<int,u_spring,SpringMapping>(mx.springid.Value);
 
             #region 计算 底面无纺布 开始
             //计算 上下无纺布方数 =(B4+C4)*(B4+D4)/10000
@@ -1466,7 +1467,7 @@ namespace JLHHJSvr.Helper
                 {
                     _springid = springList[0].springid;
                 }
-                var _spring = Cache.getspring(_springid.Value);
+                var _spring = Cache.GetData<int,u_spring,SpringMapping>(_springid.Value);
 
                 spring.center_diameter = _spring.center_diameter == null ? 0 : _spring.center_diameter;
 
@@ -1658,7 +1659,7 @@ namespace JLHHJSvr.Helper
             var spring = new u_spring() { springid = springId };
             if (line_diameter == 0)
             {
-                spring = Cache.getspring(springId.Value);
+                spring = Cache.GetData<int,u_spring,SpringMapping>(springId.Value);
                 AddKeyValue(springName + "弹簧重/个", spring.gram_weight / 1000);
                 AddKeyValue(springName + "弹簧重", spring.gram_weight / 1000);
             } 
@@ -2478,7 +2479,7 @@ namespace JLHHJSvr.Helper
             var mxList = GetBedNetMxList(bednetid);
             var springList = GetBedNetSpringList(bednetid);
             
-            var dept = Cache.getdept(bednet.deptid.Value); ;
+            var dept = Cache.GetData<int,u_dept,DeptMapping>(bednet.deptid.Value); ;
 
             if(bednet.deptid == null || bednet.deptid.Value <= 0)
             {
@@ -2914,7 +2915,7 @@ namespace JLHHJSvr.Helper
         {
             //var spring = new u_spring() { springid = springid };
             //DbSqlHelper.SelectOne(cmd, spring, "line_diameter,gram_weight,height,center_diameter,cyclenum,caliber");
-            var spring = Cache.getspring(springid);
+            var spring = Cache.GetData<int,u_spring,SpringMapping>(springid);
             return spring.name;
         }
 
@@ -2952,7 +2953,7 @@ namespace JLHHJSvr.Helper
                     //多区
                     _springid = springList[0].springid;
                 }
-                var spring = Cache.getspring(_springid.Value);
+                var spring = Cache.GetData<int,u_spring,SpringMapping>(_springid.Value);
 
                 // 处理相同公式部分
                 InitMxReplaceMents(bednet, mx, spring);

+ 82 - 29
JLHHJSvr/Helper/CacheHelper.cs

@@ -4,53 +4,106 @@ using JLHHJSvr.Com.Model;
 using LJLib;
 using LJLib.DAL.SQL;
 using System;
+using System.Collections.Concurrent;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Web.Caching;
-
+using System.Data.SqlClient;
 namespace JLHHJSvr.Helper
 {
     internal sealed class CacheHelper : HelperBase
     {
-        #region 弹簧资料
-        private static LJCache<string, u_spring> _u_spring;
-        public u_spring getspring(int springid)
+        #region 基础资料Mapping
+        /// <summary>
+        /// 弹簧资料
+        /// </summary>
+        public class SpringMapping : ICacheMapping<int, u_spring>
         {
-            string key = $"springid:{springid}";
-            if (_u_spring == null) _u_spring = new LJCache<string, u_spring>() { DefaultAddMinutes = DefaultCacheMinutes };
-            if (!_u_spring.TryGetValue(key, out u_spring value))
+            public u_spring GetInstance(SqlCommand cmd, int springid)
             {
-                var result = new u_spring { springid = springid };
-                DbSqlHelper.SelectOne(cmd, result, "line_diameter,gram_weight,height,center_diameter,caliber,cyclenum,roll_width,roll_length,arrangement_width,arrangement_height,springtypeid");
-                _u_spring.Add(key, result);
-                return ObjectHelper.DeepCopy(result);
+                var instance = new u_spring() { springid = springid };
+                DbSqlHelper.SelectOne(cmd, instance, "line_diameter,gram_weight,height,center_diameter,caliber,cyclenum,roll_width,roll_length,arrangement_width,arrangement_height,springtypeid");
+                return instance;
+            }
+        }
+        /// <summary>
+        /// 部门资料
+        /// </summary>
+        public class DeptMapping : ICacheMapping<int, u_dept>
+        {
+            public u_dept GetInstance(SqlCommand cmd, int deptid)
+            {
+                var instance = new u_dept() { deptid = deptid };
+                DbSqlHelper.SelectOne(cmd, instance, "pricelistid,profitrate,moneyrate,discount,taxes_rate,managerate,com_profitrate,dannum1_rate,dannum2_rate,dannum3_rate,dannum4_rate");
+                return instance;
             }
-            return ObjectHelper.DeepCopy(value);
         }
         #endregion
 
-        #region 弹簧类型
+        #region 获取数据
+        private static readonly Dictionary<Type, object> _cacheServiceRegistry = new Dictionary<Type, object>();
+        public TEntity GetData<TKey, TEntity, TMapping>(TKey key) where TEntity: class,new() where TMapping : ICacheMapping<TKey, TEntity>, new()
+        {
+            var entityType = typeof(TEntity);
+            if (!_cacheServiceRegistry.TryGetValue(entityType, out var serviceObj))
+            {
+                var cacheService = new CacheService<TKey, TEntity>(new GenericLoader<TKey, TEntity>(new TMapping()));
+                _cacheServiceRegistry.Add(entityType, cacheService);
+                serviceObj = cacheService;
+            }
+
+            var service = (CacheService<TKey, TEntity>)serviceObj;
+            return service.Get(cmd,key);
+        }
         #endregion
+    }
 
-        #region 部门
-        private static LJCache<string, u_dept> _u_dept;
-        public u_dept getdept(int deptid)
+    #region 核心
+    public interface ICacheLoader<TKey, TValue> where TValue : class, new()
+    {
+        TValue Load(SqlCommand cmd, TKey key);
+    }
+    public interface ICacheMapping<TKey, TValue> where TValue : class, new()
+    {
+        TValue GetInstance(SqlCommand cmd, TKey key);
+    }
+    public class CacheService<TKey, TValue> where TValue : class, new()
+    {
+        private readonly LJCache<TKey, TValue> _cache;
+        private readonly ICacheLoader<TKey, TValue> _loader;
+
+        public CacheService(ICacheLoader<TKey, TValue> loader, int cacheMinutes)
+        {
+            _loader = loader;
+            _cache = new LJCache<TKey, TValue> { DefaultAddMinutes = cacheMinutes };
+        }
+
+        public CacheService(ICacheLoader<TKey, TValue> loader)
+        {
+            _loader = loader;
+            _cache = new LJCache<TKey, TValue> { DefaultAddMinutes = 120 };
+        }
+
+        public TValue Get(SqlCommand cmd,TKey key)
         {
-            string key = $"deptid:{deptid}";
-            if(_u_dept == null) _u_dept = new LJCache<string, u_dept>() { DefaultAddMinutes = DefaultCacheMinutes };
-            if (!_u_dept.TryGetValue(key, out u_dept value))
+            if (!_cache.TryGetValue(key, out TValue value))
             {
-                var result = new u_dept { deptid = deptid };
-                DbSqlHelper.SelectOne(cmd, result, "pricelistid,profitrate,moneyrate,discount,taxes_rate,managerate,com_profitrate,dannum1_rate,dannum2_rate,dannum3_rate,dannum4_rate");
-                _u_dept.Add(key, result);
-                return ObjectHelper.DeepCopy(result);
+                value = _loader.Load(cmd, key);
+                _cache.Add(key, value);
             }
             return ObjectHelper.DeepCopy(value);
         }
-        #endregion
+    }
 
-        private const int DefaultCacheMinutes = 120;
+    public class GenericLoader<TKey, TValue> : ICacheLoader<TKey, TValue> where TValue : class, new()
+    {
+        private readonly ICacheMapping<TKey, TValue> _mapping;
+        public GenericLoader(ICacheMapping<TKey, TValue> mapping)
+        {
+            _mapping = mapping;
+        }
+        public TValue Load(SqlCommand cmd, TKey id)
+        {
+            return _mapping.GetInstance(cmd, id);
+        }
     }
+    #endregion
 }

+ 4 - 18
JLHHJSvr/Helper/InterfaceHelper.cs

@@ -12,6 +12,7 @@ using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Data.SqlClient;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Text.RegularExpressions;
@@ -37,25 +38,10 @@ namespace JLHHJSvr.Helper
                 throw new LJCommonException("错误的床垫id");
             }
 
-            //AutoSetMtrlName(mattress, mxlist);
-
-            //if (string.IsNullOrEmpty(mattress.erp_mtrlcode))
-            //{
-            //    throw new LJCommonException("请输入物料名称!");
-            //}
-
-            //if (mattress.erp_mtrltypeid == null || mattress.erp_mtrltypeid <= 0)
-            //{
-            //    throw new LJCommonException("请选择物料类别!");
-            //}
-
-            //if (mattress.erp_configcodetype == null || mattress.erp_configcodetype <= 0)
-            //{
-            //    throw new LJCommonException("请选择配置类型!");
-            //}
-
             DbSqlHelper.Update(cmd, mattress, "erp_mtrlid,erp_mtrltypeid,erp_mtrlcode,erp_mtrlname,erp_mtrlmode,erp_mtrltype,erp_mtrlunit,erp_mtrlengname,erp_configcodetype,old_mtrlname");
-
+            //
+            var caller = new StackTrace().GetFrame(1).GetMethod();
+            Trace.Write($"Called By {caller.DeclaringType?.Name}.{caller.Name},INFOS:erp_mtrlid = {mattress.erp_mtrlid},erp_mtrlcod = {mattress.erp_mtrlcode},mattressid = {mattress.mattressid}");
             // 保存接口数据
             var mattressHelper = GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = context.tokendata });
             mattressHelper.SaveMattressInterface(mattress.mattressid, mxlist, qdlist);

+ 38 - 30
JLHHJSvr/Helper/MattressHelper.cs

@@ -16,6 +16,7 @@ using System.Linq;
 using System.Text;
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
+using static JLHHJSvr.Helper.CacheHelper;
 
 namespace JLHHJSvr.Helper
 {
@@ -394,7 +395,7 @@ namespace JLHHJSvr.Helper
         }
         private void InitMattress(u_mattress mattress)
         {
-            var dept = Cache.getdept(mattress.deptid.Value);
+            var dept = Cache.GetData<int,u_dept,DeptMapping>(mattress.deptid.Value);
             //var profirate = new u_factory_profitrate() { deptid = mattress.deptid, bednettypeid_mattresstypeid = mattress.mattresstypeid, bednet_or_mattress = 1 };
             //DbSqlHelper.SelectOne(cmd, profirate, "profitrate");
             decimal profitrate = 0;
@@ -664,7 +665,7 @@ namespace JLHHJSvr.Helper
             AddFormulaKeyValue("底价", "if((【部门利润率】+【部门让利点数】/100)<> 0,【不含税出厂价】/(【部门利润率】+【部门让利点数】/ 100),0)");
             AddFormulaKeyValue("佣金", "【底价】/(1-(【佣金点数】-1))-【底价】");
 
-            var dept = Cache.getdept(mattress.deptid.Value);
+            var dept = Cache.GetData<int,u_dept,DeptMapping>(mattress.deptid.Value);
             AddKeyValue("税金补偿", dept.taxes_rate);
 
             var bednetVarList = new List<u_bednet_var>();
@@ -1485,7 +1486,7 @@ namespace JLHHJSvr.Helper
             var mattressType = new u_mattress_type() { mattresstypeid = mattress.mattresstypeid };
             DbSqlHelper.SelectOne(cmd, mattressType, "hrcost_formula,biandaiqty,zhizao_amt,guanli_rate,typerate,dannum1_rate,dannum2_rate,dannum3_rate,dannum4_rate");
 
-            var dept = Cache.getdept(mattress.deptid.Value);
+            var dept = Cache.GetData<int,u_dept,DeptMapping>(mattress.deptid.Value);
             decimal? com_profitrate_dannum = 0;
 
             decimal _rate = 1;
@@ -1945,13 +1946,15 @@ namespace JLHHJSvr.Helper
         public List<u_mattress_mx_mtrl> GetMattressMxSubspecsMtrl(int mattressid)
         {
             var list = new List<u_mattress_mx_mtrl>();
-            var outputFields = @"mattressid,mtrlid,chastr,formulakind,mtrlname";
+            var outputFields = @"mattressid,mtrlid,chastr,formulakind,formulatype,qty,mtrlname";
             var selectStr = @"SELECT
                                 u_mattress_mx_mtrl.mattressid,
                                 u_mattress_mx_mtrl.mattressmxid,
 				                u_mattress_mx_mtrl.mtrlid,
 				                u_mattress_mx_mtrl.chastr,
 				                u_mattress_formula.formulakind,
+				                u_mattress_formula.formulatype,
+				                u_mattress_mx_mtrl.qty,
                                 vv_mtrl_price.mtrlname
 			                FROM u_mattress_mx_mtrl
 			                LEFT JOIN u_mattress_formula On u_mattress_formula.formulaid = u_mattress_mx_mtrl.formulaid
@@ -1969,7 +1972,7 @@ namespace JLHHJSvr.Helper
 		                    ) AS vv_mtrl_price on vv_mtrl_price.mtrlid = u_mattress_mx_mtrl.mtrlid
                                 ";
             var whereList = new List<string>();
-            whereList.Add("u_mattress_formula.formulatype = 1");
+            whereList.Add("u_mattress_formula.formulatype IN (1,2)");
             whereList.Add("u_mtrl_price.if_subspecs = 1");
             whereList.Add("u_mattress_mx_mtrl.mattressid = @mattressid");
 
@@ -2789,27 +2792,6 @@ namespace JLHHJSvr.Helper
 
             DbSqlHelper.Update(cmd, mattress, "js2_flag,js2_auditingdate,js2_auditingrep");
         }
-
-        /// <summary>
-        /// 配对ERP成品
-        /// </summary>
-        /// <param name="mattress"></param>
-        /// <param name="mxlist"></param>
-        /// <exception cref="LJCommonException"></exception>
-        public void MatchERPMtrldef(u_mattress mattress,List<u_mattress_mx_mtrl> mxlist)
-        {
-            if(mattress.mattressid <= 0)
-            {
-                throw new LJCommonException("床垫id有误,请检查!");
-            }
-
-            DbSqlHelper.Update(cmd, mattress, "erp_mtrlid,erp_mtrlcode");
-
-            foreach(var mx in mxlist)
-            {
-                DbSqlHelper.Update(cmd, mx, "erp_mtrlid");
-            }
-        }
         #endregion
 
 
@@ -2821,6 +2803,8 @@ namespace JLHHJSvr.Helper
         /// <param name="ifErp"></param>
         public void SaveMattressPro(u_mattress mattress,bool ifErp = false)
         {
+            SaveMattressCheck(mattress);
+
             var fields = @"mattressname, deptid, mattresscode, mattresstypeid, mattress_width, mattress_length, mattress_height, packtype, packqty, woodpallettype, total_hr_cost,
                             total_material_cost, fees_dscrp, total_fees_cost, total_cost, taxrate, taxes, commissionrate, commission, fob,  profitrate, dept_profitrate, 
                             moneyrate, nottax_factory_cost, nottax_dept_cost, foreign_cost, diameter, area, cabinet_type, hrcost, biandaicost,
@@ -2954,8 +2938,8 @@ namespace JLHHJSvr.Helper
         {
             var bedNetHelper = GetHelper<BedNetHelper>(cmd, context);
             var bednetIndex = 0; // 床网索引
-            var cushionsIndex = 0; // 垫层主副规格物料索引
-            var accessoriesIndex = 0; // 辅料主副规格物料索引
+            var cushionsIndex = 1; // 垫层主副规格物料索引
+            var accessoriesIndex = 1; // 辅料主副规格物料索引
             // 处理副规格的明细内容
             foreach (var childMx in child.mxList)
             {
@@ -3016,8 +3000,8 @@ namespace JLHHJSvr.Helper
                     // 副规格-垫层物料替换
                     if (childMx.if_subspecs == 1 && child.DynamicFields.TryGetValue($"cushions_subspecs_{cushionsIndex}", out var cushions_subspecs))
                     {
-                        cushionsIndex++;
                         childMx.mtrlid = Convert.ToInt32(cushions_subspecs);
+                        cushionsIndex++;
                     }
                 }
 
@@ -3027,8 +3011,10 @@ namespace JLHHJSvr.Helper
                     // 副规格-辅料物料替换
                     if (childMx.if_subspecs == 1 && child.DynamicFields.TryGetValue($"accessories_subspecs_{accessoriesIndex}", out var accessories_subspecs))
                     {
-                        accessoriesIndex++;
+                        child.DynamicFields.TryGetValue($"accessories_subspecs_qty_{accessoriesIndex}", out object accessories_subspecs_qty);
                         childMx.mtrlid = Convert.ToInt32(accessories_subspecs);
+                        childMx.qty = accessories_subspecs_qty == null ? childMx.qty.Value : Convert.ToInt32(accessories_subspecs_qty);
+                        accessoriesIndex++;
                     }
                 }
 
@@ -3174,6 +3160,28 @@ namespace JLHHJSvr.Helper
                 cmd.ExecuteNonQuery();
             }
         }
+
+        public void SaveMattressCheck(u_mattress mattress)
+        {
+            if (mattress == null) throw new LJCommonException("床垫报价保存失败,数据异常!");
+            if (mattress.mxList == null || mattress.mxList.Count <= 0) throw new LJCommonException("床垫报价保存失败,明细内容为空!");
+
+            // 1.卷包包装必须有卷包直径
+            if(mattress.packtype == 1 && mattress.diameter <= 0)
+            {
+                throw new LJCommonException("卷包直径有误,卷包包装必须有卷包直径!");
+            }
+
+            // 特殊工艺数量汇总
+            if(mattress.extraList != null && mattress.extraList.Count > 0)
+            {
+                foreach(var mx in mattress.extraList)
+                {
+                    var sumQty = mattress.mxList.Where(t => t.mtrlname.Trim().Equals(mx.extraname.Trim())).Sum(t => t.qty ?? 0);
+                    mx.qty = sumQty;
+                }
+            }
+        }
         #endregion
 
         #region 公式计算通用方法

+ 154 - 15
JLHHJSvr/Helper/SoftBedHelper.cs

@@ -1,8 +1,11 @@
 using JLHHJSvr.BLL;
 using JLHHJSvr.Com.Model;
+using JLHHJSvr.LJException;
+using JLHHJSvr.Tools;
 using LJLib.DAL.SQL;
 using NPOI.SS.Formula.Functions;
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -19,14 +22,13 @@ namespace JLHHJSvr.Helper
 		/// <param name="billid"></param>
 		/// <param name="fields"></param>
 		/// <param name="bill"></param>
-        public u_softbed GetSoftBed(int billid,string fields)
+        public u_softbed GetSoftBed(int billid,string fields = null)
         {
             fields = fields ?? @"softbed_id,softbed_code,softbed_name,deptid,create_time,create_by,mtrlmode,mtrltype,has_headboard,has_nightstand,has_bedframe,is_template,
                                 template_id,template_code,template_name,commission,taxes,other_rate,extras_cost,moneyrate,dscrp,costamt,nottax_factory_cost,nottax_dept_cost,
                                 dept_cost,foreign_cost";
             var bill = new u_softbed() { softbed_id = billid };
-            DbSqlHelper.SelectOne(cmd, bill, fields);
-
+			if (DbSqlHelper.SelectOne(cmd, bill, fields) == 0) return null;
 			return bill;
         }
 
@@ -85,18 +87,17 @@ namespace JLHHJSvr.Helper
                             })
                             .ToList();
         }
-
 		/// <summary>
 		/// 获取软床报价单据明细
 		/// </summary>
 		/// <param name="billid"></param>
 		/// <param name="fields"></param>
 		/// <param name="mxlist"></param>
-        public void GetSoftBedMxList(int billid, string fields, out List<u_softbed_mx> mxlist)
+        public List<u_softbed_mx> GetSoftBedMxList(int billid, string fields = null)
         {
-            GetSoftBedMxList(billid, fields, out mxlist, out _);
+            GetSoftBedMxList(billid, fields, out var mxlist, out _);
+			return mxlist;
         }
-
         /// <summary>
         /// 根据部件配置项值获取对应BOM明细
         /// </summary>
@@ -147,13 +148,9 @@ namespace JLHHJSvr.Helper
 				foreach(var item in resultList)
 				{
 					mxlist.Add(InitSoftBedMxFromBom(item));
-
-					// 
 				}
 			}
-
-
-			return null;
+			return mxlist;
         }
 
 		public u_softbed_mx InitSoftBedMxFromBom(u_configure_codemxbom bomItem)
@@ -190,11 +187,155 @@ namespace JLHHJSvr.Helper
 			mx.actual_useqty = mx.useqty * mx.loss_rate;
 			// 成本金额: 实际用量 * 成本单价
 			mx.cost_amt = mx.actual_useqty * mx.cost_price;
-
 			return mx;
         }
 
+		/// <summary>
+		/// 新建/修改 软床报价
+		/// </summary>
+		/// <param name="softbed"></param>
+		/// <exception cref="LJCommonException"></exception>
+		public void SaveSoftBed(u_softbed softbed)
+		{
+			if (softbed == null) throw new LJCommonException("软床报价保存失败,数据异常!");
+			if (softbed.mxList == null || softbed.mxList.Count <= 0) throw new LJCommonException("软床报价保存失败,明细内容为空!");
+
+			// 初始化属性
+			AutoInit.AutoInitS(softbed);
+
+			foreach(var mx in softbed.mxList)
+			{
+				AutoInit.AutoInitS(mx);
+			}
+
+			// TODO:计算价格
+
+			//
+            var dtNow = DateTime.Now;
+			var fields = @"softbed_name,deptid,mtrlmode,mtrltype,has_headboard,has_nightstand,has_bedframe,is_template,
+                            template_id,template_code,template_name,commission,taxes,other_rate,extras_cost,moneyrate,dscrp,costamt,nottax_factory_cost,nottax_dept_cost,
+                            dept_cost,foreign_cost";
+
+			var mx_fields = @"softbed_id,printid,pzid,pz_printid,mtrlid,mtrlname,mtrlcode,mtrlmode,unit,has_type,allow_edit,cutting_length,cutting_width,cutting_qty,
+							useqty,use_formula,use_formula_str,actual_useqty,loss_rate,price,price_formula,price_formula_str,cost_price,cost_amt,pzname,pzmxname";
+
+			if(softbed.softbed_id == 0)
+			{
+				// 新建
+				fields += ",softbed_id,softbed_code,create_time,create_by";
+
+                softbed.softbed_id = BllHelper.GetID(cmd, "u_softbed");
+                softbed.create_time = dtNow;
+                softbed.create_by = context.tokendata.username;
+
+                if (string.IsNullOrEmpty(softbed.softbed_code))
+                {
+                    // 编号-年月日+流水
+                    softbed.softbed_code = $"RC-{dtNow.ToString("yyyyMMdd")}{(softbed.softbed_id % 10000).ToString("D4")}";
+                }
+
+                DbSqlHelper.Insert(cmd, "u_softbed", null, softbed, fields);
+            } else
+			{
+                // 修改
+                cmd.CommandText = @"DELETE FROM u_softbed_mx WHERE softbed_id = @softbed_id";
+                cmd.Parameters.Clear();
+                cmd.Parameters.AddWithValue("@softbed_id", softbed.softbed_id);
+                cmd.ExecuteNonQuery();
+
+                DbSqlHelper.Update(cmd, "u_softbed", null, softbed, "softbed_id", fields);
+            }
+
+            for (int i = 0; i < softbed.mxList.Count; i++)
+            {
+                var mx = softbed.mxList[i];
+
+                mx.softbed_id = softbed.softbed_id;
+				mx.printid = i + 1;
+
+				DbSqlHelper.Insert(cmd, "u_softbed_mx", null, mx, mx_fields);
+            }
+        }
+
+		/// <summary>
+		/// 复制软床报价
+		/// </summary>
+		/// <param name="softbed"></param>
+		/// <param name="newId"></param>
+        public void CopySoftBed(u_softbed softbed, out int newId)
+        {
+			var fields = @"softbed_code,mtrlmode,mtrltype,has_headboard,has_nightstand,has_bedframe,is_template,
+                            template_id,template_code,template_name,commission,taxes,other_rate,extras_cost,moneyrate,dscrp";
+            var softbed_copy = GetSoftBed(softbed.softbed_id, fields);
+
+
+            // 判断copy_bedNet.bednetcode是否存在@@字符串,如果存在,则删除@@后面的字符串,包括@@
+            if (softbed_copy.softbed_code.IndexOf("@@") > -1)
+            {
+                softbed_copy.softbed_code = softbed_copy.softbed_code.Substring(softbed_copy.softbed_code.IndexOf("@@"));
+            }
+
+            softbed_copy.softbed_code += " @@";
+            softbed_copy.softbed_code += DateTime.Now.ToString("yyyMMdd_mmhhss");
+            softbed_copy.softbed_id = 0;
+
+            SaveSoftBed(softbed_copy);
+
+            newId = softbed_copy.softbed_id;
+        }
+
+        /// <summary>
+        /// 删除软床报价
+        /// </summary>
+        /// <param name="billid"></param>
+        /// <exception cref="LJCommonException"></exception>
+        public void DeleteSoftBed(int billid)
+		{
+			var softbed = GetSoftBed(billid, "softbed_code,flag");
+
+			if (softbed == null) throw new LJCommonException($"单据不存在,请检查! billid:{billid}");
+
+			if (softbed.flag == 1) throw new LJCommonException($"单据:{softbed.softbed_code}已审核,无法删除!");
+
+			DbSqlHelper.Delete(cmd, softbed);
+		}
+
+		/// <summary>
+		/// 审核软床报价
+		/// </summary>
+		/// <param name="billid"></param>
+		/// <exception cref="LJCommonException"></exception>
+		public void AuditSoftBed(int billid)
+        {
+            var softbed = GetSoftBed(billid, "softbed_code,flag");
+
+            if (softbed == null) throw new LJCommonException($"单据不存在,请检查! billid:{billid}");
+
+            if (softbed.flag == 1) throw new LJCommonException($"单据:{softbed.softbed_code}未撤审,无法审核!");
+
+			softbed.flag = 1;
+            DbSqlHelper.Update(cmd, "u_softbed",null,softbed, "softbed_id", "flag");
+        }
+
+		/// <summary>
+		/// 撤审软床报价
+		/// </summary>
+		/// <param name="billid"></param>
+		/// <exception cref="LJCommonException"></exception>
+        public void CAuditSoftBed(int billid)
+        {
+            var softbed = GetSoftBed(billid, "softbed_code,flag");
+
+            if (softbed == null) throw new LJCommonException($"单据不存在,请检查! billid:{billid}");
+
+            if (softbed.flag == 0) throw new LJCommonException($"单据:{softbed.softbed_code}未审核,无法撤审!");
+
+			softbed.flag = 0;
+            DbSqlHelper.Update(cmd, "u_softbed", null, softbed, "softbed_id", "flag");
+        }
+
         #region 通用公式方法
+        private HashSet<CalCulationFormula> const_formula = new HashSet<CalCulationFormula>();
         private string ConvertToEnglishSymbols(string input)
         {
             input = input.Replace("(", "(")
@@ -213,8 +354,6 @@ namespace JLHHJSvr.Helper
         private void FormatExpression(string expression)
 		{
             expression = ConvertToEnglishSymbols(expression);
-
-
         }
         #endregion
     }

+ 7 - 0
JLHHJSvr/JLHHJSvr.csproj

@@ -92,6 +92,7 @@
     <Compile Include="Com\AuditDept.cs" />
     <Compile Include="Com\AuditMattressBcp.cs" />
     <Compile Include="Com\AuditPriceList.cs" />
+    <Compile Include="Com\AuditSoftBedQuote.cs" />
     <Compile Include="Com\AuditSpring.cs" />
     <Compile Include="Com\AuditWorkmanship.cs" />
     <Compile Include="Com\BanMtrlDef.cs" />
@@ -104,6 +105,7 @@
     <Compile Include="Com\CreatPrdPf.cs" />
     <Compile Include="Com\DeleteMattressExtraType.cs" />
     <Compile Include="Com\DeleteMattressExtra.cs" />
+    <Compile Include="Com\DeleteSoftBedQuote.cs" />
     <Compile Include="Com\GetBedNetInterfaceList.cs" />
     <Compile Include="Com\GetComputeMattressById.cs" />
     <Compile Include="Com\GetResetWiptype.cs" />
@@ -114,6 +116,7 @@
     <Compile Include="Com\ChangePassword.cs" />
     <Compile Include="Com\Model\BaseInterface.cs" />
     <Compile Include="Com\Model\BaseInterfaceQd.cs" />
+    <Compile Include="Com\Model\CalCulationFormula.cs" />
     <Compile Include="Com\Model\Sys_oplog.cs" />
     <Compile Include="Com\Model\u_bednet_interface.cs" />
     <Compile Include="Com\Model\u_bednet_interface_qd.cs" />
@@ -139,6 +142,7 @@
     <Compile Include="Com\SaveBedNetInterface.cs" />
     <Compile Include="Com\SaveMattressExtraType.cs" />
     <Compile Include="Com\SaveMattressExtra.cs" />
+    <Compile Include="Com\SaveSoftBedQuote.cs" />
     <Compile Include="Com\UnLockUser.cs" />
     <Compile Include="Com\UpdateL1Basicinfo.cs" />
     <Compile Include="Com\UpdateMtrlPrice.cs" />
@@ -313,6 +317,7 @@
     <Compile Include="Excutor\AuditDeptExcutor.cs" />
     <Compile Include="Excutor\AuditMattressBcpExcutor.cs" />
     <Compile Include="Excutor\AuditPriceListExcutor.cs" />
+    <Compile Include="Excutor\AuditSoftBedQuoteExcutor.cs" />
     <Compile Include="Excutor\AuditSpringExcutor.cs" />
     <Compile Include="Excutor\AuditWorkmanshipExcutor.cs" />
     <Compile Include="Excutor\BanMtrlDefExcutor.cs" />
@@ -325,6 +330,7 @@
     <Compile Include="Excutor\CreatPrdPfExcutor.cs" />
     <Compile Include="Excutor\DeleteMattressExtraTypeExcutor.cs" />
     <Compile Include="Excutor\DeleteMattressExtraExcutor.cs" />
+    <Compile Include="Excutor\DeleteSoftBedQuoteExcutor.cs" />
     <Compile Include="Excutor\FormulaCheckExcutor.cs" />
     <Compile Include="Excutor\GetBedNetInterfaceListExcutor.cs" />
     <Compile Include="Excutor\GetComputeMattressByIdExcutor.cs" />
@@ -341,6 +347,7 @@
     <Compile Include="Excutor\SaveBedNetInterfaceExcutor.cs" />
     <Compile Include="Excutor\SaveMattressExtraTypeExcutor.cs" />
     <Compile Include="Excutor\SaveMattressExtraExcutor.cs" />
+    <Compile Include="Excutor\SaveSoftBedQuoteExcutor.cs" />
     <Compile Include="Excutor\UnLockUserExcutor.cs" />
     <Compile Include="Excutor\UpdateL1BasicinfoExcutor.cs" />
     <Compile Include="Excutor\UpdateMtrlPriceExcutor.cs" />

+ 3 - 0
JLHWEB/src/api/interface/index.ts

@@ -1397,4 +1397,7 @@ export namespace Mattress {
     formulas_bednet: any;
     differ?: any;
   }
+  export interface ResSoftBed {
+    softbed: any;
+  }
 }

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

@@ -239,3 +239,38 @@ export const GetBedNetInterfaceList = (params: Mattress.ReqRefreshMattressInterf
 export const SaveBedNetInterface = (params: Mattress.ReqSaveMattressInterface) => {
   return http.post<Mattress.ResSaveMattressBcp>(PORT1 + `/SaveBedNetInterface`, params);
 };
+
+/**
+ * @name 软床报价:保存/修改
+ */
+export const SaveSoftBedQuote = (params: Mattress.ReqSaveMattressInterface) => {
+  return http.post<Mattress.ResSaveMattressBcp>(PORT1 + `/SaveSoftBedQuote`, params);
+};
+
+/**
+ * @name 软床报价:删除
+ */
+export const DeleteSoftBedQuote = (params: Mattress.ReqMultiMattressBcp) => {
+  return http.post(PORT1 + `/DeleteSoftBedQuote`, params);
+};
+
+/**
+ * @name 软床报价:审核
+ */
+export const AuditSoftBedQuote = (params: Mattress.ReqMultiMattressBcp) => {
+  return http.post(PORT1 + `/AuditSoftBedQuote`, params);
+};
+
+/**
+ * @name 软床报价:查看历史报价
+ */
+export const ViewHisSoftBedQuote = (params: Mattress.ReqSaveMattressInterface) => {
+  return http.post<Mattress.ResSaveMattressBcp>(PORT1 + `/ViewHisSoftBedQuote`, params);
+};
+
+/**
+ * @name 软床报价:显示公式
+ */
+export const ShowSoftBedQuoteFml = (params: Mattress.ReqSaveMattressInterface) => {
+  return http.post<Mattress.ResSaveMattressBcp>(PORT1 + `/ShowSoftBedQuoteFml`, params);
+};

+ 9 - 1
JLHWEB/src/enums/dwnameEnum.ts

@@ -177,5 +177,13 @@ export enum DwnameEnum {
   /**
    * @description 床网接口清单
    */
-  bednetInterfaceQd = "u_bednet_interface_qd"
+  bednetInterfaceQd = "u_bednet_interface_qd",
+  /*
+   * @description 软床报价
+   */
+  softbedQuote = "u_softbed",
+  /*
+   * @description 软床报价明细
+   */
+  softbedQuoteMx = "u_softbed_mx"
 }

+ 5 - 1
JLHWEB/src/enums/mittEnum.ts

@@ -25,5 +25,9 @@ export enum MittEnum {
   /**
    * @description 床垫半成品报价刷新
    */
-  MattressBcpList = "MattressBcpList"
+  MattressBcpList = "MattressBcpList",
+  /**
+   * @description 软床报价刷新
+   */
+  SoftBedList = "SoftBedList"
 }

+ 6 - 1
JLHWEB/src/languages/modules/zh-cn/menu.json

@@ -170,5 +170,10 @@
   "bednetInterfaceDetail": "床网清单详情",
   "bednetInterfaceEditYw": "修改床网清单",
   "erpapi": "ERP接口",
-  "extra": "床垫额外费用定义"
+  "extra": "床垫额外费用定义",
+  "softbedQuote": "软床报价",
+  "softbedQuoteDetail": "软床报价详情",
+  "softbedQuoteEdit": "修改软床报价",
+  "softbedQuoteAdd": "新建软床报价",
+  "softbedQuoteCopy": "复制软床报价"
 }

+ 87 - 0
JLHWEB/src/routers/modules/softbedQuoteRouter.ts

@@ -0,0 +1,87 @@
+import type { Menu } from "@/typings/global";
+/**
+ * @argument name 软床报价
+ */
+export const softbedQuoteRouter: Menu.MenuOptions[] = [
+  {
+    path: "/softbedQuote",
+    name: "softbedQuote",
+    component: "/quote/softbedQuote/index",
+    meta: {
+      icon: "Common_Business.png",
+      title: "软床报价",
+      isLink: "",
+      isHide: false,
+      isFull: false,
+      isAffix: false,
+      isKeepAlive: true,
+      funid: 61
+    },
+    children: [
+      {
+        path: "/softbedQuote/detail",
+        name: "softbedQuoteDetail",
+        component: "/quote/softbedQuote/detail",
+        meta: {
+          icon: "iconpackage",
+          title: "软床报价详情",
+          isLink: "",
+          isHide: true,
+          isFull: false,
+          isAffix: false,
+          isKeepAlive: true,
+          funid: 61,
+          activeMenu: "/softbedQuote"
+        }
+      },
+      {
+        path: "/softbedQuote/new",
+        name: "softbedQuoteAdd",
+        component: "/quote/softbedQuote/detail",
+        meta: {
+          icon: "iconuser-01",
+          title: "新增软床报价",
+          isLink: "",
+          isHide: true,
+          isFull: false,
+          isAffix: false,
+          isKeepAlive: true,
+          funid: 62,
+          activeMenu: "/softbedQuote"
+        }
+      },
+      {
+        path: "/softbedQuote/edit",
+        name: "softbedQuoteEdit",
+        component: "/quote/softbedQuote/detail",
+        meta: {
+          icon: "iconuser-01",
+          title: "修改软床报价",
+          isLink: "",
+          isHide: true,
+          isFull: false,
+          isAffix: false,
+          isKeepAlive: true,
+          funid: 62,
+          activeMenu: "/softbedQuote"
+        }
+      },
+      {
+        path: "/softbedQuote/copy",
+        name: "softbedQuoteCopy",
+        component: "/quote/softbedQuote/detail",
+        meta: {
+          icon: "iconuser-01",
+          title: "复制软床报价",
+          isLink: "",
+          isHide: true,
+          isFull: false,
+          isAffix: false,
+          isKeepAlive: true,
+          funid: 75,
+          activeMenu: "/softbedQuote"
+        }
+      }
+    ]
+  }
+];

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

@@ -342,6 +342,22 @@
             :footer-method="footerMethod"
           >
             <template #tableHeader v-if="orderStatus">
+              <el-space wrap>
+                <el-dropdown placement="bottom-start" @command="val => funcAddGongYi(val)">
+                  <el-button type="primary"
+                    >新增工艺<el-icon class="el-icon--right"><ArrowDown /></el-icon>
+                  </el-button>
+                  <template #dropdown>
+                    <el-dropdown-menu>
+                      <el-dropdown-item v-for="item in fabricMx13NewMtrlGroup" :key="item.value" :command="item">{{
+                        item.label
+                      }}</el-dropdown-item>
+                    </el-dropdown-menu>
+                  </template>
+                </el-dropdown>
+                <el-button type="danger" @click="handleDelFabricMxNewMtrlGroup('tabpage_13')">删除工艺</el-button>
+              </el-space>
+              <el-divider direction="vertical" />
               <el-space wrap>
                 <el-button type="default" @click="toMove(1, 'fabricMxTab13Ref')">{{ t("common.moveUp") }}</el-button>
                 <el-button type="default" @click="toMove(-1, 'fabricMxTab13Ref')">{{ t("common.moveDown") }}</el-button>
@@ -872,6 +888,7 @@ const {
   fabricMxTab13,
   fabricMx10NewMtrlGroup,
   fabricMx11NewMtrlGroup,
+  fabricMx13NewMtrlGroup,
   initParams,
   cushionsMxData,
   fabricMxData,
@@ -943,7 +960,8 @@ const {
   autoLoadExtraData,
   autoLoadExtraData_chai,
   getAllFormulaList,
-  setMxSpringQtyWidthAndLength
+  setMxSpringQtyWidthAndLength,
+  funcAddGongYi
 } = useHooks(t);
 const { toExcelQuote, toExcelQuoteNew } = useHooksCpQuote();
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
@@ -1497,9 +1515,16 @@ const dataCallbackSubspecs = (data: any) => {
     let mtrlList = data.mtrllist.filter((t: any) => t.mattressid == item.mattressid);
     if (mtrlList.length > 0) {
       mtrlList.map((bItem, idx) => {
-        _item["cushions_subspecs_" + (idx + 1)] = bItem.mtrlid;
-        _item["cushions_subspecs_formulakind_" + (idx + 1)] = bItem.formulakind;
-        _item["cushions_subspecs_mtrlname_" + (idx + 1)] = bItem.mtrlname;
+        if (bItem.formulatype === 1) {
+          _item["cushions_subspecs_" + (idx + 1)] = bItem.mtrlid;
+          _item["cushions_subspecs_formulakind_" + (idx + 1)] = bItem.formulakind;
+          _item["cushions_subspecs_mtrlname_" + (idx + 1)] = bItem.mtrlname;
+        } else if (bItem.formulatype === 2) {
+          _item["accessories_subspecs_" + (idx + 1)] = bItem.mtrlid;
+          _item["accessories_subspecs_formulakind_" + (idx + 1)] = bItem.formulakind;
+          _item["accessories_subspecs_mtrlname_" + (idx + 1)] = bItem.mtrlname;
+          _item["accessories_subspecs_qty_" + (idx + 1)] = bItem.qty;
+        }
       });
     }
     return _item;
@@ -1793,7 +1818,14 @@ const save = async () => {
           });
         }
 
-        const prefixes = ["spring_qty_width", "spring_qty_length", "bednet_iffork", "bednet_fork_qty"];
+        const prefixes = [
+          "spring_qty_width",
+          "spring_qty_length",
+          "bednet_iffork",
+          "bednet_fork_qty",
+          "cushions_subspecs",
+          "accessories_subspecs"
+        ];
         subspecs = subspecs.map(itm => {
           itm.mattress_width = Number(itm.mattress_width ?? 0);
           itm.mattress_length = Number(itm.mattress_length ?? 0);
@@ -2480,6 +2512,19 @@ const handleSelFabricMxNewMtrlGroup = async (target: string, item: any) => {
       arg_array_formulatype: [0, 1, 2, 3]
     };
     await funcAddMxSide(_params, item, fabricMxTab11Ref.value);
+  } else if (target == "tabpage_13") {
+    // 拉手刺绣及其他工艺
+    const $table = fabricMxTab13Ref.value?.element;
+    const { visibleData } = $table.getTableData();
+
+    let _params = {
+      arg_array_formulatype: [0],
+      arg_array_not_formulakind: [
+        0, 80, 40, 50, 60, 70, 1, 81, 41, 51, 61, 71, 2, 82, 42, 52, 62, 72, 3, 83, 43, 53, 63, 73, 4, 84, 44, 54, 64, 74, 9000,
+        9001, 9002, 9003, 9004, 9005, 9006
+      ]
+    };
+    await funcAddMxSide(_params, item, fabricMxTab13Ref.value);
   }
 };
 
@@ -2490,6 +2535,8 @@ const handleDelFabricMxNewMtrlGroup = (target: string) => {
     $table = fabricMxTab10Ref.value?.element;
   } else if (target == "tabpage_11") {
     $table = fabricMxTab11Ref.value?.element;
+  } else if (target == "tabpage_13") {
+    $table = fabricMxTab13Ref.value?.element;
   }
 
   if ($table) {
@@ -2535,6 +2582,18 @@ const handleDelFabricMxNewMtrlGroup = (target: string) => {
           $table.remove(_arr);
 
           fabricMxTab11.value = visibleData.filter((t, idx) => !_idx.includes(idx));
+        } else if (target == "tabpage_13") {
+          let _arr = [];
+          let _idx = [];
+          fabricMxTab13.value.map((t, idx) => {
+            if (t.sortcode == sameMx[0].sortcode) {
+              _arr.push(t);
+              _idx.push(idx);
+            }
+          });
+          $table.remove(_arr);
+
+          fabricMxTab13.value = visibleData.filter((t, idx) => !_idx.includes(idx));
         }
       })
       .catch((e: TypeError) => {
@@ -2940,6 +2999,8 @@ const toDelMx_accessories = () => {
     if (curRecords.length) {
       try {
         $table.remove(curRecords);
+
+        updateSubspecsTable();
       } catch (error) {
         ElMessage.error(error.message);
         return false;

+ 160 - 12
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

@@ -80,6 +80,10 @@ interface defaultState {
    * @description 面料明细数据-裥小侧 新增
    */
   fabricMx11NewMtrlGroup: any[];
+  /**
+   * @description 面料明细数据-拉手刺绣及其他工艺 新增
+   */
+  fabricMx13NewMtrlGroup: any[];
   /**
    * @description 床垫类型枚举
    */
@@ -324,6 +328,44 @@ export const useHooks = (t?: any) => {
         value: 4
       }
     ],
+    fabricMx13NewMtrlGroup: [
+      {
+        label: "拉手",
+        value: 5
+      },
+      {
+        label: "刺绣",
+        value: 6
+      },
+      {
+        label: "大侧压压布",
+        value: 7
+      },
+      {
+        label: "大侧压边带",
+        value: 8
+      },
+      {
+        label: "大侧压织带",
+        value: 9
+      },
+      {
+        label: "大侧压上下压线",
+        value: 10
+      },
+      {
+        label: "防火线",
+        value: 30
+      },
+      {
+        label: "拉链",
+        value: 202
+      },
+      {
+        label: "骨条",
+        value: 206
+      }
+    ],
     mattresstypeEnum: {},
     oriMxData: {},
     initParams: { arg_mattressid: 0 },
@@ -1445,7 +1487,7 @@ export const useHooks = (t?: any) => {
     data.shrinkage = 0;
     data.thickness = 0;
     data.price_formula = "";
-    data.qty = "";
+    data.qty = 1;
 
     if ($table) {
       $table.clearEdit();
@@ -1986,6 +2028,32 @@ export const useHooks = (t?: any) => {
     });
   };
 
+  const funcAddGongYi = (item: any) => {
+    const $table = state.fabricMxTab13Ref.element;
+    const result = state.mattressFormulaList.filter(t => t.formulatype === 0 && t.formulakind === +item.value);
+    result.map(itm => {
+      let records: any = {
+        formulatype: itm.formulatype,
+        if_mtrl: Number(itm.if_mtrl),
+        formulaid: itm.formulaid,
+        sortcode: itm.sortcode,
+        chastr: "",
+        costamt: 0,
+        formulakind: Number(itm.formulakind),
+        formula: itm.formula,
+        useformula: itm.useformula,
+        gydscrp: itm.gydscrp
+      };
+
+      if (records.if_mtrl > 1) {
+        records.addmx = "+";
+        records.delmx = "-";
+      }
+
+      $table.insertAt(records, -1);
+    });
+  };
+
   /**
    * @description 据字符串'myRef'来获取ref
    * @param name
@@ -4513,6 +4581,69 @@ export const useHooks = (t?: any) => {
       field: "chastr",
       visible: false
     },
+    {
+      title: "+",
+      field: "addmx",
+      width: 80,
+      render: (scope: any) => {
+        let _if_mtrl = Number(scope.row.if_mtrl);
+        if (_if_mtrl > 1) {
+          if (state.orderStatus) {
+            return (
+              <ElPopconfirm
+                width="220"
+                icon={InfoFilled}
+                title={t("business.tips.mattress.addMx")}
+                confirm-button-text={t("common.addText")}
+                onConfirm={() => funcAddMtrlMx(scope)}
+              >
+                {{
+                  reference: () => {
+                    return <ElButton type="primary" plain circle icon={Plus}></ElButton>;
+                  }
+                }}
+              </ElPopconfirm>
+            );
+          } else {
+            return "+";
+          }
+        } else {
+          return "";
+        }
+      }
+    },
+    {
+      title: "-",
+      field: "delmx",
+      width: 80,
+      render: (scope: any) => {
+        let _if_mtrl = Number(scope.row.if_mtrl);
+        if (_if_mtrl > 1) {
+          if (state.orderStatus) {
+            return (
+              <ElPopconfirm
+                width="220"
+                icon={InfoFilled}
+                title={t("business.tips.mattress.delMx")}
+                confirm-button-text={t("common.delText")}
+                confirm-button-type="danger"
+                onConfirm={() => funcDelBednet(scope, null, "accessoriesMxRef")}
+              >
+                {{
+                  reference: () => {
+                    return <ElButton type="danger" plain circle icon={Minus} />;
+                  }
+                }}
+              </ElPopconfirm>
+            );
+          } else {
+            return "-";
+          }
+        } else {
+          return "";
+        }
+      }
+    },
     {
       title: "物料",
       field: "mtrlname",
@@ -5779,7 +5910,7 @@ export const useHooks = (t?: any) => {
 
     let _remove = [];
     tgVisibleData.map(t => {
-      if (t.extraid == arg_extraid && mtrlItem.mtrlid == t?.mtrlid) {
+      if (t.extraid == arg_extraid || mtrlItem.mtrlid == t?.mtrlid) {
         _remove.push(t);
       }
     });
@@ -5812,7 +5943,7 @@ export const useHooks = (t?: any) => {
           dscrp: o.dscrp,
           inputtype: o.inputtype,
           typeid: o.typeid,
-          mtrlid: mtrlItem.mtrlid
+          mtrlid: mtrlItem?.mtrlid
         };
         _arr.push(_itm);
       });
@@ -6109,16 +6240,12 @@ export const useHooks = (t?: any) => {
             let _field = "accessories_subspecs_" + (idx + 1);
             let _mtrlname = "accessories_subspecs_mtrlname_" + (idx + 1);
             let _formulakind = "accessories_subspecs_formulakind_" + (idx + 1);
+            let _qty_field = "accessories_subspecs_qty_" + (idx + 1);
 
-            idx++;
-            visibleData = visibleData.map(itm => {
-              itm[_formulakind] = item.formulakind;
-              return itm;
-            });
-
-            let itmName = state.formulaKindEnum.find(t => t.value == item.formulakind)?.label ?? "";
+            let itmName = state.formulaKindEnum.find(t => Number(t.value) === Number(item.formulakind))?.label ?? "";
+            // 物料
             cols.push({
-              title: "辅料物料-" + itmName + " " + (index + 1),
+              title: "辅料物料-" + itmName + " " + (idx + 1),
               field: _mtrlname,
               width: "200",
               editRender: {},
@@ -6179,6 +6306,26 @@ export const useHooks = (t?: any) => {
                 );
               }
             });
+            // 数量
+            cols.push({
+              title: `辅料物料数量-${itmName}${idx + 1}`,
+              field: "accessories_subspecs_qty_" + (idx + 1),
+              datatype: "integer",
+              editRender: {
+                name: "$input"
+              }
+            });
+
+            // 初始化值
+            visibleData.forEach(sub => {
+              if (!(_field in sub)) {
+                sub[_field] = item.mtrlid;
+                sub[_mtrlname] = item.mtrlname;
+                sub[_formulakind] = item.formulakind;
+              }
+            });
+
+            idx++;
           }
         });
         // }
@@ -6257,6 +6404,7 @@ export const useHooks = (t?: any) => {
     autoLoadExtraData,
     autoLoadExtraData_chai,
     getAllFormulaList,
-    setMxSpringQtyWidthAndLength
+    setMxSpringQtyWidthAndLength,
+    funcAddGongYi
   };
 };

+ 200 - 0
JLHWEB/src/views/quote/softbedQuote/components/BedConfigModal.vue

@@ -0,0 +1,200 @@
+<template>
+  <LjDialogNew
+    v-model="visible"
+    width="600px"
+    :close-on-click-modal="false"
+    :modal-append-to-body="false"
+    :destroy-on-close="true"
+  >
+    <template #header>
+      <div class="flx-1">
+        <span class="text-h5-b">配置项值选择</span>
+      </div>
+    </template>
+
+    <div class="checkbox-area">
+      <el-checkbox v-model="showHeadboard" label="床头" border></el-checkbox>
+      <el-checkbox v-model="showNightstand" label="床头柜" border></el-checkbox>
+      <el-checkbox v-model="showBedframe" label="床架" border></el-checkbox>
+    </div>
+
+    <div class="config-sections config-scroll-container">
+      <ConfigSection
+        v-if="showHeadboard"
+        part-name="床头"
+        :config-items="headboardConfigs"
+        :config-item-options="configItemOptions"
+        :config-value-options-map="configValueOptionsMap"
+        @removeConfigItem="removeConfigItem('headboard', $event)"
+        @addConfigItem="addConfigItem('headboard')"
+      />
+
+      <ConfigSection
+        v-if="showNightstand"
+        part-name="床头柜"
+        :config-items="nightstandConfigs"
+        :config-item-options="configItemOptions"
+        :config-value-options-map="configValueOptionsMap"
+        @removeConfigItem="removeConfigItem('nightstand', $event)"
+        @addConfigItem="addConfigItem('nightstand')"
+      />
+
+      <ConfigSection
+        v-if="showBedframe"
+        part-name="床架"
+        :config-items="bedframeConfigs"
+        :config-item-options="configItemOptions"
+        :config-value-options-map="configValueOptionsMap"
+        @removeConfigItem="removeConfigItem('bedframe', $event)"
+        @addConfigItem="addConfigItem('bedframe')"
+      />
+    </div>
+
+    <template #footer>
+      <el-button @click="onCancel">取消</el-button>
+      <el-button type="primary" @click="onConfirm">确认配置</el-button>
+    </template>
+  </LjDialogNew>
+</template>
+
+<script setup lang="ts">
+import { ref, reactive } from "vue";
+import ConfigSection from "./ConfigSection.vue";
+import LjDialogNew from "@/components/LjDialog/index-new.vue";
+
+interface SelectOption {
+  label: string;
+  value: string;
+}
+
+interface ConfigValue {
+  pzid: number;
+  printid: number;
+  pznamemx: string;
+}
+
+interface ConfigItem {
+  pzid: number;
+  pzname: string;
+  valueList: ConfigValue[];
+  selectedValue?: string;
+}
+
+const visible = ref(true);
+
+const showHeadboard = ref(true);
+const showNightstand = ref(true);
+const showBedframe = ref(false);
+
+// 下拉选项
+const configItemOptions: SelectOption[] = [
+  { label: "颜色", value: "颜色" },
+  { label: "材质", value: "材质" },
+  { label: "款式", value: "款式" },
+  { label: "尺寸", value: "尺寸" }
+];
+
+// 各配置项对应的选配值选项Map(key为配置项名)
+const configValueOptionsMap: Record<string, SelectOption[]> = {
+  颜色: [
+    { label: "白色", value: "白色" },
+    { label: "红色", value: "红色" },
+    { label: "黑色", value: "黑色" }
+  ],
+  材质: [
+    { label: "实木", value: "实木" },
+    { label: "皮质", value: "皮质" },
+    { label: "布艺", value: "布艺" }
+  ],
+  款式: [
+    { label: "现代", value: "现代" },
+    { label: "简约", value: "简约" }
+  ],
+  尺寸: [
+    { label: "90cm", value: "90cm" },
+    { label: "120cm", value: "120cm" }
+  ]
+};
+
+// 各部件配置数据
+const headboardConfigs = reactive<ConfigItem[]>([
+  {
+    pzid: 101,
+    pzname: "颜色",
+    valueList: [
+      { pzid: 101, printid: 1, pznamemx: "白色" },
+      { pzid: 101, printid: 2, pznamemx: "红色" }
+    ],
+    selectedValue: "白色"
+  }
+]);
+
+const nightstandConfigs = reactive<ConfigItem[]>([
+  {
+    pzid: 201,
+    pzname: "材质",
+    valueList: [
+      { pzid: 201, printid: 1, pznamemx: "皮质" },
+      { pzid: 201, printid: 2, pznamemx: "布艺" }
+    ],
+    selectedValue: "皮质"
+  }
+]);
+
+const bedframeConfigs = reactive<ConfigItem[]>([]);
+
+function removeConfigItem(part: string, index: number) {
+  if (part === "headboard") headboardConfigs.splice(index, 1);
+  else if (part === "nightstand") nightstandConfigs.splice(index, 1);
+  else if (part === "bedframe") bedframeConfigs.splice(index, 1);
+}
+
+function addConfigItem(part: string) {
+  const newItem: ConfigItem = {
+    pzid: Date.now(),
+    pzname: "",
+    valueList: [],
+    selectedValue: ""
+  };
+  if (part === "headboard") headboardConfigs.push(newItem);
+  else if (part === "nightstand") nightstandConfigs.push(newItem);
+  else if (part === "bedframe") bedframeConfigs.push(newItem);
+}
+
+function onCancel() {
+  visible.value = false;
+  // 如果有重置操作也放这里
+}
+
+function onConfirm() {
+  // 你可以在这里收集、校验选配数据
+  // 比如 console.log 当前配置项等
+  visible.value = false;
+}
+</script>
+
+<style lang="scss">
+/* 弹窗最大高度限制,防止无限撑大 */
+.el-dialog {
+  max-height: 80vh;
+  display: flex;
+  flex-direction: column;
+}
+</style>
+
+<style scoped lang="scss">
+.config-scroll-container {
+  flex: 1;
+  overflow-y: auto;
+  padding-right: 4px;
+  max-height: 50vh;
+}
+.checkbox-area {
+  padding: 0 0 8px 0;
+  border-bottom: 1px solid #ebeef5;
+  display: flex;
+}
+.config-sections {
+  padding: 8px 0px;
+}
+</style>

+ 148 - 0
JLHWEB/src/views/quote/softbedQuote/components/ConfigSection.vue

@@ -0,0 +1,148 @@
+<template>
+  <div class="config-group">
+    <div class="group-header">
+      <div class="group-title">{{ partName }}</div>
+    </div>
+    <div v-for="(item, index) in configItems" :key="item.pzid" class="config-row">
+      <el-select
+        v-model="item.pzname"
+        placeholder="选择选配项"
+        size="small"
+        class="select-config-item"
+        @change="onConfigItemChange(item, index)"
+      >
+        <el-option v-for="option in configItemOptions" :key="option.value" :label="option.label" :value="option.label" />
+      </el-select>
+
+      <el-select v-model="item.selectedValue" placeholder="选择选配值" size="small" class="select-config-value">
+        <el-option
+          v-for="opt in configValueOptionsMap[item.pzname] || []"
+          :key="opt.value"
+          :label="opt.label"
+          :value="opt.label"
+        />
+      </el-select>
+
+      <i class="iconfont icontrash-01 delete-icon" @click="$emit('removeConfigItem', index)" title="删除选配项" />
+    </div>
+
+    <div class="add-config-btn">
+      <el-button type="primary" icon="el-icon-plus" size="small" @click="$emit('addConfigItem')"> 添加选配项 </el-button>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { PropType, reactive } from "vue";
+
+interface SelectOption {
+  label: string;
+  value: string;
+}
+
+interface ConfigValue {
+  pzid: number;
+  printid: number;
+  pznamemx: string;
+}
+
+interface ConfigItem {
+  pzid: number;
+  pzname: string;
+  valueList: ConfigValue[];
+  selectedValue?: string; // 选中的配置值字符串(方便双向绑定)
+}
+
+defineProps({
+  partName: { type: String, required: true },
+  configItems: {
+    type: Array as PropType<ConfigItem[]>,
+    required: true
+  },
+  configItemOptions: {
+    type: Array as PropType<SelectOption[]>,
+    default: () => []
+  },
+  configValueOptionsMap: {
+    type: Object as PropType<Record<string, SelectOption[]>>,
+    default: () => ({})
+  }
+});
+
+const emit = defineEmits(["removeConfigItem", "addConfigItem"]);
+
+// 监听配置项名变化时,如果该配置项有对应valueList,自动选中第一个值
+function onConfigItemChange(item: ConfigItem, index: number) {
+  const options = configValueOptionsMap[item.pzname];
+  if (options && options.length > 0) {
+    item.selectedValue = options[0].label;
+  } else {
+    item.selectedValue = "";
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.config-section-card {
+  margin-bottom: 16px;
+}
+
+.card-header {
+  font-weight: bold;
+  font-size: 16px;
+  margin-bottom: 12px;
+}
+
+.config-row {
+  display: flex;
+  align-items: center;
+  gap: 12px;
+  margin-bottom: 8px;
+  width: 100%;
+}
+
+.select-config-item {
+  flex: 1;
+}
+
+.select-config-value {
+  flex: 3;
+}
+
+/* 删除图标样式 */
+.delete-icon {
+  cursor: pointer;
+  font-size: 18px;
+  user-select: none;
+}
+
+/* 添加选配项按钮左对齐 */
+.add-config-btn {
+  margin-top: 12px;
+  text-align: left;
+}
+
+.config-group {
+  background: #fafafa;
+  border: 1px solid #e4e7ed;
+  border-radius: 4px;
+  margin-bottom: 15px;
+  padding: 10px;
+  position: relative;
+}
+
+.group-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 15px;
+  padding-bottom: 10px;
+  border-bottom: 1px dashed #ebeef5;
+}
+
+.group-title {
+  font-weight: 500;
+  color: #409eff;
+  font-size: 15px;
+}
+</style>

+ 0 - 0
JLHWEB/src/views/quote/softbedQuote/detail.vue


+ 40 - 0
JLHWEB/src/views/quote/softbedQuote/hooks/index.tsx

@@ -0,0 +1,40 @@
+import { ref, reactive, computed, toRefs, nextTick } from "vue";
+import { ColumnProps } from "@/components/LjVxeTable/interface";
+interface defaultState {
+  /**
+   * @description 单据当前状态
+   */
+  orderStatus: string;
+  /**
+   * @description 列表Ref
+   */
+  VxeTableRef: any;
+  /**
+   * @description 详情页Ref
+   */
+  LjDetailRef: any;
+  /**
+   * @description 详情页明细表格Ref
+   */
+  VxeTableMxRef: any;
+}
+
+/**
+ * @description 表格多选数据操作
+ * @param {String} rowKey 当表格可以多选时,所指定的 id
+ * */
+export const useHooks = (t?: any) => {
+  const state = reactive<defaultState>({
+    orderStatus: "",
+    VxeTableRef: null,
+    LjDetailRef: null,
+    VxeTableMxRef: null
+  });
+  // 表格配置项
+  const columns: ColumnProps<any>[] = [];
+
+  return {
+    ...toRefs(state),
+    columns
+  };
+};

+ 326 - 0
JLHWEB/src/views/quote/softbedQuote/index.vue

@@ -0,0 +1,326 @@
+<template>
+  <div class="table-box">
+    <LjVxeTable
+      ref="VxeTableRef"
+      row-key="softbed_id"
+      :columns="columns"
+      :init-param="initParams"
+      :request-api="getData"
+      :data-callback="dataCallback"
+      :dwname="DwnameEnum.softbedQuote"
+      :table-props="tableProps"
+      :table-events="tableEvents"
+      :auto-load-layout="false"
+      :search-btn-size-extent="[]"
+      pagination
+    >
+      <!-- 表格 header 按钮 -->
+      <template #tableHeader>
+        <LjHeaderMenu :action="action" />
+      </template>
+    </LjVxeTable>
+  </div>
+  <BedConfigModal v-model:visible="isModalVisible" @confirm="onConfigConfirm" />
+</template>
+
+<script setup lang="ts" name="softbedQuote">
+import { ref } from "vue";
+import { useRouter } from "vue-router";
+import { AuditSoftBedQuote, DeleteSoftBedQuote } from "@/api/modules/quote";
+import { CommonDynamicSelect } from "@/api/modules/common";
+import { useHooks } from "./hooks/index";
+import LjHeaderMenu from "@/components/LjHeaderMenu/index.vue";
+import { useI18n } from "vue-i18n";
+import { useAuthButtons } from "@/hooks/useAuthButtons";
+import { DwnameEnum } from "@/enums/dwnameEnum";
+import { formatToDateTime, formatToDate } from "@/utils/dateUtil";
+import { cloneDeep } from "lodash-es";
+import { useGlobalStore } from "@/stores/modules/global";
+import { ElMessage, ElMessageBox } from "element-plus";
+import { detailAction } from "@/components/LjDetail/interface";
+import { useUserStore } from "@/stores/modules/user";
+import mittBus from "@/utils/mittBus";
+import { MittEnum } from "@/enums/mittEnum";
+import { getCurrentRecords } from "@/utils/index";
+import BedConfigModal from "./components/BedConfigModal.vue";
+
+const { t } = useI18n();
+const router = useRouter();
+const globalStore = useGlobalStore();
+const { columns, orderStatus, VxeTableRef } = useHooks();
+const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
+const { userInfo } = useUserStore();
+
+const initParams = ref({});
+
+// 控制弹窗的显示状态
+const isModalVisible = ref(false);
+// 存储从弹窗返回的配置数据
+const finalConfiguration = ref(null);
+// 监听弹窗的confirm事件
+const onConfigConfirm = data => {
+  console.log("从弹窗收到的配置数据:", data);
+  finalConfiguration.value = data;
+};
+
+const getData = (params: any) => {
+  let newParams: any = {};
+  params.pageNum && (newParams.pageindex = params.pageNum);
+  params.pageSize && (newParams.pagesize = params.pageSize);
+  params.orderstr && (newParams.orderstr = params.orderstr);
+  delete params.pageNum;
+  delete params.pageSize;
+  delete params.orderstr;
+  let _params = cloneDeep(params);
+  newParams.queryParams = _params;
+  newParams.dsname = "web_softbed_list";
+  return CommonDynamicSelect(newParams, DwnameEnum.softbedQuote);
+};
+
+const dataCallback = (data: any) => {
+  return {
+    list: data.datatable,
+    tableinfo: data.tableinfo,
+    total: data.totalcnt,
+    pageNum: data.pageindex,
+    pageSize: data.pagesize
+  };
+};
+
+const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
+  if (globalStore.detailBlank) {
+    // 打开新的窗口
+    const routeUrl = router.resolve({
+      path: `/softbedQuote/detail`,
+      query: {
+        id: row.softbed_id,
+        code: row.softbed_code
+      }
+    });
+    window.open(routeUrl.href, "_blank");
+  } else {
+    // 打开新的标签页
+    router.push(`/softbedQuote/detail?id=${row.softbed_id}&code=${row.softbed_code}`);
+  }
+};
+
+const rowClsNameFunc = (data: any) => {
+  const { row, rowIndex, $rowIndex } = data;
+  return "";
+};
+const tableProps = {
+  height: "auto",
+  editConfig: { trigger: "click", mode: "cell" },
+  rowClassName: rowClsNameFunc,
+  exportConfig: {
+    filename: t("menu.softbedQuote") + formatToDate(new Date(), "YYYY-MM-DD HH:mm:ss")
+  }
+};
+
+// 返回绑定的事件
+const tableEvents = {
+  "cell-dblclick": handleDBlClickTable
+};
+
+/**
+ * @description 按钮展示
+ */
+const action: detailAction[] = [
+  buttonDefault({
+    label: t("common.redo"),
+    clickFunc: item => {
+      VxeTableRef.value.refresh();
+    }
+  }),
+  buttonDefault({
+    label: t("common.add"),
+    power: 124,
+    clickFunc: item => {
+      router.push(`/softbedQuote/new?id=0`);
+    }
+  }),
+  buttonDefault({
+    label: t("common.editText"),
+    power: 124,
+    clickFunc: item => {
+      const { $table, curRecords } = getCurrentRecords(VxeTableRef.value);
+
+      if (!curRecords.length) {
+        ElMessage.warning(t("business.tips.mattress.records"));
+        return;
+      }
+      const _cur = curRecords[curRecords.length - 1];
+      if (_cur.flag == 1) {
+        ElMessage.warning("单据已审核,不能修改");
+        return;
+      }
+      router.push(`/softbedQuote/edit?id=${_cur.softbed_id}&code=${_cur.softbed_code}`);
+    }
+  }),
+  buttonDefault({
+    label: t("common.delText"),
+    power: 127,
+    disabledTextCallBack: (data: any) => {
+      if (!CheckPower(127)) {
+        return "你没有【报价单-删除】的使用权限";
+      }
+
+      return "";
+    },
+    clickFunc: item => {
+      const { curRecords } = getCurrentRecords(VxeTableRef.value);
+
+      if (!curRecords.length) {
+        ElMessage.warning(t("business.tips.mattress.records"));
+        return;
+      }
+
+      let list = curRecords.map((item: any) => {
+        return { softbed_id: Number(item.softbed_id) };
+      });
+
+      ElMessageBox.confirm(`是否确定要删除${curRecords.length}张报价单吗?`, "询问", {
+        confirmButtonText: t("common.delText"),
+        cancelButtonText: "否",
+        type: "warning"
+      })
+        .then(() => {
+          DeleteSoftBedQuote({ list }).then(() => {
+            ElMessage.success(t("sys.api.operationSuccess"));
+            VxeTableRef.value.refresh();
+          });
+        })
+        .catch((e: TypeError) => {
+          ElMessage({
+            type: "info",
+            message: "操作取消"
+          });
+        });
+    }
+  }),
+  buttonDefault({
+    label: t("common.auditText"),
+    power: 125,
+    limited: () => {
+      return !!orderStatus.value;
+    },
+    disabledTextCallBack: (data: any) => {
+      if (!CheckPower(125)) {
+        return `你没有【报价单-${t("common.auditText")}】的使用权限`;
+      }
+      return "";
+    },
+    clickFunc: item => {
+      const { curRecords } = getCurrentRecords(VxeTableRef.value);
+      ElMessageBox.confirm("是否确定要审核单据吗?", "询问", {
+        confirmButtonText: "是",
+        cancelButtonText: "否",
+        type: "warning"
+      })
+        .then(() => {
+          let list = curRecords.map((item: any) => {
+            return { softbed_id: Number(item.softbed_id) };
+          });
+
+          AuditSoftBedQuote({ list, type: 1 }).then(() => {
+            ElMessage.success(t("sys.api.operationSuccess"));
+            VxeTableRef.value.refresh();
+          });
+        })
+        .catch((e: TypeError) => {
+          ElMessage({
+            type: "info",
+            message: "操作取消"
+          });
+        });
+    }
+  }),
+  buttonDefault({
+    label: t("common.withdrawAuditText"),
+    power: 125,
+    limited: () => {
+      return !!orderStatus.value;
+    },
+    disabledTextCallBack: (data: any) => {
+      if (!CheckPower(125)) {
+        return `你没有【报价单-${t("common.withdrawAuditText")}】的使用权限`;
+      }
+      return "";
+    },
+    clickFunc: item => {
+      const { curRecords } = getCurrentRecords(VxeTableRef.value);
+      ElMessageBox.confirm("是否确定要撤审单据吗?", "询问", {
+        confirmButtonText: "是",
+        cancelButtonText: "否",
+        type: "warning"
+      })
+        .then(() => {
+          let list = curRecords.map((item: any) => {
+            return { softbed_id: Number(item.softbed_id) };
+          });
+
+          AuditSoftBedQuote({ list, type: 0 }).then(() => {
+            ElMessage.success(t("sys.api.operationSuccess"));
+            VxeTableRef.value.refresh();
+          });
+        })
+        .catch((e: TypeError) => {
+          ElMessage({
+            type: "info",
+            message: "操作取消"
+          });
+        });
+    }
+  }),
+  buttonDefault({
+    label: t("common.copyQuote"),
+    power: 75,
+    clickFunc: item => {
+      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(`/softbedQuote/copy?id=${_cur.softbed_id}&code=${_cur.softbed_code}`);
+      } else {
+        const _cur = curRecords[curRecords.length - 1];
+        router.push(`/softbedQuote/copy?id=${_cur.softbed_id}&code=${_cur.softbed_code}`);
+      }
+    }
+  }),
+  buttonDefault({
+    label: t("common.showFormula"),
+    disabledTextCallBack: () => {
+      return userInfo.usermode == 1 ? "业务员模式不可以查看!" : "";
+    },
+    clickFunc: item => {}
+  }),
+  buttonDefault({
+    label: t("common.viewHistoricalQuotes"),
+    power: 61,
+    clickFunc: item => {}
+  }),
+  buttonDefault({
+    label: t("common.dataTransmission"),
+    power: 61,
+    clickFunc: item => {}
+  }),
+  buttonDefault({
+    label: "测试弹窗",
+    clickFunc: item => {
+      isModalVisible.value = true;
+    }
+  })
+];
+
+/**
+ * @description 监听框架属性变化
+ */
+mittBus.on(MittEnum.SoftBedList, () => {
+  VxeTableRef.value.refresh();
+});
+</script>