Commit 8ad7ddd9 LN

增加默认盘号配置

1 个父辈 2d691a7e
......@@ -53,6 +53,7 @@
<add key ="NeedScanCode" value ="1"/>
<add key ="Server_Log_Open" value ="0"/>
<add key ="CodeCount" value ="1"/>
<add key ="DefaultTrayNum" value ="9"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
......@@ -402,7 +402,6 @@
this.groupBox1.TabIndex = 195;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "料仓通信测试";
this.groupBox1.Visible = false;
//
// lblPosId
//
......@@ -501,9 +500,9 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.logBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.logBox.Location = new System.Drawing.Point(460, 85);
this.logBox.Location = new System.Drawing.Point(460, 168);
this.logBox.Name = "logBox";
this.logBox.Size = new System.Drawing.Size(860, 445);
this.logBox.Size = new System.Drawing.Size(860, 362);
this.logBox.TabIndex = 106;
this.logBox.Text = "";
//
......
......@@ -82,5 +82,6 @@ namespace OnlineStore.Common
public static string NeedScanCode = "NeedScanCode";
public static string CodeCount = "CodeCount";
public static string DefaultTrayNum = "DefaultTrayNum";
}
}
......@@ -6,7 +6,7 @@ using System.Net;
using System.Net.Sockets;
using System.Threading;
using log4net;
using System.Collections.Concurrent;
namespace OnlineStore.Common
{
......@@ -107,7 +107,7 @@ namespace OnlineStore.Common
client.ClientSocket = m_serverSocket.Accept();
IPEndPoint clientipe = (IPEndPoint)client.ClientSocket.RemoteEndPoint;
client.AddStr = clientipe.Address.ToString()+":"+clientipe.Port.ToString();
LogUtil.info(LOGGER, "["+serverPort+"]有新的客户端链接上:[" + client.AddStr+"]");
LogUtil.info(LOGGER, "["+serverPort+"]有新的客户端链接上:[" + client.AddStr+"]");
AcceptClientEvent?.Invoke(client);
receiveMessageDelegate = new ReceiveMessageDelegate(ReceiveMessages);
......@@ -119,14 +119,15 @@ namespace OnlineStore.Common
//throw new Exception(ex.Message);
}
}
}
private StringBuilder sb = new StringBuilder(); //这个是用来保存:接收到了的,但是还没有结束的消息
}
// private StringBuilder sb = new StringBuilder(); //这个是用来保存:接收到了的,但是还没有结束的消息
private int receiveBufferSize = 1024;
private string terminateString = "\r";
public void ReceiveMessages(TcpClientBean client) //这个函数会被以线程方式运行
{
try
{
StringBuilder sb = new StringBuilder();
Socket socket = (Socket)client.ClientSocket;
while (true)
{
......@@ -136,7 +137,7 @@ namespace OnlineStore.Common
{
string rawMsg = Encoding.ASCII.GetString(buffer, 0, receivedSize);
int rnFixLength = terminateString.Length; //这个是指消息结束符的长度,此处为\r\n
for (int i = 0; i < rawMsg.Length; ) //遍历接收到的整个buffer文本
for (int i = 0; i < rawMsg.Length;) //遍历接收到的整个buffer文本
{
if (i <= rawMsg.Length - rnFixLength)
{
......@@ -158,18 +159,18 @@ namespace OnlineStore.Common
i++;
}
}
}
}
Thread.Sleep(ReviceMsgMS);
}
}
catch (SocketException e)
{
LogUtil.error( e.ToString(), 1006);
LogUtil.error(e.ToString(), 1006);
}
catch (Exception ex)
{
LogUtil.error( ex.ToString(), 1005);
LogUtil.error(ex.ToString(), 1005);
}
}
//private void ReceiveMessages(Client client)
......
......@@ -12,11 +12,16 @@ namespace OnlineStore.DeviceLibrary
public class RFIDManager
{
public static RFID RfidReader = new RFID();
private static int DefaultTrayNum = ConfigAppSettings.GetIntValue(Setting_Init.DefaultTrayNum);
/// <summary>
/// 获取托盘编码
/// </summary>
public static int GetTrayNum(int subType, bool isClear = false)
{
if (DefaultTrayNum > 0)
{
return DefaultTrayNum;
}
// return 9;
if (subType.Equals(104))
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!