增加功能:
1、增加可选是否上传至甲方数据库 2、增加AGV库位管理功能
This commit is contained in:
parent
88a65ffc61
commit
a4fc1b7c9c
1
.idea/.idea.Seyounth.Hyosung/.idea/avalonia.xml
generated
1
.idea/.idea.Seyounth.Hyosung/.idea/avalonia.xml
generated
@ -4,6 +4,7 @@
|
||||
<option name="projectPerEditor">
|
||||
<map>
|
||||
<entry key="Seyounth.Hyosung.Ava/App.axaml" value="Seyounth.Hyosung.Ava/Seyounth.Hyosung.Ava.csproj" />
|
||||
<entry key="Seyounth.Hyosung.Ava/Views/AgvBinManagerPage.axaml" value="Seyounth.Hyosung.Ava/Seyounth.Hyosung.Ava.csproj" />
|
||||
<entry key="Seyounth.Hyosung.Ava/Views/HomePage.axaml" value="Seyounth.Hyosung.Ava/Seyounth.Hyosung.Ava.csproj" />
|
||||
<entry key="Seyounth.Hyosung.Ava/Views/MainWindow.axaml" value="Seyounth.Hyosung.Ava/Seyounth.Hyosung.Ava.csproj" />
|
||||
<entry key="Seyounth.Hyosung.Ava/Views/PalletManagerPage.axaml" value="Seyounth.Hyosung.Ava/Seyounth.Hyosung.Ava.csproj" />
|
||||
|
||||
@ -8,5 +8,12 @@
|
||||
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/Seyounth.Hyosung/bin/Debug/net8.0-windows/hyosung.test</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="hyosung.db" uuid="fc9f4212-d271-41ba-908e-c4274b657472">
|
||||
<driver-ref>sqlite.xerial</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||
<jdbc-url>jdbc:sqlite:D:\RiderProjects\seyounth.hyosung.ty\Seyounth.Hyosung.Ava\bin\Debug\net8.0\hyosung.db</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
||||
@ -41,10 +41,12 @@ public partial class App : Application
|
||||
builder.Services.AddSingleton<PalletManagerPage>();
|
||||
builder.Services.AddSingleton<PalletManagerViewModel>();
|
||||
builder.Services.AddSingleton<ISukiToastManager, SukiToastManager>();
|
||||
builder.Services.AddSingleton<AgvBinManagerPage>();
|
||||
builder.Services.AddSingleton<AgvBinManagerViewModel>();
|
||||
builder.Services.AddHyosung(builder.Configuration);
|
||||
|
||||
_Host = builder.Build();
|
||||
//_Host.Services.UseHyosung();
|
||||
_Host.Services.UseHyosung();
|
||||
_Host.RunAsync();
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
SukiTheme.GetInstance().ChangeBaseTheme(ThemeVariant.Dark);
|
||||
|
||||
36
Seyounth.Hyosung.Ava/ViewModels/AgvBinManagerViewModel.cs
Normal file
36
Seyounth.Hyosung.Ava/ViewModels/AgvBinManagerViewModel.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Seyounth.Hyosung.Data.Entities;
|
||||
using Seyounth.Hyosung.Data.Models;
|
||||
using Seyounth.Hyosung.Data.Services;
|
||||
|
||||
namespace Seyounth.Hyosung.Ava.ViewModels;
|
||||
|
||||
public partial class AgvBinManagerViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty] private ObservableCollection<AgvBin> _bines;
|
||||
|
||||
private IAgvBinService _agvBinService;
|
||||
|
||||
public AgvBinManagerViewModel(IAgvBinService agvBinService)
|
||||
{
|
||||
_agvBinService = agvBinService;
|
||||
NavigatedTo();
|
||||
}
|
||||
|
||||
public void NavigatedTo()
|
||||
{
|
||||
Bines = new ObservableCollection<AgvBin>((_agvBinService.GetAllAsync().Result).Select(AgvBin.FromEntity));
|
||||
foreach (var agvBin in Bines)
|
||||
{
|
||||
agvBin.OnDeletedChanged += AgvBinOnOnDeletedChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task AgvBinOnOnDeletedChanged(AgvBin arg1, bool arg2)
|
||||
{
|
||||
await _agvBinService.ChangeDeletedStatus(arg1.Id, arg2);
|
||||
}
|
||||
}
|
||||
@ -25,6 +25,8 @@ public partial class HomeViewModel : ObservableObject
|
||||
|
||||
[ObservableProperty] private int _selectedYarnCarSideTypeIndex;
|
||||
|
||||
[ObservableProperty] private bool _isSendToErp;
|
||||
|
||||
|
||||
private readonly IVarietyService _varietyService;
|
||||
|
||||
@ -32,8 +34,16 @@ public partial class HomeViewModel : ObservableObject
|
||||
|
||||
private readonly ISukiToastManager _toastManager;
|
||||
|
||||
|
||||
partial void OnIsSendToErpChanged(bool value)
|
||||
{
|
||||
if (_runtime is not null)
|
||||
_runtime.SetIsSendToErp(value);
|
||||
}
|
||||
|
||||
public HomeViewModel(IVarietyService varietyService, IHyosungRuntime runtime, ISukiToastManager toastManager)
|
||||
{
|
||||
IsSendToErp = runtime.GetIsSendToErp();
|
||||
_varietyService = varietyService;
|
||||
_runtime = runtime;
|
||||
_toastManager = toastManager;
|
||||
|
||||
@ -43,6 +43,12 @@ public class MainWindowViewModel : ViewModelBase
|
||||
Header = "辅料管理",
|
||||
PageContent = provider.GetService<PalletManagerPage>(),
|
||||
Classes = { "Compact" }
|
||||
},
|
||||
new SukiSideMenuItem
|
||||
{
|
||||
Header = "库位管理",
|
||||
PageContent = provider.GetService<AgvBinManagerPage>(),
|
||||
Classes = { "Compact" }
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
28
Seyounth.Hyosung.Ava/Views/AgvBinManagerPage.axaml
Normal file
28
Seyounth.Hyosung.Ava/Views/AgvBinManagerPage.axaml
Normal file
@ -0,0 +1,28 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
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:suki="https://github.com/kikipoulet/SukiUI"
|
||||
xmlns:viewModels="clr-namespace:Seyounth.Hyosung.Ava.ViewModels"
|
||||
xmlns:views="clr-namespace:Seyounth.Hyosung.Ava.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:DataType="views:AgvBinManagerPage"
|
||||
x:Name="PalletPage"
|
||||
x:Class="Seyounth.Hyosung.Ava.Views.AgvBinManagerPage">
|
||||
<suki:SukiStackPage>
|
||||
<suki:SukiStackPage.Content>
|
||||
<Grid x:Name="库位管理" RowDefinitions="Auto,*">
|
||||
<DataGrid Grid.Row="1" GridLinesVisibility="All"
|
||||
ItemsSource="{Binding ViewModel.Bines, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="库位名称" Binding="{Binding BinCode}" />
|
||||
<DataGridTextColumn IsReadOnly="True" Header="代码" Binding="{Binding CtnrCode}" />
|
||||
<DataGridTextColumn Header="序号" Binding="{Binding Sort}" />
|
||||
<DataGridCheckBoxColumn IsReadOnly="True" Header="是否空闲" Binding="{Binding IsFree}" />
|
||||
<DataGridCheckBoxColumn Header="禁用" Binding="{Binding IsDeleted}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</suki:SukiStackPage.Content>
|
||||
</suki:SukiStackPage>
|
||||
</UserControl>
|
||||
24
Seyounth.Hyosung.Ava/Views/AgvBinManagerPage.axaml.cs
Normal file
24
Seyounth.Hyosung.Ava/Views/AgvBinManagerPage.axaml.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Seyounth.Hyosung.Ava.ViewModels;
|
||||
|
||||
namespace Seyounth.Hyosung.Ava.Views;
|
||||
|
||||
public partial class AgvBinManagerPage : UserControl
|
||||
{
|
||||
public AgvBinManagerViewModel ViewModel { get; }
|
||||
public AgvBinManagerPage(AgvBinManagerViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = this;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnLoaded(RoutedEventArgs e)
|
||||
{
|
||||
ViewModel.NavigatedTo();
|
||||
base.OnLoaded(e);
|
||||
}
|
||||
}
|
||||
@ -29,29 +29,40 @@
|
||||
<TextBlock Grid.Column="0" Grid.Row="3" VerticalAlignment="Center" Text="当前控制号" />
|
||||
<StackPanel Grid.Column="1" Grid.Row="3" Orientation="Horizontal">
|
||||
<TextBox Width="300" Text="{Binding ViewModel.SelectedVariety.LastNo,Mode=TwoWay}" />
|
||||
<Button Margin="10,0,0,0" Classes="Outlined Accent" Content="修改" Command="{Binding ViewModel.ChangeVarietyLastNoCommand }" />
|
||||
<Button Margin="10,0,0,0" Classes="Outlined Accent" Content="修改"
|
||||
Command="{Binding ViewModel.ChangeVarietyLastNoCommand }" />
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="0" Grid.Row="4" VerticalAlignment="Center" Text="产品编码" />
|
||||
<TextBox IsEnabled="False" Grid.Column="1" Grid.Row="4"
|
||||
<TextBox IsEnabled="False" Grid.Column="1" Grid.Row="4"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="{Binding ViewModel.SelectedVariety.Code}" />
|
||||
<TextBlock Grid.Column="0" Grid.Row="5" VerticalAlignment="Center" Text="LOT" />
|
||||
<TextBox IsEnabled="False" Grid.Column="1" Grid.Row="5"
|
||||
<TextBox IsEnabled="False" Grid.Column="1" Grid.Row="5"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="{Binding ViewModel.SelectedVariety.Lot}" />
|
||||
<TextBlock Grid.Column="0" Grid.Row="6" VerticalAlignment="Center" Text="码垛层数" />
|
||||
<TextBox IsEnabled="False" Grid.Column="1" Grid.Row="6"
|
||||
<TextBox IsEnabled="False" Grid.Column="1" Grid.Row="6"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="{Binding ViewModel.SelectedVariety.StackingLayers}" />
|
||||
<TextBlock Grid.Column="0" Grid.Row="7" VerticalAlignment="Center" Text="总数" />
|
||||
<TextBox IsEnabled="False" Grid.Column="1" Grid.Row="7"
|
||||
<TextBox IsEnabled="False" Grid.Column="1" Grid.Row="7"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="{Binding ViewModel.SelectedVariety.TotalCount}" />
|
||||
<Button Grid.Row="8" Grid.Column="1" Content="切换" Command="{Binding ViewModel.ChangeVarietyCommand }" Classes="Outlined"/>
|
||||
<Button Grid.Row="8" Grid.Column="1" Content="切换"
|
||||
Command="{Binding ViewModel.ChangeVarietyCommand }" Classes="Outlined" />
|
||||
</Grid>
|
||||
</suki:GroupBox>
|
||||
</suki:GlassCard>
|
||||
<suki:GlassCard Grid.Row="0" Grid.Column="1">
|
||||
<suki:GroupBox Header="便捷设置">
|
||||
<Grid RowDefinitions="*,*,*,*,*,*,*,*,*" ColumnDefinitions="*,*">
|
||||
<TextBlock Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" Text="传送至ERP" />
|
||||
<ToggleSwitch x:Name="IsSendToErp" HorizontalAlignment="Right" Grid.Column="1" Grid.Row="0"
|
||||
IsChecked="{Binding ViewModel.IsSendToErp}" />
|
||||
</Grid>
|
||||
</suki:GroupBox>
|
||||
</suki:GlassCard>
|
||||
|
||||
@ -22,4 +22,5 @@ public partial class HomePage : UserControl
|
||||
ViewModel.NavigatedTo();
|
||||
base.OnLoaded(e);
|
||||
}
|
||||
|
||||
}
|
||||
@ -106,7 +106,7 @@ public class HyosungPlcService(ILogger<HyosungPlcService> logger) : IHyosungPlcS
|
||||
await _writer.WriteShortsAsync(12120, ls.ToArray());
|
||||
}
|
||||
|
||||
public async Task WritePrintLabelOptionsAsync(int master, int slave, int color)
|
||||
public async Task WritePrintLabelOptionsAsync(int master, int slave, int color, bool isSendToErp)
|
||||
{
|
||||
short masterCount = 0;
|
||||
switch (master)
|
||||
@ -148,10 +148,11 @@ public class HyosungPlcService(ILogger<HyosungPlcService> logger) : IHyosungPlcS
|
||||
break;
|
||||
}
|
||||
|
||||
masterCount=isSendToErp ? masterCount : (short)2;
|
||||
if (color == 1)
|
||||
{
|
||||
await _writer.WriteShortsAsync(13050, [1, 1, 1, masterCount]);
|
||||
await _writer.WriteShortsAsync(13055, [1, 1]);
|
||||
await _writer.WriteShortsAsync(13055, [1, 1]);
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
@ -58,7 +58,7 @@ public interface IHyosungPlcService
|
||||
|
||||
Task WritePackLineOptionAsync(PackLineOption option);
|
||||
|
||||
Task WritePrintLabelOptionsAsync(int masterCount, int slaveCount, int color);
|
||||
Task WritePrintLabelOptionsAsync(int masterCount, int slaveCount, int color,bool isSendToErp);
|
||||
|
||||
Task WritePrintLabelResultAsync(int index, bool result);
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Seyounth.Hyosung.Data.Entities;
|
||||
|
||||
38
Seyounth.Hyosung.Data/Models/AgvBin.cs
Normal file
38
Seyounth.Hyosung.Data/Models/AgvBin.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Seyounth.Hyosung.Data.Entities;
|
||||
|
||||
namespace Seyounth.Hyosung.Data.Models;
|
||||
|
||||
public partial class AgvBin : ObservableObject
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string BinCode { get; set; }
|
||||
public string CtnrCode { get; set; }
|
||||
|
||||
public bool IsFree { get; set; }
|
||||
|
||||
public int Sort { get; set; }
|
||||
|
||||
[ObservableProperty] private bool _isDeleted;
|
||||
|
||||
public event Func<AgvBin, bool, Task>? OnDeletedChanged;
|
||||
|
||||
partial void OnIsDeletedChanged(bool value)
|
||||
{
|
||||
// 触发视图模型的保存方法
|
||||
OnDeletedChanged?.Invoke(this, value);
|
||||
}
|
||||
|
||||
public static AgvBin FromEntity(AgvBinEntity entity)
|
||||
{
|
||||
return new AgvBin()
|
||||
{
|
||||
Id = entity.Id,
|
||||
BinCode = entity.BinCode,
|
||||
CtnrCode = entity.CtnrCode,
|
||||
IsDeleted = entity.IsDeleted,
|
||||
Sort = entity.Sort,
|
||||
IsFree = entity.IsFree,
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -6,29 +6,35 @@ namespace Seyounth.Hyosung.Data.Services;
|
||||
|
||||
public class AgvBinService : IAgvBinService
|
||||
{
|
||||
private readonly List<AgvBinEntity> _cache;
|
||||
// private readonly List<AgvBinEntity> _cache;
|
||||
|
||||
private readonly IRepository<AgvBinEntity> _repository;
|
||||
|
||||
public AgvBinService(IServiceProvider provider)
|
||||
{
|
||||
_repository = provider.CreateScope().ServiceProvider.GetRequiredService<IRepository<AgvBinEntity>>();
|
||||
_repository = provider.CreateScope().ServiceProvider.GetRequiredService<IRepository<AgvBinEntity>>();
|
||||
//_repository = provider.GetService<IRepository<AgvBinEntity>>();
|
||||
_cache = _repository.GetList();
|
||||
// _cache = _repository.GetList();
|
||||
}
|
||||
|
||||
public async Task<AgvBinEntity> GetAvailableBin(int height)
|
||||
{
|
||||
var bin = await _repository.CopyNew().AsQueryable()
|
||||
.Where(x => x.IsFree && !x.IsDeleted).OrderBy(x => x.Sort).FirstAsync();
|
||||
if (bin.BinCode == "B10")
|
||||
var maxRackType1 = await _repository.CopyNew().AsQueryable()
|
||||
.Where(x => x.RackType == 1)
|
||||
.MaxAsync(r => r.Sort);
|
||||
var maxRackType2 = await _repository.CopyNew().AsQueryable()
|
||||
.Where(x => x.RackType == 2)
|
||||
.MaxAsync(r => r.Sort);
|
||||
if (bin.Sort == maxRackType1)
|
||||
{
|
||||
await _repository.CopyNew().AsUpdateable()
|
||||
.Where(x => x.RackType == 2 && !x.IsDeleted)
|
||||
.SetColumns(x => x.IsFree, true)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
else if (bin.BinCode == "B32")
|
||||
else if (bin.Sort == maxRackType2)
|
||||
{
|
||||
await _repository.CopyNew().AsUpdateable()
|
||||
.Where(x => x.RackType == 1 && !x.IsDeleted)
|
||||
@ -41,8 +47,22 @@ public class AgvBinService : IAgvBinService
|
||||
|
||||
public Task BindAsync(AgvBinEntity entity)
|
||||
{
|
||||
entity.IsFree = false;
|
||||
_cache.First(e => e.Id == entity.Id).IsFree = false;
|
||||
// entity.IsFree = false;
|
||||
// _cache.First(e => e.Id == entity.Id).IsFree = false;
|
||||
return _repository.CopyNew().UpdateAsync(entity);
|
||||
}
|
||||
|
||||
public async Task<List<AgvBinEntity>> GetAllAsync()
|
||||
{
|
||||
var rs = await _repository.CopyNew().GetListAsync();
|
||||
return rs;
|
||||
}
|
||||
|
||||
public async Task ChangeDeletedStatus(int id, bool isDeleted)
|
||||
{
|
||||
await _repository.CopyNew().AsUpdateable()
|
||||
.Where(x => x.Id == id)
|
||||
.SetColumns(x => x.IsDeleted, isDeleted)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
@ -13,10 +13,10 @@ public class DictService : IDictService
|
||||
|
||||
public DictService(IServiceProvider provider)
|
||||
{
|
||||
_repository = provider.CreateScope()
|
||||
.ServiceProvider.GetRequiredService<IRepository<DictEntity>>();
|
||||
_repository = provider.CreateScope()
|
||||
.ServiceProvider.GetRequiredService<IRepository<DictEntity>>();
|
||||
//_repository = provider.GetService<IRepository<DictEntity>>();
|
||||
_cache = _repository.GetList();
|
||||
_cache = _repository.GetList();
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,8 @@ public class DictService : IDictService
|
||||
public async Task SetValue(string type, string key, string value)
|
||||
{
|
||||
await _repository.CopyNew().AsUpdateable()
|
||||
.Where(x => x.Type == type && x.Key == key).SetColumns(x => x.Value, value).ExecuteCommandAsync(); ;
|
||||
.Where(x => x.Type == type && x.Key == key).SetColumns(x => x.Value, value).ExecuteCommandAsync();
|
||||
;
|
||||
}
|
||||
|
||||
public async Task<string> GetValue(string type, string key)
|
||||
@ -41,4 +42,20 @@ public class DictService : IDictService
|
||||
var dict = await _repository.CopyNew().GetFirstAsync(x => x.Type == type && x.Key == key);
|
||||
return dict.Value;
|
||||
}
|
||||
|
||||
public async Task<string> GetOrAddNewValue(string type, string key, string defaultValue = "")
|
||||
{
|
||||
var newRepo = _repository.CopyNew();
|
||||
var dict = await newRepo.GetFirstAsync(x => x.Type == type && x.Key == key);
|
||||
if (dict is null)
|
||||
{
|
||||
dict = new DictEntity();
|
||||
dict.Type = type;
|
||||
dict.Key = key;
|
||||
dict.Value = defaultValue;
|
||||
await newRepo.InsertAsync(dict);
|
||||
}
|
||||
|
||||
return dict.Value;
|
||||
}
|
||||
}
|
||||
@ -18,4 +18,8 @@ public interface IAgvBinService
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task BindAsync(AgvBinEntity entity);
|
||||
|
||||
Task<List<AgvBinEntity>> GetAllAsync();
|
||||
|
||||
Task ChangeDeletedStatus(int id,bool isDeleted);
|
||||
}
|
||||
@ -11,4 +11,6 @@ public interface IDictService
|
||||
Task SetValue(string type, string key,string value);
|
||||
|
||||
Task<string> GetValue(string type, string key);
|
||||
|
||||
Task<string> GetOrAddNewValue(string type, string key, string defaultValue = "");
|
||||
}
|
||||
@ -36,6 +36,8 @@ public class HyosungRuntime(
|
||||
|
||||
private string currentPrintTrayCode = "";
|
||||
|
||||
private bool _isSendToErp = false;
|
||||
|
||||
public async Task StartAsync(CancellationToken token)
|
||||
{
|
||||
reportExportService.ExportNoExportAsync();
|
||||
@ -52,6 +54,7 @@ public class HyosungRuntime(
|
||||
hyosungPlcService.OnRequestPrintLabel += OnPlcRequestPrintLabel;
|
||||
hyosungPlcService.OnRequestGetPrintLableOption += OnRequestGetPrintLabel;
|
||||
hyosungPlcService.OnRequestScanEntry += OnPlcRequestScanEntry;
|
||||
_isSendToErp = bool.Parse(dictService.GetOrAddNewValue("system", "IsSendToErp", "true").Result);
|
||||
await hyosungPlcService.StartAsync(token);
|
||||
}
|
||||
|
||||
@ -124,6 +127,17 @@ public class HyosungRuntime(
|
||||
}
|
||||
}
|
||||
|
||||
public bool GetIsSendToErp()
|
||||
{
|
||||
return _isSendToErp;
|
||||
}
|
||||
|
||||
public async Task SetIsSendToErp(bool isSendToErp)
|
||||
{
|
||||
_isSendToErp = isSendToErp;
|
||||
await dictService.SetValue("system", "IsSendToErp", isSendToErp.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理PLC请求扫描治具事件
|
||||
/// </summary>
|
||||
@ -208,7 +222,8 @@ public class HyosungRuntime(
|
||||
//标志下线已完成
|
||||
await hyosungPlcService.LeaveCompletedAsync();
|
||||
var tray = await trayService.GetByCode(info.TrayCode);
|
||||
await hyosungWmsService.AddPdaPutawayRecord(tray.Barcode);
|
||||
if (_isSendToErp)
|
||||
await hyosungWmsService.AddPdaPutawayRecord(tray.Barcode);
|
||||
logger.LogInformation($"plc leaving production line success");
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -376,7 +391,7 @@ public class HyosungRuntime(
|
||||
_ = await trayService.PrintTrayAsync(arg, mod, variety);
|
||||
await dictService.SetValue("System", "CurrentPackingTrayCode", arg);
|
||||
await hyosungPlcService.WritePrintLabelOptionsAsync(variety.MasterLabelCount, variety.SubLabelCount,
|
||||
variety.LabelColor);
|
||||
variety.LabelColor, _isSendToErp);
|
||||
logger.LogInformation("request print option succeed");
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -410,8 +425,9 @@ public class HyosungRuntime(
|
||||
{
|
||||
//if (arg1 == 3)
|
||||
// arg1 = 2;
|
||||
await printer.PrintMasterLabelAsync(arg1-1, tray.TrayCode);
|
||||
await hyosungWmsService.AddLabelResult(new LabelResult(tray, variety));
|
||||
await printer.PrintMasterLabelAsync(arg1 - 1, tray.TrayCode);
|
||||
if (_isSendToErp)
|
||||
await hyosungWmsService.AddLabelResult(new LabelResult(tray, variety));
|
||||
}
|
||||
|
||||
await hyosungPlcService.WritePrintLabelResultAsync(arg1, true);
|
||||
|
||||
@ -38,4 +38,8 @@ public interface IHyosungRuntime
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task GenerateReportAsync();
|
||||
|
||||
bool GetIsSendToErp();
|
||||
|
||||
Task SetIsSendToErp(bool isSendToErp);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user