成品检验
This commit is contained in:
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 缺陷类别service接口
|
||||
/// </summary>
|
||||
public interface IQcDefectConfigService : IBaseService<QcDefectConfig>
|
||||
{
|
||||
PagedInfo<QcDefectConfigDto> GetList(QcDefectConfigQueryDto parm);
|
||||
|
||||
QcDefectConfig GetInfo(int Id);
|
||||
|
||||
QcDefectConfig AddQcDefectConfig(QcDefectConfig parm);
|
||||
|
||||
int UpdateQcDefectConfig(QcDefectConfig parm);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<QcFinishedproductDefectCollection> SearchDefectList(string WorkOrder);
|
||||
}
|
||||
}
|
||||
87
DOAN.Service/MES/Quality/FQC/QcDefectConfigService.cs
Normal file
87
DOAN.Service/MES/Quality/FQC/QcDefectConfigService.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 缺陷类别Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IQcDefectConfigService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class QcDefectConfigService : BaseService<QcDefectConfig>, IQcDefectConfigService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询缺陷类别列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<QcDefectConfigDto> GetList(QcDefectConfigQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<QcDefectConfig>()
|
||||
.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<QcDefectConfig, QcDefectConfigDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public QcDefectConfig GetInfo(int Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加缺陷类别
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public QcDefectConfig AddQcDefectConfig(QcDefectConfig model)
|
||||
{
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改缺陷类别
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 成品缺陷收集 Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IQcFinishedproductDefectService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class QcFinishedproductDefectService : BaseService<QcFinishedproductDefectCollection>, IQcFinishedproductDefectService
|
||||
{
|
||||
public bool AddDefectNum(string WorkOrder, string DefectCode)
|
||||
{
|
||||
int flag = 0;
|
||||
|
||||
// 检查 Workorder 是否存在
|
||||
var existingRecord = Context.Queryable<QcFinishedproductDefectCollection>()
|
||||
.Where(it => it.Workorder == WorkOrder)
|
||||
.Where(it => it.DefectCode == DefectCode)
|
||||
.First();
|
||||
|
||||
if (existingRecord != null)
|
||||
{
|
||||
// 更新 Number 字段
|
||||
flag = Context.Updateable<QcFinishedproductDefectCollection>()
|
||||
.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<QcFinishedproductDefectCollection>()
|
||||
.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<QcFinishedproductDefectCollection> SearchDefectList(string WorkOrder)
|
||||
{
|
||||
return Context.Queryable<QcFinishedproductDefectCollection>().Where(it => it.Workorder == WorkOrder).ToList();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user