add - 物料信息接口

master
wenjy 1 year ago
parent 20db5b0f08
commit 1e45df12dd

@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>

@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace Durkee.Mes.Api.Common
{
/// <summary>
/// 谓词表达式构建器
/// </summary>
public static class ExpressionExtensions
{
/// <summary>
/// 创建一个值恒为 <c>true</c> 的表达式。
/// </summary>
/// <typeparam name="T">表达式方法类型</typeparam>
/// <returns>一个值恒为 <c>true</c> 的表达式。</returns>
public static Expression<Func<T, bool>> True<T>() { return p => true; }
/// <summary>
/// 创建一个值恒为 <c>false</c> 的表达式。
/// </summary>
/// <typeparam name="T">表达式方法类型</typeparam>
/// <returns>一个值恒为 <c>false</c> 的表达式。</returns>
public static Expression<Func<T, bool>> False<T>() { return f => false; }
/// <summary>
/// 使用 Expression.OrElse 的方式拼接两个 System.Linq.Expression。
/// </summary>
/// <typeparam name="T">表达式方法类型</typeparam>
/// <param name="left">左边的 System.Linq.Expression 。</param>
/// <param name="right">右边的 System.Linq.Expression。</param>
/// <returns>拼接完成的 System.Linq.Expression。</returns>
public static Expression<T> Or<T>(this Expression<T> left, Expression<T> right)
{
return MakeBinary(left, right, Expression.OrElse);
}
/// <summary>
/// 使用 Expression.AndAlso 的方式拼接两个 System.Linq.Expression。
/// </summary>
/// <typeparam name="T">表达式方法类型</typeparam>
/// <param name="left">左边的 System.Linq.Expression 。</param>
/// <param name="right">右边的 System.Linq.Expression。</param>
/// <returns>拼接完成的 System.Linq.Expression。</returns>
public static Expression<T> And<T>(this Expression<T> left, Expression<T> right)
{
return MakeBinary(left, right, Expression.AndAlso);
}
/// <summary>
/// 使用自定义的方式拼接两个 System.Linq.Expression。
/// </summary>
/// <typeparam name="T">表达式方法类型</typeparam>
/// <param name="left">左边的 System.Linq.Expression 。</param>
/// <param name="right">右边的 System.Linq.Expression。</param>
/// <param name="func"> </param>
/// <returns>拼接完成的 System.Linq.Expression。</returns>
private static Expression<T> MakeBinary<T>(this Expression<T> left, Expression<T> right, Func<Expression, Expression, Expression> func)
{
return MakeBinary((LambdaExpression)left, right, func) as Expression<T>;
}
/// <summary>
/// 拼接两个 <paramref>
/// <name>System.Linq.Expression</name>
/// </paramref> ,两个 <paramref>
/// <name>System.Linq.Expression</name>
/// </paramref> 的参数必须完全相同。
/// </summary>
/// <param name="left">左边的 <paramref>
/// <name>System.Linq.Expression</name>
/// </paramref> </param>
/// <param name="right">右边的 <paramref>
/// <name>System.Linq.Expression</name>
/// </paramref> </param>
/// <param name="func">表达式拼接的具体逻辑</param>
/// <returns>拼接完成的 <paramref>
/// <name>System.Linq.Expression</name>
/// </paramref> </returns>
private static LambdaExpression MakeBinary(this LambdaExpression left, LambdaExpression right, Func<Expression, Expression, Expression> func)
{
var data = Combinate(right.Parameters, left.Parameters).ToArray();
right = ParameterReplace.Replace(right, data) as LambdaExpression;
return Expression.Lambda(func(left.Body, right.Body), left.Parameters.ToArray());
}
/// <summary>
/// 合并参数
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="left"></param>
/// <param name="right"></param>
/// <returns></returns>
private static IEnumerable<KeyValuePair<T, T>> Combinate<T>(IEnumerable<T> left, IEnumerable<T> right)
{
var a = left.GetEnumerator();
var b = right.GetEnumerator();
while (a.MoveNext() && b.MoveNext())
yield return new KeyValuePair<T, T>(a.Current, b.Current);
}
}
internal sealed class ParameterReplace : ExpressionVisitor
{
public static Expression Replace(Expression e, IEnumerable<KeyValuePair<ParameterExpression, ParameterExpression>> paramList)
{
var item = new ParameterReplace(paramList);
return item.Visit(e);
}
private readonly Dictionary<ParameterExpression, ParameterExpression> _parameters;
public ParameterReplace(IEnumerable<KeyValuePair<ParameterExpression, ParameterExpression>> paramList)
{
_parameters = paramList.ToDictionary(p => p.Key, p => p.Value, new ParameterEquality());
}
protected override Expression VisitParameter(ParameterExpression p)
{
ParameterExpression result;
if (_parameters.TryGetValue(p, out result))
return result;
return base.VisitParameter(p);
}
#region class: ParameterEquality
private class ParameterEquality : IEqualityComparer<ParameterExpression>
{
public bool Equals(ParameterExpression x, ParameterExpression y)
{
if (x == null || y == null)
return false;
return x.Type == y.Type;
}
public int GetHashCode(ParameterExpression obj)
{
if (obj == null)
return 0;
return obj.Type.GetHashCode();
}
}
#endregion
}
}

