diff --git a/.vs/BPA.KitChen.GroupMeal/DesignTimeBuild/.dtbcache.v2 b/.vs/BPA.KitChen.GroupMeal/DesignTimeBuild/.dtbcache.v2 index 544a97a..0beef2d 100644 Binary files a/.vs/BPA.KitChen.GroupMeal/DesignTimeBuild/.dtbcache.v2 and b/.vs/BPA.KitChen.GroupMeal/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/BPA.KitChen.GroupMeal/v17/.futdcache.v2 b/.vs/BPA.KitChen.GroupMeal/v17/.futdcache.v2 index d32dd2f..099fb77 100644 Binary files a/.vs/BPA.KitChen.GroupMeal/v17/.futdcache.v2 and b/.vs/BPA.KitChen.GroupMeal/v17/.futdcache.v2 differ diff --git a/.vs/BPA.KitChen.GroupMeal/v17/.suo b/.vs/BPA.KitChen.GroupMeal/v17/.suo index f634f07..7c24a2e 100644 Binary files a/.vs/BPA.KitChen.GroupMeal/v17/.suo and b/.vs/BPA.KitChen.GroupMeal/v17/.suo differ diff --git a/.vs/ProjectEvaluation/bpa.kitchen.groupmeal.metadata.v7.bin b/.vs/ProjectEvaluation/bpa.kitchen.groupmeal.metadata.v7.bin index aa3ec0e..154c88a 100644 Binary files a/.vs/ProjectEvaluation/bpa.kitchen.groupmeal.metadata.v7.bin and b/.vs/ProjectEvaluation/bpa.kitchen.groupmeal.metadata.v7.bin differ diff --git a/.vs/ProjectEvaluation/bpa.kitchen.groupmeal.projects.v7.bin b/.vs/ProjectEvaluation/bpa.kitchen.groupmeal.projects.v7.bin index f7b3410..84fdc7a 100644 Binary files a/.vs/ProjectEvaluation/bpa.kitchen.groupmeal.projects.v7.bin and b/.vs/ProjectEvaluation/bpa.kitchen.groupmeal.projects.v7.bin differ diff --git a/BPA.KitChen.GroupMeal.Application/Service/OneCard/DiningPlate/DiningPlateServices.cs b/BPA.KitChen.GroupMeal.Application/Service/OneCard/DiningPlate/DiningPlateServices.cs new file mode 100644 index 0000000..463026a --- /dev/null +++ b/BPA.KitChen.GroupMeal.Application/Service/OneCard/DiningPlate/DiningPlateServices.cs @@ -0,0 +1,92 @@ +using BPA.KitChen.GroupMeal.Application.BaseDto; +using BPA.KitChen.GroupMeal.Application.Service.OneCard.DiningPlate.Dtos; +using BPA.KitChen.GroupMeal.Application.Service.OneCard.DiningPlate.Service; +using BPA.KitChen.GroupMeal.Core.Entity; +using BPA.KitChen.GroupMeal.Core.Enum; +using BPA.KitChen.GroupMeal.SqlSugar; +using Furion.DatabaseAccessor; +using Furion.DynamicApiController; +using Furion.FriendlyException; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Mvc; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.KitChen.GroupMeal.Application.Service.OneCard.DiningPlate +{ + + [ApiDescriptionSettings("餐盘管理", Tag = "餐盘管理")] + public class DiningPlateServices: IDynamicApiController + { + private readonly IDiningPlateService _diningPlateService; + + public DiningPlateServices(IDiningPlateService diningPlateService) + { + _diningPlateService = diningPlateService; + } + + + /// + /// 分页查询 + /// + /// + /// + [HttpPost("/api/DiningPlate/Page")] + public async Task Page(DiningPlatePageIndexDto inputDto) + { + return await _diningPlateService.Page(inputDto); + } + + /// + /// 新增餐盘 + /// + /// + /// + [HttpPost("/api/DiningPlate/Add")] + public async Task Add(DiningPlateCreateOrUpdataDto inputDto) + { + return await _diningPlateService.Add(inputDto); + } + + + /// + /// 修改餐盘 + /// + /// + /// + [HttpPost("/api/DiningPlate/Update")] + public async Task Update(DiningPlateCreateOrUpdataDto inputDto) + { + return await _diningPlateService.Update(inputDto); + } + + + /// + /// 启用警用 + /// + /// + /// + [HttpPost("/api/DiningPlate/EnableDisable")] + public async Task EnableDisable(DiningPlateCreateOrUpdataDto inputDto) + { + return await _diningPlateService.EnableDisable(inputDto); + } + + + + /// + /// 删除 + /// + /// + /// + [HttpPost("/api/DiningPlate/Del")] + public async Task Del(string id) + { + return await _diningPlateService.Del(id); + } + } +} diff --git a/BPA.KitChen.GroupMeal.Application/Service/OneCard/DiningPlate/Dtos/DiningPlateDto.cs b/BPA.KitChen.GroupMeal.Application/Service/OneCard/DiningPlate/Dtos/DiningPlateDto.cs new file mode 100644 index 0000000..5841ad7 --- /dev/null +++ b/BPA.KitChen.GroupMeal.Application/Service/OneCard/DiningPlate/Dtos/DiningPlateDto.cs @@ -0,0 +1,59 @@ +using BPA.KitChen.GroupMeal.Application.BaseDto; +using BPA.KitChen.GroupMeal.Core.Entity; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.KitChen.GroupMeal.Application.Service.OneCard.DiningPlate.Dtos +{ + + public class DiningPlateDto : BPA_DiningPlate + { + /// + /// 是否占用 + /// + public bool IsOccupy { get; set; } + } + + public class DiningPlateCreateOrUpdataDto: BPA_DiningPlate + { + /// + /// 二维码 + /// + public string QRCode { get; set; } + + /// + /// 芯片码 + /// + public string ChipCode { get; set; } + + + + /// + /// 是否占用 + /// + public bool IsOccupy { get; set; } + } + + public class DiningPlatePageIndexDto: PageInputBase + { + /// + /// 二维码 + /// + public string QRCode { get; set; } + + /// + /// 芯片码 + /// + public string ChipCode { get; set; } + + + /// + /// 是否占用 + /// + public bool? IsOccupy { get; set; } + } + +} diff --git a/BPA.KitChen.GroupMeal.Application/Service/OneCard/DiningPlate/Service/DiningPlateService.cs b/BPA.KitChen.GroupMeal.Application/Service/OneCard/DiningPlate/Service/DiningPlateService.cs new file mode 100644 index 0000000..e768ae7 --- /dev/null +++ b/BPA.KitChen.GroupMeal.Application/Service/OneCard/DiningPlate/Service/DiningPlateService.cs @@ -0,0 +1,155 @@ +using BPA.KitChen.GroupMeal.Application.Service.OneCard.DiningPlate.Dtos; +using BPA.KitChen.GroupMeal.Core.Entity; +using BPA.KitChen.GroupMeal.Core.Enum; +using BPA.KitChen.GroupMeal.SqlSugar; +using Furion.DependencyInjection; +using Furion.FriendlyException; +using MQTTnet.Client; +using NPOI.POIFS.Crypt.Dsig; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BPA.KitChen.GroupMeal.Application.BaseDto; +using BPA.KitChen.GroupMeal.Application.Service.OneCard.Member.MemberInfo.Dtos.MemberTag; +using Microsoft.AspNetCore.Components.Forms; +using MathNet.Numerics.Distributions; + +namespace BPA.KitChen.GroupMeal.Application.Service.OneCard.DiningPlate.Service +{ + public class DiningPlateService:ITransient, IDiningPlateService + { + private readonly SqlSugarScope db; + + public DiningPlateService() + { + db = SqlSugarDb.Db; + } + + /// + /// 分页查询 + /// + /// + /// + public async Task Page(DiningPlatePageIndexDto inputDto) + { + int total = new RefAsync(); + var res = db.Queryable() + .Where(a => a.IsDeleted == 0) + .WhereIF(!string.IsNullOrEmpty(inputDto.QRCode),x=>x.QRCode==inputDto.QRCode) + .WhereIF(!string.IsNullOrEmpty(inputDto.ChipCode), x => x.ChipCode == inputDto.ChipCode) + + .OrderBy(x => x.CreateAt, OrderByType.Desc) + .Select(t => new DiningPlateDto + { + Id = t.Id.SelectAll() + + }).ToPageList(inputDto.Current, inputDto.PageSize, ref total); + return new PageUtil() + { + Data = res, + Total = total + }; + } + + /// + /// 新增餐盘 + /// + /// + /// + public async Task Add(DiningPlateCreateOrUpdataDto inputDto) + { + // + var data = await db.Queryable() + .FirstAsync(x => inputDto.QRCode == x.QRCode || inputDto.ChipCode == x.ChipCode); + if (data!=null) + { + throw Oops.Oh($"二维码或芯片码已存在"); + } + + data = new BPA_DiningPlate() + { + ChipCode = inputDto.ChipCode, + QRCode = inputDto.QRCode, + Status = CommonStatus.ENABLE, + }; + var res=await db.Insertable(data).ExecuteCommandAsync(); + + return res > 0; + } + + + /// + /// 修改餐盘 + /// + /// + /// + public async Task Update(DiningPlateCreateOrUpdataDto inputDto) + { + var data1 = await db.Queryable() + .FirstAsync(x => inputDto.QRCode == x.QRCode || inputDto.ChipCode == x.ChipCode); + + var data2 = await db.Queryable() + .FirstAsync(x =>x.Id==inputDto.Id); + if (data2==null) + { + throw Oops.Oh($"操作数据不存在"); + } + else + { + if (data1!=null&& data1.Id!=data2.Id) + { + throw Oops.Oh($"二维码或芯片码已存在"); + } + } + + data2.ChipCode = inputDto.ChipCode; + data2.QRCode = inputDto.QRCode; + var res = await db.Updateable(data2).ExecuteCommandAsync(); + return res > 0; + } + + + /// + /// 启用警用 + /// + /// + /// + public async Task EnableDisable(DiningPlateCreateOrUpdataDto inputDto) + { + + + var data = await db.Queryable() + .FirstAsync(x => x.Id == inputDto.Id); + if (data == null) + { + throw Oops.Oh($"操作数据不存在"); + } + + data.Status = data.Status== CommonStatus.DISABLE? CommonStatus.ENABLE: CommonStatus.DISABLE; + var res = await db.Updateable(data).ExecuteCommandAsync(); + return res > 0; + } + + + /// + /// 删除 + /// + /// + /// + public async Task Del(string id) + { + var data = await db.Queryable() + .FirstAsync(x => x.Id == id); + if (data == null) + { + throw Oops.Oh($"操作数据不存在"); + } + var res =await db.Deleteable(data).ExecuteCommandAsync(); + + return res > 0; + } + } +} diff --git a/BPA.KitChen.GroupMeal.Application/Service/OneCard/DiningPlate/Service/IDiningPlateService.cs b/BPA.KitChen.GroupMeal.Application/Service/OneCard/DiningPlate/Service/IDiningPlateService.cs new file mode 100644 index 0000000..8597b45 --- /dev/null +++ b/BPA.KitChen.GroupMeal.Application/Service/OneCard/DiningPlate/Service/IDiningPlateService.cs @@ -0,0 +1,58 @@ +using BPA.KitChen.GroupMeal.Application.BaseDto; +using BPA.KitChen.GroupMeal.Application.Service.OneCard.DiningPlate.Dtos; +using BPA.KitChen.GroupMeal.Core.Entity; +using BPA.KitChen.GroupMeal.Core.Enum; +using Furion.DatabaseAccessor; +using Furion.FriendlyException; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.KitChen.GroupMeal.Application.Service.OneCard.DiningPlate.Service +{ + public interface IDiningPlateService + { + + /// + /// 分页查询 + /// + /// + /// + Task Page(DiningPlatePageIndexDto inputDto); + + /// + /// 新增餐盘 + /// + /// + /// + Task Add(DiningPlateCreateOrUpdataDto inputDto); + + + /// + /// 修改餐盘 + /// + /// + /// + Task Update(DiningPlateCreateOrUpdataDto inputDto); + + + /// + /// 启用警用 + /// + /// + /// + Task EnableDisable(DiningPlateCreateOrUpdataDto inputDto); + + + + + /// + /// 删除 + /// + /// + /// + Task Del(string id); + } +} diff --git a/BPA.KitChen.GroupMeal.Core/Entity/BPA_DiningPlate.cs b/BPA.KitChen.GroupMeal.Core/Entity/BPA_DiningPlate.cs new file mode 100644 index 0000000..878d409 --- /dev/null +++ b/BPA.KitChen.GroupMeal.Core/Entity/BPA_DiningPlate.cs @@ -0,0 +1,31 @@ +using BPA.KitChen.GroupMeal.Core.Entity.Base; +using BPA.KitChen.GroupMeal.Core.Enum; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.KitChen.GroupMeal.Core.Entity +{ + /// + /// 餐盘 + /// + [SugarTable("bpa_diningplate")] + public class BPA_DiningPlate: IBaseGroupIdEntity + { + + /// + /// 二维码 + /// + public string QRCode { get; set; } + + /// + /// 芯片码 + /// + public string ChipCode { get; set; } + + + } +}