配方表
This commit is contained in:
parent
b84938858a
commit
98f581c35d
@ -3,6 +3,7 @@ using DOAN.Admin.WebApi.Filters;
|
||||
using DOAN.Service.huate_group.Recipe.IService;
|
||||
using DOAN.Model.huate_group.recipe;
|
||||
using DOAN.Model.huate_group.recipe.Dto;
|
||||
using System.ComponentModel;
|
||||
|
||||
//创建时间:2024-08-21
|
||||
namespace DOAN.Admin.WebApi.Controllers.huate_group.Recipe
|
||||
@ -125,6 +126,11 @@ namespace DOAN.Admin.WebApi.Controllers.huate_group.Recipe
|
||||
[HttpGet("get_workshop")]
|
||||
public IActionResult GetWorkShopByCompany(int company_id)
|
||||
{
|
||||
if (company_id <= 0)
|
||||
{
|
||||
throw new Exception("参数异常,请检查常数");
|
||||
|
||||
}
|
||||
var response = _RecipeService.GetWorkShopByCompany(company_id);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
@ -134,10 +140,28 @@ namespace DOAN.Admin.WebApi.Controllers.huate_group.Recipe
|
||||
[HttpGet("get_line_childen_device")]
|
||||
public IActionResult GetLineChildenDevice(int workshop_id)
|
||||
{
|
||||
if (workshop_id <= 0)
|
||||
{
|
||||
throw new Exception("参数异常,请检查常数");
|
||||
|
||||
}
|
||||
var response = _RecipeService.GetLineChildenDevice(workshop_id);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
//TODO 选中配方
|
||||
[HttpGet("selected")]
|
||||
public IActionResult SelectedRecipe(int recipe_id)
|
||||
{
|
||||
if (recipe_id <= 0)
|
||||
{
|
||||
throw new Exception("参数异常,请检查常数");
|
||||
|
||||
}
|
||||
var response = _RecipeService.SelectedRecipe(recipe_id);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
13
DOAN.Model/Factory_Model/BaseDeviceAccountExtensions.cs
Normal file
13
DOAN.Model/Factory_Model/BaseDeviceAccountExtensions.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DOAN.Model.Factory_Model
|
||||
{
|
||||
public static class BaseDeviceAccountExtensions
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -26,6 +26,6 @@ namespace DOAN.Service.huate_group.Recipe.IService
|
||||
|
||||
List<ProductLineChildrenDevice> GetLineChildenDevice(int workshop_id);
|
||||
|
||||
|
||||
int SelectedRecipe(int recipe_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ namespace DOAN.Service.huate_group.Recipe
|
||||
/// <returns></returns>
|
||||
public Recipee AddRecipe(Recipee model)
|
||||
{
|
||||
model.IsSelected = false;
|
||||
|
||||
// 根据设备id 填充 company workshop line
|
||||
BaseDeviceAccount account = Context.Queryable<BaseDeviceAccount>().Where(x => x.Id == model.FkDeviceId).First();
|
||||
model.DeviceName = account.DeviceName;
|
||||
@ -174,5 +174,23 @@ namespace DOAN.Service.huate_group.Recipe
|
||||
|
||||
return productLineChildrenDevices;
|
||||
}
|
||||
|
||||
public int SelectedRecipe(int recipe_id)
|
||||
{
|
||||
int result = 0;
|
||||
UseTran2(() =>
|
||||
{
|
||||
Recipee recipee = Context.Queryable<Recipee>().Where(it => it.Id == recipe_id).First();
|
||||
if (recipee != null)
|
||||
{
|
||||
Context.Updateable<Recipee>().Where(it => it.FkDeviceId == recipee.FkDeviceId).SetColumns(it => it.IsSelected == false).ExecuteCommand();
|
||||
result = Context.Updateable<Recipee>().Where(it => it.Id == recipee.Id).SetColumns(it => it.IsSelected == true).ExecuteCommand();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user