Commit 346d986b LN

1

1 个父辈 2c170ea6
...@@ -77,7 +77,7 @@ namespace OnlineStore.Common ...@@ -77,7 +77,7 @@ namespace OnlineStore.Common
public static MyConfig<int> CameraScan_QRCodeCount = 3; public static MyConfig<int> CameraScan_QRCodeCount = 3;
[MyConfigComment("二维码扫码超时毫秒")] [MyConfigComment("二维码扫码超时毫秒")]
public static MyConfig<int> CameraScan_CodeTimeOut = 3000; public static MyConfig<int> CameraScan_CodeTimeOut = 3000;
public static MyConfig<bool> R_IsPutReel; public static MyConfig<bool> R_IsPutReel;
public static MyConfig<string> R_WareCode; public static MyConfig<string> R_WareCode;
......
...@@ -185,16 +185,15 @@ namespace DeviceLibrary ...@@ -185,16 +185,15 @@ namespace DeviceLibrary
} }
} }
[HandleProcessCorruptedStateExceptions] [HandleProcessCorruptedStateExceptions]
public static List<CodeInfo> CameraScan(List<string> cameraNameList) public static List<CodeInfo> CameraScan(List<string> cameraNameList)
{ {
HashSet<string> codestr = new HashSet<string>(); HashSet<string> codestr = new HashSet<string>();
List<CodeInfo> codeList = new List<CodeInfo>(); List<CodeInfo> codeList = new List<CodeInfo>();
string bitmapfilename = ""; string bitmapfilename = "";
if (cameraNameList == null || cameraNameList.Count <= 0) if (cameraNameList == null || cameraNameList.Count <= 0)
{ {
return codeList;
throw new Exception("CameraScan方法没有传入相机名称."); throw new Exception("CameraScan方法没有传入相机名称.");
} }
...@@ -213,8 +212,8 @@ namespace DeviceLibrary ...@@ -213,8 +212,8 @@ namespace DeviceLibrary
if (cameraName.Trim().Equals("")) if (cameraName.Trim().Equals(""))
{ {
return; return;
} }
DateTime startTime = DateTime.Now; DateTime startTime = DateTime.Now;
HalconDotNet.HObject ho_Image = null; HalconDotNet.HObject ho_Image = null;
Bitmap bmp = null; Bitmap bmp = null;
try try
...@@ -228,7 +227,7 @@ namespace DeviceLibrary ...@@ -228,7 +227,7 @@ namespace DeviceLibrary
retrytime++; retrytime++;
CloseCamera(cameraName); CloseCamera(cameraName);
LogUtil.info($"bitmap为空重试第{retrytime}次"); LogUtil.info($"bitmap为空重试第{retrytime}次");
Task.Delay(1500).Wait(); Task.Delay(1500).Wait();
goto retry; goto retry;
} }
//HalconDotNet.HOperatorSet.RotateImage() //HalconDotNet.HOperatorSet.RotateImage()
...@@ -238,7 +237,7 @@ namespace DeviceLibrary ...@@ -238,7 +237,7 @@ namespace DeviceLibrary
CloseCamera(cameraName); CloseCamera(cameraName);
return; return;
} }
if (idx==0) if (idx == 0)
camera_event?.Invoke(null, bmp); camera_event?.Invoke(null, bmp);
LogUtil.info(" 【" + cameraName + "】取图片完成,开始扫码"); LogUtil.info(" 【" + cameraName + "】取图片完成,开始扫码");
string r = ""; string r = "";
...@@ -294,29 +293,37 @@ namespace DeviceLibrary ...@@ -294,29 +293,37 @@ namespace DeviceLibrary
} }
})); }));
Task.Delay(ii * 700).Wait(); Task.Delay(500).Wait();
} }
bool isfinish = false;
while (!cameraTask[0].IsCompleted ) while (!isfinish)
{ {
Application.DoEvents(); isfinish = true;
Thread.Sleep(100); for (int i = 0; i < cameraTask.Count(); i++)
{
if (!cameraTask[i].IsCompleted)
{
isfinish = false;
Application.DoEvents();
Thread.Sleep(100);
}
}
} }
} }
catch (AccessViolationException e) catch (AccessViolationException e)
{ {
LogUtil.error( " 扫码出现AccessViolationException异常:" + e.ToString()); LogUtil.error(" 扫码出现AccessViolationException异常:" + e.ToString());
//throw new Exception("扫码出现AccessViolationException异常"); //throw new Exception("扫码出现AccessViolationException异常");
// GC.Collect(); // GC.Collect();
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error( " 扫码出错:" + ex.ToString()); LogUtil.error(" 扫码出错:" + ex.ToString());
//throw new Exception("扫码出错"); //throw new Exception("扫码出错");
} }
return codeList; return codeList;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
......
...@@ -244,8 +244,8 @@ namespace DeviceLibrary ...@@ -244,8 +244,8 @@ namespace DeviceLibrary
return tray; return tray;
} }
string dataStr = JsonHelper.SerializeObject(data.data);
tray = JsonHelper.DeserializeJsonToObject<TrayInfo>(data.data.ToString()); tray = JsonHelper.DeserializeJsonToObject<TrayInfo>(dataStr);
if (tray == null || tray.rfid == "" || tray.rfidLoc == 0) if (tray == null || tray.rfid == "" || tray.rfidLoc == 0)
{ {
//msg = "获取位置失败"; //msg = "获取位置失败";
......
...@@ -26,7 +26,8 @@ public class ReelParam ...@@ -26,7 +26,8 @@ public class ReelParam
TargetOutShelf = posArray[0]; TargetOutShelf = posArray[0];
if (TargetOutShelf != "NG") if (TargetOutShelf != "NG")
{ {
TargetLoc = posArray[1]; //取最后一位
TargetLoc = posArray[posArray.Length-1];
} }
} }
} }
......
...@@ -738,11 +738,13 @@ namespace DeviceLibrary ...@@ -738,11 +738,13 @@ namespace DeviceLibrary
ACStorePosition position = CSVPositionReader<ACStorePosition>.GetPositon(pName); ACStorePosition position = CSVPositionReader<ACStorePosition>.GetPositon(pName);
if (position == null) if (position == null)
{ {
LogUtil.error(Name + " " + tray.ToStr() + " 找到匹配料架,但未找到库位号:" + pName + ",查找库位号:" + targetPosName);
//判断库位号是否存在 //判断库位号是否存在
position = CSVPositionReader<ACStorePosition>.GetPositon(targetPosName); position = CSVPositionReader<ACStorePosition>.GetPositon(targetPosName);
if (position == null) if (position == null)
{ {
LogUtil.error(Name + " " + tray.ToStr() + " 找到匹配料架,但未找到库位号:" + position); LogUtil.error(Name + " " + tray.ToStr() + " 找到匹配料架,但未找到库位号:" + targetPosName);
WarnMsg = tray.barcode + "未找到库位号:" + position; WarnMsg = tray.barcode + "未找到库位号:" + position;
targetPosName = ""; targetPosName = "";
break; break;
...@@ -750,8 +752,16 @@ namespace DeviceLibrary ...@@ -750,8 +752,16 @@ namespace DeviceLibrary
} }
targetPosName = position.PositionNum; targetPosName = position.PositionNum;
LogUtil.info(Name + " " + tray.ToStr() + " 使用料架:" + targetPosName + ",更改料架为忙碌状态,开始放料"); bool result = obj.StartPutReel();
obj.StartPutReel(); if (result)
{
LogUtil.info(Name + " " + tray.ToStr() + " 使用料架:" + targetPosName + ",更改料架为忙碌状态,开始放料 成功");
return targetPosName;
}
else
{
LogUtil.info(Name + " " + tray.ToStr() + " 使用料架:" + targetPosName + ",更改料架为忙碌状态,开始放料 失败");
}
break; break;
} }
} }
......
...@@ -161,7 +161,7 @@ namespace DeviceLibrary ...@@ -161,7 +161,7 @@ namespace DeviceLibrary
else else
{ {
OutShelfBean bean = getOutShelf(StoreMoveInfo.MoveParam.TargetOutShelf); OutShelfBean bean = getOutShelf(StoreMoveInfo.MoveParam.TargetOutShelf);
//通知服务器放料完成 //通知服务器放料完成
ShelfTaskInfo taskInfo = HttpServer.ShelfFinish(bean.CurrShelf.realRFID, StoreMoveInfo.MoveParam.WareCode, StoreMoveInfo.MoveParam.TargetLoc); ShelfTaskInfo taskInfo = HttpServer.ShelfFinish(bean.CurrShelf.realRFID, StoreMoveInfo.MoveParam.WareCode, StoreMoveInfo.MoveParam.TargetLoc);
bean.PutReelOk(taskInfo); bean.PutReelOk(taskInfo);
......
...@@ -170,7 +170,8 @@ namespace DeviceLibrary ...@@ -170,7 +170,8 @@ namespace DeviceLibrary
if (ShelfReady()) if (ShelfReady())
{ {
MoveInfo.NextMoveStep(MoveStep.S11_PutReel); MoveInfo.NextMoveStep(MoveStep.S11_PutReel);
MoveInfo.log("开始放料"); MoveInfo.log("开始放料 ,设置 CurrShelf.IsBusy = true");
CurrShelf.IsBusy = true;
return true; return true;
} }
return false; return false;
...@@ -178,29 +179,31 @@ namespace DeviceLibrary ...@@ -178,29 +179,31 @@ namespace DeviceLibrary
public void PutReelOk(ShelfTaskInfo taskInfo) public void PutReelOk(ShelfTaskInfo taskInfo)
{ {
if (ShelfReady()) //if (ShelfReady())
//{
if (MoveInfo.MoveStep.Equals(MoveStep.S11_PutReel))
{ {
if (MoveInfo.MoveStep.Equals(MoveStep.S11_PutReel)) CurrShelf.IsBusy = false;
{ //TODO 暂不判断是否返回成功
if (taskInfo.IsValid()) //if (taskInfo.IsValid())
{
if (taskInfo.smallEmpty == 0 && taskInfo.bigEmpty == 0)
{ {
if (taskInfo.smallEmpty == 0 && taskInfo.bigEmpty == 0) //MoveInfo.NextMoveStep(MoveStep.S10_ShelfReady);
{ //CurrShelf.IsNeedLeave = true;
//MoveInfo.NextMoveStep(MoveStep.S10_ShelfReady); //当前工单任务已完成,直接送料架离开
//CurrShelf.IsNeedLeave = true; MoveInfo.log("放料完成 ,设置CurrShelf.IsBusy = false,当前工单任务已完成,剩余空位=0,料架需要离开:" + taskInfo.ToStr());
//当前工单任务已完成,直接送料架离开 S21_ShelfNeedLeave("剩余空位=0");
MoveInfo.log("放料完成,当前工单任务已完成,剩余空位=0,料架需要离开:" + taskInfo.ToStr()); }
S21_ShelfNeedLeave("剩余空位=0"); else
} {
else MoveInfo.NextMoveStep(MoveStep.S10_ShelfReady);
{ MoveInfo.log("放料完成,设置CurrShelf.IsBusy = false,料架还有空位,准备放料完成");
MoveInfo.NextMoveStep(MoveStep.S10_ShelfReady);
MoveInfo.log("放料完成,料架还有空位,准备放料完成");
}
} }
} }
//}
} }
} }
......
using ConfigHelper; using ConfigHelper;
using DeviceLibrary;
using log4net.Config; using log4net.Config;
//using Microsoft.Win32.TaskScheduler; //using Microsoft.Win32.TaskScheduler;
using OnlineStore.Common; using OnlineStore.Common;
...@@ -23,7 +24,8 @@ namespace TheMachine ...@@ -23,7 +24,8 @@ namespace TheMachine
[STAThread] [STAThread]
static void Main() static void Main()
{ {
//string resultStr = "{\"code\":0,\"data\":{\"w\":7,\"realRfid\":\"\",\"h\":12,\"rfid\":\"1-1F\",\"usedRfidList\":\"\",\"rfidLoc\":2,\"barcode\":\"34005600000807\"},\"msg\":\"ok\",\"msgKey\":\"smfcore.ok\",\"okResult\":true,\"params\":[]}";
// ResultData data = JsonHelper.DeserializeJsonToObject<ResultData>(resultStr);
_ = new Mutex(true, Application.ProductName, out bool ret); _ = new Mutex(true, Application.ProductName, out bool ret);
if (!ret) if (!ret)
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!