修改安全生产季报接口
This commit is contained in:
parent
67c7ce6b0e
commit
d08b2346fc
|
@ -5,10 +5,52 @@
|
||||||
using BLL.CNCECHSSEService;
|
using BLL.CNCECHSSEService;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using RestSharp;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
public static class CNCECHSSEWebService
|
public static class CNCECHSSEWebService
|
||||||
{
|
{
|
||||||
|
public static string UploadFile(string file)
|
||||||
|
{
|
||||||
|
string result = string.Empty;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string CNCECPath = SysConstSetService.CNCECPath;
|
||||||
|
string baseurl = CNCECPath + "/api/FileUpload/Post";
|
||||||
|
var client = new RestClient(baseurl);
|
||||||
|
client.Timeout = -1;
|
||||||
|
var request = new RestRequest(Method.POST);
|
||||||
|
request.AddHeader("Content-Type", "multipart/form-data");//注意头部必须是form-data
|
||||||
|
// client.UserAgent = "apifox/1.0.0 (https://www.apifox.cn)";
|
||||||
|
//request.AddFile("file", @"E:\微信\WeChat\WeChat Files\wxid_9140361403112\FileStorage\File\2022-08\焊接管理尾项20220809.docx");
|
||||||
|
var filelist = file.Split(',');
|
||||||
|
foreach (var item in filelist)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (File.Exists(item))
|
||||||
|
{
|
||||||
|
request.AddFile("file", item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
request.AddParameter("typeName", "SafetyQuarterlyReport");
|
||||||
|
var tokenItem = BLL.ServerService.GetToken();
|
||||||
|
request.AddHeader("token", tokenItem.Token);
|
||||||
|
IRestResponse response = client.Execute(request);
|
||||||
|
var contentPost = response.Content.Replace('"', ' ');
|
||||||
|
result = contentPost;
|
||||||
|
}
|
||||||
|
catch (System.Exception)
|
||||||
|
{
|
||||||
|
result = "";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#region 上报数据到集团
|
#region 上报数据到集团
|
||||||
#region 百万工时上报
|
#region 百万工时上报
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -274,6 +316,9 @@
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 安全生产数据季报上报
|
#region 安全生产数据季报上报
|
||||||
|
/// <summary>
|
||||||
|
/// 安全生产数据季报上报
|
||||||
|
/// </summary>
|
||||||
public static string UpSafetyQuarterlyReport(string safetyQuarterlyReportId, Model.Sys_User CurrUser)
|
public static string UpSafetyQuarterlyReport(string safetyQuarterlyReportId, Model.Sys_User CurrUser)
|
||||||
{
|
{
|
||||||
string code = "0";
|
string code = "0";
|
||||||
|
@ -281,7 +326,7 @@
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
|
// CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
|
||||||
var upReport = from x in db.Information_SafetyQuarterlyReport
|
var upReport = from x in db.Information_SafetyQuarterlyReport
|
||||||
where x.SafetyQuarterlyReportId == safetyQuarterlyReportId
|
where x.SafetyQuarterlyReportId == safetyQuarterlyReportId
|
||||||
select new CNCECHSSEService.Information_SafetyQuarterlyReport
|
select new CNCECHSSEService.Information_SafetyQuarterlyReport
|
||||||
|
@ -356,8 +401,8 @@
|
||||||
Remarks = x.Remarks,
|
Remarks = x.Remarks,
|
||||||
CompileMan = x.CompileMan,
|
CompileMan = x.CompileMan,
|
||||||
////附件转为字节传送
|
////附件转为字节传送
|
||||||
FullTimeManAttachUrlFileContext = FileStructService.GetFileStructByAttachUrl(x.FullTimeManAttachUrl),
|
//FullTimeManAttachUrlFileContext = FileStructService.GetFileStructByAttachUrl(x.FullTimeManAttachUrl),
|
||||||
PMManAttachUrlFileContext = FileStructService.GetFileStructByAttachUrl(x.PMManAttachUrl),
|
// PMManAttachUrlFileContext = FileStructService.GetFileStructByAttachUrl(x.PMManAttachUrl),
|
||||||
KeyEquipmentTotal = x.KeyEquipmentTotal,
|
KeyEquipmentTotal = x.KeyEquipmentTotal,
|
||||||
KeyEquipmentTotalRemark = x.KeyEquipmentTotalRemark,
|
KeyEquipmentTotalRemark = x.KeyEquipmentTotalRemark,
|
||||||
KeyEquipmentReportCount = x.KeyEquipmentReportCount,
|
KeyEquipmentReportCount = x.KeyEquipmentReportCount,
|
||||||
|
@ -372,7 +417,100 @@
|
||||||
//老接口Serveice
|
//老接口Serveice
|
||||||
// var getR = hsseC.DataInsertInformation_SafetyQuarterlyReportTable(upReport.ToList());
|
// var getR = hsseC.DataInsertInformation_SafetyQuarterlyReportTable(upReport.ToList());
|
||||||
//新接口Api
|
//新接口Api
|
||||||
|
string FullTimeManAttachUrl = string.Empty;
|
||||||
|
string PMManAttachUrl = string.Empty;
|
||||||
|
string physicalpath = Funs.RootPath;
|
||||||
|
FullTimeManAttachUrl = physicalpath + upReport.FirstOrDefault().FullTimeManAttachUrl;
|
||||||
|
PMManAttachUrl = physicalpath + upReport.FirstOrDefault().PMManAttachUrl;
|
||||||
|
FullTimeManAttachUrl = UploadFile(FullTimeManAttachUrl);
|
||||||
|
PMManAttachUrl = UploadFile(PMManAttachUrl);
|
||||||
|
upReport = from x in upReport
|
||||||
|
select new CNCECHSSEService.Information_SafetyQuarterlyReport
|
||||||
|
{
|
||||||
|
SafetyQuarterlyReportId = x.SafetyQuarterlyReportId,
|
||||||
|
UnitId = x.UnitId,
|
||||||
|
YearId = x.YearId,
|
||||||
|
Quarters = x.Quarters,
|
||||||
|
TotalInWorkHours = x.TotalInWorkHours,
|
||||||
|
TotalInWorkHoursRemark = x.TotalInWorkHoursRemark,
|
||||||
|
TotalOutWorkHours = x.TotalOutWorkHours,
|
||||||
|
TotalOutWorkHoursRemark = x.TotalOutWorkHoursRemark,
|
||||||
|
WorkHoursLossRate = x.WorkHoursLossRate,
|
||||||
|
WorkHoursLossRateRemark = x.WorkHoursLossRateRemark,
|
||||||
|
WorkHoursAccuracy = x.WorkHoursAccuracy,
|
||||||
|
WorkHoursAccuracyRemark = x.WorkHoursAccuracyRemark,
|
||||||
|
MainBusinessIncome = x.MainBusinessIncome,
|
||||||
|
MainBusinessIncomeRemark = x.MainBusinessIncomeRemark,
|
||||||
|
FillingDate = x.FillingDate,
|
||||||
|
ConstructionRevenue = x.ConstructionRevenue,
|
||||||
|
ConstructionRevenueRemark = x.ConstructionRevenueRemark,
|
||||||
|
UnitTimeIncome = x.UnitTimeIncome,
|
||||||
|
UnitTimeIncomeRemark = x.UnitTimeIncomeRemark,
|
||||||
|
BillionsOutputMortality = x.BillionsOutputMortality,
|
||||||
|
BillionsOutputMortalityRemark = x.BillionsOutputMortalityRemark,
|
||||||
|
MajorFireAccident = x.MajorFireAccident,
|
||||||
|
MajorFireAccidentRemark = x.MajorFireAccidentRemark,
|
||||||
|
MajorEquipAccident = x.MajorEquipAccident,
|
||||||
|
MajorEquipAccidentRemark = x.MajorEquipAccidentRemark,
|
||||||
|
AccidentFrequency = x.AccidentFrequency,
|
||||||
|
AccidentFrequencyRemark = x.AccidentFrequencyRemark,
|
||||||
|
SeriousInjuryAccident = x.SeriousInjuryAccident,
|
||||||
|
SeriousInjuryAccidentRemark = x.SeriousInjuryAccidentRemark,
|
||||||
|
FireAccident = x.FireAccident,
|
||||||
|
FireAccidentRemark = x.FireAccidentRemark,
|
||||||
|
EquipmentAccident = x.EquipmentAccident,
|
||||||
|
EquipmentAccidentRemark = x.EquipmentAccidentRemark,
|
||||||
|
PoisoningAndInjuries = x.PoisoningAndInjuries,
|
||||||
|
PoisoningAndInjuriesRemark = x.PoisoningAndInjuriesRemark,
|
||||||
|
ProductionSafetyInTotal = x.ProductionSafetyInTotal,
|
||||||
|
ProductionSafetyInTotalRemark = x.ProductionSafetyInTotalRemark,
|
||||||
|
ProtectionInput = x.ProtectionInput,
|
||||||
|
ProtectionInputRemark = x.ProtectionInputRemark,
|
||||||
|
LaboAndHealthIn = x.LaboAndHealthIn,
|
||||||
|
LaborAndHealthInRemark = x.LaborAndHealthInRemark,
|
||||||
|
TechnologyProgressIn = x.TechnologyProgressIn,
|
||||||
|
TechnologyProgressInRemark = x.TechnologyProgressInRemark,
|
||||||
|
EducationTrainIn = x.EducationTrainIn,
|
||||||
|
EducationTrainInRemark = x.EducationTrainInRemark,
|
||||||
|
ProjectCostRate = x.ProjectCostRate,
|
||||||
|
ProjectCostRateRemark = x.ProjectCostRateRemark,
|
||||||
|
ProductionInput = x.ProductionInput,
|
||||||
|
ProductionInputRemark = x.ProductionInputRemark,
|
||||||
|
Revenue = x.Revenue,
|
||||||
|
RevenueRemark = x.RevenueRemark,
|
||||||
|
FullTimeMan = x.FullTimeMan,
|
||||||
|
FullTimeManRemark = x.FullTimeManRemark,
|
||||||
|
FullTimeManAttachUrl = FullTimeManAttachUrl,
|
||||||
|
PMMan = x.PMMan,
|
||||||
|
PMManRemark = x.PMManRemark,
|
||||||
|
PMManAttachUrl = PMManAttachUrl,
|
||||||
|
CorporateDirectorEdu = x.CorporateDirectorEdu,
|
||||||
|
CorporateDirectorEduRemark = x.CorporateDirectorEduRemark,
|
||||||
|
ProjectLeaderEdu = x.ProjectLeaderEdu,
|
||||||
|
ProjectLeaderEduRemark = x.ProjectLeaderEduRemark,
|
||||||
|
FullTimeEdu = x.FullTimeEdu,
|
||||||
|
FullTimeEduRemark = x.FullTimeEduRemark,
|
||||||
|
ThreeKidsEduRate = x.ThreeKidsEduRate,
|
||||||
|
ThreeKidsEduRateRemark = x.ThreeKidsEduRateRemark,
|
||||||
|
UplinReportRate = x.UplinReportRate,
|
||||||
|
UplinReportRateRemark = x.UplinReportRateRemark,
|
||||||
|
Remarks = x.Remarks,
|
||||||
|
CompileMan = x.CompileMan,
|
||||||
|
KeyEquipmentTotal = x.KeyEquipmentTotal,
|
||||||
|
KeyEquipmentTotalRemark = x.KeyEquipmentTotalRemark,
|
||||||
|
KeyEquipmentReportCount = x.KeyEquipmentReportCount,
|
||||||
|
KeyEquipmentReportCountRemark = x.KeyEquipmentReportCountRemark,
|
||||||
|
ChemicalAreaProjectCount = x.ChemicalAreaProjectCount,
|
||||||
|
ChemicalAreaProjectCountRemark = x.ChemicalAreaProjectCountRemark,
|
||||||
|
HarmfulMediumCoverCount = x.HarmfulMediumCoverCount,
|
||||||
|
HarmfulMediumCoverCountRemark = x.HarmfulMediumCoverCountRemark,
|
||||||
|
HarmfulMediumCoverRate = x.HarmfulMediumCoverRate,
|
||||||
|
HarmfulMediumCoverRateRemark = x.HarmfulMediumCoverRateRemark
|
||||||
|
};
|
||||||
code = UpApiSaveSafetyQuarterlyReport(upReport).ToString();
|
code = UpApiSaveSafetyQuarterlyReport(upReport).ToString();
|
||||||
|
|
||||||
|
|
||||||
|
; LogService.AddSys_Log(CurrUser, "【安全生产数据季报上报】上传", code, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
|
||||||
if (code == "1")
|
if (code == "1")
|
||||||
{
|
{
|
||||||
foreach (var item in upReport.Select(p => p.SafetyQuarterlyReportId))
|
foreach (var item in upReport.Select(p => p.SafetyQuarterlyReportId))
|
||||||
|
@ -399,7 +537,7 @@
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
ErrLogInfo.WriteLog("【安全生产数据季报上报】上传到服务器", ex);
|
ErrLogInfo.WriteLog("【安全生产数据季报上报】上传到服务器", ex);
|
||||||
LogService.AddSys_Log(CurrUser, "【安全生产数据季报上报】上传到服务器失败;", null, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
|
LogService.AddSys_Log(CurrUser, "【安全生产数据季报上报】上传到服务器失败err;", null, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -414,6 +552,7 @@
|
||||||
{
|
{
|
||||||
string baseurl = "/api/InformationData/SaveSafetyQuarterlyReport";
|
string baseurl = "/api/InformationData/SaveSafetyQuarterlyReport";
|
||||||
var resultJson = JsonConvert.SerializeObject(new { InformationDataItems = upReport });
|
var resultJson = JsonConvert.SerializeObject(new { InformationDataItems = upReport });
|
||||||
|
APICommonService.SaveSysHttpLog("api_In", baseurl, resultJson);
|
||||||
var responeData = BLL.ServerService.PushCNCEC(resultJson, baseurl);
|
var responeData = BLL.ServerService.PushCNCEC(resultJson, baseurl);
|
||||||
|
|
||||||
return responeData.code;
|
return responeData.code;
|
||||||
|
|
Loading…
Reference in New Issue