Commit 478d0803 刘韬

1

1 个父辈 80340cc5
......@@ -627,6 +627,7 @@ namespace OnlineStore.ACSingleStore
private void 扫码测试ToolStripMenuItem_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LogUtil.info("isScannerRun:"+ store.dlScanSocket.isScannerRun);
if (store.dlScanSocket.isScannerRun)
{
store.dlScanSocket.StartConnect();
......
......@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SO951-HC-ACSingleStore 0f64825aab27a7a50fb6d1a79d844b0f7b265c80")]
[assembly: AssemblyProduct("SO951-HC-ACSingleStore 80340cc5c64647256d580f0ea4aa132b7bb874e0")]
[assembly: AssemblyCopyright("Copyright ? 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......
......@@ -103,6 +103,7 @@ namespace OnlineStore.DeviceLibrary
}
LogUtil.info(StoreName + "共加载到["+positionList.Count+"]个库位,["+ PositionNumList.Count + "]个为料仓有效库位");
dlScanSocket = new DLScanSocket(config.Scanner_Ip, config.Scanner_Port, onCodeReceived);
dlScanSocket.StartConnect(true);
//初始化摄像机配置
CodeManager.LoadConfig();
IOManager.Init();
......@@ -1174,9 +1175,7 @@ namespace OnlineStore.DeviceLibrary
IO_VALUE checkIO = IOManager.IOValue(IO_Type.TrayCheck_Door);
var IsServerAccess = CodeManager.IsServerAccess();
int height = 0;
if (!IsServerAccess)
height=GetHeight();
int height = GetHeight();
//判断料门口是否有料
//光栅不遮挡时才扫码
......@@ -1201,6 +1200,7 @@ namespace OnlineStore.DeviceLibrary
//GetCameraCode();
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LastScanTime = DateTime.Now;
LogUtil.info("isScannerRun:" + dlScanSocket.isScannerRun);
var isdl = dlScanSocket.BeginScan();
LogUtil.info(StoreName + "DL扫码枪="+isdl);
if (!isdl)
......@@ -1219,7 +1219,7 @@ namespace OnlineStore.DeviceLibrary
{
codelist = CodeManager.CameraScan();
}
onCodeReceived(codelist.ToArray());
onCodeReceived("running",codelist.ToArray());
});
}
}
......@@ -1482,7 +1482,7 @@ namespace OnlineStore.DeviceLibrary
/// 扫码枪数据接收
/// </summary>
/// <param name="message"></param>
private void onCodeReceived(string[] codeList)
private void onCodeReceived(string src,string[] codeList)
{
try
{
......@@ -1497,7 +1497,7 @@ namespace OnlineStore.DeviceLibrary
if (CurrScanCount >= MaxScanCount)
{
InStoreFail = true;
LogUtil.info(LOGGER, StoreName + "[" + CurrScanCount + "]未收到二维码,请重新放入料盘,通知服务器未扫到条码");
LogUtil.info(LOGGER, StoreName + $"[{src}]" + "[" + CurrScanCount + "]未收到二维码,请重新放入料盘,通知服务器未扫到条码");
//TODO 向服务器发送未扫到码消息
//发送扫码内容到服务器进行入库操作
......@@ -1510,7 +1510,7 @@ namespace OnlineStore.DeviceLibrary
else
{
LogUtil.info(LOGGER, StoreName + "[" + CurrScanCount + "]未收到二维码,请重新放入料盘");
LogUtil.info(LOGGER, StoreName + $"[{src}]" + "[" + CurrScanCount + "]未收到二维码,请重新放入料盘");
}
IsScanCode = false;
return;
......@@ -1519,12 +1519,12 @@ namespace OnlineStore.DeviceLibrary
// InStoreFail = false;
if (storeRunStatus.Equals(StoreRunStatus.Wait))
{
LogUtil.info(LOGGER, StoreName + "二维码【 " + message + "】,设备未启动,不需要发送服务器");
LogUtil.info(LOGGER, StoreName + $"[{src}]" + "二维码【 " + message + "】,设备未启动,不需要发送服务器");
IsScanCode = false;
return;
}
// CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
LogUtil.info(LOGGER, StoreName + "二维码【 " + message + "】,发送给服务器获取入库PosID");
LogUtil.info(LOGGER, StoreName + $"[{src}]" + "二维码【 " + message + "】,发送给服务器获取入库PosID");
//发送扫码内容到服务器进行入库操作
Operation operation = getLineBoxStatus();
operation.op = 1;
......@@ -1534,15 +1534,16 @@ namespace OnlineStore.DeviceLibrary
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false);
if (resultOperation == null)
{
LogUtil.info(LOGGER, StoreName + "二维码【" + message + "】没有收到服务器反馈!");
LogUtil.info(LOGGER, StoreName + $"[{src}]" + "二维码【" + message + "】没有收到服务器反馈!");
IsScanCode = false;
return;
}
else if (!string.IsNullOrEmpty(resultOperation.msg) && string.IsNullOrEmpty(resultOperation.data[ParamDefine.posId]))
else if (!string.IsNullOrEmpty(resultOperation.msg) && !resultOperation.data.ContainsKey(ParamDefine.posId))
{
InStoreFail = true;
LogUtil.info(LOGGER, StoreName + " 二维码【" + message + "】 服务器反馈 :" + resultOperation.msg);
LogUtil.info(LOGGER, StoreName + $"[{src}]" + " 二维码【" + message + "】 服务器反馈 :" + resultOperation.msg);
CodeMsg = resultOperation.msg;
//SetWarnMsg("");
IsScanCode = false;
return;
}
......@@ -1643,10 +1644,12 @@ namespace OnlineStore.DeviceLibrary
{
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LastScanTime = DateTime.Now;
dlScanSocket.BeginScan();
var isdl = dlScanSocket.BeginScan();
if (isdl)
return;
Task.Run(() => {
var codelist = CodeManager.CameraScan();
onCodeReceived(codelist.ToArray());
onCodeReceived("手动",codelist.ToArray());
});
}
else
......@@ -1737,7 +1740,7 @@ namespace OnlineStore.DeviceLibrary
}
public int GetHeight()
{
if (!CodeManager.IsServerAccess())
if (CodeManager.IsServerAccess())
return 0;
if (Config.Default_TrayWidth.Equals(Width_7))
{
......@@ -1769,7 +1772,6 @@ namespace OnlineStore.DeviceLibrary
{
return result;
}
double ai1Value = ConvertAI(IOManager.GetADIOValue(Config.AIDI1_Addr), Config.AIDI1_DefaultPosition);
double ai2Value = ConvertAI(IOManager.GetADIOValue(Config.AIDI2_Addr), Config.AIDI2_DefaultPosition);
double Value = 0;
......@@ -1780,7 +1782,8 @@ namespace OnlineStore.DeviceLibrary
else if (ai2Value>5)
Value=Math.Round(ai2Value, 1);
// Common.LogUtil.OutputDebugString($"ai1Value:{ai1Value},ai1Value:{ai2Value},Value:{Value}");
// Common.LogUtil.OutputDebugString($"ai1Value:{ai1Value},ai1Value:{ai2Value},Value:{Value}");
return CalHeight(Value);
}
......
......@@ -18,7 +18,7 @@ namespace OnlineStore.DeviceLibrary
public bool isScannerRun = false;
private string ScannerIP = "";
private int ScannerPort = 0;
public delegate void OnCodeRevice(string[] codeList);
public delegate void OnCodeRevice(string src,string[] codeList);
public event OnCodeRevice CodeReviceEvent;
public DLScanSocket(string serverIp, int port,OnCodeRevice revicePro)
{
......@@ -48,6 +48,7 @@ namespace OnlineStore.DeviceLibrary
{
isScannerRun = true;
}
LogUtil.error("datalogic Connect:" + result);
}
}
catch (Exception ex)
......@@ -129,7 +130,7 @@ namespace OnlineStore.DeviceLibrary
}
message = asciiEncoding.GetString(newBytes.ToArray());
string[] codeList = message.Split(new string[] { spiltStr},StringSplitOptions.RemoveEmptyEntries);
CodeReviceEvent?.Invoke(codeList);
CodeReviceEvent?.Invoke("datalogic",codeList);
// return message;
}
catch (Exception ex)
......
......@@ -135,7 +135,7 @@ namespace OnlineStore.DeviceLibrary
public static bool IsServerAccess()
{
if (cameraNameList != null && cameraNameList.Count >= 0)
if (cameraNameList != null && cameraNameList.Count >= 1)
{
if (cameraNameList[0].Trim().ToLower().IndexOf("server") >= 0)
{
......
......@@ -503,12 +503,12 @@ namespace OnlineStore.LoadCSVLibrary
/// PRO (轴四)压紧轴加速度 CompAxis_AddSpeed 300
/// </summary>
[ConfigProAttribute("CompAxis_AddSpeed")]
public short CompAxis_AddSpeed { get; set; }
public int CompAxis_AddSpeed { get; set; }
/// <summary>
/// PRO (轴四)压紧轴减速度 CompAxis_DelSpeed 300
/// </summary>
[ConfigProAttribute("CompAxis_DelSpeed")]
public short CompAxis_DelSpeed { get; set; }
public int CompAxis_DelSpeed { get; set; }
/// <summary>
/// PRO (轴四)压紧轴原点低速 CompAxis_HomeLowSpeed 20
/// </summary>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!