@ -0,0 +1,284 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;
using System.Xml.Linq;
namespace Durkee.Mes.Api.Model.domain
{
[SugarTable("BasMaterial"), TenantAttribute("mes")]
[DataContract(Name = "BasMaterial 物料信息")]
public class BaseMaterialInfo
{
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ObjID", IsPrimaryKey = true)]
public int ObjID { get; set; }
/// <summary>
/// 大类+小类+规格+胶代码或最后4顺序号
///</summary>
[SugarColumn(ColumnName = "MaterialCode")]
public string MaterialCode { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "MajorTypeID")]
public int? MajorTypeID { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "MinorTypeID")]
public string MinorTypeID { get; set; }
/// <summary>
///
/// 默认值: ('')
///</summary>
[SugarColumn(ColumnName = "RubCode")]
public string RubCode { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "MaterialName")]
public string MaterialName { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "MaterialOtherName")]
public string MaterialOtherName { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "MaterialSimpleName")]
public string MaterialSimpleName { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ProductMaterialCode")]
public string ProductMaterialCode { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "MaterialLevel")]
public string MaterialLevel { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "MaterialGroup")]
public string MaterialGroup { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "UserCode")]
public string UserCode { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "PlanPrice")]
public decimal? PlanPrice { get; set; }
/// <summary>
/// 具体到县级市长度为6国外的只具体国家
///</summary>
[SugarColumn(ColumnName = "ProductArea")]
public string ProductArea { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "MinStock")]
public decimal? MinStock { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "MaxStock")]
public decimal? MaxStock { get; set; }
/// <summary>
/// 千克,克,块,桶,升
///</summary>
[SugarColumn(ColumnName = "UnitID")]
public int? UnitID { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "StaticUnitID")]
public int? StaticUnitID { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "StaticUnitCoefficient")]
public decimal? StaticUnitCoefficient { get; set; }
/// <summary>
/// 显为百分比
///</summary>
[SugarColumn(ColumnName = "CheckPermitError")]
public decimal? CheckPermitError { get; set; }
/// <summary>
/// 按小时计算
///</summary>
[SugarColumn(ColumnName = "MaxParkTime")]
public decimal? MaxParkTime { get; set; }
/// <summary>
/// 小时计算
///</summary>
[SugarColumn(ColumnName = "MinParkTime")]
public decimal? MinParkTime { get; set; }
/// <summary>
///
/// 默认值: (getdate())
///</summary>
[SugarColumn(ColumnName = "DefineDate")]
public DateTime? DefineDate { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "StandardCode")]
public string StandardCode { get; set; }
/// <summary>
///
/// 默认值: ((1))
///</summary>
[SugarColumn(ColumnName = "StaticClass")]
public int? StaticClass { get; set; }
/// <summary>
///
/// 默认值: ((0))
///</summary>
[SugarColumn(ColumnName = "IsEqualMaterial")]
public string IsEqualMaterial { get; set; }
/// <summary>
///
/// 默认值: ((0))
///</summary>
[SugarColumn(ColumnName = "IsPutJar")]
public string IsPutJar { get; set; }
/// <summary>
///
/// 默认值: ((1))
///</summary>
[SugarColumn(ColumnName = "IsQualityRateCount")]
public string IsQualityRateCount { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ERPCode")]
public string ERPCode { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "Remark")]
public string Remark { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "DeleteFlag")]
public string DeleteFlag { get; set; }
/// <summary>
///
/// 默认值: ((0))
///</summary>
[SugarColumn(ColumnName = "ValidDate")]
public decimal ValidDate { get; set; }
/// <summary>
///
/// 默认值: ((0))
///</summary>
[SugarColumn(ColumnName = "ValidDateB")]
public decimal ValidDateB { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "SAPMaterialCode")]
public string SAPMaterialCode { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "SAPMaterialShortCode")]
public string SAPMaterialShortCode { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ERPCode_Bak")]
public string ErpcodeBak { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "OperSourceTemp")]
public string OperSourceTemp { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "IsQualityrateCountBak")]
public int? IsQualityrateCountBak { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CMaterialLevel")]
public string CMaterialLevel { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CMaterialGroup")]
public string CMaterialGroup { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "XBStock")]
public decimal? XBStock { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "HFCode")]
public string HFCode { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "HFCode2")]
public string HFCode2 { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "UNITName")]
public string UNITName { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "KFACSTATUS")]
public string Kfacstatus { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "Ordertype")]
public string Ordertype { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "CreateDate")]
public string CreateDate { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "UpdateDate")]
public string UpdateDate { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "UnAudit")]
public string UnAudit { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "ChkStand")]
public string ChkStand { get; set; }
/// <summary>
/// 1 KG 2 PC 3 标准KG
/// 默认值: ((1))
///</summary>
[SugarColumn(ColumnName = "SapUpUnit")]
public int? SapUpUnit { get; set; }
/// <summary>
/// 是否为轨道事业部物料0不是1
///</summary>
[SugarColumn(ColumnName = "IsGDMaterial")]
public int? IsGDMaterial { get; set; }
}
}

