diff --git a/SlnMesnac.RfidUpload.UI/ContainerTransferOrderWindow.xaml.cs b/SlnMesnac.RfidUpload.UI/ContainerTransferOrderWindow.xaml.cs index ef5b2ff..9c53653 100644 --- a/SlnMesnac.RfidUpload.UI/ContainerTransferOrderWindow.xaml.cs +++ b/SlnMesnac.RfidUpload.UI/ContainerTransferOrderWindow.xaml.cs @@ -24,7 +24,8 @@ namespace SlnMesnac.RfidUpload.UI public ContainerTransferOrderWindow(ContainerTransferOrderViewModel containerOrderViewModel) { InitializeComponent(); - + containerOrderViewModel.StartDate = DateTime.Now.Date; + containerOrderViewModel.EndDate = DateTime.Now.Date; this.DataContext = containerOrderViewModel; containerOrderViewModel.SuccessEvent += () => { diff --git a/SlnMesnac.RfidUpload.UI/TransferOrderWindow.xaml.cs b/SlnMesnac.RfidUpload.UI/TransferOrderWindow.xaml.cs index 6457a69..b3854aa 100644 --- a/SlnMesnac.RfidUpload.UI/TransferOrderWindow.xaml.cs +++ b/SlnMesnac.RfidUpload.UI/TransferOrderWindow.xaml.cs @@ -24,7 +24,8 @@ namespace SlnMesnac.RfidUpload.UI public TransferOrderWindow(TransferOrderViewModel orderViewModel) { InitializeComponent(); - + orderViewModel.StartDate = DateTime.Now.Date; + orderViewModel.EndDate = DateTime.Now.Date; this.DataContext = orderViewModel; orderViewModel.SuccessEvent += () => { diff --git a/SlnMesnac.RfidUpload.UI/viewModel/TransferOrderViewModel.cs b/SlnMesnac.RfidUpload.UI/viewModel/TransferOrderViewModel.cs index 81adf4a..c1d7d9e 100644 --- a/SlnMesnac.RfidUpload.UI/viewModel/TransferOrderViewModel.cs +++ b/SlnMesnac.RfidUpload.UI/viewModel/TransferOrderViewModel.cs @@ -93,7 +93,7 @@ namespace SlnMesnac.RfidUpload.UI.viewModel } - private DateTime? _startDate; + private DateTime? _startDate ; public DateTime? StartDate { get => _startDate; @@ -104,7 +104,7 @@ namespace SlnMesnac.RfidUpload.UI.viewModel } } - private DateTime? _endDate; + private DateTime? _endDate ; public DateTime? EndDate { get => _endDate; @@ -138,64 +138,42 @@ namespace SlnMesnac.RfidUpload.UI.viewModel [RelayCommand] private void GetTransferOrder() { - if (_startDate == null || _endDate == null) + try { - MessageBox.Show("请选择开始日期或者结束日期"); - return; - }else if (_startDate > _endDate) - { - MessageBox.Show("开始日期不能大于结束日期"); - return; - } - _endDate = _endDate.Value.AddDays(1); - #region 正式启用 - CsbResult res = csbHandleBusiness.transferOrderFfjhByCsb(_drj, _startDate.Value.ToString(), _endDate.Value.ToString()); - MessageBox.Show("容器封发-获取调拨单和封发计划:" + res.GetMsg()); - if (res.code == "200") - { - - JObject job = JObject.Parse(res.body); - string str = job["retBody"]?["object"]?.ToString(); - if (!str.IsNullOrEmpty()) + if (_startDate == null || _endDate == null) { - List institutionList = JsonConvert.DeserializeObject>(str); - - TransferOrderInfoItems = new ObservableCollection(institutionList); - TotalAmount = TransferOrderInfoItems.Count.ToString(); + MessageBox.Show("请选择开始日期或者结束日期"); + return; } - } - #endregion + else if (_startDate > _endDate) + { + MessageBox.Show("开始日期不能大于结束日期"); + return; + } + + _endDate = _endDate.Value.AddDays(1); + #region 正式启用 + CsbResult res = csbHandleBusiness.transferOrderFfjhByCsb(_drj, _startDate.Value.ToString(), _endDate.Value.ToString()); + MessageBox.Show("容器封发-获取调拨单和封发计划:" + res.GetMsg()); + if (res.code == "200") + { + JObject job = JObject.Parse(res.body); + string str = job["retBody"]?["object"]?.ToString(); + if (!str.IsNullOrEmpty()) + { + List institutionList = JsonConvert.DeserializeObject>(str); + TransferOrderInfoItems = new ObservableCollection(institutionList); + TotalAmount = TransferOrderInfoItems.Count.ToString(); + } + } + #endregion - //#region 测试 - //result res = new result() - //{ - // status = "1", - // msg = "测试", - // @object = new List() - // { - // new TransferOrderInfo() - // { - // dbdh = "123", - // jsdw = "123", - // ffjhNo = "jh123", - // ffjhscrq = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") - // }, - // new TransferOrderInfo() - // { - // dbdh = "324", - // jsdw = "456", - // ffjhNo = "jh456", - // ffjhscrq = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") - // } - // } - //}; - //if (res.@object != null) - //{ - // TransferOrderInfoItems = new ObservableCollection(res.@object); - //} - //#endregion + }catch (Exception ex) + { + MessageBox.Show(ex.Message); + } }