From 25057a31ef27931d8a634f3f645d26b1270e76f5 Mon Sep 17 00:00:00 2001
From: wet <1034391973@qq.com>
Date: Thu, 29 Dec 2022 17:02:44 +0800
Subject: [PATCH 1/5] =?UTF-8?q?excel=E6=A8=A1=E6=9D=BF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../BookingTemplate/BookingTemplateService.cs | 52 +++++++++++++------
1 file changed, 36 insertions(+), 16 deletions(-)
diff --git a/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs b/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs
index f912791a..eadda2de 100644
--- a/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs
+++ b/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs
@@ -140,7 +140,7 @@ namespace Myshipping.Application
///
///
///
- [HttpGet("/BookingTemplate/AddOrUpdateExcelTemplate")]
+ [HttpPost("/BookingTemplate/AddOrUpdateExcelTemplate")]
public async Task AddOrUpdateExcelTemplate(BookingExcelTemplateDto dto) {
if (dto.Id == 0)
@@ -149,27 +149,47 @@ namespace Myshipping.Application
bookingExcel.Name = dto.Name;
bookingExcel.Type = dto.Type;
await _excelrep.InsertAsync(bookingExcel);
-
-
-
-
+ foreach (var item in dto.children)
+ {
+ var entity = item.Adapt();
+ entity.Pid = bookingExcel.Id;
+ await _excelsubrep.InsertAsync(entity);
+ }
}
- else {
-
-
-
-
-
-
+ else {
+ var entity = dto.Adapt();
+ await _excelrep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
+ await _excelsubrep.DeleteAsync(x => x.Pid == dto.Id);
+ foreach (var item in dto.children)
+ {
+ var ent = item.Adapt();
+ ent.Pid = dto.Id;
+ await _excelsubrep.InsertAsync(ent);
+ }
}
return null;
}
-
-
-
-
+ ///
+ /// 获取excel模板
+ ///
+ /// 模板名称
+ ///
+ [HttpGet("/BookingTemplate/BookingExcelTemplateList")]
+ public async Task BookingExcelTemplateList(string Name) {
+ return await _excelrep.AsQueryable().WhereIF(!string.IsNullOrWhiteSpace(Name), x => x.Name.Contains(Name)).ToListAsync();
+ }
+ ///
+ /// 获取excel模板详情
+ ///
+ /// 模板名称
+ ///
+ [HttpGet("/BookingTemplate/BookingExcelTemplateDetailList")]
+ public async Task BookingExcelTemplateDetailList(long Id)
+ {
+ return await _excelsubrep.AsQueryable().Where( x => x.Pid==Id).ToListAsync();
+ }
}
}
From 1a8cb1cdebad2ea65f9538d529ca9ce9ba5e7588 Mon Sep 17 00:00:00 2001
From: wet <1034391973@qq.com>
Date: Thu, 29 Dec 2022 17:35:04 +0800
Subject: [PATCH 2/5] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=A8=A1=E6=9D=BF?=
=?UTF-8?q?=E6=9D=83=E9=99=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../BookingPrintTemplateService.cs | 26 +++++++++++++++----
.../Dto/BookingPrinttemplateRightDto.cs | 2 +-
.../BookingTemplate/BookingTemplateService.cs | 7 +++++
3 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs b/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs
index 8086c8d1..3943a7b0 100644
--- a/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs
+++ b/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs
@@ -290,13 +290,17 @@ namespace Myshipping.Application
throw Oops.Bah("未上传正确数据");
}
- await _repRight.DeleteAsync(x => x.SysUserId == input.SysUserId);
+ // await _repRight.DeleteAsync(x => x.SysUserId == input.SysUserId);
foreach (var item in input.PrintTemplateId)
{
- BookingPrinttemplateRight right = new BookingPrinttemplateRight();
- right.SysUserId = input.SysUserId;
- right.PrintTemplateId = item;
- await _repRight.InsertAsync(right);
+ var ent = _repRight.FirstOrDefault(x => x.SysUserId == input.SysUserId && x.PrintTemplateId == item);
+ if (ent==null) {
+ BookingPrinttemplateRight right = new BookingPrinttemplateRight();
+ right.SysUserId = input.SysUserId;
+ right.PrintTemplateId = item;
+ await _repRight.InsertAsync(right);
+ }
+
}
}
///
@@ -311,6 +315,7 @@ namespace Myshipping.Application
WhereIF(userId != 0, d => d.SysUserId == userId).
Select((d, t) => new BookingPrinttemplateDto
{
+ Id=d.Id,
PrintTemplateId=t.Id,
SysUserId=d.SysUserId,
TypeCode = t.TypeCode,
@@ -327,5 +332,16 @@ namespace Myshipping.Application
}
return list;
}
+
+ ///
+ /// 删除打印模板权限
+ ///
+ ///
+ ///
+ [HttpGet("/BookingPrintTemplate/DeletePrinttemplateRight")]
+ public async Task DeletePrinttemplateRight(List Ids) {
+
+ await _repRight.DeleteAsync(x => Ids.Contains(x.Id));
+ }
}
}
diff --git a/Myshipping.Application/Service/BookingPrintTemplate/Dto/BookingPrinttemplateRightDto.cs b/Myshipping.Application/Service/BookingPrintTemplate/Dto/BookingPrinttemplateRightDto.cs
index 91c38b09..b99a54c2 100644
--- a/Myshipping.Application/Service/BookingPrintTemplate/Dto/BookingPrinttemplateRightDto.cs
+++ b/Myshipping.Application/Service/BookingPrintTemplate/Dto/BookingPrinttemplateRightDto.cs
@@ -21,7 +21,7 @@ namespace Myshipping.Application.Service.BookingPrintTemplate.Dto
public class BookingPrinttemplateDto
{
-
+ public long Id { get; set; }
public long PrintTemplateId { get; set; }
public long SysUserId { get; set; }
public string TypeCode { get; set; }
diff --git a/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs b/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs
index eadda2de..d01431fd 100644
--- a/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs
+++ b/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs
@@ -191,5 +191,12 @@ namespace Myshipping.Application
return await _excelsubrep.AsQueryable().Where( x => x.Pid==Id).ToListAsync();
}
+
+
+
+
+
+
+
}
}
From 0d1796879019d1501edb9c01d6e3acd38dd5b80b Mon Sep 17 00:00:00 2001
From: wanghaomei
Date: Thu, 29 Dec 2022 17:47:16 +0800
Subject: [PATCH 3/5] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=A8=A1=E6=9D=BF?=
=?UTF-8?q?=E5=89=8D=E6=9C=9F=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Entity/BookingPrintTemplate.cs | 4 +
.../BookingPrintTemplateService.cs | 79 ++++++++++++++++++-
.../Dto/BookingPrintTemplateInput.cs | 32 +++++++-
3 files changed, 109 insertions(+), 6 deletions(-)
diff --git a/Myshipping.Application/Entity/BookingPrintTemplate.cs b/Myshipping.Application/Entity/BookingPrintTemplate.cs
index 96c0aab1..22e23755 100644
--- a/Myshipping.Application/Entity/BookingPrintTemplate.cs
+++ b/Myshipping.Application/Entity/BookingPrintTemplate.cs
@@ -39,5 +39,9 @@ namespace Myshipping.Application.Entity
/// 分单
///
public bool IsSub { get; set; }
+ ///
+ /// 显示名称
+ ///
+ public string DisplayName { get; set; }
}
}
\ No newline at end of file
diff --git a/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs b/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs
index b3cc5b7d..010e9535 100644
--- a/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs
+++ b/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs
@@ -62,7 +62,7 @@ namespace Myshipping.Application
}
///
- /// 增加订舱打印模板
+ /// 增加订舱打印模板(准备作废)
///
///
///
@@ -130,7 +130,7 @@ namespace Myshipping.Application
///
- /// 更新订舱打印模板
+ /// 更新订舱打印模板(准备作废)
///
///
///
@@ -191,6 +191,81 @@ namespace Myshipping.Application
await _rep.UpdateAsync(entity);
}
+ ///
+ /// 保存订舱打印模板(新增或修改)
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("/BookingPrintTemplate/save")]
+ public async Task Save(IFormFile file, [FromForm] SaveBookingPrintTemplateInput input)
+ {
+ var opt = App.GetOptions();
+ if (file != null && file.Length > 0)
+ {
+ var fileSuffix = Path.GetExtension(file.FileName).ToLower(); // 文件后缀
+ if (!opt.fileType.Contains(fileSuffix))
+ {
+ throw Oops.Bah(BookingErrorCode.BOOK114);
+ }
+ }
+
+ BookingPrintTemplate entity = null;
+ if (input.Id > 0)
+ {
+ entity = _rep.AsQueryable().Filter(null, true).First(x => x.Id == input.Id);
+ input.Adapt(entity);
+ await _rep.UpdateAsync(entity);
+ }
+ else
+ {
+ //新增时必须上传文件
+ if (file == null || file.Length == 0)
+ {
+ throw Oops.Bah(BookingErrorCode.BOOK113);
+ }
+
+ entity = input.Adapt();
+ await _rep.InsertAsync(entity);
+ }
+
+ if (file != null && file.Length > 0)
+ {
+ var originalFilename = file.FileName; // 文件原始名称
+
+ var dirAbs = string.Empty;
+ if (string.IsNullOrEmpty(opt.basePath))
+ {
+ dirAbs = Path.Combine(App.WebHostEnvironment.WebRootPath, opt.relativePath);
+ }
+ else
+ {
+ dirAbs = Path.Combine(opt.basePath, opt.relativePath);
+ }
+
+ if (!Directory.Exists(dirAbs))
+ Directory.CreateDirectory(dirAbs);
+
+
+ // 先存库获取Id
+ var id = YitIdHelper.NextId();
+ var fileSuffix = Path.GetExtension(file.FileName).ToLower();
+ var fileSaveName = $"{id}{fileSuffix}".ToLower();
+ var fileRelaPath = Path.Combine(opt.relativePath, fileSaveName).ToLower();
+ var fileAbsPath = Path.Combine(dirAbs, fileSaveName).ToLower();
+ using (var stream = File.Create(fileAbsPath))
+ {
+ await file.CopyToAsync(stream);
+ }
+
+ entity.FileName = originalFilename;
+ entity.FilePath = fileRelaPath;
+ await _rep.UpdateAsync(entity);
+ }
+
+ return entity.Id;
+ }
+
///
/// 删除订舱打印模板
///
diff --git a/Myshipping.Application/Service/BookingPrintTemplate/Dto/BookingPrintTemplateInput.cs b/Myshipping.Application/Service/BookingPrintTemplate/Dto/BookingPrintTemplateInput.cs
index 8d755ffb..9250a6fc 100644
--- a/Myshipping.Application/Service/BookingPrintTemplate/Dto/BookingPrintTemplateInput.cs
+++ b/Myshipping.Application/Service/BookingPrintTemplate/Dto/BookingPrintTemplateInput.cs
@@ -10,12 +10,12 @@ namespace Myshipping.Application
public class BookingPrintTemplateInput
{
///
- /// 模板类型
+ /// 模板类型(准备作废)
///
public string TypeCode { get; set; }
///
- /// 类型名称
+ /// 类型名称(准备作废)
///
public virtual string TypeName { get; set; }
@@ -30,14 +30,29 @@ namespace Myshipping.Application
public string TenantName { get; set; }
///
- /// 主单
+ /// 主单(准备作废)
///
public bool IsMain { get; set; }
///
- /// 分单
+ /// 分单(准备作废)
///
public bool IsSub { get; set; }
+ ///
+ /// 显示名称
+ ///
+ public string DisplayName { get; set; }
+
+ ///
+ /// 分类代码
+ ///
+ public string CateCode { get; set; }
+
+ ///
+ /// 分类名称
+ ///
+ public virtual string CateName { get; set; }
+
}
///
@@ -60,6 +75,15 @@ namespace Myshipping.Application
}
+ public class SaveBookingPrintTemplateInput : BookingPrintTemplateInput
+ {
+ ///
+ /// 主键Id
+ ///
+ public long Id { get; set; }
+
+ }
+
///
/// 订舱打印模板获取(删除)输入参数
///
From 1007d3b89a3aa20c0141934d33c9f6fe0f0119c4 Mon Sep 17 00:00:00 2001
From: wet <1034391973@qq.com>
Date: Thu, 29 Dec 2022 18:05:49 +0800
Subject: [PATCH 4/5] =?UTF-8?q?=E6=9D=83=E9=99=90=E6=A8=A1=E6=9D=BF?=
=?UTF-8?q?=E5=88=A0=E9=99=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Myshipping.Application.xml | 21 +++++++++++++++++++
.../BookingPrintTemplateService.cs | 2 +-
.../BookingTemplate/BookingTemplateService.cs | 6 +-----
3 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml
index 142942d7..3f6bf89b 100644
--- a/Myshipping.Application/Myshipping.Application.xml
+++ b/Myshipping.Application/Myshipping.Application.xml
@@ -9282,6 +9282,13 @@
+
+
+ 删除打印模板权限
+
+
+
+
订舱打印模板输入参数
@@ -9460,6 +9467,20 @@
+
+
+ 获取excel模板
+
+ 模板名称
+
+
+
+
+ 获取excel模板详情
+
+ 模板名称
+
+
订舱模板输入参数
diff --git a/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs b/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs
index 3943a7b0..aa7e01f8 100644
--- a/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs
+++ b/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs
@@ -339,7 +339,7 @@ namespace Myshipping.Application
///
///
[HttpGet("/BookingPrintTemplate/DeletePrinttemplateRight")]
- public async Task DeletePrinttemplateRight(List Ids) {
+ public async Task DeletePrinttemplateRight([FromQuery] List Ids) {
await _repRight.DeleteAsync(x => Ids.Contains(x.Id));
}
diff --git a/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs b/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs
index d01431fd..20b15bfd 100644
--- a/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs
+++ b/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs
@@ -135,6 +135,7 @@ namespace Myshipping.Application
}
return dic;
}
+
///
/// 新增编辑excel模板
///
@@ -193,10 +194,5 @@ namespace Myshipping.Application
-
-
-
-
-
}
}
From 5cf7f17cb380197644d9849db8f6a5baf722a414 Mon Sep 17 00:00:00 2001
From: wet <1034391973@qq.com>
Date: Fri, 30 Dec 2022 11:16:43 +0800
Subject: [PATCH 5/5] =?UTF-8?q?=E8=88=B9=E6=9C=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Myshipping.Application.xml | 51 ++++++++++++++++---
.../BookingPrintTemplateService.cs | 3 ++
.../BookingTemplate/BookingTemplateService.cs | 26 ++++++++++
.../DjyVesselInfo/DjyVesselInfoService.cs | 4 +-
4 files changed, 77 insertions(+), 7 deletions(-)
diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml
index 3f6bf89b..16b2ec81 100644
--- a/Myshipping.Application/Myshipping.Application.xml
+++ b/Myshipping.Application/Myshipping.Application.xml
@@ -3446,6 +3446,11 @@
分单
+
+
+ 显示名称
+
+
订舱打印模板权限表
@@ -9236,18 +9241,26 @@
- 增加订舱打印模板
+ 增加订舱打印模板(准备作废)
- 更新订舱打印模板
+ 更新订舱打印模板(准备作废)
+
+
+ 保存订舱打印模板(新增或修改)
+
+
+
+
+
删除订舱打印模板
@@ -9296,12 +9309,12 @@
- 模板类型
+ 模板类型(准备作废)
- 类型名称
+ 类型名称(准备作废)
@@ -9316,12 +9329,27 @@
- 主单
+ 主单(准备作废)
- 分单
+ 分单(准备作废)
+
+
+
+
+ 显示名称
+
+
+
+
+ 分类代码
+
+
+
+
+ 分类名称
@@ -9339,6 +9367,11 @@
主键Id
+
+
+ 主键Id
+
+
订舱打印模板获取(删除)输入参数
@@ -9481,6 +9514,12 @@
模板名称
+
+
+ 导出excel
+
+
+
订舱模板输入参数
diff --git a/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs b/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs
index adb016ac..38709039 100644
--- a/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs
+++ b/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs
@@ -418,5 +418,8 @@ namespace Myshipping.Application
await _repRight.DeleteAsync(x => Ids.Contains(x.Id));
}
+
+
+
}
}
diff --git a/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs b/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs
index 20b15bfd..dbf04010 100644
--- a/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs
+++ b/Myshipping.Application/Service/BookingTemplate/BookingTemplateService.cs
@@ -13,6 +13,8 @@ using Myshipping.Application.Enum;
using System.ComponentModel;
using System.Collections.Generic;
using Myshipping.Application.Service.BookingTemplate.Dto;
+using System.IO;
+using MiniExcelLibs;
namespace Myshipping.Application
{
@@ -192,6 +194,30 @@ namespace Myshipping.Application
return await _excelsubrep.AsQueryable().Where( x => x.Pid==Id).ToListAsync();
}
+ /////
+ ///// 导出excel
+ /////
+ /////
+ //[HttpGet("/BookingTemplate/ExportExcel")]
+ //public async Task ExportExcel() {
+ // var order = await _repOrder.ToListAsync();
+
+ // using (MemoryStream ms = new MemoryStream())
+ // {
+ // ms.SaveAs(order);
+ // ms.Seek(0, SeekOrigin.Begin);
+ // return await Task.FromResult(new FileStreamResult(ms, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
+ // {
+ // FileDownloadName = "order.xlsx"
+ // });
+ // }
+ //}
+
+
+
+
+
+
}
diff --git a/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs b/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs
index 8b389070..bfcbd3d7 100644
--- a/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs
+++ b/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs
@@ -34,6 +34,7 @@ namespace Myshipping.Core.Service
///
///
///
+ [HttpPost("/DjyVesselInfoService/AddOrUpdate")]
public async Task AddOrUpdate(DjyVesselInfo dto)
{
if (dto == null)
@@ -56,7 +57,8 @@ namespace Myshipping.Core.Service
/// 下拉列表
///
///
- public async Task GetList(string KeyWord, string CarrierID)
+ [HttpGet("/DjyVesselInfoService/GetList")]
+ public async Task GetList([FromQuery] string KeyWord, string CarrierID)
{
//获取船名
List list = await _sysCacheService.GetAllCodeVessel();