提交代码
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -240,6 +241,52 @@ namespace WCS.BLL.Tool
|
||||
return senddata1;
|
||||
}
|
||||
|
||||
|
||||
public static byte[] InstoreLightAndWarnLight(int board_id, int lightid)
|
||||
{
|
||||
byte[] data1 = new byte[8 + 3 * 7];
|
||||
data1[0] = 0xff;
|
||||
data1[1] = 0x01;
|
||||
data1[2] = 0x00;
|
||||
data1[3] = (byte)(data1.Length + 2);
|
||||
data1[4] = 0x07;
|
||||
|
||||
//库位灯
|
||||
data1[5] = (byte)board_id;
|
||||
data1[6] = 0x03;
|
||||
data1[7] = 0x02;
|
||||
|
||||
//7就是带的有蜂鸣器
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
data1[8 + i * 3] = (byte)(lightid + i);
|
||||
data1[9 + i * 3] = 0x03;
|
||||
data1[10 + i * 3] = 0x02;
|
||||
}
|
||||
|
||||
byte[] senddata1 = Tool.Helper.Crc16(data1, data1.Length, true);
|
||||
return senddata1;
|
||||
}
|
||||
|
||||
//出库确认 蜂鸣器鸣叫一次
|
||||
public static byte[] CommitOutstoreBee(int lightid)
|
||||
{
|
||||
byte[] data1 = new byte[5 + 3 * 1];
|
||||
data1[0] = 0xff;
|
||||
data1[1] = 0x01;
|
||||
data1[2] = 0x00;
|
||||
data1[3] = (byte)(data1.Length + 2);
|
||||
data1[4] = 0x07;
|
||||
|
||||
data1[5] = (byte)(lightid + 6);
|
||||
data1[6] = 0x03;
|
||||
data1[7] = 0x02;
|
||||
|
||||
byte[] sendData = Tool.Helper.Crc16(data1, data1.Length, true);
|
||||
return sendData;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 库位灯常亮/关闭
|
||||
/// </summary>
|
||||
@ -293,5 +340,20 @@ namespace WCS.BLL.Tool
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回数据处理
|
||||
/// </summary>
|
||||
public static void ReturnDataProcess(TCPClient tcpClient, byte[] returnData)
|
||||
{
|
||||
if (returnData[0] == 0xFF && returnData[1] == 0x00 && returnData[3] == 0x08
|
||||
&& returnData[4] == 0x01 && returnData[5] == 0x06)
|
||||
{
|
||||
var sendData = Query();
|
||||
tcpClient.Send(sendData);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ namespace WCS.BLL
|
||||
|
||||
public string BindIPHost { get; set; } = "127.0.0.1:20003";
|
||||
|
||||
public string ShelfTypeName { get; set; }
|
||||
public bool IsOnline { get; set; } = false;
|
||||
|
||||
//第一次连接是否已连接
|
||||
@ -53,14 +54,16 @@ namespace WCS.BLL
|
||||
/// 初始化配置连接
|
||||
/// </summary>
|
||||
/// <param name="remoteIPHost"></param>
|
||||
public TCPClient(string remoteIPHost, string bindIPHost)
|
||||
public TCPClient(string remoteIPHost, string bindIPHost,string shelfTypeName)
|
||||
{
|
||||
try
|
||||
{
|
||||
RemoteIPHost = remoteIPHost;
|
||||
BindIPHost = bindIPHost;
|
||||
ShelfTypeName = shelfTypeName;
|
||||
|
||||
tcpClient = new TcpClient();
|
||||
|
||||
//载入配置
|
||||
tcpClient.Setup(new TouchSocketConfig()
|
||||
.SetRemoteIPHost(RemoteIPHost)
|
||||
|
Reference in New Issue
Block a user