修正
This commit is contained in:
parent
e8116783c8
commit
e1380da7b3
@ -63,10 +63,10 @@ namespace RIZO.Service.PLCBackground.Stations.Into
|
||||
try
|
||||
{
|
||||
//心跳检测 "DB1010.DBW0"
|
||||
await _plcService.WriteAsync(plcSetting.intoStation.Heartbeat, 1);
|
||||
await _plcService.WriteAsync(plcSetting.intoStation.Heartbeat, (short)1);
|
||||
|
||||
// 轮询进站请求信号/工位开始查询请求 "DB1001.DBW2000"
|
||||
int intoStationAsk = await _plcService.ReadAsync<int>(plcSetting.intoStation.IntoStationAsk);
|
||||
short intoStationAsk = await _plcService.ReadAsync<short>(plcSetting.intoStation.IntoStationAsk);
|
||||
if (intoStationAsk == 1)
|
||||
{
|
||||
// 处理进站请求
|
||||
@ -91,7 +91,7 @@ namespace RIZO.Service.PLCBackground.Stations.Into
|
||||
{
|
||||
ProductSN = productSN,
|
||||
WorkstationCode = WorkstationCode,
|
||||
Routingcode = processOperations.First().FkRoutingCode,
|
||||
Routingcode = processOperations?.First()?.FkRoutingCode??"",
|
||||
OperationCode = WorkstationCode,
|
||||
OperationName= plcSetting.WorkStationName,
|
||||
ProductionLifeStage = 1, // 1表示生产中
|
||||
@ -104,7 +104,7 @@ namespace RIZO.Service.PLCBackground.Stations.Into
|
||||
//判断该产品是否允许进站
|
||||
EntryPermissionResult result = await checkEntryPermission(productModel, productSN, WorkstationCode, processOperations);
|
||||
// "DB1010.DBW2000"
|
||||
await _plcService.WriteAsync(plcSetting.intoStation.IntoStationResp, (int)result);
|
||||
await _plcService.WriteAsync(plcSetting.intoStation.IntoStationResp, (short)result);
|
||||
}
|
||||
await Task.Delay(_pollingInterval, stoppingToken);
|
||||
|
||||
|
||||
@ -61,10 +61,10 @@ namespace RIZO.Service.PLCBackground.Stations.Into
|
||||
try
|
||||
{
|
||||
//心跳检测 "DB1010.DBW0"
|
||||
await _plcService.WriteAsync(plcSetting.intoStation.Heartbeat, 1);
|
||||
await _plcService.WriteAsync(plcSetting.intoStation.Heartbeat, (short)1);
|
||||
|
||||
// 轮询进站请求信号/工位开始查询请求 "DB1001.DBW2000"
|
||||
int intoStationAsk = await _plcService.ReadAsync<int>(plcSetting.intoStation.IntoStationAsk);
|
||||
short intoStationAsk = await _plcService.ReadAsync<short>(plcSetting.intoStation.IntoStationAsk);
|
||||
if (intoStationAsk == 1)
|
||||
{
|
||||
// 处理进站请求
|
||||
@ -102,7 +102,7 @@ namespace RIZO.Service.PLCBackground.Stations.Into
|
||||
//判断该产品是否允许进站
|
||||
EntryPermissionResult result = await checkEntryPermission(productModel, productSN, WorkstationCode, processOperations);
|
||||
// "DB1010.DBW2000"
|
||||
await _plcService.WriteAsync(plcSetting.intoStation.IntoStationResp, (int)result);
|
||||
await _plcService.WriteAsync(plcSetting.intoStation.IntoStationResp, (short)result);
|
||||
}
|
||||
await Task.Delay(_pollingInterval, stoppingToken);
|
||||
|
||||
|
||||
@ -55,10 +55,10 @@ namespace RIZO.Service.PLCBackground.Stations.Into
|
||||
try
|
||||
{
|
||||
//心跳检测
|
||||
await _plcService.WriteAsync("DB1020.DBW0", 1);
|
||||
await _plcService.WriteAsync("DB1020.DBW0", (short)1);
|
||||
|
||||
// 轮询进站请求信号/工位开始查询请求
|
||||
int intoStationAsk = await _plcService.ReadAsync<int>("DB1017.DBW2000");
|
||||
short intoStationAsk = await _plcService.ReadAsync<short>("DB1017.DBW2000");
|
||||
if (intoStationAsk == 1)
|
||||
{
|
||||
// 处理进站请求
|
||||
@ -67,7 +67,7 @@ namespace RIZO.Service.PLCBackground.Stations.Into
|
||||
//获取产品SN码
|
||||
string productModel = await _plcService.ReadStringAsync("DB1017.DBB1000");
|
||||
string productSN = await _plcService.ReadStringAsync("DB1017.DBB1054");
|
||||
int ReWorkFlag = await _plcService.ReadAsync<int>("DB1017.DBW8");
|
||||
short ReWorkFlag = await _plcService.ReadAsync<short>("DB1017.DBW8");
|
||||
//判断改产品是正常件还是返工件
|
||||
if (ReWorkFlag == 2)
|
||||
{
|
||||
@ -79,21 +79,13 @@ namespace RIZO.Service.PLCBackground.Stations.Into
|
||||
List<ProcessOperation> processOperations = await Context.Queryable<ProcessRouting>().LeftJoin<ProcessOperation>((r, o) => r.RoutingCode == o.FkRoutingCode)
|
||||
.Where((r, o) => r.FkProductMaterialCode == productModel && r.Status == 1)
|
||||
.Select((r, o) => o).ToListAsync();
|
||||
var routingcode = string.Empty;
|
||||
try
|
||||
{
|
||||
routingcode = processOperations.First().FkRoutingCode;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (routingcode == null || routingcode.Length == 0)
|
||||
return;
|
||||
|
||||
//插入入站请求ASK过站记录
|
||||
ProductPassStationRecord ASKintoStation = new ProductPassStationRecord
|
||||
{
|
||||
ProductSN = productSN,
|
||||
WorkstationCode = WorkstationCode,
|
||||
Routingcode = routingcode,
|
||||
Routingcode = processOperations?.FirstOrDefault()?.FkRoutingCode ?? "",
|
||||
OperationCode = WorkstationCode,
|
||||
ProductionLifeStage = 1, // 1表示生产中
|
||||
PasstationType = 0, // 0表示入站请求
|
||||
@ -105,9 +97,8 @@ namespace RIZO.Service.PLCBackground.Stations.Into
|
||||
//判断该产品是否允许进站
|
||||
EntryPermissionResult result = await checkEntryPermission(productModel, productSN, WorkstationCode, processOperations);
|
||||
//进站请求结果
|
||||
await _plcService.WriteAsync2("DB1317.DBW2000", (int)result);
|
||||
//设别使能1
|
||||
await _plcService.WriteAsync2("DB1317.DBW0", 1);
|
||||
await _plcService.WriteAsync("DB1317.DBW2000", (short)result);
|
||||
|
||||
}
|
||||
await Task.Delay(_pollingInterval, stoppingToken);
|
||||
|
||||
|
||||
@ -52,10 +52,10 @@ namespace RIZO.Service.PLCBackground.Stations.Into
|
||||
try
|
||||
{
|
||||
//心跳检测
|
||||
await _plcService.WriteAsync("DB1020.DBW0", 1);
|
||||
await _plcService.WriteAsync("DB1020.DBW0", (short)1);
|
||||
|
||||
// 轮询进站请求信号/工位开始查询请求
|
||||
int intoStationAsk = await _plcService.ReadAsync<int>("DB1021.DBW2000");
|
||||
short intoStationAsk = await _plcService.ReadAsync<short>("DB1021.DBW2000");
|
||||
if (intoStationAsk == 1)
|
||||
{
|
||||
// 处理进站请求
|
||||
@ -79,7 +79,7 @@ namespace RIZO.Service.PLCBackground.Stations.Into
|
||||
{
|
||||
ProductSN = productSN,
|
||||
WorkstationCode = WorkstationCode,
|
||||
Routingcode = processOperations.First().FkRoutingCode,
|
||||
Routingcode = Routingcode = processOperations?.FirstOrDefault()?.FkRoutingCode ?? "",
|
||||
OperationCode = WorkstationCode,
|
||||
ProductionLifeStage = 1, // 1表示生产中
|
||||
PasstationType = 0, // 0表示入站请求
|
||||
@ -90,7 +90,7 @@ namespace RIZO.Service.PLCBackground.Stations.Into
|
||||
await Context.Insertable(ASKintoStation).ExecuteCommandAsync();
|
||||
//判断该产品是否允许进站
|
||||
EntryPermissionResult result = await checkEntryPermission(productModel, productSN, WorkstationCode, processOperations);
|
||||
await _plcService.WriteAsync("DB1020.DBW2000", (int)result);
|
||||
await _plcService.WriteAsync("DB1020.DBW2000", (short)result);
|
||||
}
|
||||
await Task.Delay(_pollingInterval, stoppingToken);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user