Przeglądaj źródła

核价后台: 1、修复保存床垫清单时,多规格的特色工艺保存报错问题;2、床垫清单支持主副规格显示

chen_yjin 3 tygodni temu
rodzic
commit
28e74935e4

+ 35 - 0
JLHHJSvr/Com/GetMattressSubspecs.cs

@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    public sealed class GetMattressSubspecsRequest : ILJRequest<GetMattressSubspecsResponse>
+    {
+        public override string GetApiName()
+        {
+            return "GetMattressSubspecs";
+        }
+        public string token { get; set; }
+        public int mattressid { get; set; }
+    }
+
+    public sealed class GetMattressSubspecsResponse : LJResponse
+    {
+        /// <summary>
+        /// 副规格列表
+        /// </summary>
+        public List<u_mattress_mx_subspecs> mattresses { get; set; }
+        /// <summary>
+        /// 弹簧排列列表
+        /// </summary>
+        public List<u_mattress_mx_subspecs> springlist { get; set; }
+        /// <summary>
+        /// 垫层物料
+        /// </summary>
+        public List<u_mattress_mx_subspecs> mtrllist { get; set; }
+    }
+}

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

@@ -155,6 +155,10 @@ namespace JLHHJSvr.Com.Model
         /// 主规格id
         /// </summary>
         public int? parentid { get; set; }
+        /// <summary>
+        /// 有多少个副规格
+        /// </summary>
+        public int? child_count { get; set; }
 
         #region 其他
         public int? pricelistid { get; set; }

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

@@ -65,6 +65,8 @@ namespace JLHHJSvr.Com.Model
         public decimal? dannum2_rate { get; set; }
         public decimal? dannum3_rate { get; set; }
         public decimal? dannum4_rate { get; set; }
+        public decimal? spring_qty_width { get; set; }
+        public decimal? spring_qty_length { get; set; }
         #endregion
     }
 }

+ 20 - 0
JLHHJSvr/Com/Model/u_mattress_mx_subspecs.cs

@@ -0,0 +1,20 @@
+using LJLib.DAL.SQL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace JLHHJSvr.Com.Model
+{
+    [PK(new[] { "mattressid" })]
+    public sealed class u_mattress_mx_subspecs
+    {
+        public int? mattressid { get; set; }
+        public int? mtrlid { get; set; }
+        public int? mattress_width { get; set; }
+        public int? mattress_length { get; set; }
+        public int? mattress_height { get; set; }
+        public decimal? spring_qty_width { get; set; }
+        public decimal? spring_qty_length { get; set; }
+    }
+}

+ 4 - 0
JLHHJSvr/Com/Model/u_mtrl_price.cs

@@ -94,5 +94,9 @@ namespace JLHHJSvr.Com.Model
         public string price_formula { get; set; }
         public string qty_formula { get; set; }
         public int? pricelistid { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public int? if_interface_num { get; set; }
     }
 }

+ 8 - 0
JLHHJSvr/DataStore/_Mapper_bednet_area.xml

@@ -10,6 +10,14 @@
 		,u_bednet_area.area_5
 		,u_bednet_area.area_6
 		,u_bednet_area.area_7
+		,u_bednet_area.area_8
+		,u_bednet_area.area_9
+		,u_bednet_area.area_10
+		,u_bednet_area.area_11
+		,u_bednet_area.area_12
+		,u_bednet_area.area_13
+		,u_bednet_area.area_14
+		,u_bednet_area.area_15
 		FROM u_bednet_area
 	</selectstr>
 	<where>

+ 69 - 57
JLHHJSvr/DataStore/web_mattress_interfacelist.xml

@@ -1,63 +1,75 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <select>
   <selectstr>
