change-分垛修改

main
liuwf 10 months ago
parent 4526e6c369
commit 71f13c7087

@ -117,11 +117,19 @@ namespace Admin.Core.Service
/// <returns></returns>
public List<ProductAllModel> GetAllProductModel()
{
var _db = this.BaseDal.Db;
List<ProductAllModel> list = _db.Ado.SqlQuery<ProductAllModel>("select * from C##AUCMA_SCADA.GET_OFFLINE_ALL_MODEL");
return list;
try
{
var _db = this.BaseDal.Db;
List<ProductAllModel> list = _db.Ado.SqlQuery<ProductAllModel>("select * from C##AUCMA_SCADA.GET_OFFLINE_ALL_MODEL");
return list;
}
catch (Exception ex)
{
Console.WriteLine("GetAllProductModel异常:" + ex.Message.ToString());
}
return null;
}

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Speech.Synthesis;
using System.Text;
using System.Threading.Tasks;
namespace Aucma.Core.CodeBinding.Common
{
public class SpeechStr
{
private static readonly Lazy<SpeechStr> lazy = new Lazy<SpeechStr>(() => new SpeechStr());
public static SpeechStr Instance {
get
{
return lazy.Value;
}
}
public void speech(string str) {
SpeechSynthesizer speech = new SpeechSynthesizer();
speech.Rate = 3;//设置语速
speech.Volume = 100;//设置音量
speech.SelectVoice("Microsoft Huihui Desktop");//设置播音员(中文)
speech.SpeakAsync(str);
}
}
}

@ -14,6 +14,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
namespace Aucma.Core.Palletiz.ViewModels
{
@ -96,6 +97,7 @@ namespace Aucma.Core.Palletiz.ViewModels
[RelayCommand]
public void Save(Window window)
{
Console.WriteLine(Area);
if (string.IsNullOrEmpty(ProductCode))
{
MessageBox.Show("请先选择产品型号");
@ -147,6 +149,18 @@ namespace Aucma.Core.Palletiz.ViewModels
#endregion
/// <summary>
/// 区域
/// </summary>
private ComboBoxItem area;
public ComboBoxItem Area
{
get { return area; }
set => SetProperty(ref area, value);
}
#region 选中型号
private string productModel;

@ -42,6 +42,7 @@ namespace Aucma.Core.Palletiz.ViewModels
this.Init();
InStoreAmount = inStoreAmount + "19";
InStoreTaskContent = new StatisticsPageView();
}
#region 参数定义
@ -111,6 +112,18 @@ namespace Aucma.Core.Palletiz.ViewModels
}
}
public System.Windows.Controls.UserControl _content;
public System.Windows.Controls.UserControl InStoreTaskContent
{
get { return this._content; }
set
{
_content = value;
RaisePropertyChanged(nameof(InStoreTaskContent));
}
}
/// <summary>
/// A区域货道集合
/// </summary>

