Commit 346d986b LN

1

1 个父辈 2c170ea6
...@@ -194,7 +194,6 @@ namespace DeviceLibrary ...@@ -194,7 +194,6 @@ namespace DeviceLibrary
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方法没有传入相机名称.");
} }
...@@ -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,24 +293,32 @@ namespace DeviceLibrary ...@@ -294,24 +293,32 @@ namespace DeviceLibrary
} }
})); }));
Task.Delay(ii * 700).Wait(); Task.Delay(500).Wait();
} }
bool isfinish = false;
while (!cameraTask[0].IsCompleted ) while (!isfinish)
{
isfinish = true;
for (int i = 0; i < cameraTask.Count(); i++)
{
if (!cameraTask[i].IsCompleted)
{ {
isfinish = false;
Application.DoEvents(); Application.DoEvents();
Thread.Sleep(100); 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;
......
...@@ -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;
} }
} }
......
...@@ -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,28 +179,30 @@ namespace DeviceLibrary ...@@ -178,28 +179,30 @@ 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))
{ {
if (taskInfo.IsValid()) CurrShelf.IsBusy = false;
//TODO 暂不判断是否返回成功
//if (taskInfo.IsValid())
{ {
if (taskInfo.smallEmpty == 0 && taskInfo.bigEmpty == 0) if (taskInfo.smallEmpty == 0 && taskInfo.bigEmpty == 0)
{ {
//MoveInfo.NextMoveStep(MoveStep.S10_ShelfReady); //MoveInfo.NextMoveStep(MoveStep.S10_ShelfReady);
//CurrShelf.IsNeedLeave = true; //CurrShelf.IsNeedLeave = true;
//当前工单任务已完成,直接送料架离开 //当前工单任务已完成,直接送料架离开
MoveInfo.log("放料完成,当前工单任务已完成,剩余空位=0,料架需要离开:" + taskInfo.ToStr()); MoveInfo.log("放料完成 ,设置CurrShelf.IsBusy = false,当前工单任务已完成,剩余空位=0,料架需要离开:" + taskInfo.ToStr());
S21_ShelfNeedLeave("剩余空位=0"); S21_ShelfNeedLeave("剩余空位=0");
} }
else else
{ {
MoveInfo.NextMoveStep(MoveStep.S10_ShelfReady); MoveInfo.NextMoveStep(MoveStep.S10_ShelfReady);
MoveInfo.log("放料完成,料架还有空位,准备放料完成"); MoveInfo.log("放料完成,设置CurrShelf.IsBusy = false,料架还有空位,准备放料完成");
} }
} }
} //}
} }
} }
......
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!