change -修改完善

main
frankiecao 1 year ago
commit c09168469b

@ -41,14 +41,14 @@ namespace SlnMesnac.WPF.ViewModel
private bool isUse = false;
private int status = 0;//0是上班1是下班
public static HidUtils hidUtils;
public static bool isOnDuty = false;
public static bool isOnDuty = false;//是否有班组当班
private List<string> uniqueStrings = new List<string>();
private List<DateTime> timestamps = new List<DateTime>();
/// <summary>
/// 按钮文字转换事件
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
public event PropertyChangedEventHandler PropertyChanged = delegate { };
#region 定义命令
/// <summary>

@ -163,8 +163,9 @@ namespace SlnMesnac.WPF.ViewModel
}));
}
// 新增的执行事件
/// <summary>
/// 新增的执行事件
/// </summary>
private void Execute()
{
//判断是否有班组当班,查询打卡记录表4小时内最后一次打卡类型为上班的班组

@ -51,62 +51,65 @@ namespace SlnMesnac.WPF.ViewModel
/// </summary>
private void Init()
{
planDetail = _prodPlanDetailService.GetPlanDetailsByPlanCode(planInfo.PlanCode);
//_recordStaffAttendanceService.GetLastestOffRecord();
PlanAmountText = planDetail.PlanAmount.ToString();
CompleteAmountText = planDetail.CompleteAmount.ToString();
var hidUtils = EmployeeLoginViewModel.hidUtils;
// hidUtils.Initial();
hidUtils.StartScan();
hidUtils.pushReceiveDataEvent += (bytes, str) =>
if(planInfo != null)
{
if (times < 2)//打卡超过2次无效
planDetail = _prodPlanDetailService.GetPlanDetailsByPlanCode(planInfo.PlanCode);
//_recordStaffAttendanceService.GetLastestOffRecord();
PlanAmountText = planDetail.PlanAmount.ToString();
CompleteAmountText = planDetail.CompleteAmount.ToString();
var hidUtils = EmployeeLoginViewModel.hidUtils;
//hidUtils.Initial();
hidUtils.StartScan();
hidUtils.pushReceiveDataEvent += (bytes, str) =>
{
str = str.ToString().Replace(" ", "");
BaseStaffInfo user = _baseStaffService.GetStaffInfoByCardId(str);
if (user != null)
if (times < 2)//打卡超过2次无效
{
string staffType = user.StaffType;
if (staffType == "1")//判断是否为班长
str = str.ToString().Replace(" ", "");
BaseStaffInfo user = _baseStaffService.GetStaffInfoByCardId(str);
if (user != null)
{
if (times == 0 && planDetail.CurrentStaffId == user.StaffId)
string staffType = user.StaffType;
if (staffType == "1")//判断是否为班长
{
//显示记录
StaffIdText = user.StaffId;
StaffNameText = user.StaffName;
StaffTypeText = user.StaffType;
TeamCodeText = user.TeamCode;
//数量+1
times++;
}
else if (times == 1)
{
StaffIdText = user.StaffId;
//判断是否为下一班组长
planDetail.CurrentStaffId = user.StaffId;
StaffNameText = user.StaffName;
StaffTypeText = user.StaffType;
TeamCodeText = user.TeamCode;
_prodPlanDetailService.Insert(planDetail);//更换班组长后插入一条明细记录
//数量+1
times++;
if (times == 0 && planDetail.CurrentStaffId == user.StaffId)
{
//显示记录
StaffIdText = user.StaffId;
StaffNameText = user.StaffName;
StaffTypeText = user.StaffType;
TeamCodeText = user.TeamCode;
//数量+1
times++;
}
else if (times == 1)
{
StaffIdText = user.StaffId;
//判断是否为下一班组长
planDetail.CurrentStaffId = user.StaffId;
StaffNameText = user.StaffName;
StaffTypeText = user.StaffType;
TeamCodeText = user.TeamCode;
_prodPlanDetailService.Insert(planDetail);//更换班组长后插入一条明细记录
//数量+1
times++;
}
else
{
HintText = "当前班组长先打卡!";
}
}
else
{
HintText = "当前班组长先打卡!";
HintText = "打卡人员非班长,打卡无效";
}
}
else
{
HintText = "打卡人员非班长,打卡无效";
HintText = "没有匹配的员工,打卡失败";
}
}
else
{
HintText = "没有匹配的员工,打卡失败!";
}
}
};
};
}
}
#region 参数

