按照客户要求将excel导出文件保存为一个条码一条记录,名称为SN_结果_时间.xslx

This commit is contained in:
LL
2025-11-14 17:27:29 +08:00
commit 883060d140
79 changed files with 166110 additions and 0 deletions

104
SLZ_4/Struct.cs Normal file
View File

@@ -0,0 +1,104 @@
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; //通道统计信息
}
}