From 059bfb279d7bb7a45b1a9d3d5e26db238e939a7f Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期三, 15 一月 2025 13:37:47 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn --- 代码管理/淮安PDA/common/config.js | 2 代码管理/淮安PDA/pages/stash/boxing.vue | 14 +++- 代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/f0ff9510-db3b-4549-baaa-b880ccefd2d7.vsidx | 0 代码管理/淮安PDA/pages/stash/raworderboxing.vue | 84 ---------------------------- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/wwwroot/logo/favicon-32x32.png | 0 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs | 5 + /dev/null | 0 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ce8ba97c-1d90-4f9a-a3f1-69f1f87b2d47.vsidx | 0 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WebSocketSetup.cs | 29 +++++++++ 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs | 8 ++ 代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/50784c2a-deac-4e4b-9412-581239bdaea2.vsidx | 0 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs | 22 ++++++ 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json | 4 + 代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/ceed0040-40be-4d84-ae92-49490c0614dc.vsidx | 0 14 files changed, 72 insertions(+), 96 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/50784c2a-deac-4e4b-9412-581239bdaea2.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/50784c2a-deac-4e4b-9412-581239bdaea2.vsidx" new file mode 100644 index 0000000..a59f5b0 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/50784c2a-deac-4e4b-9412-581239bdaea2.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/c27c829f-7a3d-4626-bb9f-b920ddec36a6.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/c27c829f-7a3d-4626-bb9f-b920ddec36a6.vsidx" deleted file mode 100644 index 572bee1..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/c27c829f-7a3d-4626-bb9f-b920ddec36a6.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/ceed0040-40be-4d84-ae92-49490c0614dc.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/ceed0040-40be-4d84-ae92-49490c0614dc.vsidx" new file mode 100644 index 0000000..006ed79 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/ceed0040-40be-4d84-ae92-49490c0614dc.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/f0ff9510-db3b-4549-baaa-b880ccefd2d7.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/f0ff9510-db3b-4549-baaa-b880ccefd2d7.vsidx" new file mode 100644 index 0000000..6f6c859 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/f0ff9510-db3b-4549-baaa-b880ccefd2d7.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" index 89f653a..739828f 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" @@ -1,4 +1,5 @@ -锘縰sing Microsoft.AspNetCore.Authorization; +锘縰sing HslCommunication.WebSocket; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using WIDESEAWCS_Core; @@ -16,11 +17,13 @@ { private readonly IHttpContextAccessor _httpContextAccessor; private readonly IRouterExtension _routerExtension; + private readonly WebSocketServer _webSocketServer; - public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor, IRouterExtension routerExtension) : base(service) + public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor, IRouterExtension routerExtension, WebSocketServer webSocketServer) : base(service) { _httpContextAccessor = httpContextAccessor; _routerExtension = routerExtension; + _webSocketServer = webSocketServer; } [HttpPost, Route("ReceiveTask"), AllowAnonymous] @@ -69,10 +72,25 @@ { return Service.SendSecureReplyToAgv(taskNum); } + [HttpPost, HttpGet, Route("GetRouteEndPoint"), AllowAnonymous] public WebResponseContent GetRouteEndPoint(string startPoint, int routeType) { return WebResponseContent.Instance.OK(data: _routerExtension.GetEndPoint(startPoint, routeType)); } + + [HttpPost, HttpGet, Route("WebSocketPushMessage"), AllowAnonymous] + public WebResponseContent WebSocketPushMessage(string message) + { + try + { + _webSocketServer.PublishAllClientPayload(message); + return WebResponseContent.Instance.OK(); + } + catch(Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs" index bfebe8b..8da05a1 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs" @@ -1,4 +1,5 @@ 锘� +using HslCommunication.WebSocket; using SqlSugar; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_Core.Seed; @@ -12,11 +13,13 @@ { private readonly ICacheService _cacheService; private readonly DBContext _dbContext; + private readonly WebSocketServer _webSocketServer; - public WarehouseHostedService(ICacheService cacheService, DBContext dbContext) + public WarehouseHostedService(ICacheService cacheService, DBContext dbContext, WebSocketServer webSocketServer) { _cacheService = cacheService; _dbContext = dbContext; + _webSocketServer = webSocketServer; } public Task StartAsync(CancellationToken cancellationToken) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WebSocketSetup.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WebSocketSetup.cs" new file mode 100644 index 0000000..26232e4 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WebSocketSetup.cs" @@ -0,0 +1,29 @@ +锘縰sing HslCommunication.WebSocket; +using WIDESEAWCS_Core.Helper; + +namespace WIDESEAWCS_Server.HostedService +{ + public static class WebSocketSetup + { + public static void AddWebSocketSetup(this IServiceCollection services) + { + if (services == null) throw new ArgumentNullException(nameof(services)); + + if(AppSettings.Get("WebSocketEnable").ObjToBool()) + { + int port = AppSettings.Get("WebSocketPort").ObjToInt(); + if (port == 0) + { + port = 9296; + } + + services.AddSingleton(x => + { + WebSocketServer socketServer = new WebSocketServer(); + socketServer.ServerStart(port); + return socketServer; + }); + } + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs" index 0ec998c..dfb5daa 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs" @@ -51,6 +51,8 @@ builder.Services.AddHostedService<WarehouseHostedService>(); builder.Services.AddHostedService<QuartzJobDataTableHostedService>(); +builder.Services.AddWebSocketSetup(); + builder.Services.AddAutoMapperSetup(); builder.Services.AddCorsSetup(); @@ -112,13 +114,15 @@ app.UseAllServicesMiddle(builder.Services); app.UseSession(); -//if (app.Environment.IsDevelopment()) +if (app.Environment.IsProduction()) { //todo app.UseSwaggerAuthorized(); - app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEAWCS_Server.index.html") ?? throw new Exception("未找到WIDESEAWCS_Server.index.html文件")); + }//判断是否需要打开swagger +app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEAWCS_Server.index.html") ?? throw new Exception("未找到WIDESEAWCS_Server.index.html文件")); + app.UseIpLimitMiddle(); app.UseApiLogMiddleware(); //todo diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json" index 18ef079..cef2990 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json" @@ -26,5 +26,7 @@ "WMSApiAddress": "http://127.0.0.1:9293", //"http://127.0.0.1:9283",姝e紡鐜鍦板潃 "ApiName": "WIDESEA", "ExpMinutes": 120, - "QuartzJobAutoStart": true + "QuartzJobAutoStart": true, + "WebSocketEnable": true, + "WebSocketPort": 9260 } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/wwwroot/logo/favicon-32x32.png" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/wwwroot/logo/favicon-32x32.png" new file mode 100644 index 0000000..68062fe --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/wwwroot/logo/favicon-32x32.png" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ce8ba97c-1d90-4f9a-a3f1-69f1f87b2d47.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ce8ba97c-1d90-4f9a-a3f1-69f1f87b2d47.vsidx" new file mode 100644 index 0000000..94c7bcd --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ce8ba97c-1d90-4f9a-a3f1-69f1f87b2d47.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/common/config.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/common/config.js" index ee92f58..57eb1c7 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/common/config.js" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/common/config.js" @@ -1,5 +1,5 @@ let config = { - baseUrl: 'http://localhost:9293', + baseUrl: 'http://10.30.4.92:9293', urls: [ 'http://10.30.4.92:9283', 'http://10.30.4.92:9283' diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/boxing.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/boxing.vue" index 82d6dc8..4a56381 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/boxing.vue" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/boxing.vue" @@ -383,22 +383,26 @@ }, snInput() { this.$nextTick(() => { - if (this.warehouseId == 6 || this.warehouseId == 2) { + if (this.warehouseId == 6 || this.warehouseId == 2 || this.warehouseId == 3) { if (this.sns.length > 0) { this.sns = []; } } if (this.materSn != "") { this.focus = false; - var matSn = this.materSn; - setTimeout(() => { + if(this.materSn.split(',').length != 6){ this.materSn = ""; - }, 10); + return; + } + var matSn = this.materSn; + //setTimeout(() => { + this.materSn = ""; + //}, 10); this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => { this.Testcheck = false; if (res.status) { this.sns.push(res.data.serialNumber); - if (this.warehouseId == 6 || this.warehouseId == 2) { + if (this.warehouseId == 6 || this.warehouseId == 2 || this.warehouseId == 3) { if (this.matInfos.length > 0) { this.matInfos = []; } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/raworderboxing.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/raworderboxing.vue" index b138417..80fed18 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/raworderboxing.vue" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/\346\267\256\345\256\211PDA/pages/stash/raworderboxing.vue" @@ -202,90 +202,6 @@ innerAudioContext.src = src; // '../../static/success.mp3'; innerAudioContext.play(); }, - //瑙g洏 - releasebox() { - if (this.value.length == 0) { - this.$refs.uToast.show({ - title: "璇锋壂鐮�", - type: "error" - }) - return; - } - var param; - var matInfo = this.value.split('|'); - if (matInfo.length == 7) { - param = { - MainData: { - "innerCode": this.value - } - } - } else { - param = { - MainData: { - "barcode": this.value - } - } - } - this.$u.post('/api/StockOperate/ReleaseAllBox', param).then(resdt => { - if (resdt.status) { - uni.$showMsg('瑙g洏鎴愬姛!') - this.value = ""; - this.matInfo = []; - this.matTotals = []; - this.value2 = ""; - } else { - this.$refs.uToast.show({ - title: resdt.message, - type: "error" - }) - } - }) - }, - releaseboxInput() { - this.$nextTick(() => { - if (this.value.length == 0) { - return; - } - var matInfo = this.value.split('|'); - this.matInfo = []; - if (matInfo.length == 7) { - this.$u.post('/api/StockOperate/GetStockInfoByInnerCode', { - MainData: { - "innerCode": this.value - } - }).then(res => { - if (res.status) { - this.matInfo = res.data.stockInfo; - this.matTotals = res.data.stockTotal; - this.value2 = res.data.barcode; - } else { - this.$refs.uToast.show({ - title: res.message, - type: "error" - }) - } - }) - } else { - this.$u.post('/api/StockOperate/GetStockInfoByBarcode', { - MainData: { - "barcode": this.value - } - }).then(res => { - if (res.status) { - this.matInfo = res.data.stockInfo; - this.matTotals = res.data.stockTotal; - this.value2 = res.data.barcode; - } else { - this.$refs.uToast.show({ - title: res.message, - type: "error" - }) - } - }) - } - }) - }, - updateFocus() { debugger this.$nextTick(() => { -- Gitblit v1.9.3