-SELECT mattressid
-	,mattressname
-	,deptid
-	,mattresstypeid
-	,mattresscode
-	,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
-	,nottax_factory_cost
-	,nottax_dept_cost
-	,dept_cost
-	,foreign_cost
-	,extras_cost
-	,dept_profitrate
-	,moneyrate
-	,mattressrelcode
-	,flag
-	,auditingrep
-	,auditingdate
-	,createtime
-	,createby
-	,yw_flag
-	,yw_auditingrep
-	,yw_auditingdate
-	,js1_flag
-	,js1_auditingrep
-	,js1_auditingdate
-	,js2_flag
-	,js2_auditingrep
-	,js2_auditingdate
-	,creatmtrl_flag
-	,creatmtrl_auditingrep
-	,creatmtrl_auditingdate
-	,creatmtrlqd_flag
-	,creatmtrlqd_auditingrep
-	,creatmtrlqd_auditingdate
-	,erp_mtrlcode AS erp_mtrlcode
-	,erp_mtrlid
-	,nottax_factory_cost / (dept_profitrate + dept_profitrate_rangli / 100) AS dijia_cost
-	,erp_mtrlengname
-	,erp_configcodetype
-	,0 AS yongjin
-FROM u_mattress
+SELECT u_mattress.mattressid
+		,mattressname
+		,deptid
+		,mattresstypeid
+		,mattresscode
+		,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
+		,nottax_factory_cost
+		,nottax_dept_cost
+		,dept_cost
+		,foreign_cost
+		,extras_cost
+		,dept_profitrate
+		,moneyrate
+		,mattressrelcode
+		,flag
+		,auditingrep
+		,auditingdate
+		,createtime
+		,createby
+		,yw_flag
+		,yw_auditingrep
+		,yw_auditingdate
+		,js1_flag
+		,js1_auditingrep
+		,js1_auditingdate
+		,js2_flag
+		,js2_auditingrep
+		,js2_auditingdate
+		,creatmtrl_flag
+		,creatmtrl_auditingrep
+		,creatmtrl_auditingdate
+		,creatmtrlqd_flag
+		,creatmtrlqd_auditingrep
+		,creatmtrlqd_auditingdate
+		,erp_mtrlcode AS erp_mtrlcode
+		,erp_mtrlid
+		,nottax_factory_cost / (dept_profitrate + dept_profitrate_rangli / 100) AS dijia_cost
+		,erp_mtrlengname
+		,erp_configcodetype
+		,0 AS yongjin
+		,ISNULL(parentid, 0) AS parentid
+		,vv_mattress.child_count
+    FROM u_mattress
+	LEFT JOIN (
+		SELECT
+			um.mattressid,
+			COUNT(um2.mattressid) AS child_count
+		FROM
+			u_mattress um
+		LEFT JOIN
+			u_mattress um2 ON um.mattressid = um2.parentid
+		GROUP BY um.mattressid
+	) AS vv_mattress on vv_mattress.mattressid = u_mattress.mattressid
   </selectstr>
   <where>
 	<when>u_mattress.xd_flag = 1</when>

+ 15 - 1
JLHHJSvr/Excutor/GetMattressInterfaceListExcutor.cs

@@ -59,7 +59,19 @@ namespace JLHHJSvr.Excutor
                                     ,yw_flag
                                     ,js1_flag
                                     ,js2_flag
+		                            ,ISNULL(parentid, 0) AS parentid
+		                            ,vv_mattress.child_count
                                 FROM u_mattress
+		                        LEFT JOIN (
+			                        SELECT
+				                        um.mattressid,
+				                        COUNT(um2.mattressid) AS child_count
+			                        FROM
+				                        u_mattress um
+			                        LEFT JOIN
+				                        u_mattress um2 ON um.mattressid = um2.parentid
+			                        GROUP BY um.mattressid
+		                        ) AS vv_mattress on vv_mattress.mattressid = u_mattress.mattressid
                                 WHERE u_mattress.mattressid = @mattressid";
                 cmd.Parameters.Clear();
                 cmd.Parameters.AddWithValue("@mattressid", request.mattressid);
@@ -98,7 +110,9 @@ namespace JLHHJSvr.Excutor
                             old_mtrlname = Convert.ToString(reader["old_mtrlname"]),
                             yw_flag = Convert.ToInt32(reader["yw_flag"]),
                             js1_flag = Convert.ToInt32(reader["js1_flag"]),
-                            js2_flag = Convert.ToInt32(reader["js2_flag"])
+                            js2_flag = Convert.ToInt32(reader["js2_flag"]),
+                            parentid = Convert.ToInt32(reader["parentid"]),
+                            child_count = Convert.ToInt32(reader["child_count"])
                         };
                     }
                 }

+ 75 - 0
JLHHJSvr/Excutor/GetMattressSubspecsExcutor.cs

