liuwf 11 months ago
commit 4526e6c369

@ -1,3 +1,9 @@
is_global = true
build_property.RootNamespace = Admin.Core.FrameWork
<<<<<<< HEAD
build_property.ProjectDir = E:\c#\AUCMA\new\Admin.Core.FrameWork\
=======
build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.FrameWork\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
>>>>>>> 346821a670b23ccc6bf0121bb0363fb2fb2b4f48

@ -58,7 +58,7 @@ namespace Admin.Core.Model
/// 是否打印 1=>打印
/// </summary>
[SugarColumn(ColumnName = "IS_PRINT")]
public int IsPrint { get; set; }
public string IsPrint { get; set; }
}
}

@ -8,4 +8,10 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.RealTimeService
<<<<<<< HEAD
build_property.ProjectDir = E:\c#\AUCMA\new\Admin.Core.RealTimeService\
=======
build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.RealTimeService\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
>>>>>>> 346821a670b23ccc6bf0121bb0363fb2fb2b4f48

@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
@ -156,6 +157,9 @@ namespace Aucma.Core.BoxFoam.Business
if (obj1.plc.IsConnected)
{
var flag = obj1.plc.WriteBool("M6.0", true);//换班 数据清空
Thread.Sleep(500);
obj1.plc.WriteBool("M6.0", false);//数据清空后复位
Console.WriteLine($"班组切换清空1~6区产量数据{(flag == true ? "" : "")}");
log.Warn($"班组切换清空1~6区产量数据{(flag == true ? "" : "")}");
}
}
@ -165,6 +169,9 @@ namespace Aucma.Core.BoxFoam.Business
if (obj2.plc.IsConnected)
{
bool flag = obj2.plc.WriteBool("M6.0", true);//换班 数据清空
Thread.Sleep(500);
obj2.plc.WriteBool("M6.0", false);//数据清空后复位
Console.WriteLine($"班组切换清空7~12区产量数据{(flag == true ? "" : "")}");
log.Warn($"班组切换清空7~12区产量数据{(flag == true ? "" : "")}");
}
}

@ -47,7 +47,7 @@ namespace Aucma.Core.BoxFoam.ViewModels
await init();
await RefreshTeamTime();//班组时间
});
TeamSwitchBusiness teamSwitchBusiness = new TeamSwitchBusiness();
teamSwitchBusiness.Init();//切换班组清空发泡产量
//实时更新界面时间
@ -489,8 +489,62 @@ namespace Aucma.Core.BoxFoam.ViewModels
{
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
{
CurrentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
DateTime now = DateTime.Now;
CurrentDateTime = now.ToString("yyyy-MM-dd HH:mm:ss");
DateTime scheduledTime = new DateTime(now.Year, now.Month, now.Day, 20, 00, 00);
string date = scheduledTime.ToString();
if (CurrentDateTime== date)
{
var obj1 = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("foamLine1Plc"));
if (obj1 != null)
{
if (obj1.plc.IsConnected)
{
var flag = obj1.plc.WriteBool("M6.0", true);//换班 数据清空
Thread.Sleep(500);
obj1.plc.WriteBool("M6.0", false);//换班 数据清空
log.Warn($"班组切换清空1~6区产量数据{(flag == true ? "" : "")}");
}
}
var obj2 = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("foamLine2Plc"));
if (obj2 != null)
{
if (obj2.plc.IsConnected)
{
bool flag = obj2.plc.WriteBool("M6.0", true);//换班 数据清空
Thread.Sleep(500);
obj2.plc.WriteBool("M6.0", false);//换班 数据清空
log.Warn($"班组切换清空7~12区产量数据{(flag == true ? "" : "")}");
}
}
}
DateTime scheduledTime2 = new DateTime(now.Year, now.Month, now.Day, 8, 00, 00);
string date2 = scheduledTime2.ToString();
if (CurrentDateTime == date2)
{
var obj1 = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("foamLine1Plc"));
if (obj1 != null)
{
if (obj1.plc.IsConnected)
{
var flag = obj1.plc.WriteBool("M6.0", true);//换班 数据清空
Thread.Sleep(500);
obj1.plc.WriteBool("M6.0", false);//换班 数据清空
log.Warn($"班组切换清空1~6区产量数据{(flag == true ? "" : "")}");
}
}
var obj2 = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("foamLine2Plc"));
if (obj2 != null)
{
if (obj2.plc.IsConnected)
{
bool flag = obj2.plc.WriteBool("M6.0", true);//换班 数据清空
Thread.Sleep(500);
obj2.plc.WriteBool("M6.0", false);//换班 数据清空
log.Warn($"班组切换清空7~12区产量数据{(flag == true ? "" : "")}");
}
}
}
}));
}

