添加项目文件。

master
frankiecao 9 months ago
parent efc63f2b44
commit b8f586a68e

@ -0,0 +1,149 @@
using Seagull.BarTender.Print;
using SlnMesnac.LabelPrint.Bartender.equip;
using SlnMesnac.LabelPrint.BarTender.equip;
using SlnMesnac.LabelPrint.Log4net;
using SlnMesnac.LabelPrint.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlnMesnac.LabelPrint.BarTender
{
public class PrintManager
{
private LogHelper logHelper = LogHelper.Instance;
#region 单例实现
private static readonly Lazy<PrintManager> lazy = new Lazy<PrintManager>(() => new PrintManager());
public static PrintManager Instance
{
get
{
return lazy.Value;
}
}
#endregion
public PrintManager() { }
/// <summary>
/// 标签打印
/// </summary>
/// <param name="labelInfo"></param>
public bool Print(BaseLabelInfo labelInfo)
{
bool result = false;
try
{
if (labelInfo.productType == "Gas" || labelInfo.productType == "TF")
{
result = this.PrintGasLabel(labelInfo);
}else if(labelInfo.productType == "Drum")
{
result = this.PrintDrumLabel(labelInfo);
}else if(labelInfo.productType == "Unit")
{
result = this.PrintUnitLabel(labelInfo);
}else if(labelInfo.productType == "Pallet")
{
result = this.PrintPalletLabel(labelInfo);
}
else
{
logHelper.Info("产品类型未匹配到对应的模板");
}
#region 测试代码
/*Engine btEngine = new Engine();
// 启动Bartender引擎
btEngine.Start();
// 打开打印模板
LabelFormatDocument btFormat = btEngine.Documents.Open(@"C:\Path\To\Your\Template.btw");
// 设置模板中的变量值
btFormat.SubStrings["VariableName"].Value = "Value";
// 打印模板
btFormat.Print();
// 关闭模板
btFormat.Close(SaveOptions.DoNotSaveChanges);
// 关闭Bartender引擎
btEngine.Stop();*/
#endregion
result = true;
}
catch (Exception ex)
{
logHelper.Error("标签打印异常", ex);
}
return result;
}
/// <summary>
/// 气体、不锈钢标签打印
/// </summary>
/// <param name="labelInfo"></param>
private bool PrintGasLabel(BaseLabelInfo labelInfo)
{
bool result = false;
PrintEquip equip = new GasLabelPrintEquip();
equip.tempPath = "C:\\Users\\Administrator\\Desktop\\模板01.btw";
equip.ParaClass = labelInfo;
equip.Open();
result = equip.print();
equip.Colse();
return result;
}
/// <summary>
///
/// </summary>
/// <param name="labelInfo"></param>
private bool PrintDrumLabel(BaseLabelInfo labelInfo)
{
bool result = false;
PrintEquip equip = new LabelPrintEquip();
equip.tempPath = "C:\\Users\\Administrator\\Desktop\\模板01.btw";
equip.ParaClass = labelInfo;
equip.Open();
result = equip.print();
equip.Colse();
return result;
}
private bool PrintUnitLabel(BaseLabelInfo labelInfo)
{
bool result = false;
PrintEquip equip = new LabelPrintEquip();
equip.tempPath = "C:\\Users\\Administrator\\Desktop\\模板01.btw";
equip.ParaClass = labelInfo;
equip.Open();
result = equip.print();
equip.Colse();
return result;
}
private bool PrintPalletLabel(BaseLabelInfo labelInfo)
{
bool result = false;
PrintEquip equip = new LabelPrintEquip();
equip.tempPath = "C:\\Users\\Administrator\\Desktop\\模板01.btw";
equip.ParaClass = labelInfo;
equip.Open();
result = equip.print();
equip.Colse();
return result;
}
}
}

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("SlnMesnac.LabelPrint.BarTender")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SlnMesnac.LabelPrint.BarTender")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("6a110611-3f4c-46c2-a981-23a0145b1e9f")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -0,0 +1,70 @@
<?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>{6A110611-3F4C-46C2-A981-23A0145B1E9F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SlnMesnac.LabelPrint.BarTender</RootNamespace>
<AssemblyName>SlnMesnac.LabelPrint.BarTender</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Seagull.BarTender.Print, Version=11.3.7.1, Culture=neutral, PublicKeyToken=109ff779a1b4cbc7, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\SlnMesnac.LabelPrint.Library\Seagull.BarTender.Print.dll</HintPath>
</Reference>
<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="equip\GasLabelPrintEquip.cs" />
<Compile Include="equip\LabelPrintEquip.cs" />
<Compile Include="equip\PrintEquip.cs" />
<Compile Include="PrintManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SlnMesnac.LabelPrint.Common\SlnMesnac.LabelPrint.Common.csproj">
<Project>{7232269D-60AF-45F0-B614-8F9C4061C529}</Project>
<Name>SlnMesnac.LabelPrint.Common</Name>
</ProjectReference>
<ProjectReference Include="..\SlnMesnac.LabelPrint.Log4net\SlnMesnac.LabelPrint.Log4net.csproj">
<Project>{FD6AA76E-79B1-4A0C-9CEA-6CE09CCBDF9D}</Project>
<Name>SlnMesnac.LabelPrint.Log4net</Name>
</ProjectReference>
<ProjectReference Include="..\SlnMesnac.LabelPrint.Model\SlnMesnac.LabelPrint.Model.csproj">
<Project>{B68E5B08-F3E3-4AC0-A6ED-C31646956A0C}</Project>
<Name>SlnMesnac.LabelPrint.Model</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -0,0 +1,42 @@
using SlnMesnac.LabelPrint.Bartender.equip;
using SlnMesnac.LabelPrint.Common;
using SlnMesnac.LabelPrint.Log4net;
using SlnMesnac.LabelPrint.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlnMesnac.LabelPrint.BarTender.equip
{
public class GasLabelPrintEquip : PrintEquip
{
private readonly LogHelper logHelper = LogHelper.Instance;
private readonly JsonChange jsonChange = JsonChange.Instance;
public override bool AddPara()
{
var para = base.ParaClass as BaseLabelInfo;
if (para != null)
{
try
{
logHelper.Info($"打印标签信息:{jsonChange.ModeToJson(para)}");
base.EngineFormat.SubStrings["barcode"].Value = para.column_A.ToString();
return true;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return false;
}
}
else
{
return false;
}
}
}
}

@ -0,0 +1,37 @@
using SlnMesnac.LabelPrint.Common;
using SlnMesnac.LabelPrint.Log4net;
using SlnMesnac.LabelPrint.Model;
using System;
namespace SlnMesnac.LabelPrint.Bartender.equip
{
public class LabelPrintEquip : PrintEquip
{
private readonly LogHelper logHelper = LogHelper.Instance;
private readonly JsonChange jsonChange = JsonChange.Instance;
public override bool AddPara()
{
var para = base.ParaClass as BaseLabelInfo;
if (para != null)
{
try
{
logHelper.Info($"打印标签信息:{jsonChange.ModeToJson(para)}");
base.EngineFormat.SubStrings["barcode"].Value = para.column_A.ToString();
return true;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return false;
}
}
else
{
return false;
}
}
}
}

@ -0,0 +1,96 @@
using Seagull.BarTender.Print;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace SlnMesnac.LabelPrint.Bartender.equip
{
public abstract class PrintEquip
{
protected Engine engine = new Engine(true);
protected LabelFormatDocument EngineFormat;
public object ParaClass;
//模板名称
public string tempPath = "";
public string findModePath()
{
//string filePath =Common.Instance.TempBasePath;
//filePath = filePath + tempPath;
string filePath = tempPath;
Console.WriteLine("打印路径:" + filePath);
return filePath;
}
public abstract bool AddPara();
public bool Open()
{
bool result = false;
try
{
string modePath = findModePath();
if (File.Exists(modePath))
{
EngineFormat = engine.Documents.Open(modePath);
result = true;
Console.WriteLine("文件打开成功" + modePath);
}
else
{
Console.WriteLine("未找到文件" + modePath);
}
}
catch (Exception e)
{
Console.WriteLine("文件打开失败");
result = false;
}
return result;
}
public bool print()
{
bool result = false;
if (EngineFormat != null)
{
if (AddPara())
{
Result re = EngineFormat.Print();
result = re == Result.Success ? true : false;
string st = re == Result.Success ? "成功" : "失败";
Console.WriteLine("文件打印" + st + re.ToString());
}
else
{
Console.WriteLine("下传参数失败");
}
}
return result;
}
public void Colse()
{
try
{
EngineFormat.Close(SaveOptions.DoNotSaveChanges);//不保存对打开模板的修改
engine.Stop();
}
catch
{ }
}
}
}

@ -0,0 +1,112 @@
using Nancy.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SlnMesnac.LabelPrint.Log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlnMesnac.LabelPrint.Common
{
public class JsonChange
{
private static readonly Lazy<JsonChange> lazy = new Lazy<JsonChange>(() => new JsonChange());
public static JsonChange Instance
{
get
{
return lazy.Value;
}
}
private LogHelper log = LogHelper.Instance;
private JsonChange() { }
/// <summary>
/// Model 实体转json
/// </summary>
/// <param name="Model">可以是单个实体也可是实体集ToList()</param>
/// <returns></returns>
public string ModeToJson(object Model)
{
string str = "";
JavaScriptSerializer serializer = new JavaScriptSerializer();
try
{
str = serializer.Serialize(Model);
}
catch (Exception ex)
{
log.Error("Model转Json异常", ex);
}
return str;
}
/// <summary>
/// json实体转Model
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="jsonStr"></param>
/// <returns></returns>
public T JsonToMode<T>(string jsonStr)
{
T info = default(T);
JavaScriptSerializer serializer = new JavaScriptSerializer();
try
{
info = serializer.Deserialize<T>(jsonStr);
}
catch (Exception ex)
{
log.Error("Json转Model异常", ex);
}
return info;
}
/// <summary>
/// object转dictionary
/// </summary>
/// <param name="jsonData"></param>
/// <returns></returns>
public Dictionary<string, object> objectToDictionary(string jsonData)
{
Dictionary<string, object> result = new Dictionary<string, object>();
var inf = JsonConvert.DeserializeObject<Dictionary<string, object>>(jsonData);
foreach (KeyValuePair<string, object> item in inf)
{
if (item.Value != null)
{
var type = item.Value.GetType();
if (type == typeof(JObject))
{
var info = objectToDictionary(JsonConvert.SerializeObject(item.Value));
foreach (KeyValuePair<string, object> ite in info)
{
result.Add(ite.Key, ite.Value);
}
continue;
}
else if (type == typeof(JArray))
{
JArray array = (JArray)item.Value;
var info = objectToDictionary(JsonConvert.SerializeObject(array[0]));
foreach (KeyValuePair<string, object> ite in info)
{
result.Add(item.Key + ite.Key, ite.Value);
}
continue;
}
}
result.Add(item.Key, item.Value);
}
return result;
}
}
}

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("SlnMesnac.LabelPrint.Common")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SlnMesnac.LabelPrint.Common")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("7232269d-60af-45f0-b614-8f9c4061c529")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -0,0 +1,63 @@
<?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>{7232269D-60AF-45F0-B614-8F9C4061C529}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SlnMesnac.LabelPrint.Common</RootNamespace>
<AssemblyName>SlnMesnac.LabelPrint.Common</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Nancy, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.2.0.0\lib\net452\Nancy.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<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="JsonChange.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SlnMesnac.LabelPrint.Log4net\SlnMesnac.LabelPrint.Log4net.csproj">
<Project>{FD6AA76E-79B1-4A0C-9CEA-6CE09CCBDF9D}</Project>
<Name>SlnMesnac.LabelPrint.Log4net</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Nancy" version="2.0.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
</packages>

@ -0,0 +1,101 @@
using MiniExcelLibs;
using SlnMesnac.LabelPrint.Log4net;
using SlnMesnac.LabelPrint.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlnMesnac.LabelPrint.FileOperate
{
public class FileHelper
{
private readonly LogHelper logHelper = LogHelper.Instance;
#region 单例实现
private static readonly Lazy<FileHelper> lazy = new Lazy<FileHelper>(() => new FileHelper());
public static FileHelper Instance
{
get
{
return lazy.Value;
}
}
#endregion
private FileHelper() { }
/// <summary>
/// 读取Excel内容
/// </summary>
/// <param name="filePath"></param>
public List<BaseLabelInfo> ReadExceFile(string filePath)
{
List<BaseLabelInfo> result = null;
try
{
var sheetNames = MiniExcel.GetSheetNames(filePath);
if (sheetNames != null)
{
result = new List<BaseLabelInfo>();
foreach (string sheetName in sheetNames)
{
//根据sheet读取文档内容
List<dynamic> info = MiniExcel.Query(filePath, sheetName: sheetName).ToList();
if (info != null)
{
for (int i = 1; i < info.Count; i++)
{
//解析数据
dynamic labelDynamic = info[i];
BaseLabelInfo labelInfo = new BaseLabelInfo();
labelInfo.label = labelDynamic;
labelInfo.productType = sheetName;
if(labelDynamic.A == null)
{
continue;
}
labelInfo.column_A = labelDynamic.A;
if (sheetName == "Pallet")
{
labelInfo.recordTime = DateTime.Now;
result.Add(labelInfo);
continue;
}
labelInfo.column_B = labelDynamic.B;
labelInfo.column_C = labelDynamic.C;
labelInfo.column_D = labelDynamic.D;
labelInfo.column_E = labelDynamic.E;
if (sheetName == "Unit")
{
labelInfo.recordTime = DateTime.Now;
result.Add(labelInfo);
continue;
}
labelInfo.column_F = labelDynamic.F;
labelInfo.column_G = labelDynamic.G;
labelInfo.column_H = labelDynamic.H;
labelInfo.column_I = labelDynamic.I;
labelInfo.column_J = labelDynamic.J;
labelInfo.recordTime = DateTime.Now;
result.Add(labelInfo);
}
}
}
}
}
catch (Exception ex)
{
logHelper.Error("Excel文件读取异常", ex);
}
return result;
}
}
}

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("SlnMesnac.LabelPrint.FileOperate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SlnMesnac.LabelPrint.FileOperate")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("9358487f-5988-4839-bbe9-6755807ef339")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -0,0 +1,65 @@
<?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>{9358487F-5988-4839-BBE9-6755807EF339}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SlnMesnac.LabelPrint.FileOperate</RootNamespace>
<AssemblyName>SlnMesnac.LabelPrint.FileOperate</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="MiniExcel, Version=1.31.2.0, Culture=neutral, PublicKeyToken=e7310002a53eac39, processorArchitecture=MSIL">
<HintPath>..\packages\MiniExcel.1.31.2\lib\net45\MiniExcel.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<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="FileHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SlnMesnac.LabelPrint.Log4net\SlnMesnac.LabelPrint.Log4net.csproj">
<Project>{FD6AA76E-79B1-4A0C-9CEA-6CE09CCBDF9D}</Project>
<Name>SlnMesnac.LabelPrint.Log4net</Name>
</ProjectReference>
<ProjectReference Include="..\SlnMesnac.LabelPrint.Model\SlnMesnac.LabelPrint.Model.csproj">
<Project>{B68E5B08-F3E3-4AC0-A6ED-C31646956A0C}</Project>
<Name>SlnMesnac.LabelPrint.Model</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MiniExcel" version="1.31.2" targetFramework="net472" />
</packages>

@ -0,0 +1,147 @@
using log4net.Config;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlnMesnac.LabelPrint.Log4net
{
public class LogHelper
{
private static readonly Lazy<LogHelper> lazy = new Lazy<LogHelper>(() => new LogHelper());
public static LogHelper Instance
{
get
{
return lazy.Value;
}
}
private readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo");
private readonly log4net.ILog logerror = log4net.LogManager.GetLogger("logerror");
private readonly log4net.ILog logView = log4net.LogManager.GetLogger("viewlog");
private readonly log4net.ILog sqllog = log4net.LogManager.GetLogger("sqllog");
private readonly log4net.ILog semaphorelog = log4net.LogManager.GetLogger("semaphorelog");
private readonly log4net.ILog logPlc = log4net.LogManager.GetLogger("plclog");
private readonly log4net.ILog logRfid = log4net.LogManager.GetLogger("rfidlog");
/**
*
*
*/
//private readonly string fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log4net.config");
private readonly string fileName = "C:\\项目代码\\RFID标签打印项目\\SlnMesnac.LabelPrint\\SlnMesnac.LabelPrint.Log4net\\config\\log4net.config";
private LogHelper()
{
if (File.Exists(fileName))
{
XmlConfigurator.Configure(new FileInfo(fileName));
}
}
/// <summary>
/// 记录Info日志
/// </summary>
/// <param name="msg"></param>
/// <param name="ex"></param>
public void Info(string msg)
{
if (loginfo.IsInfoEnabled)
{
loginfo.Info(msg);
}
}
/// <summary>
/// 记录PLC日志
/// </summary>
/// <param name="msg"></param>
public void PlcLog(string msg)
{
if (logPlc.IsInfoEnabled)
{
logPlc.Info(msg);
}
}
/// <summary>
/// 记录Rfid日志
/// </summary>
/// <param name="msg"></param>
public void RfidLog(string msg)
{
if (logRfid.IsInfoEnabled)
{
logRfid.Info(msg);
}
}
/// <summary>
/// 界面日志
/// </summary>
/// <param name="msg"></param>
public void ViewLog(string msg)
{
if (logView.IsInfoEnabled)
{
logView.Info(msg);
}
}
public void SqlLog(string msg)
{
if (sqllog.IsInfoEnabled)
{
sqllog.Info(msg);
}
}
public void SemaphoreLog(string msg)
{
if (semaphorelog.IsInfoEnabled)
{
semaphorelog.Info(msg);
}
}
/// <summary>
/// 记录Error日志
/// </summary>
/// <param name="errorMsg"></param>
/// <param name="ex"></param>
public void Error(string info, Exception ex = null)
{
if (!string.IsNullOrEmpty(info) && ex == null)
{
logerror.ErrorFormat("【附加信息】 : {0}<br>", new object[] { info });
}
else if (!string.IsNullOrEmpty(info) && ex != null)
{
string errorMsg = BeautyErrorMsg(ex);
logerror.ErrorFormat("【附加信息】 : {0}<br>{1}", new object[] { info, errorMsg });
}
else if (string.IsNullOrEmpty(info) && ex != null)
{
string errorMsg = BeautyErrorMsg(ex);
logerror.Error(errorMsg);
}
}
/// <summary>
/// 美化错误信息
/// </summary>
/// <param name="ex">异常</param>
/// <returns>错误信息</returns>
private string BeautyErrorMsg(Exception ex)
{
string errorMsg = string.Format("【异常类型】:{0} <br>【异常信息】:{1} <br>【堆栈调用】:{2}", new object[] { ex.GetType().Name, ex.Message, ex.StackTrace });
errorMsg = errorMsg.Replace("\r\n", "<br>");
errorMsg = errorMsg.Replace("位置", "<strong style=\"color:red\">位置</strong>");
return errorMsg;
}
}
}

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("SlnMesnac.LabelPrint.Log4net")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SlnMesnac.LabelPrint.Log4net")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("fd6aa76e-79b1-4a0c-9cea-6ce09ccbdf9d")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -0,0 +1,57 @@
<?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>{FD6AA76E-79B1-4A0C-9CEA-6CE09CCBDF9D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SlnMesnac.LabelPrint.Log4net</RootNamespace>
<AssemblyName>SlnMesnac.LabelPrint.Log4net</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<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="LogHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="config\log4net.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="System.Configuration.IgnoreSectionHandler"/>
</configSections>
<appSettings>
</appSettings>
<log4net>
<!--错误日志类-->
<logger name="logerror">
<level value="ALL" />
<appender-ref ref="ErrorAppender" />
</logger>
<!--信息日志类-->
<logger name="loginfo">
<level value="ALL" />
<appender-ref ref="InfoAppender" />
</logger>
<!--PLC日志类-->
<logger name="plclog">
<level value="ALL" />
<appender-ref ref="PlcAppender" />
</logger>
<!--RFID日志类-->
<logger name="rfidlog">
<level value="ALL" />
<appender-ref ref="RfidAppender" />
</logger>
<!--RFID日志类-->
<logger name="viewlog">
<level value="ALL" />
<appender-ref ref="ViewAppender" />
</logger>
<!--Sql日志类-->
<logger name="sqllog">
<level value="ALL" />
<appender-ref ref="SqlAppender" />
</logger>
<!--信号量日志类-->
<logger name="semaphorelog">
<level value="ALL" />
<appender-ref ref="SemaphoreAppender" />
</logger>
<!--错误日志附加介质-->
<appender name="ErrorAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\" />
<param name="AppendToFile" value="true" />
<param name="MaxSizeRollBackups" value="100" />
<param name="MaxFileSize" value="10240" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value='yyyy-MM-dd/"LogError.html"'/>
<param name="RollingStyle" value="Date" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;HR COLOR=red&gt;%n异常时间%d [%t] &lt;BR&gt;%n异常级别%-5p &lt;BR&gt;%n异 常 类:%c [%x] &lt;BR&gt;%n%m &lt;BR&gt;%n &lt;HR Size=1&gt;" />
</layout>
</appender>
<!--信息日志附加介质-->
<appender name="InfoAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\" />
<param name="AppendToFile" value="true" />
<param name="MaxFileSize" value="10240" />
<param name="MaxSizeRollBackups" value="100" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value='yyyy-MM-dd/"LogInfo.txt"' />
<param name="RollingStyle" value="Date" />
<!--信息日志布局-->
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;--------------&gt;%n日志时间%d [%t] %n日志级别%-5p %n日志内容%m %n " />
</layout>
</appender>
<!--PLC日志附加介质-->
<appender name="PlcAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\" />
<param name="AppendToFile" value="true" />
<param name="MaxFileSize" value="10240" />
<param name="MaxSizeRollBackups" value="100" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value='yyyy-MM-dd/"PlcLog.txt"' />
<param name="RollingStyle" value="Date" />
<!--信息日志布局-->
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;--------------&gt;%n日志时间%d [%t] %n日志级别%-5p %n日志内容%m %n " />
</layout>
</appender>
<!--Rfid日志附加介质-->
<appender name="RfidAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\" />
<param name="AppendToFile" value="true" />
<param name="MaxFileSize" value="10240" />
<param name="MaxSizeRollBackups" value="100" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value='yyyy-MM-dd/"RfidLog.txt"' />
<param name="RollingStyle" value="Date" />
<!--信息日志布局-->
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;--------------&gt;%n日志时间%d [%t] %n日志级别%-5p %n日志内容%m %n " />
</layout>
</appender>
<appender name="ViewAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\" />
<param name="AppendToFile" value="true" />
<param name="MaxFileSize" value="10240" />
<param name="MaxSizeRollBackups" value="100" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value='yyyy-MM-dd/"ViewLog.txt"' />
<param name="RollingStyle" value="Date" />
<!--信息日志布局-->
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;--------------&gt;%n日志时间%d [%t] %n日志级别%-5p %n日志内容%m %n " />
</layout>
</appender>
<appender name="SqlAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\" />
<param name="AppendToFile" value="true" />
<param name="MaxFileSize" value="10240" />
<param name="MaxSizeRollBackups" value="100" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value='yyyy-MM-dd/"SqlLog.txt"' />
<param name="RollingStyle" value="Date" />
<!--信息日志布局-->
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;--------------&gt;%n日志时间%d [%t] %n日志级别%-5p %n日志内容%m %n " />
</layout>
</appender>
<appender name="SemaphoreAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\" />
<param name="AppendToFile" value="true" />
<param name="MaxFileSize" value="10240" />
<param name="MaxSizeRollBackups" value="100" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value='yyyy-MM-dd/"SemaphoreLog.txt"' />
<param name="RollingStyle" value="Date" />
<!--信息日志布局-->
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;--------------&gt;%n日志时间%d [%t] %n日志级别%-5p %n日志内容%m %n " />
</layout>
</appender>
</log4net>
</configuration>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.15" targetFramework="net472" />
</packages>

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlnMesnac.LabelPrint.Model
{
public class BaseLabelInfo
{
public dynamic label { get; set; }
/// <summary>
/// 产品类型
/// </summary>
public string productType { get; set; }
public object column_A { get; set; }
public object column_B { get; set; }
public object column_C { get; set; }
public object column_D { get; set; }
public object column_E { get; set; }
public object column_F { get; set; }
public object column_G { get; set; }
public object column_H { get; set; }
public object column_I { get; set; }
public object column_J { get; set; }
public DateTime recordTime { get; set; }
}
}

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("SlnMesnac.LabelPrint.Model")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SlnMesnac.LabelPrint.Model")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b68e5b08-f3e3-4ac0-a6ed-c31646956a0c")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -0,0 +1,48 @@
<?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>{B68E5B08-F3E3-4AC0-A6ED-C31646956A0C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SlnMesnac.LabelPrint.Model</RootNamespace>
<AssemblyName>SlnMesnac.LabelPrint.Model</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</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="BaseLabelInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("SlnMesnac.LabelPrint.TaskQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SlnMesnac.LabelPrint.TaskQueue")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("44b60510-5d95-4c48-949b-973b9b29dba6")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -0,0 +1,54 @@
<?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>{44B60510-5D95-4C48-949B-973B9B29DBA6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SlnMesnac.LabelPrint.TaskQueue</RootNamespace>
<AssemblyName>SlnMesnac.LabelPrint.TaskQueue</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</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="TaskHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SlnMesnac.LabelPrint.Model\SlnMesnac.LabelPrint.Model.csproj">
<Project>{B68E5B08-F3E3-4AC0-A6ED-C31646956A0C}</Project>
<Name>SlnMesnac.LabelPrint.Model</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -0,0 +1,68 @@
using SlnMesnac.LabelPrint.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlnMesnac.LabelPrint.TaskQueue
{
public class TaskHelper
{
#region 单例实现
private static readonly Lazy<TaskHelper> lazy = new Lazy<TaskHelper>(() => new TaskHelper());
public static TaskHelper Instance
{
get
{
return lazy.Value;
}
}
#endregion
#region 委托事件
/// <summary>
/// 清除标签信息
/// </summary>
/// <param name="message"></param>
public delegate void ClearLabelInfoDataGrid(BaseLabelInfo baseLabelInfo);
public event ClearLabelInfoDataGrid ClearLabelInfoDataGridEvent;
#endregion
public TaskHelper() { }
private List<BaseLabelInfo> labelTask = new List<BaseLabelInfo>();
/// <summary>
/// 添加标签任务
/// </summary>
/// <param name="labelInfos"></param>
public void AddTask(List<BaseLabelInfo> labelInfos)
{
if (labelInfos == null) return;
labelTask.AddRange(labelInfos);
}
/// <summary>
/// 获取标签任务,根据时间返回第一个不同的标签
/// </summary>
/// <returns></returns>
public BaseLabelInfo GetTask()
{
return labelTask.OrderBy(x => x.recordTime).FirstOrDefault();
}
/// <summary>
/// 删除标签任务,打印完成后删除队列中的任务
/// </summary>
/// <param name="item"></param>
public void RemoveTask(BaseLabelInfo item)
{
labelTask.Remove(item);
ClearLabelInfoDataGridEvent?.Invoke(item);
}
}
}

@ -0,0 +1,61 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.34031.81
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlnMesnac.LabelPrint", "SlnMesnac.LabelPrint\SlnMesnac.LabelPrint.csproj", "{B55D0578-0611-47D8-828B-81A3445C18A1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlnMesnac.LabelPrint.BarTender", "SlnMesnac.LabelPrint.BarTender\SlnMesnac.LabelPrint.BarTender.csproj", "{6A110611-3F4C-46C2-A981-23A0145B1E9F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlnMesnac.LabelPrint.Model", "SlnMesnac.LabelPrint.Model\SlnMesnac.LabelPrint.Model.csproj", "{B68E5B08-F3E3-4AC0-A6ED-C31646956A0C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlnMesnac.LabelPrint.FileOperate", "SlnMesnac.LabelPrint.FileOperate\SlnMesnac.LabelPrint.FileOperate.csproj", "{9358487F-5988-4839-BBE9-6755807EF339}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlnMesnac.LabelPrint.Common", "SlnMesnac.LabelPrint.Common\SlnMesnac.LabelPrint.Common.csproj", "{7232269D-60AF-45F0-B614-8F9C4061C529}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlnMesnac.LabelPrint.Log4net", "SlnMesnac.LabelPrint.Log4net\SlnMesnac.LabelPrint.Log4net.csproj", "{FD6AA76E-79B1-4A0C-9CEA-6CE09CCBDF9D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlnMesnac.LabelPrint.TaskQueue", "SlnMesnac.LabelPrint.TaskQueue\SlnMesnac.LabelPrint.TaskQueue.csproj", "{44B60510-5D95-4C48-949B-973B9B29DBA6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B55D0578-0611-47D8-828B-81A3445C18A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B55D0578-0611-47D8-828B-81A3445C18A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B55D0578-0611-47D8-828B-81A3445C18A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B55D0578-0611-47D8-828B-81A3445C18A1}.Release|Any CPU.Build.0 = Release|Any CPU
{6A110611-3F4C-46C2-A981-23A0145B1E9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A110611-3F4C-46C2-A981-23A0145B1E9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A110611-3F4C-46C2-A981-23A0145B1E9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A110611-3F4C-46C2-A981-23A0145B1E9F}.Release|Any CPU.Build.0 = Release|Any CPU
{B68E5B08-F3E3-4AC0-A6ED-C31646956A0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B68E5B08-F3E3-4AC0-A6ED-C31646956A0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B68E5B08-F3E3-4AC0-A6ED-C31646956A0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B68E5B08-F3E3-4AC0-A6ED-C31646956A0C}.Release|Any CPU.Build.0 = Release|Any CPU
{9358487F-5988-4839-BBE9-6755807EF339}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9358487F-5988-4839-BBE9-6755807EF339}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9358487F-5988-4839-BBE9-6755807EF339}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9358487F-5988-4839-BBE9-6755807EF339}.Release|Any CPU.Build.0 = Release|Any CPU
{7232269D-60AF-45F0-B614-8F9C4061C529}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7232269D-60AF-45F0-B614-8F9C4061C529}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7232269D-60AF-45F0-B614-8F9C4061C529}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7232269D-60AF-45F0-B614-8F9C4061C529}.Release|Any CPU.Build.0 = Release|Any CPU
{FD6AA76E-79B1-4A0C-9CEA-6CE09CCBDF9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FD6AA76E-79B1-4A0C-9CEA-6CE09CCBDF9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD6AA76E-79B1-4A0C-9CEA-6CE09CCBDF9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FD6AA76E-79B1-4A0C-9CEA-6CE09CCBDF9D}.Release|Any CPU.Build.0 = Release|Any CPU
{44B60510-5D95-4C48-949B-973B9B29DBA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44B60510-5D95-4C48-949B-973B9B29DBA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44B60510-5D95-4C48-949B-973B9B29DBA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44B60510-5D95-4C48-949B-973B9B29DBA6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {86E1A9DC-391D-43D2-8EE2-676C848A4990}
EndGlobalSection
EndGlobal

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

@ -0,0 +1,14 @@
<Application x:Class="SlnMesnac.LabelPrint.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SlnMesnac.LabelPrint"
StartupUri="MainWindow.xaml">
<Application.Resources>
<!--Button样式-->
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="templates/style/resourceStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace SlnMesnac.LabelPrint
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,93 @@
<Window x:Class="SlnMesnac.LabelPrint.MainWindow"
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:local="clr-namespace:SlnMesnac.LabelPrint"
mc:Ignorable="d"
Title="RFID 打印系统" Height="650" Width="1000" ResizeMode="NoResize" Topmost="False" Icon="Icon.png">
<!--<Window.Background>
<ImageBrush ImageSource="/templates/image/background.jpg" />
</Window.Background>-->
<Border Margin="5" Background="White" CornerRadius="10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderThickness="2" CornerRadius="5" Background="White" Margin="5,0,5,0">
<Border.Effect>
<DropShadowEffect Color="Gray" ShadowDepth="0" BlurRadius="5" Opacity="0.3" Direction="0"></DropShadowEffect>
</Border.Effect>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal">
<Button Content="导入文件" x:Name="instoreInfo" Command="{Binding ImportFilesCommand}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#007DFA" BorderBrush="#007DFA" Margin="10,0,10,0"/>
<Button Content="开始打印" x:Name="outstoreInfo" Command="{Binding StartPrintCommand}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009900" BorderBrush="#009900" Margin="0,0,10,0"/>
<Button Content="停止打印" x:Name="taskInfo" Command="{Binding StopPrintCommand}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#FF0033" BorderBrush="#FF0033" Margin="0,0,10,0"/>
</StackPanel>
</Border>
<Border Grid.Row="1" BorderThickness="2" CornerRadius="5" Background="White" Margin="5">
<Border.Effect>
<DropShadowEffect Color="Gray" ShadowDepth="0" BlurRadius="5" Opacity="0.3" Direction="0"></DropShadowEffect>
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="15*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="CadetBlue" BorderThickness="0,0,0,0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
<TextBlock Text="标签信息" FontSize="17" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<!--日志信息-->
<DataGrid Grid.Row="1" Name="DG" ItemsSource="{Binding LabelInfoDataGrid}" Background="Transparent"
FontSize="15" ColumnHeaderHeight="35"
RowHeight="31" AutoGenerateColumns="False" RowHeaderWidth="0"
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Visible"
ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False"
Foreground="#0288d1" >
<!--resourceStyle 399行修改选中字体颜色-->
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding productType}" Header="类型" Width="80" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding column_A}" Header="A" Width="150" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding column_B}" Header="B" Width="150" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding column_C}" Header="C" Width="150" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding column_D}" Header="D" Width="150" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding column_E}" Header="E" Width="150" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding column_F}" Header="F" Width="150" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding column_G}" Header="G" Width="150" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding column_H}" Header="H" Width="150" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding column_I}" Header="I" Width="150" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding column_J}" Header="J" Width="150" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding recordTime,StringFormat=\{0:MM月dd日 HH:mm\}}" Header="时间" Width="150" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
<!--日志信息-->
<Border Grid.Row="2" BorderThickness="2" CornerRadius="5" Background="White" Margin="5,0,5,0">
<Border.Effect>
<DropShadowEffect Color="Gray" ShadowDepth="0" BlurRadius="5" Opacity="0.3" Direction="0"></DropShadowEffect>
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2.5*"/>
<RowDefinition Height="9*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="CadetBlue" BorderThickness="0,0,0,0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
<TextBlock Text="打印日志" FontSize="17" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<!--日志信息-->
<Border Grid.Row="1" BorderBrush="Green" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1">
<ListBox x:Name="listBox" ItemsSource="{Binding LogInfoListBox}" FontSize="14" Foreground="Gray" Background="Transparent" BorderBrush="Transparent" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden"/>
</Border>
</Grid>
</Border>
</Grid>
</Border>
</Window>

