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.

184 lines
6.3 KiB
C#

using SlnMesnac.RfidUpload.Business;
using SlnMesnac.RfidUpload.Common;
using SlnMesnac.RfidUpload.Model;
using SlnMesnac.RfidUpload.Model.apiParam;
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
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, Institution institution = 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))
{
this.PageMessage.Content = "请先输入邮路代码";
// MessageBox.Show("请先输入邮路代码");
return;
}
CsbHandleBusiness.iNIFile.IniWriteValue("TdjContainerAllotQuery", "routeCode", this.RouteCode.Text);
#region 正式启用
// 自动生成opBatch
string opBatch = Guid.NewGuid().ToString("N").Substring(0, 20);
2 months ago
OpBatchManager.BathNo = opBatch;
CsbResult res = csbHandleBusiness.findStationSequenceByCsb(_transferOrderInfo.ffjhNo, opBatch);
this.PageMessage.Content = res.GetMsg();
if (res.code == "200")
{
2 months ago
if (res.IsSuccess)
{
2 months ago
List<Institution> institutionList = res.ToObjectList<Institution>();
int count = 1;
Console.WriteLine("机构信息:");
foreach (var institution in institutionList)
{
institution.No = count++.ToString();
institution.opBatch = opBatch;
}
InstitutionList.ItemsSource = institutionList;
}
}
else
{
MessageBox.Show(res.message);
}
#endregion
2 months ago
}
catch (Exception ex)
{
this.PageMessage.Content = $"获取卸交站异常:{ex.Message}";
// MessageBox.Show($"获取卸交站异常:{ex.Message}");
}
}
/// <summary>
///
/// 三、验证封发计划- 不指定机构
/// </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,"","");
//this.PageMessage.Content = "校验发运计划结果:"+res.GetMsg();
//if (res.code == "200")
//{
// RefreshSubmitVerifyEvent?.Invoke(3, res.GetMsg(), _transferOrderInfo);
// this.Close();
//}
FfjhCheck();
}
// 三、验证封发计划 -指定机构
private void ExecuteCommand_Click(object sender, RoutedEventArgs e)
{
var button = sender as Button;
var institution = button.DataContext as Institution;
if (institution != null)
2 months ago
{
FfjhCheck(institution);
// string opBatch = OpBatchManager.BathNo;
// CsbResult res = csbHandleBusiness.tranPlanCheckByCsb(_transferOrderInfo.ffjhNo, opBatch, institution.stationOrgCode,institution.stationOrgName);
// MessageBox.Show($"执行配发 6.12.容器直连配发-校验发运计划 容器封发完毕后直接向指定机构进行容器配发 :{res.message}");
// if (res.code == "200")
// {
// RefreshSubmitVerifyEvent?.Invoke(3, res.GetMsg(), _transferOrderInfo);
// this.Close();
// }
}
}
/// <summary>
/// 封发计划校验
/// 可传递机构机构实体,机构代码、机构名称供后续效验封发计划使用
/// </summary>
private void FfjhCheck(Institution institution = null)
{
#region 正式启用
//6.8 验证封发计划接口
CsbResult res = csbHandleBusiness.transferOrderFfjhCheckByCsb(_transferOrderInfo.ffjhNo, _transferOrderInfo.ffjhscrq);
this.PageMessage.Content = $"验证封发计划接口:{res.GetMsg()}";
if (res.code == "200")
{
//封发计划正常可封发
RefreshSubmitVerifyEvent?.Invoke(3, res.GetMsg(), _transferOrderInfo,institution);
this.Close();
}
#endregion
}
/// <summary>
/// 机构实体
/// </summary>
public class Institution
{
public string No { get; set; }
public string stationOrgCode { get; set; }
public string stationOrgName { get; set; }
public string opBatch { get; set; }
}
}
}