Commit 179df54f 张东亮

1

1 个父辈 ed66d54e
...@@ -473,6 +473,7 @@ namespace OnlineStore.ACPackingStore ...@@ -473,6 +473,7 @@ namespace OnlineStore.ACPackingStore
} }
CodeLibrary.FrmCodeDecode frm = new CodeLibrary.FrmCodeDecode(); CodeLibrary.FrmCodeDecode frm = new CodeLibrary.FrmCodeDecode();
frm.ShowDialog(); frm.ShowDialog();
frm.Dispose();
} }
......
...@@ -207,6 +207,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -207,6 +207,7 @@ namespace OnlineStore.DeviceLibrary
{ {
timeOutMs = int.MaxValue; timeOutMs = int.MaxValue;
} }
MoveInfo.TimeOutSeconds=timeOutMs;
if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs && NoAlarm()) if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs && NoAlarm())
{ {
ConfigIO io = Config.getWaitIO(wait.IoType); ConfigIO io = Config.getWaitIO(wait.IoType);
......
...@@ -188,14 +188,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -188,14 +188,14 @@ namespace OnlineStore.DeviceLibrary
// } // }
// } // }
//} //}
if (!findRightCode)
{
SaveImageToFile(deviceName, cameraName, bmp);
}
if (deviceName != "" || r != "") if (deviceName != "" || r != "")
{ {
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】[" + findRightCode + "]" + ScanCount + " :" + r); LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】[" + findRightCode + "]" + ScanCount + " :" + r);
} }
if (!findRightCode)
{
SaveImageToFile(deviceName, cameraName, bmp);
}
} }
catch (AccessViolationException e) catch (AccessViolationException e)
{ {
......
using CodeLibrary; using CodeLibrary;
using HalconDotNet; using HalconDotNet;
using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
...@@ -19,15 +18,9 @@ public class RemoteDecodeHelper ...@@ -19,15 +18,9 @@ public class RemoteDecodeHelper
{ {
static int webclienttimeout = 30 * 1000; static int webclienttimeout = 30 * 1000;
static Process p = new Process(); static Process p = new Process();
private static string serverhost = ConfigAppSettings.GetValue("ScanCodeServer"); const string serverhost = "http://127.0.0.1:58137/";
public static List<CodeInfo> DecodeRequest(HObject hoimg, RemoteDecodeParam remoteDecodeParam) public static List<CodeInfo> DecodeRequest(HObject hoimg, RemoteDecodeParam remoteDecodeParam)
{ {
if (serverhost.Trim().Equals(""))
{
serverhost= "http://127.0.0.1:58137/";
}
byte[] requestdata; byte[] requestdata;
lock (hoimg) lock (hoimg)
{ {
...@@ -38,10 +31,12 @@ public class RemoteDecodeHelper ...@@ -38,10 +31,12 @@ public class RemoteDecodeHelper
mStream.Close(); mStream.Close();
} }
} }
return DecodeRequest(requestdata, remoteDecodeParam,true); return DecodeRequest(requestdata, remoteDecodeParam, true);
} }
public static List<CodeInfo> DecodeRequest(Bitmap bitmap, RemoteDecodeParam remoteDecodeParam) public static List<CodeInfo> DecodeRequest(Bitmap bitmap, RemoteDecodeParam remoteDecodeParam)
{ {
if (bitmap == null)
return null;
byte[] requestdata; byte[] requestdata;
lock (bitmap) lock (bitmap)
{ {
...@@ -55,7 +50,7 @@ public class RemoteDecodeHelper ...@@ -55,7 +50,7 @@ public class RemoteDecodeHelper
} }
return DecodeRequest(requestdata, remoteDecodeParam); return DecodeRequest(requestdata, remoteDecodeParam);
} }
static List<CodeInfo> DecodeRequest(byte[] requestdata, RemoteDecodeParam remoteDecodeParam,bool isHObject=false) static List<CodeInfo> DecodeRequest(byte[] requestdata, RemoteDecodeParam remoteDecodeParam, bool isHObject = false)
{ {
CheckAndRunServer(); CheckAndRunServer();
string param; string param;
...@@ -66,17 +61,18 @@ public class RemoteDecodeHelper ...@@ -66,17 +61,18 @@ public class RemoteDecodeHelper
param = base64UrlEncode(mStreamparam.ToArray()); param = base64UrlEncode(mStreamparam.ToArray());
mStreamparam.Close(); mStreamparam.Close();
} }
string url = serverhost+"ProcessBitmap?param="; string url = serverhost + "ProcessBitmap?param=";
if (isHObject) if (isHObject)
url = serverhost+"Process?param="; url = serverhost + "Process?param=";
byte[] resp; byte[] resp;
try try
{ {
MyWebClient webClient = new MyWebClient(webclienttimeout); MyWebClient webClient = new MyWebClient(webclienttimeout);
resp = webClient.UploadData(url + param, requestdata); resp = webClient.UploadData(url + param, requestdata);
requestdata = null;
webClient.Dispose(); webClient.Dispose();
} }
catch(WebException we) catch (WebException we)
{ {
return null; return null;
} }
...@@ -85,13 +81,22 @@ public class RemoteDecodeHelper ...@@ -85,13 +81,22 @@ public class RemoteDecodeHelper
return null; return null;
} }
List<CodeInfo> codeInfos = null;
var ss = Encoding.UTF8.GetString(resp).Trim().Trim('"'); var ss = Encoding.UTF8.GetString(resp).Trim().Trim('"');
var bb = Convert.FromBase64String(ss); ss = ss.Replace(@"\/", "/");
List<CodeInfo> codeInfos; try
using (MemoryStream mStreamResult = new MemoryStream(bb)) {
var bb = Convert.FromBase64String(ss);
using (MemoryStream mStreamResult = new MemoryStream(bb))
{
XmlSerializer xff = new XmlSerializer(typeof(List<CodeInfo>));
codeInfos = (List<CodeInfo>)xff.Deserialize(mStreamResult);
}
}
catch
{ {
XmlSerializer xff = new XmlSerializer(typeof(List<CodeInfo>)); throw new Exception(ss);
codeInfos = (List<CodeInfo>)xff.Deserialize(mStreamResult);
} }
return codeInfos; return codeInfos;
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!