From 06c5bcb56189a98f4dfbcf95d37daa05a9e7b719 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Fri, 25 Nov 2022 16:59:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8Fvgm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingOrderService.cs | 80 +++++++++++++++++-- .../Service/BookingOrder/Dto/BatchVGM.cs | 62 ++++++++++++++ 2 files changed, 137 insertions(+), 5 deletions(-) create mode 100644 Myshipping.Application/Service/BookingOrder/Dto/BatchVGM.cs diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 4d0e6490..20b73537 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -613,6 +613,7 @@ namespace Myshipping.Application /// 批量编辑 /// /// + [HttpPost("/BookingOrder/BachUpdate")] public async Task BachUpdate(BatchUpdate dto) { if (dto == null || dto.Id.Count == 0) @@ -776,8 +777,6 @@ namespace Myshipping.Application } - - /// /// 下载文件 /// @@ -1225,10 +1224,11 @@ namespace Myshipping.Application //var result = new FileContentResult(bs, "application/octet-stream") { FileDownloadName = fileName }; var opt = App.GetOptions().Path; var serverpath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径 - if (!Directory.Exists(serverpath)) { + if (!Directory.Exists(serverpath)) + { Directory.CreateDirectory(serverpath); } - await File.WriteAllBytesAsync(Path.Combine(serverpath, fileName),bs); + await File.WriteAllBytesAsync(Path.Combine(serverpath, fileName), bs); return fileName; } /// @@ -1236,7 +1236,7 @@ namespace Myshipping.Application /// /// 文件名 /// - [HttpGet("/BookingOrder/downloadPrint")] + [HttpGet("/BookingOrder/DownloadPrint")] public IActionResult DownloadPrint(string fileName) { var opt = App.GetOptions().Path; @@ -1806,6 +1806,76 @@ namespace Myshipping.Application } + + + /// + /// 批量编辑vgm + /// + /// 业务id 逗号拼接 + /// + [HttpGet("/BookingOrder/GetVmgDataList")] + public async Task> GetVmgDataList(string ids) + { + var arr = ids.Split(','); + if (arr.Length == 0) + { + throw Oops.Bah("请传入正确数据"); + } + var main = await _rep.AsQueryable().Where(x => x.ParentId == 0).ToListAsync(); + List batchVGMs = new List(); + foreach (var item in arr) + { + BatchVGM batchVGM = new BatchVGM(); + batchVGM.Id = Convert.ToInt64(item); + batchVGM.MBLNO = main.Where(x => x.Id == batchVGM.Id).Select(x => x.MBLNO).FirstOrDefault(); + batchVGM.ctnlist = await _repCtn.Where(x => x.BILLID == batchVGM.Id).Select(x => new BatchVGMList + { + Id = x.Id, + CTNCODE = x.CTNCODE, + CTNALL = x.CTNALL, + CNTRNO = x.CNTRNO, + KGS = x.KGS, + TAREWEIGHT = x.TAREWEIGHT, + WEIGHTYPE = x.WEIGHTYPE, + WEIGHKGS = x.WEIGHKGS + }).ToListAsync(); + + batchVGMs.Add(batchVGM); + } + return batchVGMs; + } + + /// + /// 批量保存vgm + /// + /// + /// + [HttpPost("/BookingOrder/SaveBatchVgm")] + public async Task SaveBatchVgm(List dto) { + + if (dto == null) + { + throw Oops.Bah("未提交数据"); + } + + foreach (var item in dto) + { + await _repCtn.UpdateAsync(x => x.Id==item.Id, x => new BookingCtn + { + CTNCODE = item.CTNCODE, + CTNALL = item.CTNALL, + CNTRNO = item.CNTRNO, + KGS = item.KGS, + TAREWEIGHT = item.TAREWEIGHT, + WEIGHTYPE = item.WEIGHTYPE, + WEIGHKGS = item.WEIGHKGS + }); + + } + } + + + #endregion #region 订舱、截单EDI diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BatchVGM.cs b/Myshipping.Application/Service/BookingOrder/Dto/BatchVGM.cs new file mode 100644 index 00000000..bffb2e94 --- /dev/null +++ b/Myshipping.Application/Service/BookingOrder/Dto/BatchVGM.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application.Service.BookingOrder.Dto +{ + public class BatchVGM + { + /// + /// id + /// + public long Id { get; set; } + + /// + /// 提单号 + /// + public string MBLNO { get; set; } + + + public List ctnlist { get; set; } + } + + + public class BatchVGMList { + /// + /// 箱id + /// + public long Id { get; set; } + /// + /// 箱型代码 + /// + public string CTNCODE { get; set; } + /// + /// 箱型 + /// + public string CTNALL { get; set; } + + /// + /// 箱号 + /// + public string CNTRNO { get; set; } + + /// + /// 毛重 + /// + public decimal? KGS { get; set; } + /// + /// 皮重 + /// + public decimal? TAREWEIGHT { get; set; } + /// + /// 称重方式 + /// + public string WEIGHTYPE { get; set; } + /// + /// 称重重量 + /// + public decimal? WEIGHKGS { get; set; } + } +}