Commit baca3254 张东亮

显示处理时间

1 个父辈 0aff9dd7
此文件类型无法预览
此文件类型无法预览
FrmCodeDecode_Text,二维码识别,Qr code recognition
FrmCodeDecode_label4_Text,参数路径,Parameters of the path
FrmCodeDecode_chbUseParam_Text,使用参数,operation parameter
FrmCodeDecode_btnAn_Text,变暗,darken
FrmCodeDecode_btnLight_Text,提亮,brighten
FrmCodeDecode_btnCopyN_Text,复制名称,Copy Name
FrmCodeDecode_label3_Text,条码类型:,Bar code type:
FrmCodeDecode_label2_Text,相机列表:,Camera list:
FrmCodeDecode_btnExit_Text,退出,Exit
FrmCodeDecode_btnCameraImage_Text,相机获取图片,camera image
FrmCodeDecode_lblCount_Text,条码数量:,Barcode number:
FrmCodeDecode_btnClearLog_Text,清理日志,Clear log
FrmCodeDecode_btnDCode_Text,二维码识别,Qr code recognition
FrmCodeDecode_btnLearn_Text,学习,learn
FrmCodeDecode_btnbarCode_Text,一维码识别,One dimensional code recognition
FrmCodeDecode_btnGray_Text,图像转灰,Turning grey
FrmCodeDecode_btnErZhi_Text,二值化,binaryzation 
FrmCodeDecode_btnSelImage_Text,打开本地图片,Open local image
FrmCodeDecode_label1_Text,图片路径,Image path
FrmCodeLearn_Text,条码参数学习,Bar code parameter learning
FrmCodeLearn_chbHalcon_Text,Halcon获取图片,Halcon Get photo
FrmCodeLearn_label4_Text,图片路径,Image path
FrmCodeLearn_btnDelOld_Text,删除旧参数,Delete old parameter
FrmCodeLearn_chbUseCamera_Text,相机获取实时图片,camera image
FrmCodeLearn_btnSelImage_Text,打开本地图片,Open local image
FrmCodeLearn_chbTest_Text,学习结束自动识别测试,Automatic identification test
FrmCodeLearn_btnClearLog_Text,清理日志,Clear log
FrmCodeLearn_lblCount_Text,条码数量:,Barcode number:
FrmCodeLearn_label3_Text,参数路径,Parameters of the path
FrmCodeLearn_label2_Text,类型:,Type:
FrmCodeLearn_label1_Text,相机:,camera:
FrmCodeLearn_btnExit_Text,退出,Exit
FrmCodeLearn_btnStop_Text,结束学习,End of learning
FrmCodeLearn_btnOpen_Text,开始学习,start to learn
selCamera,请先选择相机,Please select camera
selImage,请先选择图片,Please select picture
title,提示,Notice
imageIsNull,获取二维码图片为空,Get the two-dimensional code picture is empty
sureDelete,确定删除文件:,Make sure to delete the file:
\ No newline at end of file
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<appSettings>
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="0" />
<add key="App_Title" value="流水线客户端" />
<add key="App_AutoRun" value="0"/>
<add key="App_Title" value="流水线客户端"/>
<!--Server address-->
<!--<add key="http.server" value="http://localhost/myproject/service/store/emptyPosForPutin"/>-->
<add key="http.server" value="http://10.85.199.25/myproject/" />
<add key="http.server" value="http://10.85.199.25/myproject/"/>
<!--storeType-->
<add key="Line_moveEquip_count" value="24" />
<add key="Line_feedingEquip_count" value="5" />
<add key="Line_HYEquip_count" value="21" />
<add key="Line_moveEquip_count" value="24"/>
<add key="Line_feedingEquip_count" value="5"/>
<add key="Line_HYEquip_count" value="21"/>
<!--<add key="Line_dischargeLine_count" value="2" />-->
<!--start one store config-->
<add key="ConfigPath_Line" value="\LineConfig\Config_Line.csv" />
<add key="ConfigPath_MoveEquip" value="\LineConfig\MoveEquip\Config_MoveEquip.csv" />
<add key="ConfigPath_FeedingEquip" value="\LineConfig\Config_FeedingEquip.csv" />
<add key="ConfigPath_HYEquip" value="\LineConfig\HY\Config_HYEquip.csv" />
<add key="ConfigPath_DischargeLine" value="\LineConfig\Config_DischargeLine.csv" />
<add key ="ConfigPath_TrayList" value ="\LineConfig\TrayList.data"/>
<add key="Line_Type" value="Line" />
<add key="Line_CID" value="so664" />
<add key="ConfigPath_Line" value="\LineConfig\Config_Line.csv"/>
<add key="ConfigPath_MoveEquip" value="\LineConfig\MoveEquip\Config_MoveEquip.csv"/>
<add key="ConfigPath_FeedingEquip" value="\LineConfig\Config_FeedingEquip.csv"/>
<add key="ConfigPath_HYEquip" value="\LineConfig\HY\Config_HYEquip.csv"/>
<add key="ConfigPath_DischargeLine" value="\LineConfig\Config_DischargeLine.csv"/>
<add key="ConfigPath_TrayList" value="\LineConfig\TrayList.data"/>
<add key="Line_Type" value="Line"/>
<add key="Line_CID" value="so664"/>
<!--end one store config-->
<!--摄像机名称列表配置,用#分割-->
<add key="CameraName" value="GigE:MV-CE100-30GC (00C69898519)#GigE:MV-CE100-30GC (00C95305929)" />
<add key="CameraName" value="GigE:MV-CE100-30GC (00C69898519)#GigE:MV-CE100-30GC (00C95305929)"/>
<!--二维码类型列表配置,用#分割,一维码=Barcode 二维码: QR Code#Data Matrix ECC 200#Micro QR Code-->
<add key="CodeType" value="Data Matrix ECC 200#QR Code" />
<add key="CodeType" value="Data Matrix ECC 200#QR Code"/>
<!--<add key="CodeType" value="Data Matrix ECC 200"/>-->
<add key="ACBaudRate" value="115200" />
<add key="ACBaudRate" value="115200"/>
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="\CodeParam\" />
<add key="Config_Pwd" value="123456" />
<add key="CodeParamPath" value="\CodeParam\"/>
<add key="Config_Pwd" value="123456"/>
<!--出库等待料盘拿走的时间,秒-->
<add key="OutStoreWaitSeconds" value="10" />
<add key="UseAIOBOX" value="1" />
<add key="OutStoreWaitSeconds" value="10"/>
<add key="UseAIOBOX" value="1"/>
<!--流水线监听端口-->
<add key="TCPServerPort" value="5246" />
<add key="TCPServerPort" value="5246"/>
<!--AGV调度服务器地址-->
<add key="AgvServerIp" value="10.85.162.40" />
<add key="AgvServerIp" value="10.85.162.40"/>
<!--IO配置-->
<add key="DIMS" value="60" />
<add key="DOMS" value="300" />
<add key="LineRunTest" value="1" />
<add key="DIMS" value="60"/>
<add key="DOMS" value="300"/>
<add key="LineRunTest" value="1"/>
<!--ABB机器人服务器-->
<add key="ABBServerPort" value="21" />
<add key="ABBServerPort" value="21"/>
<!--是否打开托盘编码界面-->
<add key="OpenRFIDWrite" value="1" />
<add key="DefaultPWD" value="123456" />
<add key="Server_Log_Open" value="0" />
<add key="CodeCount" value="4" />
<add key="DefaultTrayNum" value="0" />
<add key="NeedScanCode" value="1" />
<add key="Agv_Log_Open" value="0" />
<add key="NeedCheckTray" value="0" />
<add key="Feed_LastShelfID_101" value="B19" />
<add key="Feed_LastShelfID_102" value="B23" />
<add key="Feed_LastShelfID_103" value="B25" />
<add key="Feed_LastShelfID_104" value="B7" />
<add key ="SaveErrorImageToFile" value ="1"/>
<add key ="UseHCBoard" value ="1"/>
<add key ="ShowIOForm" value ="1"/>
<add key ="RfidServer_Port" value ="12001"/>
<add key="OpenRFIDWrite" value="1"/>
<add key="DefaultPWD" value="123456"/>
<add key="Server_Log_Open" value="0"/>
<add key="CodeCount" value="4"/>
<add key="DefaultTrayNum" value="0"/>
<add key="NeedScanCode" value="1"/>
<add key="Agv_Log_Open" value="0"/>
<add key="NeedCheckTray" value="0"/>
<add key="Feed_LastShelfID_101" value="B19"/>
<add key="Feed_LastShelfID_102" value="B23"/>
<add key="Feed_LastShelfID_103" value="B25"/>
<add key="Feed_LastShelfID_104" value="B7"/>
<add key="SaveErrorImageToFile" value="1"/>
<add key="UseHCBoard" value="1"/>
<add key="ShowIOForm" value="1"/>
<add key="RfidServer_Port" value="12001"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/Line-SO664.log" />
<param name="Encoding" value="UTF-8" />
<param name="maxSizeRollBackups" value="100" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<file value="logs/Line-SO664.log"/>
<param name="Encoding" value="UTF-8"/>
<param name="maxSizeRollBackups" value="100"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="TheRFID" type="log4net.Appender.RollingFileAppender">
<file value="logs/rfid/TheRFID-line.log" />
<param name="Encoding" value="UTF-8" />
<param name="maxSizeRollBackups" value="3" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<file value="logs/rfid/TheRFID-line.log"/>
<param name="Encoding" value="UTF-8"/>
<param name="maxSizeRollBackups" value="3"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="AIOBOX" type="log4net.Appender.RollingFileAppender">
<file value="logs/aio/AIOBOX-line.log" />
<param name="Encoding" value="UTF-8" />
<param name="maxSizeRollBackups" value="100" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<file value="logs/aio/AIOBOX-line.log"/>
<param name="Encoding" value="UTF-8"/>
<param name="maxSizeRollBackups" value="100"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="RunLog" type="log4net.Appender.RollingFileAppender">
<file value="logs/log/RunLog-line.log" />
<param name="Encoding" value="UTF-8" />
<param name="maxSizeRollBackups" value="100" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<file value="logs/log/RunLog-line.log"/>
<param name="Encoding" value="UTF-8"/>
<param name="maxSizeRollBackups" value="100"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value=" %m%n" />
<conversionPattern value=" %m%n"/>
</layout>
</appender>
<logger name="RollingLogFileAppender">
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
<level value="Info"/>
<appender-ref ref="RollingLogFileAppender"/>
</logger>
<logger name="TheRFID">
<level value="Error" />
<appender-ref ref="TheRFID" />
<level value="Error"/>
<appender-ref ref="TheRFID"/>
</logger>
<logger name="AIOBOX">
<level value="Info" />
<appender-ref ref="AIOBOX" />
<level value="Info"/>
<appender-ref ref="AIOBOX"/>
</logger>
<logger name="RunLog">
<level value="Info" />
<appender-ref ref="RunLog" />
<level value="Info"/>
<appender-ref ref="RunLog"/>
</logger>
<!--<root>
<level value="Info" />
......@@ -132,6 +132,6 @@
</root>-->
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
</configuration>
......@@ -19,7 +19,7 @@ namespace OnlineStore.AssemblyLine.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
......@@ -47,8 +47,8 @@ namespace OnlineStore.AssemblyLine.Properties {
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
......
......@@ -12,7 +12,7 @@ namespace OnlineStore.AssemblyLine.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
<?xml version="1.0"?>
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<appSettings>
......@@ -33,12 +33,12 @@
<add key="OutStoreWaitSeconds" value="10"/>
<add key="UseAIOBOX" value="1"/>
<!--流水线监听端口-->
<add key ="TCPServerPort" value ="5246"/>
<add key="TCPServerPort" value="5246"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/Line-RC1246.log"/>
<param name="Encoding" value="UTF-8" />
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
......
......@@ -99,6 +99,7 @@ namespace OnlineStore.DeviceLibrary
}
isInPro = true;
lastProTimer = DateTime.Now;
LastProcTime = lastProTimer;
try
{
if (runStatus <= LineRunStatus.Wait && (!baseConfig.DType.Equals(DeviceType.FeedingEquip)))
......@@ -742,6 +743,7 @@ namespace OnlineStore.DeviceLibrary
msg += "alarm: " + alarmType + " " + LastAlarmTime.ToLongTimeString() + "\n";
msg += "Move:" + MoveInfo.MoveType + " " + MoveInfo.SLog + "\n";
msg += "SMove:" + SecondMoveInfo.MoveType + " " + SecondMoveInfo.MoveStep + "\n";
msg += $"LastTime: {LastProcTime.ToString("HH:mm:ss")}";
return msg;
}
internal void MoveEndS()
......
......@@ -1260,6 +1260,7 @@ namespace OnlineStore.DeviceLibrary
msg += "runS: " + runStatus + "\n";
msg += "alarm: " + alarmType + "\n";
msg += "MoveT:" + MoveInfo.MoveType + " " + MoveInfo.SLog + "\n";
msg += $"LastTime: {LastProcTime.ToString("HH:mm:ss")}";
return msg;
}
public string GetLastTrayInfo()
......
......@@ -1032,6 +1032,7 @@ namespace OnlineStore.DeviceLibrary
msg += "alarm: " + alarmType + " " + LastAlarmTime.ToLongTimeString() + "\n";
msg += "Move:" + MoveInfo.MoveType + " " + MoveInfo.SLog + "\n";
msg += "SMove:" + SecondMoveInfo.MoveType + " " + SecondMoveInfo.MoveStep + "\n";
msg += $"LastTime: {LastProcTime.ToString("HH:mm:ss")}";
return msg;
}
}
......
......@@ -714,13 +714,13 @@ namespace OnlineStore.DeviceLibrary
if (!moveEquip.IsMainStarted)
{
moveEquip.TimerProcess();
LastProcTime = DateTime.Now;
}
}
}
LastProcTime = DateTime.Now;
LineTimerPro();
}
TimeSpan span = DateTime.Now - time;
if (span.TotalMilliseconds > 2000)
{
......@@ -973,7 +973,7 @@ namespace OnlineStore.DeviceLibrary
msg += "alarm: " + alarmType + "\n";
msg += "Move:" + MoveInfo.MoveType + " " + MoveInfo.SLog + "\n";
msg += "T3C1:" + T3C1_MoveInfo.MoveType + " " + T3C1_MoveInfo.MoveStep + "\n";
msg += $"LastTime: {LastProcTime.ToString("HH:mm:ss")}";
return msg;
}
......
......@@ -44,7 +44,6 @@ namespace OnlineStore.DeviceLibrary
LoadCamera(false);
CodeLibrary.HDCodeLearnHelper.LoadConfig("", codeStr);
CodeLibrary.EyemDecode.InitModel();
}
catch (Exception ex)
{
......@@ -140,7 +139,8 @@ namespace OnlineStore.DeviceLibrary
string r = "";
bool eyemNoCode = false;
//Task eyemtask = Task.Factory.StartNew(delegate {
//Task eyemtask = Task.Factory.StartNew(delegate
//{
// List<CodeInfo> tlci = EyemDecode.ModelDecoder(ref bmp);
// foreach (CodeInfo code in tlci)
// {
......
using CodeLibrary;
using HalconDotNet;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
public class RemoteDecodeHelper
{
private static int webclienttimeout = 30000;
private static Process p = new Process();
private const string serverhost = "http://127.0.0.1:58137/";
public static List<CodeInfo> DecodeRequest(HObject hoimg, RemoteDecodeParam remoteDecodeParam)
{
byte[] requestdata;
lock (hoimg)
{
using (MemoryStream memoryStream = new MemoryStream())
{
hoimg.Serialize(memoryStream);
requestdata = memoryStream.ToArray();
memoryStream.Close();
}
}
return DecodeRequest(requestdata, remoteDecodeParam, isHObject: true);
}
public static List<CodeInfo> DecodeRequest(Bitmap bitmap, RemoteDecodeParam remoteDecodeParam)
{
if (bitmap == null)
{
return null;
}
byte[] requestdata;
lock (bitmap)
{
using (MemoryStream memoryStream = new MemoryStream())
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
binaryFormatter.Serialize(memoryStream, bitmap);
requestdata = memoryStream.ToArray();
memoryStream.Close();
}
}
return DecodeRequest(requestdata, remoteDecodeParam);
}
private static List<CodeInfo> DecodeRequest(byte[] requestdata, RemoteDecodeParam remoteDecodeParam, bool isHObject = false)
{
CheckAndRunServer();
string text;
using (MemoryStream memoryStream = new MemoryStream())
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(RemoteDecodeParam));
xmlSerializer.Serialize(memoryStream, remoteDecodeParam);
text = base64UrlEncode(memoryStream.ToArray());
memoryStream.Close();
}
string text2 = "http://127.0.0.1:58137/ProcessBitmap?param=";
if (isHObject)
{
text2 = "http://127.0.0.1:58137/Process?param=";
}
byte[] bytes;
try
{
MyWebClient myWebClient = new MyWebClient(webclienttimeout);
bytes = myWebClient.UploadData(text2 + text, requestdata);
requestdata = null;
myWebClient.Dispose();
}
catch (WebException)
{
return null;
}
catch
{
return null;
}
List<CodeInfo> result = null;
string text3 = Encoding.UTF8.GetString(bytes).Trim().Trim('"');
text3 = text3.Replace("\\/", "/");
try
{
byte[] buffer = Convert.FromBase64String(text3);
using (MemoryStream stream = new MemoryStream(buffer))
{
XmlSerializer xmlSerializer2 = new XmlSerializer(typeof(List<CodeInfo>));
result = (List<CodeInfo>)xmlSerializer2.Deserialize(stream);
}
}
catch
{
throw new Exception(text3);
}
return result;
}
private static string base64UrlEncode(byte[] input)
{
return Convert.ToBase64String(input).Replace('+', '-').Replace('/', '_');
}
private static void CheckAndRunServer()
{
lock (p)
{
Process[] processesByName = Process.GetProcessesByName("ScanCodeServer");
if (processesByName.Length != 0)
{
return;
}
string text = "ScanCodeServer\\ScanCodeServer.exe";
if (!File.Exists(text))
{
throw new Exception("找不到扫码服务器文件");
}
p.StartInfo = new ProcessStartInfo(text);
p.Start();
int num = 5;
while (num > 0)
{
num--;
Thread.Sleep(500);
MyWebClient myWebClient = new MyWebClient(webclienttimeout);
string text2 = myWebClient.DownloadString("http://127.0.0.1:58137/alive");
if (text2.Trim() == "\"1\"")
{
return;
}
}
throw new Exception("扫码服务器打开失败");
}
}
[Serializable]
public struct RemoteDecodeParam
{
public string[] codeTypeList;
public int codeCount;
public int timeout;
}
public class MyWebClient : WebClient
{
private int _timeout;
public MyWebClient(int timeout)
{
_timeout = timeout;
}
protected override WebRequest GetWebRequest(Uri address)
{
WebRequest webRequest = base.GetWebRequest(address);
webRequest.Timeout = _timeout;
return webRequest;
}
}
}
//using CodeLibrary;
//using HalconDotNet;
//using OnlineStore.Common;
//using System;
//using System.Collections.Generic;
//using System.Diagnostics;
//using System.Drawing;
//using System.IO;
//using System.Linq;
//using System.Net;
//using System.Runtime.Serialization.Formatters.Binary;
//using System.Text;
//using System.Threading;
//using System.Threading.Tasks;
//using System.Xml;
//using System.Xml.Serialization;
//public class RemoteDecodeHelper
//{
// private static int webclienttimeout = 30000;
// private static Process p = new Process();
// private const string serverhost = "http://127.0.0.1:58137/";
// public static List<CodeInfo> DecodeRequest(HObject hoimg, RemoteDecodeParam remoteDecodeParam)
// {
// byte[] requestdata;
// lock (hoimg)
// {
// using (MemoryStream memoryStream = new MemoryStream())
// {
// hoimg.Serialize(memoryStream);
// requestdata = memoryStream.ToArray();
// memoryStream.Close();
// }
// }
// return DecodeRequest(requestdata, remoteDecodeParam, isHObject: true);
// }
// public static List<CodeInfo> DecodeRequest(Bitmap bitmap, RemoteDecodeParam remoteDecodeParam)
// {
// if (bitmap == null)
// {
// return null;
// }
// byte[] requestdata;
// lock (bitmap)
// {
// using (MemoryStream memoryStream = new MemoryStream())
// {
// BinaryFormatter binaryFormatter = new BinaryFormatter();
// binaryFormatter.Serialize(memoryStream, bitmap);
// requestdata = memoryStream.ToArray();
// memoryStream.Close();
// }
// }
// return DecodeRequest(requestdata, remoteDecodeParam);
// }
// private static List<CodeInfo> DecodeRequest(byte[] requestdata, RemoteDecodeParam remoteDecodeParam, bool isHObject = false)
// {
// CheckAndRunServer();
// string text;
// using (MemoryStream memoryStream = new MemoryStream())
// {
// XmlSerializer xmlSerializer = new XmlSerializer(typeof(RemoteDecodeParam));
// xmlSerializer.Serialize(memoryStream, remoteDecodeParam);
// text = base64UrlEncode(memoryStream.ToArray());
// memoryStream.Close();
// }
// string text2 = "http://127.0.0.1:58137/ProcessBitmap?param=";
// if (isHObject)
// {
// text2 = "http://127.0.0.1:58137/Process?param=";
// }
// byte[] bytes;
// try
// {
// MyWebClient myWebClient = new MyWebClient(webclienttimeout);
// bytes = myWebClient.UploadData(text2 + text, requestdata);
// requestdata = null;
// myWebClient.Dispose();
// }
// catch (WebException)
// {
// return null;
// }
// catch
// {
// return null;
// }
// List<CodeInfo> result = null;
// string text3 = Encoding.UTF8.GetString(bytes).Trim().Trim('"');
// text3 = text3.Replace("\\/", "/");
// try
// {
// byte[] buffer = Convert.FromBase64String(text3);
// using (MemoryStream stream = new MemoryStream(buffer))
// {
// XmlSerializer xmlSerializer2 = new XmlSerializer(typeof(List<CodeInfo>));
// result = (List<CodeInfo>)xmlSerializer2.Deserialize(stream);
// }
// }
// catch
// {
// throw new Exception(text3);
// }
// return result;
// }
// private static string base64UrlEncode(byte[] input)
// {
// return Convert.ToBase64String(input).Replace('+', '-').Replace('/', '_');
// }
// private static void CheckAndRunServer()
// {
// lock (p)
// {
// Process[] processesByName = Process.GetProcessesByName("ScanCodeServer");
// if (processesByName.Length != 0)
// {
// return;
// }
// string text = "ScanCodeServer\\ScanCodeServer.exe";
// if (!File.Exists(text))
// {
// throw new Exception("找不到扫码服务器文件");
// }
// p.StartInfo = new ProcessStartInfo(text);
// p.Start();
// int num = 5;
// while (num > 0)
// {
// num--;
// Thread.Sleep(500);
// MyWebClient myWebClient = new MyWebClient(webclienttimeout);
// string text2 = myWebClient.DownloadString("http://127.0.0.1:58137/alive");
// if (text2.Trim() == "\"1\"")
// {
// return;
// }
// }
// throw new Exception("扫码服务器打开失败");
// }
// }
// [Serializable]
// public struct RemoteDecodeParam
// {
// public string[] codeTypeList;
// public int codeCount;
// public int timeout;
// }
// public class MyWebClient : WebClient
// {
// private int _timeout;
// public MyWebClient(int timeout)
// {
// _timeout = timeout;
// }
// protected override WebRequest GetWebRequest(Uri address)
// {
// WebRequest webRequest = base.GetWebRequest(address);
// webRequest.Timeout = _timeout;
// return webRequest;
// }
// }
//}
......@@ -16,7 +16,7 @@ namespace OnlineStore.DeviceLibrary
{
public LineRunStatus runStatus = LineRunStatus.Wait;
public DateTime LastProcTime = DateTime.Now;
public string WarnMsg = "";
public DeviceConfig baseConfig = null;
......@@ -32,7 +32,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 使用timer定时器
/// </summary>
protected bool useTimer = ConfigHelper.Config.Get("Device_MainThreadUseTimer", true);
protected bool useTimer = true;//ConfigHelper.Config.Get("Device_MainThreadUseTimer", true);
public bool IsMainStarted
{
get
......
......@@ -90,7 +90,7 @@ namespace OnlineStore.DeviceLibrary
}
public string SLog
{
get { return " "+MoveStep + " "; }
get { return $" {PreMoveStep}->{MoveStep} "; }
}
public bool IsTimeOut(int timeOutSeconds = 60)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!