This commit is contained in:
ChiKyun Kim
2025-09-23 15:41:16 +09:00
parent 02028afc27
commit b037dd53e6
74 changed files with 4269 additions and 7917 deletions

View File

@@ -1,6 +1,5 @@
using AR;
using Emgu.CV.BgSegm;
using Microsoft.Owin.StaticFiles;
using System;
using System.Collections.Generic;
using System.Data;
@@ -41,21 +40,14 @@ namespace Project
public static Device.SATOPrinterAPI PrinterL;
public static Device.SATOPrinterAPI PrinterR;
public static arDev.Joystick.JoystickRaw joypad;
public static WatsonWebsocket.WatsonWsClient wsL;
public static WatsonWebsocket.WatsonWsClient wsR;
public static arDev.Joystick.JoystickRaw joystick;
//public static StdLabelPrint.LabelPrint PrinterL = null;
//public static StdLabelPrint.LabelPrint PrinterR = null;
public static Device.KeyenceBarcode keyenceF = null;
public static Device.KeyenceBarcode keyenceR = null;
public static int uploadcount = 0;
public static DateTime BuzzerTime;
public static DateTime MGZRunTime;
//public static Flag flag;
public static MessageWindow popup;
//interlock check
@@ -233,8 +225,8 @@ namespace Project
//Initialize
PUB.Result.vModel.Title = string.Empty;
PUB.PrinterL.ZPLFileName = "zpl.txt"; //Set as default file
PUB.PrinterR.ZPLFileName = "zpl.txt";
PUB.PrinterL.ZPLFileName = UTIL.MakePath("Data", "zpl.txt"); //Set as default file
PUB.PrinterR.ZPLFileName = UTIL.MakePath("Data", "zpl.txt");
var modelVision = PUB.mdm.GetDataV(modelName);
if (modelVision != null)
@@ -252,7 +244,6 @@ namespace Project
PUB.Result.BCDPattern = PUB.GetPatterns(modelName, false);
PUB.Result.BCDIgnorePattern = PUB.GetPatterns(modelName, true);
PUB.Result.BCDPrintPattern = PUB.GetPrintPatterns(); //220902
PUB.log.Add($"Model pattern loading:{PUB.Result.BCDPattern.Count}/{PUB.Result.BCDIgnorePattern.Count}");
if (modelVision.Code.isEmpty())
@@ -276,8 +267,8 @@ namespace Project
if (bUploadConfig)
{
//SAVE
UpLoadBarcodeConfig(PUB.keyenceF);
UpLoadBarcodeConfig(PUB.keyenceR);
var k1 = MemLoadBarcodeConfig(PUB.keyenceF);
var k2 = MemLoadBarcodeConfig(PUB.keyenceR);
}
if (mv.bOwnZPL)
@@ -296,7 +287,7 @@ namespace Project
}
else
{
PUB.log.AddI($"Using shared ZPL file");
PUB.log.AddI($"Using shared ZPL file ({PUB.PrinterL.ZPLFileName})");
}
return true;
}
@@ -309,9 +300,48 @@ namespace Project
}
}
public static bool MemLoadBarcodeConfig(Device.KeyenceBarcode keyence)
{
var BarcodeMemoryNo = PUB.Result.vModel.BSave;
if (BarcodeMemoryNo < 0)
{
PUB.log.AddAT($"The currently selected model does not have a barcode memory number specified.");
return false;
}
if (keyence == null || keyence.IsConnect == false)
{
var tagstr = keyence?.Tag ?? string.Empty;
PUB.log.AddAT($"Barcode ({tagstr}) is not connected, configuration file will not be uploaded." +
"This information will be retransmitted when starting a new job." +
$"This error will not occur if you select the model after checking the barcode connection at the {(tagstr == "F" ? "left" : "right")} bottom.");
return false;
}
try
{
//접속되어잇ㅇ츠면 끈다
var isTriggeronL = keyence.IsTriggerOn;
if (keyence.IsConnect)
{
keyence.Trigger(false);
keyence.BLoad(BarcodeMemoryNo);
}
if (isTriggeronL && keyence.IsConnect) keyence.Trigger(true);
return true;
}
catch (Exception ex)
{
PUB.log.AddE($"Barcode({keyence.Tag}) FTP transfer failed:{ex.Message}");
}
return false;
}
public static bool UpLoadBarcodeConfig(Device.KeyenceBarcode keyence)
{
if (keyence == null || keyence.IsConnect == false)
{
var tagstr = keyence?.Tag ?? string.Empty;
@@ -386,7 +416,7 @@ namespace Project
//기존 SID정보에서 데이터를 취합니다.
var mc = AR.SETTING.Data.McName;
PUB.log.AddAT($"ECS SKIP is set in configuration. Data will be generated from existing information MC={mc}");
PUB.log.AddAT($"SID Information Data will be generated from existing information MC={mc}");
using (var tainfo = new DataSet1TableAdapters.K4EE_Component_Reel_SID_InformationTableAdapter())
{
var cntd = tainfo.DeleteAll("IB");
@@ -394,12 +424,12 @@ namespace Project
var cnti = tainfo.MakeIBData(mc);
PUB.log.AddAT($"{cnti} records duplicated");
}
message = "ECS-OFF 됨 장비전용 데이터로 진행 함";
message = "SID Information : Only M/C Data";
result = true;
rdy = 1;
wat.Stop();
PUB.log.Add($"{cnt}건의 sid정보가 추가됨 {wat.ElapsedMilliseconds:N2}ms");
PUB.log.Add($"SID Information Add ({cnt}) - {wat.ElapsedMilliseconds:N2}ms");
return new Tuple<bool, string, int>(result, message, rdy);
});
return rlt;
@@ -455,7 +485,7 @@ namespace Project
PUB.Result.DTSidConvert.AcceptChanges();
PUB.Result.DTSidConvertEmptyList.Clear();
PUB.Result.DTSidConvertMultiList.Clear();
PUB.log.Add($"sid변환테이블 {PUB.Result.DTSidConvert.Rows.Count}건 확인");
PUB.log.Add($"SID conversion table {PUB.Result.DTSidConvert.Rows.Count} records checked");
return true;
}
catch (Exception ex)
@@ -648,7 +678,7 @@ namespace Project
GetSIDConverDB();
if (PUB.Result.DTSidConvert.Any())
{
PUB.log.Add($"[{src}] sid변환테이블조회결과 {PUB.Result.DTSidConvert.Rows.Count}");
PUB.log.Add($"[{src}] SID conversion table query result: {PUB.Result.DTSidConvert.Rows.Count} records");
VAR.BOOL[eVarBool.JOB_Empty_SIDConvertInfo] = false;
}
else
@@ -666,7 +696,7 @@ namespace Project
if (PUB.sm.Step == eSMStep.RUN)
PUB.log.Add($"[{src}] sid변환작업시작 원본:{oldsid}");
PUB.log.Add($"[{src}] SID conversion work started, original:{oldsid}");
var sidconvlist = PUB.Result.DTSidConvert.Where(t => t.SIDFrom.Equals(oldsid));
if (sidconvlist.Any() == false)
@@ -1019,65 +1049,6 @@ namespace Project
return patterns;
}
public static List<Class.RegexPattern> GetPrintPatterns()
{
var patterns = new List<Class.RegexPattern>();
//if (custname.isEmpty()) custname = "%";
//데이터베이스에서 해당 데이터를 가져온다
if (AR.SETTING.Data.OnlineMode)
{
try
{
using (var ta = new DataSet1TableAdapters.K4EE_Component_Reel_PrintRegExRuleTableAdapter())
{
ta.ClearBeforeFill = true;
ta.Fill(PUB.mdm.dataSet.K4EE_Component_Reel_PrintRegExRule);
PUB.mdm.dataSet.K4EE_Component_Reel_RegExRule.AcceptChanges();
}
}
catch (Exception ex)
{
PUB.log.AddE(ex.Message);
}
}
//data
foreach (DataSet1.K4EE_Component_Reel_PrintRegExRuleRow dr in PUB.mdm.dataSet.K4EE_Component_Reel_PrintRegExRule)
{
if (dr.Groups.isEmpty() || dr.Pattern.isEmpty()) continue;
var groupsbuf = dr.Groups.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
var Groups = new List<Class.RegexGroupMatch>();
foreach (var item in groupsbuf)
{
var itembuf = item.Split('=');
Groups.Add(new Class.RegexGroupMatch
{
GroupNo = int.Parse(itembuf[1].Trim()),
TargetPos = itembuf[0].Trim(),
});
}
//add pattern data
patterns.Add(new Class.RegexPattern
{
Seq = dr.Seq,
Customer = dr.CustCode,
Description = dr.Description,
Symbol = dr.Symbol,
Pattern = dr.Pattern,
Groups = Groups.ToArray(),
});
}
return patterns;
}
public static int RemoveCache(string basefile)
{
var fi = new System.IO.FileInfo(basefile);
@@ -1093,7 +1064,7 @@ namespace Project
{
foreach (var delFile in delFiles)
{
PUB.log.Add("보관파일삭제: " + delFile.FullName);
PUB.log.Add("Archive file deleted: " + delFile.FullName);
delFile.Delete();
cnt += 1;
}
@@ -1129,7 +1100,7 @@ namespace Project
{
system_mot = new System_MotParameter(UTIL.MakePath("System_mot.xml"));
system_mot.Load();
//setting
SETTING.Load();
VAR.Init(LenI32: 128, LenBool: 192);
@@ -1151,7 +1122,7 @@ namespace Project
popup.WindowOpen += popup_WindowOpen;
//zpl파일 만든다.
var fn = Path.Combine(UTIL.CurrentPath, "zpl.txt");
var fn = Path.Combine(UTIL.CurrentPath, "Data", "zpl.txt");
if (File.Exists(fn) == false)
File.WriteAllText(fn, Properties.Settings.Default.ZPL7, Encoding.Default);
}
@@ -1579,7 +1550,7 @@ namespace Project
else if (fi.Directory.Exists == false) fi.Directory.Create();
DTUserSID.AcceptChanges();
PUB.log.Add("사용자 SID 목록 : " + DTUserSID.Count.ToString() + " 건 불러옴");
PUB.log.Add("User SID list: " + DTUserSID.Count.ToString() + " records loaded");
}
public static void SaveSIDList()
{
@@ -1606,7 +1577,7 @@ namespace Project
cnt += 1;
}
System.IO.File.WriteAllText(fi.FullName, sb.ToString(), System.Text.Encoding.UTF8);
PUB.log.Add(string.Format("{0}건의 사용자 sid가 저장되었습니다", cnt));
PUB.log.Add(string.Format("{0} user SIDs have been saved", cnt));
}
}