质量统计完成
This commit is contained in:
parent
3b10b811a2
commit
80ff5f04f2
@ -18,9 +18,6 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
types.GetProperty("Create_by", flag)?.SetValue(source, context.GetName(), null);
|
||||
types.GetProperty("CreatedBy", flag)?.SetValue(source, context.GetName(), null);
|
||||
types.GetProperty("UserId", flag)?.SetValue(source, context.GetUId(), null);
|
||||
|
||||
|
||||
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
@ -110,13 +110,14 @@ namespace ZR.Admin.WebApi.Hubs
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存油漆缺陷采集累加信息
|
||||
/// 保存油漆缺陷采集累加信息 首检
|
||||
/// </summary>
|
||||
/// <param name="workorderid">工单id</param>
|
||||
/// <param name="checkid">检测项</param>
|
||||
/// <returns></returns>
|
||||
public async Task SaveCacheInformation(string workorderid, string Moudle, string checkid)
|
||||
public async Task SaveCacheInformation_v1(string workorderid, string Moudle, string checkid)
|
||||
{
|
||||
checkid = checkid + "_v1";
|
||||
|
||||
if (CacheHelper.Exists(checkid))
|
||||
{
|
||||
@ -124,15 +125,72 @@ namespace ZR.Admin.WebApi.Hubs
|
||||
logger.Info($"当前保存工单号{workorderid},检测项{checkid},累加的数为{sum}");
|
||||
CacheHelper.SetCache(checkid, sum);
|
||||
//SaveinspectItem
|
||||
await firstFQCService.SaveinspectItem(workorderid,Moudle, checkid,sum);
|
||||
await Clients.All.SendAsync("GetCache", Moudle,checkid, sum);
|
||||
await firstFQCService.SaveinspectItem_v1(workorderid,Moudle, checkid,sum);
|
||||
await Clients.All.SendAsync("GetCache_v1", Moudle,checkid, sum);
|
||||
}
|
||||
else
|
||||
{
|
||||
CacheHelper.SetCache(checkid, 1);
|
||||
logger.Info($"当前保存工单号{workorderid},检测项{checkid},累加的数为1");
|
||||
await firstFQCService.SaveinspectItem(workorderid, Moudle, checkid, 1);
|
||||
await Clients.All.SendAsync("GetCache", Moudle, checkid, 1);
|
||||
await firstFQCService.SaveinspectItem_v1(workorderid, Moudle, checkid, 1);
|
||||
await Clients.All.SendAsync("GetCache_v1", Moudle, checkid, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存油漆缺陷采集累加信息 二检
|
||||
/// </summary>
|
||||
/// <param name="workorderid">工单id</param>
|
||||
/// <param name="checkid">检测项</param>
|
||||
/// <returns></returns>
|
||||
public async Task SaveCacheInformation_v2(string workorderid, string Moudle, string checkid)
|
||||
{
|
||||
checkid = checkid + "_v2";
|
||||
|
||||
if (CacheHelper.Exists(checkid))
|
||||
{
|
||||
int sum = Convert.ToInt32(CacheHelper.GetCache(checkid)) + 1;
|
||||
logger.Info($"当前保存工单号{workorderid},检测项{checkid},累加的数为{sum}");
|
||||
CacheHelper.SetCache(checkid, sum);
|
||||
//SaveinspectItem
|
||||
await firstFQCService.SaveinspectItem_v2(workorderid, Moudle, checkid, sum);
|
||||
await Clients.All.SendAsync("GetCache_v2", Moudle, checkid, sum);
|
||||
}
|
||||
else
|
||||
{
|
||||
CacheHelper.SetCache(checkid, 1);
|
||||
logger.Info($"当前保存工单号{workorderid},检测项{checkid},累加的数为1");
|
||||
await firstFQCService.SaveinspectItem_v2(workorderid, Moudle, checkid, 1);
|
||||
await Clients.All.SendAsync("GetCache_v2", Moudle, checkid, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存油漆缺陷采集累加信息 三检
|
||||
/// </summary>
|
||||
/// <param name="workorderid">工单id</param>
|
||||
/// <param name="checkid">检测项</param>
|
||||
/// <returns></returns>
|
||||
public async Task SaveCacheInformation_v3(string workorderid, string Moudle, string checkid)
|
||||
{
|
||||
checkid = checkid + "_v3";
|
||||
|
||||
if (CacheHelper.Exists(checkid))
|
||||
{
|
||||
int sum = Convert.ToInt32(CacheHelper.GetCache(checkid)) + 1;
|
||||
logger.Info($"当前保存工单号{workorderid},检测项{checkid},累加的数为{sum}");
|
||||
CacheHelper.SetCache(checkid, sum);
|
||||
//SaveinspectItem
|
||||
await firstFQCService.SaveinspectItem_v3(workorderid, Moudle, checkid, sum);
|
||||
await Clients.All.SendAsync("GetCache_v3", Moudle, checkid, sum);
|
||||
}
|
||||
else
|
||||
{
|
||||
CacheHelper.SetCache(checkid, 1);
|
||||
logger.Info($"当前保存工单号{workorderid},检测项{checkid},累加的数为1");
|
||||
await firstFQCService.SaveinspectItem_v3(workorderid, Moudle, checkid, 1);
|
||||
await Clients.All.SendAsync("GetCache_v3", Moudle, checkid, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace ZR.Model.MES.op.DTO
|
||||
{
|
||||
public class QcFqcDTO
|
||||
public class QcFqcDTO
|
||||
{
|
||||
|
||||
public int? Year { get; set; }
|
||||
@ -52,15 +52,15 @@ namespace ZR.Model.MES.op.DTO
|
||||
/// <summary>
|
||||
/// 首检打磨数量
|
||||
///</summary>
|
||||
public string PolishNum01 { get; set; }
|
||||
public int? PolishNum01 { get; set; }
|
||||
/// <summary>
|
||||
/// 首检报废数量
|
||||
///</summary>
|
||||
public string ScrapNum01 { get; set; }
|
||||
public int? ScrapNum01 { get; set; }
|
||||
/// <summary>
|
||||
/// 二检合格数量
|
||||
///</summary>
|
||||
public string QualifiedNum02 { get; set; }
|
||||
public int? QualifiedNum02 { get; set; }
|
||||
/// <summary>
|
||||
/// 二检打磨数量
|
||||
///</summary>
|
||||
@ -72,14 +72,44 @@ namespace ZR.Model.MES.op.DTO
|
||||
/// <summary>
|
||||
/// 三检合格数量
|
||||
///</summary>
|
||||
public string QualifiedNum03 { get; set; }
|
||||
public int? QualifiedNum03 { get; set; }
|
||||
/// <summary>
|
||||
/// 三检打磨数量
|
||||
///</summary>
|
||||
public string PolishNum03 { get; set; }
|
||||
public int? PolishNum03 { get; set; }
|
||||
/// <summary>
|
||||
/// 三检报废数量
|
||||
///</summary>
|
||||
public string ScrapNum03 { get; set; }
|
||||
public int? ScrapNum03 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一次合格数量
|
||||
///</summary>
|
||||
|
||||
public int? FirstgoodNum { get; set; }
|
||||
/// <summary>
|
||||
/// 一次合格率80
|
||||
///</summary>
|
||||
|
||||
public double? FirstgoodRate { get; set; }
|
||||
/// <summary>
|
||||
/// 最终合格数量
|
||||
///</summary>
|
||||
|
||||
public int? FinalgoodNum { get; set; }
|
||||
/// <summary>
|
||||
/// 最终合格率70
|
||||
///</summary>
|
||||
|
||||
public double? FinalgoodRate { get; set; }
|
||||
/// <summary>
|
||||
/// 报废数
|
||||
///</summary>
|
||||
|
||||
public int? ScrapNum { get; set; }
|
||||
/// <summary>
|
||||
/// 报废率70
|
||||
///</summary>
|
||||
public double? ScrapRate { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
61
ZR.Model/MES/qc/QcAgaininspectionRecord.cs
Normal file
61
ZR.Model/MES/qc/QcAgaininspectionRecord.cs
Normal file
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 二检实时记录表
|
||||
///</summary>
|
||||
[SugarTable("qc_againinspection_record")]
|
||||
public class QcAgaininspectionRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// 流水号
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "id", IsPrimaryKey = true)]
|
||||
public string Id { get; set; }
|
||||
/// <summary>
|
||||
/// 工单id
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "fk_workorder_id")]
|
||||
public string FkWorkorderId { get; set; }
|
||||
/// <summary>
|
||||
/// 检测项id
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "fk_inpection_id")]
|
||||
public string FkInpectionId { get; set; }
|
||||
/// <summary>
|
||||
/// 模块
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "InspectionModule")]
|
||||
public string InspectionModule { get; set; }
|
||||
/// <summary>
|
||||
/// 数值
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "counter")]
|
||||
public int? Counter { get; set; }
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "CREATED_BY")]
|
||||
public string CreatedBy { get; set; }
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "CREATED_TIME")]
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "UPDATED_BY")]
|
||||
public string UpdatedBy { get; set; }
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "UPDATED_TIME")]
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
}
|
||||
}
|
||||
61
ZR.Model/MES/qc/QcFinalinspectionRecord.cs
Normal file
61
ZR.Model/MES/qc/QcFinalinspectionRecord.cs
Normal file
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 三检实时记录表
|
||||
///</summary>
|
||||
[SugarTable("qc_finalinspection_record")]
|
||||
public class QcFinalinspectionRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// 流水号
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "id", IsPrimaryKey = true)]
|
||||
public string Id { get; set; }
|
||||
/// <summary>
|
||||
/// 工单id
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "fk_workorder_id")]
|
||||
public string FkWorkorderId { get; set; }
|
||||
/// <summary>
|
||||
/// 检测项id
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "fk_inpection_id")]
|
||||
public string FkInpectionId { get; set; }
|
||||
/// <summary>
|
||||
/// 模块
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "InspectionModule")]
|
||||
public string InspectionModule { get; set; }
|
||||
/// <summary>
|
||||
/// 数值
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "counter")]
|
||||
public int? Counter { get; set; }
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "CREATED_BY")]
|
||||
public string CreatedBy { get; set; }
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "CREATED_TIME")]
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "UPDATED_BY")]
|
||||
public string UpdatedBy { get; set; }
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "UPDATED_TIME")]
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
}
|
||||
}
|
||||
@ -62,17 +62,17 @@ namespace ZR.Model.MES.qc
|
||||
/// 首检打磨数量
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "polishNum01")]
|
||||
public string PolishNum01 { get; set; }
|
||||
public int? PolishNum01 { get; set; }
|
||||
/// <summary>
|
||||
/// 首检报废数量
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "scrapNum01")]
|
||||
public string ScrapNum01 { get; set; }
|
||||
public int? ScrapNum01 { get; set; }
|
||||
/// <summary>
|
||||
/// 二检合格数量
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "qualifiedNum02")]
|
||||
public string QualifiedNum02 { get; set; }
|
||||
public int? QualifiedNum02 { get; set; }
|
||||
/// <summary>
|
||||
/// 二检打磨数量
|
||||
///</summary>
|
||||
@ -87,17 +87,17 @@ namespace ZR.Model.MES.qc
|
||||
/// 三检合格数量
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "qualifiedNum03")]
|
||||
public string QualifiedNum03 { get; set; }
|
||||
public int? QualifiedNum03 { get; set; }
|
||||
/// <summary>
|
||||
/// 三检打磨数量
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "polishNum03")]
|
||||
public string PolishNum03 { get; set; }
|
||||
public int? PolishNum03 { get; set; }
|
||||
/// <summary>
|
||||
/// 三检报废数量
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "scrapNum03")]
|
||||
public string ScrapNum03 { get; set; }
|
||||
public int? ScrapNum03 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一次合格数量
|
||||
@ -108,7 +108,7 @@ namespace ZR.Model.MES.qc
|
||||
/// 一次合格率80
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "firstgoodRate")]
|
||||
public int? FirstgoodRate { get; set; }
|
||||
public double? FirstgoodRate { get; set; }
|
||||
/// <summary>
|
||||
/// 最终合格数量
|
||||
///</summary>
|
||||
@ -118,17 +118,17 @@ namespace ZR.Model.MES.qc
|
||||
/// 最终合格率70
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "finalgoodRate")]
|
||||
public int? FinalgoodRate { get; set; }
|
||||
public double? FinalgoodRate { get; set; }
|
||||
/// <summary>
|
||||
/// 报废数
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "polishNum")]
|
||||
public int? PolishNum { get; set; }
|
||||
[SugarColumn(ColumnName = "scrapNum")]
|
||||
public int? ScrapNum { get; set; }
|
||||
/// <summary>
|
||||
/// 报废率70
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "polishRate")]
|
||||
public int? PolishRate { get; set; }
|
||||
[SugarColumn(ColumnName = "scrapRate")]
|
||||
public double? ScrapRate { get; set; }
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
///</summary>
|
||||
|
||||
@ -71,7 +71,16 @@ namespace ZR.Service.MES.op
|
||||
|
||||
return OpStatisticsDTOList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 质量统计分析表和工单关联一下
|
||||
/// </summary>
|
||||
/// <param name="workorderid"></param>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="week"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
public (List<QcFqcDTO>,int) GueryQualityStatistics(string workorderid ,int pageNum, int pageSize, int year = -1, int week = -1, int date = -1)
|
||||
{
|
||||
var predicate = Expressionable.Create<QcFqcDTO>()
|
||||
@ -79,6 +88,8 @@ namespace ZR.Service.MES.op
|
||||
.AndIF(week > 0, p => p.Week == week)
|
||||
.AndIF(date > 0, p => p.Date == date)
|
||||
.ToExpression();
|
||||
|
||||
|
||||
var predicate2 = Expressionable.Create<QcFqc>()
|
||||
.AndIF(!string.IsNullOrEmpty(workorderid),q=>q.FkWorkorderId== workorderid)
|
||||
.ToExpression();
|
||||
@ -109,6 +120,11 @@ namespace ZR.Service.MES.op
|
||||
QualifiedNum03 = q.QualifiedNum03,
|
||||
PolishNum03 = q.PolishNum03,
|
||||
ScrapNum03 = q.ScrapNum03,
|
||||
FirstgoodNum=q.FirstgoodNum,
|
||||
FirstgoodRate=q.FirstgoodRate,
|
||||
FinalgoodRate=q.FinalgoodRate,
|
||||
FinalgoodNum=q.FinalgoodNum,
|
||||
|
||||
}).MergeTable();
|
||||
|
||||
List<QcFqcDTO> QcFqcDTOList = query5.Where(predicate).ToPageList(pageNum, pageSize,ref totalCount);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@ -12,6 +13,7 @@ using ZR.Model.MES.qc.DTO;
|
||||
using ZR.Model.MES.qu;
|
||||
using ZR.Service.mes.qc.IService;
|
||||
using ZR.Service.mes.qu.IService;
|
||||
using static Microsoft.Extensions.Logging.EventSource.LoggingEventSource;
|
||||
|
||||
namespace ZR.Service.mes.qc
|
||||
{
|
||||
@ -25,7 +27,6 @@ namespace ZR.Service.mes.qc
|
||||
|
||||
|
||||
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();
|
||||
@ -36,28 +37,29 @@ namespace ZR.Service.mes.qc
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存检测结果
|
||||
/// 保存首次检测结果
|
||||
/// </summary>
|
||||
/// <param name="workorder_id"></param>
|
||||
/// <param name="InspectionModule"></param>
|
||||
/// <param name="inspectItem"></param>
|
||||
/// <param name="counter"></param>
|
||||
/// <param name="workorder_id">工单</param>
|
||||
/// <param name="InspectionModule">模块</param>
|
||||
/// <param name="inspectItem">检测项</param>
|
||||
/// <param name="counter">数量</param>
|
||||
/// <returns></returns>
|
||||
public async Task SaveinspectItem(string workorder_id, string InspectionModule, string checkid, int counter)
|
||||
public async Task SaveinspectItem_v1(string workorder_id, string InspectionModule, string checkid, int counter)
|
||||
{
|
||||
//更新实时记录表
|
||||
QcFirstinspectionRecord record = new QcFirstinspectionRecord();
|
||||
record.Id = DateTime.Now.ToString("MMddHHmmss");
|
||||
record.InspectionModule = InspectionModule;
|
||||
record.FKWorkorderId = workorder_id;
|
||||
record.FKInpectionId = checkid;
|
||||
record.FKInpectionId = checkid.Substring(0, 3);
|
||||
record.Counter = counter;
|
||||
record.UpdatedTime = DateTime.Now;
|
||||
var x = Context.Storageable(record)
|
||||
.WhereColumns(it => new {it.FKInpectionId,it.FKWorkorderId,it.InspectionModule })
|
||||
.WhereColumns(it => new { it.FKInpectionId, it.FKWorkorderId, it.InspectionModule })
|
||||
.ToStorage();
|
||||
|
||||
x.AsInsertable.ExecuteCommandAsync(); //执行插入
|
||||
x.AsUpdateable.ExecuteCommandAsync(); //执行更新
|
||||
x.AsInsertable.ExecuteCommandAsync(); //执行插入
|
||||
x.AsUpdateable.ExecuteCommandAsync(); //执行更新
|
||||
|
||||
////更新初检报废表
|
||||
//if (Convert.ToInt32(checkid) / 10 % 10==3)
|
||||
@ -83,10 +85,265 @@ namespace ZR.Service.mes.qc
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存二次检测结果
|
||||
/// </summary>
|
||||
/// <param name="workorder_id">工单</param>
|
||||
/// <param name="InspectionModule">模块</param>
|
||||
/// <param name="inspectItem">检测项</param>
|
||||
/// <param name="counter">数量</param>
|
||||
/// <returns></returns>
|
||||
public async Task SaveinspectItem_v2(string workorder_id, string InspectionModule, string checkid, int counter)
|
||||
{
|
||||
//更新实时记录表
|
||||
QcAgaininspectionRecord record = new QcAgaininspectionRecord();
|
||||
record.Id = DateTime.Now.ToString("MMddHHmmss");
|
||||
record.InspectionModule = InspectionModule;
|
||||
record.FkWorkorderId = workorder_id;
|
||||
record.FkInpectionId = checkid.Substring(0, 3);
|
||||
record.Counter = counter;
|
||||
record.UpdatedTime = DateTime.Now;
|
||||
var x = Context.Storageable(record)
|
||||
.WhereColumns(it => new { it.FkInpectionId, it.FkWorkorderId, it.InspectionModule })
|
||||
.ToStorage();
|
||||
|
||||
x.AsInsertable.ExecuteCommandAsync(); //执行插入
|
||||
x.AsUpdateable.ExecuteCommandAsync(); //执行更新
|
||||
|
||||
////更新初检报废表
|
||||
//if (Convert.ToInt32(checkid) / 10 % 10==3)
|
||||
//{
|
||||
// QcAgaininspectionUselessnum scrap =new QcAgaininspectionUselessnum();
|
||||
// scrap.Id = "scrap" + DateTime.Now.ToString("MMddHHmmss");
|
||||
// scrap.FkInspectionitemId = checkid;
|
||||
// scrap.FkFqcId = "";
|
||||
// scrap.ProductName = "";
|
||||
// scrap.Number= 1;
|
||||
|
||||
|
||||
|
||||
//}
|
||||
|
||||
////更新初检xiazi表
|
||||
//if (Convert.ToInt32(checkid) / 10 % 10 == 1)
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存最终检测结果
|
||||
/// </summary>
|
||||
/// <param name="workorder_id">工单</param>
|
||||
/// <param name="InspectionModule">模块</param>
|
||||
/// <param name="inspectItem">检测项</param>
|
||||
/// <param name="counter">数量</param>
|
||||
/// <returns></returns>
|
||||
public async Task SaveinspectItem_v3(string workorder_id, string InspectionModule, string checkid, int counter)
|
||||
{
|
||||
//更新实时记录表
|
||||
QcFinalinspectionRecord record = new QcFinalinspectionRecord();
|
||||
record.Id = DateTime.Now.ToString("MMddHHmmss");
|
||||
record.InspectionModule = InspectionModule;
|
||||
record.FkWorkorderId = workorder_id;
|
||||
record.FkInpectionId = checkid.Substring(0, 3);
|
||||
record.Counter = counter;
|
||||
record.UpdatedTime = DateTime.Now;
|
||||
var x = Context.Storageable(record)
|
||||
.WhereColumns(it => new { it.FkInpectionId, it.FkWorkorderId, it.InspectionModule })
|
||||
.ToStorage();
|
||||
|
||||
x.AsInsertable.ExecuteCommandAsync(); //执行插入
|
||||
x.AsUpdateable.ExecuteCommandAsync(); //执行更新
|
||||
|
||||
////更新初检报废表
|
||||
//if (Convert.ToInt32(checkid) / 10 % 10==3)
|
||||
//{
|
||||
// QcAgaininspectionUselessnum scrap =new QcAgaininspectionUselessnum();
|
||||
// scrap.Id = "scrap" + DateTime.Now.ToString("MMddHHmmss");
|
||||
// scrap.FkInspectionitemId = checkid;
|
||||
// scrap.FkFqcId = "";
|
||||
// scrap.ProductName = "";
|
||||
// scrap.Number= 1;
|
||||
|
||||
|
||||
|
||||
//}
|
||||
|
||||
////更新初检xiazi表
|
||||
//if (Convert.ToInt32(checkid) / 10 % 10 == 1)
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当产品切换时,完成质量统计分析
|
||||
/// </summary>
|
||||
/// <param name="workorderid">工单</param>
|
||||
/// <param name="productName">产品名称</param>
|
||||
/// <param name="leftRight">左右</param>
|
||||
/// <param name="color">颜色</param>
|
||||
/// <param name="team">班组</param>
|
||||
/// <param name="inputNum">投入数</param>
|
||||
public void quailtyStatics(string workorderid, string productName, string leftRight, string color, string team, int inputNum)
|
||||
{
|
||||
QcFqc record = new QcFqc();
|
||||
record.Id = DateTime.Now.ToString("MMddHHmmss");
|
||||
record.ProductName = productName;
|
||||
record.LeftRight = leftRight;
|
||||
record.Color = color;
|
||||
record.Team = team;
|
||||
|
||||
//TODO 1. 处理首检
|
||||
|
||||
|
||||
//1.1 首检合格数=投入数-抛光数-打磨数-报废数
|
||||
List<QcFirstinspectionRecord> qcFirstinspections = Context.Queryable<QcFirstinspectionRecord>().Where(it => it.FKWorkorderId == workorderid).ToList();
|
||||
|
||||
int NoQualifiedNum01 = 0;
|
||||
qcFirstinspections.ForEach(it =>
|
||||
{
|
||||
NoQualifiedNum01 += (int)it.Counter;
|
||||
|
||||
});
|
||||
record.QualifiedNum01 = inputNum - NoQualifiedNum01;
|
||||
|
||||
|
||||
//1.2 首检抛光数
|
||||
List<QcFirstinspectionRecord> defectNum01RecordList = Context.Queryable<QcFirstinspectionRecord>().Where(it => it.FKWorkorderId == workorderid).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 1 + "_" }).ToList();
|
||||
int defectNum01RecordSum = 0;
|
||||
defectNum01RecordList.ForEach(it =>
|
||||
{
|
||||
defectNum01RecordSum += (int)it.Counter;
|
||||
});
|
||||
record.DefectNum01 = defectNum01RecordSum;
|
||||
|
||||
//1.3 首检打磨数
|
||||
List<QcFirstinspectionRecord> polishNum01RecordList = Context.Queryable<QcFirstinspectionRecord>().Where(it => it.FKWorkorderId == workorderid).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 2 + "_" }).ToList();
|
||||
int polishNum01RecordSum = 0;
|
||||
polishNum01RecordList.ForEach(it =>
|
||||
{
|
||||
polishNum01RecordSum += (int)it.Counter;
|
||||
});
|
||||
record.PolishNum01 = polishNum01RecordSum;
|
||||
|
||||
//1.4 首检报废数
|
||||
List<QcFirstinspectionRecord> scrapNum01RecordList = Context.Queryable<QcFirstinspectionRecord>().Where(it => it.FKWorkorderId == workorderid).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 3 + "_" }).ToList();
|
||||
int scrapNum01RecordSum = 0;
|
||||
scrapNum01RecordList.ForEach(it =>
|
||||
{
|
||||
scrapNum01RecordSum += (int)it.Counter;
|
||||
});
|
||||
record.PolishNum01 = scrapNum01RecordSum;
|
||||
|
||||
|
||||
//TODO 2. 处理二检
|
||||
|
||||
//2.1 二检的合格数 = 首检的抛光数 - 二检打磨 - 二检报废
|
||||
List<QcAgaininspectionRecord> qcAgaininspections = Context.Queryable<QcAgaininspectionRecord>().Where(it => it.FkWorkorderId == workorderid).ToList();
|
||||
|
||||
int NoQualifiedNum02 = 0;
|
||||
qcAgaininspections.ForEach(it =>
|
||||
{
|
||||
NoQualifiedNum02 += (int)it.Counter;
|
||||
|
||||
});
|
||||
record.QualifiedNum02 = defectNum01RecordSum - NoQualifiedNum02;
|
||||
|
||||
//2.2 二检打磨数
|
||||
List<QcAgaininspectionRecord> polishNum02RecordList = Context.Queryable<QcAgaininspectionRecord>().Where(it => it.FkWorkorderId == workorderid).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 2 + "_" }).ToList();
|
||||
int polishNum02RecordSum = 0;
|
||||
|
||||
polishNum02RecordList.ForEach(it =>
|
||||
{
|
||||
polishNum02RecordSum += (int)it.Counter;
|
||||
});
|
||||
record.PolishNum02 = polishNum02RecordSum;
|
||||
|
||||
|
||||
//2.3 二检报废
|
||||
List<QcAgaininspectionRecord> scrapNum02RecordList = Context.Queryable<QcAgaininspectionRecord>().Where(it => it.FkWorkorderId == workorderid).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 3 + "_" }).ToList();
|
||||
int scrapNum02RecordSum = 0;
|
||||
scrapNum02RecordList.ForEach(it =>
|
||||
{
|
||||
scrapNum02RecordSum += (int)it.Counter;
|
||||
});
|
||||
record.ScrapNum02 = scrapNum02RecordSum;
|
||||
|
||||
|
||||
//TODO 3. 处理三检
|
||||
// 3.1 三检合格数=(一检合格数 + 二检合格数) - (三检打磨数+三检报废数)
|
||||
|
||||
List<QcFinalinspectionRecord> qcFinalinspections = Context.Queryable<QcFinalinspectionRecord>().Where(it => it.FkWorkorderId == workorderid).ToList();
|
||||
|
||||
int NoQualifiedNum03 = 0;
|
||||
qcAgaininspections.ForEach(it =>
|
||||
{
|
||||
NoQualifiedNum03 += (int)it.Counter;
|
||||
|
||||
});
|
||||
|
||||
record.QualifiedNum03 = (record.QualifiedNum01 + record.QualifiedNum02) - NoQualifiedNum03;
|
||||
|
||||
//3.2 三检打磨数
|
||||
List<QcFinalinspectionRecord> polishNum03RecordList = Context.Queryable<QcFinalinspectionRecord>().Where(it => it.FkWorkorderId == workorderid).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 2 + "_" }).ToList();
|
||||
int polishNum03RecordSum = 0;
|
||||
|
||||
polishNum03RecordList.ForEach(it =>
|
||||
{
|
||||
polishNum03RecordSum += (int)it.Counter;
|
||||
});
|
||||
record.PolishNum03 = polishNum03RecordSum;
|
||||
|
||||
//3.3 三检报废数
|
||||
|
||||
List<QcFinalinspectionRecord> scrapNum03RecordList = Context.Queryable<QcFinalinspectionRecord>().Where(it => it.FkWorkorderId == workorderid).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 3 + "_" }).ToList();
|
||||
int scrapNum03RecordSum = 0;
|
||||
scrapNum03RecordList.ForEach(it =>
|
||||
{
|
||||
scrapNum03RecordSum += (int)it.Counter;
|
||||
});
|
||||
record.ScrapNum03 = scrapNum03RecordSum;
|
||||
|
||||
//TODO 4 统计分析
|
||||
|
||||
// 4.1 一次合格率
|
||||
record.FirstgoodNum = record.QualifiedNum01;
|
||||
record.FirstgoodRate = CalculatePercentage((int)record.FirstgoodNum, inputNum);
|
||||
// 4.2 最终合格率
|
||||
record.FinalgoodNum = record.QualifiedNum03 / inputNum;
|
||||
record.FinalgoodRate = CalculatePercentage((int)record.FinalgoodNum, inputNum);
|
||||
// 4.3 报废率
|
||||
record.ScrapNum = record.ScrapNum01 + record.ScrapNum02 + record.ScrapNum03;
|
||||
record.ScrapRate = CalculatePercentage((int)record.ScrapNum, inputNum);
|
||||
|
||||
record.CreatedTime = DateTime.Now;
|
||||
Context.Insertable<QcFqc>(record).ExecuteCommand();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 计算百分比
|
||||
/// </summary>
|
||||
/// <param name="num1"></param>
|
||||
/// <param name="num2"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
static double CalculatePercentage(int num1, int num2)
|
||||
{
|
||||
double percentage = ((double)num1 / num2) * 100;
|
||||
return Math.Round(percentage, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,8 @@ namespace ZR.Service.mes.qc.IService
|
||||
public interface IFirstFQCService
|
||||
{
|
||||
public CheckItemTableDTO GetCheckItemTable();
|
||||
public Task SaveinspectItem(string workorder_id, string InspectionModule, string checkid, int counter);
|
||||
public Task SaveinspectItem_v1(string workorder_id, string InspectionModule, string checkid, int counter);
|
||||
public Task SaveinspectItem_v2(string workorder_id, string InspectionModule, string checkid, int counter);
|
||||
public Task SaveinspectItem_v3(string workorder_id, string InspectionModule, string checkid, int counter);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user