Browse Source

1、床垫报价:新增新旧报价同时计算
2、床垫报价:新增额外费用和特殊工艺tab相关逻辑

chen_yjin 3 weeks ago
parent
commit
c9148de8fd

+ 26 - 0
JLHHJSvr/Com/DeleteMattressExtraType.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    public sealed class DeleteMattressExtraTypeRequest : ILJRequest<DeleteMattressExtraTypeResponse>
+    {
+        public override string GetApiName()
+        {
+            return "DeleteMattressExtraType";
+        }
+        /// <summary>
+        /// 登录token
+        /// </summary>
+        public string token { get; set; }
+        public List<u_mattress_extra_type> list { get; set; }
+    }
+
+    public sealed class DeleteMattressExtraTypeResponse : LJResponse
+    {
+    }
+}

+ 6 - 0
JLHHJSvr/Com/GetComputeMattress.cs

@@ -22,6 +22,10 @@ namespace JLHHJSvr.Com
         /// 所有明细
         /// </summary>
         public List<u_mattress_mx_mtrl> mattressMx { get; set; }
+        /// <summary>
+        /// 是否查看原公式计算
+        /// </summary>
+        public byte check_original { get; set; }
     }
 
     public sealed class GetComputeMattressResponse : LJResponse
@@ -30,5 +34,7 @@ namespace JLHHJSvr.Com
         public List<replacement> replace { get; set; }
         public List<replacement> formulas { get; set; }
         public string message { get; set; }
+        public List<replacement> replace_origin { get; set; }
+        public List<replacement> formulas_origin { get; set; }
     }
 }

+ 1 - 0
JLHHJSvr/Com/GetMattressImportDW2.cs

@@ -37,6 +37,7 @@ namespace JLHHJSvr.Com
         public List<replacement> diancengarea { get; set; }
         public List<u_mattress_mx_extra> extraProcessesMx { get; set; }
         public List<u_mattress_mx_extra> extraCostsMx { get; set; }
+        public List<u_mattress_extra_type> extraTypeEnum { get; set; }
         public List<u_mattress_extra> extraEnum { get; set; }
     }
 }

+ 23 - 14
JLHHJSvr/Com/Model/u_mattress_extra.cs

@@ -6,25 +6,26 @@ using System.Text;
 
 namespace JLHHJSvr.Com.Model
 {
-    [PK(new[] { "extraid" })]
+    [PK(new[] { "extramxid" })]
     public sealed class u_mattress_extra
-    {/// <summary>
-     /// 项目id
-     /// </summary>
-        public int? extraid { get; set; }
+    {
         /// <summary>
-        /// 项目类型名称
+        /// 项目id
         /// </summary>
-        public string extratypename { get; set; }
+        public int? extramxid { get; set; }
         /// <summary>
-        /// 项目名称
+        /// 类型id
         /// </summary>
-        public string extraname { get; set; }
+        public int? extraid { get; set; }
         /// <summary>
-        /// 类型id
+        /// 项目类型id
         /// </summary>
         public int? typeid { get; set; }
         /// <summary>
+        /// 项目名称
+        /// </summary>
+        public string extramxname { get; set; }
+        /// <summary>
         /// 默认金额
         /// </summary>
         public decimal? price { get; set; }
@@ -37,13 +38,21 @@ namespace JLHHJSvr.Com.Model
         /// </summary>
         public byte? inuse { get; set; }
         /// <summary>
-        /// 录入类型
-        /// </summary>
-        public int? inputtype { get; set; }
-        /// <summary>
         /// 自动导入
         /// </summary>
         public byte? ifinit { get; set; }
+        /// <summary>
+        /// 建立人
+        /// </summary>
+        public string createby { get; set; }
+        /// <summary>
+        /// 建立时间
+        /// </summary>
+        public DateTime? createtime { get; set; }
+        /// <summary>
+        /// 录入类型
+        /// </summary>
+        public int? inputtype { get; set; }
 
     }
 }

+ 37 - 0
JLHHJSvr/Com/Model/u_mattress_extra_type.cs

@@ -0,0 +1,37 @@
+using LJLib.DAL.SQL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace JLHHJSvr.Com.Model
+{
+    [PK(new[] { "extraid" })]
+    public sealed class u_mattress_extra_type
+    {
+        /// <summary>
+        /// 类型id
+        /// </summary>
+        public int? extraid { get; set; }
+        /// <summary>
+        /// 项目类型名称
+        /// </summary>
+        public string typename { get; set; }
+        /// <summary>
+        /// 类型id
+        /// </summary>
+        public int? typeid { get; set; }
+        /// <summary>
+        /// 禁用
+        /// </summary>
+        public byte? inuse { get; set; }
+        /// <summary>
+        /// 建立人
+        /// </summary>
+        public string createby { get; set; }
+        /// <summary>
+        /// 建立时间
+        /// </summary>
+        public DateTime? createtime { get; set; }
+    }
+}

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

@@ -30,6 +30,10 @@ namespace JLHHJSvr.Com.Model
         /// </summary>
         public decimal? price { get; set; }
         /// <summary>
+        /// 数量
+        /// </summary>
+        public decimal? qty { get; set; }
+        /// <summary>
         /// 备注
         /// </summary>
         public string dscrp { get; set; }

+ 8 - 0
JLHHJSvr/Com/SaveMattress.cs

@@ -29,6 +29,14 @@ namespace JLHHJSvr.Com
         /// 副规格列表
         /// </summary>
         public List<u_mattress> subspecs { get; set; }
+        /// <summary>
+        /// 特殊工艺列表
+        /// </summary>
+        public List<u_mattress_mx_extra> extraProcesses { get; set; }
+        /// <summary>
+        /// 其他额外费用列表
+        /// </summary>
+        public List<u_mattress_mx_extra> extraCosts { get; set; }
     }
 
     public sealed class SaveMattressResponse : LJResponse

