|
|
@ -11,21 +11,15 @@ using System.Threading.Tasks;
|
|
|
|
using Admin.Core.IService;
|
|
|
|
using Admin.Core.IService;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Aucma.Core.SheetMetal.Common;
|
|
|
|
using Aucma.Core.SheetMetal.Common;
|
|
|
|
using Admin.Core.Tasks;
|
|
|
|
|
|
|
|
using CommunityToolkit.Mvvm.Messaging;
|
|
|
|
|
|
|
|
using LiveCharts;
|
|
|
|
using LiveCharts;
|
|
|
|
using LiveCharts.Wpf;
|
|
|
|
using LiveCharts.Wpf;
|
|
|
|
using Admin.Core.Model;
|
|
|
|
using Admin.Core.Model;
|
|
|
|
using System.Windows.Media;
|
|
|
|
using System.Windows.Media;
|
|
|
|
using log4net;
|
|
|
|
|
|
|
|
using Admin.Core.Common;
|
|
|
|
using Admin.Core.Common;
|
|
|
|
using LiveCharts.Defaults;
|
|
|
|
using LiveCharts.Defaults;
|
|
|
|
using Aucma.Core.SheetMetal.Business;
|
|
|
|
using Aucma.Core.SheetMetal.Business;
|
|
|
|
using static Aucma.Core.SheetMetal.Business.SheetMetalPlanTaskHandle;
|
|
|
|
using Admin.Core.Service;
|
|
|
|
using System.Threading;
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
using NetTaste;
|
|
|
|
|
|
|
|
using Aucma.Core.HwPLc;
|
|
|
|
|
|
|
|
using Admin.Core.Model.ViewModels;
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* 首页信息
|
|
|
|
* 首页信息
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -34,9 +28,9 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
public partial class IndexPageViewModel : ObservableObject
|
|
|
|
public partial class IndexPageViewModel : ObservableObject
|
|
|
|
{
|
|
|
|
{
|
|
|
|
protected readonly IExecutePlanInfoServices? _taskExecutionPlanInfoServices;
|
|
|
|
protected readonly IExecutePlanInfoServices? _taskExecutionPlanInfoServices;
|
|
|
|
protected readonly ISysUserInfoServices? _sysUserInfoServices;
|
|
|
|
protected readonly IRecordBackPanelComplateServices _recordBackPanelComplateServices;
|
|
|
|
//private SheetMetalPlanTaskHandle _taskHandle = new SheetMetalPlanTaskHandle();
|
|
|
|
protected readonly IRecordSidePanelComplateServices _recordSidePanelComplateServices;
|
|
|
|
|
|
|
|
protected readonly IBaseBomInfoServices _baseBomInfoServices;
|
|
|
|
private AppConfigHelper appConfig = new AppConfigHelper();
|
|
|
|
private AppConfigHelper appConfig = new AppConfigHelper();
|
|
|
|
List<SelectModel> list = new List<SelectModel>() { new SelectModel()
|
|
|
|
List<SelectModel> list = new List<SelectModel>() { new SelectModel()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -55,14 +49,16 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_stationName = Appsettings.app("StationInfo", "StationName");//工位名称
|
|
|
|
_stationName = Appsettings.app("StationInfo", "StationName");//工位名称
|
|
|
|
_taskExecutionPlanInfoServices = App.ServiceProvider.GetService<IExecutePlanInfoServices>();
|
|
|
|
_taskExecutionPlanInfoServices = App.ServiceProvider.GetService<IExecutePlanInfoServices>();
|
|
|
|
_sysUserInfoServices = App.ServiceProvider.GetService<ISysUserInfoServices>();
|
|
|
|
_recordBackPanelComplateServices = App.ServiceProvider.GetService<IRecordBackPanelComplateServices>();
|
|
|
|
|
|
|
|
_recordSidePanelComplateServices = App.ServiceProvider.GetService<IRecordSidePanelComplateServices>();
|
|
|
|
|
|
|
|
_baseBomInfoServices = App.ServiceProvider.GetService<IBaseBomInfoServices>();
|
|
|
|
//Job_SheetMetalTask_Quartz.SmEverDayDelegateEvent += InitEveryDayMethod;
|
|
|
|
//Job_SheetMetalTask_Quartz.SmEverDayDelegateEvent += InitEveryDayMethod;
|
|
|
|
//Job_SheetMetalTask_Quartz.SmTaskDelegateEvent += UpdatePlanSHow;//计划内容展示
|
|
|
|
//Job_SheetMetalTask_Quartz.SmTaskDelegateEvent += UpdatePlanSHow;//计划内容展示
|
|
|
|
//WeakReferenceMessenger.Default.Register<string>(this, Recive);
|
|
|
|
//WeakReferenceMessenger.Default.Register<string>(this, Recive);
|
|
|
|
Task.WaitAll(LoadData());
|
|
|
|
Task.WaitAll(LoadData());
|
|
|
|
//InitEveryDayMethod();
|
|
|
|
|
|
|
|
AddSelectData();//添加下拉菜单
|
|
|
|
AddSelectData();//添加下拉菜单
|
|
|
|
//RefreshHourAmount();//小时产量
|
|
|
|
RefreshHourAmount();//小时产量
|
|
|
|
|
|
|
|
//RefreshMaterialStats();//型号产量
|
|
|
|
SheetMetalPlanTaskHandle.RefreshCurrentPlanInfoEvent += RefreshCurrentPlanInfo;
|
|
|
|
SheetMetalPlanTaskHandle.RefreshCurrentPlanInfoEvent += RefreshCurrentPlanInfo;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -669,17 +665,20 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
App.Current.Dispatcher.Invoke((Action)(() =>
|
|
|
|
App.Current.Dispatcher.Invoke((Action)(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//获取小时产量
|
|
|
|
//获取小时产量
|
|
|
|
string stationCode = Appsettings.app("StoreInfo", "StationCode");
|
|
|
|
string stationCode = Appsettings.app("StationInfo", "StationCode");
|
|
|
|
List<dynamic> hourAmount = _sysUserInfoServices.GetStationHourAmountAsync(stationCode);
|
|
|
|
List<dynamic> hourAmount = _taskExecutionPlanInfoServices.GetStationSheetMetalHourAmountAsync(stationCode).Result;
|
|
|
|
if (hourAmount != null)
|
|
|
|
if (hourAmount != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Achievement.Clear();
|
|
|
|
Achievement.Clear();
|
|
|
|
ProductionHourList = new List<string>();
|
|
|
|
ProductionHourList = new List<string>();
|
|
|
|
ChartValues<double> hourAchievement = new ChartValues<double>();
|
|
|
|
//ChartValues<double> hourAchievement = new ChartValues<double>();
|
|
|
|
|
|
|
|
ChartValues<ObservablePoint> hourAchievement = new ChartValues<ObservablePoint>();
|
|
|
|
foreach (var item in hourAmount)
|
|
|
|
foreach (var item in hourAmount)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
ObservablePoint point=new ObservablePoint(Convert.ToInt32(item.SIDPANELHOURAMOUNT), Convert.ToInt32(item.BACKPANELHOURAMOUNT));
|
|
|
|
ProductionHourList.Add(item.PRODUCT_HOUR);
|
|
|
|
ProductionHourList.Add(item.PRODUCT_HOUR);
|
|
|
|
hourAchievement.Add(Convert.ToDouble(item.PRODUCT_AMOUNT));
|
|
|
|
hourAchievement.Add(point);
|
|
|
|
|
|
|
|
//hourAchievement.Add(Convert.ToDouble(item.PRODUCT_AMOUNT));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var houeColumn = new ColumnSeries();
|
|
|
|
var houeColumn = new ColumnSeries();
|
|
|
|
houeColumn.DataLabels = true;
|
|
|
|
houeColumn.DataLabels = true;
|
|
|
@ -691,5 +690,55 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 刷新物料型号统计
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 刷新物料型号统计
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
private void RefreshMaterialStats()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
App.Current.Dispatcher.Invoke((Action)(() =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取物料型号统计
|
|
|
|
|
|
|
|
string stationCode = Appsettings.app("StationInfo", "StationCode");
|
|
|
|
|
|
|
|
List<dynamic> materialStats = _taskExecutionPlanInfoServices.GetStationMaterialStats(stationCode).Result;
|
|
|
|
|
|
|
|
var baseBomInfoList = _baseBomInfoServices.QueryAsync().Result;
|
|
|
|
|
|
|
|
var taskExecutionPlanInfo=_taskExecutionPlanInfoServices.QueryAsync(d=>d.ProductLineCode== stationCode).Result;
|
|
|
|
|
|
|
|
var recordBackPanelList = _recordBackPanelComplateServices.QueryAsync().Result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//有问题,需要修改才可以
|
|
|
|
|
|
|
|
var list = (from d in recordBackPanelList
|
|
|
|
|
|
|
|
join t in taskExecutionPlanInfo on d.PlanCode equals t.TaskCode
|
|
|
|
|
|
|
|
join b in baseBomInfoList on d.MaterialCode equals b.MaterialCode
|
|
|
|
|
|
|
|
select new
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MaterialCode=b.MaterialCode,
|
|
|
|
|
|
|
|
ProductPlanCode=t.ProductPlanCode,
|
|
|
|
|
|
|
|
CompleteAmount= t.CompleteAmount
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (list != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ModelStatistics.Clear();
|
|
|
|
|
|
|
|
MaterialNameList = new List<string>();
|
|
|
|
|
|
|
|
ChartValues<double> materialAchievement = new ChartValues<double>();
|
|
|
|
|
|
|
|
foreach (var item in materialStats)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MaterialNameList.Add(item.MATERIAL_NAME);
|
|
|
|
|
|
|
|
materialAchievement.Add(Convert.ToDouble(item.PRODUCT_AMOUNT));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var materialColumn = new ColumnSeries();
|
|
|
|
|
|
|
|
materialColumn.DataLabels = true;
|
|
|
|
|
|
|
|
materialColumn.Title = "型号";
|
|
|
|
|
|
|
|
materialColumn.Values = materialAchievement;
|
|
|
|
|
|
|
|
materialColumn.Foreground = Brushes.White;
|
|
|
|
|
|
|
|
ModelStatistics.Add(materialColumn);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|