From 81c0b9513432fe5d3879477ae5e9519ccd3a9cba Mon Sep 17 00:00:00 2001 From: sunliang <593170460@qq.com> Date: Mon, 26 Feb 2024 17:20:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BD=AC=E4=BA=A4=E5=90=8E?= =?UTF-8?q?=E4=BB=8E=E6=88=91=E7=9A=84=E6=B5=81=E7=A8=8B=E4=B8=AD=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=E6=B5=81=E7=A8=8B=E7=8A=B6=E6=80=81=E4=B8=8D=E5=AF=B9?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E6=93=8D=E4=BD=9C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CCFlow/Components/BP.En30/DA/DBAccess.cs | 72 ++- CCFlow/Components/BP.En30/Pub/Engine.cs | 607 +++++++++++++------- CCFlow/Components/BP.WF/Data/MyJoinFlow.cs | 5 +- CCFlow/Components/BP.WF/Data/MyStartFlow.cs | 1 - CCFlow/Components/BP.WF/HttpHandler/WF.cs | 6 + CCFlow/Components/BP.WF/WF.cs | 2 + CCFlow/Components/BP.WF/WF/ShiftWork.cs | 5 +- 7 files changed, 476 insertions(+), 222 deletions(-) diff --git a/CCFlow/Components/BP.En30/DA/DBAccess.cs b/CCFlow/Components/BP.En30/DA/DBAccess.cs index cecb6bc9..ee1e2830 100644 --- a/CCFlow/Components/BP.En30/DA/DBAccess.cs +++ b/CCFlow/Components/BP.En30/DA/DBAccess.cs @@ -36,6 +36,8 @@ using Kdbndp; using BP.Difference; using Newtonsoft.Json; using KdbndpTypes; +using MySqlX.XDevAPI; +using System.Text.RegularExpressions; namespace BP.DA { @@ -2555,18 +2557,66 @@ namespace BP.DA if (conn.State != ConnectionState.Open) conn.Open(); - OracleDataAdapter ada = new OracleDataAdapter(selectSQL, conn); - ada.SelectCommand.CommandType = CommandType.Text; - - // 加入参数 - if (paras != null) + OracleDataAdapter ada; + //@BKGY-0224 + if (paras != null && Regex.Matches(selectSQL, ":").Count != paras.Count) { - foreach (Para para in paras) + foreach (Para p in paras) { - OracleParameter myParameter = new OracleParameter(para.ParaName, para.DATypeOfOra); - myParameter.Size = para.Size; - myParameter.Value = para.val; - ada.SelectCommand.Parameters.Add(myParameter); + if (p.DAType == System.Data.DbType.String) + { + if (selectSQL.Contains(BP.Difference.SystemConfig.AppCenterDBVarStr + p.ParaName + ",")) + selectSQL = selectSQL.Replace(BP.Difference.SystemConfig.AppCenterDBVarStr + p.ParaName + ",", "'" + p.val.ToString() + "',"); + else + selectSQL = selectSQL.Replace(BP.Difference.SystemConfig.AppCenterDBVarStr + p.ParaName, "'" + p.val.ToString() + "'"); + } + else + { + if (selectSQL.Contains(BP.Difference.SystemConfig.AppCenterDBVarStr + p.ParaName + ",")) + selectSQL = selectSQL.Replace(BP.Difference.SystemConfig.AppCenterDBVarStr + p.ParaName + ",", p.val.ToString() + ","); + else + selectSQL = selectSQL.Replace(BP.Difference.SystemConfig.AppCenterDBVarStr + p.ParaName, p.val.ToString()); + } + } + + //if (selectSQL.Contains(":")) { + // ada = new OracleDataAdapter(selectSQL, conn); + // ada.SelectCommand.CommandType = CommandType.Text; + + // // 加入参数 + // if (paras != null) + // { + // foreach (Para para in paras) + // { + // OracleParameter myParameter = new OracleParameter(para.ParaName, para.DATypeOfOra); + // myParameter.Size = para.Size; + // myParameter.Value = para.val; + // ada.SelectCommand.Parameters.Add(myParameter); + // } + // } + + //} + //else{ + + ada = new OracleDataAdapter(selectSQL, conn); + ada.SelectCommand.CommandType = CommandType.Text; + //} + + } + else { + ada = new OracleDataAdapter(selectSQL, conn); + ada.SelectCommand.CommandType = CommandType.Text; + + // 加入参数 + if (paras != null) + { + foreach (Para para in paras) + { + OracleParameter myParameter = new OracleParameter(para.ParaName, para.DATypeOfOra); + myParameter.Size = para.Size; + myParameter.Value = para.val; + ada.SelectCommand.Parameters.Add(myParameter); + } } } @@ -3623,7 +3673,7 @@ namespace BP.DA case DBType.KingBaseR3: case DBType.KingBaseR6: case DBType.DM: - sql = "SELECT constraint_name, constraint_type,search_condition, r_constraint_name from user_constraints WHERE table_name = upper(:tab) AND constraint_type = 'P'"; + sql = "SELECT constraint_name, constraint_type,search_condition, r_constraint_name from user_constraints WHERE table_name = upper(:Tab) AND constraint_type = 'P'"; ps.Add("Tab", table); break; case DBType.MySQL: diff --git a/CCFlow/Components/BP.En30/Pub/Engine.cs b/CCFlow/Components/BP.En30/Pub/Engine.cs index c04cea52..2ae0b032 100644 --- a/CCFlow/Components/BP.En30/Pub/Engine.cs +++ b/CCFlow/Components/BP.En30/Pub/Engine.cs @@ -1539,9 +1539,19 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br { //添加表格指定表格的行数和列数(2行,5列) Table table = section.AddTable(true); - table.ResetCells(D2date.Split(',').Count() + 1, TableNums); - //把第一列从第一行到所有项目的所有列全部合并 + //在此次判断是否是最后一个表格,如果是根据实际剩余得元素个数生成列 + if (num == 1) + { + int TableNumsS = TableNums- (TableNum - D3date.Split(',').Count()); + table.ResetCells(D2date.Split(',').Count() + 1, TableNumsS); + } + else + { + table.ResetCells(D2date.Split(',').Count() + 1, TableNums); + } + + //把第一列从第一行到所有项目的所有列全部合并 //如果需要合并行使用下面的例子(把第一行的第一列到第三列合并) //table.ApplyHorizontalMerge(0, 0, 2); int D2Num = D2date.Split(',').Count(); @@ -1939,7 +1949,7 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br D1dateNum = 1; } int rows = 0; - int d2ss = 0; + int d2DATANUM = 0;//记录当前牌号数据条数 int tanum = 2; //元素从第几列开始 //把一个表格拆成所需要的多个表格 @@ -1951,8 +1961,20 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br //添加表格指定表格的行数和列数(2行,5列) Table table = section.AddTable(true); - //创建一个指定行和列得表格 - table.ResetCells(data.Rows.Count + 1, TableNums); + //在此次判断是否是最后一个表格,如果是根据实际剩余得元素个数生成列 + if (num == 1) + { + int TableNumsS = TableNums - (TableNum - D3date.Split(',').Count()); + table.ResetCells(data.Rows.Count + 1, TableNumsS); + } + else + { + table.ResetCells(data.Rows.Count + 1, TableNums); + } + ////添加表格指定表格的行数和列数(2行,5列) + //Table table = section.AddTable(true); + ////创建一个指定行和列得表格 + //table.ResetCells(data.Rows.Count + 1, TableNums); //循环牌号 //循环每个牌号 @@ -1976,10 +1998,10 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br sqls = D1 + "='" + D1date.Split(',')[j] + "'"; } //拿到当前牌号得数据条数 - d2ss = 0; - d2ss = data.Select(sqls).Count(); + d2DATANUM = 0; + d2DATANUM = data.Select(sqls).Count(); ////拿到项目名称 - if (d2ss > 0) + if (d2DATANUM > 0) { for (int i = 0; i < data.Select(sqls).Count(); i++) { @@ -2192,14 +2214,13 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br range.CharacterFormat.Bold = false; table[row, Q].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; table[row, Q].CellFormat.VerticalAlignment = VerticalAlignment.Middle; - } }//循环元素值结束 row = row + 1; }//循环行结束 - rows = rows + d2ss; + rows = rows + d2DATANUM; }//循环牌号结束 table.TableFormat.HorizontalAlignment = RowAlignment.Center;//整个表格居中 @@ -2243,6 +2264,7 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br } } + #region /// /// 替换二维表单@BKGY质量要点 @@ -2251,16 +2273,17 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br /// 一级表头 /// 二级表头 /// 三级表头 + /// 四级表头 /// 替换字符串 /// 文件路径 - public void ZLYDFORMDoc(DataTable data, string D1, String D2, String D3, string TextName, string path) + public void ZLYDFORMDoc(DataTable data, string D1, string D2, string D3, string D4, string TextName, string path) { int TableNum = 13;//一行显示多少个元素 - int TableNums = TableNum + 2;//显示多少列2表示签名加一列牌号和项目 + int TableNums = TableNum + 3;//显示多少列2表示签名加一列牌号、坯型和项目 string rtf = string.Empty; if (data.Rows.Count > 0) { - string D1date = "", D2date = "", D3date = ""; + string D1date = "", D2date = "", D3date = "", D4date=""; ///循环拿到牌号, ///循环拿到项目, ///循环拿到元素 @@ -2280,27 +2303,7 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br if (d1dd) { D1date = D1date + data.Rows[i][D1].ToString() + ","; } } - //拿到项目名称 - if (data.Rows[i][D2].ToString() != "-1") - { - bool d1dds = true; - foreach (var item in D2date.Split(',')) - { - if (item == data.Rows[i][D2 + "Text"].ToString()) - { - d1dds = false; break; - } - } - if (d1dds) { D2date = D2date + data.Rows[i][D2 + "Text"].ToString() + ","; } - } - //if (data.Rows[i][D3].ToString() != "-1") - //{ - // if (!D3date.Contains(data.Rows[i][D3].ToString())) - // { - // 拿到每一个元素是否都有值 - // D3date = D3date + data.Rows[i][D3].ToString() + ","; - // } - //} + } if (D3.Length > 0) { @@ -2338,23 +2341,15 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br } } - if (D2date.Length > 0 && D3date.Length > 0) + if (D3date.Length > 0) { if (D1date.Length > 0) { D1date = D1date.Substring(0, D1date.Length - 1); } - D2date = D2date.Substring(0, D2date.Length - 1); - D3date = D3date.Substring(0, D3date.Length - 1); - /*在这里判断是否需要循环D2date把标准上限标准下限合并成标准,内控上限内控下限合并成内控,如果需要循环之后生成一个新的D2date字符串*/ - - //创建一个Document类实例,并添加section - //Document document = new Document(); - //Section section = document.AddSection(); - Document doc = new Document(); doc.LoadFromFile(path); @@ -2384,107 +2379,228 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br { D1dateNum = 1; } - //循环每个牌号 - for (int j = 0; j < D1dateNum; j++) + int rows = 0; + int d2DATANUM = 0; + int tanum = 3; //元素从第几列开始 + + //把一个表格拆成所需要的多个表格 + for (int k = 0; k < num; k++) { - int tanum = 2; - //元素从第几列开始 + rows = 0; + int row = 0; + //查询当前牌号又多少行--D2date - //把一个表格拆成所需要的多个表格 - for (int k = 0; k < num; k++) + //添加表格指定表格的行数和列数(2行,5列) + Table table = section.AddTable(true); + //在此次判断是否是最后一个表格,如果是根据实际剩余得元素个数生成列 + if (num == 1) { - //添加表格指定表格的行数和列数(2行,5列) - Table table = section.AddTable(true); - table.ResetCells(D2date.Split(',').Count() + 1, TableNums); - //把第一列从第一行到所有项目的所有列全部合并 - - //如果需要合并行使用下面的例子(把第一行的第一列到第三列合并) - //table.ApplyHorizontalMerge(0, 0, 2); - int D2Num = D2date.Split(',').Count(); - //string NN = "牌号"; - //获取单元格(第1行第1个单元格)并添加文本内容,设置字体字号颜色等(单元格中内容及个性化设置可以根据需要来进行调整) - //Encoding NN = System.Text.Encoding.GetEncoding("GB2312"); - //TextRange range = table[0, 0].AddParagraph().AppendText("牌号"); - if (!string.IsNullOrEmpty(D1date)) + int TableNumsS = TableNums - (TableNum - D3date.Split(',').Count()); + table.ResetCells(data.Rows.Count + 1, TableNumsS); + } + else + { + table.ResetCells(data.Rows.Count + 1, TableNums); + } + ////添加表格指定表格的行数和列数(2行,5列) + //Table table = section.AddTable(true); + ////创建一个指定行和列得表格 + //table.ResetCells(data.Rows.Count + 1, TableNums); + //bool d1dds = true; + //循环牌号 + //循环每个牌号 + int arrange = 0; + for (int j = 0; j < D1dateNum; j++) + { + arrange = 0; + D2date = ""; + D4date=""; + if (j == 0) { - table.ApplyVerticalMerge(0, 1, D2date.Split(',').Count()); - range = table[0, 0].AddParagraph().AppendText("牌号"); - range.CharacterFormat.FontName = "宋体"; - range.CharacterFormat.FontSize = 12; - range.CharacterFormat.TextColor = Color.Black; - range.CharacterFormat.Bold = false; - table[0, 0].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; - table[0, 0].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + row = 1; - //获取单元格(第1行第2个单元格)并添加文本 - range = table[0, 1].AddParagraph().AppendText("元素"); - range.CharacterFormat.FontName = "宋体"; - range.CharacterFormat.FontSize = 12; - range.CharacterFormat.TextColor = Color.Black; - range.CharacterFormat.Bold = false; - table[0, 1].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; - table[0, 1].CellFormat.VerticalAlignment = VerticalAlignment.Middle; } else { - tanum = 1; - //获取单元格(第1行第2个单元格)并添加文本 - range = table[0, 0].AddParagraph().AppendText("元素"); - range.CharacterFormat.FontName = "宋体"; - range.CharacterFormat.FontSize = 12; - range.CharacterFormat.TextColor = Color.Black; - range.CharacterFormat.Bold = false; - table[0, 0].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; - table[0, 0].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + row = rows + 1; } + string sqls = String.Empty; + if (!string.IsNullOrEmpty(D1date) && D1date.Split(',').Count() > 1) + { + sqls = D1 + "='" + D1date.Split(',')[j] + "'"; + } + if (data.Select(sqls).Count() > 0) + { + bool d1dds = true; + //拿到当前牌号下的所有数据然后循环 + for (int ii = 0; ii < data.Select(sqls).Count(); ii++) + { + ///循环拿到当前牌号的每一条数据的坯型 + string NameD4 = data.Select(sqls)[ii][D4].ToString(); + ///循环坯型判定当前坯型如果不在数组中就追加到数组中 + foreach (var item in D4date.Split(',')) + { + d1dds = true; + if (item == NameD4) + { + d1dds = false; break; + } + + } + if (d1dds) { D4date = D4date + NameD4 + ","; } + ///此处拿到有多少项目 + string NameD2 = data.Select(sqls)[ii][D2 + "Text"].ToString(); + foreach (var item in D2date.Split(',')) + { + d1dds = true; + if (item == NameD2) + { + d1dds = false; break; + } + + } + if (d1dds) { D2date = D2date + NameD2 + ","; } - - int D3Num = 0; - //此处循环元素 - for (int Q = tanum; Q < TableNums; Q++) + } + } + //拿到当前牌号得数据条数 + d2DATANUM = 0; + d2DATANUM = data.Select(sqls).Count(); + //////拿到项目名称 + //if (d2ss > 0) + //{ + // for (int i = 0; i < data.Select(sqls).Count(); i++) + // { + // d1dds = true; + // foreach (var item in D2date.Split(',')) + // { + // if (item == data.Select(sqls)[i][D2 + "Text"].ToString()) + // { + // d1dds = false; break; + // } + // } + // if (d1dds) { D2date = D2date + data.Select(sqls)[i][D2 + "Text"].ToString() + ","; } + // } + //} + if (D2date.Length > 0) { - D3Num = k * TableNum + Q - tanum; - //判断是否是最后一个表,如果是最后一个表只需要加载剩余的元素数据,其余的表格全部为""; - if (k == num - 1) + D2date = D2date.Substring(0, D2date.Length - 1); + } + if (D4date.Length > 0) + { + D4date = D4date.Substring(0, D4date.Length - 1); + } + int D2Num = D2date.Split(',').Count(); + int D4Num = D4date.Split(',').Count(); + + if (j == 0) + { + arrange = 0; + if (!string.IsNullOrEmpty(D1date)) { - //用当前第几个表格乘与每个表格的元素个数加上当前循环的元素个数判断是否超过总元素个数如果超过给表格空如果没有超过则给对应的数据值 - if (k * TableNum + Q - tanum < D3date.Split(',').Count()) + //table.ApplyVerticalMerge(0, 1, D2date.Split(',').Count()); + range = table[0, arrange].AddParagraph().AppendText("牌号"); + range.CharacterFormat.FontName = "宋体"; + range.CharacterFormat.FontSize = 12; + range.CharacterFormat.TextColor = Color.Black; + range.CharacterFormat.Bold = false; + table[0, arrange].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[0, arrange].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + + if (D4Num > 0) { - string MM = D3date.Split(',')[D3Num]; - //获取单元格(第1行第Q个单元格)并添加文本 - range = table[0, Q].AddParagraph().AppendText(MM); //D3date.Split(',')[D3Num] - range.CharacterFormat.FontName = "Times New Roman"; - range.CharacterFormat.FontSize = 10; + arrange = arrange + 1; + //获取单元格(第1行第2个单元格)并添加文本 + range = table[0, arrange].AddParagraph().AppendText("坯型"); + range.CharacterFormat.FontName = "宋体"; + range.CharacterFormat.FontSize = 12; range.CharacterFormat.TextColor = Color.Black; range.CharacterFormat.Bold = false; - table[0, Q].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; - table[0, Q].CellFormat.VerticalAlignment = VerticalAlignment.Middle; - + table[0, arrange].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[0, arrange].CellFormat.VerticalAlignment = VerticalAlignment.Middle; } - //else - //{ - // //获取单元格(第1行第Q个单元格)并添加文本 - // range = table[0, Q].AddParagraph().AppendText(""); - // range.CharacterFormat.FontName = "Arial"; - // range.CharacterFormat.FontSize = 12; - // range.CharacterFormat.TextColor = Color.Brown; - // range.CharacterFormat.Bold = true; - //} + + arrange = arrange + 1; + //获取单元格(第1行第2个单元格)并添加文本 + range = table[0, arrange].AddParagraph().AppendText("元素"); + range.CharacterFormat.FontName = "宋体"; + range.CharacterFormat.FontSize = 12; + range.CharacterFormat.TextColor = Color.Black; + range.CharacterFormat.Bold = false; + table[0, arrange].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[0, arrange].CellFormat.VerticalAlignment = VerticalAlignment.Middle; } else { - string MM = D3date.Split(',')[D3Num]; - //获取单元格(第1行第Q个单元格)并添加文本 - range = table[0, Q].AddParagraph().AppendText(MM);//D3date.Split(',')[D3Num] - range.CharacterFormat.FontName = "Times New Roman"; - range.CharacterFormat.FontSize = 10; + tanum = 2; + + if (D4Num > 0) + { + arrange = arrange + 1; + tanum = 3; + //获取单元格(第1行第2个单元格)并添加文本 + range = table[0, arrange].AddParagraph().AppendText("锭坯型"); + range.CharacterFormat.FontName = "宋体"; + range.CharacterFormat.FontSize = 12; + range.CharacterFormat.TextColor = Color.Black; + range.CharacterFormat.Bold = false; + table[0, arrange].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[0, arrange].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + } + + //获取单元格(第1行第2个单元格)并添加文本 + range = table[0, arrange].AddParagraph().AppendText("元素"); + range.CharacterFormat.FontName = "宋体"; + range.CharacterFormat.FontSize = 12; range.CharacterFormat.TextColor = Color.Black; range.CharacterFormat.Bold = false; - table[0, Q].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; - table[0, Q].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + table[0, arrange].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[0, arrange].CellFormat.VerticalAlignment = VerticalAlignment.Middle; } - }//循环表头结束 + + int D3Num = 0; + //此处循环元素 + for (int Q = tanum; Q < TableNums; Q++) + { + D3Num = k * TableNum + Q - tanum; + //判断是否是最后一个表,如果是最后一个表只需要加载剩余的元素数据,其余的表格全部为""; + if (k == num - 1) + { + //用当前第几个表格乘与每个表格的元素个数加上当前循环的元素个数判断是否超过总元素个数如果超过给表格空如果没有超过则给对应的数据值 + if (k * TableNum + Q - tanum < D3date.Split(',').Count()) + { + string MM = D3date.Split(',')[D3Num]; + //获取单元格(第1行第Q个单元格)并添加文本 + range = table[0, Q].AddParagraph().AppendText(MM); //D3date.Split(',')[D3Num] + range.CharacterFormat.FontName = "Times New Roman"; + range.CharacterFormat.FontSize = 10; + range.CharacterFormat.TextColor = Color.Black; + range.CharacterFormat.Bold = false; + table[0, Q].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[0, Q].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + + } + } + else + { + string MM = D3date.Split(',')[D3Num]; + //获取单元格(第1行第Q个单元格)并添加文本 + range = table[0, Q].AddParagraph().AppendText(MM);//D3date.Split(',')[D3Num] + range.CharacterFormat.FontName = "Times New Roman"; + range.CharacterFormat.FontSize = 10; + range.CharacterFormat.TextColor = Color.Black; + range.CharacterFormat.Bold = false; + table[0, Q].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[0, Q].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + } + }//循环表头结束 + arrange = 0; + } + int numD4 = 0; + int ford4 = 0; + int d4datanum = 0;//记录循环到第几个锭坯型 + //这里循环行 for (int W = 0; W < D2Num; W++) { @@ -2493,38 +2609,150 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br //因为牌号单元格合并了所以这里判断只有第一次循环的时候给牌号赋值 if (W == 0) { + d4datanum = 1; + //获取合并的牌号行数 + int merge = D2date.Split(',').Count(); + if (row > 1) + { + merge = row - 1 + merge; + } + table.ApplyVerticalMerge(arrange, row, merge); //获取单元格(第W+1行第1个单元格)并添加文本 - range = table[W + 1, 0].AddParagraph().AppendText(D1date.Split(',')[j]);//D1date.Split(',')[j] + range = table[row, arrange].AddParagraph().AppendText(D1date.Split(',')[j]);//D1date.Split(',')[j] range.CharacterFormat.FontName = "Times New Roman"; range.CharacterFormat.FontSize = 9; - table[W + 1, 0].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; - table[W + 1, 0].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + table[row, arrange].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[row, arrange].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + if (D4Num > 0) + { + arrange = arrange + 1; + if (W == 0) + { - //range.CharacterFormat.TextColor = Color.Black; - //range.CharacterFormat.Bold = false; + string D4SS = D4date.Split(',')[ford4]; + //拿到当前牌号有多少条数据然后合并行 + //通过牌号和坯型去查数据条数 + string d4sssql = sqls + " and " + D4 + "='" + D4SS + "'"; + //data.Select(d4sssql).Count(); + numD4 = numD4 + data.Select(d4sssql).Count(); + //合并单元格 + table.ApplyVerticalMerge(arrange, row, data.Select(d4sssql).Count()-1+ row); + range = table[row, arrange].AddParagraph().AppendText(D4SS);//D2date.Split(',')[W] + range.CharacterFormat.FontName = "宋体"; + range.CharacterFormat.FontSize = 12; + range.CharacterFormat.TextColor = Color.Black; + range.CharacterFormat.Bold = false; + table[row, arrange].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[row, arrange].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + ford4 = ford4 + 1; + } + else if (W == numD4) + { + string D4SS = D4date.Split(',')[ford4]; + //拿到当前牌号有多少条数据然后合并行 + //通过牌号和坯型去查数据条数 + string d4sssql = sqls + " and " + D4 + "='" + D4SS + "'"; + //data.Select(d4sssql).Count(); + numD4 = numD4 + data.Select(d4sssql).Count(); + //合并单元格 + table.ApplyVerticalMerge(arrange, row, data.Select(d4sssql).Count()-1+ row); + range = table[row, arrange].AddParagraph().AppendText(D4SS);//D2date.Split(',')[W] + range.CharacterFormat.FontName = "宋体"; + range.CharacterFormat.FontSize = 12; + range.CharacterFormat.TextColor = Color.Black; + range.CharacterFormat.Bold = false; + table[row, arrange].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[row, arrange].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + ford4 = ford4 + 1; + + } + + } + //} + + if (W == 0) + { + arrange = arrange + 1; + } + string D2SS = D2date.Split(',')[W]; + //获取单元格(第W+1行第2个单元格)并添加文本 + range = table[row, arrange].AddParagraph().AppendText(D2SS);//D2date.Split(',')[W] + range.CharacterFormat.FontName = "宋体"; + range.CharacterFormat.FontSize = 12; + range.CharacterFormat.TextColor = Color.Black; + range.CharacterFormat.Bold = false; + table[row, arrange].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[row, arrange].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + //row = row + 1; } + else + { + ///判断坯型是否为空如果不为空则合并当前坯型的行然后第一次的时候输入 + if (D4Num > 0) + { + + //arrange = arrange + 1; + if (W == 0) + { + arrange = arrange - 1; + string D4SS = D4date.Split(',')[ford4]; + //拿到当前牌号有多少条数据然后合并行 + //通过牌号和坯型去查数据条数 + string d4sssql = sqls + " and " + D4 + "='" + D4SS + "'"; + //data.Select(d4sssql).Count(); + numD4 = numD4 + data.Select(d4sssql).Count(); + //合并单元格 + table.ApplyVerticalMerge(arrange, row, data.Select(d4sssql).Count() - 1 + row); + range = table[row, arrange].AddParagraph().AppendText(D4SS);//D2date.Split(',')[W] + range.CharacterFormat.FontName = "宋体"; + range.CharacterFormat.FontSize = 12; + range.CharacterFormat.TextColor = Color.Black; + range.CharacterFormat.Bold = false; + table[row, arrange].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[row, arrange].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + ford4 = ford4 + 1; + arrange = arrange + 1; + } + else if (W == numD4) + { + arrange = arrange - 1; + string D4SS = D4date.Split(',')[ford4]; + //拿到当前牌号有多少条数据然后合并行 + //通过牌号和坯型去查数据条数 + string d4sssql = sqls + " and " + D4 + "='" + D4SS + "'"; + //data.Select(d4sssql).Count(); + numD4 = numD4 + data.Select(d4sssql).Count(); + //合并单元格 + table.ApplyVerticalMerge(arrange, row, data.Select(d4sssql).Count() - 1 + row); + range = table[row, arrange].AddParagraph().AppendText(D4SS);//D2date.Split(',')[W] + range.CharacterFormat.FontName = "宋体"; + range.CharacterFormat.FontSize = 12; + range.CharacterFormat.TextColor = Color.Black; + range.CharacterFormat.Bold = false; + table[row, arrange].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[row, arrange].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + ford4 = ford4 + 1; + arrange = arrange + 1; - string D2SS = D2date.Split(',')[W]; - //获取单元格(第W+1行第2个单元格)并添加文本 - range = table[W + 1, 1].AddParagraph().AppendText(D2SS);//D2date.Split(',')[W] - range.CharacterFormat.FontName = "宋体"; - range.CharacterFormat.FontSize = 12; - range.CharacterFormat.TextColor = Color.Black; - range.CharacterFormat.Bold = false; - table[W + 1, 1].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; - table[W + 1, 1].CellFormat.VerticalAlignment = VerticalAlignment.Middle; - } - else - { - string D2SS = D2date.Split(',')[W]; - //获取单元格(第W+1行第2个单元格)并添加文本 - range = table[W + 1, 0].AddParagraph().AppendText(D2SS);//D2date.Split(',')[W] - range.CharacterFormat.FontName = "宋体"; - range.CharacterFormat.FontSize = 12; - range.CharacterFormat.TextColor = Color.Black; - range.CharacterFormat.Bold = false; - table[W + 1, 0].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; - table[W + 1, 0].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + } + + } + if (W == 0) + { + arrange = arrange + 1; + } + + string D2SS = D2date.Split(',')[W]; + //获取单元格(第W+1行第2个单元格)并添加文本 + range = table[row, arrange].AddParagraph().AppendText(D2SS);//D2date.Split(',')[W] + range.CharacterFormat.FontName = "宋体"; + range.CharacterFormat.FontSize = 12; + range.CharacterFormat.TextColor = Color.Black; + range.CharacterFormat.Bold = false; + table[row, arrange].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[row, arrange].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + //row = row + 1; + } } int d3Knum = 0; //此处循环元素 @@ -2558,14 +2786,14 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br // ds = "W"; //} //获取单元格(第W+1行第Q个单元格)并添加文本 - range = table[W + 1, Q].AddParagraph().AppendText(ds); + range = table[row, Q].AddParagraph().AppendText(ds); //此处应该是元素对应的值 range.CharacterFormat.FontName = "Times New Roman"; range.CharacterFormat.FontSize = 10; range.CharacterFormat.TextColor = Color.Black; range.CharacterFormat.Bold = false; - table[W + 1, Q].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; - table[W + 1, Q].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + table[row, Q].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[row, Q].CellFormat.VerticalAlignment = VerticalAlignment.Middle; } } @@ -2590,28 +2818,28 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br } #endregion - //if (string.IsNullOrEmpty(ds)) - //{ - // ds = "W"; - //} - // D2names == D2date.Split(',')[W] , D1 == D1date.Split(',')[j] - range = table[W + 1, Q].AddParagraph().AppendText(ds);//此处获取元素得SZ - //此处应该是元素对应的值 + range = table[row, Q].AddParagraph().AppendText(ds);//此处获取元素得SZ + //此处应该是元素对应的值 range.CharacterFormat.FontName = "Times New Roman"; range.CharacterFormat.FontSize = 10; range.CharacterFormat.TextColor = Color.Black; range.CharacterFormat.Bold = false; - table[W + 1, Q].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; - table[W + 1, Q].CellFormat.VerticalAlignment = VerticalAlignment.Middle; + table[row, Q].Paragraphs[0].Format.HorizontalAlignment = HorizontalAlignment.Center; + table[row, Q].CellFormat.VerticalAlignment = VerticalAlignment.Middle; } }//循环元素值结束 + row = row + 1; }//循环行结束 - table.TableFormat.HorizontalAlignment = RowAlignment.Center;//整个表格居中 - //移除段落,插入表格 - body.ChildObjects.Insert(index + k, table); - }//循环拆分表格结束 - } + + rows = rows + d2DATANUM; + }//循环牌号结束 + + table.TableFormat.HorizontalAlignment = RowAlignment.Center;//整个表格居中 + //移除段落,插入表格 + body.ChildObjects.Insert(index + k, table); + + }//循环拆分表格结束 //保存文档 doc.SaveToFile(path, FileFormat.Doc); BP.DA.Log.DebugWriteError("开始去除新3D文档水印。"); @@ -2643,44 +2871,11 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br BP.DA.Log.DebugWriteError(ex.Message); } - //docs.Paragraphs.Application; - - - //保存文档 - //string path = "C:\\Users\\lenovo\\Desktop\\Table2.rtf"; - //document.SaveToFile(path, FileFormat.Rtf); - //StreamReader read = new StreamReader(path, System.Text.Encoding.ASCII); // 文件流. - //rtf = read.ReadToEnd(); //读取完毕。 - //read.Close(); // 关闭。 - //int numssss = rtf.IndexOf("Evaluation "); - //string rtf1 = rtf.Substring(0, numssss); - //string rtf2 = rtf.Substring(numssss + 69, rtf.Length - numssss - 69); - //rtf = rtf1 + rtf2; - //byte[] inputBytes = Encoding.ASCII.GetBytes(rtf); //System.Convert.FromBase64String(rtf); - //FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write); - //fs.Write(inputBytes, 0, inputBytes.Length); - //fs.Close(); - ////Document replaceDocument = new Document("C:\\Users\\lenovo\\Desktop\\Table1.rtf"); - //Document documents = new Document("C:\\Users\\lenovo\\Desktop\\管材类质量要点模板02.rtf"); - - ////加载用于替换文本的文档 - - ////使用该文档替换模板中的指定文本 - //documents.Replace("", document, false, true); - //Section sectionS = documents.Sections[0]; - //Table table1 = sectionS.Tables[1] as Table; - //table1.TableFormat.Borders.Horizontal.BorderType = Spire.Doc.Documents.BorderStyle.Dot; - //table1.TableFormat.Borders.Horizontal.LineWidth = 2.0f; - //table1.TableFormat.Borders.Horizontal.Color = Color.Black; - //保存文档 - //documents.SaveToFile("C:\\Users\\lenovo\\Desktop\\Table3.rtf", FileFormat.Rtf); - - //rtf = Cache.GetBillStr("Table2.rtf", false).Substring(0); - //System.Diagnostics.Process.Start("Table2.rtf"); } } } + #endregion /// /// 单据生成 @@ -3102,9 +3297,9 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br //str = str.Replace("", rtfFor3D); } } - else if (str.IndexOf("BP.ZLYD2D") != -1) + else if (str.IndexOf("BP.B2D") != -1) { - if (str.IndexOf("BP.ZLYD2D." + dtlEnName + ">") != -1) + if (str.IndexOf("BP.B2D." + dtlEnName + ">") != -1) { GEEntity mainEn = null; MapDtl mdtl = new MapDtl(dtlEnName); @@ -3121,13 +3316,13 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br d1 = item.Key; } else if (i == 1) + { + d4 = item.Key; + } + else if (i == 2) { d2 = item.Key; } - //else if (i == 2) - //{ - // d4 = item.Key; - //} else { bool d1dd = true; @@ -3732,9 +3927,9 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br { FORMDocs(dt3D, d1, d2, d3, dtlEnName3D, this.TempFilePath); } - else if (str.IndexOf("BP.ZLYD2D") != -1) + else if (str.IndexOf("BP.B2D") != -1) { - ZLYDFORMDoc(dt3D, d1, d2, d3, dtlEnName3D, this.TempFilePath); + ZLYDFORMDoc(dt3D, d1, d2, d3,d4, dtlEnName3D, this.TempFilePath); } } catch (Exception ex) diff --git a/CCFlow/Components/BP.WF/Data/MyJoinFlow.cs b/CCFlow/Components/BP.WF/Data/MyJoinFlow.cs index d446b764..a7737e0e 100644 --- a/CCFlow/Components/BP.WF/Data/MyJoinFlow.cs +++ b/CCFlow/Components/BP.WF/Data/MyJoinFlow.cs @@ -742,11 +742,10 @@ namespace BP.WF.Data #region 查询条件. - map.DTSearchKey = GenerWorkFlowAttr.SDTOfNode; - map.DTSearchLabel = "节点应完成时间"; + map.DTSearchKey = GenerWorkFlowAttr.RDT; + map.DTSearchLabel = "发起日期"; map.DTSearchWay = DTSearchWay.ByDate; map.AddSearchAttr(MyFlowAttr.WFSta); - map.AddHidden(MyStartFlowAttr.FID, "=", "0"); //map.ItIsShowSearchKey = false; //增加隐藏的查询条件. 我参与的流程. SearchNormal search = new SearchNormal(MyFlowAttr.Emps, "人员", diff --git a/CCFlow/Components/BP.WF/Data/MyStartFlow.cs b/CCFlow/Components/BP.WF/Data/MyStartFlow.cs index 17cde923..6c7c1227 100644 --- a/CCFlow/Components/BP.WF/Data/MyStartFlow.cs +++ b/CCFlow/Components/BP.WF/Data/MyStartFlow.cs @@ -738,7 +738,6 @@ namespace BP.WF.Data #region 查询条件. map.AddSearchAttr(MyStartFlowAttr.WFSta); - map.AddHidden(MyStartFlowAttr.FID, "=", "0"); map.DTSearchWay = DTSearchWay.ByDate; map.DTSearchLabel = "发起日期"; diff --git a/CCFlow/Components/BP.WF/HttpHandler/WF.cs b/CCFlow/Components/BP.WF/HttpHandler/WF.cs index 72d9c787..f66c6602 100644 --- a/CCFlow/Components/BP.WF/HttpHandler/WF.cs +++ b/CCFlow/Components/BP.WF/HttpHandler/WF.cs @@ -2655,6 +2655,12 @@ namespace BP.WF.HttpHandler return "url@MyView.htm?FK_Flow=" + this.FlowNo + "&WorkID=" + this.WorkID + "&o2=1" + paras; } + //打开已完成 + if (this.DoWhat.Equals(DoWhatList.Complete) == true) + { + return "url@Complete.htm?Token=" + token + "&o2=1&FK_Flow=" + this.FlowNo; + } + //查看表单不需要FK_Node参数。 if (this.DoWhat.Equals("MyView") == true) { diff --git a/CCFlow/Components/BP.WF/WF.cs b/CCFlow/Components/BP.WF/WF.cs index 67680106..49d286de 100644 --- a/CCFlow/Components/BP.WF/WF.cs +++ b/CCFlow/Components/BP.WF/WF.cs @@ -87,6 +87,8 @@ namespace BP.WF public const string MyStartFlows = "MyStartFlows"; public const string MyJoinFlows = "MyJoinFlows"; public const string GenerWorkFlowViews = "GenerWorkFlowViews"; + //已完成 + public const string Complete = "Complete"; /// /// 处理消息连接 /// diff --git a/CCFlow/Components/BP.WF/WF/ShiftWork.cs b/CCFlow/Components/BP.WF/WF/ShiftWork.cs index 93a85d7c..2188d69f 100644 --- a/CCFlow/Components/BP.WF/WF/ShiftWork.cs +++ b/CCFlow/Components/BP.WF/WF/ShiftWork.cs @@ -95,9 +95,12 @@ namespace BP.WF foreach (PushMsg pm in pms1) pm.DoSendMessage(nd, nd.HisWork, null, null, null, emp.UserID); + string emps = gwf.Emps; + emps += WebUser.No+","+WebUser.Name+"@"; + gwf.Emps = emps; gwf.WFState = WFState.Shift; gwf.TodoEmpsNum = 1; - gwf.TodoEmps = WebUser.No + "," + WebUser.Name + ";"; + gwf.TodoEmps = emp.UserID + "," + emp.Name + ";"; gwf.Update(); return "移交成功." + info; }