@ -22,6 +22,15 @@ namespace Aucma.Core.Palletiz.ViewModels
{
public partial class MainWindowViewModel : ObservableObject
{
/// <summary>
/// 扫描记录刷新
/// </summary>
public delegate void RefreshInfo();
public static event RefreshInfo? RefreshInfoEvent;
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(MainWindowViewModel));
private IndexPageView firstPage = new IndexPageView();//首页
private StatisticsPageView recordPage = new StatisticsPageView();
@ -215,6 +224,7 @@ namespace Aucma.Core.Palletiz.ViewModels
UserContent = firstPage;
break;
case "RecordPage":
RefreshInfoEvent?.Invoke();
UserContent = recordPage;
break;
case "PalletizPage":

@ -18,33 +18,48 @@ namespace Aucma.Core.Palletiz.ViewModels
{
public partial class StatisticsPageViewModel : ObservableObject
{
public StatisticsPageViewModel() { LoadData(); }
// private static readonly Lazy<StatisticsPageViewModel> lazy = new Lazy<StatisticsPageViewModel>(() => new StatisticsPageViewModel());
// public static StatisticsPageViewModel Instance => lazy.Value;
public StatisticsPageViewModel() {
MainWindowViewModel.RefreshInfoEvent += LoadData;
LoadData();
}
private readonly IRecordInStoreServices? _recordInstoreServices = App.ServiceProvider.GetService<IRecordInStoreServices>();
List<MaterialComplateInfo> materialComplateInfos = new List<MaterialComplateInfo>();
public string storeCodeA = Appsettings.app("StoreInfo", "PalletizStoreCodeA");
public string storeCodeB = Appsettings.app("StoreInfo", "PalletizStoreCodeB");
#region 加载DataGrid数据
private async void LoadData()
private async void LoadData()
{
try
{
List<RecordInStore> list = await _recordInstoreServices.QueryAsync(x => x.StoreCode == storeCodeA || x.StoreCode == storeCodeB);
if (list != null && list.Count > 0)
//Task.Run(() =>
//{
try
{
foreach (RecordInStore record in list)
List<RecordInStore> list = await _recordInstoreServices.QueryAsync(x => (x.StoreCode == storeCodeA || x.StoreCode == storeCodeB) && x.InStoreTime >= DateTime.Today);
if (list != null && list.Count > 0)
{
MaterialDataGrid.Add(record);
list.OrderByDescending(x => x.InStoreTime);
foreach (RecordInStore record in list)
{
App.Current.Dispatcher.Invoke(() =>
{
MaterialDataGrid.Add(record);
});
}
}
}
}
catch (Exception ex)
{
Console.WriteLine("" + ex.Message.ToString());
}
catch (Exception ex)
{
Console.WriteLine("" + ex.Message.ToString());
}
// });
//MaterialDataGrid.Add(new MaterialComplateInfo() { No = 1, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉SC", PlanAmount = 50, CompleteAmount = 10 });
}
@ -71,27 +86,25 @@ namespace Aucma.Core.Palletiz.ViewModels
[RelayCommand]
private void ExecQuery(object obj)
{
string result =(string)obj;
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
{
if (!string.IsNullOrEmpty(result))
{
MaterialDataGrid.Clear();
//foreach (MaterialComplateInfo info in materialDataGrid)
//{
// MaterialDataGrid.Add(info);
//}
}
else
string result = (string)obj;
List<RecordInStore> list = _recordInstoreServices.QueryAsync(x => (x.StoreCode == storeCodeA || x.StoreCode == storeCodeB) && x.BarCodeCode.Contains(result)).Result;
if (list != null && list.Count > 0)
{
MaterialDataGrid.Clear();
LoadData();
foreach (RecordInStore record in list)
{
App.Current.Dispatcher.Invoke(() =>
{
MaterialDataGrid.Add(record);
});
}
}
//Datalist.Insert(0, Datalist[Datalist.Count - 1]);
//Datalist.RemoveAt(Datalist.Count - 1);
}));
}
#endregion
}

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" WindowStartupLocation="CenterScreen" FontFamily="Microsoft YaHei"
Title="手动分垛" Height="800" Width="1300" Name="window" Background="White"
Title="手动分垛" Height="800" Width="1600" Name="window" Background="White"
ResizeMode="NoResize">
<Window.Resources>
@ -126,17 +126,24 @@
</Border>
<Grid Grid.Row="2">
<Label Content="产品编码:" Foreground="White" FontSize="22" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="108,0,0,0" />
<TextBox HorizontalAlignment="Left" Text="{Binding ProductCode}" Foreground="White" FontSize="22" Margin="230,38,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="266"/>
<Label Content="入库区域:" Foreground="White" FontSize="22" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="230,47,0,0" RenderTransformOrigin="-1.095,0.883" />
<ComboBox x:Name="AreaComboBox" SelectedItem="{Binding Area}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" FontSize="25" Foreground="White" Margin="367,42,0,0">
<ComboBoxItem Content="A" Foreground="Blue"/>
<ComboBoxItem Content="B" Foreground="Blue"/>
</ComboBox>
<Label Content="产品编码:" Foreground="White" FontSize="22" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="509,42,0,0" />
<Label Content="产品型号:" Foreground="White" FontSize="22" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="530,0,0,0" />
<TextBox HorizontalAlignment="Left" Text="{Binding ProductModel}" Foreground="White" FontSize="22" Margin="660,0,0,0" TextWrapping="Wrap" VerticalAlignment="Center" Width="303"/>
<TextBox HorizontalAlignment="Left" Text="{Binding ProductCode}" Foreground="White" FontSize="22" Margin="616,38,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="266"/>
<Label Content="产品型号:" Foreground="White" FontSize="22" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="919,42,0,0" />
<TextBox HorizontalAlignment="Left" Text="{Binding ProductModel}" Foreground="White" FontSize="22" Margin="1026,38,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="304"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 10 0">
<Button Content="确 认" FontSize="20" Command="{Binding SaveCommand}" CommandParameter="{Binding ElementName=window}" Background="#FF36B5C1" BorderBrush="#FF36B5C1" Foreground="white" Margin="0,0,10,0" Height="50" Width="100" />
<Button Content="取 消" FontSize="20" Command="{Binding CancelCommand}" CommandParameter="{Binding ElementName=window}" Background="#FF9900" Foreground="white" Margin="10,0,0,0" Height="50" BorderBrush="#FF9900" Width="100" />
</StackPanel>
</Grid >
</Grid>

