@@ -66,6 +66,15 @@ namespace BPA.SAAS.Manage.Application.DataBase | |||
{ | |||
return await _batchingService.GetBatchingList(); | |||
} | |||
/// <summary> | |||
/// 物料列表 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/batching/getbatchingselectlist")] | |||
public async Task<List<BatchingList>> GetBatchingSelectList() | |||
{ | |||
return await _batchingService.GetBatchingSelectList(); | |||
} | |||
[HttpPost("/api/batching/updatebatchingstatus")] | |||
public async Task<bool> UpdateBatchingStatus(BatchingStatusDto dto) | |||
{ | |||
@@ -0,0 +1,78 @@ | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.Bom; | |||
using BPA.SAAS.Manage.Application.DataBase.Interface; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase | |||
{ | |||
[ApiDescriptionSettings("Goods", Tag = "配方管理")] | |||
public class BomServices: IDynamicApiController, ITransient | |||
{ | |||
IBomService _bomService; | |||
public BomServices(IBomService bomService) | |||
{ | |||
_bomService= bomService; | |||
} | |||
/// <summary> | |||
/// 查询所有配方信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/bom/getbomlist")] | |||
public async Task<List<BomSelectList>> GetBomList() | |||
{ | |||
return await _bomService.GetBomList(); | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/bom/add")] | |||
public async Task<bool> AddBom(BomInputDto dto) | |||
{ | |||
return await _bomService.AddBom(dto); | |||
} | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/bom/update")] | |||
public async Task<bool> UpdateBom(BomInputDto dto) | |||
{ | |||
return await _bomService.UpdateBom(dto); | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/bom/delete")] | |||
public async Task<bool> DeleteBom(string id) | |||
{ | |||
return await _bomService.DeleteBom(id); | |||
} | |||
/// <summary> | |||
/// 添加配方分类 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/bom/addbomtype")] | |||
public async Task<bool> AddBomType(AddBomTypeInputDto dto) | |||
{ | |||
return await _bomService.AddBomType(dto); | |||
} | |||
/// <summary> | |||
/// 配方分类列表 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/bom/getbomtypelist")] | |||
public async Task<List<dynamic>> GetBomTypeList() | |||
{ | |||
return await _bomService.GetBomTypeList(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Batching | |||
{ | |||
public class BatchingList | |||
{ | |||
public string Id { get; set; } | |||
public string Name { get; set; } | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Bom | |||
{ | |||
public class AddBomTypeInputDto | |||
{ | |||
public string Name { get; set; } | |||
} | |||
} |
@@ -0,0 +1,30 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Bom | |||
{ | |||
public class BomInputDto | |||
{ | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 配方名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 1主料配方0 辅料配方 | |||
/// </summary> | |||
public bool IsMain { get; set; } | |||
/// <summary> | |||
/// 排序 | |||
/// </summary> | |||
public int Sort { get; set; } = 1; | |||
/// <summary> | |||
/// 配方分类id集合 | |||
/// </summary> | |||
public List<string> BomTypeIds { get; set; } | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Bom | |||
{ | |||
public class BomSelectList | |||
{ | |||
public string Id { get; set; } | |||
public string Name { get; set; } | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods | |||
{ | |||
public class GoodsBomDto | |||
{ | |||
public string GoodsId { get; set; } | |||
public List<string> BomId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods | |||
{ | |||
public class GoodsDto | |||
{ | |||
public string Id { get; set; } | |||
public string Name { get; set; } | |||
public string Descritption { get; set; } | |||
public string ImgUrl { get; set; } | |||
public int ImgMode { get; set; } | |||
public int Sort { get; set; } | |||
public decimal Price { get; set; } | |||
public string GoodsUintId { get; set; } | |||
public string IsWeigh { get; set; } | |||
public string Design { get; set; } | |||
public string DefaultMate { get; set; } | |||
public string IsAttrubute { get; set; } | |||
public string GoodsTypeId { get; set; } | |||
public string Status { get; set; } | |||
} | |||
} |
@@ -0,0 +1,23 @@ | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods | |||
{ | |||
public class GoodsQueryDto: PageInputBase | |||
{ | |||
public string Name { get; set; } | |||
public string Code { get; set; } | |||
public string Design { get; set; } | |||
public string GoodsTypeId { get; set; } | |||
/// <summary> | |||
/// 状态 【正常 停用】默认 正常 | |||
/// </summary> | |||
public string Status { get; set; } | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods | |||
{ | |||
public class GoodsUintDto | |||
{ | |||
public string Name { get; set; } | |||
} | |||
} |
@@ -0,0 +1,19 @@ | |||
using BPA.SAAS.Manage.Core.Base; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods | |||
{ | |||
public class OrtherGoodsQueryDto : PageInputBase | |||
{ | |||
/// <summary> | |||
/// ID | |||
/// </summary> | |||
public string GoodsId { get; set; } | |||
public string StoreId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,29 @@ | |||
using BPA.SAAS.Manage.Core.Device; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology | |||
{ | |||
public class DeviceGoodsTechnologyView : BPA_DeviceInfo | |||
{ | |||
public List<GoodsTechnologyInfo> GoodsTechnologyInfo { get; set; } | |||
} | |||
public class GoodsTechnologyInfo | |||
{ | |||
/// <summary> | |||
/// 工艺id | |||
/// </summary> | |||
public string DeviceTechnologyId { get; set; } | |||
/// <summary> | |||
/// 工艺名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 设备版本 | |||
/// </summary> | |||
public string DeviceVersionKey { get; set; } | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology | |||
{ | |||
public class GoodsTechnologDelete | |||
{ | |||
public string devideId { get; set; } | |||
public string goodsId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,30 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology | |||
{ | |||
public class GoodsTechnologyActionBaseDto | |||
{ | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 步骤名称 | |||
/// </summary> | |||
public string StepName { get; set; } | |||
/// <summary> | |||
/// 动作json | |||
/// </summary> | |||
public string ActionJson { get; set; } | |||
/// <summary> | |||
/// 商品属性id集合 | |||
/// </summary> | |||
public string GoodsAttributeId { get; set; } | |||
public string ChnologyId { get; set; } | |||
public int? Sort { get; set; } | |||
public bool IsBatch { get; set; } = false; | |||
public string GoodsId { get; set; } | |||
public string DeviceId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,45 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology | |||
{ | |||
public class GoodsTechnologyActionListView | |||
{ | |||
public string DeviceId { get; set; } | |||
public string DeviceName { get; set; } | |||
public List<GoodsTechnologyActionView> Data { get; set; } | |||
} | |||
public class GoodsTechnologyActionView | |||
{ | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 步骤名称 | |||
/// </summary> | |||
public string StepName { get; set; } | |||
/// <summary> | |||
/// 动作json | |||
/// </summary> | |||
public string ActionJson { get; set; } | |||
/// <summary> | |||
/// 商品属性id集合 | |||
/// </summary> | |||
public string GoodsAttributeId { get; set; } | |||
/// <summary> | |||
/// 是否物料 | |||
/// </summary> | |||
public bool IsBatch { get; set; } | |||
/// <summary> | |||
/// 动作value | |||
/// </summary> | |||
public string ChnologyId { get; set; } | |||
public DateTime CreateAt { get; set; } | |||
public string GroupId { get; set; } | |||
public int IsDeleted { get; set; } | |||
public int Sort { get; set; } | |||
public string GoodsId { get; set; } | |||
public string DeviceId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsType | |||
{ | |||
public class GoodsTypeDto | |||
{ | |||
public string Id { get; set; } | |||
public string Pid { get; set; } | |||
public string Name { get; set; } | |||
public int Sort { get; set; } | |||
public int Status { get; set; } | |||
public string Remark { get; set; } | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
using BPA.SAAS.Manage.Core.Base; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsType | |||
{ | |||
public class GoodsTypeQueryDto: PageInputBase | |||
{ | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 状态 | |||
/// </summary> | |||
public string Status { get; set; } | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsType | |||
{ | |||
public class GoodsTypeTree | |||
{ | |||
[SugarColumn(IsTreeKey = true)] | |||
public string Id { get; set; } //关联字段 默认是主键 | |||
public string Name { get; set; } | |||
public int Sort { get; set; } | |||
public string Remark { get; set; } | |||
public CommonStatus Status { get; set; } | |||
public string Pid { get; set; }//父级字段 | |||
public List<GoodsTypeTree> Children { get; set; } | |||
} | |||
} |
@@ -88,15 +88,6 @@ namespace BPA.SAAS.Manage.Application.DataBase | |||
{ | |||
return await _goodsAttributeServices.GetByGoodsIdAttribute(id); | |||
} | |||
/// <summary> | |||
/// 添加商品配方 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goodsattribute/addgoodsbomattribute")] | |||
public async Task<bool> AddGoodsBomAttribute(GoodsBomAttributeDto dto) | |||
{ | |||
return await _goodsAttributeServices.AddGoodsBomAttribute(dto); | |||
} | |||
} | |||
} |
@@ -0,0 +1,132 @@ | |||
using BPA.Franchisee.Application.FranchiseeCenter.GoodsServices; | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.Goods; | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttribute; | |||
using BPA.SAAS.Manage.Application.DataBase.Interface; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.DataBase; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase | |||
{ | |||
[ApiDescriptionSettings("Goods", Tag = "商品管理")] | |||
public class GoodsServices: IDynamicApiController, ITransient | |||
{ | |||
IGoodsService _goodsService; | |||
public GoodsServices(IGoodsService goodsService) | |||
{ | |||
_goodsService=goodsService; | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goods/page")] | |||
public async Task<PageUtil> GetGoodsPage(GoodsQueryDto dto) | |||
{ | |||
return await _goodsService.GetGoodsPage(dto); | |||
} | |||
/// <summary> | |||
/// 添加商品 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goods/add")] | |||
public async Task<bool> AddGoods(GoodsDto dto) | |||
{ | |||
return await _goodsService.AddGoods(dto); | |||
} | |||
/// <summary> | |||
/// 更新商品 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goods/update")] | |||
public async Task<bool> UpdateGoods(GoodsDto dto) | |||
{ | |||
return await _goodsService.UpdateGoods(dto); | |||
} | |||
/// <summary> | |||
/// 删除商品 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/goods/delete")] | |||
public async Task<bool> DeleteGoods(string id) | |||
{ | |||
return await _goodsService.DeleteGoods(id); | |||
} | |||
/// <summary> | |||
/// 查询商品单位 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/goods/getgoodsuintlist")] | |||
public async Task<List<dynamic>> GetGoodsUintList() | |||
{ | |||
return await _goodsService.GetGoodsUintList(); | |||
} | |||
/// <summary> | |||
/// 添加商品单位 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goods/addgoodsuint")] | |||
public async Task<bool> AddGoodsUint(GoodsUintDto dto) | |||
{ | |||
return await _goodsService.AddGoodsUint(dto); | |||
} | |||
/// <summary> | |||
/// 商品配方 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goods/getgoodsbompage")] | |||
public async Task<PageUtil> GetGoodsBomPageAsync(OrtherGoodsQueryDto dto) | |||
{ | |||
return await _goodsService.GetGoodsBomPageAsync(dto); | |||
} | |||
/// <summary> | |||
/// 删除商品配方 | |||
/// </summary> | |||
/// <param name="Ids"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/goods/delgoodsbom")] | |||
public async Task<bool> BatchDelGoodsBomAsync(string Ids) | |||
{ | |||
return await _goodsService.BatchDelGoodsBomAsync(Ids); | |||
} | |||
/// <summary> | |||
/// 添加商品配方(包含属性关系) | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goods/addgoodsbomattribute")] | |||
public async Task<bool> AddGoodsBomAttribute(GoodsBomAttributeDto dto) | |||
{ | |||
return await _goodsService.AddGoodsBomAttribute(dto); | |||
} | |||
/// <summary> | |||
/// 添加商品配方 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goods/addgoodsbom")] | |||
public async Task<bool> AddGoodsBom(GoodsBomDto dto) | |||
{ | |||
return await _goodsService.AddGoodsBom(dto); | |||
} | |||
/// <summary> | |||
/// 查询所有商品 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/goods/getgoodslist")] | |||
public async Task<List<BPA_GoodsInfo>> GetGoodsList() | |||
{ | |||
return await _goodsService.GetGoodsList(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,81 @@ | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology; | |||
using BPA.SAAS.Manage.Application.DataBase.Interface; | |||
using Microsoft.AspNetCore.Components.Forms; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Xml.Linq; | |||
namespace BPA.SAAS.Manage.Application.DataBase | |||
{ | |||
[ApiDescriptionSettings("Goods", Tag = "商品工艺")] | |||
public class GoodsTechnologyService: IDynamicApiController, ITransient | |||
{ | |||
IGoodsTechnologyService _goodsTechnologyService; | |||
public GoodsTechnologyService(IGoodsTechnologyService goodsTechnologyService) | |||
{ | |||
_goodsTechnologyService=goodsTechnologyService; | |||
} | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goodstechnology/updategoodstechnologyaction")] | |||
public async Task<bool> UpdateGoodsTechnologyAction(List<GoodsTechnologyActionBaseDto> inputDto) | |||
{ | |||
return await _goodsTechnologyService.UpdateGoodsTechnologyAction(inputDto); | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goodstechnology/addgoodstechnologyaction")] | |||
public async Task<bool> AddGoodsTechnologyAction(List<GoodsTechnologyActionBaseDto> inputDto) | |||
{ | |||
return await _goodsTechnologyService.AddGoodsTechnologyAction(inputDto); | |||
} | |||
/// <summary> | |||
/// 根据商品获取工艺 | |||
/// </summary> | |||
/// <param name="goodsId"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/goodstechnology/getGoodstechnologyaction")] | |||
public async Task<List<GoodsTechnologyActionListView>> GetGoodsTechnologyAction(string goodsId) | |||
{ | |||
return await _goodsTechnologyService.GetGoodsTechnologyAction(goodsId); | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/goodstechnology/deletegoodstechnologyaction")] | |||
public async Task<bool> DeleteGoodsTechnologyAction(string id) | |||
{ | |||
return await _goodsTechnologyService.DeleteGoodsTechnologyAction(id); | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goodstechnology/deletebydevidegoodstechnologyaction")] | |||
public async Task<bool> DeleteGoodsTechnologyAction(GoodsTechnologDelete dto) | |||
{ | |||
return await _goodsTechnologyService.DeleteGoodsTechnologyAction(dto); | |||
} | |||
/// <summary> | |||
/// 查询设备信息(包含设备版本对应的工艺信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/goodstechnology/getdevicetechnology")] | |||
public async Task<List<DeviceGoodsTechnologyView>> GetDeviceTechnology() | |||
{ | |||
return await _goodsTechnologyService.GetDeviceTechnology(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,70 @@ | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsType; | |||
using BPA.SAAS.Manage.Application.DataBase.Interface; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase | |||
{ | |||
[ApiDescriptionSettings("Goods", Tag = "商品类型管理")] | |||
public class GoodsTypeServices: IDynamicApiController, ITransient | |||
{ | |||
IGoodsTypeService _goodsTypeService; | |||
public GoodsTypeServices(IGoodsTypeService goodsTypeService) | |||
{ | |||
_goodsTypeService = goodsTypeService; | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goodstype/page")] | |||
public async Task<PageUtil> GetGoodsTypePage(GoodsTypeQueryDto dto) | |||
{ | |||
return await _goodsTypeService.GetGoodsTypePage(dto); | |||
} | |||
/// <summary> | |||
/// 添加商品类型 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goodstype/add")] | |||
public async Task<bool> AddGoodsType(GoodsTypeDto dto) | |||
{ | |||
return await _goodsTypeService.AddGoodsType(dto); | |||
} | |||
/// <summary> | |||
/// 更新商品类型 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goodstype/update")] | |||
public async Task<bool> UpdateGoodsType(GoodsTypeDto dto) | |||
{ | |||
return await _goodsTypeService.UpdateGoodsType(dto); | |||
} | |||
/// <summary> | |||
/// 删除商品类型 | |||
/// </summary> | |||
/// <param name="Id"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/goodstype/delete")] | |||
public async Task<bool> DelGoodsType(string Id) | |||
{ | |||
return await _goodsTypeService.DelGoodsType(Id); | |||
} | |||
/// <summary> | |||
/// 查询商品类型树结构 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/goodstype/tree")] | |||
public async Task<dynamic> GetGoodsTypeTree() | |||
{ | |||
return await _goodsTypeService.GetGoodsTypeTree(); | |||
} | |||
} | |||
} |
@@ -15,6 +15,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface | |||
Task<bool> UpdateBatching(BatchingInfoDto dto); | |||
Task<bool> BatchDelBatching(List<string> Ids); | |||
Task<Dictionary<string, object>> GetBatchingList(); | |||
Task<List<BatchingList>> GetBatchingSelectList(); | |||
Task<bool> UpdateBatchingStatus(BatchingStatusDto dto); | |||
Task<List<dynamic>> GetBatchingTypeList(); | |||
Task<bool> AddBatchingType(BatchingTypeDto dto); | |||
@@ -0,0 +1,47 @@ | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.Bom; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Interface | |||
{ | |||
public interface IBomService | |||
{ | |||
/// <summary> | |||
/// 查询所有配方信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<List<BomSelectList>> GetBomList(); | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
Task<bool> AddBom(BomInputDto dto); | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
Task<bool> UpdateBom(BomInputDto dto); | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
Task<bool> DeleteBom(string id); | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
Task<bool> AddBomType(AddBomTypeInputDto dto); | |||
/// <summary> | |||
/// 配方分类列表 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<List<dynamic>> GetBomTypeList(); | |||
} | |||
} |
@@ -53,7 +53,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
Task<List<GoodsAttributeList>> GetByGoodsIdAttribute(string id); | |||
Task<bool> AddGoodsBomAttribute(GoodsBomAttributeDto dto); | |||
Task<List<GoodsAttributeList>> GetByNameAttribute(string name); | |||
} | |||
} |
@@ -0,0 +1,66 @@ | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.Goods; | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttribute; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.DataBase; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Interface | |||
{ | |||
public interface IGoodsService | |||
{ | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
Task<PageUtil> GetGoodsPage(GoodsQueryDto dto); | |||
/// <summary> | |||
/// 添加商品 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
Task<bool> AddGoods(GoodsDto dto); | |||
/// <summary> | |||
/// 更新商品 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
Task<bool> UpdateGoods(GoodsDto dto); | |||
/// <summary> | |||
/// 删除商品 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
Task<bool> DeleteGoods(string id); | |||
/// <summary> | |||
/// 查询商品单位 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<List<dynamic>> GetGoodsUintList(); | |||
/// <summary> | |||
/// 添加商品单位 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
Task<bool> AddGoodsUint(GoodsUintDto dto); | |||
/// <summary> | |||
/// 商品配方 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
Task<PageUtil> GetGoodsBomPageAsync(OrtherGoodsQueryDto dto); | |||
/// <summary> | |||
/// 删除商品配方 | |||
/// </summary> | |||
/// <param name="Ids"></param> | |||
/// <returns></returns> | |||
Task<bool> BatchDelGoodsBomAsync(string Ids); | |||
Task<bool> AddGoodsBomAttribute(GoodsBomAttributeDto dto); | |||
Task<bool> AddGoodsBom(GoodsBomDto dto); | |||
Task<List<BPA_GoodsInfo>> GetGoodsList(); | |||
} | |||
} |
@@ -0,0 +1,19 @@ | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Interface | |||
{ | |||
public interface IGoodsTechnologyService | |||
{ | |||
Task<bool> UpdateGoodsTechnologyAction(List<GoodsTechnologyActionBaseDto> inputDto); | |||
Task<bool> AddGoodsTechnologyAction(List<GoodsTechnologyActionBaseDto> inputDto); | |||
Task<List<GoodsTechnologyActionListView>> GetGoodsTechnologyAction(string goodsId); | |||
Task<bool> DeleteGoodsTechnologyAction(string id); | |||
Task<bool> DeleteGoodsTechnologyAction(GoodsTechnologDelete dto); | |||
Task<List<DeviceGoodsTechnologyView>> GetDeviceTechnology(); | |||
} | |||
} |
@@ -0,0 +1,43 @@ | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsType; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Interface | |||
{ | |||
public interface IGoodsTypeService | |||
{ | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
Task<PageUtil> GetGoodsTypePage(GoodsTypeQueryDto dto); | |||
/// <summary> | |||
/// 添加商品类型 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
Task<bool> AddGoodsType(GoodsTypeDto dto); | |||
/// <summary> | |||
/// 更新商品类型 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
Task<bool> UpdateGoodsType(GoodsTypeDto dto); | |||
/// <summary> | |||
/// 删除商品类型 | |||
/// </summary> | |||
/// <param name="Id"></param> | |||
/// <returns></returns> | |||
Task<bool> DelGoodsType(string Id); | |||
/// <summary> | |||
/// 查询商品类型树结构 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<dynamic> GetGoodsTypeTree(); | |||
} | |||
} |
@@ -240,6 +240,16 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
return res; | |||
} | |||
/// <summary> | |||
/// 查询所有物料信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<BatchingList>> GetBatchingSelectList() | |||
{ | |||
var res = await _db.Queryable<BPA_Batching>().Select(x=>new BatchingList() { Id=x.Id,Name=x.Batching_Name}) | |||
.ToListAsync(); | |||
return res; | |||
} | |||
/// <summary> | |||
/// 更新物料状态 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
@@ -0,0 +1,139 @@ | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.Bom; | |||
using BPA.SAAS.Manage.Application.DataBase.Interface; | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Core.DataBase; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
public class BomService: IBomService,ITransient | |||
{ | |||
private readonly ISqlSugarClient _db; | |||
public BomService(ISqlSugarClient db) | |||
{ | |||
_db=db; | |||
} | |||
/// <summary> | |||
/// 配方分类列表 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<BomSelectList>> GetBomList() | |||
{ | |||
var res = await _db.Queryable<BPA_Bom>().Select(x => new BomSelectList | |||
{ | |||
Id = x.Id, | |||
Name = x.Name | |||
}).ToListAsync(); | |||
return res; | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddBom(BomInputDto dto) | |||
{ | |||
BPA_Bom newbPA_BOM = new BPA_Bom | |||
{ | |||
Name = dto.Name, | |||
Code = GetNumber2(), | |||
IsMain = dto.IsMain, | |||
Sort = dto.Sort, | |||
}; | |||
var bom =await _db.Insertable(newbPA_BOM).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); | |||
//添加配方分类 | |||
var list = dto.BomTypeIds.Select(item => new BPA_BomTypeInfo() { BomId = bom.Id, BomTypeId = item }).ToList(); | |||
var res =await _db.Insertable(list).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateBom(BomInputDto dto) | |||
{ | |||
// 查询数据库中是否存在未删除的商品类型 | |||
var resEntity = _db.Queryable<BPA_Bom>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.Id); | |||
if (null == resEntity) | |||
{ | |||
return false; | |||
} | |||
resEntity.Name = dto.Name; | |||
resEntity.IsMain = dto.IsMain; | |||
resEntity.Sort = dto.Sort; | |||
var res =await _db.Updateable(resEntity).IgnoreColumns(ignoreAllNullColumns: true) .ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DeleteBom(string id) | |||
{ | |||
try | |||
{ | |||
_db.Ado.BeginTran(); | |||
var resEntity = _db.Queryable<BPA_Bom>().Where(it => it.IsDeleted == 0).First(it => it.Id == id); | |||
if (null == resEntity) | |||
{ | |||
throw Oops.Oh("配方不存在"); | |||
} | |||
resEntity.IsDeleted = 1; | |||
var res = await _db.Updateable(resEntity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); | |||
var BomTypeInfo = _db.Queryable<BPA_BomTypeInfo>().Where(it => it.BomId == id).Select(x => x.Id).ToList(); | |||
await _db.Deleteable<BPA_BomTypeInfo>(BomTypeInfo).ExecuteCommandAsync(); | |||
_db.Ado.CommitTran(); | |||
return res > 0; | |||
} | |||
catch (Exception) | |||
{ | |||
_db.Ado.RollbackTran(); | |||
throw Oops.Oh("删除失败"); ; | |||
} | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddBomType(AddBomTypeInputDto dto) | |||
{ | |||
BPA_BomType newbPA_BOM = new BPA_BomType | |||
{ | |||
Name = dto.Name | |||
}; | |||
var res = await _db.Insertable(newbPA_BOM).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 配方分类列表 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<dynamic>> GetBomTypeList() | |||
{ | |||
var res = await _db.Queryable<BPA_BomType>().Select<dynamic>(x => new | |||
{ | |||
id = x.Id, | |||
name = x.Name | |||
}).ToListAsync(); | |||
return res; | |||
} | |||
private string GetNumber2(int Length = 10) | |||
{ | |||
byte[] buffer = Guid.NewGuid().ToByteArray(); | |||
var ram = BitConverter.ToInt64(buffer, 0); | |||
var str = string.Format("{0}", ram.ToString().Substring(0, Length)); | |||
return str; | |||
} | |||
} | |||
} |
@@ -4,15 +4,16 @@ using BPA.SAAS.Manage.Comm.Const; | |||
using BPA.SAAS.Manage.Core.DataBase; | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttribute; | |||
using StackExchange.Profiling.Internal; | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices | |||
{ | |||
public class GoodsAttributeService: IGoodsAttributeService, ITransient | |||
{ | |||
private readonly ISqlSugarClient _db; | |||
public GoodsAttributeService(ISqlSugarClient _db) | |||
public GoodsAttributeService(ISqlSugarClient db) | |||
{ | |||
_db = _db; // 推荐操作 | |||
_db = db; // 推荐操作 | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
@@ -73,13 +74,13 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices | |||
} | |||
else | |||
{ | |||
var newGoods = new BPA_GoodsAttribute | |||
var newGoodsAttribute = new BPA_GoodsAttribute | |||
{ | |||
AttributeName = dto.AttributeName, | |||
GoodsTypeId = string.Join(',', dto.GoodsTypeId), | |||
Sort = dto.Sort, | |||
}; | |||
var res =await _db.Insertable(newGoods).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
var res =await _db.Insertable(newGoodsAttribute).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
@@ -257,72 +258,6 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices | |||
.ToListAsync(); | |||
return goodsAttributeList; | |||
} | |||
/// <summary> | |||
/// 添加商品配方 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddGoodsBomAttribute(GoodsBomAttributeDto dto) | |||
{ | |||
_db.Ado.BeginTran(); | |||
try | |||
{ | |||
string groupId = App.User.FindFirst(ClaimConst.GroupId)?.Value; | |||
var sortMax = _db.Queryable<BPA_Bom>().Max(x => x.Sort); | |||
BPA_Bom newbPA_BOM = new BPA_Bom | |||
{ | |||
Name = dto.BomName, | |||
Code = DateTime.Now.ToString("yyyyMMddhhmmsss"), | |||
IsMain = dto.BomType == "1" ? true : false, | |||
Sort = sortMax + 1, | |||
Id = Guid.NewGuid().ToString(), | |||
CreateAt = DateTime.Now, | |||
GroupId = groupId | |||
}; | |||
//添加配方 | |||
var res = _db.Insertable(newbPA_BOM).ExecuteCommand(); | |||
//添加配方分类 | |||
var list = dto.BomtypeList.Select(item => new BPA_BomTypeInfo() { BomId = newbPA_BOM.Id, BomTypeId = item }).ToList(); | |||
_db.Insertable(list).CallEntityMethod(m => m.Create()).ExecuteCommand(); | |||
BPA_GoodsBom bom = new BPA_GoodsBom(); | |||
bom.Goods_Id = dto.GoodsId; | |||
bom.BomId = newbPA_BOM.Id; | |||
//添加商品配方关系 | |||
_db.Insertable(bom).CallEntityMethod(m => m.Create()).ExecuteCommand(); | |||
List<BPA_BomEntry> BOMEntryList = new(); | |||
if (dto.Mate.Count > 0) | |||
{ | |||
for (int i = 0; i < dto.Mate.Count; i++) | |||
{ | |||
BPA_BomEntry newbPA_BOMEnty = new BPA_BomEntry | |||
{ | |||
BatchingId = dto.Mate[i].batchingId, | |||
//BatchingKey = dto.Mate[i].AutoKey, | |||
BomQty = dto.Mate[i].dosage, | |||
BomId = newbPA_BOM.Id, | |||
IsReplace = false, | |||
}; | |||
BOMEntryList.Add(newbPA_BOMEnty); | |||
} | |||
} | |||
//添加配方物料关系 | |||
_db.Insertable(BOMEntryList).CallEntityMethod(m => m.Create()).ExecuteCommand(); | |||
BPA_BomAttributeValueRe bPA_BomAttributeValueRe = new(); | |||
bPA_BomAttributeValueRe.Id = Guid.NewGuid().ToString(); | |||
bPA_BomAttributeValueRe.GoodsId = dto.GoodsId; | |||
bPA_BomAttributeValueRe.BoomId = newbPA_BOM.Id; | |||
bPA_BomAttributeValueRe.GoodsAttributeValueId = string.Join(",", dto.Shuxing); | |||
//添加商品配方属性关系 | |||
_db.Insertable(bPA_BomAttributeValueRe).ExecuteCommand(); | |||
_db.Ado.CommitTran(); | |||
return true; | |||
} | |||
catch (Exception e) | |||
{ | |||
_db.Ado.RollbackTran(); | |||
throw Oops.Oh("添加失败,失败信息:" + e.Message); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,352 @@ | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.Batching; | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.Goods; | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttribute; | |||
using BPA.SAAS.Manage.Application.DataBase.Interface; | |||
using BPA.SAAS.Manage.Comm.Const; | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.DataBase; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
public class GoodsService: IGoodsService, ITransient | |||
{ | |||
private readonly ISqlSugarClient _db; | |||
public GoodsService(ISqlSugarClient db) | |||
{ | |||
_db=db; | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<PageUtil> GetGoodsPage(GoodsQueryDto dto) | |||
{ | |||
List<IConditionalModel> conModels = new List<IConditionalModel>(); | |||
string groupId = App.User.FindFirst(ClaimConst.GroupId)?.Value; | |||
#region 条件查询 | |||
if (!string.IsNullOrEmpty(dto.Name)) | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "a.GoodsName", ConditionalType = ConditionalType.Like, FieldValue = dto.Name }); | |||
} | |||
if (!string.IsNullOrEmpty(dto.GoodsTypeId)) | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "a.GoodsTypeId", ConditionalType = ConditionalType.Equal, FieldValue = dto.GoodsTypeId }); | |||
} | |||
if (!string.IsNullOrEmpty(dto.Status)) | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "a.Status", ConditionalType = ConditionalType.Like, FieldValue = dto.Status }); | |||
} | |||
#endregion | |||
RefAsync<int> total = 0; | |||
var res =await _db.Queryable<BPA_GoodsInfo, BPA_GoodsType>((a, b) => new JoinQueryInfos( | |||
JoinType.Left, a.GoodsTypeId == b.Id | |||
)) | |||
.Where((a, b) => a.IsDeleted == 0) | |||
.WhereIF(!string.IsNullOrWhiteSpace(dto.Code), (a, b) => a.Code.Contains(dto.Code)) | |||
// .WhereIF(dto.CreateAt.HasValue, (a, b) => SqlFunc.DateIsSame(a.CreateAt, Convert.ToDateTime(dto.CreateAt), DateType.Day)) | |||
.Where(conModels) | |||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | |||
.Select((a, b) => new | |||
{ | |||
Id = a.Id, | |||
Code = a.Code, | |||
Name = a.Name, | |||
Price = a.Price, | |||
ImgUrl = a.ImgUrl, | |||
Status = a.Status, | |||
GoodsTypeId = b.IsDeleted == 0 ? a.GoodsTypeId : "", | |||
GoodsTypeName = b.IsDeleted == 0 ? b.Name : "", | |||
Remark = a.Descritption, | |||
IsDeleted = a.IsDeleted, | |||
// CreateAt = a.CreateAt, | |||
GoodsUintId = a.GoodsUintId, | |||
ForeignKeyRe = a.ForeignKeyRe, | |||
Design = a.Design, | |||
IsWeigh = a.IsWeigh, | |||
DefaultMate = a.DefaultMate, | |||
IsAttrubute = a.IsAttrubute | |||
}) | |||
.ToPageListAsync(dto.Current, dto.PageSize, total); | |||
PageUtil util = new PageUtil() | |||
{ | |||
Total = total, | |||
Data = res | |||
}; | |||
return util; | |||
} | |||
public async Task<List<BPA_GoodsInfo>> GetGoodsList() | |||
{ | |||
var res = await _db.Queryable<BPA_GoodsInfo>().ToListAsync(); | |||
return res; | |||
} | |||
/// <summary> | |||
/// 添加商品 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddGoods(GoodsDto dto) | |||
{ | |||
if (string.IsNullOrWhiteSpace(dto.Id)) | |||
{ | |||
var resEntity = new BPA_GoodsInfo(); | |||
resEntity.Id = Guid.NewGuid().ToString(); | |||
resEntity.GoodsTypeId = dto.GoodsTypeId; | |||
resEntity.Name = dto.Name; | |||
resEntity.Descritption = dto.Descritption; | |||
resEntity.ImgUrl = dto.ImgUrl; | |||
resEntity.Price = dto.Price; | |||
resEntity.IsWeigh = dto.IsWeigh == "false" ? 0 : 1; | |||
resEntity.GoodsUintId = dto.GoodsUintId; | |||
resEntity.IsAttrubute = Convert.ToBoolean(dto.IsAttrubute); | |||
resEntity.Code = GetNumber2(8); | |||
var data = _db.Queryable<BPA_GoodsInfo>().Max(x => x.AutoKey); | |||
if (data == 0) data = 1000; | |||
else data = data + 1; | |||
resEntity.AutoKey = data; | |||
var res = await _db.Insertable(resEntity).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
else | |||
{ | |||
return await UpdateGoods(dto); | |||
} | |||
} | |||
/// <summary> | |||
/// 更新商品 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateGoods(GoodsDto dto) | |||
{ | |||
// 查询数据库中是否存在未删除的商品类型 | |||
var resEntity = _db.Queryable<BPA_GoodsInfo>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.Id); | |||
if (null == resEntity) | |||
{ | |||
throw Oops.Oh("商品不存在"); | |||
} | |||
resEntity.GoodsTypeId = dto.GoodsTypeId; | |||
resEntity.Name = dto.Name; | |||
resEntity.Descritption = dto.Descritption; | |||
resEntity.ImgUrl = dto.ImgUrl; | |||
resEntity.Price = dto.Price; | |||
resEntity.IsWeigh = dto.IsWeigh=="false"?0:1; | |||
resEntity.GoodsUintId = dto.GoodsUintId; | |||
resEntity.IsAttrubute = Convert.ToBoolean(dto.IsAttrubute); | |||
if (!string.IsNullOrWhiteSpace(dto.Status)) | |||
{ | |||
resEntity.Status = (CommonStatus)Enum.ToObject(typeof(CommonStatus), int.Parse(dto.Status)); | |||
} | |||
var res = await _db.Updateable(resEntity).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 删除商品 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DeleteGoods(string id) | |||
{ | |||
var goods = _db.Queryable<BPA_GoodsInfo>().Where(x => x.Id== id).First(); | |||
if (goods == null) throw Oops.Oh("商品不存在"); | |||
goods.IsDeleted = 1; | |||
var res = await _db.Updateable(goods).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 查询商品单位 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<dynamic>> GetGoodsUintList() | |||
{ | |||
var res = await _db.Queryable<BPA_GoodsUint>().Select<dynamic>(x => new | |||
{ | |||
id = x.Id, | |||
name = x.Name | |||
}).ToListAsync(); | |||
return res; | |||
} | |||
/// <summary> | |||
/// 添加商品单位 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddGoodsUint(GoodsUintDto dto) | |||
{ | |||
var groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
var productCode = _db.Queryable<BPA_GoodsUint>().Where(x => x.GroupId == groupId && x.Name == dto.Name).ToList(); | |||
if (productCode.Count() > 0) | |||
{ | |||
throw Oops.Oh("商品单位已存在"); | |||
} | |||
try | |||
{ | |||
BPA_GoodsUint bPA_Product = new BPA_GoodsUint(); | |||
bPA_Product.Name = dto.Name; | |||
var res = await _db.Insertable(bPA_Product).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw Oops.Oh("添加失败"); | |||
} | |||
} | |||
/// <summary> | |||
/// 商品配方 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<PageUtil> GetGoodsBomPageAsync(OrtherGoodsQueryDto dto) | |||
{ | |||
RefAsync<int> total = 0; | |||
var res =await _db.Queryable<BPA_Bom, BPA_GoodsBom>((a, b) => new JoinQueryInfos( | |||
JoinType.Left, a.Id == b.BomId | |||
)) | |||
.WhereIF(!string.IsNullOrWhiteSpace(dto.GoodsId), (a, b) => b.Goods_Id == dto.GoodsId) | |||
.Select((a, b) => new | |||
{ | |||
Id = b.Id, | |||
Name = a.Name, | |||
BomId= b.BomId, | |||
IsMain = a.IsMain | |||
}) | |||
.ToPageListAsync(dto.Current, dto.PageSize, total); | |||
PageUtil util = new PageUtil() | |||
{ | |||
Total = total, | |||
Data = res | |||
}; | |||
return util; | |||
} | |||
/// <summary> | |||
/// 删除商品配方 | |||
/// </summary> | |||
/// <param name="Ids"></param> | |||
/// <returns></returns> | |||
public async Task<bool> BatchDelGoodsBomAsync(string Ids) | |||
{ | |||
// var GoodsBom=_db.Queryable<BPA_GoodsBom>().Where(x => x.Id == Ids).First(); | |||
// 查询数据库中是否存在未删除的商品 | |||
var res = _db.Deleteable<BPA_GoodsBom>().In(Ids).ExecuteCommand(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 添加商品配方 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddGoodsBomAttribute(GoodsBomAttributeDto dto) | |||
{ | |||
_db.Ado.BeginTran(); | |||
try | |||
{ | |||
string groupId = App.User.FindFirst(ClaimConst.GroupId)?.Value; | |||
var sortMax = _db.Queryable<BPA_Bom>().Max(x => x.Sort); | |||
BPA_Bom newbPA_BOM = new BPA_Bom | |||
{ | |||
Name = dto.BomName, | |||
Code = DateTime.Now.ToString("yyyyMMddhhmmsss"), | |||
IsMain = dto.BomType == "1" ? true : false, | |||
Sort = sortMax + 1, | |||
Id = Guid.NewGuid().ToString(), | |||
CreateAt = DateTime.Now, | |||
Status = CommonStatus.ENABLE, | |||
GroupId = groupId | |||
}; | |||
//添加配方 | |||
var res = _db.Insertable(newbPA_BOM).CallEntityMethod(m => m.Create()).ExecuteCommand(); | |||
//添加配方分类 | |||
var list = dto.BomtypeList.Select(item => new BPA_BomTypeInfo() { BomId = newbPA_BOM.Id, BomTypeId = item }).ToList(); | |||
_db.Insertable(list).CallEntityMethod(m => m.Create()).ExecuteCommand(); | |||
BPA_GoodsBom bom = new BPA_GoodsBom(); | |||
bom.Goods_Id = dto.GoodsId; | |||
bom.BomId = newbPA_BOM.Id; | |||
bom.Status = CommonStatus.ENABLE; | |||
//添加商品配方关系 | |||
_db.Insertable(bom).CallEntityMethod(m => m.Create()).ExecuteCommand(); | |||
List<BPA_BomEntry> BOMEntryList = new(); | |||
if (dto.Mate.Count > 0) | |||
{ | |||
for (int i = 0; i < dto.Mate.Count; i++) | |||
{ | |||
BPA_BomEntry newbPA_BOMEnty = new BPA_BomEntry | |||
{ | |||
BatchingId = dto.Mate[i].batchingId, | |||
//BatchingKey = dto.Mate[i].AutoKey, | |||
BomQty = dto.Mate[i].dosage, | |||
BomId = newbPA_BOM.Id, | |||
Status = CommonStatus.ENABLE, | |||
IsReplace = false, | |||
}; | |||
BOMEntryList.Add(newbPA_BOMEnty); | |||
} | |||
} | |||
//添加配方物料关系 | |||
_db.Insertable(BOMEntryList).CallEntityMethod(m => m.Create()).ExecuteCommand(); | |||
BPA_BomAttributeValueRe bPA_BomAttributeValueRe = new(); | |||
bPA_BomAttributeValueRe.Id = Guid.NewGuid().ToString(); | |||
bPA_BomAttributeValueRe.GoodsId = dto.GoodsId; | |||
bPA_BomAttributeValueRe.BoomId = newbPA_BOM.Id; | |||
bPA_BomAttributeValueRe.GoodsAttributeValueId = string.Join(",", dto.Shuxing); | |||
//添加商品配方属性关系 | |||
_db.Insertable(bPA_BomAttributeValueRe).ExecuteCommand(); | |||
_db.Ado.CommitTran(); | |||
return true; | |||
} | |||
catch (Exception e) | |||
{ | |||
_db.Ado.RollbackTran(); | |||
throw Oops.Oh("添加失败,失败信息:" + e.Message); | |||
} | |||
} | |||
public async Task<bool> AddGoodsBom(GoodsBomDto dto) | |||
{ | |||
var res = false; | |||
List<BPA_GoodsBom> list = new(); | |||
if (dto.BomId.Count() > 0) | |||
{ | |||
for (int i = 0; i < dto.BomId.Count; i++) | |||
{ | |||
BPA_GoodsBom goodsBom = new(); | |||
goodsBom.BomId = dto.BomId[i]; | |||
goodsBom.Goods_Id= dto.GoodsId; | |||
goodsBom.Status = CommonStatus.ENABLE; | |||
list.Add(goodsBom); | |||
} | |||
} | |||
if (list.Count>0) | |||
{ | |||
res=await _db.Insertable(list).CallEntityMethod(m => m.Create()).ExecuteCommandAsync()>0; | |||
} | |||
return res; | |||
} | |||
private string GetNumber2(int Length = 10) | |||
{ | |||
byte[] buffer = Guid.NewGuid().ToByteArray(); | |||
var ram = BitConverter.ToInt64(buffer, 0); | |||
var str = string.Format("{0}", ram.ToString().Substring(0, Length)); | |||
return str; | |||
} | |||
} | |||
} |
@@ -0,0 +1,471 @@ | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology; | |||
using BPA.SAAS.Manage.Application.DataBase.Interface; | |||
using BPA.SAAS.Manage.Comm.Const; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.DataBase; | |||
using BPA.SAAS.Manage.Core.Device; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
public class GoodsTechnologyService: IGoodsTechnologyService, ITransient | |||
{ | |||
ISqlSugarClient _db; | |||
public GoodsTechnologyService(ISqlSugarClient db) | |||
{ | |||
_db = db; | |||
} | |||
//#region 配方工艺流程 | |||
///// <summary> | |||
///// 获取工艺流程 | |||
///// </summary> | |||
///// <param name="inputDto"></param> | |||
///// <returns></returns> | |||
//public PageUtil GetBomTechnologyPage(PageInputBase inputDto) | |||
//{ | |||
// int total = new RefAsync<int>(); | |||
// var res = _db.Queryable<BPA_BomTechnology, BPA_BOMEntry, BPA_Batching>((a, b, c) => new | |||
// JoinQueryInfos(JoinType.Left, a.BomentryId == b.Id, JoinType.Left, b.BatchingId == c.Id) | |||
// ).Where((a, b, c) => a.IsDeleted == 0 && a.ChnologyId == inputDto.chnologyId && a.GroupId == groupId) | |||
// .WhereIF(!string.IsNullOrWhiteSpace(inputDto.bomId), (a, b, c) => b.BomId == inputDto.bomId) | |||
// .OrderBy(a => a.Sort, OrderByType.Asc) | |||
// .Select((a, b, c) => new | |||
// { | |||
// Id = a.Id, | |||
// BatchingId = a.BomentryId, | |||
// ChnologyId = a.ChnologyId, | |||
// BatchingName = c.Batching_Name, | |||
// BomQty = b.BomQty, | |||
// TotalCount = a.TotalCount, | |||
// Sort = a.Sort | |||
// }).ToPageList(inputDto.Current, inputDto.PageSize, ref total); | |||
// return new PageUtil() | |||
// { | |||
// Data = res, | |||
// Total = total | |||
// }; | |||
//} | |||
///// <summary> | |||
///// 添加工艺流程 | |||
///// </summary> | |||
///// <param name="inputDto"></param> | |||
///// <returns></returns> | |||
//public async Task<bool> AddBomTechnology(List<BomTechnologyBaseDto> inputDto) | |||
//{ | |||
// var groupId = string.IsNullOrWhiteSpace(CurrentUser.TenantId) | |||
// ? App.User?.FindFirst(ClaimConst.GroupId)?.Value | |||
// : CurrentUser.TenantId; | |||
// var res = 0; | |||
// var addlist = new List<BPA_BomTechnology>(); | |||
// var uplist = new List<BPA_BomTechnology>(); | |||
// var list = _db.Queryable<BPA_BomTechnology>().Where(x => x.GroupId == groupId && x.IsDeleted == 0).ToList(); | |||
// for (int i = 0; i < inputDto.Count; i++) | |||
// { | |||
// if (list.Count > 0) | |||
// { | |||
// var model = list.Where(a => a.BomentryId == inputDto[i].BatchingId && a.IsDeleted == 0 && a.ChnologyId == inputDto[i].ChnologyId).FirstOrDefault(); | |||
// if (model != null) | |||
// { | |||
// model.BomentryId = inputDto[i].BatchingId; | |||
// model.Sort = inputDto[i].Sort; | |||
// model.TotalCount = inputDto[i].total; | |||
// uplist.Add(model); | |||
// } | |||
// else | |||
// { | |||
// var data = new BPA_BomTechnology() | |||
// { | |||
// Id = Guid.NewGuid().ToString(), | |||
// BomentryId = inputDto[i].BatchingId, | |||
// ChnologyId = inputDto[i].ChnologyId, | |||
// Sort = inputDto[i].Sort, | |||
// CreateAt = DateTime.Now, | |||
// GroupId = groupId, | |||
// IsDeleted = 0, | |||
// TotalCount = inputDto[i].total | |||
// }; | |||
// addlist.Add(data); | |||
// } | |||
// } | |||
// else | |||
// { | |||
// var data = new BPA_BomTechnology() | |||
// { | |||
// Id = Guid.NewGuid().ToString(), | |||
// BomentryId = inputDto[i].BatchingId, | |||
// ChnologyId = inputDto[i].ChnologyId, | |||
// Sort = inputDto[i].Sort, | |||
// CreateAt = DateTime.Now, | |||
// GroupId = groupId, | |||
// IsDeleted = 0, | |||
// }; | |||
// addlist.Add(data); | |||
// } | |||
// } | |||
// if (addlist.Count > 0) | |||
// { | |||
// res = await _db.Insertable(addlist).ExecuteCommandAsync(); | |||
// } | |||
// if (uplist.Count > 0) | |||
// { | |||
// res = await _db.Updateable(uplist).ExecuteCommandAsync(); | |||
// } | |||
// return res > 0; | |||
//} | |||
///// <summary> | |||
///// 修改工艺流程 | |||
///// </summary> | |||
///// <param name="inputDto"></param> | |||
///// <returns></returns> | |||
//public bool UpdateBomTechnology(BomTechnologyBaseDto inputDto) | |||
//{ | |||
// var check = _db.Queryable<BPA_BomTechnology>().Any(a => a.BomentryId == inputDto.BatchingId && a.IsDeleted == 0 && a.ChnologyId == inputDto.ChnologyId && a.Id != inputDto.Id); | |||
// if (check) throw Oops.Oh("工艺流程已存在"); | |||
// var data = _db.Queryable<BPA_BomTechnology>().Where(a => a.Id == inputDto.Id).First(); | |||
// if (data == null) throw Oops.Oh("工艺流程不存在"); | |||
// data.BomentryId = inputDto.BatchingId; | |||
// data.ChnologyId = inputDto.ChnologyId; | |||
// data.Sort = inputDto.Sort; | |||
// var res = _db.Updateable(data).ExecuteCommand(); | |||
// return res > 0; | |||
//} | |||
///// <summary> | |||
///// 删除工艺流程 | |||
///// </summary> | |||
///// <param name="ids"></param> | |||
///// <returns></returns> | |||
//public bool DeleteBomTechnology(List<string> ids) | |||
//{ | |||
// var resEntity = _db.Queryable<BPA_BomTechnology>().Where(x => ids.Contains(x.Id)).ToList(); | |||
// foreach (var item in resEntity) | |||
// { | |||
// item.IsDeleted = 1; | |||
// } | |||
// var res = _db.Updateable(resEntity).ExecuteCommand(); | |||
// return res > 0; | |||
//} | |||
//#endregion | |||
//#region 配方工艺动作 | |||
///// <summary> | |||
///// 查询配方工艺流程动作 | |||
///// </summary> | |||
///// <returns></returns> | |||
//public BPA_BomTechnologyAction GetBomTechnologyAction(BomTechnologyActionBase dto) | |||
//{ | |||
// var res = _db.Queryable<BPA_BomTechnologyAction>().Where(x => x.IsDeleted == 0 && x.BomId == dto.BomId && x.ChnologyId == dto.ChnologyId && x.GroupId == groupId) | |||
// .OrderBy(i => i.Sort, OrderByType.Desc) | |||
// .First(); | |||
// return res; | |||
//} | |||
//public async Task<List<BPA_BomTechnologyAction>> GetBomTechnologyActionList(string BomId) | |||
//{ | |||
// var res = await _db.Queryable<BPA_BomTechnologyAction>().Where(x => x.IsDeleted == 0 && x.BomId == BomId && x.GroupId == groupId) | |||
// .OrderBy(i => i.Sort, OrderByType.Asc) | |||
// .ToListAsync(); | |||
// return res; | |||
//} | |||
//public BPA_BomTechnologyAction GetBomTechnologyActionById(string id) | |||
//{ | |||
// var res = _db.Queryable<BPA_BomTechnologyAction>().Where(x => x.Id == id) | |||
// .OrderBy(i => i.Sort, OrderByType.Desc) | |||
// .First(); | |||
// return res; | |||
//} | |||
///// <summary> | |||
///// 添加配方工艺流程动作步骤 | |||
///// </summary> | |||
///// <param name="inputDto"></param> | |||
///// <returns></returns> | |||
//public async Task<bool> AddBomTechnologyAction(BomTechnologyActionBaseDto inputDto) | |||
//{ | |||
// var res = 0; | |||
// var addlist = new BPA_BomTechnologyAction(); | |||
// var uplist = new BPA_BomTechnologyAction(); | |||
// var list = _db.Queryable<BPA_BomTechnologyAction>().Where(x => x.GroupId == groupId && x.IsDeleted == 0).ToList(); | |||
// if (inputDto != null) | |||
// { | |||
// if (list.Count > 0) | |||
// { | |||
// var sort = list.Max(x => x.Sort); | |||
// var model = list.Where(a => a.BomId == inputDto.BomId && a.IsDeleted == 0 && a.ChnologyId == inputDto.ChnologyId && a.BomId == inputDto.BomId).FirstOrDefault(); | |||
// if (string.IsNullOrEmpty(inputDto.Id)) | |||
// { | |||
// model = null; | |||
// } | |||
// if (model != null) | |||
// { | |||
// model.ActionJson = inputDto.ActionJson; | |||
// model.StepName = inputDto.StepName; | |||
// uplist = model; | |||
// } | |||
// else | |||
// { | |||
// var data = new BPA_BomTechnologyAction() | |||
// { | |||
// Id = Guid.NewGuid().ToString(), | |||
// ActionJson = inputDto.ActionJson, | |||
// ChnologyId = inputDto.ChnologyId, | |||
// StepName = inputDto.StepName, | |||
// CreateAt = DateTime.Now, | |||
// GroupId = groupId, | |||
// IsDeleted = 0, | |||
// BomId = inputDto.BomId, | |||
// Sort = sort + 1, | |||
// IsBatch = inputDto.IsBatch | |||
// }; | |||
// addlist = data; | |||
// } | |||
// } | |||
// else | |||
// { | |||
// var data = new BPA_BomTechnologyAction() | |||
// { | |||
// Id = Guid.NewGuid().ToString(), | |||
// ActionJson = inputDto.ActionJson, | |||
// StepName = inputDto.StepName, | |||
// ChnologyId = inputDto.ChnologyId, | |||
// CreateAt = DateTime.Now, | |||
// GroupId = groupId, | |||
// IsDeleted = 0, | |||
// BomId = inputDto.BomId, | |||
// Sort = 1, | |||
// IsBatch = inputDto.IsBatch | |||
// }; | |||
// addlist = data; | |||
// } | |||
// } | |||
// if (!string.IsNullOrWhiteSpace(addlist.ActionJson)) | |||
// { | |||
// res = await _db.Insertable(addlist).ExecuteCommandAsync(); | |||
// } | |||
// if (!string.IsNullOrWhiteSpace(uplist.ActionJson)) | |||
// { | |||
// res = await _db.Updateable(uplist).ExecuteCommandAsync(); | |||
// } | |||
// return res > 0; | |||
//} | |||
///// <summary> | |||
///// 删除工艺动作步骤 | |||
///// </summary> | |||
///// <param name="ids"></param> | |||
///// <returns></returns> | |||
//public async Task<bool> DeleteBomTechnologyAction(string ids) | |||
//{ | |||
// var resEntity = _db.Queryable<BPA_BomTechnologyAction>().Where(x => ids == x.Id).First(); | |||
// if (resEntity == null) throw Oops.Oh("工艺流程不存在"); | |||
// if (resEntity.IsBatch) | |||
// { | |||
// //如果是绑定的是物料的步骤 则删除物料步骤相关表数据 | |||
// var resEntitywl = _db.Queryable<BPA_BomTechnology>().Where(x => resEntity.ChnologyId.Contains(x.ChnologyId) && x.GroupId == groupId).ToList(); | |||
// foreach (var item in resEntitywl) | |||
// { | |||
// item.IsDeleted = 1; | |||
// } | |||
// await _db.Updateable(resEntitywl).ExecuteCommandAsync(); | |||
// } | |||
// resEntity.IsDeleted = 1; | |||
// var res = await _db.Updateable(resEntity).ExecuteCommandAsync(); | |||
// return res > 0; | |||
//} | |||
///// <summary> | |||
///// 排序 | |||
///// </summary> | |||
///// <param name="updateSortDtos"></param> | |||
///// <returns></returns> | |||
//public async Task<bool> UpdateSortBomTechnologyAction(List<UpdateSortDto> updateSortDtos) | |||
//{ | |||
// try | |||
// { | |||
// var ids = updateSortDtos.Select(p => p.id).ToArray(); | |||
// var list = _db.Queryable<BPA_BomTechnologyAction>().Where(x => ids.Contains(x.Id)).ToList(); | |||
// list.ForEach(x => x.Sort = updateSortDtos.Where(p => p.id == x.Id).FirstOrDefault().sort); | |||
// return await _db.Updateable(list).ExecuteCommandAsync() > 0; | |||
// } | |||
// catch (Exception e) | |||
// { | |||
// throw Oops.Oh("更新出错"); | |||
// } | |||
//} | |||
//#endregion | |||
#region 商品工艺(新版本工艺制作) | |||
/// <summary> | |||
/// 添加商品工艺 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateGoodsTechnologyAction(List<GoodsTechnologyActionBaseDto> inputDto) | |||
{ | |||
try | |||
{ | |||
var addlist = new List<BPA_GoodsTechnologyAction>(); | |||
var list = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.DeviceId == inputDto[0].DeviceId && x.GoodsId == inputDto[0].GoodsId).ToList(); | |||
_db.Ado.BeginTran(); | |||
_db.Deleteable(list).ExecuteCommand(); | |||
//var list = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.GroupId == groupId && x.IsDeleted == 0).ToList(); | |||
for (int i = 0; i < inputDto.Count; i++) | |||
{ | |||
var goodsinfo = _db.Queryable<BPA_GoodsInfo>().Where(x => x.Id == inputDto[i].GoodsId).First(); | |||
var maxsort = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.GoodsId == inputDto[i].GoodsId && x.DeviceId == inputDto[i].DeviceId).Max(x => x.Sort); | |||
var data = new BPA_GoodsTechnologyAction() | |||
{ | |||
Id = string.IsNullOrEmpty(inputDto[i].Id) ? Guid.NewGuid().ToString() : inputDto[i].Id, | |||
GoodsId = inputDto[i].GoodsId, | |||
ActionJson = inputDto[i].ActionJson, | |||
StepName = inputDto[i].StepName, | |||
ChnologyId = inputDto[i].ChnologyId, | |||
CreateAt = DateTime.Now, | |||
IsDeleted = 0, | |||
GoodsAttributeId = inputDto[i].GoodsAttributeId, | |||
Sort = string.IsNullOrWhiteSpace(inputDto[i].Sort.ToString()) ? maxsort + (i + 1) : Convert.ToInt32(inputDto[i].Sort.ToString()), | |||
IsBatch = inputDto[i].IsBatch, | |||
DeviceId = inputDto[i].DeviceId, | |||
}; | |||
if (!goodsinfo.IsAttrubute) | |||
{ | |||
var sx = _db.Queryable<BPA_GoodsAttributeValue, BPA_GoodsAttribute>((a, b) => new JoinQueryInfos( | |||
JoinType.Left, a.GoodsAttributeId == b.Id)).Where((a, b) => b.AttributeName == "默认属性").Select((a, b) => new BPA_GoodsAttributeValue() { Id = a.Id.SelectAll() }).First(); | |||
data.GoodsAttributeId = sx?.Id; | |||
} | |||
addlist.Add(data); | |||
} | |||
var res = await _db.Insertable(addlist).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
_db.Ado.CommitTran(); | |||
return res > 0; | |||
} | |||
catch (Exception e) | |||
{ | |||
_db.Ado.RollbackTran(); | |||
throw Oops.Oh("保存失败"); | |||
} | |||
} | |||
public async Task<bool> AddGoodsTechnologyAction(List<GoodsTechnologyActionBaseDto> inputDto) | |||
{ | |||
try | |||
{ | |||
var addlist = new List<BPA_GoodsTechnologyAction>(); | |||
for (int i = 0; i < inputDto.Count; i++) | |||
{ | |||
var goodsinfo = _db.Queryable<BPA_GoodsInfo>().Where(x => x.Id == inputDto[i].GoodsId).First(); | |||
var maxsort = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.GoodsId == inputDto[i].GoodsId && x.DeviceId == inputDto[i].DeviceId).Max(x => x.Sort); | |||
var data = new BPA_GoodsTechnologyAction() | |||
{ | |||
Id = string.IsNullOrEmpty(inputDto[i].Id) ? Guid.NewGuid().ToString() : inputDto[i].Id, | |||
GoodsId = inputDto[i].GoodsId, | |||
ActionJson = inputDto[i].ActionJson, | |||
StepName = inputDto[i].StepName, | |||
ChnologyId = inputDto[i].ChnologyId, | |||
CreateAt = DateTime.Now, | |||
IsDeleted = 0, | |||
GoodsAttributeId = inputDto[i].GoodsAttributeId, | |||
Sort = string.IsNullOrWhiteSpace(inputDto[i].Sort.ToString()) ? maxsort + (i + 1) : Convert.ToInt32(inputDto[i].Sort.ToString()), | |||
IsBatch = inputDto[i].IsBatch, | |||
DeviceId = inputDto[i].DeviceId, | |||
}; | |||
if (!goodsinfo.IsAttrubute) | |||
{ | |||
var sx = _db.Queryable<BPA_GoodsAttributeValue, BPA_GoodsAttribute>((a, b) => new JoinQueryInfos( | |||
JoinType.Left, a.GoodsAttributeId == b.Id)).Where((a, b) => b.AttributeName == "默认属性").Select((a, b) => new BPA_GoodsAttributeValue() { Id = a.Id.SelectAll() }).First(); | |||
data.GoodsAttributeId = sx?.Id; | |||
} | |||
addlist.Add(data); | |||
} | |||
var res = await _db.Insertable(addlist).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
catch (Exception e) | |||
{ | |||
throw Oops.Oh("保存失败"); | |||
} | |||
} | |||
public async Task<List<GoodsTechnologyActionListView>> GetGoodsTechnologyAction(string goodsId) | |||
{ | |||
List<GoodsTechnologyActionListView> goodsTechnologyActionListViews = new List<GoodsTechnologyActionListView>(); | |||
var list = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.GoodsId == goodsId) | |||
.Select(x => new GoodsTechnologyActionView() | |||
{ | |||
Id = x.Id.SelectAll(), | |||
}).OrderBy(x => x.Sort, OrderByType.Asc).ToList(); | |||
var Devicelist = await _db.Queryable<BPA_DeviceInfo>().ToListAsync(); | |||
var s = list.GroupBy(x => x.DeviceId).ToList(); | |||
for (int i = 0; i < s.Count; i++) | |||
{ | |||
GoodsTechnologyActionListView item = new() | |||
{ | |||
DeviceId = s[i].Key, | |||
DeviceName = Devicelist?.FirstOrDefault(x => x.Id == s[i].Key).DeviceName, | |||
Data = s[i].AsQueryable().ToList(), | |||
}; | |||
goodsTechnologyActionListViews.Add(item); | |||
} | |||
return goodsTechnologyActionListViews; | |||
} | |||
public async Task<bool> DeleteGoodsTechnologyAction(string id) | |||
{ | |||
var item = await _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.Id == id).FirstAsync(); | |||
if (item != null) | |||
{ | |||
var res = await _db.Deleteable(item).ExecuteCommandAsync() > 0; | |||
var list = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x =>x.GoodsId == item.GoodsId && x.DeviceId == item.DeviceId).OrderBy(x => x.Sort, OrderByType.Asc).ToList(); | |||
var uplist = new List<BPA_GoodsTechnologyAction>(); | |||
for (int i = 0; i < list.Count; i++) | |||
{ | |||
list[i].Sort = i + 1; | |||
uplist.Add(list[i]); | |||
} | |||
if (uplist.Count > 0) | |||
{ | |||
await _db.Updateable(uplist).ExecuteCommandAsync(); | |||
} | |||
return true; | |||
} | |||
else | |||
{ | |||
throw Oops.Oh("找不到相关数据,删除失败"); | |||
} | |||
} | |||
public async Task<bool> DeleteGoodsTechnologyAction(GoodsTechnologDelete dto) | |||
{ | |||
var item = await _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.DeviceId == dto.devideId && x.GoodsId == dto.goodsId).ToListAsync(); | |||
if (item.Count > 0) | |||
{ | |||
return await _db.Deleteable(item).ExecuteCommandAsync() > 0; | |||
} | |||
else | |||
{ | |||
throw Oops.Oh("找不到相关数据,删除失败"); | |||
} | |||
} | |||
public async Task<List<DeviceGoodsTechnologyView>> GetDeviceTechnology() | |||
{ | |||
var list = await _db.Queryable<BPA_DeviceInfo>().Select(x => new DeviceGoodsTechnologyView() | |||
{ | |||
Id = x.Id.SelectAll(), | |||
}).Mapper(a => | |||
{ | |||
a.GoodsTechnologyInfo = _db.Queryable<BPA_DeviceTechnology>().Where(d => d.DeviceVersionKey == a.DeviceVersionKey).Select(d => new GoodsTechnologyInfo() | |||
{ | |||
DeviceTechnologyId = d.Id, | |||
DeviceVersionKey = d.DeviceVersionKey, | |||
Name = d.Name, | |||
}).ToList(); | |||
}).ToListAsync(); | |||
return list; | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,149 @@ | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsType; | |||
using BPA.SAAS.Manage.Application.DataBase.Interface; | |||
using BPA.SAAS.Manage.Application.Org.Dtos.Organize; | |||
using BPA.SAAS.Manage.Application.Org.Interface; | |||
using BPA.SAAS.Manage.Comm.Const; | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Comm.Util; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.DataBase; | |||
using BPA.SAAS.Manage.Core.Org; | |||
using Furion.LinqBuilder; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Security.Cryptography; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
public class GoodsTypeService: IGoodsTypeService, ITransient | |||
{ | |||
private readonly ISqlSugarClient _db; | |||
public GoodsTypeService(ISqlSugarClient db) | |||
{ | |||
_db= db; | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<PageUtil> GetGoodsTypePage(GoodsTypeQueryDto dto) | |||
{ | |||
List<IConditionalModel> conModels = new List<IConditionalModel>(); | |||
string groupId = App.User.FindFirst(ClaimConst.GroupId)?.Value; | |||
if (!string.IsNullOrEmpty(dto.Name)) | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "Name", ConditionalType = ConditionalType.Like, FieldValue = dto.Name }); | |||
} | |||
if (!string.IsNullOrEmpty(dto.Status)) | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "Status", ConditionalType = ConditionalType.Equal, FieldValue = dto.Status }); | |||
} | |||
int total = new RefAsync<int>(); | |||
var res =await _db.Queryable<BPA_GoodsType>().Where(it => it.IsDeleted == 0) | |||
.Where(conModels) | |||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | |||
.Select(it => new GoodsTypeTree() { Id = it.Id, Name = it.Name, Pid = it.Pid,Sort=it.Sort,Remark=it.Remark,Status=it.Status }).ToTreeAsync(it => it.Children, it => it.Pid, 0); | |||
//.ToPageList(dto.Current, dto.PageSize, ref total); | |||
List<GoodsTypeTree> list = new(); | |||
if (res != null) | |||
{ | |||
list = res.Skip((dto.Current - 1) * dto.PageSize).Take(dto.PageSize).ToList(); | |||
} | |||
PageUtil util = new PageUtil() | |||
{ | |||
Total = res==null?0:res.Count, | |||
Data = list | |||
}; | |||
return util; | |||
} | |||
/// <summary> | |||
/// 添加商品类型 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddGoodsType(GoodsTypeDto dto) | |||
{ | |||
var newType = new BPA_GoodsType | |||
{ | |||
Pid = dto.Pid, | |||
Name = dto.Name, | |||
Remark = dto.Remark, | |||
Sort = dto.Sort, | |||
Status = CommonStatus.ENABLE, | |||
}; | |||
var res =await _db.Insertable(newType).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 更新商品类型 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateGoodsType(GoodsTypeDto dto) | |||
{ | |||
// 查询数据库中是否存在未删除的商品类型 | |||
var resEntity = _db.Queryable<BPA_GoodsType>().First(it => it.Id == dto.Id); | |||
if (null == resEntity) | |||
{ | |||
return false; | |||
} | |||
resEntity.Name = dto.Name; | |||
resEntity.Pid = dto.Pid; | |||
resEntity.Sort = dto.Sort; | |||
resEntity.Remark = dto.Remark; | |||
resEntity.Status = (CommonStatus)Enum.ToObject(typeof(CommonStatus), dto.Status); | |||
var res =await _db.Updateable(resEntity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 删除商品类型 | |||
/// </summary> | |||
/// <param name="Id"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DelGoodsType(string Id) | |||
{ | |||
// 查询数据库中是否存在未删除的商品类型 | |||
var check = _db.Queryable<BPA_GoodsInfo>().Any(it => it.GoodsTypeId == Id); | |||
if (check) | |||
{ | |||
throw Oops.Oh("该类已经使用无法删除"); | |||
} | |||
var resEntity = _db.Queryable<BPA_GoodsType>().First(it => it.Id == Id); | |||
resEntity.IsDeleted = 1; | |||
var res =await _db.Updateable(resEntity).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 查询商品类型树结构 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<dynamic> GetGoodsTypeTree() | |||
{ | |||
var dataScopeList = new List<string>(); | |||
var orgs = await _db.Queryable<BPA_GoodsType>().WhereIF(dataScopeList.Count > 0, u => dataScopeList.Contains(u.Id)) | |||
.Where(u => u.Status == CommonStatus.ENABLE && u.IsDeleted==0).OrderBy(u => u.Sort) | |||
.Select(u => new OrgTreeNode | |||
{ | |||
key = u.Id, | |||
parentId = u.Pid, | |||
title = u.Name, | |||
value = u.Id.ToString(), | |||
weight = u.Sort, | |||
Type = 0, | |||
}).ToListAsync(); | |||
return new TreeBuildUtil<OrgTreeNode>().Build(orgs); | |||
} | |||
} | |||
} |
@@ -0,0 +1,120 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology; | |||
using BPA.SAAS.Manage.Application.Device.Interface; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.Device; | |||
using Microsoft.AspNetCore.Components.Forms; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device | |||
{ | |||
[ApiDescriptionSettings("Device", Tag = "设备基础工艺信息管理")] | |||
public class DeviceTechnologyServices: IDynamicApiController, ITransient | |||
{ | |||
IDeviceTechnologyService _deviceTechnologyService; | |||
public DeviceTechnologyServices(IDeviceTechnologyService deviceTechnologyService) | |||
{ | |||
_deviceTechnologyService= deviceTechnologyService; | |||
} | |||
/// <summary> | |||
/// 获取工艺基础信息列表 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicetechnology/page")] | |||
public async Task<PageUtil> GetDeviceTechnologyPage(DeviceTechnologyPageBase inputDto) | |||
{ | |||
return await _deviceTechnologyService.GetDeviceTechnologyPage(inputDto); | |||
} | |||
/// <summary> | |||
/// 查询所有工艺信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/devicetechnology/getdevicetechnology")] | |||
public async Task<List<DeviceTechnologyDto>> GetDeviceTechnology() | |||
{ | |||
return await _deviceTechnologyService.GetDeviceTechnology(); | |||
} | |||
/// <summary> | |||
/// 添加工艺 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicetechnology/add")] | |||
public async Task<bool> AddDeviceTechnology(DeviceTechnologyBaseDto inputDto) | |||
{ | |||
return await _deviceTechnologyService.AddDeviceTechnology(inputDto); | |||
} | |||
/// <summary> | |||
/// 修改工艺 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicetechnology/update")] | |||
public async Task<bool> UpdateDeviceTechnology(DeviceTechnologyBaseDto inputDto) | |||
{ | |||
return await _deviceTechnologyService.UpdateDeviceTechnology(inputDto); | |||
} | |||
/// <summary> | |||
/// 删除配方工艺 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicetechnology/delete")] | |||
public async Task<bool> DeleteDeviceTechnology(List<string> ids) | |||
{ | |||
return await _deviceTechnologyService.DeleteDeviceTechnology(ids); | |||
} | |||
/// <summary> | |||
/// 根据工艺id查询工艺模型 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/devicetechnology/gettechnologyaction")] | |||
public async Task<List<BPA_DeviceTechnologyAction>> GetTechnologyActionList(string devicetechnologyId) | |||
{ | |||
return await _deviceTechnologyService.GetTechnologyActionList(devicetechnologyId); | |||
} | |||
/// <summary> | |||
/// 查询所有工艺模型 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/devicetechnology/gettechnologyactionlist")] | |||
public async Task<List<BPA_DeviceTechnologyAction>> GetTechnologyActionList() | |||
{ | |||
return await _deviceTechnologyService.GetTechnologyActionList(); | |||
} | |||
/// <summary> | |||
/// 添加工艺模型 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicetechnology/adddevicetechnologyaction")] | |||
public async Task<bool> AddDeviceTechnologyAction(DeviceTechnologyActionBaseDto inputDto) | |||
{ | |||
return await _deviceTechnologyService.AddDeviceTechnologyAction(inputDto); | |||
} | |||
/// <summary> | |||
/// 修改工艺模型 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicetechnology/updatedevicetechnologyaction")] | |||
public async Task<bool> UpdateBomTechnology(DeviceTechnologyActionBaseDto inputDto) | |||
{ | |||
return await _deviceTechnologyService.UpdateBomTechnology(inputDto); | |||
} | |||
/// <summary> | |||
/// 删除工艺模型 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicetechnology/deldevicetechnologyaction")] | |||
public async Task<bool> DeleteTechnologyAction(List<string> ids) | |||
{ | |||
return await _deviceTechnologyService.DeleteTechnologyAction(ids); | |||
} | |||
} | |||
} |
@@ -0,0 +1,41 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology | |||
{ | |||
public class DeviceTechnologyActionBaseDto | |||
{ | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 工艺id | |||
/// </summary> | |||
public string DevicetechnologyId { get; set; } | |||
/// <summary> | |||
/// 动作名称 | |||
/// </summary> | |||
public string ActionName { get; set; } | |||
/// <summary> | |||
/// 类型 (1 输入框 2下拉框) | |||
/// </summary> | |||
public string ActionType { get; set; } | |||
/// <summary> | |||
/// 类型值(jsong格式) | |||
/// </summary> | |||
public string ActionValue { get; set; } | |||
/// <summary> | |||
/// 单位 | |||
/// </summary> | |||
public string Unit { get; set; } | |||
/// <summary> | |||
/// 是否绑定物料 | |||
/// </summary> | |||
public bool? IsBatch { get; set; } | |||
/// <summary> | |||
/// 排序 | |||
/// </summary> | |||
public int Sort { get; set; } | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology | |||
{ | |||
public class DeviceTechnologyBaseDto | |||
{ | |||
public string Id { get; set; } | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 状态 0启用 1禁用 | |||
/// </summary> | |||
public int Status { get; set; } | |||
public string ForeignKeyRe { get; set; } | |||
public string DeviceVersionKey { get; set; } | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology | |||
{ | |||
public class DeviceTechnologyDto | |||
{ | |||
public string Id { get; set; } | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 是否绑定物料 | |||
/// </summary> | |||
public bool IsBatch { get; set; } = true; | |||
} | |||
} |
@@ -0,0 +1,17 @@ | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology | |||
{ | |||
public class DeviceTechnologyPageBase | |||
{ | |||
public int Current { get; set; } | |||
public int PageSize { get; set; } | |||
public string Name { get; set; } | |||
public CommonStatus? Status { get; set; } | |||
} | |||
} |
@@ -0,0 +1,72 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.Device; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Interface | |||
{ | |||
public interface IDeviceTechnologyService | |||
{ | |||
/// <summary> | |||
/// 获取工艺基础信息列表 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<PageUtil> GetDeviceTechnologyPage(DeviceTechnologyPageBase inputDto); | |||
/// <summary> | |||
/// 查询所有工艺信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<List<DeviceTechnologyDto>> GetDeviceTechnology(); | |||
/// <summary> | |||
/// 添加工艺 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<bool> AddDeviceTechnology(DeviceTechnologyBaseDto inputDto); | |||
/// <summary> | |||
/// 修改工艺 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<bool> UpdateDeviceTechnology(DeviceTechnologyBaseDto inputDto); | |||
/// <summary> | |||
/// 删除工艺 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
Task<bool> DeleteDeviceTechnology(List<string> ids); | |||
/// <summary> | |||
/// 根据工艺id查询工艺模型 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<List<BPA_DeviceTechnologyAction>> GetTechnologyActionList(string devicetechnologyId); | |||
/// <summary> | |||
/// 查询所有工艺模型 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<List<BPA_DeviceTechnologyAction>> GetTechnologyActionList(); | |||
/// <summary> | |||
/// 添加工艺模型 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<bool> AddDeviceTechnologyAction(DeviceTechnologyActionBaseDto inputDto); | |||
/// <summary> | |||
/// 修改工艺模型 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<bool> UpdateBomTechnology(DeviceTechnologyActionBaseDto inputDto); | |||
/// <summary> | |||
/// 删除工艺模型 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
Task<bool> DeleteTechnologyAction(List<string> ids); | |||
} | |||
} |
@@ -0,0 +1,225 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology; | |||
using BPA.SAAS.Manage.Application.Device.Interface; | |||
using BPA.SAAS.Manage.Comm.Const; | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.Device; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Text.RegularExpressions; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Services | |||
{ | |||
public class DeviceTechnologyService: IDeviceTechnologyService, ITransient | |||
{ | |||
ISqlSugarClient _db; | |||
public DeviceTechnologyService(ISqlSugarClient db) | |||
{ | |||
_db = db; | |||
} | |||
#region 工艺基础信息 | |||
/// <summary> | |||
/// 获取工艺基础信息列表 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<PageUtil> GetDeviceTechnologyPage(DeviceTechnologyPageBase inputDto) | |||
{ | |||
RefAsync<int> total = 0; | |||
var res = await _db.Queryable<BPA_DeviceTechnology, BPA_DeviceVesion>((x, b) => new JoinQueryInfos(JoinType.Left, b.Id == x.DeviceVersionKey)) | |||
.OrderBy((x, b) => x.CreateAt, OrderByType.Desc) | |||
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Name), (x, b) => x.Name.Contains(inputDto.Name)) | |||
.WhereIF(inputDto.Status != null, (x, b) => x.Status == inputDto.Status) | |||
.Select((x, b) => new | |||
{ | |||
Name = x.Name, | |||
Status = x.Status, | |||
x.Id, | |||
x.GroupId, | |||
x.ForeignKeyRe, | |||
x.DeviceVersionKey, | |||
DeviceTypeKey = b.DeviceTypeKey, | |||
Vesion = b.Vesion | |||
}) | |||
.ToPageListAsync(inputDto.Current, inputDto.PageSize, total); | |||
return new PageUtil() | |||
{ | |||
Data = res, | |||
Total = total | |||
}; | |||
} | |||
/// <summary> | |||
/// 查询所有工艺信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<DeviceTechnologyDto>> GetDeviceTechnology() | |||
{ | |||
var res =await _db.Queryable<BPA_DeviceTechnology>().Where(x => x.Status == 0) | |||
.OrderBy(i => i.CreateAt, OrderByType.Desc) | |||
.Select(x => new DeviceTechnologyDto() | |||
{ | |||
Id = x.Id, | |||
Name = x.Name, | |||
IsBatch = SqlFunc.Subqueryable<BPA_DeviceTechnologyAction>().Where(p => p.DevicetechnologyId == x.Id).Any() | |||
}) | |||
.ToListAsync(); | |||
return res; | |||
} | |||
/// <summary> | |||
/// 添加工艺 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddDeviceTechnology(DeviceTechnologyBaseDto inputDto) | |||
{ | |||
var data = _db.Queryable<BPA_DeviceTechnology>() | |||
.Where(a => a.Name == inputDto.Name).ToList(); | |||
if (data.Count > 0) | |||
{ | |||
throw Oops.Oh("工艺名称已存在"); | |||
} | |||
else | |||
{ | |||
var res =await _db.Insertable(new BPA_DeviceTechnology() | |||
{ | |||
Id = Guid.NewGuid().ToString(), | |||
Name = inputDto.Name, | |||
Status = CommonStatus.ENABLE, | |||
CreateAt = DateTime.Now, | |||
IsDeleted = 0, | |||
ForeignKeyRe = inputDto.ForeignKeyRe, | |||
DeviceVersionKey = inputDto.DeviceVersionKey | |||
}).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
} | |||
/// <summary> | |||
/// 修改工艺 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateDeviceTechnology(DeviceTechnologyBaseDto inputDto) | |||
{ | |||
var check = _db.Queryable<BPA_DeviceTechnology>().Any(a => a.Id != inputDto.Id && a.Name == inputDto.Name); | |||
if (check) throw Oops.Oh("工艺名称已存在"); | |||
var data = _db.Queryable<BPA_DeviceTechnology>().Where(a => a.Id == inputDto.Id).First(); | |||
data.Name = inputDto.Name; | |||
data.DeviceVersionKey = inputDto.DeviceVersionKey; | |||
data.ForeignKeyRe = inputDto.ForeignKeyRe; | |||
var res =await _db.Updateable(data).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 删除配方工艺 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DeleteDeviceTechnology(List<string> ids) | |||
{ | |||
var resEntity = _db.Queryable<BPA_DeviceTechnology>().Where(x => ids.Contains(x.Id)).ToList(); | |||
foreach (var item in resEntity) | |||
{ | |||
item.IsDeleted = 1; | |||
} | |||
var res =await _db.Updateable(resEntity).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
#endregion | |||
#region 工艺模型 | |||
/// <summary> | |||
/// 根据工艺id查询工艺模型 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<BPA_DeviceTechnologyAction>> GetTechnologyActionList(string devicetechnologyId) | |||
{ | |||
var res = await _db.Queryable<BPA_DeviceTechnologyAction>().Where(x => x.IsDeleted == 0 && x.DevicetechnologyId == devicetechnologyId ) | |||
.OrderBy(i => i.Sort, OrderByType.Asc) | |||
.ToListAsync(); | |||
return res; | |||
} | |||
/// <summary> | |||
/// 查询所有工艺模型 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<BPA_DeviceTechnologyAction>> GetTechnologyActionList() | |||
{ | |||
var res = await _db.Queryable<BPA_DeviceTechnologyAction>().Where(x => x.IsDeleted == 0) | |||
.OrderBy(i => i.Sort, OrderByType.Asc) | |||
.ToListAsync(); | |||
return res; | |||
} | |||
/// <summary> | |||
/// 添加工艺模型 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddDeviceTechnologyAction(DeviceTechnologyActionBaseDto inputDto) | |||
{ | |||
var check = _db.Queryable<BPA_DeviceTechnologyAction>() | |||
.Any(a => a.DevicetechnologyId == inputDto.DevicetechnologyId && a.IsDeleted == 0 && a.ActionName == inputDto.ActionName && a.ActionType == inputDto.ActionType); | |||
if (check) | |||
{ | |||
throw Oops.Oh("工艺流程动作已存在"); | |||
} | |||
else | |||
{ | |||
var res = await _db.Insertable(new BPA_DeviceTechnologyAction() | |||
{ | |||
DevicetechnologyId = inputDto.DevicetechnologyId, | |||
ActionName = inputDto.ActionName, | |||
ActionType = inputDto.ActionType, | |||
ActionValue = inputDto.ActionValue, | |||
Unit = inputDto.Unit, | |||
IsBatch = true,//inputDto.IsBatch, | |||
IsDeleted = 0, | |||
Sort = inputDto.Sort, | |||
}).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); ; | |||
return res > 0; | |||
} | |||
} | |||
/// <summary> | |||
/// 修改工艺模型 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateBomTechnology(DeviceTechnologyActionBaseDto inputDto) | |||
{ | |||
var check = _db.Queryable<BPA_DeviceTechnologyAction>().Any(a => a.DevicetechnologyId == inputDto.DevicetechnologyId && a.ActionName == inputDto.ActionName && a.ActionType == inputDto.ActionType && a.Id != inputDto.Id); | |||
if (check) throw Oops.Oh("工艺流程动作已存在"); | |||
var data = _db.Queryable<BPA_DeviceTechnologyAction>().Where(a => a.Id == inputDto.Id).First(); | |||
if (data == null) throw Oops.Oh("工艺流程动作不存在"); | |||
data.ActionName = inputDto.ActionName; | |||
data.ActionType = inputDto.ActionType; | |||
data.ActionValue = inputDto.ActionValue; | |||
data.Unit = inputDto.Unit; | |||
data.IsBatch = inputDto.IsBatch; | |||
data.Sort = inputDto.Sort; | |||
var res = await _db.Updateable(data).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 删除工艺模型 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DeleteTechnologyAction(List<string> ids) | |||
{ | |||
var resEntity = _db.Queryable<BPA_DeviceTechnologyAction>().Where(x => ids.Contains(x.Id)).ToList(); | |||
foreach (var item in resEntity) | |||
{ | |||
item.IsDeleted = 1; | |||
} | |||
var res = await _db.Updateable(resEntity).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
#endregion | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
@@ -40,6 +41,11 @@ namespace BPA.SAAS.Manage.Core.DataBase | |||
/// 排序 | |||
/// </summary> | |||
public int Sort { get; set; } = 1; | |||
/// <summary> | |||
/// 状态 【正常 停用】默认 正常 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "int", ColumnDescription = "状态", IsNullable = false)] | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
public string GroupId { get; set; } | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
@@ -38,6 +39,11 @@ namespace BPA.SAAS.Manage.Core.DataBase | |||
/// 排序,小炒abc料获取 | |||
/// </summary> | |||
public int sort { get; set; } | |||
/// <summary> | |||
/// 状态 【正常 停用】默认 正常 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "int", ColumnDescription = "状态", IsNullable = false)] | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
public string GroupId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,24 @@ | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Core.DataBase | |||
{ | |||
[SugarTable("bpa_bomtype")] | |||
public class BPA_BomType : IBaseEntity, IGroupId | |||
{ | |||
public string Name { get; set; } | |||
public string Pertain { get; set; } | |||
/// <summary> | |||
/// 状态 【正常 停用】默认 正常 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "int", ColumnDescription = "状态", IsNullable = false)] | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
public string GroupId { get; set; } | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
@@ -24,6 +25,7 @@ namespace BPA.SAAS.Manage.Core.DataBase | |||
[SugarColumn(ColumnDataType = "Nvarchar(64)", IsNullable = false)] | |||
public string BomId { get; set; } | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
public string GroupId { get; set; } | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
@@ -11,7 +12,27 @@ namespace BPA.SAAS.Manage.Core.DataBase | |||
[SugarTable("bpa_goodsInfo")] | |||
public class BPA_GoodsInfo : IBaseEntity, IGroupId | |||
{ | |||
public string Name { get; set; } | |||
public string Descritption { get; set; } | |||
public string ImgUrl { get; set; } | |||
public int ImgMode { get; set; } | |||
public int Sort { get; set; } | |||
public string Key { get; set; } | |||
public string Code { get; set; } | |||
public decimal Price { get; set; } | |||
public long AutoKey { get; set; } | |||
public string GoodsUintId { get; set; } | |||
public int IsWeigh { get; set; } | |||
public string ForeignKeyRe { get; set; } | |||
public string Design { get; set; } | |||
public string DefaultMate { get; set; } | |||
public bool IsAttrubute { get; set; } | |||
public string GoodsTypeId { get; set; } | |||
/// <summary> | |||
/// 状态 【正常 停用】默认 正常 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "int", ColumnDescription = "状态", IsNullable = false)] | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
public string GroupId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,39 @@ | |||
using BPA.SAAS.Manage.Core.Base; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Core.DataBase | |||
{ | |||
[SugarTable("bpa_goodstechnologyaction")] | |||
public class BPA_GoodsTechnologyAction : IBaseEntity, IGroupId | |||
{ | |||
/// <summary> | |||
/// 步骤名称 | |||
/// </summary> | |||
public string StepName { get; set; } | |||
/// <summary> | |||
/// 动作json | |||
/// </summary> | |||
public string ActionJson { get; set; } | |||
/// <summary> | |||
/// 商品属性id集合 | |||
/// </summary> | |||
public string GoodsAttributeId { get; set; } | |||
/// <summary> | |||
/// 是否物料 | |||
/// </summary> | |||
public bool IsBatch { get; set; } | |||
/// <summary> | |||
/// 动作value | |||
/// </summary> | |||
public string ChnologyId { get; set; } | |||
public string GroupId { get; set; } | |||
public int Sort { get; set; } | |||
public string GoodsId { get; set; } | |||
public string DeviceId { get; set; } | |||
} | |||
} |
@@ -22,5 +22,6 @@ namespace BPA.SAAS.Manage.Core.DataBase | |||
[SugarColumn(ColumnDataType = "int", ColumnDescription = "状态", IsNullable = false)] | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
public string GroupId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,24 @@ | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Core.DataBase | |||
{ | |||
[SugarTable("bpa_goodsuint")] | |||
public class BPA_GoodsUint : IBaseEntity, IGroupId | |||
{ | |||
public string Name { get; set; } | |||
public string Remark { get; set; } | |||
/// <summary> | |||
/// 状态 【正常 停用】默认 正常 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "int", ColumnDescription = "状态", IsNullable = false)] | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
public string GroupId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,48 @@ | |||
using BPA.SAAS.Manage.Core.Base; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Security.Principal; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Core.Device | |||
{ | |||
[SugarTable("bpa_deviceinfo")] | |||
public class BPA_DeviceInfo: IBaseEntity, IGroupId | |||
{ | |||
/// <summary> | |||
/// 设备名称 | |||
/// </summary> | |||
public string DeviceName { get; set; } | |||
/// <summary> | |||
/// 设备标签 | |||
/// </summary> | |||
public string DeviceTypeId { get; set; } | |||
/// <summary> | |||
///归属场景(店铺) | |||
/// </summary> | |||
public string OrgId { get; set; } | |||
/// <summary> | |||
/// 设备类型 | |||
/// </summary> | |||
public string DeviceTypeKey { get; set; } | |||
/// <summary> | |||
/// 设备AutoKey 唯一用于mqtt消息推送标识 | |||
/// </summary> | |||
[SugarColumn(IsOnlyIgnoreInsert = true, IsOnlyIgnoreUpdate = true, IsIdentity = true)] | |||
public int AutoKey { get; set; } | |||
/// <summary> | |||
/// 物料数量 | |||
/// </summary> | |||
public int? MaterialQuantity { get; set; } | |||
/// <summary> | |||
/// 设备版本 | |||
/// </summary> | |||
public string DeviceVersionKey { get; set; } | |||
public string GroupId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,31 @@ | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Core.Device | |||
{ | |||
[SugarTable("bpa_devicetechnology")] | |||
public class BPA_DeviceTechnology : IBaseEntity, IGroupId | |||
{ | |||
/// <summary> | |||
/// 工艺名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 状态 0启用 1禁用 | |||
/// </summary> | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
public string GroupId { get; set; } | |||
[SugarColumn(ColumnDataType = "Nvarchar(255)", IsNullable = true)] | |||
public string ForeignKeyRe { get; set; } | |||
/// <summary> | |||
/// 设备版本 | |||
/// </summary> | |||
public string DeviceVersionKey { get; set; } | |||
} | |||
} |
@@ -0,0 +1,42 @@ | |||
using BPA.SAAS.Manage.Core.Base; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Core.Device | |||
{ | |||
public class BPA_DeviceTechnologyAction: IBaseEntity, IGroupId | |||
{ | |||
/// <summary> | |||
/// 工艺id | |||
/// </summary> | |||
public string DevicetechnologyId { get; set; } | |||
/// <summary> | |||
/// 动作名称 | |||
/// </summary> | |||
public string ActionName { get; set; } | |||
/// <summary> | |||
/// 类型 (1 输入框 2下拉框) | |||
/// </summary> | |||
public string ActionType { get; set; } | |||
/// <summary> | |||
/// 类型值(jsong格式) | |||
/// </summary> | |||
public string ActionValue { get; set; } | |||
/// <summary> | |||
/// 单位 | |||
/// </summary> | |||
public string Unit { get; set; } | |||
/// <summary> | |||
/// 是否绑定物料 | |||
/// </summary> | |||
public bool? IsBatch { get; set; } | |||
/// <summary> | |||
/// 排序 | |||
/// </summary> | |||
public int Sort { get; set; } | |||
public string GroupId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Core.Device | |||
{ | |||
[SugarTable("bpa_devicevesion")] | |||
public class BPA_DeviceVesion : IBaseEntity, IGroupId | |||
{ | |||
public string Vesion { get; set; } | |||
public string DeviceTypeKey { get; set; } | |||
/// <summary> | |||
/// 模版路径 | |||
/// </summary> | |||
public string TemplatePath { get; set; } | |||
/// <summary> | |||
/// 状态 0启用 1禁用 | |||
/// </summary> | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
public string GroupId { get ; set ; } | |||
} | |||
} |
@@ -13,6 +13,12 @@ | |||
<None Remove="BPA.SAAS.Manage.Web.Core.xml" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.0" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPA.SAAS.Manage.Application\BPA.SAAS.Manage.Application.csproj" /> | |||
</ItemGroup> | |||
@@ -1,9 +1,11 @@ | |||
using BPA.SAAS.Manage.Core; | |||
using FluentValidation.AspNetCore; | |||
using Furion; | |||
using Microsoft.AspNetCore.Builder; | |||
using Microsoft.AspNetCore.Hosting; | |||
using Microsoft.Extensions.DependencyInjection; | |||
using Microsoft.Extensions.Hosting; | |||
using Newtonsoft.Json; | |||
namespace BPA.SAAS.Manage.Web.Core | |||
{ | |||
@@ -13,7 +15,16 @@ namespace BPA.SAAS.Manage.Web.Core | |||
{ | |||
services.AddConsoleFormatter(); | |||
services.AddJwt<JwtHandler>(); | |||
services.AddControllersWithViews() | |||
.AddFluentValidation(fv => | |||
{ | |||
fv.RegisterValidatorsFromAssemblies(App.Assemblies); | |||
}) | |||
.AddNewtonsoftJson(options => | |||
{ | |||
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; | |||
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss"; | |||
}); | |||
services.AddCorsAccessor(); | |||
services.AddSqlsugarSetup(App.Configuration); | |||
services.AddControllers() | |||