change - 总装计划小时统计、物料型号统计数据加载

foamRearStore
wenjy 11 months ago
parent c1657f7c73
commit aade66c847

Binary file not shown.

@ -278,5 +278,24 @@ namespace Aucma.Scada.Business
}
return planInfo;
}
/// <summary>
/// 获取小时产量
/// </summary>
/// <returns></returns>
public List<dynamic> GetHourAmount()
{
return _executePlanInfoService.GetStationHourAmount(appConfig.stationCode);
}
/// <summary>
/// 获取物料型号统计
/// </summary>
/// <returns></returns>
public List<dynamic> GetMaterialStats()
{
return _executePlanInfoService.GetStationMaterialStats(appConfig.stationCode);
}
}
}

@ -78,7 +78,7 @@
<Button Content="出库监控" x:Name="outstoreInfo" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=outstoreInfo}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
<Button Content="任务列表" x:Name="taskInfo" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=taskInfo}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
<Button Content="实时库存" x:Name="inventoryInfo" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=inventoryInfo}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
<Button Content="装计划" x:Name="assemblyPlan" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=assemblyPlan}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
<Button Content="装计划" x:Name="assemblyPlan" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=assemblyPlan}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
<!--<Button Content="日 志" x:Name="logInfo" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=logInfo}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>-->
<!--<Button Content="记 录" x:Name="record" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=record}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>-->
<Button Content="键 盘" Command="{Binding OpenSystemKeyboardCommand}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>

@ -110,12 +110,12 @@
<TextBox Width="200" Height="25" Margin="10 0 0 0" Text="{Binding Search}" Foreground="Gray" VerticalAlignment="Center" FontSize="15"/>
<!--resourceStyle 413行修改边框颜色-->
<TextBlock Text="物料类型" VerticalAlignment="Center" Foreground="Gray" FontSize="15" Margin="20,0,0,0"/>
<!--<TextBlock Text="物料类型" VerticalAlignment="Center" Foreground="Gray" FontSize="15" Margin="20,0,0,0"/>
<ComboBox Text="{Binding MaterialTypeCombox}" Width="200" Height="25" Margin="10 0 0 0" Foreground="Black" VerticalAlignment="Center" FontSize="15">
<ComboBoxItem Content="所有" IsSelected="True"/>
<ComboBoxItem Content="箱壳" />
<ComboBoxItem Content="内胆" />
</ComboBox>
</ComboBox>-->
<Button Content="查询" Command="{Binding QueryCommand}" Style="{StaticResource BUTTON_AGREE}" Background="#007DFA" BorderBrush="#007DFA" Foreground="White" Margin="20,0,0,0" Height="30" Width="80" />
<Button Content="重置" Command="{Binding ResetCommand}" Style="{StaticResource BUTTON_AGREE}" Background="#007DFA" BorderBrush="#007DFA" Foreground="White" Margin="20,0,0,0" Height="30" Width="80" />

