步步为盈
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.

77 lines
2.1 KiB

using BBWY.Client.APIServices.QiKu;
using BBWY.Controls;
using System;
using System.Collections.Generic;
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 BBWY.Client.Views.PackerTask
{
/// <summary>
/// AddOneItemWeightWindow.xaml 的交互逻辑
/// </summary>
public partial class AddOneItemWeightWindow : BWindow
{
public AddOneItemWeightWindow(Action completePack, PackUserService packUserService, long taskId)
{
InitializeComponent();
this.DataContext = this;
CompletePack = completePack;
this.packUserService = packUserService;
TaskId = taskId;
}
PackUserService packUserService;
private Action CompletePack { get;set;}
private long TaskId;
private string weigth;
public string Weigth { get => weigth; set { Set(ref weigth, value); } }
private void btn_ok_Click(object sender, RoutedEventArgs e)
{
decimal oneItemWeight = 0;
try
{
oneItemWeight = decimal.Parse(Weigth.Trim());
if (oneItemWeight<=0)
{
MessageBox.Show("重量不能低于0");
return;
}
var res = packUserService.CompletedPackTask(TaskId, oneItemWeight);
if (res.Success)
{
CompletePack?.Invoke();
this.Close();
}
else
{
MessageBox.Show(res?.Msg);
return;
}
}
catch (Exception ex)
{
MessageBox.Show("重量输入有误");
}
}
private void btn_cancel_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
}
}