修改钣金功能

dev
liulb@mesnac.com 1 year ago
parent bff3520110
commit ea831bbed6

@ -2356,6 +2356,16 @@
产品简码 产品简码
</summary> </summary>
</member> </member>
<member name="P:Admin.Core.Model.ModeStatusView.XValue">
<summary>
夹具型号
</summary>
</member>
<member name="P:Admin.Core.Model.ModeStatusView.YValue">
<summary>
y
</summary>
</member>
<member name="T:Admin.Core.Model.OffLineInfo"> <member name="T:Admin.Core.Model.OffLineInfo">
<summary> <summary>
条码下线信息记录 条码下线信息记录

@ -1,3 +1,3 @@
is_global = true is_global = true
build_property.RootNamespace = Admin.Core.FrameWork 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\

@ -40,5 +40,14 @@ namespace Admin.Core.IRepository
/// <param name="productLineCode"></param> /// <param name="productLineCode"></param>
/// <returns></returns> /// <returns></returns>
Task<List<SheetMetaHourDataView>> GetSheetMetaHourData(string productLineCode); Task<List<SheetMetaHourDataView>> GetSheetMetaHourData(string productLineCode);
/// <summary>
/// 当前订单执行第一次数据采集时候更新SAP计划
/// </summary>
int UpdateSapPlan(string sapCode);
/// <summary>
/// 获取夹具状态
/// </summary>
/// <returns></returns>
Task<List<ModeStatusView>> StatisticalModelStatus();
} }
} }

@ -1,5 +1,6 @@
using Admin.Core.IService; using Admin.Core.IService;
using Admin.Core.Model; using Admin.Core.Model;
using Admin.Core.Model.Model_New;
using Admin.Core.Model.ViewModels; using Admin.Core.Model.ViewModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -50,5 +51,16 @@ namespace Admin.Core.IService
/// <returns></returns> /// <returns></returns>
Task<List<SheetMetaHourDataView>> GetSheetMetaHourData(string productLineCode); Task<List<SheetMetaHourDataView>> GetSheetMetaHourData(string productLineCode);
/// <summary>
/// 钣金第一次执行更新日历表
/// </summary>
/// <param name="sapCode"></param>
/// <returns></returns>
int UpdateSapPlan(string sapCode);
/// <summary>
/// 夹具状态
/// </summary>
/// <returns></returns>
Task<List<ModeStatusView>> StatisticalModelStatus();
} }
} }

@ -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
{
/// <summary>
/// 夹具型号
/// </summary>
[SugarColumn(ColumnName = "X_VALUE")]
public string XValue { get; set; }
/// <summary>
/// y
/// </summary>
[SugarColumn(ColumnName = "Y_VALUE")]
public string YValue { get; set; }
}
}

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules = build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.RealTimeService 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\

@ -89,37 +89,35 @@ namespace Admin.Core.Repository
/// <returns></returns> /// <returns></returns>
public List<SheetMetaPlanInfoView> QuerySheetMetalPlanData(string stationCode) public List<SheetMetaPlanInfoView> QuerySheetMetalPlanData(string stationCode)
{ {
string sql = $@"SELECT string sql = $@"select o.OBJ_ID,
P.OBJ_ID, P.PLAN_CODE,
P.PLAN_CODE, P.ORDER_CODE,
P.ORDER_CODE, o.MATERIAL_CODE,
o.MATERIAL_CODE, o.MATERIAL_NAME,
o.MATERIAL_NAME, m.MATERIAL_SPECIFICATIONS,
m.MATERIAL_SPECIFICATIONS, P.PRODUCTLINE_CODE,
P.PRODUCTLINE_CODE, P.PLAN_AMOUNT,
P.PLAN_AMOUNT, P.COMPLETE_AMOUNT,
P.COMPLETE_AMOUNT, P.BEGIN_TIME,
P.BEGIN_TIME, P.END_TIME
P.END_TIME FROM C##AUCMA_MES.PRODUCT_PLANINFO p INNER JOIN
FROM C##AUCMA_MES.PRODUCT_PLANINFO p INNER JOIN C##AUCMA_MES.BASE_ORDERINFO o ON o.ORDER_CODE = p.ORDER_CODE
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 INNER JOIN C##AUCMA_MES.BASE_MATERIALINFO m ON o.MATERIAL_CODE = m.MATERIAL_CODE where p.PRODUCTLINE_CODE='{stationCode}'
WHERE group by o.OBJ_ID,
p.ORDER_CODE IN ( SELECT ORDER_CODE FROM C##AUCMA_MES.PRODUCT_PLANINFO p WHERE p.PRODUCTLINE_CODE = '{stationCode}' ) P.PLAN_CODE,
group by P.OBJ_ID, P.ORDER_CODE,
P.PLAN_CODE, o.MATERIAL_CODE,
P.ORDER_CODE, o.MATERIAL_NAME,
o.MATERIAL_CODE, m.MATERIAL_SPECIFICATIONS,
o.MATERIAL_NAME, P.PRODUCTLINE_CODE,
m.MATERIAL_SPECIFICATIONS, P.PLAN_AMOUNT,
P.PRODUCTLINE_CODE, P.COMPLETE_AMOUNT,
P.PLAN_AMOUNT, P.BEGIN_TIME,
P.COMPLETE_AMOUNT, P.END_TIME
P.BEGIN_TIME, order by o.OBJ_ID";
P.END_TIME
order by OBJ_ID";
return Db.CopyNew().SqlQueryable<SheetMetaPlanInfoView>(sql).Where("PRODUCTLINE_CODE = @stationCode", new { stationCode = stationCode }).ToList(); return Db.CopyNew().SqlQueryable<SheetMetaPlanInfoView>(sql).ToList();
} }
/// <summary> /// <summary>
/// 获取钣金下发的计划 /// 获取钣金下发的计划

@ -7,6 +7,7 @@ using System.Collections.Generic;
using System; using System;
using Microsoft.IdentityModel.Logging; using Microsoft.IdentityModel.Logging;
using System.Linq; using System.Linq;
using SqlSugar;
namespace Admin.Core.Repository namespace Admin.Core.Repository
{ {
@ -104,13 +105,33 @@ namespace Admin.Core.Repository
#endregion #endregion
#region 当前订单执行第一次数据采集时候更新SAP计划
/// <summary> /// <summary>
/// /更新计划表数据 /// 当前订单执行第一次数据采集时候更新SAP计划
/// </summary> /// </summary>
//public void UpdateSAPPlan(string PlanCode) public int UpdateSapPlan(string sapCode)
//{ {
// string sql = "UPDATE PRODUCT_CALENDAR_INFO SET IS_SCHEDULING = 0 WHERE SAP_PLAN_CODE = '11227552'"; var parameters = new SugarParameter[]
// return await Db.CopyNew().Ado.ExecuteCommandAsync(sql); {
//} 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 统计夹具型号状态
/// <summary>
/// 统计夹具型号状态
/// </summary>
public async Task<List<ModeStatusView>> StatisticalModelStatus()
{
string sql = "select * from table (scada_xk_fp_01('') )";
return await Db.CopyNew().Ado.SqlQueryAsync<ModeStatusView>(sql);
}
#endregion
} }
} }

