|  |  | 
 |  |  | using Microsoft.AspNetCore.Http; | 
 |  |  | using HslCommunication.WebSocket; | 
 |  |  | using Microsoft.AspNetCore.Authorization; | 
 |  |  | using Microsoft.AspNetCore.Http; | 
 |  |  | using Microsoft.AspNetCore.Mvc; | 
 |  |  | using Newtonsoft.Json; | 
 |  |  | using WIDESEA_Core; | 
 |  |  | using WIDESEA_Core.BaseController; | 
 |  |  | using WIDESEA_Core.Helper; | 
 |  |  | using WIDESEA_IApprovalService; | 
 |  |  | using WIDESEA_ICheckRepository; | 
 |  |  | using WIDESEA_Model.Models; | 
 |  |  |  | 
 |  |  | namespace WIDESEA_WMSServer.Controllers.Approval | 
 |  |  | { | 
 |  |  |     /// <summary> | 
 |  |  |     /// å®¡æ¹ä»»å¡ | 
 |  |  |     /// </summary> | 
 |  |  |     [Route("api/[controller]")] | 
 |  |  |     [ApiController] | 
 |  |  |     public class ApprovalTaskController : ApiBaseController<IApprovalTaskService, Dt_ApprovalTask> | 
 |  |  |     { | 
 |  |  |         public ApprovalTaskController(IApprovalTaskService service) : base(service) | 
 |  |  |         private readonly ICheckOrderRepository _checkOrderRepository; | 
 |  |  |         private readonly WebSocketServer _webSocketServer; | 
 |  |  |  | 
 |  |  |         public ApprovalTaskController(IApprovalTaskService service, ICheckOrderRepository checkOrderRepository, WebSocketServer webSocketServer) : base(service) | 
 |  |  |         { | 
 |  |  |             _checkOrderRepository = checkOrderRepository; | 
 |  |  |             _webSocketServer = webSocketServer; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// åæå®¡æ¹ | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="sourceKey"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpGet, HttpPost, Route("AuditAgree")] | 
 |  |  |         public WebResponseContent AuditAgree(int sourceKey) | 
 |  |  |         { | 
 |  |  |             return Service.AuditAgree(sourceKey); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// é©³åå®¡æ¹ | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="sourceKey"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpGet, HttpPost, Route("AuditReject")] | 
 |  |  |         public WebResponseContent AuditReject(int sourceKey) | 
 |  |  |         { | 
 |  |  |             return Service.AuditReject(sourceKey); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// æ¨éæµè¯ | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [HttpGet, HttpPost, Route("PushTest"), AllowAnonymous] | 
 |  |  |         public WebResponseContent PushTest() | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<Dt_CheckOrder> checkOrders = _checkOrderRepository.Db.Queryable<Dt_CheckOrder>().Includes(x => x.Details).ToList(); | 
 |  |  |  | 
 |  |  |                 foreach (var checkOrder in checkOrders) | 
 |  |  |                 { | 
 |  |  |                     object obj = new | 
 |  |  |                     { | 
 |  |  |                         title = "IQCè´¨æ£ç»æå®¡æ¹", | 
 |  |  |                         formData = checkOrder, | 
 |  |  |                         tableData = checkOrder.Details, | 
 |  |  |                         message = "æ¨éæµè¯ä¿¡æ¯ä½", | 
 |  |  |                         date = DateTime.Now.ToString(), | 
 |  |  |                     }; | 
 |  |  |                     JsonSerializerSettings settings = new JsonSerializerSettings() | 
 |  |  |                     { | 
 |  |  |                         ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver() | 
 |  |  |                     }; | 
 |  |  |                     _webSocketServer.PublishAllClientPayload(JsonConvert.SerializeObject(obj, settings)); | 
 |  |  |                 } | 
 |  |  |                 return WebResponseContent.Instance.OK(); | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  |                 return WebResponseContent.Instance.Error(ex.Message); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } |