chen_yjin vor 1 Monat
Ursprung
Commit
13d6d77b8d

+ 7 - 7
JLHHJSvr/DataStore/_Mapper_formulakind_dc.xml

@@ -3,31 +3,31 @@
 	<json>
 		[
 			{
-				"value": "32",
+				"value": 32,
 				"label": "垫层"
 			},
 			{
-				"value": "999",
+				"value": 999,
 				"label": "床网_"
 			},
 			{
-				"value": "12",
+				"value": 12,
 				"label": "顶布"
 			},
 			{
-				"value": "1201",
+				"value": 1201,
 				"label": "顶布裥棉"
 			},
 			{
-				"value": "13",
+				"value": 13,
 				"label": "毡类"
 			},
 			{
-				"value": "14",
+				"value": 14,
 				"label": "打底无纺布"
 			},
 			{
-				"value": "29",
+				"value": 29,
 				"label": "网面布料"
 			}
 		]

+ 181 - 161
JLHHJSvr/Excutor/GetMattressImportDW2Excutor.cs

@@ -25,11 +25,6 @@ namespace JLHHJSvr.Excutor
                 rslt.ErrMsg = "会话已经中断,请重新登录";
                 return;
             }
-            if (request.mattresstypeid == 0)
-            {
-                rslt.ErrMsg = "床垫类别不能为0";
-                return;
-            }
 
             using (var con = new SqlConnection(GlobalVar.ConnectionString))
             using (var cmd = con.CreateCommand())