@ -0,0 +1,27 @@
using Admin.Core.IService.IService_New;
using Admin.Core.Model.Model_New;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aucma.Core.DataCollector.Factory
{
internal class Class1 : DataCollectorFactory
{
public Class1(IBaseDeviceParamServices deviceParamServices, IRecordDeviceAlarmInfoServices deviceAlarmInfoServices, IRecordDeviceElectricityServices deviceElectricityServices) : base(deviceParamServices, deviceAlarmInfoServices, deviceElectricityServices)
{
}
public override void CollectDeviceAlarmInfo(out List<Record_DeviceAlarmInfo> deviceAlarmInfos)
{
throw new NotImplementedException();
}
public override void CollectDeviceElectricity(out Record_DeviceElectricity deviceElectricity)
{
throw new NotImplementedException();
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

@ -5,18 +5,32 @@
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<ApplicationIcon>favicon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<None Remove="Assets\Images\background.jpg" />
<None Remove="Assets\Images\bg.jpg" />
<None Remove="Assets\Images\favicon.ico" />
<None Remove="Assets\Images\Green.png" />
<None Remove="Assets\Images\Icon.png" />
<None Remove="Assets\Images\log.png" />
<None Remove="Assets\Images\login-background.png" />
<None Remove="Assets\Images\logo.png" />
<None Remove="Assets\Images\Newlog.png" />
<None Remove="Assets\Images\Red.png" />
</ItemGroup>
<ItemGroup>
<Content Include="favicon.ico" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Assets\Images\favicon.ico" />
<EmbeddedResource Include="Assets\Images\log.png" />
<EmbeddedResource Include="Assets\Images\login-background.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
<PackageReference Include="MaterialDesignThemes" Version="4.8.0" />
@ -59,7 +73,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Report\MaterialBar.frx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

@ -1,4 +1,5 @@
using Admin.Core.IService;
using Admin.Core.Common;
using Admin.Core.IService;
using Admin.Core.Model;
using Admin.Core.Model.ViewModels;
using Aucma.Core.PrintTo.Models;
@ -6,6 +7,7 @@ using Aucma.Core.PrintTo.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using FastReport;
using log4net;
using Microsoft.Extensions.DependencyInjection;
using System;
@ -51,7 +53,9 @@ namespace Aucma.Core.PrintTo.ViewModels
Datalist.Clear();
List<PrintPlanInfoView> list = await _baseOrderInfoServices.QueryPrintInfo();
if (list == null) return;
list= list.OrderBy(d => d.CreateTime).ToList();
list= list.Where(d=>d.PlanAmount>d.CompleteAmount).ToList();
if (list == null) return;
list = list.OrderBy(d => d.CreateTime).ToList();
var printBarCode = await _printBarCodeServices.QueryAsync();
foreach (var item in list)
{
@ -406,5 +410,49 @@ namespace Aucma.Core.PrintTo.ViewModels
}
#endregion
#region 测试打印
[RelayCommand]
public void GetTest()
{
string MaterialCode = "8301501093",
falg = "L";
string barCode = $"{falg}{DateTime.Now.ToString("yyMMdd")}{MaterialCode}";
string printer = Appsettings.app("Printer", "PrinterName");
for (int i = 1; i < 123; i++)
{
string code = i.ToString().PadLeft(4, '0');
#region 打印
//对接打印机
Report barReport = new Report();
barReport.Load(System.Environment.CurrentDirectory + @"\Report\MaterialBar.frx");//打印报表位置
// 设置打印机和打印选项
barReport.PrintSettings.ShowDialog = false; // 是否打开打印机选择框
barReport.PrintSettings.Printer = printer; // 设置打印机名称
barReport.PrintSettings.Copies = 1; // 设置打印份数
barReport.SetParameterValue("BoxBarData.Id", barCode + code);
barReport.SetParameterValue("BoxBarData.Order_No", "11260310");//订单号
barReport.SetParameterValue("BoxBarData.Order_Material_Name", "BC/BD-100HT.白");//物料简码
barReport.SetParameterValue("BoxBarData.Bar_Code", barCode + code);//二维码
barReport.Print();
#endregion
PrintBarCode printBarCode = new PrintBarCode();
printBarCode.MaterialBarcode = barCode + code;
printBarCode.PrintBarType = 2;//内胆码
printBarCode.OrderCode = "11260310";
printBarCode.MaterialCode = "8301501093";
printBarCode.MaterialName = "内胆部件,BC/BD-100HT,预涂钢板,标准白,成型线,N";
printBarCode.PrintTime = DateTime.Now;
printBarCode.SupplementMaterial = 0;
var num = _printBarCodeServices.AddAsync(printBarCode).Result;
}
}
#endregion
}
}

@ -7,6 +7,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using FastReport;
using FastReport.DevComponents.DotNetBar;
using log4net;
using Microsoft.Extensions.DependencyInjection;
using StackExchange.Profiling.Internal;
@ -323,21 +324,33 @@ namespace Aucma.Core.PrintTo.ViewModels
string barCode = string.Empty;
if (_printType== 200)
{
string rowNum = GetMaxNumAsync(item.MaterialCode,"B").Result;//最大值+1
barCode = $"B{DateTime.Now.ToString("yyMMdd")}{item.MaterialCode}{rowNum}";
barCode = GetMaxNumAsync(item.MaterialCode,"B").Result;//最大值+1
if (string.IsNullOrEmpty(barCode))
{
printState = PrintState.Paused;
SetPaused();
continue;
}
//barCode = $"B{DateTime.Now.ToString("yyMMdd")}{item.MaterialCode}{rowNum}";
PrintProgress = $"[{PrintAmount}/{i}] {barCode}";
printBarCode.MaterialBarcode = barCode;
printBarCode.PrintBarType = 1;
Console.WriteLine($"B{DateTime.Now.ToString("yyMMdd")}{item.MaterialCode}{rowNum}");
Console.WriteLine($"{barCode}");
}
if (_printType == 500)
{
string rowNum = GetMaxNumAsync(item.MaterialCode, "L").Result;//最大值+1
barCode = $"L{DateTime.Now.ToString("yyMMdd")}{item.MaterialCode}{rowNum}";
barCode = GetMaxNumAsync(item.MaterialCode, "B").Result;//最大值+1
if (string.IsNullOrEmpty(barCode))
{
printState = PrintState.Paused;
SetPaused();
continue;
}
// barCode = $"L{DateTime.Now.ToString("yyMMdd")}{item.MaterialCode}{rowNum}";
PrintProgress = $"[{PrintAmount}/{i}] {barCode}";
printBarCode.MaterialBarcode = barCode;
printBarCode.PrintBarType = 2;//内胆码
Console.WriteLine($"L{DateTime.Now.ToString("yyMMdd")}{item.MaterialCode}{rowNum}");
Console.WriteLine($"{barCode}");
}
#region 打印
@ -414,13 +427,15 @@ namespace Aucma.Core.PrintTo.ViewModels
/// <returns></returns>
public async Task<string> GetMaxNumAsync(string MaterialCode,string falg)
{
string barCode = $"{falg}{DateTime.Now.ToString("yyMMdd")}{MaterialCode}";
try
{
List<int> tempList = new List<int>();
var list = await _printBarCodeServices.QueryAsync(d => d.MaterialBarcode.Contains(MaterialCode) && d.MaterialBarcode.Substring(0, 1).Equals(falg));
var list = await _printBarCodeServices.QueryAsync(d => d.MaterialBarcode.Contains(barCode) );
if (list.Count() == 0)
{
return "0001";
return barCode+"0001";
}
foreach (var item in list)
{
@ -428,15 +443,23 @@ namespace Aucma.Core.PrintTo.ViewModels
int num = Convert.ToInt32(code);
tempList.Add(num);
}
int row = tempList.Max() + 1;
if (row==10000)
{
MessageBox.Show("订单打印数据已经超过10000无法查询打印条码数据。", "系统提醒");
return null;
}
string maxStr = (tempList.Max() + 1).ToString();
string rowNum = maxStr.PadLeft(4, '0');
return rowNum;
return barCode+rowNum;
}
catch
{
return "0001";
return barCode+"0001";
}
}
#endregion
#endregion

@ -7,6 +7,7 @@ using Aucma.Core.PrintTo.Models;
using Aucma.Core.PrintTo.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using log4net;
using Microsoft.Extensions.DependencyInjection;
using System;
@ -30,6 +31,7 @@ namespace Aucma.Core.PrintTo.ViewModels
_printSuppleMentBarCodeServices = App.ServiceProvider.GetService<IPrintSuppleMentBarCodeServices>();
_baseOrderInfoServices = App.ServiceProvider.GetService<IBaseOrderInfoServices>();
Task.WaitAll(LoadData());
WeakReferenceMessenger.Default.Register<string>(this, Recive);
}
#region 选中订单参数
@ -73,11 +75,16 @@ namespace Aucma.Core.PrintTo.ViewModels
MessageBox.Show("请选中要补打的条码!", "系统提醒");
return;
}
int Id = Convert.ToInt32(obj);
if (string.IsNullOrWhiteSpace(obj))
{
MessageBox.Show("请选中要补打的条码!", "系统提醒");
return;
}
int Id = Convert.ToInt32(obj);
var printSuppleMentBarCode = _printSuppleMentBarCodeServices.FirstAsync(d => d.ObjId == Id).Result;
if (printSuppleMentBarCode != null)
{
if (printSuppleMentBarCode.IsPrint==1)
if (printSuppleMentBarCode.IsPrint=="1")
{
MessageBox.Show("选中的条码已补打过,请选择其他未补打条码!", "系统提醒");
return;
@ -156,7 +163,7 @@ namespace Aucma.Core.PrintTo.ViewModels
private async Task LoadData()
{
var list = await _printSuppleMentBarCodeServices.QueryAsync();
var list = await _printSuppleMentBarCodeServices.QueryAsync(d=>d.IsPrint==null|| d.IsPrint == "");
if (list == null) return;
foreach (var item in list)
@ -200,5 +207,22 @@ namespace Aucma.Core.PrintTo.ViewModels
}
}
#endregion
#region 刷新列表-其他界面刷新该方法
/// <summary>
/// 刷新列表
/// </summary>
/// <param name="recipient"></param>
/// <param name="message"></param>
private void Recive(object recipient, string message)
{
if (message == "RefreshSupplement")
{
Datalist.Clear();
Task.WaitAll(LoadData());
}
}
#endregion
}
}

