| | |
| | | List<LookingForBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LookingForBill>>(oMainData); |
| | | //保存人员 |
| | | string saveGroupEmpsql = $"exec h_p_saveGroupEmp '{list[0].HMaker}','{list[0].HGroupID}',{HJiaYe.Split(',')[0]},{HJiaYe.Split(',')[1]},'{HJiaYe}'"; |
| | | LogService.Write(saveGroupEmpsql); |
| | | oCN.RunProc(saveGroupEmpsql); |
| | | oCN.BeginTran(); |
| | | //var mainSql1 = "Insert Into Kf_LookingForReturnBillMain " + |
| | |
| | | //保存人员 |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | string saveGroupEmpsql = $"exec h_p_saveGroupEmp '{lsmain[0].HMaker}','{lsmain[0].HGroupID}',{lsmain[0].HJiaYe.Split(',')[0]},{lsmain[0].HJiaYe.Split(',')[1]},'{lsmain[0].HJiaYe}'"; |
| | | |
| | | LogService.Write(saveGroupEmpsql); |
| | | oCn.RunProc(saveGroupEmpsql); |
| | | |
| | | if (webserver.set_SaveProductInBill_New(websLsmain, sSourceBillType, ref DBUtility.ClsPub.sErrInfo)) |
New file |
| | |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WebAPI |
| | | { |
| | | public class LogService |
| | | { |
| | | private static readonly object lockObj = new object(); |
| | | |
| | | public static void WriteAsync(object obj, string filePath = "Vlog", bool isAppend = true) |
| | | { |
| | | Task.Run(() => |
| | | { |
| | | Write(obj, filePath, isAppend); |
| | | }); |
| | | } |
| | | |
| | | public static void WriteAsync<T>(object obj, string filePath = "Vlog", bool isAppend = true) |
| | | { |
| | | Task.Run(() => |
| | | { |
| | | Write(obj, $@"{filePath}\{typeof(T).Name}", isAppend); |
| | | }); |
| | | } |
| | | |
| | | #region 日志 |
| | | public static void Write(object obj, string filePath = "Vlog", bool isAppend = true) |
| | | { |
| | | try |
| | | { |
| | | lock (lockObj) |
| | | { |
| | | filePath = $@"{filePath}\webapi{DateTime.Now.ToString("yyyyMMdd")}.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 |
| | | } |
| | | } |
| | |
| | | <Compile Include="Dapper\SqlHelper.cs" /> |
| | | <Compile Include="Dapper\SqlPools.cs" /> |
| | | <Compile Include="DbUntil\DataFormatUntil.cs" /> |
| | | <Compile Include="LogService.cs" /> |
| | | <Compile Include="Models\ApiConfig.cs" /> |
| | | <Compile Include="Models\ApiResult.cs" /> |
| | | <Compile Include="Models\DocumentsView.cs" /> |