From 3429a1e39e1a2dcb041a9394e3515ab09b0484f4 Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Fri, 1 Dec 2023 15:39:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E5=A4=87signalr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Infrastructure/Constant/HubsConstant.cs | 1 + .../mes/qc/FQC/FirstFQCController.cs | 57 +++++++++++++++++ .../mes/qc/QcinspectionItemController.cs | 7 +-- ZR.Admin.WebApi/Hubs/MessageHub.cs | 5 +- ZR.Admin.WebApi/Program.cs | 1 + .../Properties/launchSettings.json | 2 +- ZR.Admin.WebApi/appsettings.json | 2 +- ZR.Model/MES/qc/DTO/CheckItemTableDTO.cs | 19 ++++++ ZR.Model/MES/qc/QcAgaininspectionPolish.cs | 61 +++++++++++++++++++ .../MES/qc/QcAgaininspectionUselessnum.cs | 61 +++++++++++++++++++ ZR.Model/MES/qc/QcFirstinspectionDefault.cs | 59 ++++++++++++++++++ .../MES/qc/QcFirstinspectionUselessnum.cs | 60 ++++++++++++++++++ ZR.Service/mes/pro/ProWorkorderService.cs | 4 +- ZR.Service/mes/qc/FirstFQCService.cs | 33 ++++++++++ .../mes/qc/IService/IFirstFQCService.cs | 14 +++++ 15 files changed, 373 insertions(+), 13 deletions(-) create mode 100644 ZR.Admin.WebApi/Controllers/mes/qc/FQC/FirstFQCController.cs create mode 100644 ZR.Model/MES/qc/DTO/CheckItemTableDTO.cs create mode 100644 ZR.Model/MES/qc/QcAgaininspectionPolish.cs create mode 100644 ZR.Model/MES/qc/QcAgaininspectionUselessnum.cs create mode 100644 ZR.Model/MES/qc/QcFirstinspectionDefault.cs create mode 100644 ZR.Model/MES/qc/QcFirstinspectionUselessnum.cs create mode 100644 ZR.Service/mes/qc/FirstFQCService.cs create mode 100644 ZR.Service/mes/qc/IService/IFirstFQCService.cs diff --git a/Infrastructure/Constant/HubsConstant.cs b/Infrastructure/Constant/HubsConstant.cs index d81b7f81..7bb8430e 100644 --- a/Infrastructure/Constant/HubsConstant.cs +++ b/Infrastructure/Constant/HubsConstant.cs @@ -13,5 +13,6 @@ namespace Infrastructure.Constant public static string OnlineNum = "onlineNum"; public static string MoreNotice = "moreNotice"; public static string OnlineUser = "onlineUser"; + } } diff --git a/ZR.Admin.WebApi/Controllers/mes/qc/FQC/FirstFQCController.cs b/ZR.Admin.WebApi/Controllers/mes/qc/FQC/FirstFQCController.cs new file mode 100644 index 00000000..219c397b --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/qc/FQC/FirstFQCController.cs @@ -0,0 +1,57 @@ +using Infrastructure.Constant; +using Infrastructure.Extensions; +using JinianNet.JNTemplate; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.SignalR; +using Microsoft.IdentityModel.Tokens; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System.Text.Json; +using ZR.Admin.WebApi.Extensions; +using ZR.Admin.WebApi.Hubs; +using ZR.Model.MES.qc.DTO; +using ZR.Model.MES.qu; +using ZR.Service.mes.qc.IService; +using ZR.Service.System; +using static System.Runtime.InteropServices.JavaScript.JSType; + +namespace ZR.Admin.WebApi.Controllers.mes.qc.IQC +{ + + + [Route("mes/qc/FQC")] + public class FirstFQCController : BaseController + { + private readonly IFirstFQCService fQCService; + private readonly IHubContext hubContext; + + public FirstFQCController(IFirstFQCService fQCService, IHubContext hubContext) { + this.fQCService = fQCService; + this.hubContext = hubContext; + } + + + + /// + /// 获取 检测项 填充 + /// + /// + [HttpGet("getcheckItemTable")] + public IActionResult GetcheckItemTable() + { + + CheckItemTableDTO itemTableDTO= fQCService.GetCheckItemTable(); + hubContext.Clients.All.SendAsync(HubsConstant.mymy, "123456"); + return SUCCESS(itemTableDTO); + } + + + + + } + + + + + +} diff --git a/ZR.Admin.WebApi/Controllers/mes/qc/QcinspectionItemController.cs b/ZR.Admin.WebApi/Controllers/mes/qc/QcinspectionItemController.cs index 79717aa3..33f11c79 100644 --- a/ZR.Admin.WebApi/Controllers/mes/qc/QcinspectionItemController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/qc/QcinspectionItemController.cs @@ -31,14 +31,9 @@ namespace ZR.Admin.WebApi.Controllers.mes.qc /// [HttpGet("getinspectionItemList")] public IActionResult GetinspectionItemList(string inspectionModule="",string inspectionType="") - { - + { List data = qcinspection.GetinspectionItemList(inspectionModule, inspectionType); - - - return ToResponse(new ApiResult(200, "success", data)); - } } diff --git a/ZR.Admin.WebApi/Hubs/MessageHub.cs b/ZR.Admin.WebApi/Hubs/MessageHub.cs index eb746670..e74c87a7 100644 --- a/ZR.Admin.WebApi/Hubs/MessageHub.cs +++ b/ZR.Admin.WebApi/Hubs/MessageHub.cs @@ -61,7 +61,7 @@ namespace ZR.Admin.WebApi.Hubs }; clientUsers.Add(users); Console.WriteLine($"{DateTime.Now}:{name},{Context.ConnectionId}连接服务端success,当前已连接{clientUsers.Count}个"); - //Clients.All.SendAsync("welcome", $"欢迎您:{name},当前时间:{DateTime.Now}"); + Clients.All.SendAsync("welcome", $"欢迎您:{name},当前时间:{DateTime.Now}"); Clients.All.SendAsync(HubsConstant.MoreNotice, SendNotice()); } @@ -90,7 +90,7 @@ namespace ZR.Admin.WebApi.Hubs #endregion /// - /// 注册信息 + /// 注册信息 todo vue向服务器端发送请求 注意参数一致和集线器转发的客户端 /// /// /// @@ -100,7 +100,6 @@ namespace ZR.Admin.WebApi.Hubs public async Task SendMessage(string connectId, string userName, string message) { Console.WriteLine($"{connectId},message={message}"); - await Clients.Client(connectId).SendAsync("receiveChat", new { userName, message }); } } diff --git a/ZR.Admin.WebApi/Program.cs b/ZR.Admin.WebApi/Program.cs index 9f45f91f..7b077e5b 100644 --- a/ZR.Admin.WebApi/Program.cs +++ b/ZR.Admin.WebApi/Program.cs @@ -137,6 +137,7 @@ app.UseRateLimiter(); //设置socket连接 app.MapHub("/msgHub"); + app.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); diff --git a/ZR.Admin.WebApi/Properties/launchSettings.json b/ZR.Admin.WebApi/Properties/launchSettings.json index 8ba95da5..7c3c7058 100644 --- a/ZR.Admin.WebApi/Properties/launchSettings.json +++ b/ZR.Admin.WebApi/Properties/launchSettings.json @@ -13,7 +13,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchUrl": "", - "applicationUrl": "http://localhost:8888", + "applicationUrl": "http://localhost:8889", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/ZR.Admin.WebApi/appsettings.json b/ZR.Admin.WebApi/appsettings.json index 937cd4c6..c5ba77f2 100644 --- a/ZR.Admin.WebApi/appsettings.json +++ b/ZR.Admin.WebApi/appsettings.json @@ -6,7 +6,7 @@ "Microsoft.Hosting.Lifetime": "Information" } }, - "urls": "http://localhost:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改 + "urls": "http://localhost:8888", //(app会默认去读)项目启动url,如果改动端口前端对应devServer也需要进行修改 "dbConfigs": [ { "Conn": "Data Source=192.168.0.36;User ID=root;Password=123456;Initial Catalog=ZrAdmin;", diff --git a/ZR.Model/MES/qc/DTO/CheckItemTableDTO.cs b/ZR.Model/MES/qc/DTO/CheckItemTableDTO.cs new file mode 100644 index 00000000..8eaa7d6f --- /dev/null +++ b/ZR.Model/MES/qc/DTO/CheckItemTableDTO.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZR.Model.MES.qu; + +namespace ZR.Model.MES.qc.DTO +{ + public class CheckItemTableDTO + { + + public List Paint { set; get; } + public List device { set; get; } + public List Blank { set; get; } + public List program { set; get; } + public List Team { set; get; } + } +} diff --git a/ZR.Model/MES/qc/QcAgaininspectionPolish.cs b/ZR.Model/MES/qc/QcAgaininspectionPolish.cs new file mode 100644 index 00000000..12ab0b56 --- /dev/null +++ b/ZR.Model/MES/qc/QcAgaininspectionPolish.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ZR.Model.MES.qc +{ + /// + /// 二检打磨表 + /// + [SugarTable("qc_againinspection_polish")] + public class QcAgaininspectionPolish + { + /// + /// 流水号 + /// + [SugarColumn(ColumnName = "id", IsPrimaryKey = true)] + public string Id { get; set; } + /// + /// fk_终检id + /// + [SugarColumn(ColumnName = "fk_FQC_id")] + public string FkFqcId { get; set; } + /// + /// fk_检测项 + /// + [SugarColumn(ColumnName = "fk_inspectionItem_id")] + public string FkInspectionitemId { get; set; } + /// + /// 产品名称 + /// + [SugarColumn(ColumnName = "productName")] + public string ProductName { get; set; } + /// + /// 数量 + /// + [SugarColumn(ColumnName = "number")] + public string Number { get; set; } + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "CREATED_BY")] + public string CreatedBy { get; set; } + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "CREATED_TIME")] + public DateTime? CreatedTime { get; set; } + /// + /// 更新人 + /// + [SugarColumn(ColumnName = "UPDATED_BY")] + public string UpdatedBy { get; set; } + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "UPDATED_TIME")] + public DateTime? UpdatedTime { get; set; } + } +} diff --git a/ZR.Model/MES/qc/QcAgaininspectionUselessnum.cs b/ZR.Model/MES/qc/QcAgaininspectionUselessnum.cs new file mode 100644 index 00000000..9961253d --- /dev/null +++ b/ZR.Model/MES/qc/QcAgaininspectionUselessnum.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ZR.Model.MES.qc +{ + /// + /// 二检报废表 + /// + [SugarTable("qc_againinspection_uselessnum")] + public class QcAgaininspectionUselessnum + { + /// + /// 流水号 + /// + [SugarColumn(ColumnName = "id", IsPrimaryKey = true)] + public string Id { get; set; } + /// + /// fk_检测项 + /// + [SugarColumn(ColumnName = "fk_inspectionItem_id")] + public string FkInspectionitemId { get; set; } + /// + /// fk_终检id + /// + [SugarColumn(ColumnName = "fk_FQC_id")] + public string FkFqcId { get; set; } + /// + /// 产品名称 + /// + [SugarColumn(ColumnName = "productName")] + public string ProductName { get; set; } + /// + /// 数量 + /// + [SugarColumn(ColumnName = "number")] + public int? Number { get; set; } + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "CREATED_BY")] + public string CreatedBy { get; set; } + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "CREATED_TIME")] + public DateTime? CreatedTime { get; set; } + /// + /// 更新人 + /// + [SugarColumn(ColumnName = "UPDATED_BY")] + public string UpdatedBy { get; set; } + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "UPDATED_TIME")] + public DateTime? UpdatedTime { get; set; } + } +} diff --git a/ZR.Model/MES/qc/QcFirstinspectionDefault.cs b/ZR.Model/MES/qc/QcFirstinspectionDefault.cs new file mode 100644 index 00000000..68982920 --- /dev/null +++ b/ZR.Model/MES/qc/QcFirstinspectionDefault.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace ZR.Model.MES.qc +{ + /// + /// 初检瑕疵 + /// + [SugarTable("qc_firstinspection_default")] + public class QcFirstinspectionDefault + { + /// + /// 流水号 + /// + [SugarColumn(ColumnName = "id")] + public string Id { get; set; } + /// + /// 产品名称 + /// + [SugarColumn(ColumnName = "productName")] + public string ProductName { get; set; } + /// + /// fk_检测项 + /// + [SugarColumn(ColumnName = "fk_inspectionItem_id")] + public string FkInspectionitemId { get; set; } + /// + /// fk_FQC_id + /// + [SugarColumn(ColumnName = "fk_FQC_id")] + public string FkFqcId { get; set; } + /// + /// 数量 + /// + [SugarColumn(ColumnName = "number")] + public string Number { get; set; } + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "CREATED_BY")] + public string CreatedBy { get; set; } + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "CREATED_TIME")] + public DateTime? CreatedTime { get; set; } + /// + /// 更新人 + /// + [SugarColumn(ColumnName = "UPDATED_BY")] + public string UpdatedBy { get; set; } + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "UPDATED_TIME")] + public DateTime? UpdatedTime { get; set; } + } +} diff --git a/ZR.Model/MES/qc/QcFirstinspectionUselessnum.cs b/ZR.Model/MES/qc/QcFirstinspectionUselessnum.cs new file mode 100644 index 00000000..04596305 --- /dev/null +++ b/ZR.Model/MES/qc/QcFirstinspectionUselessnum.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; + +namespace ZR.Model.MES.qc +{ + /// + /// 初检报废表 + /// + [SugarTable("qc_firstinspection_uselessnum")] + public class QcFirstinspectionUselessnum + { + /// + /// 流水号 + /// + [SugarColumn(ColumnName = "id", IsPrimaryKey = true)] + public string Id { get; set; } + /// + /// fk_报废检测id + /// + [SugarColumn(ColumnName = "fk_inspectionItem_id")] + public string FkInspectionitemId { get; set; } + /// + /// fk_FQC_id + /// + [SugarColumn(ColumnName = "fk_FQC_id")] + public string FkFqcId { get; set; } + /// + /// 报废数量 + /// + [SugarColumn(ColumnName = "number")] + public int? Number { get; set; } + /// + /// 产品名称 + /// + [SugarColumn(ColumnName = "productname")] + public string Productname { get; set; } + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "CREATED_BY")] + public string CreatedBy { get; set; } + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "CREATED_TIME")] + public DateTime? CreatedTime { get; set; } + /// + /// 更新人 + /// + [SugarColumn(ColumnName = "UPDATED_BY")] + public string UpdatedBy { get; set; } + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "UPDATED_TIME")] + public DateTime? UpdatedTime { get; set; } + } +} diff --git a/ZR.Service/mes/pro/ProWorkorderService.cs b/ZR.Service/mes/pro/ProWorkorderService.cs index 24358395..ee7c2ba1 100644 --- a/ZR.Service/mes/pro/ProWorkorderService.cs +++ b/ZR.Service/mes/pro/ProWorkorderService.cs @@ -84,7 +84,7 @@ namespace ZR.Service.mes.pro .Where(it => it.Id.Equals(id)) .ExecuteCommand(); } - + public int ReleaseProduction(string id, HttpContext context) { int result = Context.Updateable() @@ -180,7 +180,7 @@ namespace ZR.Service.mes.pro .AndIF(year > 0, it => it.Year == year) .AndIF(week > 0, it => it.Week == week) .AndIF(date > 0, it => it.Date == date) - .And(it=>it.Wrokerorder_status==1) + .And(it=>it.Wrokerorder_status==2) // 已经排产 .ToExpression(); diff --git a/ZR.Service/mes/qc/FirstFQCService.cs b/ZR.Service/mes/qc/FirstFQCService.cs new file mode 100644 index 00000000..6b4963c6 --- /dev/null +++ b/ZR.Service/mes/qc/FirstFQCService.cs @@ -0,0 +1,33 @@ +using Infrastructure.Attribute; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZR.Model.MES.qc.DTO; +using ZR.Model.MES.qu; +using ZR.Service.mes.qc.IService; +using ZR.Service.mes.qu.IService; + +namespace ZR.Service.mes.qc +{ + + [AppService(ServiceType = typeof(IFirstFQCService), ServiceLifetime = LifeTime.Transient)] + public class FirstFQCService : BaseService, IFirstFQCService + { + public CheckItemTableDTO GetCheckItemTable() + { + CheckItemTableDTO checkItem=new CheckItemTableDTO(); + checkItem.Paint = Queryable().Where(it => it.InspectionModule == "油漆").OrderBy(it=>it.Id).ToList(); + checkItem.device = Queryable().Where(it => it.InspectionModule == "设备").OrderBy(it => it.Id).ToList(); + checkItem.Blank = Queryable().Where(it => it.InspectionModule == "毛坯").OrderBy(it => it.Id).ToList(); + checkItem.program = Queryable().Where(it => it.InspectionModule == "程序").OrderBy(it => it.Id).ToList(); + checkItem.Team = Queryable().Where(it => it.InspectionModule == "班组操作").OrderBy(it => it.Id).ToList(); + + return checkItem; + + } + } +} diff --git a/ZR.Service/mes/qc/IService/IFirstFQCService.cs b/ZR.Service/mes/qc/IService/IFirstFQCService.cs new file mode 100644 index 00000000..5c7aecb0 --- /dev/null +++ b/ZR.Service/mes/qc/IService/IFirstFQCService.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZR.Model.MES.qc.DTO; + +namespace ZR.Service.mes.qc.IService +{ + public interface IFirstFQCService + { + public CheckItemTableDTO GetCheckItemTable(); + } +}