+ 29 - 0
JLHHJSvr/Com/SaveMattressExtraType.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.Com.Model;
+using LJLib.Net.SPI.Com;
+
+namespace JLHHJSvr.Com
+{
+    /// <summary>
+    /// 保存床垫额外费用类型
+    /// </summary>
+    public sealed class SaveMattressExtraTypeRequest : ILJRequest<SaveMattressExtraTypeResponse>
+    {
+        public override string GetApiName()
+        {
+            return "SaveMattressExtraType";
+        }
+        public string token { get; set; }
+        /// <summary>
+        /// 床网分区定义
+        /// </summary>
+        public u_mattress_extra_type data { get; set; }
+    }
+
+    public sealed class SaveMattressExtraTypeResponse : LJResponse
+    {
+    }
+}

+ 3 - 3
JLHHJSvr/DataStore/_Mapper_inputtype.xml

@@ -4,15 +4,15 @@
 		[
 			{
 				"label": "选择",
-				"value": "0"
+				"value": 0
 			},
 			{
 				"label": "录入",
-				"value": "1"
+				"value": 1
 			},
 			{
 				"label": "带出",
-				"value": "2"
+				"value": 2
 			}
 		]
 	</json>

+ 3 - 3
JLHHJSvr/DataStore/_Mapper_mattressextra.xml

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <select>
   <selectstr>
-	SELECT u_mattress_extra.extraid,
-		u_mattress_extra.extratypename
-	FROM u_mattress_extra
+	SELECT extraid,
+		typename
+	FROM u_mattress_extra_type
   </selectstr>
   <where>
 	  <when notnull="@arg_typeid">

+ 4 - 1
JLHHJSvr/DataStore/_Mapper_mtrl2.xml

@@ -14,9 +14,12 @@
 		<when notnull="@arg_pricelistid">
 			u_mtrl_price_pricelist.pricelistid = @arg_pricelistid
 		</when>
-		<when notnull="@arg_bednetid">
+		<when notnull="@arg_bednetid" arg_bednetid!="0">
 			u_mtrl_price_pricelist.pricelistid = (select pricelistid from u_dept where deptid = (select deptid from u_bednet where bednetid = @arg_bednetid))
 		</when>
+		<when notnull="@arg_deptid">
+			u_mtrl_price_pricelist.pricelistid = (select pricelistid from u_dept where deptid = @arg_deptid)
+		</when>
 	</where>
 	<displayfields>
 	</displayfields>

+ 3 - 3
JLHHJSvr/DataStore/_Mapper_varclass.xml

@@ -4,15 +4,15 @@
 		[
 			{
 				"label": "单一变量",
-				"value": "0"
+				"value": 0
 			},
 			{
 				"label": "按床网类别",
-				"value": "1"
+				"value": 1
 			},
 			{
 				"label": "公式",
-				"value": "2"
+				"value": 2
 			}
 		]
 	</json>

+ 2 - 2
JLHHJSvr/DataStore/_Mapper_varkind.xml

