Files
slz-4/SLZ_4/Struct.cs

105 lines
4.0 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Runtime.InteropServices;
namespace SLZ_4
{
public enum SCANNER_TYPE
{
COMMON, //普通扫码枪
INDUSTRY_COM, //工业扫码枪-串口
INDUSTRY_NETWORK, //工业扫码枪-网口
}
//设备信息
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct DEVICE_PARAM
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string sDevAddr; //串口时为串口号网络时为IP地址
public int iDevType;
public int iProtocol;
public int iSlaveId; //从机id
public int iPort; //端口 波特率
public int iSwitch; //是否切换IP改变
}
//存储配置
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct STORAGE_PARAM
{
public bool bTxt; //导出TXT
public bool bCSV; //导出CSV
public bool bSQL; //导出SQL
public bool bExcel; //导出EXCEL
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string sPath; //保存路径
}
//扫码配置
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct SCAN_PARAM
{
public bool bCheckLen; //扫码长度检测
public bool bStart; //扫码启动
public int iCodeLength; //条码长度
}
//扫码枪配置
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct SCANNER_PARAM
{
//串口连接
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string sPort; //串口
public int iBaudrate; //波特率
//网络
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string sIpaddr; //IP地址
public int iPort; //端口
}
//PLC配置
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct PLC_PARAM
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string sPort; //串口
public int iBaudrate; //波特率
}
//PLC配置
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct PRINTER_PARAM
{
public bool bPrint; //开启打印
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string printName; //打印机名称
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string printModel; //打印机模板
//型号RSFP-76*64A-4*8Q-BL-JS-流水号HT 20240109 0356 -气密 11.747Pa PASS
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string codePre; //条码前缀
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string snPre; //序列号前缀 20251022
public int sn; //序列号四位数字 0001
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string codeSuffix; //条码后缀 -气密
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string codeSuffix2; //条码后缀2 PASS
}
//MES配置
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct MES_PARAM
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string sUrl; //MESUrl
public int iPort; //端口号
public bool bCheckIn; //MES入站
public bool bCheckOut; //MES出站
}
//通道统计信息
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct STATISTICS_CHANNEL
{
public int iCount; //测试总量
public int iPass; //通过数量
public int iFailed; //不良数量
}
//统计信息
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct STATISTICS_INFO
{
public int iCount; //测试总量
public int iPass; //通过数量
public int iFailed; //不良数量
public STATISTICS_CHANNEL[] ch; //通道统计信息
}
}