Commit 9c202aa8 by zxw

init

parents
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
build/
bld/
[Bb]in/
[Oo]bj/
# Roslyn cache directories
*.ide/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
#NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding addin-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
## TODO: Comment the next line if you want to checkin your
## web deploy settings but do note that will include unencrypted
## passwords
*.pubxml
# NuGet Packages
packages/*
*.nupkg
## TODO: If the tool you use requires repositories.config
## uncomment the next line
#!packages/repositories.config
# Enable "build/" folder in the NuGet Packages folder since
# NuGet packages use it for MSBuild targets.
# This line needs to be after the ignore of the build folder
# (and the packages folder if the line above has been uncommented)
!packages/build/
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
/.vs
/JmpModel/CodeTemplates
/JunmpPoliceStation/appsettings.json
/JunmpPoliceStation/internal-nlog.txt
/JunmpPoliceStation/JunmpPoliceStation.xml
namespace JmpZbModel
{
public class BaseInfo
{
public string Id { get; set; }
public string ModelType { get; set; }
}
}
namespace JmpZbModel
{
public enum ConnectType
{
USB,
COM,
Net
}
}
namespace JmpZbModel
{
public class DeviceInfo
{
public ConnectType ConnectType { get; set; }
public PrintType PrintType { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpUhfService
{
public class InitalizeCmdInfo
{
public InitializeCmdType CmdType { get; set; }
public string Content { get; set; }
}
}
using JmpUhfService;
namespace JmpZbModel
{
public class InitializeCmdInfo
{
public string Content { get; set; }
public InitializeCmdType CmdType { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpUhfService
{
public enum InitializeCmdType
{
StartInventory,
StopInventory,
InventoryInfo,
ErrorMsg,
Initialize,
Linked,
Busy,
ReadInventorySingle,
InitializeV2,
ReadInventorySingleError
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7E4C3E44-3418-43D0-915B-57F76CF4CAB4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>JmpZbModel</RootNamespace>
<AssemblyName>JmpZbModel</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Programe\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\Programe\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BaseInfo.cs" />
<Compile Include="InitializeCmdType.cs" />
<Compile Include="InitalizeCmdInfo.cs" />
<Compile Include="InitializeCmdInfo.cs" />
<Compile Include="PrintCmdInfo.cs" />
<Compile Include="PrintCmdType.cs" />
<Compile Include="ConnectType.cs" />
<Compile Include="DeviceInfo.cs" />
<Compile Include="PrintMessage.cs" />
<Compile Include="PrintType.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SingleInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
namespace JmpZbModel
{
public class PrintCmdInfo
{
public string Message { get; set; }
public PrintCmdType CmdType { get; set; }
public bool Success { get; set; }
}
}
namespace JmpZbModel
{
public enum PrintCmdType
{
devQuery,
printMsg,
startPrint,
printNotice,
printError,
printUsed
}
}
namespace JmpZbModel
{
public class PrintMessage
{
public MessageType MessageType { get; set; }
public string MessageContent { get; set; }
public string MessageCode { get; set; }
}
public enum MessageType
{
,
通知,
异常
}
}
namespace JmpZbModel
{
public enum PrintType
{
东芝,
斑马
}
}
using System.Reflection;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("JmpZbModel")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("JmpZbModel")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("7e4c3e44-3418-43d0-915b-57f76cf4cab4")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.21")]
[assembly: AssemblyFileVersion("1.0.0.21")]
namespace JmpZbModel
{
public class SingleInfo : BaseInfo
{
public string Info1 { get; set; }
public string Info2 { get; set; }
public string Info3 { get; set; }
public string Info4 { get; set; }
public string Info5 { get; set; }
public string Info6 { get; set; }
public string Info7 { get; set; }
public string Info8 { get; set; }
public string Info9 { get; set; }
}
}

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29911.84
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JmpZbService", "JmpZbPrintService\JmpZbService.csproj", "{4EA469D8-1A2C-4B3C-965F-DBE85C4414BC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JmpZbPrint", "JmpZbPrint\JmpZbPrint.csproj", "{AF8CBDF8-6713-4E88-A2CD-A5ED53AAE26F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JmpZbModel", "JmpZbModel\JmpZbModel.csproj", "{7E4C3E44-3418-43D0-915B-57F76CF4CAB4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JmpUhfService", "RepairService\JmpUhfService.csproj", "{111435B9-7C04-4AE7-A9E0-FF7052D9F196}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4EA469D8-1A2C-4B3C-965F-DBE85C4414BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4EA469D8-1A2C-4B3C-965F-DBE85C4414BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EA469D8-1A2C-4B3C-965F-DBE85C4414BC}.Debug|x64.ActiveCfg = Debug|x64
{4EA469D8-1A2C-4B3C-965F-DBE85C4414BC}.Debug|x64.Build.0 = Debug|x64
{4EA469D8-1A2C-4B3C-965F-DBE85C4414BC}.Debug|x86.ActiveCfg = Debug|Any CPU
{4EA469D8-1A2C-4B3C-965F-DBE85C4414BC}.Debug|x86.Build.0 = Debug|Any CPU
{4EA469D8-1A2C-4B3C-965F-DBE85C4414BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EA469D8-1A2C-4B3C-965F-DBE85C4414BC}.Release|Any CPU.Build.0 = Release|Any CPU
{4EA469D8-1A2C-4B3C-965F-DBE85C4414BC}.Release|x64.ActiveCfg = Release|x64
{4EA469D8-1A2C-4B3C-965F-DBE85C4414BC}.Release|x64.Build.0 = Release|x64
{4EA469D8-1A2C-4B3C-965F-DBE85C4414BC}.Release|x86.ActiveCfg = Release|x86
{4EA469D8-1A2C-4B3C-965F-DBE85C4414BC}.Release|x86.Build.0 = Release|x86
{AF8CBDF8-6713-4E88-A2CD-A5ED53AAE26F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF8CBDF8-6713-4E88-A2CD-A5ED53AAE26F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF8CBDF8-6713-4E88-A2CD-A5ED53AAE26F}.Debug|x64.ActiveCfg = Debug|Any CPU
{AF8CBDF8-6713-4E88-A2CD-A5ED53AAE26F}.Debug|x64.Build.0 = Debug|Any CPU
{AF8CBDF8-6713-4E88-A2CD-A5ED53AAE26F}.Debug|x86.ActiveCfg = Debug|Any CPU
{AF8CBDF8-6713-4E88-A2CD-A5ED53AAE26F}.Debug|x86.Build.0 = Debug|Any CPU
{AF8CBDF8-6713-4E88-A2CD-A5ED53AAE26F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF8CBDF8-6713-4E88-A2CD-A5ED53AAE26F}.Release|Any CPU.Build.0 = Release|Any CPU
{AF8CBDF8-6713-4E88-A2CD-A5ED53AAE26F}.Release|x64.ActiveCfg = Release|Any CPU
{AF8CBDF8-6713-4E88-A2CD-A5ED53AAE26F}.Release|x64.Build.0 = Release|Any CPU
{AF8CBDF8-6713-4E88-A2CD-A5ED53AAE26F}.Release|x86.ActiveCfg = Release|Any CPU
{AF8CBDF8-6713-4E88-A2CD-A5ED53AAE26F}.Release|x86.Build.0 = Release|Any CPU
{7E4C3E44-3418-43D0-915B-57F76CF4CAB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E4C3E44-3418-43D0-915B-57F76CF4CAB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E4C3E44-3418-43D0-915B-57F76CF4CAB4}.Debug|x64.ActiveCfg = Debug|Any CPU
{7E4C3E44-3418-43D0-915B-57F76CF4CAB4}.Debug|x64.Build.0 = Debug|Any CPU
{7E4C3E44-3418-43D0-915B-57F76CF4CAB4}.Debug|x86.ActiveCfg = Debug|Any CPU
{7E4C3E44-3418-43D0-915B-57F76CF4CAB4}.Debug|x86.Build.0 = Debug|Any CPU
{7E4C3E44-3418-43D0-915B-57F76CF4CAB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E4C3E44-3418-43D0-915B-57F76CF4CAB4}.Release|Any CPU.Build.0 = Release|Any CPU
{7E4C3E44-3418-43D0-915B-57F76CF4CAB4}.Release|x64.ActiveCfg = Release|Any CPU
{7E4C3E44-3418-43D0-915B-57F76CF4CAB4}.Release|x64.Build.0 = Release|Any CPU
{7E4C3E44-3418-43D0-915B-57F76CF4CAB4}.Release|x86.ActiveCfg = Release|Any CPU
{7E4C3E44-3418-43D0-915B-57F76CF4CAB4}.Release|x86.Build.0 = Release|Any CPU
{111435B9-7C04-4AE7-A9E0-FF7052D9F196}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{111435B9-7C04-4AE7-A9E0-FF7052D9F196}.Debug|Any CPU.Build.0 = Debug|Any CPU
{111435B9-7C04-4AE7-A9E0-FF7052D9F196}.Debug|x64.ActiveCfg = Debug|Any CPU
{111435B9-7C04-4AE7-A9E0-FF7052D9F196}.Debug|x64.Build.0 = Debug|Any CPU
{111435B9-7C04-4AE7-A9E0-FF7052D9F196}.Debug|x86.ActiveCfg = Debug|Any CPU
{111435B9-7C04-4AE7-A9E0-FF7052D9F196}.Debug|x86.Build.0 = Debug|Any CPU
{111435B9-7C04-4AE7-A9E0-FF7052D9F196}.Release|Any CPU.ActiveCfg = Release|Any CPU
{111435B9-7C04-4AE7-A9E0-FF7052D9F196}.Release|Any CPU.Build.0 = Release|Any CPU
{111435B9-7C04-4AE7-A9E0-FF7052D9F196}.Release|x64.ActiveCfg = Release|Any CPU
{111435B9-7C04-4AE7-A9E0-FF7052D9F196}.Release|x64.Build.0 = Release|Any CPU
{111435B9-7C04-4AE7-A9E0-FF7052D9F196}.Release|x86.ActiveCfg = Release|Any CPU
{111435B9-7C04-4AE7-A9E0-FF7052D9F196}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {053BA28A-1110-4232-B195-3B6EBBE2A3CC}
VisualSVNWorkingCopyRoot = .
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Windows.Interactivity" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
</dependentAssembly>
<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>
<Application x:Class="JmpZbPrint.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:JmpZbPrint.View" StartupUri="pack://application:,,,/View/LoginWindow.xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
d1p1:Ignorable="d" xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
Startup="Application_Startup" DispatcherUnhandledException="Application_DispatcherUnhandledException">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/>
<ResourceDictionary Source="pack://application:,,,/Panuon.UI.Silver;component/Control.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.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>
\ No newline at end of file
using System;
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using JmpZbPrint.Common;
using JmpZbPrint.View;
namespace JmpZbPrint
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
private void Application_Startup(object sender, StartupEventArgs e)
{
// 获取当前活动进程的模块名称
string moduleName = Process.GetCurrentProcess().MainModule.ModuleName;
//返回指定路径字符串的文件名
string processName = System.IO.Path.GetFileNameWithoutExtension(moduleName);
//根据文件名创建进程资源数组
Process[] processes = Process.GetProcessesByName(processName);
//如果该数组长度大于1,说明多次运行
if (processes.Length > 1)
{
MessageBox.Show("已有另一个程序在运行!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);//弹出提示信息
Process.GetCurrentProcess().Kill();
}
else
{
CaChe.SysConfig = CaChe.LoadSystemStep();
if (CaChe.SysConfig == null)
{
//MessageBox.Show("配置文件加载失败,请检查", "文件错误", MessageBoxButton.OK, MessageBoxImage.Error);
//Process.GetCurrentProcess().Kill();
MessageBox.Show("配置文件加载失败,创建默认配置文件");
CaChe.SysConfig = new Config();
CaChe.SaveSystemStep(CaChe.SysConfig);
}
else
{
var _update = HttpHelper.GetUpdate(CaChe.SysConfig?.AppCode ?? "");
if (_update == null)
{
return;
}
else
{
if (Version.TryParse(_update.version2, out var version) && version > new Version(CaChe.SysConfig.AppVersion))
{
if (MessageBox.Show("检测到新版本,是否更新?", "更新提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
{
System.Diagnostics.Process.Start("explorer.exe", CaChe.SysConfig.DomainUrl.TrimEnd('/') + "/" + _update.address.TrimStart('/'));
Process.GetCurrentProcess().Kill();
}
else { }
}
}
//获取供应商
//CaChe.Suppliers = HttpHelper.GetAllSupplier();
}
}
}
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
Log.ErrorLog(e.Exception.ToString(), MethodBase.GetCurrentMethod().Name);
}
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace JmpZbPrint.Common
{
public class BoolConvert : IValueConverter
{
//当值从绑定源传播给绑定目标时,调用方法Convert
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return DependencyProperty.UnsetValue;
bool.TryParse(value.ToString(), out bool result);
return result ? "√" : "";
}
//当值从绑定目标传播给绑定源时,调用此方法ConvertBack
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return DependencyProperty.UnsetValue;
}
return value.ToString() == "√";
}
}
}
using JmpZbPrint.Common;
using JmpZbPrint.Model;
using Newtonsoft.Json;
using System;
using System.IO;
using System.Reflection;
using System.Text;
namespace JmpZbPrint
{
public static class CaChe
{
//public static List<WarehouseInfo> WarehouseInfo { get; set; }
public static respone_user UserInfo { get; set; }
//public static List<Supplier> Suppliers { get; set; }
//public static List<EquInfo> EquInfos { get; set; }
public static Config SysConfig { get; set; }
//public static UserInfo UserInfo { get; set; }
//public static List<EquipmentInfo> WzList { get; set; }
public static Config LoadSystemStep()
{
var v_path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "config.json";
if (!File.Exists(v_path))
{
return null;
}
else
{
var v_json = File.ReadAllText(v_path, Encoding.UTF8);
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.SetupInformation.ApplicationBase + "config.json", JmpDes.Encrypt(json), Encoding.UTF8);
return true;
}
}
}
catch (Exception ex)
{
Log.ErrorLog(ex.ToString(), MethodBase.GetCurrentMethod().Name);
return false;
}
}
}
}
using GalaSoft.MvvmLight;
using Newtonsoft.Json;
using System.Windows;
namespace JmpZbPrint.Common
{
public class Config : ViewModelBase
{
public Config()
{
AppTitle = "警用装备RFID初始化 v" + Application.ResourceAssembly.GetName().Version;
AppVersion = Application.ResourceAssembly.GetName().Version.ToString();
AppCode = "10002";
DomainUrl = "http://41.190.20.132:18761/api/service";
UserLogin = "http://41.190.20.132:10004/auth/userLogin";
CardOnly = false;
ApiVersion = "1.0";
AppKey = "jg/eM+bvVcTtil9yQJ1u5g==";
SecretKey = "0827414cbc1003ab865b975b6fae3c12";
IsDirectEntryStock = false;
IsAutoUpdate = true;
AutoUpdateTime = 0;
PrintType = 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; }
public string AppCode { get; set; }
public bool CardOnly { get; set; }
public string AppKey { get; set; }
public string SecretKey { get; set; }
public string ApiVersion { get; set; }
/// <summary>
/// 初始化的标签直接自动入库
/// </summary>
public bool IsDirectEntryStock { get; set; }
/// <summary>
/// 是否自动更新
/// </summary>
public bool IsAutoUpdate { get; set; }
/// <summary>
/// 自动更新时间(小时)
/// </summary>
public int AutoUpdateTime { get; set; }
/// <summary>
/// 打印机类型
/// 0 东芝
/// 1 博思得
/// </summary>
public int PrintType { get; set; }
}
public static class UrlConfig
{
public const string GetPrintList = "/api/Print/GetPrintList";
public const string SoftUpdate = "/api/SoftUpdate/GetLastUpdate";
public const string GetAllSupplier = "/api/Print/GetAllSupplier";
public const string GenExtTagEpc = "/api/Print/GenerateExtTagEpc";
public const string CheckEpcIsInstantiation = "/api/Print/CheckEpcIsInstantiation";
public const string GenInventory = "/api/Print/GenerateInventoryWithProgram";
public const string GenRangeInventory = "/api/Print/GenerateRangeInventory";
public const string BoxingInventory = "/api/Print/BoxingInventory";
public const string BoxingInventoryNormalVersion = "/api/Print/BoxingInventoryNormalVersion";
public const string UnpackRangeInventory = "/api/Print/UnpackRangeInventory";
public const string GetInventoryListByBoxMarkEpc = "/api/EquipmentBoxMark/GetInventoryListByBoxMarkEpc";
public const string GetBoxMarkList = "/api/EquipmentBoxMark/GetBoxMarkList";
public const string GetNeedPrintBoxMarkList = "/api/EquipmentBoxMark/GetNeedPrintBoxMarkList";
public const string ImportOldBoxMark = "/api/Print/ImportOldBoxMark";
public const string GenIntTagEpc = "/api/Print/GenerateIntTagEpc";
public const string UpdateEpc = "/api/Print/UpdateEpcState";
public const string OrderList = "/api/Print/GetPrintOrder";
public const string GetEquInfo = "/api/Print/GetEquInfoById";
public const string GetAllEqu = "/api/Print/GetAllEqu";
public const string DelEpc = "/api/Print/DeleteInventory";
public const string DelEpcList = "/api/Print/DeleteInventoryByEpcList";
public const string GetWarehouse = "/api/Warehouse/GetListWarehouse";
public const string GetListShelf = "/api/Shelf/GetListShelf";
public const string GetListEquipmentShelfPosition = "/api/Shelf/GetListEquipmentShelfPosition";
public const string GetPrintBagList = "/api/Print/GetPrintBagList";
public const string UpdateBagState = "/api/Print/UpdateBagState";
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace JmpZbPrint.Common
{
[ValueConversion(typeof(DateTime), typeof(string))]
public class DateConverter : IValueConverter
{
//源属性传给目标属性时,调用此方法ConvertBack
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return DateTime.Now.Date;
return value;
}
//目标属性传给源属性时,调用此方法ConvertBack
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return DateTime.Now.Date;
}
else
{
DateTime.TryParse(value.ToString(), out DateTime date);
return date == default ? DateTime.Now.Date : date.Date;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace JmpZbPrint.Common
{
[ValueConversion(typeof(DateTime), typeof(string))]
public class DateTimeConverter : IValueConverter
{
//源属性传给目标属性时,调用此方法ConvertBack
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
DateTime obj;
if (value == null)
{
obj = DateTime.Now;
}
else
{
obj = (DateTime)value;
}
if (parameter == null || string.IsNullOrEmpty(parameter.ToString()))
{
return obj.ToLocalTime();
}
else
{
return obj.ToString(parameter.ToString());
}
}
//目标属性传给源属性时,调用此方法ConvertBack
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null||string.IsNullOrEmpty(value.ToString()))
{
return DateTime.Now;
}
else
{
DateTime.TryParse(value.ToString(), out DateTime date);
return date == default ? DateTime.Now: date;
}
}
}
}
using JmpZbModel.Model;
using LiteDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Common
{
public class DbFactory
{
public static bool Insert(tb_general_task entity)
{
// Open database (or create if doesn't exist)
using (var db = new LiteDatabase(@"config.db"))
{
// Get a collection (or create, if doesn't exist)
var col = db.GetCollection<tb_general_task>("tb_general_task");
// Insert new customer document (Id will be auto-incremented)
var result = col.Insert(entity);
if (result.AsInt32 > 0) { return true; }
else { return false; }
}
}
public static bool Update(tb_general_task entity)
{
// Open database (or create if doesn't exist)
using (var db = new LiteDatabase(@"config.db"))
{
// Get a collection (or create, if doesn't exist)
var col = db.GetCollection<tb_general_task>("tb_general_task");
// Insert new customer document (Id will be auto-incremented)
var result = col.Update(entity);
if (result) { return true; }
else { return false; }
}
}
public static bool Delete(int id)
{
// Open database (or create if doesn't exist)
using (var db = new LiteDatabase(@"config.db"))
{
// Get a collection (or create, if doesn't exist)
var col = db.GetCollection<tb_general_task>("tb_general_task");
// Insert new customer document (Id will be auto-incremented)
var result = col.Delete(id);
if (result) { return true; }
else { return false; }
}
}
public static List<tb_general_task> GetAllTask(Expression<Func<tb_general_task,bool>> expression)
{
// Open database (or create if doesn't exist)
using (var db = new LiteDatabase(@"config.db"))
{
// Get a collection (or create, if doesn't exist)
var col = db.GetCollection<tb_general_task>("tb_general_task");
// Insert new customer document (Id will be auto-incremented)
return col.Query().Where(expression).ToList();
}
}
public static tb_general_task GetAllTask(int id)
{
// Open database (or create if doesn't exist)
using (var db = new LiteDatabase(@"config.db"))
{
// Get a collection (or create, if doesn't exist)
var col = db.GetCollection<tb_general_task>("tb_general_task");
// Insert new customer document (Id will be auto-incremented)
return col.FindById(id);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace JmpZbPrint.Common
{
[ValueConversion(typeof(decimal), typeof(string))]
public class FloatConverter : IValueConverter
{
//源属性传给目标属性时,调用此方法ConvertBack
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (decimal.TryParse((value ?? "").ToString(), out decimal val))
{
return val;
}
else
{
return 0.0;
}
}
//目标属性传给源属性时,调用此方法ConvertBack
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
string strValue = value as string;
if (string.IsNullOrEmpty(strValue))
{
return 0;
}
else
{
if (strValue.IndexOf(".") == (strValue.Length - 1) && strValue.ToArray().Where(t => t == '.').Count() <= 1)
{
return Binding.DoNothing;
}
else
{
System.Text.RegularExpressions.Regex g = new System.Text.RegularExpressions.Regex(@"^[0-9].\d*$");
if (g.IsMatch(strValue))
{
decimal.TryParse(strValue, out decimal res);
return res;
}
else
{
var tmp = System.Text.RegularExpressions.Regex.Replace(strValue, @"[^\d.]*", "");
decimal.TryParse(tmp, out decimal res);
return res;
}
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace JmpZbPrint.Common
{
public class IsSuccessConvert : IValueConverter
{
//当值从绑定源传播给绑定目标时,调用方法Convert
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return DependencyProperty.UnsetValue;
bool.TryParse(value.ToString(), out bool isSuccess);
if (isSuccess)
{
return "成功";
}
else
{
return "失败";
}
}
//当值从绑定目标传播给绑定源时,调用此方法ConvertBack
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
string str = value as string;
if (str== "成功")
{
return true;
}
return DependencyProperty.UnsetValue;
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Common
{
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.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace JmpZbPrint.Common
{
public class LabelTypeConvert : IValueConverter
{
//当值从绑定源传播给绑定目标时,调用方法Convert
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return DependencyProperty.UnsetValue;
bool.TryParse(value.ToString(), out bool type);
if (type == true)
{
return "箱标";
}
else
{
return "件标";
}
}
//当值从绑定目标传播给绑定源时,调用此方法ConvertBack
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
string str = value as string;
if (str== "箱标")
{
return true;
}
else
{
return false;
}
return DependencyProperty.UnsetValue;
}
}
}
using JmpZbPrint.Model;
using JmpZbPrint.Model.DbModel;
using LiteDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Common
{
public class LiteDbHelper
{
public static bool AddRange(List<recode_info> recodes)
{
try
{
var path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
using (var db = new LiteDatabase($"{path}print.db"))
{
var col = db.GetCollection<recode_info>("recode_info");
var res = col.InsertBulk(recodes);
return res > 0;
}
}
catch (Exception ex)
{
Log.ErrorLog(ex.ToString());
return default;
}
}
public static bool Update(recode_info recode)
{
try
{
var path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
using (var db = new LiteDatabase($"{path}print.db"))
{
var col = db.GetCollection<recode_info>("recode_info");
var res = col.Update(recode);
return res;
}
}
catch (Exception ex)
{
Log.ErrorLog(ex.ToString());
return default;
}
}
public static bool Update(string epc, bool isdelete = true)
{
try
{
var path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
using (var db = new LiteDatabase($"{path}print.db"))
{
var col = db.GetCollection<recode_info>("recode_info");
var recode = col.FindOne(t => t.epc == epc);
if (recode == null) { return false; }
else
{
recode.isdelete = isdelete;
return col.Update(recode);
}
}
}
catch (Exception ex)
{
Log.ErrorLog(ex.ToString());
return default;
}
}
public static bool Update(int id, bool isdelete = true)
{
try
{
var path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
using (var db = new LiteDatabase($"{path}print.db"))
{
var col = db.GetCollection<recode_info>("recode_info");
var recode = col.FindOne(t => t.id == id);
if (recode == null) { return false; }
else
{
recode.PrintTime = DateTime.Now;
recode.isdelete = isdelete;
return col.Update(recode);
}
}
}
catch (Exception ex)
{
Log.ErrorLog(ex.ToString());
return default;
}
}
public static void Delete(int id)
{
try
{
var path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
using (var db = new LiteDatabase($"{path}print.db"))
{
var col = db.GetCollection<recode_info>("recode_info");
var recode = col.FindOne(t => t.id == id);
if (recode == null) { return; }
else
{
col.Delete(recode.id);
}
}
}
catch (Exception ex)
{
Log.ErrorLog(ex.ToString());
return;
}
}
public static void DeleteByEpc(string epc)
{
try
{
var path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
using (var db = new LiteDatabase($"{path}print.db"))
{
var col = db.GetCollection<recode_info>("recode_info");
var recode = col.FindOne(t => t.epc == epc);
if (recode == null) { return; }
else
{
col.Delete(recode.id);
}
}
}
catch (Exception ex)
{
Log.ErrorLog(ex.ToString());
return;
}
}
public static recode_info GetSingle(int id)
{
try
{
var path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
using (var db = new LiteDatabase($"{path}print.db"))
{
var col = db.GetCollection<recode_info>("recode_info");
var res = col.FindOne(t => t.id == id);
return res;
}
}
catch (Exception ex)
{
Log.ErrorLog(ex.ToString());
return default;
}
}
public static recode_info GetSingleByEpc(string epc)
{
try
{
var path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
using (var db = new LiteDatabase($"{path}print.db"))
{
var col = db.GetCollection<recode_info>("recode_info");
var res = col.FindOne(t => t.epc == epc);
return res;
}
}
catch (Exception ex)
{
Log.ErrorLog(ex.ToString());
return default;
}
}
public static db_page GetPage(int page, int size, Expression<Func<recode_info, bool>> @where)
{
try
{
page -= 1;
var path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
using (var db = new LiteDatabase($"{path}print.db"))
{
var col = db.GetCollection<recode_info>("recode_info");
var count = col.Find(@where).Count();
var data = new db_page
{
total = count,
record = col.Find(@where).ToList().OrderBy(t => t.epc)
.Skip(page * size).Take(size).ToList()
};
return data;
}
}
catch (Exception ex)
{
Log.ErrorLog(ex.ToString());
return default;
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Common
{
public static class NotifyPropertyChangedExtension
{
public static void MutateVerbose<TField>(this INotifyPropertyChanged instance, ref TField field, TField newValue, Action<PropertyChangedEventArgs> raise, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<TField>.Default.Equals(field, newValue)) return;
field = newValue;
raise?.Invoke(new PropertyChangedEventArgs(propertyName));
}
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace JmpZbPrint.Common
{
[ValueConversion(typeof(int), typeof(string))]
public class NumericalConverter : IValueConverter
{
//源属性传给目标属性时,调用此方法ConvertBack
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return 0;
return value;
}
//目标属性传给源属性时,调用此方法ConvertBack
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return 0;
}
else
{
int.TryParse(value.ToString(), out int index);
return index;
}
}
}
}
using System;
using System.Drawing;
using System.Drawing.Text;
using System.Windows.Media.Imaging;
namespace JmpZbPrint.Common
{
public class PreviewImageHelper
{
public static BitmapImage GetEnterpriceBoxPreview(string strBoxNo, string strProductNo
, string strSupplier, string strBoxSn, string strProductName, string strWzhx
, string strBoxNum)
{
//企业箱标
Bitmap bitmap = new Bitmap(640, 245);
Graphics G = Graphics.FromImage(bitmap);
G.FillRectangle(Brushes.White, new Rectangle(0, 0, 640, 245));
G.TextRenderingHint = TextRenderingHint.AntiAlias;
FontFamily fontFamily = new FontFamily("黑体");
Font font = new Font(fontFamily, 20f, FontStyle.Regular, GraphicsUnit.Pixel);
G.DrawString("装箱清单", font, Brushes.Black, 280, 20);
G.DrawString($"装箱序列号:{strBoxNo}", font, Brushes.Black, 40, 50);
G.DrawString($"产品代码:{strProductNo}", font, Brushes.Black, 40, 90);
G.DrawString($"供应商:{strSupplier}", font, Brushes.Black, 40, 130);
G.DrawString($"装箱码:{strBoxSn}", font, Brushes.Black, 40, 170);
G.DrawString($"产品名称:{strProductName}", font, Brushes.Black, 40, 210);
G.DrawString($"装箱号型:{strWzhx}", font, Brushes.Black, 400, 50);
G.DrawString($"装箱数量:{strBoxNum}", font, Brushes.Black, 400, 90);
return Bitmap2BitmapImage(bitmap);
}
public static BitmapImage GetPiecePreview(string strBoxNo, string strWzhx, string strSupplier, string strProductName)
{
//企业箱标
Bitmap bitmap = new Bitmap(640, 245);
Graphics G = Graphics.FromImage(bitmap);
G.FillRectangle(Brushes.White, new Rectangle(0, 0, 640, 245));
G.TextRenderingHint = TextRenderingHint.AntiAlias;
FontFamily fontFamily = new FontFamily("黑体");
Font font = new Font(fontFamily, 20f, FontStyle.Regular, GraphicsUnit.Pixel);
G.DrawString($"供应商:{strSupplier}", font, Brushes.Black, 60, 50);
G.DrawString($"品名:{strProductName}", font, Brushes.Black, 60, 90);
G.DrawString($"号型:{strWzhx}", font, Brushes.Black, 60, 130);
G.DrawString($"件序列号:{strBoxNo}", font, Brushes.Black, 60, 170);
return Bitmap2BitmapImage(bitmap);
}
public static BitmapImage GetPerBoxPreview(string strSupplier, string strName, string strPoliceNo, string strBoxNum)
{
Bitmap bitmap = new Bitmap(640, 245);
Bitmap qr = (Bitmap)Bitmap.FromFile(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "qrcode.png");
Graphics G = Graphics.FromImage(bitmap);
G.FillRectangle(Brushes.White, new Rectangle(0, 0, 640, 245));
G.TextRenderingHint = TextRenderingHint.AntiAlias;
FontFamily fontFamily = new FontFamily("黑体");
Font font = new Font(fontFamily, 20f, FontStyle.Regular, GraphicsUnit.Pixel);
G.DrawString($"单位名称:{strSupplier}", font, Brushes.Black, 60, 50);
G.DrawString($"姓名:{strName}", font, Brushes.Black, 60, 90);
G.DrawString($"警号:{strPoliceNo}", font, Brushes.Black, 60, 130);
G.DrawString($"数量:{strBoxNum}", font, Brushes.Black, 60, 170);
G.DrawImage(qr, 460, 70, 150, 150);
return Bitmap2BitmapImage(bitmap);
}
private static BitmapImage Bitmap2BitmapImage(System.Drawing.Bitmap bitmap)
{
//BitmapImage bitmapImage = new BitmapImage();
//using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
//{
// bitmap.Save(ms, bitmap.RawFormat);
// bitmapImage.BeginInit();
// bitmapImage.StreamSource = ms;
// bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
// bitmapImage.EndInit();
// bitmapImage.Freeze();
//}
//return bitmapImage;
System.Drawing.Bitmap ImageOriginalBase = new Bitmap(bitmap);
BitmapImage bitmapImage = new BitmapImage();
using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
{
//ImageOriginalBase.Save(ms, ImageOriginalBase.RawFormat);
ImageOriginalBase.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
bitmapImage.BeginInit();
bitmapImage.StreamSource = ms;
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
bitmapImage.EndInit();
bitmapImage.Freeze();
}
return bitmapImage;
}
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace JmpZbPrint.Common
{
public class PrintTypeConvert : IValueConverter
{
//当值从绑定源传播给绑定目标时,调用方法Convert
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return DependencyProperty.UnsetValue;
int.TryParse(value.ToString(), out int type);
if (type == 0)
{
return "打印";
}
else
{
return "初始化";
}
}
//当值从绑定目标传播给绑定源时,调用此方法ConvertBack
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
string str = value as string;
if (int.TryParse(str, out int type))
{
return type;
}
return DependencyProperty.UnsetValue;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace JmpZbPrint.Common
{
public class ProductTag
{
public ProductTag()
{
}
public string epc = string.Empty;
//public TAB_BZGL_WZDM wzdm = null;
public string wzmc = string.Empty;
public string wzhx = string.Empty;
public Int64 num = 0;
public string wzdm = string.Empty;
public string ulsm = string.Empty;
public int wzxh = 0;
public double wzsl = 0;
public DateTime createdate;
public string boxtype = string.Empty;
}
}
using JmpZbModel;
using JmpZbPrint.Model;
using JmpZbPrint.UsControl;
using JmpZbPrint.ViewModel;
using MaterialDesignThemes.Wpf;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
using JmpZbPrint.View;
namespace JmpZbPrint.Dialog
{
/// <summary>
/// PrintLogWindow.xaml 的交互逻辑
/// </summary>
public partial class PrintLogWindow : Window
{
public PrintLog PrintInfo { get; set; }
private MainWindow _window;
public PrintLogWindow(MainWindow window)
{
InitializeComponent();
_window = window;
var vm2 = new PrintLogWindowViewModel();
this.DataContext = vm2;
}
private void Sb_Completed(object sender, EventArgs e)
{
this.Close();
}
private void OnSelectItemClick(object sender, RoutedEventArgs e)
{
var tsk_item = g_vender.SelectedValue as PrintLog;
var res = _window.printServerHelper.SendPrintCmd(new SingleInfo()
{
Info1 = tsk_item.productName,
Info2 = tsk_item.sizeName,
Info3 = tsk_item.supplierName,
Info4 = tsk_item.pieceNo ?? "1",
Info5 = tsk_item.productTime,
Info9 = tsk_item.epc.Replace(" ", ""),
ModelType = "piece"
});
if (res)
{
MessageBox.Show("打印成功");
}
else
{
MessageBox.Show("打印失败");
}
}
}
}
<Window x:Class="JmpZbPrint.Dialog.SelectEqu"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:local="clr-namespace:JmpZbPrint.Dialog"
mc:Ignorable="d"
Height="350" Width="600" AllowsTransparency="True" WindowStyle="None"
ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBox.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.DataGrid.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" />
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="PrimaryHueLightBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="PrimaryHueMidBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="#FFFFFF"/>
<!-- accent -->
<SolidColorBrush x:Key="SecondaryAccentBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="SecondaryAccentForegroundBrush" Color="#FFFFFF"/>
<Storyboard x:Key="Loading">
<ThicknessAnimation Duration="0:0:0.2" To="0" From="0,300,0,300"
Storyboard.TargetName="g_main" Storyboard.TargetProperty="Margin" />
</Storyboard>
<Storyboard x:Key="Closing">
<ThicknessAnimation FillBehavior="Stop" Duration="0:0:0.2" To="0,300,0,300" From="0" Storyboard.TargetName="g_main"
Storyboard.TargetProperty="Margin" Completed="Sb_Completed"/>
</Storyboard>
</ResourceDictionary>
</Window.Resources>
<Window.Effect>
<DropShadowEffect BlurRadius="20" Color="#FF858484" Direction="90" ShadowDepth="2"/>
</Window.Effect>
<Window.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded" >
<BeginStoryboard Storyboard="{StaticResource Loading}"/>
</EventTrigger>
<EventTrigger RoutedEvent="UIElement.MouseLeftButtonDown" SourceName="tbclose">
<BeginStoryboard Storyboard="{StaticResource Closing}" />
</EventTrigger>
</Window.Triggers>
<Border BorderBrush="#FF858484" x:Name="g_main" CornerRadius="3" BorderThickness="2" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80"/>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="txtTitle" Text="选择装备信息" FontSize="30" Foreground="#0092ea" VerticalAlignment="Top" Margin="20 20 0 0"/>
<TextBlock Text="&#xE618;" Style="{StaticResource FiconBase}" x:Name="tbclose"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0 20 20 0" FontSize="35" Foreground="#8a8a8a" />
<Grid Grid.Row="1" Margin="0,0,0,0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<TextBlock Text="装备名称:" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox x:Name="txt_vendor" Focusable="True" Text="{Binding VendorName,UpdateSourceTrigger=PropertyChanged}" MinWidth="400" VerticalAlignment="Center" Width="250" FontSize="15" Background="White" />
</StackPanel>
<StackPanel Grid.Column="3" Orientation="Horizontal">
<Button FontSize="15" Content="查询" Click="OnQueryClick" VerticalAlignment="Center" Style="{StaticResource MaterialDesignRaisedButton}" Margin="0,0,0,0" Width="70" HorizontalAlignment="Left" />
</StackPanel>
</Grid>
<DataGrid EnableRowVirtualization="False" x:Name="g_equ" Margin="3 5 3 20" Grid.Row="2" BorderBrush="#dedede" FontSize="20" Foreground="#37537d" HeadersVisibility="Column"
GridLinesVisibility="None" Background="Transparent" BorderThickness="1" CanUserAddRows="False"
AutoGenerateColumns="False" SelectionMode="Single" HorizontalScrollBarVisibility="Hidden" RowBackground="Transparent" CanUserSortColumns="True" >
<DataGrid.ColumnHeaderStyle>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#4682B4"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="Height" Value="25"/>
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="45" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#EBEBEB"/>
<Setter Property="Opacity" Value="0.4"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="装备名称" IsReadOnly="True" Width="480" FontSize="13" Binding="{Binding name}" ElementStyle="{StaticResource TextLeftStyle}"/>
<DataGridTemplateColumn Header="操作" Width="100" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="选择" Click="OnSelectItemClick" Height="30" Margin="5,0,5,0" >
</Button>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
</Window>
using JmpZbPrint.Model;
using System;
using System.Collections.Generic;
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.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace JmpZbPrint.Dialog
{
/// <summary>
/// SupplierWin.xaml 的交互逻辑
/// </summary>
public partial class SelectEqu : Window
{
public List<EquInfo> EquList { get; set; } = new List<EquInfo>();
public SelectEqu()
{
InitializeComponent();
EquList = HttpHelper.GetAllEqu();
g_equ.ItemsSource = EquList?.Take(30);
txt_vendor.Focus();
}
public EquInfo EquInfo { get; set; }
private void Sb_Completed(object sender, EventArgs e)
{
this.Close();
}
private void OnQueryClick(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(txt_vendor.Text))
{
g_equ.ItemsSource = EquList;
}
else
{
g_equ.ItemsSource = EquList?.Where(t => t.name.Contains(txt_vendor.Text));
}
}
private void OnSelectItemClick(object sender, RoutedEventArgs e)
{
EquInfo = g_equ.SelectedValue as EquInfo;
this.Close();
}
}
}
<Window x:Class="JmpZbPrint.Dialog.ShelfWindow"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:local="clr-namespace:JmpZbPrint.Dialog"
mc:Ignorable="d"
Height="370" Width="550" AllowsTransparency="True" WindowStyle="None"
ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBox.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.DataGrid.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" />
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="PrimaryHueLightBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="PrimaryHueMidBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="#FFFFFF"/>
<!-- accent -->
<SolidColorBrush x:Key="SecondaryAccentBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="SecondaryAccentForegroundBrush" Color="#FFFFFF"/>
<Storyboard x:Key="Loading">
<ThicknessAnimation Duration="0:0:0.2" To="0" From="0,300,0,300"
Storyboard.TargetName="g_main" Storyboard.TargetProperty="Margin" />
</Storyboard>
<Storyboard x:Key="Closing">
<ThicknessAnimation FillBehavior="Stop" Duration="0:0:0.2" To="0,300,0,300" From="0" Storyboard.TargetName="g_main"
Storyboard.TargetProperty="Margin" Completed="Sb_Completed"/>
</Storyboard>
</ResourceDictionary>
</Window.Resources>
<Window.Effect>
<DropShadowEffect BlurRadius="20" Color="#FF858484" Direction="90" ShadowDepth="2"/>
</Window.Effect>
<Window.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded" >
<BeginStoryboard Storyboard="{StaticResource Loading}"/>
</EventTrigger>
<EventTrigger RoutedEvent="UIElement.MouseLeftButtonDown" SourceName="tbclose">
<BeginStoryboard Storyboard="{StaticResource Closing}" />
</EventTrigger>
</Window.Triggers>
<Border BorderBrush="#FF858484" x:Name="g_main" CornerRadius="3" BorderThickness="2" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80"/>
<RowDefinition Height="45"/>
<RowDefinition Height="45"/>
<RowDefinition Height="45"/>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="1" x:Name="txtTitle" Text="选择供应商信息" FontSize="30" Foreground="#0092ea" VerticalAlignment="Top" Margin="20 20 0 0"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="&#xE618;" Style="{StaticResource FiconBase}" x:Name="tbclose"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0 20 20 0" FontSize="35" Foreground="#8a8a8a" />
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal">
<TextBlock Text="入库仓库:" Width="120" TextAlignment="Right" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Name="tbWarehouse" Text="仓库AAAAAAA" Width="380" TextAlignment="Left" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal">
<TextBlock Text="入库货架:" Width="120" TextAlignment="Right" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<ComboBox Name="cboShelf" VerticalAlignment="Center"
materialDesign:HintAssist.HintOpacity=".26"
IsEditable="False" Width="380" FontSize="13"
DisplayMemberPath="name" SelectedValuePath="id" HorizontalAlignment="Left" SelectionChanged="cboShelf_SelectionChanged">
</ComboBox>
</StackPanel>
<StackPanel Grid.Row="3" Grid.Column="1" Orientation="Horizontal" Name="spShelfData">
<TextBlock Text="排:" Width="120" TextAlignment="Right" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<ComboBox Name="cboShelfRange" VerticalAlignment="Center"
materialDesign:HintAssist.HintOpacity=".26"
IsEditable="False" Width="100" FontSize="13"
HorizontalAlignment="Left">
</ComboBox>
<TextBlock Text="列:" Width="40" TextAlignment="Right" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<ComboBox Name="cboShelfColumn" VerticalAlignment="Center"
materialDesign:HintAssist.HintOpacity=".26"
IsEditable="False" Width="100" FontSize="13"
HorizontalAlignment="Left">
</ComboBox>
<TextBlock Text="行:" Width="40" TextAlignment="Right" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<ComboBox Name="cboShelfRow" VerticalAlignment="Center"
materialDesign:HintAssist.HintOpacity=".26"
IsEditable="False" Width="100" FontSize="13"
HorizontalAlignment="Left">
</ComboBox>
</StackPanel>
<StackPanel Grid.Row="4" Grid.Column="1" Orientation="Horizontal" Name="spMessage">
<TextBlock Text="推荐存放位置:" TextAlignment="Right" FontSize="16" VerticalAlignment="Top" Foreground="Red" HorizontalAlignment="Left" Width="120"/>
<TextBlock Name="tbMessage" Text="XXXXXXXXXXXX &#x000A; XXXXXXX &#x000A; XXXXX&#x000A;XXXX" TextWrapping = "Wrap" TextAlignment="Left" FontSize="16" VerticalAlignment="Top" Foreground="Red" HorizontalAlignment="Left" Width="230"/>
</StackPanel>
<Button FontSize="20" Grid.Row="5" Click="OnSave_Click" HorizontalAlignment="Right" Content="确定" Style="{StaticResource MaterialDesignRaisedButton}" Height="40" Width="100" VerticalAlignment="Bottom" Grid.Column="1" Margin="0,5,161,20" />
<Button FontSize="20" Grid.Row="5" Click="OnCancel_Click" HorizontalAlignment="Right" Content="关闭" Background="DarkOrange" BorderBrush="Orange" Style="{StaticResource MaterialDesignRaisedButton}" Height="40" Width="100" VerticalAlignment="Bottom" Grid.Column="1" Margin="0,0,20,20"/>
</Grid>
</Border>
</Window>
using JmpZbPrint.Model;
using System;
using System.Collections.Generic;
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.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace JmpZbPrint.Dialog
{
/// <summary>
/// ShelfWindow.xaml 的交互逻辑
/// </summary>
public partial class ShelfWindow : Window
{
public List<ShelfInfo> ShelfList { get; set; }
public List<ShelfInfo> EquipmentShelfList { get; set; }
public ShelfInfo Shelf { get; set; }
public WarehouseInfo WarehouseInfo { get; set; }
public ShelfWindow(WarehouseInfo warehouse, string equId, string sizeId)
{
InitializeComponent();
WarehouseInfo = warehouse;
ShelfList = HttpHelper.GetShelfByWarehouseId(warehouse.id) ?? new List<ShelfInfo>();
ShelfList.Insert(0, new ShelfInfo
{
id = "",
name = "(未指定)"
});
cboShelf.ItemsSource = ShelfList;
cboShelf.DisplayMemberPath = "name";
cboShelf.SelectedValuePath = "id";
cboShelf.SelectedIndex = 0;
tbWarehouse.Text = WarehouseInfo.name;
EquipmentShelfList = HttpHelper.GetListEquipmentShelfPosition(WarehouseInfo.id, equId, sizeId) ?? new List<ShelfInfo>();
InitEquipmentShelfMessage();
}
private void Sb_Completed(object sender, EventArgs e)
{
this.Close();
}
private void OnSelectItemClick(object sender, RoutedEventArgs e)
{
this.Close();
}
private void OnSave_Click(object sender, RoutedEventArgs e)
{
Shelf = new ShelfInfo()
{
id = (cboShelf.SelectionBoxItem as ShelfInfo)?.id ?? "",
name = (cboShelf.SelectionBoxItem as ShelfInfo)?.name ?? "",
};
if (!string.IsNullOrEmpty(Shelf.id))
{
Shelf.range = cboShelfRange.SelectedIndex > 0 && !string.IsNullOrEmpty(Shelf.id) ? cboShelfRange.SelectedIndex.ToString() : "0";
Shelf.column = cboShelfColumn.SelectedIndex > 0 && Convert.ToInt32(Shelf.range) > 0 ? cboShelfColumn.SelectedIndex.ToString() : "0";
Shelf.row = cboShelfRow.SelectedIndex > 0 && Convert.ToInt32(Shelf.column) > 0 ? cboShelfRow.SelectedIndex.ToString() : " 0";
}
this.Close();
}
private void OnCancel_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void cboShelf_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//切换货架
if (e == null || e.RemovedItems.Count > 0)
{
var shelf = cboShelf.SelectedItem as ShelfInfo;
if (!string.IsNullOrEmpty(shelf.id))
{
cboShelfRange.ItemsSource = CreateSelectList(Convert.ToInt32(shelf.range));
cboShelfRange.SelectedIndex = 0;
cboShelfRow.ItemsSource = CreateSelectList(Convert.ToInt32(shelf.row));
cboShelfRow.SelectedIndex = 0;
cboShelfColumn.ItemsSource = CreateSelectList(Convert.ToInt32(shelf.column));
cboShelfColumn.SelectedIndex = 0;
spShelfData.IsEnabled = true;
}
else
{
cboShelfRange.ItemsSource = null;
cboShelfRow.ItemsSource = null;
cboShelfColumn.ItemsSource = null;
spShelfData.IsEnabled = false;
}
}
}
private List<string> CreateSelectList(int count)
{
var list = new List<string>();
list.Add("(未指定)");
for (int i = 1; i <= count; i++)
{
list.Add(i.ToString());
}
return list;
}
private void InitEquipmentShelfMessage()
{
if (EquipmentShelfList.Count > 0)
{
spMessage.Visibility = Visibility.Visible;
tbMessage.Text = string.Join("\r\n", EquipmentShelfList.Take(3).Select(x => x.name +
(
string.IsNullOrEmpty(x.range) ? "" : "-" + x.range +
(
string.IsNullOrEmpty(x.column) ? "" : "-" + x.column +
(
string.IsNullOrEmpty(x.row) ? "" : "-" + x.row
)
)
)
));
if (EquipmentShelfList.Count > 3)
{
tbMessage.Text += " 等";
}
//装填第一条信息
var shelf = EquipmentShelfList.First();
cboShelf.SelectedIndex = cboShelf.ItemsSource.OfType<ShelfInfo>().ToList()
.FindIndex(x => x.id == shelf.id);
cboShelfRange.SelectedIndex = Convert.ToInt32(shelf.range);
cboShelfColumn.SelectedIndex = Convert.ToInt32(shelf.column);
cboShelfRow.SelectedIndex = Convert.ToInt32(shelf.row);
}
else
{
spMessage.Visibility = Visibility.Hidden;
}
}
}
}
<Window x:Class="JmpZbPrint.Dialog.SupplierWindow"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:local="clr-namespace:JmpZbPrint.Dialog"
mc:Ignorable="d"
Height="350" Width="600" AllowsTransparency="True" WindowStyle="None"
ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBox.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.DataGrid.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" />
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="PrimaryHueLightBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="PrimaryHueMidBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="#FFFFFF"/>
<!-- accent -->
<SolidColorBrush x:Key="SecondaryAccentBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="SecondaryAccentForegroundBrush" Color="#FFFFFF"/>
<Storyboard x:Key="Loading">
<ThicknessAnimation Duration="0:0:0.2" To="0" From="0,300,0,300"
Storyboard.TargetName="g_main" Storyboard.TargetProperty="Margin" />
</Storyboard>
<Storyboard x:Key="Closing">
<ThicknessAnimation FillBehavior="Stop" Duration="0:0:0.2" To="0,300,0,300" From="0" Storyboard.TargetName="g_main"
Storyboard.TargetProperty="Margin" Completed="Sb_Completed"/>
</Storyboard>
</ResourceDictionary>
</Window.Resources>
<Window.Effect>
<DropShadowEffect BlurRadius="20" Color="#FF858484" Direction="90" ShadowDepth="2"/>
</Window.Effect>
<Window.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded" >
<BeginStoryboard Storyboard="{StaticResource Loading}"/>
</EventTrigger>
<EventTrigger RoutedEvent="UIElement.MouseLeftButtonDown" SourceName="tbclose">
<BeginStoryboard Storyboard="{StaticResource Closing}" />
</EventTrigger>
</Window.Triggers>
<Border BorderBrush="#FF858484" x:Name="g_main" CornerRadius="3" BorderThickness="2" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80"/>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="txtTitle" Text="选择供应商信息" FontSize="30" Foreground="#0092ea" VerticalAlignment="Top" Margin="20 20 0 0"/>
<TextBlock Text="&#xE618;" Style="{StaticResource FiconBase}" x:Name="tbclose"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0 20 20 0" FontSize="35" Foreground="#8a8a8a" />
<Grid Grid.Row="1" Margin="0,0,0,0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<TextBlock Text="供应商名称:" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox x:Name="txt_vendor" Focusable="True" Text="{Binding VendorName,UpdateSourceTrigger=PropertyChanged}" MinWidth="400" VerticalAlignment="Center" Width="250" FontSize="15" Background="White" materialDesign:HintAssist.Hint="供应商名称"/>
</StackPanel>
<StackPanel Grid.Column="3" Orientation="Horizontal">
<Button FontSize="15" Content="查询" Click="OnQueryClick" VerticalAlignment="Center" Style="{StaticResource MaterialDesignRaisedButton}" Margin="0,0,0,0" Width="70" HorizontalAlignment="Left" />
</StackPanel>
</Grid>
<DataGrid EnableRowVirtualization="False" x:Name="g_vender" Margin="3 5 3 20" Grid.Row="2" BorderBrush="#dedede" FontSize="20" Foreground="#37537d" HeadersVisibility="Column"
GridLinesVisibility="None" Background="Transparent" BorderThickness="1" CanUserAddRows="False"
AutoGenerateColumns="False" SelectionMode="Single" HorizontalScrollBarVisibility="Hidden" RowBackground="Transparent" CanUserSortColumns="True" >
<DataGrid.ColumnHeaderStyle>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#4682B4"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="Height" Value="25"/>
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="45" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#EBEBEB"/>
<Setter Property="Opacity" Value="0.4"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="供应商名称" IsReadOnly="True" Width="*" FontSize="13" Binding="{Binding name}" ElementStyle="{StaticResource TextLeftStyle}"/>
<DataGridTemplateColumn Header="操作" Width="100" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="选择" Click="OnSelectItemClick" Height="30" Margin="5,0,5,0" >
</Button>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
</Window>
using JmpZbPrint.Model;
using System;
using System.Collections.Generic;
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.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace JmpZbPrint.Dialog
{
/// <summary>
/// SupplierWin.xaml 的交互逻辑
/// </summary>
public partial class SupplierWindow : Window
{
public Supplier Supplier { get; set; }
public List<Supplier> SupplierList { get; set; }
public SupplierWindow()
{
InitializeComponent();
SupplierList = HttpHelper.GetAllSupplier();
g_vender.ItemsSource = SupplierList?.Take(30);
txt_vendor.Focus();
}
private void Sb_Completed(object sender, EventArgs e)
{
this.Close();
}
private void OnQueryClick(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(txt_vendor.Text))
{
g_vender.ItemsSource = SupplierList;
}
else
{
g_vender.ItemsSource = SupplierList?.Where(t=>t.name.Contains(txt_vendor.Text));
}
}
private void OnSelectItemClick(object sender, RoutedEventArgs e)
{
Supplier = g_vender.SelectedValue as Supplier;
this.Close();
}
}
}
[Database]
;是否保存(0不保存,1保存)
Save =0
;数据库IP地址
Source=172.18.77.25
;数据库名称
DB=RFIDReader_Data
;用户名
User=sa
;密码
Pwd=sa
;保存间隔时间(秒)
Upd=5
[RunMode]
mode=0
[ShowScoreboard]
show=True
[ShowSpeedCurve]
curveshow=False
[MacErr]
InterruptFWDPWRLEVERROR=True
using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
namespace JmpZbPrint
{
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 = null)
{
lock (syncErrorObj)
{
if (bEnableErrorLog)
{
WriteLine(logTxt, ModuleName, "ErrorLog/");
}
}
}
/// <summary>
/// 异常日志
/// </summary>
/// <param name="logTxt"></param>
/// <param name="ModuleName"></param>
public static void DebugLog(string logTxt, string ModuleName)
{
lock (syncDebugObj)
{
if (bEnableDebugLog)
{
WriteLine(logTxt, ModuleName, "DebugLog/");
}
}
}
/// <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 = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + pathName
+ DateTime.Now.ToString("yyyyMMdd") + ".log";
ClearFile(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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model.DbModel
{
public class db_page
{
public int total { get; set; }
public List<recode_info> record { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model
{
public class KeyName
{
public int Key { get; set; }
public string Name { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model
{
public enum LabelType
{
打印 = 0,
初始化 = 1,
}
}
using GalaSoft.MvvmLight;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model
{
public class PrintLog:ViewModelBase
{
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 是否打印成功
/// </summary>
public bool IsSuccess { get; set; }
public string epc { get; set; }
public string id { get; set; }
public string orderCode { get; set; }
public string warehouseName { get; set; }
public string productName { get; set; }
public string sizeName { get; set; }
public string productTime { get; set; }
public string useTime { get; set; }
public string pieceNo { get; set; }
public string warrantyCycle { get; set; }
public string repairCycle { get; set; }
public string price { get; set; }
public string supplierName { get; set; }
/// <summary>
/// 是否是箱标
/// </summary>
public bool isBoxMark { get; set; }
/// <summary>
/// 箱内数量
/// </summary>
public int oneBoxNum { get; set; }
[JsonIgnore]
public int state { get; set; }
[Newtonsoft.Json.JsonIgnore]
private bool _select = false;
[Newtonsoft.Json.JsonIgnore]
public bool IsSelected
{
get
{
return _select;
}
set
{
_select = value;
this.RaisePropertyChanged(() => IsSelected);
}
}
}
}
using GalaSoft.MvvmLight;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model
{
public class PrintsInfo : ViewModelBase
{
public string Id { get; set; }
public string OrderCode { get; set; }
public string ProductNo { get; set; }
public string ProductName { get; set; }
public string SupplierName { get; set; }
public string SizeName { get; set; }
public string Epc { get; set; }
public string ProductTime { get; set; }
public string Price { get; set; }
public string UseTime { get; set; }
public string WarrantyCycle { get; set; }
public string RepairCycle { get; set; }
public int Quantity { get; set; }
public int PrintType { get; set; }
private bool _select = false;
[Newtonsoft.Json.JsonIgnore]
public bool IsSelected
{
get
{
return _select;
}
set
{
_select = value;
this.RaisePropertyChanged(() => IsSelected);
}
}
[Newtonsoft.Json.JsonIgnore]
public int State { get; set; }
public int? PieceNo { get; set; }
}
}
using GalaSoft.MvvmLight;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model
{
public class order_info : ViewModelBase
{
public string orderId { get; set; }
public string detailId { get; set; }
public string createTime { get; set; }
public string equCode { get; set; }
public string equName { get; set; }
public string equId { get; set; }
public string sizeId { get; set; }
public string sizeCode { get; set; }
public string sizeName { get; set; }
public string orderCode { get; set; }
public int genedNum { get; set; }
public int totalNum { get; set; }
public ObservableCollection<Supplier> suppilers { get; set; }
public int reNum { get; set; }
[Newtonsoft.Json.JsonIgnore]
private bool _select = false;
[Newtonsoft.Json.JsonIgnore]
public bool IsSelected
{
get
{
return _select;
}
set
{
_select = value;
this.RaisePropertyChanged(() => IsSelected);
}
}
[Newtonsoft.Json.JsonIgnore]
private string _supplierId = string.Empty;
[Newtonsoft.Json.JsonIgnore]
public string supplierId
{
get { return _supplierId; }
set
{
_supplierId = value;
RaisePropertyChanged();
}
}
[Newtonsoft.Json.JsonIgnore]
public string supplierCode
{
get; set;
}
[Newtonsoft.Json.JsonIgnore]
public string supplierName
{
get; set;
}
public DateTime? productTime { get; set; } = DateTime.Now.AddDays(-7);
public DateTime? useTime { get; set; } = DateTime.Now;
public int warrantyCycle { get; set; }
public int repairCycle { get; set; }
public decimal price { get; set; }
public int needNum { get; set; }
[JsonIgnore]
public int rowNum { get; set; }
/// <summary>
/// 仓库id
/// </summary>
public string warehouseId { get; set; }
/// <summary>
/// 仓库名称
/// </summary>
public string warehouseName { get; set; }
/// <summary>
/// 货架id
/// </summary>
public string shelfId { get; set; }
/// <summary>
/// 货架名称
/// </summary>
public string shelfName { get; set; }
/// <summary>
/// 货架名称
/// </summary>
public string _shelfName { get; set; }
/// <summary>
/// 货架排
/// </summary>
public int shelfRange { get; set; }
/// <summary>
/// 货架行
/// </summary>
public int shelfRow { get; set; }
/// <summary>
/// 货架列
/// </summary>
public int shelfColumn { get; set; }
/// <summary>
/// 货架信息(拼接)
/// </summary>
[JsonIgnore]
public string shelfInfo
{
get
{
var str = shelfName;
if (shelfRange != 0)
{
str += "-" + shelfRange;
if (shelfColumn != 0)
{
str += "-" + shelfColumn;
if (shelfRow != 0)
{
str += "-" + shelfRow;
}
}
}
return str;
}
set
{
RaisePropertyChanged();
}
}
}
public class EquSupplier
{
public string id { get; set; }
public string name { get; set; }
public int num { get; set; }
}
public class EquInfo
{
public string id { get; set; }
public string name { get; set; }
public string code { get; set; }
}
public class EquAttr
{
public List<Supplier> suppliers { get; set; }
public List<EquSizeInfo> sizes { get; set; }
}
public class WarehouseInfo
{
public string id { get; set; }
public string name { get; set; }
}
public class ShelfInfo
{
public string id { get; set; }
public string name { get; set; }
public string range { get; set; }
public string row { get; set; }
public string column { get; set; }
}
public class Supplier
{
public string id { get; set; }
public string code { get; set; }
public string name { get; set; }
}
public class EquSizeInfo
{
public string id { get; set; }
public string code { get; set; }
public string name { get; set; }
/// <summary>
/// 默认价格
/// </summary>
public decimal? price { get; set; }
}
}
using GalaSoft.MvvmLight;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model
{
public class print_info : ViewModelBase
{
/// <summary>
/// 标签类型
/// 箱标
/// 件标
/// 装备包
/// </summary>
public string LabelType { get; set; }
public string epc { get; set; }
public string id { get; set; }
public string orderCode { get; set; }
public string warehouseName { get; set; }
public string warehouseId { get; set; }
public string productName { get; set; }
public string productId { get; set; }
public string productNo { get; set; }
public string sizeName { get; set; }
public string sizeId { get; set; }
public string sizeCode { get; set; }
public string productTime { get; set; }
public string useTime { get; set; }
public string pieceNo { get; set; }
public string warrantyCycle { get; set; }
public string repairCycle { get; set; }
public string price { get; set; }
public string supplierName { get; set; }
public string supplierId { get; set; }
public string supplierCode { get; set; }
public bool isUnboxingLabel { get; set; }
public int oneBoxNum { get; set; }
public string epcListJson { get; set; }
/// <summary>
/// 编号
/// </summary>
public string number { get; set; }
/// <summary>
/// 装备包名称
/// </summary>
public string bagName { get; set; }
/// <summary>
/// 装备包内部装备名称概要
/// </summary>
public string invInfo { get; set; }
[JsonIgnore]
public int state { get; set; }
[Newtonsoft.Json.JsonIgnore]
private bool _select = false;
[Newtonsoft.Json.JsonIgnore]
public bool IsSelected
{
get
{
return _select;
}
set
{
_select = value;
this.RaisePropertyChanged(() => IsSelected);
}
}
}
}
using GalaSoft.MvvmLight;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model
{
public class recode_info : ViewModelBase
{
/// <summary>
/// 标签类型
/// 箱标
/// 件标
/// </summary>
public string LabelType { get; set; }
[JsonIgnore]
public int id { get; set; }
public string equId { get; set; }
public string equName { get; set; }
public string equCode { get; set; }
public string sizeId { get; set; }
public string sizeCode { get; set; }
public string sizeName { get; set; }
public string supplierId { get; set; }
public string suppilerCode { get; set; }
public string suppilerName { get; set; }
public DateTime? productTime { get; set; } = DateTime.Now.AddDays(-7);
public DateTime? useTime { get; set; } = DateTime.Now;
public int warrantyCycle { get; set; }
public int repairCycle { get; set; }
public float price { get; set; }
/// <summary>
/// 物品数量(件标:个数 箱标:箱数)
/// </summary>
public int needNum { get; set; }
/// <summary>
/// 单箱装箱个数
/// </summary>
public int oneBoxNum { get; set; }
public string warehouseId { get; set; }
public string warehouseName { get; set; }
/// <summary>
/// 是否是拆箱生成的标签
/// </summary>
public bool IsUnboxingLabel { get; set; }
/// <summary>
/// 是否是重装箱
/// </summary>
public bool IsReloadBoxing { get; set; }
/// <summary>
/// 货架id
/// </summary>
public string ShelfId { get; set; }
/// <summary>
/// 货架名称
/// </summary>
public string ShelfName { get; set; }
/// <summary>
/// 货架排
/// </summary>
public int ShelfRange { get; set; }
/// <summary>
/// 货架行
/// </summary>
public int ShelfRow { get; set; }
/// <summary>
/// 货架列
/// </summary>
public int ShelfColumn { get; set; }
/// <summary>
/// 货架信息(拼接)
/// </summary>
[JsonIgnore]
public string ShelfInfo
{
get
{
var str = ShelfName;
if (ShelfRange != 0)
{
str += "-" + ShelfRange;
if (ShelfColumn != 0)
{
str += "-" + ShelfColumn;
if (ShelfRow != 0)
{
str += "-" + ShelfRow;
}
}
}
return str;
}
}
[JsonIgnore]
public int num { get; set; }
[JsonIgnore]
public string epc { get; set; }
/// <summary>
/// 箱标epcList(json)
/// </summary>
[JsonIgnore]
public string epcListJson { get; set; }
[JsonIgnore]
public int type { get; set; }
[JsonIgnore]
public bool isdelete { get; set; } = false;
[JsonIgnore]
public bool _isSelected { get; set; }
[JsonIgnore]
public bool IsSelected
{
get
{
return _isSelected;
}
set
{
_isSelected = value;
RaisePropertyChanged();
}
}
[JsonIgnore]
public DateTime? createTime { get; set; }
[JsonIgnore]
public string batchNo { get; set; }
[JsonIgnore]
public string orgId { get; set; }
/// <summary>
/// 标签打印时间
/// </summary>
[JsonIgnore]
public DateTime PrintTime { get; set; }
/// <summary>
/// 是否为旧数据导入成功
/// </summary>
[JsonIgnore]
public bool IsImported { get; set; }
}
}
namespace JmpZbModel.Model
{
public class request_equipment
{
public string supplierID { get; set; }
public string equipmentID { get; set; }
public string epc { get; set; }
public string equipmentSizeID { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model
{
public class request_ext_info
{
public string supplierName { get; set; }
public DateTime? productTime { get; set; }
public DateTime? useTime { get; set; }
public int warrantyCycle { get; set; }
public int repairCycle { get; set; }
public float price { get; set; }
public string supplierId { get; set; }
public string equCode { get; set; }
public string supplierCode { get; set; }
public string sizeCode { get; set; }
public string detailId { get; set; }
public int quantity { get; set; }
public string shelfId { get; set; }
public int shelfRange { get; set; }
public int shelfRow { get; set; }
public int shelfColumn { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model
{
public class request_head
{
public string warehouseid { get; set; }
public string userid { get; set; }
public string orgid { get; set; }
public List<Equipment> equipments { get; set; } = new List<Equipment>();
}
public class Equipment
{
public string supplierid { get; set; }
public string equipmentid { get; set; }
public string epc { get; set; }
public string equipmentsizeid { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model
{
public class request_int_info
{
public string labelType { get; set; }
public int warrantyCycle { get; set; }
public DateTime? productTime { get; set; }
public string equCode { get; set; }
public string supplierCode { get; set; }
public string sizeCode { get; set; }
public int oneBoxNum { get; set; }
public int quantity { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model
{
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;
using System.Windows;
using Newtonsoft.Json;
namespace JmpZbPrint.Model
{
public class respone_bagInventory
{
public string epc { get; set; }
public string id { get; set; }
public DateTime createTime { get; set; }
public int oneBoxNum { get; set; }
public string bagName { get; set; }
public string bagId { get; set; }
public int number { get; set; }
public string warehouseId { get; set; }
public string warehouseName { get; set; }
public string organizationId { get; set; }
public string invInfo { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Newtonsoft.Json;
namespace JmpZbPrint.Model
{
public class respone_boxMark
{
public string epc { get; set; }
public string id { get; set; }
public DateTime createTime { get; set; }
public int oneBoxNum { get; set; }
public string warehouseId { get; set; }
public string warehouseName { get; set; }
public string orgizationId { 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 int sizeEpcType { get; set; }
public string supplierId { get; set; }
public string supplierName { get; set; }
public string oldEpc { get; set; }
public string productTime { get; set; }
public string useTime { get; set; }
public string warrantyCycle { get; set; }
public string repairCycle { get; set; }
public string price { 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 JmpZbPrint.Model
{
public class respone_epc
{
public string epc { get; set; }
public int num { get; set; }
}
}
using JmpZbModel.Model;
using JmpZbPrint.Common;
using System.Collections.Generic;
using System.ComponentModel;
namespace JmpZbPrint.Model
{
public class respone_head<T>
{
public int code { get; set; }
public string msg { get; set; }
public T data { get; set; }
}
public class respone_order
{
public int total { get; set; }
public List<order_info> record { get; set; }
}
public class respone_supplier
{
public int total { get; set; }
public List<Supplier> record { get; set; }
}
public class respone_print
{
public int total { get; set; }
public List<print_info> record { get; set; }
}
public class respone_data
{
public int total { get; set; }
public int pages { get; set; }
public int size { get; set; }
public List<order_info> record { get; set; }
public int current { get; set; }
}
//public class EquipmentInfo
//{
// public string equipmentDetailID { get; set; } = string.Empty;
// public string equipmentDetailName { get; set; } = string.Empty;
// public List<Supplier> supplierList { get; set; } = new List<Supplier>();
// public List<Size> equipmentSizeList { get; set; } = new List<Size>();
//}
//public class Supplier
//{
// public string supplierID { get; set; }
// public string supplierName { get; set; }
//}
//public class Size
//{
// public string sizeName { get; set; }
// public string sizeId { get; set; }
// public string sizeCode { get; set; }
//}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model
{
public class respone_import_old_data
{
public List<respone_import_old_data_detail> successList { get; set; }
public List<respone_import_old_data_detail> failList { get; set; }
}
public class respone_import_old_data_detail
{
public string epc { get; set; }
public string message { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model
{
public class respone_inventory
{
public string id { get; set; }
public DateTime createTime { get; set; }
public string epc { get; set; }
public string warehouseId { get; set; }
public string warehouseName { get; set; }
public string orgizationId { 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 int sizeEpcType { get; set; }
public string supplierId { get; set; }
public string supplierCode { get; set; }
public string supplierName { get; set; }
public decimal price { get; set; }
public DateTime? productTime { get; set; }
public int repairCycle { get; set; }
public DateTime? useTime { get; set; }
public int warrantyCycle { get; set; }
public string shelfId { get; set; }
public int? shelfRange { get; set; }
public int? shelfRow { get; set; }
public int? shelfColumn { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JmpZbPrint.Model
{
public class respone_postek_msg
{
public string retval { get; set; }
public string msg { get; set; }
public string ReceiveData { get; set; }
}
}
namespace JmpZbPrint.Model
{
public class respone_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 JmpZbPrint.Model
{
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 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 policeman
{
public string id { get; set; }
public string name { get; set; }
public string policeCode { get; set; }
}
}
using GalaSoft.MvvmLight;
using System.Collections.Generic;
using System.Windows.Documents;
namespace JmpZbModel.Model
{
public class tb_general_task : ViewModelBase
{
public int Id { get; set; }
public string pmdm { get; set; }
public string pmmc { get; set; }
public string hx { get; set; }
public string hxdm { get; set; }
public string gysdm { get; set; }
public string gysmc { get; set; }
public int totalqty { get; set; }
public string type { get; set; }
public int remainqty { get; set; }
public bool issucceed { get; set; }
private bool _select = false;
public bool select
{
get
{
return _select;
}
set
{
_select = value;
this.RaisePropertyChanged(() => select);
}
}
public string epc { get; set; }
}
}
<Window x:Class="JmpZbPrint.ModifyPrint"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:local="clr-namespace:JmpZbPrint"
xmlns:System="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
Title="新增打印任务" Height="360" Width="450" AllowsTransparency="True" WindowStyle="None"
ResizeMode="NoResize" Loaded="OnWindowLoaded" WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBox.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.DataGrid.xaml" />
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="PrimaryHueLightBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="PrimaryHueMidBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="#FFFFFF"/>
<!-- accent -->
<SolidColorBrush x:Key="SecondaryAccentBrush" Color="#0093EA"/>
<SolidColorBrush x:Key="SecondaryAccentForegroundBrush" Color="#FFFFFF"/>
</ResourceDictionary>
</Window.Resources>
<Border BorderBrush="#0092ea" CornerRadius="3" BorderThickness=".8" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="5"/>
<RowDefinition Height="50"/>
<RowDefinition Height="5"/>
<RowDefinition Height="50"/>
<RowDefinition Height="5"/>
<RowDefinition Height="50"/>
<RowDefinition Height="20"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="txtTitle" Text="新建打印任务" Grid.Row="0" Grid.ColumnSpan="3" FontSize="20" Foreground="#0092ea" VerticalAlignment="Top" Margin="170 15 0 0"/>
<TextBlock Text="&#xE618;" MouseLeftButtonDown="OnClose" Grid.Row="0" Grid.Column="3" Style="{StaticResource FiconBase}" x:Name="tbclose"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0 5 10 0" FontSize="35" Foreground="#8a8a8a" />
<Label VerticalAlignment="Center" Grid.Row="1" Grid.Column="1" FontSize="18" HorizontalAlignment="Right">物资品名:</Label>
<ComboBox x:Name="cboWz" Grid.Row="1" ItemsSource="{Binding}" SelectedValuePath="equipmentDetailID" DisplayMemberPath="equipmentDetailName" SelectionChanged="OnWzSelectionChanged" materialDesign:HintAssist.HintOpacity=".26" Style="{StaticResource MaterialDesignFloatingHintComboBox}" IsDropDownOpen="False" IsEditable="True" Grid.Column="2" Margin="10,0,0,0" Width="250" FontSize="18" Background="White" materialDesign:HintAssist.Hint="请选择物资"/>
<Label VerticalAlignment="Center" Grid.Row="3" Grid.Column="1" FontSize="18" HorizontalAlignment="Right">物资号型:</Label>
<ComboBox Margin="10,0,0,0" Name="cboHx" Width="250" Grid.Row="3" Grid.Column="2" SelectedValuePath="sizeId" DisplayMemberPath="sizeName" materialDesign:HintAssist.HintOpacity=".26" Style="{StaticResource MaterialDesignFloatingHintComboBox}" IsEditable="True" FontSize="18" Background="White" materialDesign:HintAssist.Hint="请选择号型"/>
<Label VerticalAlignment="Center" FontSize="18" Grid.Row="5" Grid.Column="1" HorizontalAlignment="Right">供应商:</Label>
<ComboBox Margin="10,0,0,0" Name="cboGys" Width="250" Grid.Row="5" Grid.Column="2" SelectedValuePath="supplierID" DisplayMemberPath="supplierName" materialDesign:HintAssist.HintOpacity=".26" Style="{StaticResource MaterialDesignFloatingHintComboBox}" IsEditable="True" FontSize="18" Background="White" materialDesign:HintAssist.Hint="请选择供应商"/>
<Label VerticalAlignment="Center" Grid.Row="7" Grid.Column="1" FontSize="18" HorizontalAlignment="Right">打印数量:</Label>
<TextBox Margin="10,0,0,0" Name="txtNum" Grid.Row="7" Grid.Column="2" VerticalAlignment="Bottom" Width="250" FontSize="20" Background="White" materialDesign:HintAssist.Hint="请输入数量" >
</TextBox>
<Button FontSize="20" Grid.Row="9" Click="OnSaveClick" HorizontalAlignment="Right" Content="保存" Style="{StaticResource MaterialDesignRaisedButton}" Height="40" Width="100" VerticalAlignment="Bottom" Grid.Column="1" Margin="0,5,161,0" Grid.ColumnSpan="2"/>
<Button FontSize="20" Grid.Row="9" Click="OnCancelClick" HorizontalAlignment="Right" Content="取消" Background="DarkOrange" BorderBrush="Orange" Style="{StaticResource MaterialDesignRaisedButton}" Height="40" Width="100" VerticalAlignment="Bottom" Grid.Column="2" Margin="0,5,26,0"/>
</Grid>
</Border>
</Window>
using JmpZbModel.Model;
using JmpZbPrint.Common;
using JmpZbPrint.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
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.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace JmpZbPrint
{
/// <summary>
/// ModifyPrint.xaml 的交互逻辑
/// </summary>
public partial class ModifyPrint : Window
{
private string type = "打印";
public ModifyPrint(string type = "打印")
{
InitializeComponent();
this.type = type;
if (type == "绑定")
{
txtTitle.Text = "新建绑定任务";
}
}
//public List<Supplier> SupplierList
//{
// get;
// set;
//} = new List<Supplier>();
//public event Action OnUpdateTask;
//public List<EquipmentInfo> EquipmentList
//{
// get;
// set;
//} = new List<EquipmentInfo>();
//protected List<JmpZbPrint.Model.Size> SizeList
//{
// get;
// set;
//} = new List<Model.Size>();
private void OnWindowLoaded(object sender, RoutedEventArgs e)
{
//EquipmentList = CaChe.WzList;
//cboWz.ItemsSource = EquipmentList;
}
private void OnWzSelectionChanged(object sender, SelectionChangedEventArgs e)
{
//var eid = cboWz.SelectedValue?.ToString() ?? "";
//if (!string.IsNullOrEmpty(eid))
//{
// var tmp_item = cboWz.SelectedItem as EquipmentInfo;
// SizeList = new List<Model.Size>(tmp_item.equipmentSizeList);
// cboHx.ItemsSource = SizeList;
// SupplierList = new List<Supplier>(tmp_item.supplierList);
// cboGys.ItemsSource = SupplierList;
//}
}
private void OnSaveClick(object sender, RoutedEventArgs e)
{
if (cboWz.SelectedValue == null)
{
MessageBox.Show("物资未选择", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
}
else if (cboHx.SelectedValue == null)
{
MessageBox.Show("号型未选择", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
}
else if (cboGys.SelectedValue == null)
{
MessageBox.Show("供应商未选择", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
}
else if (!int.TryParse(txtNum.Text, out int qty) || qty <= 0)
{
MessageBox.Show("打印数量不正确", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
//var supplier = cboGys.SelectedItem as Supplier;
//var size = cboHx.SelectedItem as Model.Size;
//var enqui = cboWz.SelectedItem as EquipmentInfo;
//List<string> epcList = HttpHelper.GetEpcList(qty);
//var result = false;
//for (int i = 0; i < qty; i++)
//{
// result = DbFactory.Insert(new tb_general_task()
// {
// gysdm = supplier.supplierID,
// gysmc = supplier.supplierName,
// hx = size.sizeName,
// hxdm = size.sizeId,
// issucceed = false,
// pmdm = enqui.equipmentDetailID,
// pmmc = enqui.equipmentDetailName,
// remainqty = 1,
// totalqty = 1,
// type = type,
// epc = epcList[i]
// });
//}
//if (result)
//{
// //写入到本地数据库
// OnUpdateTask?.Invoke();
// MessageBox.Show("新建成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
//}
//else
//{
// MessageBox.Show("数据写入失败", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
//}
}
}
private void OnCancelClick(object sender, RoutedEventArgs e)
{
this.Close();
}
private void OnClose(object sender, MouseButtonEventArgs e)
{
this.Close();
}
}
}
using JmpZbPrint.ViewModel;
using System;
using System.Collections.Generic;
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.Media;
using System.Windows.Media.Imaging;
using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace JmpZbPrint.PagePartial
{
/// <summary>
/// GenEpcWindow.xaml 的交互逻辑
/// </summary>
public partial class GenEpcWindow : UserControl
{
public GenEpcWindow()
{
InitializeComponent();
var vm= new GenEpcViewModel();
this.DataContext = vm;
chk_gen.DataContext = vm;
}
private object syncObj = new object();
private void OnDataGridLoadingRow(object sender, DataGridRowEventArgs e)
{
lock (syncObj)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
}
//private void SelectItemClick(object sender, RoutedEventArgs e)
//{
// CheckBox chk = (CheckBox)sender;
// for (int i = 0; i < g_task.Items.Count; i++)
// {
// //获取行
// DataGridRow neddrow = (DataGridRow)g_task.ItemContainerGenerator.ContainerFromIndex(i);
// //获取该行的某列
// CheckBox cb = (CheckBox)g_task.Columns[0].GetCellContent(neddrow);
// cb.IsChecked = chk.IsChecked;
// }
//}
}
}
using JmpZbPrint.ViewModel;
using System;
using System.Collections.Generic;
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.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace JmpZbPrint.PagePartial
{
/// <summary>
/// GenEpcWindow.xaml 的交互逻辑
/// </summary>
public partial class IntBindWindow : UserControl
{
private IntBindViewModel vm;
public IntBindWindow()
{
InitializeComponent();
vm = new IntBindViewModel();
this.DataContext = vm;
chk_pri.DataContext = vm;
}
private object syncObj = new object();
private void OnDataGridLoadingRow(object sender, DataGridRowEventArgs e)
{
lock (syncObj)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
}
public void Clearup()
{
vm.Cleanup();
}
}
}
using JmpZbPrint.ViewModel;
using System;
using System.Collections.Generic;
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.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace JmpZbPrint.PagePartial
{
/// <summary>
/// GenEpcWindow.xaml 的交互逻辑
/// </summary>
public partial class IntHistoryWindow : UserControl
{
private IntHistoryViewModel vm;
public IntHistoryWindow()
{
InitializeComponent();
vm = new IntHistoryViewModel();
this.DataContext = vm;
chk_pri.DataContext = vm;
}
private object syncObj = new object();
private void OnDataGridLoadingRow(object sender, DataGridRowEventArgs e)
{
lock (syncObj)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
}
}
}
using JmpZbPrint.Model;
using JmpZbPrint.ViewModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using JmpZbPrint.View;
namespace JmpZbPrint.PagePartial
{
/// <summary>
/// GenEpcWindow.xaml 的交互逻辑
/// </summary>
public partial class IntPrintWindow : UserControl
{
private IntPrintViewModel vm;
private InternalWindow _window;
public IntPrintWindow(InternalWindow window)
{
InitializeComponent();
_window = window;
vm = new IntPrintViewModel(window);
this.DataContext = vm;
chk_pri.DataContext = vm;
}
private object syncObj = new object();
private void OnDataGridLoadingRow(object sender, DataGridRowEventArgs e)
{
lock (syncObj)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
}
public void Clearup()
{
vm.Cleanup();
}
private void pri_win_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (!IsVisible)
{
_window.printServerHelper.EnableControlEvent -= vm.EnableControl;
}
}
}
}
using JmpZbPrint.Dialog;
using JmpZbPrint.Model;
using JmpZbPrint.ViewModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using JmpZbPrint.View;
namespace JmpZbPrint.PagePartial
{
/// <summary>
/// TagBagPrintWindow.xaml 的交互逻辑
/// </summary>
public partial class TagBagPrintWindow : UserControl
{
private TagBagPrinViewModel vm;
private MainWindow _window;
public TagBagPrintWindow(MainWindow window)
{
InitializeComponent();
_window = window;
vm = new TagBagPrinViewModel(window);
this.DataContext = vm;
chk_pri.DataContext = vm;
}
private object syncObj = new object();
private void OnDataGridLoadingRow(object sender, DataGridRowEventArgs e)
{
lock (syncObj)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
}
public void Clearup()
{
vm.Cleanup();
}
private void pri_win_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (!IsVisible)
{
_window.printServerHelper.EnableControlEvent -= vm.EnableControl;
}
}
}
}
using JmpZbPrint.ViewModel;
using System;
using System.Collections.Generic;
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.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace JmpZbPrint.PagePartial
{
/// <summary>
/// GenEpcWindow.xaml 的交互逻辑
/// </summary>
public partial class TagBindWindow : UserControl
{
private TagBindViewModel vm;
public TagBindWindow()
{
InitializeComponent();
vm = new TagBindViewModel();
this.DataContext = vm;
chk_bind.DataContext = vm;
}
private object syncObj = new object();
private void OnDataGridLoadingRow(object sender, DataGridRowEventArgs e)
{
lock (syncObj)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
}
public void Clearup()
{
vm.Cleanup();
}
}
}
using JmpZbPrint.Dialog;
using JmpZbPrint.Model;
using JmpZbPrint.ViewModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using JmpZbPrint.View;
namespace JmpZbPrint.PagePartial
{
/// <summary>
/// GenEpcWindow.xaml 的交互逻辑
/// </summary>
public partial class TagBoxPrintWindow : UserControl
{
private TagBoxPrinViewModel vm;
private MainWindow _window;
public TagBoxPrintWindow(MainWindow window)
{
InitializeComponent();
_window = window;
vm = new TagBoxPrinViewModel(window);
this.DataContext = vm;
chk_pri.DataContext = vm;
}
private object syncObj = new object();
private void OnDataGridLoadingRow(object sender, DataGridRowEventArgs e)
{
lock (syncObj)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
}
public void Clearup()
{
vm.Cleanup();
}
private void pri_win_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (!IsVisible)
{
_window.printServerHelper.EnableControlEvent -= vm.EnableControl;
}
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论