You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
183 lines
5.5 KiB
183 lines
5.5 KiB
using BBWY.Client.APIServices;
|
|
using BBWY.Client.APIServices.QiKu;
|
|
using BBWY.Client.Models;
|
|
using BBWY.Client.Models.APIModel;
|
|
using BBWY.Controls;
|
|
using EnumsNET;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
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.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Shapes;
|
|
using WebSocketSharp;
|
|
|
|
namespace BBWY.Client.Views.QualityTask
|
|
{
|
|
/// <summary>
|
|
/// AddExceptionWindow.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class AddExceptionWindow : BWindow
|
|
{
|
|
public AddExceptionWindow(PackTaskAbortService packTaskAbortService, long taskId, TaskState abortTaskState, Action taskAbort, List<IsContinuePackageModel> IsCanPackModelList, List<string> shelvesNumberList, List<int> floorNumberList)
|
|
{
|
|
InitializeComponent();
|
|
this.packTaskAbortService = packTaskAbortService;
|
|
this.TaskId = taskId;
|
|
this.DataContext = this;
|
|
AbortTaskState = abortTaskState;
|
|
TaskAbort = taskAbort;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.IsCanPackModelList = IsCanPackModelList;
|
|
ShelvesNumberList = shelvesNumberList;
|
|
FloorNumberList = floorNumberList;
|
|
|
|
|
|
|
|
App.Current.Dispatcher.Invoke(() =>
|
|
{
|
|
IsContinuePackageList = IsCanPackModelList.Select(c => new EnumModel { Index = c.Index, Name = c.Name }).ToList();
|
|
if (IsCanPackModelList.Any())
|
|
IsContinuePackage = IsContinuePackageList.First().Index;
|
|
});
|
|
|
|
}
|
|
|
|
private int isContinuePackage;
|
|
/// <summary>
|
|
/// 验收异常类型
|
|
/// </summary>
|
|
public int IsContinuePackage
|
|
{
|
|
get => isContinuePackage; set
|
|
{
|
|
Set(ref isContinuePackage, value);
|
|
OnIsContinuePackageChanged();
|
|
}
|
|
}
|
|
public void OnIsContinuePackageChanged()
|
|
{
|
|
App.Current.Dispatcher.Invoke(() =>
|
|
{
|
|
TaskExceptionTypeList = IsCanPackModelList.SingleOrDefault(cp => cp.Index == IsContinuePackage)?.TaskExceptionTypeList;
|
|
});
|
|
}
|
|
|
|
|
|
private List<EnumModel> isContinuePackageList;
|
|
/// <summary>
|
|
/// 是否可继续包装
|
|
/// </summary>
|
|
public List<EnumModel> IsContinuePackageList { get => isContinuePackageList; set { Set(ref isContinuePackageList, value); } }
|
|
|
|
List<IsContinuePackageModel> IsCanPackModelList { get; set; }
|
|
|
|
|
|
Action TaskAbort { get; set; }
|
|
/// <summary>
|
|
/// 任务挂起类型
|
|
/// </summary>
|
|
public TaskState AbortTaskState { get; set; }
|
|
|
|
|
|
PackTaskAbortService packTaskAbortService;
|
|
|
|
|
|
private long taskId;
|
|
/// <summary>
|
|
/// 任务id
|
|
/// </summary>
|
|
public long TaskId { get => taskId; set { Set(ref taskId, value); } }
|
|
|
|
|
|
private int? taskExceptionType;
|
|
/// <summary>
|
|
/// 验收异常类型
|
|
/// </summary>
|
|
public int? TaskExceptionType { get => taskExceptionType; set { Set(ref taskExceptionType, value); } }
|
|
|
|
|
|
private List<EnumModel> taskExceptionTypeList;
|
|
/// <summary>
|
|
/// 验收异常类型
|
|
/// </summary>
|
|
public List<EnumModel> TaskExceptionTypeList { get => taskExceptionTypeList; set { Set(ref taskExceptionTypeList, value); } }
|
|
|
|
|
|
private string remarkMsg;
|
|
/// <summary>
|
|
/// 备注消息
|
|
/// </summary>
|
|
public string RemarkMsg { get => remarkMsg; set { Set(ref remarkMsg, value); } }
|
|
|
|
|
|
|
|
private List<int> floorNumberList = new List<int> { 1, 2, 3, 4 };
|
|
/// <summary>
|
|
/// 层数列表
|
|
/// </summary>
|
|
public List<int> FloorNumberList { get => floorNumberList; set { Set(ref floorNumberList, value); } }
|
|
|
|
private int floorNumber;
|
|
/// <summary>
|
|
///层数
|
|
/// </summary>
|
|
public int FloorNumber { get => floorNumber; set { Set(ref floorNumber, value); } }
|
|
|
|
|
|
private List<string> shelvesNumberList;
|
|
/// <summary>
|
|
/// 货架列表
|
|
/// </summary>
|
|
public List<string> ShelvesNumberList { get => shelvesNumberList; set { Set(ref shelvesNumberList, value); } }
|
|
|
|
private string shelvesNumber;
|
|
/// <summary>
|
|
/// 货架
|
|
/// </summary>
|
|
public string ShelvesNumber { get => shelvesNumber; set { Set(ref shelvesNumber, value); } }
|
|
|
|
|
|
private void BButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (ShelvesNumber.IsNullOrEmpty()|| FloorNumber<=0)
|
|
{
|
|
MessageBox.Show("请输入摆放货架位置");
|
|
return;
|
|
}
|
|
|
|
if (RemarkMsg.IsNullOrEmpty())
|
|
{
|
|
MessageBox.Show("请输入具体问题描述.");
|
|
return;
|
|
}
|
|
|
|
if (TaskExceptionType==null)
|
|
{
|
|
MessageBox.Show("请选择异常类型.");
|
|
return;
|
|
}
|
|
|
|
var res = packTaskAbortService.AbortPackTask(TaskId, TaskExceptionType.Value, RemarkMsg, AbortTaskState, ShelvesNumber, FloorNumber);
|
|
if (res == null || !res.Success)
|
|
{
|
|
MessageBox.Show(res?.Msg);
|
|
return;
|
|
}
|
|
TaskAbort?.Invoke();
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|
|
|