From 617bb206dca60967dfd04e2bdcc2303714f6b665 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期二, 05 三月 2024 09:34:04 +0800 Subject: [PATCH] 收料通知单的 源单类型的下拉框, 改为 根据 Xt_BillSourceSet 表来 动态加载; 注意 源单类型 的名称 根据字段 HSourceBillType varchar(10) 的源单类型编码 到 xt_BillType表 来 获取 源单名称; 并且测试 点击 选 源单,是否会 跳转 至对应的源单列表; 注意 始终以 单据类型编码为准, 单据类型名称 每个客户都有可能会修改; 程序里 以 编码为判断依据 --- WebAPI/LogService.cs | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-) diff --git a/WebAPI/LogService.cs b/WebAPI/LogService.cs index 7762f83..113cc0d 100644 --- a/WebAPI/LogService.cs +++ b/WebAPI/LogService.cs @@ -69,5 +69,47 @@ } } #endregion + + #region 鑷畾涔夋枃浠跺悕 + public static void CustomWriteLog(object obj, string FileName, string filePath = "Vlog" , bool isAppend = true) + { + try + { + lock (lockObj) + { + filePath = $@"{filePath}\{FileName}.txt"; + + filePath = AppDomain.CurrentDomain.BaseDirectory + filePath; + + if (!System.IO.Directory.Exists(Path.GetDirectoryName(filePath))) + { + System.IO.Directory.CreateDirectory(Path.GetDirectoryName(filePath)); + } + + bool fileExists = System.IO.File.Exists(filePath); + //涓嶅瓨鍦� 鍒欏垱寤鸿鏂囦欢 + if (!fileExists) + { + System.IO.File.Create(filePath).Close(); + } + + using (StreamWriter writer = new StreamWriter(filePath, isAppend)) + { + //瀛樺湪鐨勬椂鍊欐墠鍐欎竴琛� + if (fileExists && isAppend) + { + writer.WriteLine(); + } + + var content = obj is string ? obj : JsonConvert.SerializeObject(obj); + writer.WriteLine($"{DateTime.Now} {content}"); + } + } + } + catch (Exception ex) + { + } + } + #endregion } } -- Gitblit v1.9.1