获取产线和设备
This commit is contained in:
parent
de20230bcb
commit
638a674cfd
@ -111,5 +111,32 @@ namespace DOAN.Admin.WebApi.Controllers.huate_group.Recipe
|
||||
|
||||
}
|
||||
|
||||
//TODO 获取公司
|
||||
[HttpGet("get_company")]
|
||||
public IActionResult GetAllCompany()
|
||||
{
|
||||
var response = _RecipeService.GetAllCompany();
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
//TODO 获取车间
|
||||
[HttpGet("get_workshop")]
|
||||
public IActionResult GetWorkShopByCompany(int company_id)
|
||||
{
|
||||
var response = _RecipeService.GetWorkShopByCompany(company_id);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
//TODO 获取产线和设备 children
|
||||
[HttpGet("get_line_childen_device")]
|
||||
public IActionResult GetLineChildenDevice(int workshop_id)
|
||||
{
|
||||
var response = _RecipeService.GetLineChildenDevice(workshop_id);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
using DOAN.Model.Factory_Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DOAN.Model.huate_group.recipe.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 产线 childern device
|
||||
/// </summary>
|
||||
public class ProductLineChildrenDevice
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int? FkWorkshopId { get; set; }
|
||||
public string WorkshopName { get; set; }
|
||||
|
||||
public string LineCode { get; set; }
|
||||
|
||||
public string LineName { get; set; }
|
||||
|
||||
public int? Status { get; set; }
|
||||
|
||||
public BaseDeviceAccount[] Children { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@ -5,17 +5,21 @@ namespace DOAN.Model.huate_group.recipe.Dto
|
||||
/// </summary>
|
||||
public class RecipeQueryDto : PagerInfo
|
||||
{
|
||||
public int? FactoryTanantId { get; set; }
|
||||
|
||||
public string Workshop { get; set; }
|
||||
|
||||
public string Workstation { get; set; }
|
||||
public int? FkCompanyId { get; set; }
|
||||
|
||||
public string Vehiclemodel { get; set; }
|
||||
public int? FkTanantId { get; set; }
|
||||
|
||||
public string Partnumber { get; set; }
|
||||
|
||||
public string Paramter { get; set; }
|
||||
|
||||
public int? FkFactoryId { get; set; }
|
||||
|
||||
|
||||
public int? FkWorkshopId { get; set; }
|
||||
|
||||
|
||||
public int? FkDeviceId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -26,13 +30,23 @@ namespace DOAN.Model.huate_group.recipe.Dto
|
||||
[Required(ErrorMessage = "流水号不能为空")]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Localtion { get; set; }
|
||||
public string CompanyName { get; set; }
|
||||
|
||||
public int? FactoryTanantId { get; set; }
|
||||
public int? FkCompanyId { get; set; }
|
||||
|
||||
public string Workshop { get; set; }
|
||||
public int? FkTanantId { get; set; }
|
||||
|
||||
public string Workstation { get; set; }
|
||||
public string FactoryName { get; set; }
|
||||
|
||||
public int? FkFactoryId { get; set; }
|
||||
|
||||
public string WorkshopName { get; set; }
|
||||
|
||||
public int? FkWorkshopId { get; set; }
|
||||
|
||||
public string DeviceName { get; set; }
|
||||
|
||||
public int? FkDeviceId { get; set; }
|
||||
|
||||
public string Vehiclemodel { get; set; }
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
namespace DOAN.Model.huate_group.recipe
|
||||
{
|
||||
/// <summary>
|
||||
@ -13,25 +14,58 @@ namespace DOAN.Model.huate_group.recipe
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地点
|
||||
/// 公司
|
||||
/// </summary>
|
||||
public string Localtion { get; set; }
|
||||
[SugarColumn(ColumnName = "company_name")]
|
||||
public string CompanyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工厂 租户号
|
||||
/// 公司id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "factory_tanant_id")]
|
||||
public int? FactoryTanantId { get; set; }
|
||||
[SugarColumn(ColumnName = "fk_company_id")]
|
||||
public int? FkCompanyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 租户号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_tanant_id")]
|
||||
public int? FkTanantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工厂名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "factory_name")]
|
||||
public string FactoryName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工厂id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_factory_id")]
|
||||
public int? FkFactoryId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 车间
|
||||
/// </summary>
|
||||
public string Workshop { get; set; }
|
||||
[SugarColumn(ColumnName = "workshop_name")]
|
||||
public string WorkshopName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工位
|
||||
/// 车间id
|
||||
/// </summary>
|
||||
public string Workstation { get; set; }
|
||||
[SugarColumn(ColumnName = "fk_workshop_id")]
|
||||
public int? FkWorkshopId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "device_name")]
|
||||
public string DeviceName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_device_id")]
|
||||
public int? FkDeviceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 车型
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
using DOAN.Model.Factory_Model;
|
||||
using DOAN.Model.huate_group.recipe;
|
||||
using DOAN.Model.huate_group.recipe.Dto;
|
||||
|
||||
@ -18,6 +19,13 @@ namespace DOAN.Service.huate_group.Recipe.IService
|
||||
int UpdateRecipe(Recipee parm);
|
||||
List<RecipeLimit> GetRecipebyLimit(int recipe_id);
|
||||
|
||||
List<BaseCompany> GetAllCompany();
|
||||
|
||||
|
||||
List<BaseWorkshop> GetWorkShopByCompany(int company_id);
|
||||
|
||||
List<ProductLineChildrenDevice> GetLineChildenDevice(int workshop_id);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ using DOAN.Model.huate_group.recipe;
|
||||
using DOAN.Model.huate_group.recipe.Dto;
|
||||
using DOAN.Repository;
|
||||
using Aliyun.OSS;
|
||||
using DOAN.Model.Factory_Model;
|
||||
|
||||
|
||||
namespace DOAN.Service.huate_group.Recipe
|
||||
@ -69,9 +70,9 @@ namespace DOAN.Service.huate_group.Recipe
|
||||
|
||||
public List<RecipeLimit> GetRecipebyLimit(int recipe_id)
|
||||
{
|
||||
return Context.Queryable<RecipeLimit>()
|
||||
.Where(it=>it.FkRecipeId == recipe_id)
|
||||
.ToList();
|
||||
return Context.Queryable<RecipeLimit>()
|
||||
.Where(it => it.FkRecipeId == recipe_id)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -82,15 +83,65 @@ namespace DOAN.Service.huate_group.Recipe
|
||||
private static Expressionable<Recipee> QueryExp(RecipeQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<Recipee>()
|
||||
.AndIF(parm.FactoryTanantId>0,it=>it.FactoryTanantId== parm.FactoryTanantId)
|
||||
.AndIF(parm != null&&!string.IsNullOrEmpty( parm.Workshop),it=>it.Workshop.Contains(parm.Workshop))
|
||||
.AndIF(parm != null&&!string.IsNullOrEmpty( parm.Workstation),it=>it.Workstation.Contains(parm.Workstation))
|
||||
.AndIF(parm != null&&!string.IsNullOrEmpty( parm.Vehiclemodel),it=>it.Vehiclemodel.Contains(parm.Vehiclemodel))
|
||||
.AndIF(parm != null&&!string.IsNullOrEmpty( parm.Partnumber),it=>it.Partnumber.Contains(parm.Partnumber))
|
||||
.AndIF(parm != null&&!string.IsNullOrEmpty( parm.Paramter),it=>it.Paramter.Contains(parm.Paramter))
|
||||
.AndIF(parm.FkTanantId > 0, it => it.FkTanantId == parm.FkTanantId)
|
||||
.AndIF(parm.FkFactoryId > 0, it => it.FkFactoryId == parm.FkFactoryId)
|
||||
.AndIF(parm.FkWorkshopId > 0, it => it.FkWorkshopId == parm.FkWorkshopId)
|
||||
.AndIF(parm.FkDeviceId > 0, it => it.FkDeviceId == parm.FkDeviceId)
|
||||
//.AndIF(parm != null && !string.IsNullOrEmpty(parm.Workshop), it => it.WorkshopName.Contains(parm.Workshop))
|
||||
//.AndIF(parm != null && !string.IsNullOrEmpty(parm.Workstation), it => it.DeviceName.Contains(parm.Workstation))
|
||||
//.AndIF(parm != null && !string.IsNullOrEmpty(parm.Vehiclemodel), it => it.Vehiclemodel.Contains(parm.Vehiclemodel))
|
||||
//.AndIF(parm != null && !string.IsNullOrEmpty(parm.Partnumber), it => it.Partnumber.Contains(parm.Partnumber))
|
||||
//.AndIF(parm != null && !string.IsNullOrEmpty(parm.Paramter), it => it.Paramter.Contains(parm.Paramter))
|
||||
;
|
||||
|
||||
return predicate;
|
||||
}
|
||||
|
||||
public List<BaseCompany> GetAllCompany()
|
||||
{
|
||||
return Context.Queryable<BaseCompany>().ToList();
|
||||
}
|
||||
|
||||
public List<BaseWorkshop> GetWorkShopByCompany(int company_id)
|
||||
{
|
||||
return Context.Queryable<BaseWorkshop>().Where(it => it.FkCompanyId == company_id).ToList();
|
||||
}
|
||||
|
||||
public List<ProductLineChildrenDevice> GetLineChildenDevice(int workshop_id)
|
||||
{
|
||||
List<ProductLineChildrenDevice> productLineChildrenDevices = new List<ProductLineChildrenDevice>();
|
||||
//获取车间下所有产线
|
||||
|
||||
List<BaseProductionLine> lines = Context.Queryable<BaseProductionLine>().Where(it => it.FkWorkshopId == workshop_id).ToList();
|
||||
if (lines != null && lines.Count() > 0)
|
||||
{
|
||||
foreach (BaseProductionLine line in lines)
|
||||
{
|
||||
|
||||
ProductLineChildrenDevice LineItem = new ProductLineChildrenDevice();
|
||||
|
||||
LineItem.Id = line.Id;
|
||||
LineItem.FkWorkshopId = line.FkWorkshopId;
|
||||
LineItem.LineCode = line.LineCode;
|
||||
LineItem.LineName = line.LineName;
|
||||
LineItem.Status = line.Status;
|
||||
|
||||
|
||||
// 获取产线所有设备
|
||||
List<BaseDeviceAccount> accounts = Context.Queryable<BaseDeviceAccount>().Where(it => it.FkLineId == line.Id).ToList();
|
||||
if (accounts != null && accounts.Count() > 0)
|
||||
{
|
||||
LineItem.Children = accounts.ToArray();
|
||||
}
|
||||
productLineChildrenDevices.Add(LineItem);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return productLineChildrenDevices;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -149,7 +149,7 @@ namespace DOAN.ServiceCore.SqlSugar
|
||||
log.AfterData = afterPars;
|
||||
}
|
||||
//logger.WithProperty("title", data).Info(pars);
|
||||
db.GetConnectionScope(0)
|
||||
db.GetConnectionScope(1)
|
||||
.Insertable(log)
|
||||
.ExecuteReturnSnowflakeId();
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ namespace ZR.Tasks.TaskScheduler
|
||||
foreach (T item in device01s)
|
||||
{
|
||||
//1.1 判断设备配置情况
|
||||
Recipee options = query.Where(it => it.Workstation == item.Workstation && it.Paramter == item.Paramter).First();
|
||||
Recipee options = query.Where(it => it.DeviceName == item.Workstation && it.Paramter == item.Paramter).First();
|
||||
|
||||
if (options != null)
|
||||
{ //不可上传
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user