@ -108,12 +108,13 @@ namespace SlnMesnac.WPF.ViewModel
/// 确认命令
/// </summary>
public ICommand ConfirmCommand { get; private set; }
/// <summary>
/// 确认事件
/// </summary>
private void Confirm()
{
if(EmployeeLoginViewModel.isOnDuty == true)
if(EmployeeLoginViewModel.isOnDuty == true)//是否有班组当班,无当班时操作无效
{
string newAmount = NewAmountText;
if (newAmount != null)
@ -161,7 +162,8 @@ namespace SlnMesnac.WPF.ViewModel
public ICommand EndPlanCommand { get; private set; }
private void EndPlan()
{
if(EmployeeLoginViewModel.isOnDuty == true)
//判断工单实际产量与目标产量的差距,满足才能执行结束
if(EmployeeLoginViewModel.isOnDuty == true)//是否有班组当班,无当班时操作无效
{
if (planDetail != null && planInfo != null)
{

@ -15,6 +15,9 @@ namespace SlnMesnac.WPF.ViewModel
/// </summary>
public event PropertyChangedEventHandler PropertyChanged = delegate { };
/// <summary>
/// 显示工艺信息,需要讨论显示哪些数据
/// </summary>
public TechnologicalViewModel()
{
Information1 = "001";
@ -24,8 +27,7 @@ namespace SlnMesnac.WPF.ViewModel
Information5 = "005";
}
#region
#region 界面参数
/// <summary>
/// 信息1
/// </summary>
@ -72,7 +74,7 @@ namespace SlnMesnac.WPF.ViewModel
private string information5;
public string Information5
{
get { return information5; }
get { return information5;}
set { information5 = value; OnPropertyChanged("Information5"); }
}
#endregion

@ -4,9 +4,75 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SlnMesnac.WPF.Views"
WindowStartupLocation="CenterOwner" Background="Transparent" ResizeMode="NoResize" FontWeight="ExtraLight"
WindowStartupLocation="CenterOwner" Background="Transparent" ResizeMode="NoResize" FontWeight="ExtraLight"
mc:Ignorable="d"
Title="TechnologicalWin" Height="1000" Width="600">
Title="TechnologicalWin" Width="1280" Height="720" >
<WindowChrome.WindowChrome>
<WindowChrome GlassFrameThickness="-1"/>
</WindowChrome.WindowChrome>
<Window.Resources>
<Style x:Key="DataGridTextColumnCenterSytle" TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="20"/>
</Style>
<Style TargetType="DataGrid">
<!--网格线颜色-->
<Setter Property="CanUserResizeColumns" Value="false"/>
<Setter Property="Background" Value="#1152AC" />
<Setter Property="BorderBrush" Value="#4285DE" />
<Setter Property="Foreground" Value="White"/>
<Setter Property="HorizontalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#4285DE"/>
</Setter.Value>
</Setter>
<Setter Property="VerticalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#1152AC"/>
</Setter.Value>
</Setter>
</Style>
<!--列头标题栏样式-->
<Style TargetType="DataGridColumnHeader">
<!--<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>-->
<!--<Setter Property="Background" Value="#dddddd"/>
<Setter Property="Foreground" Value="Black"/>-->
<!--<Setter Property="BorderThickness" Value="1" />-->
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="BorderBrush" Value="#4285DE" />
<Setter Property="Height" Value="40"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="Background" Value="#4285DE"/>
<Setter Property="Foreground" Value="White"/>
</Style>
<!--单元格样式-->
<Style TargetType="DataGridCell">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="#4285DE" />
<Setter Property="Height" Value="40"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}" >
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#4285DE"/>
<!--<Setter Property="Foreground" Value="#dddddd"/>-->
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
@ -26,16 +92,16 @@
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="信息1" FontSize="30" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Information1}" FontSize="30" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="0" Text="信息2" FontSize="30" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Information2}" FontSize="30" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="0" Text="信息3" FontSize="30" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Information3}" FontSize="30" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="3" Grid.Column="0" Text="信息4" FontSize="30" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Information4}" FontSize="30" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="4" Grid.Column="0" Text="信息5" FontSize="30" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding Information5}" FontSize="30" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="0" Text="信息1" FontSize="30" Foreground="#1254AB" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Information1}" FontSize="30" Foreground="#1254AB" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="0" Text="信息2" FontSize="30" Foreground="#1254AB" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Information2}" FontSize="30" Foreground="#1254AB" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="0" Text="信息3" FontSize="30" Foreground="#1254AB" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Information3}" FontSize="30" Foreground="#1254AB" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="3" Grid.Column="0" Text="信息4" FontSize="30" Foreground="#1254AB" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Information4}" FontSize="30" Foreground="#1254AB" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="4" Grid.Column="0" Text="信息5" FontSize="30" Foreground="#1254AB" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding Information5}" FontSize="30" Foreground="#1254AB" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
</Grid>
</Border>
</Grid>

Loading…
Cancel
Save