diff --git a/HJGL_DS/BLL/BLL.csproj b/HJGL_DS/BLL/BLL.csproj index 82fcd1f..f884ce4 100644 --- a/HJGL_DS/BLL/BLL.csproj +++ b/HJGL_DS/BLL/BLL.csproj @@ -340,6 +340,7 @@ + diff --git a/HJGL_DS/BLL/WeldMat/UsingSentMat/DtpWebMaterialLabel.cs b/HJGL_DS/BLL/WeldMat/UsingSentMat/DtpWebMaterialLabel.cs new file mode 100644 index 0000000..b6bfc96 --- /dev/null +++ b/HJGL_DS/BLL/WeldMat/UsingSentMat/DtpWebMaterialLabel.cs @@ -0,0 +1,24 @@ +using FineUIPro; +using Newtonsoft.Json; + +namespace BLL +{ + public static class DtpWebMaterialLabel + { + public static void RegisterPrint(string usingMatId) + { + var material = string.IsNullOrEmpty(usingMatId) ? null : UsingMatService.GetUsingMatById(usingMatId); + if (material == null) + { + Alert.Show("未找到对应的焊材领用记录。", MessageBoxIcon.Warning); + return; + } + + var fields = JsonConvert.SerializeObject(UsingMatService.GetMaterialLabelParameters(material), new JsonSerializerSettings + { + StringEscapeHandling = StringEscapeHandling.EscapeHtml + }); + PageContext.RegisterStartupScript("DtpWebMaterialLabel.print(" + fields + ");"); + } + } +} diff --git a/HJGL_DS/BLL/WeldMat/UsingSentMat/UsingMatService.cs b/HJGL_DS/BLL/WeldMat/UsingSentMat/UsingMatService.cs index 9aa1a67..7c31b3a 100644 --- a/HJGL_DS/BLL/WeldMat/UsingSentMat/UsingMatService.cs +++ b/HJGL_DS/BLL/WeldMat/UsingSentMat/UsingMatService.cs @@ -20,6 +20,33 @@ namespace BLL return Funs.DB.Weld_UsingMat.FirstOrDefault(e => e.UsingMatId == usingMatId); } + public static Dictionary GetMaterialLabelParameters(Model.Weld_UsingMat material) + { + var weld = string.IsNullOrEmpty(material?.WeldId) ? null : WeldInfoService.GetWeldInfoById(material.WeldId); + var weldType = string.IsNullOrEmpty(weld?.WeldTypeId) ? null : WeldTypeService.GetWeldTypeById(weld.WeldTypeId); + var welder = string.IsNullOrEmpty(material?.UsingMan) ? null : HJGL_PersonManageService.GetWelderByWenId(material.UsingMan); + var store = string.IsNullOrEmpty(material?.StoreMan) ? null : StoremanInfoService.GetStoremanById(material.StoreMan); + + var number = string.Empty; + if (material?.Amount != null || material?.TwoAmount != null) + { + var amount = material.Amount.GetValueOrDefault() + material.TwoAmount.GetValueOrDefault(); + var unit = weldType?.WeldTypeName == "焊丝" || weldType?.WeldTypeName == "焊条" ? "根" : "Kg"; + number = amount.ToString("0.#") + unit; + } + + var usingDate = material?.UsingDate; + return new Dictionary + { + { "WeldSpec", weld?.WeldSpec ?? string.Empty }, + { "WeldName", weld?.WeldName ?? string.Empty }, + { "WelderName", welder == null ? string.Empty : welder.WED_Name + "(" + welder.WED_Code + ")" }, + { "Number", number }, + { "StoreName", store?.StoreName ?? string.Empty }, + { "UsingDate", usingDate.HasValue ? usingDate.Value.ToShortDateString() + " " + usingDate.Value.ToShortTimeString() : string.Empty } + }; + } + /// /// 添加焊材领用 /// diff --git a/HJGL_DS/FineUIPro.Web/FineUIPro.Web.csproj b/HJGL_DS/FineUIPro.Web/FineUIPro.Web.csproj index 904b250..e1feef2 100644 --- a/HJGL_DS/FineUIPro.Web/FineUIPro.Web.csproj +++ b/HJGL_DS/FineUIPro.Web/FineUIPro.Web.csproj @@ -1577,6 +1577,7 @@ + diff --git a/HJGL_DS/FineUIPro.Web/WeldMat/UsingSentMat/UsingMatCheck.aspx b/HJGL_DS/FineUIPro.Web/WeldMat/UsingSentMat/UsingMatCheck.aspx index 002c995..6701802 100644 --- a/HJGL_DS/FineUIPro.Web/WeldMat/UsingSentMat/UsingMatCheck.aspx +++ b/HJGL_DS/FineUIPro.Web/WeldMat/UsingSentMat/UsingMatCheck.aspx @@ -6,6 +6,7 @@ 领料确认单 +