using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using SlnMesnac.RfidUpload.Business;
using SlnMesnac.RfidUpload.Model.apiParam;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* 版权所有 (c) 2024 WenJY 保留所有权利。
* CLR版本:4.0.30319.42000
* 机器名称:T14-GEN3-7895
* 命名空间:SlnMesnac.RfidUpload.UI.viewModel
* 唯一标识:a65ccfd9-c493-46c4-9905-7a7d55ef1508
*
* 创建者:WenJY
* 电子邮箱:
* 创建时间:2024-12-06 16:31:16
* 版本:V1.0.0
* 描述:
*
*--------------------------------------------------------------------
* 修改人:
* 时间:
* 修改说明:
*
* 版本:V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.RfidUpload.UI.viewModel
{
public partial class containerStorageQueryByCsbViewModel : ObservableObject
{
private readonly Window _window;
#region 委托事件
///
/// model-新容器入库-调拨单号验证状态成功1,失败-1
/// model-容器封发-验证封发计划接口,状态成功2,失败-1
/// dbdh-调拨单号
/// status- 1-正常
///
///
///
public delegate void RefreshSubmitVerifyDelegate(int model,string msg, string dbdh);
public static event RefreshSubmitVerifyDelegate RefreshSubmitVerifyEvent;
#endregion
public containerStorageQueryByCsbViewModel(Window window)
{
_window = window;
}
private CsbHandleBusiness csbHandleBusiness = CsbHandleBusiness.Instance;
public string _dbbh = string.Empty;
public string dbbh
{
get => _dbbh;
set => SetProperty(ref _dbbh, value);
}
public string _rqtmStart = string.Empty;
public string rqtmStart
{
get => _rqtmStart;
set => SetProperty(ref _rqtmStart, value);
}
private string _rqtmEnd = string.Empty;
public string rqtmEnd
{
get => _rqtmEnd;
set
{
_rqtmEnd = value;
OnPropertyChanged(nameof(_rqtmEnd));
}
}
[RelayCommand]
private void Submit()
{
CsbResult res = csbHandleBusiness.containerStorageQueryByCsb(_dbbh, _rqtmStart, _rqtmEnd);
if (res.status == "0" || res.status == "2")
{
MessageBox.Show($"新容器入库-调拨单号验证通过");
RefreshSubmitVerifyEvent?.Invoke(1, res.msg, _dbbh);
_window.Close();
}
else
{
MessageBox.Show($"新容器入库-调拨单号验证失败,status:{res.status};msg:{res.msg};");
}
}
}
}