| | |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.CommonEnum; |
| | |
| | | |
| | | public override WebResponseContent AddData(SaveModel saveModel) |
| | | { |
| | | saveModel.MainData.Add(nameof(Dt_LocationInfo.EnableStatus), EnableStatusEnum.Normal.ObjToInt()); |
| | | saveModel.MainData.Add(nameof(Dt_LocationInfo.LocationStatus), LocationStatusEnum.Free.ObjToInt()); |
| | | Dt_LocationInfo locationInfo = saveModel.MainData.DicToModel<Dt_LocationInfo>(); |
| | | locationInfo.LocationCode = $"R{locationInfo.RoadwayNo.PadLeft(2, '0')}-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(3, '0')}-{locationInfo.Depth.ToString().PadLeft(2, '0')}"; |
| | | locationInfo.LocationName = $"R{locationInfo.RoadwayNo.PadLeft(2, '0')}å··é{locationInfo.Row.ToString().PadLeft(3, '0')}è¡{locationInfo.Column.ToString().PadLeft(3, '0')}å{locationInfo.Layer.ToString().PadLeft(3, '0')}å±{locationInfo.Depth.ToString().PadLeft(2, '0')}æ·±"; |
| | | |
| | | return base.AddData(locationInfo); |
| | | } |
| | | |
| | |
| | | return LocationDisableStatus(new int[] { key }); |
| | | } |
| | | |
| | | public WebResponseContent GetLocationStatusDic() |
| | | { |
| | | try |
| | | { |
| | | List<object> data = new List<object>(); |
| | | Type type = typeof(LocationStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(LocationStatusEnum)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(LocationStatusEnum).GetField(((LocationStatusEnum)item).ToString()); |
| | | if (fieldInfo != null) |
| | | { |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | | data.Add(new { value = item.ToString(), label = description.Description }); |
| | | } |
| | | else |
| | | { |
| | | data.Add(new { value = item.ToString(), label = item.ToString() }); |
| | | } |
| | | } |
| | | } |
| | | return WebResponseContent.Instance.OK(data: data); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return WebResponseContent.Instance.Error(e.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | public WebResponseContent UpdateLocationStatus(int key, int locationStatus) |
| | | { |
| | | try |
| | | { |
| | | Dt_LocationInfo locationInfo = Repository.QueryFirst(x => x.Id == key); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è´§ä½ä¿¡æ¯"); |
| | | } |
| | | locationInfo.LocationStatus = locationStatus; |
| | | Repository.UpdateData(locationInfo); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | public WebResponseContent InitializationLocation(InitializationLocationDTO initializationLocationDTO) |
| | | { |
| | | try |