|
|
|
@ -38,6 +38,8 @@ using Admin.Core.Common;
|
|
|
|
|
using Aucma.Core.CodeBinding.Business;
|
|
|
|
|
using Aucma.Core.Scanner;
|
|
|
|
|
using LiveCharts.Defaults;
|
|
|
|
|
using Admin.Core.Socket;
|
|
|
|
|
using System.Runtime.ConstrainedExecution;
|
|
|
|
|
/*
|
|
|
|
|
* 首页信息
|
|
|
|
|
*/
|
|
|
|
@ -49,17 +51,24 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
private readonly ICodeBindingRecordServices? _codeBindingRecordServices;
|
|
|
|
|
private readonly IBaseMaterialInfoServices? _baseMaterialInfoServices;
|
|
|
|
|
private readonly IBaseBomInfoServices? _baseBomInfoServices;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly IPrintBarCodeServices? _printBarCodeServices;
|
|
|
|
|
// 过点数据表,物料完成记录MaterialCompletion
|
|
|
|
|
private readonly IMaterialCompletionServices? _iMaterialCompletionServices;
|
|
|
|
|
// 静态变量存code1
|
|
|
|
|
// private static string code1Str = string.Empty;
|
|
|
|
|
// 静态变量存code1,mes条码
|
|
|
|
|
private static string code1Str = string.Empty;
|
|
|
|
|
|
|
|
|
|
// 静态变量存code2
|
|
|
|
|
// private static string code2Str = string.Empty;
|
|
|
|
|
// 静态变量存code2,SN条码
|
|
|
|
|
private static string code2Str = string.Empty;
|
|
|
|
|
//配置文件扫码器列表
|
|
|
|
|
private static List<ScannerModel> allScanners = Appsettings.app<ScannerModel>("ScannerServer").ToList();
|
|
|
|
|
|
|
|
|
|
// mes扫码器ip
|
|
|
|
|
private static string MesScannerIp = allScanners.First(x => x.Name == "mes扫码器").Ip;
|
|
|
|
|
// sn扫码器ip
|
|
|
|
|
private static string SnScannerIp = allScanners.First(x => x.Name == "sn扫码器").Ip;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public IndexPageViewModel()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
@ -67,18 +76,20 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
_codeBindingRecordServices = App.ServiceProvider.GetService<ICodeBindingRecordServices>();
|
|
|
|
|
_baseBomInfoServices = App.ServiceProvider.GetService<IBaseBomInfoServices>();
|
|
|
|
|
_baseMaterialInfoServices = App.ServiceProvider.GetService<IBaseMaterialInfoServices>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_printBarCodeServices = App.ServiceProvider.GetService<IPrintBarCodeServices>();
|
|
|
|
|
_iMaterialCompletionServices = App.ServiceProvider.GetService<IMaterialCompletionServices>();
|
|
|
|
|
Business.MvCodeHelper.ReceiveCodeEvent += ReceiveCode;
|
|
|
|
|
Business.MvCodeHelper.BindingCodeEvent += BindingCode;
|
|
|
|
|
Business.MvCodeHelper.NoReadEvent += ReceiveNoRead;
|
|
|
|
|
// Business.MvCodeHelper.ReceiveCodeEvent += ReceiveCode;
|
|
|
|
|
// Business.MvCodeHelper.BindingCodeEvent += BindingCode;
|
|
|
|
|
// Business.MvCodeHelper.NoReadEvent += ReceiveNoRead;
|
|
|
|
|
TouchSocketService.ReceiveCodeDelegateEvent += ReceiveCode;
|
|
|
|
|
TouchSocketService.NoReadReceiveEvent += ReceiveNoRead;
|
|
|
|
|
GunBusiness.BindingReceiveCodeEvent += BindingCode;
|
|
|
|
|
GunBusiness.RefreshMaterialCodeStrEvent += ReceiveCode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LoadData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//实时绑定条码和实时下发plc放行信号
|
|
|
|
|
realBindingAndSendPlc();
|
|
|
|
|
LoadCharts();
|
|
|
|
@ -86,7 +97,7 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
//Task.Run(() =>
|
|
|
|
|
//{
|
|
|
|
|
// Thread.Sleep(4000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -97,47 +108,47 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 实时绑定条码和实时下发plc放行信号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void realBindingAndSendPlc()
|
|
|
|
|
{
|
|
|
|
|
string tempCode1 ;
|
|
|
|
|
string tempCode1;
|
|
|
|
|
string tempCode2;
|
|
|
|
|
//// 实时绑定条码
|
|
|
|
|
//Task.Run(() =>
|
|
|
|
|
//{
|
|
|
|
|
// while(true)
|
|
|
|
|
// {
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
// if (!string.IsNullOrEmpty(code1Str) && !string.IsNullOrEmpty(code2Str))
|
|
|
|
|
// {
|
|
|
|
|
// tempCode1 = code1Str;
|
|
|
|
|
// tempCode2 = code2Str;
|
|
|
|
|
// code1Str = string.Empty;
|
|
|
|
|
// code2Str = string.Empty;
|
|
|
|
|
// BindingCode(tempCode1, tempCode2);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// catch (Exception ex)
|
|
|
|
|
// {
|
|
|
|
|
// Console.WriteLine(ex.ToString());
|
|
|
|
|
// }
|
|
|
|
|
// Thread.Sleep(500);
|
|
|
|
|
// }
|
|
|
|
|
//});
|
|
|
|
|
// 实时绑定条码
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(code1Str) && !string.IsNullOrEmpty(code2Str))
|
|
|
|
|
{
|
|
|
|
|
BindingCode(code1Str, code2Str);
|
|
|
|
|
code1Str = string.Empty;
|
|
|
|
|
code2Str = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
code1Str = string.Empty;
|
|
|
|
|
code2Str = string.Empty;
|
|
|
|
|
Console.WriteLine(ex.ToString());
|
|
|
|
|
}
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 心跳线程
|
|
|
|
|
// 心跳线程
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(3000);
|
|
|
|
|
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("条码绑定Plc"));
|
|
|
|
|
if(obj != null)
|
|
|
|
|
if (obj != null)
|
|
|
|
|
{
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
@ -147,7 +158,7 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
@ -201,13 +212,13 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// LoadCharts();
|
|
|
|
|
|
|
|
|
|
// LoadCharts();
|
|
|
|
|
|
|
|
|
|
List<CodeBindingRecord> records = null;
|
|
|
|
|
records = _codeBindingRecordServices.QueryAsync(x => x.BoxCode != null && x.RecordTime2 >= DateTime.Today && x.RecordTime2 < DateTime.Today.AddDays(1)).Result;
|
|
|
|
|
records = _codeBindingRecordServices.QueryAsync(x => x.BoxCode != null && x.RecordTime2 >= DateTime.Today && x.RecordTime2 < DateTime.Today.AddDays(1)).Result;
|
|
|
|
|
|
|
|
|
|
if (records != null && records.Count>0)
|
|
|
|
|
if (records != null && records.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
records = records.OrderBy(x => x.RecordTime2).ToList();
|
|
|
|
|
Application.Current.Dispatcher.Invoke(() =>
|
|
|
|
@ -226,7 +237,7 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
RecordTime = record.RecordTime2.ToString()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@ -244,30 +255,30 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
if (list == null || list.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
var result = from m in list
|
|
|
|
|
group m by GetSubstringBetweenCommas(m.BoxName) into g
|
|
|
|
|
select new CodeBindCharts()
|
|
|
|
|
{
|
|
|
|
|
BoxName = g.Key,
|
|
|
|
|
Amount = g.Sum(m=>m.Amount)
|
|
|
|
|
};
|
|
|
|
|
group m by GetSubstringBetweenCommas(m.BoxName) into g
|
|
|
|
|
select new CodeBindCharts()
|
|
|
|
|
{
|
|
|
|
|
BoxName = g.Key,
|
|
|
|
|
Amount = g.Sum(m => m.Amount)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
App.Current.Dispatcher.Invoke(() =>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ProductionHourList.Clear();
|
|
|
|
|
ModelStatistics.Clear();
|
|
|
|
|
|
|
|
|
|
ProductionHourList.Clear();
|
|
|
|
|
ModelStatistics.Clear();
|
|
|
|
|
// 图表赋值
|
|
|
|
|
ChartValues<ObservablePoint> achievement = new ChartValues<ObservablePoint>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
double total = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in result)
|
|
|
|
|
{
|
|
|
|
|
ProductionHourList.Add(item.BoxName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
achievement.Add(new ObservablePoint(i, item.Amount));
|
|
|
|
|
total += item.Amount;
|
|
|
|
|
i++;
|
|
|
|
@ -283,7 +294,7 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
column.Foreground = Brushes.White;
|
|
|
|
|
ModelStatistics.Add(column);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
@ -397,13 +408,13 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
bindingInfo = value;
|
|
|
|
|
OnPropertyChanged(nameof(BindingInfo));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 日产量柱状图X轴日期
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 日产量柱状图X轴日期
|
|
|
|
|
/// </summary>
|
|
|
|
|
private List<string> productionHourList =new List<string>();
|
|
|
|
|
private List<string> productionHourList = new List<string>();
|
|
|
|
|
|
|
|
|
|
public List<string> ProductionHourList
|
|
|
|
|
{
|
|
|
|
@ -446,62 +457,67 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
/// <param name="scannerIp"></param>
|
|
|
|
|
private async void ReceiveNoRead(string scannerIp)
|
|
|
|
|
{
|
|
|
|
|
ScannerModel model = allScanners.FirstOrDefault(x => x.Ip == scannerIp);
|
|
|
|
|
if (model.Id == 1)
|
|
|
|
|
// ScannerModel model = allScanners.FirstOrDefault(x => x.Ip == scannerIp);
|
|
|
|
|
if (scannerIp == MesScannerIp)
|
|
|
|
|
{
|
|
|
|
|
log.Info("MES条码NoRead:");
|
|
|
|
|
// 全局变量赋值
|
|
|
|
|
// code1Str = string.Empty ;
|
|
|
|
|
// code2Str = string.Empty;
|
|
|
|
|
// 页面扫码信息清空
|
|
|
|
|
Code1 = string.Empty;
|
|
|
|
|
Code2 = string.Empty;
|
|
|
|
|
Code1Time = string.Empty ;
|
|
|
|
|
Code2Time = string.Empty ;
|
|
|
|
|
// log.Info("MES条码NoRead:");
|
|
|
|
|
Clear();
|
|
|
|
|
SendPlcStop();
|
|
|
|
|
RefreshAndWriteLog("MES条码未扫描到,NoRead报警,线体停止,请重新扫描!");
|
|
|
|
|
}
|
|
|
|
|
else if(model.Id == 2)
|
|
|
|
|
else if (SnScannerIp == scannerIp)
|
|
|
|
|
{
|
|
|
|
|
RefreshAndWriteLog("SN条码未扫描到,NoRead报警,线体停止,请重新扫描!");
|
|
|
|
|
// code1Str = string.Empty;
|
|
|
|
|
// code2Str = string.Empty;
|
|
|
|
|
// 页面扫码信息清空
|
|
|
|
|
Code1 = string.Empty;
|
|
|
|
|
Code2 = string.Empty;
|
|
|
|
|
Code1Time = string.Empty;
|
|
|
|
|
Code2Time = string.Empty;
|
|
|
|
|
|
|
|
|
|
Clear();
|
|
|
|
|
SendPlcStop();
|
|
|
|
|
RefreshAndWriteLog("SN条码未扫描到,NoRead报警,线体停止,请重新扫描!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 接收扫码器传输的条码,扫码器ip
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="code1"></param>
|
|
|
|
|
/// <param name="scannerIp"></param>
|
|
|
|
|
private void ReceiveCode(string codeStr,string scannerIp)
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 页面扫码信息清空
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Clear()
|
|
|
|
|
{
|
|
|
|
|
code1Str = string.Empty;
|
|
|
|
|
code2Str = string.Empty;
|
|
|
|
|
// 页面扫码信息清空
|
|
|
|
|
Code1 = string.Empty;
|
|
|
|
|
Code2 = string.Empty;
|
|
|
|
|
Code1Time = string.Empty;
|
|
|
|
|
Code2Time = string.Empty;
|
|
|
|
|
BindingInfo = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 接收扫码器传输的条码,扫码器ip
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="code1"></param>
|
|
|
|
|
/// <param name="scannerIp"></param>
|
|
|
|
|
private void ReceiveCode(string scannerIp, string codeStr)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// ScannerModel model = allScanners.FirstOrDefault(x => x.Ip == scannerIp);
|
|
|
|
|
if (MesScannerIp == scannerIp)
|
|
|
|
|
{
|
|
|
|
|
log.Info("扫描到MES条码:" + codeStr);
|
|
|
|
|
// 全局变量赋值,SN码扫描后使用
|
|
|
|
|
code1Str = codeStr;
|
|
|
|
|
RefreshCode1(codeStr);
|
|
|
|
|
}
|
|
|
|
|
else if (SnScannerIp == scannerIp)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Clear();
|
|
|
|
|
|
|
|
|
|
log.Info("扫描到成品条码:" + codeStr);
|
|
|
|
|
// 1.刷新界面条码信息
|
|
|
|
|
// 全局变量赋值,mes条码扫描后使用
|
|
|
|
|
code2Str = codeStr;
|
|
|
|
|
RefreshCode2(codeStr);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ScannerModel model = allScanners.FirstOrDefault(x => x.Ip == scannerIp);
|
|
|
|
|
if (model.Id == 1)
|
|
|
|
|
{
|
|
|
|
|
log.Info("扫描到MES条码:" + codeStr);
|
|
|
|
|
// 全局变量赋值,SN码扫描后使用
|
|
|
|
|
// code1Str = codeStr;
|
|
|
|
|
RefreshCode1(codeStr);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
log.Info("扫描到成品条码:" + codeStr);
|
|
|
|
|
// 1.刷新界面条码信息
|
|
|
|
|
// 全局变量赋值,mes条码扫描后使用
|
|
|
|
|
// code2Str = codeStr;
|
|
|
|
|
RefreshCode2(codeStr);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region
|
|
|
|
|
// 2.创建任务更新数据库条码1
|
|
|
|
|
// CodeBindingRecord codeRecord = new CodeBindingRecord();
|
|
|
|
@ -520,8 +536,8 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
//});
|
|
|
|
|
//log.Info("条码1记录更新");
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void RefreshCode1(string code1)
|
|
|
|
|
{
|
|
|
|
@ -536,7 +552,7 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
DateTime time = System.DateTime.Now;
|
|
|
|
|
Code2 = code2;
|
|
|
|
|
Code2Time = time.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -547,7 +563,7 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
private void RefreshAndWriteLog(string logStr)
|
|
|
|
|
{
|
|
|
|
|
TimeSpan currentTime = DateTime.Now.TimeOfDay;
|
|
|
|
|
// DateTime time = System.DateTime.Now;
|
|
|
|
|
// DateTime time = System.DateTime.Now;
|
|
|
|
|
string timeString = currentTime.ToString(@"hh\:mm\:ss");
|
|
|
|
|
BindingInfo = timeString + ":" + logStr;
|
|
|
|
|
log.Info(BindingInfo);
|
|
|
|
@ -558,17 +574,17 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="code1">MES码</param>
|
|
|
|
|
/// <param name="code2">SN码</param>
|
|
|
|
|
public void BindingCode(string code1,string code2)
|
|
|
|
|
public void BindingCode(string code1, string code2)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (code1.Substring(0, 1) != "B")
|
|
|
|
|
{
|
|
|
|
|
RefreshAndWriteLog("MES码:"+code1+",扫描错误,请重新扫描!");
|
|
|
|
|
RefreshAndWriteLog("MES码:" + code1 + ",扫描错误,请重新扫描!");
|
|
|
|
|
SendPlcStop();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (code2.Length!=20)
|
|
|
|
|
if (code2.Length != 20)
|
|
|
|
|
{
|
|
|
|
|
RefreshAndWriteLog("SN码:" + code2 + ",扫描错误,请重新扫描!");
|
|
|
|
|
SendPlcStop();
|
|
|
|
@ -578,7 +594,7 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
// 1.数据库查询各个工序质检结果,不合格报警
|
|
|
|
|
|
|
|
|
|
//// 2.查询条码绑定记录表(内胆箱壳绑定处就应该插入记录),绑定SN码
|
|
|
|
|
int Repeatflag = 0;
|
|
|
|
|
int Repeatflag = 0;
|
|
|
|
|
CodeBindingRecord record = _codeBindingRecordServices.FirstAsync(x => x.BoxCode == code1).Result;
|
|
|
|
|
if (record == null)
|
|
|
|
|
{
|
|
|
|
@ -593,7 +609,7 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BaseMaterialInfo materialInfo = _baseMaterialInfoServices.FirstAsync(x => x.MaterialCode == code1.Substring(7, 10)).Result;
|
|
|
|
|
if(materialInfo == null)
|
|
|
|
|
if (materialInfo == null)
|
|
|
|
|
{
|
|
|
|
|
record.BoxName = "";
|
|
|
|
|
}
|
|
|
|
@ -608,15 +624,15 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
record.isPlcPass = 1;
|
|
|
|
|
record.BindingResult = "成功";
|
|
|
|
|
bool result = false;
|
|
|
|
|
if (Repeatflag==0)
|
|
|
|
|
if (Repeatflag == 0)
|
|
|
|
|
{ // 没有记录,新加
|
|
|
|
|
result = _codeBindingRecordServices.AddAsync(record).Result >0? true: false;
|
|
|
|
|
result = _codeBindingRecordServices.AddAsync(record).Result > 0 ? true : false;
|
|
|
|
|
}
|
|
|
|
|
else if(Repeatflag==1)
|
|
|
|
|
else if (Repeatflag == 1)
|
|
|
|
|
{
|
|
|
|
|
result = _codeBindingRecordServices.UpdateAsync(record).Result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
RefreshAndWriteLog("条码【" + record.BoxCode + "】与SN码【" + record.ProductCode + "】绑定成功");
|
|
|
|
@ -658,8 +674,8 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
// code1Str = string.Empty;
|
|
|
|
|
// code2Str = string.Empty;
|
|
|
|
|
// code1Str = string.Empty;
|
|
|
|
|
// code2Str = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -674,7 +690,7 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
{
|
|
|
|
|
bool result = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("条码绑定Plc"));
|
|
|
|
|
if (obj != null)
|
|
|
|
|
{
|
|
|
|
@ -682,10 +698,10 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
// 往plc写入停止信号
|
|
|
|
|
obj.plc.WriteInt16("D7102", "1");
|
|
|
|
|
// 报警信号
|
|
|
|
|
obj.plc.WriteInt16("D7101","1");
|
|
|
|
|
obj.plc.WriteInt16("D7101", "1");
|
|
|
|
|
result = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
@ -729,20 +745,20 @@ namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
|
/// <param name="flag"></param>
|
|
|
|
|
private void SendHeart(PlcModel obj,string flag)
|
|
|
|
|
private void SendHeart(PlcModel obj, string flag)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// log.Info("心跳D7100写:"+flag);
|
|
|
|
|
// log.Info("心跳D7100写:"+flag);
|
|
|
|
|
// 往plc写入停止信号
|
|
|
|
|
obj.plc.WriteInt16("D7100", flag);
|
|
|
|
|
// obj.plc.WriteInt32("D7102", 1);
|
|
|
|
|
// obj.plc.WriteInt32("D7102", 1);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
log.Error("SendHeart异常,ex:" + ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|