修改打印时AS元素显示ASYS问题,开发者表单生成word名称未时间问题

master
孙亮 11 months ago
parent d734a4fb6e
commit 46de7a7f8a

@ -17,6 +17,7 @@ using System.Linq;
using System.Collections.Generic;
using Spire.Doc.Documents;
using NPOI.SS.Formula.Functions;
using System.Diagnostics;
namespace BP.Pub
@ -1331,6 +1332,16 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br
docs.Paragraphs[1].Range.Delete();
docs.SaveAs2(path);
docs.Close();
Process[] current = Process.GetProcesses();
//遍历与当前进程名称相同的进程列表
foreach (Process process in current)
{
//如果实例已经存在则kill当前进程
if (process.ProcessName.ToUpper().Equals("WINWORD"))
{
process.Kill(); break;
}
}
}
catch (Exception ex)
{
@ -1454,7 +1465,14 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br
string name = D3.Split(',')[i].ToString();
if (name.Length > 1)
{
name=name.Substring(0, 1).ToUpper() + name.Substring(1).ToLower();
if (name == "ASYS")
{
name = "As";
}
else
{
name = name.Substring(0, 1).ToUpper() + name.Substring(1).ToLower();//将元素改成首位大写次位小写
}
}
//如果都没有值择把这个元素移除
@ -1670,6 +1688,11 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br
sql += "and " + D1 + "='" + D1date.Split(',')[j] + "'";
}
string named3 = D3date.Split(',')[d3Knum].ToString();
//取数据时再将As转回未ASYS否则取不到数据
if (named3=="As")
{
named3 = "ASYS";
}
int ss = data.Select(sql).Count();
string ds = data.Select(sql)[0][named3].ToString();
//if (string.IsNullOrEmpty(ds))
@ -1697,7 +1720,13 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br
{
sql += "and " + D1 + "='" + D1date.Split(',')[j] + "'";
}
string ds = data.Select(sql)[0][D3date.Split(',')[d3Knum].ToString()].ToString();
string named3 = D3date.Split(',')[d3Knum].ToString();
//取数据时再将As转回未ASYS否则取不到数据
if (named3 == "As")
{
named3 = "ASYS";
}
string ds = data.Select(sql)[0][named3].ToString();
//if (string.IsNullOrEmpty(ds))
//{
// ds = "W";
@ -1735,6 +1764,16 @@ trgaph108\trleft5\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\br
docs.Paragraphs[1].Range.Delete();
docs.SaveAs2(path);
docs.Close();
Process[] current = Process.GetProcesses();
//遍历与当前进程名称相同的进程列表
foreach (Process process in current)
{
//如果实例已经存在则kill当前进程
if (process.ProcessName.ToUpper().Equals("WINWORD"))
{
process.Kill(); break;
}
}
}
catch (Exception ex)
{

@ -425,7 +425,6 @@ namespace BP.WF.HttpHandler
return PrintDoc_ChapterFormDoneIt(nd, workID, pkval, formID, func, wk, mapData);
}
string file = DateTime.Now.Year + "_" + WebUser.DeptNo + "_" + func.MyPK + "_" + WorkID + ".doc";
string tempFile = func.TempFilePath;
if (tempFile.Contains(".rtf") == false)
tempFile = tempFile + ".rtf";
@ -557,13 +556,19 @@ namespace BP.WF.HttpHandler
}
paths = file.Split('_');
//paths = file;
path = paths[0] + "/" + paths[1] + "/" + paths[2] + "/";
string fileModelT = "rtf";
if ((int)func.TemplateFileModel == 1)
fileModelT = "word";
string billUrl = "file@" + fileModelT + "@" + BP.WF.Glo.CCFlowAppPath + "DataUser/Bill/" + path + file;
#region BKGY替换word名称 20231026 sunliang
string sql = "select TITLE from WF_GENERWORKFLOW where workid='" + WorkID + "'";
string name = DBAccess.RunSQLReturnString(sql);
var s = name.Split('_');
string da = s[0].ToString().Replace("#", "号") + ".doc";
#endregion
//string billUrl = "file@" + fileModelT + "@" + BP.WF.Glo.CCFlowAppPath + "DataUser/Bill/" + path + file;
string billUrl = "file@" + fileModelT + "@" + BP.WF.Glo.CCFlowAppPath + "DataUser/Bill/" + path + da;
if (func.HisPrintFileType == PrintFileType.PDF)
billUrl = billUrl.Replace(".doc", ".pdf");
@ -578,7 +583,8 @@ namespace BP.WF.HttpHandler
//用于扫描打印.
string qrUrl = SystemConfig.HostURL + "WF/WorkOpt/PrintDocQRGuide.htm?MyPK=" + func.MyPK;
rtf.MakeDoc(tempFile, path, file, qrUrl);
rtf.MakeDoc(tempFile, path, da, qrUrl);
//rtf.MakeDoc(tempFile, path, file, qrUrl);
#endregion
#region 转化成pdf.

Loading…
Cancel
Save