质量报表
This commit is contained in:
@@ -622,8 +622,8 @@ namespace ZR.Service.mes.qc
|
||||
public static QcCurrentWorkorderDto Now_producting_Workorder_first = null; //当前生产工单 首检
|
||||
public static QcCurrentWorkorderDto Now_producting_Workorder_again = null; //当前生产工单 二检
|
||||
public static QcCurrentWorkorderDto Now_producting_Workorder_thirty = null; //当前生产工单 三检
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前_生产中_工单列表
|
||||
/// </summary>
|
||||
@@ -753,7 +753,7 @@ namespace ZR.Service.mes.qc
|
||||
public QcCurrentWorkorderDto GetcurrentWorkorder_next_first()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//获取状态为1的生产工单列表
|
||||
@@ -1093,7 +1093,7 @@ namespace ZR.Service.mes.qc
|
||||
{
|
||||
int result = 0;
|
||||
//TODO 获取已知的的检测项 +1
|
||||
QcFirstinspectionRecord exist_record= Context.Queryable<QcFirstinspectionRecord>()
|
||||
QcFirstinspectionRecord exist_record = Context.Queryable<QcFirstinspectionRecord>()
|
||||
.Where(it => it.FKWorkorderId == workorder_id && it.FKInpectionId == checkid.ToString())
|
||||
.First();
|
||||
|
||||
@@ -1111,28 +1111,28 @@ namespace ZR.Service.mes.qc
|
||||
record.UpdatedTime = DateTime.Now;
|
||||
record.CreatedBy = name;
|
||||
record.UpdatedBy = name;
|
||||
Context.Insertable(record).ExecuteCommand();
|
||||
Context.Insertable(record).ExecuteCommand();
|
||||
|
||||
result = 1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
result= Context.Updateable<QcFirstinspectionRecord>()
|
||||
.SetColumns(it=>it.Counter==(exist_record.Counter+ number))
|
||||
.SetColumns(it=>it.UpdatedTime== DateTime.Now)
|
||||
.SetColumns(it=>it.UpdatedBy == name)
|
||||
.Where(it=>it.FKInpectionId==checkid.ToString()&&it.FKWorkorderId==workorder_id)
|
||||
result = Context.Updateable<QcFirstinspectionRecord>()
|
||||
.SetColumns(it => it.Counter == (exist_record.Counter + number))
|
||||
.SetColumns(it => it.UpdatedTime == DateTime.Now)
|
||||
.SetColumns(it => it.UpdatedBy == name)
|
||||
.Where(it => it.FKInpectionId == checkid.ToString() && it.FKWorkorderId == workorder_id)
|
||||
.ExecuteCommand();
|
||||
|
||||
result = (int)exist_record.Counter + number;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
@@ -1148,7 +1148,7 @@ namespace ZR.Service.mes.qc
|
||||
public int Accumulator_again(string workorder_id, int checkid, int number, string InspectionModule, string name)
|
||||
{
|
||||
|
||||
|
||||
|
||||
int result = 0;
|
||||
//TODO 获取已知的的检测项 +1
|
||||
QcAgaininspectionRecord exist_record = Context.Queryable<QcAgaininspectionRecord>()
|
||||
@@ -1279,7 +1279,7 @@ namespace ZR.Service.mes.qc
|
||||
public int CalculatePackagingInvestment(string workorder_id)
|
||||
{
|
||||
|
||||
|
||||
|
||||
int OnePassNumber = 0;
|
||||
int polishPassNumber = 0;
|
||||
|
||||
@@ -1287,8 +1287,8 @@ namespace ZR.Service.mes.qc
|
||||
{
|
||||
//TODO 一次合格数=计划数-所有缺陷数
|
||||
var workorder = Context.Queryable<ProWorkorder_v2>().Where(it => it.ClientWorkorder == workorder_id).First();
|
||||
|
||||
if(workorder != null)
|
||||
|
||||
if (workorder != null)
|
||||
{
|
||||
|
||||
var list = Context.Queryable<QcFirstinspectionRecord>()
|
||||
@@ -1340,7 +1340,7 @@ namespace ZR.Service.mes.qc
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
return OnePassNumber + polishPassNumber;
|
||||
|
||||
}
|
||||
@@ -1353,10 +1353,171 @@ namespace ZR.Service.mes.qc
|
||||
public int UpdateWorkorderStatus(string workorder_id)
|
||||
{
|
||||
|
||||
return Context.Updateable<ProWorkorder_v2>()
|
||||
.SetColumns(it => it.Status == 2)
|
||||
.Where(it => it.ClientWorkorder == workorder_id)
|
||||
.ExecuteCommand();
|
||||
return Context.Updateable<ProWorkorder_v2>()
|
||||
.SetColumns(it => it.Status == 2)
|
||||
.Where(it => it.ClientWorkorder == workorder_id)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成质量统计表
|
||||
/// </summary>
|
||||
/// <param name="workorderID"></param>
|
||||
/// <param name="team"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public int GenerateQualityStatisticsTable(string workorderID, string team)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(workorderID))
|
||||
{
|
||||
#region 首检
|
||||
QcQualityStatisticsFirst first = new QcQualityStatisticsFirst();
|
||||
first.Id = DateTime.Now.ToString("YYMMddHHmmss");
|
||||
first.WorkorderId = workorderID;
|
||||
|
||||
ProWorkorder_v2 workorder_item = Context.Queryable<ProWorkorder_v2>().Where(it => it.ClientWorkorder == workorderID).First();
|
||||
if (workorder_item != null)
|
||||
{
|
||||
first.FinishedPartNumber = workorder_item.FinishedPartNumber;
|
||||
first.ProductDescription = workorder_item.ProductDescription;
|
||||
first.RequireNumber = workorder_item.PreviousNumber;
|
||||
first.StartTime = workorder_item.CreatedTime;//这地方是不妥的
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
first.Team = team;
|
||||
first.QualifiedNumber = 0;
|
||||
first.QualifiedRate = 0;
|
||||
first.PaoguangTotal = 0;
|
||||
first.DamoTotal = 0;
|
||||
first.BaofeiTotal = 0;
|
||||
|
||||
first.EndTime = DateTime.Now;
|
||||
first.Remark = "抛光";
|
||||
first.Remark2 = 1;
|
||||
|
||||
List<QcFirstinspectionRecord> firstrecordList = Context.Queryable<QcFirstinspectionRecord>().Where(it => it.FKWorkorderId == workorderID).ToList();
|
||||
if (firstrecordList != null && firstrecordList.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < firstrecordList.Count; i++)
|
||||
{
|
||||
|
||||
if (firstrecordList[i].FKInpectionId=="111")
|
||||
{
|
||||
first.PaintSuokong = firstrecordList[i].Counter;
|
||||
}
|
||||
|
||||
if (firstrecordList[i].FKInpectionId == "112")
|
||||
{
|
||||
first.PaintZhengkong = firstrecordList[i].Counter;
|
||||
}
|
||||
|
||||
if (firstrecordList[i].FKInpectionId == "113")
|
||||
{
|
||||
first.PaintShiguang = firstrecordList[i].Counter;
|
||||
}
|
||||
|
||||
|
||||
if (firstrecordList[i].FKInpectionId == "114")
|
||||
{
|
||||
first.PaintSecha = firstrecordList[i].Counter;
|
||||
}
|
||||
|
||||
|
||||
if (firstrecordList[i].FKInpectionId == "115")
|
||||
{
|
||||
first.PaintDianzi = firstrecordList[i].Counter;
|
||||
}
|
||||
|
||||
|
||||
if (firstrecordList[i].FKInpectionId == "116")
|
||||
{
|
||||
first.PaintOther = firstrecordList[i].Counter;
|
||||
}
|
||||
|
||||
if (firstrecordList[i].FKInpectionId == "211")
|
||||
{
|
||||
first.DeviceShuiban = firstrecordList[i].Counter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
first.DeviceShuiban = 0;
|
||||
first.DeviceZandian = 0;
|
||||
first.DeviceBianxing = 0;
|
||||
first.DeviceYouzhu = 0;
|
||||
first.DeviceTuoluo = 0;
|
||||
first.DeviceZhuangshang = 0;
|
||||
first.DeviceOther = 0;
|
||||
first.BlankMaoci = 0;
|
||||
first.BlankSuoyin = 0;
|
||||
first.BlankCanshuang = 0;
|
||||
first.BlankShaying = 0;
|
||||
first.BlankZangdian = 0;
|
||||
first.BlankDamo = 0;
|
||||
first.ProgramLiuguang = 0;
|
||||
first.ProgramSeqiqueqi = 0;
|
||||
first.ProgramQingqiqueqi = 0;
|
||||
first.ProgramJupi = 0;
|
||||
first.ProgramOther = 0;
|
||||
first.TeamTuoluocanshuang = 0;
|
||||
first.TeamQingqiqikuai = 0;
|
||||
first.TeamSeqiqikuai = 0;
|
||||
first.TeamFahua = 0;
|
||||
first.TeamLiangbang = 0;
|
||||
first.TeamPenglou = 0;
|
||||
first.UpdatedTime = DateTime.Now;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//二检
|
||||
//三检
|
||||
//总报表
|
||||
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ namespace ZR.Service.mes.qc.IService
|
||||
|
||||
public int UpdateWorkorderStatus(string workorder_id);
|
||||
|
||||
public int GenerateQualityStatisticsTable(string workorderID, string team);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
26
ZR.Service/mes/qc/IService/IQCStatisticsService.cs
Normal file
26
ZR.Service/mes/qc/IService/IQCStatisticsService.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.qc;
|
||||
|
||||
namespace ZR.Service.mes.qc.IService
|
||||
{
|
||||
public interface IQCStatisticsService
|
||||
{
|
||||
|
||||
#region 获取统计表
|
||||
//获取 首检
|
||||
(List<QcQualityStatisticsFirst>,int) GetQualityStatisticsTable_first(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize);
|
||||
|
||||
//获取 二检
|
||||
|
||||
( List<QcQualityStatisticsAgain>,int) GetQualityStatisticsTable_again(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize);
|
||||
//获取 三检
|
||||
(List<QcQualityStatisticsFinal>,int) GetQualityStatisticsTable_final(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize);
|
||||
//获取 总检
|
||||
(List<QcQualityStatisticsTotal>,int) GetQualityStatisticsTable_total(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
149
ZR.Service/mes/qc/QCStatisticsService.cs
Normal file
149
ZR.Service/mes/qc/QCStatisticsService.cs
Normal file
@@ -0,0 +1,149 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
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.qc;
|
||||
using ZR.Model.MES.qu;
|
||||
using ZR.Service.mes.qc.IService;
|
||||
|
||||
namespace ZR.Service.mes.qc
|
||||
{
|
||||
[AppService(ServiceType = typeof(IQCStatisticsService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class QCStatisticsService : BaseService<QcQualityStatisticsFirst>, IQCStatisticsService
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取质量统计表 首检
|
||||
/// </summary>
|
||||
/// <param name="starttime"></param>
|
||||
/// <param name="endTime"></param>
|
||||
/// <param name="workorderid">工单号</param>
|
||||
/// <param name="partnumber"></param>
|
||||
/// <param name="product_description"></param>
|
||||
/// <param name="team"></param>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public (List<QcQualityStatisticsFirst>, int) GetQualityStatisticsTable_first(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize)
|
||||
{
|
||||
int totalNum = 0;
|
||||
var predicate = Expressionable.Create<QcQualityStatisticsFirst>()
|
||||
.AndIF(starttime>new DateTime(2023, 1, 1, 0,0, 0), it => it.StartTime>=starttime)
|
||||
.AndIF(endTime > new DateTime(2023, 1, 1, 0,0, 0), it => it.EndTime<=endTime)
|
||||
.AndIF(!string.IsNullOrEmpty(workorderid),it=>it.Equals(workorderid))
|
||||
.AndIF(!string.IsNullOrEmpty(partnumber),it=>it.Equals(partnumber))
|
||||
.AndIF(!string.IsNullOrEmpty(team),it=>it.Equals(team))
|
||||
.AndIF(!string.IsNullOrEmpty(product_description), it => it.ProductDescription.Contains(product_description))
|
||||
.ToExpression();
|
||||
|
||||
|
||||
List<QcQualityStatisticsFirst> data = Context.Queryable<QcQualityStatisticsFirst>().Where(predicate).OrderBy(it => it.WorkorderId).OrderBy(it=>it.Remark2).ToPageList(pageNum, pageSize, ref totalNum);
|
||||
|
||||
|
||||
return (data, totalNum);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取质量统计表 二检
|
||||
/// </summary>
|
||||
/// <param name="starttime"></param>
|
||||
/// <param name="endTime"></param>
|
||||
/// <param name="workorderid"></param>
|
||||
/// <param name="partnumber"></param>
|
||||
/// <param name="product_description"></param>
|
||||
/// <param name="team"></param>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public (List<QcQualityStatisticsAgain>,int) GetQualityStatisticsTable_again(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize)
|
||||
{
|
||||
int totalNum = 0;
|
||||
var predicate = Expressionable.Create<QcQualityStatisticsAgain>()
|
||||
.AndIF(starttime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.StartTime >= starttime)
|
||||
.AndIF(endTime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.EndTime <= endTime)
|
||||
.AndIF(!string.IsNullOrEmpty(workorderid), it => it.Equals(workorderid))
|
||||
.AndIF(!string.IsNullOrEmpty(partnumber), it => it.Equals(partnumber))
|
||||
.AndIF(!string.IsNullOrEmpty(team), it => it.Equals(team))
|
||||
.AndIF(!string.IsNullOrEmpty(product_description), it => it.ProductDescription.Contains(product_description))
|
||||
.ToExpression();
|
||||
|
||||
|
||||
List<QcQualityStatisticsAgain> data = Context.Queryable<QcQualityStatisticsAgain>().Where(predicate).OrderBy(it => it.WorkorderId).OrderBy(it => it.Remark2).ToPageList(pageNum, pageSize, ref totalNum);
|
||||
|
||||
|
||||
return (data, totalNum);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取质量统计表 三检
|
||||
/// </summary>
|
||||
/// <param name="starttime"></param>
|
||||
/// <param name="endTime"></param>
|
||||
/// <param name="workorderid"></param>
|
||||
/// <param name="partnumber"></param>
|
||||
/// <param name="product_description"></param>
|
||||
/// <param name="team"></param>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public (List<QcQualityStatisticsFinal>,int) GetQualityStatisticsTable_final(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize)
|
||||
{
|
||||
int totalNum = 0;
|
||||
var predicate = Expressionable.Create<QcQualityStatisticsFinal>()
|
||||
.AndIF(starttime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.StartTime >= starttime)
|
||||
.AndIF(endTime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.EndTime <= endTime)
|
||||
.AndIF(!string.IsNullOrEmpty(workorderid), it => it.Equals(workorderid))
|
||||
.AndIF(!string.IsNullOrEmpty(partnumber), it => it.Equals(partnumber))
|
||||
.AndIF(!string.IsNullOrEmpty(team), it => it.Equals(team))
|
||||
.AndIF(!string.IsNullOrEmpty(product_description), it => it.ProductDescription.Contains(product_description))
|
||||
.ToExpression();
|
||||
|
||||
|
||||
List<QcQualityStatisticsFinal> data = Context.Queryable<QcQualityStatisticsFinal>().Where(predicate).OrderBy(it => it.WorkorderId).OrderBy(it => it.Remark2).ToPageList(pageNum, pageSize, ref totalNum);
|
||||
|
||||
|
||||
return (data, totalNum);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取质量统计表 总表
|
||||
/// </summary>
|
||||
/// <param name="starttime"></param>
|
||||
/// <param name="endTime"></param>
|
||||
/// <param name="workorderid"></param>
|
||||
/// <param name="partnumber"></param>
|
||||
/// <param name="product_description"></param>
|
||||
/// <param name="team"></param>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public (List<QcQualityStatisticsTotal>,int) GetQualityStatisticsTable_total(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize)
|
||||
{
|
||||
int totalNum = 0;
|
||||
var predicate = Expressionable.Create<QcQualityStatisticsTotal>()
|
||||
.AndIF(starttime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.StartTime >= starttime)
|
||||
.AndIF(endTime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.EndTime <= endTime)
|
||||
.AndIF(!string.IsNullOrEmpty(workorderid), it => it.Equals(workorderid))
|
||||
.AndIF(!string.IsNullOrEmpty(partnumber), it => it.Equals(partnumber))
|
||||
.AndIF(!string.IsNullOrEmpty(team), it => it.Equals(team))
|
||||
.AndIF(!string.IsNullOrEmpty(product_description), it => it.ProductDescription.Contains(product_description))
|
||||
.ToExpression();
|
||||
|
||||
|
||||
List<QcQualityStatisticsTotal> data = Context.Queryable<QcQualityStatisticsTotal>().Where(predicate).OrderBy(it => it.WorkorderId).OrderBy(it => it.Remark2).ToPageList(pageNum, pageSize, ref totalNum);
|
||||
|
||||
|
||||
return (data, totalNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user