change -计划执行时,新增明细时取消存储当前班组长,修改弹窗和界面修改

main
启龙 曹 8 months ago
commit 9665fc56eb

@ -56,6 +56,7 @@ namespace SlnMesnac.Business.business
OrderCode = orderCode,
MaterialCode = orderInfo.MaterialCode,
MaterialName = orderInfo.MaterialName,
BeginTime =DateTime.Now.ToString(),
StationCode = stationCode,
DeviceCode = deviceCode,
PlanAmount = orderInfo.OrderAmount,
@ -152,6 +153,16 @@ namespace SlnMesnac.Business.business
return _prodPlanInfoService.GetPlanInfoByConditions(orderCode,"","", stationCode,"0").FirstOrDefault();
}
/// <summary>
/// 更新订单信息状态
/// </summary>
/// <param name="orderCode"></param>
/// <exception cref="NotImplementedException"></exception>
public void UpdateOrderInfoStatus(string orderCode,string status)
{
_prodOrderInfoService.UpdateOrderInfoStatus(orderCode,status);
}
///// <summary>
///// 查询所有计划工位
///// </summary>

@ -26,6 +26,7 @@ namespace SlnMesnac.Business.business
private List<string> members = new List<string>();
public static string stationCode = "";
public static List<string> stationList;
public static string staffId = "";
public RfidHandleBusniess(IRecordStaffAttendanceService recordStaffAttendanceService, IRecordStaffCommuteService recordStaffCommuteService, IRecordStaffRealTimeService recordStaffRealTimeService)
{
@ -57,6 +58,28 @@ namespace SlnMesnac.Business.business
return _recordStaffAttendanceService.GetRecordStaffAttendances(stationCode);
}
/// <summary>
/// 处理并插入打卡记录(强退)
/// </summary>
/// <param name="staff"></param>
/// <param name="isCheckOn"></param>
/// <returns></returns>
public List<RecordStaffAttendance> HandleAndInsertRemove(BaseStaffInfo staff, int isCheckOn)
{
RecordStaffAttendance recordStaffAttendance = new RecordStaffAttendance
{
StaffId = staff.StaffId,
AttendanceType = isCheckOn.ToString(),
TeamCode = staff.TeamCode,
Remark = staffId,
CreateBy = staff.StaffName,
CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
StationCode = stationCode
};
_recordStaffAttendanceService.Insert(recordStaffAttendance);
return _recordStaffAttendanceService.GetRecordStaffAttendances(stationCode);
}
/// <summary>
/// 处理上下班记录
/// </summary>

@ -35,5 +35,33 @@ namespace SlnMesnac.Repository.service.Impl
}
return prodOrderInfo;
}
/// <summary>
/// 更新订单状态
/// </summary>
/// <param name="orderCode"></param>
/// <param name="status"></param>
/// <exception cref="NotImplementedException"></exception>
public void UpdateOrderInfoStatus(string orderCode, string status)
{
try
{
var prodOrderInfo = _rep.GetFirst(x => x.OrderCode == orderCode);
if (prodOrderInfo != null)
{
prodOrderInfo.OrderStatus = status; // 更新订单状态
_rep.Update(prodOrderInfo); // 假设有一个Update方法来保存更改
}
else
{
_logger.LogWarning($"未找到订单号为 {orderCode} 的订单信息");
}
}
catch (Exception ex)
{
_logger.LogError($"更新订单状态异常:{ex.Message}");
}
}
}
}

@ -53,7 +53,7 @@ namespace SlnMesnac.Repository.service.Impl
.WhereIF(!string.IsNullOrEmpty(planCode), x => x.PlanCode == planCode)
.WhereIF(!string.IsNullOrEmpty(materialCode), x => x.MaterialCode == materialCode)
.WhereIF(!string.IsNullOrEmpty(stationCode), x => x.StationCode == stationCode)
.WhereIF(!string.IsNullOrEmpty(planStatus), x => x.PlanStatus == planStatus || x.PlanStatus == "4")
.WhereIF(!string.IsNullOrEmpty(planStatus), x => x.PlanStatus == planStatus)
.OrderByDescending(x => x.ObjId)
.ToList();
return planInfoList;
@ -85,7 +85,8 @@ namespace SlnMesnac.Repository.service.Impl
ProdPLanInfo prodPLan = new ProdPLanInfo();
try
{//只显示未执行的
prodPLan = _rep.GetFirst(x => x.OrderCode == orderCode && x.StationCode == stationCode && x.PlanStatus == "0" || x.PlanStatus == "4");
prodPLan = _rep.GetFirst(x => x.OrderCode == orderCode && x.StationCode == stationCode);
//&& (x.PlanStatus == "0" || x.PlanStatus == "4")
}
catch (Exception ex)
{

@ -9,5 +9,6 @@ namespace SlnMesnac.Repository.service
public interface ProdOrderInfoService : IBaseService<ProdOrderInfo>
{
ProdOrderInfo GetProdOrderInfoByOrderCode(string orderCode);
public void UpdateOrderInfoStatus(string orderCode,string status);
}
}

