add-新容器入库送货单号加列表保存

master
liuwf 1 month ago
parent 5dcca0c04d
commit 5d466c079a

@ -153,7 +153,9 @@
<Label Content="封发计划编号 :" FontSize="20" FontWeight="Black" Foreground="#00CC33" Margin="20,0,0,0"/>
<Label Content="{Binding MainPageFfjhNo}" FontSize="20" FontWeight="Black" Foreground="#00CC33" Margin="5,0,10,0"/>
<Label Content="送货单号trackNo :" FontSize="20" FontWeight="Black" Foreground="#00CC33" Margin="20,0,0,0"/>
<Label Content="{Binding TrackNo}" FontSize="20" FontWeight="Black" Foreground="#00CC33" Margin="5,0,10,0"/>
</StackPanel>
</Border>

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlnMesnac.RfidUpload.UI.TempData
{
/// <summary>
/// 存放系统临时数据
/// 暂时只存储新容器入库校验界面的送货单号列表数据
/// </summary>
public class SysData
{
#region 单例实现
private static readonly SysData lazy = new SysData();
public static SysData Instance
{
get
{
return lazy;
}
}
#endregion
public List<newContainerInCheckData> trackNoList = new List<newContainerInCheckData>();
}
/// <summary>
/// 新容器入库校验界面的送货单号列表数据
/// </summary>
public class newContainerInCheckData
{
/// <summary>
/// 调拨单号
/// </summary>
public string dbdh { get; set; }
/// <summary>
/// 送货单号
/// </summary>
public string trackNo { get; set; }
/// <summary>
/// 开始号段
/// </summary>
public string rqtmStart { get; set; }
/// <summary>
/// 结束号段
/// </summary>
public string rqtmEnd { get; set; }
/// <summary>
/// 添加时间
/// </summary>
public DateTime time { get; set; }
}
}

@ -5,13 +5,14 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SlnMesnac.RfidUpload.UI"
mc:Ignorable="d"
Title="新容器入库" Height="450" Width="800">
Title="新容器入库" Height="750" Width="800">
<Grid Margin="50,50">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="4*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="调拨单号:" FontSize="16" FontWeight="Black" Foreground="#006699" Margin="10,0,0,0"/>
@ -52,9 +53,37 @@
</TextBox>
</StackPanel>
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="确定" Command="{Binding SubmitCommand}" Style="{StaticResource BUTTON_AGREE}" Width="80" Height="30" Background="#007DFA" BorderBrush="#007DFA" Margin="10,0,10,0"/>
</StackPanel>
<DataGrid Grid.Row="4" Name="DG" ItemsSource="{Binding TrackNoItems}" Background="Transparent"
FontSize="15" ColumnHeaderHeight="35"
RowHeight="31" AutoGenerateColumns="False" RowHeaderWidth="0"
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Visible"
ScrollViewer.VerticalScrollBarVisibility="Visible" BorderThickness="0" CanUserAddRows="False"
Foreground="#0288d1" >
<!--resourceStyle 399行修改选中字体颜色-->
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding dbdh}" Header="调拨单号" Width="3*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding trackNo}" Header="送货单号" Width="*" IsReadOnly="True"/>
<DataGridTemplateColumn Header="操作" Width="180">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="新容器入库" Command="{Binding DataContext.ExecuteCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" CommandParameter="{Binding}" Style="{StaticResource BUTTON_AGREE}" FontSize="14" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,5,0"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>

