jianghaiqing 2 years ago
commit 67c6ea7cf4

@ -39,5 +39,9 @@ namespace Myshipping.Application.Entity
/// 分单
/// </summary>
public bool IsSub { get; set; }
/// <summary>
/// 显示名称
/// </summary>
public string DisplayName { get; set; }
}
}

@ -3446,6 +3446,11 @@
分单
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingPrintTemplate.DisplayName">
<summary>
显示名称
</summary>
</member>
<member name="T:Myshipping.Application.Entity.BookingPrinttemplateRight">
<summary>
订舱打印模板权限表
@ -9250,18 +9255,26 @@
</member>
<member name="M:Myshipping.Application.BookingPrintTemplateService.Add(Microsoft.AspNetCore.Http.IFormFile,Myshipping.Application.AddBookingPrintTemplateInput)">
<summary>
增加订舱打印模板
增加订舱打印模板(准备作废)
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingPrintTemplateService.Update(Microsoft.AspNetCore.Http.IFormFile,Myshipping.Application.UpdateBookingPrintTemplateInput)">
<summary>
更新订舱打印模板
更新订舱打印模板(准备作废)
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingPrintTemplateService.Save(Microsoft.AspNetCore.Http.IFormFile,Myshipping.Application.SaveBookingPrintTemplateInput)">
<summary>
保存订舱打印模板(新增或修改)
</summary>
<param name="file"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingPrintTemplateService.Delete(Myshipping.Application.GetBookingPrintTemplateInput)">
<summary>
删除订舱打印模板
@ -9296,6 +9309,13 @@
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingPrintTemplateService.DeletePrinttemplateRight(System.Collections.Generic.List{System.Int64})">
<summary>
删除打印模板权限
</summary>
<param name="Ids"></param>
<returns></returns>
</member>
<member name="T:Myshipping.Application.BookingPrintTemplateInput">
<summary>
订舱打印模板输入参数
@ -9303,12 +9323,12 @@
</member>
<member name="P:Myshipping.Application.BookingPrintTemplateInput.TypeCode">
<summary>
模板类型
模板类型(准备作废)
</summary>
</member>
<member name="P:Myshipping.Application.BookingPrintTemplateInput.TypeName">
<summary>
类型名称
类型名称(准备作废)
</summary>
</member>
<member name="P:Myshipping.Application.BookingPrintTemplateInput.TenantId">
@ -9323,12 +9343,27 @@
</member>
<member name="P:Myshipping.Application.BookingPrintTemplateInput.IsMain">
<summary>
主单
主单(准备作废)
</summary>
</member>
<member name="P:Myshipping.Application.BookingPrintTemplateInput.IsSub">
<summary>
分单
分单(准备作废)
</summary>
</member>
<member name="P:Myshipping.Application.BookingPrintTemplateInput.DisplayName">
<summary>
显示名称
</summary>
</member>
<member name="P:Myshipping.Application.BookingPrintTemplateInput.CateCode">
<summary>
分类代码
</summary>
</member>
<member name="P:Myshipping.Application.BookingPrintTemplateInput.CateName">
<summary>
分类名称
</summary>
</member>
<member name="T:Myshipping.Application.AddBookingPrintTemplateInput">
@ -9346,6 +9381,11 @@
主键Id
</summary>
</member>
<member name="P:Myshipping.Application.SaveBookingPrintTemplateInput.Id">
<summary>
主键Id
</summary>
</member>
<member name="T:Myshipping.Application.GetBookingPrintTemplateInput">
<summary>
订舱打印模板获取(删除)输入参数
@ -9474,6 +9514,26 @@
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingTemplateService.BookingExcelTemplateList(System.String)">
<summary>
获取excel模板
</summary>
<param name="Name">模板名称</param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingTemplateService.BookingExcelTemplateDetailList(System.Int64)">
<summary>
获取excel模板详情
</summary>
<param name="Id">模板名称</param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingTemplateService.ExportExcel">
<summary>
导出excel
</summary>
<returns></returns>
</member>
<member name="T:Myshipping.Application.BookingTemplateInput">
<summary>
订舱模板输入参数

