|
@@ -139,6 +139,25 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
}
|
|
|
private LabelModel _CurrentLabel;
|
|
|
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 当前加工文件
|
|
|
+ /// </summary>
|
|
|
+ public string CurrentCycDoc
|
|
|
+ {
|
|
|
+ get { return _CurrentCycDoc; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ if (value != _CurrentCycDoc)
|
|
|
+ {
|
|
|
+ _CurrentCycDoc = value;
|
|
|
+ OnPropertyChanged(nameof(CurrentCycDoc));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private string _CurrentCycDoc;
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
@@ -164,39 +183,39 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
|
|
|
if (reg.Comment.Variable == Tag_StartSort && reg.Value == 1)
|
|
|
{
|
|
|
- _Lbls = GetLabes(File.FilePath);
|
|
|
- Labels = new ObservableCollection<LabelModel>(_Lbls);
|
|
|
- //var errorCount = 0;
|
|
|
- //var end = false;
|
|
|
-
|
|
|
- //while (!end)
|
|
|
- //{
|
|
|
- // if (CuttingMac.isConnected())
|
|
|
- // {
|
|
|
- // var ncName = new int[16];
|
|
|
- // CuttingMac.READ_plc_register(0, 16, out ncName);
|
|
|
- // _Lbls = GetLabes(CycFilePath(ncName));
|
|
|
- // Labels = new ObservableCollection<LabelModel>(_Lbls);
|
|
|
- // end = true;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // errorCount++;
|
|
|
- // if (errorCount > 3)
|
|
|
- // {
|
|
|
- // if (MessageBox.Show("开料机连接失败,请检查网络连接!是否重新连接?", "获取开料机加工文件", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
|
|
- // {
|
|
|
- // errorCount = 0;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // GetListenReg(Tag_Reset).SetBit();
|
|
|
- // end = true;
|
|
|
- // }
|
|
|
-
|
|
|
- // }
|
|
|
- // }
|
|
|
- //}
|
|
|
+ //_Lbls = GetLabes(File.FilePath);
|
|
|
+ //Labels = new ObservableCollection<LabelModel>(_Lbls);
|
|
|
+ var errorCount = 0;
|
|
|
+ var end = false;
|
|
|
+
|
|
|
+ while (!end)
|
|
|
+ {
|
|
|
+ if (CuttingMac.isConnected())
|
|
|
+ {
|
|
|
+ var ncName = new int[40];
|
|
|
+ CuttingMac.READ_plc_register(7200, 7240, out ncName);
|
|
|
+ _Lbls = GetLabes(CycFilePath(ncName));
|
|
|
+ Labels = new ObservableCollection<LabelModel>(_Lbls);
|
|
|
+ end = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ errorCount++;
|
|
|
+ if (errorCount > 3)
|
|
|
+ {
|
|
|
+ if (MessageBox.Show("开料机连接失败,请检查网络连接!是否重新连接?", "获取开料机加工文件", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
|
|
+ {
|
|
|
+ errorCount = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ GetListenReg(Tag_Reset).SetBit();
|
|
|
+ end = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
reg.ResetBit();
|
|
|
NewBoardArrived?.Invoke(this, EventArgs.Empty);
|
|
|
}
|
|
@@ -587,10 +606,10 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
var code = new byte[values.Count() * 4];
|
|
|
for (int i = 0; i < values.Count(); i++)
|
|
|
{
|
|
|
- code[0 + i * 4] = (byte)(values[i] >> 24);
|
|
|
- code[1+ i * 4] = (byte)(values[i] >> 16);
|
|
|
- code[2+ i * 4] = (byte)(values[i] >> 8);
|
|
|
- code[3 + i * 4] = (byte)(values[i] >> 0);
|
|
|
+ code[0 + i * 4] = (byte)(values[i] >> 0);
|
|
|
+ code[1+ i * 4] = (byte)(values[i] >> 8);
|
|
|
+ code[2+ i * 4] = (byte)(values[i] >> 16);
|
|
|
+ code[3 + i * 4] = (byte)(values[i] >> 24);
|
|
|
}
|
|
|
for (int i = 0; i < code.Count(); i++)
|
|
|
{
|
|
@@ -600,9 +619,12 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- return str;
|
|
|
- //var fileName = new DirectoryInfo(CustomerEnv.SortingMacConfigValue.CycFolder).GetFiles().Where(t => t.Name.Contains("202407092125_01")).FirstOrDefault();
|
|
|
- //return CustomerEnv.SortingMacConfigValue.CycFolder + $@"\{fileName}";
|
|
|
+ log.Info($"开料机解析的加工文件为{str}");
|
|
|
+ //return str;
|
|
|
+ var fileName ="Label_"+str.Replace(".nc",".cyc");
|
|
|
+ CurrentCycDoc = fileName;
|
|
|
+ var filePath = new DirectoryInfo(CustomerEnv.SortingMacConfigValue.CycFolder).GetFiles().Where(t => t.Name.Contains(fileName)).FirstOrDefault();
|
|
|
+ return CustomerEnv.SortingMacConfigValue.CycFolder + $@"\{fileName}";
|
|
|
}
|
|
|
|
|
|
/// <summary>
|