first commit
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Library</OutputType>
|
||||
<UseWPF>True</UseWPF>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Converters\**" />
|
||||
<Compile Remove="Events\**" />
|
||||
<EmbeddedResource Remove="Converters\**" />
|
||||
<EmbeddedResource Remove="Events\**" />
|
||||
<None Remove="Converters\**" />
|
||||
<None Remove="Events\**" />
|
||||
<Page Remove="Converters\**" />
|
||||
<Page Remove="Events\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FastReport.DataVisualization" Version="2021.3.0" />
|
||||
<PackageReference Include="HandyControl" Version="3.3.0" />
|
||||
<PackageReference Include="Prism.Core" Version="8.1.97" />
|
||||
<PackageReference Include="Prism.Unity" Version="8.1.97" />
|
||||
<PackageReference Include="Prism.Wpf" Version="8.1.97" />
|
||||
<PackageReference Include="System.Reactive.Linq" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\JSMachine.WMS.Common\JSMachine.WMS.Common.csproj" />
|
||||
<ProjectReference Include="..\JSMachine.WMS.Job\JSMachine.WMS.Job.csproj" />
|
||||
<ProjectReference Include="..\JSMachine.WMS.PLC\JSMachine.WMS.PLC.csproj" />
|
||||
<ProjectReference Include="..\Server.MqttClient\JSMachine.WMS.Mqtt.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Views\PaperStorageView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="Views\HomePage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="Views\HomePage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Rx\" />
|
||||
<Folder Include="Utils\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FastReport">
|
||||
<HintPath>..\JSMachine.WMS.FastReport\RefDll\FastReport.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsFormsIntegration">
|
||||
<HintPath>..\JSMachine.WMS.FastReport\RefDll\WindowsFormsIntegration.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Page Update="Views\HomePage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\PaperStorageView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)]
|
||||
|
||||
// 在此类的 SDK 样式项目中,现在,在此文件中早前定义的几个程序集属性将在生成期间自动添加,并使用在项目属性中定义的值进行填充。有关包含的属性以及如何定制此过程的详细信息,请参阅
|
||||
// https://aka.ms/assembly-info-properties
|
||||
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,请将该类型的 ComVisible
|
||||
// 属性设置为 true。
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID。
|
||||
|
||||
[assembly: Guid("2bbd81df-737d-4886-b9f5-612a10d89b46")]
|
||||
@@ -0,0 +1,216 @@
|
||||
using JSMachine.WMS.Storage.BusinessModules.Views;
|
||||
using JSMachine.WMS.Common.Mvvm;
|
||||
using Unity;
|
||||
using static JSMachine.WMS.Common.EventBus.GlobalEventBus;
|
||||
using JSMachine.WMS.App.Dto;
|
||||
|
||||
namespace JSMachine.WMS.Storage.BusinessModules.ViewModels
|
||||
{
|
||||
public class HomePageViewModel : ViewModelBase, IViewLoadedAndUnloadedAware<HomePage>
|
||||
{
|
||||
HomePage _homePage;
|
||||
|
||||
public HomePageViewModel(IUnityContainer container) : base(container)
|
||||
{
|
||||
}
|
||||
|
||||
public void OnLoaded(HomePage view)
|
||||
{
|
||||
_homePage = view;
|
||||
//base.OnLoaded(view);
|
||||
view.Page_Change.Content = new PaperStorageView();
|
||||
EventAggregator.GetEvent<DeviceConnectionEvent>().Subscribe(UpdateDeviceConnectState);
|
||||
}
|
||||
|
||||
public void OnUnloaded(HomePage view)
|
||||
{
|
||||
}
|
||||
#region PLC通讯状态
|
||||
/// <summary>
|
||||
/// PLC通讯状态-连接
|
||||
/// </summary>
|
||||
private bool _plcConected;
|
||||
public bool PLCConected
|
||||
{
|
||||
get => _plcConected;
|
||||
set => SetProperty(ref _plcConected, value);
|
||||
}
|
||||
|
||||
private bool _plcVisible;
|
||||
public bool PLCVisible
|
||||
{
|
||||
get => _plcVisible;
|
||||
set => SetProperty(ref _plcVisible, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DB通讯状态
|
||||
/// <summary>
|
||||
/// DB通讯状态-连接
|
||||
/// </summary>
|
||||
private bool _dbConected;
|
||||
public bool DBConected
|
||||
{
|
||||
get => _dbConected;
|
||||
set => SetProperty(ref _dbConected, value);
|
||||
}
|
||||
private bool _dbVisible;
|
||||
public bool DBVisible
|
||||
{
|
||||
get => _dbVisible;
|
||||
set => SetProperty(ref _dbVisible, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CodeScnner通讯状态
|
||||
/// <summary>
|
||||
/// CS1通讯状态-连接
|
||||
/// </summary>
|
||||
private bool _cs1Conected;
|
||||
public bool CS1Conected
|
||||
{
|
||||
get => _cs1Conected;
|
||||
set => SetProperty(ref _cs1Conected, value);
|
||||
}
|
||||
private bool _cs1Visible;
|
||||
public bool CS1Visible
|
||||
{
|
||||
get => _cs1Visible;
|
||||
set => SetProperty(ref _cs1Visible, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// CS2通讯状态
|
||||
/// </summary>
|
||||
private bool _cs2Conected;
|
||||
public bool CS2Conected
|
||||
{
|
||||
get => _cs2Conected;
|
||||
set => SetProperty(ref _cs2Conected, value);
|
||||
}
|
||||
private bool _cs2Visible;
|
||||
public bool CS2Visible
|
||||
{
|
||||
get => _cs2Visible;
|
||||
set => SetProperty(ref _cs2Visible, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ERP通讯状态
|
||||
/// <summary>
|
||||
/// ERP通讯状态-连接
|
||||
/// </summary>
|
||||
private bool _erpConected;
|
||||
public bool ERPConected
|
||||
{
|
||||
get => _erpConected;
|
||||
set => SetProperty(ref _erpConected, value);
|
||||
}
|
||||
private bool _erpVisible;
|
||||
public bool ERPVisible
|
||||
{
|
||||
get => _erpVisible;
|
||||
set => SetProperty(ref _erpVisible, value);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region ACS通讯状态
|
||||
/// <summary>
|
||||
/// ACS通讯状态-连接
|
||||
/// </summary>
|
||||
private bool _acsConected;
|
||||
public bool ACSConected
|
||||
{
|
||||
get => _acsConected;
|
||||
set => SetProperty(ref _acsConected, value);
|
||||
}
|
||||
private bool _acsVisible;
|
||||
public bool ACSVisible
|
||||
{
|
||||
get => _acsVisible;
|
||||
set => SetProperty(ref _acsVisible, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WeighBridge通讯状态
|
||||
/// <summary>
|
||||
/// 地磅通讯状态-连接
|
||||
/// </summary>
|
||||
private bool _wbConected;
|
||||
public bool WBConected
|
||||
{
|
||||
get => _wbConected;
|
||||
set => SetProperty(ref _wbConected, value);
|
||||
}
|
||||
private bool _wbVisible;
|
||||
public bool WBVisible
|
||||
{
|
||||
get => _wbVisible;
|
||||
set => SetProperty(ref _wbVisible, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 印贴一体机通讯状态
|
||||
/// <summary>
|
||||
/// 印贴一体机通讯状态-连接
|
||||
/// </summary>
|
||||
private bool _printConected;
|
||||
public bool PrintConected
|
||||
{
|
||||
get => _printConected;
|
||||
set => SetProperty(ref _printConected, value);
|
||||
}
|
||||
private bool _printVisible;
|
||||
public bool PrintVisible
|
||||
{
|
||||
get => _printVisible;
|
||||
set => SetProperty(ref _printVisible, value);
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// 设备连接事件
|
||||
/// </summary>
|
||||
/// <param name = "deviceStateDto" ></ param >
|
||||
private void UpdateDeviceConnectState(DeviceStateDto deviceStateDto)
|
||||
{
|
||||
#region PLCState
|
||||
PLCConected = deviceStateDto.PLCConected;
|
||||
PLCVisible = deviceStateDto.PLCVisible;
|
||||
#endregion
|
||||
#region DBState
|
||||
DBConected = deviceStateDto.DBConected;
|
||||
DBVisible = deviceStateDto.DBVisible;
|
||||
#endregion
|
||||
#region CS1State
|
||||
CS1Conected = deviceStateDto.CS1Conected;
|
||||
CS1Visible = deviceStateDto.CS1Visible;
|
||||
#endregion
|
||||
#region CS2State
|
||||
CS2Conected = deviceStateDto.CS2Conected;
|
||||
CS2Visible = deviceStateDto.CS2Visible;
|
||||
#endregion
|
||||
#region ERPState
|
||||
ERPConected = deviceStateDto.ERPConected;
|
||||
ERPVisible = deviceStateDto.ERPVisible;
|
||||
#endregion
|
||||
#region ACState
|
||||
ACSConected = deviceStateDto.ACSConected;
|
||||
ACSVisible = deviceStateDto.ACSVisible;
|
||||
#endregion
|
||||
#region WBState
|
||||
WBConected = deviceStateDto.WBConected;
|
||||
WBVisible = deviceStateDto.WBVisible;
|
||||
#endregion
|
||||
#region PrintState
|
||||
PrintConected = deviceStateDto.PrintConected;
|
||||
PrintVisible = deviceStateDto.PrintVisible;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,403 @@
|
||||
using FastReport;
|
||||
using HandyControl.Controls;
|
||||
using JSMachine.WMS.App.Dto;
|
||||
using JSMachine.WMS.App.Dto.Enum;
|
||||
using JSMachine.WMS.App.IService;
|
||||
using JSMachine.WMS.Common;
|
||||
using JSMachine.WMS.Common.Globalization;
|
||||
using JSMachine.WMS.Common.Mvvm;
|
||||
using JSMachine.WMS.Domain.Entity;
|
||||
using JSMachine.WMS.Infrastructure.Extensions;
|
||||
using JSMachine.WMS.Infrastructure.Helper;
|
||||
using JSMachine.WMS.Storage.BusinessModules.Views;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using SqlSugar;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Unity;
|
||||
using static JSMachine.WMS.Common.EventBus.GlobalEventBus;
|
||||
using static JSMachine.WMS.Common.EventBus.JobEvent;
|
||||
|
||||
namespace JSMachine.WMS.Storage.BusinessModules.ViewModels
|
||||
{
|
||||
public class PaperStorageViewModel : ViewModelBase, IViewLoadedAndUnloadedAware<PaperStorageView>
|
||||
{
|
||||
#region Command
|
||||
|
||||
/// <summary>
|
||||
/// 自动打印标签
|
||||
/// </summary>
|
||||
public ICommand IAtuoPrintCmd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手动打印标签
|
||||
/// </summary>
|
||||
public ICommand IHandPrintCmd { get; set; }
|
||||
|
||||
#endregion Command
|
||||
|
||||
#region Search Condition
|
||||
|
||||
private DateTime? _startTime;
|
||||
|
||||
/// <summary>
|
||||
/// 订单开始时间起点
|
||||
/// </summary>
|
||||
public DateTime? StartTime
|
||||
{
|
||||
get => _startTime;
|
||||
set => SetProperty(ref _startTime, value);
|
||||
}
|
||||
|
||||
private DateTime? _endTime;
|
||||
|
||||
/// <summary>
|
||||
/// 订单结束时间终点
|
||||
/// </summary>
|
||||
public DateTime? EndTime
|
||||
{
|
||||
get => _endTime;
|
||||
set => SetProperty(ref _endTime, value);
|
||||
}
|
||||
|
||||
private string _paperLabel;
|
||||
|
||||
/// <summary>
|
||||
/// 原纸卷标
|
||||
/// </summary>
|
||||
public string PaperLabel
|
||||
{
|
||||
get => _paperLabel;
|
||||
set => SetProperty(ref _paperLabel, value);
|
||||
}
|
||||
|
||||
private string _supplier;
|
||||
|
||||
/// <summary>
|
||||
/// 供应商
|
||||
/// </summary>
|
||||
public string Supplier
|
||||
{
|
||||
get => _supplier;
|
||||
set => SetProperty(ref _supplier, value);
|
||||
}
|
||||
|
||||
private string _paperCode;
|
||||
|
||||
/// <summary>
|
||||
/// 纸质
|
||||
/// </summary>
|
||||
public string PaperCode
|
||||
{
|
||||
get => _paperCode;
|
||||
set => SetProperty(ref _paperCode, value);
|
||||
}
|
||||
|
||||
private string _paperWidth;
|
||||
|
||||
/// <summary>
|
||||
/// 门幅
|
||||
/// </summary>
|
||||
public string PaperWidth
|
||||
{
|
||||
get => _paperWidth;
|
||||
set => SetProperty(ref _paperWidth, value);
|
||||
}
|
||||
|
||||
#endregion Search Condition
|
||||
|
||||
#region DataSource
|
||||
|
||||
private List<PaperNewStockInDto> _paperNewStockIns;
|
||||
|
||||
/// <summary>
|
||||
/// 新卷入库数据集合
|
||||
/// </summary>
|
||||
public List<PaperNewStockInDto> PaperNewStockIns
|
||||
{
|
||||
get { return _paperNewStockIns; }
|
||||
set { SetProperty(ref _paperNewStockIns, value); }
|
||||
}
|
||||
|
||||
private PaperNewStockInDto _selectedPaperNewStockIn;
|
||||
|
||||
/// <summary>
|
||||
/// 当前选中新卷入库信息
|
||||
/// </summary>
|
||||
public PaperNewStockInDto SelectedPaperNewStockIn
|
||||
{
|
||||
get { return _selectedPaperNewStockIn; }
|
||||
set { SetProperty(ref _selectedPaperNewStockIn, value); }
|
||||
}
|
||||
|
||||
#endregion DataSource
|
||||
|
||||
#region Page Search Condition
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询条件
|
||||
/// </summary>
|
||||
private PageQueryConditionDto _pageQueryCondtion = new()
|
||||
{
|
||||
CurrentPage = 1,
|
||||
PageSize = 11,
|
||||
OrderByFiled = nameof(PaperNewStockInDto.CreationTime),
|
||||
OrderByType = OrderByType.Asc,
|
||||
Filters = new()
|
||||
};
|
||||
|
||||
#endregion Page Search Condition
|
||||
|
||||
#region Structure Function
|
||||
|
||||
private IPaperNewStockInService _paperNewStockInService;
|
||||
private IEventAggregator _eventAggregator;
|
||||
|
||||
public PaperStorageViewModel(IUnityContainer container, IPaperNewStockInService paperNewStockInService, IEventAggregator eventAggregator) : base(container)
|
||||
{
|
||||
IAtuoPrintCmd = new DelegateCommand(OnAutoPrint);
|
||||
IHandPrintCmd = new DelegateCommand(OnHandPrint);
|
||||
_paperNewStockInService = paperNewStockInService;
|
||||
_eventAggregator = eventAggregator;
|
||||
StartTime = DateTime.Now.GetTodayBegin();
|
||||
EndTime = DateTime.Now.GetTodayEnd();
|
||||
_eventAggregator.GetEvent<PaperStorageBaseDataEvent>().Subscribe(OnSearchClick); //自动写入新卷入库之后,自动刷新页面
|
||||
}
|
||||
|
||||
#endregion Structure Function
|
||||
|
||||
/// <summary>
|
||||
/// 自动打印
|
||||
/// </summary>
|
||||
private async void OnAutoPrint()
|
||||
{
|
||||
try
|
||||
{
|
||||
//未打印的记录
|
||||
PaperNewStockIns = await _paperNewStockInService.GetListByExpression(p => p.PrintState == 0);
|
||||
if (!PaperNewStockIns.Any())
|
||||
{
|
||||
Growl.Error("没有需要自动打印的标签", PaperMesConst.MainWindow);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Report fPrewControlReport = new Report();//报表预览
|
||||
foreach (var item in PaperNewStockIns)
|
||||
{
|
||||
LoadFrxAndData(fPrewControlReport, Environment.CurrentDirectory + Global.AppSettings.LabelReportFilePathStr);
|
||||
fPrewControlReport.SetParameterValue("companyname", "京山轻机");
|
||||
fPrewControlReport.SetParameterValue("papercode", item.PaperCode);
|
||||
fPrewControlReport.SetParameterValue("supplier", item.Supplier);
|
||||
fPrewControlReport.SetParameterValue("paperwidth", item.PaperWidth);
|
||||
fPrewControlReport.SetParameterValue("weight", Convert.ToInt32(item.InWeight));
|
||||
fPrewControlReport.SetParameterValue("paperlabel", item.PaperLabel);
|
||||
fPrewControlReport.SetParameterValue("paperlength", Convert.ToInt32(item.MeterLength));
|
||||
fPrewControlReport.SetParameterValue("unitweight", item.PaperUnitWeight);
|
||||
FastReport.Utils.Config.ReportSettings.ShowProgress = false;
|
||||
fPrewControlReport.PrintSettings.Printer = "Doro PDF Writer";
|
||||
fPrewControlReport.PrintSettings.ShowDialog = false;
|
||||
fPrewControlReport.Print();
|
||||
}
|
||||
await GetPageData(1);
|
||||
//更新自动打印时间
|
||||
await Task.Delay(500).ContinueWith(async task =>
|
||||
{
|
||||
foreach (var item in PaperNewStockIns)
|
||||
{
|
||||
item.PrintTime = DateTime.Now;
|
||||
item.PrintState = 1;
|
||||
}
|
||||
await _paperNewStockInService.EditBatch(PaperNewStockIns);
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"新卷入库:自动打印标签出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 载入报表路径和报表数据
|
||||
/// </summary>
|
||||
private void LoadFrxAndData(FastReport.Report report, string filePathStr)
|
||||
{
|
||||
//1 编辑指定路径下的frx,先load frx
|
||||
report.Load(filePathStr);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 手动打印
|
||||
/// </summary>
|
||||
private void OnHandPrint()
|
||||
{
|
||||
try
|
||||
{
|
||||
PrintLabelWindow printLabelWindow = new PrintLabelWindow
|
||||
{
|
||||
WindowStartupLocation = WindowStartupLocation.CenterScreen,//窗体居中
|
||||
Owner = Application.Current.MainWindow,
|
||||
};
|
||||
printLabelWindow.SelectedPaperNewStockIn = SelectedPaperNewStockIn;
|
||||
_eventAggregator.GetEvent<PrintLabelEvent>().Publish(PrintType.NewStock);
|
||||
printLabelWindow.ShowDialog();//打开原生的xaml文件,不使用prism,report用在prism的框架下无法正常使用
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"新卷入库:手动打印弹窗出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
|
||||
public async void OnLoaded(PaperStorageView view)
|
||||
{
|
||||
_eventAggregator.GetEvent<SearchStorageEvent>().Subscribe(OnSearchClick);
|
||||
await GetPageData(1);
|
||||
}
|
||||
|
||||
public void OnUnloaded(PaperStorageView view)
|
||||
{
|
||||
}
|
||||
|
||||
private async void OnSearchClick()
|
||||
{
|
||||
await GetPageData(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取数据
|
||||
/// </summary>
|
||||
public override async Task GetPageData(int pageIndex)
|
||||
{
|
||||
_pageQueryCondtion.Filters = new();
|
||||
|
||||
if (EndTime < StartTime)
|
||||
{
|
||||
Growl.Error(Localizations.GetStringValueByKey("CompletionRecordViewModel_Growl_ErrorThree"), PaperMesConst.MainWindow);
|
||||
return;
|
||||
}
|
||||
|
||||
if (StartTime != null)
|
||||
{
|
||||
_pageQueryCondtion.Filters.Add(new ConditionalCollections()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>
|
||||
{
|
||||
new KeyValuePair<WhereType, ConditionalModel> (
|
||||
WhereType.And,
|
||||
new ConditionalModel
|
||||
{
|
||||
FieldName= nameof(PaperNewStockInDto.CreationTime) ,
|
||||
ConditionalType=ConditionalType.GreaterThanOrEqual,
|
||||
FieldValue=StartTime.ToString()}
|
||||
)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (EndTime != null)
|
||||
{
|
||||
_pageQueryCondtion.Filters.Add(new ConditionalCollections()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>
|
||||
{
|
||||
new KeyValuePair<WhereType, ConditionalModel> (
|
||||
WhereType.And,
|
||||
new ConditionalModel
|
||||
{
|
||||
FieldName= nameof(PaperNewStockInDto.CreationTime) ,
|
||||
ConditionalType=ConditionalType.LessThanOrEqual,
|
||||
FieldValue=EndTime.ToString()}
|
||||
)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(PaperLabel))
|
||||
{
|
||||
_pageQueryCondtion.Filters.Add(new ConditionalCollections()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>
|
||||
{
|
||||
new KeyValuePair<WhereType, ConditionalModel> (
|
||||
WhereType.And,
|
||||
new ConditionalModel
|
||||
{
|
||||
FieldName= nameof(PaperNewStockInDto.PaperLabel) ,
|
||||
ConditionalType=ConditionalType.Like,
|
||||
FieldValue=PaperLabel}
|
||||
)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Supplier))
|
||||
{
|
||||
_pageQueryCondtion.Filters.Add(new ConditionalCollections()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>
|
||||
{
|
||||
new KeyValuePair<WhereType, ConditionalModel> (
|
||||
WhereType.And,
|
||||
new ConditionalModel
|
||||
{
|
||||
FieldName= nameof(PaperNewStockInDto.Supplier) ,
|
||||
ConditionalType=ConditionalType.Like,
|
||||
FieldValue=Supplier}
|
||||
)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(PaperCode))
|
||||
{
|
||||
_pageQueryCondtion.Filters.Add(new ConditionalCollections()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>
|
||||
{
|
||||
new KeyValuePair<WhereType, ConditionalModel> (
|
||||
WhereType.And,
|
||||
new ConditionalModel
|
||||
{
|
||||
FieldName= nameof(PaperNewStockInDto.PaperCode) ,
|
||||
ConditionalType=ConditionalType.Like,
|
||||
FieldValue=PaperCode}
|
||||
)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(PaperWidth))
|
||||
{
|
||||
_pageQueryCondtion.Filters.Add(new ConditionalCollections()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>
|
||||
{
|
||||
new KeyValuePair<WhereType, ConditionalModel> (
|
||||
WhereType.And,
|
||||
new ConditionalModel
|
||||
{
|
||||
FieldName= nameof(PaperNewStockInDto.PaperWidth) ,
|
||||
ConditionalType=ConditionalType.Like,
|
||||
FieldValue=PaperWidth}
|
||||
)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_pageQueryCondtion.CurrentPage = pageIndex;
|
||||
|
||||
PagedResult<PaperNewStockInDto> pageData = await _paperNewStockInService.QueryByPage(_pageQueryCondtion);
|
||||
if (pageData != null)
|
||||
{
|
||||
base.PageIndex = pageData.PageNumber;
|
||||
base.PageCount = pageData.TotalPages;
|
||||
base.PageSize = pageData.PageSize;
|
||||
base.TotalCount = pageData.TotalRecords;
|
||||
|
||||
PaperNewStockIns = pageData.PageData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<Page
|
||||
x:Class="JSMachine.WMS.Storage.BusinessModules.Views.HomePage"
|
||||
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:mvvm="http://prismlibrary.com/"
|
||||
xmlns:customercontrols="clr-namespace:JSMachine.WMS.Common.CustomerControls;assembly=JSMachine.WMS.Common"
|
||||
Title="HomePage"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mvvm:ViewModelLocator.AutoWireViewModel="True"
|
||||
Loaded="Page_Loaded"
|
||||
mc:Ignorable="d">
|
||||
<Viewbox Stretch="Fill">
|
||||
<Canvas
|
||||
Grid.Row="1"
|
||||
Width="1920"
|
||||
Height="980"
|
||||
VerticalAlignment="Top">
|
||||
<!--<Border
|
||||
Canvas.Left="5"
|
||||
Canvas.Top="6"
|
||||
Width="1910"
|
||||
Height="40"
|
||||
BorderBrush="#999999"
|
||||
BorderThickness="0,0,0,2">
|
||||
<WrapPanel
|
||||
Name="ButtonContainer"
|
||||
VerticalAlignment="Bottom"
|
||||
Button.Click="TabClick"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="ButtonHome"
|
||||
Content="{DynamicResource HomePage_Button_ButtonHome}"
|
||||
Style="{StaticResource MenuButton}" />
|
||||
<Button
|
||||
x:Name="ButtonOrder"
|
||||
Content="{DynamicResource HomePage_Button_ButtonOrder}"
|
||||
Style="{StaticResource MenuButton}" />
|
||||
</WrapPanel>
|
||||
</Border>-->
|
||||
<customercontrols:ConnectionStatusView
|
||||
Grid.Row="2"
|
||||
Grid.ColumnSpan="3"
|
||||
Canvas.Top="20" Canvas.Right="30"
|
||||
Background="Transparent" />
|
||||
<ContentControl
|
||||
x:Name="Page_Change"
|
||||
Canvas.Left="5"
|
||||
Canvas.Top="10"
|
||||
Width="1920" />
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
</Page>
|
||||
@@ -0,0 +1,102 @@
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using JSMachine.WMS.Storage.BusinessModules.Views;
|
||||
using Prism.Events;
|
||||
using Prism.Ioc;
|
||||
using static JSMachine.WMS.Common.EventBus.HotKeyEventBus;
|
||||
|
||||
namespace JSMachine.WMS.Storage.BusinessModules.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// HomePage.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class HomePage : Page
|
||||
{
|
||||
private static IEventAggregator _eventAggregator = ContainerLocator.Container.Resolve<IEventAggregator>();
|
||||
|
||||
public bool IsMainWindows { get; set; } = true;
|
||||
|
||||
private LinearGradientBrush ActiveBrush = new();
|
||||
public HomePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
Init();
|
||||
RegisterHotKey();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册快捷键
|
||||
/// </summary>
|
||||
private void RegisterHotKey()
|
||||
{
|
||||
////没有权限点击的按钮不允许使用快捷键
|
||||
//_eventAggregator.GetEvent<ProductionHomeHotKeyEvent>().Subscribe(() =>
|
||||
//{
|
||||
// if (this.ButtonHome.Visibility == Visibility.Visible && this.ButtonHome.IsEnabled)
|
||||
// this.ButtonHome.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
|
||||
//});
|
||||
|
||||
//_eventAggregator.GetEvent<OrderManageHotKeyEvent>().Subscribe(() =>
|
||||
//{
|
||||
// if (this.ButtonOrder.Visibility == Visibility.Visible && this.ButtonOrder.IsEnabled)
|
||||
// this.ButtonOrder.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
|
||||
//});
|
||||
}
|
||||
|
||||
private void Page_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//Page_Change.Content = new ProductionHomeView() { };
|
||||
ActiveBrush.StartPoint = new Point(0, 0);
|
||||
ActiveBrush.EndPoint = new Point(0, 1);
|
||||
ActiveBrush.Opacity = 1;
|
||||
ActiveBrush.GradientStops.Add(new GradientStop(color: (Color)ColorConverter.ConvertFromString("#111111"), offset: 0));
|
||||
ActiveBrush.GradientStops.Add(new GradientStop(color: (Color)ColorConverter.ConvertFromString("#999999"), offset: 0.5));
|
||||
ActiveBrush.GradientStops.Add(new GradientStop(color: (Color)ColorConverter.ConvertFromString("#111111"), offset: 1));
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
//ButtonHome.Background = ActiveBrush;//主页默认选中黑色
|
||||
//ButtonHome.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFF"));
|
||||
}
|
||||
|
||||
public void TabClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Button button = (Button)e.OriginalSource;
|
||||
ShowButtonBlack();
|
||||
button.Background = ActiveBrush;
|
||||
button.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFF"));
|
||||
switch (button.Name)
|
||||
{
|
||||
case "ButtonHome":
|
||||
{
|
||||
Page_Change.Content = new PaperStorageView() { };
|
||||
};
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowButtonBlack()
|
||||
{
|
||||
LinearGradientBrush brush = new LinearGradientBrush();
|
||||
brush.StartPoint = new Point(0, 0);
|
||||
brush.EndPoint = new Point(0, 1);
|
||||
brush.Opacity = 1;
|
||||
brush.GradientStops.Add(new GradientStop(color: (Color)ColorConverter.ConvertFromString("#BBBBBB"), offset: 0));
|
||||
brush.GradientStops.Add(new GradientStop(color: (Color)ColorConverter.ConvertFromString("#FFFFFF"), offset: 0.5));
|
||||
brush.GradientStops.Add(new GradientStop(color: (Color)ColorConverter.ConvertFromString("#BBBBBB"), offset: 1));
|
||||
|
||||
//for (int i = 0; i < ButtonContainer.Children.Count; i++)
|
||||
//{
|
||||
// Button button = ButtonContainer.Children[i] as Button;
|
||||
// button.Background = brush;
|
||||
// button.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("Black"));
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
<UserControl
|
||||
x:Class="JSMachine.WMS.Storage.BusinessModules.Views.PaperStorageView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converter="clr-namespace:JSMachine.WMS.Common.Converter;assembly=JSMachine.WMS.Common"
|
||||
xmlns:customercontrols="clr-namespace:JSMachine.WMS.Common.CustomerControls;assembly=JSMachine.WMS.Common"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:local="clr-namespace:JSMachine.WMS.Storage.BusinessModules.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mvvm="http://prismlibrary.com/"
|
||||
Width="1920"
|
||||
Height="980"
|
||||
mvvm:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<converter:DateTimeConverter x:Key="DateTimeConverter" />
|
||||
<converter:PrintStateToStrConverter x:Key="PrintStateToStrConverter" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid Margin="20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="8*" />
|
||||
<RowDefinition Height="6*" />
|
||||
<RowDefinition Height="90*" />
|
||||
<RowDefinition Height="6*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Button
|
||||
Grid.Row="0"
|
||||
Width="200"
|
||||
Height="50"
|
||||
HorizontalAlignment="Left"
|
||||
Command="{Binding IAtuoPrintCmd}"
|
||||
Content="新卷标签自动打印"
|
||||
FontSize="20"
|
||||
Style="{StaticResource MenuButton}" />
|
||||
<WrapPanel Grid.Row="1">
|
||||
<hc:DateTimePicker
|
||||
x:Name="DateTimePickerStart"
|
||||
Width="330"
|
||||
Margin="0,0,0,5"
|
||||
VerticalAlignment="Center"
|
||||
hc:InfoElement.Title="开始时间"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
hc:InfoElement.TitleWidth="80"
|
||||
Background="Transparent"
|
||||
FontSize="18"
|
||||
Foreground="#CC8"
|
||||
SelectedDateTime="{Binding StartTime}"
|
||||
SelectedDateTimeChanged="DateTimePickerStart_SelectedDateTimeChanged"
|
||||
ShowClearButton="True"
|
||||
Style="{StaticResource DateTimePickerPlus}" />
|
||||
<hc:DateTimePicker
|
||||
x:Name="DateTimePickerEnd"
|
||||
Width="330"
|
||||
Margin="20,0,0,5"
|
||||
VerticalAlignment="Center"
|
||||
hc:InfoElement.Title="结束时间"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
hc:InfoElement.TitleWidth="80"
|
||||
Background="Transparent"
|
||||
FontSize="18"
|
||||
Foreground="#CC8"
|
||||
SelectedDateTime="{Binding EndTime}"
|
||||
SelectedDateTimeChanged="DateTimePickerEnd_SelectedDateTimeChanged"
|
||||
ShowClearButton="True"
|
||||
Style="{StaticResource DateTimePickerPlus}" />
|
||||
<TextBox
|
||||
x:Name="TxtPaperLabel"
|
||||
Width="250"
|
||||
Margin="20,0,0,5"
|
||||
hc:InfoElement.Placeholder="请输入卷标"
|
||||
hc:InfoElement.Title="原纸卷标"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
Background="Transparent"
|
||||
FontSize="18"
|
||||
Foreground="#CC8"
|
||||
SelectionChanged="TxtPaperLabel_SelectionChanged"
|
||||
Style="{StaticResource TextBoxExtend}"
|
||||
Text="{Binding PaperLabel, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBox
|
||||
x:Name="TxtSupplier"
|
||||
Width="250"
|
||||
Margin="20,0,0,5"
|
||||
hc:InfoElement.Placeholder="请输入供应商"
|
||||
hc:InfoElement.Title="供应商"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
Background="Transparent"
|
||||
FontSize="18"
|
||||
Foreground="#CC8"
|
||||
SelectionChanged="TxtSupplier_SelectionChanged"
|
||||
Style="{StaticResource TextBoxExtend}"
|
||||
Text="{Binding Supplier, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBox
|
||||
x:Name="TxtPaperCode"
|
||||
Width="250"
|
||||
Margin="20,0,0,5"
|
||||
hc:InfoElement.Placeholder="请输入纸质"
|
||||
hc:InfoElement.Title="纸质"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
Background="Transparent"
|
||||
FontSize="18"
|
||||
Foreground="#CC8"
|
||||
SelectionChanged="TxtPaperCode_SelectionChanged"
|
||||
Style="{StaticResource TextBoxExtend}"
|
||||
Text="{Binding PaperCode, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBox
|
||||
x:Name="TxtPaperWidth"
|
||||
Width="250"
|
||||
Margin="20,0,0,5"
|
||||
hc:InfoElement.Placeholder="请输入门幅"
|
||||
hc:InfoElement.Title="门幅"
|
||||
hc:InfoElement.TitlePlacement="Left"
|
||||
Background="Transparent"
|
||||
FontSize="18"
|
||||
Foreground="#CC8"
|
||||
SelectionChanged="TxtPaperWidth_SelectionChanged"
|
||||
Style="{StaticResource TextBoxExtend}"
|
||||
Text="{Binding PaperWidth, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</WrapPanel>
|
||||
<DataGrid
|
||||
Grid.Row="2"
|
||||
Grid.RowSpan="2"
|
||||
Width="Auto"
|
||||
Height="760"
|
||||
VerticalAlignment="Top"
|
||||
AutoGenerateColumns="False"
|
||||
Background="Transparent"
|
||||
CanUserSortColumns="False"
|
||||
DataGrid.CellStyle="{StaticResource DataGridCellStyle}"
|
||||
DataGrid.RowStyle="{StaticResource DataGridRowStyle}"
|
||||
DataGrid.Style="{StaticResource DataGridStyle}"
|
||||
EnableRowVirtualization="True"
|
||||
FontSize="20"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding PaperNewStockIns}"
|
||||
RowHeaderWidth="0"
|
||||
SelectedItem="{Binding SelectedPaperNewStockIn}"
|
||||
SelectionMode="Single"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="{x:Type DataGridColumnHeader}">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="0.6*"
|
||||
Binding="{Binding PaperLabel}"
|
||||
ElementStyle="{StaticResource DataGridTextStyle}"
|
||||
Header="原纸卷标"
|
||||
HeaderStyle="{StaticResource HeaderStyle}" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding Supplier}"
|
||||
ElementStyle="{StaticResource DataGridTextStyle}"
|
||||
Header="供应商"
|
||||
HeaderStyle="{StaticResource HeaderStyle}" />
|
||||
<DataGridTextColumn
|
||||
Width="0.4*"
|
||||
Binding="{Binding PaperUnitWeight}"
|
||||
ElementStyle="{StaticResource DataGridTextStyle}"
|
||||
Header="克重"
|
||||
HeaderStyle="{StaticResource HeaderStyle}" />
|
||||
<DataGridTextColumn
|
||||
Width="0.4*"
|
||||
Binding="{Binding PaperCode}"
|
||||
ElementStyle="{StaticResource DataGridTextStyle}"
|
||||
Header="纸质"
|
||||
HeaderStyle="{StaticResource HeaderStyle}" />
|
||||
<DataGridTextColumn
|
||||
Width="0.4*"
|
||||
Binding="{Binding PaperWidth}"
|
||||
ElementStyle="{StaticResource DataGridTextStyle}"
|
||||
Header="门幅"
|
||||
HeaderStyle="{StaticResource HeaderStyle}" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding Memo}"
|
||||
ElementStyle="{StaticResource DataGridTextStyle}"
|
||||
Header="备注"
|
||||
HeaderStyle="{StaticResource HeaderStyle}" />
|
||||
<DataGridTextColumn
|
||||
Width="0.4*"
|
||||
Binding="{Binding PrintState, Converter={StaticResource PrintStateToStrConverter}}"
|
||||
ElementStyle="{StaticResource DataGridTextStyle}"
|
||||
Header="打印状态"
|
||||
HeaderStyle="{StaticResource HeaderStyle}" />
|
||||
<DataGridTextColumn
|
||||
Width="0.8*"
|
||||
Binding="{Binding PrintTime, Converter={StaticResource DateTimeConverter}}"
|
||||
ElementStyle="{StaticResource DataGridTextStyle}"
|
||||
Header="自动打印时间"
|
||||
HeaderStyle="{StaticResource HeaderStyle}" />
|
||||
<DataGridTextColumn
|
||||
Width="0.8*"
|
||||
Binding="{Binding CreationTime, Converter={StaticResource DateTimeConverter}}"
|
||||
ElementStyle="{StaticResource DataGridTextStyle}"
|
||||
Header="创建时间"
|
||||
HeaderStyle="{StaticResource HeaderStyle}" />
|
||||
<DataGridTemplateColumn
|
||||
x:Name="Operation"
|
||||
Width="0.4*"
|
||||
Header="操作"
|
||||
HeaderStyle="{StaticResource HeaderStyle}">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Button
|
||||
Height="45"
|
||||
Width="100"
|
||||
FontSize="20"
|
||||
Background="#6893f7"
|
||||
Command="{Binding DataContext.IHandPrintCmd, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
|
||||
Content="打印标签"
|
||||
Style="{StaticResource ButtonSuccess}"
|
||||
Tag="{Binding Operation}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<customercontrols:TurnPage
|
||||
Grid.Row="3"
|
||||
Grid.ColumnSpan="3"
|
||||
Margin="0,8,0,0"
|
||||
Background="Transparent" />
|
||||
<Button
|
||||
Grid.Row="0"
|
||||
Width="200"
|
||||
Height="50"
|
||||
Margin="3,9,0,9"
|
||||
HorizontalAlignment="Left"
|
||||
Command="{Binding IAtuoPrintCmd}"
|
||||
Content="新卷标签自动打印"
|
||||
FontSize="20"
|
||||
Style="{StaticResource MenuButton}" />
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,50 @@
|
||||
using Prism.Events;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Prism.Ioc;
|
||||
using static JSMachine.WMS.Common.EventBus.GlobalEventBus;
|
||||
|
||||
namespace JSMachine.WMS.Storage.BusinessModules.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// PaperStorageView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class PaperStorageView : UserControl
|
||||
{
|
||||
IEventAggregator eventAggregator = ContainerLocator.Container.Resolve<IEventAggregator>();
|
||||
public PaperStorageView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void DateTimePickerStart_SelectedDateTimeChanged(object sender, HandyControl.Data.FunctionEventArgs<DateTime?> e)
|
||||
{
|
||||
eventAggregator.GetEvent<SearchStorageEvent>().Publish();
|
||||
}
|
||||
|
||||
private void DateTimePickerEnd_SelectedDateTimeChanged(object sender, HandyControl.Data.FunctionEventArgs<DateTime?> e)
|
||||
{
|
||||
eventAggregator.GetEvent<SearchStorageEvent>().Publish();
|
||||
}
|
||||
|
||||
private void TxtPaperLabel_SelectionChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
eventAggregator.GetEvent<SearchStorageEvent>().Publish();
|
||||
}
|
||||
|
||||
private void TxtSupplier_SelectionChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
eventAggregator.GetEvent<SearchStorageEvent>().Publish();
|
||||
}
|
||||
|
||||
private void TxtPaperCode_SelectionChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
eventAggregator.GetEvent<SearchStorageEvent>().Publish();
|
||||
}
|
||||
|
||||
private void TxtPaperWidth_SelectionChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
eventAggregator.GetEvent<SearchStorageEvent>().Publish();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<Window
|
||||
x:Class="JSMachine.WMS.Storage.BusinessModules.Views.PrintLabelWindow"
|
||||
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:local="clr-namespace:JSMachine.WMS.Storage.BusinessModules.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="标签打印"
|
||||
Width="1000"
|
||||
Height="600"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="860" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid Width="900" HorizontalAlignment="Left">
|
||||
<WrapPanel HorizontalAlignment="Right">
|
||||
<Label Content="打印机:" />
|
||||
<ComboBox
|
||||
x:Name="cbPrinters"
|
||||
Width="230"
|
||||
Height="23"
|
||||
Margin="5"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top" />
|
||||
<Button
|
||||
x:Name="ButtonDesigner"
|
||||
Click="ButtonDesigner_Click"
|
||||
Content="模板编辑"
|
||||
FontSize="15"
|
||||
Style="{StaticResource ToolButton}" />
|
||||
<Button
|
||||
x:Name="ButtonClose"
|
||||
Click="ButtonClose_Click"
|
||||
Content="关闭窗体"
|
||||
FontSize="15"
|
||||
Style="{StaticResource ToolButton}" />
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Grid.Row="1">
|
||||
<WindowsFormsHost x:Name="WindowsFornsHostDesignerControl" />
|
||||
<WindowsFormsHost x:Name="WindowsFornsHostPreviewControl" />
|
||||
</Grid>
|
||||
<!--<Grid Grid.Row="2">
|
||||
<WindowsFormsHost x:Name="WindowsFornsHostPreviewControl" />
|
||||
</Grid>-->
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,243 @@
|
||||
using HandyControl.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Data;
|
||||
using System.Drawing.Printing;
|
||||
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.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
using System.Windows.Threading;
|
||||
using JSMachine.WMS.Infrastructure.AppConfiguration;
|
||||
using JSMachine.WMS.Common;
|
||||
using JSMachine.WMS.App.Dto;
|
||||
using JSMachine.WMS.Infrastructure.Helper;
|
||||
using JSMachine.WMS.App.Dto.Enum;
|
||||
using static JSMachine.WMS.Common.EventBus.GlobalEventBus;
|
||||
using Prism.Events;
|
||||
using Prism.Ioc;
|
||||
|
||||
namespace JSMachine.WMS.Storage.BusinessModules.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// 标签打印window ,不使用prism
|
||||
/// </summary>
|
||||
public partial class PrintLabelWindow : System.Windows.Window
|
||||
{
|
||||
FastReport.Design.StandardDesigner.DesignerControl designerControl = new FastReport.Design.StandardDesigner.DesignerControl();
|
||||
FastReport.Preview.PreviewControl prewControl = new FastReport.Preview.PreviewControl();
|
||||
FastReport.Report fDesignerReport = new FastReport.Report(); //报表设计
|
||||
FastReport.Report fPrewControlReport = new FastReport.Report();//报表预览
|
||||
private string companyName = Global.AppSettings.CompanyName;
|
||||
private IEventAggregator eventAggregator = ContainerLocator.Container.Resolve<IEventAggregator>();
|
||||
|
||||
private PrintType _printType;
|
||||
public PrintType PrintType
|
||||
{
|
||||
get { return _printType; }
|
||||
set { _printType = value; }
|
||||
}
|
||||
private PaperNewStockInDto _selectedPaperNewStockIn;
|
||||
/// <summary>
|
||||
/// 当前选中新卷入库信息
|
||||
/// </summary>
|
||||
public PaperNewStockInDto SelectedPaperNewStockIn
|
||||
{
|
||||
get { return _selectedPaperNewStockIn; }
|
||||
set { _selectedPaperNewStockIn = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前选中进纸信息
|
||||
/// </summary>
|
||||
private PaperStockOutDto _selectePpaperStockOut;
|
||||
public PaperStockOutDto SelectePpaperStockOut
|
||||
{
|
||||
get { return _selectePpaperStockOut; }
|
||||
set { _selectePpaperStockOut = value; }
|
||||
}
|
||||
|
||||
private PaperReStockInDto _selectedPaperReStockIn;
|
||||
/// <summary>
|
||||
/// 当前选中残卷入库信息
|
||||
/// </summary>
|
||||
public PaperReStockInDto SelectedPaperReStockIn
|
||||
{
|
||||
get { return _selectedPaperReStockIn ;}
|
||||
set { _selectedPaperReStockIn = value;}
|
||||
}
|
||||
|
||||
public PrintLabelWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
GetPrinters(); //添加打印机下拉选项
|
||||
eventAggregator.GetEvent<PrintLabelEvent>().Subscribe(PrinteLable);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加打印机下拉选项
|
||||
/// </summary>
|
||||
private void GetPrinters()
|
||||
{
|
||||
var fPrinters = GetLocalPrinters();
|
||||
if (fPrinters != null && fPrinters.Any())
|
||||
{
|
||||
foreach (var f in fPrinters)
|
||||
{
|
||||
cbPrinters.Items.Add(f);
|
||||
}
|
||||
cbPrinters.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑模板
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonDesigner_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadFrxAndData(fDesignerReport, Environment.CurrentDirectory + Global.AppSettings.LabelReportFilePathStr);
|
||||
designerControl.Report = fDesignerReport;//编辑模板
|
||||
ControlVisibility(true, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打印选中标签
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//PrinteLable(PrintType);
|
||||
this.Close();
|
||||
}
|
||||
/// <summary>
|
||||
/// 标签打印
|
||||
/// </summary>
|
||||
private void PrinteLable(PrintType printType)
|
||||
{
|
||||
try
|
||||
{
|
||||
PrintType= printType;
|
||||
LoadFrxAndData(fPrewControlReport, Environment.CurrentDirectory + Global.AppSettings.LabelReportFilePathStr);
|
||||
if (printType == PrintType.NewStock)
|
||||
{
|
||||
var paperCode = string.IsNullOrEmpty(SelectedPaperNewStockIn.PaperCode) ? "" : SelectedPaperNewStockIn.PaperCode.Replace("-", "");
|
||||
fPrewControlReport.SetParameterValue("companyname", companyName);
|
||||
fPrewControlReport.SetParameterValue("papercode", paperCode);
|
||||
fPrewControlReport.SetParameterValue("supplier", SelectedPaperNewStockIn.Supplier);
|
||||
fPrewControlReport.SetParameterValue("paperwidth", SelectedPaperNewStockIn.PaperWidth);
|
||||
fPrewControlReport.SetParameterValue("weight", Convert.ToInt32(SelectedPaperNewStockIn.InWeight));
|
||||
fPrewControlReport.SetParameterValue("paperlabel", SelectedPaperNewStockIn.PaperLabel);
|
||||
fPrewControlReport.SetParameterValue("paperlength", Convert.ToInt32(SelectedPaperNewStockIn.MeterLength));
|
||||
fPrewControlReport.SetParameterValue("unitweight", SelectedPaperNewStockIn.PaperUnitWeight);
|
||||
}
|
||||
else if (printType == PrintType.ReStock)
|
||||
{
|
||||
var paperCode = string.IsNullOrEmpty(SelectedPaperReStockIn.PaperCode) ? "" : SelectedPaperReStockIn.PaperCode.Replace("-", "");
|
||||
fPrewControlReport.SetParameterValue("companyname", companyName);
|
||||
fPrewControlReport.SetParameterValue("papercode", paperCode);
|
||||
fPrewControlReport.SetParameterValue("supplier", SelectedPaperReStockIn.Supplier);
|
||||
fPrewControlReport.SetParameterValue("paperwidth", SelectedPaperReStockIn.PaperWidth);
|
||||
fPrewControlReport.SetParameterValue("weight", Convert.ToInt32(SelectedPaperReStockIn.InWeight));
|
||||
fPrewControlReport.SetParameterValue("paperlabel", SelectedPaperReStockIn.PaperLabel);
|
||||
fPrewControlReport.SetParameterValue("paperlength", Convert.ToInt32(SelectedPaperReStockIn.MeterLength));
|
||||
fPrewControlReport.SetParameterValue("unitweight", SelectedPaperReStockIn.PaperUnitWeight);
|
||||
}
|
||||
else if (printType == PrintType.StockOut)
|
||||
{
|
||||
var paperCode = string.IsNullOrEmpty(SelectePpaperStockOut.PaperCode) ? "" : SelectePpaperStockOut.PaperCode.Replace("-", "");
|
||||
fPrewControlReport.SetParameterValue("companyname", companyName);
|
||||
fPrewControlReport.SetParameterValue("papercode", paperCode);
|
||||
fPrewControlReport.SetParameterValue("supplier", SelectePpaperStockOut.Supplier);
|
||||
fPrewControlReport.SetParameterValue("paperwidth", SelectePpaperStockOut.PaperWidth);
|
||||
fPrewControlReport.SetParameterValue("weight", Convert.ToInt32(SelectePpaperStockOut.OutWeight));
|
||||
fPrewControlReport.SetParameterValue("paperlabel", SelectePpaperStockOut.PaperLabel);
|
||||
fPrewControlReport.SetParameterValue("paperlength", Convert.ToInt32(SelectePpaperStockOut.MeterLength));
|
||||
fPrewControlReport.SetParameterValue("unitweight", SelectePpaperStockOut.PaperUnitWeight);
|
||||
}
|
||||
PrepareReprot(fPrewControlReport, prewControl);
|
||||
ControlVisibility(false, true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error($"新卷入库:手动打印标签出错: {ex.Message} \n {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 预览报表
|
||||
/// </summary>
|
||||
private void PrepareReprot(FastReport.Report report, FastReport.Preview.PreviewControl prewControl)
|
||||
{
|
||||
report.Preview = prewControl;
|
||||
report.Prepare();
|
||||
report.ShowPrepared();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 载入报表路径和报表数据
|
||||
/// </summary>
|
||||
private void LoadFrxAndData(FastReport.Report report, string filePathStr)
|
||||
{
|
||||
//1 编辑指定路径下的frx,先load frx
|
||||
report.Load(filePathStr);
|
||||
}
|
||||
/// <summary>
|
||||
/// 报表设计与预览显示在同一个区域,每次只显示一个
|
||||
/// </summary>
|
||||
/// <param name="designerControlVisibility"></param>
|
||||
/// <param name="designerControlVisibility"></param>
|
||||
private void ControlVisibility(bool designerControlVisibility, bool previewControlVisibility)
|
||||
{
|
||||
if (designerControlVisibility == true && previewControlVisibility == false)
|
||||
{
|
||||
WindowsFornsHostPreviewControl.Visibility = Visibility.Collapsed;
|
||||
WindowsFornsHostDesignerControl.Visibility = Visibility.Visible;
|
||||
WindowsFornsHostDesignerControl.Child = designerControl;
|
||||
}
|
||||
else if (designerControlVisibility == false && previewControlVisibility == true)
|
||||
{
|
||||
WindowsFornsHostDesignerControl.Visibility = Visibility.Collapsed;
|
||||
WindowsFornsHostPreviewControl.Visibility = Visibility.Visible;
|
||||
WindowsFornsHostPreviewControl.Child = prewControl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static PrintDocument fPrintDocument = new PrintDocument();
|
||||
private static string DefaultPrinter
|
||||
{
|
||||
get { return fPrintDocument.PrinterSettings.PrinterName; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取打印机列表
|
||||
/// </summary>
|
||||
private static List<string> GetLocalPrinters()
|
||||
{
|
||||
List<string> fPrinters = new List<string>();
|
||||
fPrinters.Add(DefaultPrinter);
|
||||
foreach (string fPrinterName in PrinterSettings.InstalledPrinters)
|
||||
{
|
||||
if (!fPrinters.Contains(fPrinterName))
|
||||
fPrinters.Add(fPrinterName);
|
||||
}
|
||||
return fPrinters;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user