@ -82,7 +82,7 @@ namespace Aucma.Core.PrintTo.ViewModels
#endregion
//打印完成 不可以再次打印
printSuppleMentBarCode.IsPrint = 1;
printSuppleMentBarCode.IsPrint = "1";
printSuppleMentBarCode.PrintTime = DateTime.Now;
await _printSuppleMentBarCodeServices.UpdateAsync(printSuppleMentBarCode);
//打印完成
@ -229,7 +229,27 @@ namespace Aucma.Core.PrintTo.ViewModels
}
#endregion
#region 关闭当前界面
/// <summary>
/// 关闭当前界面
/// </summary>
/// <param name="parameter"></param>
[RelayCommand]
public void CloseWindow(object parameter)
{
var window = parameter as Window;
if (window == null) return;
if (MessageBox.Show("确定要退出打印吗?", "系统提醒", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
printState = PrintState.Stopped;
WeakReferenceMessenger.Default.Send<string>("RefreshSupplement");//刷新窗口
window.Close();
}
}
#endregion
}
}

@ -166,6 +166,7 @@
<Label Content="查询条件" VerticalAlignment="Center" Foreground="White" />
<TextBox x:Name="queryParam" Text="" Style="{x:Null}" PreviewMouseDoubleClick="queryParam_PreviewMouseDown" Width="300" HorizontalAlignment="Left" VerticalContentAlignment="Center"/>
<Button Content="查询" Background="#4285DE" Width="100" Height="40" Margin="5 0" Command="{Binding QueryStringCommand}" CommandParameter="{Binding Text, ElementName=queryParam}"/>
</WrapPanel>
<UniformGrid Grid.Row="1" Margin="0 5 0 0" x:Name="HeightPanel">
<!--