@@ -4,11 +4,11 @@
 		[
 			{
 				"label": "床网",
-				"value": "0"
+				"value": 0
 			},
 			{
 				"label": "床垫",
-				"value": "1"
+				"value": 1
 			}
 		]
 	</json>

+ 4 - 4
JLHHJSvr/DataStore/_Mapper_vartype.xml

@@ -4,19 +4,19 @@
 		[
 			{
 				"label": "单价",
-				"value": "0"
+				"value": 0
 			},
 			{
 				"label": "重量",
-				"value": "1"
+				"value": 1
 			},
 			{
 				"label": "损耗率",
-				"value": "2"
+				"value": 2
 			},
 			{
 				"label": "人工",
-				"value": "3"
+				"value": 3
 			}
 		]
 	</json>

+ 15 - 9
JLHHJSvr/DataStore/web_mattress_extralist.xml

@@ -2,32 +2,38 @@
 <select>
 	<selectstr>
 		SELECT
-			extraid
-			,extratypename
-			,extraname
-			,typeid
+			u_mattress_extra_type.extraid
+			,extramxid
+			,extramxname
+			,u_mattress_extra_type.typeid
 			,price
 			,dscrp
-			,inuse
+			,u_mattress_extra.inuse
 			,inputtype
 			,ifinit
 		From u_mattress_extra
+		inner join u_mattress_extra_type on u_mattress_extra_type.extraid = u_mattress_extra.extraid
+			AND u_mattress_extra_type.inuse = 0
 	</selectstr>
 	<where>
+		<when notnull="@arg_extraid" arg_extraid!="0">
+			u_mattress_extra_type.extraid = @arg_extraid
+		</when>
 		<when notnull="@arg_typeid">
-			u_mattress_extra.typeid = @arg_typeid
+			u_mattress_extra_type.typeid = @arg_typeid
 		</when>
 		<when notnull="@arg_ifinit">
-			u_mattress_extra.arg_ifinit = @arg_ifinit
+			u_mattress_extra.ifinit = @arg_ifinit
 		</when>
 	</where>
 	<displayfields>
 		<field field="pid" compute="getrow()">序</field>
-		<field field="extratypename" mapper="u_mattress_extra.mattressextra">项目类型</field>
-		<field field="extraname">项目名称</field>
+		<field field="extraid" mapper="u_mattress_extra_type.mattressextra">项目类型</field>
+		<field field="extramxname">项目名称</field>
 		<field field="price" datatype="number">金额</field>
 		<field field="dscrp">备注</field>
 		<field field="ifinit" datatype="checkbox">自动导入</field>
+		<field field="inputtype" mapper="">录入类型</field>
 		<field field="inuse" datatype="checkbox">禁用</field>
 	</displayfields>
 </select>

+ 28 - 7
JLHHJSvr/DataStore/web_mattress_mx.xml

@@ -26,6 +26,10 @@
 			CASE when u_mattress_formula.if_mtrl > 1 THEN '+' ELSE '' END as addmx,
 			CASE when u_mattress_formula.if_mtrl > 1 THEN '-' ELSE '' END as delmx,
 			u_mtrl_price.name,
+			ISNULL(u_mtrltype.dannum1_rate, 0) AS dannum1_rate,
+			ISNULL(u_mtrltype.dannum2_rate, 0) AS dannum2_rate,
+			ISNULL(u_mtrltype.dannum3_rate, 0) AS dannum3_rate,
+			ISNULL(u_mtrltype.dannum4_rate, 0) AS dannum4_rate,
 			u_mattress_mx_mtrl.thickness,
 			u_mattress_mx_mtrl.chastr,
 			u_mattress_mx_mtrl.xu,
@@ -36,8 +40,9 @@
 			u_mattress_mx_mtrl.mattress_width,
 			u_mattress_mx_mtrl.mattress_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_mtrl_price on
