ningshuxia
2024-06-18 e83dca6e861b622b54d3392ca0d3f1f1eb69f7c9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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;
        }
    }
}