145 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			145 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using Model; | |||
|  | using Model.CQMS; | |||
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Net; | |||
|  | using System.Net.Http; | |||
|  | using System.Web.Http; | |||
|  | 
 | |||
|  | namespace WebAPI.Controllers.CQMS | |||
|  | { | |||
|  |     public class InspectionManagementController : ApiController | |||
|  |     { | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  |          /// <summary> | |||
|  |          ///   添加 主表+子表 | |||
|  |          /// </summary> | |||
|  |          /// <param name="inspectionManagement"></param> | |||
|  |          /// <returns></returns> | |||
|  |         [HttpPost] | |||
|  |         public ResponseData<string> AddInspectionManagement([FromBody]InspectionManagement inspectionManagement) | |||
|  |         { | |||
|  |             ResponseData<string> res = new ResponseData<string>(); | |||
|  |             try | |||
|  |             { | |||
|  |                 res.successful = BLL.API.CQMS.ApiInspectionManagementService.AddInspectionManagement(inspectionManagement); | |||
|  |                 res.successful = true; | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  | 
 | |||
|  |             } | |||
|  |             return res; | |||
|  | 
 | |||
|  |         } | |||
|  |        /// <summary> | |||
|  |        /// 获取观测点 | |||
|  |        /// </summary> | |||
|  |        /// <param name="projectId"></param> | |||
|  |        /// <param name="keyWord"></param> | |||
|  |        /// <returns></returns> | |||
|  |         public ResponseData<List<BreakdownProject>> getBreakdownProject(string projectId, string keyWord) | |||
|  |         { | |||
|  |             ResponseData<List<BreakdownProject>> res = new ResponseData<List<BreakdownProject>>(); | |||
|  |             try | |||
|  |             {if (string.IsNullOrEmpty(keyWord)) | |||
|  |                     keyWord = ""; | |||
|  |                 res.resultValue = BLL.API.CQMS.BreakdownProjectService.getBreakdowns(projectId, keyWord); | |||
|  |                 res.successful = true; | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  | 
 | |||
|  |             } | |||
|  |             return res; | |||
|  | 
 | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         ///   获取明细列表数据 | |||
|  |         /// </summary> | |||
|  |         /// <param name="projectId"></param> | |||
|  |         /// <param name="index"></param> | |||
|  |         /// <param name="page"></param> | |||
|  |         /// <param name="state"></param> | |||
|  |         /// <param name="name"></param> | |||
|  |         /// <returns></returns> | |||
|  |         [HttpGet] | |||
|  |         public ResponseData<List<InspectionManagement>> getInspectionManagement(string projectId, int index, int page, string state, string name) | |||
|  |         { | |||
|  |             ResponseData<List<InspectionManagement>> res = new ResponseData<List<InspectionManagement>>(); | |||
|  |             try | |||
|  |             { | |||
|  |                 res.successful = true; | |||
|  |                 res.resultValue = BLL.API.CQMS.ApiInspectionManagementService.getInspectionManagement(projectId, index, page, state, name); | |||
|  | 
 | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 res.successful = false; | |||
|  | 
 | |||
|  |             } | |||
|  | 
 | |||
|  |             return res; | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         ///   获取明细列表数据 | |||
|  |         /// </summary> | |||
|  |         /// <param name="projectId"></param> | |||
|  |         /// <param name="index"></param> | |||
|  |         /// <param name="page"></param> | |||
|  |         /// <param name="state"></param> | |||
|  |         /// <param name="name"></param> | |||
|  |         /// <returns></returns> | |||
|  |         [HttpGet] | |||
|  |         public ResponseData<List<InspectionManagementDetail>> getInspectionManagementDetail(string projectId, int index, int page, string state, string name) | |||
|  |         { | |||
|  |             ResponseData<List<InspectionManagementDetail>> res = new ResponseData<List<InspectionManagementDetail>>(); | |||
|  |             try | |||
|  |             { | |||
|  |                 res.successful = true; | |||
|  |                 res.resultValue = BLL.API.CQMS.ApiInspectionManagementService.getInspectionManagementDetail(projectId, index, page, state, name); | |||
|  | 
 | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 res.successful = false; | |||
|  | 
 | |||
|  |             } | |||
|  | 
 | |||
|  |             return res; | |||
|  |         } | |||
|  |        /// <summary> | |||
|  |        /// 根据主表 获取子表数据 | |||
|  |        /// </summary> | |||
|  |        /// <param name="InspectionId"></param> | |||
|  |        /// <returns></returns> | |||
|  |         [HttpGet] | |||
|  |         public ResponseData<List<InspectionManagementDetail>> getInspectionManagementDetailByInspectionId(string InspectionId) | |||
|  |         { | |||
|  |             ResponseData<List<InspectionManagementDetail>> res = new ResponseData<List<InspectionManagementDetail>>(); | |||
|  |             try | |||
|  |             { | |||
|  |                 res.successful = true; | |||
|  |                 res.resultValue = BLL.API.CQMS.ApiInspectionManagementService.getInspectionManagementDetailByinspectionId(InspectionId); | |||
|  | 
 | |||
|  |             } | |||
|  |             catch (Exception e) | |||
|  |             { | |||
|  |                 res.successful = false; | |||
|  | 
 | |||
|  |             } | |||
|  | 
 | |||
|  |             return res; | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  |     } | |||
|  | } |