@ -13,6 +13,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Durkee.Mes.Api.Common\Durkee.Mes.Api.Common.csproj" />
<ProjectReference Include="..\Durkee.Mes.Api.Config\Durkee.Mes.Api.Config.csproj" />
<ProjectReference Include="..\Durkee.Mes.Api.Model\Durkee.Mes.Api.Model.csproj" />
</ItemGroup>

@ -58,8 +58,10 @@ namespace Durkee.Mes.Api.Repository
/// <param name="services"></param>
public static void AddServices(this IServiceCollection services)
{
services.AddSingleton<Repository<BaseUser>>();
//services.AddSingleton<Repository<BaseUser>>();
services.AddSingleton(typeof(Repository<>));
services.AddSingleton<IBaseUserService, BaseUserServiceImpl>();
services.AddSingleton<IBaseMaterialService, BaseMaterialServiceImpl>();
}
}
}

@ -0,0 +1,39 @@
using Durkee.Mes.Api.Model.domain;
using System;
using System.Collections.Generic;
using System.Text;
namespace Durkee.Mes.Api.Repository.service
{
public interface IBaseMaterialService
{
/// <summary>
/// 获取所有的物料信息
/// </summary>
/// <returns></returns>
List<BaseMaterialInfo> GetMaterialInfos();
/// <summary>
/// 通过物料编码获取物料信息
/// </summary>
/// <param name="materialCode"></param>
/// <returns></returns>
BaseMaterialInfo GetMaterialInfoByMaterialCode(string materialCode);
/// <summary>
/// 通过SAP物料编码获取物料信息
/// </summary>
/// <param name="sapMaterialCode"></param>
/// <returns></returns>
BaseMaterialInfo GetMaterialInfoBySapMaterialCode(string sapMaterialCode);
/// <summary>
/// 通过物料类别获取物料信息
/// </summary>
/// <param name="majorTypeId">物料大类</param>
/// <param name="minorTypeId">物料细类</param>
/// <returns></returns>
List<BaseMaterialInfo> GetMaterialInfosByMaterialType(int majorTypeId,string minorTypeId);
}
}

@ -12,5 +12,12 @@ namespace Durkee.Mes.Api.Repository.service
/// </summary>
/// <returns></returns>
List<BaseUser> GetUsers();
/// <summary>
/// 验证添加用户信息,有一个错误时进行回滚
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
bool InsertUsers(List<BaseUser> users);
}
}

