1
Huangxiaoqiang-03
2024-11-04 fe941b73b9496f6cfab1a8957f319f74ea09fe1d
代码管理/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,6 +19,8 @@
    {
        public void AddLocationStatusChangeRecord(Dt_LocationInfo locationInfo, int lastStatus, int changeType, string? orderNo, int? taskNum)
        {
            try
            {
            Dt_LocationStatusChangeRecord locationStatusChangeRecord = new Dt_LocationStatusChangeRecord()
            {
                AfterStatus = locationInfo.LocationStatus,
@@ -25,13 +29,22 @@
                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,
            };
            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++)
@@ -54,5 +67,25 @@
            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);
            }
        }
    }
}