add-添加登录功能

main
liuwf 10 months ago
parent 0204c8b3d9
commit e370d1460c

@ -2541,6 +2541,11 @@
箱体名称
</summary>
</member>
<member name="P:Admin.Core.Model.CodeBindingRecord.LinerCode">
<summary>
内胆码
</summary>
</member>
<member name="P:Admin.Core.Model.CodeBindingRecord.ProductCode">
<summary>
成品码

@ -11,5 +11,11 @@ namespace Admin.Core.IService.IService_New
public interface IRecordBoxFoamFixtureComplateServices : IBaseServices<RecordBoxFoamFixtureComplate>
{
bool SaveFixtureComplate(List<RecordBoxFoamFixtureComplate> fixture, string productLineCode, string stationCode);
/// <summary>
/// 获取班组产量
/// </summary>
/// <returns></returns>
public List<RecordBoxFoamFixtureComplate> getTeamData(string productLine,string teamName);
}
}

@ -31,6 +31,11 @@ namespace Admin.Core.Model
[SugarColumn(ColumnName = "BOX_Name")]
public string BoxName { get; set; }
/// <summary>
/// 内胆码
/// </summary>
[SugarColumn(ColumnName = "LINER_CODE")]
public string LinerCode { get; set; }
/// <summary>
/// 成品码
/// </summary>
[SugarColumn(ColumnName = "PRODUCT_CODE")]

@ -46,6 +46,29 @@ namespace Admin.Core.Service.Service_New
_materialCompletionServices = materialCompletionServices;
}
/// <summary>
/// 获取班组产量
/// </summary>
/// <returns></returns>
public List<RecordBoxFoamFixtureComplate> getTeamData(string productLine, string teamName)
{
List<RecordBoxFoamFixtureComplate> list;
try
{
var _db = this.BaseDal.Db;
list = _db.CopyNew().Ado.SqlQuery<RecordBoxFoamFixtureComplate>($"SELECT * FROM DATA_BOXFOAM_FIXTURECOMPLATE WHERE LOGIN_TEAM='{teamName}' and PRODUCTION_LINE='{productLine}'");
}
catch (Exception ex)
{
list = null;
}
return list;
}
/// <summary>
/// 保存夹具生产数量
/// </summary>
@ -70,9 +93,8 @@ namespace Admin.Core.Service.Service_New
RecordBoxFoamFixtureComplate lastFixtureComplate = lastFixtureList.OrderByDescending(x => x.RecordTime).First();
if (lastFixtureComplate != null)
{
if (item.FixtureBoxType == lastFixtureComplate.FixtureBoxType)
{
if (item.FixtureOutPut > lastFixtureComplate.FixtureOutPut)
if (item.FixtureOutPut != lastFixtureComplate.FixtureOutPut)
{
item.RealOutPut = item.FixtureOutPut - lastFixtureComplate.FixtureOutPut;
@ -86,7 +108,7 @@ namespace Admin.Core.Service.Service_New
break;
}
}
}
}

