Merge branch 'master' of http://47.104.102.122:3000/lpf/SGGL_SeDin_New
This commit is contained in:
Binary file not shown.
@@ -77,7 +77,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"$type": "Bookmark",
|
"$type": "Bookmark",
|
||||||
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
|
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1446,6 +1446,28 @@ namespace BLL
|
|||||||
return response.Content;
|
return response.Content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string RequestPost(string Baseurl, Dictionary<string ,string> Token, string JsonBody)
|
||||||
|
{
|
||||||
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||||
|
|
||||||
|
var client = new RestClient(Baseurl);
|
||||||
|
client.Timeout = -1;
|
||||||
|
var request = new RestRequest(Method.POST);
|
||||||
|
foreach (var item in Token)
|
||||||
|
{
|
||||||
|
request.AddHeader(item.Key, item.Value);
|
||||||
|
}
|
||||||
|
request.AddHeader("ClientId", SysConstSetService.ClientId);
|
||||||
|
request.AddHeader("OperationCode", Baseurl.Substring(Baseurl.LastIndexOf("/", StringComparison.Ordinal) + 1));
|
||||||
|
if (!string.IsNullOrEmpty(JsonBody))
|
||||||
|
{
|
||||||
|
request.AddJsonBody(JsonBody);
|
||||||
|
}
|
||||||
|
|
||||||
|
IRestResponse response = client.Execute(request);
|
||||||
|
return response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据星期几返回值
|
/// 根据星期几返回值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using WIA;
|
||||||
|
|
||||||
namespace BLL
|
namespace BLL
|
||||||
{
|
{
|
||||||
@@ -373,74 +374,89 @@ namespace BLL
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// 推送数据到HSE系统
|
public static string PushDataToHSE(string projectId, string contractNum,string costManageId)
|
||||||
/// </summary>
|
|
||||||
public static string PushDataToHSE(string projectId, string contractNum)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string message = "";
|
string message = "";
|
||||||
// 查询当前合同所有审核通过的数据
|
// 查询当前合同所有审核通过的数据
|
||||||
var costData = from x in Funs.DB.CostGoods_CostManage
|
var costData = from x in Funs.DB.CostGoods_CostManage
|
||||||
where x.ProjectId == projectId && x.ContractNum == contractNum && x.States == Const.State_2
|
where x.ProjectId == projectId && x.ContractNum == contractNum && x.States == Const.State_2
|
||||||
orderby x.CostManageDate descending
|
orderby x.CostManageDate descending
|
||||||
select x;
|
select x;
|
||||||
|
var projectModel=ProjectService.GetProjectByProjectId(projectId);
|
||||||
if (costData.Any())
|
var contractModel = CostManageService.GetCostManageById(costManageId);
|
||||||
|
decimal totalAmount = costData.Sum(x => x.SumMoney ?? 0);
|
||||||
|
var files = new List<object>();
|
||||||
|
if (contractModel!=null)
|
||||||
{
|
{
|
||||||
// 获取所有附件文件
|
var fileDetails = GetBase64FilesWithDetails(contractModel.CostManageId);
|
||||||
var files = new List<object>();
|
if (fileDetails != null && fileDetails.Count > 0)
|
||||||
decimal totalAmount = 0;
|
|
||||||
|
|
||||||
foreach (var item in costData)
|
|
||||||
{
|
{
|
||||||
var fileDetails = GetBase64FilesWithDetails(item.CostManageId);
|
files.AddRange(fileDetails);
|
||||||
if (fileDetails != null && fileDetails.Count > 0)
|
|
||||||
{
|
|
||||||
files.AddRange(fileDetails);
|
|
||||||
totalAmount += item.SumMoney ?? 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建请求体
|
// 构建请求体
|
||||||
var requestBody = new
|
var requestBody = new
|
||||||
{
|
{
|
||||||
projectId = projectId,
|
projectNumber = projectModel.ProjectCode,
|
||||||
contractNo = contractNum,
|
contractNo = contractNum,
|
||||||
amountHSE = totalAmount.ToString(),
|
amountHSE = totalAmount.ToString(),
|
||||||
files = files
|
files = files
|
||||||
};
|
};
|
||||||
var jsonBody = JsonConvert.SerializeObject(requestBody);
|
var jsonBody = JsonConvert.SerializeObject(requestBody);
|
||||||
|
|
||||||
// 调用HSE接口推送数据
|
// 调用HSE接口推送数据
|
||||||
// TODO: 实现实际的HSE接口调用逻辑
|
var url = "http://172.29.60.33:8080";
|
||||||
var url="http://172.29.60.33:8080";
|
var requestGetTokenUrl = url + "/auth/getToken";
|
||||||
var requestGetTokenUrl = url + "/api/Token/GetToken";
|
string requestGetTokenBody = "{\"username\": \"coadmin\",\"password\": \"coadminPu@2025\"}";
|
||||||
string requestGetTokenBody = "{\r\n\r\n\"username\": \"coadmin\",\r\n\r\n\"password\": \"coadminPu@2025\"\r\n\r\n}";
|
|
||||||
var response = Funs.RequestPost(requestGetTokenUrl, "", requestGetTokenBody);
|
var response = Funs.RequestPost(requestGetTokenUrl, "", requestGetTokenBody);
|
||||||
var responseStr = JsonConvert.DeserializeObject<JObject>(response);
|
var responseStr = JsonConvert.DeserializeObject<JObject>(response);
|
||||||
if (responseStr == null || responseStr["data"].ToString() != "200")
|
APICommonService.SaveSysHttpLog("PU_Token", requestGetTokenUrl, response);
|
||||||
|
|
||||||
|
if (responseStr == null || responseStr["code"]?.ToString() != "200" || responseStr["data"] == null)
|
||||||
{
|
{
|
||||||
message = "获取Pu系统Token失败";
|
message = "获取Pu系统Token失败";
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
string accessToken = responseStr["data"]["token"]?.ToString();
|
||||||
string accessToken = responseStr["data"]["token"].ToString();
|
if (string.IsNullOrEmpty(accessToken))
|
||||||
var requestUrl = url + "/api/PuPayCraftAmount/AddPuPayCraftAmount";
|
{
|
||||||
var responseHSE = Funs.RequestPost(requestUrl, accessToken, jsonBody);
|
message = "获取Pu系统Token失败,Token为空";
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
Dictionary<string, string> headers = new Dictionary<string, string>();
|
||||||
|
headers.Add("Authorization", "Bearer " + accessToken);
|
||||||
|
var requestUrl = url + "/pu_api/payCraftAmountToHSE/add";
|
||||||
|
APICommonService.SaveSysHttpLog("PU_AddPuPayCraftAmount", requestUrl, jsonBody, "Requset");
|
||||||
|
var responseHSE = Funs.RequestPost(requestUrl, headers, jsonBody);
|
||||||
var responseHSEStr = JsonConvert.DeserializeObject<JObject>(responseHSE);
|
var responseHSEStr = JsonConvert.DeserializeObject<JObject>(responseHSE);
|
||||||
if (responseHSEStr == null || responseHSEStr["data"].ToString()!= "200")
|
APICommonService.SaveSysHttpLog("PU_AddPuPayCraftAmount", requestUrl, responseHSE, "Response");
|
||||||
|
if (responseHSEStr == null)
|
||||||
{
|
{
|
||||||
message = "推送数据到HSE系统失败";
|
message = "推送数据到HSE系统失败";
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
else if (responseHSEStr["code"]?.ToString() != "200")
|
||||||
|
{
|
||||||
|
message = responseHSEStr["message"]?.ToString();
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
message = "";
|
||||||
|
return message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return message;
|
|
||||||
|
|
||||||
|
return message;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// 记录错误日志
|
// 记录错误日志
|
||||||
ErrLogInfo.WriteLog(ex.Message, ex.StackTrace);
|
ErrLogInfo.WriteLog(ex.Message, ex.StackTrace);
|
||||||
return "推送数据失败"+ex.Message;
|
return "推送数据失败";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,22 +472,35 @@ namespace BLL
|
|||||||
var attachments = AttachFileService.getFileUrl(costManageId);
|
var attachments = AttachFileService.getFileUrl(costManageId);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(attachments))
|
if (!string.IsNullOrEmpty(attachments))
|
||||||
{
|
{
|
||||||
string filePath=Funs.RootPath+attachments.Split(',')[0];
|
string[] filePaths = attachments.Split(',');
|
||||||
FileInfo file = new FileInfo(filePath);
|
foreach (var filePath in filePaths)
|
||||||
byte[] fileBytes = File.ReadAllBytes(filePath);
|
|
||||||
string base64Content = Convert.ToBase64String(fileBytes);
|
|
||||||
|
|
||||||
result.Add(new Model.PuPayCraftAmountFileInput
|
|
||||||
{
|
{
|
||||||
name = file.Name,
|
string fullPath = Funs.RootPath + filePath;
|
||||||
content = base64Content,
|
if (File.Exists(fullPath))
|
||||||
thisamount = costManage?.SumMoney?.ToString() ?? "0",
|
{
|
||||||
date = costManage?.CostManageDate?.ToString("yyyy-MM-dd") ?? DateTime.Now.ToString("yyyy-MM-dd")
|
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 = 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}");*/
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16599,7 +16599,7 @@
|
|||||||
</COMReference>
|
</COMReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<VisualStudio>
|
<VisualStudio>
|
||||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
<f:Button ID="btnNew" Text="新增" Icon="Add" EnablePostBack="false" Hidden="true"
|
<f:Button ID="btnNew" Text="新增" Icon="Add" EnablePostBack="false" Hidden="true"
|
||||||
runat="server">
|
runat="server">
|
||||||
</f:Button>
|
</f:Button>
|
||||||
<f:Button ID="Button1" Text="推送" Icon="Add" runat="server" OnClick="Button1_Click">
|
<f:button id="Button1" text="推送" icon="Add" runat="server" onclick="Button1_Click">
|
||||||
</f:Button>
|
</f:button>
|
||||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="导出" Icon="FolderUp"
|
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="导出" Icon="FolderUp"
|
||||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||||
</f:Button>
|
</f:Button>
|
||||||
|
|||||||
@@ -348,7 +348,15 @@ namespace FineUIPro.Web.HSSE.CostGoods
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string messaage = CostManageService.PushDataToHSE(this.CurrUser.LoginProjectId, costManage.ContractNum);
|
string messaage = CostManageService.PushDataToHSE(this.CurrUser.LoginProjectId, costManage.ContractNum,costManageId);
|
||||||
|
if (string.IsNullOrEmpty(messaage))
|
||||||
|
{
|
||||||
|
Alert.ShowInTop("推送成功!", MessageBoxIcon.Success);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Alert.ShowInTop(messaage, MessageBoxIcon.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -582,6 +582,8 @@
|
|||||||
// refreshWhenExist: 添加选项卡时,如果选项卡已经存在,是否刷新内部IFrame
|
// refreshWhenExist: 添加选项卡时,如果选项卡已经存在,是否刷新内部IFrame
|
||||||
// iconFont: 选项卡图标字体
|
// iconFont: 选项卡图标字体
|
||||||
function addExampleTab(tabOptions) {
|
function addExampleTab(tabOptions) {
|
||||||
|
debugger;
|
||||||
|
|
||||||
if (typeof (tabOptions) === 'string') {
|
if (typeof (tabOptions) === 'string') {
|
||||||
tabOptions = {
|
tabOptions = {
|
||||||
id: arguments[0],
|
id: arguments[0],
|
||||||
|
|||||||
Reference in New Issue
Block a user