diff --git a/BBWY.Client/APIServices/BillCorrectionService.cs b/BBWY.Client/APIServices/BillCorrectionService.cs index bed8f61d..4c86b795 100644 --- a/BBWY.Client/APIServices/BillCorrectionService.cs +++ b/BBWY.Client/APIServices/BillCorrectionService.cs @@ -22,5 +22,10 @@ namespace BBWY.Client.APIServices endTime }, null, HttpMethod.Post); } + + public ApiResponse CorrectOrder(IList requestList) + { + return SendRequest(globalContext.BBYWApiHost, "api/billCorrection/CorrectOrder", requestList, null, HttpMethod.Post); + } } } diff --git a/BBWY.Client/Models/APIModel/Request/BillCorrectionRequest.cs b/BBWY.Client/Models/APIModel/Request/BillCorrectionRequest.cs new file mode 100644 index 00000000..8e19fb26 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Request/BillCorrectionRequest.cs @@ -0,0 +1,9 @@ +namespace BBWY.Client.Models +{ + public class BillCorrectionRequest + { + public string OrderId { get; set; } + + public decimal NewDeliveryExpressFreight { get; set; } + } +} diff --git a/BBWY.Client/ViewModels/BillCorrection/BillCorrectionViewModel.cs b/BBWY.Client/ViewModels/BillCorrection/BillCorrectionViewModel.cs index 453073f0..bad1c291 100644 --- a/BBWY.Client/ViewModels/BillCorrection/BillCorrectionViewModel.cs +++ b/BBWY.Client/ViewModels/BillCorrection/BillCorrectionViewModel.cs @@ -435,6 +435,7 @@ namespace BBWY.Client.ViewModels MessageBox.Show("缺少运费账单"); return; } + foreach (var order in OrderList) { //矫正销售运费 @@ -454,7 +455,8 @@ namespace BBWY.Client.ViewModels //矫正出仓操作 } - + var correctionCount = OrderList.Count(o => !string.IsNullOrEmpty(o.ChangedContent)); + MessageBox.Show($"矫正完成,本次矫正{correctionCount}笔订单", "矫正费用"); } private void Clear() @@ -489,6 +491,26 @@ namespace BBWY.Client.ViewModels return; } + var billCorrectionOrderList = saveOrderList.Select(o => new BillCorrectionRequest() + { + OrderId = o.OrderId, + NewDeliveryExpressFreight = o.NewDeliveryExpressFreight + }).ToList(); + IsLoading = true; + Task.Factory.StartNew(() => billCorrectionService.CorrectOrder(billCorrectionOrderList)) + .ContinueWith(t => + { + IsLoading = false; + var response = t.Result; + if (!response.Success) + { + App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "矫正费用 ")); + return; + } + + App.Current.Dispatcher.Invoke(() => MessageBox.Show("矫正账单成功", "矫正费用")); + this.Clear(); + }); } } diff --git a/BBWY.Client/Views/MainWindow.xaml b/BBWY.Client/Views/MainWindow.xaml index c21f05d8..9d3a1db3 100644 --- a/BBWY.Client/Views/MainWindow.xaml +++ b/BBWY.Client/Views/MainWindow.xaml @@ -26,7 +26,7 @@ - + diff --git a/BBWY.Server.API/Controllers/BillCorrectionController.cs b/BBWY.Server.API/Controllers/BillCorrectionController.cs index fb0561af..27d12e37 100644 --- a/BBWY.Server.API/Controllers/BillCorrectionController.cs +++ b/BBWY.Server.API/Controllers/BillCorrectionController.cs @@ -24,5 +24,15 @@ namespace BBWY.Server.API.Controllers { return billCorrectionBusiness.GetBillCorrectionOrderList(request); } + + /// + /// 矫正费用 + /// + /// + [HttpPost] + public void CorrectOrder([FromBody] IList requestList) + { + billCorrectionBusiness.CorrectOrder(requestList); + } } }