@ -2,6 +2,7 @@
using Admin.Core.IRepository; using Admin.Core.IRepository;
using Admin.Core.IService; using Admin.Core.IService;
using Admin.Core.Model; using Admin.Core.Model;
using Admin.Core.Model.Model_New;
using Admin.Core.Model.ViewModels; using Admin.Core.Model.ViewModels;
using Admin.Core.Service; using Admin.Core.Service;
using log4net; using log4net;
@ -9,6 +10,7 @@ using NPOI.SS.Formula.Functions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection.Emit;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Admin.Core.IService namespace Admin.Core.IService
@ -83,5 +85,19 @@ namespace Admin.Core.IService
{ {
return await _sysUserInfoRepository.GetSheetMetaHourData(productLineCode); return await _sysUserInfoRepository.GetSheetMetaHourData(productLineCode);
} }
public int UpdateSapPlan(string sapCode)
{
return _sysUserInfoRepository.UpdateSapPlan(sapCode);
}
/// <summary>
/// 获取夹具状态
/// </summary>
/// <returns></returns>
public Task<List<ModeStatusView>> StatisticalModelStatus()
{
return _sysUserInfoRepository.StatisticalModelStatus();
}
} }
} }

@ -76,7 +76,7 @@ namespace Aucma.Core.HwPLc
/// <returns></returns> /// <returns></returns>
public bool Connect(string iP, int port) public bool Connect(string iP, int port)
{ {
melsecMcNet.IpAddress = iP;//正式环境开启 //melsecMcNet.IpAddress = iP;//正式环境开启
melsecMcNet.Port = port; melsecMcNet.Port = port;
// 如果网络不太理想,配置了两个端口,一个有问题,立即切换另一个的话,可以配置如下的代码 // 如果网络不太理想,配置了两个端口,一个有问题,立即切换另一个的话,可以配置如下的代码

@ -10,10 +10,13 @@ using System.Windows.Documents;
using Admin.Core.Common; using Admin.Core.Common;
using Admin.Core.IService; using Admin.Core.IService;
using Admin.Core.Model; using Admin.Core.Model;
using Admin.Core.Model.Model_New;
using Admin.Core.Model.ViewModels; using Admin.Core.Model.ViewModels;
using Admin.Core.Service; using Admin.Core.Service;
using Aucma.Core.HwPLc; using Aucma.Core.HwPLc;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using NetTaste;
using NPOI.SS.Formula.Functions;
using SqlSugar; using SqlSugar;
namespace Aucma.Core.SheetMetal.Business; namespace Aucma.Core.SheetMetal.Business;
@ -61,7 +64,7 @@ public class SheetMetalPlanTaskHandle
/// <summary> /// <summary>
/// 刷新当前正在执行的计划 /// 刷新当前正在执行的计划
/// </summary> /// </summary>
public delegate void RefreshExecInfo(string message); public delegate void RefreshExecInfo(string message,string color);
public static event RefreshExecInfo RefreshExecInfoEvent; public static event RefreshExecInfo RefreshExecInfoEvent;
#endregion #endregion
@ -70,15 +73,19 @@ public class SheetMetalPlanTaskHandle
protected readonly IRecordSidePanelComplateServices _sidePanelComplateServices; protected readonly IRecordSidePanelComplateServices _sidePanelComplateServices;
protected readonly IRecordBackPanelComplateServices _backPanelComplateServices; protected readonly IRecordBackPanelComplateServices _backPanelComplateServices;
protected readonly IProductPlanInfoServices? _productPlanInfoServices; protected readonly IProductPlanInfoServices? _productPlanInfoServices;
protected readonly ISysUserInfoServices? _sysUserInfoServices;
protected readonly IMaterialCompletionServices? _materialCompletionServices;
public HwPLc.PlcModel plc1 = null; public HwPLc.PlcModel plc1 = null;
public SheetMetalPlanTaskHandle() public SheetMetalPlanTaskHandle()
{ {
_executePlanInfoServices = _executePlanInfoServices =App.ServiceProvider.GetService<IExecutePlanInfoServices>();
App.ServiceProvider.GetService<IExecutePlanInfoServices>();
_sidePanelComplateServices = App.ServiceProvider.GetService<IRecordSidePanelComplateServices>(); _sidePanelComplateServices = App.ServiceProvider.GetService<IRecordSidePanelComplateServices>();
_backPanelComplateServices = App.ServiceProvider.GetService<IRecordBackPanelComplateServices>(); _backPanelComplateServices = App.ServiceProvider.GetService<IRecordBackPanelComplateServices>();
_productPlanInfoServices = App.ServiceProvider.GetService<IProductPlanInfoServices>(); _productPlanInfoServices = App.ServiceProvider.GetService<IProductPlanInfoServices>();
_backPanelComplateServices = App.ServiceProvider.GetService<IRecordBackPanelComplateServices>();
_sysUserInfoServices = App.ServiceProvider.GetService<ISysUserInfoServices>();
_materialCompletionServices = App.ServiceProvider.GetService<IMaterialCompletionServices>();
} }
@ -109,6 +116,8 @@ public class SheetMetalPlanTaskHandle
if (planInfo == null) continue; if (planInfo == null) continue;
if (planInfo.PlanType == 3 || planInfo.PlanType == 1)//如果为3或者为1 后板计划单独下发 以前板完成为主 if (planInfo.PlanType == 3 || planInfo.PlanType == 1)//如果为3或者为1 后板计划单独下发 以前板完成为主
{ {
//获取设置的型号查询对应的型号,下发计划
SendPlanTaskToBackPanel(planInfo, obj_backPanel); SendPlanTaskToBackPanel(planInfo, obj_backPanel);
UpdateBackPanelPlanTaskByComplate(planInfo); UpdateBackPanelPlanTaskByComplate(planInfo);
@ -183,7 +192,7 @@ public class SheetMetalPlanTaskHandle
obj_sidePanel.plc.WriteInt32("D6021", 1); obj_sidePanel.plc.WriteInt32("D6021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>计划【{planInfo.TaskCode}】已下发,等待前板设备应答。。。。。。"); Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>计划【{planInfo.TaskCode}】已下发,等待前板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke($"计划【{planInfo.TaskCode}】已下发,等待前板设备应答。。。。。。"); RefreshExecInfoEvent?.Invoke($"计划【{planInfo.TaskCode}】已下发,等待前板设备应答。。。。。。","White");
#region PLC反馈信号逻辑处理 #region PLC反馈信号逻辑处理
//循环读取PLC应答信号PLC应答后复位应答信号、更新计划状态为执行中 //循环读取PLC应答信号PLC应答后复位应答信号、更新计划状态为执行中
bool isFlag = true; bool isFlag = true;
@ -195,7 +204,7 @@ public class SheetMetalPlanTaskHandle
{ {
obj_sidePanel.plc.WriteInt32("D6021", 0); obj_sidePanel.plc.WriteInt32("D6021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>计划【{planInfo.TaskCode}】,收到前板设备应答信号,复位应答地址"); Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>计划【{planInfo.TaskCode}】,收到前板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke($"计划【{planInfo.TaskCode}】,收到前板板设备应答信号,复位应答地址"); RefreshExecInfoEvent?.Invoke($"计划【{planInfo.TaskCode}】,收到前板板设备应答信号,复位应答地址", "White");
startTime=DateTime.Now; startTime=DateTime.Now;
isFlag = false; isFlag = false;
} }
@ -255,7 +264,7 @@ public class SheetMetalPlanTaskHandle
obj_backPanel.plc.WriteInt32("D4021", 1); obj_backPanel.plc.WriteInt32("D4021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>计划【{planInfo.TaskCode}】已下发,等待背板设备应答。。。。。。"); Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>计划【{planInfo.TaskCode}】已下发,等待背板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke($"计划【{planInfo.TaskCode}】下发,等待背板设备应答。。。。。。"); RefreshExecInfoEvent?.Invoke($"计划【{planInfo.TaskCode}】下发,等待背板设备应答。。。。。。", "White");
#region PLC反馈信号逻辑处理 #region PLC反馈信号逻辑处理
//循环读取PLC应答信号PLC应答后复位应答信号、更新计划状态为执行中 //循环读取PLC应答信号PLC应答后复位应答信号、更新计划状态为执行中
bool isFlag = true; bool isFlag = true;
@ -267,7 +276,7 @@ public class SheetMetalPlanTaskHandle
{ {
obj_backPanel.plc.WriteInt32("D4021", 0); obj_backPanel.plc.WriteInt32("D4021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到背板板设备应答信号,复位应答地址"); Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到背板板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke($"收到背板板设备应答信号,复位应答地址"); RefreshExecInfoEvent?.Invoke($"收到背板板设备应答信号,复位应答地址", "White");
startTime = DateTime.Now; startTime = DateTime.Now;
isFlag = false; isFlag = false;
} }
@ -328,7 +337,7 @@ public class SheetMetalPlanTaskHandle
int sumBackPanelAmount = backPanelComplates.Sum(x => x.OutPutAmount); int sumBackPanelAmount = backPanelComplates.Sum(x => x.OutPutAmount);
Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}"); 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; int sumAmount = 0;
if (planInfo.PlanType == 1) if (planInfo.PlanType == 1)
@ -339,7 +348,6 @@ public class SheetMetalPlanTaskHandle
{ {
sumAmount = sumSidePanelAmount; sumAmount = sumSidePanelAmount;
planInfo.ExecuteStatus = 3; planInfo.ExecuteStatus = 3;
} }
if (sumSidePanelAmount < sumBackPanelAmount && sumBackPanelAmount == planInfo.PlanAmount) if (sumSidePanelAmount < sumBackPanelAmount && sumBackPanelAmount == planInfo.PlanAmount)
{ {
@ -420,7 +428,7 @@ public class SheetMetalPlanTaskHandle
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine($"计划任务信息更新异常:{ex.Message}"); Console.WriteLine($"计划任务信息更新异常:{ex.Message}");
RefreshExecInfoEvent?.Invoke($"计划任务信息更新异常:{ex.Message}"); RefreshExecInfoEvent?.Invoke($"计划任务信息更新异常:{ex.Message}", "Red");
} }
} }
/// <summary> /// <summary>
@ -446,7 +454,7 @@ public class SheetMetalPlanTaskHandle
int sumBackPanelAmount = backPanelComplates.Sum(x => x.OutPutAmount); int sumBackPanelAmount = backPanelComplates.Sum(x => x.OutPutAmount);
Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}"); 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; int sumAmount = 0;
@ -516,7 +524,7 @@ public class SheetMetalPlanTaskHandle
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine($"计划任务信息更新异常:{ex.Message}"); Console.WriteLine($"计划任务信息更新异常:{ex.Message}");
RefreshExecInfoEvent?.Invoke($"计划任务信息更新异常:{ex.Message}"); RefreshExecInfoEvent?.Invoke($"计划任务信息更新异常:{ex.Message}", "Red");
} }
} while (isComplate); } while (isComplate);
@ -534,74 +542,6 @@ public class SheetMetalPlanTaskHandle
#endregion #endregion
#region 更新计划列表数量
/// <summary>
/// 更新计划列表数量
/// </summary>
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 下发单个计划逻辑 #region 下发单个计划逻辑
@ -678,7 +618,7 @@ public class SheetMetalPlanTaskHandle
int sumBackPanelAmount = backPanelComplates.Sum(x => x.OutPutAmount); int sumBackPanelAmount = backPanelComplates.Sum(x => x.OutPutAmount);
Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};前板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}"); 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; int sumAmount = 0;
if (planInfo.PlanType == 1) if (planInfo.PlanType == 1)
@ -724,7 +664,7 @@ public class SheetMetalPlanTaskHandle
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine($"计划任务信息更新异常:{ex.Message}"); 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); obj_sidePanel.plc.WriteInt32("D6021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待前板设备应答。。。。。。"); Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待前板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke("等待前板设备应答......"); RefreshExecInfoEvent?.Invoke("等待前板设备应答......","Red");
//下发完成后读取PLC应答应答后复位应答信号 //下发完成后读取PLC应答应答后复位应答信号
#region PLC反馈信号逻辑处理 #region PLC反馈信号逻辑处理
@ -764,7 +704,7 @@ public class SheetMetalPlanTaskHandle
{ {
obj_sidePanel.plc.WriteInt32("D6021", 0); obj_sidePanel.plc.WriteInt32("D6021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到前板设备应答信号,复位应答地址"); Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到前板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke("收到前板设备应答信号,复位应答地址"); RefreshExecInfoEvent?.Invoke("收到前板设备应答信号,复位应答地址","White");
isFlag = false; isFlag = false;
} }
Thread.Sleep(2000); Thread.Sleep(2000);
@ -803,7 +743,7 @@ public class SheetMetalPlanTaskHandle
obj_backPanel.plc.WriteInt32("D4021", 1); obj_backPanel.plc.WriteInt32("D4021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待背板设备应答。。。。。。"); Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待背板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke($"等待背板设备应答。。。。。。"); RefreshExecInfoEvent?.Invoke($"等待背板设备应答。。。。。。", "White");
#region PLC反馈信号逻辑处理 #region PLC反馈信号逻辑处理
//循环读取PLC应答信号PLC应答后复位应答信号、更新计划状态为执行中 //循环读取PLC应答信号PLC应答后复位应答信号、更新计划状态为执行中
bool isFlag = true; bool isFlag = true;
@ -813,7 +753,7 @@ public class SheetMetalPlanTaskHandle
{ {
obj_backPanel.plc.WriteInt32("D4021", 0); obj_backPanel.plc.WriteInt32("D4021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到背板板设备应答信号,复位应答地址"); Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到背板板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke("收到背板板设备应答信号,复位应答地址"); RefreshExecInfoEvent?.Invoke("收到背板板设备应答信号,复位应答地址", "White");
isFlag = false; isFlag = false;
} }
Thread.Sleep(2000); Thread.Sleep(2000);
@ -870,7 +810,7 @@ public class SheetMetalPlanTaskHandle
obj_sidePanel.plc.WriteInt32("D6021", 1); obj_sidePanel.plc.WriteInt32("D6021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待前板设备应答。。。。。。"); Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待前板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke("等待前板设备应答......"); RefreshExecInfoEvent?.Invoke("等待前板设备应答......", "White");
//下发完成后读取PLC应答应答后复位应答信号 //下发完成后读取PLC应答应答后复位应答信号
#region PLC反馈信号逻辑处理 #region PLC反馈信号逻辑处理
@ -882,7 +822,7 @@ public class SheetMetalPlanTaskHandle
{ {
obj_sidePanel.plc.WriteInt32("D6021", 0); obj_sidePanel.plc.WriteInt32("D6021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到前板设备应答信号,复位应答地址"); Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到前板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke("收到前板设备应答信号......"); RefreshExecInfoEvent?.Invoke("收到前板设备应答信号......", "White");
isFlag = false; isFlag = false;
} }
Thread.Sleep(2000); 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); int productionBeat = short.Parse(bytesToHexStr(info.Skip(51).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
Console.WriteLine($"前板设备数据读取====>>>>当前计划:{planCode},物料编号:{materialCode},完成数量:{complateAmount},下线数量:{offLineAmount},设备状态:{deviceStatus},生产节拍:{productionBeat}"); 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() RecordSidePanelComplate sidePanelComplate = new RecordSidePanelComplate()
@ -1011,7 +951,7 @@ public class SheetMetalPlanTaskHandle
{ {
isFlag = false; isFlag = false;
Console.WriteLine($"前板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}"); 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) catch (Exception e)
{ {
Console.WriteLine($"读取前板设备完成数据异常:{e.Message}"); Console.WriteLine($"读取前板设备完成数据异常:{e.Message}");
RefreshExecInfoEvent?.Invoke($"读取前板设备完成数据异常:{e.Message}"); RefreshExecInfoEvent?.Invoke($"读取前板设备完成数据异常:{e.Message}", "Red");
} }
} while (isFlag); } while (isFlag);
@ -1078,7 +1018,7 @@ public class SheetMetalPlanTaskHandle
obj_backPanel.plc.WriteInt32("D4021", 1); obj_backPanel.plc.WriteInt32("D4021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待背板设备应答。。。。。。"); Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待背板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke($"等待背板设备应答。。。。。。"); RefreshExecInfoEvent?.Invoke($"等待背板设备应答。。。。。。", "White");
#region PLC反馈信号逻辑处理 #region PLC反馈信号逻辑处理
//循环读取PLC应答信号PLC应答后复位应答信号、更新计划状态为执行中 //循环读取PLC应答信号PLC应答后复位应答信号、更新计划状态为执行中
bool isFlag = true; bool isFlag = true;
@ -1089,7 +1029,7 @@ public class SheetMetalPlanTaskHandle
{ {
obj_backPanel.plc.WriteInt32("D4021", 0); obj_backPanel.plc.WriteInt32("D4021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到背板板设备应答信号,复位应答地址"); Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到背板板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke($"收到背板板设备应答信号,复位应答地址"); RefreshExecInfoEvent?.Invoke($"收到背板板设备应答信号,复位应答地址", "White");
isFlag = false; isFlag = false;
} }
Thread.Sleep(2000); 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); int productionBeat = short.Parse(bytesToHexStr(info.Skip(51).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
Console.WriteLine($"背板设备数据读取====>>>>当前计划:{planCode},物料编号:{materialCode},完成数量:{complateAmount},下线数量:{offLineAmount},设备状态:{deviceStatus},生产节拍:{productionBeat}"); 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() RecordBackPanelComplate backPanelComplate = new RecordBackPanelComplate()
{ {
@ -1215,7 +1155,7 @@ public class SheetMetalPlanTaskHandle
{ {
isFlag = false; isFlag = false;
Console.WriteLine($"背板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}"); 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) catch (Exception e)
{ {
Console.WriteLine($"读取背板设备完成数据异常:{e.Message}"); Console.WriteLine($"读取背板设备完成数据异常:{e.Message}");
RefreshExecInfoEvent?.Invoke($"背板⽣产计划下发异常:{e.Message}"); RefreshExecInfoEvent?.Invoke($"背板⽣产计划下发异常:{e.Message}", "Red");
} }
} }
@ -1271,9 +1211,92 @@ public class SheetMetalPlanTaskHandle
} }
} }
return returnStr; return returnStr;
} }
#endregion #endregion
#region 更新计划列表数量
/// <summary>
/// 更新计划列表数量
/// </summary>
public void UpdateComplatePlan()
{
string stationCode = Appsettings.app("StationInfo", "StationCode");
string productLineCode = Appsettings.app("StationInfo", "ProductLineCode");
List<ProductPlanInfo> pPlanInfoList = new List<ProductPlanInfo>();
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
} }

