From fe562be009f354480f9430c1349bd217eeb1c3b1 Mon Sep 17 00:00:00 2001 From: liuwf Date: Wed, 17 Apr 2024 17:12:41 +0800 Subject: [PATCH] =?UTF-8?q?change-=E8=80=81=E7=BA=BF=E5=88=86=E5=9E=9B?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=8A=E6=96=B0=E5=8F=91=E6=B3=A1=E7=99=BD?= =?UTF-8?q?=E5=A4=9C=E7=8F=AD=E5=88=87=E6=8D=A2=E6=97=B6=E9=97=B4=E6=A0=B9?= =?UTF-8?q?=E6=8D=AEmes=E8=AE=BE=E7=BD=AE=E6=97=B6=E9=97=B4=E5=88=87?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Admin.Core.Api/Admin.Core.Model.xml | 15 ++ .../IService_New/IBaseBomInfoServices.cs | 6 + Admin.Core.Model/ViewModels/TwoTime.cs | 29 ++++ .../Service_New/BaseBomInfoServices.cs | 19 +++ Admin.Core.Socket/TouchSocketService.cs | 8 +- .../Business/TeamSwitchBusiness.cs | 68 ++++++++- .../ViewModels/FoamMonitorPageViewModel.cs | 2 + Aucma.Core.Palletiz/appsettings.json | 7 +- .../Business/InstoreBusiness.cs | 8 +- .../ViewModels/IndexPageViewModel.cs | 37 +++-- .../Views/HandPalletizView.xaml | 1 + .../Views/IndexPageView.xaml | 129 +++++++++++------- Aucma.Core.PalletizCX1/appsettings.json | 26 ++-- 13 files changed, 267 insertions(+), 88 deletions(-) create mode 100644 Admin.Core.Model/ViewModels/TwoTime.cs diff --git a/Admin.Core.Api/Admin.Core.Model.xml b/Admin.Core.Api/Admin.Core.Model.xml index 9408fbfb..3ed33bd0 100644 --- a/Admin.Core.Api/Admin.Core.Model.xml +++ b/Admin.Core.Api/Admin.Core.Model.xml @@ -6626,6 +6626,21 @@ 前板数量 + + + 条码绑定扫描类型统计 + + + + + 开始时间 + + + + + 结束时间 + + 条码绑定扫描类型统计 diff --git a/Admin.Core.IService/IService_New/IBaseBomInfoServices.cs b/Admin.Core.IService/IService_New/IBaseBomInfoServices.cs index c566a7df..7451c159 100644 --- a/Admin.Core.IService/IService_New/IBaseBomInfoServices.cs +++ b/Admin.Core.IService/IService_New/IBaseBomInfoServices.cs @@ -12,6 +12,12 @@ namespace Admin.Core.IService public interface IBaseBomInfoServices : IBaseServices { + /// + /// 获取系统白夜班时间,发泡班组切换使用 + /// + public Task> getTwoTime(); + + /// /// 获取系统班组时间 /// diff --git a/Admin.Core.Model/ViewModels/TwoTime.cs b/Admin.Core.Model/ViewModels/TwoTime.cs new file mode 100644 index 00000000..82bbca73 --- /dev/null +++ b/Admin.Core.Model/ViewModels/TwoTime.cs @@ -0,0 +1,29 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Admin.Core.Model.ViewModels +{ + /// + /// 条码绑定扫描类型统计 + /// + [SugarTable("VIEW_TEAM_MAX_MIN_TIME", "AUCMA_MES")] + public class TwoTime + { + /// + /// 开始时间 + /// + [SugarColumn(ColumnName = "START_TIME")] + public DateTime startTime { get; set; } + /// + /// 结束时间 + /// + [SugarColumn(ColumnName = "END_TIME")] + public DateTime endTime { get; set; } + + + } +} diff --git a/Admin.Core.Service/Service_New/BaseBomInfoServices.cs b/Admin.Core.Service/Service_New/BaseBomInfoServices.cs index caee6479..ffecc787 100644 --- a/Admin.Core.Service/Service_New/BaseBomInfoServices.cs +++ b/Admin.Core.Service/Service_New/BaseBomInfoServices.cs @@ -27,6 +27,25 @@ namespace Admin.Core.Service _baseBomInfoRepository = baseBomInfoRepository; } + /// + /// 获取系统白夜班时间,发泡班组切换使用 + /// + public async Task> getTwoTime() + { + try + { + List list = null; + var _db = this.BaseDal.Db; + list = await _db.CopyNew().Ado.SqlQueryAsync("SELECT * FROM VIEW_TEAM_MAX_MIN_TIME ORDER BY START_TIME"); + return list; + } + catch (Exception) + { + return null; + } + } + + /// /// 获取系统班组时间 /// diff --git a/Admin.Core.Socket/TouchSocketService.cs b/Admin.Core.Socket/TouchSocketService.cs index 71ca3426..44f8aa04 100644 --- a/Admin.Core.Socket/TouchSocketService.cs +++ b/Admin.Core.Socket/TouchSocketService.cs @@ -162,14 +162,18 @@ namespace Admin.Core.Socket /// private void SetProdStoreClientId(SocketClient client) { - if (client.IP == "10.10.92.230") + if (client.IP == "10.10.92.230" || client.IP == "10.10.92.240") { client.ResetId("A"); } - else if (client.IP == "10.10.92.231") + else if (client.IP == "10.10.92.231" || client.IP == "10.10.92.241") { client.ResetId("B"); } + else if(client.IP == "10.10.92.242") + { + client.ResetId("C"); + } RefreshClientInfoEvent?.Invoke(service); } diff --git a/Aucma.Core.BoxFoam/Business/TeamSwitchBusiness.cs b/Aucma.Core.BoxFoam/Business/TeamSwitchBusiness.cs index aeaebb03..1a328e81 100644 --- a/Aucma.Core.BoxFoam/Business/TeamSwitchBusiness.cs +++ b/Aucma.Core.BoxFoam/Business/TeamSwitchBusiness.cs @@ -1,5 +1,7 @@ using Admin.Core.IService; using Admin.Core.Model; +using Admin.Core.Model.ViewModels; +using Admin.Core.Service; using Aucma.Core.HwPLc; using log4net; using Microsoft.Extensions.DependencyInjection; @@ -23,6 +25,8 @@ namespace Aucma.Core.BoxFoam.Business private readonly IBoxFoamPlanServices _boxFoamPlanServices; private readonly IBoxFoamDataServices _oldBoxFoamDataServices; private readonly IBoxFoamDataRecordServices _boxFoamDataRecordServices; + private readonly IBaseBomInfoServices? _baseBomInfoServices; + public List listTime; public TeamSwitchBusiness() { _boxFoamPlanServices = App.ServiceProvider.GetService(); @@ -30,11 +34,15 @@ namespace Aucma.Core.BoxFoam.Business _oldBoxFoamDataServices = App.ServiceProvider.GetService(); _boxFoamDataRecordServices = App.ServiceProvider.GetService(); + + _baseBomInfoServices = App.ServiceProvider.GetService(); + + listTime = _baseBomInfoServices.getTwoTime().Result; } public void Init() { - + DayShiftInfoCut(); NightShiftInfoCut(); } @@ -45,8 +53,20 @@ namespace Aucma.Core.BoxFoam.Business private void DayShiftInfoCut() { DateTime now = DateTime.Now; - - DateTime scheduledTime = new DateTime(now.Year, now.Month, now.Day, 08, 00, 00); + DateTime scheduledTime; + if (listTime == null) + { + listTime = _baseBomInfoServices.getTwoTime().Result; + } + if (listTime != null) + { + scheduledTime = listTime[0].startTime; + } + else + { + scheduledTime = new DateTime(now.Year, now.Month, now.Day, 08, 00, 00); + } + if (now > scheduledTime) { @@ -64,6 +84,7 @@ namespace Aucma.Core.BoxFoam.Business private void DayShiftTimerCallback(object sender, ElapsedEventArgs e) { + DateTime scheduledTime; Console.WriteLine("切换为白班!"); UpdateShiftInfo(1); @@ -71,7 +92,18 @@ namespace Aucma.Core.BoxFoam.Business #region 重新定义Timer,进行第二天执行 DateTime now = DateTime.Now; - DateTime scheduledTime = new DateTime(now.Year, now.Month, now.Day, 08, 00, 00); + if (listTime == null) + { + listTime = _baseBomInfoServices.getTwoTime().Result; + } + if (listTime != null) + { + scheduledTime = listTime[0].startTime; + } + else + { + scheduledTime = new DateTime(now.Year, now.Month, now.Day, 08, 00, 00); + } if (now > scheduledTime) { @@ -95,8 +127,20 @@ namespace Aucma.Core.BoxFoam.Business private void NightShiftInfoCut() { DateTime now = DateTime.Now; + DateTime scheduledTime; + if (listTime == null) + { + listTime = _baseBomInfoServices.getTwoTime().Result; + } + if (listTime != null) + { + scheduledTime = listTime[0].endTime; + } + else + { + scheduledTime = new DateTime(now.Year, now.Month, now.Day, 20, 00, 00); + } - DateTime scheduledTime = new DateTime(now.Year, now.Month, now.Day, 20, 00, 00); if (now > scheduledTime) { @@ -114,6 +158,7 @@ namespace Aucma.Core.BoxFoam.Business private void NightShiftTimerCallback(object sender, ElapsedEventArgs e) { + DateTime scheduledTime; Console.WriteLine("切换为夜班!"); UpdateShiftInfo(2); @@ -121,7 +166,18 @@ namespace Aucma.Core.BoxFoam.Business #region 重新定义Timer,进行第二天执行 DateTime now = DateTime.Now; - DateTime scheduledTime = new DateTime(now.Year, now.Month, now.Day, 20, 00, 00); + if (listTime == null) + { + listTime = _baseBomInfoServices.getTwoTime().Result; + } + if (listTime != null) + { + scheduledTime = listTime[0].endTime; + } + else + { + scheduledTime = new DateTime(now.Year, now.Month, now.Day, 20, 00, 00); + } if (now > scheduledTime) { diff --git a/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs b/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs index aacad2ef..1fb1e01d 100644 --- a/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs +++ b/Aucma.Core.BoxFoam/ViewModels/FoamMonitorPageViewModel.cs @@ -69,6 +69,7 @@ namespace Aucma.Core.BoxFoam.ViewModels } + #region 日产量 /// /// 每日生产 @@ -93,6 +94,7 @@ namespace Aucma.Core.BoxFoam.ViewModels //} ProductionHourList = xList; // 货道列表 + List list = _boxFoamDataServices.QueryAsync(x => x.ProductLineCode.Equals("CX_02") && x.StationCode == "1005").Result; if (list != null) diff --git a/Aucma.Core.Palletiz/appsettings.json b/Aucma.Core.Palletiz/appsettings.json index f2571e6b..bcc7a272 100644 --- a/Aucma.Core.Palletiz/appsettings.json +++ b/Aucma.Core.Palletiz/appsettings.json @@ -118,9 +118,7 @@ "UpdateTime": "2023-08-07 16:45:45.0530000" } ], - "StationInfo": { - "StationCode": "1010" - }, + "Startup": { "Cors": { "PolicyName": "CorsIpAccess", //策略名称 @@ -208,6 +206,9 @@ "Port": 2015 } ], + "StationInfo": { + "StationCode": "1010" + }, "StoreInfo": { "StationCode": "1010", "StationName": "成品分垛库", diff --git a/Aucma.Core.PalletizCX1/Business/InstoreBusiness.cs b/Aucma.Core.PalletizCX1/Business/InstoreBusiness.cs index d0e2239f..81ee6406 100644 --- a/Aucma.Core.PalletizCX1/Business/InstoreBusiness.cs +++ b/Aucma.Core.PalletizCX1/Business/InstoreBusiness.cs @@ -74,19 +74,19 @@ namespace Aucma.Core.PalletizCX1.Business public InStoreBusiness() { - + _appConfig = new AppConfig(); _spaceinfoService = App.ServiceProvider.GetService(); _offlineService = App.ServiceProvider.GetService(); HandPalletizViewModel.HandSendEvent += InStore; // string AA = ExtractNumber("FD01_012"); } - + public void Init() { TouchSocketService.ReceivedClientBufferEvent += ReceivedBuffer; } - + /// /// Buffer缓冲 /// @@ -145,8 +145,8 @@ namespace Aucma.Core.PalletizCX1.Business throw new ArgumentException($"货道区域为空"); } - _offlineService.GetProductInfosBySnCode(asciiStr, out ProductOffline prodInfo); + if (prodInfo == null) diff --git a/Aucma.Core.PalletizCX1/ViewModels/IndexPageViewModel.cs b/Aucma.Core.PalletizCX1/ViewModels/IndexPageViewModel.cs index 83b2332d..d71f277d 100644 --- a/Aucma.Core.PalletizCX1/ViewModels/IndexPageViewModel.cs +++ b/Aucma.Core.PalletizCX1/ViewModels/IndexPageViewModel.cs @@ -160,6 +160,7 @@ namespace Aucma.Core.PalletizCX1.ViewModels private ObservableCollection spaceItemsB = new ObservableCollection(); + private ObservableCollection spaceItemsC = new ObservableCollection(); /// /// 刷新界面提示信息 @@ -192,10 +193,9 @@ namespace Aucma.Core.PalletizCX1.ViewModels { App.Current.Dispatcher.BeginInvoke((Action)(() => { - if (spaceItems.Count > 0) - { - spaceItems.Clear(); - } + + spaceItems.Clear(); + foreach (var item in info) { spaceItems.Add(item); @@ -204,16 +204,15 @@ namespace Aucma.Core.PalletizCX1.ViewModels })); } - var info2 = inStoreBusiness.GetBaseSpaceinfos("A"); - info2 = info2.OrderBy(x => x.ObjId).ToList(); + var info2 = inStoreBusiness.GetBaseSpaceinfos("B"); + info2 = info2.OrderByDescending(x => x.ObjId).ToList(); if (info2 != null) { App.Current.Dispatcher.BeginInvoke((Action)(() => { - if (spaceItemsB.Count > 0) - { - spaceItemsB.Clear(); - } + + spaceItemsB.Clear(); + foreach (var item in info2) { spaceItemsB.Add(item); @@ -222,6 +221,24 @@ namespace Aucma.Core.PalletizCX1.ViewModels })); } + + var info3 = inStoreBusiness.GetBaseSpaceinfos("C"); + info3 = info3.OrderByDescending(x => x.ObjId).ToList(); + if (info3 != null) + { + App.Current.Dispatcher.BeginInvoke((Action)(() => + { + + spaceItemsC.Clear(); + + foreach (var item in info3) + { + spaceItemsC.Add(item); + } + AreaC_SpaceInfo = spaceItemsC; + })); + } + }); diff --git a/Aucma.Core.PalletizCX1/Views/HandPalletizView.xaml b/Aucma.Core.PalletizCX1/Views/HandPalletizView.xaml index f177f8e8..8fda4569 100644 --- a/Aucma.Core.PalletizCX1/Views/HandPalletizView.xaml +++ b/Aucma.Core.PalletizCX1/Views/HandPalletizView.xaml @@ -130,6 +130,7 @@ +