From a220689a643d52604fd1fb391618fa2d79a5db74 Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期一, 16 六月 2025 16:15:59 +0800 Subject: [PATCH] 2.增加PNL二维码烧蚀位置提取上传接口(递入PNL条码编号、x坐标、y坐标,更新PNL条码编号对应PNL布局信息中的PNL二维码位置x坐标、y坐标) 3.PNL二维码烧蚀位置加载接口(递入PNL条码编号,获取PNL条码编号对应PNL布局信息中的PNL二维码位置x坐标、y坐标) 4.增加Set二维码烧蚀位置提取上传接口(递入set条码编号、x坐标、y坐标,更新set条码编号对应PNL布局信息中的set二维码位置x坐标、y坐标) 5.Set二维码烧蚀位置加载接口(递入set条码编号,获取set条码编号对应PNL布局信息中的PNL二维码位置x坐标、y坐标) --- 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