Commit 7f9ed739 刘韬

1

1 个父辈 7b9ae5e4
...@@ -17,6 +17,7 @@ Global ...@@ -17,6 +17,7 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Description = 美光环形线
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
......
...@@ -50,9 +50,6 @@ ...@@ -50,9 +50,6 @@
<Reference Include="Fleck, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Fleck, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Fleck.1.2.0\lib\net45\Fleck.dll</HintPath> <HintPath>..\packages\Fleck.1.2.0\lib\net45\Fleck.dll</HintPath>
</Reference> </Reference>
<Reference Include="halcondotnet">
<HintPath>..\..\RC1271-DUOStore\dll\halcondotnet.dll</HintPath>
</Reference>
<Reference Include="HuichuanLibrary"> <Reference Include="HuichuanLibrary">
<HintPath>..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\HuichuanLibrary.dll</HintPath> <HintPath>..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\HuichuanLibrary.dll</HintPath>
</Reference> </Reference>
......
...@@ -181,136 +181,6 @@ namespace DeviceLibrary ...@@ -181,136 +181,6 @@ namespace DeviceLibrary
} }
[HandleProcessCorruptedStateExceptions]
public static List<CodeInfo> CameraScan(List<string> cameraNameList)
{
HashSet<string> codestr = new HashSet<string>();
List<CodeInfo> codeList = new List<CodeInfo>();
string bitmapfilename = "";
if (cameraNameList == null || cameraNameList.Count <= 0)
{
throw new Exception("CameraScan方法没有传入相机名称.");
}
try
{
Task[] cameraTask = new Task[cameraNameList.Count()];
for (int ii = 0; ii < cameraNameList.Count(); ii++)
{
var cameraName = cameraNameList[ii];
var idx = ii;
cameraTask[ii] = Task.Run(new Action(() =>
{
int retrytime = 0;
retry:
LogUtil.info($"【" + cameraName + "】开始取图片");
if (cameraName.Trim().Equals(""))
{
return;
}
DateTime startTime = DateTime.Now;
HalconDotNet.HObject ho_Image = null;
Bitmap bmp = null;
try
{
bool nohalcon = true;
ho_Image = Camera._cam.CaptureOnImage(cameraName, out bmp, nohalcon);
if (bmp == null)
{
if (retrytime > 2)
return;
retrytime++;
CloseCamera(cameraName);
LogUtil.info($"bitmap为空重试第{retrytime}次");
Task.Delay(1500).Wait();
goto retry;
}
//HalconDotNet.HOperatorSet.RotateImage()
if (ho_Image == null && !nohalcon)
{
LogUtil.error(" 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName);
return;
}
if (idx==0)
camera_event?.Invoke(null, bmp);
LogUtil.info(" 【" + cameraName + "】取图片完成,开始扫码");
string r = "";
RemoteDecodeHelper.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper.RemoteDecodeParam
{
codeTypeList = codeTypeList.ToArray(),
codeCount = QRCodeCount,
timeout = CodeTimeOut
};
List<CodeInfo> cc = new List<CodeInfo>();
cc = RemoteDecodeHelper.DecodeRequest(bmp, remoteDecodeParam);
if (cc != null)
{
lock (codeList)
{
cc.ForEach((c) =>
{
c.CodeStr = CodeManager.ReplaceCode(c.CodeStr);
if (!codestr.Contains(c.CodeStr))
{
codeList.Add(c);
codestr.Add(c.CodeStr);
r += "##" + c.CodeStr;
}
});
}
}
else
{
bitmapfilename = SaveImageToFile("mimo", cameraName, bmp);
}
LogUtil.info(" 【" + cameraName + "】" + " 扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】 :" + r);
}
catch (AccessViolationException e)
{
LogUtil.error(" 扫码出现AccessViolationException异常,关闭相机【" + cameraName + "】:" + e.ToString());
Camera._cam.Close(cameraName);
// GC.Collect();
}
catch (Exception ex)
{
LogUtil.error(" 扫码出错:" + ex.ToString());
}
finally
{
if (ho_Image != null)
{
ho_Image.Dispose();
}
if (bmp != null)
bmp.Dispose();
}
}));
Task.Delay(ii * 700).Wait();
}
while (!cameraTask[0].IsCompleted || !cameraTask[1].IsCompleted)
{
Application.DoEvents();
Thread.Sleep(100);
}
}
catch (AccessViolationException e)
{
LogUtil.error( " 扫码出现AccessViolationException异常:" + e.ToString());
//throw new Exception("扫码出现AccessViolationException异常");
// GC.Collect();
}
catch (Exception ex)
{
LogUtil.error( " 扫码出错:" + ex.ToString());
//throw new Exception("扫码出错");
}
return codeList;
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
......
using HalconDotNet; using OnlineStore.Common;
using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
......
...@@ -595,6 +595,10 @@ namespace DeviceLibrary ...@@ -595,6 +595,10 @@ namespace DeviceLibrary
/// 存储MyCronic料仓的剩余容量 7X8=1000;7X12=345;13X32=100; /// 存储MyCronic料仓的剩余容量 7X8=1000;7X12=345;13X32=100;
/// </summary> /// </summary>
internal string capacity; internal string capacity;
/// <summary>
/// 与mycrnoic通讯错误
/// </summary>
public bool communicationError = false;
public bool SendCommand(string command, bool needlog, out string msg, params string[] arg) public bool SendCommand(string command, bool needlog, out string msg, params string[] arg)
{ {
...@@ -621,20 +625,22 @@ namespace DeviceLibrary ...@@ -621,20 +625,22 @@ namespace DeviceLibrary
{ {
var re = towerAppWSClient.XmlAction(command); var re = towerAppWSClient.XmlAction(command);
msg = re.ToString(); msg = re.ToString();
//communicationError = false;
return true; return true;
//errmsg = "Request sent successfully."; //errmsg = "Request sent successfully.";
} }
catch (Exception ex) catch (Exception ex)
{ {
errmsg = "Failed to send request." + command+ ex; errmsg = "Failed to send request." + command + ex;
msg = errmsg; msg = errmsg;
communicationError= true;
return false; return false;
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
errmsg = "Error: " + ex.ToString(); errmsg = "Error: " + command + ex.ToString();
msg = errmsg; msg = errmsg;
} }
return false; return false;
......
...@@ -2,19 +2,12 @@ using OnlineStore; ...@@ -2,19 +2,12 @@ using OnlineStore;
using RemoteSheardObject; using RemoteSheardObject;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
namespace DeviceLibrary namespace DeviceLibrary
{ {
public class VStore public class VStore
{ {
public VServerComm ServerCM; public VServerComm ServerCM;
public VLog VLog; public VLog VLog;
VStoreCollection vc; VStoreCollection vc;
MsgService Msg; MsgService Msg;
...@@ -29,27 +22,28 @@ namespace DeviceLibrary ...@@ -29,27 +22,28 @@ namespace DeviceLibrary
public string CID; public string CID;
public string TowerName; public string TowerName;
public TowerInfo TowerInfo; public TowerInfo TowerInfo;
public VStore(TowerInfo towerInfo, VStoreCollection storeCollection) { public VStore(TowerInfo towerInfo, VStoreCollection storeCollection)
{
vc = storeCollection; vc = storeCollection;
CID = towerInfo.TowerID; CID = towerInfo.TowerID;
TowerName = towerInfo.TowerName; TowerName = towerInfo.TowerName;
TowerInfo= towerInfo; TowerInfo = towerInfo;
VLog = new VLog(CID, CID); VLog = new VLog(CID, CID);
ServerCM = new VServerComm(CID,VLog); ServerCM = new VServerComm(CID, VLog);
ServerCM.OutStoreEvent += ServerCM_OutStoreEvent; ServerCM.OutStoreEvent += ServerCM_OutStoreEvent;
ServerCM.storeStatus = StoreStatus.None; ServerCM.storeStatus = StoreStatus.None;
Msg = new MsgService("RT-" + CID); Msg = new MsgService("RT-" + CID);
OutStoreJobList = new StoreJobList(crc.GetString("Res0050","出库任务")); OutStoreJobList = new StoreJobList(crc.GetString("Res0050", "出库任务"));
} }
public void ServerCM_OutStoreEvent(object sender, JobInfo e) public void ServerCM_OutStoreEvent(object sender, JobInfo e)
{ {
VLog.Info(sender+"出库指令信息:" + e.ToStr()); VLog.Info(sender + "出库指令信息:" + e.ToStr());
OutStoreJobList.Enqueue(e.Clone()); OutStoreJobList.Enqueue(e.Clone());
//MI.DeviceList[TowerList.List[CurrentOutJobInfo.CID].DeviceGroupName].EnqueueOutStore(CurrentOutJobInfo); //MI.DeviceList[TowerList.List[CurrentOutJobInfo.CID].DeviceGroupName].EnqueueOutStore(CurrentOutJobInfo);
} }
public string CurrentTowerStatusText=""; public string CurrentTowerStatusText = "";
public RTStoreStatus RTStoreStatus = RTStoreStatus.Offline; public RTStoreStatus RTStoreStatus = RTStoreStatus.Offline;
public volatile bool TerminalError = false; public volatile bool TerminalError = false;
DateTime LastStatusTime = DateTime.Now; DateTime LastStatusTime = DateTime.Now;
...@@ -59,19 +53,28 @@ namespace DeviceLibrary ...@@ -59,19 +53,28 @@ namespace DeviceLibrary
/// </summary> /// </summary>
public DateTime LastProcessErrorTime = DateTime.Now; public DateTime LastProcessErrorTime = DateTime.Now;
public int LastProcessErrorTimes = 0; public int LastProcessErrorTimes = 0;
internal void VTowerProcess() { internal void VTowerProcess()
if (!TowerInfo.Enable) { {
if (!TowerInfo.Enable)
{
ServerCM.storeStatus = StoreStatus.None; ServerCM.storeStatus = StoreStatus.None;
CurrentTowerStatusText = "Disable"; CurrentTowerStatusText = "Disable";
RTStoreStatus = RTStoreStatus.Offline; RTStoreStatus = RTStoreStatus.Offline;
TerminalError=false; TerminalError = false;
return; return;
} }
try try
{ {
ServerCM.communicationError = false;
var ti = ServerCM.GetTowerDetailInformation(CID); var ti = ServerCM.GetTowerDetailInformation(CID);
if (ti != null) if (ti == null)
{
ServerCM.storeStatus = StoreStatus.None;
RTStoreStatus = RTStoreStatus.Offline;
VLog.Error("GetTowerDetailInformation=null");
}
else
{ {
if (LastStatusCode != ti.StatusCode) if (LastStatusCode != ti.StatusCode)
{ {
...@@ -83,7 +86,7 @@ namespace DeviceLibrary ...@@ -83,7 +86,7 @@ namespace DeviceLibrary
ServerCM.Humidity = ti.Humidity; ServerCM.Humidity = ti.Humidity;
if (ServerCM.Humidity > ServerCM.Max_Humidity || ServerCM.Temperature > ServerCM.Max_Temperature) if (ServerCM.Humidity > ServerCM.Max_Humidity || ServerCM.Temperature > ServerCM.Max_Temperature)
{ {
Msg.add(crc.GetString("Res0098.70dccffd","温湿度超限"), MsgLevel.alarm); Msg.add(crc.GetString("Res0098.70dccffd", "温湿度超限"), MsgLevel.alarm);
} }
if (ti.StatusCode == 26 && ti.StatusText == "Ready") if (ti.StatusCode == 26 && ti.StatusText == "Ready")
...@@ -158,13 +161,13 @@ namespace DeviceLibrary ...@@ -158,13 +161,13 @@ namespace DeviceLibrary
else if (RTStoreStatus == RTStoreStatus.LockToOutStore) else if (RTStoreStatus == RTStoreStatus.LockToOutStore)
{ {
VLog.Error($"出库超时出错,没有检测到出库信息,RTStoreStatus={RTStoreStatus}:" + CurrentTerminalReelID); VLog.Error($"出库超时出错,没有检测到出库信息,RTStoreStatus={RTStoreStatus}:" + CurrentTerminalReelID);
CurrentTowerStatusText = crc.GetString("Res0112.e6c4624b","出库错误,没有执行出库过程"); CurrentTowerStatusText = crc.GetString("Res0112.e6c4624b", "出库错误,没有执行出库过程");
Msg.add($"TerminalError:" + crc.GetString("Res0113.71e5a53a","出库超时"), MsgLevel.alarm); Msg.add($"TerminalError:" + crc.GetString("Res0113.71e5a53a", "出库超时"), MsgLevel.alarm);
} }
else else
{ {
VLog.Error($"未知状态超时,RTStoreStatus={RTStoreStatus}:" + InStoreJobInfo?.ToStr()); VLog.Error($"未知状态超时,RTStoreStatus={RTStoreStatus}:" + InStoreJobInfo?.ToStr());
Msg.add($"TerminalError:" + crc.GetString("Res0114.d3023f35","料仓状态异常"), MsgLevel.warning); Msg.add($"TerminalError:" + crc.GetString("Res0114.d3023f35", "料仓状态异常"), MsgLevel.warning);
} }
} }
...@@ -275,12 +278,7 @@ namespace DeviceLibrary ...@@ -275,12 +278,7 @@ namespace DeviceLibrary
//CurrentTowerStatusText = $"{ti.StatusText}-{ti.OnlineStatus}"; //CurrentTowerStatusText = $"{ti.StatusText}-{ti.OnlineStatus}";
} }
} }
else
{
ServerCM.storeStatus = StoreStatus.None;
RTStoreStatus = RTStoreStatus.Offline;
}
/* /*
18 offline 18 offline
26 Ready/Idle 26 Ready/Idle
...@@ -335,8 +333,13 @@ namespace DeviceLibrary ...@@ -335,8 +333,13 @@ namespace DeviceLibrary
} }
finally finally
{ {
if (ServerCM.communicationError)
{
Msg.add($"Communication with tower {CID} failed.", MsgLevel.warning);
VLog.Error($"Communication with tower {CID} failed.");
}
ServerCM.ProcessMsg(Msg.msg); ServerCM.ProcessMsg(Msg.msg);
Msg.clear(); //Msg.clear();
} }
} }
public Dictionary<string, string> SlotsInfo = new Dictionary<string, string>(); public Dictionary<string, string> SlotsInfo = new Dictionary<string, string>();
...@@ -353,13 +356,13 @@ namespace DeviceLibrary ...@@ -353,13 +356,13 @@ namespace DeviceLibrary
return crc.GetString("Res0067", "等待入库信息"); return crc.GetString("Res0067", "等待入库信息");
if (RTStoreStatus == RTStoreStatus.LockToOutStore) if (RTStoreStatus == RTStoreStatus.LockToOutStore)
return crc.GetString("Res0115.44b81dd3","等待出库"); return crc.GetString("Res0115.44b81dd3", "等待出库");
if (RTStoreStatus == RTStoreStatus.InStoreExecute || RTStoreStatus == RTStoreStatus.InStoreReady) if (RTStoreStatus == RTStoreStatus.InStoreExecute || RTStoreStatus == RTStoreStatus.InStoreReady)
return crc.GetString("Res0068", "入库中") + " Barcode:" + InStoreJobInfo?.WareNum; return crc.GetString("Res0068", "入库中") + " Barcode:" + InStoreJobInfo?.WareNum;
if (RTStoreStatus == RTStoreStatus.InStoreError) if (RTStoreStatus == RTStoreStatus.InStoreError)
return crc.GetString("Res0069", "入库出错,物料NG") +"LT:"+ LastProcessErrorTimes + ", Barcode:" + InStoreJobInfo?.WareNum; return crc.GetString("Res0069", "入库出错,物料NG") + "LT:" + LastProcessErrorTimes + ", Barcode:" + InStoreJobInfo?.WareNum;
if (RTStoreStatus == RTStoreStatus.Error) if (RTStoreStatus == RTStoreStatus.Error)
return CurrentTowerStatusText; return CurrentTowerStatusText;
...@@ -371,14 +374,16 @@ namespace DeviceLibrary ...@@ -371,14 +374,16 @@ namespace DeviceLibrary
/// </summary> /// </summary>
public volatile JobInfo InStoreJobInfo; public volatile JobInfo InStoreJobInfo;
StoreJobList OutStoreJobList; StoreJobList OutStoreJobList;
public void RequestInStore(JobInfo jobInfo) { public void RequestInStore(JobInfo jobInfo)
LastStatusTime=DateTime.Now; {
LastStatusTime = DateTime.Now;
TerminalError = false; TerminalError = false;
InStoreJobInfo = jobInfo.Clone(); InStoreJobInfo = jobInfo.Clone();
//return vc.BeginInStore(CID, jobInfo); //return vc.BeginInStore(CID, jobInfo);
} }
public bool OutStoreEnd(string reelid,string towerid) { public bool OutStoreEnd(string reelid, string towerid)
{
CurrentTerminalReelID = reelid; CurrentTerminalReelID = reelid;
TheLine.UpdateLocInfo("", CurrentTerminalReelID, TheLine.LineStatusE.BOXDOOR, towerid); TheLine.UpdateLocInfo("", CurrentTerminalReelID, TheLine.LineStatusE.BOXDOOR, towerid);
return ServerCM.SendStoreState("", reelid, StoreStatus.OutStoreEnd); return ServerCM.SendStoreState("", reelid, StoreStatus.OutStoreEnd);
...@@ -393,7 +398,8 @@ namespace DeviceLibrary ...@@ -393,7 +398,8 @@ namespace DeviceLibrary
VLog.Info(v); VLog.Info(v);
} }
} }
public enum RTStoreStatus { public enum RTStoreStatus
{
Offline, Offline,
Ready, Ready,
InStoreReady, InStoreReady,
......
using log4net; using Newtonsoft.Json;
using MydataWcfServiceTest.ServiceReference2;
using Newtonsoft.Json;
using OnlineStore.Common; using OnlineStore.Common;
using RemoteSheardObject; using RemoteSheardObject;
using RtTower.WebService.ComTowerApp.Contract;
using RtTower.WebService.SharedService; using RtTower.WebService.SharedService;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -11,7 +8,6 @@ using System.IO; ...@@ -11,7 +8,6 @@ using System.IO;
using System.Linq; using System.Linq;
using System.ServiceModel; using System.ServiceModel;
using System.ServiceModel.Description; using System.ServiceModel.Description;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml; using System.Xml;
...@@ -22,35 +18,37 @@ namespace DeviceLibrary ...@@ -22,35 +18,37 @@ namespace DeviceLibrary
{ {
public class VStoreCollection public class VStoreCollection
{ {
ServiceHost Host = null; ServiceHost Host = null;
public VLog VLog = new VLog(); public VLog VLog = new VLog();
public string StoreServerURL; public string StoreServerURL;
public static Dictionary<string, VStore> VStoreList = new Dictionary<string, VStore>(); public static Dictionary<string, VStore> VStoreList = new Dictionary<string, VStore>();
public VStoreCollection() { public VStoreCollection()
{
StoreServerURL = Setting_Init.Device_StoreServerURL; StoreServerURL = Setting_Init.Device_StoreServerURL;
service.OnCommand += Service_OnCommand; service.OnCommand += Service_OnCommand;
StartService(); StartService();
if(!string.IsNullOrEmpty(Setting_Init.Runtime_OutStoreReelInfo)) if (!string.IsNullOrEmpty(Setting_Init.Runtime_OutStoreReelInfo))
OutStoreReelInfo = JsonConvert.DeserializeObject<Dictionary<string, JobInfo>>(Setting_Init.Runtime_OutStoreReelInfo); OutStoreReelInfo = JsonConvert.DeserializeObject<Dictionary<string, JobInfo>>(Setting_Init.Runtime_OutStoreReelInfo);
//TowerList.List.Add("123132", new TowerInfo() { TowerID = "13123", TowerName = "asdasd" }); //TowerList.List.Add("123132", new TowerInfo() { TowerID = "13123", TowerName = "asdasd" });
//TowerList.SaveTowerInfo(); //TowerList.SaveTowerInfo();
TowerList.List.Values.ToList().ForEach(s => TowerList.List.Values.ToList().ForEach(s =>
{ {
VLog.Info("加载RT料仓:" + s.TowerID); VLog.Info("加载RT料仓:" + s.TowerID);
VStore vStore = new VStore(s,this); VStore vStore = new VStore(s, this);
VStoreList[s.TowerID] = vStore; VStoreList[s.TowerID] = vStore;
}); });
} }
private void Service_OnCommand(object sender, string xmlString) private void Service_OnCommand(object sender, string xmlString)
{ {
var cmd= XmlCommandSerializer.DeserializeCommand(xmlString); var cmd = XmlCommandSerializer.DeserializeCommand(xmlString);
switch (cmd.Command) { switch (cmd.Command)
{
case "NotifyCarrierLoad": case "NotifyCarrierLoad":
// put in your code here // put in your code here
var r = XElement.Parse(cmd.Parameter); var r = XElement.Parse(cmd.Parameter);
...@@ -61,17 +59,19 @@ namespace DeviceLibrary ...@@ -61,17 +59,19 @@ namespace DeviceLibrary
if (!VStoreList.ContainsKey(towerid)) if (!VStoreList.ContainsKey(towerid))
{ {
VLog.Error("收到入库信息,但没有找到该料仓id"); VLog.Error("收到入库信息,但没有找到该料仓id");
}else }
else
VStoreList[towerid].InStoreEnd(reelid); VStoreList[towerid].InStoreEnd(reelid);
break; break;
case "NotifyCarrierUnload": case "NotifyCarrierUnload":
// put in your code here // put in your code here
r = XElement.Parse(cmd.Parameter); r = XElement.Parse(cmd.Parameter);
reelid = r.Descendants("Barcode").FirstOrDefault().Value; reelid = r.Descendants("Barcode").FirstOrDefault().Value;
towerid = r.Descendants("TowerId").FirstOrDefault().Value; towerid = r.Descendants("TowerId").FirstOrDefault().Value;
VLog.Info("收到出库完成通知:" + $"ReelID:{reelid},TowerID:{towerid}"); VLog.Info("收到出库完成通知:" + $"ReelID:{reelid},TowerID:{towerid}");
VStoreList[towerid].log("收到出库完成通知:" + $"ReelID:{reelid},TowerID:{towerid}"); VStoreList[towerid].log("收到出库完成通知:" + $"ReelID:{reelid},TowerID:{towerid}");
if (!VStoreList.ContainsKey(towerid)) { if (!VStoreList.ContainsKey(towerid))
{
VLog.Error("收到出库信息,但没有找到该料仓id"); VLog.Error("收到出库信息,但没有找到该料仓id");
} }
else else
...@@ -82,18 +82,21 @@ namespace DeviceLibrary ...@@ -82,18 +82,21 @@ namespace DeviceLibrary
} }
} }
Thread td; Thread td;
public void Start() { public void Start()
{
td = new Thread(new ThreadStart(Run)); td = new Thread(new ThreadStart(Run));
td.Start(); td.Start();
} }
bool mstate = false; bool mstate = false;
DateTime LastQueryCarrierListTime = DateTime.MinValue; DateTime LastQueryCarrierListTime = DateTime.MinValue;
void Run() { void Run()
{
mstate = true; mstate = true;
while (mstate) { while (mstate)
{
Thread.Sleep(1000); Thread.Sleep(1000);
VStoreList.Values.ToList().ForEach(vs=> VStoreList.Values.ToList().ForEach(vs =>
{ {
try try
{ {
...@@ -102,7 +105,7 @@ namespace DeviceLibrary ...@@ -102,7 +105,7 @@ namespace DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
VLog.Error("VTowerProcess error:"+ex); VLog.Error("VTowerProcess error:" + ex);
} }
finally finally
{ {
...@@ -119,8 +122,8 @@ namespace DeviceLibrary ...@@ -119,8 +122,8 @@ namespace DeviceLibrary
VLog.Info("RT料仓退出主循环"); VLog.Info("RT料仓退出主循环");
} }
public static Dictionary<string, JobInfo> OutStoreReelInfo = new Dictionary<string,JobInfo>(); public static Dictionary<string, JobInfo> OutStoreReelInfo = new Dictionary<string, JobInfo>();
RtTowerClientService.Service service = new RtTowerClientService.Service(); RtTowerClientService.Service service = new RtTowerClientService.Service();
void StartService() void StartService()
{ {
...@@ -201,7 +204,7 @@ namespace DeviceLibrary ...@@ -201,7 +204,7 @@ namespace DeviceLibrary
VLog.Info("stop service success"); VLog.Info("stop service success");
} }
public void GetCarrierList() public async void GetCarrierList()
{ {
try try
{ {
...@@ -218,7 +221,7 @@ namespace DeviceLibrary ...@@ -218,7 +221,7 @@ namespace DeviceLibrary
EndpointAddress endpointAddress = new EndpointAddress(baseAddress.ToString()); EndpointAddress endpointAddress = new EndpointAddress(baseAddress.ToString());
var towerAppWSClient = new MydataWcfServiceTest.ServiceReference2.TowerAppWSClient(binding, endpointAddress); var towerAppWSClient = new MydataWcfServiceTest.ServiceReference2.TowerAppWSClient(binding, endpointAddress);
VLog.Info("开始查询 CarrierList"); VLog.Info("开始查询 CarrierList");
var result = towerAppWSClient.XmlAction(VCmd.GetCarrierList); var result = await towerAppWSClient.XmlActionAsync(VCmd.GetCarrierList);
VLog.Info("结束查询 CarrierList"); VLog.Info("结束查询 CarrierList");
File.WriteAllText("logs\\CarrierList.xml", result.ToString()); File.WriteAllText("logs\\CarrierList.xml", result.ToString());
towerAppWSClient.Close(); towerAppWSClient.Close();
...@@ -227,7 +230,7 @@ namespace DeviceLibrary ...@@ -227,7 +230,7 @@ namespace DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
VLog.Error(ex.ToString()); VLog.Error("GetCarrierList:" + ex.ToString());
} }
} }
...@@ -265,7 +268,8 @@ namespace DeviceLibrary ...@@ -265,7 +268,8 @@ namespace DeviceLibrary
} }
TheLine.UploadCarrierInformation(cril); TheLine.UploadCarrierInformation(cril);
VLog.Info("上传库位信息:" + cril.Count); VLog.Info("上传库位信息:" + cril.Count);
}catch (Exception ex) }
catch (Exception ex)
{ {
VLog.Error("上传库位信息失败:" + ex); VLog.Error("上传库位信息失败:" + ex);
} }
......
...@@ -31,6 +31,6 @@ using System.Runtime.InteropServices; ...@@ -31,6 +31,6 @@ using System.Runtime.InteropServices;
// //
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
[assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.6")]
//[assembly: AssemblyVersion("1.0.*")] //[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")] //[assembly: AssemblyFileVersion("1.0.0.0")]
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!