@ -0,0 +1,108 @@
using Durkee.Mes.Api.Common;
using Durkee.Mes.Api.Model.domain;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
namespace Durkee.Mes.Api.Repository.service.Impl
{
public class BaseMaterialServiceImpl : IBaseMaterialService
{
private Repository<BaseMaterialInfo> _repository;
private ILogger<BaseMaterialServiceImpl> _logger;
public BaseMaterialServiceImpl(Repository<BaseMaterialInfo> repository,ILogger<BaseMaterialServiceImpl> logger)
{
_repository = repository;
_logger = logger;
}
/// <summary>
/// 通过物料编码获取物料信息
/// </summary>
/// <param name="materialCode"></param>
/// <returns></returns>
public BaseMaterialInfo GetMaterialInfoByMaterialCode(string materialCode)
{
BaseMaterialInfo materialInfo = null;
try
{
materialInfo = _repository.GetFirst(x=>x.MaterialCode == materialCode);
}catch (Exception ex)
{
_logger.LogError($"根据物料编号获取物料信息异常:{ex.Message}");
}
return materialInfo;
}
/// <summary>
/// 通过SAP物料编码获取物料信息
/// </summary>
/// <param name="sapMaterialCode"></param>
/// <returns></returns>
public BaseMaterialInfo GetMaterialInfoBySapMaterialCode(string sapMaterialCode)
{
BaseMaterialInfo materialInfo = null;
try
{
materialInfo = _repository.GetFirst(x => x.SAPMaterialCode == sapMaterialCode);
}
catch (Exception ex)
{
_logger.LogError($"根据SAP物料编号获取物料信息异常:{ex.Message}");
}
return materialInfo;
}
/// <summary>
/// 获取所有的物料信息
/// </summary>
/// <returns></returns>
public List<BaseMaterialInfo> GetMaterialInfos()
{
List<BaseMaterialInfo> materialInfos = null;
try
{
materialInfos = _repository.GetList();
}
catch (Exception ex)
{
_logger.LogError($"获取物料信息异常:{ex.Message}");
}
return materialInfos;
}
/// <summary>
/// 通过物料类别获取物料信息
/// </summary>
/// <param name="majorTypeId">物料大类</param>
/// <param name="minorTypeId">物料细类</param>
/// <returns></returns>
public List<BaseMaterialInfo> GetMaterialInfosByMaterialType(int majorTypeId, string minorTypeId)
{
List<BaseMaterialInfo> materialInfos = null;
try
{
Expression<Func<BaseMaterialInfo, bool>> exp = x => true;
if(majorTypeId != 0)
{
exp = exp.And(x=>x.MajorTypeID == majorTypeId);
}else if (!string.IsNullOrEmpty(minorTypeId))
{
exp = exp.And(x=>x.MinorTypeID == minorTypeId);
}
materialInfos = _repository.GetList(exp);
}
catch (Exception ex)
{
_logger.LogError($"通过物料类型获取物料信息异常:{ex.Message}");
}
return materialInfos;
}
}
}

@ -31,5 +31,23 @@ namespace Durkee.Mes.Api.Repository.service.Impl
}
return users;
}
public bool InsertUsers(List<BaseUser> users)
{
bool result = false;
try
{
_rep.AsTenant().BeginTran();
result = _rep.InsertRange(users);
_rep.AsTenant().CommitTran();
}catch(Exception ex)
{
_rep.AsTenant().RollbackTran();
_logger.LogError($"用户信息添加异常:{ex.Message}");
}
return result;
}
}
}

