wanghaomei 2 years ago
commit ea8e4db58d

@ -11242,7 +11242,7 @@
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingPrintTemplateService.GetPrinttemplateRightList(System.Int64,System.String,System.String)">
<member name="M:Myshipping.Application.BookingPrintTemplateService.GetPrinttemplateRightList(System.Int64,System.String,System.String,System.String)">
<summary>
获取打印模板权限
</summary>

@ -1155,11 +1155,12 @@ namespace Myshipping.Application
{
var o = _rep.AsQueryable().Where(x => x.Id == item.BookingId).FirstAsync().Result;
var oldatd = o.ATD;
if (oldatd!= item.OpTime) {
if (oldatd != item.OpTime)
{
o.ATD = item.OpTime;
await _rep.UpdateAsync(o);
////添加booking日志
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
{
Type = "Edit",
BookingId = item.BookingId,
@ -1172,12 +1173,13 @@ namespace Myshipping.Application
{
PId = bid,
Field = "实际开船",
OldValue = oldatd==null?"": oldatd.ToString(),
OldValue = oldatd == null ? "" : oldatd.ToString(),
NewValue = item.OpTime == null ? "" : item.OpTime.ToString(),
});
}
if (!string.IsNullOrWhiteSpace(o.VESSEL)&&!string.IsNullOrWhiteSpace(o.VOYNO)) {
var order = await _rep.AsQueryable().Where(x => x.VOYNO == o.VOYNO && x.VESSEL == o.VESSEL&&x.TenantId==o.TenantId).ToListAsync();
if (!string.IsNullOrWhiteSpace(o.VESSEL) && !string.IsNullOrWhiteSpace(o.VOYNO))
{
var order = await _rep.AsQueryable().Where(x => x.VOYNO == o.VOYNO && x.VESSEL == o.VESSEL && x.TenantId == o.TenantId).ToListAsync();
foreach (var it in order)
{
var _oldatd = it.ATD;
@ -1296,7 +1298,7 @@ namespace Myshipping.Application
//vgm链接
allowCarrier = _cache.GetAllDictData().Result.Where(x => x.TypeCode == "vgm_carrier_list").Select(x => x.Code).ToList();
if (allowCarrier.Contains(order.CARRIERID))
if (!allowCarrier.Contains(order.CARRIERID))
{
await VgmLink(input.BookingId);
}
@ -1782,7 +1784,7 @@ namespace Myshipping.Application
throw Oops.Bah("类型参数不正确");
}
fileName = $"{dicCate.Value}_{order.MBLNO}_{DateTime.Now.Ticks}{fileType}";//名称
var opt = App.GetOptions<TempFileOptions>().Path;
@ -1812,35 +1814,72 @@ namespace Myshipping.Application
var excelwork = new HSSFWorkbook(result);
var sheet = excelwork.GetSheetAt(0);
var entity = await _excelrep.AsQueryable().Where(x => x.PId == templateId).OrderBy(x => x.Row).ToListAsync();
if (entity==null) {
if (entity == null)
{
throw Oops.Bah("当前模板未设置");
}
for (int _row = 0; _row < entity.Max(x => x.Row); _row++)
for (int _row = 1; _row <= entity.Max(x => x.Row); _row++)
{
if (entity.Where(x => x.Row == (_row + 1)).Count() > 0)
if (entity.Where(x => x.Row == _row).Count() > 0)
{
//创建行
var row = NpoiExcelExportHelper._.CreateRow(sheet, _row, 25);
for (int _cellNum = 0; _cellNum < entity.Max(x => x.Column); _cellNum++)
//获取行
var row = sheet.GetRow(_row);
if (row != null)
{
for (int _cellNum = 0; _cellNum < entity.Max(x => x.Column); _cellNum++)
{
if (entity.Where(x => x.Row == _row && x.Column == _cellNum + 1).Count() > 0)
{
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(order))
{
var name = entity.Where(x => x.Row == _row && x.Column == _cellNum + 1).Select(x => x.Field).FirstOrDefault();
var _name = descriptor.Name.ToLower();
if (name == _name)
{
var value = descriptor.GetValue(order).ToString();
if (_cellNum < row.Cells.Count())
{
row.Cells[_cellNum].SetCellValue(value);
}
else
{
row.CreateCell(_cellNum).SetCellValue(value);
}
}
}
}
}
}
else
{
if (entity.Where(x => x.Row == _row + 1 && x.Column == _cellNum + 1).Count() > 0)
////创建行
var srow = NpoiExcelExportHelper._.CreateRow(sheet, _row);
for (int _cellNum = 0; _cellNum < entity.Max(x => x.Column); _cellNum++)
{
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(order))
if (entity.Where(x => x.Row == _row && x.Column == _cellNum + 1).Count() > 0)
{
var name = entity.Where(x => x.Row == _row + 1 && x.Column == _cellNum + 1).Select(x => x.Field).FirstOrDefault();
var _name = descriptor.Name.ToLower();
if (name == _name)
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(order))
{
var value = descriptor.GetValue(order).ToString();
var cell = NpoiExcelExportHelper._.CreateCells(row, _cellNum, value);
var name = entity.Where(x => x.Row == _row && x.Column == _cellNum + 1).Select(x => x.Field).FirstOrDefault();
var _name = descriptor.Name.ToLower();
if (name == _name)
{
var value = descriptor.GetValue(order).ToString();
srow.CreateCell(_cellNum).SetCellValue(value);
}
}
}
}
}
}
}
var fileFullPath = Path.Combine(App.WebHostEnvironment.WebRootPath, App.GetOptions<TempFileOptions>().Path);//服务器路径
@ -1848,7 +1887,7 @@ namespace Myshipping.Application
{
Directory.CreateDirectory(fileFullPath);
}
fileName = $"{dicCate.Value}_{order.MBLNO}_{DateTime.Now.Ticks}"+ ".xls";//名称
fileName = $"{dicCate.Value}_{order.MBLNO}_{DateTime.Now.Ticks}" + ".xls";//名称
_logger.LogInformation("导出excel:" + Path.Combine(fileFullPath, fileName));
var filestream = new FileStream(Path.Combine(fileFullPath, fileName), FileMode.OpenOrCreate, FileAccess.ReadWrite);
excelwork.Write(filestream);
@ -3623,7 +3662,7 @@ namespace Myshipping.Application
/// </summary>
/// <returns></returns>
[HttpGet("/BookingOrder/GetFieldName")]
public async Task<dynamic> GetFieldName()
public async Task<dynamic> GetFieldName()
{
BookingOrder order = new BookingOrder();
BookingCtn ctn = new BookingCtn();

@ -395,7 +395,7 @@ namespace Myshipping.Application
/// </summary>
/// <returns></returns>
[HttpGet("/BookingPrintTemplate/GetPrinttemplateRightList")]
public async Task<dynamic> GetPrinttemplateRightList(long userId, string cateCode, string type)
public async Task<dynamic> GetPrinttemplateRightList(long userId, string cateCode, string type,string name)
{
var userlist = await _repUser.AsQueryable().Filter(null, true).ToListAsync();
var list = await _repRight.AsQueryable().InnerJoin<BookingPrintTemplate>((d, t) => d.PrintTemplateId == t.Id && t.TenantId == UserManager.TENANT_ID).
@ -417,7 +417,7 @@ namespace Myshipping.Application
UserName = "",
}).ToListAsync();
list = list.WhereIF(!string.IsNullOrWhiteSpace(cateCode), x => x.CateCode == cateCode).
list = list.WhereIF(!string.IsNullOrWhiteSpace(cateCode), x => x.CateCode == cateCode).WhereIF(!string.IsNullOrWhiteSpace(name), x => x.DisplayName.StartsWith(name)).
WhereIF(!string.IsNullOrWhiteSpace(type), x => x.Type == type).ToList();
foreach (var item in list)
{

@ -22,10 +22,10 @@ namespace Myshipping.Core.Helper
/// <param name="sheet">Excel工作表对象</param>
/// <param name="rowNum">创建第几行(从0开始)</param>
/// <param name="rowHeight">行高</param>
public HSSFRow CreateRow(ISheet sheet, int rowNum, float rowHeight)
public HSSFRow CreateRow(ISheet sheet, int rowNum )
{
HSSFRow row = (HSSFRow)sheet.CreateRow(rowNum); //创建行
row.HeightInPoints = rowHeight; //设置列头行高
//row.HeightInPoints = rowHeight; //设置列头行高
return row;
}

@ -5436,7 +5436,7 @@
<param name="body"></param>
<param name="sendTo"></param>
</member>
<member name="M:Myshipping.Core.Helper.NpoiExcelExportHelper.CreateRow(NPOI.SS.UserModel.ISheet,System.Int32,System.Single)">
<member name="M:Myshipping.Core.Helper.NpoiExcelExportHelper.CreateRow(NPOI.SS.UserModel.ISheet,System.Int32)">
<summary>
TODO:先创建行,然后在创建对应的列
创建Excel中指定的行

Loading…
Cancel
Save