add - 组装计划小时产量、物料型号统计数据加载

collectionStore
wenjy 1 year ago
parent c2f5c90779
commit 0839f43521

Binary file not shown.

@ -278,5 +278,23 @@ 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);
}
}
}

@ -79,7 +79,7 @@
<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="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="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"/>
<Button Content="最小化" x:Name="Minimized" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Minimized}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#FF9900" BorderBrush="#FF9900" Margin="0,0,10,0"/>

@ -172,10 +172,10 @@
<Grid Margin="10,10">
<lvc:CartesianChart Series="{Binding Achievement, UpdateSourceTrigger=PropertyChanged}">
<lvc:CartesianChart.AxisX>
<lvc:Axis Labels="{Binding ProductionHourList}" FontSize="15"/>
<lvc:Axis Labels="{Binding ProductionHourList}" FontSize="15" Foreground="#0288d1"/>
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.AxisY>
<lvc:Axis FontSize="15"/>
<lvc:Axis FontSize="15" Foreground="#0288d1"/>
</lvc:CartesianChart.AxisY>
</lvc:CartesianChart>
</Grid>
@ -271,10 +271,10 @@
<Grid Margin="10,10">
<lvc:CartesianChart Series="{Binding ModelStatistics, UpdateSourceTrigger=PropertyChanged}">
<lvc:CartesianChart.AxisX>
<lvc:Axis Labels="{Binding MaterialNameList}" FontSize="15"/>
<lvc:Axis Labels="{Binding MaterialNameList}" FontSize="15" Foreground="#0288d1"/>
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.AxisY>
<lvc:Axis FontSize="15"/>
<lvc:Axis FontSize="15" Foreground="#0288d1"/>
</lvc:CartesianChart.AxisY>
</lvc:CartesianChart>
</Grid>