@ -220,13 +220,13 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
PlanInfoDataGrid = new ObservableCollection<ExecutePlanInfo>();
if (executePlanInfos != null)
{
RefreshStatisticsGauge(executePlanInfos);
executePlanInfos.ForEach(
arg =>
{
PlanInfoDataGrid.Add(arg);
});
}
RefreshStatisticsGauge(executePlanInfos);
}
/// <summary>
@ -318,51 +318,6 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
public void Init()
{
RefreshDataGrid();
MaterialNameList = new List<string>()
{
"SC232",
"SA124",
"SC387",
"SC211",
"DQ196",
};
ChartValues<double> achievement = new ChartValues<double>();
Random random = new Random();
for (int i = 0; i < 5; i++)
{
achievement.Add(random.Next(60, 100));
}
var column = new ColumnSeries();
column.DataLabels = true;
column.Title = "型号";
column.Values = achievement;
ModelStatistics.Add(column);
ProductionHourList = new List<string>()
{
"12",
"13",
"14",
"15",
"16",
};
ChartValues<double> achievement2 = new ChartValues<double>();
Random random2 = new Random();
for (int i = 0; i < 5; i++)
{
achievement2.Add(random2.Next(60, 100));
}
var column2 = new ColumnSeries();
column2.DataLabels = true;
column2.Title = "产量";
column2.Values = achievement2;
Achievement.Add(column2);
}
/// <summary>
@ -431,7 +386,68 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
DiffAmount = 0;
CompleRoution =string.Empty;
}
RefreshMaterialStats();
RefreshHourAmount();
}
}
/// <summary>
/// 刷新物料型号统计
/// </summary>
private void RefreshMaterialStats()
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
//获取物料型号统计
List<dynamic> materialStats = assemblyPlanBusiness.GetMaterialStats();
if (materialStats != 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;
ModelStatistics.Add(materialColumn);
}
}));
}
/// <summary>
/// 刷新小时产量统计
/// </summary>
private void RefreshHourAmount()
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
//获取小时产量
List<dynamic> hourAmount = assemblyPlanBusiness.GetHourAmount();
if (hourAmount != null)
{
Achievement.Clear();
ProductionHourList = new List<string>();
ChartValues<double> hourAchievement = new ChartValues<double>();
foreach (var item in hourAmount)
{
ProductionHourList.Add(item.PRODUCT_HOUR);
hourAchievement.Add(Convert.ToDouble(item.PRODUCT_AMOUNT));
}
var houeColumn = new ColumnSeries();
houeColumn.DataLabels = true;
houeColumn.Title = "小时产量";
houeColumn.Values = hourAchievement;
Achievement.Add(houeColumn);
}
}));
}
}

@ -208,20 +208,25 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
var info = inStoreBusiness.GetInStoreTask();
if (info != null)
{
taskItems = new ObservableCollection<RealTaskInfo>();
//info.ForEach(x => RefreshInStoreTask(x));
try
{
if(info.Count > 0)
{
info = info.Where(x => !string.IsNullOrEmpty(search) ? x.materialCode == search : 1 == 1).ToList();
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
foreach (var item in info)
{
item.materialType = inStoreBusiness.GetMaterialName(item.materialType);
taskItems.Add(item);
InstoreTask = taskItems;
}
InstoreTask = taskItems;
}));
}
}
catch (Exception ex)
{
logHelper.Error("入库任务列表刷新异常", ex);
@ -229,7 +234,6 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
}
#endregion
InstoreTask = taskItems.Where(x => !string.IsNullOrEmpty(search) ? x.materialCode == search : 1 == 1);
}
}

@ -60,5 +60,19 @@ namespace HighWayIot.Repository.service
/// <param name="executePlanCode"></param>
/// <returns></returns>
bool DeleteExecutePlanInfoByPlanCode(string executePlanCode);
/// <summary>
/// 获取工位小时产量
/// </summary>
/// <param name="stationCode"></param>
/// <returns></returns>
List<dynamic> GetStationHourAmount(string stationCode);
/// <summary>
/// 获取物料型号统计
/// </summary>
/// <param name="stationCode"></param>
/// <returns></returns>
List<dynamic> GetStationMaterialStats(string stationCode);
}
}

