change -添加交接班弹窗

main
frankiecao 1 year ago
commit cd26a1d7ac

@ -29,6 +29,12 @@ namespace SlnMesnac.Model.domain
[SugarColumn(ColumnName = "staff_name")] [SugarColumn(ColumnName = "staff_name")]
public string StaffName { get; set; } public string StaffName { get; set; }
/// <summary>
/// 员工类型
/// </summary>
[SugarColumn(ColumnName = "staff_type")]
public string StaffType { get; set; }
/// <summary> /// <summary>
/// 卡号1 /// 卡号1
/// </summary> /// </summary>

@ -26,7 +26,7 @@ namespace SlnMesnac.Model.domain
/// ERP订单编号 /// ERP订单编号
/// </summary> /// </summary>
[SugarColumn(ColumnName = "order_code")] [SugarColumn(ColumnName = "order_code")]
public string StaffId { get; set; } public string OrderCode { get; set; }
/// <summary> /// <summary>
/// 物料编号 /// 物料编号

@ -0,0 +1,63 @@
using Microsoft.Extensions.Logging;
using SlnMesnac.Common;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace SlnMesnac.Repository.service.Impl
{
public class ProdPlanInfoServiceImpl : BaseServiceImpl<ProdPLanInfo>
{
private ILogger<ProdPlanInfoServiceImpl> _logger;
public ProdPlanInfoServiceImpl(Repository<ProdPLanInfo> repository, ILogger<ProdPlanInfoServiceImpl> logger) : base(repository)
{
_logger = logger;
}
/// <summary>
/// 通过订单编号、工单编号、物料名称获取工单信息
/// </summary>
/// <param name="orderCode"></param>
/// <param name="planCode"></param>
/// <param name="materialCode"></param>
/// <returns></returns>
public List<ProdPLanInfo> GetRecordStaffAttendancesByOrderCodeAndPlanCodeAndMaterialName(string orderCode, string planCode, string materialCode)
{
List<ProdPLanInfo> prodPLanInfos = null;
Expression<Func<ProdPLanInfo, bool>> exp = x => true;
if (!string.IsNullOrEmpty(orderCode))
{
exp = exp.And(x => x.OrderCode == orderCode);
}
if (!string.IsNullOrEmpty(planCode))
{
exp = exp.And(x => x.PlanCode == planCode);
}
if (!string.IsNullOrEmpty(materialCode))
{
exp = exp.And(x => x.MaterialCode == materialCode);
}
prodPLanInfos = base._rep.GetList(exp);
return prodPLanInfos;
}
public List<ProdPLanInfo> GetRecordStaffAttendances()
{
List<ProdPLanInfo> pLanInfos = null;
try
{
pLanInfos = base._rep.GetList();
pLanInfos.Reverse();
}
catch (Exception ex)
{
_logger.LogError($"获取员工打卡信息异常{ex.Message}");
}
return pLanInfos;
}
}
}

@ -9,9 +9,15 @@ namespace SlnMesnac.Repository.service
public interface ProdPlanInfoService : IBaseService<ProdPLanInfo> public interface ProdPlanInfoService : IBaseService<ProdPLanInfo>
{ {
/// <summary> /// <summary>
/// 获取工单信息 /// 获取所有工单信息
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
List<RecordStaffAttendance> GetRecordStaffAttendances(); List<ProdPLanInfo> GetRecordStaffAttendances();
/// <summary>
/// 根据订单编号、工单编号、物料名称获取工单信息
/// </summary>
/// <returns></returns>
List<ProdPLanInfo> GetRecordStaffAttendancesByOrderCodeAndPlanCodeAndMaterialName(string orderCode,string planCode,string materialCode);
} }
} }