-		u_mattress_mx_mtrl.mtrlid = u_mtrl_price.mtrlid
+		Left join u_mattress_formula On u_mattress_formula.formulaid = u_mattress_mx_mtrl.formulaid 
+		left outer join u_mtrl_price on u_mattress_mx_mtrl.mtrlid = u_mtrl_price.mtrlid
+		left outer join u_mtrltype on u_mtrltype.mtrltypeid = u_mtrl_price.mtrltype
 		Left OUTER JOIN (
 			select
 				mtrlid,
@@ -50,12 +55,12 @@
 				from u_user_jlhprice
 		) AS vv_mtrl_price on vv_mtrl_price.mtrlid = u_mattress_mx_mtrl.mtrlid
 		Left OUTER JOIN (
-		SELECT u_bednet.bednetid,
-		rtrim(u_bednet_type.typename)+ ' ' +  rtrim(u_bednet.bednetcode)+ ' '+cast(u_bednet.mattress_width as char(3))+ '*'
-		+cast(u_bednet.mattress_length as char(3))+ '*'+cast(u_bednet.mattress_height as char(3)) as bednetname
+			SELECT u_bednet.bednetid,
+			rtrim(u_bednet_type.typename)+ ' ' +  rtrim(u_bednet.bednetcode)+ ' '+cast(u_bednet.mattress_width as char(3))+ '*'
+			+cast(u_bednet.mattress_length as char(3))+ '*'+cast(u_bednet.mattress_height as char(3)) as bednetname
 
-		FROM u_bednet
-		inner join u_bednet_type ON u_bednet_type.bednettypeid = u_bednet.bednettypeid
+			FROM u_bednet
+			inner join u_bednet_type ON u_bednet_type.bednettypeid = u_bednet.bednettypeid
 		) as vv_bednet ON vv_bednet.bednetid = u_mattress_mx_mtrl.mtrlid
 	</selectstr>
 	<where>
@@ -105,6 +110,22 @@
 			成本
 			金额
 		</field>
+		<field field="dannum1_rate" datatype="number" onlyusermode="0">
+			散单
+			成本金额
+		</field>
+		<field field="dannum2_rate" datatype="number" onlyusermode="0">
+			标准
+			成本金额
+		</field>
+		<field field="dannum3_rate" datatype="number" onlyusermode="0">
+			大单
+			成本金额
+		</field>
+		<field field="dannum4_rate" datatype="number" onlyusermode="0">
+			小单
+			成本金额
+		</field>
 		<field field="formula" onlyusermode="0">
 			金额文本
 			公式

+ 2 - 0
JLHHJSvr/DataStore/web_mattress_mx_extra.xml

@@ -8,6 +8,7 @@
 			u_mattress_extra.extratypename,
 			u_mattress_mx_extra.extraname,
 			u_mattress_mx_extra.price,
+			u_mattress_mx_extra.qty,
 			'+' as addmx,
 			'-' as delmx,
 			u_mattress_mx_extra.dscrp
@@ -32,6 +33,7 @@
 		<field field="extratypename" mapper="u_mattress_extra.mattressextra">项目类型</field>
 		<field field="extraname">项目名称</field>
 		<field field="price" datatype="number">金额</field>
+		<field field="qty" datatype="number">数量</field>
 		<field field="dscrp">备注</field>
 	</displayfields>
 </select>

+ 56 - 0
JLHHJSvr/Excutor/DeleteMattressExtraTypeExcutor.cs

@@ -0,0 +1,56 @@
+using System;
+using System.Data.SqlClient;
+using System.Linq;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.LJException;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class DeleteMattressExtraTypeExcutor : ExcutorBase<DeleteMattressExtraTypeRequest, DeleteMattressExtraTypeResponse>
+    {
+        protected override void ExcuteInternal(DeleteMattressExtraTypeRequest request, object state, DeleteMattressExtraTypeResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+            if (!request.list.Any())
+            {
+                rslt.ErrMsg = "至少提交一条需要删除的记录";
+                return;
+            }
+
+            using (var con = new SqlConnection(GlobalVar.ConnectionString))
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                using (cmd.Transaction = con.BeginTransaction())
+                {
+                    try
+                    {
+                        foreach (var area in request.list)
+                        {
+                            if (DbSqlHelper.Delete(cmd, area) == 0)
+                            {
+                                throw new LJCommonException($"床垫额外费用类型定义资料不存在");
+                            }
+                        }
+
+                        cmd.Transaction.Commit();
+                    }
+                    catch (Exception e)
+                    {
+                        cmd.Transaction.Rollback();
+                        rslt.ErrMsg = e.ToString();
+                    }
+                }
+            }
+        }
+    }
+}

+ 13 - 4
JLHHJSvr/Excutor/GetComputeMattressExcutor.cs

@@ -60,17 +60,26 @@ namespace JLHHJSvr.Excutor
 
                     var helper = HelperBase.GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
 
+
+                    if (request.check_original == 1)
+                    {
+                        helper.CalCulateFormula(request.mattress, request.mattressMx, false, false);
+                        rslt.replace_origin = helper.Replacements;
+
+                        rslt.formulas_origin = helper.FormulaReplacements;
+                    }
+
                     try
                     {
-                        helper.CalCulateFormula(request.mattress, request.mattressMx,false);
+                        helper.CalCulateFormula(request.mattress, request.mattressMx, false);
+                        rslt.replace = helper.Replacements;
+
+                        rslt.formulas = helper.FormulaReplacements;
                     }
                     catch (Exception e)
                     {
                         rslt.message = e.Message;
                     }
