|
|
|
@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Components.Forms;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.IdentityModel.Protocols;
|
|
|
|
|
using SlnMesnac.Business;
|
|
|
|
|
using SlnMesnac.Business.business;
|
|
|
|
|
using SlnMesnac.Model.domain;
|
|
|
|
|
using SlnMesnac.Model.dto;
|
|
|
|
@ -32,20 +33,22 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
public ObservableCollection<string> PlanCodeComboBoxItems { get; set; }
|
|
|
|
|
public ObservableCollection<string> MaterialNameComboBoxItems { get; set; }
|
|
|
|
|
private RfidHandleBusniess _RfidHandleBusniess;
|
|
|
|
|
private DatabaseHandleBusniess _databaseHandleBusniess;
|
|
|
|
|
private ProdPlanInfoService _prodPlanInfoService;
|
|
|
|
|
private List<ProdPLanInfo> prodPlanInfos;
|
|
|
|
|
private ProdPlanDetailService _prodPlanDetailService;
|
|
|
|
|
private IRecordStaffAttendanceService _recordStaffAttendanceService;
|
|
|
|
|
private IBaseStaffService _baseStaffService;
|
|
|
|
|
private string StationCode;
|
|
|
|
|
private string DeviceCode;
|
|
|
|
|
private string ProcessCode;
|
|
|
|
|
public static bool isComplete = true;
|
|
|
|
|
private ProdPLanInfo pLanInfo;
|
|
|
|
|
private SerialPortBusiness _serialPortBusiness;
|
|
|
|
|
private string executeText = "待执行";
|
|
|
|
|
private int isSearch = 0;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 按钮文字转换事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged = delegate { };
|
|
|
|
|
|
|
|
|
|
#region 定义命令
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 检索命令
|
|
|
|
|
/// </summary>
|
|
|
|
@ -70,171 +73,19 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
/// 执行命令
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ICommand ExecuteCommand { get; private set; }
|
|
|
|
|
|
|
|
|
|
#region 委托
|
|
|
|
|
public delegate void RefreshDelegate(ProdPLanInfo pLanInfo);
|
|
|
|
|
public static event RefreshDelegate? RefreshEvent;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public ExecuteViewModel()
|
|
|
|
|
{
|
|
|
|
|
_prodPlanInfoService = App.ServiceProvider.GetService<ProdPlanInfoService>();
|
|
|
|
|
_prodPlanDetailService = App.ServiceProvider.GetService<ProdPlanDetailService>();
|
|
|
|
|
_recordStaffAttendanceService = App.ServiceProvider.GetService<IRecordStaffAttendanceService>();
|
|
|
|
|
_RfidHandleBusniess = App.ServiceProvider.GetService<RfidHandleBusniess>();
|
|
|
|
|
_baseStaffService = App.ServiceProvider.GetService<IBaseStaffService>();
|
|
|
|
|
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
|
|
|
|
|
.SetBasePath(System.AppContext.BaseDirectory)
|
|
|
|
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
|
|
|
|
|
IConfigurationRoot configuration = configurationBuilder.Build();
|
|
|
|
|
pLanInfo = _prodPlanInfoService.GetRecordStaffAttendancesByConditions("", "", "", "", "1").FirstOrDefault();
|
|
|
|
|
Refresh(pLanInfo);
|
|
|
|
|
// 从配置文件中获取ProductLineNameTextBlock的值
|
|
|
|
|
stationTextBlock = configuration.GetSection("AppConfig")["ProductLineName"];
|
|
|
|
|
StationCode = configuration.GetSection("AppConfig")["ProductLineCode"];
|
|
|
|
|
HandoverCommand = new RelayCommand(Handover);
|
|
|
|
|
ProductionReportCommand = new RelayCommand(ProductionReport);
|
|
|
|
|
TechnologicalInformationCommand = new RelayCommand(TechnologicalInformation);
|
|
|
|
|
SearchCommand = new RelayCommand(Search);
|
|
|
|
|
ExecuteCommand = new RelayCommand(Execute);
|
|
|
|
|
ProductionReportViewModel.RefreshDelegateEvent += Refresh;
|
|
|
|
|
EmployeeLoginViewModel.TransmitUserDelegateEvent += ShowTeamMember;
|
|
|
|
|
}
|
|
|
|
|
#region 定义委托
|
|
|
|
|
public delegate void RefreshDelegate(ProdPLanInfo pLanInfo);
|
|
|
|
|
public static event RefreshDelegate? RefreshEvent;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 换班弹窗
|
|
|
|
|
/// 按钮文字转换事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void Handover()
|
|
|
|
|
{
|
|
|
|
|
var handOverWin = new HandOverWin();
|
|
|
|
|
handOverWin.Owner = Application.Current.MainWindow; // 设置父窗口为当前主窗口
|
|
|
|
|
handOverWin.WindowStartupLocation = WindowStartupLocation.CenterScreen; // 让窗体出现在屏幕中央
|
|
|
|
|
handOverWin.ShowDialog();//窗体出现后禁止后面的用户控件
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged = delegate { };
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 报工弹窗
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void ProductionReport()
|
|
|
|
|
{
|
|
|
|
|
var reportWin = new ProductionReportWin();
|
|
|
|
|
reportWin.Owner = Application.Current.MainWindow; // 设置父窗口为当前主窗口
|
|
|
|
|
reportWin.WindowStartupLocation = WindowStartupLocation.CenterScreen; // 让窗体出现在屏幕中央
|
|
|
|
|
reportWin.ShowDialog();//窗体出现后禁止后面的用户控件
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 工艺信息弹窗,单例模式保证只显示一个
|
|
|
|
|
/// </summary>
|
|
|
|
|
private static TechnologicalWin instance;
|
|
|
|
|
private void TechnologicalInformation()
|
|
|
|
|
{
|
|
|
|
|
if (instance == null)
|
|
|
|
|
{
|
|
|
|
|
instance = new TechnologicalWin();
|
|
|
|
|
instance.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
|
|
|
|
instance.Closed += (sender, e) => { instance = null; }; // 窗口关闭时重置instance为null,以便下次可以重新打开窗口
|
|
|
|
|
instance.Show();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
instance.Focus(); // 如果窗口已经存在,则将焦点放在该窗口上
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 检索事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void Search()
|
|
|
|
|
{
|
|
|
|
|
// 在这里执行其他操作,可以通过InputText获取用户输入的信息
|
|
|
|
|
//Console.WriteLine("用户输入的信息:" + OrderCodeTextBox + PlanCodeTextBox + MaterialCodeTextBox);
|
|
|
|
|
//ProductLineNameTextBlock = ConfigurationManager.AppSettings["ProductLineNameTextBlock"];
|
|
|
|
|
List<ProdPLanInfo> list = _prodPlanInfoService.GetRecordStaffAttendancesByConditions(OrderCodeTextBox, PlanCodeTextBox, MaterialCodeTextBox, StationCode,"0");
|
|
|
|
|
System.Windows.Application.Current.Dispatcher.Invoke((Action)(async () =>
|
|
|
|
|
{
|
|
|
|
|
ProdPLanInfoDataGrid.Clear();
|
|
|
|
|
list.ForEach(item =>
|
|
|
|
|
{
|
|
|
|
|
ProdPLanInfoDataGrid.Add(item);
|
|
|
|
|
});
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增的执行事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void Execute()
|
|
|
|
|
{
|
|
|
|
|
//判断是否有班组当班,查询打卡记录表,4小时内最后一次打卡类型为上班的班组
|
|
|
|
|
if(EmployeeLoginViewModel.isOnDuty == true)
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//刷新明细
|
|
|
|
|
private void Refresh(ProdPLanInfo pLanInfo)
|
|
|
|
|
{
|
|
|
|
|
if(pLanInfo != null)
|
|
|
|
|
{
|
|
|
|
|
ProdPlanDetail planDetail = _prodPlanDetailService.GetPlanDetailsByPlanCode(pLanInfo.PlanCode);
|
|
|
|
|
PlanCodeText = planDetail.PlanCode;
|
|
|
|
|
OrderCodeText = pLanInfo.OrderCode;
|
|
|
|
|
MaterialCodeText = planDetail.MaterialCode;
|
|
|
|
|
StationCodeText = pLanInfo.StationCode;
|
|
|
|
|
System.Windows.Application.Current.Dispatcher.Invoke((Action)(async () =>
|
|
|
|
|
{
|
|
|
|
|
ProdPLanDetailDataGrid.Clear();
|
|
|
|
|
ProdPLanDetailDataGrid.Add(planDetail);
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示班组成员
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="baseStaffInfo"></param>
|
|
|
|
|
private void ShowTeamMember(BaseStaffInfo baseStaffInfo)
|
|
|
|
|
{
|
|
|
|
|
if(baseStaffInfo != null)
|
|
|
|
|
{
|
|
|
|
|
TeamMember = _RfidHandleBusniess.SpliceTeamMember(baseStaffInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region
|
|
|
|
|
#region 定义属性
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 班组成员
|
|
|
|
|
/// </summary>
|
|
|
|
@ -359,6 +210,216 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public ExecuteViewModel()
|
|
|
|
|
{
|
|
|
|
|
_prodPlanInfoService = App.ServiceProvider.GetService<ProdPlanInfoService>();
|
|
|
|
|
_prodPlanDetailService = App.ServiceProvider.GetService<ProdPlanDetailService>();
|
|
|
|
|
_recordStaffAttendanceService = App.ServiceProvider.GetService<IRecordStaffAttendanceService>();
|
|
|
|
|
_RfidHandleBusniess = App.ServiceProvider.GetService<RfidHandleBusniess>();
|
|
|
|
|
_baseStaffService = App.ServiceProvider.GetService<IBaseStaffService>();
|
|
|
|
|
_serialPortBusiness = App.ServiceProvider.GetService<SerialPortBusiness>();
|
|
|
|
|
_databaseHandleBusniess = App.ServiceProvider.GetService<DatabaseHandleBusniess>();
|
|
|
|
|
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
|
|
|
|
|
.SetBasePath(System.AppContext.BaseDirectory)
|
|
|
|
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
|
|
|
|
|
IConfigurationRoot configuration = configurationBuilder.Build();
|
|
|
|
|
pLanInfo = _prodPlanInfoService.GetRecordStaffAttendancesByConditions("", "", "", "", "1").FirstOrDefault();
|
|
|
|
|
Refresh(pLanInfo);
|
|
|
|
|
// 从配置文件中获取ProductLineNameTextBlock的值
|
|
|
|
|
stationTextBlock = configuration.GetSection("AppConfig")["ProductLineName"];
|
|
|
|
|
StationCode = configuration.GetSection("AppConfig")["StationCode"];
|
|
|
|
|
RfidHandleBusniess.stationCode = StationCode;
|
|
|
|
|
DeviceCode = configuration.GetSection("AppConfig")["DeviceCode"];
|
|
|
|
|
ProcessCode = configuration.GetSection("AppConfig")["ProcessCode"];
|
|
|
|
|
HandoverCommand = new RelayCommand(Handover);
|
|
|
|
|
ProductionReportCommand = new RelayCommand(ProductionReport);
|
|
|
|
|
TechnologicalInformationCommand = new RelayCommand(TechnologicalInformation);
|
|
|
|
|
SearchCommand = new RelayCommand(Search);
|
|
|
|
|
ExecuteCommand = new RelayCommand(Execute);
|
|
|
|
|
ProductionReportViewModel.RefreshDelegateEvent += Refresh;
|
|
|
|
|
EmployeeLoginViewModel.TransmitUserDelegateEvent += ShowTeamMember;
|
|
|
|
|
//SerialPortBusiness.ReceivedBarcodeInfoEvent += HandleOrderCode;
|
|
|
|
|
MainWindowViewModel.TransferOrderCodeEvent += HandleOrderCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 换班弹窗
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void Handover()
|
|
|
|
|
{
|
|
|
|
|
var handOverWin = new HandOverWin();
|
|
|
|
|
handOverWin.Owner = Application.Current.MainWindow; // 设置父窗口为当前主窗口
|
|
|
|
|
handOverWin.WindowStartupLocation = WindowStartupLocation.CenterScreen; // 让窗体出现在屏幕中央
|
|
|
|
|
handOverWin.ShowDialog();//窗体出现后禁止后面的用户控件
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 报工弹窗
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void ProductionReport()
|
|
|
|
|
{
|
|
|
|
|
MainWindowViewModel.wins = 3;
|
|
|
|
|
var reportWin = new ProductionReportWin();
|
|
|
|
|
reportWin.Owner = Application.Current.MainWindow; // 设置父窗口为当前主窗口
|
|
|
|
|
reportWin.WindowStartupLocation = WindowStartupLocation.CenterScreen; // 让窗体出现在屏幕中央
|
|
|
|
|
reportWin.ShowDialog();//窗体出现后禁止后面的用户控件
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 工艺信息弹窗,单例模式保证只显示一个
|
|
|
|
|
/// </summary>
|
|
|
|
|
private static TechnologicalWin instance;
|
|
|
|
|
private void TechnologicalInformation()
|
|
|
|
|
{
|
|
|
|
|
if (instance == null)
|
|
|
|
|
{
|
|
|
|
|
instance = new TechnologicalWin();
|
|
|
|
|
instance.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
|
|
|
|
instance.Closed += (sender, e) => { instance = null; }; // 窗口关闭时重置instance为null,以便下次可以重新打开窗口
|
|
|
|
|
instance.Show();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
instance.Focus(); // 如果窗口已经存在,则将焦点放在该窗口上
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 检索事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void Search()
|
|
|
|
|
{
|
|
|
|
|
if (EmployeeLoginViewModel.isOnDuty == true)
|
|
|
|
|
{
|
|
|
|
|
//在这里执行其他操作,可以通过InputText获取用户输入的信息
|
|
|
|
|
//Console.WriteLine("用户输入的信息:" + OrderCodeTextBox + PlanCodeTextBox + MaterialCodeTextBox);
|
|
|
|
|
//ProductLineNameTextBlock = ConfigurationManager.AppSettings["ProductLineNameTextBlock"];
|
|
|
|
|
List<ProdPLanInfo> list = _prodPlanInfoService.GetRecordStaffAttendancesByConditions(OrderCodeTextBox, PlanCodeTextBox, MaterialCodeTextBox, StationCode, "0");
|
|
|
|
|
System.Windows.Application.Current.Dispatcher.Invoke((Action)(async () =>
|
|
|
|
|
{
|
|
|
|
|
ProdPLanInfoDataGrid.Clear();
|
|
|
|
|
list.ForEach(item =>
|
|
|
|
|
{
|
|
|
|
|
ProdPLanInfoDataGrid.Add(item);
|
|
|
|
|
});
|
|
|
|
|
}));
|
|
|
|
|
isSearch = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("没有班组上班,请先打卡上班!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据订单单号判断是否存在,
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void HandleOrderCode(string orderCode)
|
|
|
|
|
{
|
|
|
|
|
if (isComplete)
|
|
|
|
|
{
|
|
|
|
|
if (isSearch == 1)
|
|
|
|
|
{
|
|
|
|
|
//判断当前工位的工单编号是否存在
|
|
|
|
|
var plan = _prodPlanInfoService.GetProdPLanInfoByOrderCode(StationCode, orderCode);
|
|
|
|
|
if (plan == null)//不存在,就在生产工单表中新增一条当前工位的订单,且执行状态改为4,重新检索,并高亮这条工单,执行按钮可用
|
|
|
|
|
{
|
|
|
|
|
_databaseHandleBusniess.AddNewPlanInfo(orderCode,StationCode,DeviceCode,ProcessCode,"0");
|
|
|
|
|
}
|
|
|
|
|
else//存在,将本条数据的执行状态改为4高亮这条工单,执行按钮可用
|
|
|
|
|
{
|
|
|
|
|
_databaseHandleBusniess.UpdatePlanStatus(orderCode,StationCode,DeviceCode,ProcessCode,"4");
|
|
|
|
|
}
|
|
|
|
|
Search();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先检索工单!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先完成当前工单!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增的执行事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void Execute()
|
|
|
|
|
{
|
|
|
|
|
//判断是否有班组当班,查询打卡记录表,4小时内最后一次打卡类型为上班的班组
|
|
|
|
|
if(EmployeeLoginViewModel.isOnDuty == true)
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先完成当前工单!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//刷新明细
|
|
|
|
|
private void Refresh(ProdPLanInfo pLanInfo)
|
|
|
|
|
{
|
|
|
|
|
if(pLanInfo != null)
|
|
|
|
|
{
|
|
|
|
|
ProdPlanDetail planDetail = _prodPlanDetailService.GetPlanDetailsByPlanCode(pLanInfo.PlanCode);
|
|
|
|
|
if (planDetail != null)
|
|
|
|
|
{
|
|
|
|
|
PlanCodeText = planDetail.PlanCode;
|
|
|
|
|
OrderCodeText = pLanInfo.OrderCode;
|
|
|
|
|
MaterialCodeText = planDetail.MaterialCode;
|
|
|
|
|
StationCodeText = pLanInfo.StationCode;
|
|
|
|
|
System.Windows.Application.Current.Dispatcher.Invoke((Action)(async () =>
|
|
|
|
|
{
|
|
|
|
|
ProdPLanDetailDataGrid.Clear();
|
|
|
|
|
ProdPLanDetailDataGrid.Add(planDetail);
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示班组成员
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="baseStaffInfo"></param>
|
|
|
|
|
private void ShowTeamMember()
|
|
|
|
|
{
|
|
|
|
|
TeamMember = _RfidHandleBusniess.SpliceTeamMember();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnPropertyChanged([CallerMemberName] string propertyName = "")
|
|
|
|
|
{
|
|
|
|
|
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
|
|
|
|