This commit is contained in:
2025-07-11 17:29:50 +08:00
31 changed files with 2800 additions and 582 deletions
+4
View File
@@ -56,6 +56,10 @@
<Reference Include="EmitMapper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EmitMapper.1.0.0\lib\EmitMapper.dll</HintPath>
</Reference>
<Reference Include="FastReport, Version=2017.1.16.0, Culture=neutral, PublicKeyToken=417583d16d08abed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\FastReport.dll</HintPath>
</Reference>
<Reference Include="FineUIPro, Version=6.3.0.0, Culture=neutral, PublicKeyToken=9cbe753c029f291a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\FineUIPro\FineUIPro.dll</HintPath>
+5
View File
@@ -92,6 +92,11 @@ namespace BLL
{
return Funs.DB.Sys_Const.FirstOrDefault(e => e.ConstValue == constValue && e.GroupId == groupId);
}
public static Sys_Const GetConstByConstText(string constText)
{
return Funs.DB.Sys_Const.FirstOrDefault(e => e.ConstText == constText);
}
public static void DeleteConstValueBygroupId(string groupId)
{
var q = Funs.DB.Sys_Const.Where(x => x.GroupId == groupId);
+61 -2
View File
@@ -1,6 +1,12 @@
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Web;
using FastReport;
namespace BLL
{
public static class FastReportService
@@ -30,5 +36,58 @@ namespace BLL
}
/// <summary>
/// 合并报表后打印
/// </summary>
/// <param name="fastReportItems">报表实体集</param>
/// <param name="path">导出的路径</param>
public static void ExportMergeReport(List<Model.FastReportItem> fastReportItems, string path, string printType)
{
Report report = new Report();
report.PrintSettings.ShowDialog = false; //隐藏弹窗
FastReport.EnvironmentSettings settings = new EnvironmentSettings();
settings.ReportSettings.ShowProgress = false; //隐藏进度条
for (int i = 0; i < fastReportItems.Count; i++)
{
report.Load(Funs.RootPath + fastReportItems[i].ReportPath); //加载报表
List<DataTable> dataTables = fastReportItems[i].DataTables;
Dictionary<string, string> ParameterValues = fastReportItems[i].ParameterValues;
if (dataTables != null && dataTables.Count > 0)
{
for (int j = 0; j < dataTables.Count; j++)
{
report.RegisterData(dataTables[j], dataTables[j].TableName);//绑定数据源
}
}
if (ParameterValues.Count > 0)
{
foreach (KeyValuePair<string, string> kvp in ParameterValues)
{
report.SetParameterValue(kvp.Key, kvp.Value);//绑定参数
}
}
if (i == 0)
{
report.Prepare();
}
else
{
report.Prepare(true);
}
}
if (printType == "1")
{
FastReport.Export.Pdf.PDFExport exp = new FastReport.Export.Pdf.PDFExport();
report.Export(exp, path);
}
else if (printType == "2")
{
FastReport.Export.OoXML.Word2007Export exportBase = new FastReport.Export.OoXML.Word2007Export();
report.Export(export: exportBase, fileName: path.Replace(oldValue: "pdf", newValue: "docx"));
}
}
}
}
@@ -144,5 +144,21 @@ namespace BLL
return isShow;
}
#endregion
/// <summary>
/// 根据委托Id删除明细
/// </summary>
/// <param name="trustBatchId"></param>
public static void DeleteTrustItemByTrustBatchId(string trustBatchId)
{
Model.SGGLDB db = Funs.DB;
var trustBatchItems = from x in db.HJGL_Batch_BatchTrustItem where x.TrustBatchId == trustBatchId select x;
if (trustBatchItems != null)
{
db.HJGL_Batch_BatchTrustItem.DeleteAllOnSubmit(trustBatchItems);
db.SubmitChanges();
}
}
}
}
@@ -455,5 +455,14 @@ namespace BLL
db.SubmitChanges();
}
}
public static void AddPipelineLists(List<Model.PTP_PipelineList> pipelineList)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.PTP_PipelineList.InsertAllOnSubmit(pipelineList);
db.SubmitChanges();
}
}
}
}
+86 -44
View File
@@ -386,28 +386,17 @@ namespace BLL
select x;
var projectModel=ProjectService.GetProjectByProjectId(projectId);
var contractModel = CostManageService.GetCostManageById(costManageId);
decimal totalAmount = costData.Sum(x => x.SumMoney ?? 0);
//decimal totalAmount = costData.Sum(x => x.SumMoney ?? 0);
var files = new List<object>();
if (contractModel!=null)
{
var fileDetails = GetBase64FilesWithDetails(contractModel.CostManageId);
if (fileDetails != null && fileDetails.Count > 0)
{
var url = ConstValue.GetConstByConstText("PU_PUSH_URL")?.ConstValue;
if (string.IsNullOrEmpty(url))
{
files.AddRange(fileDetails);
message = "未配置推送接口地址";
return message;
}
// 构建请求体
var requestBody = new
{
projectNumber = projectModel.ProjectCode,
contractNo = contractNum,
amountHSE = totalAmount.ToString(),
files = files
};
var jsonBody = JsonConvert.SerializeObject(requestBody);
// 调用HSE接口推送数据
var url = "http://172.29.60.33:9037";
var requestGetTokenUrl = url + "/auth/getToken";
string requestGetTokenBody = "{\"username\": \"coadmin\",\"password\": \"coadminPu@2025\"}";
var response = Funs.RequestPost(requestGetTokenUrl, "", requestGetTokenBody);
@@ -425,10 +414,55 @@ namespace BLL
{
message = "获取Pu系统Token失败,Token为空";
return message;
}
}
Dictionary<string, string> headers = new Dictionary<string, string>();
headers.Add("Authorization", "Bearer " + accessToken);
#region
var getRequestUrl = url + "/pu_api/payCraftAmountToHSE/get";
var getRequestbody= $"{{\"projectNumber\":\"{projectModel.ProjectCode}\",\"contractNo\":\"{contractNum}\"}}";
APICommonService.SaveSysHttpLog("PU_GetPuPayCraftAmount", getRequestUrl, getRequestbody, "Requset");
var getResponse = Funs.RequestPost(getRequestUrl, headers, getRequestbody);
APICommonService.SaveSysHttpLog("PU_GetPuPayCraftAmount", getRequestUrl, getResponse, "Response");
var getResponseStr = JsonConvert.DeserializeObject<JObject>(getResponse);
if (getResponseStr == null)
{
message = "推送数据到HSE系统失败";
return message;
}
else if (getResponseStr["code"]?.ToString() != "200")
{
message = getResponseStr["message"]?.ToString();
return message;
}
var getResponseOutput = JsonConvert.DeserializeObject<List<PuGetApiOutput>>(getResponseStr["data"]?.ToString()) ;
if (getResponseOutput.Any() && getResponseOutput.Count(x=>x.itemNo== costManageId)>0)
{
message = "当前费用已推送,无需重复推送!";
return message;
}
#endregion
#region Pu
var requestUrl = url + "/pu_api/payCraftAmountToHSE/add";
// 构建请求体
var fileDetails = GetBase64FilesWithDetails(contractModel.CostManageId);
if (fileDetails != null && fileDetails.Count > 0)
{
files.AddRange(fileDetails);
}
List<PuAddApiInput> puAddApiInputs = new List<PuAddApiInput>()
{
new PuAddApiInput()
{
projectNumber = projectModel.ProjectCode,
itemId= costManageId,
contractNo = contractNum,
amountHSE = contractModel.SumMoney.ToString(),
files = files
}
};
var jsonBody = JsonConvert.SerializeObject(puAddApiInputs);
APICommonService.SaveSysHttpLog("PU_AddPuPayCraftAmount", requestUrl, jsonBody, "Requset");
var responseHSE = Funs.RequestPost(requestUrl, headers, jsonBody);
var responseHSEStr = JsonConvert.DeserializeObject<JObject>(responseHSE);
@@ -438,16 +472,23 @@ namespace BLL
message = "推送数据到HSE系统失败";
return message;
}
else if ( string.IsNullOrEmpty(responseHSEStr["code"]?.ToString()))
{
message = responseHSE;
return message;
}
else if (responseHSEStr["code"]?.ToString() != "200")
{
message = responseHSEStr["message"]?.ToString();
return message;
}
else
else
{
message = "";
return message;
}
#endregion
}
return message;
@@ -459,7 +500,6 @@ namespace BLL
return "推送数据失败";
}
}
/// <summary>
/// 获取Base64编码的附件文件
/// </summary>
@@ -468,37 +508,39 @@ namespace BLL
var result = new List<object>();
// 获取费用管理信息
var costManage = GetCostManageById(costManageId);
// 获取附件文件
var attachments = AttachFileService.getFileUrl(costManageId);
var costItem = BLL.CostManageItemService.GetCostManageItemByCostManageId(costManageId);
foreach (var item in costItem)
{ // 获取附件文件
var attachments = AttachFileService.getFileUrl(item.CostManageItemId);
if (!string.IsNullOrEmpty(attachments))
{
string[] filePaths = attachments.Split(',');
foreach (var filePath in filePaths)
if (!string.IsNullOrEmpty(attachments))
{
string fullPath = Funs.RootPath + filePath;
if (File.Exists(fullPath))
string[] filePaths = attachments.Split(',');
foreach (var filePath in filePaths)
{
FileInfo file = new FileInfo(fullPath);
byte[] fileBytes = File.ReadAllBytes(fullPath);
string base64Content = Convert.ToBase64String(fileBytes);
result.Add(new Model.PuPayCraftAmountFileInput
string fullPath = Funs.RootPath + filePath;
if (File.Exists(fullPath))
{
name = file.Name,
content = base64Content,
thisamount = costManage?.SumMoney?.ToString() ?? "0",
date = costManage?.CostManageDate?.ToString("yyyy-MM-dd") ?? DateTime.Now.ToString("yyyy-MM-dd")
});
}
else
{
/* message += $"附件文件路径 {fullPath} 不存在!";
ErrLogInfo.WriteLog(message, $"File not found: {fullPath}");*/
FileInfo file = new FileInfo(fullPath);
byte[] fileBytes = File.ReadAllBytes(fullPath);
string base64Content = Convert.ToBase64String(fileBytes);
result.Add(new Model.PuPayCraftAmountFileInput
{
name = file.Name,
content = base64Content,
thisamount = item?.PriceMoney?.ToString() ?? "0",
date = costManage?.CompileDate?.ToString("yyyy-MM-dd") ?? DateTime.Now.ToString("yyyy-MM-dd")
});
continue;//只取第一个文件
}
}
}
}
return result;
}