| 
									
										
										
										
											2023-07-24 17:41:50 +08:00
										 |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Web.Http; | 
					
						
							|  |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using Model; | 
					
						
							| 
									
										
										
										
											2024-09-20 08:49:45 +08:00
										 |  |  |  | using Model.CQMS; | 
					
						
							| 
									
										
										
										
											2023-07-24 17:41:50 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace WebAPI.Controllers.CQMS | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     /// <summary> | 
					
						
							|  |  |  |  |     /// 共检通知单控制器 | 
					
						
							|  |  |  |  |     /// </summary> | 
					
						
							|  |  |  |  |     public class InspectionManagementController : ApiController | 
					
						
							|  |  |  |  |     { | 
					
						
							| 
									
										
										
										
											2023-08-15 15:11:57 +08:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 首次扫描执行,加载数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="InspectionNoticeMenuId"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         [HttpGet] | 
					
						
							| 
									
										
										
										
											2023-08-15 15:14:38 +08:00
										 |  |  |  |         public Model.ResponeData GetPersonQuality(string InspectionNoticeMenuId) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2023-08-15 15:11:57 +08:00
										 |  |  |  |             var responeData = new Model.ResponeData(); | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 var model = BLL.InspectionManagementService.GetInspectionManagementById(InspectionNoticeMenuId); | 
					
						
							| 
									
										
										
										
											2023-08-15 15:14:38 +08:00
										 |  |  |  |                 returnPersonQuality newModel = new returnPersonQuality(); | 
					
						
							|  |  |  |  |                 if (model != null) | 
					
						
							| 
									
										
										
										
											2023-08-15 15:11:57 +08:00
										 |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2023-08-15 15:14:38 +08:00
										 |  |  |  |                     newModel.InspectionCode = model.InspectionCode; | 
					
						
							|  |  |  |  |                     newModel.IsOnceQualified = model.IsOnceQualified; | 
					
						
							| 
									
										
										
										
											2023-08-17 09:39:51 +08:00
										 |  |  |  |                     if (!string.IsNullOrEmpty(model.InspectionDate.ToString())) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         newModel.InspectionDate = model.InspectionDate.ToString().Replace("/", "-"); | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2023-08-15 15:14:38 +08:00
										 |  |  |  |                     newModel.UnqualifiedReason = model.UnqualifiedReason; | 
					
						
							| 
									
										
										
										
											2023-08-17 09:39:51 +08:00
										 |  |  |  |                     //附件 | 
					
						
							|  |  |  |  |                     var Fjmodel = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == InspectionNoticeMenuId && x.MenuId == Const.InspectionNoticeMenuId); | 
					
						
							|  |  |  |  |                     if (model != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         newModel.AttachUrl = Fjmodel.AttachUrl; | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2023-08-15 15:14:38 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |                     responeData.data = newModel; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else { | 
					
						
							|  |  |  |  |                     responeData.code = 0; | 
					
						
							| 
									
										
										
										
											2023-08-15 15:11:57 +08:00
										 |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception ex) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 responeData.code = 0; | 
					
						
							|  |  |  |  |                 responeData.message = ex.Message; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return responeData; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-24 17:41:50 +08:00
										 |  |  |  |         #region 根据二维码ID验收日期、是否一次合格 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 根据二维码ID修改验收日期、是否一次合格 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="model"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         [HttpPost] | 
					
						
							|  |  |  |  |         public Model.ResponeData SavePersonQuality([FromBody] Model.ProcessControl_InspectionManagement model) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var responeData = new Model.ResponeData(); | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 InspectionManagementService.UpdateByInspectionManagementId(model); | 
					
						
							| 
									
										
										
										
											2023-07-24 19:52:40 +08:00
										 |  |  |  |                 //上传附件 | 
					
						
							| 
									
										
										
										
											2023-08-15 15:11:57 +08:00
										 |  |  |  |                 SaveAttachFile(model.InspectionId, BLL.Const.InspectionNoticeMenuId, model.AttachUrl); | 
					
						
							| 
									
										
										
										
											2023-07-24 17:41:50 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception ex) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 responeData.code = 0; | 
					
						
							|  |  |  |  |                 responeData.message = ex.Message; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return responeData; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							| 
									
										
										
										
											2023-07-24 19:52:40 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void SaveAttachFile(string dataId, string menuId, string url) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.ToDoItem toDoItem = new Model.ToDoItem | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 MenuId = menuId, | 
					
						
							|  |  |  |  |                 DataId = dataId, | 
					
						
							|  |  |  |  |                 UrlStr = url, | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             APIUpLoadFileService.SaveAttachUrl(toDoItem); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2023-08-15 15:14:38 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-17 09:39:51 +08:00
										 |  |  |  |          | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-15 15:14:38 +08:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 返回实体 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         public class returnPersonQuality | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2023-08-17 09:39:51 +08:00
										 |  |  |  |             public string InspectionDate { get; set; } | 
					
						
							| 
									
										
										
										
											2023-08-15 15:14:38 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |             public bool? IsOnceQualified { get; set; } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             public int MyProperty { get; set; } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             public string InspectionCode { get; set; } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             public string UnqualifiedReason { get; set; } | 
					
						
							| 
									
										
										
										
											2023-08-17 09:39:51 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |             public string AttachUrl { get; set; } | 
					
						
							| 
									
										
										
										
											2023-08-15 15:14:38 +08:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-09-20 08:49:45 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 小程序端 | 
					
						
							|  |  |  |  |         /// <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; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							| 
									
										
										
										
											2023-07-24 17:41:50 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | } |