change-新发泡首页图表

dev
liuwf 1 year ago
parent a1eae00139
commit 73cf28eff3

@ -111,11 +111,11 @@ namespace Aucma.Core.BoxFoam.Business
spaceAddresses.Add(spaceConfig.GetSpaceAddress(storeCode, space.SpaceCode)); spaceAddresses.Add(spaceConfig.GetSpaceAddress(storeCode, space.SpaceCode));
} }
// 模拟入库 // 模拟入库
Task.Run(() => //Task.Run(() =>
{ //{
Thread.Sleep(2000); // Thread.Sleep(2000);
InStore("B24010181060282920011"); // InStore("B24010181060282920011");
}); //});
//实时监测入库任务下发和入库任务完成 //实时监测入库任务下发和入库任务完成
StartPassDownAndRealInstoreFinish(); StartPassDownAndRealInstoreFinish();
@ -191,12 +191,13 @@ namespace Aucma.Core.BoxFoam.Business
{ {
logHelper.Info($"下发泡前入库任务:{taskInfo.TaskCode};仓库{taskInfo.StoreCode};货道:{taskInfo.SpaceCode}"); logHelper.Info($"下发泡前入库任务:{taskInfo.TaskCode};仓库{taskInfo.StoreCode};货道:{taskInfo.SpaceCode}");
LogDelegateEvent?.Invoke($"下发泡前入库任务:{taskInfo.TaskCode};仓库{taskInfo.StoreCode};货道:{taskInfo.SpaceCode}"); LogDelegateEvent?.Invoke($"下发泡前入库任务:{taskInfo.TaskCode};仓库{taskInfo.StoreCode};货道:{taskInfo.SpaceCode},等待plc反馈");
if (SendFoamTask_InStore(taskInfo)) if (SendFoamTask_InStore(taskInfo))
{ {
logHelper.Info($"泡前入库任务:{taskInfo.TaskCode}下发成功等待PLC执行反馈"); logHelper.Info($"泡前入库任务:{taskInfo.TaskCode}下发成功等待PLC执行反馈");
semaphore.Wait(); //一直堵塞直到信号量释放 semaphore.Wait(); //一直堵塞直到信号量释放
logHelper.Info($"箱壳入库任务:{taskInfo.TaskCode};开始执行"); logHelper.Info($"箱壳入库任务:{taskInfo.TaskCode};开始执行");
LogDelegateEvent?.Invoke($"箱壳入库任务:{taskInfo.TaskCode};开始执行");
taskInfo.TaskStatus = 2; taskInfo.TaskStatus = 2;
_realTaskInfoService.UpdateAsync(taskInfo); _realTaskInfoService.UpdateAsync(taskInfo);
@ -206,7 +207,7 @@ namespace Aucma.Core.BoxFoam.Business
_baseSpaceInfoServices.UpdateSpaceInfo(spaceInfo); _baseSpaceInfoServices.UpdateSpaceInfo(spaceInfo);
#endregion #endregion
RefreshInStoreTaskEvent?.Invoke(taskInfo);//刷新datagrid 列表 RefreshDataGridDelegateEvent?.Invoke();//刷新datagrid 列表
// logHelper.Info($"泡后入库任务:{taskInfo.TaskCode};执行完成"); // logHelper.Info($"泡后入库任务:{taskInfo.TaskCode};执行完成");
// 刷新入库任务列表 // 刷新入库任务列表
@ -291,7 +292,7 @@ namespace Aucma.Core.BoxFoam.Business
//completion.CompleteDate = DateTime.Now; //completion.CompleteDate = DateTime.Now;
//await _iMaterialCompletionServices.AddAsync(completion); //await _iMaterialCompletionServices.AddAsync(completion);
#endregion #endregion
// RefreshDataGridDelegateEvent?.Invoke(); RefreshDataGridDelegateEvent?.Invoke();
await _baseSpaceInfoServices.UpdateSpaceInfo(spaceInfo); await _baseSpaceInfoServices.UpdateSpaceInfo(spaceInfo);
} }
} }
@ -585,7 +586,11 @@ namespace Aucma.Core.BoxFoam.Business
{ {
LogDelegateEvent?.Invoke($"入库完成,更新数据库成功"); LogDelegateEvent?.Invoke($"入库完成,更新数据库成功");
} }
else
{
LogDelegateEvent?.Invoke($"更新数据库异常"); LogDelegateEvent?.Invoke($"更新数据库异常");
}
} }
////清除任务信息 ////清除任务信息
//await _realTaskInfoService.DeleteTaskInfo(taskCode, storeCode); //await _realTaskInfoService.DeleteTaskInfo(taskCode, storeCode);

