optimize
wet 2 years ago
parent 6bdade7cd8
commit 7b28c01dbc

@ -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);
}
@ -1812,34 +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);
for (int _cellNum = 0; _cellNum < entity.Max(x => x.Column); _cellNum++)
//获取行
var row = sheet.GetRow(_row);
if (row != null)
{
if (entity.Where(x => x.Row == _row + 1 && x.Column == _cellNum + 1).Count() > 0)
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();
if (_cellNum < row.Cells.Count())
{
row.Cells[_cellNum].SetCellValue(value);
}
else
{
row.CreateCell(_cellNum).SetCellValue(value);
}
}
}
}
}
}
else
{
////创建行
var srow = NpoiExcelExportHelper._.CreateRow(sheet, _row);
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();
srow.CreateCell(_cellNum).SetCellValue(value);
}
}
}
}
}
}
}
var fileFullPath = Path.Combine(App.WebHostEnvironment.WebRootPath, App.GetOptions<TempFileOptions>().Path);//服务器路径
@ -1847,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);
@ -3628,7 +3668,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();

Loading…
Cancel
Save