-                    rslt.replace = helper.Replacements;
-
-                    rslt.formulas = helper.FormulaReplacements;
 
                     //rslt.mattress = request.mattress;
                 }

+ 63 - 46
JLHHJSvr/Excutor/GetMattressImportDW2Excutor.cs

@@ -63,27 +63,11 @@ namespace JLHHJSvr.Excutor
                                 rslt.diancengarea = wf_add_dianceng_area_bytype(cmd, mattersstype.dianceng_area);
                             }
 
-                            var selectStr = @"
-                                SELECT
-			                        extraid
-			                        ,extratypename
-			                        ,extraname
-			                        ,typeid
-			                        ,price
-			                        ,dscrp
-			                        ,inuse
-			                        ,inputtype
-			                        ,ifinit
-		                        From u_mattress_extra";
-                            var outFields = "extraid,extratypename,extraname,typeid,price,dscrp,inuse,inputtype,ifinit";
-                            var whereList = new List<string>();
-                            whereList.Add("u_mattress_extra.inuse = 0");
-                            var param = new Dictionary<string, object>();
-
-                            var mattressExtra = new List<u_mattress_extra>();
-                            DbSqlHelper.SelectJoin(cmd, selectStr, ListEx.GetWhereStr(whereList), param, "typeid, extraid", outFields, 0, 0, mattressExtra);
-
-                            rslt.extraEnum = mattressExtra;
+                            var extraEnum = new List<u_mattress_extra>();
+                            var extraTypeEnum = new List<u_mattress_extra_type>();
+                            getExtraType(cmd, ref extraTypeEnum, ref extraEnum);
+                            rslt.extraEnum = extraEnum;
+                            rslt.extraTypeEnum = extraTypeEnum;
                         }
                     }
                     else
@@ -278,31 +262,15 @@ namespace JLHHJSvr.Excutor
                         rslt.mattressMx = dw_2;
 
                         #region 导入其他额外费用和特殊工艺
+                        var extraEnum = new List<u_mattress_extra>();
+                        var extraTypeEnum = new List<u_mattress_extra_type>();
+                        getExtraType(cmd, ref extraTypeEnum, ref extraEnum);
+                        rslt.extraEnum = extraEnum;
+                        rslt.extraTypeEnum = extraTypeEnum;
 
-                        selectStr = @"
-                                SELECT
-			                        extraid
-			                        ,extratypename
-			                        ,extraname
-			                        ,typeid
-			                        ,price
-			                        ,dscrp
-			                        ,inuse
-			                        ,inputtype
-			                        ,ifinit
-		                        From u_mattress_extra";
-                        outFields = "extraid,extratypename,extraname,typeid,price,dscrp,inuse,inputtype,ifinit";
-                        whereList = new List<string>();
-                        whereList.Add("u_mattress_extra.inuse = 0");
-                        param = new Dictionary<string, object>();
-
-                        var mattressExtra = new List<u_mattress_extra>();
-                        DbSqlHelper.SelectJoin(cmd, selectStr, ListEx.GetWhereStr(whereList), param, "typeid, extraid", outFields, 0, 0, mattressExtra);
-
-                        rslt.extraEnum = mattressExtra;
                         rslt.extraProcessesMx = new List<u_mattress_mx_extra>();
-                        var processesMx = mattressExtra.Where(item => item.ifinit == 1 && item.typeid == 1).ToArray();
-                        var costsMx = mattressExtra.Where(item => item.ifinit == 1 && item.typeid == 2).ToArray();
+                        var processesMx = extraEnum.Where(item => item.ifinit == 1 && item.typeid == 1).ToArray();
+                        var costsMx = extraEnum.Where(item => item.ifinit == 1 && item.typeid == 2).ToArray();
                         foreach (var mx in processesMx)
                         {
                             u_mattress_mx_extra mxItem = new u_mattress_mx_extra
@@ -310,7 +278,7 @@ namespace JLHHJSvr.Excutor
                                 mattressid = 0,
                                 mattressmxid = 0,
                                 extraid = mx.extraid,
-                                extraname = mx.extraname,
+                                extraname = mx.extramxname,
                                 dscrp = mx.dscrp,
                                 price = mx.price,
                                 typeid = mx.typeid
@@ -324,7 +292,7 @@ namespace JLHHJSvr.Excutor
                                 mattressid = 0,
                                 mattressmxid = 0,
                                 extraid = mx.extraid,
-                                extraname = mx.extraname,
+                                extraname = mx.extramxname,
                                 dscrp = mx.dscrp,
                                 price = mx.price,
                                 typeid = mx.typeid
@@ -337,7 +305,56 @@ namespace JLHHJSvr.Excutor
                 }
             }
         }