@ -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
{
/// <summary>
/// 颜色
/// </summary>
public string Color { get; set; }
/// <summary>
/// 内容
/// </summary>
public string Content { get; set; }
}
}

@ -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
}
}

@ -19,13 +19,11 @@ using Admin.Core.Common;
using LiveCharts.Defaults; using LiveCharts.Defaults;
using Aucma.Core.SheetMetal.Business; using Aucma.Core.SheetMetal.Business;
using Admin.Core.Model.ViewModels; using Admin.Core.Model.ViewModels;
using NPOI.SS.Formula.Functions;
using log4net; using log4net;
using Aucma.Core.HwPLc; using Aucma.Core.HwPLc;
using static Npgsql.Replication.PgOutput.Messages.RelationMessage;
using System.Text; using System.Text;
using System.Threading; 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 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 IExecutePlanInfoServices? _taskExecutionPlanInfoServices;
protected readonly IRecordBackPanelComplateServices _recordBackPanelComplateServices; protected readonly IRecordBackPanelComplateServices _recordBackPanelComplateServices;
protected readonly IRecordSidePanelComplateServices _recordSidePanelComplateServices; protected readonly IRecordSidePanelComplateServices _recordSidePanelComplateServices;
@ -41,8 +42,12 @@ namespace Aucma.Core.SheetMetal.ViewModels
protected readonly IBaseBomInfoServices _baseBomInfoServices; protected readonly IBaseBomInfoServices _baseBomInfoServices;
private readonly ISysUserInfoServices _sysUserInfoServices; private readonly ISysUserInfoServices _sysUserInfoServices;
private readonly IRecordInStoreServices _recordInstoreServices; private readonly IRecordInStoreServices _recordInstoreServices;
private AppConfigHelper appConfig = new AppConfigHelper(); private readonly IBaseOrderInfoServices _baseOrderInfoServices;
List<SelectModel> list = new List<SelectModel>() { new SelectModel() #endregion
#region 初始化下拉数据
private AppConfigHelper appConfig = new AppConfigHelper();//读取保存的文本数据
List<SelectModel> selectList = new List<SelectModel>() { new SelectModel()
{ {
ID=1, ID=1,
TypeName="手动" TypeName="手动"
@ -52,13 +57,18 @@ namespace Aucma.Core.SheetMetal.ViewModels
ID=2, ID=2,
TypeName="自动" TypeName="自动"
}}; }};
#endregion
#region 定义对象和定义字段
public Func<double, string> Formatter { get; set; } public Func<double, string> Formatter { get; set; }
public HwPLc.PlcModel obj = null; public HwPLc.PlcModel obj = null;
#endregion
#region 构造函数 #region 构造函数
public IndexPageViewModel() public IndexPageViewModel()
{ {
_stationName = Appsettings.app("StationInfo", "StationName");//工位名称 _stationName = Appsettings.app("StationInfo", "StationName");//工位名称
_baseOrderInfoServices = App.ServiceProvider.GetService<IBaseOrderInfoServices>();
_executePlanInfoServices = App.ServiceProvider.GetService<IExecutePlanInfoServices>(); _executePlanInfoServices = App.ServiceProvider.GetService<IExecutePlanInfoServices>();
_taskExecutionPlanInfoServices = App.ServiceProvider.GetService<IExecutePlanInfoServices>(); _taskExecutionPlanInfoServices = App.ServiceProvider.GetService<IExecutePlanInfoServices>();
_recordBackPanelComplateServices = App.ServiceProvider.GetService<IRecordBackPanelComplateServices>(); _recordBackPanelComplateServices = App.ServiceProvider.GetService<IRecordBackPanelComplateServices>();
@ -78,17 +88,19 @@ namespace Aucma.Core.SheetMetal.ViewModels
} }
#endregion #endregion
#region 更新前端数据
public Task RefreshChat() public Task RefreshChat()
{ {
RefreshHourAmountChart();//小时产量 RefreshHourAmountChart();//小时产量
RefreshMaterialChart();//型号产量 RefreshMaterialChart();//型号产量
return Task.CompletedTask; return Task.CompletedTask;
} }
#endregion
#region 下拉 #region 下拉
public void AddSelectData() public void AddSelectData()
{ {
foreach (var item in list) foreach (var item in selectList)
{ {
LocationSource.Add(item); LocationSource.Add(item);
} }
@ -268,22 +280,22 @@ namespace Aucma.Core.SheetMetal.ViewModels
#endregion #endregion
#region 刷新计划执行 #region 刷新计划执行
public void RefreshPlanShow(SheetMetaSendPlanInfoView execPlan) public async void RefreshPlanShow(SheetMetaSendPlanInfoView execPlan)
{ {
//更新首页显示信息 //更新首页显示信息
//ExecutePlanInfo execPlan = execList.SingleOrDefault(d => d.ExecuteStatus == 2); BaseOrderInfo orderPlan =await _baseOrderInfoServices.FirstAsync(d => d.OrderCode == execPlan.OrderCode);
if (execPlan != null) if (orderPlan != null)
{ {
OrderCode = execPlan.OrderCode; OrderCode = execPlan.OrderCode;
MesMOrderCode = execPlan.ProductPlanCode; MesMOrderCode = execPlan.ProductPlanCode;
ProductModel = execPlan.MaterialName; ProductModel = execPlan.MaterialName;
BeginTime = string.IsNullOrEmpty(execPlan.BeginTime)?"": execPlan.BeginTime.ToString(); BeginTime = string.IsNullOrEmpty(execPlan.BeginTime)?"": execPlan.BeginTime.ToString();
PlanMaxNum = PlanNum = execPlan.PlanAmount;//显示SAP订单数而不是拆分订单计划数 PlanMaxNum = orderPlan.OrderAmount;//显示SAP订单数而不是拆分订单计划数
RealQuantity = execPlan.CompleteAmount; RealQuantity = orderPlan.CompleteAmount;
double diff = _planMaxNum - _realQuantity; double diff = orderPlan.OrderAmount - RealQuantity;
DiffQuantity = int.Parse(diff.ToString()); DiffQuantity = int.Parse(diff.ToString());
//CompletionRate = (_realQuantity/_planMaxNum).ToString("0%"); //CompletionRate = (_realQuantity/_planMaxNum).ToString("0%");
CompletionRate = (_realQuantity / _planMaxNum); CompletionRate = double.Parse((RealQuantity / orderPlan.OrderAmount).ToString());
} }
else else
{ {
@ -778,7 +790,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
{ {
//读取入到配置文件中 //读取入到配置文件中
var queryExec = appConfig.queryExec; 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; return model;
} }
#endregion #endregion
@ -830,6 +842,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
var column = new ColumnSeries(); var column = new ColumnSeries();
column.DataLabels = true; column.DataLabels = true;
column.Title = "前板"; column.Title = "前板";
column.ScalesYAt = 0;
column.Values = hourAchievement1; column.Values = hourAchievement1;
column.Foreground = Brushes.White; column.Foreground = Brushes.White;
column.FontSize = 18; column.FontSize = 18;
@ -840,7 +853,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
{ {
DataLabels = true, DataLabels = true,
Title = "后板", Title = "后板",
Values = hourAchievement2, ScalesYAt = 0,
Values = hourAchievement2,
Fill = new SolidColorBrush(Color.FromRgb(15, 209, 226)), Fill = new SolidColorBrush(Color.FromRgb(15, 209, 226)),
Foreground = Brushes.CadetBlue, Foreground = Brushes.CadetBlue,
FontSize = 18 FontSize = 18
@ -852,7 +866,6 @@ namespace Aucma.Core.SheetMetal.ViewModels
} }
#endregion #endregion
#region 更新小时产量统计 #region 更新小时产量统计
/// <summary> /// <summary>
/// 更新小时产量统计 /// 更新小时产量统计
@ -882,7 +895,6 @@ namespace Aucma.Core.SheetMetal.ViewModels
} }
#endregion #endregion
#region 刷新物料型号统计 #region 刷新物料型号统计
/// <summary> /// <summary>
/// 刷新物料型号统计 /// 刷新物料型号统计
@ -914,6 +926,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
var column2 = new ColumnSeries(); var column2 = new ColumnSeries();
column2.DataLabels = true; column2.DataLabels = true;
column2.Title = "前板"; column2.Title = "前板";
column2.ScalesYAt = 0;
column2.Values = achievement1; column2.Values = achievement1;
column2.Foreground = Brushes.White; column2.Foreground = Brushes.White;
column2.FontSize = 18; column2.FontSize = 18;
@ -924,7 +937,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
DataLabels = true, DataLabels = true,
Title = "后板", Title = "后板",
Values = achievement2, Values = achievement2,
Fill = new SolidColorBrush(Color.FromRgb(15, 209, 226)), ScalesYAt = 0,
Fill = new SolidColorBrush(Color.FromRgb(15, 209, 226)),
Foreground = Brushes.White, Foreground = Brushes.White,
FontSize = 18 FontSize = 18
}); });
@ -935,7 +949,6 @@ namespace Aucma.Core.SheetMetal.ViewModels
} }
#endregion #endregion
#region 刷新物料型号统计 #region 刷新物料型号统计
/// <summary> /// <summary>
/// 刷新物料型号统计 /// 刷新物料型号统计
@ -993,63 +1006,86 @@ namespace Aucma.Core.SheetMetal.ViewModels
public CurrentTeamTimeView GetTeamHour() public CurrentTeamTimeView GetTeamHour()
{ {
List<CurrentTeamTimeView> obj = _sysUserInfoServices.GetTeamData().Result; try
if (obj != null) {
List<CurrentTeamTimeView> 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(); log.Error($"获取当前班组时间异常:{ex.Message}");
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;
} }
return null; return null;
} }
#endregion #endregion
#region PLC存储的当前正在执行的前后板计划编号
public string GetSidePlanCode(PlcModel obj) public string GetSidePlanCode(PlcModel obj)
{ {
bool flag = true; bool flag = true;
string planCode = string.Empty; string planCode = string.Empty;
do try
{ {
do
byte[] info = obj.plc.Read("D6030", 59);
if (info == null)
{ {
Thread.Sleep(1000);
continue;
}
//计划编号 byte[] info = obj.plc.Read("D6030", 59);
planCode = Encoding.ASCII.GetString(info.Skip(0).Take(20).ToArray()).Replace("\0", "").Trim();
if (!string.IsNullOrEmpty(planCode)) flag = false; if (info == null)
} while (flag); {
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; return planCode;
} }
public string GetBackPlanCode(PlcModel obj) public string GetBackPlanCode(PlcModel obj)
{ {
bool flag = true;
string planCode = string.Empty; string planCode = string.Empty;
do try
{ {
bool flag = true;
byte[] info = obj.plc.Read("D4030", 59);
do
if (info == null)
{ {
Thread.Sleep(1000); byte[] info = obj.plc.Read("D4030", 59);
continue;
} if (info == null)
{
Thread.Sleep(1000);
continue;
}
//计划编号 //计划编号
planCode = Encoding.ASCII.GetString(info.Skip(0).Take(20).ToArray()).Replace("\0", "").Trim(); planCode = Encoding.ASCII.GetString(info.Skip(0).Take(20).ToArray()).Replace("\0", "").Trim();
if (!string.IsNullOrEmpty(planCode)) flag = false; if (!string.IsNullOrEmpty(planCode)) flag = false;
} while (flag); } while (flag);
}
catch (Exception ex)
{
log.Error($"获取后板传入的计划编号:{ex.Message}");
}
return planCode; return planCode;
} }
#endregion
} }
} }

