using BBWY.Client.APIServices;
using BBWY.Client.APIServices.QiKu;
using BBWY.Client.Models;
using BBWY.Controls;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WebSocketSharp;
namespace BBWY.Client.Views.TaskOverTime
{
///
/// SubmitOverTimeMarkMsgWindow.xaml 的交互逻辑
///
public partial class SubmitOverTimeMarkMsgWindow : BWindow
{
public SubmitOverTimeMarkMsgWindow(PackTaskOverTimeDetailService packTaskOverTimeDetailService, long id, string msg, TaskMessageType taskMessageType, OverTimeType overTimeType, Action reflashWindow)
{
InitializeComponent();
this.Id = id;
MarkMsg = msg;
this.reflashWindow = reflashWindow;
this.DataContext = this;
this.packTaskOverTimeDetailService = packTaskOverTimeDetailService;
TaskMessageType = taskMessageType;
OverTimeType = overTimeType;
}
Action reflashWindow;
PackTaskOverTimeDetailService packTaskOverTimeDetailService { get; set; }
///
/// 超时任务类型
///
public TaskMessageType TaskMessageType { get; set; }
public OverTimeType OverTimeType{ get; set; }
///
/// 任务id 或者 封箱id
///
public long Id { get; set; }
///
/// 备注信息
///
public string MarkMsg { get; set; }
private void BButton_Click(object sender, RoutedEventArgs e)
{
if (MarkMsg.IsNullOrEmpty())
{
MessageBox.Show("请输入超时原因");
return;
}
var res = packTaskOverTimeDetailService.SubmitOverTimeMarkMsg(TaskMessageType, Id, OverTimeType, MarkMsg);
if (res == null)
{
MessageBox.Show("网络异常");
return;
}
if (!res.Success)
{
MessageBox.Show(res.Msg);
return;
}
if (reflashWindow != null) reflashWindow();
App.Current.Dispatcher.Invoke(new Action(() => { this.Close(); }));
}
}
}