You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.7 KiB
C#
67 lines
1.7 KiB
C#
using ATC_MaterialBind.Entity;
|
|
using Microsoft.IdentityModel.Logging;
|
|
using SlnMesnac.Business.@base;
|
|
using SlnMesnac.Plc;
|
|
using SlnMesnac.Repository.service;
|
|
using SlnMesnac.Repository.service.@base;
|
|
using SlnMesnac.Repository.service.Impl;
|
|
using SlnMesnac.Rfid;
|
|
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace SlnMesnac.Business.@base
|
|
{
|
|
public class MaterialBindBusiness : BaseBusiness
|
|
{
|
|
private IStationQualityInfoService _stationQualityInfoService;
|
|
public Action<bool> _PlcConnectState;
|
|
public MaterialBindBusiness(List<PlcAbsractFactory> plcFactories,IStationQualityInfoService stationQualityInfoService) : base(plcFactories)
|
|
{
|
|
_stationQualityInfoService = stationQualityInfoService;
|
|
}
|
|
public bool OK_FXSignal(String PlcAddress)
|
|
{
|
|
try
|
|
{
|
|
var plc = base.GetPlcByKey("plc");
|
|
var flag = plc.writeInt16ByAddress(PlcAddress, 1);
|
|
return flag;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
|
|
}
|
|
public bool NG_BJSignal(String PlcAddress)
|
|
{
|
|
try
|
|
{
|
|
var plc = base.GetPlcByKey("plc");
|
|
var flag = plc.writeInt16ByAddress(PlcAddress, 2);
|
|
return flag;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
|
|
}
|
|
public bool PLCState()
|
|
{
|
|
var plc = base.GetPlcByKey("plc");
|
|
_PlcConnectState?.Invoke(plc.IsConnected);
|
|
return plc.IsConnected;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|