@ -0,0 +1,32 @@
using SlnMesnac.LabelPrint.BarTender;
using SlnMesnac.LabelPrint.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 SlnMesnac.LabelPrint
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.DataContext = new MainWindowViewModel();
}
}
}

@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("SlnMesnac.LabelPrint")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SlnMesnac.LabelPrint")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
//若要开始生成可本地化的应用程序,请设置
//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
//例如,如果您在源文件中使用的是美国英语,
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
//对以下 NeutralResourceLanguage 特性的注释。 更新
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
//(未在页面中找到资源时使用,
//或应用程序资源字典中找到时使用)
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
//(未在页面中找到资源时使用,
//、应用程序或任何主题专用资源字典中找到时使用)
)]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -0,0 +1,70 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace SlnMesnac.LabelPrint.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SlnMesnac.LabelPrint.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SlnMesnac.LabelPrint.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

@ -0,0 +1,155 @@
<?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>{B55D0578-0611-47D8-828B-81A3445C18A1}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>SlnMesnac.LabelPrint</RootNamespace>
<AssemblyName>SlnMesnac.LabelPrint</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="CommonServiceLocator, Version=2.0.2.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
<HintPath>..\packages\CommonServiceLocator.2.0.2\lib\net47\CommonServiceLocator.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight, Version=5.4.1.0, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight.Extras, Version=5.4.1.0, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.4.1.0, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.5.4.1.1\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="viewModel\MainWindowViewModel.cs" />
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="templates\style\resourceStyle.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SlnMesnac.LabelPrint.BarTender\SlnMesnac.LabelPrint.BarTender.csproj">
<Project>{6A110611-3F4C-46C2-A981-23A0145B1E9F}</Project>
<Name>SlnMesnac.LabelPrint.BarTender</Name>
</ProjectReference>
<ProjectReference Include="..\SlnMesnac.LabelPrint.Common\SlnMesnac.LabelPrint.Common.csproj">
<Project>{7232269D-60AF-45F0-B614-8F9C4061C529}</Project>
<Name>SlnMesnac.LabelPrint.Common</Name>
</ProjectReference>
<ProjectReference Include="..\SlnMesnac.LabelPrint.FileOperate\SlnMesnac.LabelPrint.FileOperate.csproj">
<Project>{9358487F-5988-4839-BBE9-6755807EF339}</Project>
<Name>SlnMesnac.LabelPrint.FileOperate</Name>
</ProjectReference>
<ProjectReference Include="..\SlnMesnac.LabelPrint.Log4net\SlnMesnac.LabelPrint.Log4net.csproj">
<Project>{FD6AA76E-79B1-4A0C-9CEA-6CE09CCBDF9D}</Project>
<Name>SlnMesnac.LabelPrint.Log4net</Name>
</ProjectReference>
<ProjectReference Include="..\SlnMesnac.LabelPrint.Model\SlnMesnac.LabelPrint.Model.csproj">
<Project>{B68E5B08-F3E3-4AC0-A6ED-C31646956A0C}</Project>
<Name>SlnMesnac.LabelPrint.Model</Name>
</ProjectReference>
<ProjectReference Include="..\SlnMesnac.LabelPrint.TaskQueue\SlnMesnac.LabelPrint.TaskQueue.csproj">
<Project>{44B60510-5D95-4C48-949B-973B9B29DBA6}</Project>
<Name>SlnMesnac.LabelPrint.TaskQueue</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="templates\icon\Icon.png" />
<Resource Include="templates\image\background.jpg" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icon.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="2.0.2" targetFramework="net472" />
<package id="MvvmLightLibs" version="5.4.1.1" targetFramework="net472" />
</packages>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

