From 80c122558fe680cddb195199a4f35b122f89fc02 Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Fri, 27 Dec 2024 10:08:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=90=E5=93=81=E6=A3=80=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Quality/FQC/QcDefectConfigController.cs | 108 +++++++++++++ .../FQC/QcFinishedproductDefectController.cs | 67 ++++++++ DOAN.Model/DOAN.Model.csproj | 4 + .../FQC/QcFinishedproductDefectCollection.cs | 62 +++++++ .../Quality/IPQC/Dto/QcDefectCollectionDto.cs | 126 +++++++++++++++ .../MES/Quality/IPQC/QcDefectCollection.cs | 152 ++++++++++++++++++ .../MES/Quality/IQC/Dto/QcDefectConfigDto.cs | 47 ++++++ DOAN.Model/MES/Quality/IQC/QcDefectConfig.cs | 66 ++++++++ DOAN.Model/Mobile/Dto/CheckMaterialDto.cs | 36 +++++ DOAN.Model/Mobile/Dto/MaterialModel.cs | 42 +++++ DOAN.Model/Mobile/Dto/MobileTask.cs | 56 +++++++ .../FQC/IService/IQcDefectConfigService.cs | 21 +++ .../IQcFinishedproductDefectService.cs | 16 ++ .../MES/Quality/FQC/QcDefectConfigService.cs | 87 ++++++++++ .../FQC/QcFinishedproductDefectService.cs | 82 ++++++++++ 15 files changed, 972 insertions(+) create mode 100644 DOAN.Admin.WebApi/Controllers/MES/Quality/FQC/QcDefectConfigController.cs create mode 100644 DOAN.Admin.WebApi/Controllers/MES/Quality/FQC/QcFinishedproductDefectController.cs create mode 100644 DOAN.Model/MES/Quality/FQC/QcFinishedproductDefectCollection.cs create mode 100644 DOAN.Model/MES/Quality/IPQC/Dto/QcDefectCollectionDto.cs create mode 100644 DOAN.Model/MES/Quality/IPQC/QcDefectCollection.cs create mode 100644 DOAN.Model/MES/Quality/IQC/Dto/QcDefectConfigDto.cs create mode 100644 DOAN.Model/MES/Quality/IQC/QcDefectConfig.cs create mode 100644 DOAN.Model/Mobile/Dto/CheckMaterialDto.cs create mode 100644 DOAN.Model/Mobile/Dto/MaterialModel.cs create mode 100644 DOAN.Model/Mobile/Dto/MobileTask.cs create mode 100644 DOAN.Service/MES/Quality/FQC/IService/IQcDefectConfigService.cs create mode 100644 DOAN.Service/MES/Quality/FQC/IService/IQcFinishedproductDefectService.cs create mode 100644 DOAN.Service/MES/Quality/FQC/QcDefectConfigService.cs create mode 100644 DOAN.Service/MES/Quality/FQC/QcFinishedproductDefectService.cs diff --git a/DOAN.Admin.WebApi/Controllers/MES/Quality/FQC/QcDefectConfigController.cs b/DOAN.Admin.WebApi/Controllers/MES/Quality/FQC/QcDefectConfigController.cs new file mode 100644 index 0000000..88209cc --- /dev/null +++ b/DOAN.Admin.WebApi/Controllers/MES/Quality/FQC/QcDefectConfigController.cs @@ -0,0 +1,108 @@ +using DOAN.Admin.WebApi.Filters; +using DOAN.Model.MES.quality.IQC; +using DOAN.Model.MES.quality.IQC.Dto; +using DOAN.Service.MES.quality.FQC.IService; +using Microsoft.AspNetCore.Mvc; + +//创建时间:2024-10-10 +namespace DOAN.WebApi.Controllers.MES.quality.FQC +{ + /// + /// 缺陷类别 + /// + //[Verify] + [Route("mes/qualityManagement/FQC/QcDefectConfig")] + public class QcDefectConfigController : BaseController + { + /// + /// 缺陷类别接口 + /// + private readonly IQcDefectConfigService _QcDefectConfigService; + + public QcDefectConfigController(IQcDefectConfigService QcDefectConfigService) + { + _QcDefectConfigService = QcDefectConfigService; + } + + /// + /// 查询缺陷类别列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "qualityManagement:qcdefectconfig:list")] + public IActionResult QueryQcDefectConfig([FromQuery] QcDefectConfigQueryDto parm) + { + var response = _QcDefectConfigService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询缺陷类别详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "qualityManagement:qcdefectconfig:query")] + public IActionResult GetQcDefectConfig(int Id) + { + var response = _QcDefectConfigService.GetInfo(Id); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加缺陷类别 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "qualityManagement:qcdefectconfig:add")] + [Log(Title = "缺陷类别", BusinessType = BusinessType.INSERT)] + public IActionResult AddQcDefectConfig([FromBody] QcDefectConfigDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _QcDefectConfigService.AddQcDefectConfig(modal); + + return SUCCESS(response); + } + + /// + /// 更新缺陷类别 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "qualityManagement:qcdefectconfig:edit")] + [Log(Title = "缺陷类别", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateQcDefectConfig([FromBody] QcDefectConfigDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _QcDefectConfigService.UpdateQcDefectConfig(modal); + + return ToResponse(response); + } + + /// + /// 删除缺陷类别 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "qualityManagement:qcdefectconfig:delete")] + [Log(Title = "缺陷类别", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteQcDefectConfig(string ids) + { + int[] idsArr = Tools.SpitIntArrary(ids); + if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } + + var response = _QcDefectConfigService.Delete(idsArr); + + return ToResponse(response); + } + + + + + } +} \ No newline at end of file diff --git a/DOAN.Admin.WebApi/Controllers/MES/Quality/FQC/QcFinishedproductDefectController.cs b/DOAN.Admin.WebApi/Controllers/MES/Quality/FQC/QcFinishedproductDefectController.cs new file mode 100644 index 0000000..325cd16 --- /dev/null +++ b/DOAN.Admin.WebApi/Controllers/MES/Quality/FQC/QcFinishedproductDefectController.cs @@ -0,0 +1,67 @@ +using DOAN.Admin.WebApi.Filters; +using DOAN.Model.MES.quality.IQC; +using DOAN.Model.MES.quality.IQC.Dto; +using DOAN.Service.MES.quality.FQC.IService; +using Microsoft.AspNetCore.Mvc; + +//创建时间:2024-10-10 +namespace DOAN.WebApi.Controllers.MES.quality.FQC +{ + /// + /// 成品检验 缺陷收集 + /// + [AllowAnonymous] + [Route("mes/qualityManagement/FQC/QcFinishedproductDefect")] + public class QcFinishedproductDefectController : BaseController + { + private readonly IQcFinishedproductDefectService qcFinishedproductDefectService; + public QcFinishedproductDefectController(IQcFinishedproductDefectService qcFinishedproductDefectService) + { + this.qcFinishedproductDefectService = qcFinishedproductDefectService; + } + + + //TODO 增加 缺陷数 + [HttpGet("add_defect_num")] + public IActionResult AddDefectNum(string WorkOrder, string DefectCode) + { + if (string.IsNullOrEmpty(WorkOrder) || string.IsNullOrEmpty(DefectCode)) + { + throw new CustomException("WorkOrder为空||DefectCode为空"); + } + var response = qcFinishedproductDefectService.AddDefectNum(WorkOrder, DefectCode); + return SUCCESS(response); + + } + + //TODO 修改缺陷数 + [HttpGet("update_defect_num")] + public IActionResult UpdateDefectNum(string WorkOrder, string DefectCode, int num) + { + if (string.IsNullOrEmpty(WorkOrder) || string.IsNullOrEmpty(DefectCode)) + { + throw new CustomException("WorkOrder为空||DefectCode为空"); + } + var response = qcFinishedproductDefectService.UpdateDefectNum(WorkOrder, DefectCode, num); + return SUCCESS(response); + + } + + //TODO 查询指定工单下的缺陷 + [HttpGet("search_defects")] + public IActionResult SearchDefectList(string WorkOrder) + { + if (string.IsNullOrEmpty(WorkOrder) ) + { + throw new CustomException("WorkOrder为空"); + } + var response = qcFinishedproductDefectService.SearchDefectList(WorkOrder); + return SUCCESS(response); + } + + + } +} + + + diff --git a/DOAN.Model/DOAN.Model.csproj b/DOAN.Model/DOAN.Model.csproj index 7f2c2ac..47eeff4 100644 --- a/DOAN.Model/DOAN.Model.csproj +++ b/DOAN.Model/DOAN.Model.csproj @@ -12,4 +12,8 @@ + + + + diff --git a/DOAN.Model/MES/Quality/FQC/QcFinishedproductDefectCollection.cs b/DOAN.Model/MES/Quality/FQC/QcFinishedproductDefectCollection.cs new file mode 100644 index 0000000..400a5a8 --- /dev/null +++ b/DOAN.Model/MES/Quality/FQC/QcFinishedproductDefectCollection.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DOAN.Model.MES.quality.FQC +{ + /// + /// 成品缺陷 + /// + [SugarTable("qc_finishedproduct_defect_collection")] + public class QcFinishedproductDefectCollection + { + /// + /// 雪花 + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false)] + public string Id { get; set; } + + /// + /// 工单号 + /// + public string Workorder { get; set; } + + /// + /// 缺陷描述 + /// + [SugarColumn(ColumnName = "defect_code")] + public string DefectCode { get; set; } + + /// + /// 数量 + /// + public int? Number { get; set; } + + /// + /// CreatedBy + /// + [SugarColumn(ColumnName = "created_by")] + public string CreatedBy { get; set; } + + /// + /// CreatedTime + /// + [SugarColumn(ColumnName = "created_time")] + public DateTime? CreatedTime { get; set; } + + /// + /// UpdatedBy + /// + [SugarColumn(ColumnName = "updated_by")] + public string UpdatedBy { get; set; } + + /// + /// UpdatedTime + /// + [SugarColumn(ColumnName = "updated_time")] + public DateTime? UpdatedTime { get; set; } + + } +} \ No newline at end of file diff --git a/DOAN.Model/MES/Quality/IPQC/Dto/QcDefectCollectionDto.cs b/DOAN.Model/MES/Quality/IPQC/Dto/QcDefectCollectionDto.cs new file mode 100644 index 0000000..66f460f --- /dev/null +++ b/DOAN.Model/MES/Quality/IPQC/Dto/QcDefectCollectionDto.cs @@ -0,0 +1,126 @@ +using System.ComponentModel.DataAnnotations; + +namespace DOAN.Model.MES.quality.IPQC.Dto; + +/// +/// 缺陷收集查询对象 +/// +public class QcDefectCollectionQueryDto : PagerInfo +{ + public string MaterialCode { get; set; } + + public string MaterialName { get; set; } + + public DateTime? DateTime { get; set; } + + + public string LineCode { get; set; } + + public int? Tqm { get; set; } + + public int? Type { get; set; } +} + +/// +/// 缺陷收集输入输出对象 +/// +public class QcDefectCollectionDto +{ + [Required(ErrorMessage = "id不能为空")] public string Id { get; set; } + + public string LineCode { get; set; } + + public DateTime? DateTime { get; set; } + + public string MaterialCode { get; set; } + + public string MaterialName { get; set; } + + /// + /// 产品编码 + /// + + public string ProductCode { get; set; } + + /// + /// 产品名称 + /// + + public string ProductName { get; set; } + + public string BatchNumber { get; set; } + + public string Unit { get; set; } + + + /// + /// 供应商编码 + /// + + public string SupplierCode { get; set; } + + public string SupplierName { get; set; } + + public decimal PlanNum { get; set; } + + public decimal ActualNum { get; set; } + + public decimal Quantity { get; set; } + + public string ProcessName { get; set; } + + public string Superintendent { get; set; } + + public string DefectDescription { get; set; } + + public int? Tqm { get; set; } + public int? Type { get; set; } + + public string Remark { get; set; } + + public string CreatedBy { get; set; } + + public DateTime? CreatedTime { get; set; } + + public string UpdatedBy { get; set; } + + public DateTime? UpdatedTime { get; set; } +} + +/// +/// 报损单 +/// +public class QcDefectCollectionQueryDto2 : PagerInfo +{ + public string MaterialCode { get; set; } + + public string MaterialName { get; set; } + + public DateTime? DateTime { get; set; } + + + public string LineCode { get; set; } + + //public int? Tqm { get; set; } + + public int? Type { get; set; } + + public string SupplierCode { get; set; } + + /// + /// 供应商名称 + /// + public string SupplierName { get; set; } + + /// + /// 产品编码 + /// + + public string ProductCode { get; set; } + + /// + /// 产品名称 + /// + + public string ProductName { get; set; } +} \ No newline at end of file diff --git a/DOAN.Model/MES/Quality/IPQC/QcDefectCollection.cs b/DOAN.Model/MES/Quality/IPQC/QcDefectCollection.cs new file mode 100644 index 0000000..fbc2930 --- /dev/null +++ b/DOAN.Model/MES/Quality/IPQC/QcDefectCollection.cs @@ -0,0 +1,152 @@ +namespace DOAN.Model.MES.quality.IPQC +{ + /// + /// 缺陷收集 + /// + [SugarTable("qc_defect_collection")] + public class QcDefectCollection + { + /// + /// id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false)] + public string Id { get; set; } + + /// + /// 线别 + /// + [SugarColumn(ColumnName = "line_code")] + public string LineCode { get; set; } + + /// + /// 日期 + /// + [SugarColumn(ColumnName = "date_time")] + public DateTime? DateTime { get; set; } + + /// + /// 原材料编码 + /// + [SugarColumn(ColumnName = "material_code")] + public string MaterialCode { get; set; } + + /// + /// 原材料名称 + /// + [SugarColumn(ColumnName = "material_name")] + public string MaterialName { get; set; } + + /// + /// 产品编码 + /// + [SugarColumn(ColumnName = "product_code")] + public string ProductCode { get; set; } + + /// + /// 产品名称 + /// + [SugarColumn(ColumnName = "product_name")] + public string ProductName { get; set; } + + /// + /// 批号 + /// + [SugarColumn(ColumnName = "batch_number")] + public string BatchNumber { get; set; } + + /// + /// 单位 + /// + public string Unit { get; set; } + + + public string Specification { get; set; } + + /// + /// 供应商编码 + /// + [SugarColumn(ColumnName = "supplier_code")] + public string SupplierCode { get; set; } + + /// + /// 供应商名称 + /// + [SugarColumn(ColumnName = "supplier_name")] + public string SupplierName { get; set; } + + + /// + /// 计划数量 + /// + [SugarColumn(ColumnName = "plan_num")] + public decimal PlanNum { get; set; } + + /// + /// 实际数量 + /// + [SugarColumn(ColumnName = "actual_num")] + public decimal ActualNum { get; set; } + + /// + /// 缺陷数量 + /// + public decimal Quantity { get; set; } + + /// + /// 工序名称 + /// + [SugarColumn(ColumnName = "process_name")] + public string ProcessName { get; set; } + + /// + /// 负责人 + /// + public string Superintendent { get; set; } + + /// + /// 缺陷描述 + /// + [SugarColumn(ColumnName = "defect_description")] + public string DefectDescription { get; set; } + + /// + /// 5M1E(1-人 2-机 3-料 4-法 5-环 6-测) + /// + public int? Tqm { get; set; } + + + /// + /// 1:报损单 2:索赔单 + /// + public int? Type { get; set; } + + /// + /// 备注 + /// + public string Remark { 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; } + } +} \ No newline at end of file diff --git a/DOAN.Model/MES/Quality/IQC/Dto/QcDefectConfigDto.cs b/DOAN.Model/MES/Quality/IQC/Dto/QcDefectConfigDto.cs new file mode 100644 index 0000000..f283e6d --- /dev/null +++ b/DOAN.Model/MES/Quality/IQC/Dto/QcDefectConfigDto.cs @@ -0,0 +1,47 @@ +using System.ComponentModel.DataAnnotations; + +namespace DOAN.Model.MES.quality.IQC.Dto +{ + /// + /// 缺陷类别查询对象 + /// + public class QcDefectConfigQueryDto : PagerInfo + { + public string Name { get; set; } + public string Code { get; set; } + public string Group { get; set; } + public string QcType { get; set; } + public string Status { get; set; } + + } + + /// + /// 缺陷类别输入输出对象 + /// + public class QcDefectConfigDto + { + [Required(ErrorMessage = "主键不能为空")] + public int Id { get; set; } + + public string Name { get; set; } + + public string Code { get; set; } + + public string Group { get; set; } + + public string QcType { get; set; } + + public string Status { get; set; } + + public string CreatedBy { get; set; } + + public DateTime? CreatedTime { get; set; } + + public string UpdatedBy { get; set; } + + public DateTime? UpdatedTime { get; set; } + + + + } +} \ No newline at end of file diff --git a/DOAN.Model/MES/Quality/IQC/QcDefectConfig.cs b/DOAN.Model/MES/Quality/IQC/QcDefectConfig.cs new file mode 100644 index 0000000..6d5b1af --- /dev/null +++ b/DOAN.Model/MES/Quality/IQC/QcDefectConfig.cs @@ -0,0 +1,66 @@ +namespace DOAN.Model.MES.quality.IQC +{ + /// + /// 缺陷类别 + /// + [SugarTable("qc_defect_config")] + public class QcDefectConfig + { + /// + /// 主键 + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 名称 + /// + public string Name { get; set; } + + /// + /// 编号 + /// + public string Code { get; set; } + + /// + /// 组 + /// + public string Group { get; set; } + + /// + /// 质检类别(FQC,IPQC,IQC) + /// + [SugarColumn(ColumnName = "qc_type")] + public string QcType { get; set; } + + /// + /// 是否生效 + /// + public string Status { 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; } + + } +} \ No newline at end of file diff --git a/DOAN.Model/Mobile/Dto/CheckMaterialDto.cs b/DOAN.Model/Mobile/Dto/CheckMaterialDto.cs new file mode 100644 index 0000000..db52d0e --- /dev/null +++ b/DOAN.Model/Mobile/Dto/CheckMaterialDto.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DOAN.Model.Mobile.Dto +{ + /// + /// 校验物料是否在指定线和日期内 + /// + public class CheckMaterialDto + { + /// + /// 物料清单 + /// + public string[] MatetialCodeArray { get; set; } + /// + /// 线别 + /// + public string LineCode { get; set; } + /// + /// 指定日期 + /// + public DateTime HandelDate { get; set; } + + } + public class CheckMaterialResult + { + public string MatetialCode { get; set; } + + public bool result { get; set; } + + } + +} diff --git a/DOAN.Model/Mobile/Dto/MaterialModel.cs b/DOAN.Model/Mobile/Dto/MaterialModel.cs new file mode 100644 index 0000000..61fad6a --- /dev/null +++ b/DOAN.Model/Mobile/Dto/MaterialModel.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DOAN.Model.Mobile.Dto +{ + public class MaterialModel + { + public string Partnumber { get; set; } + + public string MaterialName { get; set; } + public string Batchnumber { get; set; } + + public float quantity { get; set; } + + public string Code { get; set; } + + + /// + /// 颜色 + /// + public string Color { get; set; } + + /// + /// 规格型号 + /// + public string Specification { get; set; } + + /// + /// 计量单位 + /// + public string Unit { get; set; } + + /// + /// 描述 + /// + public string Description { get; set; } + + } +} diff --git a/DOAN.Model/Mobile/Dto/MobileTask.cs b/DOAN.Model/Mobile/Dto/MobileTask.cs new file mode 100644 index 0000000..1f2d47a --- /dev/null +++ b/DOAN.Model/Mobile/Dto/MobileTask.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DOAN.Model.Mobile.Dto +{ + public class IngredientTaskRequestForm + { + + public List Ingredient_task { get; set; } + + public string workorder { get; set; } + + + } + public class IngredientTaskRequestForm2 + { + + public List Ingredient_task { get; set; } + + public string lineCode { get; set; } + public DateTime HandleDate { get; set; } + + + } + + public class MobileTaskDto + { + /// + /// 物料code + /// + public string MaterialCode { get; set; } + + /// + /// 物料名称 + /// + public string MaterialName { get; set; } + + /// + /// 规格型号 + /// + public string Specification { get; set; } + + /// + /// 配料数量 + /// + public decimal Quantity { get; set; } + + /// + /// 单位 + /// + public string Unit { get; set; } + } +} diff --git a/DOAN.Service/MES/Quality/FQC/IService/IQcDefectConfigService.cs b/DOAN.Service/MES/Quality/FQC/IService/IQcDefectConfigService.cs new file mode 100644 index 0000000..2200366 --- /dev/null +++ b/DOAN.Service/MES/Quality/FQC/IService/IQcDefectConfigService.cs @@ -0,0 +1,21 @@ +using DOAN.Model; +using DOAN.Model.MES.quality.IQC; +using DOAN.Model.MES.quality.IQC.Dto; + +namespace DOAN.Service.MES.quality.FQC.IService +{ + /// + /// 缺陷类别service接口 + /// + public interface IQcDefectConfigService : IBaseService + { + PagedInfo GetList(QcDefectConfigQueryDto parm); + + QcDefectConfig GetInfo(int Id); + + QcDefectConfig AddQcDefectConfig(QcDefectConfig parm); + + int UpdateQcDefectConfig(QcDefectConfig parm); + + } +} diff --git a/DOAN.Service/MES/Quality/FQC/IService/IQcFinishedproductDefectService.cs b/DOAN.Service/MES/Quality/FQC/IService/IQcFinishedproductDefectService.cs new file mode 100644 index 0000000..5916044 --- /dev/null +++ b/DOAN.Service/MES/Quality/FQC/IService/IQcFinishedproductDefectService.cs @@ -0,0 +1,16 @@ +using DOAN.Model.MES.quality.FQC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DOAN.Service.MES.quality.FQC.IService +{ + public interface IQcFinishedproductDefectService + { + bool AddDefectNum(string WorkOrder,string name); + bool UpdateDefectNum(string WorkOrder,string name,int num); + List SearchDefectList(string WorkOrder); + } +} diff --git a/DOAN.Service/MES/Quality/FQC/QcDefectConfigService.cs b/DOAN.Service/MES/Quality/FQC/QcDefectConfigService.cs new file mode 100644 index 0000000..c76fa19 --- /dev/null +++ b/DOAN.Service/MES/Quality/FQC/QcDefectConfigService.cs @@ -0,0 +1,87 @@ +using DOAN.Model; +using DOAN.Model.MES.quality.IQC; +using DOAN.Model.MES.quality.IQC.Dto; +using DOAN.Repository; +using DOAN.Service.MES.quality.FQC.IService; +using Infrastructure.Attribute; + +namespace DOAN.Service.MES.quality.FQC +{ + /// + /// 缺陷类别Service业务层处理 + /// + [AppService(ServiceType = typeof(IQcDefectConfigService), ServiceLifetime = LifeTime.Transient)] + public class QcDefectConfigService : BaseService, IQcDefectConfigService + { + /// + /// 查询缺陷类别列表 + /// + /// + /// + public PagedInfo GetList(QcDefectConfigQueryDto parm) + { + var predicate = Expressionable.Create() + .AndIF(!string.IsNullOrEmpty(parm.Name), it => it.Name.Contains(parm.Name)) + .AndIF(!string.IsNullOrEmpty(parm.Code), it => it.Code.Contains(parm.Code)) + .AndIF(!string.IsNullOrEmpty(parm.Group), it => it.Group.Contains(parm.Group)) + .AndIF(!string.IsNullOrEmpty(parm.QcType), it => it.QcType.Contains(parm.QcType)) + .AndIF(!string.IsNullOrEmpty(parm.Status), it => it.Status == parm.Status); + + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public QcDefectConfig GetInfo(int Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加缺陷类别 + /// + /// + /// + public QcDefectConfig AddQcDefectConfig(QcDefectConfig model) + { + return Context.Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改缺陷类别 + /// + /// + /// + public int UpdateQcDefectConfig(QcDefectConfig model) + { + //var response = Update(w => w.Id == model.Id, it => new QcDefectConfig() + //{ + // Name = model.Name, + // Code = model.Code, + // Group = model.Group, + // QcType = model.QcType, + // Status = model.Status, + // CreatedBy = model.CreatedBy, + // CreatedTime = model.CreatedTime, + // UpdatedBy = model.UpdatedBy, + // UpdatedTime = model.UpdatedTime, + //}); + //return response; + return Update(model, true); + } + + } +} \ No newline at end of file diff --git a/DOAN.Service/MES/Quality/FQC/QcFinishedproductDefectService.cs b/DOAN.Service/MES/Quality/FQC/QcFinishedproductDefectService.cs new file mode 100644 index 0000000..e5e5eb2 --- /dev/null +++ b/DOAN.Service/MES/Quality/FQC/QcFinishedproductDefectService.cs @@ -0,0 +1,82 @@ +using DOAN.Model; +using DOAN.Model.MES.quality.FQC; +using DOAN.Model.MES.quality.IQC; +using DOAN.Model.MES.quality.IQC.Dto; +using DOAN.Repository; +using DOAN.Service.MES.quality.FQC.IService; +using Infrastructure.Attribute; +using static ICSharpCode.SharpZipLib.Zip.ExtendedUnixData; + +namespace DOAN.Service.MES.quality.FQC +{ + /// + /// 成品缺陷收集 Service业务层处理 + /// + [AppService(ServiceType = typeof(IQcFinishedproductDefectService), ServiceLifetime = LifeTime.Transient)] + public class QcFinishedproductDefectService : BaseService, IQcFinishedproductDefectService + { + public bool AddDefectNum(string WorkOrder, string DefectCode) + { + int flag = 0; + + // 检查 Workorder 是否存在 + var existingRecord = Context.Queryable() + .Where(it => it.Workorder == WorkOrder) + .Where(it => it.DefectCode == DefectCode) + .First(); + + if (existingRecord != null) + { + // 更新 Number 字段 + flag = Context.Updateable() + .SetColumns(it => new QcFinishedproductDefectCollection + { + Number = it.Number + 1, + UpdatedTime = DateTime.Now + }) + .Where(it => it.Workorder == WorkOrder) + .Where(it => it.DefectCode == DefectCode) + .ExecuteCommand(); + } + else + { + // 插入新记录 + QcFinishedproductDefectCollection qcFinishedproductDefect = new QcFinishedproductDefectCollection(); + qcFinishedproductDefect.Id = XueHua; + qcFinishedproductDefect.Workorder = WorkOrder; + qcFinishedproductDefect.DefectCode = DefectCode; + qcFinishedproductDefect.CreatedTime = DateTime.Now; + qcFinishedproductDefect.UpdatedTime = DateTime.Now; + qcFinishedproductDefect.Number = 1; + flag = Context.Insertable(qcFinishedproductDefect).ExecuteCommand(); + } + + return flag > 0 ? true : false; + } + + + public bool UpdateDefectNum(string WorkOrder, string DefectCode, int num) + { + int flag = 0; + + flag = Context.Updateable() + .SetColumns(it => new QcFinishedproductDefectCollection + { + Number = num, + UpdatedTime = DateTime.Now + }) + .Where(it => it.Workorder == WorkOrder) + .Where(it => it.DefectCode == DefectCode) + .ExecuteCommand(); + return flag > 0 ? true : false; + } + + public List SearchDefectList(string WorkOrder) + { + return Context.Queryable().Where(it => it.Workorder == WorkOrder).ToList(); + } + + } +} + +