@ -12,14 +12,14 @@ using System.Threading.Tasks;
using System.Windows.Documents; using System.Windows.Documents;
using Admin.Core.Tasks; using Admin.Core.Tasks;
using Aucma.Core.SheetMetal.Business; using Aucma.Core.SheetMetal.Business;
using Aucma.Core.SheetMetal.Models;
namespace Aucma.Core.SheetMetal.ViewModels namespace Aucma.Core.SheetMetal.ViewModels
{ {
public class LogPageViewModel : ObservableObject public class LogPageViewModel : ObservableObject
{ {
private ObservableCollection<dynamic> listItems = new ObservableCollection<dynamic>();
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(LogPageViewModel)); private static readonly log4net.ILog log = LogManager.GetLogger(typeof(LogPageViewModel));
private ObservableCollection<ListBoxDataView> listItems = new ObservableCollection<ListBoxDataView>();
public LogPageViewModel() public LogPageViewModel()
{ {
SheetMetalPlanTaskHandle.RefreshExecInfoEvent += PrintMessageToListBox; SheetMetalPlanTaskHandle.RefreshExecInfoEvent += PrintMessageToListBox;
@ -28,8 +28,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
/// <summary> /// <summary>
/// LisBox数据模板 /// LisBox数据模板
/// </summary> /// </summary>
private IEnumerable logInfoListBox; private IEnumerable<ListBoxDataView> logInfoListBox;
public IEnumerable LogInfoListBox public IEnumerable<ListBoxDataView> LogInfoListBox
{ {
get => logInfoListBox; get => logInfoListBox;
set => SetProperty(ref logInfoListBox, value); set => SetProperty(ref logInfoListBox, value);
@ -39,14 +39,19 @@ namespace Aucma.Core.SheetMetal.ViewModels
/// listBox绑定日志 /// listBox绑定日志
/// </summary> /// </summary>
/// <param name="message"></param> /// <param name="message"></param>
private void PrintMessageToListBox(string message) /// <param name="color">Red or White</param>
private void PrintMessageToListBox(string message, string color)
{ {
try try
{ {
listItems.Add($"{DateTime.Now.ToString("HH:mm:ss")}==>{message}"); System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
{
LogInfoListBox = listItems.OrderByDescending(x => x); 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) catch (Exception ex)
{ {
@ -54,5 +59,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
} }
} }
public ObservableCollection<ListBoxDataView> Items { get; set; }
} }
} }

@ -4,22 +4,31 @@ using Admin.Core.Model;
using Admin.Core.Service; using Admin.Core.Service;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using LiveCharts;
using LiveCharts.Defaults;
using LiveCharts.Wpf;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Pipelines.Sockets.Unofficial;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Media;
namespace Aucma.Core.SheetMetal.ViewModels namespace Aucma.Core.SheetMetal.ViewModels
{ {
public partial class MaterialStatisticsViewModel : ObservableObject public partial class MaterialStatisticsViewModel : ObservableObject
{ {
private readonly IBaseSpaceInfoServices _baseSpaceInfoServices; private readonly IBaseSpaceInfoServices _baseSpaceInfoServices;
private readonly ISysUserInfoServices _sysUserInfoServices;
public MaterialStatisticsViewModel() public MaterialStatisticsViewModel()
{ {
_baseSpaceInfoServices = App.ServiceProvider.GetService<IBaseSpaceInfoServices>(); _baseSpaceInfoServices = App.ServiceProvider.GetService<IBaseSpaceInfoServices>();
_sysUserInfoServices = App.ServiceProvider.GetService<ISysUserInfoServices>();
Refresh(); Refresh();
} }
#region 刷新 #region 刷新
@ -79,6 +88,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
if (string.IsNullOrEmpty(item.MaterialType)) continue; if (string.IsNullOrEmpty(item.MaterialType)) continue;
FoamBeforeMaterialStockDataGrid.Add(new BaseSpaceInfo() { MaterialType = item.MaterialType, SpaceStock = item.SpaceStock }); FoamBeforeMaterialStockDataGrid.Add(new BaseSpaceInfo() { MaterialType = item.MaterialType, SpaceStock = item.SpaceStock });
} }
//夹具状态
RefreshModeStatus();
} }
#endregion #endregion
@ -133,5 +144,77 @@ namespace Aucma.Core.SheetMetal.ViewModels
set => SetProperty(ref foamBeforeMaterialStockDataGrid, value); set => SetProperty(ref foamBeforeMaterialStockDataGrid, value);
} }
#endregion #endregion
#region 刷新夹具统计
/// <summary>
/// 刷新夹具统计
/// </summary>
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<string>();
ChartValues<double> achievement = new ChartValues<double>();
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 夹具状态统计
/// <summary>
/// 夹具状态统计
/// </summary>
private List<string> modeTypeList;
public List<string> ModeTypeList
{
get { return modeTypeList; }
set { modeTypeList = value; }
}
#endregion
/// <summary>
/// 夹具状态统计
/// </summary>
private SeriesCollection achievement = new SeriesCollection();
public SeriesCollection Achievement
{
get { return achievement; }
set { achievement = value; }
}
#endregion
} }
} }