@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using DirectService.Tools;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.Com.Model;
+using JLHHJSvr.Helper;
+using JLHHJSvr.LJException;
+using JLHHJSvr.Tools;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class GetMattressSubspecsExcutor : ExcutorBase<GetMattressSubspecsRequest, GetMattressSubspecsResponse>
+    {
+        protected override void ExcuteInternal(GetMattressSubspecsRequest request, object state, GetMattressSubspecsResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+            if (request.mattressid == 0)
+            {
+                rslt.ErrMsg = "床垫id不能为0";
+                return;
+            }
+
+            using (var con = new SqlConnection(GlobalVar.ConnectionString))
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                using (cmd.Transaction = con.BeginTransaction())
+                {
+
+                    var helper = HelperBase.GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
+
+                    var subspecsList = new List<u_mattress>();
+                    var result = new List<u_mattress_mx_subspecs>();
+
+                    //获取副规格列表
+                    subspecsList = helper.GetMattressSubspecs(request.mattressid);
+
+                    if (subspecsList.Count > 0)
+                    {
+                        foreach(var mattrss in subspecsList)
+                        {
+                            var _res = new u_mattress_mx_subspecs()
+                            {
+                                mattressid = mattrss.mattressid,
+                                mattress_width = mattrss.mattress_width,
+                                mattress_length = mattrss.mattress_length,
+                                //mattress_height = 
+                            };
+                            //获取弹簧排列
+                            List<u_mattress_mx_mtrl> springList = helper.GetMattressSubspecsBednet(mattrss.mattressid);
+
+                            //判断是否有主副规格调整物料
+
+                        }
+                    }
+
+                    //rslt.mattressMx = result;
+
+                }
+            }
+        }
+    }
+}

+ 18 - 0
JLHHJSvr/Excutor/SaveMattressExcutor.cs

@@ -87,6 +87,12 @@ namespace JLHHJSvr.Excutor
                         {
                             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();
@@ -199,6 +205,18 @@ namespace JLHHJSvr.Excutor
 
                                                 oBednet.bednetid = 0;
 
+                                                //// 袋装网,多个分区时,重新分配弹簧
+                                                //if (_bednetMx[0].if_part == 1 && _bednetSpring.Count > 0)
+                                                //{
+                                                //    var bednetArea = helperBednet.GetBedNetArea(Convert.ToInt32(oBednet.duo_qv_str));
+
+                                                //    foreach (var _spr in _bednetSpring)
+                                                //    {
+                                                //        _spr.spring_qty_width = submx.spring_qty_width;
+                                                //        //_spr.spring_qty_length = 
+                                                //    }
+                                                //}
+
                                                 helperBednet.SaveBedNet(oBednet, _bednetMx, _bednetSpring);
                                             }
 

+ 1 - 0
JLHHJSvr/GlobalVar/GlobalVar.cs

@@ -194,6 +194,7 @@ namespace JLHHJSvr
                 excutorManager.AddMap("DeleteMattressBcp", typeof(DeleteMattressBcpRequest), new DeleteMattressBcpExcutor());// 删除半成品报价
                 excutorManager.AddMap("AuditMattressBcp", typeof(AuditMattressBcpRequest), new AuditMattressBcpExcutor());// 审核半成品报价
                 excutorManager.AddMap("GetMattressPackagMx", typeof(GetMattressPackagMxRequest), new GetMattressPackagMxExcutor());// 包装方式切换
+                excutorManager.AddMap("GetMattressSubspecs", typeof(GetMattressSubspecsRequest), new GetMattressSubspecsExcutor());// 获取主副规格
 
                 excutorManager.AddMap("SaveBedNet", typeof(SaveBedNetRequest), new SaveBedNetExcutor());// 保存床网报价
                 excutorManager.AddMap("DeleteBedNet", typeof(DeleteBedNetRequest), new DeleteBedNetExcutor());// 删除床网报价

+ 9 - 0
JLHHJSvr/Helper/BedNetHelper.cs

@@ -2045,6 +2045,15 @@ namespace JLHHJSvr.Helper
             return springList;
         }
 
