diff --git a/ZR.Admin.WebApi/Controllers/mes/op/OperationController.cs b/ZR.Admin.WebApi/Controllers/mes/op/OperationController.cs new file mode 100644 index 00000000..66af6506 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/op/OperationController.cs @@ -0,0 +1,39 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using ZR.Admin.WebApi.Extensions; +using ZR.Model.mes.md; +using ZR.Model.MES.op.DTO; +using ZR.Model.MES.op.ZR.Model.mes.md; +using ZR.Service.mes.md; +using ZR.Service.MES.md; +using ZR.Service.MES.md.IService; +using ZR.Service.MES.op; +using ZR.Service.MES.op.IService; +using static System.Runtime.InteropServices.JavaScript.JSType; + +namespace ZR.Admin.WebApi.Controllers.MES.md +{ + [Route("mes/op/operation")] + public class OperationController : BaseController + { + IOperationService operationService; + public OperationController(IOperationService operationService) { + this.operationService= operationService; + } + /// + /// 获取所有统计信息 + /// + /// 车间id + /// + [HttpGet("getOperation")] + public IActionResult GetActionResult(string WorkerID = "1") + { + List OpStatisticsList= operationService.GetAllData(WorkerID); + + return ToResponse(new ApiResult(200, "success", OpStatisticsList)); + } + + } +} diff --git a/ZR.Common/Tools.cs b/ZR.Common/Tools.cs index d95c47f1..70c9d855 100644 --- a/ZR.Common/Tools.cs +++ b/ZR.Common/Tools.cs @@ -7,6 +7,8 @@ namespace ZR.Common { public class Tools { + + /// /// 要分割的字符串 eg: 1,3,10,00 /// diff --git a/ZR.Model/mes/op/DTO/OpStatisticsDTO.cs b/ZR.Model/mes/op/DTO/OpStatisticsDTO.cs new file mode 100644 index 00000000..2c8edcaa --- /dev/null +++ b/ZR.Model/mes/op/DTO/OpStatisticsDTO.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ZR.Model.MES.op.DTO +{ + public class OpStatisticsDTO + { + + /// + /// 工作车间 + /// + public string WorkshopId { get; set; } + /// + /// 工作车间 + /// + + public string WorkshopName { get; set; } + /// + /// 生产日期 + /// + [SugarColumn(ColumnName = "productDate")] + public DateTime? ProductDate { get; set; } + /// + /// 计划数量 + /// + + public int? PlanNum { get; set; } + /// + /// 已经生产数量 + /// + + public int? ProductedNum { get; set; } + + /// + /// 生产进度 :ProductedNum/PlanNum*100 + /// + public string ProductProgressRate { get; set; } + /// + /// 良品数量 + /// + public int? GoodproductsNum { get; set; } + /// + /// 不良品数量 + /// + public int? DefectiveProductsNum { get; set; } + /// + /// 品质率: 良品数量/不良品数量*100 + /// + public string QualityRate { get; set; } + + /// + /// 生产开始时间 + /// + + public DateTime? ProductStarttime { get; set; } + /// + /// 生产结束时间 + /// + + public DateTime? ProductEndtime { get; set; } + + /// + /// 是否正在生产 + /// + public bool isProducting { get; set; } + /// + /// 线体id + /// + + public string LineId { get; set; } + + /// + /// 排序序号 + /// + public int numSort { get; set; } + /// + /// 线体名称 + /// + + public string LineName { get; set; } + /// + /// + /// + + public string CreatedBy { get; set; } + /// + /// + /// + + public string CreatedTime { get; set; } + /// + /// + /// + + public string UpdatedBy { get; set; } + /// + /// + /// + + public string UpdatedTime { get; set; } + /// + /// + /// + public int Id { get; set; } + } +} diff --git a/ZR.Model/mes/op/OpStatistics.cs b/ZR.Model/mes/op/OpStatistics.cs new file mode 100644 index 00000000..17f2200f --- /dev/null +++ b/ZR.Model/mes/op/OpStatistics.cs @@ -0,0 +1,100 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; + +namespace ZR.Model.MES.op +{ + namespace ZR.Model.mes.md + { + /// + /// 操作统计表 + /// + [SugarTable("op_statistics")] + public class OpStatistics + { + /// + /// 工作车间 + /// + [SugarColumn(ColumnName = "workshop_id")] + public string WorkshopId { get; set; } + /// + /// 工作车间 + /// + [SugarColumn(ColumnName = "workshop_name")] + public string WorkshopName { get; set; } + /// + /// 生产日期 + /// + [SugarColumn(ColumnName = "productDate")] + public DateTime? ProductDate { get; set; } + /// + /// 计划数量 + /// + [SugarColumn(ColumnName = "planNum")] + public int? PlanNum { get; set; } + /// + /// 已经生产数量 + /// + [SugarColumn(ColumnName = "productedNum")] + public int? ProductedNum { get; set; } + /// + /// 良品数量 + /// + [SugarColumn(ColumnName = "goodproductsNum")] + public int? GoodproductsNum { get; set; } + /// + /// 不良品数量 + /// + [SugarColumn(ColumnName = "defectiveProductsNum")] + public int? DefectiveProductsNum { get; set; } + /// + /// 生产开始时间 + /// + [SugarColumn(ColumnName = "product_starttime")] + public DateTime? ProductStarttime { get; set; } + /// + /// 生产结束时间 + /// + [SugarColumn(ColumnName = "product_endtime")] + public DateTime? ProductEndtime { get; set; } + /// + /// 线体id + /// + [SugarColumn(ColumnName = "line_id")] + public string LineId { get; set; } + /// + /// 线体名称 + /// + [SugarColumn(ColumnName = "line_name")] + public string LineName { get; set; } + /// + /// + /// + [SugarColumn(ColumnName = "CREATED_BY")] + public string CreatedBy { get; set; } + /// + /// + /// + [SugarColumn(ColumnName = "CREATED_TIME")] + public string CreatedTime { get; set; } + /// + /// + /// + [SugarColumn(ColumnName = "UPDATED_BY")] + public string UpdatedBy { get; set; } + /// + /// + /// + [SugarColumn(ColumnName = "UPDATED_TIME")] + public string UpdatedTime { get; set; } + /// + /// + /// + [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + } + } + +} diff --git a/ZR.Repository/BaseRepository.cs b/ZR.Repository/BaseRepository.cs index ad822567..9b0f559a 100644 --- a/ZR.Repository/BaseRepository.cs +++ b/ZR.Repository/BaseRepository.cs @@ -202,6 +202,10 @@ namespace ZR.Repository { return Context.Queryable(); } + public ISugarQueryable Queryable(Expression> expression) + { + return Context.Queryable().Where(expression); + } public List SqlQueryToList(string sql, object obj = null) { diff --git a/ZR.Service/mes/op/IService/IOperationService.cs b/ZR.Service/mes/op/IService/IOperationService.cs new file mode 100644 index 00000000..4a1a8524 --- /dev/null +++ b/ZR.Service/mes/op/IService/IOperationService.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZR.Model.MES.op.DTO; +using ZR.Model.MES.op.ZR.Model.mes.md; + +namespace ZR.Service.MES.op.IService +{ + public interface IOperationService + { + + public List GetAllData(string workshopID); + } +} diff --git a/ZR.Service/mes/op/OperationService.cs b/ZR.Service/mes/op/OperationService.cs new file mode 100644 index 00000000..aae6ca6e --- /dev/null +++ b/ZR.Service/mes/op/OperationService.cs @@ -0,0 +1,70 @@ +using Infrastructure.Attribute; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZR.Model.mes.md; +using ZR.Model.MES.op.ZR.Model.mes.md; +using ZR.Service.MES.md.IService; +using ZR.Service; +using ZR.Service.MES.op.IService; +using ZR.Model.MES.op.DTO; +using Microsoft.AspNetCore.Http.HttpResults; +using Org.BouncyCastle.Asn1.Esf; + +namespace ZR.Service.MES.op +{ + [AppService(ServiceType = typeof(IOperationService), ServiceLifetime = LifeTime.Transient)] + public class OperationService : BaseService, IOperationService + { + public List GetAllData(string workshopID) + { + decimal myDecimal = 123.456789m; + string formattedDecimal = myDecimal.ToString("0.00"); // 保留两位小数 + + List OpStatisticsDTOList= new List(); + List OpStatisticsList =Queryable().Where(it => it.WorkshopId == workshopID ).ToList(); + foreach (var OpStatistics in OpStatisticsList) + { + OpStatisticsDTO opStatisticsDTO=new OpStatisticsDTO(); + opStatisticsDTO.WorkshopId = OpStatistics.WorkshopId; + opStatisticsDTO.WorkshopName = OpStatistics.WorkshopName; + opStatisticsDTO.ProductDate = OpStatistics.ProductDate; + opStatisticsDTO.PlanNum = OpStatistics.PlanNum; + opStatisticsDTO.ProductedNum = OpStatistics.ProductedNum; + decimal num1 = (decimal) OpStatistics.ProductedNum / (decimal)OpStatistics.PlanNum*100; + opStatisticsDTO.ProductProgressRate = num1.ToString("0.00") ; + opStatisticsDTO.GoodproductsNum = OpStatistics.GoodproductsNum; + opStatisticsDTO.DefectiveProductsNum = OpStatistics.DefectiveProductsNum; + decimal num2 = (decimal)OpStatistics.DefectiveProductsNum / (decimal)(OpStatistics.GoodproductsNum + OpStatistics.DefectiveProductsNum); + opStatisticsDTO.QualityRate = num2.ToString("f2"); + opStatisticsDTO.ProductStarttime = OpStatistics.ProductStarttime; + opStatisticsDTO.ProductEndtime = OpStatistics.ProductEndtime; + if(DateTime.Now> opStatisticsDTO.ProductStarttime&& DateTime.Now < opStatisticsDTO.ProductEndtime) + { + opStatisticsDTO.isProducting = true; + + } + else + { + opStatisticsDTO.isProducting = false; + } + + opStatisticsDTO.numSort = OpStatisticsList.IndexOf(OpStatistics); + + opStatisticsDTO.LineId = OpStatistics.LineId; + opStatisticsDTO.LineName = OpStatistics.LineName; + opStatisticsDTO.ProductEndtime = OpStatistics.ProductEndtime; + + OpStatisticsDTOList.Add(opStatisticsDTO); + } + + + + return OpStatisticsDTOList; + } + } +} + diff --git a/ZR.Vue/src/api/operationManagement/operation.js b/ZR.Vue/src/api/operationManagement/operation.js new file mode 100644 index 00000000..d6f2e354 --- /dev/null +++ b/ZR.Vue/src/api/operationManagement/operation.js @@ -0,0 +1,13 @@ +import request from '@/utils/request' + +/** +* 演示分页查询 +* @param {查询条件} data +*/ +export function getOperation(query) { + return request({ + url: 'mes/op/operation/getOperation', + method: 'get', + params: query, + }) +} diff --git a/ZR.Vue/src/settings.js b/ZR.Vue/src/settings.js index 8301d83f..85ea9f52 100644 --- a/ZR.Vue/src/settings.js +++ b/ZR.Vue/src/settings.js @@ -48,5 +48,5 @@ module.exports = { * If you want to also use it in dev, you can pass ['production', 'development'] */ errorLog: 'production', - copyRight: 'Copyright ©2023 www.izhaorui.cn All Rights Reserved.' + copyRight: 'Copyright ©2023 www.doan.com All Rights Reserved.' } \ No newline at end of file diff --git a/ZR.Vue/src/views/OperationManagement/assemblyWorkshop.vue b/ZR.Vue/src/views/OperationManagement/assemblyWorkshop.vue new file mode 100644 index 00000000..ecbd813d --- /dev/null +++ b/ZR.Vue/src/views/OperationManagement/assemblyWorkshop.vue @@ -0,0 +1,239 @@ + + + + 装配车间生产状态统计 + + + + + + + + + + + {{ row.productedNum }}/{{ row.planNum }} + + + + + + + + + + + + + + + + + + {{ row.qualityRate }}% {{ row.goodproductsNum }}/{{ row.defectiveProductsNum }} + + + + + + + + + + diff --git a/ZR.Vue/src/views/OperationManagement/injectionWorkshop.vue b/ZR.Vue/src/views/OperationManagement/injectionWorkshop.vue new file mode 100644 index 00000000..85fadc3a --- /dev/null +++ b/ZR.Vue/src/views/OperationManagement/injectionWorkshop.vue @@ -0,0 +1,15 @@ + + + + + + + + + \ No newline at end of file diff --git a/ZR.Vue/src/views/OperationManagement/paintingWorkshop.vue b/ZR.Vue/src/views/OperationManagement/paintingWorkshop.vue new file mode 100644 index 00000000..cebb6c55 --- /dev/null +++ b/ZR.Vue/src/views/OperationManagement/paintingWorkshop.vue @@ -0,0 +1,299 @@ + + + + + + + + 名称 + 序号 + + + + 支持 + test abc + + + 弹框{{ row.name }} + + + + + + + + 我是超链接:{{ row.name }} + + + + + 自定义头部 + + + 累计:{{ items[_columnIndex] }} + + + + + + + + 自定义按钮 + + + + + + + + + + + + + + + {{ formatDate(row.time) }} + + + + + + + + + + + + + + + + + + 自定义模板 + + + + + + + 无 + + + + + + + + + diff --git a/ZR.Vue/src/views/index_v1.vue b/ZR.Vue/src/views/index_v1.vue index 9f219db3..00550d6e 100644 --- a/ZR.Vue/src/views/index_v1.vue +++ b/ZR.Vue/src/views/index_v1.vue @@ -72,7 +72,7 @@ - 数量统计 + 生产进度 {{ item.name }}
数量统计
生产进度
{{ item.name }}