@ -11,7 +11,9 @@ namespace HighWayIot.Repository.service.Impl
public class ExecutePlanInfoServiceImpl : IExecutePlanInfoService
{
private Repository<ExecutePlanInfo> _mesRepository = new Repository<ExecutePlanInfo>("scada");
private Repository<ExecutePlanInfo> _scadaRepository = new Repository<ExecutePlanInfo>("scada");
private Repository<dynamic> _mesRepository = new Repository<dynamic>("mes");
private LogHelper logHelper = LogHelper.Instance;
@ -30,7 +32,7 @@ namespace HighWayIot.Repository.service.Impl
Expression<Func<ExecutePlanInfo, bool>> exp = s1 => true;
exp = exp.And(x => x.productLineCode == productLineCode);
List<ExecutePlanInfo> planInfos = _mesRepository.GetList(exp);
List<ExecutePlanInfo> planInfos = _scadaRepository.GetList(exp);
int order = planInfos.OrderByDescending(x => x.executeOrder).First().executeOrder;
@ -56,7 +58,7 @@ namespace HighWayIot.Repository.service.Impl
Expression<Func<ExecutePlanInfo, bool>> exp = s1 => true;
exp = exp.And(x => x.executePlanCode == executePlanCode);
planInfo = _mesRepository.GetFirst(exp);
planInfo = _scadaRepository.GetFirst(exp);
logHelper.Info($"根据执行计划编号{executePlanCode};获取到的执行计划信息:{jsonChange.ModeToJson(planInfo)}");
}
@ -80,7 +82,7 @@ namespace HighWayIot.Repository.service.Impl
Expression<Func<ExecutePlanInfo, bool>> exp = s1 => true;
exp = exp.And(x => x.productLineCode == productLineCode);
planInfos = _mesRepository.GetList(exp);
planInfos = _scadaRepository.GetList(exp);
logHelper.Info($"根据产线工位编号:{productLineCode};获取到的执行计划信息:{jsonChange.ModeToJson(planInfos)}");
}
@ -104,7 +106,7 @@ namespace HighWayIot.Repository.service.Impl
Expression<Func<ExecutePlanInfo, bool>> exp = s1 => true;
exp = exp.And(x => x.productPlanCode == productPlanCode);
planInfos = _mesRepository.GetList(exp);
planInfos = _scadaRepository.GetList(exp);
logHelper.Info($"根据生产计划编号:{productPlanCode};获取到的执行计划信息:{jsonChange.ModeToJson(planInfos)}");
}
@ -125,7 +127,7 @@ namespace HighWayIot.Repository.service.Impl
bool result = false;
try
{
result = _mesRepository.Insert(executePlanInfo);
result = _scadaRepository.Insert(executePlanInfo);
}
catch (Exception ex)
{
@ -144,7 +146,7 @@ namespace HighWayIot.Repository.service.Impl
bool result = false;
try
{
result = _mesRepository.Update(executePlanInfo);
result = _scadaRepository.Update(executePlanInfo);
}
catch (Exception ex)
@ -164,7 +166,7 @@ namespace HighWayIot.Repository.service.Impl
bool result = false;
try
{
result = _mesRepository.UpdateRange(executePlanInfos);
result = _scadaRepository.UpdateRange(executePlanInfos);
}
catch (Exception ex)
@ -186,7 +188,7 @@ namespace HighWayIot.Repository.service.Impl
{
ExecutePlanInfo planInfo = this.GetExecutePlanInfoByPlanCode(executePlanCode);
result = _mesRepository.Delete(planInfo);
result = _scadaRepository.Delete(planInfo);
}
catch (Exception ex)
@ -195,5 +197,41 @@ namespace HighWayIot.Repository.service.Impl
}
return result;
}
public List<dynamic> GetStationHourAmount(string stationCode)
{
List<dynamic> result = null;
try
{
var _db = _mesRepository.Context;
result = _db.Queryable<dynamic>().AS("GET_STATION_HOURAMOUNT").Where("PRODUCTLINE_CODE = @stationCode", new { stationCode = stationCode }).ToList();
}
catch (Exception ex)
{
logHelper.Error("获取小时产量数据异常", ex);
}
return result;
}
public List<dynamic> GetStationMaterialStats(string stationCode)
{
List<dynamic> result = null;
try
{
var _db = _mesRepository.Context;
result = _db.Queryable<dynamic>().AS("GET_STATION_MATERIALSTATS").Where("PRODUCTLINE_CODE = @stationCode", new { stationCode = stationCode }).ToList();
}
catch (Exception ex)
{
logHelper.Error("获取型号统计数据异常", ex);
}
return result;
}
}
}

Loading…
Cancel
Save