diff --git a/ds-wms-service/DS.WMS.PrintApi/Model/SysPrintTemplate.cs b/ds-wms-service/DS.WMS.PrintApi/Model/SysPrintTemplate.cs index 64bb2986..fc7185ac 100644 --- a/ds-wms-service/DS.WMS.PrintApi/Model/SysPrintTemplate.cs +++ b/ds-wms-service/DS.WMS.PrintApi/Model/SysPrintTemplate.cs @@ -16,6 +16,11 @@ namespace DS.WMS.PrintApi.Model [SugarColumn(IsPrimaryKey = true, ColumnDescription = "主键ID")] public long Id { get; set; } /// + /// 打印模块唯一编码 + /// + [SqlSugar.SugarColumn(ColumnDescription = "打印模块唯一编码", IsNullable = false, Length = 100)] + public string ModuleCode { get; set; } + /// /// 打印模块Id /// public long ModuleId { get; set; } diff --git a/ds-wms-service/DS.WMS.PrintApi/Service/OpenPrintService.cs b/ds-wms-service/DS.WMS.PrintApi/Service/OpenPrintService.cs index 9ee9e417..b2b58713 100644 --- a/ds-wms-service/DS.WMS.PrintApi/Service/OpenPrintService.cs +++ b/ds-wms-service/DS.WMS.PrintApi/Service/OpenPrintService.cs @@ -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().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().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().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);