@ -123,13 +123,13 @@
<Border Grid.Row="0" Grid.Column="5">
<TextBox Text="{Binding MaterialNameTextBox}" Height="30" Width="180" FontSize="15" Foreground="White" HorizontalAlignment="Left"/>
</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"/>
</Border>
<Border Grid.Row="1" Grid.Column="1">
<TextBlock Text="{Binding StationTextBox}" FontSize="15" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Left"/>
--><!--<ComboBox x:Name="StationComboBox" ItemsSource="{Binding StationList}" SelectedItem="{Binding Station}" Width="180" Height="30" FontSize="15" HorizontalAlignment="Left"/>--><!--
</Border>-->
<!--<ComboBox x:Name="StationComboBox" ItemsSource="{Binding StationList}" SelectedItem="{Binding Station}" Width="180" Height="30" FontSize="15" HorizontalAlignment="Left"/>-->
</Border>
<Border Grid.Row="1" Grid.Column="5">
<Button Content="检索工单" x:Name="Select" Command="{Binding SearchCommand}" CommandParameter="{Binding Name,ElementName=Select}" Style="{StaticResource BUTTON_AGREE}" FontSize="15" FontWeight="Bold" Background="#009999" BorderBrush="#FF36B5C1" Margin="20,5,20,5"/>
</Border>
@ -156,9 +156,9 @@
</DataGridTemplateColumn>
<!--<DataGridTextColumn Binding="{Binding IndexCode}" Header="序号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>-->
<DataGridTextColumn Binding="{Binding OrderCode}" Header="ERP订单编号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding PlanCode}" Header="工单编号" Width="3.5*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<!--<DataGridTextColumn Binding="{Binding PlanCode}" Header="工单编号" Width="3.5*" 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 MaterialName}" Header="物料名称" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding MaterialName}" Header="物料名称" Width="4*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding PlanAmount}" Header="计划数量" Width="1.5*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding CompleteAmount}" Header="完成数量" Width="1.5*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTemplateColumn Header="操作" Width="1*" >
@ -230,6 +230,54 @@
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Grid.Row="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Border Grid.Row="0" Grid.Column="0">
<TextBlock Text="ERP订单编号" FontSize="15" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Row="0" Grid.Column="1" Height="50" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5">
<Border.Effect>
<DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
</Border.Effect>
<TextBlock Text="{Binding OrderCodeText}" FontSize="20" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Row="0" Grid.Column="2">
<TextBlock Text="工单编号" FontSize="15" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Row="0" Grid.Column="3" Height="50" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5">
<Border.Effect>
<DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
</Border.Effect>
<TextBlock Text="{Binding PlanCodeText}" FontSize="20" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
</Grid>
</Border>
<Border Grid.Row="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0">
<TextBlock Text="物料名称" FontSize="15" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="1" Height="50" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5">
<Border.Effect>
<DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
</Border.Effect>
<TextBlock Text="{Binding MaterialNameText}" FontSize="20" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
</Grid>
</Border>
</Grid>
<!--<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="2*"/>
@ -255,13 +303,13 @@
<TextBlock Text="{Binding PlanCodeText}" FontSize="20" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<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 Grid.Row="1" Grid.Column="1" Height="50" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5">
<Border.Effect>
<DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
</Border.Effect>
<TextBlock Text="{Binding MaterialCodeText}" FontSize="20" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock Text="{Binding MaterialNameText}" FontSize="20" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Row="1" Grid.Column="2">
<TextBlock Text="计划工位" FontSize="15" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
@ -272,7 +320,7 @@
</Border.Effect>
<TextBlock Text="{Binding StationCodeText}" FontSize="20" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
</Grid>
</Grid>-->
</Border>
<Border Grid.Row="2">
<Grid>