@ -0,0 +1,424 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SlnMesnac.RfidPrint">
<Style x:Key="Window" TargetType="Window">
<Setter Property="WindowStyle" Value="None"/>
<Setter Property="AllowsTransparency" Value="True"/>
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style x:Key="BUTTON_MENUBAR" TargetType="Button">
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
<Grid Name="g" Opacity="0" Background="LightGray"/>
<Grid Name="grd" RenderTransformOrigin="0.5,0.5" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" VerticalAlignment="Center" HorizontalAlignment="Center" >
<Grid.RenderTransform>
<TransformGroup>
<!--<RotateTransform x:Name="rotate" Angle="0"-->
<ScaleTransform x:Name="scale" ScaleX="0.8" ScaleY="0.8"/>
</TransformGroup>
</Grid.RenderTransform>
</Grid>
<ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="0.2" Duration="0:0:0.2" Storyboard.TargetName="g" Storyboard.TargetProperty="Opacity" />
<DoubleAnimation To="1" Duration="0:0:0.2" Storyboard.TargetName="scale" Storyboard.TargetProperty="ScaleX" />
<DoubleAnimation To="1" Duration="0:0:0.2" Storyboard.TargetName="scale" Storyboard.TargetProperty="ScaleY" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="0" Duration="0:0:0.2" Storyboard.TargetName="g" Storyboard.TargetProperty="Opacity" />
<DoubleAnimation To="0.8" Duration="0:0:0.2" Storyboard.TargetName="scale" Storyboard.TargetProperty="ScaleX" />
<DoubleAnimation To="0.8" Duration="0:0:0.2" Storyboard.TargetName="scale" Storyboard.TargetProperty="ScaleY" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="BUTTON_MENUBAR_PATH" TargetType="Button">
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Foreground" Value="Gray" />
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="Auto"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
<Grid Name="g" Background="LightGray" Opacity="0" />
<Grid Name="grd" Width="22" Height="22" Background="{TemplateBinding Background}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" />
<Path Width="10" Height="30" HorizontalAlignment="Right" VerticalAlignment="Center" Data="M3,10 L7,15 L3,20" Stroke="Gray" StrokeThickness="1"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="0.4" Duration="0:0:0.2" Storyboard.TargetName="g" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation Duration="0:0:0.2" Storyboard.TargetName="g" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="BUTTON_MENUBAR_MINI" TargetType="Button">
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" ClipToBounds="True">
<Border Name="bdr" BorderBrush="LightGray" BorderThickness="2" Opacity="0">
<Border.Effect>
<DropShadowEffect x:Name="effect" BlurRadius="20" Opacity="0.8" ShadowDepth="0" Color="LightGray"/>
</Border.Effect>
</Border>
<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" VerticalAlignment="Center" HorizontalAlignment="Center" >
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="1" Duration="0:0:0.3" Storyboard.TargetName="bdr" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="0" Duration="0:0:0.3" Storyboard.TargetName="bdr" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="BUTTON_AGREE" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Name="bdr" CornerRadius="3" Opacity="1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1">
<!--可使用ContentPresenter代替-->
<!--Foreground的值White可以替换为{TemplateBinding Foreground}-->
<Label VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Foreground="White" Content="{TemplateBinding Content}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="0.6" Duration="0:0:0.2" Storyboard.TargetName="bdr" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="1" Duration="0:0:0.2" Storyboard.TargetName="bdr" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="BUTTON_DISAGREE" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border CornerRadius="3" BorderBrush="#FFEBEBEB" BorderThickness="1">
<Grid>
<Border Name="bdr" CornerRadius="3" Background="Gray" Opacity="0"/>
<Label VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Foreground="{TemplateBinding Foreground}" Content="{TemplateBinding Content}"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="0.2" Duration="0:0:0.2" Storyboard.TargetName="bdr" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="0" Duration="0:0:0.2" Storyboard.TargetName="bdr" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<SolidColorBrush x:Key="SOLIDCOLORBRUSH_LIGHT" Color="#FF6FD1FF"/>
<Color x:Key="COLOR_LIGHT" R="111" G="209" B="255" A="255" />
<Style x:Key="BUTTON_ELLIPSE" TargetType="{x:Type Button}">
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="ToolTip" Value="下一步"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border CornerRadius="15" Width="30" Height="30" Background="{DynamicResource SOLIDCOLORBRUSH_LIGHT}">
<Border.Effect>
<DropShadowEffect x:Name="effect" BlurRadius="7" Opacity="0.6" ShadowDepth="0" Color="{DynamicResource COLOR_LIGHT}"/>
</Border.Effect>
<Grid>
<Path Name="path" HorizontalAlignment="Left" Margin="0,0,0,0" Data="M5,15 L 15,23 L24,9" Stroke="White" StrokeThickness="1"/>
<Path Name="path2" HorizontalAlignment="Left" Opacity="0" Margin="0,0,0,0" Data="M5,15 H25 L17,7 M25,15 L17,22 " Stroke="White" StrokeThickness="1"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation To="0.9" Duration="0:0:0.3" Storyboard.TargetName="effect" Storyboard.TargetProperty="Opacity" />
<DoubleAnimation To="15" Duration="0:0:0.3" Storyboard.TargetName="effect" Storyboard.TargetProperty="BlurRadius" />
<DoubleAnimation To="0" Duration="0:0:0.5" Storyboard.TargetName="path" Storyboard.TargetProperty="Opacity" />
<DoubleAnimation To="1" Duration="0:0:0.5" BeginTime="0:0:0.3" Storyboard.TargetName="path2" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard >
<Storyboard>
<DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="effect" Storyboard.TargetProperty="Opacity" />
<DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="effect" Storyboard.TargetProperty="BlurRadius" />
<DoubleAnimation Duration="0:0:0.5" BeginTime="0:0:0.3" Storyboard.TargetName="path" Storyboard.TargetProperty="Opacity" />
<DoubleAnimation Duration="0:0:0.5" Storyboard.TargetName="path2" Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--DataGrid样式-->
<Style TargetType="{x:Type DataGrid}">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="BorderBrush" Value="#FF688CAF"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="RowDetailsVisibilityMode" Value="VisibleWhenSelected"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="AutoGenerateColumns" Value="False"/>
<Setter Property="ColumnHeaderHeight" Value="50"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="RowHeight" Value="50"/>
<Setter Property="AlternationCount" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGrid}">
<Grid>
<Border Background="Transparent" CornerRadius="0">
<Border.Effect>
<DropShadowEffect ShadowDepth="0" Direction="0" Color="#FFDADADA"/>
</Border.Effect>
</Border>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
<ScrollViewer x:Name="DG_ScrollViewer" Focusable="false">
<ScrollViewer.Template>
<ControlTemplate TargetType="{x:Type ScrollViewer}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Background="Transparent" Grid.Column="1">
<Grid.Effect>
<DropShadowEffect Direction="270" Color="#FFF3F3F3"/>
</Grid.Effect>
</Grid>
<Button Command="{x:Static DataGrid.SelectAllCommand}" Focusable="false" Style="{DynamicResource {ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}}" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
<DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter" Grid.Column="1" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Column}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" Grid.ColumnSpan="2" Grid.Row="1"/>
<ScrollBar x:Name="PART_VerticalScrollBar" Grid.Column="2" Maximum="{TemplateBinding ScrollableHeight}" Orientation="Vertical" Grid.Row="1" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
<Grid Grid.Column="1" Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding NonFrozenColumnsViewportHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ScrollBar x:Name="PART_HorizontalScrollBar" Grid.Column="1" Maximum="{TemplateBinding ScrollableWidth}" Orientation="Horizontal" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
</Grid>
</Grid>
</ControlTemplate>
</ScrollViewer.Template>
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</ScrollViewer>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="true"/>
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
</MultiTrigger>
</Style.Triggers>
</Style>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
<Grid Background="{TemplateBinding Background}">
<!--<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>-->
<ContentPresenter Margin="20 0 0 0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
<!--<TextBlock Grid.Column="1" x:Name="SortArrow" Visibility="Visible" VerticalAlignment="Center" FontFamily="/DataGrid;component/Fonts/#FontAwesome"/>-->
</Grid>
<!--<ControlTemplate.Triggers>
<Trigger Property="SortDirection" Value="Ascending">
<Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
<Setter TargetName="SortArrow" Property="Text" Value="&#xf160;" />
</Trigger>
<Trigger Property="SortDirection" Value="Descending">
<Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
<Setter TargetName="SortArrow" Property="Text" Value="&#xf161;" />
</Trigger>
</ControlTemplate.Triggers>-->
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="DataGridRow">
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template" >
<Setter.Value>
<ControlTemplate TargetType="DataGridRow">
<Grid >
<Border x:Name="border" Background="{TemplateBinding Background}" BorderThickness="1" BorderBrush="Transparent"/>
<DataGridCellsPresenter />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" TargetName="border" Value="#00BCD4"/>
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="#00BCD4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex"
Value="0">
<Setter Property="Background" Value="Transparent" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex"
Value="1">
<Setter Property="Background" Value="Transparent" />
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="DataGridCell">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridCell">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Foreground" Value="Gray" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--TextBox样式-->
<Style TargetType="{x:Type TextBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border BorderThickness="1" Width="auto" Height="auto" BorderBrush="CadetBlue">
<Grid x:Name="grid" Background="Transparent">
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Center"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--RadioButton样式-->
</ResourceDictionary>

