@ -330,12 +330,12 @@ namespace ZJ_BYD
{
{
BarCode = resultBarcode ;
BarCode = resultBarcode ;
//打印反馈
//打印反馈
Program . omronCip Net. Write ( M17 . Address , ushort . Parse ( "1" ) ) ;
Program . siemensS7 Net. Write ( M17 . Address , ushort . Parse ( "1" ) ) ;
}
}
else
else
{
{
//打印反馈
//打印反馈
Program . omronCip Net. Write ( M17 . Address , ushort . Parse ( "2" ) ) ;
Program . siemensS7 Net. Write ( M17 . Address , ushort . Parse ( "2" ) ) ;
}
}
_logs . Add ( new LogVm
_logs . Add ( new LogVm
{
{
@ -351,7 +351,7 @@ namespace ZJ_BYD
var msg = ex = = null ? "操作异常" : ex . Message ;
var msg = ex = = null ? "操作异常" : ex . Message ;
LogHelper . WriteErrorLog ( $"标签打印时异常:{msg}" ) ;
LogHelper . WriteErrorLog ( $"标签打印时异常:{msg}" ) ;
//打印反馈
//打印反馈
Program . omronCip Net. Write ( M17 . Address , ushort . Parse ( "2" ) ) ;
Program . siemensS7 Net. Write ( M17 . Address , ushort . Parse ( "2" ) ) ;
}
}
}
}
else
else
@ -397,17 +397,17 @@ namespace ZJ_BYD
Log = $"{DateTime.Now:HH:mm:ss}>>>>>主条码匹配反馈:{(ok ? " OK " : " NG ")},详情:{msg}{Environment.NewLine}" ;
Log = $"{DateTime.Now:HH:mm:ss}>>>>>主条码匹配反馈:{(ok ? " OK " : " NG ")},详情:{msg}{Environment.NewLine}" ;
if ( ok )
if ( ok )
{
{
Program . omronCip Net. Write ( M20 . Address , ushort . Parse ( "1" ) ) ;
Program . siemensS7 Net. Write ( M20 . Address , ushort . Parse ( "1" ) ) ;
}
}
else
else
{
{
Program . omronCip Net. Write ( M20 . Address , ushort . Parse ( "2" ) ) ;
Program . siemensS7 Net. Write ( M20 . Address , ushort . Parse ( "2" ) ) ;
}
}
}
}
catch ( Exception ex )
catch ( Exception ex )
{
{
Program . omronCip Net. Write ( M20 . Address , ushort . Parse ( "2" ) ) ;
Program . siemensS7 Net. Write ( M20 . Address , ushort . Parse ( "2" ) ) ;
var errMsg = ex = = null ? "未知异常" : ex . Message ;
var errMsg = ex = = null ? "未知异常" : ex . Message ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>{errMsg}" ) ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>{errMsg}" ) ;
runMainMatch = true ;
runMainMatch = true ;
@ -983,16 +983,16 @@ namespace ZJ_BYD
{
{
CheckCode . SearchEmptyTotalWeight ( _plcPoints , out var emptyTotalWeight ) ;
CheckCode . SearchEmptyTotalWeight ( _plcPoints , out var emptyTotalWeight ) ;
var M31 = _plcPoints . FirstOrDefault ( m = > m . Key = = "M31" ) ;
var M31 = _plcPoints . FirstOrDefault ( m = > m . Key = = "M31" ) ;
var writeOk = Program . omronCip Net. Write ( M31 . Address , emptyTotalWeight ) ;
var writeOk = Program . siemensS7 Net. Write ( M31 . Address , emptyTotalWeight ) ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>一体机启动反馈:获取压缩机总空重成功,数据值:{emptyTotalWeight}, 写入M31" ) ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>一体机启动反馈:获取压缩机总空重成功,数据值:{emptyTotalWeight}, 写入M31" ) ;
var M26 = _plcPoints . FirstOrDefault ( m = > m . Key = = "M26" ) ;
var M26 = _plcPoints . FirstOrDefault ( m = > m . Key = = "M26" ) ;
if ( writeOk . IsSuccess )
if ( writeOk . IsSuccess )
{
{
Program . omronCip Net. Write ( M26 . Address , ushort . Parse ( "1" ) ) ;
Program . siemensS7 Net. Write ( M26 . Address , ushort . Parse ( "1" ) ) ;
}
}
else
else
{
{
Program . omronCip Net. Write ( M26 . Address , ushort . Parse ( "2" ) ) ;
Program . siemensS7 Net. Write ( M26 . Address , ushort . Parse ( "2" ) ) ;
}
}
}
}
else
else
@ -1015,11 +1015,11 @@ namespace ZJ_BYD
{
{
if ( ok . Value )
if ( ok . Value )
{
{
Program . omronCip Net. Write ( M26 . Address , ushort . Parse ( "1" ) ) ;
Program . siemensS7 Net. Write ( M26 . Address , ushort . Parse ( "1" ) ) ;
}
}
else
else
{
{
Program . omronCip Net. Write ( M26 . Address , ushort . Parse ( "2" ) ) ;
Program . siemensS7 Net. Write ( M26 . Address , ushort . Parse ( "2" ) ) ;
}
}
}
}
_logs . Add ( new LogVm
_logs . Add ( new LogVm
@ -1341,7 +1341,7 @@ namespace ZJ_BYD
}
}
else
else
{
{
Program . omronCip Net. Write ( M31 . Address , weight ) ;
Program . siemensS7 Net. Write ( M31 . Address , weight ) ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>一体机启动反馈:获取[{value.Key}]成功,数据值:{value.Value}, 写入M31" ) ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>一体机启动反馈:获取[{value.Key}]成功,数据值:{value.Value}, 写入M31" ) ;
}
}
}
}
@ -1350,7 +1350,7 @@ namespace ZJ_BYD
{
{
var value = values . keyValues . ElementAt ( 1 ) ;
var value = values . keyValues . ElementAt ( 1 ) ;
var M32 = _plcPoints . FirstOrDefault ( m = > m . Key = = "M32" ) ;
var M32 = _plcPoints . FirstOrDefault ( m = > m . Key = = "M32" ) ;
Program . omronCip Net. Write ( M32 . Address , float . Parse ( value . Value ) ) ;
Program . siemensS7 Net. Write ( M32 . Address , float . Parse ( value . Value ) ) ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>一体机启动反馈:获取[{value.Key}]成功,数据值:{value.Value}, 写入M32" ) ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>一体机启动反馈:获取[{value.Key}]成功,数据值:{value.Value}, 写入M32" ) ;
}
}
}
}
@ -1369,11 +1369,11 @@ namespace ZJ_BYD
var M26 = _plcPoints . FirstOrDefault ( m = > m . Key = = "M26" ) ;
var M26 = _plcPoints . FirstOrDefault ( m = > m . Key = = "M26" ) ;
if ( isCheck )
if ( isCheck )
{
{
Program . omronCip Net. Write ( M26 . Address , ushort . Parse ( "1" ) ) ;
Program . siemensS7 Net. Write ( M26 . Address , ushort . Parse ( "1" ) ) ;
}
}
else
else
{
{
Program . omronCip Net. Write ( M26 . Address , ushort . Parse ( "2" ) ) ;
Program . siemensS7 Net. Write ( M26 . Address , ushort . Parse ( "2" ) ) ;
}
}
}
}
catch ( Exception ex )
catch ( Exception ex )
@ -1543,20 +1543,20 @@ namespace ZJ_BYD
{
{
if ( isOk )
if ( isOk )
{
{
var result = Program . omronCip Net. Write ( M24 . Address , ushort . Parse ( "1" ) ) ;
var result = Program . siemensS7 Net. Write ( M24 . Address , ushort . Parse ( "1" ) ) ;
if ( ! result . IsSuccess )
if ( ! result . IsSuccess )
{
{
Program . omronCip Net. Write ( M24 . Address , ushort . Parse ( "1" ) ) ;
Program . siemensS7 Net. Write ( M24 . Address , ushort . Parse ( "1" ) ) ;
}
}
savedb = true ;
savedb = true ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>写入PLC地址M24, 数据值: 1" ) ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>写入PLC地址M24, 数据值: 1" ) ;
}
}
else
else
{
{
var result = Program . omronCip Net. Write ( M24 . Address , ushort . Parse ( "2" ) ) ;
var result = Program . siemensS7 Net. Write ( M24 . Address , ushort . Parse ( "2" ) ) ;
if ( ! result . IsSuccess )
if ( ! result . IsSuccess )
{
{
Program . omronCip Net. Write ( M24 . Address , ushort . Parse ( "2" ) ) ;
Program . siemensS7 Net. Write ( M24 . Address , ushort . Parse ( "2" ) ) ;
}
}
savedb = true ;
savedb = true ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>写入PLC地址M24, 数据值: 2" ) ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>写入PLC地址M24, 数据值: 2" ) ;
@ -1579,13 +1579,13 @@ namespace ZJ_BYD
{
{
if ( isOk )
if ( isOk )
{
{
Program . omronCip Net. Write ( M22 . Address , ushort . Parse ( "1" ) ) ;
Program . siemensS7 Net. Write ( M22 . Address , ushort . Parse ( "1" ) ) ;
savedb = true ;
savedb = true ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>写入PLC地址M22, 数据值: 1" ) ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>写入PLC地址M22, 数据值: 1" ) ;
}
}
else
else
{
{
Program . omronCip Net. Write ( M22 . Address , ushort . Parse ( "2" ) ) ;
Program . siemensS7 Net. Write ( M22 . Address , ushort . Parse ( "2" ) ) ;
savedb = true ;
savedb = true ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>写入PLC地址M22, 数据值: 2" ) ;
LogHandler ( $"{DateTime.Now:HH:mm:ss}>>>>>写入PLC地址M22, 数据值: 2" ) ;
}
}