打印模块优化 实现分单文件命名

dev
cjy 4 weeks ago
parent 3367d57a0a
commit d15b4af381

@ -16,6 +16,11 @@ namespace DS.WMS.PrintApi.Model
[SugarColumn(IsPrimaryKey = true, ColumnDescription = "主键ID")] [SugarColumn(IsPrimaryKey = true, ColumnDescription = "主键ID")]
public long Id { get; set; } public long Id { get; set; }
/// <summary> /// <summary>
/// 打印模块唯一编码
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "打印模块唯一编码", IsNullable = false, Length = 100)]
public string ModuleCode { get; set; }
/// <summary>
/// 打印模块Id /// 打印模块Id
/// </summary> /// </summary>
public long ModuleId { get; set; } public long ModuleId { get; set; }

@ -395,8 +395,10 @@ namespace DS.WMS.PrintApi.Service
{ {
fileName = template.NamingRule; fileName = template.NamingRule;
var id = sugarParams.Where(x => x.ParameterName.ToLower() == "@id").FirstOrDefault().Value; var id = sugarParams.Where(x => x.ParameterName.ToLower() == "@id").FirstOrDefault().Value;
if (id != null) { if (template.ModuleCode == "sea_freight_f_export")//主单
{
if (id != null)
{
var info = tenantDb.Queryable<dynamic>().AS("op_sea_export").Where("id=@id", new { id = id }).First(); var info = tenantDb.Queryable<dynamic>().AS("op_sea_export").Where("id=@id", new { id = id }).First();
if (fileName.Contains("[委托编号]")) if (fileName.Contains("[委托编号]"))
{ {
@ -407,6 +409,30 @@ namespace DS.WMS.PrintApi.Service
fileName = fileName.Replace("[提单号]", info.MBLNO); fileName = fileName.Replace("[提单号]", info.MBLNO);
} }
} }
}
else if (template.ModuleCode == "sea_freight_c_export") //分单
{
if (id != null)
{
var info = tenantDb.Queryable<dynamic>().AS("op_sea_export_billmanage").Where("id=@id", new { id = id }).First();
if (fileName.Contains("[委托编号]"))
{
fileName = fileName.Replace("[委托编号]", info.CustomerNo);
}
if (fileName.Contains("[提单号]"))
{
fileName = fileName.Replace("[提单号]", info.MBLNO);
}
if (fileName.Contains("[分提单号]"))
{
fileName = fileName.Replace("[分提单号]", info.HBLNO);
}
}
}
} }
if (string.IsNullOrEmpty(fileName)) if (string.IsNullOrEmpty(fileName))
fileName = DateTime.Now.Ticks + "-" + NumUtil.GetRandomString(3); fileName = DateTime.Now.Ticks + "-" + NumUtil.GetRandomString(3);

Loading…
Cancel
Save