liuwf 1 year ago
commit 7a744aee0a

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.Common
build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.Common\
build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.Common\

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.EventBus
build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.EventBus\
build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.EventBus\

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.Serilog.Es
build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.Serilog.Es\
build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.Serilog.Es\

@ -13,7 +13,6 @@ using Admin.Core.Model;
using Aucma.Core.HwPLc;
using Microsoft.Extensions.DependencyInjection;
using NetTaste;
using SqlSugar;
namespace Aucma.Core.SheetMetal.Business;
@ -22,15 +21,16 @@ namespace Aucma.Core.SheetMetal.Business;
/// </summary>
public class SheetMetalPlanTaskHandle
{
#region 刷新创建计划
/// <summary>
/// 刷新创建计划
/// </summary>
public delegate Task RefreshCretaePlanInfo();
public static event RefreshCretaePlanInfo RefreshCretaePlanInfoEvent;
public static event RefreshCretaePlanInfo RefreshCreatePlanInfoEvent;
#endregion
#region 刷新图
#region 刷新图
/// <summary>
/// 刷新创建计划
/// </summary>
@ -42,7 +42,7 @@ public class SheetMetalPlanTaskHandle
/// <summary>
/// 刷新当前正在执行的计划
/// </summary>
public delegate void RefreshCurrentPlanInfo(ExecutePlanInfo planInfo);
public delegate void RefreshCurrentPlanInfo();
public static event RefreshCurrentPlanInfo RefreshCurrentPlanInfoEvent;
#endregion
@ -56,7 +56,6 @@ public class SheetMetalPlanTaskHandle
#endregion
protected readonly IExecutePlanInfoServices? _executePlanInfoServices;
protected readonly IRecordSidePanelComplateServices _sidePanelComplateServices;
protected readonly IRecordBackPanelComplateServices _backPanelComplateServices;
@ -81,18 +80,17 @@ public class SheetMetalPlanTaskHandle
while (true)
{
var planInfos = _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals("1001") && d.ExecuteStatus == 1||d.ExecuteStatus==2).Result;
var planInfos = _executePlanInfoServices.Query(d => d.ProductLineCode.Equals("1001") && d.ExecuteStatus == 1 || d.ExecuteStatus == 2);
if (planInfos != null)
{
if (planInfos.Count > 0)
{
ExecutePlanInfo planInfo = planInfos.First();
//planInfo.PlanAmount = planInfo.PlanAmount - planInfo.CompleteAmount;
if (planInfo.PlanType == 1) //联合下发
{
SendPlanTask(planInfo, obj_sidePanel, obj_backPanel);
UpdatePlanTaskByComplate(planInfo);
}
@ -113,7 +111,6 @@ public class SheetMetalPlanTaskHandle
else
{
Console.WriteLine("未获取到需要下发的任务");
RefreshExecInfoEvent?.Invoke("未获取到需要下发的任务");
}
}
@ -136,10 +133,10 @@ public class SheetMetalPlanTaskHandle
do
{
//等待计划执行完成
List<RecordSidePanelComplate> sidePanelComplates = _sidePanelComplateServices.QueryAsync(x => x.ProductlineCode == "1001" && x.PlanCode == planInfo.TaskCode).Result;
List<RecordSidePanelComplate> sidePanelComplates = _sidePanelComplateServices.Query(x => x.ProductlineCode == "1001" && x.PlanCode == planInfo.TaskCode);
int sumSidePanelAmount = sidePanelComplates.Sum(x => x.OutPutAmount);
List<RecordBackPanelComplate> backPanelComplates = _backPanelComplateServices.QueryAsync(x => x.ProductlineCode == "1001" && x.PlanCode == planInfo.TaskCode).Result;
List<RecordBackPanelComplate> backPanelComplates = _backPanelComplateServices.Query(x => x.ProductlineCode == "1001" && x.PlanCode == planInfo.TaskCode);
int sumBackPanelAmount = backPanelComplates.Sum(x => x.OutPutAmount);
Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount};围板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
@ -174,8 +171,13 @@ public class SheetMetalPlanTaskHandle
planInfo.CompleteAmount = sumAmount;
_executePlanInfoServices.UpdateExecutePlanInfo(planInfo);
bool result = _executePlanInfoServices.UpdateExecutePlanInfo(planInfo).Result;
if (result)
{
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
Thread.Sleep(5000);
} while (isComplate);
@ -203,14 +205,12 @@ public class SheetMetalPlanTaskHandle
if (obj_sidePanel != null)
{
//计划编号10个字D6000-D6009、物料编号10个字D6010-D6019、计划数量1个字D6020、应答字1个字D6021
obj_sidePanel.plc.WriteString("D6000", planInfo.TaskCode);
obj_sidePanel.plc.WriteString("D6030", planInfo.TaskCode);
string processNumber = GetProcessNumberBy(planInfo.MaterialCode);
obj_sidePanel.plc.WriteString("D6010", "BCD/310NF");
obj_sidePanel.plc.WriteInt32("D6020", planInfo.PlanAmount);
obj_sidePanel.plc.WriteInt32("D6021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待围板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke("等待围板设备应答");
//下发完成后读取PLC应答应答后复位应答信号
@ -232,8 +232,13 @@ public class SheetMetalPlanTaskHandle
//更新计划状态为2执行中
planInfo.ExecuteStatus = 2;
_executePlanInfoServices.UpdateExecutePlanInfo(planInfo);
RefreshCurrentPlanInfoEvent?.Invoke(planInfo);
bool result = _executePlanInfoServices.UpdateExecutePlanInfo(planInfo).Result;
if (result)
{
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
#endregion
//读取设备进度,完成后再次下发新任务
ReadDeviceComplate_SidePanel(obj_sidePanel);
@ -246,24 +251,22 @@ public class SheetMetalPlanTaskHandle
if (obj_backPanel != null)
{
//计划编号10个字D6000-D6009、物料编号10个字D6010-D6019、计划数量1个字D6020、应答字1个字D6021
obj_backPanel.plc.WriteString("D4000", planInfo.TaskCode);
obj_backPanel.plc.WriteString("D6030", planInfo.TaskCode);
string processNumber = GetProcessNumberBy(planInfo.MaterialCode);
obj_backPanel.plc.WriteString("D4010", "BCD/310NF");
obj_backPanel.plc.WriteInt32("D4020", planInfo.PlanAmount);
obj_backPanel.plc.WriteInt32("D4021", 1);
obj_backPanel.plc.WriteString("D6010", "BCD/310NF");
obj_backPanel.plc.WriteInt32("D6020", planInfo.PlanAmount);
obj_backPanel.plc.WriteInt32("D6021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待背板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke("等待背板设备应答......");
#region PLC反馈信号逻辑处理
//循环读取PLC应答信号PLC应答后复位应答信号、更新计划状态为执行中
bool isFlag = true;
do
{
if (obj_backPanel.plc.ReadInt32("D4021") == 2)
if (obj_backPanel.plc.ReadInt32("D6021") == 2)
{
obj_backPanel.plc.WriteInt32("D4021", 0);
obj_backPanel.plc.WriteInt32("D6021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到背板板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke("收到背板板设备应答信号,复位应答地址");
isFlag = false;
@ -273,8 +276,13 @@ public class SheetMetalPlanTaskHandle
//更新计划状态为2执行中
planInfo.ExecuteStatus = 2;
_executePlanInfoServices.UpdateExecutePlanInfo(planInfo);
RefreshCurrentPlanInfoEvent?.Invoke(planInfo);
bool result= _executePlanInfoServices.UpdateExecutePlanInfo(planInfo).Result;
if (result)
{
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
#endregion
//读取设备进度,完成后再次下发新任务
@ -324,24 +332,29 @@ public class SheetMetalPlanTaskHandle
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到围板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke("收到围板设备应答信号......");
isFlag = false;
//更新计划状态为2执行中
planInfo.ExecuteStatus = 2;
_executePlanInfoServices.UpdateExecutePlanInfo(planInfo);
//更新前端展示图表
RefreshCurrentPlanInfoEvent?.Invoke(planInfo);
RefreshCretaePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
Thread.Sleep(2000);
} while (isFlag);
//更新计划状态为2执行中
planInfo.ExecuteStatus = 2;
bool result=_executePlanInfoServices.UpdateExecutePlanInfo(planInfo).Result;
if (result)
{
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
RefreshCurrentPlanInfoEvent?.Invoke();
#endregion
//读取设备进度,完成后再次下发新任务
ReadDeviceComplate_SidePanel(obj_sidePanel);
if (!isFlag)
{
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
}
});
}
@ -349,7 +362,6 @@ public class SheetMetalPlanTaskHandle
{
MessageBox.Show($"围板⽣产计划下发异常:{ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error,
MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
RefreshExecInfoEvent?.Invoke("围板⽣产计划下发异常:{ex.Message}");
}
}
@ -389,14 +401,13 @@ 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}");
Console.WriteLine($"===>收到围板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke($"围板设备数据读取====>>>>当前计划:{planCode},物料编号:{materialCode},完成数量:{complateAmount},下线数量:{offLineAmount},设备状态:{deviceStatus},生产节拍:{productionBeat}");
RefreshExecInfoEvent?.Invoke($"收到围板设备应答信号,复位应答地址");
//添加完工记录
RecordSidePanelComplate sidePanelComplate = new RecordSidePanelComplate()
{
ProductlineCode = "1001",
PlanCode = planCode.Substring(0, 16).Replace("\n","").Trim(),//.Substring(0, 16),
PlanCode = planCode.Substring(0, 16),
//MaterialCode = string.IsNullOrEmpty(materialCode) ? "" : materialCode,
MaterialCode = "BCD/310NF",
CompleteAmount = complateAmount,
@ -414,7 +425,7 @@ public class SheetMetalPlanTaskHandle
}
//先查询该计划编号下的前一条完工记录如果不存在本条记录产量为0
List<RecordSidePanelComplate> sidePanelComplates = _sidePanelComplateServices.QueryAsync(x => x.ProductlineCode == "1001" && x.PlanCode == planCode.Substring(0, 16)).Result;
List<RecordSidePanelComplate> sidePanelComplates = _sidePanelComplateServices.Query(x => x.ProductlineCode == "1001" && x.PlanCode == planCode.Substring(0, 16));
int lastComplateAmount = 0; //前一条完成记录的计划完成数量
int sumComplateAmount = 0; //当前计划总产量
if (sidePanelComplates != null)
@ -422,7 +433,7 @@ public class SheetMetalPlanTaskHandle
if (sidePanelComplates.Count > 0)
{
sidePanelComplates = sidePanelComplates.OrderByDescending(x => x.RecordTime).ToList();
lastComplateAmount = sidePanelComplates.First().CompleteAmount;
sidePanelComplate.OutPutAmount = complateAmount - lastComplateAmount;
sumComplateAmount = sidePanelComplates.Sum(x => x.OutPutAmount) + sidePanelComplate.OutPutAmount;
@ -434,7 +445,7 @@ public class SheetMetalPlanTaskHandle
}
else
{
List<ExecutePlanInfo> planInfos = _executePlanInfoServices.QueryAsync(x => x.TaskCode.Equals(planCode.Substring(0, 16)) && x.ExecuteStatus == 2).Result;
List<ExecutePlanInfo> planInfos = _executePlanInfoServices.Query(x => x.TaskCode.Equals(planCode.Substring(0, 16)) && x.ExecuteStatus == 2);
if (planInfos != null)
{
if (planInfos.Count > 0)
@ -447,8 +458,6 @@ public class SheetMetalPlanTaskHandle
isFlag = false;
Console.WriteLine($"围板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}");
RefreshExecInfoEvent?.Invoke($"围板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}");
RefreshCretaePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
}
}
@ -460,8 +469,22 @@ public class SheetMetalPlanTaskHandle
_sidePanelComplateServices.InsertSidePanelCimplate(sidePanelComplate);
if (complateAmount!=lastComplateAmount)
{
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
RefreshCreatePlanInfoEvent?.Invoke();
}
Thread.Sleep(5000);
} while (isFlag);
if (!isFlag)
{
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
}
catch (Exception e)
{
@ -493,7 +516,7 @@ public class SheetMetalPlanTaskHandle
obj_backPanel.plc.WriteInt32("D4021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待背板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke($"等待背板设备应答.....");
RefreshExecInfoEvent?.Invoke($"等待背板设备应答。。。。。。");
#region PLC反馈信号逻辑处理
//循环读取PLC应答信号PLC应答后复位应答信号、更新计划状态为执行中
bool isFlag = true;
@ -512,12 +535,25 @@ public class SheetMetalPlanTaskHandle
//更新计划状态为2执行中
planInfo.ExecuteStatus = 2;
_executePlanInfoServices.UpdateExecutePlanInfo(planInfo);
RefreshCurrentPlanInfoEvent?.Invoke(planInfo);
bool result= _executePlanInfoServices.UpdateExecutePlanInfo(planInfo).Result;
if (result)
{
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
#endregion
//读取设备进度,完成后再次下发新任务
ReadDeviceComplate_BackPanel(obj_backPanel);
if (!isFlag)
{
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
}
});
}
@ -525,7 +561,6 @@ public class SheetMetalPlanTaskHandle
{
MessageBox.Show($"背板⽣产计划下发异常:{ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error,
MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
RefreshExecInfoEvent?.Invoke($"背板⽣产计划下发异常:{ex.Message}");
}
}
@ -606,7 +641,7 @@ public class SheetMetalPlanTaskHandle
}
else
{
List<ExecutePlanInfo> planInfos = _executePlanInfoServices.QueryAsync(x => x.TaskCode == planCode.Substring(0, 16) && x.ExecuteStatus == 2).Result;
List<ExecutePlanInfo> planInfos = _executePlanInfoServices.Query(x => x.TaskCode == planCode.Substring(0, 16) && x.ExecuteStatus == 2);
if (planInfos != null)
{
if (planInfos.Count > 0)
@ -619,9 +654,6 @@ public class SheetMetalPlanTaskHandle
isFlag = false;
Console.WriteLine($"背板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}");
RefreshExecInfoEvent?.Invoke($"背板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}");
RefreshCretaePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
}
}
@ -631,17 +663,31 @@ public class SheetMetalPlanTaskHandle
}
_backPanelComplateServices.InsertBackPanelCimplate(backPanelComplate);
if (complateAmount != lastComplateAmount)
{
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
Thread.Sleep(5000);
} while (isFlag);
if (!isFlag)
{
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
}
catch (Exception e)
{
Console.WriteLine($"读取背板设备完成数据异常:{e.Message}");
RefreshExecInfoEvent?.Invoke($"读取背板设备完成数据异常:{e.Message}");
RefreshExecInfoEvent?.Invoke($"背板⽣产计划下发异常:{e.Message}");
}
}
/// <summary>
/// 通过物料编号获取工艺编号
/// </summary>

@ -64,15 +64,16 @@ namespace Aucma.Core.SheetMetal.ViewModels
RefreshMaterialStats();//型号产量
SheetMetalPlanTaskHandle.RefreshCurrentPlanInfoEvent += RefreshCurrentPlanInfo;
QuantityIssuedViewModel.RefreshCretaePlanInfoEvent += LoadData;
SheetMetalPlanTaskHandle.RefreshCretaePlanInfoEvent += LoadData;
SheetMetalPlanTaskHandle.RefreshCreatePlanInfoEvent += LoadData;
SheetMetalPlanTaskHandle.RefreshChatEvent += RefreshChat;
}
#endregion
public Task RefreshChat()
{
RefreshHourAmount();//小时产量
RefreshMaterialStats();//型号产量
RefreshHourAmountChart();//小时产量
RefreshMaterialChart();//型号产量
return Task.CompletedTask;
}
@ -96,12 +97,9 @@ namespace Aucma.Core.SheetMetal.ViewModels
ExecutePlanInfo info = await _taskExecutionPlanInfoServices.FirstAsync(d => d.ProductLineCode.Equals(station) && d.ExecuteStatus == 2);
if (info == null) return;
PlanNum = info.PlanAmount;
PlanMaxNum = PlanNum = info.PlanAmount;
RealQuantity = info.CompleteAmount;
DiffQuantity = Math.Abs(info.CompleteAmount - info.PlanAmount);
//CompletionRate = (_realQuantity / _planMaxNum).ToString("0%");
CompletionRate = (_realQuantity / _planMaxNum);
}
@ -260,15 +258,24 @@ namespace Aucma.Core.SheetMetal.ViewModels
MesMOrderCode = execPlan.ProductPlanCode;
ProductModel = execPlan.MaterialName;
BeginTime = execPlan.BeginTime.ToString();
PlanMaxNum = _planNum = execPlan.PlanAmount;
PlanMaxNum = PlanNum = execPlan.PlanAmount;
RealQuantity = execPlan.CompleteAmount;
double diff = _planMaxNum - _realQuantity;
DiffQuantity =int.Parse(diff.ToString());
//CompletionRate = (_realQuantity/_planMaxNum).ToString("0%");
CompletionRate = (_realQuantity / _planMaxNum);
}
else
{
OrderCode =string.Empty;
MesMOrderCode = string.Empty;
ProductModel = string.Empty;
BeginTime = string.Empty;
PlanMaxNum = 0;
RealQuantity =0.0;
DiffQuantity = 0;
CompletionRate =0;
}
}));
}
catch (Exception ex)
@ -676,7 +683,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
/// 刷新当前执行的计划进度
/// </summary>
/// <param name="planInfo"></param>
private void RefreshCurrentPlanInfo(ExecutePlanInfo planInfo)
private void RefreshCurrentPlanInfo()
{
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
@ -712,9 +719,6 @@ namespace Aucma.Core.SheetMetal.ViewModels
ProductionHourList.Add(item.HourTime);
hour++;
}
#region 按时间统计
@ -743,6 +747,37 @@ namespace Aucma.Core.SheetMetal.ViewModels
}
#endregion
#region 更新小时产量统计
/// <summary>
/// 更新小时产量统计
/// </summary>
private void RefreshHourAmountChart()
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
//获取小时产量
string stationCode = Appsettings.app("StationInfo", "StationCode");
var hourAmount = _sysUserInfoServices.GetSheetMetaHourData(stationCode).Result;
if (hourAmount != null)
{
int hour = 0;
for (int i = 0; i < hourAmount.Count; i++)
{
Achievement[0].Values[i] =
new ObservablePoint(hour, Convert.ToDouble(hourAmount[i].FrontPlateAmount));
Achievement[1].Values[i] =
new ObservablePoint(hour, Convert.ToDouble(hourAmount[i].RearPanelAmount));
hour++;
}
}
}));
}
#endregion
#region 刷新物料型号统计
/// <summary>
/// 刷新物料型号统计
@ -795,6 +830,37 @@ namespace Aucma.Core.SheetMetal.ViewModels
}
#endregion
#region 刷新物料型号统计
/// <summary>
/// 刷新物料型号统计
/// </summary>
private void RefreshMaterialChart()
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
//获取物料型号统计
string stationCode = Appsettings.app("StationInfo", "StationCode");
var sheetMetalTypeList = _sysUserInfoServices.GetSheetMetalTypeData(stationCode).Result;
if (sheetMetalTypeList != null)
{
#region 按类型统计
for (int i = 0; i < sheetMetalTypeList.Count; i++)
{
double frontPlateAmount =Convert.ToDouble(sheetMetalTypeList[i].FrontPlateAmount);
ModelStatistics[0].Values[i] = frontPlateAmount;
double rearPanelAmount = Convert.ToDouble(sheetMetalTypeList[i].RearPanelAmount);
ModelStatistics[1].Values[i] = rearPanelAmount;
MaterialNameList[i]=sheetMetalTypeList[i].MaterialName;
}
#endregion
}
}));
}
#endregion
public CurrentTeamTimeView GetTeamHour()
{
List<CurrentTeamTimeView> obj = _sysUserInfoServices.GetTeamData().Result;

@ -94,7 +94,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
task.OrderCode = PlanInfo.OrderCode;
task.ProductLineCode = stationCode;//计划工位
//task.TaskCode = GetMaxCodeAsync();
task.TaskCode = System.Guid.NewGuid().ToString("N").Substring(0,16);
task.TaskCode = System.Guid.NewGuid().ToString("N").Substring(0,14)+DateTime.Now.ToString("ss");
task.MaterialCode = PlanInfo.MaterialCode;
task.MaterialName = PlanInfo.MaterialName;
if (list.Count == 0)

@ -62,13 +62,14 @@ namespace Aucma.Core.SheetMetal.ViewModels
}
}
private async Task LoadDateData(DateTime startTime,DateTime endTime)
private async Task LoadDateData(string result)
{
string station = Appsettings.app("StationInfo", "StationCode");
var list = _productPlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station)).Result;
var sidePanelComplateList = _sidePanelComplateServices.QueryAsync(d => d.ProductlineCode == station).Result;
int i = 1;
foreach (var item in list.Where(d => d.BeginTime > startTime && d.EndTime < endTime))
var productPlanInfoList = list.Where(d => d.OrderCode.Contains(result) || d.PlanCode.Contains(result) || d.MaterialCode.Contains(result) || d.MaterialName.Contains(result)).ToList();
foreach (var item in productPlanInfoList)
{
int sidePanelComplete = GetSidePanelCompleteData(sidePanelComplateList, item.OrderCode, station);
int backPanelComplete = GetBackPanelCompleteData(sidePanelComplateList, item.OrderCode, station);
@ -109,29 +110,21 @@ namespace Aucma.Core.SheetMetal.ViewModels
/// 查询
/// </summary>
[RelayCommand]
private async Task ExecQuery(object obj)
private async Task ExecQuery(string result)
{
var result = (StatisticModel)obj;
if (string.IsNullOrEmpty(result.BeginTime))
if (string.IsNullOrEmpty(result))
{
MessageBox.Show("开始时间不能为空!");
return;
}
if (string.IsNullOrEmpty(result.EndTime))
{
MessageBox.Show("结束时间不能为空!");
MessageBox.Show("查询条件不能为空!");
return;
}
//System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
//{
if (!string.IsNullOrEmpty(result.BeginTime))
if (!string.IsNullOrEmpty(result))
{
var beginTime =DateTime.Parse(result.BeginTime);
var endTime = DateTime.Parse(result.EndTime);
MaterialDataGrid.Clear();
await LoadDateData(beginTime, endTime);
await LoadDateData(result);
}
else
{

@ -175,7 +175,7 @@
</Border>
<Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,0,0" >
<lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="{Binding PlanMaxNum,Mode=TwoWay}"
Value="{Binding PlanNum,Mode=TwoWay}"
Value="{Binding PlanMaxNum,Mode=TwoWay}"
Foreground="White"/>
</Border>
</Grid>
@ -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">
<Grid Margin="10,10">
<lvc:CartesianChart Series="{Binding Achievement, UpdateSourceTrigger=PropertyChanged}" LegendLocation="Top" Foreground="White">
<lvc:CartesianChart Series="{Binding Achievement, UpdateSourceTrigger=PropertyChanged}" DisableAnimations="True" LegendLocation="Top" Foreground="White">
<lvc:CartesianChart.DataTooltip >
<lvc:DefaultTooltip SelectionMode="OnlySender" BulletSize="10" Foreground="Black"></lvc:DefaultTooltip>
</lvc:CartesianChart.DataTooltip>
@ -369,7 +369,7 @@
<!--型号统计-->
<Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
<Grid Margin="10,10">
<lvc:CartesianChart LegendLocation="Top" Series="{Binding ModelStatistics, UpdateSourceTrigger=PropertyChanged}" Foreground="White">
<lvc:CartesianChart LegendLocation="Top" Series="{Binding ModelStatistics, UpdateSourceTrigger=PropertyChanged}" DisableAnimations="True" Foreground="White">
<lvc:CartesianChart.DataTooltip>
<lvc:DefaultTooltip BulletSize="10" Foreground="Black"></lvc:DefaultTooltip>
</lvc:CartesianChart.DataTooltip>

@ -66,7 +66,7 @@
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="下达数量" FontSize="18" Foreground="#FFFFFF" Margin="10,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox x:Name="TransmitAmount" VerticalContentAlignment="Center" FontSize="18" Text="{Binding TransmitAmount}" Foreground="#FFFFFF" BorderBrush="White" Width="150" Height="40" IsReadOnly="True" Margin="5,0,10,0"/>
<TextBox x:Name="TransmitAmount" Style="{x:Null}" Background="#1152AC" VerticalContentAlignment="Center" FontSize="18" Text="{Binding TransmitAmount}" Foreground="#FFFFFF" BorderBrush="White" Width="150" Height="40" IsReadOnly="True" Margin="5,0,10,0"/>
</StackPanel>
<Border Grid.Row="1" BorderBrush="Black" BorderThickness="0" Margin="10">

@ -77,59 +77,35 @@
<Border Grid.Row="1" Grid.Column="1" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Background="Transparent" Margin="5 15 5 5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300*"/>
<ColumnDefinition Width="1159*"/>
<ColumnDefinition Width="29*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.8*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="9*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Background="#1157b9" Margin="1,1,5,5" >
<Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Background="#1157b9" Margin="1,1,5,5" Grid.ColumnSpan="3" >
<TextBlock Text="生产统计" FontSize="25" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</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.ColumnSpan="3">
<Grid Margin="10,5">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="0.6*"/>
<RowDefinition Height="8*"/>
</Grid.RowDefinitions>
<WrapPanel Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock Text="开始时间" Margin="10 0" Foreground="White" FontSize="18" VerticalAlignment="Center"/>
<DatePicker
x:Name="BeginTime" FontSize="16"
Width="200" Margin="10 0" BorderBrush="White"
materialDesign:CalendarAssist.IsHeaderVisible="False">
<DatePicker.SelectedDate>
<Binding
Path="FutureValidatingDate"
UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
</Binding.ValidationRules>
</Binding>
</DatePicker.SelectedDate>
</DatePicker>
<TextBlock Text="搜索条件" Margin="10 0" Foreground="White" FontSize="18" VerticalAlignment="Center"/>
<TextBox
x:Name="queryParam" FontSize="16" Style="{x:Null}" Background="#1152AC"
Width="200" Margin="10 0" BorderBrush="White" Foreground="White">
<TextBlock Text="结束时间" Margin="10 0" Foreground="White" FontSize="18" VerticalAlignment="Center"/>
<DatePicker
x:Name="EndTime" Margin="10 0"
Width="200" BorderBrush="White" FontSize="16"
materialDesign:CalendarAssist.IsHeaderVisible="False">
<DatePicker.SelectedDate>
<Binding
Path="FutureValidatingDate"
UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
</Binding.ValidationRules>
</Binding>
</DatePicker.SelectedDate>
</DatePicker>
</TextBox>
<Button Margin="10 0"
Content="查询" Command="{Binding ExecQueryCommand}" FontSize="18"
Style="{StaticResource MaterialDesignRaisedSecondaryDarkButton}">
<Button.CommandParameter>
<MultiBinding Converter="{StaticResource QueryConvert}">
<Binding ElementName="BeginTime" Path="Text"/>
<Binding ElementName="EndTime" Path="Text"/>
</MultiBinding>
</Button.CommandParameter>
</Button>
Style="{StaticResource MaterialDesignRaisedSecondaryDarkButton}" CommandParameter="{Binding Text, ElementName=queryParam}" />
</WrapPanel>
<UniformGrid Grid.Row="1">
<DataGrid Grid.Row="0" ItemsSource="{Binding MaterialDataGrid}" Background="#00000000"
@ -138,13 +114,11 @@
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False" SelectionMode="Single" IsReadOnly="True"
Foreground="White" >
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding No}" Header="序号" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding ProductPlanCode}" Header="计划编号" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding MaterialName}" Header="物料名称" Width="3*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding MaterialName}" Header="物料名称" Width="3*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" Visibility="Collapsed"/>
<DataGridTextColumn Binding="{Binding MaterialCode}" Header="物料编号" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" Visibility="Collapsed"/>
<DataGridTextColumn Binding="{Binding PlanAmount}" Header="计划数量" Width="*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding SidePanelComplete}" Header="前板数量" Width="*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding BackPanelComplete}" Header="后板数量" Width="*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>

Loading…
Cancel
Save