|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using SlnMesnac.Repository;
|
|
|
|
|
using SlnMesnac.Repository.service;
|
|
|
|
|
using SlnMesnac.WPF.ViewModel.IndexPage;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
using System.Windows.Navigation;
|
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
|
using static Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties.System;
|
|
|
|
|
|
|
|
|
|
namespace SlnMesnac.WPF.Page.IndexPage
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// AddTaskContent.xaml 的交互逻辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class AddTaskContent : Window
|
|
|
|
|
{
|
|
|
|
|
public Action<AirportTask> _Taskaction;
|
|
|
|
|
private IAirportTaskService _taskservice;
|
|
|
|
|
|
|
|
|
|
public AddTaskContent()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
_taskservice = App.ServiceProvider.GetService<IAirportTaskService>();
|
|
|
|
|
InitAreaCombox();
|
|
|
|
|
this.Init();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Init()
|
|
|
|
|
{
|
|
|
|
|
taskNo.Text = DateTime.Now.ToString("yyMMddHHmmss");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void InitAreaCombox()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Dictionary<int, string> dicItem = new Dictionary<int, string>();
|
|
|
|
|
dicItem.Add(1,"1号站台");
|
|
|
|
|
dicItem.Add(2, "2号站台");
|
|
|
|
|
dicItem.Add(3, "3号站台");
|
|
|
|
|
dicItem.Add(4, "4号站台");
|
|
|
|
|
dicItem.Add(5, "5号站台");
|
|
|
|
|
dicItem.Add(6, "6号站台");
|
|
|
|
|
AreaNo.ItemsSource = dicItem;
|
|
|
|
|
AreaNo.SelectedIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btn_cancle_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void btn_ok_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//判空
|
|
|
|
|
if (string.IsNullOrEmpty(AirNo.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请输入航班号!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string ss = AreaNo.SelectedIndex.ToString();
|
|
|
|
|
//判断站台任务是否结束
|
|
|
|
|
AirportTask AirportTask = new AirportTask()
|
|
|
|
|
{
|
|
|
|
|
taskno = taskNo.Text,
|
|
|
|
|
conveyorno = AreaNo.SelectedValue.ToString(),
|
|
|
|
|
flightno = AirNo.Text,
|
|
|
|
|
taskstate = "等待",
|
|
|
|
|
starttime = DateTime.Now
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool iflag = await _taskservice.AddTaskAsync(AirportTask);
|
|
|
|
|
if (iflag)
|
|
|
|
|
{
|
|
|
|
|
_Taskaction?.Invoke(AirportTask);
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|