You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

206 lines
6.3 KiB
C#


using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Nancy.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SlnMesnac.RfidUpload.Business;
using SlnMesnac.RfidUpload.Common;
using SlnMesnac.RfidUpload.Model;
using SlnMesnac.RfidUpload.Model.apiParam;
using SlnMesnac.RfidUpload.Model.config;
using SlnMesnac.RfidUpload.TouchSocket;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.ServiceModel.Channels;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2024 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* SlnMesnac.RfidUpload.UI.viewModel
* 81e29764-73f1-4de5-bd78-56b96ca165ba
*
* WenJY
*
* 2024-12-06 9:50:16
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.RfidUpload.UI.viewModel
{
public partial class ContainerTransferOrderViewModel : ObservableObject
{
#region 委托事件
/// <summary>
/// model-新容器入库-调拨单号验证状态成功1失败-1
/// model-容器封发-验证封发计划接口状态成功2失败-1
/// dbdh-调拨单号
/// status- 1-正常
/// </summary>
/// <param name="status"></param>
/// <param name="dbdh"></param>
public delegate void RefreshSubmitVerifyDelegate(int model, string msg, string dbdh);
public static event RefreshSubmitVerifyDelegate RefreshSubmitVerifyEvent;
#endregion
public delegate void Success();
public event Success SuccessEvent;
private CsbHandleBusiness csbHandleBusiness = CsbHandleBusiness.Instance;
public string _FFPlan = string.Empty;
public string FFPlan
{
get => _FFPlan;
set => SetProperty(ref _FFPlan, value);
}
public string _drj = string.Empty;
public string DRJ
{
get => _drj;
set => SetProperty(ref _drj, value);
}
private DateTime? _startDate;
public DateTime? StartDate
{
get => _startDate;
set
{
_startDate = value;
OnPropertyChanged(nameof(StartDate));
}
}
private DateTime? _endDate;
public DateTime? EndDate
{
get => _endDate;
set
{
_endDate = value;
OnPropertyChanged(nameof(EndDate));
}
}
private ObservableCollection<TransferOrderInfo> _transferOrderInfoItems = new ObservableCollection<TransferOrderInfo>();
public ObservableCollection<TransferOrderInfo> TransferOrderInfoItems
{
get => _transferOrderInfoItems;
set => SetProperty(ref _transferOrderInfoItems, value);
}
[RelayCommand]
private void Query()
{
var info = _FFPlan;
var info2 = _drj;
var info3 = _startDate;
var info4 = _endDate;
}
private AppConfig appConfig = AppConfig.Instance;
private WebApiClientApp webApiClientApp = WebApiClientApp.Instance;
private static INIFile iNIFile = new INIFile(System.Environment.CurrentDirectory + "/App.InI");
[RelayCommand]
private void GetTransferOrder()
{
if (_startDate == null || _endDate == null)
{
MessageBox.Show("请选择开始日期或者结束日期");
return;
}
else if (_startDate > _endDate)
{
MessageBox.Show("开始日期不能大于结束日期");
return;
}
#region 正式启用
//CsbResult res = csbHandleBusiness.transferOrderFfjhByCsb("", _startDate.Value.ToString(), _endDate.Value.ToString());
//MessageBox.Show(res.message);
//if (res.code == "200")
//{
// if (res.@object != null && res.@object.Count > 0)
// {
// List<TransferOrderInfo> institutionList = res.@object.ConvertAll(item => JsonConvert.DeserializeObject<TransferOrderInfo>(item.ToString()));
// TransferOrderInfoItems = new ObservableCollection<TransferOrderInfo>(institutionList);
// }
//}
#endregion
#region 测试启用
result res = new result()
{
status = "1",
msg = "测试",
@object = new List<TransferOrderInfo>()
{
new TransferOrderInfo()
{
dbdh = "123",
jsdw = "123",
ffjhNo = "jh123",
ffjhscrq = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
},
new TransferOrderInfo()
{
dbdh = "324",
jsdw = "456",
ffjhNo = "jh456",
ffjhscrq = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
}
}
};
if (res.@object != null)
{
TransferOrderInfoItems = new ObservableCollection<TransferOrderInfo>(res.@object);
}
#endregion
}
/// <summary>
/// 执行分发
/// </summary>
/// <param name="transferOrderInfo"></param>
[RelayCommand]
private void Execute(TransferOrderInfo transferOrderInfo)
{
SelectRouterWindow selectRouterWindow = new SelectRouterWindow(transferOrderInfo);
selectRouterWindow.ShowDialog();
}
}
}
class result1
{
public string status { get; set; }
public string msg { get; set; }
public List<TransferOrderInfo> @object { get; set; }
}