647556386
4 天以前 91ead18d0e92b6e1ed916c5159f3431bf2071a56
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_RecordService/LocationStatusChangeRecordService.cs
@@ -1,5 +1,7 @@
锘縰sing WIDESEA_Core.BaseRepository;
锘縰sing WIDESEA_Common.LocationEnum;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Helper;
using WIDESEA_IRecordService;
using WIDESEA_Model.Models;
@@ -30,6 +32,36 @@
            BaseDal.AddData(locationStatusChangeRecord);
        }
        public void AddLocationStatusChangeRecord(List<Dt_LocationInfo> locationInfos, LocationStatusEnum newStatus, LocationChangeType changeType, string? orderNo = null, List<int>? taskNums = null)
        {
            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.ObjToInt(),
                        BeforeStatus = locationInfo.LocationStatus,
                        ChangeType = changeType.ObjToInt(),
                        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 void AddLocationStatusChangeRecord(List<Dt_LocationInfo> locationInfos, int newStatus, int changeType, string? orderNo, List<int>? taskNums)
        {
            List<Dt_LocationStatusChangeRecord> records = new List<Dt_LocationStatusChangeRecord>();