+        private void getExtraType(SqlCommand cmd, ref List<u_mattress_extra_type> extraTypeEnum, ref List<u_mattress_extra> extraEnum)
+        {
+            #region 查询额外费用定义项目
+            var selectStr = @"
+                                SELECT
+			                        u_mattress_extra.extraid
+			                        ,extramxid
+			                        ,extramxname
+			                        ,u_mattress_extra_type.typeid
+			                        ,price
+			                        ,dscrp
+			                        ,u_mattress_extra.inuse
+			                        ,inputtype
+			                        ,ifinit
+		                        From u_mattress_extra
+		                        inner join u_mattress_extra_type on u_mattress_extra_type.extraid = u_mattress_extra.extraid 
+                                    AND u_mattress_extra_type.inuse = 0
+		                        ";
+            var outFields = "extraid,extramxname,typeid,price,dscrp,inuse,inputtype,ifinit";
+            var whereList = new List<string>();
+            whereList.Add("u_mattress_extra.inuse = 0");
+            var param = new Dictionary<string, object>();
+
+            var mattressExtra = new List<u_mattress_extra>();
+            DbSqlHelper.SelectJoin(cmd, selectStr, ListEx.GetWhereStr(whereList), param, "typeid, extraid", outFields, 0, 0, mattressExtra);
+            extraEnum = mattressExtra;
+            #endregion
+
+            #region 查询额外费用定义类型
+            selectStr = @"
+                                SELECT
+			                        extraid
+                                    ,typename
+                                    ,typeid
+                                    ,inuse
+                                    ,createby
+                                    ,createtime
+		                        From u_mattress_extra_type
+		                        ";
+            outFields = "extraid, typename, typeid, inuse, createby, createtime";
+            whereList = new List<string>();
+            whereList.Add("u_mattress_extra_type.inuse = 0");
+            param = new Dictionary<string, object>();
+
+            var mattressExtraType = new List<u_mattress_extra_type>();
+            DbSqlHelper.SelectJoin(cmd, selectStr, ListEx.GetWhereStr(whereList), param, "typeid, extraid", outFields, 0, 0, mattressExtraType);
+            extraTypeEnum = mattressExtraType;
+            #endregion
 
+        }
         private void wf_add_side(SqlCommand cmd, int[] formulakindList, string arg_name, ref List<u_mattress_mx_mtrl> dw_2)
         {
             foreach(int ll_formulakind in formulakindList)

+ 4 - 2
JLHHJSvr/Excutor/ReCalculateNoAuditExcutor.cs

@@ -65,11 +65,13 @@ namespace JLHHJSvr.Excutor
                         {
                             var mattress_temp = helper.GetMattress(mattress.mattressid);
                             var mxList = helper.GetMattressMxMtrl(mattress.mattressid);
+                            var mxExtra1List = helper.GetMattressMxExtra(mattress.mattressid, 1);
+                            var mxExtra2List = helper.GetMattressMxExtra(mattress.mattressid, 2);
                             var subspecsList = helper.GetMattressSubspecs(mattress.mattressid);
 
-                            helper.CalCulateFormula(mattress_temp, mxList);
+                            helper.CalCulateFormula(mattress_temp, mxList, true, true, mxExtra1List, mxExtra2List);
 
-                            helper.SaveMattress(mattress_temp, mxList, subspecsList);
+                            helper.SaveMattress(mattress_temp, mxList, mxExtra1List, mxExtra2List);
                         }
                         cmd.Transaction.Commit();
                     }

+ 5 - 5
JLHHJSvr/Excutor/SaveMattressExcutor.cs

@@ -67,7 +67,7 @@ namespace JLHHJSvr.Excutor
                     {
                         rslt.mxmessage = new List<string>();
 
-                        rslt.mxmessage = toSaveMattress(cmd, request.mattress, request.mattressMx, tokendata);
+                        rslt.mxmessage = toSaveMattress(cmd, request.mattress, request.mattressMx, request.extraProcesses, request.extraCosts, tokendata);
 
                         rslt.mattressid = request.mattress.mattressid;
                         rslt.mattresscode = request.mattress.mattresscode;
@@ -215,7 +215,7 @@ namespace JLHHJSvr.Excutor
                                     }
                                 }
 
