wet 2 years ago
commit 5204076e2a

@ -12056,6 +12056,56 @@
提单用纸数
</summary>
</member>
<member name="T:Myshipping.Application.LaraPaperRegistDto">
<summary>
</summary>
</member>
<member name="P:Myshipping.Application.LaraPaperRegistDto.NumberTo">
<summary>
上次结束编号
</summary>
</member>
<member name="P:Myshipping.Application.LaraPaperRegistDto.DetailList">
<summary>
LARA提单纸登记合计明细
</summary>
</member>
<member name="T:Myshipping.Application.LaraPaperRegistDetailDto">
<summary>
</summary>
</member>
<member name="P:Myshipping.Application.LaraPaperRegistDetailDto.OrderNo">
<summary>
</summary>
</member>
<member name="P:Myshipping.Application.LaraPaperRegistDetailDto.TaskId">
<summary>
</summary>
</member>
<member name="P:Myshipping.Application.LaraPaperRegistDetailDto.MBLNo">
<summary>
</summary>
</member>
<member name="P:Myshipping.Application.LaraPaperRegistDetailDto.DraftNum">
<summary>
</summary>
</member>
<member name="P:Myshipping.Application.LaraPaperRegistDetailDto.OriginalDownTime">
<summary>
</summary>
</member>
<member name="P:Myshipping.Application.LaraPaperRegistDetailDto.IssueType">
<summary>
</summary>
</member>
<member name="T:Myshipping.Application.LaraPaperRegistPostDto">
<summary>

@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Myshipping.Application.Entity;
using Myshipping.Application.Helper;
using Myshipping.Application.Service.BookingOrder.Dto;
using Myshipping.Core;
using Myshipping.Core.Entity;
using NPOI.OpenXmlFormats.Wordprocessing;
@ -286,7 +287,7 @@ namespace Myshipping.Application
if (!string.IsNullOrWhiteSpace(QuerySearch.SortField))
entityOrderCol = MapsterExtHelper.GetAdaptProperty<ParaGoodsShowDto, ParaGoodsInfo>(QuerySearch.SortField);
var entities = await _paraGoodsInfoRepository.AsQueryable().Filter(null, true)
var entities = await _paraGoodsInfoRepository.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.GoodsCode), t => t.GOODS_CODE.Contains(QuerySearch.GoodsCode.Trim(), StringComparison.OrdinalIgnoreCase))
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.GoodsNameCN), t => t.GOODS_NAME_CN.Contains(QuerySearch.GoodsNameCN.Trim(), StringComparison.OrdinalIgnoreCase))
.WhereIF(createBegin != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value >= createBegin)
@ -300,14 +301,9 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.UpdateUserName), t => t.UpdatedUserName.Contains(QuerySearch.UpdateUserName.Trim(), StringComparison.OrdinalIgnoreCase))
.OrderBy(entityOrderCol + (QuerySearch.descSort ? " asc " : " desc "))
.ToPagedListAsync(QuerySearch.PageNo, QuerySearch.PageSize);
return new
{
PageNo = entities.PageIndex,
PageSize = entities.PageSize,
TotalPage = entities.TotalPages,
TotalRows = entities.TotalCount,
Rows = entities.Items.Select(t => t.Adapt<ParaGoodsShowDto>()).ToList()
};
return entities.Adapt<SqlSugarPagedList<ParaGoodsShowDto>>();
}
/// <summary>
@ -556,7 +552,7 @@ namespace Myshipping.Application
if (!string.IsNullOrWhiteSpace(QuerySearch.SortField))
entityOrderCol = MapsterExtHelper.GetAdaptProperty<ParaGoodsCategoryShowDto, ParaGoodsCategoryInfo>(QuerySearch.SortField);
var entities = await _paraGoodsCategoryInfoRepository.AsQueryable().Filter(null, true)
var entities = await _paraGoodsCategoryInfoRepository.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.GoodsCategory), t => t.GOODS_CATEGORY.Contains(QuerySearch.GoodsCategory.Trim(), StringComparison.OrdinalIgnoreCase))
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.GoodsCategoryName), t => t.GOODS_CATEGORY_NAME.Contains(QuerySearch.GoodsCategoryName.Trim(), StringComparison.OrdinalIgnoreCase))
.WhereIF(createBegin != DateTime.MinValue, t => t.CreatedTime.HasValue && t.CreatedTime.Value >= createBegin)
@ -567,14 +563,8 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.UpdateUserName), t => t.UpdatedUserName.Contains(QuerySearch.UpdateUserName.Trim(), StringComparison.OrdinalIgnoreCase))
.OrderBy(entityOrderCol + (QuerySearch.descSort ? " asc " : " desc "))
.ToPagedListAsync(QuerySearch.PageNo, QuerySearch.PageSize);
return new
{
PageNo = entities.PageIndex,
PageSize = entities.PageSize,
TotalPage = entities.TotalPages,
TotalRows = entities.TotalCount,
Rows = entities.Items.Select(t => t.Adapt<ParaGoodsCategoryShowDto>()).ToList()
};
return entities.Adapt<SqlSugarPagedList<ParaGoodsCategoryShowDto>>();
}
#endregion
@ -813,7 +803,7 @@ namespace Myshipping.Application
if (!string.IsNullOrWhiteSpace(QuerySearch.SortField))
entityOrderCol = MapsterExtHelper.GetAdaptProperty<ParaContractNoShowDto, ParaContractNoInfo>(QuerySearch.SortField);
var entities = await _paraContractNoInfoRepository.AsQueryable().Filter(null, true)
var entities = await _paraContractNoInfoRepository.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.ContractNo), t => t.CONTRACT_NO.Contains(QuerySearch.ContractNo.Trim(), StringComparison.OrdinalIgnoreCase))
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.ContractName), t => t.CONTRACT_NAME.Contains(QuerySearch.ContractName.Trim(), StringComparison.OrdinalIgnoreCase))
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.ContractNote), t => t.CONTRACT_NOTE.Contains(QuerySearch.ContractNote.Trim(), StringComparison.OrdinalIgnoreCase))
@ -825,14 +815,8 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.UpdateUserName), t => t.UpdatedUserName.Contains(QuerySearch.UpdateUserName.Trim(), StringComparison.OrdinalIgnoreCase))
.OrderBy(entityOrderCol + (QuerySearch.descSort ? " asc " : " desc "))
.ToPagedListAsync(QuerySearch.PageNo, QuerySearch.PageSize);
return new
{
PageNo = entities.PageIndex,
PageSize = entities.PageSize,
TotalPage = entities.TotalPages,
TotalRows = entities.TotalCount,
Rows = entities.Items.Select(t => t.Adapt<ParaContractNoShowDto>()).ToList()
};
return entities.Adapt<SqlSugarPagedList<ParaContractNoShowDto>>();
}
#endregion
}