@ -42,7 +42,7 @@ namespace Aucma.Core.BoxFoam.Business
public void Init()
{
DayShiftInfoCut();
NightShiftInfoCut();
}
@ -66,7 +66,7 @@ namespace Aucma.Core.BoxFoam.Business
{
scheduledTime = new DateTime(now.Year, now.Month, now.Day, 08, 00, 00);
}
if (now > scheduledTime)
{

@ -23,11 +23,15 @@ using System.Threading;
using Aucma.Core.HwPLc;
using Admin.Core.Model.ViewModels;
using System.Windows;
using Admin.Core.Model.Model_New;
using Admin.Core.IService.IService_New;
using Aucma.Core.BoxFoam.Config;
namespace Aucma.Core.BoxFoam.ViewModels
{
public partial class FoamMonitorPageViewModel : ObservableObject
{
private readonly IRecordBoxFoamFixtureComplateServices? _boxFoamCompleteServices;
private readonly IBaseBomInfoServices? _baseBomInfoServices;
private readonly IBoxFoamDataServices _boxFoamDataServices;
private readonly ICurrentTeamTimeServices _currentTeamTimeServices;
@ -37,12 +41,13 @@ namespace Aucma.Core.BoxFoam.ViewModels
private readonly IBoxFoamDataRecordServices _boxFoamDataRecordServices;
private readonly IBoxFoamDataRealTimeServices? _boxFoamDataRealTimeServices;
private readonly IBoxFoamDataRealTimeHistoryServices _boxFoamDataRealTimeHistoryServices;
System.Timers.Timer timer2 = new System.Timers.Timer(5000);
private AppConfig appConfig = AppConfig.Instance;
int totalAmount = 0;
public FoamMonitorPageViewModel()
{
_boxFoamCompleteServices = App.ServiceProvider.GetService<IRecordBoxFoamFixtureComplateServices>();
_boxFoamPlanServices = App.ServiceProvider.GetService<IBoxFoamPlanServices>();
_boxFoamDataRealTimeServices = App.ServiceProvider.GetService<IBoxFoamDataRealTimeServices>();
_boxFoamDataRecordServices = App.ServiceProvider.GetService<IBoxFoamDataRecordServices>();
@ -59,8 +64,7 @@ namespace Aucma.Core.BoxFoam.ViewModels
{
while (true)
{
Thread.Sleep(5000);
Thread.Sleep(10000);
InitEveryDayMethod();
}
@ -74,44 +78,39 @@ namespace Aucma.Core.BoxFoam.ViewModels
/// 每日生产
/// </summary>
/// <returns></returns>
private Task InitEveryDayMethod()
private void InitEveryDayMethod()
{
try
{
Application.Current.Dispatcher.Invoke(() =>
{
List<string> xList = new List<string>();
List<WorkTime> listTime = _baseBomInfoServices.getWorkTime().Result;
foreach (WorkTime time in listTime)
{
xList.Add(time.hourTime);
}
ProductionHourList = xList;
// 货道列表
List<BoxFoamData> list = _boxFoamDataServices.QueryAsync(x => x.ProductLineCode.Equals("CX_02") && x.StationCode == "1005").Result;
List <RecordBoxFoamFixtureComplate> list = _boxFoamCompleteServices.getTeamData(appConfig.ProductlineCode,appConfig.TeamName);
if (list != null)
Application.Current.Dispatcher.Invoke(() =>
{
ProductionHourList.Clear();
Achievement.Clear();
MaterialNameList.Clear();
ModelStatistics.Clear();
});
#region 按时间统计
list = list.OrderBy(x => x.RecordTime).ToList();
var result = list.GroupBy(x => x.RecordTime.Hour)
.Select(g => new {
Hour = g.Key,
Amount = g.Count()
});
Application.Current.Dispatcher.Invoke(() =>
{
ChartValues<double> achievement = new ChartValues<double>();
//Achievement.Clear();
#region 按时间统计
if (list.Count > 0)
foreach (var item in result)
{
achievement.Add(list.Sum(x => x.AnHour));
achievement.Add(list.Sum(x => x.TwoHour));
achievement.Add(list.Sum(x => x.ThreeHour));
achievement.Add(list.Sum(x => x.FourHour));
achievement.Add(list.Sum(x => x.FiveHour));
achievement.Add(list.Sum(x => x.SixHour));
achievement.Add(list.Sum(x => x.SevenHour));
achievement.Add(list.Sum(x => x.EightHour));
achievement.Add(list.Sum(x => x.NineHour));
achievement.Add(list.Sum(x => x.TenHour));
achievement.Add(list.Sum(x => x.ElevenHour));
achievement.Add(list.Sum(x => x.TwelveHour));
ProductionHourList.Add($"{item.Hour}:00");
achievement.Add(item.Amount);
}
var column = new ColumnSeries();
@ -119,67 +118,44 @@ namespace Aucma.Core.BoxFoam.ViewModels
column.Title = "当日小时产量统计";
column.Values = achievement;
column.Foreground = Brushes.White;
// Achievement.Add(column);
if (Achievement.Count > 0)
{
for (int i = 0; i < achievement.Count; i++)
{
Achievement.FirstOrDefault().Values[i] = achievement[i];
}
}
else
{
Achievement.Add(column);
}
#endregion
Achievement.Add(column);
#endregion
#region 按类型统计
MaterialNameList = new List<string>();
ChartValues<int> achievement2 = new ChartValues<int>();
//foreach(BoxFoamData space in list)
//{
// MaterialNameList.Add(space.Fixtureboxtype);
//}
var grouped = list.GroupBy(x => x.Fixtureboxtype);
foreach (var item in grouped)
{
var flattenedList = item.SelectMany(p => new[] { p.AnHour, p.TwoHour, p.ThreeHour, p.FourHour, p.FiveHour, p.SixHour, p.SevenHour, p.EightHour, p.NineHour, p.TenHour, p.ElevenHour, p.TwelveHour }).ToList();
MaterialNameList.Add(item.Key);
achievement2.Add(flattenedList.Sum());
}
// ModelStatistics.Clear();
var column2 = new ColumnSeries();
column2.DataLabels = true;
column2.Title = "当日型号产量统计";
column2.Values = achievement2;
column2.Foreground = Brushes.White;
// ModelStatistics.Add(column2);
if (ModelStatistics.Count > 0)
{
for (int i = 0; i < achievement2.Count; i++)
{
ModelStatistics.FirstOrDefault().Values[i] = achievement2[i];
}
}
else
{
ModelStatistics.Add(column2);
}
#region 按类型统计
ChartValues<int> achievement2 = new ChartValues<int>();
var grouped = list.GroupBy(x => x.FixtureBoxType)
.Select(y => new {
Type = y.Key,
Amount = y.Count()
});
foreach (var item in grouped)
{
MaterialNameList.Add(item.Type);
achievement2.Add(item.Amount);
}
var column2 = new ColumnSeries();
column2.DataLabels = true;
column2.Title = "当日型号产量统计";
column2.Values = achievement2;
column2.Foreground = Brushes.White;
ModelStatistics.Add(column2);
#endregion
}
});
});
}
catch (Exception ex)
{
Console.WriteLine(ex.Message.ToString());
}
return Task.CompletedTask;
}
@ -189,7 +165,7 @@ namespace Aucma.Core.BoxFoam.ViewModels
/// <summary>
/// 日产量柱状图X轴日期
/// </summary>
private List<string> productionHourList;
private List<string> productionHourList = new List<string>();
public List<string> ProductionHourList
{
@ -205,7 +181,7 @@ namespace Aucma.Core.BoxFoam.ViewModels
/// <summary>
/// 型号统计柱状图x轴物料类型
/// </summary>
private List<string> materialNameList;
private List<string> materialNameList = new List<string>();
public List<string> MaterialNameList
{

@ -37,7 +37,8 @@ namespace Aucma.Core.BoxFoam.ViewModels
/// <param name="team">选择的班组信息</param>
/// <param name="userName">用户名</param>
/// <param name="passWord">密码</param>
public void Login(BaseTeamMembers team, string userName, string passWord,object parameter)
/// <param name="isTeamChanged">是否切班</param>
public void Login(BaseTeamMembers team, string userName, string passWord,object parameter,bool isTeamChanged)
{
try
{
@ -69,8 +70,13 @@ namespace Aucma.Core.BoxFoam.ViewModels
window.Hide();
MainWindow indexPage = MainWindow.Instance;
indexPage.Show();
// window.Close();
if (isTeamChanged)
{
// TODO 调用委托处理班组切换方法
}
log.Info($"班组:{appConfig.TeamName}、用户:{appConfig.Account}登录,是否切班:{isTeamChanged}");
// window.Close();
}
else
{

@ -28,7 +28,7 @@
</StackPanel>
</UniformGrid>
<UniformGrid Grid.Row="1" Margin="0 10">
<Border BorderThickness="4" CornerRadius="5" x:Name="DialogHost" Width="400" Height="350" VerticalAlignment="Center" HorizontalAlignment="Center" >
<Border BorderThickness="4" CornerRadius="5" x:Name="DialogHost" Width="400" Height="450" VerticalAlignment="Center" HorizontalAlignment="Center" >
<StackPanel Background="White">
<ComboBox Margin="0 50 0 0"
@ -41,7 +41,16 @@
DisplayMemberPath="TeamName"
ItemsSource="{Binding TeamMembersList}"
Style="{StaticResource MaterialDesignOutlinedComboBox}" />
<ComboBox Margin="0 10 0 0"
x:Name="IsChanged"
Width="300"
BorderThickness="1"
BorderBrush="{StaticResource MaterialDesignDivider}"
materialDesign:HintAssist.Hint="是否切班"
Style="{StaticResource MaterialDesignOutlinedComboBox}" >
<ComboBoxItem Content="不切班"/>
<ComboBoxItem Content="切班"/>
</ComboBox>
<TextBox Margin="0 10 0 0"
x:Name="txtUserName"
Width="300"

@ -43,7 +43,7 @@ namespace Aucma.Core.BoxFoam.Views
private void loginBtn_Click(object sender, RoutedEventArgs e)
{
bool isTeamChanged ;
string userName = txtUserName.Text;
string passWord = txtPassword.Password;
BaseTeamMembers teamMembers = (BaseTeamMembers)this.selectTeamComboBox.SelectedItem;
@ -52,6 +52,11 @@ namespace Aucma.Core.BoxFoam.Views
MessageBox.Show("请选择班组!","系统提醒");
return;
}
if (string.IsNullOrEmpty(IsChanged.Text))
{
MessageBox.Show("请选择是否切班!", "系统提醒");
return;
}
// 非空校验,账号密码正则校验
if (string.IsNullOrWhiteSpace(userName))
{
@ -63,10 +68,12 @@ namespace Aucma.Core.BoxFoam.Views
MessageBox.Show("密码不可为空!", "系统提醒");
return;
}
isTeamChanged = "切班" == IsChanged.Text ? true : false;
// 登录校验
txtUserName.Text = "";
txtPassword.Password = "";
loginViewModel.Login(teamMembers,userName, passWord,this);
IsChanged.Text = "";
loginViewModel.Login(teamMembers,userName, passWord,this,isTeamChanged);
}

@ -37,7 +37,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
/// <param name="team">选择的班组信息</param>
/// <param name="userName">用户名</param>
/// <param name="passWord">密码</param>
public void Login(BaseTeamMembers team, string userName, string passWord,object parameter)
public void Login(BaseTeamMembers team, string userName, string passWord,object parameter,bool isTeamChanged)
{
try
{
@ -69,8 +69,12 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
window.Hide();
MainWindow indexPage = MainWindow.Instance;
indexPage.Show();
// window.Close();
if (isTeamChanged)
{
// TODO 调用委托处理班组切换方法
}
log.Info($"班组:{appConfig.TeamName}、用户:{appConfig.Account}登录,是否切班:{isTeamChanged}");
// window.Close();
}
else
{

@ -28,6 +28,10 @@ using System.Windows.Forms;
using Aucma.Core.HwPLc;
using Aucma.Core.PLc;
using System.Windows.Input;
using Admin.Core.IService.IService_New;
using Aucma.Core.OldBoxFoam.Config;
using Application = System.Windows.Application;
using System.Threading;
namespace Aucma.Core.OldBoxFoam.ViewModels
{
@ -37,22 +41,30 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
* */
public partial class RealRoadPageViewModel : ObservableObject
{
private readonly IRecordBoxFoamFixtureComplateServices? _boxFoamCompleteServices;
private readonly log4net.ILog log = LogManager.GetLogger(typeof(RealRoadPageViewModel));
protected readonly IBoxFoamPlanServices? _boxFoamPlanServices;
private IOldBoxFoamTypeServices? _oldBoxFoamTypeServices;
private IBoxFoamDataServices? _boxFoamDataServices;
System.Timers.Timer timer2 = new System.Timers.Timer(3000);
private AppConfig appConfig = AppConfig.Instance;
public RealRoadPageViewModel()
{
YAxisLabelFormatter = value => Math.Round(value, 2).ToString();
YAxisLabelFormatter = value => Math.Round(value, 2).ToString();
_boxFoamCompleteServices = App.ServiceProvider.GetService<IRecordBoxFoamFixtureComplateServices>();
_boxFoamPlanServices = App.ServiceProvider.GetService<IBoxFoamPlanServices>();
_oldBoxFoamTypeServices = App.ServiceProvider.GetService<IOldBoxFoamTypeServices>();
_boxFoamDataServices = App.ServiceProvider.GetService<IBoxFoamDataServices>();
//InitData();
Collection.RefreshSpaceEvent += InitData;
Task.Run(() =>
{
while (true)
{
Thread.Sleep(10000);
InitEveryDayMethod();
}
});
}
#region 参数定义
@ -84,7 +96,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
/// <summary>
/// 小时产量统计图表X轴
/// </summary>
private List<string> _hourOutPutList;
private List<string> _hourOutPutList = new List<string>();
public List<string> HourOutPutList
{
@ -109,7 +121,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
OnPropertyChanged(nameof(MaterialTypeAchievement));
}
}
private List<string> _materialTypeOutPutList;
private List<string> _materialTypeOutPutList = new List<string>();
public List<string> MaterialTypeOutPutList
{
@ -232,8 +244,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
await _oldBoxFoamTypeServices.UpdateAsync(storeList);
}
RefreshSpaceInfoDataGrid(spaceDetailModel, fixtureStatus);
RefreshHourOutPutChart();
RefreshMaterialTypeChart();
}
@ -319,8 +330,96 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
}
}
#region 日产量
/// <summary>
/// 小时统计图表
/// 每日生产
/// </summary>
/// <returns></returns>
private void InitEveryDayMethod()
{
try
{
List<RecordBoxFoamFixtureComplate> list = _boxFoamCompleteServices.getTeamData(appConfig.ProductlineCode, appConfig.TeamName);
Application.Current.Dispatcher.Invoke(() =>
{
HourOutPutList.Clear();
HourAchievement.Clear();
MaterialTypeOutPutList.Clear();
MaterialTypeAchievement.Clear();
});
#region 按时间统计
list = list.OrderBy(x => x.RecordTime).ToList();
var result = list.GroupBy(x => x.RecordTime.Hour)
.Select(g => new {
Hour = g.Key,
Amount = g.Count()
});
Application.Current.Dispatcher.Invoke(() =>
{
ChartValues<double> achievement = new ChartValues<double>();
foreach (var item in result)
{
HourOutPutList.Add($"{item.Hour}:00");
achievement.Add(item.Amount);
}
var column = new ColumnSeries();
column.DataLabels = true;
column.Title = "当日小时产量统计";
column.Values = achievement;
column.Foreground = Brushes.White;
HourAchievement.Add(column);
#endregion
#region 按类型统计
ChartValues<int> achievement2 = new ChartValues<int>();
var grouped = list.GroupBy(x => x.FixtureBoxType)
.Select(y => new {
Type = y.Key,
Amount = y.Count()
});
foreach (var item in grouped)
{
MaterialTypeOutPutList.Add(item.Type);
achievement2.Add(item.Amount);
}
var column2 = new ColumnSeries();
column2.DataLabels = true;
column2.Title = "当日型号产量统计";
column2.Values = achievement2;
column2.Foreground = Brushes.White;
MaterialTypeAchievement.Add(column2);
#endregion
});
}
catch (Exception ex)
{
Console.WriteLine(ex.Message.ToString());
}
}
#endregion
/// <summary>
/// 小时统计图表--弃用
/// </summary>
private void RefreshHourOutPutChart()
{
@ -394,7 +493,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
}
/// <summary>
/// 型号统计图表
/// 型号统计图表--弃用
/// </summary>
private void RefreshMaterialTypeChart()
{
@ -444,6 +543,8 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
}
private OldBoxFoamTypeModel selectedDataItem;
public OldBoxFoamTypeModel SelectedDataItem
{

@ -28,7 +28,7 @@
</StackPanel>
</UniformGrid>
<UniformGrid Grid.Row="1" Margin="0 10">
<Border BorderThickness="4" CornerRadius="5" x:Name="DialogHost" Width="400" Height="350" VerticalAlignment="Center" HorizontalAlignment="Center" >
<Border BorderThickness="4" CornerRadius="5" x:Name="DialogHost" Width="400" Height="450" VerticalAlignment="Center" HorizontalAlignment="Center" >
<StackPanel Background="White">
<ComboBox Margin="0 50 0 0"
@ -41,7 +41,16 @@
DisplayMemberPath="TeamName"
ItemsSource="{Binding TeamMembersList}"
Style="{StaticResource MaterialDesignOutlinedComboBox}" />
<ComboBox Margin="0 10 0 0"
x:Name="IsChanged"
Width="300"
BorderThickness="1"
BorderBrush="{StaticResource MaterialDesignDivider}"
materialDesign:HintAssist.Hint="是否切班"
Style="{StaticResource MaterialDesignOutlinedComboBox}" >
<ComboBoxItem Content="不切班"/>
<ComboBoxItem Content="切班"/>
</ComboBox>
<TextBox Margin="0 10 0 0"
x:Name="txtUserName"
Width="300"

@ -42,6 +42,7 @@ namespace Aucma.Core.OldBoxFoam.Views
private void loginBtn_Click(object sender, RoutedEventArgs e)
{
bool isTeamChanged;
string userName = txtUserName.Text;
string passWord = txtPassword.Password;
BaseTeamMembers teamMembers = (BaseTeamMembers)this.selectTeamComboBox.SelectedItem;
@ -50,6 +51,11 @@ namespace Aucma.Core.OldBoxFoam.Views
MessageBox.Show("请选择班组!","系统提醒");
return;
}
if (string.IsNullOrEmpty(IsChanged.Text))
{
MessageBox.Show("请选择是否切班!", "系统提醒");
return;
}
// 非空校验,账号密码正则校验
if (string.IsNullOrWhiteSpace(userName))
{
@ -61,10 +67,12 @@ namespace Aucma.Core.OldBoxFoam.Views
MessageBox.Show("密码不可为空!", "系统提醒");
return;
}
isTeamChanged = "切班" == IsChanged.Text ? true : false;
// 登录校验
txtUserName.Text = "";
txtPassword.Password = "";
loginViewModel.Login(teamMembers,userName, passWord,this);
IsChanged.Text = "";
loginViewModel.Login(teamMembers,userName, passWord,this, isTeamChanged);
}

@ -178,7 +178,7 @@
<lvc:CartesianChart.AxisY>
<lvc:Axis Foreground="White" FontSize="15" MinValue="0" LabelFormatter="{Binding YAxisLabelFormatter}" >
<lvc:Axis.Separator>
<lvc:Separator Visibility="Hidden" StrokeThickness="1" StrokeDashArray="3" Stroke="Transparent">
<lvc:Separator Step="50" Visibility="Hidden" StrokeThickness="1" StrokeDashArray="3" Stroke="Transparent">
</lvc:Separator>
</lvc:Axis.Separator>
</lvc:Axis>
@ -210,7 +210,7 @@
<lvc:CartesianChart.AxisY>
<lvc:Axis Foreground="White" FontSize="15" MinValue="0" LabelFormatter="{Binding YAxisLabelFormatter}">
<lvc:Axis.Separator>
<lvc:Separator Visibility="Hidden" StrokeThickness="1" StrokeDashArray="3" Stroke="Transparent" >
<lvc:Separator Step="100" Visibility="Hidden" StrokeThickness="1" StrokeDashArray="3" Stroke="Transparent" >
</lvc:Separator>
</lvc:Axis.Separator>
</lvc:Axis>

@ -18,6 +18,8 @@ using Aucma.Core.PalletizCX1.Business;
using Aucma.Core.HwPLc;
using Aucma.Core.PalletizCX1.Common;
using Aucma.Core.PalletizCX1.config;
using Admin.Core.Socket;
using System.Collections.Generic;
namespace Aucma.Core.PalletizCX1.ViewModels
{
@ -29,9 +31,13 @@ namespace Aucma.Core.PalletizCX1.ViewModels
/// </summary>
public delegate Task RefreshInfo();
public static event RefreshInfo? RefreshInfoEvent;
private static List<ScannerModel> allScanners = Appsettings.app<ScannerModel>("ScannerServer").ToList();
private AppConfig appConfig = AppConfig.Instance;
// A库扫码器ip
private static string AScannerIp = allScanners.First(x => x.Name == "ScannerA").Ip;
// B库扫码器ip
private static string BScannerIp = allScanners.First(x => x.Name == "ScannerB").Ip;
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(MainWindowViewModel));
private IndexPageView firstPage = new IndexPageView();//首页
@ -44,14 +50,16 @@ namespace Aucma.Core.PalletizCX1.ViewModels
_sysUserInfoServices = App.ServiceProvider.GetService<ISysUserInfoServices>();
UserContent = firstPage;
init();
}
public void init()
{
RefreshScanner(AScannerIp, false);
RefreshScanner(BScannerIp, false);
TouchSocketService.RefreshStateEvent += RefreshScanner;
TeamName = $"班组:{appConfig.TeamName} 用户:{appConfig.Account}";
// 设备状态刷新定时器
System.Timers.Timer timer = new System.Timers.Timer(1000 * 5);
@ -77,7 +85,7 @@ namespace Aucma.Core.PalletizCX1.ViewModels
{
RefreshMesDb();
RefreshPlc();
RefreshScanner();
}
/// <summary>
@ -120,11 +128,16 @@ namespace Aucma.Core.PalletizCX1.ViewModels
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void RefreshScanner()
public void RefreshScanner(string ip, bool flag)
{
string ip1 = Appsettings.app("Middleware", "Scanner1", "Ip");
bool flag1 = true;// MvCodeHelper.ConnectionStatus(ip1);
Scanner1State(flag1);
if (ip == AScannerIp)
{
Scanner1State(flag); ;
}
else if (ip == BScannerIp)
{
Scanner2State(flag);
}
}
#endregion
@ -375,7 +388,7 @@ namespace Aucma.Core.PalletizCX1.ViewModels
}
#endregion
#region 扫码器1状态
#region A库扫码器状态
/// <summary>
/// UI 展示状态-文字
/// </summary>
@ -420,13 +433,13 @@ namespace Aucma.Core.PalletizCX1.ViewModels
{
if (type)
{
Scanner1UIStatusWb = "扫码器1连接成功";
Scanner1UIStatusWb = "A库扫码器";
Scanner1UIColor = "Green";
Scanner1UIIcon = "Assets/Images/Green.png";
}
else
{
Scanner1UIStatusWb = "扫码器1状态异常";
Scanner1UIStatusWb = "A库扫码器";
Scanner1UIColor = "Red";
Scanner1UIIcon = "Assets/Images/Red.png";
}
@ -434,6 +447,68 @@ namespace Aucma.Core.PalletizCX1.ViewModels
}
#endregion
#region B库扫码器状态
/// <summary>
/// UI 展示状态-文字
/// </summary>
public string _scanner2UIStatusWb;
public string Scanner2UIStatusWb
{
//get { return plcUIStatusWb; }
//set { plcUIStatusWb = value; RaisePropertyChanged("PlcUIStatusWb"); }
get => _scanner2UIStatusWb;
set => SetProperty(ref _scanner2UIStatusWb, value);
}
/// <summary>
/// UI 展示状态-颜色
/// </summary>
public string _scanner2UIColor;
public string Scanner2UIColor
{
//get { return plcUIColor; }
//set { plcUIColor = value; RaisePropertyChanged("PlcUIColor"); }
get => _scanner2UIColor;
set => SetProperty(ref _scanner2UIColor, value);
}
/// <summary>
/// UI 展示状态-图标
/// </summary>
public string _scanner2UIIcon;
public string Scanner2UIIcon
{
//get { return plcUIIcon; }
//set { plcUIIcon = value; RaisePropertyChanged("plcUIIcon"); }
get => _scanner2UIIcon;
set => SetProperty(ref _scanner2UIIcon, value);
}
/// <summary>
/// 扫码器1连接状态-true:连接成功false:失败
/// </summary>
/// <param name="type"></param>
public void Scanner2State(bool type)
{
Application.Current.Dispatcher.Invoke(() =>
{
if (type)
{
Scanner2UIStatusWb = "B库扫码器";
Scanner2UIColor = "Green";
Scanner2UIIcon = "Assets/Images/Green.png";
}
else
{
Scanner2UIStatusWb = "B库扫码器";
Scanner2UIColor = "Red";
Scanner2UIIcon = "Assets/Images/Red.png";
}
});
}
#endregion
#region 刷新时间
public string _currentDateTime;

@ -87,7 +87,12 @@
</Border.Background>
</Border>
<TextBlock x:Name="Scanner1" Text="{Binding Scanner1UIStatusWb}" VerticalAlignment="Center" Foreground="{Binding Scanner1UIColor}" FontSize="15" Margin="10,0"/>
<Border Width="30" Height="30" CornerRadius="15">
<Border.Background>
<ImageBrush x:Name="Scanner2Status" ImageSource="{Binding Scanner2UIIcon}"/>
</Border.Background>
</Border>
<TextBlock x:Name="Scanner2" Text="{Binding Scanner2UIStatusWb}" VerticalAlignment="Center" Foreground="{Binding Scanner2UIColor}" FontSize="15" Margin="10,0"/>
</StackPanel>
</Grid>
</Border>

@ -179,17 +179,17 @@
"ScannerServer": [
{
"Id": 1,
"Ip": "10.10.92.240", // 192.168.1.19",
"Ip": "10.10.97.42", // 192.168.1.19",
"Name": "ScannerA"
},
{
"Id": 2,
"Ip": "10.10.92.241", //"192.168.1.20",
"Ip": "10.10.97.43", //"192.168.1.20",
"Name": "ScannerB"
},
{
"Id": 3,
"Ip": "10.10.92.242", // 192.168.1.19",
"Ip": "10.10.97.44", // 192.168.1.19",
"Name": "ScannerC"
}
],

@ -25,6 +25,7 @@ namespace Aucma.Core.PrintTo.ViewModels
{
private readonly IPrintSuppleMentBarCodeServices _printSuppleMentBarCodeServices;
protected readonly IPrintBarCodeServices _printBarCodeServices;
private readonly ICodeBindingRecordServices _codeBindingRecordServices;
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(SupplementViewModel));
private PrintState printState { get; set; } = PrintState.Idle;//打印状态
PrintSuppleMentBarCode printSuppleMentBarCode = null;
@ -35,6 +36,7 @@ namespace Aucma.Core.PrintTo.ViewModels
/// <param name="barType">补打类型</param>
public SupplementViewModel(int Id,string barType)
{
_codeBindingRecordServices = App.ServiceProvider.GetService<ICodeBindingRecordServices>();
_printSuppleMentBarCodeServices = App.ServiceProvider.GetService<IPrintSuppleMentBarCodeServices>();
_printBarCodeServices = App.ServiceProvider.GetService<IPrintBarCodeServices>();
printSuppleMentBarCode = _printSuppleMentBarCodeServices.FirstAsync(d => d.ObjId == Id).Result;
@ -47,6 +49,14 @@ namespace Aucma.Core.PrintTo.ViewModels
PrintAmount = 1;
PrintName = printSuppleMentBarCode.PrintName;
PrintBarType = printSuppleMentBarCode.PrintBarType;
#region 查询箱体码绑定的内胆码
CodeBindingRecord codeBindingRecord = _codeBindingRecordServices.FirstAsync(d => d.BoxCode == _barCode).Result;
if (codeBindingRecord != null && !string.IsNullOrEmpty(codeBindingRecord.LinerCode))
{
LinerCode = codeBindingRecord.LinerCode;
}
#endregion
}
BarType = barType;
Progress = 0;
@ -87,9 +97,31 @@ namespace Aucma.Core.PrintTo.ViewModels
//打印完成 不可以再次打印
printSuppleMentBarCode.IsPrint = "1";
await _printSuppleMentBarCodeServices.UpdateAsync(printSuppleMentBarCode);
#region 打印内胆码
if (IsSelectedOption && !string.IsNullOrEmpty(LinerCode))
{
PintBarCode(printer, LinerCode);
// 查询打印记录表
var printHistoryRecord = _printBarCodeServices.FirstAsync(d => d.MaterialBarcode == LinerCode).Result;
if (printHistoryRecord != null)
{
PrintSuppleMentBarCode linerPrintRecord = new PrintSuppleMentBarCode();
linerPrintRecord.OrderCode = printHistoryRecord.OrderCode;
linerPrintRecord.MaterialCode = printHistoryRecord.MaterialCode;
linerPrintRecord.MaterialName = printHistoryRecord.MaterialName;
linerPrintRecord.MaterialBarCode = LinerCode ;
linerPrintRecord.PrintTime = DateTime.Now;
linerPrintRecord.MaterialCode = printHistoryRecord.OrderCode;
linerPrintRecord.PrintBarType = "2";
linerPrintRecord.IsPrint = "1";
await _printSuppleMentBarCodeServices.AddAsync(printSuppleMentBarCode);
}
}
#endregion
}
//打印完成
SetCompletetd();
}
@ -150,6 +182,22 @@ namespace Aucma.Core.PrintTo.ViewModels
}
#endregion
#region 补打关联的内胆码
private string _linerCode;
public string LinerCode
{ get => _linerCode;
set => SetProperty(ref _linerCode, value);
}
#endregion
#region 是否补打关联的内胆码
private bool _isSelectedOption;
public bool IsSelectedOption
{
get => _isSelectedOption;
set => SetProperty(ref _isSelectedOption, !_isSelectedOption);
}
#endregion
#region 产品编码
private string _productCode;

@ -45,7 +45,7 @@
</WrapPanel>
<WrapPanel Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="打印名称" FontSize="18" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox Text="{Binding PrintName}" FontSize="18" Width="300" Foreground="White" BorderBrush="White" Margin="15 0 0 0" IsReadOnly="True"
<TextBox Text="{Binding PrintName}" FontSize="18" Width="300" Foreground="White" BorderBrush="White" Margin="15 0 0 0"
HorizontalAlignment="Center" VerticalAlignment="Center" />
</WrapPanel>
</Grid>

@ -7,8 +7,8 @@
xmlns:local="clr-namespace:Aucma.Core.PrintTo.Views"
mc:Ignorable="d"
Background="#0C4CA3"
Title="条码补打" d:DesignHeight="600"
d:DesignWidth="1000">
Title="条码补打" Height="900"
Width="1600">
<Window.Resources>
<Style x:Key="DataGridTextColumnCenterSytle" TargetType="{x:Type TextBlock}">
@ -76,7 +76,7 @@
</Window.Resources>
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.8*"/>
<ColumnDefinition Width="2.8*"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<UniformGrid Grid.Column="0" Margin="3" >
@ -105,10 +105,10 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="*" Binding="{Binding ID}" Header="主键" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" Visibility="Collapsed" />
<DataGridTextColumn Width="*" Binding="{Binding OrderCode}" Header="订单号" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" />
<DataGridTextColumn Width="1.5*" Binding="{Binding BarCode}" Header="物料条码" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="1.5*" Binding="{Binding MaterialCode}" Header="物料编码" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="2*" Binding="{Binding MaterialName}" Header="物料名称" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="0.6*" Binding="{Binding OrderCode}" Header="订单号" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" />
<DataGridTextColumn Width="1.7*" Binding="{Binding BarCode}" Header="物料条码" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="1.2*" Binding="{Binding MaterialCode}" Header="物料编码" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="1.7*" Binding="{Binding MaterialName}" Header="物料名称" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="1*" Binding="{Binding PrintName}" Header="打印名称" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Width="*" Binding="{Binding PrintTime ,StringFormat=\{0:yy-MM-dd HH:mm\}}" Header="打印时间" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
</DataGrid.Columns>
@ -152,7 +152,7 @@
</WrapPanel>
<WrapPanel Grid.Row="4" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 15">
<TextBlock Text="打印名称" FontSize="18" Foreground="white" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBox x:Name="PrintName" Foreground="white" Text="{Binding SelectedItem.PrintName, ElementName=dgvMH}" IsReadOnly="True" Margin="15 0 0 0 " FontSize="18" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Width="250"
<TextBox x:Name="PrintName" Foreground="white" Text="{Binding SelectedItem.PrintName, ElementName=dgvMH}" Margin="15 0 0 0 " FontSize="18" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Width="250"
materialDesign:HintAssist.Hint="打印名称" BorderBrush="White" />
</WrapPanel>
<WrapPanel Grid.Row="5" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 15" Visibility="Collapsed">

@ -7,16 +7,16 @@
mc:Ignorable="d"
Background="#1152AC"
Name="window"
d:DesignHeight="700"
d:DesignWidth="700"
d:DesignHeight="900"
d:DesignWidth="900"
Title="二维码打印"
Height="700"
Width="700"
Height="900"
Width="900"
WindowStyle="None"
FontFamily="Microsoft YaHei"
WindowStartupLocation="CenterScreen"
>
<Border Margin="5" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5">
<Border Margin="5,5,-10,0" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5">
<Grid Margin="15">
<Grid.RowDefinitions>
<RowDefinition Height="5*"/>
@ -30,8 +30,9 @@
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<WrapPanel Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="产品编号" FontSize="18" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox FontSize="18" Text="{Binding OrderCode}" Width="300" Foreground="White" BorderBrush="White" Margin="15 0 0 0" VerticalAlignment="Center" IsReadOnly="True"/>
@ -44,9 +45,27 @@
</WrapPanel>
<WrapPanel Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="打印名称" FontSize="18" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox Text="{Binding PrintName}" FontSize="18" Width="300" Foreground="White" BorderBrush="White" Margin="15 0 0 0" IsReadOnly="True"
<TextBox Text="{Binding PrintName}" FontSize="18" Width="300" Foreground="White" BorderBrush="White" Margin="15 0 0 0"
HorizontalAlignment="Center" VerticalAlignment="Center" />
</WrapPanel>
<Grid Grid.Row="3" VerticalAlignment="Center" Margin="10,0,-10,0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock Text="关联内胆码" FontSize="18" Foreground="White" Margin="184,10,-184,-10" />
<TextBox Text="{Binding LinerCode}" FontSize="18" Foreground="White" BorderBrush="White" Margin="295,7,-184,0" IsReadOnly="True" VerticalAlignment="Top" RenderTransformOrigin="0.805,0.862" />
</Grid>
<Grid Grid.Column="0">
<TextBlock Text="选中打印" FontSize="18" Foreground="White" Margin="621,10,-300,-1" RenderTransformOrigin="-0.066,0.592" />
<RadioButton Foreground="White" IsChecked="{Binding IsSelectedOption, Mode=TwoWay}" FontSize="20" Margin="700,10,-312,0" RenderTransformOrigin="3.733,0.438" />
</Grid>
</Grid>
</Grid>
</GroupBox>
</UniformGrid>
@ -86,5 +105,5 @@
</UniformGrid>
</Grid>
</Border>
</Window>

@ -157,12 +157,12 @@ namespace Aucma.Core.ProductOffLineCX1.Business
// 内侧
if (LinerScannerIp == ip)
{
Console.WriteLine($"内侧扫码器ip: {ip} 未扫描到条码");
log.Error($"内侧扫码器ip: {ip} 未扫描到条码");
speechStr.SpeakAsync("西侧扫码失败");
}
else if (ShellScannerIp == ip)
{
Console.WriteLine($"外侧扫码器ip: {ip} 未扫描到条码");
log.Error($"外侧扫码器ip: {ip} 未扫描到条码");
speechStr.SpeakAsync("东侧扫码失败");
}

Loading…
Cancel
Save