diff --git a/ds-wms-service/DS.Module.ExcelModule/ExcelService.cs b/ds-wms-service/DS.Module.ExcelModule/ExcelService.cs
index ffd39ec2..075c480f 100644
--- a/ds-wms-service/DS.Module.ExcelModule/ExcelService.cs
+++ b/ds-wms-service/DS.Module.ExcelModule/ExcelService.cs
@@ -24,7 +24,15 @@ namespace DS.Module.ExcelModule
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
-
+ static readonly ApiFox api;
+ ///
+ /// 构造函数
+ ///
+ ///
+ static ExcelService()
+ {
+ api = new ApiFox();
+ }
///
/// 构造函数
///
@@ -33,7 +41,6 @@ namespace DS.Module.ExcelModule
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService();
-
}
public DataResult ExportExcelByColumn(ExportByColumnReq req)
{
@@ -51,7 +58,7 @@ namespace DS.Module.ExcelModule
for (int n = 0; n < req.ColumnSets.Count; n++)
{
var columnSet = req.ColumnSets[n];
- var key = columnSet.DataIndex;
+ var key = columnSet.DataIndex;
info.Add(columnSet.Title, temp[key]);
}
values.Add(info);
@@ -60,6 +67,29 @@ namespace DS.Module.ExcelModule
return DataResult.Success(path);
}
+ public async Task ExportExcelStreamByColumnAsync(ExportByColumnReq req)
+ {
+ var data = JArray.Parse(req.JsonDataStr);
+
+ var values = new List>();
+
+ for (int i = 0; i < data.Count; i++)
+ {
+ var temp = data[i];
+ var info = new Dictionary();
+ for (int n = 0; n < req.ColumnSets.Count; n++)
+ {
+ var columnSet = req.ColumnSets[n];
+ var key = columnSet.DataIndex;
+ info.Add(columnSet.Title, temp[key]);
+ }
+ values.Add(info);
+ }
+ var stream = new MemoryStream();
+ await MiniExcel.SaveAsAsync(stream, values);
+ stream.Seek(0, SeekOrigin.Begin);
+ return stream;
+ }
public MemoryStream ExportExcelStreamByColumn(ExportByColumnReq req)
{
diff --git a/ds-wms-service/DS.Module.ExcelModule/IExcelService.cs b/ds-wms-service/DS.Module.ExcelModule/IExcelService.cs
index 21036e7d..606525dc 100644
--- a/ds-wms-service/DS.Module.ExcelModule/IExcelService.cs
+++ b/ds-wms-service/DS.Module.ExcelModule/IExcelService.cs
@@ -26,5 +26,11 @@ namespace DS.Module.ExcelModule
///
public MemoryStream ExportExcelStreamByColumn(ExportByColumnReq req);
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ExportExcelStreamByColumnAsync(ExportByColumnReq req);
}
}
diff --git a/ds-wms-service/DS.Module.ExcelModule/Model/ExportExcelReq.cs b/ds-wms-service/DS.Module.ExcelModule/Model/ExportExcelReq.cs
new file mode 100644
index 00000000..1349f288
--- /dev/null
+++ b/ds-wms-service/DS.Module.ExcelModule/Model/ExportExcelReq.cs
@@ -0,0 +1,30 @@
+using DS.Module.Core;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.Module.ExcelModule.Model
+{
+ ///
+ /// 导出Excel通用请求
+ ///
+ public class ExportExcelReq
+ {
+ ///
+ /// 请求路由Url
+ ///
+ public string Url { get; set; }
+ ///
+ /// 查询条件
+ ///
+ public PageRequest QueryRequest { get; set; }
+
+ ///
+ /// 用户自定义列设置
+ ///
+ public List ColumnSets { get; set; }
+
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExportBillManage.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExportBillManage.cs
index 074f5969..1e2bbfae 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExportBillManage.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExportBillManage.cs
@@ -324,7 +324,7 @@ public class SeaExportBillManage : BaseOrgModel
///
/// 签单方式 t_code_issutype
///
- [SugarColumn(ColumnDescription = "签单方式", IsNullable = true, Length = 12)]
+ [SugarColumn(ColumnDescription = "签单方式", IsNullable = true, Length = 30)]
public string IssueType { get; set; }
///
diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportRefundService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportRefundService.cs
index c6de8366..da30464a 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportRefundService.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportRefundService.cs
@@ -299,14 +299,14 @@ namespace DS.WMS.Core.Op.Method
await tenantDb.Insertable(list).ExecuteCommandAsync();
}
//更新主表货运跟踪
- var statusLogs = await tenantDb.Queryable().Where(x => x.BusinessId == req.Id).ToListAsync();
- if (statusLogs.IsNotNull() && statusLogs.Count > 0)
+ var bookingGoods = await tenantDb.Queryable().Where(x => x.BusinessId == req.Id).ToListAsync();
+ if (bookingGoods.IsNotNull() && bookingGoods.Count > 0)
{
- foreach (var item in statusLogs)
+ foreach (var item in bookingGoods)
{
item.BusinessId = newKey;
}
- await tenantDb.Updateable(statusLogs).ExecuteCommandAsync();
+ await tenantDb.Updateable(bookingGoods).ExecuteCommandAsync();
}
//任务交互表
var taskList = await tenantDb.Queryable().Where(x => x.BusinessId == req.Id).ToListAsync();
diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs
index 3883855d..bd857bb8 100644
--- a/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs
+++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs
@@ -22,6 +22,11 @@ using Microsoft.AspNetCore.Authorization;
using SixLabors.ImageSharp.Drawing;
using System.IO;
using System.Web;
+using DS.WMS.Core.Flow.Dtos;
+using DS.WMS.Core.Flow.Entity;
+using DS.WMS.Core;
+using MathNet.Numerics;
+using NPOI.SS.Formula.Functions;
namespace DS.WMS.MainApi.Controllers
{
@@ -53,6 +58,50 @@ namespace DS.WMS.MainApi.Controllers
return _invokeService.ExportExcelByColumn(req);
}
+ //[HttpPost]
+ //[Route("CommonExcelExportAsync")]
+ //public async Task CommonExcelExportAsync([FromBody] ExportExcelReq req)
+ //{
+
+ // if (instance.CallbackURL.IsNullOrEmpty())
+ // return;
+
+ // //请求参数设置
+ // var callback = new FlowCallback
+ // {
+ // InstanceId = instance.Id,
+ // BusinessId = instance.BusinessId,
+ // BusinessType = instance.BusinessType,
+ // AuditType = instance.AuditType,
+ // FlowStatus = instance.FlowStatus,
+ // RejectReason = instance.Note
+ // };
+
+ // if (api.DefaultHeaders.Contains("Authorization"))
+ // api.DefaultHeaders.Remove("Authorization");
+
+ // api.DefaultHeaders.Add("Authorization", "Bearer " + User.GetToken());
+ // try
+ // {
+ // var result = await api.PostAsync(instance.CallbackURL, callback);
+ // if (result.Succeeded)
+ // {
+ // //更新回调执行标识
+ // await Db.Updateable().SetColumns(it => it.IsCallbackExecuted == true)
+ // .Where(it => it.Id == instance.Id).ExecuteCommandAsync();
+ // }
+ // else
+ // {
+ // await new ApplicationException($"访问回调URL:{instance.CallbackURL} 时返回了错误:" + result.Message).LogAsync(Db);
+ // }
+ // }
+ // catch (Exception ex)
+ // {
+ // await ex.LogAsync(Db);
+ // }
+
+
+ //}
///
/// 根据用户列导出Excel文件流
///