| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | |
| | | { |
| | | return base.DeleteData(keys); |
| | | } |
| | | public override PageGridData<Dt_LocationInfo> GetPageData(PageDataOptions options) |
| | | { |
| | | return base.GetPageData(options); |
| | | } |
| | | /// <summary> |
| | | /// ä¿®æ¹è´§ä½çç¦ç¨ç¶æ |
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent UpdateEnableStatus(SaveModel saveModel) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => saveModel.DelKeys.Contains(x.Id)); |
| | | var values = Enum.GetValues(typeof(EnableStatusEnum)); |
| | | var Index = saveModel.Extra.ObjToInt(); |
| | | var EnableStatus = (EnableStatusEnum)values.GetValue(Index); |
| | | locationInfos.ForEach(x => |
| | | { |
| | | x.EnableStatus = EnableStatus.ObjToInt(); |
| | | }); |
| | | Repository.UpdateData(locationInfos); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | |
| | | return content; |
| | | } |
| | | public WebResponseContent LocationEnableStatus(int[] keys) |
| | | { |
| | | List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => keys.Contains(x.Id)); |
| | |
| | | return LocationDisableStatus(new int[] { key }); |
| | | } |
| | | |
| | | public WebResponseContent GetLocationCodes() |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //content.OK(_basicRepository.MaterielInfoRepository.Getmaterianame(saveModel).Message, Repository.QueryData(x => x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()).Select(x => x.LocationCode).ToList()); |
| | | content.OK(data: Repository.QueryData(x => x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()).Select(x => x.LocationCode).ToList()); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | public object GetLocationLayer() |
| | | { |
| | | List<object> list = new List<object>(); |
| | | var data = Db.Ado.SqlQuery<LocationArea>(@"SELECT areaName,areaCode,roadwayNo,layer from Dt_AreaInfo as t1 |
| | | INNER JOIN |
| | | ( |
| | | select DISTINCT AreaId,RoadwayNo,Layer from Dt_LocationInfo |
| | | ) as t2 |
| | | on t1.Id=t2.AreaId"); |
| | | foreach (var item in data.GroupBy(t => t.areaName)) |
| | | { |
| | | var obj = new |
| | | { |
| | | areaName = item.Key, |
| | | areaCode = item.Max(x => x.areaCode), |
| | | tunnel = item.Select(t => t.roadwayNo).OrderBy(t => t).Distinct().ToList(), |
| | | Layers = item.Select(t => t.layer).OrderBy(t => t).ToList(), |
| | | }; |
| | | list.Add(obj); |
| | | } |
| | | return list; |
| | | } |
| | | public WebResponseContent InitializationLocation(InitializationLocationDTO initializationLocationDTO) |
| | | { |
| | | try |
| | |
| | | LocationType = LocationTypeEnum.Cube.ObjToInt(), |
| | | RoadwayNo = initializationLocationDTO.Roadway, |
| | | Row = i + 1, |
| | | MaxQty = i == 1 ? 24 : 12, |
| | | MaxQty = 12, |
| | | CurrentQty = 0, |
| | | }; |
| | | |