@ -80,7 +80,7 @@ namespace Myshipping.Application
/// <summary>
/// 增加订舱打印模板
/// 增加订舱打印模板(准备作废)
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@ -148,7 +148,7 @@ namespace Myshipping.Application
/// <summary>
/// 更新订舱打印模板
/// 更新订舱打印模板(准备作废)
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@ -209,6 +209,81 @@ namespace Myshipping.Application
await _rep.UpdateAsync(entity);
}
/// <summary>
/// 保存订舱打印模板(新增或修改)
/// </summary>
/// <param name="file"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/BookingPrintTemplate/save")]
public async Task<long> Save(IFormFile file, [FromForm] SaveBookingPrintTemplateInput input)
{
var opt = App.GetOptions<PrintTemplateOptions>();
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<BookingPrintTemplate>();
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;
}
/// <summary>
/// 删除订舱打印模板
/// </summary>
@ -290,14 +365,18 @@ 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)
{
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);
}
}
}
/// <summary>
/// 获取打印模板权限
@ -311,6 +390,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 +407,19 @@ namespace Myshipping.Application
}
return list;
}
/// <summary>
/// 删除打印模板权限
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
[HttpGet("/BookingPrintTemplate/DeletePrinttemplateRight")]
public async Task DeletePrinttemplateRight([FromQuery] List<long> Ids) {
await _repRight.DeleteAsync(x => Ids.Contains(x.Id));
}
}
}

@ -10,12 +10,12 @@ namespace Myshipping.Application
public class BookingPrintTemplateInput
{
/// <summary>
/// 模板类型
/// 模板类型(准备作废)
/// </summary>
public string TypeCode { get; set; }
/// <summary>
/// 类型名称
/// 类型名称(准备作废)
/// </summary>
public virtual string TypeName { get; set; }
@ -30,14 +30,29 @@ namespace Myshipping.Application
public string TenantName { get; set; }
/// <summary>
/// 主单
/// 主单(准备作废)
/// </summary>
public bool IsMain { get; set; }
/// <summary>
/// 分单
/// 分单(准备作废)
/// </summary>
public bool IsSub { get; set; }
/// <summary>
/// 显示名称
/// </summary>
public string DisplayName { get; set; }
/// <summary>
/// 分类代码
/// </summary>
public string CateCode { get; set; }
/// <summary>
/// 分类名称
/// </summary>
public virtual string CateName { get; set; }
}
/// <summary>
@ -60,6 +75,15 @@ namespace Myshipping.Application
}
public class SaveBookingPrintTemplateInput : BookingPrintTemplateInput
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
}
/// <summary>
/// 订舱打印模板获取(删除)输入参数
/// </summary>

@ -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; }

@ -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
{
@ -135,12 +137,13 @@ namespace Myshipping.Application
}
return dic;
}
/// <summary>
/// 新增编辑excel模板
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpGet("/BookingTemplate/AddOrUpdateExcelTemplate")]
[HttpPost("/BookingTemplate/AddOrUpdateExcelTemplate")]
public async Task<dynamic> AddOrUpdateExcelTemplate(BookingExcelTemplateDto dto) {
if (dto.Id == 0)
@ -149,22 +152,68 @@ 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<BookingExcelTemplateSub>();
entity.Pid = bookingExcel.Id;
await _excelsubrep.InsertAsync(entity);
}
}
else {
var entity = dto.Adapt<BookingExcelTemplate>();
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<BookingExcelTemplateSub>();
ent.Pid = dto.Id;
await _excelsubrep.InsertAsync(ent);
}
}
return null;
}
/// <summary>
/// 获取excel模板
/// </summary>
/// <param name="Name">模板名称</param>
/// <returns></returns>
[HttpGet("/BookingTemplate/BookingExcelTemplateList")]
public async Task<dynamic> BookingExcelTemplateList(string Name) {
return await _excelrep.AsQueryable().WhereIF(!string.IsNullOrWhiteSpace(Name), x => x.Name.Contains(Name)).ToListAsync();
}
return null;
/// <summary>
/// 获取excel模板详情
/// </summary>
/// <param name="Id">模板名称</param>
/// <returns></returns>
[HttpGet("/BookingTemplate/BookingExcelTemplateDetailList")]
public async Task<dynamic> BookingExcelTemplateDetailList(long Id)
{
return await _excelsubrep.AsQueryable().Where( x => x.Pid==Id).ToListAsync();
}
///// <summary>
///// 导出excel
///// </summary>
///// <returns></returns>
//[HttpGet("/BookingTemplate/ExportExcel")]
//public async Task<IActionResult> 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"
// });
// }
//}

@ -34,6 +34,7 @@ namespace Myshipping.Core.Service
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/DjyVesselInfoService/AddOrUpdate")]
public async Task<long> AddOrUpdate(DjyVesselInfo dto)
{
if (dto == null)
@ -56,7 +57,8 @@ namespace Myshipping.Core.Service
/// 下拉列表
/// </summary>
/// <returns></returns>
public async Task<dynamic> GetList(string KeyWord, string CarrierID)
[HttpGet("/DjyVesselInfoService/GetList")]
public async Task<dynamic> GetList([FromQuery] string KeyWord, string CarrierID)
{
//获取船名
List<CodeVessel> list = await _sysCacheService.GetAllCodeVessel();

Loading…
Cancel
Save