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

dev
cjy 3 weeks ago
parent 3367d57a0a
commit d15b4af381

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

@ -394,19 +394,45 @@ namespace DS.WMS.PrintApi.Service
if (!string.IsNullOrEmpty(template.NamingRule))
{
fileName = template.NamingRule;
var id = sugarParams.Where(x=>x.ParameterName.ToLower()=="@id").FirstOrDefault().Value;
if (id != null) {
var info = tenantDb.Queryable<dynamic>().AS("op_sea_export").Where("id=@id", new { id = id }).First();
if (fileName.Contains("[委托编号]"))
{
fileName = fileName.Replace("[委托编号]", info.CustomerNo);
var id = sugarParams.Where(x => x.ParameterName.ToLower() == "@id").FirstOrDefault().Value;
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();
if (fileName.Contains("[委托编号]"))
{
fileName = fileName.Replace("[委托编号]", info.CustomerNo);
}
if (fileName.Contains("[提单号]"))
{
fileName = fileName.Replace("[提单号]", info.MBLNO);
}
}
if (fileName.Contains("[提单号]"))
}
else if (template.ModuleCode == "sea_freight_c_export") //分单
{
if (id != null)
{
fileName = fileName.Replace("[提单号]", info.MBLNO);
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))
fileName = DateTime.Now.Ticks + "-" + NumUtil.GetRandomString(3);

Loading…
Cancel
Save