|
|
|
@ -0,0 +1,999 @@
|
|
|
|
|
using Amazon.Runtime.Internal.Util;
|
|
|
|
|
using AngleSharp.Dom;
|
|
|
|
|
using DS.Module.Core;
|
|
|
|
|
using DS.Module.Core.Data;
|
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
|
using DS.Module.SqlSugar;
|
|
|
|
|
using DS.Module.UserModule;
|
|
|
|
|
using DS.WMS.Core.Code.Entity;
|
|
|
|
|
using DS.WMS.Core.Fee.Entity;
|
|
|
|
|
using DS.WMS.Core.Map.Entity;
|
|
|
|
|
using DS.WMS.Core.Op.Dtos;
|
|
|
|
|
using DS.WMS.Core.Op.EDI;
|
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
|
using DS.WMS.Core.Op.Interface;
|
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using NLog;
|
|
|
|
|
using Logger = NLog.Logger;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using DS.Module.Core.Helpers;
|
|
|
|
|
using Org.BouncyCastle.Ocsp;
|
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
|
using MiniExcelLibs;
|
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
using DS.WMS.Core.HangfireJob.Dtos;
|
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
using ZstdSharp.Unsafe;
|
|
|
|
|
using static DS.WMS.Core.Op.Method.SeaExportTestService;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Op.Method
|
|
|
|
|
{
|
|
|
|
|
public class SeaExportTestService: ISeaExportTestService
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private readonly IServiceProvider _serviceProvider;
|
|
|
|
|
private readonly ISqlSugarClient db;
|
|
|
|
|
private readonly IUser user;
|
|
|
|
|
private readonly ISaasDbService saasService;
|
|
|
|
|
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
Microsoft.Extensions.Configuration.IConfiguration config;
|
|
|
|
|
IWebHostEnvironment hostEnvironment;
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="serviceProvider"></param>
|
|
|
|
|
public SeaExportTestService(IServiceProvider serviceProvider)
|
|
|
|
|
{
|
|
|
|
|
_serviceProvider = serviceProvider;
|
|
|
|
|
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
|
|
|
|
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
|
|
|
|
config = serviceProvider.GetRequiredService<Microsoft.Extensions.Configuration.IConfiguration>();
|
|
|
|
|
hostEnvironment = serviceProvider.GetRequiredService<IWebHostEnvironment>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ZySeaExportMain
|
|
|
|
|
{
|
|
|
|
|
public long Id { get; set; }
|
|
|
|
|
public string 订单类别 { get; set; }
|
|
|
|
|
public string 订单code { get; set; }
|
|
|
|
|
public string 分单编号 { get; set; }
|
|
|
|
|
public string 改配订单code { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string 客户编号 { get; set; }
|
|
|
|
|
public string 货源 { get; set; }
|
|
|
|
|
public string 入货通知备注 { get; set; }
|
|
|
|
|
public string 订单备注 { get; set; }
|
|
|
|
|
public string 客户联系人 { get; set; }
|
|
|
|
|
public string 客户电话 { get; set; }
|
|
|
|
|
public string 客户邮箱 { get; set; }
|
|
|
|
|
public string 客户职务 { get; set; }
|
|
|
|
|
public string 客户qq { get; set; }
|
|
|
|
|
public string 客户联系方式 { get; set; }
|
|
|
|
|
public string 客户 { get; set; }
|
|
|
|
|
public string 状态 { get; set; }
|
|
|
|
|
|
|
|
|
|
public int 优先级 { get; set; }
|
|
|
|
|
public int 是否锁单 { get; set; }
|
|
|
|
|
public string 约主 { get; set; }
|
|
|
|
|
public string 创建者 { get; set; }
|
|
|
|
|
public DateTime? 创建时间 { get; set; }
|
|
|
|
|
public string 更新者 { get; set; }
|
|
|
|
|
public DateTime? 更新时间 { get; set; }
|
|
|
|
|
public int 是否删除 { get; set; }
|
|
|
|
|
public string 商务 { get; set; }
|
|
|
|
|
public string 操作 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 客服 { get; set; }
|
|
|
|
|
public int? 委托状态 { get; set; }
|
|
|
|
|
|
|
|
|
|
public DateTime? 离港时间 { get; set; }
|
|
|
|
|
|
|
|
|
|
public DateTime? 到港时间 { get; set; }
|
|
|
|
|
public int 汇率 { get; set; }
|
|
|
|
|
public string 订单箱子名称与数量 { get; set; }
|
|
|
|
|
public int? 底单价 { get; set; }
|
|
|
|
|
|
|
|
|
|
public int? 卖单价 { get; set; }
|
|
|
|
|
public DateTime? 实际离港时间 { get; set; }
|
|
|
|
|
public string 操作完结 { get; set; }
|
|
|
|
|
public DateTime? 货好时间 { get; set; }
|
|
|
|
|
public DateTime? ATA { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 起运港 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 目的港 { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ZySeaExportCtnGoods
|
|
|
|
|
{
|
|
|
|
|
public long Id { get; set; }
|
|
|
|
|
public string 品名 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 海关编码 { get; set; }
|
|
|
|
|
public string 订单编号 { get; set; }
|
|
|
|
|
public string 分单编号 { get; set; }
|
|
|
|
|
public string 创建者 { get; set; }
|
|
|
|
|
public DateTime? 创建时间 { get; set; }
|
|
|
|
|
public DateTime? 更新时间 { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ZySeaExportGoodsInfo
|
|
|
|
|
{
|
|
|
|
|
public long Id { get; set; }
|
|
|
|
|
public string 订单编号 { get; set; }
|
|
|
|
|
public string 分单编号 { get; set; }
|
|
|
|
|
public string 货物类别 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 唛头 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 货物中文名 { get; set; }
|
|
|
|
|
public int? 货物件数 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 包装类型 { get; set; }
|
|
|
|
|
public string 单位 { get; set; }
|
|
|
|
|
public decimal? 毛重 { get; set; }
|
|
|
|
|
public decimal? 体积 { get; set; }
|
|
|
|
|
public string 商品海关编码 { get; set; }
|
|
|
|
|
public string 危品分类 { get; set; }
|
|
|
|
|
public string 危险品属性 { get; set; }
|
|
|
|
|
public string 危险品包装类型
|
|
|
|
|
{ get; set; }
|
|
|
|
|
public string 危险页码 { get; set; }
|
|
|
|
|
public string 危险品标签 { get; set; }
|
|
|
|
|
public string 危险品编号 { get; set; }
|
|
|
|
|
public string 应急联系电话 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 设置单位 { get; set; }
|
|
|
|
|
public string 最低温度 { get; set; }
|
|
|
|
|
public string 最高温度 { get; set; }
|
|
|
|
|
public string 设置温度 { get; set; }
|
|
|
|
|
public string 通风设置 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 创建者 { get; set; }
|
|
|
|
|
public int 是否删除 { get; set; }
|
|
|
|
|
public string 更新者 { get; set; }
|
|
|
|
|
public DateTime? 创建时间 { get; set; }
|
|
|
|
|
public DateTime? 更新时间 { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class ZySeaExportCtnInfo
|
|
|
|
|
{
|
|
|
|
|
public long Id { get; set; }
|
|
|
|
|
public string 订单编号 { get; set; }
|
|
|
|
|
public string 分单编号 { get; set; }
|
|
|
|
|
public string 箱型 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 箱号 { get; set; }
|
|
|
|
|
|
|
|
|
|
public int? 箱量 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 箱封号 { get; set; }
|
|
|
|
|
|
|
|
|
|
public int? 件数 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 包装 { get; set; }
|
|
|
|
|
public decimal? 重量 { get; set; }
|
|
|
|
|
public decimal? 体积 { get; set; }
|
|
|
|
|
|
|
|
|
|
public decimal? VGM重量 { get; set; }
|
|
|
|
|
public decimal? 箱重 { get; set; }
|
|
|
|
|
|
|
|
|
|
public decimal? 毛重 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 创建者 { get; set; }
|
|
|
|
|
public int 是否删除 { get; set; }
|
|
|
|
|
public string 更新者 { get; set; }
|
|
|
|
|
public DateTime? 创建时间 { get; set; }
|
|
|
|
|
public DateTime? 更新时间 { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ZySeaExportBookInfo
|
|
|
|
|
{
|
|
|
|
|
public long Id { get; set; }
|
|
|
|
|
public string 订单编号 { get; set; }
|
|
|
|
|
public string 分单编号 { get; set; }
|
|
|
|
|
public string 订舱号 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 船名 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 航次 { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string 运输条款 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 运费条款 { get; set; }
|
|
|
|
|
public string 船公司 { get; set; }
|
|
|
|
|
public string 约号 { get; set; }
|
|
|
|
|
public string 签单方式{ get; set; }
|
|
|
|
|
public string 签单份数 { get; set; }
|
|
|
|
|
public string 提单号 { get; set; }
|
|
|
|
|
public string 签发地 { get; set; }
|
|
|
|
|
public DateTime? 签发时间 { get; set; }
|
|
|
|
|
public string 订舱代理 { get; set; }
|
|
|
|
|
public string 海外代理 { get; set; }
|
|
|
|
|
public DateTime? 开港时间 { get; set; }
|
|
|
|
|
public DateTime? 截港时间 { get; set; }
|
|
|
|
|
public DateTime? 截单时间 { get; set; }
|
|
|
|
|
|
|
|
|
|
public DateTime? 截关时间 { get; set; }
|
|
|
|
|
public string 船代 { get; set; }
|
|
|
|
|
public string 场站联系人 { get; set; }
|
|
|
|
|
public string 场站联系电话 { get; set; }
|
|
|
|
|
public string 场站 { get; set; }
|
|
|
|
|
public string 箱使需求 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 订舱代理联人 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 海外代理联系人 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 海外代理联系方式 { get; set; }
|
|
|
|
|
public string 订舱邮箱 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 创建者 { get; set; }
|
|
|
|
|
public int 是否删除 { get; set; }
|
|
|
|
|
public string 更新者 { get; set; }
|
|
|
|
|
public DateTime? 创建时间 { get; set; }
|
|
|
|
|
public DateTime? 更新时间 { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ZySeaExportFeeInfo
|
|
|
|
|
{
|
|
|
|
|
public long Id { get; set; }
|
|
|
|
|
public string 订单编号 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 分单编号 { get; set; }
|
|
|
|
|
public string 费用名称 { get; set; }
|
|
|
|
|
public string 结算单位 { get; set; }
|
|
|
|
|
public int 费用类型 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 币种 { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public decimal? 数量 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 单位 { get; set; }
|
|
|
|
|
public decimal? 单价 { get; set; }
|
|
|
|
|
public decimal? 总价 { get; set; }
|
|
|
|
|
|
|
|
|
|
public string 创建者 { get; set; }
|
|
|
|
|
public int 是否删除 { get; set; }
|
|
|
|
|
public string 更新者 { get; set; }
|
|
|
|
|
public DateTime? 创建时间 { get; set; }
|
|
|
|
|
public DateTime? 更新时间 { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class Main {
|
|
|
|
|
|
|
|
|
|
public List<ZySeaExportMain> List { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class CtnGoods
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public List<ZySeaExportCtnGoods> List { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class MainGoods
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public List<ZySeaExportGoodsInfo> List { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class MainCtns
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public List<ZySeaExportCtnInfo> List { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class MainBooks
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public List<ZySeaExportBookInfo> List { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class MainFees
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public List<ZySeaExportFeeInfo> List { get; set; }
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 海运出口主单导出
|
|
|
|
|
/// </summary>
|
|
|
|
|
public async Task SeaExportExport()
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
|
|
|
|
|
string path = Path.Combine(hostEnvironment.WebRootPath, "templates", "海运出口主单.xlsx");
|
|
|
|
|
FileInfo templateFile = new(path);
|
|
|
|
|
if (!templateFile.Exists)
|
|
|
|
|
{
|
|
|
|
|
var ex = new ApplicationException("未能在下列路径找到模板文件:" + path);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
var model = new Main();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string savePath = Path.Combine(hostEnvironment.WebRootPath, "templates", "海运出口主单" + NumUtil.GetNo() + ".xlsx");
|
|
|
|
|
var ctnpriceList = await tenantDb.Queryable<BusinessCtnPrice>().Filter(null, true).ToListAsync();
|
|
|
|
|
var contactList = await tenantDb.Queryable<BusinessOrderContact>().Filter(null, true).Where(x => x.CustomerType == "controller").ToListAsync();
|
|
|
|
|
|
|
|
|
|
var data = await tenantDb.Queryable<SeaExport>().Filter(null, true).Where(x => !x.Deleted && x.IsRefund == false && x.IsChangeETD == false)
|
|
|
|
|
.LeftJoin<BusinessFeeStatus>((x, y) => x.Id == y.BusinessId)
|
|
|
|
|
.Select((x, y) => new ZySeaExportMain
|
|
|
|
|
{
|
|
|
|
|
Id =x.Id,
|
|
|
|
|
订单类别 = x.BLType,
|
|
|
|
|
订单code = x.MBLNO,
|
|
|
|
|
客户编号 = x.CustomerNo,
|
|
|
|
|
货源 = x.SourceCode,
|
|
|
|
|
入货通知备注 = "",
|
|
|
|
|
订单备注 = x.Remark,
|
|
|
|
|
|
|
|
|
|
客户qq = "",
|
|
|
|
|
|
|
|
|
|
客户 = x.CustomerName,
|
|
|
|
|
状态 = x.BusinessStatusName,
|
|
|
|
|
优先级 = 1,
|
|
|
|
|
是否锁单 = (bool)y.IsBusinessLocking ? 1 : 0,
|
|
|
|
|
约主 = x.ContractClientName,
|
|
|
|
|
创建者 = x.CreateUserName,
|
|
|
|
|
创建时间 = x.CreateTime,
|
|
|
|
|
更新者 = x.UpdateUserName,
|
|
|
|
|
更新时间 = x.UpdateTime,
|
|
|
|
|
是否删除 = 0,
|
|
|
|
|
商务 = x.Sale,
|
|
|
|
|
操作 = x.OperatorName,
|
|
|
|
|
客服 = x.CustomerServiceName,
|
|
|
|
|
委托状态 = 2,
|
|
|
|
|
离港时间 = x.ETD,
|
|
|
|
|
到港时间 = x.ATA,
|
|
|
|
|
汇率 = 0,
|
|
|
|
|
订单箱子名称与数量 = x.CntrTotal,
|
|
|
|
|
实际离港时间 = x.ATD,
|
|
|
|
|
操作完结 = "",
|
|
|
|
|
货好时间 = x.GoodsCompleteTime,
|
|
|
|
|
ATA = x.ATA,
|
|
|
|
|
起运港 = x.LoadPortCode,
|
|
|
|
|
目的港 = x.DischargePortCode,
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
foreach (var item in data)
|
|
|
|
|
{
|
|
|
|
|
var ctnprice = ctnpriceList.FirstOrDefault(a => a.BusinessId == item.Id);
|
|
|
|
|
if (ctnprice.IsNotNull())
|
|
|
|
|
{
|
|
|
|
|
item.底单价 = ctnprice.FloorPrice;
|
|
|
|
|
item.卖单价 = ctnprice.QuotePrice;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var contact = contactList.FirstOrDefault(a => a.BusinessId == item.Id);
|
|
|
|
|
if (contact.IsNotNull())
|
|
|
|
|
{
|
|
|
|
|
item.客户联系人 = contact.Name;
|
|
|
|
|
item.客户电话 = contact.Tel;
|
|
|
|
|
item.客户邮箱 = contact.Email;
|
|
|
|
|
item.客户职务 = contact.Job;
|
|
|
|
|
item.客户联系方式 = contact.Mobile;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
model.List = data;
|
|
|
|
|
//MemoryStream ms = new();
|
|
|
|
|
await MiniExcel.SaveAsByTemplateAsync(savePath, path, model);
|
|
|
|
|
//string base64Str = Convert.ToBase64String(ms.ToArray());
|
|
|
|
|
//ms.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 海运出口品名信息导出
|
|
|
|
|
/// </summary>
|
|
|
|
|
public async Task SeaExportExportCtnGoods()
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
|
|
|
|
|
string path = Path.Combine(hostEnvironment.WebRootPath, "templates", "货物中文品名信息.xlsx");
|
|
|
|
|
FileInfo templateFile = new(path);
|
|
|
|
|
if (!templateFile.Exists)
|
|
|
|
|
{
|
|
|
|
|
var ex = new ApplicationException("未能在下列路径找到模板文件:" + path);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
var model = new CtnGoods();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string savePath = Path.Combine(hostEnvironment.WebRootPath, "templates", "货物中文品名信息" + NumUtil.GetNo() + ".xlsx");
|
|
|
|
|
|
|
|
|
|
var data = await tenantDb.Queryable<OpCtnGoods>().Filter(null, true).Where(x => !x.Deleted )
|
|
|
|
|
.InnerJoin<SeaExport>((x, y) => x.BusinessId == y.Id && y.IsRefund == false && y.IsChangeETD == false)
|
|
|
|
|
.Select((x, y) => new ZySeaExportCtnGoods
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
品名 = x.GoodsName,
|
|
|
|
|
海关编码 = x.HSCode,
|
|
|
|
|
订单编号 = y.MBLNO,
|
|
|
|
|
创建者 = x.CreateUserName,
|
|
|
|
|
创建时间 = x.CreateTime,
|
|
|
|
|
更新时间 = x.UpdateTime,
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
model.List = data;
|
|
|
|
|
await MiniExcel.SaveAsByTemplateAsync(savePath, path, model);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 海运出口订单货物信息导出
|
|
|
|
|
/// </summary>
|
|
|
|
|
public async Task SeaExportExportMainGood()
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
|
|
|
|
|
string path = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单货物信息.xlsx");
|
|
|
|
|
FileInfo templateFile = new(path);
|
|
|
|
|
if (!templateFile.Exists)
|
|
|
|
|
{
|
|
|
|
|
var ex = new ApplicationException("未能在下列路径找到模板文件:" + path);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
var model = new MainGoods();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string savePath = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单货物信息" + NumUtil.GetNo() + ".xlsx");
|
|
|
|
|
var ctnpriceList = await tenantDb.Queryable<BusinessCtnPrice>().Filter(null, true).ToListAsync();
|
|
|
|
|
var contactList = await tenantDb.Queryable<BusinessOrderContact>().Filter(null, true).Where(x => x.CustomerType == "controller").ToListAsync();
|
|
|
|
|
|
|
|
|
|
var data = await tenantDb.Queryable<SeaExport>().Filter(null, true).Where(x => !x.Deleted && x.IsRefund == false && x.IsChangeETD == false)
|
|
|
|
|
.Select(x => new ZySeaExportGoodsInfo
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
订单编号 = x.MBLNO,
|
|
|
|
|
唛头 = x.Marks,
|
|
|
|
|
货物中文名 = x.GoodsName,
|
|
|
|
|
货物件数 = x.PKGS,
|
|
|
|
|
包装类型 = x.KindPkgsName,
|
|
|
|
|
|
|
|
|
|
毛重 = x.KGS,
|
|
|
|
|
|
|
|
|
|
体积 = x.CBM,
|
|
|
|
|
商品海关编码 = x.HSCode,
|
|
|
|
|
|
|
|
|
|
创建者 = x.CreateUserName,
|
|
|
|
|
创建时间 = x.CreateTime,
|
|
|
|
|
更新者 = x.UpdateUserName,
|
|
|
|
|
更新时间 = x.UpdateTime,
|
|
|
|
|
是否删除 = 0,
|
|
|
|
|
危品分类 = x.DangerClass,
|
|
|
|
|
//危 = x.DangerAttn,
|
|
|
|
|
危险品标签 = x.DangerLabel,
|
|
|
|
|
危险页码 = x.DangerNo,
|
|
|
|
|
危险品编号 = x.DangerPage,
|
|
|
|
|
应急联系电话 = x.DangerTel,
|
|
|
|
|
设置温度 = x.TemperatureSet,
|
|
|
|
|
最高温度 = x.TemperatureMax,
|
|
|
|
|
最低温度 = x.TemperatureMin,
|
|
|
|
|
设置单位 = x.TemperatureUnit,
|
|
|
|
|
通风设置 = x.ReeferQuantity,
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
model.List = data;
|
|
|
|
|
//MemoryStream ms = new();
|
|
|
|
|
await MiniExcel.SaveAsByTemplateAsync(savePath, path, model);
|
|
|
|
|
//string base64Str = Convert.ToBase64String(ms.ToArray());
|
|
|
|
|
//ms.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 海运出口订单集装箱信息导出
|
|
|
|
|
/// </summary>
|
|
|
|
|
public async Task SeaExportExportMainCtn()
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
|
|
|
|
|
string path = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单集装箱信息.xlsx");
|
|
|
|
|
FileInfo templateFile = new(path);
|
|
|
|
|
if (!templateFile.Exists)
|
|
|
|
|
{
|
|
|
|
|
var ex = new ApplicationException("未能在下列路径找到模板文件:" + path);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
var model = new MainCtns();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string savePath = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单集装箱信息" + NumUtil.GetNo() + ".xlsx");
|
|
|
|
|
var ctnpriceList = await tenantDb.Queryable<BusinessCtnPrice>().Filter(null, true).ToListAsync();
|
|
|
|
|
var contactList = await tenantDb.Queryable<BusinessOrderContact>().Filter(null, true).Where(x => x.CustomerType == "controller").ToListAsync();
|
|
|
|
|
|
|
|
|
|
var data = await tenantDb.Queryable<OpCtn>().Filter(null, true).Where(x => !x.Deleted)
|
|
|
|
|
.InnerJoin<SeaExport>((x, y) => x.BSNO == y.Id.ToString() && y.IsRefund == false && y.IsChangeETD == false)
|
|
|
|
|
.Select((x, y) => new ZySeaExportCtnInfo
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
订单编号 = y.MBLNO,
|
|
|
|
|
箱型 = x.Ctn,
|
|
|
|
|
箱号 = x.CntrNo,
|
|
|
|
|
箱量 = x.CtnNum,
|
|
|
|
|
箱封号 = x.SealNo,
|
|
|
|
|
件数 = x.PKGS,
|
|
|
|
|
包装 = x.KindPkgsName,
|
|
|
|
|
体积 = x.CBM,
|
|
|
|
|
VGM重量 = x.WeightKGS,
|
|
|
|
|
毛重 = x.KGS,
|
|
|
|
|
箱重 = x.TareWeight,
|
|
|
|
|
创建者 = x.CreateUserName,
|
|
|
|
|
更新者 = x.UpdateUserName,
|
|
|
|
|
创建时间 = x.CreateTime,
|
|
|
|
|
更新时间 = x.UpdateTime,
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
model.List = data;
|
|
|
|
|
//MemoryStream ms = new();
|
|
|
|
|
await MiniExcel.SaveAsByTemplateAsync(savePath, path, model);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 海运出口订单订舱信息导出
|
|
|
|
|
/// </summary>
|
|
|
|
|
public async Task SeaExportExportMainBook()
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
|
|
|
|
|
string path = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单订舱信息.xlsx");
|
|
|
|
|
FileInfo templateFile = new(path);
|
|
|
|
|
if (!templateFile.Exists)
|
|
|
|
|
{
|
|
|
|
|
var ex = new ApplicationException("未能在下列路径找到模板文件:" + path);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
var model = new MainBooks();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string savePath = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单订舱信息" + NumUtil.GetNo() + ".xlsx");
|
|
|
|
|
var ctnpriceList = await tenantDb.Queryable<BusinessCtnPrice>().Filter(null, true).ToListAsync();
|
|
|
|
|
var contactList = await tenantDb.Queryable<BusinessOrderContact>().Filter(null, true).Where(x => x.CustomerType == "controller").ToListAsync();
|
|
|
|
|
|
|
|
|
|
var data = await tenantDb.Queryable<SeaExport>().Filter(null, true).Where(x => !x.Deleted && x.IsRefund == false && x.IsChangeETD == false)
|
|
|
|
|
.Select(x => new ZySeaExportBookInfo
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
订单编号 = x.MBLNO,
|
|
|
|
|
订舱号 = x.BookingNo,
|
|
|
|
|
船名 = x.Vessel,
|
|
|
|
|
航次 = x.Voyno,
|
|
|
|
|
运输条款 = x.Service,
|
|
|
|
|
船公司 = x.Carrier,
|
|
|
|
|
约号 = x.ContractNo,
|
|
|
|
|
签单方式 = x.IssueType,
|
|
|
|
|
签单份数 = x.NoBill,
|
|
|
|
|
签发地 = x.IssuePlace,
|
|
|
|
|
签发时间 = x.IssueDate,
|
|
|
|
|
订舱代理 = x.Forwarder,
|
|
|
|
|
海外代理 = x.Agent,
|
|
|
|
|
开港时间 = x.ETD,
|
|
|
|
|
截港时间 = x.ClosingDate,
|
|
|
|
|
截单时间 = x.CloseDocDate,
|
|
|
|
|
船代 = x.ShipAgency,
|
|
|
|
|
场站联系人 = x.YardATTN,
|
|
|
|
|
场站联系电话 = x.YardTel,
|
|
|
|
|
场站 = x.Yard,
|
|
|
|
|
箱使需求 = x.ApplyCtnRemark,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
创建者 = x.CreateUserName,
|
|
|
|
|
创建时间 = x.CreateTime,
|
|
|
|
|
更新者 = x.UpdateUserName,
|
|
|
|
|
更新时间 = x.UpdateTime,
|
|
|
|
|
是否删除 = 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
model.List = data;
|
|
|
|
|
//MemoryStream ms = new();
|
|
|
|
|
await MiniExcel.SaveAsByTemplateAsync(savePath, path, model);
|
|
|
|
|
//string base64Str = Convert.ToBase64String(ms.ToArray());
|
|
|
|
|
//ms.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 海运出口订单费用信息导出
|
|
|
|
|
/// </summary>
|
|
|
|
|
public async Task SeaExportExportMainFee()
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
|
|
|
|
|
string path = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单费用信息.xlsx");
|
|
|
|
|
FileInfo templateFile = new(path);
|
|
|
|
|
if (!templateFile.Exists)
|
|
|
|
|
{
|
|
|
|
|
var ex = new ApplicationException("未能在下列路径找到模板文件:" + path);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
var model = new MainFees();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string savePath = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单费用信息" + NumUtil.GetNo() + ".xlsx");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var data = await tenantDb.Queryable<FeeRecord>().Filter(null, true).Where(x => !x.Deleted)
|
|
|
|
|
.InnerJoin<SeaExport>((x, y) => x.BusinessId == y.Id && y.IsRefund == false && y.IsChangeETD == false)
|
|
|
|
|
.Select((x, y) => new ZySeaExportFeeInfo
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
订单编号 = y.MBLNO,
|
|
|
|
|
费用名称 = x.FeeName,
|
|
|
|
|
结算单位= x.CustomerName,
|
|
|
|
|
费用类型 = x.FeeType == FeeType.Receivable ? 215 : 214,
|
|
|
|
|
币种 = x.Currency,
|
|
|
|
|
数量 = x.Quantity,
|
|
|
|
|
单位 = x.UnitText,
|
|
|
|
|
单价 = x.UnitPrice,
|
|
|
|
|
总价 = x.Amount,
|
|
|
|
|
|
|
|
|
|
创建者 = x.CreateUserName,
|
|
|
|
|
更新者 = x.UpdateUserName,
|
|
|
|
|
创建时间 = x.CreateTime,
|
|
|
|
|
更新时间 = x.UpdateTime,
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
model.List = data;
|
|
|
|
|
//MemoryStream ms = new();
|
|
|
|
|
await MiniExcel.SaveAsByTemplateAsync(savePath, path, model);
|
|
|
|
|
//string base64Str = Convert.ToBase64String(ms.ToArray());
|
|
|
|
|
//ms.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 海运出口导出-分单
|
|
|
|
|
/// </summary>
|
|
|
|
|
public async Task SeaExportExportPart()
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
|
|
|
|
|
string path = Path.Combine(hostEnvironment.WebRootPath, "templates", "海运出口主单.xlsx");
|
|
|
|
|
FileInfo templateFile = new(path);
|
|
|
|
|
if (!templateFile.Exists)
|
|
|
|
|
{
|
|
|
|
|
var ex = new ApplicationException("未能在下列路径找到模板文件:" + path);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
var model = new Main();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string savePath = Path.Combine(hostEnvironment.WebRootPath, "templates", "海运出口-分单 " + NumUtil.GetNo() + ".xlsx");
|
|
|
|
|
var ctnpriceList = await tenantDb.Queryable<BusinessCtnPrice>().Filter(null, true).ToListAsync();
|
|
|
|
|
var contactList = await tenantDb.Queryable<BusinessOrderContact>().Filter(null, true).Where(x => x.CustomerType == "controller").ToListAsync();
|
|
|
|
|
|
|
|
|
|
var data = await tenantDb.Queryable<SeaExportBillManage>().Filter(null, true).Where(x => !x.Deleted)
|
|
|
|
|
.InnerJoin<SeaExport>((x, y) => x.BusinessId == y.Id)
|
|
|
|
|
.LeftJoin<BusinessFeeStatus>((x, y,z) => z.BusinessId == y.Id)
|
|
|
|
|
.Select((x, y,z) => new ZySeaExportMain
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
订单类别 = "分单",
|
|
|
|
|
订单code = x.MBLNO,
|
|
|
|
|
客户编号 = y.CustomerNo,
|
|
|
|
|
货源 = y.SourceCode,
|
|
|
|
|
入货通知备注 = "",
|
|
|
|
|
订单备注 = x.Remark,
|
|
|
|
|
|
|
|
|
|
客户qq = "",
|
|
|
|
|
|
|
|
|
|
客户 = y.CustomerName,
|
|
|
|
|
状态 = y.BusinessStatusName,
|
|
|
|
|
优先级 = 1,
|
|
|
|
|
是否锁单 = (bool)y.IsBusinessLocking ? 1 : 0,
|
|
|
|
|
约主 = y.ContractClientName,
|
|
|
|
|
创建者 = x.CreateUserName,
|
|
|
|
|
创建时间 = x.CreateTime,
|
|
|
|
|
更新者 = x.UpdateUserName,
|
|
|
|
|
更新时间 = x.UpdateTime,
|
|
|
|
|
是否删除 = 0,
|
|
|
|
|
商务 = y.Sale,
|
|
|
|
|
操作 = y.OperatorName,
|
|
|
|
|
客服 = y.CustomerServiceName,
|
|
|
|
|
委托状态 = 2,
|
|
|
|
|
离港时间 = y.ETD,
|
|
|
|
|
到港时间 = y.ATA,
|
|
|
|
|
汇率 = 0,
|
|
|
|
|
订单箱子名称与数量 = x.CntrTotal,
|
|
|
|
|
实际离港时间 = x.ATD,
|
|
|
|
|
操作完结 = "",
|
|
|
|
|
货好时间 = y.GoodsCompleteTime,
|
|
|
|
|
ATA = y.ATA,
|
|
|
|
|
起运港 = y.LoadPortCode,
|
|
|
|
|
目的港 = y.DischargePortCode,
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
foreach (var item in data)
|
|
|
|
|
{
|
|
|
|
|
var ctnprice = ctnpriceList.FirstOrDefault(a => a.BusinessId == item.Id);
|
|
|
|
|
if (ctnprice.IsNotNull())
|
|
|
|
|
{
|
|
|
|
|
item.底单价 = ctnprice.FloorPrice;
|
|
|
|
|
item.卖单价 = ctnprice.QuotePrice;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var contact = contactList.FirstOrDefault(a => a.BusinessId == item.Id);
|
|
|
|
|
if (contact.IsNotNull())
|
|
|
|
|
{
|
|
|
|
|
item.客户联系人 = contact.Name;
|
|
|
|
|
item.客户电话 = contact.Tel;
|
|
|
|
|
item.客户邮箱 = contact.Email;
|
|
|
|
|
item.客户职务 = contact.Job;
|
|
|
|
|
item.客户联系方式 = contact.Mobile;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
model.List = data;
|
|
|
|
|
//MemoryStream ms = new();
|
|
|
|
|
await MiniExcel.SaveAsByTemplateAsync(savePath, path, model);
|
|
|
|
|
//string base64Str = Convert.ToBase64String(ms.ToArray());
|
|
|
|
|
//ms.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///// <summary>
|
|
|
|
|
///// 海运出口品名信息导出-分单
|
|
|
|
|
///// </summary>
|
|
|
|
|
//public async Task SeaExportExportCtnGoodsPart()
|
|
|
|
|
//{
|
|
|
|
|
// var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
|
|
|
|
|
// string path = Path.Combine(hostEnvironment.WebRootPath, "templates", "货物中文品名信息.xlsx");
|
|
|
|
|
// FileInfo templateFile = new(path);
|
|
|
|
|
// if (!templateFile.Exists)
|
|
|
|
|
// {
|
|
|
|
|
// var ex = new ApplicationException("未能在下列路径找到模板文件:" + path);
|
|
|
|
|
// throw ex;
|
|
|
|
|
// }
|
|
|
|
|
// var model = new CtnGoods();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// string savePath = Path.Combine(hostEnvironment.WebRootPath, "templates", "货物中文品名信息-分单" + NumUtil.GetNo() + ".xlsx");
|
|
|
|
|
|
|
|
|
|
// var data = await tenantDb.Queryable<SeaExportBillManageCtn>().Filter(null, true).Where(x => !x.Deleted)
|
|
|
|
|
// .InnerJoin<SeaExportBillManage>((x, y) => x.Pid == y.Id)
|
|
|
|
|
// .Select((x, y) => new ZySeaExportCtnGoods
|
|
|
|
|
// {
|
|
|
|
|
// Id = x.Id,
|
|
|
|
|
// 品名 = x.GoodsName,
|
|
|
|
|
// 海关编码 = x.HSCode,
|
|
|
|
|
// 订单编号 = y.MBLNO,
|
|
|
|
|
// 创建者 = x.CreateUserName,
|
|
|
|
|
// 创建时间 = x.CreateTime,
|
|
|
|
|
// 更新时间 = x.UpdateTime,
|
|
|
|
|
|
|
|
|
|
// }).ToListAsync();
|
|
|
|
|
// model.List = data;
|
|
|
|
|
// await MiniExcel.SaveAsByTemplateAsync(savePath, path, model);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
///// <summary>
|
|
|
|
|
///// 海运出口订单货物信息导出-分单
|
|
|
|
|
///// </summary>
|
|
|
|
|
//public async Task SeaExportExportMainGoodPart()
|
|
|
|
|
//{
|
|
|
|
|
// var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
|
|
|
|
|
// string path = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单货物信息.xlsx");
|
|
|
|
|
// FileInfo templateFile = new(path);
|
|
|
|
|
// if (!templateFile.Exists)
|
|
|
|
|
// {
|
|
|
|
|
// var ex = new ApplicationException("未能在下列路径找到模板文件:" + path);
|
|
|
|
|
// throw ex;
|
|
|
|
|
// }
|
|
|
|
|
// var model = new MainGoods();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// string savePath = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单货物信息" + NumUtil.GetNo() + ".xlsx");
|
|
|
|
|
// var ctnpriceList = await tenantDb.Queryable<BusinessCtnPrice>().Filter(null, true).ToListAsync();
|
|
|
|
|
// var contactList = await tenantDb.Queryable<BusinessOrderContact>().Filter(null, true).Where(x => x.CustomerType == "controller").ToListAsync();
|
|
|
|
|
|
|
|
|
|
// var data = await tenantDb.Queryable<SeaExportBillManage>().Filter(null, true).Where(x => !x.Deleted)
|
|
|
|
|
// .Select(x => new ZySeaExportGoodsInfo
|
|
|
|
|
// {
|
|
|
|
|
// Id = x.Id,
|
|
|
|
|
// 订单编号 = x.MBLNO,
|
|
|
|
|
// 唛头 = x.Marks,
|
|
|
|
|
// 货物中文名 = x.GoodsName,
|
|
|
|
|
// 货物件数 = x.PKGS,
|
|
|
|
|
// 包装类型 = x.KindPkgsName,
|
|
|
|
|
|
|
|
|
|
// 毛重 = x.KGS,
|
|
|
|
|
|
|
|
|
|
// 体积 = x.CBM,
|
|
|
|
|
// 商品海关编码 = x.HSCode,
|
|
|
|
|
|
|
|
|
|
// 创建者 = x.CreateUserName,
|
|
|
|
|
// 创建时间 = x.CreateTime,
|
|
|
|
|
// 更新者 = x.UpdateUserName,
|
|
|
|
|
// 更新时间 = x.UpdateTime,
|
|
|
|
|
// 是否删除 = 0,
|
|
|
|
|
// 危品分类 = x.DangerClass,
|
|
|
|
|
// //危 = x.DangerAttn,
|
|
|
|
|
// 危险品标签 = x.DangerLabel,
|
|
|
|
|
// 危险页码 = x.DangerNo,
|
|
|
|
|
// 危险品编号 = x.DangerPage,
|
|
|
|
|
// 应急联系电话 = x.DangerTel,
|
|
|
|
|
// 设置温度 = x.TemperatureSet,
|
|
|
|
|
// 最高温度 = x.TemperatureMax,
|
|
|
|
|
// 最低温度 = x.TemperatureMin,
|
|
|
|
|
// 设置单位 = x.TemperatureUnit,
|
|
|
|
|
// 通风设置 = x.ReeferQuantity,
|
|
|
|
|
|
|
|
|
|
// }).ToListAsync();
|
|
|
|
|
|
|
|
|
|
// model.List = data;
|
|
|
|
|
// //MemoryStream ms = new();
|
|
|
|
|
// await MiniExcel.SaveAsByTemplateAsync(savePath, path, model);
|
|
|
|
|
// //string base64Str = Convert.ToBase64String(ms.ToArray());
|
|
|
|
|
// //ms.Dispose();
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 海运出口订单集装箱信息导出-分单
|
|
|
|
|
/// </summary>
|
|
|
|
|
public async Task SeaExportExportPartCtn()
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
|
|
|
|
|
string path = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单集装箱信息.xlsx");
|
|
|
|
|
FileInfo templateFile = new(path);
|
|
|
|
|
if (!templateFile.Exists)
|
|
|
|
|
{
|
|
|
|
|
var ex = new ApplicationException("未能在下列路径找到模板文件:" + path);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
var model = new MainCtns();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string savePath = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单集装箱信息-分单 " + NumUtil.GetNo() + ".xlsx");
|
|
|
|
|
var ctnpriceList = await tenantDb.Queryable<BusinessCtnPrice>().Filter(null, true).ToListAsync();
|
|
|
|
|
var contactList = await tenantDb.Queryable<BusinessOrderContact>().Filter(null, true).Where(x => x.CustomerType == "controller").ToListAsync();
|
|
|
|
|
|
|
|
|
|
var data = await tenantDb.Queryable<SeaExportBillManageCtn>().Filter(null, true).Where(x => !x.Deleted)
|
|
|
|
|
.InnerJoin<SeaExportBillManage>((x, y) => x.Pid == y.Id )
|
|
|
|
|
.Select((x, y) => new ZySeaExportCtnInfo
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
订单编号 = y.MBLNO,
|
|
|
|
|
箱型 = x.Ctn,
|
|
|
|
|
箱号 = x.CntrNo,
|
|
|
|
|
箱量 = x.CtnNum,
|
|
|
|
|
箱封号 = x.SealNo,
|
|
|
|
|
件数 = x.PKGS,
|
|
|
|
|
包装 = x.KindPkgsName,
|
|
|
|
|
体积 = x.CBM,
|
|
|
|
|
//VGM重量 = x.WeightKGS,
|
|
|
|
|
毛重 = x.KGS,
|
|
|
|
|
箱重 = x.TareWeight,
|
|
|
|
|
创建者 = x.CreateUserName,
|
|
|
|
|
更新者 = x.UpdateUserName,
|
|
|
|
|
创建时间 = x.CreateTime,
|
|
|
|
|
更新时间 = x.UpdateTime,
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
model.List = data;
|
|
|
|
|
//MemoryStream ms = new();
|
|
|
|
|
await MiniExcel.SaveAsByTemplateAsync(savePath, path, model);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///// <summary>
|
|
|
|
|
///// 海运出口订单订舱信息导出-分单
|
|
|
|
|
///// </summary>
|
|
|
|
|
//public async Task SeaExportExportPartBook()
|
|
|
|
|
//{
|
|
|
|
|
// var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
|
|
|
|
|
// string path = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单订舱信息.xlsx");
|
|
|
|
|
// FileInfo templateFile = new(path);
|
|
|
|
|
// if (!templateFile.Exists)
|
|
|
|
|
// {
|
|
|
|
|
// var ex = new ApplicationException("未能在下列路径找到模板文件:" + path);
|
|
|
|
|
// throw ex;
|
|
|
|
|
// }
|
|
|
|
|
// var model = new MainBooks();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// string savePath = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单订舱信息" + NumUtil.GetNo() + ".xlsx");
|
|
|
|
|
// var ctnpriceList = await tenantDb.Queryable<BusinessCtnPrice>().Filter(null, true).ToListAsync();
|
|
|
|
|
// var contactList = await tenantDb.Queryable<BusinessOrderContact>().Filter(null, true).Where(x => x.CustomerType == "controller").ToListAsync();
|
|
|
|
|
|
|
|
|
|
// var data = await tenantDb.Queryable<SeaExport>().Filter(null, true).Where(x => !x.Deleted && x.IsRefund == false && x.IsChangeETD == false)
|
|
|
|
|
// .Select(x => new ZySeaExportBookInfo
|
|
|
|
|
// {
|
|
|
|
|
// Id = x.Id,
|
|
|
|
|
// 订单编号 = x.MBLNO,
|
|
|
|
|
// 订舱号 = x.BookingNo,
|
|
|
|
|
// 船名 = x.Vessel,
|
|
|
|
|
// 航次 = x.Voyno,
|
|
|
|
|
// 运输条款 = x.Service,
|
|
|
|
|
// 船公司 = x.Carrier,
|
|
|
|
|
// 约号 = x.ContractNo,
|
|
|
|
|
// 签单方式 = x.IssueType,
|
|
|
|
|
// 签单份数 = x.NoBill,
|
|
|
|
|
// 签发地 = x.IssuePlace,
|
|
|
|
|
// 签发时间 = x.IssueDate,
|
|
|
|
|
// 订舱代理 = x.Forwarder,
|
|
|
|
|
// 海外代理 = x.Agent,
|
|
|
|
|
// 开港时间 = x.ETD,
|
|
|
|
|
// 截港时间 = x.ClosingDate,
|
|
|
|
|
// 截单时间 = x.CloseDocDate,
|
|
|
|
|
// 船代 = x.ShipAgency,
|
|
|
|
|
// 场站联系人 = x.YardATTN,
|
|
|
|
|
// 场站联系电话 = x.YardTel,
|
|
|
|
|
// 场站 = x.Yard,
|
|
|
|
|
// 箱使需求 = x.ApplyCtnRemark,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 创建者 = x.CreateUserName,
|
|
|
|
|
// 创建时间 = x.CreateTime,
|
|
|
|
|
// 更新者 = x.UpdateUserName,
|
|
|
|
|
// 更新时间 = x.UpdateTime,
|
|
|
|
|
// 是否删除 = 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }).ToListAsync();
|
|
|
|
|
|
|
|
|
|
// model.List = data;
|
|
|
|
|
// //MemoryStream ms = new();
|
|
|
|
|
// await MiniExcel.SaveAsByTemplateAsync(savePath, path, model);
|
|
|
|
|
// //string base64Str = Convert.ToBase64String(ms.ToArray());
|
|
|
|
|
// //ms.Dispose();
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 海运出口订单费用信息导出-分单
|
|
|
|
|
/// </summary>
|
|
|
|
|
public async Task SeaExportExportPartFee()
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
|
|
|
|
|
string path = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单费用信息.xlsx");
|
|
|
|
|
FileInfo templateFile = new(path);
|
|
|
|
|
if (!templateFile.Exists)
|
|
|
|
|
{
|
|
|
|
|
var ex = new ApplicationException("未能在下列路径找到模板文件:" + path);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
var model = new MainFees();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string savePath = Path.Combine(hostEnvironment.WebRootPath, "templates", "订单费用信息-分单 " + NumUtil.GetNo() + ".xlsx");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var data = await tenantDb.Queryable<FeeRecord>().Filter(null, true).Where(x => !x.Deleted)
|
|
|
|
|
.InnerJoin<SeaExportBillManage>((x, y) => x.BusinessId == y.Id )
|
|
|
|
|
.Select((x, y) => new ZySeaExportFeeInfo
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
订单编号 = y.MBLNO,
|
|
|
|
|
费用名称 = x.FeeName,
|
|
|
|
|
结算单位 = x.CustomerName,
|
|
|
|
|
费用类型 = x.FeeType == FeeType.Receivable ? 215 : 214,
|
|
|
|
|
币种 = x.Currency,
|
|
|
|
|
数量 = x.Quantity,
|
|
|
|
|
单位 = x.UnitText,
|
|
|
|
|
单价 = x.UnitPrice,
|
|
|
|
|
总价 = x.Amount,
|
|
|
|
|
|
|
|
|
|
创建者 = x.CreateUserName,
|
|
|
|
|
更新者 = x.UpdateUserName,
|
|
|
|
|
创建时间 = x.CreateTime,
|
|
|
|
|
更新时间 = x.UpdateTime,
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
model.List = data;
|
|
|
|
|
//MemoryStream ms = new();
|
|
|
|
|
await MiniExcel.SaveAsByTemplateAsync(savePath, path, model);
|
|
|
|
|
//string base64Str = Convert.ToBase64String(ms.ToArray());
|
|
|
|
|
//ms.Dispose();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|