Ver a proveniência

v2.0.7 修复导出excel颜色bug

TongWei
CPL há 1 ano
ascendente
cometimento
979799ec36
2 ficheiros alterados com 167 adições e 2 eliminações
  1. +161
    -1
      halftoneproject-master/BanBoShi/SysCtrl/SysMgr.cs
  2. +6
    -1
      halftoneproject-master/BanBoShi/SysUI/DefectPicShow/DataQueryFrm.cs

+ 161
- 1
halftoneproject-master/BanBoShi/SysCtrl/SysMgr.cs Ver ficheiro

@@ -2227,6 +2227,7 @@ namespace MaiMuAOI.SysCtrl
/// <returns></returns>
public bool StartRun(Form fatherFrm, string detectOrder, int defectCnt, string productCode, string sn, string ms, string xj)
{
//TestPic();
bool ret = true;
//Log("运行", $"启动自动检测流程---料号:{productCode},网版编码:{sn}");
//运行前清除过期图片文件
@@ -8960,9 +8961,21 @@ namespace MaiMuAOI.SysCtrl
}
else
{
//保存原始大图
if (confMgr.SysConfigParams.DefectBigImag.SavePath != "" && Directory.Exists(confMgr.SysConfigParams.DefectBigImag.SavePath))
{
string path = Util.CreateSubDir(confMgr.SysConfigParams.DefectBigImag.SavePath, new List<string> { order.CreateTime.ToString("yyyyMMdd"), order.SN });
path += $"Defect_SN{order.SN}_I{res.index}_X{res.Xmm}_Y{res.Ymm}_C{res.defectCount}_{picName}_Err";
lock (ImageSaveObj)
{
res.bmp.ImWrite(path + ".bmp");
//OpenCvSharp.Extensions.BitmapConverter.ToBitmap(res.bmp).Save(path + ".bmp", ImageFormat.Bmp);
File.WriteAllText(path + ".json", JsonConvert.SerializeObject(res.informationList));
}
}
OnAutoRuning(new RunEventArgs(res.stepIndex, $"缺陷检测失败:{res.resultInfo}", new List<double>(), 1, -1, -1, 1, true));
//OnAutoRuning(new RunEventArgs(liStatocStepIndex, $"失败:{res.resultInfo}"));
Log($"{res.stepIndex + 1}-{res.processName}", $"缺陷检测失败:{res.resultInfo}");
Log($"{res.stepIndex + 1}-{res.processName}", $"缺陷检测失败:{res.modelType}-{res.thresholdsClass}-{JsonConvert.SerializeObject(res.recAreaThreshold)}-{res.resultInfo}");
//暂停 这里不能暂停,stepIndex和scannerBmpQueue队列也不对了
}
defectBmpNumResult++;
@@ -11249,6 +11262,153 @@ namespace MaiMuAOI.SysCtrl
}
}
#endregion
#region 防真
public void TestPic()
{
defectLib = new DefectLib();
if (!defectLib.start())
throw new Exception("外观检测核心初始化失败...");
defectLib.loadModelFile("E:\\CPL\\迈沐智能项目\\2023\\版博士\\版本exe\\推理&标定\\Debug\\ConfigFiles\\onnxFiles\\tw\\rj_0322_tw1.onnx");
//var dict = JsonConvert.DeserializeObject<Dictionary<string, float>>();
//"\"dk\":0.07326923," +
// "\"zw\":1.70961535," +
// "\"xws\":488.4127," +
// "\"gsyc\":0.0,\"" +
// "qk\":488.4127," +
// "\"zk\":488.4127," +
// "\"pp\":488.4127," +
// "\"hs\":0.0," +
// "\"yx\":488.4127," +
// "\"xb\":0.0," +
// "\"gsdl\":0.0," +
// "\"gs\":0.0," +
// "\"ds\":0.0," +
// "\"cjdk\":0.0," +
// "\"na\":0.0," +
// "\"nb\":0.0," +
// "\"nc\":0.0"
Dictionary<string, float> fty = new Dictionary<string, float>();
fty.Add("dk", 0.07326923f);
fty.Add("zw", 1.70961535f);
fty.Add("xws", 488.4127f);
fty.Add("gsyc", 0.0f);
fty.Add("qk", 488.4127f);
fty.Add("zk", 488.4127f);
fty.Add("pp", 488.4127f);
fty.Add("hs", 0.0f);
fty.Add("yx", 488.4127f);
fty.Add("xb", 0.0f);
fty.Add("gsdl", 0.00f);
fty.Add("gs", 0.00f);
fty.Add("ds", 0.00f);
fty.Add("cjdk", 0.00f);
fty.Add("na", 0.00f);
fty.Add("nb", 0.00f);
fty.Add("nc", 0.00f);
//fty.Add("dk", 0.07326923f);
//fty.Add("dk", 0.07326923f);
Mat mt = new Mat("C:\\Users\\fang\\Desktop\\12\\Defect_SNCC-CDTW-A-325-L-240814-0012-1_I34_X220.3794_Y-765.5828_C0_TW182M-SP1-10B-000-01(TW182J210F) A0_Err.bmp");
defectLib.add(new DefectTask()
{
stepIndex = 0,
processName = "tt",
modelType = "rj",
drawingPagePath = "5454",
//index = defectBmpNum++,
index = 0,
bmp = mt.Clone(),
Xmm = 1,
Ymm = 2,
cut_size = new System.Drawing.Size(592, 532),
resize = new System.Drawing.Size(224, 224),
thresholds = 0.4f,
thresholdsClass = "0.89,0.3,0.3,0.9,0.9,0.3,0.3,0.3,0.3,0.3,0.3,0.8,0.8,0.3,0.3,0.3",
recAreaThreshold = fty, //qxName,面积; qxName,面积; qxName,面积;
finishEvent = (res) =>
{
if (res.isSucceed)
{
//OnAutoRuning(new RunEventArgs(liStatocStepIndex,
// $"源图索引:{res.index},缺陷数:{res.defectCount},处理时间(ms):{string.Join("->", res.stopwatch.Select(i => i.ToString()).ToArray())}"));
Log($"{res.stepIndex + 1}-{res.processName}", $"缺陷检测完成(源图索引:{res.index}),缺陷数:{res.defectCount},处理时间(ms):{string.Join("->", res.stopwatch.Select(i => i.ToString()).ToArray())}");
string path;
if (res.defectCount > 0)
{
//UI显示小图 (含统计缺陷类型数量)
AllDefectCount += res.informationList.Count;
if (res.defectInfor2RestorationDeskPage != null && res.defectInfor2RestorationDeskPage.Count > 0)
{
Log($"{res.stepIndex + 1}-{res.processName}", $"转换后坐标数据:{JsonConvert.SerializeObject(res.defectInfor2RestorationDeskPage)}");
if (order.DefectInfoList == null)
order.DefectInfoList = new List<DefectInfo>();
#if false
foreach (var item in res.defectInfor2RestorationDeskPage)
order.DefectInfoList.Add(new DefectInfo()
{
Type = 0,
Code = item[3],
X = double.Parse(item[1]),
Y = double.Parse(item[2]),
ZXD = double.Parse(item[4]),
Index = int.Parse(item[0]),
Area = item.Count>5?double.Parse(item[5]):0,
ModifyUserCode = UserMgr.LoginUser.Code,
CreateUserCode = UserMgr.LoginUser.Code,
});
#else
for (int i = 0; i < res.defectInfor2RestorationDeskPage.Count; i++)
{
double n;
order.DefectInfoList.Add(new DefectInfo()
{
Type = 0,
Code = res.defectInfor2RestorationDeskPage[i][3],
X = double.Parse(res.defectInfor2RestorationDeskPage[i][1]),
Y = double.Parse(res.defectInfor2RestorationDeskPage[i][2]),
ZXD = double.Parse(res.defectInfor2RestorationDeskPage[i][4]),
Index = int.Parse(res.defectInfor2RestorationDeskPage[i][0]),
Area = ((res.defectInfor2RestorationDesk[i].Count > 5) && (double.TryParse(res.defectInfor2RestorationDesk[i][5], out n))) ? double.Parse(res.defectInfor2RestorationDesk[i][5]) : 0,
ModifyUserCode = UserMgr.LoginUser.Code,
CreateUserCode = UserMgr.LoginUser.Code,
});
}
#endif
}
}
else//没有缺陷
{
}
}
else
{
//OnAutoRuning(new RunEventArgs(liStatocStepIndex, $"失败:{res.resultInfo}"));
Log($"{res.stepIndex + 1}-{res.processName}", $"缺陷检测失败:{res.modelType}-{res.thresholdsClass}-{JsonConvert.SerializeObject(res.recAreaThreshold)}-{res.resultInfo}");
//暂停 这里不能暂停,stepIndex和scannerBmpQueue队列也不对了
}
defectBmpNumResult++;
foreach (var item in res.bmps_cut)
item.Dispose();
res.bmp.Dispose();
res.bmp = null;
res.bmps_tag = null;
if (res.bmpCompress != null)
{
res.bmpCompress.Dispose();
res.bmpCompress = null;
}
System.GC.Collect();
}
});
Thread.Sleep(600000);
}
#endregion
}
#region 系统事件


