change -修改完善

main
frankiecao 1 year ago
commit c09168469b

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

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

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

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

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

@ -4,9 +4,75 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SlnMesnac.WPF.Views" 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" 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>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition/> <RowDefinition/>
@ -26,16 +92,16 @@
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </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="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="White" 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="White" 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="White" 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="White" 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="White" 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="White" 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="White" 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="White" 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="White" 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> </Grid>
</Border> </Border>
</Grid> </Grid>

Loading…
Cancel
Save