@ -20,6 +20,7 @@ using System.Windows;
using System.Threading;
using static SlnMesnac.RfidUpload.UI.SelectRouterWindow;
using static SlnMesnac.RfidUpload.UI.viewModel.containerStorageQueryByCsbViewModel;
using SlnMesnac.RfidUpload.UI.TempData;
namespace SlnMesnac.RfidUpload.UI.viewModel
{
@ -39,7 +40,7 @@ namespace SlnMesnac.RfidUpload.UI.viewModel
private AppConfig appConfig = AppConfig.Instance;
private JsonChange jsonChange = JsonChange.Instance;
private int No = 1;
private string TrackNo = "";
private SysData sysData = SysData.Instance;
//暂存库存容器分发配发机构数据
private Institution Institution;
#region 参数定义
@ -143,6 +144,16 @@ namespace SlnMesnac.RfidUpload.UI.viewModel
set { _mainPageDbdh = value; RaisePropertyChanged(() => MainPageDbdh); }
}
/// <summary>
/// 主界面当前送货单号
/// </summary>
private string _trackNo = "";
public string TrackNo
{
get { return _trackNo; }
set { _trackNo = value; RaisePropertyChanged(() => TrackNo); }
}
/// <summary>
/// 主界面当前封发计划
/// </summary>
@ -264,7 +275,21 @@ namespace SlnMesnac.RfidUpload.UI.viewModel
FinishCommand = new RelayCommand(Finish);
this.Init();
//测试数据
sysData.trackNoList.Add(new newContainerInCheckData() { dbdh = "1234567890", trackNo = "123", rqtmStart = "123", rqtmEnd = "123", time = DateTime.Now });
sysData.trackNoList.Add(new newContainerInCheckData() { dbdh = "1234", trackNo = "123", rqtmStart = "123", rqtmEnd = "123", time = DateTime.Now });
sysData.trackNoList.Add(new newContainerInCheckData() { dbdh = "4434", trackNo = "123", rqtmStart = "123", rqtmEnd = "123", time = DateTime.Now });
sysData.trackNoList.Add(new newContainerInCheckData() { dbdh = "554434", trackNo = "123", rqtmStart = "123", rqtmEnd = "123", time = DateTime.Now.AddDays(1) });
sysData.trackNoList.Add(new newContainerInCheckData() { dbdh = "4434", trackNo = "123", rqtmStart = "123", rqtmEnd = "123", time = DateTime.Now });
sysData.trackNoList.Add(new newContainerInCheckData() { dbdh = "4434", trackNo = "123", rqtmStart = "123", rqtmEnd = "123", time = DateTime.Now });
sysData.trackNoList.Add(new newContainerInCheckData() { dbdh = "4434", trackNo = "123", rqtmStart = "123", rqtmEnd = "123", time = DateTime.Now });
sysData.trackNoList.Add(new newContainerInCheckData() { dbdh = "4434", trackNo = "123", rqtmStart = "123", rqtmEnd = "123", time = DateTime.Now });
sysData.trackNoList.Add(new newContainerInCheckData() { dbdh = "4434", trackNo = "123", rqtmStart = "123", rqtmEnd = "123", time = DateTime.Now });
sysData.trackNoList.Add(new newContainerInCheckData() { dbdh = "4434", trackNo = "123", rqtmStart = "123", rqtmEnd = "123", time = DateTime.Now });
sysData.trackNoList.Add(new newContainerInCheckData() { dbdh = "4434", trackNo = "123", rqtmStart = "123", rqtmEnd = "123", time = DateTime.Now });
sysData.trackNoList.Add(new newContainerInCheckData() { dbdh = "4434", trackNo = "123", rqtmStart = "123", rqtmEnd = "123", time = DateTime.Now });
}