@ -12,6 +12,8 @@ using Admin.Core.Common;
using Admin.Core.Model.ViewModels; using Admin.Core.Model.ViewModels;
using System.Threading; using System.Threading;
using Aucma.Core.BoxFoam.Business; using Aucma.Core.BoxFoam.Business;
using Admin.Core.Model;
using System.Collections.Generic;
/* /*
* *
*/ */
@ -24,29 +26,24 @@ namespace Aucma.Core.BoxFoam.ViewModels
private ObservableCollection<dynamic> listItems = new ObservableCollection<dynamic>(); private ObservableCollection<dynamic> listItems = new ObservableCollection<dynamic>();
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(IndexPageViewModel)); private static readonly log4net.ILog log = LogManager.GetLogger(typeof(IndexPageViewModel));
public readonly IRecordInStoreServices? _recordInstoreServices; public readonly IRecordInStoreServices? _recordInstoreServices;
private readonly IRealTaskInfoServices? _realTaskInfoService;
private InStoreBusiness inStoreBusiness = InStoreBusiness.Instance; private InStoreBusiness inStoreBusiness = InStoreBusiness.Instance;
public IndexPageViewModel() public IndexPageViewModel()
{ {
inStoreBusiness.init(); inStoreBusiness.init();
_recordInstoreServices = App.ServiceProvider.GetService<IRecordInStoreServices>(); _recordInstoreServices = App.ServiceProvider.GetService<IRecordInStoreServices>();
//Job_BoxFoamInStoreTask_Quartz.RefreshDataGridDelegateEvent += LoadData;//刷新底部列表 _realTaskInfoService =App.ServiceProvider.GetService<IRealTaskInfoServices>();
//Job_BoxFoamInStoreTask_Quartz.RefreshDataGridDelegateEvent += LoadData;//刷新底部列表
InStoreBusiness.RefreshDataGridDelegateEvent += LoadData;//刷新底部列表 InStoreBusiness.RefreshDataGridDelegateEvent += LoadData;//刷新底部列表
// Job_TestTask_Quartz.DataGridDelegateEvent += ExecMethod;//刷新日志 // Job_TestTask_Quartz.DataGridDelegateEvent += ExecMethod;//刷新日志
// Job_BoxFoamInStoreTask_Quartz.RefreshScanMateriaCodeEvent += RefreshScanInfo;//扫码信息刷新 // Job_BoxFoamInStoreTask_Quartz.RefreshScanMateriaCodeEvent += RefreshScanInfo;//扫码信息刷新
InStoreBusiness.RefreshScanMateriaCodeEvent += RefreshScanInfo;//扫码信息刷新 InStoreBusiness.RefreshScanMateriaCodeEvent += RefreshScanInfo;//扫码信息刷新
// Job_BoxFoamInStoreTask_Quartz.LogDelegateEvent += PrintMessageToListBox;//入库日志事件 // Job_BoxFoamInStoreTask_Quartz.LogDelegateEvent += PrintMessageToListBox;//入库日志事件
InStoreBusiness.LogDelegateEvent += PrintMessageToListBox;//入库日志事件 InStoreBusiness.LogDelegateEvent += PrintMessageToListBox;//入库日志事件
ExecMethod(); LoadData();
} }
public async Task ExecMethod()
{
System.Windows.Application.Current.Dispatcher.Invoke((Action)(async () =>
{
PlanInfoDataGrid.Clear();
await LoadData();
}));
}
#region 扫描记录 data #region 扫描记录 data
@ -57,28 +54,23 @@ namespace Aucma.Core.BoxFoam.ViewModels
var storeCode = Appsettings.app("StoreInfo", "BeforeStoreCode"); var storeCode = Appsettings.app("StoreInfo", "BeforeStoreCode");
DateTime startTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")); DateTime startTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
DateTime endTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59")); DateTime endTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
List<RealTaskInfo> list = _realTaskInfoService.QueryAsync(x=>x.StoreCode.Equals(storeCode)).Result.OrderBy(x=>x.CreateTime).Take(4).ToList();
System.Windows.Application.Current.Dispatcher.Invoke((Action)(async () => System.Windows.Application.Current.Dispatcher.Invoke((Action)(async () =>
{ {
PlanInfoDataGrid.Clear(); PlanInfoDataGrid.Clear();
int i = 1; int i = 1;
try try
{ {
foreach (var item in list)
var list = await _recordInstoreServices.SaveRecordToDb(storeCode, startTime, endTime);
foreach (var item in list.OrderByDescending(d => d.No))
{ {
PlanInfoDataGrid.Add(new EnterLibView() PlanInfoDataGrid.Add(new RealTaskInfo()
{ {
No = i, TaskCode = item.TaskCode,
PlanCode = item.PlanCode,
MaterialCode = item.MaterialCode, MaterialCode = item.MaterialCode,
MaterialName = item.MaterialName, MaterialType = item.MaterialType,
MaterialBarCode = item.MaterialBarCode, SpaceName = item.SpaceName,
EnterSpace = item.EnterSpace, CreateTime = item.CreateTime,
ExecDateTime = item.ExecDateTime, TaskStatus = item.TaskStatus
Status = item.Status
}); });
i++; i++;
}; };
@ -95,8 +87,8 @@ namespace Aucma.Core.BoxFoam.ViewModels
#endregion #endregion
#region 初始化datagrid #region 初始化datagrid
private ObservableCollection<EnterLibView> planInfoDataGrid = new ObservableCollection<EnterLibView>(); private ObservableCollection<RealTaskInfo> planInfoDataGrid = new ObservableCollection<RealTaskInfo>();
public ObservableCollection<EnterLibView> PlanInfoDataGrid public ObservableCollection<RealTaskInfo> PlanInfoDataGrid
{ {
get { return planInfoDataGrid; } get { return planInfoDataGrid; }
set set

@ -12,7 +12,7 @@
<UserControl.Resources> <UserControl.Resources>
<Style x:Key="DataGridTextColumnCenterSytle" TargetType="{x:Type TextBlock}"> <Style x:Key="DataGridTextColumnCenterSytle" TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="HorizontalAlignment" Value="Center" />
</Style> </Style>
<Style TargetType="DataGrid"> <Style TargetType="DataGrid">
@ -53,7 +53,7 @@
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}"> <ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}" > <Grid Background="{TemplateBinding Background}" >
<ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center" /> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
@ -193,14 +193,14 @@
Foreground="White" > Foreground="White" >
<!--修改选中字体颜色--> <!--修改选中字体颜色-->
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Binding="{Binding No}" Header="编号" Width="auto" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <!--<DataGridTextColumn Binding="{Binding No}" Header="编号" Width="auto" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>-->
<DataGridTextColumn Binding="{Binding PlanCode}" Header="计划编号" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding TaskCode}" Header="任务编号" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding MaterialBarCode}" Header="物料条码" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding MaterialCode}" Header="物料条码" Width="2*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding MaterialCode}" Header="物料编码" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" /> <DataGridTextColumn Binding="{Binding MaterialType}" Header="物料类型" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" />
<DataGridTextColumn Binding="{Binding MaterialName}" Header="物料名称" Width="2*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" /> <!--<DataGridTextColumn Binding="{Binding MaterialName}" Header="物料名称" Width="2*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" />-->
<DataGridTextColumn Binding="{Binding EnterSpace}" Header="入库货道" Width="*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding SpaceName}" Header="入库货道" Width="*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding ExecDateTime ,StringFormat=\{0:MM-dd HH:mm\}}" Header="执行时间" Width="1.5*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding CreateTime,StringFormat=\{0:yyyy-MM-dd HH:mm\}}" Header="创建时间" Width="1.5*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding Status}" Header="状态" Width="*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding TaskStatus}" Header="状态" Width="0.5*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<!--<DataGridTextColumn Binding="{Binding CompleteAmount}" Header="设备号" Width="*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>--> <!--<DataGridTextColumn Binding="{Binding CompleteAmount}" Header="设备号" Width="*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>-->
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>

Loading…
Cancel
Save