From 695571c6009ecbc12e7d4a4fb147df7967a1260e Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期一, 07 七月 2025 20:21:19 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Approval/ApprovalTaskController.cs | 62 ++++++++++++++++++++++++++++++-
1 files changed, 60 insertions(+), 2 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Approval/ApprovalTaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Approval/ApprovalTaskController.cs"
index d9c631b..df78d7d 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Approval/ApprovalTaskController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Approval/ApprovalTaskController.cs"
@@ -1,30 +1,88 @@
-锘縰sing Microsoft.AspNetCore.Http;
+锘縰sing 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);
+ }
+ }
}
}
--
Gitblit v1.9.3