diff --git a/Admin.Core.Api/Admin.Core.Model.xml b/Admin.Core.Api/Admin.Core.Model.xml
index 441f7753..d35a8860 100644
--- a/Admin.Core.Api/Admin.Core.Model.xml
+++ b/Admin.Core.Api/Admin.Core.Model.xml
@@ -2356,6 +2356,16 @@
产品简码
+
+
+ 夹具型号
+
+
+
+
+ y
+
+
条码下线信息记录
diff --git a/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.GeneratedMSBuildEditorConfig.editorconfig b/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.GeneratedMSBuildEditorConfig.editorconfig
index 5decb385..34f11e1e 100644
--- a/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.GeneratedMSBuildEditorConfig.editorconfig
+++ b/Admin.Core.FrameWork/obj/Debug/netcoreapp3.1/Admin.Core.FrameWork.GeneratedMSBuildEditorConfig.editorconfig
@@ -1,3 +1,3 @@
is_global = true
build_property.RootNamespace = Admin.Core.FrameWork
-build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.FrameWork\
+build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.FrameWork\
diff --git a/Admin.Core.IRepository/IRepository_New/ISysUserInfoRepository.cs b/Admin.Core.IRepository/IRepository_New/ISysUserInfoRepository.cs
index c0cbf020..1347b862 100644
--- a/Admin.Core.IRepository/IRepository_New/ISysUserInfoRepository.cs
+++ b/Admin.Core.IRepository/IRepository_New/ISysUserInfoRepository.cs
@@ -40,5 +40,14 @@ namespace Admin.Core.IRepository
///
///
Task> GetSheetMetaHourData(string productLineCode);
+ ///
+ /// 当前订单执行第一次数据采集时候更新SAP计划
+ ///
+ int UpdateSapPlan(string sapCode);
+ ///
+ /// 获取夹具状态
+ ///
+ ///
+ Task> StatisticalModelStatus();
}
}
\ No newline at end of file
diff --git a/Admin.Core.IService/IService_New/ISysUserInfoServices.cs b/Admin.Core.IService/IService_New/ISysUserInfoServices.cs
index 13e7b320..b0e0a0cb 100644
--- a/Admin.Core.IService/IService_New/ISysUserInfoServices.cs
+++ b/Admin.Core.IService/IService_New/ISysUserInfoServices.cs
@@ -1,5 +1,6 @@
using Admin.Core.IService;
using Admin.Core.Model;
+using Admin.Core.Model.Model_New;
using Admin.Core.Model.ViewModels;
using System;
using System.Collections.Generic;
@@ -50,5 +51,16 @@ namespace Admin.Core.IService
///
Task> GetSheetMetaHourData(string productLineCode);
+ ///
+ /// 钣金第一次执行更新日历表
+ ///
+ ///
+ ///
+ int UpdateSapPlan(string sapCode);
+ ///
+ /// 夹具状态
+ ///
+ ///
+ Task> StatisticalModelStatus();
}
}
\ No newline at end of file
diff --git a/Admin.Core.Model/Model_New/ModeStatusView.cs b/Admin.Core.Model/Model_New/ModeStatusView.cs
new file mode 100644
index 00000000..73f980d0
--- /dev/null
+++ b/Admin.Core.Model/Model_New/ModeStatusView.cs
@@ -0,0 +1,23 @@
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Admin.Core.Model
+{
+ public class ModeStatusView
+ {
+ ///
+ /// 夹具型号
+ ///
+ [SugarColumn(ColumnName = "X_VALUE")]
+ public string XValue { get; set; }
+ ///
+ /// y
+ ///
+ [SugarColumn(ColumnName = "Y_VALUE")]
+ public string YValue { get; set; }
+ }
+}
diff --git a/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.GeneratedMSBuildEditorConfig.editorconfig b/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.GeneratedMSBuildEditorConfig.editorconfig
index abc27d01..ce84cb9f 100644
--- a/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.GeneratedMSBuildEditorConfig.editorconfig
+++ b/Admin.Core.RealTimeService/obj/Debug/net6.0/Admin.Core.RealTimeService.GeneratedMSBuildEditorConfig.editorconfig
@@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.RealTimeService
-build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.RealTimeService\
+build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.RealTimeService\
diff --git a/Admin.Core.Repository/Repository_New/ExecutePlanInfoRepository.cs b/Admin.Core.Repository/Repository_New/ExecutePlanInfoRepository.cs
index e0e0ef9c..9d7acb7c 100644
--- a/Admin.Core.Repository/Repository_New/ExecutePlanInfoRepository.cs
+++ b/Admin.Core.Repository/Repository_New/ExecutePlanInfoRepository.cs
@@ -89,37 +89,35 @@ namespace Admin.Core.Repository
///
public List QuerySheetMetalPlanData(string 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";
+ string sql = $@"select o.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
+ INNER JOIN C##AUCMA_MES.BASE_MATERIALINFO m ON o.MATERIAL_CODE = m.MATERIAL_CODE where p.PRODUCTLINE_CODE='{stationCode}'
+ group by o.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 o.OBJ_ID";
- return Db.CopyNew().SqlQueryable(sql).Where("PRODUCTLINE_CODE = @stationCode", new { stationCode = stationCode }).ToList();
+ 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 873c6483..d378220b 100644
--- a/Admin.Core.Repository/Repository_New/SysUserInfoRepository.cs
+++ b/Admin.Core.Repository/Repository_New/SysUserInfoRepository.cs
@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System;
using Microsoft.IdentityModel.Logging;
using System.Linq;
+using SqlSugar;
namespace Admin.Core.Repository
{
@@ -104,13 +105,33 @@ namespace Admin.Core.Repository
#endregion
+ #region 当前订单执行第一次数据采集时候更新SAP计划
///
- /// /更新计划表数据
+ /// 当前订单执行第一次数据采集时候更新SAP计划
///
- //public void UpdateSAPPlan(string PlanCode)
- //{
- // string sql = "UPDATE PRODUCT_CALENDAR_INFO SET IS_SCHEDULING = 0 WHERE SAP_PLAN_CODE = '11227552'";
- // return await Db.CopyNew().Ado.ExecuteCommandAsync(sql);
- //}
+ public int UpdateSapPlan(string sapCode)
+ {
+ var parameters = new SugarParameter[]
+ {
+ new SugarParameter("@SAP_PLAN_CODE", sapCode)
+ };
+
+ string sql = "UPDATE PRODUCT_CALENDAR_INFO SET IS_SCHEDULING = 0 WHERE SAP_PLAN_CODE = @SAP_PLAN_CODE";
+ int affectedRows = Db.CopyNew().Ado.ExecuteCommand(sql, parameters);
+ return affectedRows;
+ }
+ #endregion
+
+
+ #region 统计夹具型号状态
+ ///
+ /// 统计夹具型号状态
+ ///
+ public async Task> StatisticalModelStatus()
+ {
+ string sql = "select * from table (scada_xk_fp_01('') )";
+ return await Db.CopyNew().Ado.SqlQueryAsync(sql);
+ }
+ #endregion
}
}
\ No newline at end of file
diff --git a/Admin.Core.Service/Service_New/SysUserInfoServices.cs b/Admin.Core.Service/Service_New/SysUserInfoServices.cs
index acd2cce9..b217a022 100644
--- a/Admin.Core.Service/Service_New/SysUserInfoServices.cs
+++ b/Admin.Core.Service/Service_New/SysUserInfoServices.cs
@@ -2,6 +2,7 @@
using Admin.Core.IRepository;
using Admin.Core.IService;
using Admin.Core.Model;
+using Admin.Core.Model.Model_New;
using Admin.Core.Model.ViewModels;
using Admin.Core.Service;
using log4net;
@@ -9,6 +10,7 @@ using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection.Emit;
using System.Threading.Tasks;
namespace Admin.Core.IService
@@ -83,5 +85,19 @@ namespace Admin.Core.IService
{
return await _sysUserInfoRepository.GetSheetMetaHourData(productLineCode);
}
+
+
+ public int UpdateSapPlan(string sapCode)
+ {
+ return _sysUserInfoRepository.UpdateSapPlan(sapCode);
+ }
+ ///
+ /// 获取夹具状态
+ ///
+ ///
+ public Task> StatisticalModelStatus()
+ {
+ return _sysUserInfoRepository.StatisticalModelStatus();
+ }
}
}
\ No newline at end of file
diff --git a/Aucma.Core.HwPLc/Impl/MelsecPlc.cs b/Aucma.Core.HwPLc/Impl/MelsecPlc.cs
index c9ae071e..d54ef3c0 100644
--- a/Aucma.Core.HwPLc/Impl/MelsecPlc.cs
+++ b/Aucma.Core.HwPLc/Impl/MelsecPlc.cs
@@ -76,7 +76,7 @@ namespace Aucma.Core.HwPLc
///
public bool Connect(string iP, int port)
{
- melsecMcNet.IpAddress = iP;//正式环境开启
+ //melsecMcNet.IpAddress = iP;//正式环境开启
melsecMcNet.Port = port;
// 如果网络不太理想,配置了两个端口,一个有问题,立即切换另一个的话,可以配置如下的代码
diff --git a/Aucma.Core.SheetMetal/Business/SheetMetalPlanTaskHandle.cs b/Aucma.Core.SheetMetal/Business/SheetMetalPlanTaskHandle.cs
index b678f928..156b7c34 100644
--- a/Aucma.Core.SheetMetal/Business/SheetMetalPlanTaskHandle.cs
+++ b/Aucma.Core.SheetMetal/Business/SheetMetalPlanTaskHandle.cs
@@ -10,10 +10,13 @@ using System.Windows.Documents;
using Admin.Core.Common;
using Admin.Core.IService;
using Admin.Core.Model;
+using Admin.Core.Model.Model_New;
using Admin.Core.Model.ViewModels;
using Admin.Core.Service;
using Aucma.Core.HwPLc;
using Microsoft.Extensions.DependencyInjection;
+using NetTaste;
+using NPOI.SS.Formula.Functions;
using SqlSugar;
namespace Aucma.Core.SheetMetal.Business;
@@ -61,7 +64,7 @@ public class SheetMetalPlanTaskHandle
///
/// 刷新当前正在执行的计划
///
- public delegate void RefreshExecInfo(string message);
+ public delegate void RefreshExecInfo(string message,string color);
public static event RefreshExecInfo RefreshExecInfoEvent;
#endregion
@@ -70,15 +73,19 @@ public class SheetMetalPlanTaskHandle
protected readonly IRecordSidePanelComplateServices _sidePanelComplateServices;
protected readonly IRecordBackPanelComplateServices _backPanelComplateServices;
protected readonly IProductPlanInfoServices? _productPlanInfoServices;
+ protected readonly ISysUserInfoServices? _sysUserInfoServices;
+ protected readonly IMaterialCompletionServices? _materialCompletionServices;
public HwPLc.PlcModel plc1 = null;
public SheetMetalPlanTaskHandle()
{
- _executePlanInfoServices =
- App.ServiceProvider.GetService();
+ _executePlanInfoServices =App.ServiceProvider.GetService();
_sidePanelComplateServices = App.ServiceProvider.GetService();
_backPanelComplateServices = App.ServiceProvider.GetService();
_productPlanInfoServices = App.ServiceProvider.GetService();
+ _backPanelComplateServices = App.ServiceProvider.GetService();
+ _sysUserInfoServices = App.ServiceProvider.GetService();
+ _materialCompletionServices = App.ServiceProvider.GetService();
}
@@ -109,6 +116,8 @@ public class SheetMetalPlanTaskHandle
if (planInfo == null) continue;
if (planInfo.PlanType == 3 || planInfo.PlanType == 1)//如果为3或者为1 后板计划单独下发 以前板完成为主
{
+ //获取设置的型号查询对应的型号,下发计划
+
SendPlanTaskToBackPanel(planInfo, obj_backPanel);
UpdateBackPanelPlanTaskByComplate(planInfo);
@@ -183,7 +192,7 @@ public class SheetMetalPlanTaskHandle
obj_sidePanel.plc.WriteInt32("D6021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>计划【{planInfo.TaskCode}】已下发,等待前板设备应答。。。。。。");
- RefreshExecInfoEvent?.Invoke($"计划【{planInfo.TaskCode}】已下发,等待前板设备应答。。。。。。");
+ RefreshExecInfoEvent?.Invoke($"计划【{planInfo.TaskCode}】已下发,等待前板设备应答。。。。。。","White");
#region PLC反馈信号逻辑处理
//循环读取PLC应答信号,PLC应答后复位应答信号、更新计划状态为执行中
bool isFlag = true;
@@ -195,7 +204,7 @@ public class SheetMetalPlanTaskHandle
{
obj_sidePanel.plc.WriteInt32("D6021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>计划【{planInfo.TaskCode}】,收到前板设备应答信号,复位应答地址");
- RefreshExecInfoEvent?.Invoke($"计划【{planInfo.TaskCode}】,收到前板板设备应答信号,复位应答地址");
+ RefreshExecInfoEvent?.Invoke($"计划【{planInfo.TaskCode}】,收到前板板设备应答信号,复位应答地址", "White");
startTime=DateTime.Now;
isFlag = false;
}
@@ -255,7 +264,7 @@ public class SheetMetalPlanTaskHandle
obj_backPanel.plc.WriteInt32("D4021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>计划【{planInfo.TaskCode}】已下发,等待背板设备应答。。。。。。");
- RefreshExecInfoEvent?.Invoke($"计划【{planInfo.TaskCode}】以下发,等待背板设备应答。。。。。。");
+ RefreshExecInfoEvent?.Invoke($"计划【{planInfo.TaskCode}】已下发,等待背板设备应答。。。。。。", "White");
#region PLC反馈信号逻辑处理
//循环读取PLC应答信号,PLC应答后复位应答信号、更新计划状态为执行中
bool isFlag = true;
@@ -267,7 +276,7 @@ public class SheetMetalPlanTaskHandle
{
obj_backPanel.plc.WriteInt32("D4021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到背板板设备应答信号,复位应答地址");
- RefreshExecInfoEvent?.Invoke($"收到背板板设备应答信号,复位应答地址");
+ RefreshExecInfoEvent?.Invoke($"收到背板板设备应答信号,复位应答地址", "White");
startTime = DateTime.Now;
isFlag = false;
}
@@ -328,7 +337,7 @@ public class SheetMetalPlanTaskHandle
int sumBackPanelAmount = backPanelComplates.Sum(x => x.OutPutAmount);
Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
- RefreshExecInfoEvent?.Invoke($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
+ RefreshExecInfoEvent?.Invoke($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}", "White");
int sumAmount = 0;
if (planInfo.PlanType == 1)
@@ -339,7 +348,6 @@ public class SheetMetalPlanTaskHandle
{
sumAmount = sumSidePanelAmount;
planInfo.ExecuteStatus = 3;
-
}
if (sumSidePanelAmount < sumBackPanelAmount && sumBackPanelAmount == planInfo.PlanAmount)
{
@@ -420,7 +428,7 @@ public class SheetMetalPlanTaskHandle
catch (Exception ex)
{
Console.WriteLine($"计划任务信息更新异常:{ex.Message}");
- RefreshExecInfoEvent?.Invoke($"计划任务信息更新异常:{ex.Message}");
+ RefreshExecInfoEvent?.Invoke($"计划任务信息更新异常:{ex.Message}", "Red");
}
}
///
@@ -446,7 +454,7 @@ public class SheetMetalPlanTaskHandle
int sumBackPanelAmount = backPanelComplates.Sum(x => x.OutPutAmount);
Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
- RefreshExecInfoEvent?.Invoke($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
+ RefreshExecInfoEvent?.Invoke($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}", "White");
int sumAmount = 0;
@@ -516,7 +524,7 @@ public class SheetMetalPlanTaskHandle
catch (Exception ex)
{
Console.WriteLine($"计划任务信息更新异常:{ex.Message}");
- RefreshExecInfoEvent?.Invoke($"计划任务信息更新异常:{ex.Message}");
+ RefreshExecInfoEvent?.Invoke($"计划任务信息更新异常:{ex.Message}", "Red");
}
} while (isComplate);
@@ -534,74 +542,6 @@ public class SheetMetalPlanTaskHandle
#endregion
-
-
-
- #region 更新计划列表数量
- ///
- /// 更新计划列表数量
- ///
- public void UpdateComplatePlan()
- {
- string stationCode = Appsettings.app("StationInfo", "StationCode");
- while (true)
- {
-
- var planInfoList = _executePlanInfoServices.QueryAsync(d=>d.ProductLineCode.Contains(stationCode)).Result;
- if (planInfoList == null || planInfoList.Count == 0) continue;
-
- var list = from d in planInfoList
- select new
- {
- d.OrderCode,
- d.CompleteAmount
- };
-
- var grouplist =( from d in list
- group d by d.OrderCode into g
- select new
- {
- OrderCode = g.Key,
- CompleteAmount = g.Sum(d=>d.CompleteAmount)
- }).OrderBy(t => t.OrderCode).ToList();
-
- var productPlanInfoList= _productPlanInfoServices.QueryAsync(d => d.ProductLineCode.Contains(stationCode)&& d.CompleteAmount!=d.PlanAmount).Result;
- productPlanInfoList.ForEach(t =>
- {
- var obj= grouplist.SingleOrDefault(d=>d.OrderCode.Equals(t.OrderCode));
- if (obj != null)
- {
- if (t.PlanAmount == obj.CompleteAmount)
- {
- t.CompleteAmount = obj.CompleteAmount;
- t.EndTime = DateTime.Now;
- }
- if (t.PlanAmount > obj.CompleteAmount)
- {
- t.CompleteAmount = obj.CompleteAmount;
- }
- else
- {
- t.CompleteAmount = t.PlanAmount;
- }
- if (obj.CompleteAmount!=0)
- {
- _productPlanInfoServices.UpdateAsync(t);
- }
- }
- });
-
- Thread.Sleep(5000);
- }
-
- }
-
- #endregion
-
-
-
-
-
#region 下发单个计划逻辑
@@ -678,7 +618,7 @@ public class SheetMetalPlanTaskHandle
int sumBackPanelAmount = backPanelComplates.Sum(x => x.OutPutAmount);
Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
- RefreshExecInfoEvent?.Invoke($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
+ RefreshExecInfoEvent?.Invoke($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}", "White");
int sumAmount = 0;
if (planInfo.PlanType == 1)
@@ -724,7 +664,7 @@ public class SheetMetalPlanTaskHandle
catch (Exception ex)
{
Console.WriteLine($"计划任务信息更新异常:{ex.Message}");
- RefreshExecInfoEvent?.Invoke($"计划任务信息更新异常:{ex.Message}");
+ RefreshExecInfoEvent?.Invoke($"计划任务信息更新异常:{ex.Message}", "Red");
}
}
@@ -751,7 +691,7 @@ public class SheetMetalPlanTaskHandle
obj_sidePanel.plc.WriteInt32("D6021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待前板设备应答。。。。。。");
- RefreshExecInfoEvent?.Invoke("等待前板设备应答......");
+ RefreshExecInfoEvent?.Invoke("等待前板设备应答......","Red");
//下发完成后读取PLC应答,应答后复位应答信号
#region PLC反馈信号逻辑处理
@@ -764,7 +704,7 @@ public class SheetMetalPlanTaskHandle
{
obj_sidePanel.plc.WriteInt32("D6021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到前板设备应答信号,复位应答地址");
- RefreshExecInfoEvent?.Invoke("收到前板设备应答信号,复位应答地址");
+ RefreshExecInfoEvent?.Invoke("收到前板设备应答信号,复位应答地址","White");
isFlag = false;
}
Thread.Sleep(2000);
@@ -803,7 +743,7 @@ public class SheetMetalPlanTaskHandle
obj_backPanel.plc.WriteInt32("D4021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待背板设备应答。。。。。。");
- RefreshExecInfoEvent?.Invoke($"等待背板设备应答。。。。。。");
+ RefreshExecInfoEvent?.Invoke($"等待背板设备应答。。。。。。", "White");
#region PLC反馈信号逻辑处理
//循环读取PLC应答信号,PLC应答后复位应答信号、更新计划状态为执行中
bool isFlag = true;
@@ -813,7 +753,7 @@ public class SheetMetalPlanTaskHandle
{
obj_backPanel.plc.WriteInt32("D4021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到背板板设备应答信号,复位应答地址");
- RefreshExecInfoEvent?.Invoke("收到背板板设备应答信号,复位应答地址");
+ RefreshExecInfoEvent?.Invoke("收到背板板设备应答信号,复位应答地址", "White");
isFlag = false;
}
Thread.Sleep(2000);
@@ -870,7 +810,7 @@ public class SheetMetalPlanTaskHandle
obj_sidePanel.plc.WriteInt32("D6021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待前板设备应答。。。。。。");
- RefreshExecInfoEvent?.Invoke("等待前板设备应答......");
+ RefreshExecInfoEvent?.Invoke("等待前板设备应答......", "White");
//下发完成后读取PLC应答,应答后复位应答信号
#region PLC反馈信号逻辑处理
@@ -882,7 +822,7 @@ public class SheetMetalPlanTaskHandle
{
obj_sidePanel.plc.WriteInt32("D6021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到前板设备应答信号,复位应答地址");
- RefreshExecInfoEvent?.Invoke("收到前板设备应答信号......");
+ RefreshExecInfoEvent?.Invoke("收到前板设备应答信号......", "White");
isFlag = false;
}
Thread.Sleep(2000);
@@ -955,7 +895,7 @@ 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}");
+ RefreshExecInfoEvent?.Invoke($"前板设备数据读取====>>>>当前计划:{planCode},物料编号:{materialCode},完成数量:{complateAmount},下线数量:{offLineAmount},设备状态:{deviceStatus},生产节拍:{productionBeat}", "White");
//添加完工记录
RecordSidePanelComplate sidePanelComplate = new RecordSidePanelComplate()
@@ -1011,7 +951,7 @@ public class SheetMetalPlanTaskHandle
{
isFlag = false;
Console.WriteLine($"前板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}");
- RefreshExecInfoEvent?.Invoke($"前板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}");
+ RefreshExecInfoEvent?.Invoke($"前板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}", "White");
}
}
}
@@ -1041,7 +981,7 @@ public class SheetMetalPlanTaskHandle
catch (Exception e)
{
Console.WriteLine($"读取前板设备完成数据异常:{e.Message}");
- RefreshExecInfoEvent?.Invoke($"读取前板设备完成数据异常:{e.Message}");
+ RefreshExecInfoEvent?.Invoke($"读取前板设备完成数据异常:{e.Message}", "Red");
}
} while (isFlag);
@@ -1078,7 +1018,7 @@ public class SheetMetalPlanTaskHandle
obj_backPanel.plc.WriteInt32("D4021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待背板设备应答。。。。。。");
- RefreshExecInfoEvent?.Invoke($"等待背板设备应答。。。。。。");
+ RefreshExecInfoEvent?.Invoke($"等待背板设备应答。。。。。。", "White");
#region PLC反馈信号逻辑处理
//循环读取PLC应答信号,PLC应答后复位应答信号、更新计划状态为执行中
bool isFlag = true;
@@ -1089,7 +1029,7 @@ public class SheetMetalPlanTaskHandle
{
obj_backPanel.plc.WriteInt32("D4021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到背板板设备应答信号,复位应答地址");
- RefreshExecInfoEvent?.Invoke($"收到背板板设备应答信号,复位应答地址");
+ RefreshExecInfoEvent?.Invoke($"收到背板板设备应答信号,复位应答地址", "White");
isFlag = false;
}
Thread.Sleep(2000);
@@ -1161,7 +1101,7 @@ 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}");
+ RefreshExecInfoEvent?.Invoke($"当前计划:{planCode},物料编号:{materialCode},完成数量:{complateAmount},下线数量:{offLineAmount},设备状态:{deviceStatus},生产节拍:{productionBeat}", "White");
//添加完工记录
RecordBackPanelComplate backPanelComplate = new RecordBackPanelComplate()
{
@@ -1215,7 +1155,7 @@ public class SheetMetalPlanTaskHandle
{
isFlag = false;
Console.WriteLine($"背板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}");
- RefreshExecInfoEvent?.Invoke($"背板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}");
+ RefreshExecInfoEvent?.Invoke($"背板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}", "White");
}
}
}
@@ -1244,7 +1184,7 @@ public class SheetMetalPlanTaskHandle
catch (Exception e)
{
Console.WriteLine($"读取背板设备完成数据异常:{e.Message}");
- RefreshExecInfoEvent?.Invoke($"背板⽣产计划下发异常:{e.Message}");
+ RefreshExecInfoEvent?.Invoke($"背板⽣产计划下发异常:{e.Message}", "Red");
}
}
@@ -1271,9 +1211,92 @@ public class SheetMetalPlanTaskHandle
}
}
return returnStr;
- }
+ }
#endregion
+ #region 更新计划列表数量
+ ///
+ /// 更新计划列表数量
+ ///
+ public void UpdateComplatePlan()
+ {
+ string stationCode = Appsettings.app("StationInfo", "StationCode");
+ string productLineCode = Appsettings.app("StationInfo", "ProductLineCode");
+ List pPlanInfoList = new List();
+ while (true)
+ {
+
+ var planInfoList = _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Contains(stationCode)).Result;
+ if (planInfoList == null || planInfoList.Count == 0) continue;
+
+ var list = from d in planInfoList
+ select new
+ {
+ d.OrderCode,
+ d.CompleteAmount
+ };
+
+ var grouplist = (from d in list
+ group d by d.OrderCode into g
+ select new
+ {
+ OrderCode = g.Key,
+ CompleteAmount = g.Sum(d => d.CompleteAmount)
+ }).OrderBy(t => t.OrderCode).ToList();
+ var productPlanInfoList = _productPlanInfoServices.QueryAsync(d => d.ProductLineCode.Contains(stationCode) && d.CompleteAmount != d.PlanAmount).Result;
+
+
+ productPlanInfoList.ForEach(async t =>
+ {
+ var materialCompletionList = _materialCompletionServices.QueryAsync(d => d.ProductLineCode.Contains(productLineCode) && d.StationName.Equals(stationCode)).Result;
+ var obj = grouplist.FirstOrDefault(d => d.OrderCode.Equals(t.OrderCode));
+
+ if (obj != null)
+ {
+ ProductPlanInfo productPlanInfo = new ProductPlanInfo();
+
+ if (obj.CompleteAmount == 1 && t.CompleteAmount == 0)
+ {
+ productPlanInfo.EndTime = DateTime.Now;
+ _sysUserInfoServices.UpdateSapPlan(obj.OrderCode);//第一次执行更新日历表
+ }
+ if (t.PlanAmount == obj.CompleteAmount)
+ {
+ productPlanInfo.CompleteAmount = obj.CompleteAmount;
+ productPlanInfo.EndTime = DateTime.Now;
+ }
+ if (t.PlanAmount > obj.CompleteAmount)
+ {
+ productPlanInfo.CompleteAmount = obj.CompleteAmount;
+ }
+ else
+ {
+ productPlanInfo.CompleteAmount = t.PlanAmount;
+ }
+ int completeNum = materialCompletionList.Count();//过点完成数量
+ if ((obj.CompleteAmount - completeNum) > 0)
+ {
+ MaterialCompletion materialCompletion = new MaterialCompletion();
+ materialCompletion.OrderCode = t.OrderCode;
+ materialCompletion.ProductLineCode = productLineCode;
+ materialCompletion.MaterialCode = t.MaterialCode;
+ materialCompletion.MaterialName = t.MaterialName;
+ materialCompletion.StationName = stationCode;
+ materialCompletion.CompleteDate = DateTime.Now;
+ materialCompletion.planCode = t.PlanCode;
+ await _materialCompletionServices.AddAsync(materialCompletion);
+ }
+ }
+ });
+ if (pPlanInfoList.Count != 0 && pPlanInfoList != null)
+ {
+ _productPlanInfoServices.UpdateAsync(pPlanInfoList);
+ }
+ Thread.Sleep(3000);
+ }
+ }
+
+ #endregion
}
\ No newline at end of file
diff --git a/Aucma.Core.SheetMetal/Models/ListBoxDataView.cs b/Aucma.Core.SheetMetal/Models/ListBoxDataView.cs
new file mode 100644
index 00000000..9ca32a41
--- /dev/null
+++ b/Aucma.Core.SheetMetal/Models/ListBoxDataView.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Aucma.Core.SheetMetal.Models
+{
+ public class ListBoxDataView
+ {
+ ///
+ /// 颜色
+ ///
+ public string Color { get; set; }
+ ///
+ /// 内容
+ ///
+ public string Content { get; set; }
+ }
+}
diff --git a/Aucma.Core.SheetMetal/Models/SelectColorView.cs b/Aucma.Core.SheetMetal/Models/SelectColorView.cs
new file mode 100644
index 00000000..f864f694
--- /dev/null
+++ b/Aucma.Core.SheetMetal/Models/SelectColorView.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Aucma.Core.SheetMetal.Models
+{
+ public enum SelectColorView
+ {
+ Red,
+ White
+ }
+}
diff --git a/Aucma.Core.SheetMetal/ViewModels/IndexPageViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/IndexPageViewModel.cs
index 41623c41..20cb2b7c 100644
--- a/Aucma.Core.SheetMetal/ViewModels/IndexPageViewModel.cs
+++ b/Aucma.Core.SheetMetal/ViewModels/IndexPageViewModel.cs
@@ -19,13 +19,11 @@ using Admin.Core.Common;
using LiveCharts.Defaults;
using Aucma.Core.SheetMetal.Business;
using Admin.Core.Model.ViewModels;
-using NPOI.SS.Formula.Functions;
using log4net;
using Aucma.Core.HwPLc;
-using static Npgsql.Replication.PgOutput.Messages.RelationMessage;
using System.Text;
using System.Threading;
-using Admin.Core.Service;
+using Admin.Core.Model.Model_New;
/*
* 首页信息
*/
@@ -33,7 +31,10 @@ namespace Aucma.Core.SheetMetal.ViewModels
{
public partial class IndexPageViewModel : ObservableObject
{
- private static readonly log4net.ILog log = LogManager.GetLogger(typeof(LogPageViewModel));
+ private static readonly log4net.ILog log = LogManager.GetLogger(typeof(IndexPageViewModel));
+
+ #region 初始化接口
+
protected readonly IExecutePlanInfoServices? _taskExecutionPlanInfoServices;
protected readonly IRecordBackPanelComplateServices _recordBackPanelComplateServices;
protected readonly IRecordSidePanelComplateServices _recordSidePanelComplateServices;
@@ -41,8 +42,12 @@ namespace Aucma.Core.SheetMetal.ViewModels
protected readonly IBaseBomInfoServices _baseBomInfoServices;
private readonly ISysUserInfoServices _sysUserInfoServices;
private readonly IRecordInStoreServices _recordInstoreServices;
- private AppConfigHelper appConfig = new AppConfigHelper();
- List list = new List() { new SelectModel()
+ private readonly IBaseOrderInfoServices _baseOrderInfoServices;
+ #endregion
+
+ #region 初始化下拉数据
+ private AppConfigHelper appConfig = new AppConfigHelper();//读取保存的文本数据
+ List selectList = new List() { new SelectModel()
{
ID=1,
TypeName="手动"
@@ -52,13 +57,18 @@ namespace Aucma.Core.SheetMetal.ViewModels
ID=2,
TypeName="自动"
}};
+ #endregion
+
+ #region 定义对象和定义字段
public Func Formatter { get; set; }
- public HwPLc.PlcModel obj = null;
+ public HwPLc.PlcModel obj = null;
+ #endregion
#region 构造函数
public IndexPageViewModel()
{
_stationName = Appsettings.app("StationInfo", "StationName");//工位名称
+ _baseOrderInfoServices = App.ServiceProvider.GetService();
_executePlanInfoServices = App.ServiceProvider.GetService();
_taskExecutionPlanInfoServices = App.ServiceProvider.GetService();
_recordBackPanelComplateServices = App.ServiceProvider.GetService();
@@ -78,17 +88,19 @@ namespace Aucma.Core.SheetMetal.ViewModels
}
#endregion
+ #region 更新前端数据
public Task RefreshChat()
{
RefreshHourAmountChart();//小时产量
RefreshMaterialChart();//型号产量
return Task.CompletedTask;
- }
+ }
+ #endregion
#region 下拉
public void AddSelectData()
{
- foreach (var item in list)
+ foreach (var item in selectList)
{
LocationSource.Add(item);
}
@@ -268,22 +280,22 @@ namespace Aucma.Core.SheetMetal.ViewModels
#endregion
#region 刷新计划执行
- public void RefreshPlanShow(SheetMetaSendPlanInfoView execPlan)
+ public async void RefreshPlanShow(SheetMetaSendPlanInfoView execPlan)
{
//更新首页显示信息
- //ExecutePlanInfo execPlan = execList.SingleOrDefault(d => d.ExecuteStatus == 2);
- if (execPlan != null)
+ BaseOrderInfo orderPlan =await _baseOrderInfoServices.FirstAsync(d => d.OrderCode == execPlan.OrderCode);
+ if (orderPlan != null)
{
OrderCode = execPlan.OrderCode;
MesMOrderCode = execPlan.ProductPlanCode;
ProductModel = execPlan.MaterialName;
BeginTime = string.IsNullOrEmpty(execPlan.BeginTime)?"": execPlan.BeginTime.ToString();
- PlanMaxNum = PlanNum = execPlan.PlanAmount;//显示SAP订单数,而不是拆分订单计划数
- RealQuantity = execPlan.CompleteAmount;
- double diff = _planMaxNum - _realQuantity;
+ PlanMaxNum = orderPlan.OrderAmount;//显示SAP订单数,而不是拆分订单计划数
+ RealQuantity = orderPlan.CompleteAmount;
+ double diff = orderPlan.OrderAmount - RealQuantity;
DiffQuantity = int.Parse(diff.ToString());
//CompletionRate = (_realQuantity/_planMaxNum).ToString("0%");
- CompletionRate = (_realQuantity / _planMaxNum);
+ CompletionRate = double.Parse((RealQuantity / orderPlan.OrderAmount).ToString());
}
else
{
@@ -778,7 +790,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
{
//读取入到配置文件中
var queryExec = appConfig.queryExec;
- var model = list.FirstOrDefault(d => d.ID == int.Parse(queryExec));
+ var model = selectList.FirstOrDefault(d => d.ID == int.Parse(queryExec));
return model;
}
#endregion
@@ -830,6 +842,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
var column = new ColumnSeries();
column.DataLabels = true;
column.Title = "前板";
+ column.ScalesYAt = 0;
column.Values = hourAchievement1;
column.Foreground = Brushes.White;
column.FontSize = 18;
@@ -840,7 +853,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
{
DataLabels = true,
Title = "后板",
- Values = hourAchievement2,
+ ScalesYAt = 0,
+ Values = hourAchievement2,
Fill = new SolidColorBrush(Color.FromRgb(15, 209, 226)),
Foreground = Brushes.CadetBlue,
FontSize = 18
@@ -852,7 +866,6 @@ namespace Aucma.Core.SheetMetal.ViewModels
}
#endregion
-
#region 更新小时产量统计
///
/// 更新小时产量统计
@@ -882,7 +895,6 @@ namespace Aucma.Core.SheetMetal.ViewModels
}
#endregion
-
#region 刷新物料型号统计
///
/// 刷新物料型号统计
@@ -914,6 +926,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
var column2 = new ColumnSeries();
column2.DataLabels = true;
column2.Title = "前板";
+ column2.ScalesYAt = 0;
column2.Values = achievement1;
column2.Foreground = Brushes.White;
column2.FontSize = 18;
@@ -924,7 +937,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
DataLabels = true,
Title = "后板",
Values = achievement2,
- Fill = new SolidColorBrush(Color.FromRgb(15, 209, 226)),
+ ScalesYAt = 0,
+ Fill = new SolidColorBrush(Color.FromRgb(15, 209, 226)),
Foreground = Brushes.White,
FontSize = 18
});
@@ -935,7 +949,6 @@ namespace Aucma.Core.SheetMetal.ViewModels
}
#endregion
-
#region 刷新物料型号统计
///
/// 刷新物料型号统计
@@ -993,63 +1006,86 @@ namespace Aucma.Core.SheetMetal.ViewModels
public CurrentTeamTimeView GetTeamHour()
{
- List obj = _sysUserInfoServices.GetTeamData().Result;
- if (obj != null)
+ try
+ {
+ List obj = _sysUserInfoServices.GetTeamData().Result;
+ if (obj != null)
+ {
+ CurrentTeamTimeView view = new CurrentTeamTimeView();
+ view.TeamName = obj.FirstOrDefault(d => d.Seq == 1).TeamName;
+ view.StartTime = obj.Min(d => d.StartTime);
+ view.EndTime = obj.Max(d => d.EndTime);
+ return view;
+ }
+ }
+ catch (Exception ex)
{
- CurrentTeamTimeView view = new CurrentTeamTimeView();
- view.TeamName = obj.FirstOrDefault(d => d.Seq == 1).TeamName;
- view.StartTime = obj.Min(d => d.StartTime);
- view.EndTime = obj.Max(d => d.EndTime);
- return view;
+ log.Error($"获取当前班组时间异常:{ex.Message}");
}
return null;
}
#endregion
-
+ #region PLC存储的当前正在执行的前后板计划编号
public string GetSidePlanCode(PlcModel obj)
{
bool flag = true;
string planCode = string.Empty;
- do
+ try
{
-
- byte[] info = obj.plc.Read("D6030", 59);
-
- if (info == null)
+ do
{
- Thread.Sleep(1000);
- continue;
- }
- //计划编号
- planCode = Encoding.ASCII.GetString(info.Skip(0).Take(20).ToArray()).Replace("\0", "").Trim();
- if (!string.IsNullOrEmpty(planCode)) flag = false;
- } while (flag);
+ byte[] info = obj.plc.Read("D6030", 59);
+
+ if (info == null)
+ {
+ Thread.Sleep(1000);
+ continue;
+ }
+
+ //计划编号
+ planCode = Encoding.ASCII.GetString(info.Skip(0).Take(20).ToArray()).Replace("\0", "").Trim();
+ if (!string.IsNullOrEmpty(planCode)) flag = false;
+ } while (flag);
+ }
+ catch (Exception ex)
+ {
+ log.Error($"获取前板传入的计划编号:{ex.Message}");
+ }
return planCode;
}
public string GetBackPlanCode(PlcModel obj)
{
- bool flag = true;
string planCode = string.Empty;
- do
+ try
{
-
- byte[] info = obj.plc.Read("D4030", 59);
-
- if (info == null)
+ bool flag = true;
+
+ do
{
- Thread.Sleep(1000);
- continue;
- }
+ byte[] info = obj.plc.Read("D4030", 59);
+
+ if (info == null)
+ {
+ Thread.Sleep(1000);
+ continue;
+ }
- //计划编号
- planCode = Encoding.ASCII.GetString(info.Skip(0).Take(20).ToArray()).Replace("\0", "").Trim();
- if (!string.IsNullOrEmpty(planCode)) flag = false;
- } while (flag);
+ //计划编号
+ planCode = Encoding.ASCII.GetString(info.Skip(0).Take(20).ToArray()).Replace("\0", "").Trim();
+ if (!string.IsNullOrEmpty(planCode)) flag = false;
+ } while (flag);
+
+ }
+ catch (Exception ex)
+ {
+ log.Error($"获取后板传入的计划编号:{ex.Message}");
+ }
return planCode;
- }
+ }
+ #endregion
}
}
diff --git a/Aucma.Core.SheetMetal/ViewModels/LogPageViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/LogPageViewModel.cs
index bc312a5d..47f0d91f 100644
--- a/Aucma.Core.SheetMetal/ViewModels/LogPageViewModel.cs
+++ b/Aucma.Core.SheetMetal/ViewModels/LogPageViewModel.cs
@@ -12,14 +12,14 @@ using System.Threading.Tasks;
using System.Windows.Documents;
using Admin.Core.Tasks;
using Aucma.Core.SheetMetal.Business;
+using Aucma.Core.SheetMetal.Models;
namespace Aucma.Core.SheetMetal.ViewModels
{
public class LogPageViewModel : ObservableObject
{
- private ObservableCollection listItems = new ObservableCollection();
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(LogPageViewModel));
-
+ private ObservableCollection listItems = new ObservableCollection();
public LogPageViewModel()
{
SheetMetalPlanTaskHandle.RefreshExecInfoEvent += PrintMessageToListBox;
@@ -28,8 +28,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
///
/// LisBox数据模板
///
- private IEnumerable logInfoListBox;
- public IEnumerable LogInfoListBox
+ private IEnumerable logInfoListBox;
+ public IEnumerable LogInfoListBox
{
get => logInfoListBox;
set => SetProperty(ref logInfoListBox, value);
@@ -39,14 +39,19 @@ namespace Aucma.Core.SheetMetal.ViewModels
/// listBox绑定日志
///
///
- private void PrintMessageToListBox(string message)
+ /// Red or White
+ private void PrintMessageToListBox(string message, string color)
{
try
{
- listItems.Add($"{DateTime.Now.ToString("HH:mm:ss")}==>{message}");
-
- LogInfoListBox = listItems.OrderByDescending(x => x);
-
+ System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
+ {
+ string content = $"{DateTime.Now.ToString("HH:mm:ss")}==>{message}";
+ ListBoxDataView view = new ListBoxDataView { Content = content, Color = color };
+ //listItems.Add(view);
+ listItems.Insert(0, view);
+ LogInfoListBox = listItems;
+ }));
}
catch (Exception ex)
{
@@ -54,5 +59,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
}
}
+
+ public ObservableCollection Items { get; set; }
}
+
}
diff --git a/Aucma.Core.SheetMetal/ViewModels/MaterialStatisticsViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/MaterialStatisticsViewModel.cs
index 64ac7697..2e6b5467 100644
--- a/Aucma.Core.SheetMetal/ViewModels/MaterialStatisticsViewModel.cs
+++ b/Aucma.Core.SheetMetal/ViewModels/MaterialStatisticsViewModel.cs
@@ -4,22 +4,31 @@ using Admin.Core.Model;
using Admin.Core.Service;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
+using LiveCharts;
+using LiveCharts.Defaults;
+using LiveCharts.Wpf;
using Microsoft.Extensions.DependencyInjection;
+using Pipelines.Sockets.Unofficial;
+using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
+using System.Windows.Media;
namespace Aucma.Core.SheetMetal.ViewModels
{
public partial class MaterialStatisticsViewModel : ObservableObject
{
private readonly IBaseSpaceInfoServices _baseSpaceInfoServices;
+ private readonly ISysUserInfoServices _sysUserInfoServices;
public MaterialStatisticsViewModel()
{
_baseSpaceInfoServices = App.ServiceProvider.GetService();
+ _sysUserInfoServices = App.ServiceProvider.GetService();
Refresh();
+
}
#region 刷新
@@ -79,6 +88,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
if (string.IsNullOrEmpty(item.MaterialType)) continue;
FoamBeforeMaterialStockDataGrid.Add(new BaseSpaceInfo() { MaterialType = item.MaterialType, SpaceStock = item.SpaceStock });
}
+ //夹具状态
+ RefreshModeStatus();
}
#endregion
@@ -133,5 +144,77 @@ namespace Aucma.Core.SheetMetal.ViewModels
set => SetProperty(ref foamBeforeMaterialStockDataGrid, value);
}
#endregion
+
+
+ #region 刷新夹具统计
+ ///
+ /// 刷新夹具统计
+ ///
+ private void RefreshModeStatus()
+ {
+ App.Current.Dispatcher.Invoke((Action)(async () =>
+ {
+ var modeStatus = await _sysUserInfoServices.StatisticalModelStatus();
+
+ if (modeStatus != null)
+ {
+ if (Achievement.Count != 0) Achievement.Clear();
+
+ ModeTypeList = new List();
+ ChartValues achievement = new ChartValues();
+ int hour = 0;
+ foreach (var item in modeStatus)
+ {
+ achievement.Add(Convert.ToInt32(item.YValue));
+ ModeTypeList.Add(item.XValue);
+ hour++;
+ }
+ #region 按夹具状态统计
+
+ Achievement.Add(new ColumnSeries
+ {
+ DataLabels = true,
+ Title = "夹具状态",
+ ScalesYAt = 0,
+ Values = achievement,
+ Fill = new SolidColorBrush(Color.FromRgb(15, 209, 226)),
+ Foreground = Brushes.CadetBlue,
+ FontSize = 18
+ });
+
+ #endregion
+ }
+ }));
+ }
+ #endregion
+
+
+ #region 夹具状态统计
+
+ #region 夹具状态统计
+ ///
+ /// 夹具状态统计
+ ///
+ private List modeTypeList;
+
+ public List ModeTypeList
+ {
+ get { return modeTypeList; }
+ set { modeTypeList = value; }
+ }
+ #endregion
+
+ ///
+ /// 夹具状态统计
+ ///
+ private SeriesCollection achievement = new SeriesCollection();
+
+ public SeriesCollection Achievement
+ {
+ get { return achievement; }
+ set { achievement = value; }
+ }
+
+ #endregion
}
}
diff --git a/Aucma.Core.SheetMetal/ViewModels/SplitPlanViewModel.cs b/Aucma.Core.SheetMetal/ViewModels/SplitPlanViewModel.cs
index cb88e4a0..cad13104 100644
--- a/Aucma.Core.SheetMetal/ViewModels/SplitPlanViewModel.cs
+++ b/Aucma.Core.SheetMetal/ViewModels/SplitPlanViewModel.cs
@@ -16,99 +16,105 @@ using Castle.Core.Internal;
using CommunityToolkit.Mvvm.Messaging;
using Aucma.Core.SheetMetal.Views;
using Aucma.Core.SheetMetal.Common;
-using System.Windows.Input;
using Admin.Core.Common;
-using System.Drawing.Drawing2D;
-using Aucma.Core.SheetMetal.Business;
-using Aucma.Core.HwPLc;
-using Admin.Core.Service;
namespace Aucma.Core.SheetMetal.ViewModels
{
public partial class SplitPlanViewModel : ObservableObject
{
-
-
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(SplitPlanViewModel));
protected readonly IProductPlanInfoServices? _productPlanInfoServices;
protected readonly IExecutePlanInfoServices? _executePlanInfoServices;
- private AppConfigHelper appConfig = new AppConfigHelper();
-
+ private AppConfigHelper appConfig = new AppConfigHelper();//读取配置文件保存的查询内容
+
+ #region 构造函数
public SplitPlanViewModel()
{
_productPlanInfoServices = App.ServiceProvider.GetService();
_executePlanInfoServices = App.ServiceProvider.GetService();
Task.WaitAll(LoadData());
//加载快捷方式
- SaveSearchCriteria();
+ SaveSearchCriteria();
WeakReferenceMessenger.Default.Register(this, SaveSearchCriteria);
_radioButtonStatus = 1;
- }
+ }
+ #endregion
#region 加载DataGrid数据
private async Task LoadData()
{
- MaterialDataGrid.Clear();
- int i = 1;
- string station = Appsettings.app("StationInfo", "StationCode");
- var execList = _executePlanInfoServices.QuerySheetMetalPlanData(station);
- if (execList == null) return;
- foreach (var item in execList)
+ try
{
- 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()
+ MaterialDataGrid.Clear();
+ int i = 1;
+ string station = Appsettings.app("StationInfo", "StationCode");
+ var execList = _executePlanInfoServices.QuerySheetMetalPlanData(station);
+ if (execList == null) return;
+ foreach (var item in execList)
{
- 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,
- MaterialSpecificatons = item.MaterialSpecificatons,
- StartDate = item.BeginTime
- });
- i++;
- }
+ 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,
+ OrderCode = item.OrderCode,
+ MaterialCode = item.MaterialCode,
+ MaterialName = item.MaterialName,
+ PlanAmount = item.PlanAmount,
+ ResidueAmount = item.PlanAmount - item.CompleteAmount,
+ SpliteResidueAmount = item.PlanAmount - residue,
+ MaterialSpecificatons = item.MaterialSpecificatons,
+ CompleteAmount = item.CompleteAmount,
+ StartDate = item.BeginTime
+ });
+ i++;
+ }
- await Task.CompletedTask;
+ }
+ catch (Exception ex)
+ {
+ log.Error($"初始化查询:{ex.Message}");
+ }
+ await Task.CompletedTask;
}
private async Task LoadData(string obj)
{
- string station = Appsettings.app("StationInfo", "StationCode");
- MaterialDataGrid.Clear();
- int i = 1;
- //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)
+ try
{
- 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()
+ string station = Appsettings.app("StationInfo", "StationCode");
+ MaterialDataGrid.Clear();
+ int i = 1;
+ 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)
{
- 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,
- MaterialSpecificatons = item.MaterialSpecificatons,
- StartDate = item.BeginTime
- });
- i++;
+ 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,
+ MaterialSpecificatons = item.MaterialSpecificatons,
+ StartDate = item.BeginTime
+ });
+ i++;
+ }
+ }
+ catch (Exception ex)
+ {
+ log.Error($"根据搜索条件查询:{ex.Message}");
}
await Task.CompletedTask;
}
diff --git a/Aucma.Core.SheetMetal/Views/IndexPageView.xaml b/Aucma.Core.SheetMetal/Views/IndexPageView.xaml
index c4e7cc01..0f61ea80 100644
--- a/Aucma.Core.SheetMetal/Views/IndexPageView.xaml
+++ b/Aucma.Core.SheetMetal/Views/IndexPageView.xaml
@@ -254,7 +254,7 @@
-
+
@@ -269,7 +269,7 @@
-
+
@@ -312,7 +312,7 @@
-
+
@@ -385,7 +385,7 @@
-
+
diff --git a/Aucma.Core.SheetMetal/Views/LogPageView.xaml b/Aucma.Core.SheetMetal/Views/LogPageView.xaml
index e641d04b..030479a7 100644
--- a/Aucma.Core.SheetMetal/Views/LogPageView.xaml
+++ b/Aucma.Core.SheetMetal/Views/LogPageView.xaml
@@ -7,6 +7,7 @@
mc:Ignorable="d" Background="#1152AC" FontFamily="Microsoft YaHei"
d:DesignHeight="450" d:DesignWidth="800"
>
+
@@ -18,7 +19,24 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Aucma.Core.SheetMetal/Views/LogPageView.xaml.cs b/Aucma.Core.SheetMetal/Views/LogPageView.xaml.cs
index 9cf94ebb..45a62011 100644
--- a/Aucma.Core.SheetMetal/Views/LogPageView.xaml.cs
+++ b/Aucma.Core.SheetMetal/Views/LogPageView.xaml.cs
@@ -26,5 +26,7 @@ namespace Aucma.Core.SheetMetal.Views
InitializeComponent();
this.DataContext = new LogPageViewModel();
}
+
+
}
}
diff --git a/Aucma.Core.SheetMetal/Views/MaterialStatisticsView.xaml b/Aucma.Core.SheetMetal/Views/MaterialStatisticsView.xaml
index 1c095f78..f0566df4 100644
--- a/Aucma.Core.SheetMetal/Views/MaterialStatisticsView.xaml
+++ b/Aucma.Core.SheetMetal/Views/MaterialStatisticsView.xaml
@@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
xmlns:local="clr-namespace:Aucma.Core.SheetMetal.Views"
mc:Ignorable="d" Background="#1152AC" FontFamily="Microsoft YaHei"
Title="物料库存统计" Height="650" Width="1000" Name="window" WindowStartupLocation="CenterScreen"
@@ -185,13 +186,35 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/Aucma.Core.SheetMetal/Views/QuantityIssuedView.xaml b/Aucma.Core.SheetMetal/Views/QuantityIssuedView.xaml
index 65551da5..81b9ba2b 100644
--- a/Aucma.Core.SheetMetal/Views/QuantityIssuedView.xaml
+++ b/Aucma.Core.SheetMetal/Views/QuantityIssuedView.xaml
@@ -10,6 +10,7 @@
Title="下达数量"
Height="500" Width="700" Name="window"
ResizeMode="NoResize"
+ WindowStartupLocation="CenterScreen"
Topmost="False">
@@ -97,7 +98,7 @@
-
+
diff --git a/Aucma.Core.SheetMetal/Views/SplitPlanView.xaml b/Aucma.Core.SheetMetal/Views/SplitPlanView.xaml
index 0d12d1f8..a39e78fc 100644
--- a/Aucma.Core.SheetMetal/Views/SplitPlanView.xaml
+++ b/Aucma.Core.SheetMetal/Views/SplitPlanView.xaml
@@ -6,7 +6,7 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Background="#1152AC"
- Title="计划维护" FontFamily="Microsoft YaHei" Height="800" Width="1000"
+ Title="计划维护" FontFamily="Microsoft YaHei" Height="800" Width="1100"
d:DesignHeight="800" WindowStartupLocation="CenterScreen"
d:DesignWidth="1500" ResizeMode="NoResize" Topmost="False" >
@@ -239,7 +239,7 @@
-
+
diff --git a/Aucma.Core.SheetMetal/appsettings.json b/Aucma.Core.SheetMetal/appsettings.json
index c926d2a4..369a633d 100644
--- a/Aucma.Core.SheetMetal/appsettings.json
+++ b/Aucma.Core.SheetMetal/appsettings.json
@@ -136,7 +136,7 @@
"PlcType": "Melsec",
"Enabled": true,
"IP": "10.10.91.6",
- "Port": 5553
+ "Port": 5552
}
]
}