|
@@ -225,7 +225,7 @@ namespace UAS_PLCDataReader
|
|
|
ButtonDeleteCommandSet.Grid = GridPollingSetting;
|
|
|
|
|
|
|
|
|
- GridCommandSetting.GetDataSQL = "select 0 CHECKEDCOLUMN,dc_id,dc_code,dc_ifng,dc_name,dc_type,case when dc_type='INQTY' then '投入' when dc_type='INGORE' then '忽略' when dc_type='NGQTY' then '不良' when dc_type='OUTQTY' then '产出' when dc_type='TEMPERATURE' then '温度' when dc_type='PARAM1' then '参数1' when dc_type='PARAM2' then '参数2' when dc_type='PARAM3' then '参数3' when dc_type='PARAM4' then '参数4' when dc_type='PARAM5' then '参数5' when dc_type='PARAM6' then '参数6' when dc_type='PARAM7' then '参数7' when dc_type='PARAM8' then '参数8' when dc_type='PARAM9' then '参数9' when dc_type='PARAM10' then '参数10' when dc_type='PARAM3' then '参数3' when dc_type='WAITTIME' then '待料时间' when dc_type='BREAKTIME' then '故障时长' when dc_type='MANSTOPTIME' then '人工停机时长' when dc_type='WORKTIME' then '正常工作时长' when dc_type='STARTTIME' then '开机时长' when dc_type='RUNTIME' then '设备运行时长' end dc_typename,dc_value,dc_dataindex,dc_sendcoding,dc_receivecoding,db_name,dc_man,dc_date,dc_address from devicecommand left join devicebrand on db_code=dc_debrand ".ToUpper();
|
|
|
+ GridCommandSetting.GetDataSQL = "select 0 CHECKEDCOLUMN,dc_id,dc_code,dc_ifng,dc_name,dc_type,case when dc_type='INQTY' then '投入' when dc_type='INGORE' then '忽略' when dc_type='NGQTY' then '不良' when dc_type='OUTQTY' then '产出' when dc_type='TEMPERATURE' then '温度' when dc_type='PARAM1' then '参数1' when dc_type='PARAM2' then '参数2' when dc_type='PARAM3' then '参数3' when dc_type='PARAM4' then '参数4' when dc_type='PARAM5' then '参数5' when dc_type='PARAM6' then '参数6' when dc_type='PARAM7' then '参数7' when dc_type='PARAM8' then '参数8' when dc_type='PARAM9' then '参数9' when dc_type='PARAM10' then '参数10' when dc_type='PARAM3' then '参数3' when dc_type='WAITTIME' then '待料时间' when dc_type='BREAKTIME' then '故障时长' when dc_type='MANSTOPTIME' then '人工停机时长' when dc_type='WORKTIME' then '正常工作时长' when dc_type='STARTTIME' then '开机时长' when dc_type='RUNTIME' then '设备运行时长' when dc_type='BADDETAIL' then '不良明细' end dc_typename,dc_value,dc_dataindex,dc_sendcoding,dc_receivecoding,db_name,dc_man,dc_date,dc_address from devicecommand left join devicebrand on db_code=dc_debrand ".ToUpper();
|
|
|
GridCommandSetting.TableName = "devicecommand";
|
|
|
GridCommandSetting.ID = "dc_id";
|
|
|
GridCommandSetting.InsertSQL = "insert into devicecommand(dc_id,dc_code,dc_name,dc_value,dc_debrand,dc_sendcoding,dc_receivecoding,dc_man,dc_date,dc_dataindex,dc_type,dc_address) values(devicecommand_seq.nextval,:dc_code,:dc_name,:dc_value,'" + BaseUtil.GetComboxEditValue(Brand) + "',:dc_sendcoding,:dc_receivecoding,'" + User.UserName + "',sysdate,:dc_dataindex,:dc_type,:)";
|
|
@@ -507,7 +507,7 @@ namespace UAS_PLCDataReader
|
|
|
NextDecode = GridViewPollSetting.GetRowCellValue(i + 1, "DPC_DECODE").ToString();
|
|
|
}
|
|
|
|
|
|
- if (LastDecode != NextDecode || i == GridPollingSetting.RowCount - 1)
|
|
|
+ if (!StartDecode.Contains(LastDecode))
|
|
|
{
|
|
|
Polling pl = new Polling();
|
|
|
|
|
@@ -536,8 +536,9 @@ namespace UAS_PLCDataReader
|
|
|
}
|
|
|
else LogicHandler.UpdateDeviceStatus(pl.DeviceCode, pl.DeviceName, "设备未启用", DeviceStatus.Stopped, 0);
|
|
|
}
|
|
|
- else
|
|
|
+ else
|
|
|
{
|
|
|
+ if (GridViewPollSetting.GetRowCellValue(i, "DPC_ENABLE").ToString() != "0")
|
|
|
CommandCode.Add(GridViewPollSetting.GetRowCellValue(i, "DPC_DCCODE").ToString());
|
|
|
}
|
|
|
}
|
|
@@ -627,6 +628,7 @@ namespace UAS_PLCDataReader
|
|
|
int SendCommandByteSize = 0;
|
|
|
if (dc_dr.Length > 0)
|
|
|
{
|
|
|
+
|
|
|
Command = dc_dr[0]["dc_value"].ToString();
|
|
|
SendCommandByteSize = Encoding.Default.GetBytes(Command.ToCharArray()).Length;
|
|
|
}
|
|
@@ -644,7 +646,6 @@ namespace UAS_PLCDataReader
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- Console.WriteLine(ex.Message + ex.StackTrace);
|
|
|
LogicHandler.UpdateDeviceStatus(pl.DeviceCode, pl.DeviceName, ex.Message, DeviceStatus.Disconnect, -1);
|
|
|
}
|
|
|
}
|
|
@@ -678,12 +679,12 @@ namespace UAS_PLCDataReader
|
|
|
int[] Arr = BaseUtil.GetDecimalData(BaseUtil.ASCIIToString(client[IP].Returnvalue[IP]), 8);
|
|
|
Console.WriteLine(IP + " " + Arr.Length + " " + dc_dr.Length);
|
|
|
|
|
|
- if (dc_dr[0]["dc_type"].ToString() == "BADDETAIL")
|
|
|
+ if (dc_dr.Length>0&&dc_dr[0]["dc_type"].ToString() == "BADDETAIL")
|
|
|
{
|
|
|
|
|
|
for (int j = 0; j < Arr.Length; j++)
|
|
|
{
|
|
|
- ItemData.Add(dc_dr[j]["dc_type"].ToString() + j, Arr[j].ToString());
|
|
|
+ ItemData.Add(dc_dr[0]["dc_type"].ToString() + j, Arr[j].ToString());
|
|
|
}
|
|
|
}
|
|
|
else
|