diff --git a/WcsMain/ApiServe/ControllerFilter/WcsAuthorizationAttribute.cs b/WcsMain/ApiServe/ControllerFilter/WcsAuthorizationAttribute.cs index b2e8607..a048b54 100644 --- a/WcsMain/ApiServe/ControllerFilter/WcsAuthorizationAttribute.cs +++ b/WcsMain/ApiServe/ControllerFilter/WcsAuthorizationAttribute.cs @@ -23,6 +23,7 @@ public class WcsAuthorizationAttribute : Attribute, IAuthorizationFilter } catch(Exception ex) { + _ = ex; context.Result = new Microsoft.AspNetCore.Mvc.UnauthorizedResult(); return; } diff --git a/WcsMain/ApiServe/Controllers/WcsController/StackerConveyController.cs b/WcsMain/ApiServe/Controllers/WcsController/StackerConveyController.cs new file mode 100644 index 0000000..aec3402 --- /dev/null +++ b/WcsMain/ApiServe/Controllers/WcsController/StackerConveyController.cs @@ -0,0 +1,30 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using WcsMain.ApiServe.ControllerFilter.ExceptionFilter; +using WcsMain.ApiServe.ControllerFilter; +using WcsMain.ApiServe.Service.WcsService; +using WcsMain.ApiServe.Controllers.Dto; +using WcsMain.DataBase.TableEntity; + +namespace WcsMain.ApiServe.Controllers.WcsController; + +/// +/// 库前输送线控制器 +/// +[Route("api/wcs/stackerConvey")] +[ApiController] +[WcsExceptionFilter] +[WcsAuthorization] +public class StackerConveyController(StackerConveyService stackerConveyService) : ControllerBase +{ + /// + /// 查询所有库前输送线信息 + /// + /// + [HttpGet("queryStackerConveyInfo")] + public WcsApiResponse>? QueryStackerConveyInfo() => stackerConveyService.QueryStackerConveyInfo(); + + + + +} diff --git a/WcsMain/ApiServe/Service/WcsService/StackerConveyService.cs b/WcsMain/ApiServe/Service/WcsService/StackerConveyService.cs new file mode 100644 index 0000000..df9e898 --- /dev/null +++ b/WcsMain/ApiServe/Service/WcsService/StackerConveyService.cs @@ -0,0 +1,25 @@ +using WcsMain.ApiServe.Controllers.Dto; +using WcsMain.ApiServe.Factory; +using WcsMain.DataBase.Dao; +using WcsMain.DataBase.TableEntity; +using WcsMain.WcsAttribute.AutoFacAttribute; + +namespace WcsMain.ApiServe.Service.WcsService; + +/// +/// 库前输送线的 Service +/// +[Service] +public class StackerConveyService(AppStackerConveyDao stackerConveyDao) +{ + + /// + /// 查询所有的库前输送线信息 + /// + /// + public WcsApiResponse>? QueryStackerConveyInfo() + { + List? stackerConveys = stackerConveyDao.Query(); + return stackerConveys == default ? WcsApiResponseFactory.DataBaseErr>() : WcsApiResponseFactory.Success(stackerConveys); + } +} diff --git a/WcsMain/DataBase/Dao/AppStackerConveyDao.cs b/WcsMain/DataBase/Dao/AppStackerConveyDao.cs new file mode 100644 index 0000000..47be481 --- /dev/null +++ b/WcsMain/DataBase/Dao/AppStackerConveyDao.cs @@ -0,0 +1,49 @@ +using WcsMain.Common; +using WcsMain.DataBase.TableEntity; +using WcsMain.WcsAttribute.AutoFacAttribute; + +namespace WcsMain.DataBase.Dao; + +[Component] +public class AppStackerConveyDao +{ + + /// + /// 条件查询 + /// + /// + /// + public List? Query(AppStackerConvey queryEntity) + { + try + { + var sqlFuc = CommonTool.DbServe.Queryable() + .WhereIF(queryEntity.WcsLocation != default, it => it.WcsLocation == queryEntity.WcsLocation) + .WhereIF(queryEntity.WmsLocation != default, it => it.WmsLocation == queryEntity.WmsLocation) + .WhereIF(queryEntity.LocationName != default, it => it.LocationName == queryEntity.LocationName) + .WhereIF(queryEntity.PlcLocation != default, it => it.PlcLocation == queryEntity.PlcLocation) + .WhereIF(queryEntity.Area != default, it => it.Area == queryEntity.Area) + .WhereIF(queryEntity.LocationType != default, it => it.LocationType == queryEntity.LocationType) + .WhereIF(queryEntity.LocationStatus != default, it => it.LocationStatus == queryEntity.LocationStatus) + .WhereIF(queryEntity.WriteType != default, it => it.WriteType == queryEntity.WriteType) + .WhereIF(queryEntity.Remark != default, it => it.Remark == queryEntity.Remark); + return sqlFuc.ToList(); + } + catch(Exception ex) + { + _ = ex; + return default; + } + } + + /// + /// 查询所有 + /// + /// + public List? Query() => Query(new AppStackerConvey()); + + + + + +} diff --git a/WcsMain/DataBase/TableEntity/AppStackerConvey.cs b/WcsMain/DataBase/TableEntity/AppStackerConvey.cs new file mode 100644 index 0000000..55202f7 --- /dev/null +++ b/WcsMain/DataBase/TableEntity/AppStackerConvey.cs @@ -0,0 +1,80 @@ +using SqlSugar; +using System.Text.Json.Serialization; + +namespace WcsMain.DataBase.TableEntity; + +/// +/// 库前输送机表 +/// +[SugarTable("tbl_app_stacker_convey")] +public class AppStackerConvey +{ + /// + /// WCS 点位 + /// + [SugarColumn(IsPrimaryKey = true, ColumnName = "wcs_location")] + [JsonPropertyName("wcsLocation")] + public string? WcsLocation { get; set; } + + /// + /// WMS 点位 + /// + [SugarColumn(ColumnName = "wms_location")] + [JsonPropertyName("wmsLocation")] + public string? WmsLocation { get; set; } + + /// + /// 点位名称 + /// + [SugarColumn(ColumnName = "location_name")] + [JsonPropertyName("locationName")] + public string? LocationName { get; set; } + + /// + /// plc 的位置 + /// + [SugarColumn(ColumnName = "plc_location")] + [JsonPropertyName("plcLocation")] + public string? PlcLocation { get; set; } + + /// + /// 区域 + /// + [SugarColumn(ColumnName = "area")] + [JsonPropertyName("area")] + public string? Area { get; set; } + + /// + /// 点位类型 + /// + [SugarColumn(ColumnName = "location_type")] + [JsonPropertyName("locationType")] + public int? LocationType { get; set; } + + /// + /// 点位状态 + /// + [SugarColumn(ColumnName = "location_status")] + [JsonPropertyName("locationStatus")] + public int? LocationStatus { get; set; } + + /// + /// 写入方式 + /// + [SugarColumn(ColumnName = "write_type")] + [JsonPropertyName("writeType")] + public int? WriteType { get; set; } + + /// + /// 备注信息 + /// + [SugarColumn(ColumnName = "remark")] + [JsonPropertyName("remark")] + public string? Remark { get; set; } + + + + + + +}