99 lines
4.9 KiB
C#
99 lines
4.9 KiB
C#
using System.Linq;
|
|
using System.Timers;
|
|
using System.Configuration;
|
|
using System;
|
|
using Newtonsoft.Json.Linq;
|
|
using Newtonsoft.Json;
|
|
using System.Collections;
|
|
|
|
namespace BLL
|
|
{
|
|
public class CNCECHSSEGetWebService
|
|
{
|
|
|
|
|
|
#region 督查检查整改上报
|
|
/// <summary>
|
|
/// 督查检查整改上报
|
|
/// </summary>
|
|
public static string UpDCGlCheck_CheckRectify(string checkRectifyId, Model.Sys_User CurrUser)
|
|
{
|
|
string code = "0";
|
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
|
{
|
|
try
|
|
{
|
|
// CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
|
|
var upCheckReport = from x in db.View_DCGL_CheckRectifyListFromSUB
|
|
where x.RealEndDate.HasValue && x.CheckRectifyId == checkRectifyId
|
|
select new Model.DCGLCheckRectifyItem
|
|
{
|
|
CheckRectifyId = x.CheckRectifyId,
|
|
CheckRectifyCode = x.CheckRectifyCode,
|
|
ProjectId = x.ProjectId,
|
|
UnitId = x.UnitId,
|
|
CheckDate = x.CheckDate,
|
|
IssueMan = x.IssueMan,
|
|
IssueDate = x.IssueDate,
|
|
HandleState = x.HandleState,
|
|
CheckRectifyItemId = x.CheckRectifyItemId,
|
|
ConfirmMan = x.ConfirmMan,
|
|
ConfirmDate = x.ConfirmDate,
|
|
OrderEndDate = x.OrderEndDate,
|
|
OrderEndPerson = x.OrderEndPerson,
|
|
RealEndDate = x.RealEndDate,
|
|
Verification = x.Verification,
|
|
AttachFileId = x.AttachFileId2,
|
|
ToKeyId = x.ToKeyId2,
|
|
AttachSource = x.AttachSource2,
|
|
AttachUrl = x.AttachUrl2,
|
|
////附件转为字节传送
|
|
FileContext = FileStructService.GetMoreFileStructByAttachUrl(x.AttachUrl2),
|
|
};
|
|
|
|
string baseurl = SysConstSetService.CNCECPath + "/api/HSSEData/UpDCGLCheckRectifyTable";
|
|
string contenttype = "application/json;charset=unicode";
|
|
Hashtable newToken = new Hashtable
|
|
{
|
|
{ "token", ServerService.GetToken().Token }
|
|
};
|
|
var pushContent = JsonConvert.SerializeObject(upCheckReport.ToList());
|
|
var strJosn = APIGetHttpService.Http(baseurl, "Post", contenttype, newToken, pushContent);
|
|
if (!string.IsNullOrEmpty(strJosn))
|
|
{
|
|
JObject obj = JObject.Parse(strJosn);
|
|
code = obj["code"].ToString();
|
|
|
|
if (code == "1")
|
|
{
|
|
var getIds = Funs.GetStrListByStr(obj["data"].ToString(), ',');
|
|
if (getIds.Count() > 0)
|
|
{
|
|
foreach (var item in getIds)
|
|
{
|
|
var newCheckRectify = db.DCGL_Check_CheckRectify.FirstOrDefault(e => e.CheckRectifyId == item);
|
|
if (newCheckRectify != null)
|
|
{
|
|
newCheckRectify.HandleState = BLL.Const.State_3; //已完成
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
LogService.AddSys_Log(CurrUser, "【集团检查整改】上传到服务器" + getIds.Count.ToString() + "条数据;", null, BLL.Const.UpDCGLCheckReportMenuId, BLL.Const.BtnUploadResources);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ErrLogInfo.WriteLog("【集团检查整改】上传到服务器", ex);
|
|
LogService.AddSys_Log(CurrUser, "【集团检查整改】上传到服务器失败;", null, BLL.Const.UpDCGLCheckReportMenuId, BLL.Const.BtnUploadResources);
|
|
}
|
|
return code;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|