@ -0,0 +1,15 @@
<Window x:Class="Aucma.Core.PrintTo.Views.LoginPageView"
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:Aucma.Core.PrintTo.Views"
mc:Ignorable="d"
Title="LoginPageView" Height="450" Width="800">
<Window.Background>
<ImageBrush ImageSource="/Assets/images/login-background.png" />
</Window.Background>
<Grid>
</Grid>
</Window>

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace Aucma.Core.PrintTo.Views
{
/// <summary>
/// LoginPageView.xaml 的交互逻辑
/// </summary>
public partial class LoginPageView : Window
{
public LoginPageView()
{
InitializeComponent();
}
}
}

@ -12,9 +12,10 @@
Title="二维码打印"
Height="700"
Width="700"
WindowStyle="None"
FontFamily="Microsoft YaHei"
WindowStartupLocation="CenterScreen"
WindowStyle="ToolWindow"
>
<Border Margin="5" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5">
<Grid Margin="15">

@ -12,9 +12,9 @@
Title="二维码打印"
Height="700"
Width="700"
WindowStyle="None"
FontFamily="Microsoft YaHei"
WindowStartupLocation="CenterScreen"
WindowStyle="ToolWindow"
WindowStartupLocation="CenterScreen"
>
<Border Margin="5" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5">
<Grid Margin="15">
@ -79,7 +79,7 @@
<WrapPanel Grid.Row="3" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="打印" x:Name="Start" Height="40" FontSize="18" Margin="20 0" Command="{Binding StartOperateCommand}" IsEnabled="{Binding OperateEnabled,Mode=TwoWay}"/>
<!--<Button Content="暂停" IsEnabled="True" x:Name="Suspend" Height="40" FontSize="18" Margin="20 0" Command="{Binding SuspendOperateCommand}" />-->
<!--<Button Content="关闭" x:Name="Close" Height="40" FontSize="18" Margin="20 0" Command="{Binding CloseWindowCommand}" CommandParameter="{Binding ElementName=window}" />-->
<Button Content="关闭" x:Name="Close" Height="40" FontSize="18" Margin="20 0" Command="{Binding CloseWindowCommand}" CommandParameter="{Binding ElementName=window}" />
</WrapPanel>
</Grid>
</GroupBox>

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

@ -15,7 +15,11 @@ namespace XamlGeneratedNamespace {
/// GeneratedInternalTypeHelper
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
<<<<<<< HEAD
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "7.0.9.0")]
=======
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.2.0")]
>>>>>>> 346821a670b23ccc6bf0121bb0363fb2fb2b4f48
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed class GeneratedInternalTypeHelper : System.Windows.Markup.InternalTypeHelper {

@ -8,4 +8,10 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = HwControlLib
<<<<<<< HEAD
build_property.ProjectDir = E:\c#\AUCMA\new\HwControlLib\
=======
build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\HwControlLib\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
>>>>>>> 346821a670b23ccc6bf0121bb0363fb2fb2b4f48

@ -4,7 +4,7 @@
library
C#
.cs
E:\桌面\AUCMA_SCADA\HwControlLib\obj\Debug\net6.0-windows\
D:\Project\gitea\AUCMA\SCADA\HwControlLib\obj\Debug\net6.0-windows\
HwControlLib
none
false
@ -13,8 +13,8 @@ TRACE;DEBUG;NET;NET6_0;NETCOREAPP
1204305769
71208292394
194-2005446070
194-428966090
Themes\Generic.xaml;
True
False

Loading…
Cancel
Save