@ -117,10 +117,10 @@
<ComboBox Background="White" Height="40"/> <ComboBox Background="White" Height="40"/>
</Border> </Border>
<Border Grid.Row="1" Grid.Column="0"> <Border Grid.Row="1" Grid.Column="0">
<TextBlock Text="计划工位" FontSize="15" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Text="工位" FontSize="15" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border> </Border>
<Border Grid.Row="1" Grid.Column="1"> <Border Grid.Row="1" Grid.Column="1">
<ComboBox Background="White" Height="40"/> <TextBlock Text="{Binding WorkLocation}" FontSize="15" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border> </Border>
<Border Grid.Row="1" Grid.Column="5"> <Border Grid.Row="1" Grid.Column="5">
<Button Content="检索" x:Name="Select" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=Select}" Style="{StaticResource BUTTON_AGREE}" FontSize="15" FontWeight="Bold" Background="#009999" BorderBrush="#FF36B5C1" Margin="15,5,15,5"/> <Button Content="检索" x:Name="Select" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=Select}" Style="{StaticResource BUTTON_AGREE}" FontSize="15" FontWeight="Bold" Background="#009999" BorderBrush="#FF36B5C1" Margin="15,5,15,5"/>
@ -169,7 +169,8 @@
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
<RowDefinition Height="2*"/> <RowDefinition Height="2*"/>
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
<RowDefinition Height="6*"/> <RowDefinition Height="5*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border Grid.Row="0"> <Border Grid.Row="0">
<TextBlock Text="工单信息" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Text="工单信息" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
@ -239,6 +240,20 @@
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
</Border> </Border>
<Border Grid.Row="4">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0">
<Button Content="生产报工" x:Name="ProductionReport" Command="{Binding ControlOnClickCommand}" Style="{StaticResource BUTTON_AGREE}" FontSize="15" FontWeight="Bold" Background="#009999" BorderBrush="#FF36B5C1" Margin="40,14,40,14"/>
</Border>
<Border Grid.Column="1">
<Button Content="换班交接" x:Name="Handover" Command="{Binding HandoverCommand}" Style="{StaticResource BUTTON_AGREE}" FontSize="15" FontWeight="Bold" Background="#009999" BorderBrush="#FF36B5C1" Margin="40,14,40,14" Click="ChangeShifts_Click"/>
</Border>
</Grid>
</Border>
</Grid> </Grid>
</Border> </Border>
</Grid> </Grid>

@ -1,4 +1,5 @@
using SlnMesnac.WPF.Views; using SlnMesnac.WPF.ViewModel;
using SlnMesnac.WPF.Views;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -24,6 +25,7 @@ namespace SlnMesnac.WPF.Page
public ExecutePage() public ExecutePage()
{ {
InitializeComponent(); InitializeComponent();
this.DataContext = new ExecuteViewModel();
} }
#region 弹出工单信息窗口 #region 弹出工单信息窗口
@ -37,7 +39,12 @@ namespace SlnMesnac.WPF.Page
planDetailWin.ShowDialog(); planDetailWin.ShowDialog();
} }
#endregion #endregion
private void ChangeShifts_Click(object sender, RoutedEventArgs e)
{
}
} }
} }

