diff --git a/Durkee.Mes.Api.Model/BaseBomInfo.cs b/Durkee.Mes.Api.Model/BaseBomInfo.cs
deleted file mode 100644
index 49b7f7c..0000000
--- a/Durkee.Mes.Api.Model/BaseBomInfo.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using SqlSugar;
-using System;
-using System.Collections.Generic;
-using System.Security.Principal;
-using System.Text;
-
-namespace Durkee.Mes.Api.Model
-{
- [SugarTable("BASE_BOMINFO"),TenantAttribute("mes")]
- public class BaseBomInfo
- {
- ///
- /// 主键标识
- ///
- [SugarColumn(ColumnName = "OBJ_ID", IsPrimaryKey = true, IsIdentity = true)]
- public int objId { get; set; }
-
- ///
- /// BOM编号
- ///
- [SugarColumn(ColumnName = "BOM_CODE")]
- public string bomCode { get; set; }
-
- ///
- /// 物料编号
- ///
- [SugarColumn(ColumnName = "MATERIAL_CODE")]
- public string materialCode { get; set; }
-
- ///
- /// 物料名称
- ///
- [SugarColumn(ColumnName = "MATERIAL_NAME")]
- public string materialName { get; set; }
-
- ///
- /// 物料类别
- ///
- [SugarColumn(ColumnName = "MATERIAL_TYPE")]
- public string materialType { get; set; }
-
- ///
- /// 标准数量
- ///
- [SugarColumn(ColumnName = "STANDARD_AMOUNT")]
- public int standardAmount { get; set; }
-
- ///
- /// 父级编号
- ///
- [SugarColumn(ColumnName = "PARENT_ID")]
- public string parentId { get; set; }
-
- ///
- /// 工厂编号
- ///
- [SugarColumn(ColumnName = "PLANT_CODE")]
- public string plantCode { get; set; }
-
- ///
- /// 产线/工位
- ///
- [SugarColumn(ColumnName = "PRODUCT_LINE_CODE")]
- public string productLineCode { get; set; }
-
- ///
- /// 是否标识
- ///
- [SugarColumn(ColumnName = "IS_FLAG")]
- public int isFlag { get; set; }
- }
-}
diff --git a/Durkee.Mes.Api.Model/domain/BaseUser.cs b/Durkee.Mes.Api.Model/domain/BaseUser.cs
new file mode 100644
index 0000000..d353f2c
--- /dev/null
+++ b/Durkee.Mes.Api.Model/domain/BaseUser.cs
@@ -0,0 +1,105 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Xml.Linq;
+using SqlSugar;
+namespace Durkee.Mes.Api.Model.domain
+{
+ ///
+ /// 系统基础资料-人员基础资料 yuany
+ ///
+ [SugarTable("BasUser"), TenantAttribute("mes")]
+ [DataContract(Name = "BaseUser 人员基础资料")]
+ public class BaseUser
+ {
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="ObjID" ,IsPrimaryKey = true ,IsIdentity = true )]
+ public int ObjID { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="UserName" )]
+ public string UserName { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="UserPWD" )]
+ public string UserPWD { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="RealName" )]
+ public string RealName { get; set; }
+ ///
+ ///
+ /// 默认值: ((1))
+ ///
+ [SugarColumn(ColumnName="Sex" )]
+ public int? Sex { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="Telephone" )]
+ public string Telephone { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="WorkBarcode" )]
+ public string WorkBarcode { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="DeptCode" )]
+ public string DeptCode { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="WorkID" )]
+ public int? WorkID { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="ShiftID" )]
+ public int? ShiftID { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="WorkShopID" )]
+ public int? WorkShopID { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="HRCode" )]
+ public string HRCode { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="ERPCode" )]
+ public string ERPCode { get; set; }
+ ///
+ ///
+ /// 默认值: ((0))
+ ///
+ [SugarColumn(ColumnName="DeleteFlag" )]
+ public string DeleteFlag { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="Remark" )]
+ public string Remark { get; set; }
+ ///
+ ///
+ /// 默认值: ((1))
+ ///
+ [SugarColumn(ColumnName="IsEmployee" )]
+ public string IsEmployee { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="RecordTime" )]
+ public DateTime? RecordTime { get; set; }
+ }
+}
diff --git a/Durkee.Mes.Api.Repository/SqlsugarSetup.cs b/Durkee.Mes.Api.Repository/SqlsugarSetup.cs
index f146636..59d9c29 100644
--- a/Durkee.Mes.Api.Repository/SqlsugarSetup.cs
+++ b/Durkee.Mes.Api.Repository/SqlsugarSetup.cs
@@ -9,6 +9,7 @@ using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
+using Durkee.Mes.Api.Model.domain;
namespace Durkee.Mes.Api.Repository
{
@@ -28,7 +29,7 @@ namespace Durkee.Mes.Api.Repository
new ConnectionConfig()
{
ConfigId = "mes",
- DbType = DbType.Oracle,
+ DbType = DbType.SqlServer,
ConnectionString = appConfig.mesConnStr,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
@@ -57,8 +58,8 @@ namespace Durkee.Mes.Api.Repository
///
public static void AddServices(this IServiceCollection services)
{
- services.AddSingleton>();
- services.AddSingleton();
+ services.AddSingleton>();
+ services.AddSingleton();
}
}
}
diff --git a/Durkee.Mes.Api.Repository/service/IBaseBomInfoService.cs b/Durkee.Mes.Api.Repository/service/IBaseBomInfoService.cs
deleted file mode 100644
index 178aed9..0000000
--- a/Durkee.Mes.Api.Repository/service/IBaseBomInfoService.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using Durkee.Mes.Api.Model;
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Durkee.Mes.Api.Repository.service
-{
- public interface IBaseBomInfoService
- {
- List GetBomInfos();
- }
-}
diff --git a/Durkee.Mes.Api.Repository/service/IBaseUserService.cs b/Durkee.Mes.Api.Repository/service/IBaseUserService.cs
new file mode 100644
index 0000000..9a7b21f
--- /dev/null
+++ b/Durkee.Mes.Api.Repository/service/IBaseUserService.cs
@@ -0,0 +1,16 @@
+using Durkee.Mes.Api.Model.domain;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Durkee.Mes.Api.Repository.service
+{
+ public interface IBaseUserService
+ {
+ ///
+ /// 获取用户信息
+ ///
+ ///
+ List GetUsers();
+ }
+}
diff --git a/Durkee.Mes.Api.Repository/service/Impl/BaseBomInfoServiceImpl.cs b/Durkee.Mes.Api.Repository/service/Impl/BaseBomInfoServiceImpl.cs
deleted file mode 100644
index dffb121..0000000
--- a/Durkee.Mes.Api.Repository/service/Impl/BaseBomInfoServiceImpl.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using Durkee.Mes.Api.Model;
-using Microsoft.Extensions.Logging;
-using Microsoft.IdentityModel.Logging;
-using SqlSugar;
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Durkee.Mes.Api.Repository.service.Impl
-{
- public class BaseBomInfoServiceImpl : IBaseBomInfoService
- {
- private readonly ILogger _logger;
-
- private readonly Repository _bomInfoRepository;
- public BaseBomInfoServiceImpl(ILogger logger,Repository bomInfoRepository)
- {
- _logger = logger;
- _bomInfoRepository = bomInfoRepository;
- }
-
- public List GetBomInfos()
- {
- try
- {
- var info = _bomInfoRepository.GetList();
- return info;
- }
- catch (Exception ex)
- {
- //logHelper.Error("获取BOM集合异常", ex);
- _logger.LogError($"获取BOM集合异常:{ex.Message}");
- return null;
- }
- }
- }
-}
diff --git a/Durkee.Mes.Api.Repository/service/Impl/BaseUserServiceImpl.cs b/Durkee.Mes.Api.Repository/service/Impl/BaseUserServiceImpl.cs
new file mode 100644
index 0000000..013f691
--- /dev/null
+++ b/Durkee.Mes.Api.Repository/service/Impl/BaseUserServiceImpl.cs
@@ -0,0 +1,35 @@
+using Durkee.Mes.Api.Model.domain;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Durkee.Mes.Api.Repository.service.Impl
+{
+ public class BaseUserServiceImpl : IBaseUserService
+ {
+ private readonly ILogger _logger;
+
+ private readonly Repository _rep;
+
+ public BaseUserServiceImpl(ILogger logger, Repository rep)
+ {
+ _logger = logger;
+ _rep = rep;
+ }
+
+
+ public List GetUsers()
+ {
+ List users = null;
+ try
+ {
+ users = _rep.GetList();
+ }catch(Exception ex)
+ {
+ _logger.LogError($"获取用户信息异常{ex.Message}");
+ }
+ return users;
+ }
+ }
+}
diff --git a/Durkee.Mes.Api/Controllers/BaseUserController.cs b/Durkee.Mes.Api/Controllers/BaseUserController.cs
new file mode 100644
index 0000000..063bbcc
--- /dev/null
+++ b/Durkee.Mes.Api/Controllers/BaseUserController.cs
@@ -0,0 +1,80 @@
+using Durkee.Mes.Api.Model.domain;
+using Durkee.Mes.Api.Repository.service;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Logging;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+
+namespace Durkee.Mes.Api.Controllers
+{
+ ///
+ /// 人员基础信息
+ ///
+ [Route("api/[controller]")]
+ [ApiController]
+ public class BaseUserController : ControllerBase
+ {
+ private readonly ILogger _logger;
+
+ private readonly IBaseUserService _service;
+
+ public BaseUserController(ILogger logger, IBaseUserService service)
+ {
+ _logger = logger;
+ _service = service;
+ }
+
+ ///
+ /// 获取人员基础信息
+ ///
+ ///
+ [HttpGet]
+ public IEnumerable Get()
+ {
+ IEnumerable users = null;
+ try
+ {
+ users = _service.GetUsers();
+ }
+ catch(Exception ex)
+ {
+ _logger.LogError($"获取用户信息接口调用异常:{ex.Message}");
+ }
+ return users;
+ }
+
+ ///
+ /// 通过用户名称获取指定用户信息
+ ///
+ /// 用户名称
+ ///
+ [HttpGet("Gets/{userName}")]
+ public IEnumerable GetUserByUserName(string userName)
+ {
+ IEnumerable users = null;
+ try
+ {
+ users = _service.GetUsers();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError($"获取用户信息接口调用异常:{ex.Message}");
+ }
+ return users;
+ }
+
+ ///
+ /// 添加用户信息
+ ///
+ /// 用户信息
+ ///
+ [HttpPut]
+ public bool InsertUserInfo(BaseUser user)
+ {
+ var info = user;
+ return true;
+ }
+ }
+}
diff --git a/Durkee.Mes.Api/Controllers/WeatherForecastController.cs b/Durkee.Mes.Api/Controllers/WeatherForecastController.cs
deleted file mode 100644
index 548a15c..0000000
--- a/Durkee.Mes.Api/Controllers/WeatherForecastController.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using Durkee.Mes.Api.Config;
-using Durkee.Mes.Api.Repository;
-using Durkee.Mes.Api.Repository.service;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Logging;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace Durkee.Mes.Api.Controllers
-{
- [ApiController]
- [Route("[controller]")]
- public class WeatherForecastController : ControllerBase
- {
-
- private static readonly string[] Summaries = new[]
- {
- "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
- };
-
- private readonly ILogger _logger;
-
- private IBaseBomInfoService _service;
-
- public WeatherForecastController(ILogger logger, AppConfig appConfig, IBaseBomInfoService service)
- {
- _logger = logger;
- _service = service;
- }
-
- [HttpGet]
- public IEnumerable Get()
- {
- try
- {
- var info = _service.GetBomInfos();
- var rng = new Random();
- return Enumerable.Range(1, 5).Select(index => new WeatherForecast
- {
- Date = DateTime.Now.AddDays(index),
- TemperatureC = rng.Next(-20, 55),
- Summary = Summaries[rng.Next(Summaries.Length)]
- })
- .ToArray();
- }catch(Exception ex)
- {
- _logger.LogError("异常", ex);
- }
- return null;
- }
- }
-}
diff --git a/Durkee.Mes.Api/Durkee.Mes.Api.csproj b/Durkee.Mes.Api/Durkee.Mes.Api.csproj
index 5bb8ee9..212a551 100644
--- a/Durkee.Mes.Api/Durkee.Mes.Api.csproj
+++ b/Durkee.Mes.Api/Durkee.Mes.Api.csproj
@@ -4,6 +4,8 @@
netcoreapp3.1
true
+ True
+ True
diff --git a/Durkee.Mes.Api/Startup.cs b/Durkee.Mes.Api/Startup.cs
index 6312ef5..79cbc81 100644
--- a/Durkee.Mes.Api/Startup.cs
+++ b/Durkee.Mes.Api/Startup.cs
@@ -1,21 +1,17 @@
using Durkee.Mes.Api.Config;
-using Durkee.Mes.Api.Model;
using Durkee.Mes.Api.Repository;
-using Durkee.Mes.Api.Repository.service;
-using Durkee.Mes.Api.Repository.service.Impl;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-using Microsoft.IdentityModel.Logging;
using Microsoft.OpenApi.Models;
using Serilog;
using Serilog.Events;
-using SqlSugar;
using System;
-using System.Collections.Generic;
using System.IO;
+using System.Linq;
+using System.Runtime.Serialization;
namespace Durkee.Mes.Api
{
@@ -36,7 +32,27 @@ namespace Durkee.Mes.Api
//Swagger
services.AddSwaggerGen(swagger =>
{
- swagger.SwaggerDoc("v1", new OpenApiInfo { Title = "ſMES Web Api", Version = "v1" });
+ //ԶӿϢ
+ swagger.SwaggerDoc("V1.0", new OpenApiInfo {
+ Title = "ſMES Web Api",
+ Version = "V1.0",
+ Description = $"API汾V1.0",
+ Contact = new OpenApiContact
+ {
+ Name = "MES Web Api",
+ Email = "wenjy@mesnac.com"
+ }
+ });
+
+ //Զʵ
+ swagger.CustomSchemaIds(type => type.GetCustomAttributes(typeof(DataContractAttribute), true)
+ .Cast()
+ .FirstOrDefault()?.Name);
+
+ //Action
+ var path = Path.Combine(AppContext.BaseDirectory, "Durkee.Mes.Api.xml");
+ swagger.IncludeXmlComments(path, true); // true : ʾע
+ swagger.OrderActionsBy(o => o.RelativePath); // actionƽжͿԿЧˡ
});
//ע
@@ -65,10 +81,8 @@ namespace Durkee.Mes.Api
app.UseSwagger();
app.UseSwaggerUI(c =>
{
- c.SwaggerEndpoint("/swagger/v1/swagger.json", "ſMES Web Api");
+ c.SwaggerEndpoint("/swagger/V1.0/swagger.json", "ſMES Web Api V1.0");
c.RoutePrefix = "";
- //c.DefaultModelRendering(ModelRendering.Example); // ĬϵģȾʽѡ
- //c.DisplayRequestDuration(); // ʾʱ䣨ѡ
});
//Serilogм
diff --git a/Durkee.Mes.Api/WeatherForecast.cs b/Durkee.Mes.Api/WeatherForecast.cs
deleted file mode 100644
index 2e13698..0000000
--- a/Durkee.Mes.Api/WeatherForecast.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-
-namespace Durkee.Mes.Api
-{
- public class WeatherForecast
- {
- public DateTime Date { get; set; }
-
- public int TemperatureC { get; set; }
-
- public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
-
- public string Summary { get; set; }
- }
-}
diff --git a/Durkee.Mes.Api/appsettings.json b/Durkee.Mes.Api/appsettings.json
index 011f0e2..8ba2674 100644
--- a/Durkee.Mes.Api/appsettings.json
+++ b/Durkee.Mes.Api/appsettings.json
@@ -9,7 +9,7 @@
"AllowedHosts": "*",
"AppConfig": {
"logPath": "E:/代码生成/日志信息",
- "mesConnStr": "Data Source=175.27.215.92/helowin;User ID=aucma_mes;Password=aucma",
+ "mesConnStr": "server=.;uid=sa;pwd=123456;database=JiangYinMENS",
"mcsConnStr": "Data Source=175.27.215.92/helowin;User ID=aucma_scada;Password=aucma"
}
}