Frm_TaskAdd.xaml.cs 2.16 KB
using HHWCS.Bll;
using HHWCS.Model;
using System;
using System.Collections.Generic;
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.Shapes;

namespace HHWCSHost.View
{
    /// <summary>
    /// TaskAdd.xaml 的交互逻辑
    /// </summary>
    public partial class Frm_TaskAdd : Window
    {
        public TaskEntity TaskEntity { get; set; }
        public Frm_TaskAdd()
        {
            InitializeComponent();
            InitContorl();
        }

        private void InitContorl()
        {
            cbx_Priority.ItemsSource = AppCommon.GetPriority();
            cbx_Priority.SelectedValuePath = "Key";
            cbx_Priority.DisplayMemberPath = "Value";
            cbx_Priority.SelectedIndex = 0;
            cbx_TaskType.ItemsSource = AppCommon.GetTaskType();
            cbx_TaskType.SelectedValuePath = "Key";
            cbx_TaskType.DisplayMemberPath = "Value";
            cbx_TaskType.SelectedIndex = 0;
            cbx_Station.ItemsSource = AppCommon.GetStations();
            cbx_Station.SelectedValuePath = "Key";
            cbx_Station.DisplayMemberPath = "Value";
            cbx_Station.SelectedIndex = 0;
        }

        private void btn_Create_Click(object sender, RoutedEventArgs e)
        {
            if (Convert.ToInt32(cbx_TaskType.SelectedValue) != 900)
            {
                MessageBox.Show("注意:现在WCS只支持出库查看任务创建");
                return;
            }
            BllResult<TaskEntity> BllResult = AppCommon.Bll.CreatTask(txt_Pallet.Text, Convert.ToInt32(cbx_Station.SelectedValue), txt_sourceLocation.Text, txt_destinationLocation.Text, 0, Convert.ToInt32(cbx_TaskType.SelectedValue), Convert.ToInt32(cbx_Priority.SelectedValue));
            if (BllResult.Success)
            {
                MessageBox.Show("创建成功");
            }
            else
            {
                MessageBox.Show("创建失败:" + BllResult.Msg);
            }
        }
    }
}