Commit a36a5372 LN

1

1 个父辈 c25d1b3f
......@@ -219,7 +219,7 @@ namespace OnlineStore.DeviceLibrary
string code = CodeManager.ProcessCode(LastCodeList);
TrayManager.UpdateTrayCode(currMoveTrayNum, code);
//从服务器获取库位号
string result = StoreServerManager.CodeReceived(Name, currMoveTrayNum, code, LastHeight, LastWidth);
string result = StoreServerManager.CodeReceived(Name, currMoveTrayNum, LastCodeList, LastHeight, LastWidth);
if (!result.Equals("")) { LogUtil.error(result); }
InStoreLog(" SecondStoreMove=MO_12_LoactionCylinder_Down 上料横移机构上升,托盘开始放行,定位气缸下降");
......
......@@ -750,80 +750,80 @@ namespace OnlineStore.DeviceLibrary
#region 扫码枪代码
/// <summary>
/// 是否已经扫码
/// </summary>
private bool IsScanCode = false;
private string CodeMsg = "";
private static string ACCode = "";
public void GetCameraCode()
{
if (IsInScan())
{
LogUtil.info("上次扫码还未执行完毕,请稍后!");
return;
}
Task.Factory.StartNew(delegate
{
///// <summary>
///// 是否已经扫码
///// </summary>
//private bool IsScanCode = false;
//private string CodeMsg = "";
//private static string ACCode = "";
//public void GetCameraCode()
//{
// if (IsInScan())
// {
// LogUtil.info("上次扫码还未执行完毕,请稍后!");
// return;
// }
// Task.Factory.StartNew(delegate
// {
IsScanCode = true;
LastScanTime = DateTime.Now;
// IsScanCode = true;
// LastScanTime = DateTime.Now;
DateTime date = DateTime.Now;
// IOMove(IO_Type.CameraLight_Power, IO_VALUE.HIGH);
// DateTime date = DateTime.Now;
// // IOMove(IO_Type.CameraLight_Power, IO_VALUE.HIGH);
List<string> codeList = CodeManager.CameraScan();
if (codeList.Count <= 0)
{
codeList = CodeManager.CameraScan();
}
List<string> list = new List<string>();
string outMsg = "";
string message = "";
int height = GetHeight();
int width = GetWidth();
//= 1 + 123.4x100.5 - 7x12 = CODE
foreach (string str in codeList)
{
if (list.Contains(str.Trim()))
{
continue;
}
list.Add(str.Trim());
//string code = "=1+0x0-" + width + "x" + height + "=" + str.Trim();
string code = width + "x" + height + "%3D" + str.Trim();
message = message + code + spiltStr;
}
if (!outMsg.Equals(""))
{
CodeMsg = "盘尺寸错误,清理二维码【" + message + "】";
LogUtil.error("盘尺寸错误,清理二维码【" + message + "】");
message = "";
}
// KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
onCodeReceived( message,height,width);
IsScanCode = false;
});
}
// List<string> codeList = CodeManager.CameraScan();
// if (codeList.Count <= 0)
// {
// codeList = CodeManager.CameraScan();
// }
// List<string> list = new List<string>();
// string outMsg = "";
// string message = "";
// int height = GetHeight();
// int width = GetWidth();
// //= 1 + 123.4x100.5 - 7x12 = CODE
// foreach (string str in codeList)
// {
// if (list.Contains(str.Trim()))
// {
// continue;
// }
// list.Add(str.Trim());
// //string code = "=1+0x0-" + width + "x" + height + "=" + str.Trim();
// string code = width + "x" + height + "%3D" + str.Trim();
// message = message + code + spiltStr;
// }
// if (!outMsg.Equals(""))
// {
// CodeMsg = "盘尺寸错误,清理二维码【" + message + "】";
// LogUtil.error("盘尺寸错误,清理二维码【" + message + "】");
// message = "";
// }
// // KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
// onCodeReceived( message,height,width);
// IsScanCode = false;
// });
//}
private string spiltStr = "%23%23";
//private string spiltStr = "%23%23";
private DateTime LastScanTime = DateTime.Now;
private bool IsInScan()
{
if (!IsScanCode)
{
return false;
}
TimeSpan span = DateTime.Now - LastScanTime;
if (span.TotalSeconds > 60)
{
//大于60秒表示超时了,可以重新开始扫码
return false;
}
return true;
}
//private DateTime LastScanTime = DateTime.Now;
//private bool IsInScan()
//{
// if (!IsScanCode)
// {
// return false;
// }
// TimeSpan span = DateTime.Now - LastScanTime;
// if (span.TotalSeconds > 60)
// {
// //大于60秒表示超时了,可以重新开始扫码
// return false;
// }
// return true;
//}
/// <summary>
......
......@@ -9,11 +9,24 @@ namespace OnlineStore.DeviceLibrary
{
public class StoreServerManager
{
public static string CodeReceived(string deviceName, int trayNum, string codeStr, int height, int width)
private static string spiltStr = "%23%23";
public static string CodeReceived(string deviceName, int trayNum, List<string> codeList, int height, int width)
{
string msg = "";
try
{
string codeStr = "";
foreach(string str in codeList)
{
if (codeStr.Equals(""))
{
codeStr = str;
}
else
{
codeStr += spiltStr + str;
}
}
if (String.IsNullOrEmpty(codeStr))
{
return msg = deviceName + "托盘【" + trayNum + "】 没有扫码到条码";
......@@ -26,6 +39,7 @@ namespace OnlineStore.DeviceLibrary
//http://localhost/myproject/service/store/emptyPosForPutin
// 参数:cids: 多个 cid
//code: 条码内容
string server = ConfigAppSettings.GetValue(Setting_Init.http_server) + "?cids=" + LineServer.GetAllCID() + "&code=%3D" + codeStr;
LogUtil.info(deviceName + "托盘【" + trayNum + "】 收到条码<< " + codeStr + ",获取入库PosID:" + server);
......@@ -58,7 +72,7 @@ namespace OnlineStore.DeviceLibrary
//判断盘是否过高(7*8的盘需要判断,如果盘过高,不让盘通过,直接显示报警信息)
int storeId = int.Parse(posArray[0]);
//根据库位号查找移栽
MoveEquip moveEquip =LineManager.Line.MoveEquipMap[storeId];
MoveEquip moveEquip = LineManager.Line.MoveEquipMap[storeId];
//取盘号
string wareNum = serverResult.barcode;
......@@ -73,14 +87,14 @@ namespace OnlineStore.DeviceLibrary
// 判断PosID是否已经在入库或者在排队列表中,如果已经存在,加入列表失败
if (LineManager.Line.IsReviceInPosId(moveEquip, posId))
{
LineManager.Line. WarnMsg = "入库库位重复: " + param.ToStr() + " ,入库失败!";
LineManager.Line.WarnMsg = "入库库位重复: " + param.ToStr() + " ,入库失败!";
moveEquip.WarnMsg = "入库库位重复: " + param.ToStr() + " ,入库失败!";
return msg=("收到服务器入库命令 " + "入库库位重复: " + param.ToStr() + " ,入库失败!" );
return msg = ("收到服务器入库命令 " + "入库库位重复: " + param.ToStr() + " ,入库失败!");
}
LineServer.CheckInStorePos(storeId, param);
//StartInStoreMove(param);
TrayManager.UpdateTrayInfo(trayCode,true,1, codeStr,posId,plateH,plateW);
TrayManager.UpdateTrayInfo(trayCode, true, 1, codeStr, posId, plateH, plateW);
}
}
}
......@@ -91,5 +105,79 @@ namespace OnlineStore.DeviceLibrary
return "";
}
///// <summary>
///// 是否已经扫码
///// </summary>
//private bool IsScanCode = false;
//private string CodeMsg = "";
//private static string ACCode = "";
//public void GetCameraCode()
//{
// if (IsInScan())
// {
// LogUtil.info("上次扫码还未执行完毕,请稍后!");
// return;
// }
// Task.Factory.StartNew(delegate
// {
// IsScanCode = true;
// LastScanTime = DateTime.Now;
// DateTime date = DateTime.Now;
// // IOMove(IO_Type.CameraLight_Power, IO_VALUE.HIGH);
// List<string> codeList = CodeManager.CameraScan();
// if (codeList.Count <= 0)
// {
// codeList = CodeManager.CameraScan();
// }
// List<string> list = new List<string>();
// string outMsg = "";
// string message = "";
// int height = GetHeight();
// int width = GetWidth();
// //= 1 + 123.4x100.5 - 7x12 = CODE
// foreach (string str in codeList)
// {
// if (list.Contains(str.Trim()))
// {
// continue;
// }
// list.Add(str.Trim());
// //string code = "=1+0x0-" + width + "x" + height + "=" + str.Trim();
// string code = width + "x" + height + "%3D" + str.Trim();
// message = message + code + spiltStr;
// }
// if (!outMsg.Equals(""))
// {
// CodeMsg = "盘尺寸错误,清理二维码【" + message + "】";
// LogUtil.error("盘尺寸错误,清理二维码【" + message + "】");
// message = "";
// }
// // KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
// onCodeReceived(message, height, width);
// IsScanCode = false;
// });
//}
//
//private DateTime LastScanTime = DateTime.Now;
//private bool IsInScan()
//{
// if (!IsScanCode)
// {
// return false;
// }
// TimeSpan span = DateTime.Now - LastScanTime;
// if (span.TotalSeconds > 60)
// {
// //大于60秒表示超时了,可以重新开始扫码
// return false;
// }
// return true;
//}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!