diff --git a/RIZO.Admin.WebApi/PLC/Service/PlcService.cs b/RIZO.Admin.WebApi/PLC/Service/PlcService.cs index 5fc2751..2658f40 100644 --- a/RIZO.Admin.WebApi/PLC/Service/PlcService.cs +++ b/RIZO.Admin.WebApi/PLC/Service/PlcService.cs @@ -210,7 +210,9 @@ namespace RIZO.Admin.WebApi.PLC.Service { { "报警信息", ("DB1001.DBB58", 48) }, // Array[1..48] of Byte { "产品型号", ("DB1001.DBB1000", 48) }, // String[48] - { "产品名称", ("DB1001.DBB1054", 48) } // String[48] + { "产品名称", ("DB1001.DBB1054", 48) }, // String[48] + { "产品3SN", ("DB1001.DBB362", 40) }, // String[40] + { "产品4SN", ("DB1001.DBB518", 40) } // String[40] }; private readonly Dictionary _op050_1IntMap = new() @@ -221,12 +223,19 @@ namespace RIZO.Admin.WebApi.PLC.Service { "设备在线状态", "DB1001.DBW4" }, // Int - 1=离线,0=在线 { "ByPass", "DB1001.DBW6" }, // Int - 1=ByPass,0=正常模式 { "生产模式", "DB1001.DBW8" }, // Int - 1=正常模式;2=清线模式;4=返工模式;8=换型模式;16=预热模式 - + // 产量数据 { "实际产量", "DB1001.DBD1104" }, // DInt { "合格数量", "DB1001.DBD1108" }, // DInt { "失败数量", "DB1001.DBD1112" }, // DInt - + + // 请求指令 + { "查询请求", "DB1001.DBW2000" }, // Int - 1:请求开始,0:无请求 + { "产品1保存请求", "DB1001.DBW2002" }, // Int + { "产品2保存请求", "DB1001.DBW2004" }, // Int + { "产品3保存请求", "DB1001.DBW2006" }, // Int + { "产品4保存请求", "DB1001.DBW2008" }, // Int + // 节拍时间 { "节拍时间", "DB1001.DBD5086" }, // Real }; @@ -313,6 +322,10 @@ namespace RIZO.Admin.WebApi.PLC.Service { "实际产量", "DB1004.DBD1104" }, // DInt { "合格数量", "DB1004.DBD1108" }, // DInt { "失败数量", "DB1004.DBD1112" }, // DInt + + // 操作请求 + { "工位开始查询请求", "DB1001.DBW2000" }, // Int - 1=请求开始,0=无请求 + { "1#产品结果保存请求", "DB1001.DBW2002" }, // Int - 1=请求,0=无请求 // 产品结果 { "产品总结果", "DB1004.DBW2278" }, // Int - 1=OK,2=NG @@ -1260,7 +1273,7 @@ namespace RIZO.Admin.WebApi.PLC.Service iSaveRequest = await ReadPlcIntAsync(plc, _op020_2IntMap["上传请求"]).ConfigureAwait(false); break; case "OP020-3": - iSaveRequest = 1; + iSaveRequest = await ReadPlcIntAsync(plc, _op020_3IntMap["上传请求"]).ConfigureAwait(false); break; case "OP020-4": var task4_1 = ReadPlcIntAsync(plc, _op020_4IntMap["产品1上传请求"]); @@ -1274,7 +1287,13 @@ namespace RIZO.Admin.WebApi.PLC.Service iSaveRequest = await ReadPlcIntAsync(plc, _op050IntMap["上传请求"]).ConfigureAwait(false); break; case "OP050-1": - iSaveRequest = 1; + var task5_1 = ReadPlcIntAsync(plc, _op050_1IntMap["产品1保存请求"]); + var task5_2 = ReadPlcIntAsync(plc, _op050_1IntMap["产品2保存请求"]); + var task5_3 = ReadPlcIntAsync(plc, _op050_1IntMap["产品3保存请求"]); + var task5_4 = ReadPlcIntAsync(plc, _op050_1IntMap["产品4保存请求"]); + await Task.WhenAll(task5_1, task5_2, task5_3, task5_4).ConfigureAwait(false); + iSaveRequest = (task5_1.Result == 1 || task5_2.Result == 1 || task5_3.Result == 1 || task5_4.Result == 1) ? 1 : 0; + break; break; case "OP051扫码": iSaveRequest = await ReadPlcIntAsync(plc, _op051ScanIntMap["上传结果请求"]).ConfigureAwait(false); @@ -1283,7 +1302,7 @@ namespace RIZO.Admin.WebApi.PLC.Service iSaveRequest = await ReadPlcIntAsync(plc, _op057IntMap["1#产品结果保存请求"]).ConfigureAwait(false); break; case "OP058": - iSaveRequest = 1; + iSaveRequest = await ReadPlcIntAsync(plc, _op058IntMap["1#产品结果保存请求"]).ConfigureAwait(false); break; case "OP060": iSaveRequest = await ReadPlcIntAsync(plc, _op060IntMap["1#产品结果保存请求"]).ConfigureAwait(false); @@ -1341,7 +1360,7 @@ namespace RIZO.Admin.WebApi.PLC.Service break; case "OP115": //iSaveRequest = await ReadPlcIntAsync(plc, _op115IntMap["结果保存请求"]).ConfigureAwait(false); - iSaveRequest = 1; + iSaveRequest = 0; break; case "OP140": iSaveRequest = await ReadPlcIntAsync(plc, _op140IntMap["结果保存请求"]).ConfigureAwait(false);