@ -216,7 +216,7 @@ namespace SlnMesnac.WPF.ViewModel
private ObservableCollection<RecordStaffAttendance> item = new ObservableCollection<RecordStaffAttendance>(); private ObservableCollection<RecordStaffAttendance> item = new ObservableCollection<RecordStaffAttendance>();
// //
private ObservableCollection<RecordStaffAttendance> recordStaffAttendanceDataGrid=new ObservableCollection<RecordStaffAttendance>(); private ObservableCollection<RecordStaffAttendance> recordStaffAttendanceDataGrid = new ObservableCollection<RecordStaffAttendance>();
public ObservableCollection<RecordStaffAttendance> RecordStaffAttendanceDataGrid public ObservableCollection<RecordStaffAttendance> RecordStaffAttendanceDataGrid
{ {

@ -0,0 +1,39 @@
using GalaSoft.MvvmLight.Command;
using SlnMesnac.WPF.Views;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace SlnMesnac.WPF.ViewModel
{
public class ExecuteViewModel
{
/// <summary>
/// 换班命令
/// </summary>
public ICommand HandoverCommand { get; private set; }
public ExecuteViewModel()
{
HandoverCommand = new RelayCommand(Handover);
}
/// <summary>
/// 换班弹窗
/// </summary>
private void Handover()
{
var handOverWin = new HandOverWin();
handOverWin.WindowStartupLocation = WindowStartupLocation.CenterScreen; // 让窗体出现在屏幕中央
handOverWin.ShowDialog();//窗体出现后禁止后面的用户控件
//其他操作
}
}
}

@ -0,0 +1,65 @@
using ConsoleApp;
using Microsoft.Extensions.DependencyInjection;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlnMesnac.WPF.ViewModel
{
public class HandOverViewModel
{
private HidUtils hidUtils = new HidUtils();
private IBaseStaffService _baseStaffService;
public HandOverViewModel()
{
Init();
_baseStaffService = App.ServiceProvider.GetService<IBaseStaffService>();
}
#region
///// <summary>
///// 员工id
///// </summary>
//private string staffId;
//public string StaffIdText
//{
// get { return staffId; }
// set { staffId = value; OnPropertyChanged("StaffIdText"); }
//}
#endregion
private void Init()
{
hidUtils.Initial();
hidUtils.StartScan();
hidUtils.pushReceiveDataEvent += (bytes, str) =>
{
str = str.ToString().Replace(" ", "");
BaseStaffInfo user = _baseStaffService.GetStaffInfoByCardId(str);
if (user != null)
{
string staffType = user.StaffType;
if(staffType == "1")
{
}
else
{
}
}
else
{
}
};
}
}
}

@ -0,0 +1,165 @@
<Window x:Class="SlnMesnac.WPF.Views.HandOverWin"
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:SlnMesnac.WPF.Views"
WindowStartupLocation="CenterOwner" Background="Transparent" ResizeMode="NoResize" FontWeight="ExtraLight"
mc:Ignorable="d"
Title="HandOverWin" Height="450" Width="800">
<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 Height="2*"/>
<RowDefinition Height="6*"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0">
<TextBlock Text="计划数量" FontSize="20" FontWeight="Bold" Foreground="#1254AB" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="1" Height="50" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Margin="0,0,80,0">
<Border.Effect>
<DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
</Border.Effect>
<TextBlock Text="{Binding StaffIdText}" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="2">
<TextBlock Text="完成数量" FontSize="20" FontWeight="Bold" Foreground="#1254AB" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="3" Height="50" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Margin="0,0,80,0">
<Border.Effect>
<DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
</Border.Effect>
<TextBlock Text="{Binding StaffIdText}" FontSize="20" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
</Grid>
</Border>
<Border Grid.Row="1" BorderBrush="#1254AB" BorderThickness="2">
<Border.Effect>
<DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
</Border.Effect>
<DataGrid Name="dataGrid" ItemsSource="{Binding RecordStaffAttendanceDataGrid}" Background="Transparent"
FontSize="15" ColumnHeaderHeight="30"
RowHeight="30" AutoGenerateColumns="False" RowHeaderWidth="0"
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False"
Foreground="#FFFFFF" SelectedItem="{Binding SelectedDataItem}">
<!--resourceStyle 399行修改选中字体颜色-->
<DataGrid.Columns>
<DataGridTemplateColumn Width="55" Header="序号" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" FontSize="18" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"></TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Binding="{Binding ObjId}" Header="序号1" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" Visibility="Collapsed"/>
<DataGridTextColumn Binding="{Binding StaffId}" Header="员工ID" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding CreateBy}" Header="员工姓名" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<!--<DataGridTextColumn Binding="{Binding date,StringFormat=\{0:yyyy-MM-dd\}}" Header="工单编号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>-->
<DataGridTextColumn Binding="{Binding AttendanceType}" Header="员工类型" Width="3*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<!--<DataGridTextColumn Binding="{Binding hualway}" Header="性别" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>-->
<!--<DataGridTextColumn Binding="{Binding baggageTagCode}" Header="卡号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>-->
<DataGridTextColumn Binding="{Binding TeamCode}" Header="班组编号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<!--<DataGridTextColumn Binding="{Binding baggageTagCode}" Header="手机号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>-->
</DataGrid.Columns>
</DataGrid>
</Border>
<Border Grid.Row="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Height="50" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Margin="20,0,20,0">
<Border.Effect>
<DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
</Border.Effect>
<TextBlock Text="{Binding StaffIdText}" FontSize="20" Foreground="Red" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="1">
<Grid>
<TextBlock Text="请先进行生产报工" FontSize="20" FontWeight="Bold" Foreground="#1254AB" VerticalAlignment="Center" HorizontalAlignment="Right"/>
</Grid>
</Border>
<Border Grid.Column="2">
<Button Content="确认交班" x:Name="ProductionReport" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=Select}" Style="{StaticResource BUTTON_AGREE}" FontSize="20" FontWeight="Bold" Background="#009999" BorderBrush="#FF36B5C1" Margin="40,14,40,14"/>
</Border>
</Grid>
</Border>
</Grid>
</Window>

@ -0,0 +1,29 @@
using SlnMesnac.WPF.ViewModel;
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 SlnMesnac.WPF.Views
{
/// <summary>
/// HandOverWin.xaml 的交互逻辑
/// </summary>
public partial class HandOverWin : Window
{
public HandOverWin()
{
InitializeComponent();
this.DataContext = new HandOverViewModel();
}
}
}
Loading…
Cancel
Save