@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
///
/// </summary>
public class LaraPaperRegistDto
{
/// <summary>
/// 上次结束编号
/// </summary>
public string NumberTo { get; set; }
/// <summary>
/// LARA提单纸登记合计明细
/// </summary>
public List<LaraPaperRegistDetailDto> DetailList { get; set; }
}
/// <summary>
///
/// </summary>
public class LaraPaperRegistDetailDto
{
/// <summary>
///
/// </summary>
public string OrderNo { get; set; }
/// <summary>
///
/// </summary>
public string TaskId { get; set; }
/// <summary>
///
/// </summary>
public string MBLNo { get; set; }
/// <summary>
///
/// </summary>
public int DraftNum { get; set; }
/// <summary>
///
/// </summary>
public Nullable<DateTime> OriginalDownTime { get; set; }
/// <summary>
///
/// </summary>
public string IssueType { get; set; }
}
}

@ -86,7 +86,7 @@ namespace Myshipping.Application
/// </summary>
/// <param name="PKIds">任务主键数组</param>
/// <returns>返回结果</returns>
Task<TaskManageOrderResultDto> LaraPaperRegist(string[] PKIds);
Task<LaraPaperRegistDto> LaraPaperRegist(string[] PKIds);
/// <summary>

@ -19,6 +19,7 @@ using Myshipping.Core.Service;
using MySqlX.XDevAPI.Common;
using Newtonsoft.Json.Linq;
using NPOI.SS.Formula.Functions;
using Org.BouncyCastle.Asn1.X500;
using SqlSugar;
using StackExchange.Profiling.Internal;
using System;
@ -1209,16 +1210,112 @@ namespace Myshipping.Application
/// </summary>
/// <param name="PKIds">任务主键数组</param>
/// <returns>返回结果</returns>
public async Task<TaskManageOrderResultDto> LaraPaperRegist(string[] PKIds)
[HttpPost("/TaskManage/LaraPaperRegist")]
public async Task<LaraPaperRegistDto> LaraPaperRegist(string[] PKIds)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
LaraPaperRegistDto result = new LaraPaperRegistDto();
List<LaraPaperRegistDetailDto> list = new List<LaraPaperRegistDetailDto>();
string batchNo = IDGen.NextID().ToString();
_logger.LogInformation("批次={no} ids={ids} LARA提单纸登记开始", batchNo, string.Join(",", PKIds));
/*
1DRAFT
2
LARA
*/
try
{
//
var fileList = _taskBaseInfoRepository.EntityContext.Queryable<TaskBaseInfo>()
.InnerJoin<TaskBaseInfo>((tsk, tsk2) => tsk.BOOK_ORDER_NO == tsk2.BOOK_ORDER_NO)
.Where((tsk, tsk2) => PKIds.Contains(tsk.PK_ID) && tsk.TASK_TYPE == TaskBusiTypeEnum.DRAFT.ToString())
.Select((tsk, tsk2) => new { tsk = tsk, tsk2 = tsk2 }).ToList();
var taskList = _taskBaseInfoRepository.AsQueryable()
.Where(t => PKIds.Contains(t.PK_ID) && t.TASK_TYPE == TaskBusiTypeEnum.DRAFT.ToString())
.OrderByDescending(t => new { t.BOOK_ORDER_NO, t.CreatedTime })
.ToList();
if(taskList.Count > 0)
{
var orderNoList = taskList.Select(t => long.Parse(t.BOOK_ORDER_NO)).Distinct().ToArray();
//跨库读取订舱数据
var orderList = _bookingOrderRepository.AsQueryable().Where(t => orderNoList.Contains(t.Id)).ToList();
var originalDownloadHisInfo = _taskOriginalDownloadHisInfoRepository.AsQueryable().First(t => t.TASK_ID == "");
taskList.ForEach(t => {
int draftNum = 0;
var orderInfo = orderList.FirstOrDefault();
LaraPaperRegistDetailDto laraInfo = new LaraPaperRegistDetailDto();
laraInfo.OrderNo = t.BOOK_ORDER_NO;
laraInfo.TaskId = t.PK_ID;
laraInfo.MBLNo = t.MBL_NO;
laraInfo.DraftNum = draftNum;
laraInfo.OriginalDownTime = originalDownloadHisInfo.END_DATE;
laraInfo.IssueType = orderInfo.ISSUETYPE;
list.Add(laraInfo);
});
}
/*
taskList.ForEach(t =>
{
//查询draft任务根据附件名称解析draft的pdf页数
var draftTask = taskDataContext.OpTasks.AsNoTracking()
.Where(tt => tt.RelativeId == t.RelativeId && tt.TASKTYPE == taskTypeDraft)
.OrderByDescending(tt => tt.CreateTime)
.FirstOrDefault();
var oriDownHisQuery = from oriPrint in taskDataContext.OriginalPrintHistory.AsNoTracking()
join task in taskDataContext.OpTasks.AsNoTracking() on oriPrint.TASKID equals task.GID
where task.RelativeId == t.RelativeId
orderby oriPrint.OP_TIME descending
select oriPrint;
var oriDownHis = oriDownHisQuery.FirstOrDefault();
if (draftTask != null && !string.IsNullOrEmpty(draftTask.FILEPATH) && oriDownHis != null)
{
var fileName = Path.GetFileNameWithoutExtension(draftTask.FILEPATH);
var tmpArr = fileName.Split("-".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
if (tmpArr.Length == 3)
{
var order = taskDataContext.Orders.AsNoTracking().First(oo => oo.ORDNO == t.RelativeId);
arr.Add(new LaraPaperInputListModel
{
ORDNO = t.RelativeId,
TaskId = t.GID,
MBLNO = t.MBLNO,
DraftNum = Convert.ToInt32(tmpArr[2]),
OriginalDownTime = oriDownHis.OP_TIME,
ISSUETYPE = order.ISSUETYPE
});
}
}
});
ViewData["List"] = arr;
//查询最后使用提单纸编号
var currUser = CurrentUser;
var lastPrint = taskDataContext.LaraPapers.AsNoTracking().Where(lp => lp.UserId == currUser.GID).OrderByDescending(lp => lp.NumberTo).FirstOrDefault();
if (lastPrint != null)
{
ViewData["LastPaperNumber"] = Convert.ToInt32(lastPrint.NumberTo);
}
else
{
ViewData["LastPaperNumber"] = 0;
}*/
}
catch (Exception ex)

Loading…
Cancel
Save