@@ -45,195 +40,220 @@ namespace JLHHJSvr.Excutor
                 using (cmd.Transaction = con.BeginTransaction())
                 {
 
-                    var mattersstype = new u_mattress_type() { mattresstypeid = request.mattresstypeid };
-                    DbSqlHelper.SelectOne(cmd, mattersstype, "biandaiqty, if_top_side, if_button_sdie, if_big_side, if_small_side, if_v_side, if_in_cloth_cover, if_out_cloth_cover, if_small_side2, if_small_side3, if_v_side2, if_v_side3, dianceng_sort, dianceng_area");
-                    rslt.biandai_qty = mattersstype.biandaiqty;
-
-                    AutoInit.AutoInitS(cmd, mattersstype);
-
-                    var helper = HelperBase.GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
-
-                    var selectStr = @"
-                            SELECT formulaid
-	                            ,formulakind
-	                            ,formulatype
-	                            ,sortcode
-	                            ,if_mtrl
-	                            ,formula
-	                            ,usetype
-	                            ,if_packtype0
-	                            ,if_packtype1
-	                            ,if_packtype2
-	                            ,default_mtrlid
-	                            ,createtime
-	                            ,createby
-	                            ,useformula
-	                            ,gydscrp
-	                            ,mtrltype
-                            FROM u_mattress_formula";
-                    var outFields = "formulaid, formulakind, formulatype, sortcode, if_mtrl, formula, usetype, if_packtype0, if_packtype1, if_packtype2, default_mtrlid, createtime, createby, useformula, gydscrp, mtrltype";
-                    var whereList = new List<string>();
-                    whereList.Add("u_mattress_formula.formulatype IN (0, 1, 2, 3, 99, 104)");
-                    whereList.Add("u_mattress_formula.usetype = @usetype");
-                    var param = new Dictionary<string, object>();
-
-
-                    //   导入 0-通用类型  的公式
-                    param.Add("@usetype", 0);
-                    var mattressFormulaList0 = new List<u_mattress_formula>();
-                    DbSqlHelper.SelectJoin(cmd, selectStr, ListEx.GetWhereStr(whereList), param, "formulatype, sortcode", outFields, 0, 0, mattressFormulaList0);
-
-                    var dw_2 = new List<u_mattress_mx_mtrl>();
-
-                    foreach (var mx in mattressFormulaList0)
+                    if (request.mattresstypeid == 0)
                     {
-                        if (new[] { 11, 12, 32, 33, 13, 14, 29, 999, 1201 }.Contains(mx.formulakind.Value)) continue;
-
-                        var newDw2 = new u_mattress_mx_mtrl();
-                        AutoInit.AutoInitS(newDw2);
-                        if (mx.if_mtrl > 1)
+                        if (request.mattressid == 0)
                         {
-                            newDw2.addmx = "+";
-                            newDw2.delmx = "-";
+                            rslt.ErrMsg = "床垫类别不能为0";
+                            return;
+                        }
+                        else
+                        {
+                            var matterss = new u_mattress() { mattressid = request.mattressid };
+                            DbSqlHelper.SelectOne(cmd, matterss, "mattresstypeid");
+
+                            var mattersstype = new u_mattress_type() { mattresstypeid = matterss.mattresstypeid };
+                            DbSqlHelper.SelectOne(cmd, mattersstype, "biandaiqty, if_top_side, if_button_sdie, if_big_side, if_small_side, if_v_side, if_in_cloth_cover, if_out_cloth_cover, if_small_side2, if_small_side3, if_v_side2, if_v_side3, dianceng_sort, dianceng_area");
+                           
+                            rslt.diancengarea = new List<replacement>();
+                            if (!string.IsNullOrEmpty(mattersstype.dianceng_area))
+                            {
+                                rslt.diancengarea = wf_add_dianceng_area_bytype(cmd, mattersstype.dianceng_area);
+                            }
                         }
-                        newDw2.formulatype = mx.formulatype;
-                        newDw2.if_mtrl = mx.if_mtrl;
-                        newDw2.formulaid = mx.formulaid;
-                        newDw2.sortcode = mx.sortcode;
-                        newDw2.formulakind = mx.formulakind;
-                        newDw2.formula = mx.formula;
-                        newDw2.useformula = mx.useformula;
-                        newDw2.gydscrp = mx.gydscrp;
-
-                        dw_2.Add(newDw2);
                     }
-
-                    //   导入 1-按床垫类别  的公式
-                    var mattressFormulaList1 = new List<u_mattress_formula>();
-                    param.Clear();
-                    param.Add("@usetype", 1);
-                    DbSqlHelper.SelectJoin(cmd, selectStr, ListEx.GetWhereStr(whereList), param, "formulatype, sortcode", outFields, 0, 0, mattressFormulaList1);
-
-                    foreach (var mx in mattressFormulaList1)
+                    else
                     {
-                        var ls_chastr = "";
-
-                        if (request.ifbcptype == 1)
+                        var mattersstype = new u_mattress_type() { mattresstypeid = request.mattresstypeid };
+                        DbSqlHelper.SelectOne(cmd, mattersstype, "biandaiqty, if_top_side, if_button_sdie, if_big_side, if_small_side, if_v_side, if_in_cloth_cover, if_out_cloth_cover, if_small_side2, if_small_side3, if_v_side2, if_v_side3, dianceng_sort, dianceng_area");
+                        rslt.biandai_qty = mattersstype.biandaiqty;
+
+                        AutoInit.AutoInitS(cmd, mattersstype);
+
+                        var helper = HelperBase.GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
+
+                        var selectStr = @"
+                                SELECT formulaid
+	                                ,formulakind
+	                                ,formulatype
+	                                ,sortcode
+	                                ,if_mtrl
+	                                ,formula
+	                                ,usetype
+	                                ,if_packtype0
+	                                ,if_packtype1
+	                                ,if_packtype2
+	                                ,default_mtrlid
+	                                ,createtime
+	                                ,createby
+	                                ,useformula
+	                                ,gydscrp
+	                                ,mtrltype
+                                FROM u_mattress_formula";
+                        var outFields = "formulaid, formulakind, formulatype, sortcode, if_mtrl, formula, usetype, if_packtype0, if_packtype1, if_packtype2, default_mtrlid, createtime, createby, useformula, gydscrp, mtrltype";
+                        var whereList = new List<string>();
+                        whereList.Add("u_mattress_formula.formulatype IN (0, 1, 2, 3, 99, 104)");
+                        whereList.Add("u_mattress_formula.usetype = @usetype");
+                        var param = new Dictionary<string, object>();
+
+
+                        //   导入 0-通用类型  的公式
+                        param.Add("@usetype", 0);
+                        var mattressFormulaList0 = new List<u_mattress_formula>();
+                        DbSqlHelper.SelectJoin(cmd, selectStr, ListEx.GetWhereStr(whereList), param, "formulatype, sortcode", outFields, 0, 0, mattressFormulaList0);
+
+                        var dw_2 = new List<u_mattress_mx_mtrl>();
+
+                        foreach (var mx in mattressFormulaList0)
                         {
-                            if (new[] { 0, 40, 50, 60, 70, 80, 1, 41, 51, 61, 71, 81, 2, 42, 52, 62, 72, 82, 3, 43, 53, 63, 73, 83, 4, 44, 54, 64, 74, 84 }.Contains(mx.formulakind.Value))
+                            if (new[] { 11, 12, 32, 33, 13, 14, 29, 999, 1201 }.Contains(mx.formulakind.Value)) continue;
+
+                            var newDw2 = new u_mattress_mx_mtrl();
+                            AutoInit.AutoInitS(newDw2);
+                            if (mx.if_mtrl > 1)
                             {
-                                continue;
+                                newDw2.addmx = "+";
+                                newDw2.delmx = "-";
                             }
+                            newDw2.formulatype = mx.formulatype;
+                            newDw2.if_mtrl = mx.if_mtrl;
+                            newDw2.formulaid = mx.formulaid;
+                            newDw2.sortcode = mx.sortcode;
+                            newDw2.formulakind = mx.formulakind;
+                            newDw2.formula = mx.formula;
+                            newDw2.useformula = mx.useformula;
+                            newDw2.gydscrp = mx.gydscrp;
+
+                            dw_2.Add(newDw2);
                         }
 
-                        if (new[] { 0, 40, 50, 60, 70, 80 }.Contains(mx.formulakind.Value))
-                        {
-                            ls_chastr = "面裥绵";
-                            if (mattersstype.if_top_side == 0) continue;
-                        }
+                        //   导入 1-按床垫类别  的公式
+                        var mattressFormulaList1 = new List<u_mattress_formula>();
+                        param.Clear();
+                        param.Add("@usetype", 1);
+                        DbSqlHelper.SelectJoin(cmd, selectStr, ListEx.GetWhereStr(whereList), param, "formulatype, sortcode", outFields, 0, 0, mattressFormulaList1);
 
-                        if (new[] { 1, 41, 51, 61, 71, 81 }.Contains(mx.formulakind.Value))
+                        foreach (var mx in mattressFormulaList1)
                         {
-                            ls_chastr = "底裥绵";
-                            if (mattersstype.if_button_sdie == 0) continue;
+                            var ls_chastr = "";
+
+                            if (request.ifbcptype == 1)
+                            {
+                                if (new[] { 0, 40, 50, 60, 70, 80, 1, 41, 51, 61, 71, 81, 2, 42, 52, 62, 72, 82, 3, 43, 53, 63, 73, 83, 4, 44, 54, 64, 74, 84 }.Contains(mx.formulakind.Value))
+                                {
+                                    continue;
+                                }
+                            }
+
+                            if (new[] { 0, 40, 50, 60, 70, 80 }.Contains(mx.formulakind.Value))
+                            {
+                                ls_chastr = "面裥绵";
+                                if (mattersstype.if_top_side == 0) continue;
+                            }
+
+                            if (new[] { 1, 41, 51, 61, 71, 81 }.Contains(mx.formulakind.Value))
+                            {
+                                ls_chastr = "底裥绵";
+                                if (mattersstype.if_button_sdie == 0) continue;
+                            }
+
+                            if (new[] { 2, 42, 52, 62, 72, 82 }.Contains(mx.formulakind.Value))
+                            {
+                                ls_chastr = "普通大侧";
+                                if (mattersstype.if_big_side == 0) continue;
+                            }
+
+                            if (new[] { 3, 43, 53, 63, 73, 83 }.Contains(mx.formulakind.Value))
+                            {
+                                ls_chastr = "小侧1";
+                                if (mattersstype.if_small_side == 0) continue;
+                            }
+
+                            if (new[] { 4, 44, 54, 64, 74, 84 }.Contains(mx.formulakind.Value))
+                            {
+                                ls_chastr = "V侧1";
+                                if (mattersstype.if_v_side == 0) continue;
+                            }
+
+                            if (new[] { 101, 102, 103, 104, 105, 106 }.Contains(mx.formulakind.Value))
+                            {
+                                if (mattersstype.if_in_cloth_cover == 0) continue;
+                            }
+
+                            if (new[] { 111, 112, 113, 114, 115, 116 }.Contains(mx.formulakind.Value))
+                            {
+                                if (mattersstype.if_out_cloth_cover == 0) continue;
+                            }
+
+                            var newDw2 = new u_mattress_mx_mtrl();
+                            AutoInit.AutoInitS(newDw2);
+                            if (mx.if_mtrl > 1)
+                            {
+                                newDw2.addmx = "+";
+                                newDw2.delmx = "-";
+                            }
+                            newDw2.formulatype = mx.formulatype;
+                            newDw2.if_mtrl = mx.if_mtrl;
+                            newDw2.formulaid = mx.formulaid;
+                            newDw2.sortcode = mx.sortcode;
+                            newDw2.formulakind = mx.formulakind;
+                            newDw2.formula = mx.formula;
+                            newDw2.chastr = ls_chastr;
+                            newDw2.useformula = mx.useformula;
+                            newDw2.gydscrp = mx.gydscrp;
+
+                            dw_2.Add(newDw2);
                         }
 
-                        if (new[] { 2, 42, 52, 62, 72, 82 }.Contains(mx.formulakind.Value))
+                        //   导入 2-按包装方式  的公式
+                        helper.wf_import_bz(request.packtype, ref dw_2);
+
+
+                        //加多一个 小侧2
+                        if (mattersstype.if_small_side2 == 1 && request.ifbcptype == 0)
                         {
-                            ls_chastr = "普通大侧";
-                            if (mattersstype.if_big_side == 0) continue;
+                            wf_add_side(cmd, new[] { 3, 83, 43, 53, 63, 73 }, "小侧2", ref dw_2);
                         }
-
-                        if (new[] { 3, 43, 53, 63, 73, 83 }.Contains(mx.formulakind.Value))
+                        //加多一个 小侧3
+                        if (mattersstype.if_small_side3 == 1 && request.ifbcptype == 0)
                         {
-                            ls_chastr = "小侧1";
-                            if (mattersstype.if_small_side == 0) continue;
+                            wf_add_side(cmd, new[] { 3, 83, 43, 53, 63, 73 }, "小侧3", ref dw_2);
                         }
-
-                        if (new[] { 4, 44, 54, 64, 74, 84 }.Contains(mx.formulakind.Value))
+                        //加多一个 V侧2
+                        if (mattersstype.if_v_side2 == 1 && request.ifbcptype == 0)
                         {
-                            ls_chastr = "V侧1";
-                            if (mattersstype.if_v_side == 0) continue;
+                            wf_add_side(cmd, new[] { 4, 84, 44, 54, 64, 74 }, "V侧2", ref dw_2);
                         }
-
-                        if (new[] { 101, 102, 103, 104, 105, 106 }.Contains(mx.formulakind.Value))
+                        //加多一个 V侧3
+                        if (mattersstype.if_v_side3 == 1 && request.ifbcptype == 0)
                         {
-                            if (mattersstype.if_in_cloth_cover == 0) continue;
+                            wf_add_side(cmd, new[] { 4, 84, 44, 54, 64, 74 }, "V侧3", ref dw_2);
                         }
 
-                        if (new[] { 111, 112, 113, 114, 115, 116 }.Contains(mx.formulakind.Value))
+                        // 在 床垫类型 定义里面   按垫层默认配置  自动带出 垫层配置  和  垫层可选项
+                        if (!string.IsNullOrEmpty(mattersstype.dianceng_sort))
                         {
-                            if (mattersstype.if_out_cloth_cover == 0) continue;
+                            wf_add_dianceng_bytype(cmd, mattersstype.dianceng_sort, ref dw_2);
                         }
 
-                        var newDw2 = new u_mattress_mx_mtrl();
-                        AutoInit.AutoInitS(newDw2);
-                        if (mx.if_mtrl > 1)
+                        rslt.diancengarea = new List<replacement>();
+                        if (!string.IsNullOrEmpty(mattersstype.dianceng_area))
                         {
-                            newDw2.addmx = "+";
-                            newDw2.delmx = "-";
+                            rslt.diancengarea = wf_add_dianceng_area_bytype(cmd, mattersstype.dianceng_area);
                         }
-                        newDw2.formulatype = mx.formulatype;
-                        newDw2.if_mtrl = mx.if_mtrl;
-                        newDw2.formulaid = mx.formulaid;
-                        newDw2.sortcode = mx.sortcode;
-                        newDw2.formulakind = mx.formulakind;
-                        newDw2.formula = mx.formula;
-                        newDw2.chastr = ls_chastr;
-                        newDw2.useformula = mx.useformula;
-                        newDw2.gydscrp = mx.gydscrp;
-
-                        dw_2.Add(newDw2);
-                    }
-
-                    //   导入 2-按包装方式  的公式
-                    helper.wf_import_bz(request.packtype, ref dw_2);
 
+                        // 明细排序
+                        helper.wf_sort_mx(ref dw_2);
 
-                    //加多一个 小侧2
-                    if (mattersstype.if_small_side2 == 1 && request.ifbcptype == 0)
-                    {
-                        wf_add_side(cmd, new[] { 3, 83, 43, 53, 63, 73 }, "小侧2", ref dw_2);
-                    }
-                    //加多一个 小侧3
-                    if (mattersstype.if_small_side3 == 1 && request.ifbcptype == 0)
-                    {
-                        wf_add_side(cmd, new[] { 3, 83, 43, 53, 63, 73 }, "小侧3", ref dw_2);
-                    }
-                    //加多一个 V侧2
-                    if (mattersstype.if_v_side2 == 1 && request.ifbcptype == 0)
-                    {
-                        wf_add_side(cmd, new[] { 4, 84, 44, 54, 64, 74 }, "V侧2", ref dw_2);
-                    }
-                    //加多一个 V侧3
-                    if (mattersstype.if_v_side3 == 1 && request.ifbcptype == 0)
-                    {
-                        wf_add_side(cmd, new[] { 4, 84, 44, 54, 64, 74 }, "V侧3", ref dw_2);
-                    }
-
-                    // 在 床垫类型 定义里面   按垫层默认配置  自动带出 垫层配置  和  垫层可选项
-                    if (!string.IsNullOrEmpty(mattersstype.dianceng_sort))
-                    {
-                        wf_add_dianceng_bytype(cmd, mattersstype.dianceng_sort, ref dw_2);
-                    }
-
-                    rslt.diancengarea = new List<replacement>();
-                    if (!string.IsNullOrEmpty(mattersstype.dianceng_area))
-                    {
-                        rslt.diancengarea = wf_add_dianceng_area_bytype(cmd, mattersstype.dianceng_area);
-                    }
-
-                    // 明细排序
-                    helper.wf_sort_mx(ref dw_2);
+                        if (request.mattressid == 0)
+                        {
+                            helper.wf_default_mtrlid(request.pricelistid, ref dw_2);
+                            helper.wf_default_mtrlid_notbz(request.pricelistid, ref dw_2);
+                        }
 
-                    if (request.mattressid == 0)
-                    {
-                        helper.wf_default_mtrlid(request.pricelistid, ref dw_2);
-                        helper.wf_default_mtrlid_notbz(request.pricelistid, ref dw_2);
+                        rslt.mattressMx = dw_2;
                     }
 
-                    rslt.mattressMx = dw_2;
-
                 }
             }
         }