fix 字段修改
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Dlhis.Basic.Organization.Services.Implements;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Controllers;
|
||||
|
||||
@@ -57,4 +60,14 @@ public class GainfoPermissionsController : ControllerBase
|
||||
{
|
||||
return await _gainfoPermissions.GetAssignDeviceCodesAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前绑定的设备组信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("assignGroups")]
|
||||
public async Task<List<DeviceGroupTreeResponse>> GetAssignGroupAsync(string userNo)
|
||||
{
|
||||
return await _gainfoPermissions.GetAssignGroupAsync(userNo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Dlhis.Basic.Organization.Response
|
||||
{
|
||||
public class GetAssignGroupResponse
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services.Implements;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
@@ -14,4 +13,6 @@ public interface IGainfoPermissions : IScopeDependency
|
||||
Task<List<GetDevicesUnderGroupByUserNoResponse>> GetDevicesUnderGroupByUserNoAsync(string userNo, string deviceGroupCode);
|
||||
|
||||
Task<Pagination<DevicePageResponse>> GetAssignDeviceCodesAsync(DeviceAssRequest request);
|
||||
|
||||
Task<List<DeviceGroupTreeResponse>> GetAssignGroupAsync(string userNo);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
@@ -8,6 +9,7 @@ using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
@@ -193,6 +195,16 @@ public class GainfoPermissions : IGainfoPermissions
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<DeviceGroupTreeResponse>> GetAssignGroupAsync(string userNo)
|
||||
{
|
||||
var groups = await _devicePermissionService.GetAssignmentsAsync(DeviceAssignmentTypeEnumType.Group, AssignTypeEnumType.User, userNo);
|
||||
return await _dbContext.Queryable<DeviceGroupEntity>()
|
||||
.Where(x => groups.Contains(x.Code))
|
||||
.Select<DeviceGroupTreeResponse>()
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
private IEnumerable<Guid> RecursionGetNext(DeviceGroupEntity current, List<DeviceGroupEntity> deviceGroups)
|
||||
{
|
||||
var next = deviceGroups.Where(x => x.PCode == current.Code).ToList();
|
||||
|
||||
@@ -24,7 +24,7 @@ public class MenuDishesController : ControllerBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取菜单
|
||||
/// 菜单分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
@@ -46,7 +46,7 @@ public class MenuDishesController : ControllerBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取菜品
|
||||
/// 菜品分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
@@ -34,6 +34,18 @@ public class MiniProgramOrderDetailController : ControllerBase
|
||||
return await _miniProgramOrderDetailService.GetMiniProgramOrderAsync(request);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 明细保存
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("saveDetail")]
|
||||
public async Task SaveDetailAsync(SaveDetailRequest request)
|
||||
{
|
||||
await _miniProgramOrderDetailService.SaveDetailAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 明细分页
|
||||
/// </summary>
|
||||
@@ -44,4 +56,14 @@ public class MiniProgramOrderDetailController : ControllerBase
|
||||
{
|
||||
return await _miniProgramOrderDetailService.GetDetailAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下单
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("order")]
|
||||
public async Task OrderAsync(OrderRequest request)
|
||||
{
|
||||
await _miniProgramOrderDetailService.OrderAsync(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,7 @@ namespace Dlhis.Canteen.Order.Request
|
||||
public class GetMenuRequest : PageDto
|
||||
{
|
||||
public Guid? PlaceCode { get; set; }
|
||||
|
||||
public string Factory { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,9 @@ namespace Dlhis.Canteen.Order.Request
|
||||
{
|
||||
public class GetMiniProgramOrderRequest : PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 用餐日期
|
||||
/// </summary>
|
||||
public DateOnly? SysDate { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
45
Src/Dlhis.Canteen/Order/Request/OrderRequest.cs
Normal file
45
Src/Dlhis.Canteen/Order/Request/OrderRequest.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using SqlSugar.DbConvert;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Request
|
||||
{
|
||||
public class OrderRequest
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 订餐人
|
||||
/// </summary>
|
||||
public string UserCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 食堂
|
||||
/// </summary>
|
||||
public Guid PlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐别
|
||||
/// </summary>
|
||||
public ShiftEnumType ShiftType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配送地址
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品
|
||||
/// </summary>
|
||||
public Guid DishesCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public int DishesNum { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 支付方式
|
||||
/// </summary>
|
||||
public CanteenPayEnumType PayType { get; set; }
|
||||
}
|
||||
}
|
||||
61
Src/Dlhis.Canteen/Order/Request/SaveDetailRequest.cs
Normal file
61
Src/Dlhis.Canteen/Order/Request/SaveDetailRequest.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using SqlSugar.DbConvert;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Request
|
||||
{
|
||||
public class SaveDetailRequest
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单号
|
||||
/// </summary>
|
||||
public string ThirdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业日
|
||||
/// </summary>
|
||||
public DateOnly BusinessDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
public ShiftEnumType ShiftType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品编码
|
||||
/// </summary>
|
||||
public Guid DishesCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品名称
|
||||
/// </summary>
|
||||
public Guid DishesName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单价
|
||||
/// </summary>
|
||||
public decimal Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string Unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public int Num { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 金额
|
||||
/// </summary>
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单明细状态
|
||||
/// </summary>
|
||||
public OrderDetailsStatusEnumType OrderStatus { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,14 @@ namespace Dlhis.Canteen.Order.Response
|
||||
public DateOnly BusinessDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐别
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
public string ShiftType { get; set; }
|
||||
public ShiftEnumType ShiftType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次CN
|
||||
/// </summary>
|
||||
public string ShiftTypeCN => ShiftType.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 菜品编码
|
||||
|
||||
@@ -12,6 +12,11 @@ namespace Dlhis.Canteen.Order.Response
|
||||
/// </summary>
|
||||
public Guid MenuCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单名称
|
||||
/// </summary>
|
||||
public string MenuName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 大类
|
||||
/// </summary>
|
||||
|
||||
@@ -21,6 +21,11 @@ namespace Dlhis.Canteen.Order.Response
|
||||
/// </summary>
|
||||
public Guid PlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属营业点名称
|
||||
/// </summary>
|
||||
public string PlaceName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 厂区
|
||||
/// </summary>
|
||||
|
||||
@@ -32,6 +32,11 @@ namespace Dlhis.Canteen.Order.Response
|
||||
/// </summary>
|
||||
public string DepartmentNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
/// </summary>
|
||||
public string DepartmentName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 成本中心
|
||||
/// </summary>
|
||||
@@ -52,16 +57,31 @@ namespace Dlhis.Canteen.Order.Response
|
||||
/// </summary>
|
||||
public Guid PlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业名称
|
||||
/// </summary>
|
||||
public string PlaceName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
public string ShiftType { get; set; }
|
||||
public ShiftEnumType ShiftType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次CN
|
||||
/// </summary>
|
||||
public string ShiftTypeCN => ShiftType.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 菜品
|
||||
/// </summary>
|
||||
public Guid DishesCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品名称
|
||||
/// </summary>
|
||||
public string DishesName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
@@ -97,6 +117,16 @@ namespace Dlhis.Canteen.Order.Response
|
||||
/// </summary>
|
||||
public string OrderStatusCN => OrderStatus.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 订单类型
|
||||
/// </summary>
|
||||
public CanteenDishesEnumType OrderType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单类型CN
|
||||
/// </summary>
|
||||
public string OrderTypeCN => OrderType.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 总金额
|
||||
/// </summary>
|
||||
|
||||
@@ -9,6 +9,10 @@ namespace Dlhis.Canteen.Order.Services
|
||||
{
|
||||
Task<Pagination<GetMiniProgramOrderResponse>> GetMiniProgramOrderAsync(GetMiniProgramOrderRequest request);
|
||||
|
||||
Task SaveDetailAsync(SaveDetailRequest request);
|
||||
|
||||
Task<Pagination<GetDetailResponse>> GetDetailAsync( GetDetailRequest request);
|
||||
|
||||
Task OrderAsync(OrderRequest request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,15 +24,15 @@ namespace Dlhis.Canteen.Order.Services.Implements
|
||||
|
||||
public async Task<Pagination<GetMenuResponse>> GetMenuAsync(GetMenuRequest request)
|
||||
{
|
||||
var currentTenantId = _currentUser.GetStringTenantId();
|
||||
|
||||
var page = await _dbContext.Queryable<CanteenMenuEntity>()
|
||||
.Where(x => x.Factory == currentTenantId)
|
||||
.LeftJoin<BusinessPlaceEntity>((x,place) => x.PlaceCode == place.Code)
|
||||
.WhereIF(!request.Factory.IsEmpty(),x => x.Factory == request.Factory)
|
||||
.WhereIF(request.PlaceCode.HasValue, x => request.PlaceCode == x.PlaceCode)
|
||||
.WhereIF(!request.Search.IsEmpty(),x => x.Name.Contains(request.Search))
|
||||
.Select(x => new GetMenuResponse
|
||||
.Select((x,place) => new GetMenuResponse
|
||||
{
|
||||
ShiftTypesSrt = x.ShiftTypes.ToString(),
|
||||
PlaceName = place.Name,
|
||||
},true)
|
||||
.ToPageListAsync(request);
|
||||
return page;
|
||||
@@ -62,9 +62,13 @@ namespace Dlhis.Canteen.Order.Services.Implements
|
||||
public async Task<Pagination<GetDishesResponse>> GetDishesAsync(GetDishesRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<CanteenDishesEntity>()
|
||||
.LeftJoin<CanteenMenuEntity>((x,menu)=>x.MenuCode == menu.Code)
|
||||
.WhereIF(request.MenuCode.HasValue, x => request.MenuCode == x.MenuCode)
|
||||
.WhereIF(!request.Search.IsEmpty(),x => x.Name.Contains(request.Search))
|
||||
.Select<GetDishesResponse>()
|
||||
.Select((x,menu) => new GetDishesResponse
|
||||
{
|
||||
MenuName = menu.Name,
|
||||
},true)
|
||||
.ToPageListAsync(request);
|
||||
return page;
|
||||
}
|
||||
|
||||
@@ -1,32 +1,64 @@
|
||||
using Dlhis.Canteen.Order.Request;
|
||||
using Dlhis.Canteen.Order.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Dlhis.Sys.Api;
|
||||
using Kurisu.AspNetCore.Utils;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Services.Implements;
|
||||
|
||||
public class MiniProgramOrderDetailService : IMiniProgramOrderDetailService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public MiniProgramOrderDetailService(IDbContext dbContext)
|
||||
private readonly ITenantApi _tenantApi;
|
||||
public MiniProgramOrderDetailService(IDbContext dbContext, ITenantApi tenantApi)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_tenantApi = tenantApi;
|
||||
}
|
||||
|
||||
public async Task<Pagination<GetMiniProgramOrderResponse>> GetMiniProgramOrderAsync(GetMiniProgramOrderRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<MiniProgramOrderEntity>()
|
||||
.WhereIF(!request.Search.IsEmpty(), x => x.Name == request.Search || x.Code == request.Search)
|
||||
.Select<GetMiniProgramOrderResponse>()
|
||||
.LeftJoin<BusinessPlaceEntity>((order,place) => order.PlaceCode == place.Code)
|
||||
.LeftJoin<CanteenDishesEntity>((order, place,dishers) => order.DishesCode == dishers.Code)
|
||||
.LeftJoin<DepartmentEntity>((order, place, dishers,depart) => order.DepartmentNo == depart.No)
|
||||
.WhereIF(!request.Search.IsEmpty(), order => order.Name == request.Search || order.Code == request.Search)
|
||||
.WhereIF(request.SysDate.HasValue,order=>order.SysDate == request.SysDate)
|
||||
.OrderBy(order => order.CostDate,SqlSugar.OrderByType.Desc)
|
||||
.Select((order, place, dishers, depart) => new GetMiniProgramOrderResponse
|
||||
{
|
||||
PlaceName = place.Name,
|
||||
DepartmentName = depart.Name,
|
||||
DishesName = dishers.Name,
|
||||
},true)
|
||||
.ToPageListAsync(request);
|
||||
return page;
|
||||
}
|
||||
|
||||
public async Task SaveDetailAsync(SaveDetailRequest request)
|
||||
{
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var entity = request.Adapt<OrderDetailsEntity>();
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _dbContext.Queryable<OrderDetailsEntity>()
|
||||
.Where(x => x.Id == request.Id)
|
||||
.FirstAsync();
|
||||
request.Adapt(entity);
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Pagination<GetDetailResponse>> GetDetailAsync(GetDetailRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<OrderDetailsEntity>()
|
||||
@@ -36,4 +68,98 @@ public class MiniProgramOrderDetailService : IMiniProgramOrderDetailService
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
public async Task OrderAsync(OrderRequest request)
|
||||
{
|
||||
//判断时间
|
||||
DateTime currentTime = DateTime.Now;
|
||||
TimeSpan ninePM = new TimeSpan(20, 30, 0);
|
||||
if (currentTime.TimeOfDay > ninePM)
|
||||
{
|
||||
true.ThrowIfTrue("20:30之后无法订餐!");
|
||||
}
|
||||
//判断营业日
|
||||
var dishes = await _dbContext.Queryable<CanteenDishesEntity>().Where(x => x.Code == request.DishesCode).FirstAsync();
|
||||
dishes.Enable.ThrowIfFalse($"{dishes.Name}没启用!");
|
||||
|
||||
var menu = await _dbContext.Queryable<CanteenMenuEntity>().Where(x => x.Code == dishes.MenuCode).FirstAsync();
|
||||
menu.Enable.ThrowIfFalse($"{dishes.Name}没启用!");
|
||||
|
||||
// 获取用餐日期
|
||||
DateOnly tomorrow = DateOnly.FromDateTime(DateTime.Today.AddDays(1));
|
||||
if (!(tomorrow >= menu.StartDate && tomorrow <= menu.EndDate))
|
||||
{
|
||||
true.ThrowIfTrue($"菜品:{dishes.Name}对应的菜单:{menu.Name}不在营业日!");
|
||||
}
|
||||
if(dishes.RestrictedNum < 0)
|
||||
{
|
||||
true.ThrowIfTrue($"菜品:{dishes.Name}已售罄!");
|
||||
}
|
||||
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>()
|
||||
.Where(x => x.Code == request.UserCode)
|
||||
.FirstAsync();
|
||||
|
||||
//判断是否订过餐
|
||||
var flag = await _dbContext.Queryable<MiniProgramOrderEntity>()
|
||||
.Where(x => x.SysDate == tomorrow && x.ShiftType == request.ShiftType && x.Code == request.UserCode && x.OrderStatus == MiniProgramOrderStatusEnumType.I)
|
||||
.AnyAsync();
|
||||
flag.ThrowIfTrue($"工号:{request.UserCode} 姓名:{gainfo.Name} 已经定过{tomorrow}的{request.ShiftType.GetDescription()}!");
|
||||
|
||||
//支付方式
|
||||
/* var result = await _tenantApi.GetTenantTreeAsync();
|
||||
var tree = result.Data;
|
||||
var shanxi = tree.Where(x => x.Name == "山西基地").FirstOrDefault();
|
||||
var codes = shanxi.Next.Select(x => x.Code).ToList();
|
||||
if (!codes.Contains(gainfo.Factory))
|
||||
{
|
||||
if (request.PayType == CanteenPayEnumType.Repair)
|
||||
{
|
||||
true.ThrowIfTrue($"非山西,支付方式不能为{request.PayType.GetDescription()}");
|
||||
}
|
||||
}*/
|
||||
|
||||
//生成订单
|
||||
var order = new MiniProgramOrderEntity
|
||||
{
|
||||
No = "O" + SnowFlakeHelper.Instance.NextId(),
|
||||
Name = gainfo.Name,
|
||||
Code = gainfo.Code,
|
||||
Werks = gainfo.Werks,
|
||||
DepartmentNo = gainfo.DepartmentNo,
|
||||
CostId = gainfo.CostId,
|
||||
Workplace = gainfo.Workplace,
|
||||
Factory = gainfo.Factory,
|
||||
PlaceCode = request.PlaceCode,
|
||||
ShiftType = request.ShiftType,
|
||||
DishesCode = request.DishesCode,
|
||||
Phone = gainfo.Phone,
|
||||
SysDate = tomorrow,
|
||||
CostDate = DateTime.Now,
|
||||
PayType = request.PayType,
|
||||
OrderStatus = MiniProgramOrderStatusEnumType.I,
|
||||
OrderType = dishes.Type,
|
||||
};
|
||||
//订单明细
|
||||
var detail = new OrderDetailsEntity
|
||||
{
|
||||
ThirdNo = order.No,
|
||||
SysDate = tomorrow,
|
||||
ShiftType= request.ShiftType,
|
||||
DishesCode= request.DishesCode,
|
||||
DishesName = dishes.Name,
|
||||
Price = dishes.Amount,
|
||||
Unit = dishes.Unit,
|
||||
Num = request.DishesNum,
|
||||
Amount = request.DishesNum * dishes.Amount,
|
||||
OrderStatus = OrderDetailsStatusEnumType.I,
|
||||
};
|
||||
order.TotalAmount = detail.Amount;
|
||||
|
||||
await _dbContext.InsertAsync(order);
|
||||
await _dbContext.InsertAsync(detail);
|
||||
dishes.RestrictedNum-=request.DishesNum;
|
||||
await _dbContext.UpdateAsync(dishes);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
"AllowedHosts": "*",
|
||||
"InternalRequest": {
|
||||
"CommonRequestUrl": "http://common",
|
||||
"BasicRequestUrl": "http://basic"
|
||||
"BasicRequestUrl": "http://basic",
|
||||
"SysRequestUrl": "http://sys"
|
||||
},
|
||||
"FilterOptions": {
|
||||
"EnableApiRequestLog": true
|
||||
|
||||
@@ -68,8 +68,8 @@ namespace Dlhis.Entity.Canteen.Entities
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "餐次", IsNullable = true)]
|
||||
public string ShiftType { get; set; }
|
||||
[SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "餐次")]
|
||||
public ShiftEnumType ShiftType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品
|
||||
@@ -107,6 +107,12 @@ namespace Dlhis.Entity.Canteen.Entities
|
||||
[SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "订单状态")]
|
||||
public MiniProgramOrderStatusEnumType OrderStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "订单类型")]
|
||||
public CanteenDishesEnumType OrderType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 总金额
|
||||
/// </summary>
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
using Kurisu.SqlSugar;
|
||||
using SqlSugar;
|
||||
using SqlSugar.DbConvert;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dlhis.Entity.Canteen.Entities
|
||||
{
|
||||
@@ -23,16 +18,16 @@ namespace Dlhis.Entity.Canteen.Entities
|
||||
public string ThirdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业日
|
||||
/// 营业日(用餐日期)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "营业日")]
|
||||
public DateOnly BusinessDate { get; set; }
|
||||
public DateOnly SysDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐别
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "餐别")]
|
||||
public string ShiftType { get; set; }
|
||||
[SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "餐次")]
|
||||
public ShiftEnumType ShiftType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品编码
|
||||
@@ -44,7 +39,7 @@ namespace Dlhis.Entity.Canteen.Entities
|
||||
/// 菜品名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "菜品名称")]
|
||||
public Guid DishesName { get; set; }
|
||||
public string DishesName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单价
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ApkFileEntity : SugarBaseEntity
|
||||
/// 产品代码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "产品代码")]
|
||||
public string? ProductCode { get; set; }
|
||||
public string ProductCode { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user