@ -0,0 +1,216 @@

using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Microsoft.Win32;
using SlnMesnac.LabelPrint.BarTender;
using SlnMesnac.LabelPrint.Common;
using SlnMesnac.LabelPrint.FileOperate;
using SlnMesnac.LabelPrint.Log4net;
using SlnMesnac.LabelPrint.Model;
using SlnMesnac.LabelPrint.TaskQueue;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
namespace SlnMesnac.LabelPrint.viewModel
{
public class MainWindowViewModel: ViewModelBase
{
private readonly LogHelper logHelper = LogHelper.Instance;
private readonly FileHelper fileHelper = FileHelper.Instance;
private readonly TaskHelper taskHelper = TaskHelper.Instance;
private readonly JsonChange jsonChange = JsonChange.Instance;
private readonly PrintManager printManager = PrintManager.Instance;
private ObservableCollection<dynamic> listItems = new ObservableCollection<dynamic>();
private ObservableCollection<BaseLabelInfo> labelItems = new ObservableCollection<BaseLabelInfo>();
#region 参数定义
/// <summary>
/// 日志打印ListBox
/// </summary>
private IEnumerable logInfoListBox;
public IEnumerable LogInfoListBox
{
get { return logInfoListBox; }
set { logInfoListBox = value; RaisePropertyChanged(() => LogInfoListBox); }
}
/// <summary>
/// 标签信息DataGrid
/// </summary>
private IEnumerable labelInfoDataGrid;
public IEnumerable LabelInfoDataGrid
{
get { return labelInfoDataGrid; }
set { labelInfoDataGrid = value; RaisePropertyChanged(() => LabelInfoDataGrid); }
}
#endregion
#region 事件定义
/// <summary>
/// 导入文件
/// </summary>
public RelayCommand ImportFilesCommand { get; set; }
/// <summary>
/// 开始打印
/// </summary>
public RelayCommand StartPrintCommand { get; set; }
/// <summary>
/// 停止打印
/// </summary>
public RelayCommand StopPrintCommand { get; set; }
#endregion
public MainWindowViewModel()
{
logHelper.Info("初始化成功!!!");
try
{
taskHelper.ClearLabelInfoDataGridEvent += ClearLabelInfoDataGrid;
ImportFilesCommand = new RelayCommand(ImportFile);
StartPrintCommand = new RelayCommand(StartPrint);
StopPrintCommand = new RelayCommand(StopPrint);
}catch(Exception ex)
{
logHelper.Error("初始化事件绑定异常", ex);
}
}
/// <summary>
/// 导入文件事件实现
/// </summary>
private void ImportFile()
{
try
{
string fileName = "";
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Multiselect = true; //该值确定是否可以选择多个文件
openFileDialog.Title = "请选择文件"; //弹窗的标题
openFileDialog.InitialDirectory = "D:\\"; //默认打开的文件夹的位置
openFileDialog.Filter = "MicroSoft Excel文件(*.xlsx)|*.xlsx|所有文件(*.*)|*.*"; //筛选文件
if (openFileDialog.ShowDialog() == true)
{
fileName = openFileDialog.FileName;
PrintMessageToListBox($"文件上传成功,路径:{fileName}");
//读取Excel内容
List<BaseLabelInfo> labelInfos = fileHelper.ReadExceFile(fileName);
RefreshLabelInfoDataGrid(labelInfos);
Thread.Sleep(1000);
PrintMessageToListBox($"文件解析完成:{jsonChange.ModeToJson(labelInfos)}");
taskHelper.AddTask(labelInfos);
}
}catch(Exception ex)
{
this.PrintMessageToListBox($"导入文件事件实现异常:{ex.Message}");
}
}
/// <summary>
/// 开始打印事件实现
/// </summary>
private void StartPrint()
{
var info = taskHelper.GetTask();
if(info == null)
{
this.PrintMessageToListBox("未获取到需要打印的任务");
}
else
{
this.PrintMessageToListBox($"开始打印标签信息:{jsonChange.ModeToJson(info)}");
if (info.column_A == null)
{
this.PrintMessageToListBox($"{info.productType}打印任务执行失败A列数据为空");
return;
}
var printResult = printManager.Print(info);
if (printResult)
{
this.PrintMessageToListBox($"{info.productType}打印{info.column_A.ToString()};打印成功");
}
else
{
this.PrintMessageToListBox($"{info.column_A.ToString()};打印失败");
}
taskHelper.RemoveTask(info);
}
}
/// <summary>
/// 停止打印事件实现
/// </summary>
private void StopPrint()
{
this.PrintMessageToListBox("停止打印事件实现");
}
/// <summary>
/// 加载标签信息DataGrid
/// </summary>
/// <param name="labelInfos"></param>
private void RefreshLabelInfoDataGrid(List<BaseLabelInfo> labelInfos)
{
if (labelInfos == null) return;
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
labelItems = new ObservableCollection<BaseLabelInfo>();
foreach (var item in labelInfos)
{
labelItems.Add(item);
}
LabelInfoDataGrid = labelItems;
}));
}
/// <summary>
/// 打印完成后回调该函数
/// </summary>
/// <param name="labelInfo"></param>
private void ClearLabelInfoDataGrid(BaseLabelInfo labelInfo)
{
if (labelInfo == null) return;
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
labelItems.Remove(labelInfo);
LabelInfoDataGrid = labelItems;
}));
}
/// <summary>
/// listBox绑定日志
/// </summary>
/// <param name="message"></param>
private void PrintMessageToListBox(string message)
{
try
{
listItems.Add($"{DateTime.Now.ToString("HH:mm:ss")}==>{message}");
LogInfoListBox = listItems.OrderByDescending(x => x);
}
catch (Exception ex)
{
logHelper.Error("日志数据绑定异常", ex);
}
}
}
}
Loading…
Cancel
Save