@ -1,4 +1,5 @@
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "761197E72019FA48DD888520668F10CC0A0310CFF8A6F9336B14C0A351ACC259"
// Updated by XamlIntelliSenseFileGenerator 2023-10-24 14:33:32
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "761197E72019FA48DD888520668F10CC0A0310CFF8A6F9336B14C0A351ACC259"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
@ -32,132 +33,129 @@ using System.Windows.Shapes;
using System.Windows.Shell;
namespace Aucma.Scada.UI {
namespace Aucma.Scada.UI
{
/// <summary>
/// MainWindow
/// </summary>
public partial class MainWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
#line 77 "..\..\MainWindow.xaml"
public partial class MainWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector
{
#line 77 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button instoreInfo;
#line default
#line hidden
#line 78 "..\..\MainWindow.xaml"
#line default
#line hidden
#line 78 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button outstoreInfo;
#line default
#line hidden
#line 79 "..\..\MainWindow.xaml"
#line default
#line hidden
#line 79 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button taskInfo;
#line default
#line hidden
#line 80 "..\..\MainWindow.xaml"
#line default
#line hidden
#line 80 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button inventoryInfo;
#line default
#line hidden
#line 81 "..\..\MainWindow.xaml"
#line default
#line hidden
#line 81 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button assemblyPlan;
#line default
#line hidden
#line 82 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button logInfo;
#line default
#line hidden
#line 85 "..\..\MainWindow.xaml"
#line default
#line hidden
#line 85 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button Minimized;
#line default
#line hidden
#line 86 "..\..\MainWindow.xaml"
#line default
#line hidden
#line 86 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button Exit;
#line default
#line hidden
#line default
#line hidden
private bool _contentLoaded;
/// <summary>
/// InitializeComponent
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent() {
if (_contentLoaded) {
public void InitializeComponent()
{
if (_contentLoaded)
{
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/Aucma.Scada.UI;component/mainwindow.xaml", System.UriKind.Relative);
#line 1 "..\..\MainWindow.xaml"
#line 1 "..\..\MainWindow.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);
#line default
#line hidden
#line default
#line hidden
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
{
switch (connectionId)
{
case 1:
this.instoreInfo = ((System.Windows.Controls.Button)(target));
return;
case 2:
this.outstoreInfo = ((System.Windows.Controls.Button)(target));
return;
case 3:
this.taskInfo = ((System.Windows.Controls.Button)(target));
return;
case 4:
this.inventoryInfo = ((System.Windows.Controls.Button)(target));
return;
case 5:
this.assemblyPlan = ((System.Windows.Controls.Button)(target));
return;
case 6:
this.logInfo = ((System.Windows.Controls.Button)(target));
return;
case 7:
this.Minimized = ((System.Windows.Controls.Button)(target));
return;
case 8:
this.Exit = ((System.Windows.Controls.Button)(target));
return;
case 1:
this.instoreInfo = ((System.Windows.Controls.Button)(target));
return;
case 2:
this.outstoreInfo = ((System.Windows.Controls.Button)(target));
return;
case 3:
this.taskInfo = ((System.Windows.Controls.Button)(target));
return;
case 4:
this.inventoryInfo = ((System.Windows.Controls.Button)(target));
return;
case 5:
this.assemblyPlan = ((System.Windows.Controls.Button)(target));
return;
case 6:
this.logInfo = ((System.Windows.Controls.Button)(target));
return;
case 7:
this.Minimized = ((System.Windows.Controls.Button)(target));
return;
case 8:
this.Exit = ((System.Windows.Controls.Button)(target));
return;
}
this._contentLoaded = true;
}

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\Page\AssemblyPlan\AssemblyPlanControl.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "D536AE37E611DE63815C8A69BC3CB492E8D312804D0D4C91592629457E2EA8CE"
#pragma checksum "..\..\..\..\Page\AssemblyPlan\AssemblyPlanControl.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "5A45D0B6305D139356269F0878B942DF810FB9213B2E1C4F857110595A8D36F5"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\Page\AssemblyPlan\AssemblyPlanControl.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "D536AE37E611DE63815C8A69BC3CB492E8D312804D0D4C91592629457E2EA8CE"
#pragma checksum "..\..\..\..\Page\AssemblyPlan\AssemblyPlanControl.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "5A45D0B6305D139356269F0878B942DF810FB9213B2E1C4F857110595A8D36F5"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。

@ -290,13 +290,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>
@ -321,56 +321,6 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
public void Init()
{
RefreshExecutePlan();
App.Current.Dispatcher.Invoke((Action)(() =>
{
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>
@ -440,6 +390,67 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
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);
}
}));
}
}

@ -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,39 @@ 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;
}
}
}

@ -61,6 +61,10 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HighWayIot.Config\HighWayIot.Config.csproj">
<Project>{75180EE5-13AE-499B-B0F6-C7BFEE1140CC}</Project>
<Name>HighWayIot.Config</Name>
</ProjectReference>
<ProjectReference Include="..\HighWayIot.Log4net\HighWayIot.Log4net.csproj">
<Project>{DEABC30C-EC6F-472E-BD67-D65702FDAF74}</Project>
<Name>HighWayIot.Log4net</Name>

@ -1,4 +1,8 @@
using HighWayIot.Log4net;
using HighWayIot.Config;
using HighWayIot.Log4net;
using HighWayIot.Repository.service;
using HighWayIot.Repository.service.Impl;
using System;
namespace HighWayIot
{
@ -6,11 +10,18 @@ namespace HighWayIot
{
private static LogHelper logger = LogHelper.Instance;
private static AppConfig appConfig = AppConfig.Instance;
private static IExecutePlanInfoService execPlanInfoService = new ExecutePlanInfoServiceImpl();
static void Main(string[] args)
{
logger.Info("初始化启动");
var info = execPlanInfoService.GetStationHourAmount(appConfig.stationCode);
foreach (var item in info)
{
Console.WriteLine($"productLine_code:{item.productLine_code}");
}
}
}
}

@ -1,3 +1,20 @@
[system]
mesConnStr=Data Source=175.27.215.92/helowin;User ID=aucma_mes;Password=aucma
scadaConnStr=Data Source=175.27.215.92/helowin;User ID=aucma_scada;Password=aucma
stationCode=ZZ-01
shellStoreCode=XKJCK-001
linerStoreCode=NDJCK-001
shellMaterialType=3
linerMaterialType=4
instoreTaskType=1
outstoreTaskType=2
stationName=Ïä¿ÇÄÚµ¨×é×°
shellHikRobotIp=169.254.100.169
linerHikRobotIp=127.0.0.1

@ -0,0 +1,31 @@
[plcSystem]
箱壳PLCIP=127.0.0.1
箱壳PLC端口=6000
内胆PLCIP=127.0.0.1
内胆PLC端口=6000
#箱壳入库地址
[shell_inStore_address]
入库货道号=D101
入库应答字=D103
入库任务号=D104
入库完成=D105
#内胆入库地址
[liner_inStore_address]
入库货道号=D201
入库应答字=D203
入库任务号=D204
入库完成=D205
#箱壳出库地址
[shell_outStore_address]
出库货道号=M101
出库数量=M102
出库应答字=M103
出库任务号=M104
出库完成=M105
#内胆出库地址
[liner_outStore_address]
出库货道号=M201
出库数量=M202
出库应答字=M203
出库任务号=M204
出库完成=M205

@ -1 +1 @@
a06e08eba04b58b9c288665f37c4b068d1aa4bff
381efba6ccd19bcf21dcb8312578326d689984a3

Loading…
Cancel
Save