|
@@ -74,22 +74,22 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
private double CenterX { get; set; }
|
|
|
private double CenterY { get; set; }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 文件选择
|
|
|
- /// </summary>
|
|
|
- public FileSelectModel File
|
|
|
- {
|
|
|
- get { return _FilePath; }
|
|
|
- set
|
|
|
- {
|
|
|
- if (value != _FilePath)
|
|
|
- {
|
|
|
- _FilePath = value;
|
|
|
- OnPropertyChanged(nameof(File));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- private FileSelectModel _FilePath = new FileSelectModel();
|
|
|
+ ///// <summary>
|
|
|
+ ///// 文件选择
|
|
|
+ ///// </summary>
|
|
|
+ //public FileSelectModel File
|
|
|
+ //{
|
|
|
+ // get { return _FilePath; }
|
|
|
+ // set
|
|
|
+ // {
|
|
|
+ // if (value != _FilePath)
|
|
|
+ // {
|
|
|
+ // _FilePath = value;
|
|
|
+ // OnPropertyChanged(nameof(File));
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //private FileSelectModel _FilePath = new FileSelectModel();
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
@@ -187,56 +187,69 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
//Labels = new ObservableCollection<LabelModel>(_Lbls);
|
|
|
var errorCount = 0;
|
|
|
var end = false;
|
|
|
- if (BaseDevice.Simulated)
|
|
|
+ if (BaseDevice.Simulated || !CustomerEnv.SortingMacConfigValue.IsConnectToCuttingMac)
|
|
|
{
|
|
|
end = true;
|
|
|
- _Lbls = GetLabes(File.FilePath);
|
|
|
- Labels = new ObservableCollection<LabelModel>(_Lbls);
|
|
|
- }
|
|
|
- while (!end)
|
|
|
- {
|
|
|
- if (CuttingMac.isConnected())
|
|
|
+ if (CustomerEnv.SortingMacConfigValue.CycFilePath != null)
|
|
|
{
|
|
|
- var ncName = new int[40];
|
|
|
- CuttingMac.READ_plc_register(7200, 7240, out ncName);
|
|
|
- var path = CycFilePath(ncName);
|
|
|
- if (path != null)
|
|
|
- {
|
|
|
- _Lbls = GetLabes(path);
|
|
|
- Labels = new ObservableCollection<LabelModel>(_Lbls);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
-
|
|
|
- MessageBox.Show($"文件不存在");
|
|
|
- GetListenReg(Tag_Reset).SetBit();
|
|
|
-
|
|
|
- }
|
|
|
- end = true;
|
|
|
+ _Lbls = GetLabes(CustomerEnv.SortingMacConfigValue.CycFilePath);
|
|
|
+ Labels = new ObservableCollection<LabelModel>(_Lbls);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- errorCount++;
|
|
|
- if (errorCount > 3)
|
|
|
+ MessageBox.Show($"参数页面中的'单机运行时cyc文件'为空!");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ while (!end)
|
|
|
+ {
|
|
|
+ if (CuttingMac.isConnected())
|
|
|
{
|
|
|
- if (MessageBox.Show("开料机连接失败,请检查网络连接!是否重新连接?", "获取开料机加工文件", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
|
|
+ var ncName = new int[40];
|
|
|
+ CuttingMac.READ_plc_register(7200, 7240, out ncName);
|
|
|
+ var path = CycFilePath(ncName);
|
|
|
+ if (path != null)
|
|
|
{
|
|
|
- errorCount = 0;
|
|
|
+ _Lbls = GetLabes(path);
|
|
|
+ Labels = new ObservableCollection<LabelModel>(_Lbls);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+
|
|
|
+ MessageBox.Show($"文件不存在");
|
|
|
GetListenReg(Tag_Reset).SetBit();
|
|
|
- end = true;
|
|
|
+
|
|
|
}
|
|
|
+ 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);
|
|
|
}
|
|
|
else if (reg.Comment.Variable == Tag_RequestNext && reg.Value == 1 && reg.OldValue == 0)
|
|
|
{
|
|
|
+ GetListenReg(Tag_AAutoSpeed).WriteReg(CustomerEnv.SortingMacConfigValue.AxisAAutoHighSpeed);
|
|
|
CurrentLabel = _Lbls.FirstOrDefault(t => t.Status == Models.TaskStatus.None);
|
|
|
if (CurrentLabel != null)
|
|
|
{
|
|
@@ -299,7 +312,6 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
BoardInfo.CupCenter = new Point(BoardInfo.CupCenter.X - cup1NewCenter.X, BoardInfo.CupCenter.Y - cup1NewCenter.Y);
|
|
|
BoardInfo.ReleaseY = CurrentLabel.ActualWidth / 2 - 180;
|
|
|
//BoardInfo.ReleaseY = CurrentLabel.ActualWidth / 2 - 170;
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -309,7 +321,7 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
//cup3NewCenter.Offset(100, 32.5); //补偿夹具尺寸
|
|
|
BoardInfo.CupCenter = new Point(BoardInfo.CupCenter.X - cup1NewCenter.X, BoardInfo.CupCenter.Y - cup1NewCenter.Y);
|
|
|
//BoardInfo.ReleaseY = CurrentLabel.ActualWidth / 2;
|
|
|
- BoardInfo.ReleaseY = CurrentLabel.ActualWidth / 2 - 180;
|
|
|
+ BoardInfo.ReleaseY = CurrentLabel.ActualLength / 2 - 180;
|
|
|
//BoardInfo.ReleaseY = CurrentLabel.ActualWidth / 2 - 20;
|
|
|
|
|
|
|
|
@@ -327,7 +339,7 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
BoardInfo.CupCenter = new Point(BoardInfo.CupCenter.X - cup3NewCenter.X, BoardInfo.CupCenter.Y - cup3NewCenter.Y);
|
|
|
}
|
|
|
//BoardInfo.ReleaseY = CurrentLabel.ActualWidth / 2;
|
|
|
- BoardInfo.ReleaseY = CurrentLabel.ActualWidth / 2 - 180;
|
|
|
+ BoardInfo.ReleaseY = CurrentLabel.ActualLength / 2 - 180;
|
|
|
//BoardInfo.ReleaseY = CurrentLabel.ActualWidth / 2 - 20;
|
|
|
|
|
|
|
|
@@ -372,7 +384,6 @@ namespace SCADA_DAQ.Customer.Machines
|
|
|
//var _lbl = new LabelModel() { ID = CurrentLabel.ID };
|
|
|
var _lbl = new LabelModel();
|
|
|
var isCancel = false;
|
|
|
- GetListenReg(Tag_AAutoSpeed).WriteReg(CustomerEnv.SortingMacConfigValue.AxisAAutoHighSpeed);
|
|
|
if (GetListenReg(Tag_CameraEnable).Value == 0)
|
|
|
{
|
|
|
_barcodeReader = MachineServer.GetInstance().GetMachine<SampleBarcodeReader>("BarcodeReader4");
|