-                                toSaveMattress(cmd, _mattress, _mattressMx, tokendata);
+                                toSaveMattress(cmd, _mattress, _mattressMx, request.extraProcesses, request.extraCosts, tokendata);
                             }
                         }
 
@@ -233,7 +233,7 @@ namespace JLHHJSvr.Excutor
             }
         }
 
-        public List<string> toSaveMattress(SqlCommand cmd, u_mattress mattress, List<u_mattress_mx_mtrl> mattressMx, TokenData tokendata)
+        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)
         {
             var helper = HelperBase.GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
 
@@ -241,7 +241,7 @@ namespace JLHHJSvr.Excutor
 
             try
             {
-                helper.CalCulateFormula(mattress, mattressMx);
+                helper.CalCulateFormula(mattress, mattressMx, true, true, extraProcesses, extraCosts);
             }
             catch (Exception e)
             {
@@ -259,7 +259,7 @@ namespace JLHHJSvr.Excutor
 
             try
             {
-                helper.SaveMattress(mattress, mattressMx);
+                helper.SaveMattress(mattress, mattressMx, extraProcesses, extraCosts);
 
                 if (mattress.copy_id != null && mattress.copy_id > 0)
                 {

+ 9 - 7
JLHHJSvr/Excutor/SaveMattressExtraExcutor.cs

@@ -29,9 +29,9 @@ namespace JLHHJSvr.Excutor
                 return;
             }
 
-            if (string.IsNullOrEmpty(request.data.extratypename))
+            if (string.IsNullOrEmpty(request.data.extramxname))
             {
-                rslt.ErrMsg = "请填写项目类型名称";
+                rslt.ErrMsg = "请填写项目名称";
                 return;
             }
 
@@ -48,17 +48,19 @@ namespace JLHHJSvr.Excutor
                 {
                     try
                     {
-                        var fields = "extratypename,extraname,typeid,price,dscrp,inuse,ifinit,inputtype";
-                        if (request.data.extraid <= 0)
+                        var fields = "extraid,extramxname,price,dscrp,inuse,ifinit,inputtype,createby,createtime";
+                        request.data.createby = tokendata.username;
+                        request.data.createtime = DateTime.Now;
+                        if (request.data.extramxid <= 0)
                         {
-                            request.data.extraid = BllHelper.GetID(cmd, "u_mattress_extra");
+                            request.data.extramxid = BllHelper.GetID(cmd, "u_mattress_extra");
 
-                            DbSqlHelper.Insert(cmd, "u_mattress_extra", null, request.data, "extraid," + fields);
+                            DbSqlHelper.Insert(cmd, "u_mattress_extra", null, request.data, "extramxid," + fields);
                         }
                         else
                         {
                             //修改
-                            DbSqlHelper.Update(cmd, "u_mattress_extra", null, request.data, "extraid", fields);
+                            DbSqlHelper.Update(cmd, "u_mattress_extra", null, request.data, "extramxid", fields);
                         }
 
                         cmd.Transaction.Commit();

+ 77 - 0
JLHHJSvr/Excutor/SaveMattressExtraTypeExcutor.cs

@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using JLHHJSvr.BLL;
+using JLHHJSvr.Com;
+using JLHHJSvr.LJException;
+using JLHHJSvr.Tools;
+using LJLib.DAL.SQL;
+using LJLib.Net.SPI.Server;
+
+namespace JLHHJSvr.Excutor
+{
+    internal sealed class SaveMattressExtraTypeExcutor : ExcutorBase<SaveMattressExtraTypeRequest, SaveMattressExtraTypeResponse>
+    {
+        protected override void ExcuteInternal(SaveMattressExtraTypeRequest request, object state, SaveMattressExtraTypeResponse rslt)
+        {
+            var tokendata = BllHelper.GetToken(request.token);
+            if (tokendata == null)
+            {
+                rslt.ErrMsg = "会话已经中断,请重新登录";
+                return;
+            }
+
+            if (request.data == null)
+            {
+                rslt.ErrMsg = "未提交数据定义";
+                return;
+            }
+
+            if (string.IsNullOrEmpty(request.data.typename))
+            {
+                rslt.ErrMsg = "请填写类型名称";
+                return;
+            }
+
+            using (var con = new SqlConnection(GlobalVar.ConnectionString))
+            using (var cmd = con.CreateCommand())
+            {
+                con.Open();
+
+                var dtNow = DateTime.Now;
+
+                AutoInit.AutoInitS(cmd, request.data);
+
+                using (cmd.Transaction = con.BeginTransaction())
+                {
+                    try
+                    {
+                        var fields = "typename,typeid,inuse,createby,createtime";
+                        request.data.createby = tokendata.username;
+                        request.data.createtime = DateTime.Now;
+                        if (request.data.extraid <= 0)
+                        {
+                            request.data.extraid = BllHelper.GetID(cmd, "u_mattress_extra_type");
+
+                            DbSqlHelper.Insert(cmd, "u_mattress_extra_type", null, request.data, "extraid," + fields);
+                        }
+                        else
+                        {
+                            //修改
+                            DbSqlHelper.Update(cmd, "u_mattress_extra_type", null, request.data, "extraid", fields);
+                        }
+
+                        cmd.Transaction.Commit();
+                    }
+                    catch (Exception e)
+                    {
+                        cmd.Transaction.Rollback();
+                        rslt.ErrMsg = e.ToString();
+                    }
+                }
+            }
+        }
+    }
+}

+ 0 - 12
JLHHJSvr/Excutor/SaveWorkmanshipExcutor.cs

@@ -36,18 +36,6 @@ namespace JLHHJSvr.Excutor
                     rslt.ErrMsg = "利润率有误,请检查!";
                     return;
                 }
-
-                if (item.deptid <= 0)
-                {
-                    rslt.ErrMsg = "部门选择有误,请检查!";
-                    return;
-                }
-
-                if (item.mattresstypeid <= 0)
-                {
-                    rslt.ErrMsg = "床垫类型选择有误,请检查!";
-                    return;
-                }
             }
 
             using (var con = new SqlConnection(GlobalVar.ConnectionString))

+ 2 - 0
JLHHJSvr/GlobalVar/GlobalVar.cs

@@ -226,6 +226,8 @@ namespace JLHHJSvr
                 //excutorManager.AddMap("ImportSpring", typeof(ImportSpringRequest), new ImportSpringExcutor());
                 excutorManager.AddMap("SaveMattressExtra", typeof(SaveMattressExtraRequest), new SaveMattressExtraExcutor());// 保存床网分区定义
                 excutorManager.AddMap("DeleteMattressExtra", typeof(DeleteMattressExtraRequest), new DeleteMattressExtraExcutor());// 删除床网分区定义
+                excutorManager.AddMap("SaveMattressExtraType", typeof(SaveMattressExtraTypeRequest), new SaveMattressExtraTypeExcutor());// 保存床网分区类型
+                excutorManager.AddMap("DeleteMattressExtraType", typeof(DeleteMattressExtraTypeRequest), new DeleteMattressExtraTypeExcutor());// 删除床网分区类型
 
             }
             catch (Exception ex)

File diff suppressed because it is too large
+ 245 - 48
JLHHJSvr/Helper/MattressHelper.cs


+ 5 - 0
JLHHJSvr/JLHHJSvr.csproj

@@ -99,9 +99,12 @@
     <Compile Include="Com\CommonDynamicSelect.cs" />
     <Compile Include="Com\CopyMattressAudited.cs" />
     <Compile Include="Com\CopyMtrlDef.cs" />
+    <Compile Include="Com\DeleteMattressExtraType.cs" />
     <Compile Include="Com\DeleteMattressExtra.cs" />
+    <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\SaveMattressExtraType.cs" />
     <Compile Include="Com\SaveMattressExtra.cs" />
     <Compile Include="Com\UpdateMtrlPrice.cs" />
     <Compile Include="Com\DelCarList.cs" />
@@ -285,7 +288,9 @@
     <Compile Include="Excutor\CommonDynamicSelectExcutor.cs" />
     <Compile Include="Excutor\CopyMattressAuditedExcutor.cs" />
     <Compile Include="Excutor\CopyMtrlDefExcutor.cs" />
+    <Compile Include="Excutor\DeleteMattressExtraTypeExcutor.cs" />
     <Compile Include="Excutor\DeleteMattressExtraExcutor.cs" />
+    <Compile Include="Excutor\SaveMattressExtraTypeExcutor.cs" />
     <Compile Include="Excutor\SaveMattressExtraExcutor.cs" />
     <Compile Include="Excutor\UpdateMtrlPriceExcutor.cs" />
     <Compile Include="Excutor\DelMtrlPfExcutor.cs" />