瀏覽代碼

核价后台: 1、修复床垫清单配置明细错误问题

chen_yjin 3 周之前
父節點
當前提交
fb6493d97e
共有 2 個文件被更改,包括 70 次插入62 次删除
  1. 12 1
      JLHHJSvr/Excutor/SaveConfigureCodeMxExcutor.cs
  2. 58 61
      JLHHJSvr/Helper/InterfaceHelper.cs

+ 12 - 1
JLHHJSvr/Excutor/SaveConfigureCodeMxExcutor.cs

@@ -62,7 +62,18 @@ namespace JLHHJSvr.Excutor
                     {
                         if (request.configure.printid <= 0)
                         {
-                            request.configure.printid = BllHelper.GetID(cmd, "u_configure_codemx");
+                            int _printid = 0;
+                            cmd.CommandText = @"SELECT MAX(printid) AS printid FROM u_configure_codemx WHERE pzid = @pzid";
+                            cmd.Parameters.Clear();
+                            cmd.Parameters.AddWithValue("@pzid", request.configure.pzid);
+                            using (var reader = cmd.ExecuteReader())
+                            {
+                                if (reader.Read())
+                                {
+                                    _printid = Convert.ToInt32(reader["printid"]);
+                                }
+                            }
+                            request.configure.printid = _printid + 1;
 
                             var fields = @"pzid,printid,pzcodemx,namemx,gradestr,mtrlcode,price,ifdft,MCostRate,ProfitRate,dscrp,ifuse,ifnoch,pricerate,packqty,packvol,price_pz,grade";
                             DbSqlHelper.Insert(cmd, "u_configure_codemx", null, request.configure, fields);

+ 58 - 61
JLHHJSvr/Helper/InterfaceHelper.cs

@@ -587,11 +587,15 @@ namespace JLHHJSvr.Helper
                 }
             }
             // 拉链