@ -11,7 +11,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Durkee.Mes.Api.Repository",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Durkee.Mes.Api.Model", "Durkee.Mes.Api.Model\Durkee.Mes.Api.Model.csproj", "{28400313-5B3D-412C-94F4-3DCCF5FDAEE3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Durkee.Mes.Api.Quartz", "Durkee.Mes.Api.Quartz\Durkee.Mes.Api.Quartz.csproj", "{0AC0188D-548A-428C-8FFC-164F53A5607F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Durkee.Mes.Api.Quartz", "Durkee.Mes.Api.Quartz\Durkee.Mes.Api.Quartz.csproj", "{0AC0188D-548A-428C-8FFC-164F53A5607F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Durkee.Mes.Api.Common", "Durkee.Mes.Api.Common\Durkee.Mes.Api.Common.csproj", "{0C072D94-3DA2-4E8F-896C-47537D1DFAA0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -39,6 +41,10 @@ Global
{0AC0188D-548A-428C-8FFC-164F53A5607F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0AC0188D-548A-428C-8FFC-164F53A5607F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0AC0188D-548A-428C-8FFC-164F53A5607F}.Release|Any CPU.Build.0 = Release|Any CPU
{0C072D94-3DA2-4E8F-896C-47537D1DFAA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C072D94-3DA2-4E8F-896C-47537D1DFAA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C072D94-3DA2-4E8F-896C-47537D1DFAA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C072D94-3DA2-4E8F-896C-47537D1DFAA0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -0,0 +1,87 @@
using Durkee.Mes.Api.Model.domain;
using Durkee.Mes.Api.Repository.service;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System;
namespace Durkee.Mes.Api.Controllers
{
/// <summary>
/// 物料信息
/// </summary>
[Route("api/[controller]")]
[ApiController]
public class BaseMaterialInfoController
{
private ILogger<BaseMaterialInfoController> _logger;
private IBaseMaterialService _service;
public BaseMaterialInfoController(ILogger<BaseMaterialInfoController> logger, IBaseMaterialService service)
{
_logger = logger;
_service = service;
}
/// <summary>
/// 获取物料信息
/// </summary>
/// <returns></returns>
[HttpGet]
public IEnumerable<BaseMaterialInfo> Get()
{
IEnumerable<BaseMaterialInfo> materialInfos = null;
try
{
materialInfos = _service.GetMaterialInfos();
}
catch (Exception ex)
{
_logger.LogError($"获取物料信息接口调用异常:{ex.Message}");
}
return materialInfos;
}
/// <summary>
/// 根据物料编号获取物料信息
/// </summary>
/// <param name="materialCode">物料编号</param>
/// <returns></returns>
[HttpGet("Get/{materialCode}")]
public BaseMaterialInfo GetMaterialInfoByMaterialCode(string materialCode)
{
BaseMaterialInfo materialInfo = null;
try
{
materialInfo = _service.GetMaterialInfoByMaterialCode(materialCode);
}
catch (Exception ex)
{
_logger.LogError($"根据物料编号获取物料信息接口调用异常:{ex.Message}");
}
return materialInfo;
}
/// <summary>
/// 通过物料类别获取物料信息
/// </summary>
/// <param name="majorTypeId">物料大类</param>
/// <param name="minorTypeId">物料细类</param>
/// <returns></returns>
[HttpGet("Get/{majorTypeId}/{minorTypeId}")]
public IEnumerable<BaseMaterialInfo> GetMaterialInfosByMaterialType(int majorTypeId, string minorTypeId)
{
IEnumerable<BaseMaterialInfo> materialInfos = null;
try
{
materialInfos = _service.GetMaterialInfosByMaterialType(majorTypeId,minorTypeId);
}
catch (Exception ex)
{
_logger.LogError($"通过物料类别获取物料信息接口调用异常:{ex.Message}");
}
return materialInfos;
}
}
}

@ -71,13 +71,12 @@ namespace Durkee.Mes.Api.Controllers
/// <summary>
/// 添加用户信息
/// </summary>
/// <param name="user">用户信息</param>
/// <param name="users">用户列表</param>
/// <returns></returns>
[HttpPut]
public bool InsertUserInfo(BaseUser user)
public bool InsertUserInfo(List<BaseUser> users)
{
var info = user;
return true;
return _service.InsertUsers(users);
}
}
}

@ -21,6 +21,12 @@ namespace Durkee.Mes.Api.Controllers
_scheduler = scheduler;
}
/// <summary>
/// 启动任务
/// </summary>
/// <param name="jobName">任务名称</param>
/// <param name="groupName">任务分组</param>
/// <returns></returns>
[HttpPost("start")]
public async Task<string> StartJob(string jobName,string groupName)
{
@ -36,6 +42,12 @@ namespace Durkee.Mes.Api.Controllers
return "Job started successfully.";
}
/// <summary>
/// 停止任务
/// </summary>
/// <param name="jobName">任务名称</param>
/// <param name="groupName">任务分组</param>
/// <returns></returns>
[HttpPost("stop")]
public async Task<string> StopJob(string jobName, string groupName)
{

@ -117,7 +117,7 @@ namespace Durkee.Mes.Api
endpoints.MapControllers();
});
Log.Information($"项目初始化完成,日志存放路径:{logPath}");
Log.Information($"项目初始化完成,日志存放路径:{appConfig.logPath}");
}
}

@ -8,7 +8,7 @@
},
"AllowedHosts": "*",
"AppConfig": {
"logPath": "E:/代码生成/日志信息",
"logPath": "E:\\桌面\\杜肯密炼MES项目\\日志信息",
"mesConnStr": "server=.;uid=sa;pwd=123456;database=JiangYinMENS",
"mcsConnStr": "Data Source=175.27.215.92/helowin;User ID=aucma_scada;Password=aucma"
}

Loading…
Cancel
Save