修改派车打印

optimize
jianghaiqing 2 years ago
parent 788668a695
commit fee311c7c7

@ -28,7 +28,17 @@ namespace Myshipping.Application
{
public static class PrintHelper
{
public static async Task<byte[]> GeneratePrintFile(string BusiJson,string reportUrl, PrintFileTypeEnum printFileType,
/// <summary>
/// 生成打印文件
/// </summary>
/// <param name="busiJson">业务详情JSON</param>
/// <param name="reportUrl">请求生成URL</param>
/// <param name="dataSourceKey">数据源Key</param>
/// <param name="printFileType">文档类型</param>
/// <param name="printTemplate">文档模板</param>
/// <returns>返回文件二进制</returns>
public static async Task<byte[]> GeneratePrintFile(string busiJson,string reportUrl, string dataSourceKey,
PrintFileTypeEnum printFileType,
BookingPrintTemplate printTemplate)
{
var logger = Log.CreateLogger(nameof(PrintHelper));
@ -77,10 +87,11 @@ namespace Myshipping.Application
file.Close();
NameValueCollection par = new NameValueCollection();
par.Add("printType", ((int)printFileType).ToString());
par.Add("dataJson", BusiJson);
par.Add("printType", printFileType.ToString().ToLower());
par.Add($"dataJson{dataSourceKey}", busiJson);
var rtn = TransmitFile(reportUrl, par, new {
var genUrl = $"{reportUrl}Report/PrintReport";
var rtn = TransmitFile(genUrl, par, new {
file = "file",
fileName = printTemplate.FileName,
fileBytes = heByte

@ -56,6 +56,7 @@ namespace Myshipping.Application
private readonly ITaskManageExternalService _taskManageExternalService;
const string PRINT_LIST_TYPE_KEY = "booking_truck_print_list";
const string PRINT_DATASOURCE_KEY = "booking_order";
public BookingTruckService(ISysCacheService cache, ILogger<BookingTruckService> logger,
SqlSugarRepository<BookingTruck> bookingTruckRepository,
@ -176,6 +177,8 @@ namespace Myshipping.Application
it.TruckName,
it.TruckCode,
it.Status,
it.TruckFlowNo,
it.TaskNo
}).ExecuteCommandAsync();
await _bookingTruckContaRepository.DeleteAsync(x => x.TruckId == model.Id);
@ -186,15 +189,6 @@ namespace Myshipping.Application
{
ctn.TruckId = entity.Id;
//await _bookingTruckContaRepository.AsUpdateable(ctn).IgnoreColumns(it => new
//{
// it.TenantId,
// it.CreatedTime,
// it.CreatedUserId,
// it.CreatedUserName,
// it.IsDeleted,
//}).ExecuteCommandAsync();
await _bookingTruckContaRepository.InsertAsync(ctn);
});
}
@ -1493,8 +1487,6 @@ namespace Myshipping.Application
reportUrl += "/";
}
var genUrl = $"{reportUrl}PrintReport";
var truckOrder = _bookingTruckRepository.AsQueryable().First(a => a.Id == bookingTruckId);
if (truckOrder == null)
@ -1507,7 +1499,8 @@ namespace Myshipping.Application
if (truckCtnList.Count > 0)
model.ContaList = truckCtnList.Adapt<List<BookingTruckCtnDto>>();
return await PrintHelper.GeneratePrintFile(JSON.Serialize(model), genUrl, printFileType, printTemplate);
return await PrintHelper.GeneratePrintFile(JSON.Serialize(model), reportUrl, PRINT_DATASOURCE_KEY,
printFileType, printTemplate);
}

@ -40,7 +40,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingExcelTemplate> _bookingExcelTemplateRepository;
const string PRINT_LIST_TYPE_KEY = "booking_truck_print_list";
const string PRINT_DATASOURCE_KEY = "booking_order";
public TaskManageTruckService(SqlSugarRepository<TaskTruckInfo> taskTruckRepository,
SqlSugarRepository<TaskTruckCtn> taskTruckContaRepository,
SqlSugarRepository<TaskBaseInfo> taskBaseRepository,
@ -633,7 +633,8 @@ namespace Myshipping.Application
if (truckCtnList.Count > 0)
model.ContaList = truckCtnList.Adapt<List<BookingTruckCtnDto>>();
return await PrintHelper.GeneratePrintFile(JSON.Serialize(model), genUrl, printFileType, printTemplate);
return await PrintHelper.GeneratePrintFile(JSON.Serialize(model), genUrl, PRINT_DATASOURCE_KEY,
printFileType, printTemplate);
}
/// <summary>

Loading…
Cancel
Save