@ -16,99 +16,105 @@ using Castle.Core.Internal;
using CommunityToolkit.Mvvm.Messaging; using CommunityToolkit.Mvvm.Messaging;
using Aucma.Core.SheetMetal.Views; using Aucma.Core.SheetMetal.Views;
using Aucma.Core.SheetMetal.Common; using Aucma.Core.SheetMetal.Common;
using System.Windows.Input;
using Admin.Core.Common; 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 namespace Aucma.Core.SheetMetal.ViewModels
{ {
public partial class SplitPlanViewModel : ObservableObject public partial class SplitPlanViewModel : ObservableObject
{ {
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(SplitPlanViewModel)); private static readonly log4net.ILog log = LogManager.GetLogger(typeof(SplitPlanViewModel));
protected readonly IProductPlanInfoServices? _productPlanInfoServices; protected readonly IProductPlanInfoServices? _productPlanInfoServices;
protected readonly IExecutePlanInfoServices? _executePlanInfoServices; protected readonly IExecutePlanInfoServices? _executePlanInfoServices;
private AppConfigHelper appConfig = new AppConfigHelper(); private AppConfigHelper appConfig = new AppConfigHelper();//读取配置文件保存的查询内容
#region 构造函数
public SplitPlanViewModel() public SplitPlanViewModel()
{ {
_productPlanInfoServices = App.ServiceProvider.GetService<IProductPlanInfoServices>(); _productPlanInfoServices = App.ServiceProvider.GetService<IProductPlanInfoServices>();
_executePlanInfoServices = App.ServiceProvider.GetService<IExecutePlanInfoServices>(); _executePlanInfoServices = App.ServiceProvider.GetService<IExecutePlanInfoServices>();
Task.WaitAll(LoadData()); Task.WaitAll(LoadData());
//加载快捷方式 //加载快捷方式
SaveSearchCriteria(); SaveSearchCriteria();
WeakReferenceMessenger.Default.Register<string>(this, SaveSearchCriteria); WeakReferenceMessenger.Default.Register<string>(this, SaveSearchCriteria);
_radioButtonStatus = 1; _radioButtonStatus = 1;
} }
#endregion
#region 加载DataGrid数据 #region 加载DataGrid数据
private async Task LoadData() private async Task LoadData()
{ {
MaterialDataGrid.Clear(); try
int i = 1;
string station = Appsettings.app("StationInfo", "StationCode");
var execList = _executePlanInfoServices.QuerySheetMetalPlanData(station);
if (execList == null) return;
foreach (var item in execList)
{ {
int residue = 0; MaterialDataGrid.Clear();
if (execList == null) residue = 0; int i = 1;
else residue = (execList.Where(d => d.MaterialCode.Equals(item.MaterialCode))).Sum(d => d.PlanAmount); string station = Appsettings.app("StationInfo", "StationCode");
MaterialDataGrid.Add(new ProductPlanInfoModel() var execList = _executePlanInfoServices.QuerySheetMetalPlanData(station);
if (execList == null) return;
foreach (var item in execList)
{ {
No = i, int residue = 0;
PlanCode = item.PlanCode, if (execList == null) residue = 0;
MaterialCode = item.MaterialCode, else residue = (execList.Where(d => d.MaterialCode.Equals(item.MaterialCode))).Sum(d => d.PlanAmount);
MaterialName = item.MaterialName, MaterialDataGrid.Add(new ProductPlanInfoModel()
OrderCode = item.OrderCode, {
PlanAmount = item.PlanAmount, No = i,
ResidueAmount = item.PlanAmount - item.CompleteAmount, PlanCode = item.PlanCode,
SpliteResidueAmount = item.PlanAmount - residue, OrderCode = item.OrderCode,
MaterialSpecificatons = item.MaterialSpecificatons, MaterialCode = item.MaterialCode,
StartDate = item.BeginTime MaterialName = item.MaterialName,
}); PlanAmount = item.PlanAmount,
i++; 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) private async Task LoadData(string obj)
{ {
string station = Appsettings.app("StationInfo", "StationCode"); try
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)
{ {
int residue = 0; string station = Appsettings.app("StationInfo", "StationCode");
if (execList == null) residue = 0; MaterialDataGrid.Clear();
else residue = (execList.Where(d => d.MaterialCode.Equals(item.MaterialCode))).Sum(d => d.PlanAmount); int i = 1;
MaterialDataGrid.Add(new ProductPlanInfoModel() 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, int residue = 0;
PlanCode = item.PlanCode, if (execList == null) residue = 0;
MaterialCode = item.MaterialCode, else residue = (execList.Where(d => d.MaterialCode.Equals(item.MaterialCode))).Sum(d => d.PlanAmount);
MaterialName = item.MaterialName, MaterialDataGrid.Add(new ProductPlanInfoModel()
OrderCode = item.OrderCode, {
PlanAmount = item.PlanAmount, No = i,
ResidueAmount = item.PlanAmount - item.CompleteAmount, PlanCode = item.PlanCode,
SpliteResidueAmount = item.PlanAmount - residue, MaterialCode = item.MaterialCode,
MaterialSpecificatons = item.MaterialSpecificatons, MaterialName = item.MaterialName,
StartDate = item.BeginTime OrderCode = item.OrderCode,
}); PlanAmount = item.PlanAmount,
i++; 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; await Task.CompletedTask;
} }

@ -254,7 +254,7 @@
<Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5"> <Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
<Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5"> <Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
<Grid Margin="10,10"> <Grid Margin="10,10">
<lvc:CartesianChart Series="{Binding Achievement, UpdateSourceTrigger=PropertyChanged}" DisableAnimations="True" LegendLocation="Top" Foreground="White"> <lvc:CartesianChart Series="{Binding Achievement, UpdateSourceTrigger=PropertyChanged}" DisableAnimations="True" LegendLocation="Top" Foreground="White">
<lvc:CartesianChart.DataTooltip > <lvc:CartesianChart.DataTooltip >
<lvc:DefaultTooltip SelectionMode="OnlySender" BulletSize="10" Foreground="Black"></lvc:DefaultTooltip> <lvc:DefaultTooltip SelectionMode="OnlySender" BulletSize="10" Foreground="Black"></lvc:DefaultTooltip>
</lvc:CartesianChart.DataTooltip> </lvc:CartesianChart.DataTooltip>
@ -269,7 +269,7 @@
<lvc:CartesianChart.AxisY> <lvc:CartesianChart.AxisY>
<lvc:Axis FontSize="18" Foreground="White"> <lvc:Axis FontSize="18" Foreground="White">
<lvc:Axis.Separator> <lvc:Axis.Separator>
<lvc:Separator Visibility="Hidden" StrokeThickness="1" StrokeDashArray="3" Stroke="#404F56" > <lvc:Separator Visibility="Hidden" StrokeThickness="1" StrokeDashArray="3" Step="1 " Stroke="#404F56" >
</lvc:Separator> </lvc:Separator>
</lvc:Axis.Separator> </lvc:Axis.Separator>
</lvc:Axis> </lvc:Axis>
@ -312,7 +312,7 @@
<DataGridTextColumn Binding="{Binding SidePanelAmount}" Header="前板" Width="0.6*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding SidePanelAmount}" Header="前板" Width="0.6*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding BackPanelAmount}" Header="后板" Width="0.6*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding BackPanelAmount}" Header="后板" Width="0.6*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding PlanType}" Header="计划类型" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding PlanType}" Header="计划类型" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding PlanType}" Header="配方" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" Visibility="Collapsed"/> <DataGridTextColumn Binding="{Binding PlanType}" Header="配方" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding BeginTime ,StringFormat=\{0:MM-dd HH:mm\}}" Header="开始时间" Width="1.2*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding BeginTime ,StringFormat=\{0:MM-dd HH:mm\}}" Header="开始时间" Width="1.2*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding ExecuteStatus}" Header="执行状态" Visibility="Collapsed"/> <DataGridTextColumn Binding="{Binding ExecuteStatus}" Header="执行状态" Visibility="Collapsed"/>
@ -385,7 +385,7 @@
<lvc:CartesianChart.AxisY> <lvc:CartesianChart.AxisY>
<lvc:Axis FontSize="18" Foreground="White"> <lvc:Axis FontSize="18" Foreground="White">
<lvc:Axis.Separator> <lvc:Axis.Separator>
<lvc:Separator Visibility="Hidden" StrokeThickness="1" StrokeDashArray="3" Stroke="#404F56" > <lvc:Separator Visibility="Hidden" StrokeThickness="1" StrokeDashArray="3" Step="1 " Stroke="#404F56" >
</lvc:Separator> </lvc:Separator>
</lvc:Axis.Separator> </lvc:Axis.Separator>
</lvc:Axis> </lvc:Axis>

@ -7,6 +7,7 @@
mc:Ignorable="d" Background="#1152AC" FontFamily="Microsoft YaHei" mc:Ignorable="d" Background="#1152AC" FontFamily="Microsoft YaHei"
d:DesignHeight="450" d:DesignWidth="800" d:DesignHeight="450" d:DesignWidth="800"
> >
<Border Grid.Row="1" Grid.Column="1" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Background="Transparent" Margin="5 15 5 5"> <Border Grid.Row="1" Grid.Column="1" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Background="Transparent" Margin="5 15 5 5">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -18,7 +19,24 @@
</Border> </Border>
<Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5"> <Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
<Grid Margin="10,10"> <Grid Margin="10,10">
<ListBox Grid.Row="1" x:Name="listBox" FontSize="18" ItemsSource="{Binding LogInfoListBox}" Foreground="White" Background="Transparent" BorderBrush="Transparent" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden"/> <!--<ListBox Grid.Row="1" x:Name="listBox" FontSize="18" ItemsSource="{Binding LogInfoListBox}" Foreground="White" Background="Transparent" BorderBrush="Transparent" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden"/>-->
<ListBox ItemsSource="{Binding LogInfoListBox}" >
<ListBox.ItemTemplate>
<DataTemplate >
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="txtName" Text="{Binding Content}" FontSize="18" />
</StackPanel>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Color}" Value="Red">
<Setter TargetName="txtName" Property="Foreground" Value="{Binding Color}" />
</DataTrigger>
<DataTrigger Binding="{Binding Color}" Value="White">
<Setter TargetName="txtName" Property="Foreground" Value="{Binding Color}" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid> </Grid>
</Border> </Border>
</Grid> </Grid>

@ -26,5 +26,7 @@ namespace Aucma.Core.SheetMetal.Views
InitializeComponent(); InitializeComponent();
this.DataContext = new LogPageViewModel(); this.DataContext = new LogPageViewModel();
} }
} }
} }

@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 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" xmlns:local="clr-namespace:Aucma.Core.SheetMetal.Views"
mc:Ignorable="d" Background="#1152AC" FontFamily="Microsoft YaHei" mc:Ignorable="d" Background="#1152AC" FontFamily="Microsoft YaHei"
Title="物料库存统计" Height="650" Width="1000" Name="window" WindowStartupLocation="CenterScreen" Title="物料库存统计" Height="650" Width="1000" Name="window" WindowStartupLocation="CenterScreen"
@ -185,13 +186,35 @@
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="发 泡 夹 具 状 态" Foreground="#FFFFFF" FontSize="18"/> <TextBlock Text="发 泡 夹 具 状 态" Foreground="#FFFFFF" FontSize="18"/>
</StackPanel> </StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="mode">
<Grid>
<lvc:CartesianChart LegendLocation="Top" Series="{Binding Achievement, UpdateSourceTrigger=PropertyChanged}" DisableAnimations="True" Foreground="White" Margin="-229,-110,-228,-102">
<lvc:CartesianChart.DataTooltip>
<lvc:DefaultTooltip BulletSize="10" Foreground="Black"></lvc:DefaultTooltip>
</lvc:CartesianChart.DataTooltip>
<lvc:CartesianChart.AxisX>
<lvc:Axis Labels="{Binding ModeTypeList}" FontSize="18" Foreground="White">
<lvc:Axis.Separator>
<lvc:Separator Step="1" Visibility="Hidden" StrokeThickness="1.5" StrokeDashArray="0" Stroke="#404F56" >
</lvc:Separator>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.AxisY>
<lvc:Axis FontSize="18" Foreground="White">
<lvc:Axis.Separator>
<lvc:Separator Visibility="Hidden" StrokeThickness="1" StrokeDashArray="3" Step="1 " Stroke="#404F56" >
</lvc:Separator>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
</lvc:CartesianChart>
</Grid>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Border> </Border>
<Border Grid.Row="2" Grid.Column="1" BorderBrush="#1254AB" BorderThickness="2"> <Border Grid.Row="2" Grid.Column="1" BorderBrush="#1254AB" BorderThickness="0">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,20,0"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,20,0">
<Button Content="刷 新" Command="{Binding RefreshCommand}" Background="#007DFA" BorderBrush="#007DFA" Width="100" Height="30" Margin="20,0,0,0"/> <Button Content="刷 新" Command="{Binding RefreshCommand}" Background="#007DFA" BorderBrush="#007DFA" Width="100" Height="30" Margin="20,0,0,0"/>
<Button Content="取 消" Command="{Binding CloseWindowCommand}" CommandParameter="{Binding ElementName=window}" Background="#FF9900" Foreground="white" Margin="20,0,50,0" Height="30" BorderBrush="#FF9900" Width="100" /> <Button Content="取 消" Command="{Binding CloseWindowCommand}" CommandParameter="{Binding ElementName=window}" Background="#FF9900" Foreground="white" Margin="20,0,50,0" Height="30" BorderBrush="#FF9900" Width="100" />

@ -10,6 +10,7 @@
Title="下达数量" Title="下达数量"
Height="500" Width="700" Name="window" Height="500" Width="700" Name="window"
ResizeMode="NoResize" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Topmost="False"> Topmost="False">
<Border Margin="5" BorderBrush="#0288d1" CornerRadius="10"> <Border Margin="5" BorderBrush="#0288d1" CornerRadius="10">
@ -97,7 +98,7 @@
<Button Grid.Row="2" Grid.Column="1" Content="8" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" /> <Button Grid.Row="2" Grid.Column="1" Content="8" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" />
<Button Grid.Row="2" Grid.Column="2" Content="9" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" /> <Button Grid.Row="2" Grid.Column="2" Content="9" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" />
<Button Grid.Row="3" Grid.Column="0" Content="0" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" /> <Button Grid.Row="3" Grid.Column="0" Content="0" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" />
<Button Grid.Row="3" Grid.Column="2" Content="清除" FontSize="15" Margin="2,2" Background="#FF9900" Foreground="white" BorderBrush="#FF9900" Command="{Binding ClearTransmitAmountCommand}" Height="70" Width="100" /> <Button Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Content="清除" FontSize="15" Margin="2,2" Background="#FF9900" Foreground="white" BorderBrush="#FF9900" Command="{Binding ClearTransmitAmountCommand}" Height="70" />
</Grid> </Grid>
</Border> </Border>

@ -6,7 +6,7 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d" mc:Ignorable="d"
Background="#1152AC" Background="#1152AC"
Title="计划维护" FontFamily="Microsoft YaHei" Height="800" Width="1000" Title="计划维护" FontFamily="Microsoft YaHei" Height="800" Width="1100"
d:DesignHeight="800" WindowStartupLocation="CenterScreen" d:DesignHeight="800" WindowStartupLocation="CenterScreen"
d:DesignWidth="1500" ResizeMode="NoResize" Topmost="False" > d:DesignWidth="1500" ResizeMode="NoResize" Topmost="False" >
@ -239,7 +239,7 @@
<DataGridTextColumn Binding="{Binding MaterialSpecificatons}" Header="产品型号" Width="*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" Visibility="Collapsed"/> <DataGridTextColumn Binding="{Binding MaterialSpecificatons}" Header="产品型号" Width="*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" Visibility="Collapsed"/>
<DataGridTextColumn Binding="{Binding PlanAmount}" Header="计划数量" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding PlanAmount}" Header="计划数量" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding CompleteAmount}" Header="完成数量" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding CompleteAmount}" Header="完成数量" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding BeginTime,StringFormat=\{0:MM月dd日 HH:mm\}}" Header="开始时间" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding StartDate,StringFormat=\{0:MM-dd HH:mm\}}" Header="开始时间" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
</UniformGrid> </UniformGrid>

@ -136,7 +136,7 @@
"PlcType": "Melsec", "PlcType": "Melsec",
"Enabled": true, "Enabled": true,
"IP": "10.10.91.6", "IP": "10.10.91.6",
"Port": 5553 "Port": 5552
} }
] ]
} }

Loading…
Cancel
Save