@ -52,7 +52,7 @@ namespace SlnMesnac.WPF.ViewModel
public static bool isOnDuty = false;//是否有班组当班
private List<string> uniqueStrings = new List<string>();
private List<DateTime> timestamps = new List<DateTime>();
//private BaseStaffInfo user;
private BaseStaffInfo user;
/// <summary>
/// 按钮文字转换事件
@ -290,7 +290,11 @@ namespace SlnMesnac.WPF.ViewModel
var result = ExtractStrings(SelectedItem);
RfidHandleBusniess.stationCode = result.Item1;
stationName = result.Item2;
//ExecuteViewModel.stationTextBlock = stationName;
TransmitStationNameAction?.Invoke(stationName);
isSelectedStationCode = true;
TransmitUserDelegateEvent?.Invoke();
ShowStaffAttendances(null, isCheckOn);
MessageBox.Show("已确认工位:" + stationName);
}
else
@ -314,7 +318,7 @@ namespace SlnMesnac.WPF.ViewModel
if (RemoveConfirmViewModel.times == 1)
{
var theUser = baseStaffService.GetStaffInfoByStaffId(staffId);
_rfidHandleBusniess.HandleAndInsertStaffAttendance(theUser, 2);
_rfidHandleBusniess.HandleAndInsertRemove(theUser, 2);
var list = _rfidHandleBusniess.HandleAndInsertStaffRealTime(theUser, 2);
if (list.Count>=0)
{
@ -323,6 +327,7 @@ namespace SlnMesnac.WPF.ViewModel
RecordStaffRealTimeDataGrid.Clear();
list.ForEach(item => { RecordStaffRealTimeDataGrid.Add(item); });
}));
_rfidHandleBusniess.HandleStaffCommute(user, 1);
}
if(list.Count == 0)
{
@ -355,7 +360,7 @@ namespace SlnMesnac.WPF.ViewModel
// Additional logic for processing the unique string goes here
if (isUse)
{
var user = baseStaffService.GetStaffInfoByCardId(cleanStr);
user = baseStaffService.GetStaffInfoByCardId(cleanStr);
if (user != null)
{
RecordStaffAttendance recordStaffAttendance = _recordStaffAttendanceService.GetRecordStaffAttendanceByStaffId(user.StaffId, RfidHandleBusniess.stationCode);
@ -523,7 +528,7 @@ namespace SlnMesnac.WPF.ViewModel
}
/// <summary>
/// 30分钟内过滤重复str
/// 5秒内过滤重复str
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
@ -531,7 +536,7 @@ namespace SlnMesnac.WPF.ViewModel
{
for (int i = 0; i < uniqueStrings.Count; i++)
{
if (uniqueStrings[i] == str && (DateTime.Now - timestamps[i]).TotalSeconds < 30)
if (uniqueStrings[i] == str && (DateTime.Now - timestamps[i]).TotalSeconds < 5)
{
return true;
}

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Protocols;
using NVelocity.Util.Introspection;
using SlnMesnac.Business;
@ -30,6 +31,7 @@ namespace SlnMesnac.WPF.ViewModel
{
public class ExecuteViewModel : INotifyPropertyChanged
{
private readonly ILogger<ExecuteViewModel> _logger;
public ObservableCollection<string> OrderCodeComboBoxItems { get; set; }
public ObservableCollection<string> PlanCodeComboBoxItems { get; set; }
public ObservableCollection<string> MaterialNameComboBoxItems { get; set; }
@ -44,6 +46,9 @@ namespace SlnMesnac.WPF.ViewModel
private string DeviceCode;
private string ProcessCode;
public static bool isComplete = true;
public static string theStartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//记录每个明细的开始时间
public static int stations = 0;
private string theOrderCode = "";
private ProdPLanInfo pLanInfo;
private ProdPLanInfo haveInfo;
private SerialPortBusiness _serialPortBusiness;
@ -132,10 +137,10 @@ namespace SlnMesnac.WPF.ViewModel
/// 工位
/// </summary>
private string stationTextBlock;
public string StationTextBox
public string StationTextBox
{
get { return stationTextBlock; }
set { stationTextBlock = value; new PropertyChangedEventArgs(nameof(StationTextBox)); }
set { stationTextBlock = value; OnPropertyChanged("StationTextBox"); }
}
/// <summary>
@ -194,11 +199,11 @@ namespace SlnMesnac.WPF.ViewModel
/// <summary>
/// 原料Text
/// </summary>
private string materialCodeText;
public string MaterialCodeText
private string materialNameText;
public string MaterialNameText
{
get { return materialCodeText; }
set { materialCodeText = value; OnPropertyChanged("MaterialCodeText"); }
get { return materialNameText; }
set { materialNameText = value; OnPropertyChanged("MaterialNameText"); }
}
/// <summary>
@ -224,6 +229,7 @@ namespace SlnMesnac.WPF.ViewModel
public ExecuteViewModel()
{
_logger = App.ServiceProvider.GetService<ILogger<ExecuteViewModel>>();
_prodPlanInfoService = App.ServiceProvider.GetService<ProdPlanInfoService>();
_prodPlanDetailService = App.ServiceProvider.GetService<ProdPlanDetailService>();
_recordStaffAttendanceService = App.ServiceProvider.GetService<IRecordStaffAttendanceService>();
@ -246,6 +252,10 @@ namespace SlnMesnac.WPF.ViewModel
//};
//StationList = ConvertStringToList(StationCodes);
//RfidHandleBusniess.stationCode = StationCodes;
EmployeeLoginViewModel.TransmitStationNameAction += stationName =>
{
updateStationName(stationName);
};
DeviceCode = configuration.GetSection("AppConfig")["DeviceCode"];
ProcessCode = configuration.GetSection("AppConfig")["ProcessCode"];
HandoverCommand = new RelayCommand(Handover);
@ -259,6 +269,9 @@ namespace SlnMesnac.WPF.ViewModel
MainWindowViewModel.TransferOrderCodeEvent += HandleOrderCode;
}
/// <summary>
/// 是否有计划正在执行
/// </summary>
private void havePlanOnDuty()
{
haveInfo = _prodPlanInfoService.GetPlanInfoByConditions("", "", "", "", "1").FirstOrDefault();
@ -271,6 +284,15 @@ namespace SlnMesnac.WPF.ViewModel
}
}
/// <summary>
/// 更新工位名称
/// </summary>
/// <param name="stationName"></param>
private void updateStationName(string stationName)
{
StationTextBox = EmployeeLoginViewModel.stationName;
}
/// <summary>
/// 换班弹窗
/// </summary>
@ -299,6 +321,10 @@ namespace SlnMesnac.WPF.ViewModel
reportWin.ShowDialog();//窗体出现后禁止后面的用户控件
Refresh(pLanInfo);
ShowTeamMember();
if (stations >= 3)
{
_databaseHandleBusniess.UpdateOrderInfoStatus(theOrderCode, "2");
}
MainWindowViewModel.wins = 1;
}
else
@ -364,10 +390,13 @@ namespace SlnMesnac.WPF.ViewModel
/// </summary>
private void HandleOrderCode(string orderCode)
{
theOrderCode = orderCode;
if (isComplete)
{
if (isSearch == 1)
{
//更新当前工单状态
_databaseHandleBusniess.UpdateOrderInfoStatus(orderCode,"1");
//判断当前工位的工单编号是否存在
var plan = _prodPlanInfoService.GetProdPLanInfoByOrderCode(RfidHandleBusniess.stationCode, orderCode);
if (plan == null)//不存在就在生产工单表中新增一条当前工位的订单且执行状态改为4,重新检索,并高亮这条工单,执行按钮可用
@ -393,10 +422,10 @@ namespace SlnMesnac.WPF.ViewModel
}
Search();
}
else
{
MessageBox.Show("请先检索工单!");
}
//else
//{
// MessageBox.Show("请先检索工单!");
//}
}
else
{
@ -415,33 +444,40 @@ namespace SlnMesnac.WPF.ViewModel
{
if (isComplete)//判断是否完成,未完成不能执行其他工单
{
// 将当前记录存为实体可以通过parameter获取当前记录的信息
string orderCode = _selectedRow.OrderCode.ToString();
string planCode = _selectedRow.PlanCode.ToString();
pLanInfo = _prodPlanInfoService.GetRecordStaffAttendancesByConditions(orderCode, planCode, "", "", "0").First();
RecordStaffAttendance currentRecord = _recordStaffAttendanceService.GetLastestOnRecord();
BaseStaffInfo staffInfo = _baseStaffService.GetMonitorByTeamCode(currentRecord.TeamCode);
RecordStaffAttendance nextRecord = _recordStaffAttendanceService.GetLastestOffRecord();
// 向detail表里插入一条数据
ProdPlanDetail prodPlanDetail = new ProdPlanDetail
try
{
PlanCode = pLanInfo.PlanCode,
MaterialCode = pLanInfo.MaterialCode,
PlanAmount = pLanInfo.PlanAmount,
CompleteAmount = pLanInfo.CompleteAmount,
BeginTime = DateTime.Now.ToString(),
CurrentStaffId = staffInfo.StaffId
//NextStaffId = nextRecord.StaffId,
};
_prodPlanDetailService.Insert(prodPlanDetail);
//按钮文字变成执行中并锁定,其他的订单执行按钮也禁用
pLanInfo.BeginTime = DateTime.Now.ToString();
pLanInfo.PlanStatus = "1";
_prodPlanInfoService.Update(pLanInfo);
Search();
//查明细表显示出来
Refresh(pLanInfo);
isComplete = false;
// 将当前记录存为实体可以通过parameter获取当前记录的信息
string orderCode = _selectedRow.OrderCode.ToString();
string planCode = _selectedRow.PlanCode.ToString();
pLanInfo = _prodPlanInfoService.GetRecordStaffAttendancesByConditions(orderCode, planCode, "", "", "0").First();
//RecordStaffAttendance currentRecord = _recordStaffAttendanceService.GetLastestOnRecord();
//BaseStaffInfo staffInfo = _baseStaffService.GetMonitorByTeamCode(currentRecord.TeamCode);
RecordStaffAttendance nextRecord = _recordStaffAttendanceService.GetLastestOffRecord();
// 向detail表里插入一条数据
ProdPlanDetail prodPlanDetail = new ProdPlanDetail
{
PlanCode = pLanInfo.PlanCode,
MaterialCode = pLanInfo.MaterialCode,
PlanAmount = pLanInfo.PlanAmount,
CompleteAmount = pLanInfo.CompleteAmount,
BeginTime = DateTime.Now.ToString(),
//CurrentStaffId = staffInfo.StaffId
//NextStaffId = nextRecord.StaffId,
};
_prodPlanDetailService.Insert(prodPlanDetail);
//按钮文字变成执行中并锁定,其他的订单执行按钮也禁用
//pLanInfo.BeginTime = DateTime.Now.ToString();
pLanInfo.PlanStatus = "1";
_prodPlanInfoService.Update(pLanInfo);
Search();
//查明细表显示出来
Refresh(pLanInfo);
isComplete = false;
}
catch (Exception ex)
{
_logger.LogError("执行异常", ex);
}
}
else
{
@ -461,7 +497,7 @@ namespace SlnMesnac.WPF.ViewModel
var planDetail = planDetails.FirstOrDefault();
PlanCodeText = planDetail.PlanCode;
OrderCodeText = pLanInfo.OrderCode;
MaterialCodeText = planDetail.MaterialCode;
MaterialNameText = pLanInfo.MaterialName;
StationCodeText = pLanInfo.StationCode;
System.Windows.Application.Current.Dispatcher.Invoke((Action)(async () =>
{

@ -53,7 +53,7 @@ namespace SlnMesnac.WPF.ViewModel
private void Init()
{
planInfo = _prodPlanInfoService.GetPlanInfoByConditions("", "", "", RfidHandleBusniess.stationCode, "1").FirstOrDefault();
planInfo = _prodPlanInfoService.GetRecordStaffAttendancesByConditions("", "", "", RfidHandleBusniess.stationCode, "1").FirstOrDefault();
if (planInfo != null)
{
complateRate = GetComplateRate(Convert.ToDouble(planInfo.CompleteAmount), planInfo.PlanAmount);
@ -168,7 +168,9 @@ namespace SlnMesnac.WPF.ViewModel
//planDetail = new ProdPlanDetail();
planDetail.CompleteAmount = newAmountDouble.ToString();
planInfo.CompleteAmount = result.ToString();
planDetail.BeginTime = ExecuteViewModel.theStartTime;
planDetail.EndTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
ExecuteViewModel.theStartTime = planDetail.EndTime;
planDetail.BatchNumber += 1;
planInfo.PlanStatus = "4";
//保存工单的执行人员
@ -221,8 +223,8 @@ namespace SlnMesnac.WPF.ViewModel
//_prodPlanDetailService.Insert(planDetail);
planInfo.PlanStatus = "2";
planInfo.EndTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
double planAmountDouble = Convert.ToDouble(planDetail.PlanAmount);
double completeAmountDouble = Convert.ToDouble(planDetail.CompleteAmount);
double planAmountDouble = Convert.ToDouble(planInfo.PlanAmount);
double completeAmountDouble = Convert.ToDouble(planInfo.CompleteAmount);
if (planAmountDouble == completeAmountDouble)
{
planInfo.CompFlag = "0";//正常完成
@ -236,6 +238,7 @@ namespace SlnMesnac.WPF.ViewModel
planInfo.CompFlag = "2";//超额完成
}
_prodPlanInfoService.Update(planInfo);
ExecuteViewModel.stations += 1;
}
//关闭窗口
Application.Current.Windows.OfType<ProductionReportWin>().First().Close();

@ -13,6 +13,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using SlnMesnac.Business.business;
namespace SlnMesnac.WPF.ViewModel
{
@ -75,6 +76,7 @@ namespace SlnMesnac.WPF.ViewModel
{
HintText = "成功!";
times++;
RfidHandleBusniess.staffId = user.StaffId;
}
else
{

Loading…
Cancel
Save