质量大屏添加合格率,描述排序,新增一个标签解析
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using System;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
|
||||
@@ -34,7 +34,8 @@ namespace ZR.Service.Utils
|
||||
string quantity = "";
|
||||
string batchCode = "";
|
||||
// 判断解析是否成功
|
||||
if (!partnumberMatch.Success) {
|
||||
if (!partnumberMatch.Success)
|
||||
{
|
||||
throw new Exception("解析零件号失败");
|
||||
}
|
||||
if (!quantityMatch.Success)
|
||||
@@ -52,16 +53,18 @@ namespace ZR.Service.Utils
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
throw new Exception("解析失败" + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//解析外箱标签码
|
||||
public ResultionPackageCodeDto ResolutionPackage(string code)
|
||||
{
|
||||
// 德国大众
|
||||
if (code.Contains("MX2D") && code.Contains("MLX"))
|
||||
{
|
||||
return ResolutionPackagecode3(code);
|
||||
}
|
||||
if (code.Contains('^'))
|
||||
{
|
||||
// 初步进行解析检测,增加解析成功率
|
||||
@@ -109,12 +112,18 @@ namespace ZR.Service.Utils
|
||||
string workoderidid = splitstr[2].Substring(7);
|
||||
resultionPackageCode.WorkoderID = workoderidid;
|
||||
// 解析生产时间 工单号生产时间提取
|
||||
resultionPackageCode.ProductionTime = string.Concat("20", workoderidid.AsSpan(0, 6));
|
||||
resultionPackageCode.ProductionTime = string.Concat(
|
||||
"20",
|
||||
workoderidid.AsSpan(0, 6)
|
||||
);
|
||||
// 解析箱子中产品数量
|
||||
string product_num = splitstr[3].Substring(4);
|
||||
resultionPackageCode.Quantity = int.Parse(product_num);
|
||||
// 解析产品描述 partnumber 从物料列表抓取数据
|
||||
WmMaterial material = Context.Queryable<WmMaterial>().Where(it => it.Partnumber == partnumber).First();
|
||||
WmMaterial material = Context
|
||||
.Queryable<WmMaterial>()
|
||||
.Where(it => it.Partnumber == partnumber)
|
||||
.First();
|
||||
if (material == null)
|
||||
{
|
||||
resultionPackageCode.ProductionDescribe = "物料记录未录入此零件号信息!";
|
||||
@@ -138,7 +147,12 @@ namespace ZR.Service.Utils
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// 2-解析门把手
|
||||
|
||||
/// <summary>
|
||||
/// 2-解析门把手
|
||||
/// </summary>
|
||||
/// <param name="packagecode"></param>
|
||||
/// <returns></returns>
|
||||
private ResultionPackageCodeDto ResolutionPackagecode2(string packagecode)
|
||||
{
|
||||
ResultionPackageCodeDto resultionPackageCode = new ResultionPackageCodeDto();
|
||||
@@ -162,7 +176,10 @@ namespace ZR.Service.Utils
|
||||
string product_num = splitstr[4].Substring(3);
|
||||
resultionPackageCode.Quantity = int.Parse(product_num);
|
||||
// 解析产品描述 partnumber 从物料列表抓取数据
|
||||
WmMaterial material = Context.Queryable<WmMaterial>().Where(it => it.Partnumber == partnumber).First();
|
||||
WmMaterial material = Context
|
||||
.Queryable<WmMaterial>()
|
||||
.Where(it => it.Partnumber == partnumber)
|
||||
.First();
|
||||
if (material == null)
|
||||
{
|
||||
resultionPackageCode.ProductionDescribe = "物料记录未录入此零件号信息!";
|
||||
@@ -191,5 +208,100 @@ namespace ZR.Service.Utils
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 3-解析德国大众标签
|
||||
/// </summary>
|
||||
/// <param name="packagecode">原始标签码</param>
|
||||
/// <returns></returns>
|
||||
private ResultionPackageCodeDto ResolutionPackagecode3(string packagecode)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 定义正则表达式模式
|
||||
string partnumberPattern = @"1P(\d+)Q"; // 产品零件号
|
||||
string quantityPattern = @"Q(\d+)S"; // 产品数量
|
||||
string batchCodePattern = @"S(\d+)13Q"; // 批次号(工单号)
|
||||
string serialNumberPattern = @"13Q(\d+)B"; // 流水号
|
||||
string productionTimePattern = @"12D(\d+)4L"; // 生产日期
|
||||
// 使用正则表达式进行匹配
|
||||
Match partnumberMatch = Regex.Match(packagecode, partnumberPattern);
|
||||
Match quantityMatch = Regex.Match(packagecode, quantityPattern);
|
||||
Match batchCodeMatch = Regex.Match(packagecode, batchCodePattern);
|
||||
Match serialNumberMatch = Regex.Match(packagecode, serialNumberPattern);
|
||||
Match productionTimeMatch = Regex.Match(packagecode, productionTimePattern);
|
||||
// 创建接收
|
||||
string partnumber = "";
|
||||
string quantityStr = "";
|
||||
string batchCode = "";
|
||||
string serialNumber = "";
|
||||
string productionTime = "";
|
||||
// 判断解析是否成功
|
||||
if (!partnumberMatch.Success)
|
||||
{
|
||||
throw new Exception("解析零件号失败");
|
||||
}
|
||||
if (!quantityMatch.Success)
|
||||
{
|
||||
throw new Exception("解析产品数量失败");
|
||||
}
|
||||
if (!batchCodeMatch.Success)
|
||||
{
|
||||
throw new Exception("解析产品批次号失败");
|
||||
}
|
||||
if (!serialNumberMatch.Success)
|
||||
{
|
||||
throw new Exception("解析产品流水号失败");
|
||||
}
|
||||
if (!productionTimeMatch.Success)
|
||||
{
|
||||
throw new Exception("解析产品生产日期失败");
|
||||
}
|
||||
partnumber = partnumberMatch.Groups[1].Value;
|
||||
quantityStr = quantityMatch.Groups[1].Value.TrimStart('0');
|
||||
batchCode = batchCodeMatch.Groups[1].Value.TrimStart('0');
|
||||
serialNumber = serialNumberMatch.Groups[1].Value.TrimStart('0');
|
||||
productionTime = productionTimeMatch.Groups[1].Value;
|
||||
string PatchCode = "BNW" + batchCode + '_' + serialNumber;
|
||||
string WorkoderID = batchCode;
|
||||
string ProductionTime = productionTime;
|
||||
bool isSuccess1 = int.TryParse(quantityStr, out int quantity);
|
||||
if (!isSuccess1)
|
||||
{
|
||||
quantity = 0;
|
||||
}
|
||||
// 产品描述
|
||||
string ProductionDescribe = "";
|
||||
WmMaterial material = Context
|
||||
.Queryable<WmMaterial>()
|
||||
.Where(it => it.Partnumber == partnumber)
|
||||
.Where(it => it.Type == 1)
|
||||
.Where(it => it.Status == 1)
|
||||
.First();
|
||||
if (material != null)
|
||||
{
|
||||
ProductionDescribe = !string.IsNullOrEmpty(material.Description)
|
||||
? material.Description
|
||||
: material.ProductName;
|
||||
}
|
||||
ResultionPackageCodeDto resultionPackageCode =
|
||||
new()
|
||||
{
|
||||
originalCode = packagecode,
|
||||
PatchCode = PatchCode,
|
||||
WorkoderID = WorkoderID,
|
||||
PartNumner = partnumber,
|
||||
ProductionTime = ProductionTime,
|
||||
Quantity = quantity,
|
||||
Team = "",
|
||||
ProductionDescribe = ProductionDescribe,
|
||||
Remark = "德国大众",
|
||||
};
|
||||
return resultionPackageCode;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new Exception("解析失败" + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1509,6 +1509,7 @@ namespace ZR.Service.mes.qc
|
||||
{
|
||||
if (!string.IsNullOrEmpty(workorderID))
|
||||
{
|
||||
// 开始时间
|
||||
ProWorkordertimeStep step = Context
|
||||
.Queryable<ProWorkordertimeStep>()
|
||||
.Where(it => it.WorkoderId == workorderID)
|
||||
@@ -1538,6 +1539,10 @@ namespace ZR.Service.mes.qc
|
||||
first.StartTime = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("工单不存在!");
|
||||
}
|
||||
|
||||
first.Team = team;
|
||||
first.EndTime = DateTime.Now;
|
||||
@@ -1723,8 +1728,6 @@ namespace ZR.Service.mes.qc
|
||||
first.UpdatedTime = DateTime.Now;
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 打磨
|
||||
QcQualityStatisticsFirst first2 = new QcQualityStatisticsFirst();
|
||||
first2.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
@@ -1933,7 +1936,6 @@ namespace ZR.Service.mes.qc
|
||||
first2.UpdatedTime = DateTime.Now;
|
||||
#endregion
|
||||
|
||||
|
||||
#region 报废
|
||||
QcQualityStatisticsFirst first3 = new QcQualityStatisticsFirst();
|
||||
first3.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
@@ -2144,7 +2146,6 @@ namespace ZR.Service.mes.qc
|
||||
first3.UpdatedTime = DateTime.Now;
|
||||
#endregion
|
||||
|
||||
|
||||
#region 计算汇总
|
||||
int qualifiedNumber_No_all = paoguang_total + damo_total + baofei_total;
|
||||
|
||||
@@ -2211,12 +2212,10 @@ namespace ZR.Service.mes.qc
|
||||
x3.AsInsertable.ExecuteCommand(); //不存在插入
|
||||
x3.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand(); //存在更新
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
#region 二检
|
||||
|
||||
|
||||
#region 二检
|
||||
#region 打磨
|
||||
QcQualityStatisticsAgain again2 = new QcQualityStatisticsAgain();
|
||||
again2.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
@@ -2427,6 +2426,7 @@ namespace ZR.Service.mes.qc
|
||||
again2.UpdatedTime = DateTime.Now;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 报废
|
||||
QcQualityStatisticsAgain again3 = new QcQualityStatisticsAgain();
|
||||
again3.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
@@ -2666,6 +2666,7 @@ namespace ZR.Service.mes.qc
|
||||
again3.UpdatedTime = DateTime.Now;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 计算汇总
|
||||
int qualifiedNumber_No_all_again = damo_total_again + baofei_total_again3;
|
||||
|
||||
@@ -2712,11 +2713,190 @@ namespace ZR.Service.mes.qc
|
||||
x_again_3.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand(); //存在更新
|
||||
#endregion
|
||||
|
||||
|
||||
#endregion
|
||||
#region 三检
|
||||
|
||||
|
||||
|
||||
#region 三检
|
||||
#region 三捡-抛光
|
||||
QcQualityStatisticsFinal final1 = new QcQualityStatisticsFinal();
|
||||
final1.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
final1.WorkorderId = workorderID;
|
||||
if (workorder_item != null)
|
||||
{
|
||||
final1.Color = workorder_item?.Colour;
|
||||
final1.FinishedPartNumber = workorder_item.FinishedPartNumber;
|
||||
final1.ProductDescription = workorder_item.ProductDescription;
|
||||
final1.RequireNumber = first.QualifiedNumber + again2.QualifiedNumber;
|
||||
if (step != null)
|
||||
{
|
||||
final1.StartTime = step.FirstInspectTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
final1.StartTime = null;
|
||||
}
|
||||
}
|
||||
|
||||
final1.Team = team;
|
||||
final1.EndTime = DateTime.Now;
|
||||
final1.Remark = "抛光";
|
||||
final1.Remark2 = 1;
|
||||
// 三检抛光总数
|
||||
int paoguang_final = 0;
|
||||
List<QcFinalinspectionRecord> finalrecordList = Context
|
||||
.Queryable<QcFinalinspectionRecord>()
|
||||
.Where(it => it.FkWorkorderId == workorderID)
|
||||
.Where(it => SqlFunc.Contains(it.FkInpectionId, "_1_"))
|
||||
.ToList();
|
||||
paoguang_final =
|
||||
Context
|
||||
.Queryable<QcFinalinspectionRecord>()
|
||||
.Where(it => it.FkWorkorderId == workorderID)
|
||||
.Where(it => SqlFunc.Contains(it.FkInpectionId, "_1_"))
|
||||
.Sum(it => it.Counter) ?? 0;
|
||||
|
||||
if (finalrecordList != null && finalrecordList.Count > 0)
|
||||
{
|
||||
foreach (QcFinalinspectionRecord fianlRecord in finalrecordList)
|
||||
{
|
||||
if (fianlRecord.FkInpectionId == "111")
|
||||
{
|
||||
final1.PaintSuokong = fianlRecord.Counter;
|
||||
}
|
||||
|
||||
if (fianlRecord.FkInpectionId == "112")
|
||||
{
|
||||
final1.PaintZhengkong = fianlRecord.Counter;
|
||||
}
|
||||
|
||||
if (fianlRecord.FkInpectionId == "113")
|
||||
{
|
||||
final1.PaintShiguang = fianlRecord.Counter;
|
||||
}
|
||||
|
||||
if (fianlRecord.FkInpectionId == "114")
|
||||
{
|
||||
final1.PaintSecha = fianlRecord.Counter;
|
||||
}
|
||||
|
||||
if (fianlRecord.FkInpectionId == "115")
|
||||
{
|
||||
final1.PaintDianzi = fianlRecord.Counter;
|
||||
}
|
||||
|
||||
if (fianlRecord.FkInpectionId == "116")
|
||||
{
|
||||
final1.PaintOther = fianlRecord.Counter;
|
||||
}
|
||||
|
||||
if (fianlRecord.FkInpectionId == "211")
|
||||
{
|
||||
final1.DeviceShuiban = fianlRecord.Counter;
|
||||
}
|
||||
|
||||
if (fianlRecord.FkInpectionId == "212")
|
||||
{
|
||||
final1.DeviceZandian = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "213")
|
||||
{
|
||||
final1.DeviceBianxing = fianlRecord.Counter;
|
||||
}
|
||||
|
||||
if (fianlRecord.FkInpectionId == "214")
|
||||
{
|
||||
final1.DeviceYouzhu = fianlRecord.Counter;
|
||||
}
|
||||
|
||||
if (fianlRecord.FkInpectionId == "215")
|
||||
{
|
||||
final1.DeviceTuoluo = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "216")
|
||||
{
|
||||
final1.DeviceZhuangshang = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "217")
|
||||
{
|
||||
final1.DeviceOther = fianlRecord.Counter;
|
||||
}
|
||||
|
||||
if (fianlRecord.FkInpectionId == "311")
|
||||
{
|
||||
final1.BlankMaoci = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "312")
|
||||
{
|
||||
final1.BlankSuoyin = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "313")
|
||||
{
|
||||
final1.BlankCanshuang = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "314")
|
||||
{
|
||||
final1.BlankShaying = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "315")
|
||||
{
|
||||
final1.BlankZangdian = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "316")
|
||||
{
|
||||
final1.BlankDamo = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "411")
|
||||
{
|
||||
final1.ProgramLiuguang = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "412")
|
||||
{
|
||||
final1.ProgramSeqiqueqi = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "413")
|
||||
{
|
||||
final1.ProgramQingqiqueqi = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "414")
|
||||
{
|
||||
final1.ProgramJupi = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "415")
|
||||
{
|
||||
final1.ProgramOther = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "511")
|
||||
{
|
||||
final1.TeamTuoluocanshuang = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "512")
|
||||
{
|
||||
final1.TeamQingqiqikuai = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "513")
|
||||
{
|
||||
final1.TeamSeqiqikuai = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "514")
|
||||
{
|
||||
final1.TeamFahua = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "515")
|
||||
{
|
||||
final1.TeamLiangbang = fianlRecord.Counter;
|
||||
}
|
||||
if (fianlRecord.FkInpectionId == "516")
|
||||
{
|
||||
final1.TeamPenglou = fianlRecord.Counter;
|
||||
}
|
||||
}
|
||||
}
|
||||
final1.PaoguangTotal = paoguang_final;
|
||||
final1.CreatedTime = DateTime.Now;
|
||||
final1.UpdatedTime = DateTime.Now;
|
||||
#endregion
|
||||
|
||||
#region 打磨
|
||||
QcQualityStatisticsFinal final2 = new QcQualityStatisticsFinal();
|
||||
final2.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
@@ -2809,7 +2989,7 @@ namespace ZR.Service.mes.qc
|
||||
}
|
||||
if (finalrecordList2[i].FkInpectionId == "223")
|
||||
{
|
||||
first2.DeviceBianxing = finalrecordList2[i].Counter;
|
||||
final2.DeviceBianxing = finalrecordList2[i].Counter;
|
||||
damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter;
|
||||
}
|
||||
|
||||
@@ -2918,7 +3098,7 @@ namespace ZR.Service.mes.qc
|
||||
if (finalrecordList2[i].FkInpectionId == "526")
|
||||
{
|
||||
final2.TeamPenglou = finalrecordList2[i].Counter;
|
||||
damo_total_again = damo_total_again + (int)finalrecordList2[i].Counter;
|
||||
damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2927,6 +3107,7 @@ namespace ZR.Service.mes.qc
|
||||
final2.UpdatedTime = DateTime.Now;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 报废
|
||||
QcQualityStatisticsFinal final3 = new QcQualityStatisticsFinal();
|
||||
final3.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
@@ -2959,11 +3140,10 @@ namespace ZR.Service.mes.qc
|
||||
final3.Remark = "报废";
|
||||
final3.Remark2 = 3;
|
||||
int baofei_total_final = 0;
|
||||
|
||||
List<QcFinalinspectionRecord> finalrecordList3 = Context
|
||||
.Queryable<QcFinalinspectionRecord>()
|
||||
.Where(it => it.FkWorkorderId == workorderID)
|
||||
.Where(it => SqlFunc.Contains(it.FkWorkorderId, "_3_"))
|
||||
.Where(it => SqlFunc.Contains(it.FkInpectionId, "_3_"))
|
||||
.ToList();
|
||||
if (finalrecordList3 != null && finalrecordList3.Count > 0)
|
||||
{
|
||||
@@ -3166,20 +3346,48 @@ namespace ZR.Service.mes.qc
|
||||
final3.UpdatedTime = DateTime.Now;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 计算汇总
|
||||
int qualifiedNumber_No_all_final = baofei_total_final + damo_total_final;
|
||||
// 抛光表格插入
|
||||
final1.QualifiedNumber = final1.RequireNumber - qualifiedNumber_No_all_final;
|
||||
if (final1.RequireNumber == 0)
|
||||
{
|
||||
final1.QualifiedRate = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
final1.QualifiedRate = Math.Round(
|
||||
((decimal)final1.QualifiedNumber / (decimal)final1.RequireNumber) * 100,
|
||||
3
|
||||
);
|
||||
}
|
||||
|
||||
final1.PaoguangTotal = paoguang_final;
|
||||
final1.DamoTotal = damo_total_final;
|
||||
final1.BaofeiTotal = baofei_total_final;
|
||||
|
||||
var x_final_1 = Context
|
||||
.Storageable(final1)
|
||||
.WhereColumns(it => new { it.WorkorderId, it.Remark2 })
|
||||
.ToStorage();
|
||||
x_final_1.AsInsertable.ExecuteCommand(); //不存在插入
|
||||
x_final_1.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand(); //存在更新
|
||||
// 打磨表格插入
|
||||
final2.QualifiedNumber = final3.RequireNumber - qualifiedNumber_No_all_final;
|
||||
if (final2.RequireNumber == 0)
|
||||
{
|
||||
final2.QualifiedNumber = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
final2.QualifiedRate = Math.Round(
|
||||
((decimal)final2.QualifiedNumber / (decimal)final2.RequireNumber) * 100,
|
||||
3
|
||||
);
|
||||
}
|
||||
|
||||
final2.PaoguangTotal = paoguang_final;
|
||||
final2.DamoTotal = damo_total_final;
|
||||
final2.BaofeiTotal = baofei_total_final;
|
||||
|
||||
@@ -3189,13 +3397,20 @@ namespace ZR.Service.mes.qc
|
||||
.ToStorage();
|
||||
x_final_2.AsInsertable.ExecuteCommand(); //不存在插入
|
||||
x_final_2.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand(); //存在更新
|
||||
|
||||
// 报废表格插入
|
||||
final3.QualifiedNumber = final3.RequireNumber - qualifiedNumber_No_all_final;
|
||||
final3.QualifiedRate = Math.Round(
|
||||
((decimal)final3.QualifiedNumber / (decimal)final3.RequireNumber) * 100,
|
||||
3
|
||||
);
|
||||
|
||||
if (final3.RequireNumber == 0)
|
||||
{
|
||||
final3.QualifiedNumber = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
final3.QualifiedRate = Math.Round(
|
||||
((decimal)final3.QualifiedNumber / (decimal)final3.RequireNumber) * 100,
|
||||
3
|
||||
);
|
||||
}
|
||||
final3.PaoguangTotal = paoguang_final;
|
||||
final3.DamoTotal = damo_total_final;
|
||||
final3.BaofeiTotal = baofei_total_final;
|
||||
|
||||
@@ -3206,17 +3421,80 @@ namespace ZR.Service.mes.qc
|
||||
x_final_3.AsInsertable.ExecuteCommand(); //不存在插入
|
||||
x_final_3.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand(); //存在更新
|
||||
#endregion
|
||||
|
||||
|
||||
#endregion
|
||||
#region 总报表
|
||||
|
||||
#region 抛光 将首检的抛光和包装三检的抛光合并
|
||||
QcQualityStatisticsTotal total1 = new QcQualityStatisticsTotal();
|
||||
total1.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
total1.WorkorderId = workorderID;
|
||||
total1.FinishedPartNumber = workorder_item.FinishedPartNumber;
|
||||
total1.ProductDescription = workorder_item.ProductDescription;
|
||||
total1.Color = workorder_item.Colour;
|
||||
//XXX:修改生产投入数为首检生产投入数 workorder_item
|
||||
// total2.RequireNumber = again2.RequireNumber;
|
||||
total1.RequireNumber = workorder_item.PreviousNumber;
|
||||
if (step != null)
|
||||
{
|
||||
total1.StartTime = step.FirstInspectTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
total1.StartTime = DateTime.Now;
|
||||
}
|
||||
total1.Team = team;
|
||||
total1.EndTime = DateTime.Now;
|
||||
total1.Remark = "抛光";
|
||||
total1.Remark2 = 1;
|
||||
total1.PaintSuokong = (final1.PaintSuokong ?? 0) + (first.PaintSuokong ?? 0);
|
||||
total1.PaintZhengkong = (final1.PaintZhengkong ?? 0) + (first.PaintZhengkong ?? 0);
|
||||
total1.PaintShiguang = (final1.PaintShiguang ?? 0) + (first.PaintShiguang ?? 0);
|
||||
total1.PaintSecha = (final1.PaintSecha ?? 0) + (first.PaintSecha ?? 0);
|
||||
total1.PaintDianzi = (final1.PaintDianzi ?? 0) + (first.PaintDianzi ?? 0);
|
||||
total1.DeviceShuiban = (final1.DeviceShuiban ?? 0) + (first.DeviceShuiban ?? 0);
|
||||
total1.PaintOther = (final1.PaintOther ?? 0) + (first.PaintOther ?? 0);
|
||||
total1.DeviceZandian = (final1.DeviceZandian ?? 0) + (first.DeviceZandian ?? 0);
|
||||
total1.DeviceBianxing = (final1.DeviceBianxing ?? 0) + (first.DeviceBianxing ?? 0);
|
||||
total1.DeviceYouzhu = (final1.DeviceYouzhu ?? 0) + (first.DeviceYouzhu ?? 0);
|
||||
total1.DeviceTuoluo = (final1.DeviceTuoluo ?? 0) + (first.DeviceTuoluo ?? 0);
|
||||
total1.DeviceZhuangshang =
|
||||
(final1.DeviceZhuangshang ?? 0) + (first.DeviceZhuangshang ?? 0);
|
||||
total1.DeviceOther = final1.DeviceOther ?? 0 + first.DeviceOther ?? 0;
|
||||
total1.BlankMaoci = (final1.BlankMaoci ?? 0) + (first.BlankMaoci ?? 0);
|
||||
total1.BlankSuoyin = (final1.BlankSuoyin ?? 0) + (first.BlankSuoyin ?? 0);
|
||||
total1.BlankCanshuang = (final1.BlankCanshuang ?? 0) + (first.BlankCanshuang ?? 0);
|
||||
total1.BlankShaying = (final1.BlankShaying ?? 0) + (first.BlankShaying ?? 0);
|
||||
total1.BlankZangdian = (final1.BlankZangdian ?? 0) + (first.BlankZangdian ?? 0);
|
||||
total1.BlankDamo = (final1.BlankDamo ?? 0) + (first.BlankDamo ?? 0);
|
||||
total1.ProgramLiuguang =
|
||||
(final1.ProgramLiuguang ?? 0) + (first.ProgramLiuguang ?? 0);
|
||||
total1.ProgramSeqiqueqi =
|
||||
(final1.ProgramSeqiqueqi ?? 0) + (first.ProgramSeqiqueqi ?? 0);
|
||||
total1.ProgramQingqiqueqi =
|
||||
(final1.ProgramQingqiqueqi ?? 0) + (first.ProgramQingqiqueqi ?? 0);
|
||||
total1.ProgramJupi = (final1.ProgramJupi ?? 0) + (first.ProgramJupi ?? 0);
|
||||
total1.TeamTuoluocanshuang =
|
||||
(final1.TeamTuoluocanshuang ?? 0) + (first.TeamTuoluocanshuang ?? 0);
|
||||
total1.ProgramOther = (final1.ProgramOther ?? 0) + (first.ProgramOther ?? 0);
|
||||
total1.TeamQingqiqikuai =
|
||||
(final1.TeamQingqiqikuai ?? 0) + (first.TeamQingqiqikuai ?? 0);
|
||||
total1.TeamSeqiqikuai = (final1.TeamSeqiqikuai ?? 0) + (first.TeamSeqiqikuai ?? 0);
|
||||
total1.TeamFahua = (final1.TeamFahua ?? 0) + (first.TeamFahua ?? 0);
|
||||
total1.TeamLiangbang = (final1.TeamLiangbang ?? 0) + (first.TeamLiangbang ?? 0);
|
||||
total1.TeamPenglou = (final1.TeamPenglou ?? 0) + (first.TeamPenglou ?? 0);
|
||||
|
||||
total1.CreatedTime = DateTime.Now;
|
||||
total1.UpdatedTime = DateTime.Now;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 打磨 将二检的打磨和三检的打磨合并
|
||||
QcQualityStatisticsTotal total2 = new QcQualityStatisticsTotal();
|
||||
total2.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
total2.WorkorderId = workorderID;
|
||||
|
||||
total2.FinishedPartNumber = again2.FinishedPartNumber;
|
||||
total2.ProductDescription = again2.ProductDescription;
|
||||
total2.FinishedPartNumber = workorder_item.FinishedPartNumber;
|
||||
total2.ProductDescription = workorder_item.ProductDescription;
|
||||
total2.Color = workorder_item.Colour;
|
||||
//XXX:修改生产投入数为首检生产投入数 workorder_item
|
||||
// total2.RequireNumber = again2.RequireNumber;
|
||||
total2.RequireNumber = workorder_item.PreviousNumber;
|
||||
@@ -3226,7 +3504,7 @@ namespace ZR.Service.mes.qc
|
||||
}
|
||||
else
|
||||
{
|
||||
total2.StartTime = null;
|
||||
total2.StartTime = DateTime.Now;
|
||||
}
|
||||
|
||||
total2.Team = team;
|
||||
@@ -3364,7 +3642,7 @@ namespace ZR.Service.mes.qc
|
||||
}
|
||||
else
|
||||
{
|
||||
total3.StartTime = null;
|
||||
total3.StartTime = DateTime.Now;
|
||||
}
|
||||
|
||||
total3.Team = team;
|
||||
@@ -3494,6 +3772,32 @@ namespace ZR.Service.mes.qc
|
||||
+ qualifiedNumber_No_all_final;
|
||||
//XXX:修改合格数公式:包装数
|
||||
// total2.QualifiedNumber = (again2.RequireNumber ?? 0) - qualifiedNumber_No_all_total;
|
||||
|
||||
|
||||
// 总报表-抛光记录插入
|
||||
total1.QualifiedNumber = final1.QualifiedNumber;
|
||||
if (total1.RequireNumber == 0)
|
||||
{
|
||||
total1.QualifiedRate = 0;
|
||||
}
|
||||
else
|
||||
total1.QualifiedRate = Math.Round(
|
||||
((decimal)total1.QualifiedNumber / (decimal)total1.RequireNumber) * 100,
|
||||
3
|
||||
);
|
||||
// XXX:修改总报表打磨,报废数计算公式
|
||||
total1.PaoguangTotal = first.PaoguangTotal + final1.PaoguangTotal;
|
||||
total1.DamoTotal = damo_total + damo_total_again + damo_total_final;
|
||||
total1.BaofeiTotal = baofei_total + baofei_total_again3 + baofei_total_final;
|
||||
var x_total_1 = Context
|
||||
.Storageable(total1)
|
||||
.WhereColumns(it => new { it.WorkorderId, it.Remark2 })
|
||||
.ToStorage();
|
||||
x_total_1.AsInsertable.ExecuteCommand(); //不存在插入
|
||||
x_total_1.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand(); //存在更新
|
||||
|
||||
// 总报表-打磨记录插入
|
||||
|
||||
total2.QualifiedNumber = final2.QualifiedNumber;
|
||||
if (total2.RequireNumber == 0)
|
||||
{
|
||||
@@ -3505,6 +3809,7 @@ namespace ZR.Service.mes.qc
|
||||
3
|
||||
);
|
||||
// XXX:修改总报表打磨,报废数计算公式
|
||||
total2.PaoguangTotal = first.PaoguangTotal + final1.PaoguangTotal;
|
||||
total2.DamoTotal = damo_total + damo_total_again + damo_total_final;
|
||||
total2.BaofeiTotal = baofei_total + baofei_total_again3 + baofei_total_final;
|
||||
// total2.DamoTotal = damo_total_again + damo_total_final;
|
||||
@@ -3517,6 +3822,8 @@ namespace ZR.Service.mes.qc
|
||||
.ToStorage();
|
||||
x_total_2.AsInsertable.ExecuteCommand(); //不存在插入
|
||||
x_total_2.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand(); //存在更新
|
||||
|
||||
// 总报表-报废记录插入
|
||||
//XXX:修改合格数公式
|
||||
// total3.QualifiedNumber = again3.RequireNumber ?? 0 - qualifiedNumber_No_all_total;
|
||||
total3.QualifiedNumber = final2.QualifiedNumber;
|
||||
@@ -3530,6 +3837,7 @@ namespace ZR.Service.mes.qc
|
||||
3
|
||||
);
|
||||
// XXX:修改总报表打磨,报废数计算公式
|
||||
total3.PaoguangTotal = first.PaoguangTotal + final1.PaoguangTotal;
|
||||
total3.DamoTotal = damo_total + damo_total_again + damo_total_final;
|
||||
total3.BaofeiTotal = baofei_total + baofei_total_again3 + baofei_total_final;
|
||||
// total3.DamoTotal = damo_total_again + damo_total_final;
|
||||
@@ -3546,6 +3854,10 @@ namespace ZR.Service.mes.qc
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 产线报表生成后自动化操作
|
||||
|
||||
try
|
||||
@@ -3558,7 +3870,7 @@ namespace ZR.Service.mes.qc
|
||||
Partnumber = workorder_item.FinishedPartNumber,
|
||||
WorkOrder = workorder_item.ClientWorkorder,
|
||||
Type = workorder_item.Remark1.Contains("返工") ? 2 : 1,
|
||||
Quantity = paoguang_by_first,
|
||||
Quantity = paoguang_by_first + paoguang_final,
|
||||
ActionTime = DateTime.Now.ToLocalTime(),
|
||||
CreatedBy = "包装" + team + "组",
|
||||
Remark = "首检抛光自动入库。来源工单号:[" + workorder_item.ClientWorkorder + "]"
|
||||
@@ -3568,7 +3880,8 @@ namespace ZR.Service.mes.qc
|
||||
// 合格品检查是否是门把手,是进入成品库(仅出库),不是进入一次合格品库
|
||||
string[] checkStrArray =
|
||||
{
|
||||
"门把手","面盖",
|
||||
"门把手",
|
||||
"面盖",
|
||||
"T22",
|
||||
"T26",
|
||||
"A58",
|
||||
|
||||
@@ -15,15 +15,57 @@ namespace ZR.Service.mes.qc.IService
|
||||
|
||||
#region 获取统计表
|
||||
//获取 首检
|
||||
(List<QcQualityStatisticsFirst>, int) GetQualityStatisticsTable_first(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize);
|
||||
(List<QcQualityStatisticsFirst>, int) GetQualityStatisticsTable_first(
|
||||
DateTime starttime,
|
||||
DateTime endTime,
|
||||
string workorderid,
|
||||
string partnumber,
|
||||
string product_description,
|
||||
string team,
|
||||
int pageNum,
|
||||
int pageSize,
|
||||
int sortType
|
||||
);
|
||||
|
||||
//获取 二检
|
||||
|
||||
(List<QcQualityStatisticsAgain>, int) GetQualityStatisticsTable_again(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,
|
||||
int sortType
|
||||
);
|
||||
|
||||
//获取 三检
|
||||
(List<QcQualityStatisticsFinal>, int) GetQualityStatisticsTable_final(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,
|
||||
int sortType
|
||||
);
|
||||
|
||||
//获取 总检
|
||||
(List<QcQualityStatisticsTotal>, int) GetQualityStatisticsTable_total(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,
|
||||
int sortType
|
||||
);
|
||||
#endregion
|
||||
|
||||
public int DeleteStatisticsTable(string workorderid);
|
||||
@@ -41,6 +83,16 @@ namespace ZR.Service.mes.qc.IService
|
||||
/// <param name="pageSize"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
List<QcQualityStatisticsFirstDto> DownloadStatisticsTableExcel(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize, int type);
|
||||
List<QcQualityStatisticsFirstDto> DownloadStatisticsTableExcel(
|
||||
DateTime starttime,
|
||||
DateTime endTime,
|
||||
string workorderid,
|
||||
string partnumber,
|
||||
string product_description,
|
||||
string team,
|
||||
int pageNum,
|
||||
int pageSize,
|
||||
int type
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user