|
|
|
@ -31,10 +31,12 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
public ObservableCollection<string> OrderCodeComboBoxItems { get; set; }
|
|
|
|
|
public ObservableCollection<string> PlanCodeComboBoxItems { get; set; }
|
|
|
|
|
public ObservableCollection<string> MaterialNameComboBoxItems { get; set; }
|
|
|
|
|
private RfidHandleBusniess _RfidHandleBusniess;
|
|
|
|
|
private ProdPlanInfoService _prodPlanInfoService;
|
|
|
|
|
private List<ProdPLanInfo> prodPlanInfos;
|
|
|
|
|
private ProdPlanDetailService _prodPlanDetailService;
|
|
|
|
|
private IRecordStaffAttendanceService _recordStaffAttendanceService;
|
|
|
|
|
private IBaseStaffService _baseStaffService;
|
|
|
|
|
private string StationCode;
|
|
|
|
|
public static bool isComplete = true;
|
|
|
|
|
private ProdPLanInfo pLanInfo;
|
|
|
|
@ -64,7 +66,7 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ICommand ExecuteCommand { get; private set; }
|
|
|
|
|
|
|
|
|
|
#region
|
|
|
|
|
#region 委托
|
|
|
|
|
public delegate void RefreshDelegate(ProdPLanInfo pLanInfo);
|
|
|
|
|
public static event RefreshDelegate? RefreshEvent;
|
|
|
|
|
#endregion
|
|
|
|
@ -74,6 +76,8 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
_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);
|
|
|
|
@ -88,6 +92,7 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
SearchCommand = new RelayCommand(Search);
|
|
|
|
|
ExecuteCommand = new RelayCommand(Execute);
|
|
|
|
|
ProductionReportViewModel.RefreshDelegateEvent += Refresh;
|
|
|
|
|
EmployeeLoginViewModel.TransmitUserDelegateEvent += ShowTeamMember;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -130,37 +135,43 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 新增的执行事件
|
|
|
|
|
|
|
|
|
|
private void Execute()
|
|
|
|
|
{
|
|
|
|
|
if (isComplete)
|
|
|
|
|
//判断是否有班组当班,查询打卡记录表,4小时内最后一次打卡类型为上班的班组
|
|
|
|
|
if(EmployeeLoginViewModel.isOnDuty == true)
|
|
|
|
|
{
|
|
|
|
|
// 将当前记录存为实体,可以通过parameter获取当前记录的信息
|
|
|
|
|
string orderCode = _selectedRow.OrderCode.ToString();
|
|
|
|
|
string planCode = _selectedRow.PlanCode.ToString();
|
|
|
|
|
pLanInfo = _prodPlanInfoService.GetRecordStaffAttendancesByConditions(orderCode, planCode, "", "", "0").First();
|
|
|
|
|
RecordStaffAttendance currentRecord = _recordStaffAttendanceService.GetLastestOnRecord();
|
|
|
|
|
RecordStaffAttendance nextRecord = _recordStaffAttendanceService.GetLastestOffRecord();
|
|
|
|
|
// 向detail表里插入一条数据
|
|
|
|
|
ProdPlanDetail prodPlanDetail = new ProdPlanDetail
|
|
|
|
|
if (isComplete)//判断是否完成,未完成不能执行其他工单
|
|
|
|
|
{
|
|
|
|
|
PlanCode = pLanInfo.PlanCode,
|
|
|
|
|
MaterialCode = pLanInfo.MaterialCode,
|
|
|
|
|
PlanAmount = pLanInfo.PlanAmount,
|
|
|
|
|
CompleteAmount = pLanInfo.CompleteAmount,
|
|
|
|
|
BeginTime = DateTime.Now.ToString(),
|
|
|
|
|
CurrentStaffId = currentRecord.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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//刷新明细
|
|
|
|
@ -180,8 +191,30 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示班组成员
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="baseStaffInfo"></param>
|
|
|
|
|
private void ShowTeamMember(BaseStaffInfo baseStaffInfo)
|
|
|
|
|
{
|
|
|
|
|
if(baseStaffInfo != null)
|
|
|
|
|
{
|
|
|
|
|
TeamMember = _RfidHandleBusniess.SpliceTeamMember(baseStaffInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 班组成员
|
|
|
|
|
/// </summary>
|
|
|
|
|
private string teamMember;
|
|
|
|
|
public string TeamMember
|
|
|
|
|
{
|
|
|
|
|
get { return teamMember; }
|
|
|
|
|
set { teamMember = value; OnPropertyChanged("TeamMember"); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订单
|
|
|
|
|
/// </summary>
|
|
|
|
|