184 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			184 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | ||
| using Model;
 | ||
| using System;
 | ||
| using System.Collections.Generic;
 | ||
| using System.Linq;
 | ||
| using System.Threading.Tasks;
 | ||
| using System.Web.Http;
 | ||
| 
 | ||
| namespace WebAPI.Controllers
 | ||
| {
 | ||
|     /// <summary>
 | ||
|     /// 五环IDP平台
 | ||
|     /// </summary>
 | ||
|     public class IDPController : ApiController
 | ||
|     {
 | ||
|         #region IDP系统项目设计图纸数据
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 每天夜间同步获取IDP系统项目设计图纸数据
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         [HttpPost]
 | ||
|         public Model.ResponeData SynIDPDesignDrawingData()
 | ||
|         {
 | ||
|             var responeData = new Model.ResponeData();
 | ||
|             try
 | ||
|             {
 | ||
|                 var lst = DesignDrawingService.GetIDPDesignDrawingFile();
 | ||
|                 if (lst.Any())
 | ||
|                 {
 | ||
|                     List<string> dates = new List<string>();
 | ||
|                     dates.Add(DateTime.Now.ToString("yyyy-MM-dd"));
 | ||
|                     dates.Add(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"));
 | ||
|                     dates.Add(DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd"));
 | ||
|                     //string date = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
 | ||
| 
 | ||
|                     foreach (var date in dates)
 | ||
|                     {
 | ||
|                         IDPDataService.GetIDPProjectDesignDrawingData("", date);
 | ||
|                     }
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     IDPDataService.GetIDPProjectDesignDrawingData();
 | ||
|                 }
 | ||
|             }
 | ||
|             catch (Exception ex)
 | ||
|             {
 | ||
|                 responeData.code = 0;
 | ||
|                 responeData.message = ex.ToString();
 | ||
|             }
 | ||
|             return responeData;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 获取指定日期的IDP系统项目设计图纸数据【调试数据用】
 | ||
|         /// </summary>
 | ||
|         /// <param name="dates"></param>
 | ||
|         /// <returns></returns>
 | ||
|         [HttpPost]
 | ||
|         public Model.ResponeData SynIDPDesignDrawingDataByDate([FromBody] List<string> dates)
 | ||
|         {
 | ||
|             var responeData = new Model.ResponeData();
 | ||
|             try
 | ||
|             {
 | ||
|                 foreach (var date in dates)
 | ||
|                 {
 | ||
|                     if (!string.IsNullOrWhiteSpace(date))
 | ||
|                     {
 | ||
|                         //string date = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
 | ||
|                         IDPDataService.GetIDPProjectDesignDrawingData("", date);
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         IDPDataService.GetIDPProjectDesignDrawingData();
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
|             catch (Exception ex)
 | ||
|             {
 | ||
|                 responeData.code = 0;
 | ||
|                 responeData.message = ex.ToString();
 | ||
|             }
 | ||
|             return responeData;
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 每天夜间接收OA系统项目设计图纸数据
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         [HttpPost]
 | ||
|         public Model.ResponeData SynOADesignDrawingData([FromBody] List<OADesignDrawingDataItem> items)
 | ||
|         {
 | ||
|             var responeData = new Model.ResponeData();
 | ||
|             try
 | ||
|             {
 | ||
|                 responeData.message = IDPDataService.SaveDesignDrawingData(items);
 | ||
|             }
 | ||
|             catch (Exception ex)
 | ||
|             {
 | ||
|                 responeData.code = 0;
 | ||
|                 responeData.message = ex.ToString();
 | ||
|             }
 | ||
|             return responeData;
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 每天夜间同步获取OA系统项目设计图纸数据蓝图寄出信息
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         [HttpPost]
 | ||
|         public Model.ResponeData SynOADesignDrawingDataBlueprintInfo()
 | ||
|         {
 | ||
|             var responeData = new Model.ResponeData();
 | ||
|             try
 | ||
|             {
 | ||
|                 responeData.message = IDPDataService.GetDesignDrawingDataBlueprintInfo();
 | ||
|             }
 | ||
|             catch (Exception ex)
 | ||
|             {
 | ||
|                 responeData.code = 0;
 | ||
|                 responeData.message = ex.ToString();
 | ||
|             }
 | ||
|             return responeData;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 每天夜间同步获取OA系统项目设计图纸数据蓝图打印信息
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         [HttpPost]
 | ||
|         public Model.ResponeData SynOADesignDrawingDataPrintInfo()
 | ||
|         {
 | ||
|             var responeData = new Model.ResponeData();
 | ||
|             try
 | ||
|             {
 | ||
|                 responeData.message = IDPDataService.GetDesignDrawingDataPrintInfo();
 | ||
|             }
 | ||
|             catch (Exception ex)
 | ||
|             {
 | ||
|                 responeData.code = 0;
 | ||
|                 responeData.message = ex.ToString();
 | ||
|             }
 | ||
|             return responeData;
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region IDP系统项目开车数据
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 获取IDP系统项目开车数据【测试用,接口不上线】
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         [HttpPost]
 | ||
|         public Model.ReturnData SynIDPPreRunData()
 | ||
|         {
 | ||
|             var responeData = new Model.ReturnData();
 | ||
|             responeData.time = DateTime.Now.ToString();
 | ||
|             try
 | ||
|             {
 | ||
|                 var session = IDPDataService.GetAuthenticationSession();
 | ||
|                 //ErrLogInfo.WriteLog($"Session——name:{session.name};value:{session.value}");
 | ||
| 
 | ||
|                 string pipingMsg = IDPDataService.GetIDPProjectPreRunDataPiping(session, "32d0bca0-7693-4bd6-813d-6ee174ba29d3");
 | ||
|                 string equipmentMsg = IDPDataService.GetIDPProjectPreRunDataEquipment(session, "32d0bca0-7693-4bd6-813d-6ee174ba29d3");
 | ||
|                 string instrumentationMsg = IDPDataService.GetIDPProjectPreRunDataInstrumentation(session, "32d0bca0-7693-4bd6-813d-6ee174ba29d3");
 | ||
|                 responeData.message = $"管道一览表:{pipingMsg};设备一览表:{equipmentMsg};索引表:{instrumentationMsg}";
 | ||
|                 //responeData.message = $"管道一览表:{pipingMsg};设备一览表:{equipmentMsg};";
 | ||
|                 //responeData.message = $"索引表:{instrumentationMsg}";
 | ||
|             }
 | ||
|             catch (Exception ex)
 | ||
|             {
 | ||
|                 responeData.code = 0;
 | ||
|                 responeData.message = ex.ToString();
 | ||
|             }
 | ||
|             return responeData;
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
|     }
 | ||
| } |