|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
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;
|
|
|
using NewLife;
|
|
|
using Newtonsoft.Json;
|
|
|
using static SlnMesnac.RfidUpload.UI.SelectRouterWindow;
|
|
|
using NewLife.Log;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
#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 TransferOrderViewModel : 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, TransferOrderInfo transferOrderInfo = null, Institution institution = null);
|
|
|
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);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 调拨单总数
|
|
|
/// </summary>
|
|
|
public string _totalCount = string.Empty;
|
|
|
public string TotalAmount
|
|
|
{
|
|
|
get => _totalCount;
|
|
|
set => SetProperty(ref _totalCount, 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>
|
|
|
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);
|
|
|
}
|
|
|
|
|
|
[RelayCommand]
|
|
|
private void Query()
|
|
|
{
|
|
|
var info = _FFPlan;
|
|
|
var info2 = _drj;
|
|
|
var info3 = _startDate;
|
|
|
var info4 = _endDate;
|
|
|
}
|
|
|
|
|
|
|
|
|
private void OnDateChanged()
|
|
|
{
|
|
|
if (_startDate != null && _endDate != null)
|
|
|
{
|
|
|
GetTransferOrder();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
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.GetMsg());
|
|
|
if (res.IsSuccess)
|
|
|
{
|
|
|
|
|
|
JObject job = JObject.Parse(res.body);
|
|
|
string str = job["retBody"]?["object"]?.ToString();
|
|
|
if (!str.IsNullOrEmpty())
|
|
|
{
|
|
|
List<TransferOrderInfo> institutionList = JsonConvert.DeserializeObject<List<TransferOrderInfo>>(str);
|
|
|
|
|
|
TransferOrderInfoItems = new ObservableCollection<TransferOrderInfo>(institutionList);
|
|
|
TotalAmount = TransferOrderInfoItems.Count.ToString();
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
TransferOrderInfoItems.Clear();
|
|
|
TotalAmount = "0";
|
|
|
//TransferOrderInfoItems = new ObservableCollection<TransferOrderInfo>(new List<TransferOrderInfo>());
|
|
|
//TotalAmount = TransferOrderInfoItems.Count.ToString();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
}catch (Exception ex)
|
|
|
{
|
|
|
TransferMsg = ex.Message;
|
|
|
// MessageBox.Show(ex.Message);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 执行分发 容器封发-验证封发计划
|
|
|
/// </summary>
|
|
|
/// <param name="transferOrderInfo"></param>
|
|
|
[RelayCommand]
|
|
|
private void Execute(TransferOrderInfo transferOrderInfo)
|
|
|
{
|
|
|
|
|
|
#region 正式启用
|
|
|
CsbResult res = csbHandleBusiness.transferOrderFfjhCheckByCsb(transferOrderInfo.ffjhNo, transferOrderInfo.ffjhscrq);
|
|
|
TransferMsg = $"验证调拨单结果:{res.GetMsg()}";
|
|
|
|
|
|
if (res.IsSuccess)
|
|
|
{ //封发计划正常可封发
|
|
|
// MessageBox.Show($"验证调拨单结果,[{res.GetMsg()}];");
|
|
|
SuccessEvent?.Invoke();
|
|
|
RefreshSubmitVerifyEvent?.Invoke(2, res.GetMsg(), transferOrderInfo);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
TransferMsg = res.GetMsg();
|
|
|
// MessageBox.Show(res.message);
|
|
|
return;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
//JObject jsonObject = new JObject
|
|
|
//{
|
|
|
// ["code"] = 104,
|
|
|
// ["requestURL"] = appConfig.requestURL,
|
|
|
// ["sysCode"] = appConfig.sysCode,
|
|
|
// ["password"] = appConfig.password,
|
|
|
// ["ak"] = appConfig.ak,
|
|
|
// ["sk"] = appConfig.sk,
|
|
|
// ["TdjStockTransferOrderffjhCheckQuery"] = new JObject
|
|
|
// {
|
|
|
// ["opOrgCode"] = iNIFile.IniReadValue("BatchOpenQuery", "opOrgCode"),
|
|
|
// ["devicedId"] = iNIFile.IniReadValue("BatchOpenQuery", "devicedId"),
|
|
|
// ["ffjhNo"] = info.ffjhNo,
|
|
|
// ["ffjhscrq"] = info.ffjhscrq,
|
|
|
// }
|
|
|
//};
|
|
|
|
|
|
//string jsonString = jsonObject.ToString();
|
|
|
//var str = webApiClientApp.UploadAsync(jsonString);
|
|
|
//result res = JsonConvert.DeserializeObject<result>(str);
|
|
|
|
|
|
//result res = new result()
|
|
|
//{
|
|
|
// status = "0",
|
|
|
// msg = "1"
|
|
|
//};
|
|
|
|
|
|
//MessageBox.Show($"验证调拨单结果,status:{res.status};msg:{res.msg};");
|
|
|
//if(res.status == "0")
|
|
|
//{
|
|
|
// SuccessEvent?.Invoke();
|
|
|
|
|
|
// RefreshTransferOrderInfoEvent?.Invoke(info);
|
|
|
//}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
class result
|
|
|
{
|
|
|
public string status { get; set; }
|
|
|
|
|
|
public string msg { get; set; }
|
|
|
|
|
|
public List<TransferOrderInfo> @object { get; set; }
|
|
|
}
|