+ 6
- 1
halftoneproject-master/BanBoShi/SysUI/DefectPicShow/DataQueryFrm.cs Ver ficheiro

@@ -30,11 +30,13 @@ using DataTable = System.Data.DataTable;
using Point = System.Drawing.Point;
using Excel = Microsoft.Office.Interop.Excel;
using Microsoft.Office.Interop.Excel;
using Service;
namespace MaiMuAOI.SysUI.DefectPicShow
{
public partial class DataQueryFrm : Form
{
ProductService PdtService = new ProductService();
Service.OrderService OrderService = new Service.OrderService();
List<Order> QueryOrders = new List<Order>();
List<Order> QueryAllOrders = new List<Order>();
@@ -646,7 +648,10 @@ namespace MaiMuAOI.SysUI.DefectPicShow
{
tempd = item.SizeDefectInfoList.Where(q => q.StepName == tdata.Key).ToList();
var tempstep = item.StepInfo.ProcessList.Where(q => q.ProcessName == tdata.Key).FirstOrDefault();
var md = PdtService.GetModelNav(item.ProductId);
var tempstep = md.StepInfo.ProcessList.Where(q => q.ProcessName == tdata.Key).FirstOrDefault();
var tempstep22 = item.StepInfo.ProcessList.Where(q => q.ProcessName == tdata.Key).FirstOrDefault();
if (tempstep != null)
{
JObject processParam = JObject.Parse(tempstep.ProcessParams);


Carregando…
Cancelar
Guardar