From fe941b73b9496f6cfab1a8957f319f74ea09fe1d Mon Sep 17 00:00:00 2001 From: Huangxiaoqiang-03 <1247017146@qq.com> Date: 星期一, 04 十一月 2024 17:34:32 +0800 Subject: [PATCH] 1 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordSetvice.cs | 87 ++++++++++++++++++++++++++++++------------- 1 files changed, 60 insertions(+), 27 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordSetvice.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordSetvice.cs" index 2655e77..7c98f6b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordSetvice.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordSetvice.cs" @@ -4,8 +4,10 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using WIDESEA_Core; using WIDESEA_Core.BaseServices; using WIDESEA_Core.DB; +using WIDESEA_Core.Enums; using WIDESEA_Core.Seed; using WIDESEA_IRecordRepository; using WIDESEA_IRecordService; @@ -17,42 +19,73 @@ { public void AddLocationStatusChangeRecord(Dt_LocationInfo locationInfo, int lastStatus, int changeType, string? orderNo, int? taskNum) { - Dt_LocationStatusChangeRecord locationStatusChangeRecord = new Dt_LocationStatusChangeRecord() + try { - AfterStatus = locationInfo.LocationStatus, - BeforeStatus = lastStatus, - ChangeType = changeType, - LocationCode = locationInfo.LocationCode, - LocationId = locationInfo.Id, - TaskNum = taskNum, - OrderNo = orderNo ?? "" - }; - - BaseDal.AddData(locationStatusChangeRecord); - } - - public void AddLocationStatusChangeRecord(List<Dt_LocationInfo> locationInfos, int newStatus, int changeType, string? orderNo, List<int>? taskNums) - { - List< Dt_LocationStatusChangeRecord > records = new List<Dt_LocationStatusChangeRecord> (); - for (int i = 0; i < locationInfos.Count; i++) - { - Dt_LocationInfo locationInfo = locationInfos[i]; - int? taskNum = (taskNums != null && taskNums.Count > 0 && taskNums.Count == locationInfos.Count) ? taskNums[i] : null; Dt_LocationStatusChangeRecord locationStatusChangeRecord = new Dt_LocationStatusChangeRecord() { - AfterStatus = newStatus, - BeforeStatus = locationInfo.LocationStatus, + AfterStatus = locationInfo.LocationStatus, + BeforeStatus = lastStatus, ChangeType = changeType, LocationCode = locationInfo.LocationCode, LocationId = locationInfo.Id, TaskNum = taskNum, - OrderNo = orderNo ?? "" + OrderNo = orderNo ?? "", + Creater = App.User.UserId == 0 ? "" : "WCS", + CreateDate = App.User.UserId == 0 ? DateTime.Now : DateTime.Now, }; - records.Add(locationStatusChangeRecord); - } - - BaseDal.AddData(records); + BaseDal.AddData(locationStatusChangeRecord); + } + catch (Exception ex) + { + throw new Exception($"{ex.Message}"); + } + } + + public void AddLocationStatusChangeRecord(List<Dt_LocationInfo> locationInfos, int newStatus, int changeType, string? orderNo, List<int>? taskNums) + { + try + { + List<Dt_LocationStatusChangeRecord> records = new List<Dt_LocationStatusChangeRecord>(); + for (int i = 0; i < locationInfos.Count; i++) + { + Dt_LocationInfo locationInfo = locationInfos[i]; + int? taskNum = (taskNums != null && taskNums.Count > 0 && taskNums.Count == locationInfos.Count) ? taskNums[i] : null; + Dt_LocationStatusChangeRecord locationStatusChangeRecord = new Dt_LocationStatusChangeRecord() + { + AfterStatus = newStatus, + BeforeStatus = locationInfo.LocationStatus, + ChangeType = changeType, + LocationCode = locationInfo.LocationCode, + LocationId = locationInfo.Id, + TaskNum = taskNum, + OrderNo = orderNo ?? "" + }; + records.Add(locationStatusChangeRecord); + } + + + BaseDal.AddData(records); + } + catch (Exception ex) + { + throw new Exception($"{ex.Message}"); + } + } + + public WebResponseContent GetLocationState(int id) + { + WebResponseContent content = new WebResponseContent(); + try + { + List<Dt_LocationStatusChangeRecord> location=BaseDal.QueryData(x=>x.LocationId== id).ToList(); + + return content = WebResponseContent.Instance.OK(data: location); + } + catch (Exception ex) + { + return content = WebResponseContent.Instance.Error(ex.Message); + } } } } -- Gitblit v1.9.3