Commit 7351ef86 by zxw

充电台单机版

parent d509d682
......@@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiteChannelWinXP", "LiteCha
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransmitterService", "TransmitterService\TransmitterService.csproj", "{FB7E4EB3-F9C2-42DA-89CC-D8831C462CB5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiteChannelDJB", "LiteChannelDJB\LiteChannelDJB.csproj", "{105D4340-4411-4B91-AD04-7A1EF2F7D3C8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -51,12 +53,16 @@ Global
{FB7E4EB3-F9C2-42DA-89CC-D8831C462CB5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB7E4EB3-F9C2-42DA-89CC-D8831C462CB5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB7E4EB3-F9C2-42DA-89CC-D8831C462CB5}.Release|Any CPU.Build.0 = Release|Any CPU
{105D4340-4411-4B91-AD04-7A1EF2F7D3C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{105D4340-4411-4B91-AD04-7A1EF2F7D3C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{105D4340-4411-4B91-AD04-7A1EF2F7D3C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{105D4340-4411-4B91-AD04-7A1EF2F7D3C8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F1BB736E-801B-4BAD-8BC5-A7BA50F023D7}
VisualSVNWorkingCopyRoot = .
SolutionGuid = {F1BB736E-801B-4BAD-8BC5-A7BA50F023D7}
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.5.0" newVersion="2.0.5.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
<Application x:Class="LiteChannel.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:LiteChannel"
StartupUri="LoginWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Panuon.UI.Silver;component/Control.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="TextBlock" x:Key="FiconBase">
<Setter Property="FontFamily" Value="pack://application:,,,/font/#iconfont" />
<Setter Property="Cursor" Value="Hand" />
</Style>
<Style x:Key="TextCenterStyle" TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="TextAlignment" Value="Center" />
</Style>
<Style x:Key="TextLeftStyle" TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="TextAlignment" Value="Left" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
using LiteChannel.Commons;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using JmpCommon;
using LiteChannel.Models;
namespace LiteChannel
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
private System.Threading.Mutex _mutex;
public App()
{
this.Startup += App_Startup;
}
void App_Startup(object sender, StartupEventArgs e)
{
_mutex = new System.Threading.Mutex(true, Process.GetCurrentProcess().ProcessName, out var ret);
if (!ret)
{
MessageBox.Show("已有另一个程序在运行!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);//弹出提示信息
Environment.Exit(0);
}
}
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
LiteCaChe.SysConfig = LiteCaChe.LoadSystemStep();
if (LiteCaChe.SysConfig == null)
{
//MessageBox.Show("配置文件加载失败,请检查", "文件错误", MessageBoxButton.OK, MessageBoxImage.Error);
//Process.GetCurrentProcess().Kill();
MessageBox.Show("配置文件加载失败,创建默认配置文件");
LiteCaChe.SysConfig = new Config();
LiteCaChe.SaveSystemStep(LiteCaChe.SysConfig);
}
else
{
//var update = HttpHelper.GetUpdate(LiteCaChe.SysConfig?.AppCode ?? "");
//if (update == null)
//{
//}
//else
//{
// if (Version.TryParse(update.version2, out var version) && version > new Version(LiteCaChe.SysConfig.AppVersion))
// {
// if (MessageBox.Show("检测到新版本,是否更新?", "更新提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
// {
// System.Diagnostics.Process.Start("explorer.exe", LiteCaChe.SysConfig.DomainUrl.TrimEnd('/') + "/" + update.address.TrimStart('/'));
// Process.GetCurrentProcess().Kill();
// }
// else { }
// }
//}
}
//获取供应商
LiteCaChe.EquInfos = HttpHelper.GetEquInfos();
LiteCaChe.InventoryInfos = HttpHelper.GetAllInventoryList();
}
}
}
<pu:WindowX x:Class="LiteChannel.AutoClosingMessageBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:pu="clr-namespace:Panuon.UI.Silver;assembly=Panuon.UI.Silver"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LiteChannel"
Title="标题" Height="250" Width="400" Loaded="Window_Loaded" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" FontSize="14" >
<Window.Effect>
<DropShadowEffect BlurRadius="10" Color="#FF858484" Direction="90" ShadowDepth="2"/>
</Window.Effect>
<Grid >
<Grid x:Name="g_body" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
<Label x:Name="lb_Message" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="24" Margin="0,0,0,20">消息</Label>
<Button x:Name="btn_Submit" Grid.Row="2" pu:ButtonHelper.CornerRadius="4" FontSize="20" Content="确定" Margin="60,10,0,0" Height="40" Width="120" HorizontalAlignment="Left" VerticalAlignment="Top" Click="btn_Submit_Click"/>
<Button x:Name="btn_Cancel" Grid.Row="2" pu:ButtonHelper.CornerRadius="4" FontSize="20" Content="取消" Margin="200,10,0,0" Height="40" Width="120" HorizontalAlignment="Left" VerticalAlignment="Top" Click="btn_Cancel_Click" Grid.ColumnSpan="2"/>
</Grid>
</Grid>
</pu:WindowX>
using LiteChannel.Commons;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Panuon.UI.Silver;
using Panuon.UI.Silver.Core;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Markup;
namespace LiteChannel
{
/// <summary>
/// AutoClosingMessageBox.xaml 的交互逻辑
/// </summary>
public partial class AutoClosingMessageBox : WindowX, IComponentConnector
{
private int _count = 0;
private System.Threading.Timer _timer;
private Action _callBack;
public AutoClosingMessageBox(Window window,string content, string title, int count, Action callback)
{
InitializeComponent();
Owner = window;
Title = " " + title;
lb_Message.Content = content;
_count = count;
_callBack = callback;
_timer = new System.Threading.Timer(TimerFunction, null, 0, 1000);
//居中弹出
this.Left = System.Windows.SystemParameters.PrimaryScreenWidth / 2 - this.Width / 2;
this.Top = System.Windows.SystemParameters.PrimaryScreenHeight / 2 - this.Height / 2;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
}
private void btn_Submit_Click(object sender, RoutedEventArgs e)
{
//执行
_timer.Dispose();
_callBack.BeginInvoke(null, null);
this.Close();
}
private void btn_Cancel_Click(object sender, RoutedEventArgs e)
{
_timer.Dispose();
this.Close();
}
private void TimerFunction(object state)
{
this.Dispatcher.Invoke(() => { btn_Submit.Content = $"确定({_count})"; });
if (_count < 0)
{
_timer.Dispose();
this.Dispatcher.Invoke(() => this.btn_Submit_Click(null, null));
}
_count--;
}
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Commons
{
public class JmpDes
{
/// <summary> 加密字符串
/// </summary>
/// <param name="strText">需被加密的字符串</param>
/// <param name="strEncrKey">密钥</param>
/// <returns></returns>
public static string Encrypt(string strText, string strKey = "jMp838668")
{
try
{
byte[] byKey = null;
byte[] IV = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };
byKey = Encoding.UTF8.GetBytes(strKey.Substring(0, 8));
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
byte[] inputByteArray = Encoding.UTF8.GetBytes(strText);
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(byKey, IV), CryptoStreamMode.Write);
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
return Convert.ToBase64String(ms.ToArray());
}
catch
{
return "";
}
}
/// <summary> 解密字符串
/// </summary>
/// <param name="strText">需被解密的字符串</param>
/// <param name="sDecrKey">密钥</param>
/// <returns></returns>
public static string Decrypt(string strText, string strKey = "jMp838668")
{
try
{
byte[] byKey = null;
byte[] IV = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };
byte[] inputByteArray = new Byte[strText.Length];
byKey = Encoding.UTF8.GetBytes(strKey.Substring(0, 8));
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
inputByteArray = Convert.FromBase64String(strText);
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(byKey, IV), CryptoStreamMode.Write);
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
Encoding encoding = new UTF8Encoding();
return encoding.GetString(ms.ToArray());
}
catch
{
return string.Empty;
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Commons
{
public class Log
{
//private static
private static StreamWriter sr;
private static readonly object syncWorkObj = new object();
private static readonly object syncErrorObj = new object();
private static readonly object syncDebugObj = new object();
private static bool bEnableWorkLog = true;
private static bool bEnableErrorLog = true;
private static bool bEnableDebugLog = true;
public Log()
{
}
/// <summary>
/// Log 启用
/// </summary>
/// <param name="enable"></param>
public static void EnableWorkLog(bool enable)
{
bEnableWorkLog = enable;
}
/// <summary>
/// Log 启用
/// </summary>
/// <param name="enable"></param>
public static void EnableErrorLog(bool enable)
{
bEnableErrorLog = enable;
}
/// <summary>
/// Log 启用
/// </summary>
/// <param name="enable"></param>
public static void EnableDebugLog(bool enable)
{
bEnableDebugLog = enable;
}
/// <summary>
/// 工作日志
/// </summary>
/// <param name="logTxt"></param>
/// <param name="ModuleName"></param>
public static void WorkLog(string logTxt, [CallerMemberName] string ModuleName = default)
{
lock (syncWorkObj)
{
if (bEnableWorkLog)
{
WriteLine(logTxt, ModuleName, "WorkLog/");
}
}
}
/// <summary>
/// 异常日志
/// </summary>
/// <param name="logTxt"></param>
/// <param name="ModuleName"></param>
public static void ErrorLog(string logTxt, [CallerMemberName] string ModuleName = default)
{
lock (syncErrorObj)
{
if (bEnableErrorLog)
{
WriteLine(logTxt, ModuleName, "ErrorLog/");
}
}
}
/// <summary>
/// 异常日志
/// </summary>
/// <param name="logTxt"></param>
/// <param name="ModuleName"></param>
public static void DebugLog(string logTxt, [CallerMemberName] string ModuleName = null)
{
lock (syncDebugObj)
{
if (bEnableDebugLog)
{
WriteLine(logTxt, ModuleName, "WorkLog/");
}
}
}
/// <summary>
/// 写日志
/// </summary>
/// <param name="logTxt"></param>
/// <param name="ModuleName"></param>
/// <param name="pathName"></param>
private static void WriteLine(string logTxt, string ModuleName, string pathName)
{
try
{
string logPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + pathName
+ DateTime.Now.ToString("yyyyMMdd") + ".log";
ClearFile(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + pathName);
logTxt = string.Format(" {0}|{1}|{2}",
DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
ModuleName,
logTxt);
sr = new StreamWriter(logPath, true, Encoding.Default);
sr.WriteLine(logTxt);
sr.Close();
}
catch { }
}
/// <summary>
/// 日志清除文件
/// </summary>
/// <param name="FilePath"></param>
private static void ClearFile(string FilePath)
{
if (!Directory.Exists(FilePath))
{
Directory.CreateDirectory(FilePath);
}
String[] Files = Directory.GetFiles(FilePath);
if (Files.Length > 30)
{
for (int i = 0; i < 1; i++)
{
try
{
File.Delete(Files[i]);
}
catch
{
}
}
}
}
}
}
using System;
using System.Runtime.InteropServices;
namespace LiteChannel.Commons
{
public class Win32API
{
[DllImport("Kernel32.dll")]
public static extern bool SetLocalTime(ref SYSTEMTIME Time);
[DllImport("Kernel32.dll")]
public static extern void GetLocalTime(ref SYSTEMTIME Time);
}
/// <summary>
///
/// </summary>
public struct SYSTEMTIME
{
public ushort wYear;
public ushort wMonth;
public ushort wDayOfWeek;
public ushort wDay;
public ushort wHour;
public ushort wMinute;
public ushort wSecond;
public ushort wMilliseconds;
/// <summary>
/// 从System.DateTime转换。
/// </summary>
/// <param name="time">System.DateTime类型的时间。</param>
public void FromDateTime(DateTime time)
{
wYear = (ushort)time.Year;
wMonth = (ushort)time.Month;
wDayOfWeek = (ushort)time.DayOfWeek;
wDay = (ushort)time.Day;
wHour = (ushort)time.Hour;
wMinute = (ushort)time.Minute;
wSecond = (ushort)time.Second;
wMilliseconds = (ushort)time.Millisecond;
}
/// <summary>
/// 转换为System.DateTime类型。
/// </summary>
/// <returns></returns>
public DateTime ToDateTime()
{
return new DateTime(wYear, wMonth, wDay, wHour, wMinute, wSecond, wMilliseconds);
}
/// <summary>
/// 静态方法。转换为System.DateTime类型。
/// </summary>
/// <param name="time">SYSTEMTIME类型的时间。</param>
/// <returns></returns>
public static DateTime ToDateTime(SYSTEMTIME time)
{
return time.ToDateTime();
}
}
}
<pu:WindowX x:Class="LiteChannel.InitWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:pu="clr-namespace:Panuon.UI.Silver;assembly=Panuon.UI.Silver"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LiteChannel"
mc:Ignorable="d" Icon="1.ico"
Height="720" Width="1024" ResizeMode="NoResize" WindowState="Maximized"
Title="初始化入库" FontSize="24" WindowStartupLocation="CenterScreen"
Loaded="OnWindow_Loaded" Closing="OnWindow_Closing">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="0"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions>
<ComboBox Name="cbo_info" Grid.Row="0" pu:ComboBoxHelper.Watermark="请选择装备类型..." Height="40" Width="200" Margin="5,0,800,0"
pu:ComboBoxHelper.ItemHeight="50"
pu:ComboBoxHelper.HoverBackground="#1EB5B5B5"
pu:ComboBoxHelper.SelectedBackground="#32B5B5B5"
pu:ComboBoxHelper.IsSearchTextBoxVisible="True"
pu:ComboBoxHelper.SearchTextChanged="cbo_equInfo_SearchTextChanged"
pu:ComboBoxHelper.SearchTextBoxWatermark="在此搜索装备类型..." SelectionChanged="cbo_equInfo_SelectionChanged" HorizontalAlignment="Left"
>
</ComboBox>
<ComboBox Name="cbo_size_info" Grid.Row="0" pu:ComboBoxHelper.Watermark="请选择装备号型..." Height="40" Width="200" Margin="225,0,599,0"
pu:ComboBoxHelper.ItemHeight="50"
pu:ComboBoxHelper.HoverBackground="#1EB5B5B5"
pu:ComboBoxHelper.SelectedBackground="#32B5B5B5"
pu:ComboBoxHelper.IsSearchTextBoxVisible="True"
pu:ComboBoxHelper.SearchTextChanged="cbo_equSizeInfo_SearchTextChanged"
pu:ComboBoxHelper.SearchTextBoxWatermark="在此搜索装备号型..." SelectionChanged="cbo_equSizeInfo_SelectionChanged" HorizontalAlignment="Left"
>
</ComboBox>
<Button pu:ButtonHelper.CornerRadius="4" Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Right" Background="#C8FF7F00" Click="OnExport_Click" pu:ButtonHelper.HoverBrush="#FF7F00" Width="150" Height="35" Margin="0,0,10,0" FontSize="24">导出物资信息</Button>
<DataGrid FontSize="24" Grid.Row="1" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" EnableRowVirtualization="False" Margin="3 5 3 0" HeadersVisibility="Column"
pu:DataGridHelper.SelectedBackground="#44B5B5B5" pu:DataGridHelper.HoverBackground="#22B5B5B5" CanUserAddRows="False"
AutoGenerateColumns="False" LoadingRow="OnDataGridLoadingRow" SelectionMode="Single" Name="dg_epc" pu:DataGridHelper.ColumnHorizontalContentAlignment="Center" CanUserSortColumns="True"
ColumnHeaderHeight="60" RowHeight="60" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" BorderThickness="0,0,0,1" VerticalAlignment="Stretch"
>
<DataGrid.Columns>
<DataGridTemplateColumn Header="序号" MinWidth="80" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock FontSize="24" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,0,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn IsReadOnly="True" Header="EPC" Binding="{Binding EPC}" Width="*"></DataGridTextColumn>
<!--<DataGridTextColumn IsReadOnly="True" Header="识别数量" Binding="{Binding scanQty,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" Width="150"></DataGridTextColumn>-->
</DataGrid.Columns>
</DataGrid>
<!--<ComboBox Name="cbo_type" Grid.Row="1" Grid.Column="1" pu:ComboBoxHelper.Watermark="请选择入库类型..." Height="40" Margin="5,0,5,0">
<ComboBoxItem>采购</ComboBoxItem>
<ComboBoxItem>借用</ComboBoxItem>
<ComboBoxItem>跨库借用</ComboBoxItem>
<ComboBoxItem>库存调拨</ComboBoxItem>
<ComboBoxItem>维修</ComboBoxItem>
<ComboBoxItem>跨库归还</ComboBoxItem>
</ComboBox>-->
<TextBlock Grid.Row="3" Grid.ColumnSpan="2" Margin="0,0,220,0" Foreground="Red" Name="txt_stat" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24">状态:读写器启动失败</TextBlock>
<Button pu:ButtonHelper.CornerRadius="4" Grid.Row="3" Grid.ColumnSpan="2" IsEnabled="false" Name="btn_inv" HorizontalAlignment="Right" Click="OnInv_Click" Width="120" Height="35" Margin="0,0,273,0" FontSize="24">开始读取</Button>
<Button pu:ButtonHelper.CornerRadius="4" Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Right" Width="120" Height="35" Margin="0,0,140,0" Click="OnSave_Click" FontSize="24">提交入库</Button>
<Button pu:ButtonHelper.CornerRadius="4" Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Right" Background="#C8FF7F00" Click="OnExit_Click" pu:ButtonHelper.HoverBrush="#FF7F00" Width="120" Height="35" Margin="0,0,10,0" FontSize="24">返回</Button>
</Grid>
</pu:WindowX>
<pu:WindowX x:Class="LiteChannel.InvInfoWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pu="clr-namespace:Panuon.UI.Silver;assembly=Panuon.UI.Silver"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LiteChannel"
xmlns:usControl="clr-namespace:LiteChannel.UsControl"
mc:Ignorable="d" Icon="1.ico"
Height="720" Width="1024" ResizeMode="NoResize" WindowState="Maximized"
Loaded="MainWindowLoaded" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterScreen"
Closing="OnWindow_Closing" pu:WindowXCaption.DisableCloseButton="True">
<Grid x:Name="g_main">
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
<RowDefinition Height="80"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.6*"/>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Button Name="btn_onInStore" Grid.Row="0" Grid.ColumnSpan="2" Margin="0,0,10,0" Click="OnInit_Click" pu:ButtonHelper.Icon="&#xf085;" Content="初始化" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="22"></Button>
<!--<Button Grid.Column="1" Margin="0,0,10,0" Click="OnOutStoreNoOrder_Click" pu:ButtonHelper.Icon="&#xf085;" Content="本仓库借用出库" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="22"></Button>-->
<Button Grid.Row="0" Grid.Column="2" Click="OnRefresh_Click" pu:ButtonHelper.Icon="&#xf202;" Margin="10,0,10,0" Content="刷新" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="22"></Button>
<Button Grid.Row="0" Grid.Column="3" Click="OnClose_Click" pu:ButtonHelper.Icon="&#xf2d3;" Margin="10,0,10,0" Content="返回主页" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="22" Background="#C8FF0000" pu:ButtonHelper.HoverBrush="#FF0000" ></Button>
<DataGrid Grid.Row="1" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" EnableRowVirtualization="False" Margin="3 5 3 0" HeadersVisibility="Column"
pu:DataGridHelper.SelectedBackground="#44B5B5B5" pu:DataGridHelper.HoverBackground="#22B5B5B5" CanUserAddRows="False" Grid.ColumnSpan="4"
AutoGenerateColumns="False" LoadingRow="OnDataGridLoadingRow" SelectionMode="Single" Name="dg_order" pu:DataGridHelper.ColumnHorizontalContentAlignment="Center" CanUserSortColumns="True" >
<DataGrid.Columns>
<DataGridTemplateColumn Header="序号" MinWidth="80" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock FontSize="18" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,0,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn IsReadOnly="True" Header="装备类型" Width="*" MinWidth="115" FontSize="18" Binding="{Binding equipmentDetailName}" />
<DataGridTextColumn IsReadOnly="True" Header="装备号型" Width="*" MinWidth="100" FontSize="18" Binding="{Binding equipmentSizeName}" />
<DataGridTextColumn IsReadOnly="True" Header="EPC" Width="3*" MinWidth="100" FontSize="18" Binding="{Binding epc}" />
<DataGridTextColumn IsReadOnly="True" Header="在库状态" Width="*" MinWidth="100" FontSize="18" Binding="{Binding stateName}" />
<!--<DataGridTextColumn IsReadOnly="True" Header="装备信息" Width="*" MinWidth="100" FontSize="18" Binding="{Binding equNames}"/>-->
<!--<DataGridTextColumn IsReadOnly="True" Header="单据数量" Width="100" MinWidth="100" FontSize="18" Binding="{Binding orderQuantity}"/>-->
<DataGridTemplateColumn Header="操作" Width="250" MinWidth="250" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="删除" pu:ButtonHelper.Icon="&#xf20e;" pu:ButtonHelper.CornerRadius="5" Click="OnDelete_Click" Padding="8" Margin="2,8,2,8" >
</Button>
<!--<Button Content="查看明细" pu:ButtonHelper.Icon="&#xf1cb;" pu:ButtonHelper.CornerRadius="5" Click="OnShowDetail_Click" Padding="8" Margin="5,8,5,8" >
</Button>-->
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<usControl:PageControl IsEnabled="{Binding BindButton}" x:Name="d_pager" Margin="0,0,0,0" Grid.Row="2" TotalRecord="{Binding TotalRecord,Mode=TwoWay}" TotalPage="{Binding PageTotal,Mode=TwoWay}" PageSize="{Binding PageSize,Mode=TwoWay}" PageIndex="{Binding PageIndex,Mode=TwoWay}" Grid.ColumnSpan="4"
Grid.Column="0">
<i:Interaction.Triggers>
<i:EventTrigger EventName="OnPageChanged">
<i:InvokeCommandAction Command="{Binding OnPageChangeCmd}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</usControl:PageControl>
</Grid>
</pu:WindowX>
using LiteChannel.Commons;
using LiteChannel.Models;
using Panuon.UI.Silver;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using GalaSoft.MvvmLight.CommandWpf;
using System.ComponentModel;
using JmpCommon;
namespace LiteChannel
{
/// <summary>
/// Window1.xaml 的交互逻辑
/// </summary>
public partial class InvInfoWindow : WindowX, IComponentConnector
{
private PageControl2Model model;
public InvInfoWindow()
{
InitializeComponent();
model = new PageControl2Model(this);
}
private void MainWindowLoaded(object sender, RoutedEventArgs e)
{
DataContext = model;
//加载单据数据
model.PageIndex = 1;
LoadData();
}
public void LoadData()
{
var tmp = LiteCaChe.InventoryInfos
.OrderBy(x => x.equipmentDetailName)
.ThenBy(x => x.equipmentSizeName)
.Skip((model.PageIndex - 1) * model.PageSize).Take(model.PageSize);
model.TotalRecord = LiteCaChe.InventoryInfos.Count;
model.PageTotal = model.TotalRecord == 0 ? 0 : (model.TotalRecord + model.PageSize - 1) / model.PageSize;
dg_order.ItemsSource = tmp;
}
private void OnDataGridLoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
private void OnWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
}
private void OnRefresh_Click(object sender, RoutedEventArgs e)
{
model.PageIndex = 1;
LoadData();
}
private void OnClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
//Application.Current.Shutdown();
//Process.GetCurrentProcess().Kill();
}
private void OnInit_Click(object sender, RoutedEventArgs e)
{
var from = new InitWindow();
from.Owner = this;
//from.OnApplySuc += LoadData;
from.ShowDialog();
OnRefresh_Click(null, null);
}
private void OnDelete_Click(object sender, RoutedEventArgs e)
{
if (dg_order.SelectedItem != null)
{
var item = dg_order.SelectedItem as inventory_info;
if (MessageBox.Show($"是否确定删除装备?同时出入库记录也会被删除\r\n装备名:{item.equipmentDetailName}-{item.equipmentSizeName}\r\nEPC:{item.epc}", "提示", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
//删除装备
LiteDBHelper.DeleteInventory(item);
//更新缓存
LiteCaChe.InventoryInfos = LiteDBHelper.FindAllInventory();
LoadData();
}
}
}
}
public class PageControl2Model : INotifyPropertyChanged
{
private bool _bindButton = true;
public bool BindButton
{
get { return _bindButton; }
set
{
_bindButton = value;
OnPropertyChanged("BindButton");
}
}
private int _total = 0;
public int TotalRecord
{
get { return _total; }
set
{
_total = value;
OnPropertyChanged("TotalRecord");
}
}
private int _page = 0;
public int PageIndex
{
get { return _page; }
set
{
_page = value;
OnPropertyChanged("PageIndex");
}
}
private int _pageTotal = 0;
public int PageTotal
{
get { return _pageTotal; }
set
{
_pageTotal = value;
OnPropertyChanged("PageTotal");
}
}
private int _pageSize = 50;
public int PageSize
{
get { return _pageSize; }
set
{
_pageSize = value;
OnPropertyChanged("PageSize");
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string strPropertyInfo)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(strPropertyInfo));
}
}
private readonly InvInfoWindow _mainWindow;
public RelayCommand OnPageChangeCmd { get; set; }
public PageControl2Model(InvInfoWindow mainWindow)
{
_mainWindow = mainWindow;
PageSize = 10;
OnPageChangeCmd = new RelayCommand(OnPageChange);
}
private void OnPageChange()
{
_mainWindow.LoadData();
}
}
}
using GalaSoft.MvvmLight;
using LiteChannel.Commons;
using LiteChannel.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace LiteChannel
{
public static class LiteCaChe
{
public static List<sync_police> PoliceList { get; set; }
public static string OrgId { get; set; }
public static string OrgCode { get; set; }
public static string PoliceId { get; set; }
public static string UserId { get; set; }
public static string UserName { get; set; }
public static List<equ_info> EquInfos { get; set; }
public static List<inventory_info> InventoryInfos { get; set; }
public static Config SysConfig { get; set; }
public static Config LoadSystemStep()
{
var v_path = AppDomain.CurrentDomain.BaseDirectory + "config.json";
if (!File.Exists(v_path))
{
return null;
}
else
{
var v_json = File.ReadAllText(v_path, Encoding.Default);
var des_str = JmpDes.Decrypt(v_json);
if (string.IsNullOrEmpty(des_str))
{
return null;
}
else
{
var config = JsonConvert.DeserializeObject<Config>(des_str);
//预处理
if (config.DomainUrl == "http://41.204.7.134:18761/api/service")
{
config.DomainUrl = "http://41.190.20.132:18761/api/service";
}
if (config.UserLogin == "http://41.204.7.134:10004/auth/userLogin")
{
config.UserLogin = "http://41.190.20.132:10004/auth/userLogin";
}
return config;
}
}
}
public static bool SaveSystemStep(Config config)
{
try
{
if (config == null) { return false; }
else
{
var json = JsonConvert.SerializeObject(config, Formatting.Indented);
if (string.IsNullOrEmpty(json))
{
return false;
}
else
{
System.IO.File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + "config.json", JmpDes.Encrypt(json), Encoding.UTF8);
return true;
}
}
}
catch (Exception ex)
{
Log.ErrorLog(ex.ToString(), MethodBase.GetCurrentMethod().Name);
return false;
}
}
}
public class Config : ViewModelBase
{
public const string SoftUpdate = "/api/SoftUpdate/GetLastUpdate";
public const string GetEquInfo = "/api/EquipmentDetail/GetListEquipmentDetail";
public const string GetStoreInfo = "/api/Warehouse/GetListOrgWarehouse";
public const string GetOrderInfo = "/api/Inventory/GetOrderInfo";
public const string GetOrderDetail = "/api/Inventory/GetOrderDetail";
public const string OpenOrderWorkUrl = "/api/Inventory/OpenThisOrderAndCloseOther";
public const string UploadUrl = "/api/Inventory/UploadRFIDNew";
public const string CloseOrderUrl = "/api/Inventory/CloseOrder";
public const string GetPolices = "/api/ChannelCfg/GetOrgStaff";
public const string UploadFace = "/api/ChannelCfg/UploadFace";
public const string UpdateFinger = "/api/ChannelCfg/UpdateFinger";
public const string GetInvListByEpc = "/api/Inventory/GetInvListByEpc";
public const string GetWarehouseById = "/api/Warehouse/GetWarehouseById";
public const string SetWarehouseState = "/api/Inventory/SetWarehouseState";
public const string GetEpcListByBoxMarkEpc = "/api/EquipmentBoxMark/GetEpcListByBoxMarkEpc";
public const string GetAllInventoryList = "/api/Inventory/GetAllInventoryList";
public const string AddAndApprovalBorrowOrder = "/api/Borrow/AddAndApprovalBorrowOrder";
public const string AddAndApprovalBorrowJYOrder = "/api/Borrow/AddAndApprovalBorrowJYOrder";
public const string GetServerime = "/api/ChannelCfg/GetServerTime";
public Config()
{
AppTitle = "充电台出入库v" + Application.ResourceAssembly.GetName().Version;
AppVersion = Application.ResourceAssembly.GetName().Version.ToString();
AppCode = "10003";
DomainUrl = "http://41.190.20.132:18761/api/service";
UserLogin = "http://41.190.20.132:10004/auth/userLogin";
ComMouth = "COM4";
WarehouseID = "d8192b23-0ec9-4b2e-a47d-f6780a66a880";
ApiVersion = "1.0";
AppKey = "q6t0lEKOmMg5Tm+dg3XdZQ==";
SecretKey = "ba4d855b3b83eab441a51ea9bd9d9671";
FaceAddress = "192.168.8.35";
FaceUser = "admin";
FacePwd = "junmp123";
FacePort = "8000";
IsUseFace = true;
IsEnabledShelf = false;
ShelfAddress = "http://192.168.3.128:38080/api/BoundDocuments";
IsAutoUpdate = true;
AutoUpdateTime = 0;
ReaderType = 0;
}
/// <summary>
/// 接口域名
/// </summary>
public string DomainUrl { get; set; }
/// <summary>
/// 登录
/// </summary>
public string UserLogin { get; set; }
[JsonIgnore]
public string AppTitle { get; set; }
[JsonIgnore]
public string AppVersion { get; set; }
[JsonIgnore]
public string AppCode { get; set; }
public string ComMouth { get; set; }
public string WarehouseID { get; set; }
public string ApiVersion { get; set; }
public string AppKey { get; set; }
public string SecretKey { get; set; }
public string FaceAddress { get; set; }
public string FaceUser { get; set; }
public string FacePwd { get; set; }
public string FacePort { get; set; }
public bool IsUseFace { get; set; }
public bool IsEnabledShelf { get; set; }
public string ShelfAddress { get; set; }
/// <summary>
/// 是否自动更新
/// </summary>
public bool IsAutoUpdate { get; set; }
/// <summary>
/// 自动更新时间(小时)
/// </summary>
public int AutoUpdateTime { get; set; }
/// <summary>
/// 读写器类型
/// 0 钧普
/// 1 索力得
/// </summary>
public int ReaderType { get; set; }
[JsonIgnore]
public static new bool IsInDesignModeStatic { get; }
}
public class respone_user
{
public string id { get; set; }
public string username { get; set; }
public bool enabled { get; set; }
public respone_org baseJpOrganization { get; set; }
public respone_policeman policeman { get; set; }
}
public class respone_org
{
public string id { get; set; }
public string name { get; set; }
public string code { get; set; }
public string findCode { get; set; }
}
public class respone_policeman
{
public string id { get; set; }
public string name { get; set; }
public string policeCode { get; set; }
}
}
<pu:WindowX x:Class="LiteChannel.LoginWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:pu="clr-namespace:Panuon.UI.Silver;assembly=Panuon.UI.Silver"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LiteChannel"
mc:Ignorable="d" Icon="1.ico"
Title="射频出入库系统" Height="250" Width="400" Loaded="Window_Loaded" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" >
<Window.Resources>
<ResourceDictionary>
<RoutedUICommand x:Key="OnShowConfig" Text="配置管理"/>
</ResourceDictionary>
</Window.Resources>
<Window.InputBindings>
<KeyBinding Gesture="Ctrl+ALT+J" Command="{ StaticResource OnShowConfig}" />
</Window.InputBindings>
<Window.CommandBindings>
<CommandBinding Command="{StaticResource OnShowConfig}"
CanExecute="OnShowConfig_CanExecute"
Executed="OnShowConfig_Executed"/>
</Window.CommandBindings>
<Window.Effect>
<DropShadowEffect BlurRadius="10" Color="#FF858484" Direction="90" ShadowDepth="2"/>
</Window.Effect>
<Grid >
<Grid x:Name="g_body" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height="60"/>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Center" Width="300">
<TextBox Height="30" Name="txtUser"
Width="300"
pu:TextBoxHelper.Watermark="请输入用户名"
pu:TextBoxHelper.Icon="&#xf11c;"
FontFamily="/Font/#iconfont"
pu:TextBoxHelper.FocusedBorderBrush="#B5B5B5"
pu:TextBoxHelper.FocusedShadowColor="#B5B5B5"
pu:TextBoxHelper.IsClearButtonVisible="True" />
</StackPanel>
<StackPanel Margin="0 0 0 0" Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" Width="300">
<PasswordBox Height="30" Name="txtPwd" KeyDown="OnKeyDown"
Width="300"
FontFamily="/Font/#iconfont"
pu:PasswordBoxHelper.Watermark="请输入密码"
pu:PasswordBoxHelper.Icon="&#xf11c;"
pu:PasswordBoxHelper.FocusedBorderBrush="#B5B5B5"
pu:PasswordBoxHelper.FocusedShadowColor="#B5B5B5"
pu:PasswordBoxHelper.IsShowPwdButtonVisible="True" />
</StackPanel>
<Button Grid.Row="3" pu:ButtonHelper.CornerRadius="4" FontSize="20" Content="登录" Margin="127,10,116.6,0" Height="45" Width="150" HorizontalAlignment="Center" VerticalAlignment="Top" Click="OnLoginClick"/>
</Grid>
</Grid>
</pu:WindowX>
using LiteChannel.Commons;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Panuon.UI.Silver;
using Panuon.UI.Silver.Core;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Markup;
namespace LiteChannel
{
/// <summary>
/// Login.xaml 的交互逻辑
/// </summary>
public partial class LoginWindow : WindowX, IComponentConnector
{
private bool bLogin = false;
public LoginWindow()
{
InitializeComponent();
txtUser.Focus();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
ReadHistory();
}
private void Sb_Completed(object sender, EventArgs e)
{
this.Close();
Process.GetCurrentProcess().Kill();
}
private async void OnLoginClick(object sender, RoutedEventArgs e)
{
if (bLogin) { return; }
if (string.IsNullOrEmpty(txtUser.Text))
{
bLogin = false;
MessageBox.Show(this, "用户名未填写", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
if (string.IsNullOrEmpty(txtPwd.Password))
{
bLogin = false;
MessageBox.Show(this, "密码未填写", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
var handler = PendingBox.Show("系统登录中...", "", false, Application.Current.MainWindow, new PendingBoxConfigurations()
{
LoadingForeground = "#5DBBEC".ToColor().ToBrush(),
MaxWidth = 250,
MinHeight = 110,
MinWidth = 250,
MaxHeight = 110,
ButtonBrush = "#5DBBEC".ToColor().ToBrush(),
});
var user = txtUser.Text;
var pwd = txtPwd.Password;
var lg_res = await Task.Run(() =>
{
var result = HttpHelper.UserLogin(user, pwd);
return result;
});
if (lg_res != null)
{
SaveHistory();
handler.UpdateMessage("系统登录成功!");
LiteCaChe.OrgId = lg_res.baseJpOrganization?.id ?? "";
LiteCaChe.OrgCode = lg_res.baseJpOrganization?.code?.Substring(0, 6) ?? "";
LiteCaChe.PoliceId = lg_res.policeman?.id ?? "";
LiteCaChe.UserId = lg_res.id;
LiteCaChe.UserName = lg_res.username;
new MainWindow().Show();
this.ShowInTaskbar = false;
this.Hide();
}
else
{
handler.UpdateMessage("系统登录失败!");
}
await Task.Delay(500);
handler.Close();
}
private void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
OnLoginClick(sender, new RoutedEventArgs());
}
}
private void OnShowConfig_CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = true;
}
private void OnShowConfig_Executed(object sender, ExecutedRoutedEventArgs e)
{
Setting settings = new Setting();
settings.ShowDialog();
}
private void SaveHistory()
{
var path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "history.txt";
if (!File.Exists(path))
{
File.Create(path);
}
var txt = txtUser.Text + "|" + txtPwd.Password;
File.WriteAllText(path, txt, Encoding.UTF8);
}
public void ReadHistory()
{
var path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "history.txt";
if (!File.Exists(path))
{
File.CreateText(path).Dispose();
}
var txt = File.ReadAllText(path, Encoding.UTF8);
if (!string.IsNullOrEmpty(txt))
{
var record = txt.Split('|');
if (record.Length == 2)
{
txtUser.Text = record[0];
txtPwd.Password = record[1];
}
}
}
}
}
<pu:WindowX x:Class="LiteChannel.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pu="clr-namespace:Panuon.UI.Silver;assembly=Panuon.UI.Silver"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LiteChannel"
xmlns:usControl="clr-namespace:LiteChannel.UsControl"
mc:Ignorable="d"
Height="720" Width="1024" ResizeMode="NoResize" WindowState="Maximized"
Loaded="MainWindowLoaded" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterScreen"
Closing="OnWindow_Closing" pu:WindowXCaption.DisableCloseButton="True">
<pu:WindowX.Background>
<ImageBrush ImageSource="Resources/1.png"/>
</pu:WindowX.Background>
<Grid x:Name="g_main">
<Grid.RowDefinitions>
<RowDefinition Height="0.18*"/>
<RowDefinition Height="0.06*"/>
<RowDefinition Height="0.1*"/>
<RowDefinition Height="0.4*"/>
<RowDefinition Height="0.28*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="6*"/>
<ColumnDefinition Width="6*"/>
<ColumnDefinition Width="6*"/>
<ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions>
<!--<ComboBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" x:Name="cbo_warehouse"
Width="auto" Height="50" Margin="10,0,10,0"
HorizontalAlignment="Stretch" VerticalAlignment="Center"
FontSize="20"
MaxDropDownHeight="400"
pu:ComboBoxHelper.ItemHeight="50"
pu:ComboBoxHelper.HoverBackground="#1EB5B5B5"
pu:ComboBoxHelper.SelectedBackground="#32B5B5B5"
pu:ComboBoxHelper.IsSearchTextBoxVisible="True"
pu:ComboBoxHelper.SearchTextChanged="cbo_warehouse_SearchTextChanged"
pu:ComboBoxHelper.SearchTextBoxWatermark="在此搜索仓库..." SelectionChanged="cbo_warehouse_SelectionChanged"></ComboBox>-->
<Border Grid.Row="3" Grid.Column="1" Margin="25,0,25,0">
<Border.BorderBrush>
<ImageBrush ImageSource="Resources/3.png"/>
</Border.BorderBrush>
<Border.Background>
<ImageBrush ImageSource="Resources/3.png"/>
</Border.Background>
<Button Click="OnInStore_Click" FontFamily="{StaticResource FontAwesome}" FontSize="30" Foreground="{x:Null}" Margin="0,75,0,0">
<pu:ButtonHelper.ButtonStyle>
<pu:ButtonStyle>Link</pu:ButtonStyle>
</pu:ButtonHelper.ButtonStyle>
</Button>
</Border>
<Border Grid.Row="3" Grid.Column="2" Margin="25,0,25,0">
<Border.BorderBrush>
<ImageBrush ImageSource="Resources/4.png"/>
</Border.BorderBrush>
<Border.Background>
<ImageBrush ImageSource="Resources/4.png"/>
</Border.Background>
<Button Click="OnOutStore_Click" FontFamily="{StaticResource FontAwesome}" FontSize="30" Foreground="{x:Null}" Margin="0,75,0,0">
<pu:ButtonHelper.ButtonStyle>
<pu:ButtonStyle>Link</pu:ButtonStyle>
</pu:ButtonHelper.ButtonStyle>
</Button>
</Border>
<Border Grid.Row="3" Grid.Column="3" Margin="25,0,25,0">
<Border.BorderBrush>
<ImageBrush ImageSource="Resources/2.png"/>
</Border.BorderBrush>
<Border.Background>
<ImageBrush ImageSource="Resources/2.png"/>
</Border.Background>
<Button Click="OnInit_Click" FontFamily="{StaticResource FontAwesome}" FontSize="30" Foreground="{x:Null}" Margin="0,75,0,0">
<pu:ButtonHelper.ButtonStyle>
<pu:ButtonStyle>Link</pu:ButtonStyle>
</pu:ButtonHelper.ButtonStyle>
</Button>
</Border>
<Button Grid.Row="0" Grid.Column="4" Background="Transparent" MouseDoubleClick="OnClose_Click" pu:ButtonHelper.ButtonStyle="Link">
</Button>
</Grid>
</pu:WindowX>
using LiteChannel.Commons;
using LiteChannel.Models;
using Panuon.UI.Silver;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using GalaSoft.MvvmLight.CommandWpf;
using System.ComponentModel;
namespace LiteChannel
{
/// <summary>
/// Window1.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : WindowX, IComponentConnector
{
private List<store_info> StoreList { get; set; }
public MainWindow()
{
InitializeComponent();
}
private void MainWindowLoaded(object sender, RoutedEventArgs e)
{
//this.Topmost = true;
}
private void OnOutStore_Click(object sender, RoutedEventArgs e)
{
var from = new OutInWindow("出库");
from.Owner = this;
//from.OnApplySuc += LoadData;
from.ShowDialog();
}
private void OnWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
Process.GetCurrentProcess().Kill();
}
private void OnInStore_Click(object sender, RoutedEventArgs e)
{
var from = new OutInWindow("入库");
from.Owner = this;
//from.OnApplySuc += LoadData;
from.ShowDialog();
}
private void OnInit_Click(object sender, RoutedEventArgs e)
{
var from = new InvInfoWindow();
from.Owner = this;
//from.OnApplySuc += LoadData;
from.ShowDialog();
}
private void OnClose_Click(object sender, RoutedEventArgs e)
{
Application.Current.Shutdown();
//Process.GetCurrentProcess().Kill();
}
}
}
<pu:WindowX x:Class="LiteChannel.OutInWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pu="clr-namespace:Panuon.UI.Silver;assembly=Panuon.UI.Silver"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LiteChannel"
xmlns:usControl="clr-namespace:LiteChannel.UsControl"
mc:Ignorable="d" Icon="1.ico"
Height="720" Width="1024" ResizeMode="NoResize" WindowState="Maximized"
Loaded="MainWindowLoaded" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterScreen"
Closing="OnWindow_Closing" pu:WindowXCaption.DisableCloseButton="True">
<Grid x:Name="g_main">
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
<RowDefinition Height="80"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.6*"/>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Button Grid.Row="0" Margin="0,0,10,0" Click="OnInStore_Click" pu:ButtonHelper.Icon="&#xf085;" Content="快捷创建单据" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="22"></Button>
<Button Grid.Column="1" Margin="0,0,10,0" Click="OnOutStoreNoOrder_Click" pu:ButtonHelper.Icon="&#xf085;" Content="本仓库借用出库" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="22"></Button>
<Button Grid.Row="0" Grid.Column="2" Click="OnRefresh_Click" pu:ButtonHelper.Icon="&#xf202;" Margin="10,0,10,0" Content="刷新单据" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="22"></Button>
<Button Grid.Row="0" Grid.Column="3" Click="OnClose_Click" pu:ButtonHelper.Icon="&#xf2d3;" Margin="10,0,10,0" Content="返回主页" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="22" Background="#C8FF0000" pu:ButtonHelper.HoverBrush="#FF0000" ></Button>
<DataGrid Grid.Row="1" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" EnableRowVirtualization="False" Margin="3 5 3 0" HeadersVisibility="Column"
pu:DataGridHelper.SelectedBackground="#44B5B5B5" pu:DataGridHelper.HoverBackground="#22B5B5B5" CanUserAddRows="False" Grid.ColumnSpan="4"
AutoGenerateColumns="False" LoadingRow="OnDataGridLoadingRow" SelectionMode="Single" Name="dg_order" pu:DataGridHelper.ColumnHorizontalContentAlignment="Center" CanUserSortColumns="True" >
<DataGrid.Columns>
<!--<DataGridTemplateColumn Header="序号" MinWidth="80" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock FontSize="18" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,0,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
<DataGridTextColumn IsReadOnly="True" Header="单据编号(后6位)" Width="115" MinWidth="115" FontSize="18" Binding="{Binding orderCodeLast6}" />
<DataGridTextColumn IsReadOnly="True" Header="单据类型" Width="100" MinWidth="100" FontSize="18" Binding="{Binding orderType}" />
<DataGridTextColumn IsReadOnly="True" Header="借用警员(借用)" Width="*" MinWidth="100" FontSize="18" Binding="{Binding borrowPolice}" />
<DataGridTextColumn IsReadOnly="True" Header="目标仓库(调拨)" Width="*" MinWidth="100" FontSize="18" Binding="{Binding receiveWarehouseName}" />
<DataGridTextColumn IsReadOnly="True" Header="申请日期" Width="*" MinWidth="205" FontSize="18" Binding="{Binding createTime}"/>
<!--<DataGridTextColumn IsReadOnly="True" Header="装备信息" Width="*" MinWidth="100" FontSize="18" Binding="{Binding equNames}"/>-->
<!--<DataGridTextColumn IsReadOnly="True" Header="单据数量" Width="100" MinWidth="100" FontSize="18" Binding="{Binding orderQuantity}"/>-->
<DataGridTemplateColumn Header="操作" Width="250" MinWidth="250" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="开始出库" pu:ButtonHelper.Icon="&#xf20e;" pu:ButtonHelper.CornerRadius="5" Click="OnOutStore_Click" Padding="8" Margin="5,8,5,8" >
</Button>
<Button Content="查看明细" pu:ButtonHelper.Icon="&#xf1cb;" pu:ButtonHelper.CornerRadius="5" Click="OnShowDetail_Click" Padding="8" Margin="5,8,5,8" >
</Button>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<usControl:PageControl IsEnabled="{Binding BindButton}" x:Name="d_pager" Margin="0,0,0,0" Grid.Row="2" TotalRecord="{Binding TotalRecord,Mode=TwoWay}" TotalPage="{Binding PageTotal,Mode=TwoWay}" PageSize="{Binding PageSize,Mode=TwoWay}" PageIndex="{Binding PageIndex,Mode=TwoWay}" Grid.ColumnSpan="4"
Grid.Column="0">
<i:Interaction.Triggers>
<i:EventTrigger EventName="OnPageChanged">
<i:InvokeCommandAction Command="{Binding OnPageChangeCmd}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</usControl:PageControl>
</Grid>
</pu:WindowX>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Models
{
public class BaseJpWarehouse
{
public string id { get; set; }
public int? sort { get; set; }
public string name { get; set; }
public string location { get; set; }
public string locationDetail { get; set; }
public string orgizationId { get; set; }
public string phone { get; set; }
public DateTime createTime { get; set; }
public DateTime updateTime { get; set; }
public string updateUser { get; set; }
/// <summary>
/// 是否锁库,0:未锁库,1:锁库中
/// </summary>
public bool? isLocked { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Models
{
public class equ_info
{
public equ_info()
{
sizeList = new List<equ_size_info>();
}
public string id { get; set; }
public string code { get; set; }
public string name { get; set; }
public List<equ_size_info> sizeList { get; set; }
}
public class equ_size_info
{
public string id { get; set; }
public string info_id { get; set; }
public string code { get; set; }
public string name { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LiteDB;
namespace LiteChannel.Models
{
public class inventory_info
{
/// <summary>
/// id
/// </summary>
public string Id { get; set; }
/// <summary>
/// 装备类型id
/// </summary>
public string equipmentDetailId { get; set; }
/// <summary>
/// 装备类型名
/// </summary>
public string equipmentDetailName { get; set; }
/// <summary>
/// 装备号型id
/// </summary>
public string equipmentSizeId { get; set; }
/// <summary>
/// 装备号型名
/// </summary>
public string equipmentSizeName { get; set; }
/// <summary>
/// epc
/// </summary>
public string epc { get; set; }
/// <summary>
/// 状态 0 在库 1 出库
/// </summary>
public int state { get; set; }
/// <summary>
/// 状态 0 入库 1 出库
/// </summary>
[BsonIgnore]
public string stateName
{
get { return state == 0 ? "在库" : "出库"; }
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LiteDB;
namespace LiteChannel.Models
{
public class inventory_out_in_log
{
/// <summary>
/// id
/// </summary>
public string Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createTime { get; set; }
/// <summary>
/// 装备类型id
/// </summary>
public string equipmentDetailId { get; set; }
/// <summary>
/// 装备类型名
/// </summary>
public string equipmentDetailName { get; set; }
/// <summary>
/// 装备号型id
/// </summary>
public string equipmentSizeId { get; set; }
/// <summary>
/// 装备号型名
/// </summary>
public string equipmentSizeName { get; set; }
/// <summary>
/// epc
/// </summary>
public string epc { get; set; }
/// <summary>
/// 状态 0 入库 1 出库
/// </summary>
public int state { get; set; }
/// <summary>
/// 状态 0 入库 1 出库
/// </summary>
[BsonIgnore]
public string stateName
{
get { return state == 0 ? "入库" : "出库"; }
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Models
{
public class order_equ
{
public string equCode { get; set; }
public int equRem { get; set; }
public int equCount { get; set; }
public int equUsed { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Models
{
public class order_info
{
public string id { get; set; }
public string warehouseId { get; set; }
public string orderCode { get; set; }
public string orderCodeLast6 => orderCode.Substring(16);
public string orgId { get; set; }
public string createTime { get; set; }
public bool? isWork { get; set; }
public string orderType { get; set; }
public int orderQuantity { get; set; }
public string equNames { get; set; }
public string borrowPolice { get; set; }
public string receiveWarehouseId { get; set; }
public string receiveWarehouseName { get; set; }
}
public class order_detail
{
public string id { get; set; }
public string equId { get; set; }
public string equName { get; set; }
public string equCode { get; set; }
public int equCount { get; set; }
public int equUsed { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Models
{
public class request_sign
{
public string appKey { get; set; } = string.Empty;
public string orgId { get; set; } = string.Empty;
public string version { get; set; } = "1.0";
public string timestamp { get; set; }
public string body { get; set; }
public string sign { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Models
{
public class respone<T>
{
public int code { get; set; }
public string msg { get; set; }
public T data { get; set; }
}
public class respone
{
public int code { get; set; }
public string msg { get; set; }
}
public class PagedList<T>
{
public int totalElements { get; set; }
public List<T> content { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Models
{
public class respone_upload
{
public int code { get; set; }
public string msg { get; set; }
public int timestamp { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Models
{
public class response_BoxMarkModel
{
public string id { get; set; }
public string createTime { get; set; }
public string epc { get; set; }
public string oneBoxNum { get; set; }
public string warehouseId { get; set; }
public string warehouseName { get; set; }
public string orgizationId { get; set; }
public string equipmentInfoId { get; set; }
public string equipmentDetailId { get; set; }
public string equipmentDetailName { get; set; }
public string equipmentDetailCode { get; set; }
public string sizeId { get; set; }
public string sizeName { get; set; }
public string sizeCode { get; set; }
public string sizeEpcType { get; set; }
public string supplierId { get; set; }
public string supplierCode { get; set; }
public string supplierName { get; set; }
public List<string> epcList { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Models
{
public class rfid_res
{
public string epc { get; set; }
public string name { get; set; }
public int currentState { get; set; }
public int safeLevel { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Models
{
public class scan_info : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public int equRem { get; set; }
public string equCode { get; set; }
public string equId { get; set; }
public string equSizeId { get; set; }
public string equName { get; set; }
public string equSizeName { get; set; }
private int _scan_qty = 0;
public int scanQty
{
get { return _scan_qty; }
set
{
_scan_qty = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("scanQty"));
}
}
public int equCount { get; set; }
public List<string> epcList { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Models
{
public class soft_update
{
public string version2 { get; set; }
public int version { get; set; }
public string name { get; set; }
public string appCode { get; set; }
public string note { get; set; }
public string address { get; set; }
public string updateTime { get; set; }
public string fileMd5 { get; set; }
public bool isAutoUpdate { get; set; }
public string autoUpdateAddress { get; set; }
public string autoUpdateFileMd5 { get; set; }
public string autoUpdateVersion2 { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Models
{
public class store_info
{
public string id { get; set; }
public string name { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Models
{
public class sync_police
{
public string orgId { get; set; }
public string id { get; set; }
public string name { get; set; }
public string policeCode { get; set; }
public string photo { get; set; }
public DateTime udateTime { get; set; }
public DateTime createTime { get; set; }
public List<FingerInfo> fingerList { get; set; }
}
public class FingerInfo
{
public int fingerNum { get; set; }
public string fingerInfo { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiteChannel.Models
{
public class upload_info
{
public string orgId { get; set; }
public string warehouseId { get; set; }
/// <summary>
/// "当前出入库状态",//0出库,1入库
/// </summary>
public string currentState { get; set; }
public string policeId { get; set; } = string.Empty;
public string picUrl { get; set; }
public List<rfid_info> RFIDList { get; set; }
}
public class rfid_info
{
public string RFID { get; set; }
}
}
<pu:WindowX x:Class="LiteChannel.OutInWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pu="clr-namespace:Panuon.UI.Silver;assembly=Panuon.UI.Silver"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LiteChannel"
xmlns:usControl="clr-namespace:LiteChannel.UsControl"
mc:Ignorable="d" Icon="1.ico"
Height="720" Width="1024" ResizeMode="NoResize" WindowState="Maximized"
Loaded="MainWindowLoaded" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterScreen"
Closing="OnWindow_Closing" pu:WindowXCaption.DisableCloseButton="True">
<Grid x:Name="g_main">
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
<RowDefinition Height="80"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.6*"/>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Button Name="btn_onInStore" Grid.Row="0" Grid.ColumnSpan="2" Margin="0,0,10,0" Click="OnInStore_Click" pu:ButtonHelper.Icon="&#xf085;" Content="出库" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="22"></Button>
<!--<Button Grid.Column="1" Margin="0,0,10,0" Click="OnOutStoreNoOrder_Click" pu:ButtonHelper.Icon="&#xf085;" Content="本仓库借用出库" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="22"></Button>-->
<Button Grid.Row="0" Grid.Column="2" Click="OnRefresh_Click" pu:ButtonHelper.Icon="&#xf202;" Margin="10,0,10,0" Content="刷新" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="22"></Button>
<Button Grid.Row="0" Grid.Column="3" Click="OnClose_Click" pu:ButtonHelper.Icon="&#xf2d3;" Margin="10,0,10,0" Content="返回主页" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="22" Background="#C8FF0000" pu:ButtonHelper.HoverBrush="#FF0000" ></Button>
<DataGrid Grid.Row="1" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" EnableRowVirtualization="False" Margin="3 5 3 0" HeadersVisibility="Column"
pu:DataGridHelper.SelectedBackground="#44B5B5B5" pu:DataGridHelper.HoverBackground="#22B5B5B5" CanUserAddRows="False" Grid.ColumnSpan="4"
AutoGenerateColumns="False" LoadingRow="OnDataGridLoadingRow" SelectionMode="Single" Name="dg_order" pu:DataGridHelper.ColumnHorizontalContentAlignment="Center" CanUserSortColumns="True" >
<DataGrid.Columns>
<!--<DataGridTemplateColumn Header="序号" MinWidth="80" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock FontSize="18" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,0,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
<DataGridTextColumn IsReadOnly="True" Header="装备类型" Width="*" MinWidth="115" FontSize="18" Binding="{Binding equipmentDetailName}" />
<DataGridTextColumn IsReadOnly="True" Header="装备号型" Width="*" MinWidth="100" FontSize="18" Binding="{Binding equipmentSizeName}" />
<DataGridTextColumn IsReadOnly="True" Header="出入类型" Width="*" MinWidth="100" FontSize="18" Binding="{Binding stateName}" />
<DataGridTextColumn IsReadOnly="True" Header="出入时间" Width="*" MinWidth="100" FontSize="18" Binding="{Binding createTime,StringFormat='yyyy-MM-dd HH:mm:ss'}" />
<!--<DataGridTextColumn IsReadOnly="True" Header="装备信息" Width="*" MinWidth="100" FontSize="18" Binding="{Binding equNames}"/>-->
<!--<DataGridTextColumn IsReadOnly="True" Header="单据数量" Width="100" MinWidth="100" FontSize="18" Binding="{Binding orderQuantity}"/>-->
<!--<DataGridTemplateColumn Header="操作" Width="250" MinWidth="250" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="开始出库" pu:ButtonHelper.Icon="&#xf20e;" pu:ButtonHelper.CornerRadius="5" Click="OnOutStore_Click" Padding="8" Margin="5,8,5,8" >
</Button>
<Button Content="查看明细" pu:ButtonHelper.Icon="&#xf1cb;" pu:ButtonHelper.CornerRadius="5" Click="OnShowDetail_Click" Padding="8" Margin="5,8,5,8" >
</Button>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
</DataGrid.Columns>
</DataGrid>
<usControl:PageControl IsEnabled="{Binding BindButton}" x:Name="d_pager" Margin="0,0,0,0" Grid.Row="2" TotalRecord="{Binding TotalRecord,Mode=TwoWay}" TotalPage="{Binding PageTotal,Mode=TwoWay}" PageSize="{Binding PageSize,Mode=TwoWay}" PageIndex="{Binding PageIndex,Mode=TwoWay}" Grid.ColumnSpan="4"
Grid.Column="0">
<i:Interaction.Triggers>
<i:EventTrigger EventName="OnPageChanged">
<i:InvokeCommandAction Command="{Binding OnPageChangeCmd}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</usControl:PageControl>
</Grid>
</pu:WindowX>
using LiteChannel.Commons;
using LiteChannel.Models;
using Panuon.UI.Silver;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using GalaSoft.MvvmLight.CommandWpf;
using System.ComponentModel;
namespace LiteChannel
{
/// <summary>
/// Window1.xaml 的交互逻辑
/// </summary>
public partial class OutInWindow : WindowX, IComponentConnector
{
private PageControlModel model;
private readonly string _Type;
public OutInWindow(string type)
{
InitializeComponent();
model = new PageControlModel(this);
_Type = type;
switch (type)
{
case "出库":
{
btn_onInStore.Content = "物资出库";
break;
}
case "入库":
{
btn_onInStore.Content = "物资入库";
break;
}
}
}
private void MainWindowLoaded(object sender, RoutedEventArgs e)
{
DataContext = model;
//加载单据数据
model.PageIndex = 1;
LoadData();
}
public void LoadData()
{
var tmp = HttpHelper.GetOutInLogs(_Type, model.PageIndex, model.PageSize);
model.TotalRecord = tmp?.totalElements ?? 0;
model.PageTotal = model.TotalRecord == 0 ? 0 : (model.TotalRecord + model.PageSize - 1) / model.PageSize;
dg_order.ItemsSource = tmp?.content;
}
private void OnDataGridLoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
private void OnWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
}
private void OnInStore_Click(object sender, RoutedEventArgs e)
{
switch (_Type)
{
case "出库":
{
var from = new StoreOutWindow("", "NoOrder", null);
from.Owner = this;
from.ShowDialog();
OnRefresh_Click(null, null);
break;
}
case "入库":
{
var from = new StoreInWindow();
from.Owner = this;
from.ShowDialog();
OnRefresh_Click(null, null);
break;
}
}
}
private void OnRefresh_Click(object sender, RoutedEventArgs e)
{
model.PageIndex = 1;
LoadData();
}
private void OnClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
//Application.Current.Shutdown();
//Process.GetCurrentProcess().Kill();
}
}
public class PageControlModel : INotifyPropertyChanged
{
private bool _bindButton = true;
public bool BindButton
{
get { return _bindButton; }
set
{
_bindButton = value;
OnPropertyChanged("BindButton");
}
}
private int _total = 0;
public int TotalRecord
{
get { return _total; }
set
{
_total = value;
OnPropertyChanged("TotalRecord");
}
}
private int _page = 0;
public int PageIndex
{
get { return _page; }
set
{
_page = value;
OnPropertyChanged("PageIndex");
}
}
private int _pageTotal = 0;
public int PageTotal
{
get { return _pageTotal; }
set
{
_pageTotal = value;
OnPropertyChanged("PageTotal");
}
}
private int _pageSize = 50;
public int PageSize
{
get { return _pageSize; }
set
{
_pageSize = value;
OnPropertyChanged("PageSize");
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string strPropertyInfo)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(strPropertyInfo));
}
}
private readonly OutInWindow _mainWindow;
public RelayCommand OnPageChangeCmd { get; set; }
public PageControlModel(OutInWindow mainWindow)
{
_mainWindow = mainWindow;
PageSize = 10;
OnPageChangeCmd = new RelayCommand(OnPageChange);
}
private void OnPageChange()
{
_mainWindow.LoadData();
}
}
}
<pu:WindowX x:Class="LiteChannel.OutWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pu="clr-namespace:Panuon.UI.Silver;assembly=Panuon.UI.Silver"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LiteChannel"
xmlns:usControl="clr-namespace:LiteChannel.UsControl"
mc:Ignorable="d" Icon="1.ico"
Height="720" Width="1024" Loaded="MainWindowLoaded" ResizeMode="NoResize"
AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterScreen"
WindowState="Maximized" pu:WindowXCaption.DisableCloseButton="True">
<Grid x:Name="g_main">
<Grid.RowDefinitions>
<RowDefinition Height="0.3*"/>
<RowDefinition Height="0.3*"/>
<RowDefinition Height="0.3*"/>
<RowDefinition Height="0.3*"/>
<RowDefinition Height="0.3*"/>
<RowDefinition Height="0.3*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<Button Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Margin="10,10,10,10" Click="OnOutStoreNoOrder_Click" pu:ButtonHelper.Icon="&#xf085;" Content="无单据出库" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="30"></Button>
<Button Grid.Row="2" Grid.Column="1" Margin="10,10,10,10" Click="OnOutStoreJY_Click" pu:ButtonHelper.Icon="&#xf085;" Content="借用" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="30"></Button>
<Button Grid.Row="2" Grid.Column="2" Margin="10,10,10,10" Click="OnOutStoreLY_Click" pu:ButtonHelper.Icon="&#xf085;" Content="领用" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="30"></Button>
<Button Grid.Row="3" Grid.Column="1" Margin="10,10,10,10" Click="OnOutStoreDB_Click" pu:ButtonHelper.Icon="&#xf085;" Content="调拨" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="30"></Button>
<Button Grid.Row="3" Grid.Column="2" Margin="10,10,10,10" Click="OnOutStoreKK_Click" pu:ButtonHelper.Icon="&#xf085;" Content="跨库" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="30"></Button>
<Button Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" Click="OnClose_Click" pu:ButtonHelper.Icon="&#xf2d3;" Margin="10,10,10,10" Content="返回上级" FontFamily="{StaticResource FontAwesome}" pu:ButtonHelper.CornerRadius="5" FontSize="24" Background="#C8FF0000" pu:ButtonHelper.HoverBrush="#FF0000" ></Button>
</Grid>
</pu:WindowX>
using LiteChannel.Commons;
using LiteChannel.Models;
using Panuon.UI.Silver;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using GalaSoft.MvvmLight.CommandWpf;
using System.ComponentModel;
namespace LiteChannel
{
/// <summary>
/// Window1.xaml 的交互逻辑
/// </summary>
public partial class OutWindow : WindowX, IComponentConnector
{
public OutWindow()
{
InitializeComponent();
}
private void MainWindowLoaded(object sender, RoutedEventArgs e)
{
}
private void OnOutStoreNoOrder_Click(object sender, RoutedEventArgs e)
{
var from = new StoreOutWindow("", "NoOrder", null);
from.Owner = this;
from.ShowDialog();
}
private void OnOutStoreJY_Click(object sender, RoutedEventArgs e)
{
var from = new MainWindow2("借用");
from.Owner = this;
from.ShowDialog();
}
private void OnOutStoreLY_Click(object sender, RoutedEventArgs e)
{
var from = new MainWindow2("领用");
from.Owner = this;
from.ShowDialog();
}
private void OnOutStoreDB_Click(object sender, RoutedEventArgs e)
{
var from = new MainWindow2("调拨");
from.Owner = this;
from.ShowDialog();
}
private void OnOutStoreKK_Click(object sender, RoutedEventArgs e)
{
var from = new MainWindow2("跨库");
from.Owner = this;
from.ShowDialog();
}
private void OnClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
}
}
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("LiteChannel")]
[assembly: AssemblyDescription("充电台出入库程序,提供出入库信息上报功能。")]
[assembly: AssemblyConfiguration("充电台出入库程序,提供出入库信息上报功能。")]
[assembly: AssemblyCompany("Junmp")]
[assembly: AssemblyProduct("LiteChannel")]
[assembly: AssemblyCopyright("Copyright © Junmp 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
//若要开始生成可本地化的应用程序,请设置
//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
//例如,如果您在源文件中使用的是美国英语,
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
//对以下 NeutralResourceLanguage 特性的注释。 更新
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
//(未在页面中找到资源时使用,
//或应用程序资源字典中找到时使用)
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
//(未在页面中找到资源时使用,
//、应用程序或任何主题专用资源字典中找到时使用)
)]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.15.03080")]
[assembly: AssemblyFileVersion("1.2.15.03080")]
[assembly: Guid("2a903ab7-96f9-435b-b29a-5acf29b34ce8")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace LiteChannel.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LiteChannel.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _1 {
get {
object obj = ResourceManager.GetObject("_1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _2 {
get {
object obj = ResourceManager.GetObject("_2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _3 {
get {
object obj = ResourceManager.GetObject("_3", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _4 {
get {
object obj = ResourceManager.GetObject("_4", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="_1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="_2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="_3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="_4" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace LiteChannel.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 清单选项
如果想要更改 Windows 用户帐户控制级别,请使用
以下节点之一替换 requestedExecutionLevel 节点。n
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
如果你的应用程序需要此虚拟化来实现向后兼容性,则删除此
元素。
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
Windows 版本的列表。取消评论适当的元素,
Windows 将自动选择最兼容的环境。 -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- 指示该应用程序可以感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
选择加入。选择加入此设置的 Windows 窗体应用程序(目标设定为 .NET Framework 4.6 )还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。-->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>
\ No newline at end of file
<pu:WindowX x:Class="LiteChannel.Setting"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pu="clr-namespace:Panuon.UI.Silver;assembly=Panuon.UI.Silver"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LiteChannel"
mc:Ignorable="d"
Title="系统配置" Height="500" Loaded="OnWindow_Loaded" Width="800" Icon="1.ico" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="10"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="1" Text="软件版本:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Grid.Row="0" Grid.Column="2" Name="txt_ver" Width="auto" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
<TextBlock Grid.Row="0" Grid.Column="3" Text="软件编码:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Grid.Row="0" Grid.Column="4" Name="txt_code" Width="auto" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
<!--<TextBlock Grid.Row="1" Grid.Column="1" Text="接口域名:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="2" x:Name="txt_domain" Width="auto" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
<TextBlock Grid.Row="1" Grid.Column="3" Text="登录接口:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="4" x:Name="txt_login" Width="auto" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>-->
<TextBlock Grid.Row="1" Grid.Column="1" Text="程序标题:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="2" x:Name="txt_title" Width="auto" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="门禁地址:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="2" x:Name="txt_ip" Width="auto" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
<TextBlock Grid.Row="2" Grid.Column="3" Text="门禁端口:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="4" x:Name="txt_port" Width="auto" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
<TextBlock Grid.Row="3" Grid.Column="1" Text="门禁用户:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="2" x:Name="txt_user" Width="auto" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
<TextBlock Grid.Row="3" Grid.Column="3" Text="门禁密码:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="4" x:Name="txt_pwd" Width="auto" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
<TextBlock Grid.Row="4" Grid.Column="1" Text="门禁状态:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<ComboBox Grid.Row="4" Grid.Column="2" x:Name="cbo_state" Width="auto" Height="25"
HorizontalAlignment="Stretch" VerticalAlignment="Center"
pu:ComboBoxHelper.HoverBackground="#1EB5B5B5"
pu:ComboBoxHelper.SelectedBackground="#32B5B5B5"
pu:ComboBoxHelper.IsSearchTextBoxVisible="False">
<ComboBoxItem>启用</ComboBoxItem>
<ComboBoxItem>禁用</ComboBoxItem>
</ComboBox>
<TextBlock Grid.Row="5" Grid.Column="1" Text="启用智能货架:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<ComboBox Grid.Row="5" Grid.Column="2" x:Name="cbo_shelf" Width="auto" Height="25"
HorizontalAlignment="Stretch" VerticalAlignment="Center"
pu:ComboBoxHelper.HoverBackground="#1EB5B5B5"
pu:ComboBoxHelper.SelectedBackground="#32B5B5B5"
pu:ComboBoxHelper.IsSearchTextBoxVisible="False">
<ComboBoxItem>启用</ComboBoxItem>
<ComboBoxItem>禁用</ComboBoxItem>
</ComboBox>
<TextBlock Grid.Row="5" Grid.Column="3" Text="智能货架地址:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Grid.Row="5" Grid.Column="4" x:Name="txt_shelf" Width="auto" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
<TextBlock Grid.Row="6" Grid.Column="1" Text="AppKey:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="2" x:Name="txt_appkey" Width="auto" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
<TextBlock Grid.Row="6" Grid.Column="3" Text="SecretKey:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="4" x:Name="txt_secretkey" Width="auto" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
<TextBlock Grid.Row="7" Grid.Column="1" Text="自动更新:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<CheckBox Grid.Row="7" Grid.Column="2" x:Name="cb_autoUpdate" Width="auto" Height="25" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="8,8,0,8" Click="cb_autoUpdate_Click">启用自动更新,检查时间:</CheckBox>
<ComboBox Grid.Row="7" Grid.Column="2" x:Name="cbb_autoUpdate" Width="auto" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="188,0,0,0"
pu:ComboBoxHelper.HoverBackground="#1EB5B5B5"
pu:ComboBoxHelper.SelectedBackground="#32B5B5B5"
pu:ComboBoxHelper.IsSearchTextBoxVisible="False">
<ComboBoxItem>0:00</ComboBoxItem>
<ComboBoxItem>1:00</ComboBoxItem>
<ComboBoxItem>2:00</ComboBoxItem>
<ComboBoxItem>3:00</ComboBoxItem>
<ComboBoxItem>4:00</ComboBoxItem>
<ComboBoxItem>5:00</ComboBoxItem>
<ComboBoxItem>6:00</ComboBoxItem>
<ComboBoxItem>7:00</ComboBoxItem>
<ComboBoxItem>8:00</ComboBoxItem>
<ComboBoxItem>9:00</ComboBoxItem>
<ComboBoxItem>10:00</ComboBoxItem>
<ComboBoxItem>11:00</ComboBoxItem>
<ComboBoxItem>12:00</ComboBoxItem>
<ComboBoxItem>13:00</ComboBoxItem>
<ComboBoxItem>14:00</ComboBoxItem>
<ComboBoxItem>15:00</ComboBoxItem>
<ComboBoxItem>16:00</ComboBoxItem>
<ComboBoxItem>17:00</ComboBoxItem>
<ComboBoxItem>18:00</ComboBoxItem>
<ComboBoxItem>19:00</ComboBoxItem>
<ComboBoxItem>20:00</ComboBoxItem>
<ComboBoxItem>21:00</ComboBoxItem>
<ComboBoxItem>22:00</ComboBoxItem>
<ComboBoxItem>23:00</ComboBoxItem>
</ComboBox>
<TextBlock Grid.Row="8" Grid.Column="1" Text="读写器类型:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<ComboBox Grid.Row="8" Grid.Column="2" x:Name="cbo_readerType" Width="auto" Height="25"
HorizontalAlignment="Stretch" VerticalAlignment="Center"
pu:ComboBoxHelper.HoverBackground="#1EB5B5B5"
pu:ComboBoxHelper.SelectedBackground="#32B5B5B5"
pu:ComboBoxHelper.IsSearchTextBoxVisible="False" SelectionChanged="cbo_readerType_SelectionChanged">
<ComboBoxItem>钧普</ComboBoxItem>
<ComboBoxItem>索力得</ComboBoxItem>
</ComboBox>
<TextBlock Grid.Row="8" Grid.Column="3" x:Name="tb_com" Text="串口编号:" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<ComboBox Grid.Row="8" Grid.Column="4" x:Name="cbo_com" Width="auto" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
<Button Grid.Row="11" Grid.ColumnSpan="6" Click="OnSave_Click" HorizontalAlignment="Right" Width="90" Margin="0,0,110,0">保存配置</Button>
<!--<Button Grid.Row="14" Grid.ColumnSpan="6" Click="OnRefresh_Click" HorizontalAlignment="Right" Width="90" Margin="0,0,110,0">刷新仓库</Button>-->
<Button Grid.Row="11" Grid.ColumnSpan="6" Click="OnCancel_Click" HorizontalAlignment="Right" Background="#C8FF7F00" pu:ButtonHelper.HoverBrush="#FF7F00" Width="90" Margin="0,0,10,0">关闭</Button>
</Grid>
</pu:WindowX>
using LiteChannel.Commons;
using LiteChannel.Models;
using Panuon.UI.Silver;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace LiteChannel
{
/// <summary>
/// Setting.xaml 的交互逻辑
/// </summary>
public partial class Setting : WindowX, IComponentConnector
{
private bool IsLoaded = false;
private List<store_info> StoreList { get; set; }
public Setting()
{
InitializeComponent();
}
private void OnSave_Click(object sender, RoutedEventArgs e)
{
//int.TryParse(txt_ver.Text, out int ver);
//LiteCaChe.SysConfig.UserLogin = txt_login.Text;
LiteCaChe.SysConfig.AppCode = txt_code.Text;
//LiteCaChe.SysConfig.DomainUrl = txt_domain.Text;
//LiteCaChe.SysConfig.AppTitle = txt_title.Text;
//LiteCaChe.SysConfig.AppVersion = ver;
//LiteCaChe.SysConfig.WarehouseID = cbo_warehouse.SelectedValue?.ToString() ?? "";
LiteCaChe.SysConfig.FaceAddress = txt_ip.Text;
LiteCaChe.SysConfig.FacePort = txt_port.Text;
LiteCaChe.SysConfig.FaceUser = txt_user.Text;
LiteCaChe.SysConfig.FacePwd = txt_pwd.Text;
LiteCaChe.SysConfig.IsUseFace = cbo_state.Text == "启用" ? true : false;
LiteCaChe.SysConfig.AppKey = txt_appkey.Text;
LiteCaChe.SysConfig.SecretKey = txt_secretkey.Text;
LiteCaChe.SysConfig.IsEnabledShelf = cbo_shelf.Text == "启用";
LiteCaChe.SysConfig.ShelfAddress = txt_shelf.Text;
LiteCaChe.SysConfig.IsAutoUpdate = cb_autoUpdate.IsChecked == true;
LiteCaChe.SysConfig.AutoUpdateTime = cbb_autoUpdate.SelectedIndex;
LiteCaChe.SysConfig.ReaderType = cbo_readerType.SelectedIndex;
if (LiteCaChe.SysConfig.ReaderType == 0)
{
LiteCaChe.SysConfig.ComMouth = cbo_com.Text;
}
LiteCaChe.SaveSystemStep(LiteCaChe.SysConfig);
MessageBox.Show("配置保存成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
this.Close();
}
private void OnCancel_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
//private void OnRefresh_Click(object sender, RoutedEventArgs e)
//{
// StoreList = HttpHelper.GetStoreInfos();
// cbo_warehouse.ItemsSource = StoreList;
//}
private void OnWindow_Loaded(object sender, RoutedEventArgs e)
{
cbo_com.ItemsSource = SerialPort.GetPortNames();
//StoreList = HttpHelper.GetStoreInfos();
//cbo_warehouse.ItemsSource = StoreList;
//cbo_warehouse.DisplayMemberPath = "name";
//cbo_warehouse.SelectedValuePath = "id";
//txt_login.Text = LiteCaChe.SysConfig.UserLogin;
txt_code.Text = LiteCaChe.SysConfig.AppCode;
//txt_domain.Text = LiteCaChe.SysConfig.DomainUrl;
txt_title.Text = LiteCaChe.SysConfig.AppTitle;
txt_ver.Text = LiteCaChe.SysConfig.AppVersion.ToString();
//cbo_warehouse.SelectedValue = LiteCaChe.SysConfig.WarehouseID;
txt_ip.Text = LiteCaChe.SysConfig.FaceAddress;
txt_port.Text = LiteCaChe.SysConfig.FacePort;
txt_user.Text = LiteCaChe.SysConfig.FaceUser;
txt_pwd.Text = LiteCaChe.SysConfig.FacePwd;
cbo_state.SelectedIndex = LiteCaChe.SysConfig.IsUseFace ? 0 : 1;
txt_appkey.Text = LiteCaChe.SysConfig.AppKey;
txt_secretkey.Text = LiteCaChe.SysConfig.SecretKey;
cbo_shelf.SelectedIndex = LiteCaChe.SysConfig.IsEnabledShelf ? 0 : 1;
txt_shelf.Text = LiteCaChe.SysConfig.ShelfAddress;
cb_autoUpdate.IsChecked = LiteCaChe.SysConfig.IsAutoUpdate;
if (cb_autoUpdate.IsChecked == true)
{
cbb_autoUpdate.IsEnabled = true;
}
else
{
cbb_autoUpdate.IsEnabled = false;
}
cbb_autoUpdate.SelectedIndex = LiteCaChe.SysConfig.AutoUpdateTime;
IsLoaded = true;
cbo_readerType.SelectedIndex = LiteCaChe.SysConfig.ReaderType;
if (LiteCaChe.SysConfig.ReaderType == 0)
{
tb_com.Visibility = Visibility.Visible;
cbo_com.Visibility = Visibility.Visible;
cbo_com.Text = LiteCaChe.SysConfig.ComMouth;
}
else
{
tb_com.Visibility = Visibility.Hidden;
cbo_com.Visibility = Visibility.Hidden;
}
}
//private void cbo_warehouse_SearchTextChanged(object sender, Panuon.UI.Silver.Core.SearchTextChangedEventArgs e)
//{
// if (!IsLoaded)
// return;
// cbo_warehouse.ItemsSource = StoreList.Where(t => t.name.Contains(e.Text));
//}
private void OnSldCornerRadius_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!IsLoaded)
return;
}
private void cb_autoUpdate_Click(object sender, RoutedEventArgs e)
{
if (cb_autoUpdate.IsChecked == true)
{
cbb_autoUpdate.IsEnabled = true;
}
else
{
cbb_autoUpdate.IsEnabled = false;
}
}
private void cbo_readerType_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (cbo_readerType.SelectedIndex == 0)
{
tb_com.Visibility = Visibility.Visible;
cbo_com.Visibility = Visibility.Visible;
cbo_com.Text = LiteCaChe.SysConfig.ComMouth;
}
else
{
tb_com.Visibility = Visibility.Hidden;
cbo_com.Visibility = Visibility.Hidden;
}
}
}
}
<pu:WindowX x:Class="LiteChannel.StoreInWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:pu="clr-namespace:Panuon.UI.Silver;assembly=Panuon.UI.Silver"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LiteChannel"
mc:Ignorable="d" Icon="1.ico"
Height="720" Width="1024" ResizeMode="NoResize" WindowState="Normal"
Title="盘点入库" FontSize="24" WindowStartupLocation="CenterScreen"
Loaded="OnWindow_Loaded" Closing="OnWindow_Closing">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="0"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions>
<!--<Button pu:ButtonHelper.CornerRadius="4" Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Right" Width="150" Height="35" Margin="0,0,150,0" Click="OnInit_Click" FontSize="24" Background="Red" pu:ButtonHelper.HoverBrush="Red">初始化物资</Button>
<Button pu:ButtonHelper.CornerRadius="4" Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Right" Width="120" Height="35" Margin="0,0,20,0" Click="OnInLog_Click" FontSize="24">入库记录</Button>-->
<DataGrid FontSize="24" ColumnHeaderHeight="60" RowHeight="60" Grid.Row="1" Grid.ColumnSpan="2" x:Name="dg_epc" HorizontalAlignment="Stretch" BorderThickness="0,0,0,1" VerticalAlignment="Stretch" pu:DataGridHelper.SelectedBackground="#44B5B5B5" pu:DataGridHelper.HoverBackground="#22B5B5B5" CanUserAddRows="False" >
<DataGrid.Columns>
<DataGridTextColumn IsReadOnly="True" Header="装备名称" Binding="{Binding equName}" Width="*"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="装备号型" Binding="{Binding equSizeName}" Width="*"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="识别数量" Binding="{Binding scanQty,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" Width="150"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<!--<ComboBox Name="cbo_type" Grid.Row="1" Grid.Column="1" pu:ComboBoxHelper.Watermark="请选择入库类型..." Height="40" Margin="5,0,5,0">
<ComboBoxItem>采购</ComboBoxItem>
<ComboBoxItem>借用</ComboBoxItem>
<ComboBoxItem>跨库借用</ComboBoxItem>
<ComboBoxItem>库存调拨</ComboBoxItem>
<ComboBoxItem>维修</ComboBoxItem>
<ComboBoxItem>跨库归还</ComboBoxItem>
</ComboBox>-->
<TextBlock Grid.Row="3" Grid.ColumnSpan="2" Margin="0,0,220,0" Foreground="Red" Name="txt_stat" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24">状态:读写器启动失败</TextBlock>
<Button pu:ButtonHelper.CornerRadius="4" Grid.Row="3" Grid.ColumnSpan="2" IsEnabled="false" Name="btn_inv" HorizontalAlignment="Right" Click="OnInv_Click" Width="120" Height="35" Margin="0,0,273,0" FontSize="24">开始读取</Button>
<Button pu:ButtonHelper.CornerRadius="4" Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Right" Width="120" Height="35" Margin="0,0,140,0" Click="OnSave_Click" FontSize="24">提交入库</Button>
<Button pu:ButtonHelper.CornerRadius="4" Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Right" Background="#C8FF7F00" Click="OnExit_Click" pu:ButtonHelper.HoverBrush="#FF7F00" Width="120" Height="35" Margin="0,0,10,0" FontSize="24">返回</Button>
</Grid>
</pu:WindowX>
using JmpRfidLp;
using LiteChannel.Commons;
using LiteChannel.Models;
using Panuon.UI.Silver;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
using Panuon.UI.Silver.Core;
namespace LiteChannel
{
/// <summary>
/// StoreWindow.xaml 的交互逻辑
/// </summary>
public partial class StoreInWindow : WindowX, IComponentConnector
{
private IReaderHelper reader;
private List<scan_info> SourcesList = new List<scan_info>();
private List<scan_info> BoxMarkList = new List<scan_info>();
private Queue<string> _epcQueue = new Queue<string>();
private CancellationTokenSource tokenSource = new CancellationTokenSource();
private ObservableCollection<scan_info> RefreshSourcesList = new ObservableCollection<scan_info>();
private Dictionary<ulong, string> dic_equ = new Dictionary<ulong, string>();
private List<order_equ> orderWzdm = new List<order_equ>();
public event Action OnApplySuc;
public StoreInWindow()
{
InitializeComponent();
dg_epc.AutoGenerateColumns = false;
}
private void OnWindow_Loaded(object sender, RoutedEventArgs e)
{
ConnectReader();
EpcHandleTask(tokenSource.Token);
}
private bool ConnectReader()
{
try
{ //启动读写器
switch (LiteCaChe.SysConfig.ReaderType)
{
case 0:
{
reader = new JmpRfidLpReaderHelper(LiteCaChe.SysConfig.ComMouth);
break;
}
case 1:
{
reader = new USBRFIDReaderHelper();
break;
}
}
reader.OnInventory += OnRadioInventory;
var state = reader.Open();
if (state)
{
var version = reader.GetFWVerion();
if (string.IsNullOrEmpty(version))
{
txt_stat.Text = "状态:读写器版本读取失败";
txt_stat.Foreground = new SolidColorBrush(Colors.Red);
return false;
}
reader.InventoryStop();
reader.SetPALevel(1);
reader.SetTxPower(0, true, 24);
txt_stat.Text = "状态:读写器连接成功";
txt_stat.Foreground = new SolidColorBrush(Colors.Green);
btn_inv.IsEnabled = true;
return true;
}
else
{
txt_stat.Text = "状态:读写器连接失败";
txt_stat.Foreground = new SolidColorBrush(Colors.Red);
return false;
}
}
catch (Exception ex)
{
reader = null;
txt_stat.Text = "状态:读写器连接失败";
txt_stat.Foreground = new SolidColorBrush(Colors.Red);
return false;
}
}
private void OnRadioInventory(TagInfoData args)
{
if (!SourcesList.Any(t => t.epcList.Contains(args.EPC)) &&
!BoxMarkList.Any(t => t.epcList.Contains(args.EPC))
)
{
//有效标签
lock (_epcQueue)
{
if (!_epcQueue.Contains(args.EPC))
{
_epcQueue.Enqueue(args.EPC);
}
}
}
}
private void EpcHandleTask(CancellationToken token)
{
Task.Run(() =>
{
var epcList = new List<string>();
while (true)
{
if (token.IsCancellationRequested)
{
break;
}
lock (_epcQueue)
{
if (_epcQueue.Count != 0)
{
epcList = _epcQueue.ToList();
_epcQueue.Clear();
}
else
{
Thread.Sleep(500);
continue;
}
}
foreach (var epc in epcList)
{
//再次检查是否被阻塞阶段添加标签
if (!SourcesList.Any(t => t.epcList.Contains(epc)))
{
var tempEpc = epc;
var inv = LiteCaChe.InventoryInfos.FirstOrDefault(x => x.epc == tempEpc);
if (inv != null)
{
var tmp_info = SourcesList.FirstOrDefault(t => t.equId == inv.equipmentDetailId && t.equSizeId == inv.equipmentSizeId);
if (tmp_info == null)
{
tmp_info = new scan_info()
{
epcList = new List<string>() { tempEpc },
equId = inv.equipmentDetailId,
equName = inv.equipmentDetailName,
equSizeId = inv.equipmentSizeId,
equSizeName = inv.equipmentSizeName,
scanQty = 1
};
SourcesList.Add(tmp_info);
Dispatcher.BeginInvoke(DispatcherPriority.Background,
new Action<List<scan_info>>((x) =>
{
RefreshSourcesList = new ObservableCollection<scan_info>(x);
dg_epc.ItemsSource = RefreshSourcesList;
}), SourcesList);
}
else
{
tmp_info.scanQty += 1;
tmp_info.epcList.Add(tempEpc);
}
}
}
}
epcList.Clear();
}
}, token);
}
private void OnInv_Click(object sender, RoutedEventArgs e)
{
if (btn_inv.Content.ToString() == "开始读取")
{
reader?.InventoryStart();
btn_inv.Content = "停止读取";
}
else
{
reader?.InventoryStop();
btn_inv.Content = "开始读取";
}
}
private void OnExit_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void OnWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
tokenSource.Cancel();
if (reader?.IsOpen() ?? false)
{
reader?.InventoryStop();
reader?.Close();
}
}
private void OnSave_Click(object sender, RoutedEventArgs e)
{
if (SourcesList != null && SourcesList.Count > 0)
{
List<rfid_info> epcList = new List<rfid_info>();
SourcesList.SelectMany(t => t.epcList).ToList()
.ForEach(s => epcList.Add(new rfid_info()
{
RFID = s
}));
if (epcList.Count > 0)
{
//if (string.IsNullOrEmpty(cbo_type.Text))
//{
// MessageBox.Show(this, "入库类型未选择,请选择后重试!", "出库提示", MessageBoxButton.OK, MessageBoxImage.Information);
//}
//else
{
if (btn_inv.Content.ToString() == "停止读取")
{
OnInv_Click(default, default);
}
var _res = HttpHelper.RfidInStore("", epcList);
MessageBox.Show(this, _res.Item2, "出库提示", MessageBoxButton.OK, MessageBoxImage.Information);
if (_res.Item1)
{
OnApplySuc?.Invoke();
this.Close();
}
}
}
}
}
}
}
<pu:WindowX x:Class="LiteChannel.StoreOutWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:pu="clr-namespace:Panuon.UI.Silver;assembly=Panuon.UI.Silver"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LiteChannel"
mc:Ignorable="d" Icon="1.ico"
Height="720" Width="1024" ResizeMode="NoResize" WindowState="Normal"
Title="盘点出库" FontSize="24" WindowStartupLocation="CenterScreen"
Loaded="OnWindow_Loaded" Closing="OnWindow_Closing">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions>
<!--<Button pu:ButtonHelper.CornerRadius="4" Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Right" Width="120" Height="35" Margin="0,0,20,0" Click="OnOutLog_Click" FontSize="24">出库记录</Button>-->
<DataGrid Grid.Row="1" FontSize="24" ColumnHeaderHeight="60" RowHeight="60" x:Name="dg_epc" HorizontalAlignment="Stretch" BorderThickness="0,0,0,1" VerticalAlignment="Stretch" pu:DataGridHelper.SelectedBackground="#44B5B5B5" pu:DataGridHelper.HoverBackground="#22B5B5B5" CanUserAddRows="False" >
<DataGrid.Columns>
<DataGridTextColumn IsReadOnly="True" Header="装备名称" Binding="{Binding equName}" Width="*"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="装备号型" Binding="{Binding equSizeName}" Width="*"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="申领数量" Binding="{Binding equCount}" Width="150" x:Name="equCountGridTextColumn"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="剩余数量" Binding="{Binding equRem}" Width="150" x:Name="equRemGridTextColumn"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="识别数量" Binding="{Binding scanQty,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" Width="150"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<TextBlock Grid.Row="2" Margin="0,0,220,0" Foreground="Red" Name="txt_stat" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24">状态:读写器启动失败</TextBlock>
<Button pu:ButtonHelper.CornerRadius="4" Grid.Row="2" IsEnabled="false" Name="btn_inv" HorizontalAlignment="Right" Click="OnInv_Click" Width="120" Height="35" Margin="0,0,270,0" FontSize="24">开始读取</Button>
<Button pu:ButtonHelper.CornerRadius="4" Grid.Row="2" HorizontalAlignment="Right" Width="120" Height="35" Margin="0,0,140,0" Click="OnSave_Click" FontSize="24">提交出库</Button>
<Button pu:ButtonHelper.CornerRadius="4" Grid.Row="2" HorizontalAlignment="Right" Background="#C8FF7F00" Click="OnExit_Click" pu:ButtonHelper.HoverBrush="#FF7F00" Width="120" Height="35" Margin="0,0,10,0" FontSize="24">返回</Button>
</Grid>
</pu:WindowX>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论