diff --git a/Admin.Core.Api/Admin.Core.Model.xml b/Admin.Core.Api/Admin.Core.Model.xml index 0486eacc..1263bf24 100644 --- a/Admin.Core.Api/Admin.Core.Model.xml +++ b/Admin.Core.Api/Admin.Core.Model.xml @@ -5041,14 +5041,14 @@ 工位 - + - 排序 + 小时 - + - 小时 + 物料名称 @@ -5116,11 +5116,6 @@ 物料名称 - - - 工位 - - 前板数量 @@ -5221,6 +5216,21 @@ 物料名称 + + + 计划编码 + + + + + 开始时间 + + + + + 开始时间 + + 执行状态 diff --git a/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.GeneratedMSBuildEditorConfig.editorconfig b/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.GeneratedMSBuildEditorConfig.editorconfig index 2f9c868b..decf85c2 100644 --- a/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.GeneratedMSBuildEditorConfig.editorconfig +++ b/Admin.Core.Common/obj/Debug/net6.0/Admin.Core.Common.GeneratedMSBuildEditorConfig.editorconfig @@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly = build_property.EnforceExtendedAnalyzerRules = build_property._SupportedPlatformList = Linux,macOS,Windows build_property.RootNamespace = Admin.Core.Common -build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.Common\ +build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.Common\ diff --git a/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.GeneratedMSBuildEditorConfig.editorconfig b/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.GeneratedMSBuildEditorConfig.editorconfig index 0f098310..f38a35e7 100644 --- a/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.GeneratedMSBuildEditorConfig.editorconfig +++ b/Admin.Core.EventBus/obj/Debug/net6.0/Admin.Core.EventBus.GeneratedMSBuildEditorConfig.editorconfig @@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly = build_property.EnforceExtendedAnalyzerRules = build_property._SupportedPlatformList = Linux,macOS,Windows build_property.RootNamespace = Admin.Core.EventBus -build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.EventBus\ +build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.EventBus\ diff --git a/Admin.Core.Model/ViewModels/SheetMetaHourDataView.cs b/Admin.Core.Model/ViewModels/SheetMetaHourDataView.cs index 43a201bc..093d07d8 100644 --- a/Admin.Core.Model/ViewModels/SheetMetaHourDataView.cs +++ b/Admin.Core.Model/ViewModels/SheetMetaHourDataView.cs @@ -12,14 +12,19 @@ namespace Admin.Core.Model.ViewModels /// /// 排序 /// - [SugarColumn(ColumnName = "SEQ")] - public int Seq { get; set; } + //[SugarColumn(ColumnName = "SEQ")] + //public int Seq { get; set; } /// /// 小时 /// [SugarColumn(ColumnName = "HOUR_TIME")] public string HourTime { get; set; } /// + /// 物料名称 + /// + [SugarColumn(ColumnName = "MATERIAL_CODE")] + public string MaterialName { get; set; } + /// /// 前板数量 /// [SugarColumn(ColumnName = "FRONTPLATE_AMOUNT")] diff --git a/Admin.Core.Model/ViewModels/SheetMetaSendPlanInfoView.cs b/Admin.Core.Model/ViewModels/SheetMetaSendPlanInfoView.cs index 0a454ca0..139f965e 100644 --- a/Admin.Core.Model/ViewModels/SheetMetaSendPlanInfoView.cs +++ b/Admin.Core.Model/ViewModels/SheetMetaSendPlanInfoView.cs @@ -40,7 +40,22 @@ namespace Admin.Core.Model.ViewModels [SugarColumn(ColumnName = "MATERIAL_SPECIFICATIONS")] public string MaterialSpecificatons { get; set; } - + /// + /// 计划编码 + /// + [SugarColumn(ColumnName = "PRODUCT_PLANCODE")] + public string ProductPlanCode { get; set; } + + /// + /// 开始时间 + /// + [SugarColumn(ColumnName = "BEGIN_TIME")] + public string BeginTime { get; set; } + /// + /// 开始时间 + /// + [SugarColumn(ColumnName = "END_TIME")] + public string EndTime { get; set; } /// /// 执行状态 /// diff --git a/Admin.Core.Model/ViewModels/SheetMetalTypeDataView.cs b/Admin.Core.Model/ViewModels/SheetMetalTypeDataView.cs index 7de52294..b5e1f526 100644 --- a/Admin.Core.Model/ViewModels/SheetMetalTypeDataView.cs +++ b/Admin.Core.Model/ViewModels/SheetMetalTypeDataView.cs @@ -12,13 +12,9 @@ namespace Admin.Core.Model.ViewModels /// /// 物料名称 /// - [SugarColumn(ColumnName = "MATERIAL_SPECIFICATIONS")] + [SugarColumn(ColumnName = "MATERUALNAME")] public string MaterialName { get; set; } - /// - /// 工位 - /// - [SugarColumn(ColumnName = "PRODUCTLINE_CODE")] - public string ProductLineCode { get; set; } + /// /// 前板数量 /// diff --git a/Admin.Core.Repository/Repository_New/ExecutePlanInfoRepository.cs b/Admin.Core.Repository/Repository_New/ExecutePlanInfoRepository.cs index 6afc8cd6..7a38bde7 100644 --- a/Admin.Core.Repository/Repository_New/ExecutePlanInfoRepository.cs +++ b/Admin.Core.Repository/Repository_New/ExecutePlanInfoRepository.cs @@ -49,7 +49,7 @@ namespace Admin.Core.Repository string sql = @"SELECT b.MATERIAL_NAME, r.PRODUCTLINE_CODE, SUM(r.complete_amount) AS PRODUCT_AMOUNT FROM(select p.*, s.complete_amount from EXECUTE_PLANINFO p inner join RECORD_SIDEPANEL_COMPLATE s on p.TASK_CODE = s.PLAN_CODE) r JOIN C##AUCMA_MES.BASE_BOMINFO b ON r.MATERIAL_CODE = b.MATERIAL_CODE - WHERE TRUNC(r.RECORD_TIME) = TRUNC(SYSDATE) + WHERE TRUNC(r.RECORD_TIME) = TRUNC(SYSDATE) WHERE e.IS_FLAG=0 GROUP BY b.MATERIAL_NAME, r.PRODUCTLINE_CODE"; result = Db.CopyNew().SqlQueryable(sql).Where("PRODUCTLINE_CODE = @stationCode", new { stationCode = stationCode }).ToList(); } @@ -67,13 +67,13 @@ namespace Admin.Core.Repository select * from C##AUCMA_MES.PRODUCT_PLANINFO ), S AS( - select e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME, COUNT(c.PLAN_CODE) as SIDEPANELAMOUNT from EXECUTE_PLANINFO e - inner join RECORD_SIDEPANEL_COMPLATE c on e.TASK_CODE=c.PLAN_CODE + select e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME, SUM(c.OUTPUT_AMOUNT) as SIDEPANELAMOUNT from EXECUTE_PLANINFO e + inner join RECORD_SIDEPANEL_COMPLATE c on e.TASK_CODE=c.PLAN_CODE WHERE e.IS_FLAG=0 GROUP BY e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME ), B AS( - select e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME, COUNT(c.PLAN_CODE) BACKPANELAMOUNT from EXECUTE_PLANINFO e - inner join RECORD_BACKPANEL_COMPLATE c on e.TASK_CODE=c.PLAN_CODE + select e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME, SUM(c.OUTPUT_AMOUNT) BACKPANELAMOUNT from EXECUTE_PLANINFO e + inner join RECORD_BACKPANEL_COMPLATE c on e.TASK_CODE=c.PLAN_CODE WHERE e.IS_FLAG=0 GROUP BY e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME ) select t.PLAN_CODE,t.ORDER_CODE,t.PRODUCTLINE_CODE,t.MATERIAL_CODE,t.MATERIAL_NAME,t.PLAN_AMOUNT,t.COMPLETE_AMOUNT, @@ -89,12 +89,42 @@ namespace Admin.Core.Repository /// public List QuerySheetMetalPlanData(string stationCode) { - string sql = $@"select P.OBJ_ID,P.PLAN_CODE,P.ORDER_CODE,P.MATERIAL_CODE,P.MATERIAL_NAME,P.PRODUCTLINE_CODE, - P.PLAN_AMOUNT,P.COMPLETE_AMOUNT,P.BEGIN_TIME,P.END_TIME,SPC.MATERIAL_SPECIFICATIONS from C##AUCMA_MES.PRODUCT_PLANINFO P - inner join (select SPC.*,ML.MATERIAL_SPECIFICATIONS FROM C##AUCMA_MES.PRODUCT_PLANINFO SPC - inner JOIN C##AUCMA_MES.BASE_MATERIALINFO ML ON ML.MATERIAL_CODE = SPC.MATERIAL_CODE where SPC.PRODUCTLINE_CODE ='{stationCode}' - ) SPC on p.ORDER_CODE=SPC.ORDER_CODE - where p.PRODUCTLINE_CODE ='{stationCode}' "; + // string sql = $@"select P.OBJ_ID,P.PLAN_CODE,P.ORDER_CODE,P.MATERIAL_CODE,P.MATERIAL_NAME,P.PRODUCTLINE_CODE, + //P.PLAN_AMOUNT,P.COMPLETE_AMOUNT,P.BEGIN_TIME,P.END_TIME,SPC.MATERIAL_SPECIFICATIONS from C##AUCMA_MES.PRODUCT_PLANINFO P + //inner join (select SPC.*,ML.MATERIAL_SPECIFICATIONS FROM C##AUCMA_MES.PRODUCT_PLANINFO SPC + // inner JOIN C##AUCMA_MES.BASE_MATERIALINFO ML ON ML.MATERIAL_CODE = SPC.MATERIAL_CODE where SPC.PRODUCTLINE_CODE ='{stationCode}' + //) SPC on p.ORDER_CODE=SPC.ORDER_CODE + // where p.PRODUCTLINE_CODE ='{stationCode}' "; + + string sql = $@"SELECT + P.OBJ_ID, + P.PLAN_CODE, + P.ORDER_CODE, + o.MATERIAL_CODE, + o.MATERIAL_NAME, + m.MATERIAL_SPECIFICATIONS, + P.PRODUCTLINE_CODE, + P.PLAN_AMOUNT, + P.COMPLETE_AMOUNT, + P.BEGIN_TIME, + P.END_TIME + FROM C##AUCMA_MES.PRODUCT_PLANINFO p INNER JOIN + C##AUCMA_MES.BASE_ORDERINFO o ON o.ORDER_CODE = p.ORDER_CODE + INNER JOIN C##AUCMA_MES.BASE_MATERIALINFO m ON o.MATERIAL_CODE = m.MATERIAL_CODE + WHERE + p.ORDER_CODE IN ( SELECT ORDER_CODE FROM C##AUCMA_MES.PRODUCT_PLANINFO p WHERE p.PRODUCTLINE_CODE = '{stationCode}' ) + group by P.OBJ_ID, + P.PLAN_CODE, + P.ORDER_CODE, + o.MATERIAL_CODE, + o.MATERIAL_NAME, + m.MATERIAL_SPECIFICATIONS, + P.PRODUCTLINE_CODE, + P.PLAN_AMOUNT, + P.COMPLETE_AMOUNT, + P.BEGIN_TIME, + P.END_TIME + order by OBJ_ID"; return Db.CopyNew().SqlQueryable(sql).Where("PRODUCTLINE_CODE = @stationCode", new { stationCode = stationCode }).ToList(); } @@ -105,14 +135,13 @@ namespace Admin.Core.Repository /// public List QuerySheetMetalSendPlanData(string stationCode) { - string sql = $@"select *from (select e.OBJ_ID,e.EXECUTE_PLANCODE, e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME, e.MATERIAL_SPECIFICATIONS, - e.EXECUTE_STATUS,e.PLAN_TYPE,e.PLAN_AMOUNT,e.COMPLETE_AMOUNT,e.TASK_CODE,COUNT(c.PLAN_CODE) BACKPANELAMOUNT,COUNT(s.PLAN_CODE) SIDEPANELAMOUNT,e.EXECUTE_ORDER + string sql = $@"select *from (select e.OBJ_ID,e.EXECUTE_PLANCODE, e.ORDER_CODE, e.PRODUCT_PLANCODE,e.MATERIAL_CODE,e.MATERIAL_NAME,e.BEGIN_TIME,e.END_TIME, e.MATERIAL_SPECIFICATIONS, + e.EXECUTE_STATUS,e.PLAN_TYPE,e.PLAN_AMOUNT,e.COMPLETE_AMOUNT,e.TASK_CODE,SUM(c.OUTPUT_AMOUNT) BACKPANELAMOUNT,SUM(s.OUTPUT_AMOUNT) SIDEPANELAMOUNT,e.EXECUTE_ORDER from EXECUTE_PLANINFO e left join RECORD_BACKPANEL_COMPLATE c on e.TASK_CODE=c.PLAN_CODE left join RECORD_SIDEPANEL_COMPLATE s on e.TASK_CODE=s.PLAN_CODE - where e.PRODUCTLINE_CODE='{stationCode}' and EXECUTE_STATUS in (1,2) - GROUP BY e.OBJ_ID,e.EXECUTE_PLANCODE,e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME,e.MATERIAL_SPECIFICATIONS, e.PLAN_TYPE,e.PLAN_AMOUNT,e.EXECUTE_STATUS,e.COMPLETE_AMOUNT, e.TASK_CODE,e.EXECUTE_ORDER ) t - - order by t.EXECUTE_ORDER "; + where e.PRODUCTLINE_CODE='{stationCode}' AND e.IS_FLAG=0 and EXECUTE_STATUS in (1,2) + GROUP BY e.OBJ_ID,e.EXECUTE_PLANCODE,e.ORDER_CODE, e.PRODUCT_PLANCODE,e.MATERIAL_CODE,e.MATERIAL_NAME,e.BEGIN_TIME,e.END_TIME, e.MATERIAL_SPECIFICATIONS, e.PLAN_TYPE,e.PLAN_AMOUNT,e.EXECUTE_STATUS,e.COMPLETE_AMOUNT, e.TASK_CODE,e.EXECUTE_ORDER ) t + order by t.EXECUTE_ORDER "; return Db.CopyNew().SqlQueryable(sql).ToList(); } diff --git a/Admin.Core.Repository/Repository_New/SysUserInfoRepository.cs b/Admin.Core.Repository/Repository_New/SysUserInfoRepository.cs index 5a8aee89..704ea078 100644 --- a/Admin.Core.Repository/Repository_New/SysUserInfoRepository.cs +++ b/Admin.Core.Repository/Repository_New/SysUserInfoRepository.cs @@ -67,23 +67,16 @@ namespace Admin.Core.Repository /// public async Task> GetSheetMetalTypeData(string productLineCode) { - string sql = @$"WITH CTT AS (SELECT MIN(START_TIME) START_TIME, MAX(END_TIME) END_TIME - FROM VIEW_CURRENT_TEAM_TIME) - SELECT ML.MATERIAL_SPECIFICATIONS,SPC.PRODUCTLINE_CODE, - SUM(CASE - WHEN SPC.PLAN_TYPE = 1 THEN SPC.COMPLETE_AMOUNT - WHEN SPC.PLAN_TYPE = 2 THEN SPC.COMPLETE_AMOUNT - ELSE 0 END) FRONTPLATE_AMOUNT, - SUM(CASE - WHEN SPC.PLAN_TYPE = 1 THEN SPC.COMPLETE_AMOUNT - WHEN SPC.PLAN_TYPE = 3 THEN SPC.COMPLETE_AMOUNT - ELSE 0 END) REARPANEL_AMOUNT - FROM VIEW_EXECUTE_PLANINFO SPC - LEFT JOIN BASE_MATERIALINFO ML ON ML.MATERIAL_CODE = SPC.MATERIAL_CODE + string sql = @$" WITH CTT AS (SELECT MIN(START_TIME) START_TIME, MAX(END_TIME) END_TIME + FROM VIEW_CURRENT_TEAM_TIME) + SELECT FB.MATERIAL_CODE as MATERUALNAME, + SUM(CASE WHEN FB.BOX_TYPE = 1 THEN FB.OUTPUT_AMOUNT ELSE 0 END) FRONTPLATE_AMOUNT, + SUM(CASE WHEN FB.BOX_TYPE = 2 THEN FB.OUTPUT_AMOUNT ELSE 0 END) REARPANEL_AMOUNT + FROM VIEW_RECORD_FRONT_BACK_COMP FB CROSS JOIN CTT - WHERE SPC.BEGIN_TIME > CTT.START_TIME - AND SPC.BEGIN_TIME <= CTT.END_TIME and SPC.PRODUCTLINE_CODE='{productLineCode}' - GROUP BY ML.MATERIAL_SPECIFICATIONS,SPC.PRODUCTLINE_CODE"; + WHERE FB.RECORD_TIME >= CTT.START_TIME + AND FB.RECORD_TIME < CTT.END_TIME + GROUP BY FB.MATERIAL_CODE"; return await Db.CopyNew().Ado.SqlQueryAsync(sql); } @@ -98,51 +91,14 @@ namespace Admin.Core.Repository /// public async Task> GetSheetMetaHourData(string productLineCode) { - - - //string sql = @$"SELECT CTT.HOUR_TIME, - // SUM(CASE - // WHEN SPC.PLAN_TYPE = 1 THEN SPC.COMPLETE_AMOUNT - // WHEN SPC.PLAN_TYPE = 2 THEN SPC.COMPLETE_AMOUNT - // ELSE 0 END) FRONTPLATE_AMOUNT, - // SUM(CASE - // WHEN SPC.PLAN_TYPE = 1 THEN SPC.COMPLETE_AMOUNT - // WHEN SPC.PLAN_TYPE = 3 THEN SPC.COMPLETE_AMOUNT - // ELSE 0 END) REARPANEL_AMOUNT - // FROM VIEW_CURRENT_TEAM_TIME CTT - // LEFT JOIN (select * from VIEW_EXECUTE_PLANINFO where PRODUCTLINE_CODE='{productLineCode}') SPC - // ON SPC.BEGIN_TIME >= CTT.START_TIME AND SPC.BEGIN_TIME < CTT.END_TIME - - // GROUP BY CTT.HOUR_TIME - // ORDER BY CTT.HOUR_TIME"; - - //string sql = $@"SELECT CTT.SEQ,CTT.HOUR_TIME,COUNT(SPC.PLAN_CODE) as FRONTPLATE_AMOUNT,COUNT(BACK.PLAN_CODE) as REARPANEL_AMOUNT - // FROM VIEW_CURRENT_TEAM_TIME CTT - // LEFT JOIN (select * from C##AUCMA_SCADA.EXECUTE_PLANINFO v inner join C##AUCMA_SCADA.RECORD_SIDEPANEL_COMPLATE c - //on v.TASK_CODE=c.PLAN_CODE where v.PRODUCTLINE_CODE='{productLineCode}' AND c.COMPLETE_AMOUNT!=0) SPC ON SPC.RECORD_TIME >= CTT.START_TIME AND SPC.RECORD_TIME < CTT.END_TIME - // LEFT JOIN (select * from C##AUCMA_SCADA.EXECUTE_PLANINFO v inner join C##AUCMA_SCADA.RECORD_BACKPANEL_COMPLATE c - //on v.TASK_CODE=c.PLAN_CODE where v.PRODUCTLINE_CODE='{productLineCode}' AND c.COMPLETE_AMOUNT!=0) BACK ON BACK.RECORD_TIME >= CTT.START_TIME AND BACK.RECORD_TIME < CTT.END_TIME - //group by CTT.SEQ,CTT.HOUR_TIME ORDER BY CTT.SEQ asc"; - - - string sql = @$"SELECT CTT.HOUR_TIME, - SUM(CASE - WHEN SPC.PLAN_TYPE = 1 THEN SPC.COMPLETE_AMOUNT - WHEN SPC.PLAN_TYPE = 2 THEN SPC.COMPLETE_AMOUNT - ELSE 0 END) FRONTPLATE_AMOUNT, - SUM(CASE - WHEN SPC.PLAN_TYPE = 1 THEN SPC.COMPLETE_AMOUNT - WHEN SPC.PLAN_TYPE = 3 THEN SPC.COMPLETE_AMOUNT - ELSE 0 END) REARPANEL_AMOUNT - FROM VIEW_CURRENT_TEAM_TIME CTT - LEFT JOIN (select * from VIEW_EXECUTE_PLANINFO where PRODUCTLINE_CODE='{productLineCode}') SPC - ON SPC.BEGIN_TIME >= CTT.START_TIME AND SPC.BEGIN_TIME < CTT.END_TIME - - GROUP BY CTT.HOUR_TIME - ORDER BY CTT.HOUR_TIME"; - if (GetConnectionState() == false) return null; - + SUM(CASE WHEN FB.BOX_TYPE = 1 THEN FB.OUTPUT_AMOUNT ELSE 0 END) FRONTPLATE_AMOUNT, + SUM(CASE WHEN FB.BOX_TYPE = 2 THEN FB.OUTPUT_AMOUNT ELSE 0 END) REARPANEL_AMOUNT + FROM VIEW_CURRENT_TEAM_TIME CTT + LEFT JOIN VIEW_RECORD_FRONT_BACK_COMP FB + ON FB.RECORD_TIME >= CTT.START_TIME AND FB.RECORD_TIME < CTT.END_TIME + GROUP BY CTT.HOUR_TIME + ORDER BY CTT.HOUR_TIME"; return await Db.CopyNew().Ado.SqlQueryAsync(sql); } diff --git a/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.GeneratedMSBuildEditorConfig.editorconfig b/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.GeneratedMSBuildEditorConfig.editorconfig index a3d7d5ba..a581a844 100644 --- a/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.GeneratedMSBuildEditorConfig.editorconfig +++ b/Admin.Core.Serilog.Es/obj/Debug/net6.0/Admin.Core.Serilog.Es.GeneratedMSBuildEditorConfig.editorconfig @@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly = build_property.EnforceExtendedAnalyzerRules = build_property._SupportedPlatformList = Linux,macOS,Windows build_property.RootNamespace = Admin.Core.Serilog.Es -build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.Serilog.Es\ +build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.Serilog.Es\ diff --git a/Aucma.Core.OldBoxFoam/Models/OldBoxFoamTypeModel.cs b/Aucma.Core.OldBoxFoam/Models/OldBoxFoamTypeModel.cs index 6cebd322..8d2e2f06 100644 --- a/Aucma.Core.OldBoxFoam/Models/OldBoxFoamTypeModel.cs +++ b/Aucma.Core.OldBoxFoam/Models/OldBoxFoamTypeModel.cs @@ -51,5 +51,7 @@ namespace Aucma.Core.OldBoxFoam.Models public string MaterialCode { get; set; } public string MaterialName { get; set; } + + public string SpaceName { get; set; } } } diff --git a/Aucma.Core.OldBoxFoam/ViewModels/RealRoadPageViewModel.cs b/Aucma.Core.OldBoxFoam/ViewModels/RealRoadPageViewModel.cs index 7f1f3205..f461354a 100644 --- a/Aucma.Core.OldBoxFoam/ViewModels/RealRoadPageViewModel.cs +++ b/Aucma.Core.OldBoxFoam/ViewModels/RealRoadPageViewModel.cs @@ -125,26 +125,57 @@ namespace Aucma.Core.OldBoxFoam.ViewModels public async void InitData(object? sender, ElapsedEventArgs e) { List list = await _oldBoxFoamTypeServices.QueryAsync(); - if (list == null) return; - System.Windows.Application.Current.Dispatcher.Invoke((Action)(() => + + if(list != null) { - ListItems.Clear(); - foreach (OldBoxFoamType item in list) + if(list.Count > 0) { - ListItems.Add(new OldBoxFoamTypeModel() - { - ObjId = item.ObjId, - Local = item.Local, - Status = item.Storeamount==3?"1":"0", - Storeamount = item.Storeamount, - MaterialCode = item.MaterialCode, - MaterialName = item.MaterialName, - Boxtype = item.Boxtype, + list = list.OrderBy(x=>x.ObjId).ToList(); + int totalItems = list.Count; + int half = totalItems / 2; - }); ; + List spaceInfoLeft = list.Take(half).ToList(); + List spaceInfoRight = list.Skip(half).ToList(); + + System.Windows.Application.Current.Dispatcher.Invoke((Action)(() => + { + ListItems.Clear(); + if (spaceInfoLeft == null) return; + for (int i = 0; i < spaceInfoLeft.Count; i++) + { + ListItems.Add(new OldBoxFoamTypeModel() + { + SpaceName = $"东线{i + 1}", + Local = spaceInfoLeft[i].Local, + Status = spaceInfoLeft[i].Storeamount == 3 ? "1" : "0", + Storeamount = spaceInfoLeft[i].Storeamount, + MaterialCode = spaceInfoLeft[i].MaterialCode, + MaterialName = spaceInfoLeft[i].MaterialName, + Boxtype = spaceInfoLeft[i].Boxtype, + + }); + } + if (spaceInfoRight == null) return; + for (int i = 0; i < spaceInfoRight.Count; i++) + { + ListItems.Add(new OldBoxFoamTypeModel() + { + SpaceName = $"西线{i + 1}", + Local = spaceInfoRight[i].Local, + Status = spaceInfoRight[i].Storeamount == 3 ? "1" : "0", + Storeamount = spaceInfoRight[i].Storeamount, + MaterialCode = spaceInfoRight[i].MaterialCode, + MaterialName = spaceInfoRight[i].MaterialName, + Boxtype = spaceInfoRight[i].Boxtype, + + }); + } + })); } - })); + } + + } #region 初始化datagrid diff --git a/Aucma.Core.OldBoxFoam/ViewModels/RoadKindPageViewModel.cs b/Aucma.Core.OldBoxFoam/ViewModels/RoadKindPageViewModel.cs index f8673ae2..0044b16e 100644 --- a/Aucma.Core.OldBoxFoam/ViewModels/RoadKindPageViewModel.cs +++ b/Aucma.Core.OldBoxFoam/ViewModels/RoadKindPageViewModel.cs @@ -16,6 +16,7 @@ using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows; +using System.Windows.Documents; namespace Aucma.Core.OldBoxFoam.ViewModels { @@ -50,31 +51,93 @@ namespace Aucma.Core.OldBoxFoam.ViewModels public async void InitData() { - Shapes.Clear(); + //Shapes.Clear(); List list = await _boxFoamTypeServices.QueryAsync(); if (list == null) return; - foreach(OldBoxFoamType item in list) + if(list.Count > 0) { - OldBoxFoamTypeModel model= new OldBoxFoamTypeModel(); - model.MaterialCode = item.MaterialCode; - - string pattern = @",(.*)"; - Regex regex = new Regex(pattern); - Match match = regex.Match(item.MaterialName); + list = list.OrderBy(x => x.ObjId).ToList(); + int totalItems = list.Count; + int half = totalItems / 2; - if (match.Success) - { - string result = match.Groups[1].Value; - model.MaterialName = result; - } - else + List spaceInfoLeft = list.Take(half).ToList(); + List spaceInfoRight = list.Skip(half).ToList(); + + System.Windows.Application.Current.Dispatcher.Invoke((Action)(() => { - model.MaterialName = item.MaterialName; - } - model.ObjId = item.ObjId; - model.Status = "1"; - Shapes.Add(model); + Shapes.Clear(); + if (spaceInfoLeft == null) return; + for (int i = 0; i < spaceInfoLeft.Count; i++) + { + OldBoxFoamTypeModel model = new OldBoxFoamTypeModel(); + model.MaterialCode = spaceInfoLeft[i].MaterialCode; + + string pattern = @",(.*)"; + Regex regex = new Regex(pattern); + Match match = regex.Match(spaceInfoLeft[i].MaterialName); + + if (match.Success) + { + string result = match.Groups[1].Value; + model.MaterialName = result; + } + else + { + model.MaterialName = spaceInfoLeft[i].MaterialName; + } + model.ObjId = spaceInfoLeft[i].ObjId; + model.Status = "1"; + model.Local = $"东线{i + 1}"; + Shapes.Add(model); + } + if (spaceInfoRight == null) return; + for (int i = 0; i < spaceInfoRight.Count; i++) + { + OldBoxFoamTypeModel model = new OldBoxFoamTypeModel(); + model.MaterialCode = spaceInfoRight[i].MaterialCode; + + string pattern = @",(.*)"; + Regex regex = new Regex(pattern); + Match match = regex.Match(spaceInfoRight[i].MaterialName); + + if (match.Success) + { + string result = match.Groups[1].Value; + model.MaterialName = result; + } + else + { + model.MaterialName = spaceInfoRight[i].MaterialName; + } + model.ObjId = spaceInfoRight[i].ObjId; + model.Status = "1"; + model.Local = $"西线{i + 1}"; + Shapes.Add(model); + } + })); } + //foreach(OldBoxFoamType item in list) + //{ + // OldBoxFoamTypeModel model= new OldBoxFoamTypeModel(); + // model.MaterialCode = item.MaterialCode; + + // string pattern = @",(.*)"; + // Regex regex = new Regex(pattern); + // Match match = regex.Match(item.MaterialName); + + // if (match.Success) + // { + // string result = match.Groups[1].Value; + // model.MaterialName = result; + // } + // else + // { + // model.MaterialName = item.MaterialName; + // } + // model.ObjId = item.ObjId; + // model.Status = "1"; + // Shapes.Add(model); + //} } #region 初始化 diff --git a/Aucma.Core.OldBoxFoam/Views/RealRoadPageView.xaml b/Aucma.Core.OldBoxFoam/Views/RealRoadPageView.xaml index b0b67600..e747dac4 100644 --- a/Aucma.Core.OldBoxFoam/Views/RealRoadPageView.xaml +++ b/Aucma.Core.OldBoxFoam/Views/RealRoadPageView.xaml @@ -169,8 +169,8 @@ - - + + @@ -202,7 +202,7 @@ - + @@ -228,7 +228,7 @@ ScrollViewer.VerticalScrollBarVisibility="Auto" BorderThickness="0" CanUserAddRows="False" SelectionMode="Single" IsReadOnly="True" Foreground="White" > - + diff --git a/Aucma.Core.OldBoxFoam/Views/RoadKindPageView.xaml b/Aucma.Core.OldBoxFoam/Views/RoadKindPageView.xaml index c198646d..95753424 100644 --- a/Aucma.Core.OldBoxFoam/Views/RoadKindPageView.xaml +++ b/Aucma.Core.OldBoxFoam/Views/RoadKindPageView.xaml @@ -187,7 +187,7 @@ --> - + diff --git a/Aucma.Core.SheetMetal/Business/SheetMetalPlanTaskHandle.cs b/Aucma.Core.SheetMetal/Business/SheetMetalPlanTaskHandle.cs index c232f031..7e5fe6c7 100644 --- a/Aucma.Core.SheetMetal/Business/SheetMetalPlanTaskHandle.cs +++ b/Aucma.Core.SheetMetal/Business/SheetMetalPlanTaskHandle.cs @@ -41,6 +41,14 @@ public class SheetMetalPlanTaskHandle public static event RefreshChat RefreshChatEvent; #endregion + #region 刷新创建计划 + /// + /// 刷新创建计划 + /// + public delegate void RefreshPlanInfo(SheetMetaSendPlanInfoView planInfo); + public static event RefreshPlanInfo RefreshPlanInfoEvent; + #endregion + #region 刷新当前正在执行的计划 /// /// 刷新当前正在执行的计划 @@ -168,8 +176,8 @@ public class SheetMetalPlanTaskHandle obj_sidePanel.plc.WriteInt32("D6020", planInfo.PlanAmount); obj_sidePanel.plc.WriteInt32("D6021", 1); - Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待背板设备应答。。。。。。"); - RefreshExecInfoEvent?.Invoke($"等待背板设备应答。。。。。。"); + Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待前板设备应答。。。。。。"); + RefreshExecInfoEvent?.Invoke($"等待前板设备应答。。。。。。"); #region PLC反馈信号逻辑处理 //循环读取PLC应答信号,PLC应答后复位应答信号、更新计划状态为执行中 bool isFlag = true; @@ -179,8 +187,8 @@ public class SheetMetalPlanTaskHandle if (obj_sidePanel.plc.ReadInt32("D6021") == 2) { obj_sidePanel.plc.WriteInt32("D6021", 0); - Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到背板板设备应答信号,复位应答地址"); - RefreshExecInfoEvent?.Invoke($"收到背板板设备应答信号,复位应答地址"); + Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到前板设备应答信号,复位应答地址"); + RefreshExecInfoEvent?.Invoke($"收到前板板设备应答信号,复位应答地址"); isFlag = false; } Thread.Sleep(2000); @@ -206,13 +214,14 @@ public class SheetMetalPlanTaskHandle //更新前端展示图表 RefreshCreatePlanInfoEvent?.Invoke();//更新界面 RefreshChatEvent?.Invoke();//刷新图表 + RefreshPlanInfoEvent?.Invoke(planInfo);//刷新计划执行 } } }); } catch (Exception ex) { - MessageBox.Show($"背板⽣产计划下发异常:{ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error, + MessageBox.Show($"前板⽣产计划下发异常:{ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly); } } @@ -263,6 +272,7 @@ public class SheetMetalPlanTaskHandle //更新前端展示图表 RefreshCreatePlanInfoEvent?.Invoke();//更新界面 RefreshChatEvent?.Invoke();//刷新图表 + //RefreshPlanInfoEvent?.Invoke(planInfo); } #endregion @@ -313,22 +323,15 @@ public class SheetMetalPlanTaskHandle if (planInfo.PlanType == 1) { - if(planInfo.PlanAmount == sumBackPanelAmount) + if (sumSidePanelAmount <= sumBackPanelAmount) { - if (sumSidePanelAmount<= sumBackPanelAmount) - { - sumAmount = sumSidePanelAmount; - isComplate = false; - } - else - { - sumAmount = planInfo.PlanAmount; - isComplate = false; - } + sumAmount = sumSidePanelAmount; + isComplate = false; } else { - sumAmount = sumSidePanelAmount; + sumAmount = planInfo.PlanAmount; + isComplate = false; } } @@ -359,7 +362,12 @@ public class SheetMetalPlanTaskHandle if (result) { //更新前端展示图表 - // RefreshCreatePlanInfoEvent?.Invoke();//更新界面 + // RefreshCreatePlanInfoEvent?.Invoke();//更新界面 + if (planInfo.PlanType == 3) + { + RefreshCreatePlanInfoEvent?.Invoke();//更新界面 + RefreshPlanInfoEvent?.Invoke(planInfo); + } RefreshChatEvent?.Invoke();//刷新图表 } @@ -396,20 +404,24 @@ public class SheetMetalPlanTaskHandle List backPanelComplates = _backPanelComplateServices.Query(x => x.ProductlineCode == "1001" && x.PlanCode == planInfo.TaskCode); int sumBackPanelAmount = backPanelComplates.Sum(x => x.OutPutAmount); - Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};围板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}"); - RefreshExecInfoEvent?.Invoke($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};围板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}"); + Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}"); + RefreshExecInfoEvent?.Invoke($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}"); int sumAmount = 0; if (planInfo.PlanType == 1) { - if (sumSidePanelAmount >= sumBackPanelAmount) + if (sumSidePanelAmount >= sumBackPanelAmount && sumBackPanelAmount != 0) { sumAmount = sumBackPanelAmount; } - else + if (sumBackPanelAmount == 0) { - sumAmount = sumSidePanelAmount; + sumAmount = 0; } + if (planInfo.PlanAmount == sumSidePanelAmount) + { + isComplate = false; + } } else if (planInfo.PlanType == 2) { @@ -432,15 +444,18 @@ public class SheetMetalPlanTaskHandle obj.CompleteAmount = planInfo.CompleteAmount; obj.ExecuteStatus = planInfo.ExecuteStatus; bool result = _executePlanInfoServices.UpdateExecutePlanInfo(obj).Result; - if (result) - { - //更新前端展示图表 - RefreshCreatePlanInfoEvent?.Invoke();//更新界面 - RefreshChatEvent?.Invoke();//刷新图表 - } + Thread.Sleep(5000); } while (isComplate); + if (!isComplate) + { + //更新前端展示图表 + //RefreshCreatePlanInfoEvent?.Invoke();//更新界面 + RefreshChatEvent?.Invoke();//刷新图表 + //SheetMetaSendPlanInfoView planInfo = planInfoList.FirstOrDefault(d => d.TaskCode == planCode); + RefreshPlanInfoEvent?.Invoke(planInfo);//刷新计划执行 + } } } catch (Exception ex) @@ -537,8 +552,8 @@ public class SheetMetalPlanTaskHandle List backPanelComplates = _backPanelComplateServices.Query(x => x.ProductlineCode == "1001" && x.PlanCode == planInfo.TaskCode); int sumBackPanelAmount = backPanelComplates.Sum(x => x.OutPutAmount); - Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};围板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}"); - RefreshExecInfoEvent?.Invoke($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};围板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}"); + Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}"); + RefreshExecInfoEvent?.Invoke($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}"); int sumAmount = 0; if (planInfo.PlanType == 1) @@ -610,8 +625,8 @@ public class SheetMetalPlanTaskHandle obj_sidePanel.plc.WriteInt32("D6020", planInfo.PlanAmount); obj_sidePanel.plc.WriteInt32("D6021", 1); - Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待围板设备应答。。。。。。"); - RefreshExecInfoEvent?.Invoke("等待围板设备应答......"); + Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待前板设备应答。。。。。。"); + RefreshExecInfoEvent?.Invoke("等待前板设备应答......"); //下发完成后读取PLC应答,应答后复位应答信号 #region PLC反馈信号逻辑处理 @@ -623,8 +638,8 @@ public class SheetMetalPlanTaskHandle if (obj_sidePanel.plc.ReadInt32("D6021") == 2) { obj_sidePanel.plc.WriteInt32("D6021", 0); - Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到围板设备应答信号,复位应答地址"); - RefreshExecInfoEvent?.Invoke("收到围板设备应答信号,复位应答地址"); + Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到前板设备应答信号,复位应答地址"); + RefreshExecInfoEvent?.Invoke("收到前板设备应答信号,复位应答地址"); isFlag = false; } Thread.Sleep(2000); @@ -703,14 +718,14 @@ public class SheetMetalPlanTaskHandle } catch (Exception ex) { - MessageBox.Show($"围板⽣产计划下发异常:{ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error, + MessageBox.Show($"前板⽣产计划下发异常:{ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly); } } /// - /// 下发围板生产计划 + /// 下发前板生产计划 /// /// /// @@ -729,8 +744,8 @@ public class SheetMetalPlanTaskHandle obj_sidePanel.plc.WriteInt32("D6020", planInfo.PlanAmount); obj_sidePanel.plc.WriteInt32("D6021", 1); - Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待围板设备应答。。。。。。"); - RefreshExecInfoEvent?.Invoke("等待围板设备应答......"); + Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待前板设备应答。。。。。。"); + RefreshExecInfoEvent?.Invoke("等待前板设备应答......"); //下发完成后读取PLC应答,应答后复位应答信号 #region PLC反馈信号逻辑处理 @@ -741,8 +756,8 @@ public class SheetMetalPlanTaskHandle if (obj_sidePanel.plc.ReadInt32("D6021") == 2) { obj_sidePanel.plc.WriteInt32("D6021", 0); - Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到围板设备应答信号,复位应答地址"); - RefreshExecInfoEvent?.Invoke("收到围板设备应答信号......"); + Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到前板设备应答信号,复位应答地址"); + RefreshExecInfoEvent?.Invoke("收到前板设备应答信号......"); isFlag = false; } Thread.Sleep(2000); @@ -773,13 +788,13 @@ public class SheetMetalPlanTaskHandle } catch (Exception ex) { - MessageBox.Show($"围板⽣产计划下发异常:{ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error, + MessageBox.Show($"前板⽣产计划下发异常:{ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly); } } /// - /// 读取围板生产数据 + /// 读取前板生产数据 /// /// public void ReadDeviceComplate_SidePanel(PlcModel obj) @@ -813,8 +828,8 @@ public class SheetMetalPlanTaskHandle //生产节拍 int productionBeat = short.Parse(bytesToHexStr(info.Skip(51).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber); - Console.WriteLine($"围板设备数据读取====>>>>当前计划:{planCode},物料编号:{materialCode},完成数量:{complateAmount},下线数量:{offLineAmount},设备状态:{deviceStatus},生产节拍:{productionBeat}"); - RefreshExecInfoEvent?.Invoke($"围板设备数据读取====>>>>当前计划:{planCode},物料编号:{materialCode},完成数量:{complateAmount},下线数量:{offLineAmount},设备状态:{deviceStatus},生产节拍:{productionBeat}"); + Console.WriteLine($"前板设备数据读取====>>>>当前计划:{planCode},物料编号:{materialCode},完成数量:{complateAmount},下线数量:{offLineAmount},设备状态:{deviceStatus},生产节拍:{productionBeat}"); + RefreshExecInfoEvent?.Invoke($"前板设备数据读取====>>>>当前计划:{planCode},物料编号:{materialCode},完成数量:{complateAmount},下线数量:{offLineAmount},设备状态:{deviceStatus},生产节拍:{productionBeat}"); //添加完工记录 RecordSidePanelComplate sidePanelComplate = new RecordSidePanelComplate() @@ -869,8 +884,8 @@ public class SheetMetalPlanTaskHandle if (planInfo.PlanAmount - sumComplateAmount == 0) { isFlag = false; - Console.WriteLine($"围板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}"); - RefreshExecInfoEvent?.Invoke($"围板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}"); + Console.WriteLine($"前板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}"); + RefreshExecInfoEvent?.Invoke($"前板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}"); } } } @@ -888,6 +903,13 @@ public class SheetMetalPlanTaskHandle RefreshCreatePlanInfoEvent?.Invoke();//更新界面 RefreshChatEvent?.Invoke();//刷新图表 RefreshCreatePlanInfoEvent?.Invoke(); + var planInfoList = _executePlanInfoServices.QuerySheetMetalSendPlanData("1001"); + if (planInfoList != null&& planInfoList.Count != 0) + { + SheetMetaSendPlanInfoView planInfo = planInfoList.FirstOrDefault(d => d.TaskCode == planCode.Replace("\0","").Trim()); + RefreshPlanInfoEvent?.Invoke(planInfo);//刷新计划执行 + } + } Thread.Sleep(5000); } while (isFlag); @@ -897,12 +919,13 @@ public class SheetMetalPlanTaskHandle //更新前端展示图表 RefreshCreatePlanInfoEvent?.Invoke();//更新界面 RefreshChatEvent?.Invoke();//刷新图表 + } } catch (Exception e) { - Console.WriteLine($"读取围板设备完成数据异常:{e.Message}"); - RefreshExecInfoEvent?.Invoke($"读取围板设备完成数据异常:{e.Message}"); + Console.WriteLine($"读取前板设备完成数据异常:{e.Message}"); + RefreshExecInfoEvent?.Invoke($"读取前板设备完成数据异常:{e.Message}"); } } diff --git a/Aucma.Core.SheetMetal/Models/MaterialComplateInfoModel.cs b/Aucma.Core.SheetMetal/Models/MaterialComplateInfoModel.cs index c7ee73ed..01fee325 100644 --- a/Aucma.Core.SheetMetal/Models/MaterialComplateInfoModel.cs +++ b/Aucma.Core.SheetMetal/Models/MaterialComplateInfoModel.cs @@ -13,6 +13,10 @@ namespace Aucma.Core.SheetMetal.Models /// public int No { get; set; } /// + /// 订单编码 + /// + public string OrderCode { get; set; } + /// /// 计划编号 /// public string? ProductPlanCode { get; set; } diff --git a/Aucma.Core.SheetMetal/ViewModels/IndexPageViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/IndexPageViewModel.cs index e8574676..a349826e 100644 --- a/Aucma.Core.SheetMetal/ViewModels/IndexPageViewModel.cs +++ b/Aucma.Core.SheetMetal/ViewModels/IndexPageViewModel.cs @@ -22,6 +22,7 @@ using Admin.Core.Model.ViewModels; using NPOI.SS.Formula.Functions; using log4net; using Aucma.Core.HwPLc; +using static Npgsql.Replication.PgOutput.Messages.RelationMessage; /* * 首页信息 */ @@ -49,6 +50,7 @@ namespace Aucma.Core.SheetMetal.ViewModels }}; public Func Formatter { get; set; } public HwPLc.PlcModel obj = null; + #region 构造函数 public IndexPageViewModel() { @@ -67,7 +69,7 @@ namespace Aucma.Core.SheetMetal.ViewModels QuantityIssuedViewModel.RefreshCretaePlanInfoEvent += LoadData; SheetMetalPlanTaskHandle.RefreshCreatePlanInfoEvent += LoadData; SheetMetalPlanTaskHandle.RefreshChatEvent += RefreshChat; - + SheetMetalPlanTaskHandle.RefreshPlanInfoEvent += RefreshPlanShow; } #endregion @@ -287,6 +289,38 @@ namespace Aucma.Core.SheetMetal.ViewModels } #endregion + public void RefreshPlanShow(SheetMetaSendPlanInfoView execPlan) + { + //更新首页显示信息 + //ExecutePlanInfo execPlan = execList.SingleOrDefault(d => d.ExecuteStatus == 2); + if (execPlan != null) + { + OrderCode = execPlan.OrderCode; + MesMOrderCode = execPlan.ProductPlanCode; + ProductModel = execPlan.MaterialName; + BeginTime = execPlan.BeginTime.ToString(); + PlanMaxNum = PlanNum = execPlan.PlanAmount; + RealQuantity = execPlan.CompleteAmount; + double diff = _planMaxNum - _realQuantity; + DiffQuantity = int.Parse(diff.ToString()); + //CompletionRate = (_realQuantity/_planMaxNum).ToString("0%"); + CompletionRate = (_realQuantity / _planMaxNum); + } + else + { + OrderCode = string.Empty; + MesMOrderCode = string.Empty; + ProductModel = string.Empty; + BeginTime = string.Empty; + PlanMaxNum = 0; + RealQuantity = 0.0; + DiffQuantity = 0; + CompletionRate = 0; + } + } + + + #region 向上 /// /// 向上 @@ -860,15 +894,31 @@ namespace Aucma.Core.SheetMetal.ViewModels if (sheetMetalTypeList != null) { #region 按类型统计 + ChartValues achievement1 = new ChartValues(); + ChartValues achievement2 = new ChartValues(); for (int i = 0; i < sheetMetalTypeList.Count; i++) { - double frontPlateAmount =Convert.ToDouble(sheetMetalTypeList[i].FrontPlateAmount); - ModelStatistics[0].Values[i] = frontPlateAmount; - double rearPanelAmount = Convert.ToDouble(sheetMetalTypeList[i].RearPanelAmount); - ModelStatistics[1].Values[i] = rearPanelAmount; - MaterialNameList[i]=sheetMetalTypeList[i].MaterialName; + if (ModelStatistics.Count==0) + { + RefreshMaterialStats(); + } + else + { + if (sheetMetalTypeList.Count()>0) + { + //RefreshMaterialStats(); + double frontPlateAmount = Convert.ToDouble(sheetMetalTypeList[i].FrontPlateAmount); + ModelStatistics[0].Values[i] = frontPlateAmount; + double rearPanelAmount = Convert.ToDouble(sheetMetalTypeList[i].RearPanelAmount); + ModelStatistics[1].Values[i] = rearPanelAmount; + MaterialNameList[i] = sheetMetalTypeList[i].MaterialName; + } + else + { + RefreshMaterialStats(); + } + } } - #endregion } })); @@ -889,5 +939,13 @@ namespace Aucma.Core.SheetMetal.ViewModels } return null; } + + /// + /// 循环查询成品数据 + /// + public void QueryFinishProduct() + { + + } } } diff --git a/Aucma.Core.SheetMetal/ViewModels/MainWindowViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/MainWindowViewModel.cs index 4ddb059f..9104d298 100644 --- a/Aucma.Core.SheetMetal/ViewModels/MainWindowViewModel.cs +++ b/Aucma.Core.SheetMetal/ViewModels/MainWindowViewModel.cs @@ -15,6 +15,9 @@ using Aucma.Core.Scanner; using System.Linq; using System.Threading.Tasks; using Aucma.Core.SheetMetal.Business; +using System.Threading; +using Admin.Core.IService; +using Microsoft.Extensions.DependencyInjection; namespace Aucma.Core.SheetMetal.ViewModels { @@ -25,9 +28,10 @@ namespace Aucma.Core.SheetMetal.ViewModels private LogPageView logPage = new LogPageView();//日志 private StatisticsPageView statisticsPage = new StatisticsPageView();//统计 private SheetMetalPlanTaskHandle _taskHandle = new SheetMetalPlanTaskHandle(); - + ISysUserInfoServices _sysUserInfoServices; public MainWindowViewModel() { + _sysUserInfoServices = App.ServiceProvider.GetService(); UserContent = firstPage; init(); Task.Run(() => @@ -40,6 +44,10 @@ namespace Aucma.Core.SheetMetal.ViewModels //_taskHandle.InitSendPlan(); _taskHandle.InitSendSidePanelPlan(); }); + Task.Run(async () => + { + await RefreshTeamTime();//班组时间 + }); } public void init() { @@ -51,6 +59,23 @@ namespace Aucma.Core.SheetMetal.ViewModels timer.Start(); } + public async Task RefreshTeamTime() + { + while (true) + { + var list= await _sysUserInfoServices.GetTeamData(); + if (list!=null&& list.Count>0) + { + var sysUserInfo=list.First(); + TeamTime = $"({list.Min(d=>d.StartTime).ToString("HH:mm")}~{list.Max(d => d.EndTime).ToString("HH:mm")})"; + TeamName = $"{sysUserInfo.TeamName}"; + } + Thread.Sleep(5000); + } + } + + + #region 设备状态刷新 /// /// 设备状态刷新 @@ -386,5 +411,25 @@ namespace Aucma.Core.SheetMetal.ViewModels }); } #endregion + + + /// + /// 班组时间 + /// + public string _teamTime; + public string TeamTime + { + get => _teamTime; + set => SetProperty(ref _teamTime, value); + } + /// + /// 班组名称 + /// + public string _teamName; + public string TeamName + { + get => _teamName; + set => SetProperty(ref _teamName, value); + } } } diff --git a/Aucma.Core.SheetMetal/ViewModels/SplitPlanViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/SplitPlanViewModel.cs index ac1e5c8a..5ead8f9e 100644 --- a/Aucma.Core.SheetMetal/ViewModels/SplitPlanViewModel.cs +++ b/Aucma.Core.SheetMetal/ViewModels/SplitPlanViewModel.cs @@ -81,12 +81,17 @@ namespace Aucma.Core.SheetMetal.ViewModels private async Task LoadData(string obj) { + string station = Appsettings.app("StationInfo", "StationCode"); + MaterialDataGrid.Clear(); int i = 1; - string station = Appsettings.app("StoreInfo", "StationCode"); - var planlist = await _productPlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station)); - var queryList = planlist.Where(d=>d.OrderCode.Contains(obj)|| d.MaterialCode.Contains(obj) || d.MaterialName.Contains(obj)); - var execList = await _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station)); - foreach (var item in queryList) + //var planlist = _productPlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station)).Result; + //if (planlist == null) return ; + //var execList = await _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station)); + //if (execList == null) return; + var execList = _executePlanInfoServices.QuerySheetMetalPlanData(station); + if (execList == null) return; + execList=execList.Where(d => d.MaterialName.Contains(obj) || d.OrderCode.Contains(obj) || d.PlanCode.Contains(obj)).ToList(); + foreach (var item in execList) { int residue = 0; if (execList == null) residue = 0; @@ -101,6 +106,7 @@ namespace Aucma.Core.SheetMetal.ViewModels PlanAmount = item.PlanAmount, ResidueAmount = item.PlanAmount - item.CompleteAmount, SpliteResidueAmount = item.PlanAmount - residue, + MaterialSpecificatons = item.MaterialSpecificatons, StartDate = item.BeginTime }); i++; @@ -360,31 +366,15 @@ namespace Aucma.Core.SheetMetal.ViewModels { string productLineCode = Appsettings.app("StationInfo", "StationCode"); MaterialDataGrid.Clear(); - int i = 1; - string station = Appsettings.app("StationInfo", "StationCode"); - var planlist = _productPlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station)&&d.MaterialName.Contains(selectedOption)).Result; - if (planlist == null) return; - var execList = await _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station)&& d.MaterialName.Contains(station)); - if (execList == null) return; - foreach (var item in planlist) + if (!string.IsNullOrEmpty(selectedOption)) { - int residue = 0; - if (execList == null) residue = 0; - else residue = (execList.Where(d => d.MaterialCode.Equals(item.MaterialCode))).Sum(d => d.PlanAmount); - MaterialDataGrid.Add(new ProductPlanInfoModel() - { - No = i, - PlanCode = item.PlanCode, - MaterialCode = item.MaterialCode, - MaterialName = item.MaterialName, - OrderCode = item.OrderCode, - PlanAmount = item.PlanAmount, - ResidueAmount = item.PlanAmount - item.CompleteAmount, - SpliteResidueAmount = item.PlanAmount - residue, - StartDate = item.BeginTime - }); - i++; + await LoadData(selectedOption); + } + else + { + await LoadData(); } + } #endregion diff --git a/Aucma.Core.SheetMetal/ViewModels/StatisticsPageViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/StatisticsPageViewModel.cs index 271c87b6..dbf550b4 100644 --- a/Aucma.Core.SheetMetal/ViewModels/StatisticsPageViewModel.cs +++ b/Aucma.Core.SheetMetal/ViewModels/StatisticsPageViewModel.cs @@ -46,6 +46,7 @@ namespace Aucma.Core.SheetMetal.ViewModels MaterialDataGrid.Add(new MaterialComplateInfo() { No = i, ProductPlanCode = item.PlanCode, + OrderCode = item.OrderCode, MaterialCode = item.MaterialCode, MaterialName = item.MaterialName, PlanAmount = item.PlanAmount, diff --git a/Aucma.Core.SheetMetal/Views/IndexPageView.xaml b/Aucma.Core.SheetMetal/Views/IndexPageView.xaml index bd49b743..050e398c 100644 --- a/Aucma.Core.SheetMetal/Views/IndexPageView.xaml +++ b/Aucma.Core.SheetMetal/Views/IndexPageView.xaml @@ -70,7 +70,7 @@ - + @@ -132,7 +132,7 @@ - + @@ -171,10 +171,10 @@ - + - @@ -191,7 +191,7 @@ - @@ -208,7 +208,7 @@ - @@ -224,8 +224,8 @@ - - + diff --git a/Aucma.Core.SheetMetal/Views/LogPageView.xaml b/Aucma.Core.SheetMetal/Views/LogPageView.xaml index 11d82007..e641d04b 100644 --- a/Aucma.Core.SheetMetal/Views/LogPageView.xaml +++ b/Aucma.Core.SheetMetal/Views/LogPageView.xaml @@ -10,7 +10,7 @@ - + diff --git a/Aucma.Core.SheetMetal/Views/MainWindow.xaml b/Aucma.Core.SheetMetal/Views/MainWindow.xaml index 161341a9..8fae9fc2 100644 --- a/Aucma.Core.SheetMetal/Views/MainWindow.xaml +++ b/Aucma.Core.SheetMetal/Views/MainWindow.xaml @@ -37,16 +37,17 @@ - + - - - - - - - - + + + + + + + + + diff --git a/Aucma.Core.SheetMetal/Views/QuantityIssuedView.xaml b/Aucma.Core.SheetMetal/Views/QuantityIssuedView.xaml index 8561884f..634a4f95 100644 --- a/Aucma.Core.SheetMetal/Views/QuantityIssuedView.xaml +++ b/Aucma.Core.SheetMetal/Views/QuantityIssuedView.xaml @@ -35,28 +35,28 @@ - + - + - + - + - + - + diff --git a/Aucma.Core.SheetMetal/Views/QuantityIssuedView.xaml.cs b/Aucma.Core.SheetMetal/Views/QuantityIssuedView.xaml.cs index 90991f24..dc096e05 100644 --- a/Aucma.Core.SheetMetal/Views/QuantityIssuedView.xaml.cs +++ b/Aucma.Core.SheetMetal/Views/QuantityIssuedView.xaml.cs @@ -26,13 +26,14 @@ namespace Aucma.Core.SheetMetal.Views public QuantityIssuedView() { InitializeComponent(); + this.TransmitAmount.Focus(); } public QuantityIssuedView(ProductPlanInfoModel productPlanInfo) { InitializeComponent(); this.DataContext = new QuantityIssuedViewModel(productPlanInfo); - + this.TransmitAmount.Focus(); } } } diff --git a/Aucma.Core.SheetMetal/Views/SplitPlanView.xaml b/Aucma.Core.SheetMetal/Views/SplitPlanView.xaml index 4bee6173..c9b0a7bc 100644 --- a/Aucma.Core.SheetMetal/Views/SplitPlanView.xaml +++ b/Aucma.Core.SheetMetal/Views/SplitPlanView.xaml @@ -236,7 +236,7 @@ - + diff --git a/Aucma.Core.SheetMetal/Views/StatisticsPageView.xaml b/Aucma.Core.SheetMetal/Views/StatisticsPageView.xaml index ed2a6758..683cfc15 100644 --- a/Aucma.Core.SheetMetal/Views/StatisticsPageView.xaml +++ b/Aucma.Core.SheetMetal/Views/StatisticsPageView.xaml @@ -87,7 +87,7 @@ - + @@ -117,7 +117,8 @@ - + +