|
|
|
@ -22,6 +22,7 @@ using log4net;
|
|
|
|
|
using Admin.Core.Common;
|
|
|
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
|
|
|
using System.Drawing.Drawing2D;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
/*
|
|
|
|
|
* 首页信息
|
|
|
|
|
*
|
|
|
|
@ -31,9 +32,19 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
public partial class IndexPageViewModel : ObservableObject
|
|
|
|
|
{
|
|
|
|
|
protected readonly IExecutePlanInfoServices? _taskExecutionPlanInfoServices;
|
|
|
|
|
|
|
|
|
|
int k = 100;
|
|
|
|
|
|
|
|
|
|
private AppConfigHelper appConfig = new AppConfigHelper();
|
|
|
|
|
List<SelectModel> list = new List<SelectModel>() { new SelectModel()
|
|
|
|
|
{
|
|
|
|
|
ID=1,
|
|
|
|
|
TypeName="手动"
|
|
|
|
|
},
|
|
|
|
|
new SelectModel()
|
|
|
|
|
{
|
|
|
|
|
ID=2,
|
|
|
|
|
TypeName="自动"
|
|
|
|
|
}};
|
|
|
|
|
|
|
|
|
|
#region 构造函数
|
|
|
|
|
public IndexPageViewModel()
|
|
|
|
|
{
|
|
|
|
|
_taskExecutionPlanInfoServices = App.ServiceProvider.GetService<IExecutePlanInfoServices>();
|
|
|
|
@ -42,14 +53,22 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
Job_SheetMetalTask_Quartz.SmEverDayDelegateEvent += InitEveryDayMethod;
|
|
|
|
|
Job_SheetMetalTask_Quartz.SmShowDelegateEvent += UpdatePlanSHow;//计划内容展示
|
|
|
|
|
WeakReferenceMessenger.Default.Register<string>(this, Recive);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Task.Run(async () =>
|
|
|
|
|
{
|
|
|
|
|
await LoadData();
|
|
|
|
|
await InitExecMethod();
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
InitEveryDayMethod();
|
|
|
|
|
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
|
|
|
|
LocationSource.Add(item);
|
|
|
|
|
}
|
|
|
|
|
SelectLocation = ReadFile();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 订单统计
|
|
|
|
|
|
|
|
|
@ -61,8 +80,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
|
|
|
|
|
PlanNum = info.PlanAmount;
|
|
|
|
|
RealQuantity = info.CompleteAmount;
|
|
|
|
|
|
|
|
|
|
DiffQuantity =Math.Abs(info.CompleteAmount-info.PlanAmount);
|
|
|
|
|
|
|
|
|
|
DiffQuantity = Math.Abs(info.CompleteAmount - info.PlanAmount);
|
|
|
|
|
CompletionRate = info.CompleteAmount / info.PlanAmount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -125,13 +144,13 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
#region 加载DataGrid数据
|
|
|
|
|
private async Task LoadData()
|
|
|
|
|
{
|
|
|
|
|
var list= await _taskExecutionPlanInfoServices.QueryAsync(d=>d.ProductLineCode.Contains("1001"));
|
|
|
|
|
var execList= list.OrderBy(d=>d.ExecuteOrder);
|
|
|
|
|
var list = await _taskExecutionPlanInfoServices.QueryAsync(d => d.ProductLineCode.Contains("1001"));
|
|
|
|
|
var execList = list.OrderBy(d => d.ExecuteOrder);
|
|
|
|
|
int i = 1;
|
|
|
|
|
string planType=string.Empty;
|
|
|
|
|
string planType = string.Empty;
|
|
|
|
|
foreach (var item in execList)
|
|
|
|
|
{
|
|
|
|
|
TaskExecModel task=new TaskExecModel();
|
|
|
|
|
TaskExecModel task = new TaskExecModel();
|
|
|
|
|
task.No = i;
|
|
|
|
|
task.ID = item.ObjId.ToString();
|
|
|
|
|
task.OrderCode = item.OrderCode;
|
|
|
|
@ -141,7 +160,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
task.CompleteAmount = item.CompleteAmount;
|
|
|
|
|
task.BeginTime = item.BeginTime;
|
|
|
|
|
task.IsExec = item.ExecuteStatus;
|
|
|
|
|
if (item.PlanType==1)
|
|
|
|
|
if (item.PlanType == 1)
|
|
|
|
|
{
|
|
|
|
|
planType = "前后板联动";
|
|
|
|
|
}
|
|
|
|
@ -155,7 +174,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
}
|
|
|
|
|
task.PlanType = planType;
|
|
|
|
|
task.TaskCode = item.TaskCode;
|
|
|
|
|
|
|
|
|
|
task.ExecuteStatus= item.ExecuteStatus;
|
|
|
|
|
|
|
|
|
|
PlanInfoDataGrid.Add(task);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
@ -213,7 +233,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
PlanInfoDataGrid.Clear();
|
|
|
|
|
LoadData();
|
|
|
|
|
MessageBox.Show("执行计划删除成功", "系统信息");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -274,7 +294,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private void SplitPlan()
|
|
|
|
|
{
|
|
|
|
|
SplitPlanView split=new SplitPlanView();
|
|
|
|
|
SplitPlanView split = new SplitPlanView();
|
|
|
|
|
split.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
@ -288,7 +308,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
{
|
|
|
|
|
MaterialStatisticsView model = new MaterialStatisticsView();
|
|
|
|
|
model.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
@ -326,8 +346,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
private string _productModel;
|
|
|
|
|
public string ProductModel
|
|
|
|
|
{
|
|
|
|
|
get=>_productModel;
|
|
|
|
|
set=> SetProperty(ref _productModel, value);
|
|
|
|
|
get => _productModel;
|
|
|
|
|
set => SetProperty(ref _productModel, value);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -427,7 +447,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
{
|
|
|
|
|
get { return materialNameList; }
|
|
|
|
|
set { materialNameList = value; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 型号统计柱状图
|
|
|
|
@ -440,8 +460,65 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
{
|
|
|
|
|
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 刷新列表-其他界面刷新该方法
|
|
|
|
@ -450,10 +527,13 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="recipient"></param>
|
|
|
|
|
/// <param name="message"></param>
|
|
|
|
|
private async void Recive(object recipient, object message)
|
|
|
|
|
private async void Recive(object recipient, string message)
|
|
|
|
|
{
|
|
|
|
|
PlanInfoDataGrid.Clear();
|
|
|
|
|
await LoadData();
|
|
|
|
|
if (message== "Refresh")
|
|
|
|
|
{
|
|
|
|
|
PlanInfoDataGrid.Clear();
|
|
|
|
|
await LoadData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -474,10 +554,24 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
MesMOrderCode = info.ProductPlanCode;
|
|
|
|
|
ProductModel = info.MaterialName;
|
|
|
|
|
BeginTime = info.BeginTime.ToString();
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
#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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|