@ -5,13 +5,17 @@ using Newtonsoft.Json.Linq;
using SlnMesnac.RfidUpload.Business;
using SlnMesnac.RfidUpload.Model;
using SlnMesnac.RfidUpload.Model.apiParam;
using SlnMesnac.RfidUpload.UI.TempData;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
using static SlnMesnac.RfidUpload.UI.SelectRouterWindow;
using static SlnMesnac.RfidUpload.UI.viewModel.containerStorageQueryByCsbViewModel;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
@ -39,7 +43,7 @@ namespace SlnMesnac.RfidUpload.UI.viewModel
{
public partial class containerStorageQueryByCsbViewModel : ObservableObject
{
private SysData sysData = SysData.Instance;
private readonly Window _window;
#region 委托事件
@ -62,9 +66,29 @@ namespace SlnMesnac.RfidUpload.UI.viewModel
public containerStorageQueryByCsbViewModel(Window window)
{
_window = window;
RefreshItems();
}
private void RefreshItems()
{
TrackNoItems.Clear();
sysData.trackNoList = sysData.trackNoList.OrderByDescending(x => x.time).ToList();
Dispatcher.CurrentDispatcher.BeginInvoke(() =>
{
sysData.trackNoList.ForEach(x => TrackNoItems.Add(x));
});
}
private ObservableCollection<newContainerInCheckData> _trackNoItems = new ObservableCollection<newContainerInCheckData>();
public ObservableCollection<newContainerInCheckData> TrackNoItems
{
get => _trackNoItems;
set => SetProperty(ref _trackNoItems, value);
}
private CsbHandleBusiness csbHandleBusiness = CsbHandleBusiness.Instance;
public string _dbbh = string.Empty;
@ -97,33 +121,68 @@ namespace SlnMesnac.RfidUpload.UI.viewModel
[RelayCommand]
private void Submit()
{
CsbResult res = csbHandleBusiness.containerStorageQueryByCsb(_dbbh, _rqtmStart, _rqtmEnd);
Check(_dbbh, _rqtmStart, _rqtmEnd);
}
if (res.code == "200")
/// <summary>
/// 新容器入库-调拨单号验证
/// </summary>
/// <param name="dbbh"></param>
/// <param name="rqtmStart"></param>
/// <param name="rqtmEnd"></param>
private void Check(string dbbh,string rqtmStart, string rqtmEnd)
{
try
{
JObject job = JObject.Parse(res.body);
string str = job["retBody"]?["object"]?.ToString();
if (!string.IsNullOrEmpty(str))
{
TrackResult trackResult = JsonConvert.DeserializeObject<TrackResult>(str);
MessageBox.Show($"传递trackNo"+ trackResult.trackNo);
RefreshTrackNoEvent?.Invoke(trackResult.trackNo);
}
CsbResult res = csbHandleBusiness.containerStorageQueryByCsb(dbbh,rqtmStart,rqtmEnd);
MessageBox.Show($"新容器入库-调拨单号验证通过");
TransferOrderInfo transferOrderInfo = new TransferOrderInfo() {
dbdh = _dbbh,
};
if (res.code == "200")
{
JObject job = JObject.Parse(res.body);
string str = job["retBody"]?["object"]?.ToString();
if (!string.IsNullOrEmpty(str))
{
TrackResult trackResult = JsonConvert.DeserializeObject<TrackResult>(str);
MessageBox.Show($"传递trackNo" + trackResult.trackNo);
RefreshTrackNoEvent?.Invoke(trackResult.trackNo);
if (sysData.trackNoList.FirstOrDefault(x => x.trackNo == trackResult.trackNo) == null)
{
sysData.trackNoList.Add(new newContainerInCheckData() { dbdh = _dbbh, trackNo = trackResult.trackNo, rqtmStart = _rqtmStart, rqtmEnd = _rqtmEnd, time = DateTime.Now });
}
RefreshItems();
}
MessageBox.Show($"新容器入库-调拨单号验证通过");
TransferOrderInfo transferOrderInfo = new TransferOrderInfo()
{
dbdh = _dbbh,
};
RefreshSubmitVerifyEvent?.Invoke(1, res.GetMsg(), transferOrderInfo);
_window.Close();
RefreshSubmitVerifyEvent?.Invoke(1, res.GetMsg(), transferOrderInfo);
_window.Close();
}
else
{
MessageBox.Show($"新容器入库-调拨单号验证失败,status:{res.code};msg:{res.GetMsg()};");
}
}
else
}catch (Exception ex)
{
MessageBox.Show($"新容器入库-调拨单号验证失败,status:{res.code};msg:{res.GetMsg()};");
MessageBox.Show("新容器入库-调拨单号验证异常:" + ex.Message);
}
}
/// <summary>
/// 执行分发 容器封发-验证封发计划
/// </summary>
/// <param name="transferOrderInfo"></param>
[RelayCommand]
private void Execute(newContainerInCheckData newContainerInCheck)
{
Check(newContainerInCheck.dbdh, newContainerInCheck.rqtmStart, newContainerInCheck.rqtmEnd);
}
public class TrackResult

Loading…
Cancel
Save