|
|
|
|
using Aucma.Core.SheetMetal.Models;
|
|
|
|
|
using Aucma.Core.SheetMetal.Views;
|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Admin.Core.IService;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Aucma.Core.SheetMetal.Common;
|
|
|
|
|
using Admin.Core.Tasks;
|
|
|
|
|
using CommunityToolkit.Mvvm.Messaging;
|
|
|
|
|
using LiveCharts;
|
|
|
|
|
using LiveCharts.Wpf;
|
|
|
|
|
using Admin.Core.Model;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using log4net;
|
|
|
|
|
using Admin.Core.Common;
|
|
|
|
|
using LiveCharts.Defaults;
|
|
|
|
|
/*
|
|
|
|
|
* 首页信息
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
{
|
|
|
|
|
public partial class IndexPageViewModel : ObservableObject
|
|
|
|
|
{
|
|
|
|
|
protected readonly IExecutePlanInfoServices? _taskExecutionPlanInfoServices;
|
|
|
|
|
|
|
|
|
|
private AppConfigHelper appConfig = new AppConfigHelper();
|
|
|
|
|
List<SelectModel> list = new List<SelectModel>() { new SelectModel()
|
|
|
|
|
{
|
|
|
|
|
ID=1,
|
|
|
|
|
TypeName="手动"
|
|
|
|
|
},
|
|
|
|
|
new SelectModel()
|
|
|
|
|
{
|
|
|
|
|
ID=2,
|
|
|
|
|
TypeName="自动"
|
|
|
|
|
}};
|
|
|
|
|
public Func<double, string> Formatter { get; set; }
|
|
|
|
|
|
|
|
|
|
#region 构造函数
|
|
|
|
|
public IndexPageViewModel()
|
|
|
|
|
{
|
|
|
|
|
_taskExecutionPlanInfoServices = App.ServiceProvider.GetService<IExecutePlanInfoServices>();
|
|
|
|
|
StationName = Appsettings.app("StoreInfo", "StationName");
|
|
|
|
|
//Job_SheetMetalTask_Quartz.SmEverDayDelegateEvent += InitEveryDayMethod;
|
|
|
|
|
Job_SheetMetalTask_Quartz.SmTaskDelegateEvent += UpdatePlanSHow;//计划内容展示
|
|
|
|
|
WeakReferenceMessenger.Default.Register<string>(this, Recive);
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(LoadData(), InitExecMethod());
|
|
|
|
|
InitEveryDayMethod();
|
|
|
|
|
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
|
|
|
|
LocationSource.Add(item);
|
|
|
|
|
}
|
|
|
|
|
SelectLocation = ReadFile();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 订单统计
|
|
|
|
|
|
|
|
|
|
private async Task InitExecMethod()
|
|
|
|
|
{
|
|
|
|
|
string station = Appsettings.app("StoreInfo", "StationCode");
|
|
|
|
|
ExecutePlanInfo info = await _taskExecutionPlanInfoServices.FirstAsync(d => d.ProductLineCode.Equals(station) && d.ExecuteStatus == 2);
|
|
|
|
|
if (info == null) return;
|
|
|
|
|
|
|
|
|
|
PlanNum = info.PlanAmount;
|
|
|
|
|
RealQuantity = info.CompleteAmount;
|
|
|
|
|
|
|
|
|
|
DiffQuantity = Math.Abs(info.CompleteAmount - info.PlanAmount);
|
|
|
|
|
CompletionRate = info.CompleteAmount / info.PlanAmount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 日产量
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 每日生产
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private Task InitEveryDayMethod()
|
|
|
|
|
{
|
|
|
|
|
#region 按时间统计
|
|
|
|
|
ChartValues<ObservablePoint> achievement = new ChartValues<ObservablePoint>
|
|
|
|
|
{
|
|
|
|
|
new ObservablePoint(0, 8),
|
|
|
|
|
new ObservablePoint(1, 14),
|
|
|
|
|
new ObservablePoint(2, 10),
|
|
|
|
|
new ObservablePoint(3, 5),
|
|
|
|
|
new ObservablePoint(4, 11),
|
|
|
|
|
new ObservablePoint(5, 15),
|
|
|
|
|
new ObservablePoint(6, 7),
|
|
|
|
|
new ObservablePoint(7, 3),
|
|
|
|
|
new ObservablePoint(8, 13),
|
|
|
|
|
new ObservablePoint(9, 11),
|
|
|
|
|
new ObservablePoint(10, 8),
|
|
|
|
|
new ObservablePoint(11, 5)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var column = new ColumnSeries();
|
|
|
|
|
column.DataLabels = true;
|
|
|
|
|
column.Title = "前板";
|
|
|
|
|
column.Values = achievement;
|
|
|
|
|
column.Foreground = Brushes.White;
|
|
|
|
|
//柱子宽度
|
|
|
|
|
//column.Width = 30;
|
|
|
|
|
//column.MaxColumnWidth = 30;
|
|
|
|
|
//column.LabelsPosition = BarLabelPosition.Perpendicular;
|
|
|
|
|
//column.Fill = new SolidColorBrush(Color.FromRgb(34, 139, 34)); //柱状图颜色填充
|
|
|
|
|
//column.LabelPoint = p => p.Y.ToString(); //柱状图数据显示位置
|
|
|
|
|
|
|
|
|
|
ProductionHourList = new List<string>()
|
|
|
|
|
{
|
|
|
|
|
"7:30", "8:80", "9:30", "10:30", "11:30", "12:30", "13:30", "14:30", "15:30", "16:30", "17:30", "18:30"
|
|
|
|
|
};
|
|
|
|
|
//Formatter = value => value.ToString("N");
|
|
|
|
|
Achievement.Add(column);
|
|
|
|
|
|
|
|
|
|
Achievement.Add(new ColumnSeries
|
|
|
|
|
{
|
|
|
|
|
DataLabels = true,
|
|
|
|
|
Title = "后板",
|
|
|
|
|
Values = achievement,
|
|
|
|
|
Fill = new SolidColorBrush(Color.FromRgb(15,209,226)),
|
|
|
|
|
Foreground = Brushes.CadetBlue
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 按类型统计
|
|
|
|
|
ChartValues<double> achievement2 = new ChartValues<double>();
|
|
|
|
|
Random random2 = new Random();
|
|
|
|
|
for (int i = 0; i < 2; i++)
|
|
|
|
|
{
|
|
|
|
|
achievement2.Add(random2.Next(60, 100));
|
|
|
|
|
}
|
|
|
|
|
var column2 = new ColumnSeries();
|
|
|
|
|
column2.DataLabels = true;
|
|
|
|
|
column2.Title = "前板";
|
|
|
|
|
column2.Values = achievement2;
|
|
|
|
|
column2.Foreground = Brushes.White;
|
|
|
|
|
ModelStatistics.Add(column2);
|
|
|
|
|
|
|
|
|
|
ModelStatistics.Add(new ColumnSeries()
|
|
|
|
|
{
|
|
|
|
|
DataLabels = true,
|
|
|
|
|
Title = "后板",
|
|
|
|
|
Values = achievement2,
|
|
|
|
|
Fill = new SolidColorBrush(Color.FromRgb(15, 209, 226)),
|
|
|
|
|
Foreground = Brushes.White,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
MaterialNameList = new List<string>()
|
|
|
|
|
{
|
|
|
|
|
"玻璃门,SC-439", "玻璃门,SC-439,AC"
|
|
|
|
|
};
|
|
|
|
|
#endregion
|
|
|
|
|
//await InitExecMethod();
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 计划列表
|
|
|
|
|
|
|
|
|
|
#region 加载DataGrid数据
|
|
|
|
|
private async Task LoadData()
|
|
|
|
|
{
|
|
|
|
|
string productLineCode = Appsettings.app("StoreInfo", "ProductLineCode");
|
|
|
|
|
var list = await _taskExecutionPlanInfoServices.QueryAsync(d => d.ProductLineCode.Contains(productLineCode));
|
|
|
|
|
var execList = list.OrderBy(d => d.ExecuteOrder);
|
|
|
|
|
int i = 1;
|
|
|
|
|
string planType = string.Empty;
|
|
|
|
|
foreach (var item in execList)
|
|
|
|
|
{
|
|
|
|
|
TaskExecModel task = new TaskExecModel();
|
|
|
|
|
task.No = i;
|
|
|
|
|
task.ID = item.ObjId.ToString();
|
|
|
|
|
task.OrderCode = item.OrderCode;
|
|
|
|
|
task.MaterialCode = item.MaterialCode;
|
|
|
|
|
task.MaterialName = item.MaterialName;
|
|
|
|
|
task.TaskAmount = item.PlanAmount;
|
|
|
|
|
task.CompleteAmount = item.CompleteAmount;
|
|
|
|
|
task.BeginTime = item.BeginTime;
|
|
|
|
|
task.IsExec = item.ExecuteStatus;//执行状态
|
|
|
|
|
if (item.PlanType == 1)
|
|
|
|
|
{
|
|
|
|
|
planType = "前后板联动";
|
|
|
|
|
}
|
|
|
|
|
if (item.PlanType == 2)
|
|
|
|
|
{
|
|
|
|
|
planType = "前板计划";
|
|
|
|
|
}
|
|
|
|
|
if (item.PlanType == 3)
|
|
|
|
|
{
|
|
|
|
|
planType = "后板计划";
|
|
|
|
|
}
|
|
|
|
|
task.PlanType = planType;
|
|
|
|
|
task.TaskCode = item.TaskCode;
|
|
|
|
|
task.ExecuteStatus= item.ExecuteStatus;//执行状态
|
|
|
|
|
|
|
|
|
|
PlanInfoDataGrid.Add(task);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 向上
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 向上
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private async Task MoveUp(string Id)
|
|
|
|
|
{
|
|
|
|
|
string stationCode = Appsettings.app("StoreInfo", "StationCode");
|
|
|
|
|
bool result = await _taskExecutionPlanInfoServices.PlanMoveUp(Id, stationCode);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
PlanInfoDataGrid.Clear();
|
|
|
|
|
await LoadData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 向下
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 向下
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private async Task MoveDown(string Id)
|
|
|
|
|
{
|
|
|
|
|
string stationCode = Appsettings.app("StoreInfo", "StationCode");
|
|
|
|
|
bool result = await _taskExecutionPlanInfoServices.PlanMoveDown(Id, stationCode);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
PlanInfoDataGrid.Clear();
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 删除
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private async Task DeletePlan(string Id)
|
|
|
|
|
{
|
|
|
|
|
MessageBoxResult msg = MessageBox.Show("确定要删除吗?", "系统提醒", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
|
|
|
|
|
if (MessageBoxResult.Yes == msg)
|
|
|
|
|
{
|
|
|
|
|
bool result = await _taskExecutionPlanInfoServices.ExecPlanDelete(Id);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
PlanInfoDataGrid.Clear();
|
|
|
|
|
LoadData();
|
|
|
|
|
MessageBox.Show("执行计划删除成功", "系统信息");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("执行计划删除失败", "系统信息");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 下传计划
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下传计划
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private async Task NextPass(string Id)
|
|
|
|
|
{
|
|
|
|
|
MessageBoxResult msg = MessageBox.Show("确定要下发计划吗?", "系统提醒", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
|
|
|
|
|
if (MessageBoxResult.Yes != msg) return;
|
|
|
|
|
|
|
|
|
|
var model = await _taskExecutionPlanInfoServices.FirstAsync(d => d.ObjId == int.Parse(Id));
|
|
|
|
|
if (model.ExecuteStatus == 2)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("该计划正在执行中,请勿重复下传", "系统信息");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var result = _taskExecutionPlanInfoServices.PlanNextPass(model);
|
|
|
|
|
if (result != null)
|
|
|
|
|
{
|
|
|
|
|
//刷新列表
|
|
|
|
|
MessageBox.Show("执行计划已下达", "系统信息");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("执行计划下达失败", "系统信息");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 初始化datagrid
|
|
|
|
|
private ObservableCollection<TaskExecModel> planInfoDataGrid = new ObservableCollection<TaskExecModel>();
|
|
|
|
|
public ObservableCollection<TaskExecModel> PlanInfoDataGrid
|
|
|
|
|
{
|
|
|
|
|
get { return planInfoDataGrid; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
planInfoDataGrid = value;
|
|
|
|
|
OnPropertyChanged();//属性通知
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 计划拆分执行
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 计划拆分执行
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private void SplitPlan()
|
|
|
|
|
{
|
|
|
|
|
SplitPlanView split = new SplitPlanView();
|
|
|
|
|
split.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 物料库存
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物料库存
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private void InventoryStatistics()
|
|
|
|
|
{
|
|
|
|
|
MaterialStatisticsView model = new MaterialStatisticsView();
|
|
|
|
|
model.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 执行计划
|
|
|
|
|
|
|
|
|
|
#region 工位名称
|
|
|
|
|
private string _stationName;
|
|
|
|
|
public string StationName
|
|
|
|
|
{
|
|
|
|
|
get => _stationName;
|
|
|
|
|
set => SetProperty(ref _stationName, value);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 订单编号
|
|
|
|
|
private string _orderCode;
|
|
|
|
|
public string OrderCode
|
|
|
|
|
{
|
|
|
|
|
get => _orderCode;
|
|
|
|
|
set => SetProperty(ref _orderCode, value);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 计划编号
|
|
|
|
|
private string _mesMOrderCode;
|
|
|
|
|
public string MesMOrderCode
|
|
|
|
|
{
|
|
|
|
|
get => _mesMOrderCode;
|
|
|
|
|
set => SetProperty(ref _mesMOrderCode, value);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 成品型号
|
|
|
|
|
private string _productModel;
|
|
|
|
|
public string ProductModel
|
|
|
|
|
{
|
|
|
|
|
get => _productModel;
|
|
|
|
|
set => SetProperty(ref _productModel, value);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 开始时间
|
|
|
|
|
private string _beginTime;
|
|
|
|
|
public string BeginTime
|
|
|
|
|
{
|
|
|
|
|
get => _beginTime;
|
|
|
|
|
set => SetProperty(ref _beginTime, value);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 计划数量
|
|
|
|
|
private int _planNum;
|
|
|
|
|
public int PlanNum
|
|
|
|
|
{
|
|
|
|
|
get => _planNum;
|
|
|
|
|
set => SetProperty(ref _planNum, value);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 计划最大值
|
|
|
|
|
/// </summary>
|
|
|
|
|
private int _planMaxNum;
|
|
|
|
|
public int PlanMaxNum
|
|
|
|
|
{
|
|
|
|
|
get => _planMaxNum;
|
|
|
|
|
set => SetProperty(ref _planMaxNum, value);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 实际数量
|
|
|
|
|
private int _realQuantity;
|
|
|
|
|
public int RealQuantity
|
|
|
|
|
{
|
|
|
|
|
get => _realQuantity;
|
|
|
|
|
set => SetProperty(ref _realQuantity, value);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 差异数量
|
|
|
|
|
private int _diffQuantity;
|
|
|
|
|
public int DiffQuantity
|
|
|
|
|
{
|
|
|
|
|
get => _diffQuantity;
|
|
|
|
|
set => SetProperty(ref _diffQuantity, value);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 完成率
|
|
|
|
|
private double _completionRate;
|
|
|
|
|
public double CompletionRate
|
|
|
|
|
{
|
|
|
|
|
get => _completionRate;
|
|
|
|
|
set => SetProperty(ref _completionRate, value);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 当日产量
|
|
|
|
|
|
|
|
|
|
#region 日产量柱状图X轴日期
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 日产量柱状图X轴日期
|
|
|
|
|
/// </summary>
|
|
|
|
|
private List<string> productionHourList;
|
|
|
|
|
|
|
|
|
|
public List<string> ProductionHourList
|
|
|
|
|
{
|
|
|
|
|
get { return productionHourList; }
|
|
|
|
|
set { productionHourList = value; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 日产量柱状图
|
|
|
|
|
/// </summary>
|
|
|
|
|
private SeriesCollection achievement = new SeriesCollection();
|
|
|
|
|
|
|
|
|
|
public SeriesCollection Achievement
|
|
|
|
|
{
|
|
|
|
|
get { return achievement; }
|
|
|
|
|
set { achievement = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 型号统计
|
|
|
|
|
|
|
|
|
|
#region 型号统计柱状图x轴物料类型
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 型号统计柱状图x轴物料类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
private List<string> materialNameList;
|
|
|
|
|
|
|
|
|
|
public List<string> MaterialNameList
|
|
|
|
|
{
|
|
|
|
|
get { return materialNameList; }
|
|
|
|
|
set { materialNameList = value; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 型号统计柱状图
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 型号统计柱状图
|
|
|
|
|
/// </summary>
|
|
|
|
|
private SeriesCollection modelStatistics = new SeriesCollection();
|
|
|
|
|
|
|
|
|
|
public SeriesCollection ModelStatistics
|
|
|
|
|
{
|
|
|
|
|
get { return modelStatistics; }
|
|
|
|
|
set { modelStatistics = value; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 下拉框 选择执行状态
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下拉框 选择执行状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
private string materialTypeCombox;
|
|
|
|
|
public string MaterialTypeCombox
|
|
|
|
|
{
|
|
|
|
|
get { return materialTypeCombox; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
materialTypeCombox = value;
|
|
|
|
|
SetProperty(ref materialTypeCombox, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 当ComboBox选中项更改时发生
|
|
|
|
|
/// </summary>
|
|
|
|
|
private SelectModel _selectLocation;
|
|
|
|
|
|
|
|
|
|
public SelectModel SelectLocation
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._selectLocation;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._selectLocation = value;
|
|
|
|
|
//这里操作更改变化的值
|
|
|
|
|
//MessageBox.Show(_selectLocation.ID);
|
|
|
|
|
if (_selectLocation != null)
|
|
|
|
|
{
|
|
|
|
|
WriteFile(_selectLocation.ID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SetProperty(ref _selectLocation, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ObservableCollection<SelectModel> _locationRoad = new ObservableCollection<SelectModel>();
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 集合数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ObservableCollection<SelectModel> LocationSource
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._locationRoad;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
SetProperty(ref _locationRoad, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 刷新列表-其他界面刷新该方法
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 刷新列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="recipient"></param>
|
|
|
|
|
/// <param name="message"></param>
|
|
|
|
|
private async void Recive(object recipient, string message)
|
|
|
|
|
{
|
|
|
|
|
if (message== "Refresh")
|
|
|
|
|
{
|
|
|
|
|
PlanInfoDataGrid.Clear();
|
|
|
|
|
await LoadData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 刷新界面显示数据
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 刷新界面显示数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="info"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task UpdatePlanSHow()
|
|
|
|
|
{
|
|
|
|
|
string stationCode = Appsettings.app("StoreInfo", "StationCode");
|
|
|
|
|
var info =await _taskExecutionPlanInfoServices.FirstAsync(d=>d.ExecuteStatus==3&& d.ProductLineCode == stationCode);
|
|
|
|
|
if (info == null) return;
|
|
|
|
|
|
|
|
|
|
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
PlanMaxNum = info.PlanAmount;
|
|
|
|
|
OrderCode = info.OrderCode;
|
|
|
|
|
MesMOrderCode = info.ProductPlanCode;
|
|
|
|
|
ProductModel = info.MaterialName;
|
|
|
|
|
BeginTime = info.BeginTime.ToString();
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 读写文件
|
|
|
|
|
public void WriteFile(int obj)
|
|
|
|
|
{
|
|
|
|
|
//写入到配置文件中
|
|
|
|
|
appConfig.queryExec = obj.ToString();
|
|
|
|
|
}
|
|
|
|
|
public SelectModel ReadFile()
|
|
|
|
|
{
|
|
|
|
|
//读取入到配置文件中
|
|
|
|
|
var queryExec = appConfig.queryExec;
|
|
|
|
|
var model = list.FirstOrDefault(d => d.ID == int.Parse(queryExec));
|
|
|
|
|
return model;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|