namespace IStation.Application
|
{
|
/// <summary>
|
/// 陈行输水调度配置
|
/// </summary>
|
[AllowAnonymous]
|
[Route("OpenApi/Dispatch/Config")]
|
[ApiDescriptionSettings("Schedule", Name = "输水调度", Order = 1)]
|
public class ScheduleConfig_Controller : IDynamicApiController, ITransient
|
{
|
private readonly Service.ScheduleConfig _service_schedule_config = new();
|
|
/// <summary>
|
/// 获取陈行调度配置
|
/// </summary>
|
[Route("Get")]
|
[HttpGet]
|
[NonUnify]
|
public ChScheduleConfigDto Get()
|
{
|
var model = _service_schedule_config.Get();
|
var dto = model.Adapt<Model.ChScheduleConfig, ChScheduleConfigDto>();
|
return dto;
|
}
|
|
|
/// <summary>
|
/// 保存陈行调度配置
|
/// </summary>
|
[AllowAnonymous]
|
[Route("Save")]
|
[HttpPost]
|
[NonUnify]
|
public SaveChScheduleConfigOutput Save([Required] ChScheduleConfigInput input)
|
{
|
if (input == null)
|
{
|
return new SaveChScheduleConfigOutput() { Result = false, Msg = "入参不能为空!" };
|
}
|
|
var receipt_time = DateTime.Now;
|
var request_id = Yw.YitIdHelper.NextId();
|
var log_title = "调度配置";
|
Log.Info(request_id, log_title, "更新配置!");
|
Log.Debug(request_id, log_title, JsonHelper.Object2Json(input));
|
|
var model = input.Adapt<ChScheduleConfigInput, Model.ChScheduleConfig>();
|
var bol = _service_schedule_config.Save(model);
|
Log.Info(request_id, log_title, bol.ToString());
|
return new SaveChScheduleConfigOutput() { Result = true, Msg = "保存成功!" };
|
}
|
|
|
|
/// <summary>
|
/// Test
|
/// </summary>
|
[Route("Test")]
|
[HttpGet]
|
[NonUnify]
|
public ChScheduleConfigDto Test()
|
{
|
var model = _service_schedule_config.Get();
|
model.Station1.MustOpenFlagList = new List<int>() { 11, 12 };
|
model.Station1.MustCloseFlagList = new List<int>() { 13 };
|
model.Station1.AssociativeFlagCombineList = new List<List<int>>()
|
{
|
new List<int>(){14,15}
|
};
|
model.Station1.WaterSupplyLimitList = new List<IStation.Model.WaterSupplyLimit>()
|
{
|
new Model.WaterSupplyLimit()
|
{
|
Min=10500,
|
Max=15000,
|
PumpCount=3
|
},
|
new Model.WaterSupplyLimit()
|
{
|
Min=15500,
|
Max=20000,
|
PumpCount=4
|
},
|
new Model.WaterSupplyLimit()
|
{
|
Min=20000,
|
Max=27000,
|
PumpCount=5
|
},
|
};
|
var dto = model.Adapt<Model.ChScheduleConfig, ChScheduleConfigDto>();
|
return dto;
|
}
|
}
|
}
|