@ -153,15 +153,23 @@
<ContentControl x:Name="ctrl" Width="{Binding ActualWidth, ElementName=areaA_outerBorder}" Margin="5,5">
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Height" Value="40" />
<Setter Property="Height" Value="35" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border Background="#4D96E0" >
<!--<Label Content="{Binding SpaceName}" FontSize="18" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>-->
<Button Command="{Binding DataContext.UpdateInStoreFlagCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding ObjId}" Style="{StaticResource BUTTON_AGREE}" BorderBrush="Transparent" BorderThickness="0" Background="Transparent">
<TextBlock Text="{Binding typeNameA}" Foreground="White" FontSize="18" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center" />
<Button Command="{Binding DataContext.UpdateInStoreFlagCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding ObjId}" BorderBrush="Transparent" BorderThickness="0" Background="Transparent">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="7*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding SpaceCode}" Foreground="White" FontSize="18" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="{Binding typeNameA}" Foreground="White" FontSize="18" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="50 0 0 0" />
</Grid>
</Button>
</Border>
</ControlTemplate>
@ -169,7 +177,7 @@
</Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding SpaceType}" Value="2">
<Setter Property="Height" Value="70" />
<Setter Property="Height" Value="60" />
</DataTrigger>
</Style.Triggers>
</Style>
@ -221,15 +229,15 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="6*"/>
<ColumnDefinition Width="4*"/>
<!--<ColumnDefinition Width="4*"/>-->
</Grid.ColumnDefinitions>
<DataGrid Grid.Column="0" Name="DG" ItemsSource="{Binding InstoreTask}" Background="Transparent"
<!--<DataGrid Grid.Column="0" Name="DG" ItemsSource="{Binding InstoreTask}" Background="Transparent"
FontSize="20" ColumnHeaderHeight="35"
RowHeight="31" AutoGenerateColumns="False" RowHeaderWidth="0"
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False"
Foreground="#FFFFFF" >
<!--resourceStyle 399行修改选中字体颜色-->
--><!--resourceStyle 399行修改选中字体颜色--><!--
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding taskCode}" Header="序号" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding materialCode}" Header="物料编码" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
@ -238,9 +246,12 @@
<DataGridTextColumn Binding="{Binding createTime,StringFormat=\{0:MM月dd日 HH:mm\}}" Header="扫描时间" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
</DataGrid.Columns>
</DataGrid>
</DataGrid>-->
<Border Grid.Column="0" BorderBrush="Red" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="2,25,2,2">
<ContentControl Content="{Binding InStoreTaskContent}"/>
</Border>
<!--日志信息-->
<Border Grid.Column="1" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Background="Transparent" Margin="1,0,0,0">
<!--<Border Grid.Column="1" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Background="Transparent" Margin="1,0,0,0">
<Border.Effect>
<DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
</Border.Effect>
@ -254,12 +265,12 @@
<TextBlock Text="系统监控" FontSize="20" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<!--日志信息-->
--><!--日志信息--><!--
<Border Grid.Row="1" BorderBrush="Green" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
<ListBox x:Name="listBox" ItemsSource="{Binding LogInfoListBox}" FontSize="15" Foreground="#FFFFFF" Background="Transparent" BorderBrush="Transparent" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden"/>
</Border>
</Grid>
</Border>
</Border>-->
</Grid>
</Border>
</Grid>

@ -115,7 +115,7 @@
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding No}" Header="序号" Width="1*" Visibility="Collapsed"/>
<DataGridTextColumn Binding="{Binding BarCodeCode}" Header="成品条码" Width="3*" />
<DataGridTextColumn Binding="{Binding MaterialType}" Header="成品型号" Width="3*" />
<DataGridTextColumn Binding="{Binding MaterialName}" Header="成品型号" Width="3*" />
<DataGridTextColumn Binding="{Binding StoreArea}" Header="区域" Width="1*" />
<DataGridTextColumn Binding="{Binding InStoreAmount}" Header="旋转角度" Width="*" />
<DataGridTextColumn Binding="{Binding InStoreTime,StringFormat=\{0:yyyy-MM-dd HH:mm\}}" Header="入库时间" Width="2*" />

@ -197,7 +197,7 @@
"PlcType": "Melsec",
"Enabled": true,
"IP": "10.10.92.80", //10.10.92.80
"Port": 2015
"Port": 6000
}
],
"StoreInfo": {

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Speech.Synthesis;
using System.Text;
using System.Threading.Tasks;
namespace Aucma.Core.CodeBinding.Common
{
public class SpeechStr
{
private static readonly Lazy<SpeechStr> lazy = new Lazy<SpeechStr>(() => new SpeechStr());
public static SpeechStr Instance {
get
{
return lazy.Value;
}
}
public void speech(string str) {
SpeechSynthesizer speech = new SpeechSynthesizer();
speech.Rate = 3;//设置语速
speech.Volume = 100;//设置音量
speech.SelectVoice("Microsoft Huihui Desktop");//设置播音员(中文)
speech.SpeakAsync(str);
}
}
}
Loading…
Cancel
Save