using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using WIDESEA_Core.BaseRepository;
|
using WIDESEA_Core.Enums;
|
using WIDESEA_Core;
|
using WIDESEA_IBasicService;
|
using WIDESEA_Model.Models;
|
using WIDESEA_Core.Helper;
|
|
namespace WIDESEA_BasicService
|
{
|
public class BasicService : IBasicService
|
{
|
public IAreaInfoService AreaInfoService { get; }
|
|
public ILocationInfoService LocationInfoService { get; }
|
|
public IMaterielInfoService MaterielInfoService { get; }
|
|
public IRoadwayInfoService RoadwayInfoService { get; }
|
|
public IWarehouseService WarehouseService { get; }
|
|
public IAreaRouterService AreaRouterService { get; }
|
|
public ICachePointService CachePointService { get; }
|
|
public BasicService(IAreaInfoService areaInfoService, ILocationInfoService locationInfoService, IMaterielInfoService materielInfoService, IRoadwayInfoService roadwayInfoService, IWarehouseService warehouseService, IAreaRouterService areaRouterService, ICachePointService cachePointService)
|
{
|
AreaInfoService = areaInfoService;
|
LocationInfoService = locationInfoService;
|
MaterielInfoService = materielInfoService;
|
RoadwayInfoService = roadwayInfoService;
|
WarehouseService = warehouseService;
|
AreaRouterService = areaRouterService;
|
CachePointService = cachePointService;
|
}
|
|
#region AreaInfo
|
public WebResponseContent AreaEnableStatus(int[] keys)
|
{
|
List<Dt_AreaInfo> areaInfos = AreaInfoService.Repository.QueryData(x => keys.Contains(x.Id));
|
areaInfos.ForEach(x =>
|
{
|
x.AreaStatus = EnableEnum.Enable.ObjToInt();
|
});
|
AreaInfoService.Repository.UpdateData(areaInfos);
|
|
return WebResponseContent.Instance.OK();
|
}
|
|
public WebResponseContent AreaDisableStatus(int[] keys)
|
{
|
List<Dt_AreaInfo> areaInfos = AreaInfoService.Repository.QueryData(x => keys.Contains(x.Id));
|
areaInfos.ForEach(x =>
|
{
|
x.AreaStatus = EnableEnum.Disable.ObjToInt();
|
});
|
AreaInfoService.Repository.UpdateData(areaInfos);
|
|
return WebResponseContent.Instance.OK();
|
}
|
|
public WebResponseContent AreaEnableStatus(int key)
|
{
|
return AreaEnableStatus(new int[] { key });
|
}
|
|
public WebResponseContent AreaDisableStatus(int key)
|
{
|
return AreaDisableStatus(new int[] { key });
|
}
|
#endregion
|
|
#region CachePoint
|
public WebResponseContent CachePointEnableStatus(int[] keys)
|
{
|
List<Dt_CachePoint> cachePoints = CachePointService.Repository.QueryData(x => keys.Contains(x.Id));
|
cachePoints.ForEach(x =>
|
{
|
x.EnableStatus = EnableEnum.Enable.ObjToInt();
|
});
|
CachePointService.Repository.UpdateData(cachePoints);
|
|
return WebResponseContent.Instance.OK();
|
}
|
|
public WebResponseContent CachePointDisableStatus(int[] keys)
|
{
|
List<Dt_CachePoint> cachePoints = CachePointService.Repository.QueryData(x => keys.Contains(x.Id));
|
cachePoints.ForEach(x =>
|
{
|
x.EnableStatus = EnableEnum.Disable.ObjToInt();
|
});
|
CachePointService.Repository.UpdateData(cachePoints);
|
|
return WebResponseContent.Instance.OK();
|
}
|
|
public WebResponseContent CachePointEnableStatus(int key)
|
{
|
return CachePointEnableStatus(new int[] { key });
|
}
|
|
public WebResponseContent CachePointDisableStatus(int key)
|
{
|
return CachePointDisableStatus(new int[] { key });
|
}
|
#endregion
|
|
#region LocationInfo
|
public WebResponseContent LocationEnableStatus(int[] keys)
|
{
|
List<Dt_LocationInfo> locationInfos = LocationInfoService.Repository.QueryData(x => keys.Contains(x.Id));
|
locationInfos.ForEach(x =>
|
{
|
x.EnableStatus = EnableEnum.Enable.ObjToInt();
|
});
|
LocationInfoService.Repository.UpdateData(locationInfos);
|
|
return WebResponseContent.Instance.OK();
|
}
|
|
public WebResponseContent LocationDisableStatus(int[] keys)
|
{
|
List<Dt_LocationInfo> locationInfos = LocationInfoService.Repository.QueryData(x => keys.Contains(x.Id));
|
locationInfos.ForEach(x =>
|
{
|
x.EnableStatus = EnableEnum.Disable.ObjToInt();
|
});
|
LocationInfoService.Repository.UpdateData(locationInfos);
|
|
return WebResponseContent.Instance.OK();
|
}
|
|
public WebResponseContent LocationEnableStatus(int key)
|
{
|
return LocationEnableStatus(new int[] { key });
|
}
|
|
public WebResponseContent LocationDisableStatus(int key)
|
{
|
return LocationDisableStatus(new int[] { key });
|
}
|
#endregion
|
|
#region RoadwayInfo
|
public WebResponseContent RoadwayEnableStatus(int[] keys)
|
{
|
List<Dt_RoadwayInfo> roadwayInfos = RoadwayInfoService.Repository.QueryData(x => keys.Contains(x.Id));
|
roadwayInfos.ForEach(x =>
|
{
|
x.EnableStatus = EnableEnum.Enable.ObjToInt();
|
});
|
RoadwayInfoService.Repository.UpdateData(roadwayInfos);
|
|
return WebResponseContent.Instance.OK();
|
}
|
|
public WebResponseContent RoadwayDisableStatus(int[] keys)
|
{
|
List<Dt_RoadwayInfo> roadwayInfos = RoadwayInfoService.Repository.QueryData(x => keys.Contains(x.Id));
|
roadwayInfos.ForEach(x =>
|
{
|
x.EnableStatus = EnableEnum.Disable.ObjToInt();
|
});
|
RoadwayInfoService.Repository.UpdateData(roadwayInfos);
|
|
return WebResponseContent.Instance.OK();
|
}
|
|
public WebResponseContent RoadwayEnableStatus(int key)
|
{
|
return RoadwayEnableStatus(new int[] { key });
|
}
|
|
public WebResponseContent RoadwayDisableStatus(int key)
|
{
|
return RoadwayDisableStatus(new int[] { key });
|
}
|
#endregion
|
|
#region Warehouse
|
public WebResponseContent WarehouseEnableStatus(int[] keys)
|
{
|
List<Dt_Warehouse> warehouses = WarehouseService.Repository.QueryData(x => keys.Contains(x.Id));
|
warehouses.ForEach(x =>
|
{
|
x.WarehouseStatus = EnableEnum.Enable.ObjToInt();
|
});
|
WarehouseService.Repository.UpdateData(warehouses);
|
|
return WebResponseContent.Instance.OK();
|
}
|
|
public WebResponseContent WarehouseDisableStatus(int[] keys)
|
{
|
List<Dt_Warehouse> warehouses = WarehouseService.Repository.QueryData(x => keys.Contains(x.Id));
|
warehouses.ForEach(x =>
|
{
|
x.WarehouseStatus = EnableEnum.Disable.ObjToInt();
|
});
|
WarehouseService.Repository.UpdateData(warehouses);
|
|
return WebResponseContent.Instance.OK();
|
}
|
|
public WebResponseContent WarehouseEnableStatus(int key)
|
{
|
return WarehouseEnableStatus(new int[] { key });
|
}
|
|
public WebResponseContent WarehouseDisableStatus(int key)
|
{
|
return WarehouseDisableStatus(new int[] { key });
|
}
|
#endregion
|
}
|
}
|