+        public u_bednet_area GetBedNetArea(int areaid)
+        {
+            var outputFields = @"u_bednet_area.areaid, u_bednet_area.areaname, u_bednet_area.area_1, u_bednet_area.area_2, u_bednet_area.area_3, u_bednet_area.area_4, u_bednet_area.area_5, u_bednet_area.area_6, u_bednet_area.area_7, u_bednet_area.area_8, u_bednet_area.area_9, u_bednet_area.area_10, u_bednet_area.area_11, u_bednet_area.area_12, u_bednet_area.area_13, u_bednet_area.area_14, u_bednet_area.area_15";
+            var bedentArea = new u_bednet_area() { areaid = areaid };
+            DbSqlHelper.SelectOne(cmd, bedentArea, outputFields);
+
+            return bedentArea;
+        }
+
         public List<u_bednetmx_mtrl> GetBedNetMxMtrlList(int bednetid)
         {
             var mxList = new List<u_bednetmx_mtrl>();

+ 27 - 8
JLHHJSvr/Helper/MattressHelper.cs

@@ -1634,10 +1634,7 @@ namespace JLHHJSvr.Helper
                 foreach (var item in extraProcesses)
                 {
                     item.mattressid = mattress.mattressid;
-                    if (item.mattressmxid == null || item.mattressmxid <= 0)
-                    {
-                        item.mattressmxid = BllHelper.GetID(cmd, "u_mattress_mx_extra");
-                    }
+                    item.mattressmxid = BllHelper.GetID(cmd, "u_mattress_mx_extra");
 
                     DbSqlHelper.Insert(cmd, "u_mattress_mx_extra", null, item, fieldsExtra);
                 }
@@ -1648,10 +1645,7 @@ namespace JLHHJSvr.Helper
                 foreach (var item in extraCosts)
                 {
                     item.mattressid = mattress.mattressid;
-                    if (item.mattressmxid == null || item.mattressmxid <= 0)
-                    {
-                        item.mattressmxid = BllHelper.GetID(cmd, "u_mattress_mx_extra");
-                    }
+                    item.mattressmxid = BllHelper.GetID(cmd, "u_mattress_mx_extra");
 
                     DbSqlHelper.Insert(cmd, "u_mattress_mx_extra", null, item, fieldsExtra);
                 }
@@ -1826,6 +1820,31 @@ namespace JLHHJSvr.Helper
             return list;
         }
         /// <summary>
+        /// 获取副规格的床网弹簧排列数
+        /// </summary>
+        /// <param name="mattressid"></param>
+        /// <returns></returns>
+        public List<u_mattress_mx_mtrl> GetMattressSubspecsBednet(int mattressid)
+        {
+            var list = new List<u_mattress_mx_mtrl>();
+            var outputFields = @"mtrlid,spring_qty_width,spring_qty_length";
+            var selectStr = @"SELECT
+				                u_mattress_mx_mtrl.mtrlid,
+				                ISNULL(u_bednetmx.spring_qty_width, 0) AS spring_qty_width,
+				                ISNULL(u_bednetmx.spring_qty_length, 0) AS spring_qty_length
+			                FROM u_mattress_mx_mtrl
+			                LEFT JOIN u_mattress_formula On u_mattress_formula.formulaid = u_mattress_mx_mtrl.formulaid
+			                LEFT OUTER JOIN u_bednetmx on u_bednetmx.bednetid = u_mattress_mx_mtrl.mtrlid
+                                ";
+            var whereList = new List<string>();
+            whereList.Add("u_mattress_mx_mtrl.formulatype = 99");
+            whereList.Add("u_mattress_mx_mtrl.mattressid = @mattressid");
+
+            DbSqlHelper.SelectJoin(cmd, selectStr, ListEx.GetWhereStr(whereList), new Dictionary<string, object>() { { "@mattressid", mattressid } }, "mattressmxid", outputFields, 0, 0, list);
+
+            return list;
+        }
+        /// <summary>
         /// 保存床垫复制清单
         /// </summary>
         /// <param name="mattressid"></param>

+ 3 - 0
JLHHJSvr/JLHHJSvr.csproj

@@ -102,6 +102,7 @@
     <Compile Include="Com\CreatPrdPf.cs" />
     <Compile Include="Com\DeleteMattressExtraType.cs" />
     <Compile Include="Com\DeleteMattressExtra.cs" />
+    <Compile Include="Com\GetMattressSubspecs.cs" />
     <Compile Include="Com\JLH_FetchPrice.cs" />
     <Compile Include="Com\Model\replacement_bednet.cs" />
     <Compile Include="Com\FormulaCheck.cs" />
@@ -110,6 +111,7 @@
     <Compile Include="Com\Model\u_mattress_extra_type.cs" />
     <Compile Include="Com\Model\u_mattress_extra.cs" />
     <Compile Include="Com\Model\u_mattress_mx_extra.cs" />
+    <Compile Include="Com\Model\u_mattress_mx_subspecs.cs" />
     <Compile Include="Com\SaveMattressExtraType.cs" />
     <Compile Include="Com\SaveMattressExtra.cs" />
     <Compile Include="Com\UnLockUser.cs" />
@@ -298,6 +300,7 @@
     <Compile Include="Excutor\DeleteMattressExtraExcutor.cs" />
     <Compile Include="Excutor\FormulaCheckExcutor.cs" />
     <Compile Include="Excutor\GetFormulaVarListExcutor.cs" />
+    <Compile Include="Excutor\GetMattressSubspecsExcutor.cs" />
     <Compile Include="Excutor\JLH_FetchPriceExcutor.cs" />
     <Compile Include="Excutor\SaveMattressExtraTypeExcutor.cs" />
     <Compile Include="Excutor\SaveMattressExtraExcutor.cs" />