| | |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IRecordService; |
| | | using WIDESEA_Model.Models; |
| | |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | | /// <param name="baseDal">基础数据访问对象</param> |
| | | public LocationStatusChangeRecordService(IRepository<Dt_LocationStatusChangeRecord> baseDal) : base(baseDal) |
| | | { |
| | | } |
| | |
| | | /// 获取货位状态变更记录仓储接口 |
| | | /// </summary> |
| | | public IRepository<Dt_LocationStatusChangeRecord> Repository => BaseDal; |
| | | |
| | | /// <summary> |
| | | /// 记录货位状态变更。 |
| | | /// </summary> |
| | | public async Task<bool> AddChangeRecordAsync( |
| | | Dt_LocationInfo beforeLocation, |
| | | Dt_LocationInfo afterLocation, |
| | | LocationChangeType changeType, |
| | | int? taskNum = null, |
| | | string? orderNo = null, |
| | | int? orderId = null, |
| | | string? remark = null) |
| | | { |
| | | if (beforeLocation == null || afterLocation == null) |
| | | return false; |
| | | |
| | | if (beforeLocation.LocationStatus == afterLocation.LocationStatus) |
| | | return true; |
| | | |
| | | Dt_LocationStatusChangeRecord record = new Dt_LocationStatusChangeRecord |
| | | { |
| | | LocationId = afterLocation.Id, |
| | | LocationCode = afterLocation.LocationCode, |
| | | BeforeStatus = beforeLocation.LocationStatus, |
| | | AfterStatus = afterLocation.LocationStatus, |
| | | ChangeType = (int)changeType, |
| | | OrderId = orderId, |
| | | OrderNo = orderNo, |
| | | TaskNum = taskNum, |
| | | Remark = remark |
| | | }; |
| | | |
| | | return await BaseDal.AddDataAsync(record) > 0; |
| | | } |
| | | } |
| | | } |