108 lines
		
	
	
		
			5.6 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			108 lines
		
	
	
		
			5.6 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))
 | |
|             {
 | |
|                 string filePath = Funs.SGGLUrl;
 | |
|                 try
 | |
|                 {
 | |
|                     var upCheckReport = from x in db.View_DCGL_CheckRectifyListFromSUB
 | |
|                                         where x.RealEndDate.HasValue && x.CheckRectifyId == checkRectifyId
 | |
|                                         select new Model.DCGLCheckRectifyItem
 | |
|                                         {
 | |
|                                             CheckRectifyId = x.CheckRectifyId,
 | |
|                                             NoticeItemId = x.NoticeItemId,
 | |
|                                             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,
 | |
|                                             Situation = x.Situation,
 | |
|                                             AttachFileId = x.AttachFileId2,
 | |
|                                             ToKeyId = x.ToKeyId2,
 | |
|                                             AttachSource = x.AttachSource2,
 | |
|                                             AttachUrl = x.AttachUrl2,
 | |
|                                             FilePath = filePath
 | |
|                                             //////附件转为字节传送
 | |
|                                             //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());
 | |
| 
 | |
|                     //ErrLogInfo.WriteLog($"【集团检查整改上报数据】:{pushContent}");
 | |
|                     var strJosn = APIGetHttpService.Http(baseurl, "Post", contenttype, newToken, pushContent);
 | |
|                     if (!string.IsNullOrEmpty(strJosn))
 | |
|                     {
 | |
|                         //ErrLogInfo.WriteLog($"【集团检查整改上报数据结果】:{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)
 | |
|                                     {
 | |
|                                         var getNoUpdateItem = db.DCGL_Check_CheckRectifyItem.FirstOrDefault(x => x.CheckRectifyId == checkRectifyId && !x.RealEndDate.HasValue);
 | |
|                                         if (getNoUpdateItem == 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
 | |
| 
 | |
|     }
 | |
| }
 |