change -成品下线界面修改

dev
liuwf 1 year ago
parent 160fd104ae
commit 1428882b53

@ -4,6 +4,16 @@ using log4net;
using LiveCharts.Wpf;
using LiveCharts;
using System.Collections.Generic;
using Aucma.Core.Scanner;
using Microsoft.Extensions.Hosting;
using NPOI.SS.Formula.Functions;
using Oracle.ManagedDataAccess.Client;
using System.Windows.Forms;
using System.Threading;
using static Aucma.Core.Scanner.MvCodeHelper;
using Admin.Core.Common;
using System.Linq;
using static Npgsql.Replication.PgOutput.Messages.RelationMessage;
/*
*
@ -17,12 +27,12 @@ namespace Aucma.Core.ProductOffLine.ViewModels
public IndexPageViewModel()
{
StationName = "成品分垛入库";
MaterialName = "SC-AUCMA-农夫山泉SC 门体";
OrderNo = "8512365486";
BeginTime = DateTime.Now.ToString("yyyy-mm-dd HH:mm:ss");
InitEveryDayMethod();
MvCodeHelper.ReceiveCodeEvent += ReceiveCode;
// test();
//List<MutiDBOperate> listdatabase = Appsettings.app<MutiDBOperate>("DBS")
// .Where(i => i.Enabled).ToList();
InitEveryDayMethod();
}
#region 扫描信息
@ -80,13 +90,41 @@ namespace Aucma.Core.ProductOffLine.ViewModels
#endregion
private void LoadProduct()
{
ChartValues<double> achievement = new ChartValues<double>();
ProductionHourList = new List<string>();
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
Achievement.Clear();
for (int i = 0; i < 5; i++)
{
ProductionHourList.Add(i.ToString());
achievement.Add(1 + i * 10);
}
var column = new ColumnSeries();
column.DataLabels = true;
column.Title = "泡后库";
column.Values = achievement;
Achievement.Add(column);
ModelStatistics.Add(column);
}));
}
private void InitEveryDayMethod()
{
StationName = "成品下线扫描";
MaterialName = "SC-AUCMA-农夫山泉SC 门体";
OrderNo = "8512365486";
BeginTime = DateTime.Now.ToString("yyyy-mm-dd HH:mm:ss");
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();
@ -117,7 +155,6 @@ namespace Aucma.Core.ProductOffLine.ViewModels
column2.Title = "产量";
column2.Values = achievement2;
Achievement.Add(column2);
}
@ -161,5 +198,64 @@ namespace Aucma.Core.ProductOffLine.ViewModels
set { productionHourList = value; }
}
#endregion
/// <summary>
/// 扫描的条码处理
/// </summary>
/// <param name="code"></param>
/// <param name="direction">扫码器方向1左边分A库2右边分B库</param>
private void ReceiveCode(string code,int direction)
{
//1.扫描的SN条码去条码系统查询
string result = "Y@1104@16160030000000910780@000010034895@@ @000000@000000009000000807@BCD-160C,家电下乡@@BCD-160C@皓月白-家电下乡@161601300@160@1-00版@家电下乡产品@默认@2010-09-01";
//2.查询到的数据分割处理,结果中用"@"号分隔刷新页面显示并存到scada数据库(表待建)
string[] resultArray = result.Split('@');
// 输出结果
foreach (string item in resultArray)
{
Thread.Sleep(2000);
MessageBox.Show(item);
}
//3.调条码系统保存接口入库
//4.更新mes数据库完成数量和时间(BASE_ORDERINFO,PRODUCT_PLANINFO)
//5.分垛A,B库逻辑(先左边读到的条码分A库右边读到的B库==>预留分库逻辑)
//6.下发plc信号
}
// 测试连接
void test()
{
string connectionString = "Data Source=(DESCRIPTION=(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.1.50)(PORT = 1521)))(CONNECT_DATA=(SERVICE_NAME=tmdata)));User ID=ILS_SORT;Password=Aucma_2019;";
// string connectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=175.27.215.92)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=helowin)));User ID=aucma_scada;Password=aucma;";
// string functionQuery = "SELECT COUNT(*) from CODE_BINDING";
string sql = "SELECT ILS_TMPRD.ILS_SORT_BARCODE_PKG.GET_BARCODE_DATA('16160030000000910779') FROM DUAL";
using (OracleConnection connection = new OracleConnection(connectionString))
{
connection.Open();
using (OracleCommand command = new OracleCommand(sql, connection))
{
// 执行函数并获取结果
string result = command.ExecuteScalar().ToString();
// 在结果中用"@"号分隔
string[] resultArray = result.Split('@');
// 输出结果
foreach (string item in resultArray)
{
Thread.Sleep(2000);
MessageBox.Show(item);
}
}
}
}
}
}

@ -56,7 +56,7 @@
<TextBlock Text="当前工位" Foreground="White"/>
</Border>
<Border Grid.Row="1" Grid.RowSpan="3" Grid.Column="0" Background="#0288d1">
<TextBlock Text="品下线扫描" Foreground="White" FontWeight="Bold" FontSize="18"/>
<TextBlock Text="品下线扫描" Foreground="White" FontWeight="Bold" FontSize="18"/>
</Border>
<Border Grid.Row="0" Grid.Column="1" Background="#0288d1">
<TextBlock Text="产品条码" Foreground="White" />
@ -146,6 +146,7 @@
</lvc:CartesianChart.AxisY>
</lvc:CartesianChart>
</Border>
</Grid>
</Border>
<Border Grid.Column="1" >

@ -37,7 +37,7 @@
</Border>
<Button x:Name="btn1" Content="入库记录" HorizontalAlignment="Left" Margin="37,13,0,0" Grid.Row="1" VerticalAlignment="Top" RenderTransformOrigin="0.204,0.551" Background="#FF1752E1" Click="btn1_Click" />
<Button x:Name="btn2" Content="入库统计" HorizontalAlignment="Left" Margin="135,13,0,0" Grid.Row="1" VerticalAlignment="Top" RenderTransformOrigin="0.204,0.551" Background="#FF384E83" Click="btn2_Click" />
<Border x:Name="border1" Grid.Row="1" Visibility="Visible" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,50,5,5">
<Border x:Name="border1" Grid.Row="1" Visibility="Visible" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Background="Transparent" Margin="1,50,5,5">
<Grid Margin="10,5">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
@ -95,6 +95,19 @@
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Auto" BorderThickness="0" CanUserAddRows="False" SelectionMode="Single" IsReadOnly="True"
Foreground="Gray" >
<!-- 表头剧中-->
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center">
</Setter>
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGrid.CellStyle>
<!--表头剧中-->
<!--<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
@ -106,23 +119,21 @@
<!--修改选中字体颜色-->
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding No}" Header="序号" />
<DataGridTextColumn Binding="{Binding ProductPlanCode}" Header="计划编号" Width="1*" />
<DataGridTextColumn Binding="{Binding MaterialCode}" Header="物料编号" Width="1*" />
<DataGridTextColumn Binding="{Binding MaterialName}" Header="物料名称" Width="3*" />
<DataGridTextColumn Binding="{Binding PlanAmount}" Header="计划数量" Width="*" />
<DataGridTextColumn Binding="{Binding CompleteAmount}" Header="完成数量" Width="*" />
<DataGridTextColumn Binding="{Binding ProductPlanCode}" Header="订单号" Width="1*" />
<DataGridTextColumn Binding="{Binding MaterialCode}" Header="物料条码" Width="3*" />
<DataGridTextColumn Binding="{Binding MaterialName}" Header="物料型号" Width="3*" />
<DataGridTextColumn Binding="{Binding PlanAmount}" Header="物料编码" Width="3*" />
<DataGridTextColumn Binding="{Binding CompleteAmount}" Header="扫描时间" Width="2*" />
</DataGrid.Columns>
</DataGrid>
</UniformGrid>
</Grid>
</Border>
<Border x:Name="border2" Grid.Row="1" Visibility="Collapsed" BorderBrush="#0288d1" Background="Transparent" BorderThickness="0" CornerRadius="5" Margin="6,50,0,5">
<Border x:Name="border2" Grid.Row="1" Visibility="Collapsed" BorderBrush="#0288d1" Background="Transparent" BorderThickness="1" CornerRadius="5" Margin="6,50,0,5">
<Grid Margin="10,5">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<!--<Grid.RowDefinitions>
<RowDefinition Height="8*"/>
</Grid.RowDefinitions>
</Grid.RowDefinitions>-->
<UniformGrid Grid.Row="1">
<DataGrid Grid.Row="0" ItemsSource="{Binding MaterialDataGrid}" Background="#00000000"
@ -131,14 +142,26 @@
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Auto" BorderThickness="0" CanUserAddRows="False" SelectionMode="Single" IsReadOnly="True"
Foreground="Gray" >
<!-- 表头剧中-->
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center">
</Setter>
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding No}" Header="2序号" />
<DataGridTextColumn Binding="{Binding ProductPlanCode}" Header="2计划编号" Width="1*" />
<DataGridTextColumn Binding="{Binding MaterialCode}" Header="2物料编号" Width="1*" />
<DataGridTextColumn Binding="{Binding MaterialName}" Header="2物料名称" Width="3*" />
<DataGridTextColumn Binding="{Binding PlanAmount}" Header="2计划数量" Width="*" />
<DataGridTextColumn Binding="{Binding CompleteAmount}" Header="2完成数量" Width="*" />
<DataGridTextColumn Binding="{Binding No}" Header="序号" />
<DataGridTextColumn Binding="{Binding ProductPlanCode}" Header="" Width="1*" />
<DataGridTextColumn Binding="{Binding MaterialCode}" Header="物料条码" Width="3*" />
<DataGridTextColumn Binding="{Binding MaterialName}" Header="物料型号" Width="3*" />
<DataGridTextColumn Binding="{Binding PlanAmount}" Header="数量" Width="*" />
<DataGridTextColumn Binding="{Binding CompleteAmount}" Header="入库时间" Width="2*" />
</DataGrid.Columns>
</DataGrid>

@ -63,7 +63,7 @@
// *** MutiDBEnabled trueEnabledtrue **
// https://www.bilibili.com/video/BV1BJ411B7mn?p=6
"MainDB": "Admin.Core", //Enabledtrue
"MutiDBEnabled": false, //
"MutiDBEnabled": true, //
"CQRSEnabled": false, //SqlServer
"DBS": [
/*
@ -77,13 +77,29 @@
Kdbndp = 6,//
*/
{
"ConnId": "Admin.Core",
"ConnId": "AUCMA_SCADA",
"DBType": 3,
"Enabled": true,
"HitRate": 50,
//"Connection": "Data Source=localhost;Initial Catalog=Hsdb;User ID=sa;Password=sa;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
"Connection": "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=175.27.215.92)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=helowin)));User ID=aucma_scada;Password=aucma;",
"ProviderName": "System.Data.SqlClient"
},
{
"ConnId": "AUCMA_MES",
"DBType": 3,
"Enabled": true,
"HitRate": 40,
"Connection": "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=175.27.215.92)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=helowin)));User ID=aucma_mes;Password=aucma;",
"ProviderName": "System.Data.SqlClient"
},
{
"ConnId": "AUCMA_TIAOMA",
"DBType": 3,
"Enabled": true,
"HitRate": 40,
"Connection": "Data Source=(DESCRIPTION=(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.1.50)(PORT = 1521)))(CONNECT_DATA=(SERVICE_NAME=tmdata)));User ID=ILS_SORT;Password=Aucma_2019;",
"ProviderName": "System.Data.SqlClient"
}
],
"QuartzNetJob": [

@ -31,6 +31,17 @@ namespace Aucma.Core.Scanner
public static event ReceiveCode2? ReceiveCode2Event;
#endregion
#region 成品下线上位机委托事件
/// <summary>
/// code扫码信息刷新
/// </summary>
/// <param name="Code1"></param>
public delegate void ReceiveCode(string code, int direction);
public static event ReceiveCode? ReceiveCodeEvent;
#endregion
#endregion
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(MvCodeHelper));
// 获取到的所有设备

Loading…
Cancel
Save