|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
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 保留所有权利。
|
|
|
* CLR版本:4.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
|
|
|
|
|
|
/// <summary>
|
|
|
/// 区分属于哪个界面
|
|
|
/// 由于库存容器分发配发与卸车容器分发配发使用同一个界面与viewmodel
|
|
|
/// BelongPage = 3,表示库存容器分发配发,BelongPage = 4,表示卸车容器分发配发
|
|
|
/// </summary>
|
|
|
public int BelongPage = 3;
|
|
|
|
|
|
|
|
|
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
|
|
|
{
|
|
|
if (_startDate != value)
|
|
|
{
|
|
|
OnDateChanged();
|
|
|
}
|
|
|
_startDate = value;
|
|
|
OnPropertyChanged(nameof(StartDate));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private DateTime? _endDate;
|
|
|
public DateTime? EndDate
|
|
|
{
|
|
|
get => _endDate;
|
|
|
set
|
|
|
{
|
|
|
if (_endDate != value)
|
|
|
{
|
|
|
OnDateChanged();
|
|
|
}
|
|
|
_endDate = value;
|
|
|
OnPropertyChanged(nameof(EndDate));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 调拨单总数
|
|
|
/// </summary>
|
|
|
public string _totalCount = string.Empty;
|
|
|
public string TotalAmount
|
|
|
{
|
|
|
get => _totalCount;
|
|
|
set => SetProperty(ref _totalCount, value);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 界面提示信息
|
|
|
/// </summary>
|
|
|
private string? _transferMsg;
|
|
|
public string? TransferMsg
|
|
|
{
|
|
|
get => _transferMsg;
|
|
|
set
|
|
|
{
|
|
|
_transferMsg = value;
|
|
|
OnPropertyChanged(nameof(TransferMsg));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private ObservableCollection<TransferOrderInfo> _transferOrderInfoItems = new ObservableCollection<TransferOrderInfo>();
|
|
|
public ObservableCollection<TransferOrderInfo> TransferOrderInfoItems
|
|
|
{
|
|
|
get => _transferOrderInfoItems;
|
|
|
set => SetProperty(ref _transferOrderInfoItems, value);
|
|
|
}
|
|
|
|
|
|
|
|
|
private void OnDateChanged()
|
|
|
{
|
|
|
if (_startDate != null && _endDate != null)
|
|
|
{
|
|
|
GetTransferOrder();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[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)
|
|
|
{
|
|
|
TransferMsg = "请选择开始日期或者结束日期";
|
|
|
// MessageBox.Show("请选择开始日期或者结束日期");
|
|
|
return;
|
|
|
}
|
|
|
else if (_startDate > _endDate)
|
|
|
{
|
|
|
TransferMsg = "开始日期不能大于结束日期";
|
|
|
// MessageBox.Show("开始日期不能大于结束日期");
|
|
|
return;
|
|
|
}
|
|
|
_endDate = _endDate.Value.AddDays(1);
|
|
|
#region 正式启用
|
|
|
CsbResult res = csbHandleBusiness.transferOrderFfjhByCsb(_drj, _startDate.Value.ToString(), _endDate.Value.ToString());
|
|
|
TransferMsg = "获取调拨单结果:" + res.GetMsg();
|
|
|
// MessageBox.Show("容器封发-获取调拨单和封发计划:"+res.message);
|
|
|
if (res.IsSuccess)
|
|
|
{
|
|
|
List<TransferOrderInfo> institutionList = res.ToObjectList<TransferOrderInfo>();
|
|
|
TransferOrderInfoItems = new ObservableCollection<TransferOrderInfo>(institutionList);
|
|
|
TotalAmount = TransferOrderInfoItems.Count.ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
TransferOrderInfoItems.Clear();
|
|
|
TotalAmount = "0";
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 执行分发
|
|
|
/// </summary>
|
|
|
/// <param name="transferOrderInfo"></param>
|
|
|
[RelayCommand]
|
|
|
private void Execute(TransferOrderInfo transferOrderInfo)
|
|
|
{
|
|
|
SelectRouterWindow selectRouterWindow = new SelectRouterWindow(transferOrderInfo,BelongPage);
|
|
|
selectRouterWindow.ShowDialog();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|