|
|
|
@ -77,7 +77,6 @@ namespace ConsoleApp
|
|
|
|
case "S130-1":
|
|
|
|
case "S130-1":
|
|
|
|
_plcHeartBeatAddress = "D7777";
|
|
|
|
_plcHeartBeatAddress = "D7777";
|
|
|
|
_completeAskAddress = "D7703";
|
|
|
|
_completeAskAddress = "D7703";
|
|
|
|
_productBarcode = "";
|
|
|
|
|
|
|
|
_semiBarcode1 = "D7701";
|
|
|
|
_semiBarcode1 = "D7701";
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "S130-2":
|
|
|
|
case "S130-2":
|
|
|
|
@ -88,6 +87,12 @@ namespace ConsoleApp
|
|
|
|
_semiBarcode1 = "D7801";
|
|
|
|
_semiBarcode1 = "D7801";
|
|
|
|
_semiBarcode2 = "D7802";
|
|
|
|
_semiBarcode2 = "D7802";
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "A20":
|
|
|
|
|
|
|
|
_plcHeartBeatAddress = "D7777";
|
|
|
|
|
|
|
|
_completeAskAddress = "D7703";
|
|
|
|
|
|
|
|
_productBarcode = "D7700";
|
|
|
|
|
|
|
|
_semiBarcode1 = "D7701";
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
@ -118,6 +123,7 @@ namespace ConsoleApp
|
|
|
|
case "S130-1":
|
|
|
|
case "S130-1":
|
|
|
|
if (Plc.readInt16ByAddress(_completeAskAddress) == 1)
|
|
|
|
if (Plc.readInt16ByAddress(_completeAskAddress) == 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Info(StationCode+"放行请求");
|
|
|
|
Plc.writeInt16ByAddress(_completeAskAddress, 0);
|
|
|
|
Plc.writeInt16ByAddress(_completeAskAddress, 0);
|
|
|
|
|
|
|
|
|
|
|
|
SaveStationDataTask(Plc);
|
|
|
|
SaveStationDataTask(Plc);
|
|
|
|
@ -127,11 +133,24 @@ namespace ConsoleApp
|
|
|
|
//读取PLC工作请求
|
|
|
|
//读取PLC工作请求
|
|
|
|
if (Plc.readInt16ByAddress(_workAskAddress) == 1)
|
|
|
|
if (Plc.readInt16ByAddress(_workAskAddress) == 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Info(StationCode + "工作请求");
|
|
|
|
|
|
|
|
|
|
|
|
Plc.writeInt16ByAddress(_workAskAddress, 0);
|
|
|
|
Plc.writeInt16ByAddress(_workAskAddress, 0);
|
|
|
|
//根据转子码查询上工位是否合格
|
|
|
|
//根据转子码查询上工位是否合格
|
|
|
|
SelectStationQuality(Plc);
|
|
|
|
SelectStationQuality(Plc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "A20":
|
|
|
|
|
|
|
|
//读取PLC工作请求
|
|
|
|
|
|
|
|
if (Plc.readInt16ByAddress(_completeAskAddress) == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Info(StationCode + "放行请求");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Plc.writeInt16ByAddress(_completeAskAddress, 0);
|
|
|
|
|
|
|
|
//根据转子码查询上工位是否合格
|
|
|
|
|
|
|
|
BarCodeRelationShipBinding(Plc);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -150,17 +169,22 @@ namespace ConsoleApp
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//前盖码
|
|
|
|
//壳体码
|
|
|
|
byte[] _QGBarcode = Plc.readValueByAddress(_semiBarcode2, 20);
|
|
|
|
byte[] _KTBarcode = Plc.readValueByAddress(_productBarcode, 20);
|
|
|
|
string QGBarCode = ByteTransform.TransString(_QGBarcode, 0, 20, Encoding.ASCII);
|
|
|
|
string KTBarCode = ByteTransform.TransString(_KTBarcode, 0, 20, Encoding.ASCII);
|
|
|
|
_logger.Info("前盖码:"+ QGBarCode);
|
|
|
|
_logger.Info("壳体码:"+ KTBarCode);
|
|
|
|
|
|
|
|
|
|
|
|
//转子码
|
|
|
|
//定子码
|
|
|
|
byte[] _ZZBarcode = Plc.readValueByAddress(_semiBarcode1, 20);
|
|
|
|
byte[] _DZBarcode = Plc.readValueByAddress(_semiBarcode1, 20);
|
|
|
|
string ZZBarCode = ByteTransform.TransString(_ZZBarcode, 0, 20, Encoding.ASCII);
|
|
|
|
string DZBarCode = ByteTransform.TransString(_DZBarcode, 0, 20, Encoding.ASCII);
|
|
|
|
_logger.Info("转子码:" + QGBarCode);
|
|
|
|
_logger.Info("定子码:" + DZBarCode);
|
|
|
|
//下发PLC
|
|
|
|
|
|
|
|
Plc.writeInt16ByAddress(_completeAskAddress, 1);
|
|
|
|
var Dipsn = SqlSugarClient.Queryable<Dataproduce>().First(it => it.Mainsn == KTBarCode);
|
|
|
|
|
|
|
|
if (Dipsn != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Dipsn.Snlist = Dipsn.Snlist + "," + DZBarCode;
|
|
|
|
|
|
|
|
int updateflag = SqlSugarClient.Updateable(Dipsn).ExecuteCommand();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|