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.

165 lines
5.5 KiB
C#

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.UI.viewModel;
using System;
using System.Collections.Generic;
using System.Linq;
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;
using TouchSocket.Core;
using static SlnMesnac.RfidUpload.UI.SelectRouterWindow;
namespace SlnMesnac.RfidUpload.UI
{
/// <summary>
/// containerStorageQueryByCsb.xaml 的交互逻辑
/// </summary>
public partial class SelectRouterWindow : Window
{
#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);
public static event RefreshSubmitVerifyDelegate RefreshSubmitVerifyEvent;
#endregion
private CsbHandleBusiness csbHandleBusiness = CsbHandleBusiness.Instance;
TransferOrderInfo _transferOrderInfo;
public SelectRouterWindow(TransferOrderInfo transferOrderInfo)
{
_transferOrderInfo = transferOrderInfo;
InitializeComponent();
}
/// <summary>
/// 获取卸交站
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void QueryButton_Click(object sender, RoutedEventArgs e)
{
try
{
if (string.IsNullOrEmpty(this.RouteCode.Text))
{
MessageBox.Show("请先输入邮路代码");
return;
}
CsbHandleBusiness.iNIFile.IniWriteValue("TdjContainerAllotQuery", "routeCode", this.RouteCode.Text);
#region 正式启用
// 自动生成opBatch
string opBatch = Guid.NewGuid().ToString("N").Substring(0, 20);
CsbResult res = csbHandleBusiness.findStationSequenceByCsb(_transferOrderInfo.ffjhNo, opBatch);
if (res.code == "200")
{
if (res.IsSuccess)
{
List<Institution> institutionList = res.ToObjectList<Institution>();
// res.@object.ConvertAll(item => JsonConvert.DeserializeObject<Institution>(item.ToString()));
int count = 1;
Console.WriteLine("机构信息:");
foreach (var institution in institutionList)
{
institution.No = count++.ToString();
}
InstitutionList.ItemsSource = institutionList;
}
}
else
{
MessageBox.Show(res.message);
}
#endregion
1 month ago
}
catch (Exception ex)
{
MessageBox.Show($"获取卸交站异常:{ex.Message}");
}
}
/// <summary>
/// 封发配发 6.12.容器直连配发-校验发运计划
/// 可不指定机构直接完成容器封发配发
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void HandOutButton_Click(object sender, RoutedEventArgs e)
{
string opBatch = Guid.NewGuid().ToString("N").Substring(0, 20);
CsbResult res = csbHandleBusiness.tranPlanCheckByCsb(_transferOrderInfo.ffjhNo,opBatch,"","");
MessageBox.Show(res.message);
if (res.code == "200")
{
RefreshSubmitVerifyEvent?.Invoke(3, res.message, _transferOrderInfo);
this.Close();
}
}
// 执行配发 6.12.容器直连配发-校验发运计划
// 容器封发完毕后直接向指定机构进行容器配发
private void ExecuteCommand_Click(object sender, RoutedEventArgs e)
{
var button = sender as Button;
var institution = button.DataContext as Institution;
if (institution != null)
{
string opBatch = Guid.NewGuid().ToString("N").Substring(0, 20);
CsbResult res = csbHandleBusiness.tranPlanCheckByCsb(_transferOrderInfo.ffjhNo, opBatch, institution.stationOrgCode,institution.stationOrgName);
if(res.code == "200")
{
RefreshSubmitVerifyEvent?.Invoke(3, res.message, _transferOrderInfo);
this.Close();
}
}
}
/// <summary>
/// 机构实体
/// </summary>
public class Institution
{
public string No { get; set; }
public string stationOrgCode { get; set; }
public string stationOrgName { get; set; }
}
}
}