| | |
| | | config.ForType<Model.PumpCurve, PumpCurveDto>(); |
| | | config.ForType<AddPumpCurveInput, Model.PumpCurve>() |
| | | .Map(dest => dest.CurveInfo, src => src.CurveInfo) |
| | | .Map(dest => dest.CoordParas, src => src.CoordParas); |
| | | .Map(dest => dest.CoordParas, src => src.CoordParas) |
| | | .Map(dest => dest.CreateUserID, src => UserManager.UserID) |
| | | .Map(dest => dest.CreateTime, src => DateTime.Now) |
| | | .Map(dest => dest.CreateUserName, src => UserManager.UserName); |
| | | config.ForType<UpdatePumpCurveInput, Model.PumpCurve>() |
| | | .Map(dest => dest.CurveInfo, src => src.CurveInfo) |
| | | .Map(dest => dest.CoordParas, src => src.CoordParas); |
| | | .Map(dest => dest.CoordParas, src => src.CoordParas) |
| | | .Map(dest => dest.UpdateTime, src => DateTime.Now) |
| | | .Map(dest => dest.UpdateUserID, src => UserManager.UserID) |
| | | .Map(dest => dest.UpdateUserName, src => UserManager.UserName); |
| | | |
| | | |
| | | #endregion |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 3-pump-curve-mapping-extension |
| | | |
| | | config.ForType<AddPumpCurveExMappingInput, Model.PumpCurve>() |
| | | .Map(dest => dest.CurveInfo, src => src.CurveInfo) |
| | | .Map(dest => dest.CoordParas, src => src.CoordParas) |
| | | .Map(dest => dest.CreateUserID, src => UserManager.UserID) |
| | | .Map(dest => dest.CreateTime, src => DateTime.Now) |
| | | .Map(dest => dest.CreateUserName, src => UserManager.UserName); |
| | | |
| | | config.ForType<UpdatePumpCurveExMappingInput, Model.PumpCurve>() |
| | | .Map(dest => dest.CurveInfo, src => src.CurveInfo) |
| | | .Map(dest => dest.CoordParas, src => src.CoordParas) |
| | | .Map(dest => dest.UpdateTime, src => DateTime.Now) |
| | | .Map(dest => dest.UpdateUserID, src => UserManager.UserID) |
| | | .Map(dest => dest.UpdateUserName, src => UserManager.UserName); |
| | | |
| | | config.ForType<AddPumpCurveExMappingInput, Model.PumpCurveMapping>(); |
| | | config.ForType<UpdatePumpCurveExMappingInput, Model.PumpCurveMapping>(); |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | |
| | | /// </summary> |
| | | [Route("Insert@V1.0")] |
| | | [HttpPost] |
| | | public long Insert(AddPumpCurveInput input) |
| | | public long Insert([Required] AddPumpCurveInput input) |
| | | { |
| | | if (input == null) |
| | | return default; |
| | | var model = input.Adapt<AddPumpCurveInput, Model.PumpCurve>(); |
| | | var id = _service.Insert(model); |
| | | return id; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æå
¥å¤æ¡ |
| | | /// </summary> |
| | | [Route("Inserts@V1.0")] |
| | | [HttpPost] |
| | | public bool Inserts(List<AddPumpCurveInput> inputList) |
| | | { |
| | | if (inputList == null || inputList.Count < 1) |
| | | return false; |
| | | var list = inputList.Select(x => x.Adapt<AddPumpCurveInput, Model.PumpCurve>()).ToList(); |
| | | var bol = _service.Inserts(list); |
| | | return bol; |
| | | } |
| | | |
| | | #endregion |
| | |
| | | /// </summary> |
| | | [Route("Update@V1.0")] |
| | | [HttpPut] |
| | | public bool Update(UpdatePumpCurveInput input) |
| | | public bool Update([Required] UpdatePumpCurveInput input) |
| | | { |
| | | if (input == null) |
| | | return false; |
| | | var model = _service.GetByID(input.CorpID, input.ID); |
| | | var model = _service.GetByID(input.ID); |
| | | if (model == null) |
| | | return false; |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, $"ID:{input.ID} æ°æ®ä¸åå¨"); |
| | | } |
| | | var rhs = new Model.PumpCurve(model); |
| | | input.Adapt(rhs); |
| | | var bol = _service.Update(rhs); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°å¤æ¡ |
| | | /// </summary> |
| | | [Route("Updates@V1.0")] |
| | | [HttpPut] |
| | | public bool Updates(List<UpdatePumpCurveInput> inputList) |
| | | { |
| | | if (inputList == null || inputList.Count() < 1) |
| | | { |
| | | return false; |
| | | } |
| | | var corpIds = inputList.Select(x => x.CorpID).Distinct().ToList(); |
| | | if (corpIds.Count > 1) |
| | | return false; |
| | | var modelList = _service.GetByIds(corpIds[0], inputList.Select(x => x.ID).ToList()); |
| | | if (modelList == null || modelList.Count < 1) |
| | | return false; |
| | | var rhsList = new List<Model.PumpCurve>(); |
| | | modelList.ForEach(x => |
| | | { |
| | | var input = inputList.Find(t => t.ID == x.ID); |
| | | if (input != null) |
| | | { |
| | | var rhs = new Model.PumpCurve(x); |
| | | input.Adapt(rhs); |
| | | rhsList.Add(rhs); |
| | | } |
| | | }); |
| | | if (rhsList.Count < 1) |
| | | return false; |
| | | var bol = _service.Updates(rhsList); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°æ²çº¿ç¼ç |
| | | /// </summary> |
| | | [Route("UpdateCurveCode@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateCurveCode(UpdateCurveCodeInput input) |
| | | { |
| | | var bol = _service.UpdateCurveCode(input.CorpID, input.ID, input.CurveCode, UserManager.UserID, DateTime.Now); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°æ²çº¿æ¥æº |
| | | /// </summary> |
| | | [Route("UpdateSourceFrom@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateSourceFrom(UpdateCurveSourceFromInput input) |
| | | { |
| | | var bol = _service.UpdateSourceFrom(input.CorpID, input.ID, input.SourceFrom, UserManager.UserID, DateTime.Now); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°åå»ºæ¹æ³ |
| | | /// </summary> |
| | | [Route("UpdateCreateMethod@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateCreateMethod(UpdateCurveCreateMethodInput input) |
| | | { |
| | | var bol = _service.UpdateCreateMethod(input.CorpID, input.ID, input.CreateMethod, UserManager.UserID, DateTime.Now); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°æ²çº¿ä¿¡æ¯ |
| | | /// </summary> |
| | | [Route("UpdateCurveInfo@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateCurveInfo(UpdateCurveInfoInput input) |
| | | { |
| | | var bol = _service.UpdateCurveInfo(input.CorpID, input.ID, input.CurveInfo?.ToDsString(), UserManager.UserID, DateTime.Now); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ç¹ä¿¡æ¯ |
| | | /// </summary> |
| | | [Route("UpdatePointInfo@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdatePointInfo(UpdateCurvePointInfoInput input) |
| | | { |
| | | var bol = _service.UpdatePointInfo(input.CorpID, input.ID, input.PointInfo?.ToDsString(), UserManager.UserID, DateTime.Now); |
| | | return bol; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | [Route("UpdateCoordParas@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateCoordParas(UpdateCurveCoordParasInput input) |
| | | public bool UpdateCoordParas(UpdatePumpCoordParasInput input) |
| | | { |
| | | var bol = _service.UpdateCoordParas(input.CorpID, input.ID, input.CoordParas?.ToJson(), UserManager.UserID, DateTime.Now); |
| | | var bol = _service.UpdateCoordParas(input.ID, input.CoordParas, UserManager.UserID, DateTime.Now); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°æ²çº¿ä¿¡æ¯ |
| | | /// </summary> |
| | | [Route("UpdateCurveInfo@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateCurveInfo(UpdatePumpCurveInfoInput input) |
| | | { |
| | | var bol = _service.UpdateCurveInfo(input.ID, input.CurveInfo, UserManager.UserID, DateTime.Now); |
| | | return bol; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | [Route("UpdateReliabilityStatus@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateReliabilityStatus(UpdateCurveReliabilityStatus input) |
| | | public bool UpdateReliabilityStatus(UpdateReliabilityStatusInput input) |
| | | { |
| | | var bol = _service.UpdateReliabilityStatus(input.CorpID, input.ID, (int)input.ReliabilityStatus, UserManager.UserID, DateTime.Now); |
| | | var bol = _service.UpdateReliabilityStatus(input.ID, input.ReliabilityStatus, UserManager.UserID, DateTime.Now); |
| | | return bol; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | [Route("DeleteByID@V1.0")] |
| | | [HttpDelete] |
| | | public DeleteReasonOutput DeleteByID([FromQuery][Required] IDUnderCorpInput input) |
| | | public bool DeleteByID([FromQuery][Required] IDInput input) |
| | | { |
| | | var bol = _service.DeleteByID(input.CorpID, input.ID, out string Msg); |
| | | return new DeleteReasonOutput() { Success = bol, Reason = Msg }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å 餿²çº¿ -åæ¶å é¤æææ²çº¿æ å° |
| | | /// </summary> |
| | | [Route("DeleteWithMappingByID@V1.0")] |
| | | [HttpDelete] |
| | | public DeleteReasonOutput DeleteWithMappingByID([FromQuery][Required] IDUnderCorpInput input) |
| | | { |
| | | var bol = _service.DeleteWithMappingByID(input.CorpID, input.ID, out string Msg); |
| | | return new DeleteReasonOutput() { Success = bol, Reason = Msg }; |
| | | var bol = _service.DeleteByID(input.ID, out string Msg); |
| | | if (!bol) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D999, Msg); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | #endregion |
| | |
| | | [ApiDescriptionSettings("Curve", Name = "æ³µæ²çº¿æ å°æå±", Order = 8000)] |
| | | public partial class PumpCurveExMapping_StandardController : IDynamicApiController |
| | | { |
| | | private readonly Service.PumpCurveExMapping _service = new Service.PumpCurveExMapping(); |
| | | private readonly Service.PumpCurveExMapping _service = new(); |
| | | |
| | | #region Query |
| | | |
| | | /// <summary> |
| | | /// éè¿ CorpID è·å |
| | | /// </summary> |
| | | [Route("GetByCorpID@V1.0")] |
| | | [HttpGet] |
| | | public List<PumpCurveExMappingDto> GetByCorpID([FromQuery][Required] CorpIDInput input) |
| | | { |
| | | var list = _service.GetByCorpID(input.CorpID); |
| | | var vm_list = list?.Select(x => x.Adapt<Model.PumpCurveExMapping, PumpCurveExMappingDto>()).ToList(); |
| | | return vm_list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ MappingID è·å |
| | | /// </summary> |
| | | [Route("GetByMappingID@V1.0")] |
| | | [HttpGet] |
| | | public PumpCurveExMappingDto GetByMappingID |
| | | ( |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "CorpID å¿
须大äº0")] |
| | | long CorpID, |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "MappingID å¿
须大äº0")] |
| | | long MappingID |
| | | ) |
| | | { |
| | | var model = _service.GetByMappingID(CorpID, MappingID); |
| | | return model?.Adapt<Model.PumpCurveExMapping, PumpCurveExMappingDto>(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ MappingIds è·å |
| | | /// </summary> |
| | | [Route("GetByMappingIds@V1.0")] |
| | | [HttpGet] |
| | | public List<PumpCurveExMappingDto> GetByMappingIds([FromQuery][Required] MappingIdsUnderCorpInput input) |
| | | { |
| | | var ids = LongListHelper.ToList(input.MappingIds); |
| | | var list = _service.GetByMappingIds(input.CorpID, ids); |
| | | var vm_list = list?.Select(x => x.Adapt<Model.PumpCurveExMapping, PumpCurveExMappingDto>()).ToList(); |
| | | return vm_list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ PumpID è·å |
| | | /// éè¿ PumpID è·å |
| | | /// </summary> |
| | | [Route("GetByPumpID@V1.0")] |
| | | [HttpGet] |
| | | public List<PumpCurveExMappingDto> GetByPumpID |
| | | ( |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "CorpID å¿
须大äº0")] |
| | | long CorpID, |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "PumpID å¿
须大äº0")] |
| | | long PumpID |
| | | ) |
| | | public List<PumpCurveExMappingDto> GetByPumpID([FromQuery][Required] PumpIDInput input) |
| | | { |
| | | var list = _service.GetByPumpID(CorpID, PumpID); |
| | | var vm_list = list?.Select(x => x.Adapt<Model.PumpCurveExMapping, PumpCurveExMappingDto>()).ToList(); |
| | | return vm_list; |
| | | var list = _service.GetByPumpID(input.PumpID); |
| | | var vmList = list.Select(x => new PumpCurveExMappingDto(x.Item1, x.Item2)).ToList(); |
| | | return vmList; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ PumpIds è·å |
| | | /// éè¿ ID è·å |
| | | /// </summary> |
| | | [Route("GetByPumpIds@V1.0")] |
| | | [Route("GetByID@V1.0")] |
| | | [HttpGet] |
| | | public List<PumpCurveExMappingDto> GetByPumpIds([FromQuery][Required] PumpIdsUnderCorpInput input) |
| | | public PumpCurveExMappingDto GetByID([FromQuery][Required] IDInput input) |
| | | { |
| | | var ids = LongListHelper.ToList(input.PumpIds); |
| | | var list = _service.GetByPumpIds(input.CorpID, ids); |
| | | var vm_list = list?.Select(x => x.Adapt<Model.PumpCurveExMapping, PumpCurveExMappingDto>()).ToList(); |
| | | return vm_list; |
| | | var model = _service.GetByID(input.ID); |
| | | return model == null ? null : new PumpCurveExMappingDto(model.Item1, model.Item2); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ CurveID è·å |
| | | /// éè¿ Ids è·å |
| | | /// </summary> |
| | | [Route("GetByCurveID@V1.0")] |
| | | [Route("GetByIds@V1.0")] |
| | | [HttpGet] |
| | | public List<PumpCurveExMappingDto> GetByCurveID |
| | | ( |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "CorpID å¿
须大äº0")] |
| | | long CorpID, |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "CurveID å¿
须大äº0")] |
| | | long CurveID |
| | | ) |
| | | public List<PumpCurveExMappingDto> GetByIds([FromQuery][Required] IdsInput input) |
| | | { |
| | | var list = _service.GetByCurveID(CorpID, CurveID); |
| | | var vm_list = list?.Select(x => x.Adapt<Model.PumpCurveExMapping, PumpCurveExMappingDto>()).ToList(); |
| | | return vm_list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ CurveIds è·å |
| | | /// </summary> |
| | | [Route("GetByCurveIds@V1.0")] |
| | | [HttpGet] |
| | | public List<PumpCurveExMappingDto> GetByCurveIds([FromQuery][Required] CurveIdsUnderCorpInput input) |
| | | { |
| | | var ids = LongListHelper.ToList(input.CurveIds); |
| | | var list = _service.GetByCurveIds(input.CorpID, ids); |
| | | var vm_list = list?.Select(x => x.Adapt<Model.PumpCurveExMapping, PumpCurveExMappingDto>()).ToList(); |
| | | return vm_list; |
| | | var ids = LongListHelper.ToList(input.Ids); |
| | | var list = _service.GetByIds(ids); |
| | | var vmList = list.Select(x => new PumpCurveExMappingDto(x.Item1, x.Item2)).ToList(); |
| | | return vmList; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | [Route("GetWorkingByPumpID@V1.0")] |
| | | [HttpGet] |
| | | public PumpCurveExMappingDto GetWorkingByPumpID |
| | | ( |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "CorpID å¿
须大äº0")] |
| | | long CorpID, |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "PumpID å¿
须大äº0")] |
| | | long PumpID |
| | | ) |
| | | public PumpCurveExMappingDto GetWorkingByPumpID([FromQuery][Required] PumpIDInput input) |
| | | { |
| | | var model = _service.GetWorkingByPumpID(CorpID, PumpID); |
| | | return model?.Adapt<Model.PumpCurveExMapping, PumpCurveExMappingDto>(); |
| | | var model = _service.GetWorkingByPumpID(input.PumpID); |
| | | return model == null ? null : new PumpCurveExMappingDto(model.Item1, model.Item2); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ PumpID è·åé»è®¤å·¥ä½æ²çº¿ |
| | | /// éè¿ PumpID è·åé»è®¤æ²çº¿ |
| | | /// </summary> |
| | | [Route("GetDefaultWorkingByPumpID@V1.0")] |
| | | [Route("GetDefaultByPumpID@V1.0")] |
| | | [HttpGet] |
| | | public PumpCurveExMappingDto GetDefaultWorkingByPumpID |
| | | ( |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "CorpID å¿
须大äº0")] |
| | | long CorpID, |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "PumpID å¿
须大äº0")] |
| | | long PumpID |
| | | ) |
| | | public PumpCurveExMappingDto GetDefaultByPumpID([FromQuery][Required] PumpIDInput input) |
| | | { |
| | | var model = _service.GetDefaultWorkingByPumpID(CorpID, PumpID); |
| | | return model?.Adapt<Model.PumpCurveExMapping, PumpCurveExMappingDto>(); |
| | | var model = _service.GetDefaultByPumpID(input.PumpID); |
| | | return model == null ? null : new PumpCurveExMappingDto(model.Item1, model.Item2); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ PumpIds è·å工使²çº¿ |
| | | /// </summary> |
| | | [Route("GetWorkingByPumpIds@V1.0")] |
| | | [HttpGet] |
| | | public List<PumpCurveExMappingDto> GetWorkingByPumpIds([FromQuery][Required] PumpIdsUnderCorpInput input) |
| | | { |
| | | var ids = LongListHelper.ToList(input.PumpIds); |
| | | var list = _service.GetWorkingByPumpIds(input.CorpID, ids); |
| | | var vm_list = list?.Select(x => x.Adapt<Model.PumpCurveExMapping, PumpCurveExMappingDto>()).ToList(); |
| | | return vm_list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ PumpIds è·åé»è®¤å·¥ä½æ²çº¿ |
| | | /// </summary> |
| | | [Route("GetDefaultWorkingByPumpIds@V1.0")] |
| | | [HttpGet] |
| | | public List<PumpCurveExMappingDto> GetDefaultWorkingByPumpIds([FromQuery][Required] PumpIdsUnderCorpInput input) |
| | | { |
| | | var ids = LongListHelper.ToList(input.PumpIds); |
| | | var list = _service.GetDefaultWorkingByPumpIds(input.CorpID, ids); |
| | | var vm_list = list?.Select(x => x.Adapt<Model.PumpCurveExMapping, PumpCurveExMappingDto>()).ToList(); |
| | | return vm_list; |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | /// </summary> |
| | | [Route("Insert@V1.0")] |
| | | [HttpPost] |
| | | public long Insert(AddPumpCurveExMappingInput input) |
| | | public long Insert([Required] AddPumpCurveExMappingInput input) |
| | | { |
| | | if (input == null) |
| | | return default; |
| | | var model = input.Adapt<AddPumpCurveExMappingInput, Model.PumpCurveExMapping>(); |
| | | var id = _service.Insert(model); |
| | | var curve = input.Adapt<AddPumpCurveExMappingInput, Model.PumpCurve>(); |
| | | var mapping = input.Adapt<AddPumpCurveExMappingInput, Model.PumpCurveMapping>(); |
| | | mapping.SortCode = new Service.PumpCurveMapping().GetMaxSortCodeByPumpID(input.PumpID) + 1; |
| | | var id = _service.Insert(curve, mapping); |
| | | return id; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Update |
| | | |
| | | /// <summary> |
| | | /// æå
¥å¤æ¡ |
| | | /// æ´æ°ä¸æ¡ |
| | | /// </summary> |
| | | [Route("Inserts@V1.0")] |
| | | [HttpPost] |
| | | public bool Inserts(List<AddPumpCurveExMappingInput> inputList) |
| | | [Route("Update@V1.0")] |
| | | [HttpPut] |
| | | public bool Update([Required] UpdatePumpCurveExMappingInput input) |
| | | { |
| | | if (inputList == null || inputList.Count < 1) |
| | | return false; |
| | | var list = inputList.Select(x => x.Adapt<AddPumpCurveExMappingInput, Model.PumpCurveExMapping>()).ToList(); |
| | | var bol = _service.Inserts(list); |
| | | var curveModel = new Service.PumpCurve().GetByID(input.CurveID); |
| | | if (curveModel == null) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, $"CurveID:{input.CurveID} æ°æ®ä¸åå¨"); |
| | | } |
| | | var curveRhs = new Model.PumpCurve(curveModel); |
| | | var mappingModel = new Service.PumpCurveMapping().GetByID(input.MappingID); |
| | | if (mappingModel == null) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, $"MappingID:{input.MappingID} æ°æ®ä¸åå¨"); |
| | | } |
| | | var mappingRhs = new Model.PumpCurveMapping(mappingModel); |
| | | |
| | | input.Adapt(curveRhs); |
| | | input.Adapt(mappingRhs); |
| | | |
| | | var bol = _service.Update(curveRhs, mappingRhs); |
| | | return bol; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Delete |
| | | |
| | | /// <summary> |
| | | /// éè¿ ID å é¤ï¼å¦ææ²çº¿æ²¡æå
¶ä»å
³èå
³ç³»ï¼ååæ¶å 餿²çº¿ï¼ |
| | | /// </summary> |
| | | public bool DeleteByID(long ID) |
| | | { |
| | | var bol = new Service.PumpCurveMapping().DeleteExByID(ID, out string Msg); |
| | | if (!bol) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D999, Msg); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | |
| | | namespace IStation.Application |
| | | namespace Yw.Application |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class AddPumpCurveExMappingInput |
| | | { |
| | | /// <summary> |
| | | /// å®¢æ·æ è¯ |
| | | /// </summary> |
| | | public long CorpID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ²çº¿ç¼ç |
| | | /// æ³µid |
| | | /// </summary> |
| | | public string CurveCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ²çº¿æ¥æº |
| | | /// </summary> |
| | | public eCurveSourceFrom SourceFrom { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åå»ºæ¹æ³ |
| | | /// </summary> |
| | | public eCurveCreateMethod CreateMethod { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ åæ° |
| | | /// </summary> |
| | | public CurveCoordinateParas CoordParas { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ²çº¿ä¿¡æ¯ |
| | | /// </summary> |
| | | public SingleCurveExpressGroup CurveInfo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¹ä¿¡æ¯ |
| | | /// </summary> |
| | | public SingleCurvePointListGroup PointInfo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ³µæ è¯ |
| | | /// </summary> |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "PumpID å¿
须大äº0")] |
| | | public long PumpID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | [Required] |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å«å |
| | | /// </summary> |
| | | [Required] |
| | | public string OtherName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåºç |
| | | /// </summary> |
| | | public int SortCode { get; set; } |
| | | /// æ¥æºæ¹å¼ |
| | | /// </summary> |
| | | [Required] |
| | | public eSourceWay SourceWay { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åå»ºæ¹æ³ |
| | | /// </summary> |
| | | [Required] |
| | | public string CreateMethod { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ åæ° |
| | | /// </summary> |
| | | public Dictionary<string, string> CoordParas { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ²çº¿ä¿¡æ¯ |
| | | /// </summary> |
| | | [Required] |
| | | public PumpCurveInfoModel CurveInfo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å¯ä¿¡åº¦ |
| | | /// </summary> |
| | | [Required] |
| | | public eReliabilityStatus ReliabilityStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å½å
¥æ¶é´ |
| | | /// </summary> |
| | | [Required] |
| | | public DateTime InputTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 工使²çº¿ |
| | | /// </summary> |
| | | [Required] |
| | | public bool IsWorking { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨è¯´æ |
| | | /// 说æ |
| | | /// </summary> |
| | | public string Description { get; set; } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace Yw.Application |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class UpdatePumpCurveExMappingInput |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "MappingID å¿
须大äº0")] |
| | | public long MappingID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "CurveID å¿
须大äº0")] |
| | | public long CurveID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | [Required] |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å«å |
| | | /// </summary> |
| | | [Required] |
| | | public string OtherName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¥æºæ¹å¼ |
| | | /// </summary> |
| | | [Required] |
| | | public eSourceWay SourceWay { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åå»ºæ¹æ³ |
| | | /// </summary> |
| | | [Required] |
| | | public string CreateMethod { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ åæ° |
| | | /// </summary> |
| | | public Dictionary<string, string> CoordParas { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ²çº¿ä¿¡æ¯ |
| | | /// </summary> |
| | | [Required] |
| | | public PumpCurveInfoModel CurveInfo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å¯ä¿¡åº¦ |
| | | /// </summary> |
| | | [Required] |
| | | public eReliabilityStatus ReliabilityStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å½å
¥æ¶é´ |
| | | /// </summary> |
| | | [Required] |
| | | public DateTime InputTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 工使²çº¿ |
| | | /// </summary> |
| | | [Required] |
| | | public bool IsWorking { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 说æ |
| | | /// </summary> |
| | | public string Description { get; set; } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | --> |
| | | <Project> |
| | | <PropertyGroup> |
| | | <History>True|2023-10-24T15:17:54.0748672Z;True|2023-10-21T14:38:03.2722172+08:00;True|2023-09-26T14:10:22.2485377+08:00;True|2023-08-29T11:46:24.5710627+08:00;True|2023-08-23T11:34:59.7400481+08:00;True|2023-08-21T13:31:52.3074533+08:00;True|2023-08-18T16:51:57.4477528+08:00;True|2023-08-18T13:49:11.3231257+08:00;True|2023-08-17T14:51:49.8452519+08:00;True|2023-08-17T11:44:23.5001902+08:00;True|2023-08-16T17:43:46.8283841+08:00;True|2023-08-16T11:10:43.5110570+08:00;True|2023-08-15T16:51:35.3016945+08:00;True|2023-08-15T15:04:30.4334950+08:00;True|2023-08-10T15:23:57.4783701+08:00;True|2023-08-08T10:01:53.7466486+08:00;True|2023-08-07T11:49:59.7506144+08:00;True|2023-08-05T10:38:53.6104500+08:00;True|2023-08-02T15:25:21.6024349+08:00;True|2023-08-02T15:20:20.4985081+08:00;True|2023-08-02T13:31:18.6184059+08:00;True|2023-08-02T13:30:52.4975034+08:00;True|2023-08-02T13:29:34.9010019+08:00;True|2023-08-02T13:28:35.4729592+08:00;True|2023-07-25T15:08:42.3375388+08:00;True|2023-07-17T10:31:53.5181752+08:00;True|2023-07-17T10:31:44.6652344+08:00;True|2023-07-13T12:10:11.2591498+08:00;True|2023-05-25T18:02:16.3580168+08:00;True|2023-05-25T15:44:32.4909866+08:00;</History> |
| | | <History>True|2023-11-07T03:05:59.7264456Z;True|2023-11-07T11:05:52.0532331+08:00;True|2023-10-24T23:17:54.0748672+08:00;True|2023-10-21T14:38:03.2722172+08:00;True|2023-09-26T14:10:22.2485377+08:00;True|2023-08-29T11:46:24.5710627+08:00;True|2023-08-23T11:34:59.7400481+08:00;True|2023-08-21T13:31:52.3074533+08:00;True|2023-08-18T16:51:57.4477528+08:00;True|2023-08-18T13:49:11.3231257+08:00;True|2023-08-17T14:51:49.8452519+08:00;True|2023-08-17T11:44:23.5001902+08:00;True|2023-08-16T17:43:46.8283841+08:00;True|2023-08-16T11:10:43.5110570+08:00;True|2023-08-15T16:51:35.3016945+08:00;True|2023-08-15T15:04:30.4334950+08:00;True|2023-08-10T15:23:57.4783701+08:00;True|2023-08-08T10:01:53.7466486+08:00;True|2023-08-07T11:49:59.7506144+08:00;True|2023-08-05T10:38:53.6104500+08:00;True|2023-08-02T15:25:21.6024349+08:00;True|2023-08-02T15:20:20.4985081+08:00;True|2023-08-02T13:31:18.6184059+08:00;True|2023-08-02T13:30:52.4975034+08:00;True|2023-08-02T13:29:34.9010019+08:00;True|2023-08-02T13:28:35.4729592+08:00;True|2023-07-25T15:08:42.3375388+08:00;True|2023-07-17T10:31:53.5181752+08:00;True|2023-07-17T10:31:44.6652344+08:00;True|2023-07-13T12:10:11.2591498+08:00;True|2023-05-25T18:02:16.3580168+08:00;True|2023-05-25T15:44:32.4909866+08:00;</History> |
| | | </PropertyGroup> |
| | | </Project> |
| | |
| | | <ItemGroup> |
| | | <PackageReference Include="Yw.Application.Core" Version="1.2.5" /> |
| | | <PackageReference Include="Yw.Quartz.Core" Version="1.0.0" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\Yw.Service.Curve.Core\Yw.Service.Curve.Core.csproj" /> |
| | | <PackageReference Include="Yw.Service.Curve.Core" Version="1.0.0" /> |
| | | </ItemGroup> |
| | | |
| | | </Project> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <PropertyGroup> |
| | | <_LastSelectedProfileId>D:\WorkData\模å\Code\Curve\Yw.Application.Curve.Core\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId> |
| | | </PropertyGroup> |
| | | </Project> |
| | |
| | | --> |
| | | <Project> |
| | | <PropertyGroup> |
| | | <History>True|2023-09-22T05:16:35.5213053Z;True|2023-09-19T13:47:08.6616971+08:00;True|2023-09-19T13:42:42.1690038+08:00;True|2023-09-18T15:12:24.4129783+08:00;False|2023-09-18T15:11:19.1798407+08:00;True|2023-09-01T13:20:20.4261550+08:00;True|2023-09-01T11:08:43.5292206+08:00;True|2023-08-29T16:21:32.3346453+08:00;</History> |
| | | <History>True|2023-11-07T02:59:03.8484346Z;True|2023-09-22T13:16:35.5213053+08:00;True|2023-09-19T13:47:08.6616971+08:00;True|2023-09-19T13:42:42.1690038+08:00;True|2023-09-18T15:12:24.4129783+08:00;False|2023-09-18T15:11:19.1798407+08:00;True|2023-09-01T13:20:20.4261550+08:00;True|2023-09-01T11:08:43.5292206+08:00;True|2023-08-29T16:21:32.3346453+08:00;</History> |
| | | </PropertyGroup> |
| | | </Project> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <PropertyGroup> |
| | | <_LastSelectedProfileId>D:\WorkData\模å\Code\Curve\Yw.CurveBase.Core\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId> |
| | | </PropertyGroup> |
| | | </Project> |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æå
¥ |
| | | /// æå
¥ä¸æ¡ |
| | | /// </summary> |
| | | public override long Insert(Entity.PumpCurveMapping entity) |
| | | { |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | try |
| | | { |
| | | db.BeginTran(); |
| | | entity.ID = db.Insertable(entity).ExecuteReturnSnowflakeId(); |
| | | if (entity.ID < 1) |
| | | { |
| | | db.RollbackTran(); |
| | | return default; |
| | | } |
| | | if (entity.IsWorking) |
| | | { |
| | | db.Updateable<Entity.PumpCurveMapping>() |
| | | .SetColumns(x => x.IsWorking == false) |
| | | .Where(x => x.PumpID == entity.PumpID && x.ID != entity.ID).ExecuteCommandHasChange(); |
| | | } |
| | | db.CommitTran(); |
| | | return entity.ID; |
| | | } |
| | | catch |
| | | { |
| | | db.RollbackTran(); |
| | | throw; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æå
¥æå± |
| | | /// </summary> |
| | | public long InsertEx(Entity.PumpCurve curveEntity, Entity.PumpCurveMapping mappingEntity) |
| | | { |
| | |
| | | return default; |
| | | } |
| | | mappingEntity.CurveID = curveId; |
| | | var mapId = db.Insertable(mappingEntity).ExecuteReturnSnowflakeId(); |
| | | if (mapId < 1) |
| | | mappingEntity.ID = db.Insertable(mappingEntity).ExecuteReturnSnowflakeId(); |
| | | if (mappingEntity.ID < 1) |
| | | { |
| | | db.RollbackTran(); |
| | | return default; |
| | | } |
| | | if (mappingEntity.IsWorking) |
| | | { |
| | | db.Updateable<Entity.PumpCurveMapping>() |
| | | .SetColumns(x => x.IsWorking == false) |
| | | .Where(x => x.PumpID == mappingEntity.PumpID && x.ID != mappingEntity.ID).ExecuteCommandHasChange(); |
| | | } |
| | | db.CommitTran(); |
| | | return mapId; |
| | | return mappingEntity.ID; |
| | | } |
| | | catch |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¹éæå
¥ |
| | | /// æ´æ°ä¸æ¡ |
| | | /// </summary> |
| | | public bool InsertsEx(Dictionary<Entity.PumpCurve, Entity.PumpCurveMapping> dict) |
| | | public override bool Update(Entity.PumpCurveMapping entity) |
| | | { |
| | | if (dict == null || dict.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | try |
| | | { |
| | | db.BeginTran(); |
| | | foreach (var item in dict) |
| | | var bol = db.Updateable(entity).ExecuteCommandHasChange(); |
| | | if (!bol) |
| | | { |
| | | var curveId = db.Insertable(item.Key).ExecuteReturnSnowflakeId(); |
| | | if (curveId < 1) |
| | | { |
| | | db.RollbackTran(); |
| | | return default; |
| | | } |
| | | item.Value.CurveID = curveId; |
| | | var mapId = db.Insertable(item.Value).ExecuteReturnSnowflakeId(); |
| | | if (mapId < 1) |
| | | { |
| | | db.RollbackTran(); |
| | | return default; |
| | | } |
| | | db.RollbackTran(); |
| | | return false; |
| | | } |
| | | |
| | | if (entity.IsWorking) |
| | | { |
| | | db.Updateable<Entity.PumpCurveMapping>() |
| | | .SetColumns(x => x.IsWorking == false) |
| | | .Where(x => x.PumpID == entity.PumpID && x.ID != entity.ID).ExecuteCommandHasChange(); |
| | | } |
| | | db.CommitTran(); |
| | | return true; |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¹éæå
¥ |
| | | /// æ´æ°æå± |
| | | /// </summary> |
| | | public List<long> InsertsREx(Dictionary<Entity.PumpCurve, Entity.PumpCurveMapping> dict) |
| | | public bool UpdateEx(Entity.PumpCurve curveEntity, Entity.PumpCurveMapping mappingEntity) |
| | | { |
| | | if (dict == null || dict.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | try |
| | | { |
| | | db.BeginTran(); |
| | | var list = new List<long>(); |
| | | foreach (var item in dict) |
| | | var bol = db.Updateable(curveEntity).ExecuteCommandHasChange(); |
| | | if (!bol) |
| | | { |
| | | var curveId = db.Insertable(item.Key).ExecuteReturnSnowflakeId(); |
| | | if (curveId < 1) |
| | | { |
| | | db.RollbackTran(); |
| | | return default; |
| | | } |
| | | item.Value.CurveID = curveId; |
| | | var mapId = db.Insertable(item.Value).ExecuteReturnSnowflakeId(); |
| | | if (mapId < 1) |
| | | { |
| | | db.RollbackTran(); |
| | | return default; |
| | | } |
| | | list.Add(mapId); |
| | | db.RollbackTran(); |
| | | return false; |
| | | } |
| | | bol = db.Updateable(mappingEntity).ExecuteCommandHasChange(); |
| | | if (!bol) |
| | | { |
| | | db.RollbackTran(); |
| | | return false; |
| | | } |
| | | if (mappingEntity.IsWorking) |
| | | { |
| | | db.Updateable<Entity.PumpCurveMapping>() |
| | | .SetColumns(x => x.IsWorking == false) |
| | | .Where(x => x.PumpID == mappingEntity.PumpID && x.ID != mappingEntity.ID).ExecuteCommandHasChange(); |
| | | } |
| | | db.CommitTran(); |
| | | return list; |
| | | return true; |
| | | } |
| | | catch |
| | | { |
| | |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ PumpIds è·å |
| | | /// </summary> |
| | | public List<Entity.PumpCurveMapping> GetByPumpIds(List<long> PumpIds) |
| | | { |
| | | if (PumpIds == null || PumpIds.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | return db.Queryable<Entity.PumpCurveMapping>() |
| | | .Where(x => PumpIds.Contains(x.PumpID)) |
| | | .OrderBy(x => x.SortCode).ToList(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ CurveID è·å |
| | | /// </summary> |
| | | public List<Entity.PumpCurveMapping> GetByCurveID(long CurveID) |
| | |
| | | } |
| | | |
| | | //éè¿ ID æ´æ°ç¼å |
| | | private static void UpdateCache(long ID) |
| | | internal static void UpdateCache(long ID) |
| | | { |
| | | var dal = new DAL.PumpCurve(); |
| | | var entityDb = dal.GetByID(ID); |
| | |
| | | } |
| | | |
| | | //Model to Entity |
| | | private static Entity.PumpCurve Model2Entity(Model.PumpCurve model) |
| | | internal static Entity.PumpCurve Model2Entity(Model.PumpCurve model) |
| | | { |
| | | if (model == null) |
| | | return default; |
| | |
| | | } |
| | | |
| | | //éè¿ ID æ´æ°ç¼å |
| | | private static void UpdateCache(long ID) |
| | | internal static Model.PumpCurveMapping UpdateCache(long ID) |
| | | { |
| | | var dal = new DAL.PumpCurveMapping(); |
| | | var entityDb = dal.GetByID(ID); |
| | |
| | | model.Reset(modelDb); |
| | | } |
| | | PumpCurveMappingCacheHelper.Trigger(); |
| | | return modelDb; |
| | | } |
| | | |
| | | //éè¿ Ids æ´æ°ç¼å |
| | |
| | | var modelList = Entity2Models(entityList); |
| | | var all = GetCache(); |
| | | all.RemoveAll(x => x.PumpID == PumpID); |
| | | if (modelList != null && modelList.Count > 0) |
| | | { |
| | | all.AddRange(modelList); |
| | | } |
| | | PumpCurveMappingCacheHelper.Trigger(); |
| | | } |
| | | |
| | | //éè¿ PumpIds æ´æ°ç¼å |
| | | internal static void UpdateCacheByPumpID(List<long> PumpIds) |
| | | { |
| | | if (PumpIds == null || PumpIds.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var dal = new DAL.PumpCurveMapping(); |
| | | var entityList = dal.GetByPumpIds(PumpIds); |
| | | var modelList = Entity2Models(entityList); |
| | | var all = GetCache(); |
| | | all.RemoveAll(x => PumpIds.Contains(x.PumpID)); |
| | | if (modelList != null && modelList.Count > 0) |
| | | { |
| | | all.AddRange(modelList); |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ PumpID è·å工使²çº¿ |
| | | /// </summary> |
| | | public Model.PumpCurveMapping GetWorkingByPumpID(long PumpID) |
| | | { |
| | | var all = GetByPumpID(PumpID); |
| | | if (all == null || all.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | return all.Find(x => x.IsWorking); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ PumpID è·åé»è®¤ |
| | | /// </summary> |
| | | public Model.PumpCurveMapping GetDefaultByPumpID(long PumpID) |
| | | { |
| | | var all = GetByPumpID(PumpID); |
| | | if (all == null || all.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var model = all.Find(x => x.IsWorking); |
| | | if (model == null) |
| | | { |
| | | model = all.First(); |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ PumpID è·åæå¤§æåºç |
| | | /// </summary> |
| | | public int GetMaxSortCodeByPumpID(long PumpID) |
| | |
| | | { |
| | | return default; |
| | | } |
| | | if (IsExistByPumpIDAndCurveID(model.PumpID, model.CurveID)) |
| | | { |
| | | return default; |
| | | } |
| | | var entity = Model2Entity(model); |
| | | var dal = new DAL.PumpCurveMapping(); |
| | | var id = dal.Insert(entity); |
| | | if (id > 0) |
| | | { |
| | | UpdateCache(id); |
| | | UpdateCacheByPumpID(model.PumpID); |
| | | } |
| | | return id; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¹éæå
¥ |
| | | /// </summary> |
| | | public bool Inserts(List<Model.PumpCurveMapping> list) |
| | | { |
| | | if (list == null || list.Count < 1) |
| | | { |
| | | return false; |
| | | } |
| | | var dal = new DAL.PumpCurveMapping(); |
| | | var entity_list = Model2Entities(list); |
| | | var ids = dal.InsertsR(entity_list); |
| | | if (ids != null && ids.Count > 0) |
| | | { |
| | | UpdateCache(ids); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | |
| | | var bol = dal.Update(entity); |
| | | if (bol) |
| | | { |
| | | UpdateCache(model.ID); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¹éæ´æ° |
| | | /// </summary> |
| | | public bool Updates(List<Model.PumpCurveMapping> list) |
| | | { |
| | | if (list == null || list.Count < 1) |
| | | { |
| | | return false; |
| | | } |
| | | var entity_list = Model2Entities(list.ToList()); |
| | | var dal = new DAL.PumpCurveMapping(); |
| | | var bol = dal.Updates(entity_list); |
| | | if (bol) |
| | | { |
| | | UpdateCache(list.Select(x => x.ID).ToList()); |
| | | UpdateCacheByPumpID(model.PumpID); |
| | | } |
| | | return bol; |
| | | } |
| | |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ ID å é¤ï¼å¦ææ²çº¿æ²¡æå
¶ä»å
³èå
³ç³»ï¼ååæ¶å 餿²çº¿ï¼ |
| | | /// </summary> |
| | | public bool DeleteExByID(long ID, out string Msg) |
| | | { |
| | | Msg = string.Empty; |
| | | var mapping = GetByID(ID); |
| | | if (mapping == null) |
| | | { |
| | | Msg = "æ°æ®ä¸åå¨"; |
| | | return false; |
| | | } |
| | | var mappingList = GetByCurveID(mapping.CurveID); |
| | | if (mappingList.Count > 1) |
| | | { |
| | | return DeleteByID(ID, out Msg); |
| | | } |
| | | return new PumpCurve().DeleteExByID(mapping.CurveID, out Msg); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region Set |
| | |
| | | } |
| | | |
| | | //Model to Entity |
| | | private static Entity.PumpCurveMapping Model2Entity(Model.PumpCurveMapping model) |
| | | internal static Entity.PumpCurveMapping Model2Entity(Model.PumpCurveMapping model) |
| | | { |
| | | if (model == null) |
| | | return default; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace Yw.Service |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class PumpCurveExMapping |
| | | { |
| | | /// <summary> |
| | | /// éè¿ PumpID è·å |
| | | /// </summary> |
| | | public List<Tuple<Model.PumpCurveMapping, Model.PumpCurve>> GetByPumpID(long PumpID) |
| | | { |
| | | var mappingList = new Service.PumpCurveMapping().GetByPumpID(PumpID); |
| | | if (mappingList == null || mappingList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var curveIds = mappingList.Select(x => x.CurveID).Distinct().ToList(); |
| | | var curveList = new Service.PumpCurve().GetByIds(curveIds); |
| | | return (from x in mappingList |
| | | join y in curveList |
| | | on x.CurveID equals y.ID |
| | | select new Tuple<Model.PumpCurveMapping, Model.PumpCurve>(x, y)).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ ID è·å |
| | | /// </summary> |
| | | public Tuple<Model.PumpCurveMapping, Model.PumpCurve> GetByID(long ID) |
| | | { |
| | | var mapping = new Service.PumpCurveMapping().GetByID(ID); |
| | | if (mapping == null) |
| | | { |
| | | return default; |
| | | } |
| | | var curve = new Service.PumpCurve().GetByID(mapping.CurveID); |
| | | if (curve == null) |
| | | { |
| | | return default; |
| | | } |
| | | return new Tuple<Model.PumpCurveMapping, Model.PumpCurve>(mapping, curve); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ Ids è·å |
| | | /// </summary> |
| | | public List<Tuple<Model.PumpCurveMapping, Model.PumpCurve>> GetByIds(List<long> Ids) |
| | | { |
| | | var mappingList = new Service.PumpCurveMapping().GetByIds(Ids); |
| | | if (mappingList == null || mappingList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var curveIds = mappingList.Select(x => x.CurveID).Distinct().ToList(); |
| | | var curveList = new Service.PumpCurve().GetByIds(curveIds); |
| | | return (from x in mappingList |
| | | join y in curveList |
| | | on x.CurveID equals y.ID |
| | | select new Tuple<Model.PumpCurveMapping, Model.PumpCurve>(x, y)).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ PumpID è·å工使²çº¿ |
| | | /// </summary> |
| | | public Tuple<Model.PumpCurveMapping, Model.PumpCurve> GetWorkingByPumpID(long PumpID) |
| | | { |
| | | var mapping = new Service.PumpCurveMapping().GetWorkingByPumpID(PumpID); |
| | | if (mapping == null) |
| | | { |
| | | return default; |
| | | } |
| | | var curve = new Service.PumpCurve().GetByID(mapping.CurveID); |
| | | if (curve == null) |
| | | { |
| | | return default; |
| | | } |
| | | return new Tuple<Model.PumpCurveMapping, Model.PumpCurve>(mapping, curve); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ PumpID è·åé»è®¤æ²çº¿ |
| | | /// </summary> |
| | | public Tuple<Model.PumpCurveMapping, Model.PumpCurve> GetDefaultByPumpID(long PumpID) |
| | | { |
| | | var mapping = new Service.PumpCurveMapping().GetDefaultByPumpID(PumpID); |
| | | if (mapping == null) |
| | | { |
| | | return default; |
| | | } |
| | | var curve = new Service.PumpCurve().GetByID(mapping.CurveID); |
| | | if (curve == null) |
| | | { |
| | | return default; |
| | | } |
| | | return new Tuple<Model.PumpCurveMapping, Model.PumpCurve>(mapping, curve); |
| | | } |
| | | |
| | | #region Insert |
| | | |
| | | /// <summary> |
| | | /// æå
¥ä¸æ¡ |
| | | /// </summary> |
| | | public long Insert(Model.PumpCurve curve, Model.PumpCurveMapping mapping) |
| | | { |
| | | if (curve == null || mapping == null) |
| | | { |
| | | return default; |
| | | } |
| | | var curveEntity = PumpCurve.Model2Entity(curve); |
| | | var mappingEntity = PumpCurveMapping.Model2Entity(mapping); |
| | | var dal = new DAL.PumpCurveMapping(); |
| | | var id = dal.InsertEx(curveEntity, mappingEntity); |
| | | if (id > 0) |
| | | { |
| | | var rhs = PumpCurveMapping.UpdateCache(id); |
| | | PumpCurve.UpdateCache(rhs.CurveID); |
| | | } |
| | | return id; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Update |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ä¸æ¡ |
| | | /// </summary> |
| | | public bool Update(Model.PumpCurve curve, Model.PumpCurveMapping mapping) |
| | | { |
| | | if (curve == null || mapping == null) |
| | | { |
| | | return default; |
| | | } |
| | | var curveEntity = PumpCurve.Model2Entity(curve); |
| | | var mappingEntity = PumpCurveMapping.Model2Entity(mapping); |
| | | var dal = new DAL.PumpCurveMapping(); |
| | | var bol = dal.UpdateEx(curveEntity, mappingEntity); |
| | | if (bol) |
| | | { |
| | | PumpCurveMapping.UpdateCacheByPumpID(mapping.PumpID); |
| | | PumpCurve.UpdateCache(curve.ID); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | --> |
| | | <Project> |
| | | <PropertyGroup> |
| | | <History>True|2023-10-24T15:16:33.8643304Z;True|2023-10-21T14:19:25.2606768+08:00;True|2023-09-26T14:09:33.8756384+08:00;True|2023-08-29T11:33:28.5466784+08:00;True|2023-08-21T13:26:43.3162454+08:00;True|2023-08-18T13:08:38.6378644+08:00;True|2023-08-16T17:42:45.3685771+08:00;True|2023-08-16T11:48:48.4326811+08:00;True|2023-08-15T15:00:14.6493599+08:00;True|2023-08-10T15:20:03.2786400+08:00;True|2023-08-07T11:48:46.2865626+08:00;True|2023-08-07T11:15:37.1248435+08:00;True|2023-08-07T10:40:31.7277832+08:00;True|2023-08-04T17:10:25.6488475+08:00;True|2023-08-02T15:24:28.5531853+08:00;True|2023-08-02T15:19:18.2260163+08:00;True|2023-08-02T13:26:30.0499052+08:00;True|2023-07-17T10:30:15.0370305+08:00;True|2023-07-13T11:54:33.7989040+08:00;True|2023-07-13T11:54:23.3967174+08:00;True|2023-07-06T09:49:52.7407983+08:00;True|2023-05-25T15:37:23.5406830+08:00;False|2023-05-25T15:36:09.3589239+08:00;</History> |
| | | <History>True|2023-11-07T03:00:32.3186525Z;True|2023-11-07T11:00:20.7173571+08:00;True|2023-10-24T23:16:33.8643304+08:00;True|2023-10-21T14:19:25.2606768+08:00;True|2023-09-26T14:09:33.8756384+08:00;True|2023-08-29T11:33:28.5466784+08:00;True|2023-08-21T13:26:43.3162454+08:00;True|2023-08-18T13:08:38.6378644+08:00;True|2023-08-16T17:42:45.3685771+08:00;True|2023-08-16T11:48:48.4326811+08:00;True|2023-08-15T15:00:14.6493599+08:00;True|2023-08-10T15:20:03.2786400+08:00;True|2023-08-07T11:48:46.2865626+08:00;True|2023-08-07T11:15:37.1248435+08:00;True|2023-08-07T10:40:31.7277832+08:00;True|2023-08-04T17:10:25.6488475+08:00;True|2023-08-02T15:24:28.5531853+08:00;True|2023-08-02T15:19:18.2260163+08:00;True|2023-08-02T13:26:30.0499052+08:00;True|2023-07-17T10:30:15.0370305+08:00;True|2023-07-13T11:54:33.7989040+08:00;True|2023-07-13T11:54:23.3967174+08:00;True|2023-07-06T09:49:52.7407983+08:00;True|2023-05-25T15:37:23.5406830+08:00;False|2023-05-25T15:36:09.3589239+08:00;</History> |
| | | </PropertyGroup> |
| | | </Project> |
| | |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <PackageReference Include="Yw.CurveBase.Core" Version="1.0.0" /> |
| | | <PackageReference Include="Yw.DynamicExpresso.Core" Version="1.0.0" /> |
| | | <PackageReference Include="Yw.RabbitMq.Core" Version="1.0.0" /> |
| | | <PackageReference Include="Yw.Redis.Core" Version="1.0.1" /> |
| | |
| | | <Content Update="C:\Users\admin\.nuget\packages\yw.sqlsugar.core\1.0.0\contentFiles\any\net6.0\paras_sqlsugar_settings.json"> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </Content> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\Yw.CurveBase.Core\Yw.CurveBase.Core.csproj" /> |
| | | </ItemGroup> |
| | | |
| | | </Project> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <PropertyGroup> |
| | | <_LastSelectedProfileId>D:\WorkData\模å\Code\Curve\Yw.Service.Curve.Core\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId> |
| | | </PropertyGroup> |
| | | </Project> |