diff --git a/SlnMesnac.WPF/ViewModel/EmployeeLoginViewModel.cs b/SlnMesnac.WPF/ViewModel/EmployeeLoginViewModel.cs index f5d3d8d..cb87e22 100644 --- a/SlnMesnac.WPF/ViewModel/EmployeeLoginViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/EmployeeLoginViewModel.cs @@ -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 uniqueStrings = new List(); private List timestamps = new List(); /// /// 按钮文字转换事件 /// - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler PropertyChanged = delegate { }; #region 定义命令 /// diff --git a/SlnMesnac.WPF/ViewModel/ExecuteViewModel.cs b/SlnMesnac.WPF/ViewModel/ExecuteViewModel.cs index 5184fbc..ee61f86 100644 --- a/SlnMesnac.WPF/ViewModel/ExecuteViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/ExecuteViewModel.cs @@ -163,8 +163,9 @@ namespace SlnMesnac.WPF.ViewModel })); } - // 新增的执行事件 - + /// + /// 新增的执行事件 + /// private void Execute() { //判断是否有班组当班,查询打卡记录表,4小时内最后一次打卡类型为上班的班组 diff --git a/SlnMesnac.WPF/ViewModel/HandOverViewModel.cs b/SlnMesnac.WPF/ViewModel/HandOverViewModel.cs index b78bcae..5099de2 100644 --- a/SlnMesnac.WPF/ViewModel/HandOverViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/HandOverViewModel.cs @@ -51,62 +51,65 @@ namespace SlnMesnac.WPF.ViewModel /// 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 参数 diff --git a/SlnMesnac.WPF/ViewModel/ProductionReportViewModel.cs b/SlnMesnac.WPF/ViewModel/ProductionReportViewModel.cs index 421061b..0352b15 100644 --- a/SlnMesnac.WPF/ViewModel/ProductionReportViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/ProductionReportViewModel.cs @@ -108,12 +108,13 @@ namespace SlnMesnac.WPF.ViewModel /// 确认命令 /// public ICommand ConfirmCommand { get; private set; } + /// /// 确认事件 /// 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) { diff --git a/SlnMesnac.WPF/ViewModel/TechnologicalViewModel.cs b/SlnMesnac.WPF/ViewModel/TechnologicalViewModel.cs index 2dbace7..a273336 100644 --- a/SlnMesnac.WPF/ViewModel/TechnologicalViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/TechnologicalViewModel.cs @@ -15,6 +15,9 @@ namespace SlnMesnac.WPF.ViewModel /// public event PropertyChangedEventHandler PropertyChanged = delegate { }; + /// + /// 显示工艺信息,需要讨论显示哪些数据 + /// public TechnologicalViewModel() { Information1 = "001"; @@ -24,8 +27,7 @@ namespace SlnMesnac.WPF.ViewModel Information5 = "005"; } - - #region + #region 界面参数 /// /// 信息1 /// @@ -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 diff --git a/SlnMesnac.WPF/Views/TechnologicalWin.xaml b/SlnMesnac.WPF/Views/TechnologicalWin.xaml index 8b7f979..35cb7ce 100644 --- a/SlnMesnac.WPF/Views/TechnologicalWin.xaml +++ b/SlnMesnac.WPF/Views/TechnologicalWin.xaml @@ -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" > + + + + + + + + + + + + + @@ -26,16 +92,16 @@ - - - - - - - - - - + + + + + + + + + +