执行逻辑优化

main
yinq 4 days ago
parent e83910ef8a
commit 481d9a4229

@ -289,6 +289,11 @@ namespace SlnMesnac.WPF.ViewModel
if (!isOnDuty)
{
//stationCode = SelectedItem;
if (SelectedItem == null)
{
MessageBox.Show("请选择工位!");
return;
}
var result = ExtractStrings(SelectedItem);
RfidHandleBusniess.stationCode = result.Item1;
stationName = result.Item2;
@ -298,6 +303,7 @@ namespace SlnMesnac.WPF.ViewModel
TransmitUserDelegateEvent?.Invoke();
ShowStaffAttendances(null, isCheckOn);
MessageBox.Show("已确认工位:" + stationName);
ExecuteViewModel.RefreshAction?.Invoke(result.Item1);
}
else
{

@ -99,6 +99,9 @@ namespace SlnMesnac.WPF.ViewModel
public static Action ClearOrderCodeAction;
public static Action<string> RefreshAction;
/// <summary>
/// 按钮文字转换事件
/// </summary>
@ -317,9 +320,9 @@ namespace SlnMesnac.WPF.ViewModel
.SetBasePath(System.AppContext.BaseDirectory)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
IConfigurationRoot configuration = configurationBuilder.Build();
pLanInfo = _prodPlanInfoService.GetPlanInfoByConditions("", "", "", "", "1").FirstOrDefault();
Refresh(pLanInfo);
havePlanOnDuty();
//pLanInfo = _prodPlanInfoService.GetPlanInfoByConditions("", "", "", "", "1").FirstOrDefault();
//Refresh(pLanInfo);
//havePlanOnDuty(ProcessCode);
// 从配置文件中获取ProductLineNameTextBlock的值
//stationTextBlock = configuration.GetSection("AppConfig")["ProductLineName"];
//StationCodes = configuration.GetSection("AppConfig")["StationCode"];
@ -338,6 +341,7 @@ namespace SlnMesnac.WPF.ViewModel
Clear();
}
;
RefreshAction += RefreshDetail;
DeviceCode = configuration.GetSection("AppConfig")["DeviceCode"];
ProcessCode = configuration.GetSection("AppConfig")["ProcessCode"];
@ -357,6 +361,19 @@ namespace SlnMesnac.WPF.ViewModel
MainWindowViewModel.TransferOrderCodeEvent += HandleOrderCode;
}
/// <summary>
/// 根据工位刷新明细
/// </summary>
private void RefreshDetail(string stationCode)
{
if (stationCode == null) { return; }
pLanInfo = _prodPlanInfoService.GetPlanInfoByConditions("", "", "", stationCode, "1").FirstOrDefault();
if (pLanInfo == null) { return; }
Refresh(pLanInfo);
havePlanOnDuty(stationCode);
}
/// <summary>
/// 撤回
/// </summary>
@ -391,9 +408,9 @@ namespace SlnMesnac.WPF.ViewModel
/// <summary>
/// 是否有计划正在执行
/// </summary>
private void havePlanOnDuty()
private void havePlanOnDuty(string stationCode)
{
haveInfo = _prodPlanInfoService.GetPlanInfoByConditions("", "", "", "", "1").FirstOrDefault();
haveInfo = _prodPlanInfoService.GetPlanInfoByConditions("", "", "", stationCode, "1").FirstOrDefault();
if (haveInfo != null)
{
isComplete = false;
@ -487,7 +504,14 @@ namespace SlnMesnac.WPF.ViewModel
/// </summary>
private void Search()
{
var staffList = _recordStaffRealTimeService.Query().ToList();
if(RfidHandleBusniess.stationCode == "")
{
MessageBox.Show("请先选择工位!");
return;
}
var staffList = _recordStaffRealTimeService.Query()
.Where(x => x.StationCode == RfidHandleBusniess.stationCode)
.ToList();
if (staffList.Count > 0)
{
//在这里执行其他操作可以通过InputText获取用户输入的信息
@ -626,7 +650,11 @@ namespace SlnMesnac.WPF.ViewModel
{
MessageBox.Show("请先完成当前工单!");
}
}
}
else
{
MessageBox.Show("请点击上班打卡!");
}
}
//刷新明细

Loading…
Cancel
Save