-            var llList = jianmianList.Where(t => t.formulakind == 202).ToList();
+            var llList = jianmianList.Where(t => t.formulakind == 202 && string.IsNullOrEmpty(t.chastr) && t.mtrlid > 0).ToList();
             for (int i = 0; i < llList.Count; i++)
             {
                 var mx = llList[i];
-                if (string.IsNullOrEmpty(mx.chastr) && mx.mtrlid > 0)
+                if (llList.Count > 1)
+                {
+                    interfaceList.Add(InserMattressInterfacePz("拉手刺绣及其他工艺", "拉链" + (i+1), 1, new string[] { $"{mx.qty.Value.ToString("#,##0.0#")}米{mx.mtrlname}" }));
+                }
+                else
                 {
                     interfaceList.Add(InserMattressInterfacePz("拉手刺绣及其他工艺", "拉链", 1, new string[] { $"{mx.qty.Value.ToString("#,##0.0#")}米{mx.mtrlname}" }));
                 }
@@ -603,7 +607,7 @@ namespace JLHHJSvr.Helper
             var mianList1 = new HashSet<string> { "面裥绵", "底裥绵" };
             var mianList2 = new string[4] { "顶布裥棉1", "顶布裥棉2", "顶布裥棉3", "顶布裥棉4" };
             var mianList3 = new HashSet<string> { "普通大侧", "上下拼侧1", "上下拼侧2", "上下拼侧3", "左右拼侧1", "左右拼侧2", "左右拼侧3", "小侧1", "小侧2", "小侧3" };
-            var mianList4 = new HashSet<string> { "小侧1", "小侧2", "小侧3" };
+            //var mianList4 = new HashSet<string> { "小侧1", "小侧2", "小侧3" };
 
             var name_arr = new string[5];
             foreach (var mx in mxlist)
@@ -619,17 +623,17 @@ namespace JLHHJSvr.Helper
                 }
             }
 
-            if (mianList4.Contains(key))
-            {
-                var _index = 0;
-                Regex regex = new Regex(@"\d+");
-                Match match = regex.Match(key);
-                _index = Convert.ToInt32(match.Value) - 1;
-                for (int i = 0; i < mianList4.Count; i++)
-                {
-                    XiaoCePeizhi.SetValue(name_arr[i], i, _index);
-                }
-            }
+            //if (mianList4.Contains(key))
+            //{
+            //    var _index = 0;
+            //    Regex regex = new Regex(@"\d+");
+            //    Match match = regex.Match(key);
+            //    _index = Convert.ToInt32(match.Value) - 1;
+            //    for (int i = 0; i < mianList4.Count; i++)
+            //    {
+            //        XiaoCePeizhi.SetValue(name_arr[i], i, _index);
+            //    }
+            //}
 
             var sb = new StringBuilder();
             foreach (var name2 in name_arr)
@@ -637,51 +641,48 @@ namespace JLHHJSvr.Helper
                 sb.Append(name2);
             }
 
-            if (sb.Length > 0 || mianList2.Contains(key))
+            bool ifchastr3 = false;
+            if (sb.Length > 0)
             {
                 if (!string.IsNullOrEmpty(chastrArr[1])) interfaceList.Add(InserMattressInterfacePz(chastrArr[0], chastrArr[1], 2, name_arr));
                 interfaceList.Add(InserMattressInterfacePz(chastrArr[0], chastrArr[2], 1, new string[] { "" }));
-                if (chastrArr.Length > 3) interfaceList.Add(InserMattressInterfacePz(chastrArr[0], chastrArr[3], 1, new string[] { "" }));
-            }
-
-            if (mianList3.Contains(key)) { 
-                foreach (var name in chastrArr)
+                if (chastrArr.Length > 3)
                 {
-                    if (string.IsNullOrEmpty(name)) continue;
-                    // 计算小测是否添加说明
-                    bool ifInert = true;
-                    if (mianList4.Contains(key))
-                    {
-                        ifInert = ifHasXiaoceMtrl();
-                    }
-                    if (name.Contains("说明") && ifInert)
-                    {
-                        interfaceList.Add(InserMattressInterfacePz(chastrArr[0], name, 1, new string[] { "" }));
-                    }
+                    if (chastrArr[3].Contains("说明")) ifchastr3 = true;
+                    interfaceList.Add(InserMattressInterfacePz(chastrArr[0], chastrArr[3], 1, new string[] { "" }));
                 }
             }
 
-        }
-        private bool ifHasXiaoceMtrl()
-        {
-            bool hasVal = false;
-            for (int i = 0; i < XiaoCePeizhi.GetLength(0); i++)
+            foreach (var name in chastrArr)
             {
-                for (int j = 0; j < XiaoCePeizhi.GetLength(1); j++)
-                {
-                    if (!string.IsNullOrEmpty(XiaoCePeizhi[i, j]))
-                    {
-                        hasVal = true;
-                        break;
-                    }
-                }
-                if (hasVal)
+                if (string.IsNullOrEmpty(name)) continue;
+                if (name.Contains("说明") && !ifchastr3)
                 {
-                    break;
+                    interfaceList.Add(InserMattressInterfacePz(chastrArr[0], name, 1, new string[] { "" }));
                 }
             }
-            return hasVal;
+
         }
+        //private bool ifHasXiaoceMtrl()
+        //{
+        //    bool hasVal = false;
+        //    for (int i = 0; i < XiaoCePeizhi.GetLength(0); i++)
+        //    {
+        //        for (int j = 0; j < XiaoCePeizhi.GetLength(1); j++)
+        //        {
+        //            if (!string.IsNullOrEmpty(XiaoCePeizhi[i, j]))
+        //            {
+        //                hasVal = true;
+        //                break;
+        //            }
+        //        }
+        //        if (hasVal)
+        //        {
+        //            break;
+        //        }
+        //    }
+        //    return hasVal;
+        //}
 
         private void SetFormulaTypeZeroPzName(u_mattress_mx_mtrl mx, string key, int[] powerArr, string[] name_arr)
         {
@@ -927,17 +928,18 @@ namespace JLHHJSvr.Helper
         }
         private void AutoSetFormulaTypeTwoPz(List<u_mattress_mx_mtrl> mxlist, List<u_mattress_interface> interfaceList)
         {
-            var fuliaoList = mxlist.Where(t => t.formulatype == 2).ToList();
-
             var nameSet = new HashSet<string>(new string[] {
                 "白色无字包角", "保用卡", "采购小标", "打钮钮扣", "打印小标", "合格证", "画纸", "角网+拉链",
                 "开箱刀+开箱说明", "开箱说明+开箱刀", "气钮", "吊标", "说明书", "斜标", "正标", "织唛",
                 "织唛斜标", "客供标", "空白牛皮纸包角", "空白珍珠包角"
             });
+            // 按照nameSet排序
+            Dictionary<string, int> orderDict = nameSet.Select((name, index) => new { Name = name, Index = index }).ToDictionary(x => x.Name, x => x.Index);
+            var fuliaoList = mxlist.Where(t => t.formulatype == 2).OrderBy(t => orderDict.ContainsKey(t.mtrlname) ? orderDict[t.mtrlname] : int.MaxValue).ThenBy(t => !orderDict.ContainsKey(t.mtrlname) ? t.mtrlname : null).ToList();
+
             var extraSet = new HashSet<string>(new string[] { "采购小标", "打印小标", "合格证", "吊标", "斜标", "正标", "织唛", "织唛斜标", "客供标" });
             var specialSet = new HashSet<string>(new string[] { "打钮钮扣", "气钮" });
 
-            var index = 0;
             foreach (var mx in fuliaoList)
             {
                 if (mx.mtrlid > 0)
@@ -956,22 +958,20 @@ namespace JLHHJSvr.Helper
                     {
                         for (int i = 1; i <= cnt; i++)
                         {
-                            index++;
                             // 添加辅料接口
-                            interfaceList.Add(InserMattressInterfacePz("辅料", $"{mx.mtrlname}{index}", 1, new string[] { "" }));
+                            interfaceList.Add(InserMattressInterfacePz("辅料", $"{mx.mtrlname}{i}", 1, new string[] { "" }));
                             // 如果是额外的辅料,添加位置接口
                             if (extraSet.Contains(mx.mtrlname))
                             {
-                                interfaceList.Add(InserMattressInterfacePz("辅料", $"{mx.mtrlname}{index}位置", 0, new string[] { "" }));
+                                interfaceList.Add(InserMattressInterfacePz("辅料", $"{mx.mtrlname}{i}位置", 0, new string[] { "" }));
                             }
                         }
                     }else if(mx.formulakind == 15 && !nameSet.Contains(mx.mtrlname))
                     {
                         for (int i = 1; i <= cnt; i++)
                         {
-                            index++;
-                            interfaceList.Add(InserMattressInterfacePz("辅料", $"{mx.mtrlname}{index}", 1, new string[] { "" }));
-                            interfaceList.Add(InserMattressInterfacePz("辅料", $"{mx.mtrlname}{index}位置", 0, new string[] { "" }));
+                            interfaceList.Add(InserMattressInterfacePz("辅料", $"{mx.mtrlname}{i}", 1, new string[] { "" }));
+                            interfaceList.Add(InserMattressInterfacePz("辅料", $"{mx.mtrlname}{i}位置", 0, new string[] { "" }));
                         }
                     }
                 }
@@ -1053,7 +1053,6 @@ namespace JLHHJSvr.Helper
                 {"底裥绵",new string[] { "内布套-底层裥棉", "内布套-底层裥棉裥棉图案" } },
                 {"普通大侧",new string[] { "内布套-大侧裥棉", "内布套-大侧裥棉裥棉图案" } }
             };
-            var mianList = new string[2] { "面裥绵", "底裥绵" };
 
             foreach (var item in powerDict)
             {
@@ -1069,7 +1068,7 @@ namespace JLHHJSvr.Helper
                     sb.Append(name2);
                 }
 
-                if (sb.Length > 0 || mianList.Contains(item.Key))
+                if (sb.Length > 0)
                 {
                     interfaceList.Add(InserMattressInterfacePz("内布套", chastrDict[item.Key][0], 2, name_arr));
                     interfaceList.Add(InserMattressInterfacePz("内布套", chastrDict[item.Key][1], 1, new string[] { "" }));
@@ -1093,8 +1092,8 @@ namespace JLHHJSvr.Helper
             if (mattress.if_n_butao == 1)
             {
                 butaostring = new string[] { $"内布套面层向大侧覆盖{mattress.s_cover_qty.Value.ToString("#,##0.0#")}CM、内布套大侧向底层覆盖{mattress.z_cover_qty.Value.ToString("#,##0.0#")}CM、内布套底层向大侧覆盖{mattress.x_cover_qty.Value.ToString("#,##0.0#")}CM" };
+                interfaceList.Add(InserMattressInterfacePz("内布套", "内布套做法说明", 1, butaostring));
             }
-            interfaceList.Add(InserMattressInterfacePz("内布套", "内布套做法说明", 1, butaostring));
         }
         #endregion
 
@@ -1725,8 +1724,6 @@ namespace JLHHJSvr.Helper
         #region 全局变量
         // 储存顶布裥棉数据
         private string[,] DingBuLianMian = new string[4,5];
-        // 储存顶布裥棉数据
-        private string[,] XiaoCePeizhi = new string[3, 5];
         private enum PackType
         {
             压包 = 0,