|
|
@@ -27,6 +27,8 @@ using System.Data;
|
|
|
using System.IO;
|
|
|
using System.Net;
|
|
|
using System.Text;
|
|
|
+using Fleck;
|
|
|
+using System.Linq;
|
|
|
|
|
|
namespace Dongke.IBOSS.PRD.Service.PMModuleLogic
|
|
|
{
|
|
|
@@ -37,6 +39,29 @@ namespace Dongke.IBOSS.PRD.Service.PMModuleLogic
|
|
|
{
|
|
|
#region 生产管理
|
|
|
|
|
|
+ #region xuwei add 2022-09-07 增加数据监控变量
|
|
|
+ public static List<IWebSocketConnection> webSocketConection;
|
|
|
+ public static WebSocketServer webSocketServer;
|
|
|
+ public static int WebSocketSend(string data)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (webSocketServer == null)
|
|
|
+ {
|
|
|
+ webSocketConection = new List<IWebSocketConnection>();
|
|
|
+ webSocketServer = new WebSocketServer("ws://127.0.0.1:8000");
|
|
|
+ webSocketServer.Start(socket => { socket.OnOpen = () => webSocketConection.Add(socket); socket.OnClose = () => webSocketConection.Remove(socket); });
|
|
|
+ }
|
|
|
+ webSocketConection.ToList().ForEach(s => s.Send(data));
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
#region 计件
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -51,6 +76,14 @@ namespace Dongke.IBOSS.PRD.Service.PMModuleLogic
|
|
|
/// </remarks>
|
|
|
public static DataTable AddWorkPiece(int procedureID, DataTable barcodeTable, SUserInfo sUserInfo, out ProcedureEntity procedureInfo)
|
|
|
{
|
|
|
+ #region xuwei add 2022-09-07 增加数据监控
|
|
|
+ JObject pieceData = new JObject();
|
|
|
+ pieceData.Add(new JProperty("procedureID", procedureID));
|
|
|
+ pieceData.Add(new JProperty("barcodeTable", barcodeTable));
|
|
|
+ pieceData.Add(new JProperty("sUserInfo", sUserInfo));
|
|
|
+ WebSocketSend(pieceData.ToString());
|
|
|
+ #endregion
|
|
|
+
|
|
|
procedureInfo = null;
|
|
|
if (barcodeTable == null || barcodeTable.Rows.Count == 0)
|
|
|
{
|