Commit c45757fc LN

增加库位循环获取逻辑

1 个父辈 3185ffb8
<?xml version="1.0"?>
<doc>
<assembly>
<name>Asa.RFID</name>
</assembly>
<members>
<member name="T:Asa.RFID.ReadAll">
<summary>
读取所有RFID
</summary>
</member>
<member name="T:Asa.RFID.ReadAll.ReceivedEvent">
<summary>
接收数据包事件
</summary>
<param name="ip"></param>
<param name="id"></param>
</member>
<member name="E:Asa.RFID.ReadAll.Received">
<summary>
接收数据包
</summary>
</member>
<member name="T:Asa.RFID.ReadAll.ReceiveBufferEvent">
<summary>
接收网卡缓存事件
</summary>
<param name="ip"></param>
<param name="buffer"></param>
</member>
<member name="E:Asa.RFID.ReadAll.ReceiveBuffer">
<summary>
接收网卡缓存
</summary>
</member>
<member name="M:Asa.RFID.ReadAll.#ctor(System.String)">
<summary>
读取所有RFID
</summary>
<param name="logName">日志名称</param>
</member>
<member name="M:Asa.RFID.ReadAll.Start(System.Int32)">
<summary>
开启
</summary>
<param name="port">RFID设备的端口</param>
</member>
<member name="M:Asa.RFID.ReadAll.Stop">
<summary>
停止
</summary>
</member>
<member name="M:Asa.RFID.ReadAll.Read(System.String)">
<summary>
读取ID号
</summary>
<param name="ip"></param>
<returns></returns>
</member>
<member name="M:Asa.RFID.ReadAll.Clear(System.String)">
<summary>
清除缓存
</summary>
<param name="ip"></param>
</member>
</members>
</doc>
......@@ -61,10 +61,10 @@ namespace OnlineStore.DeviceLibrary
{
continue;
}
list.Add(str.Trim());
list.Add(str.Trim());
string code = "=" + width + "x" + height + "=" + str.Trim();
codeStr = codeStr + code + spiltStr;
}
}
codeStr = CodeManager.ReplaceCode(codeStr);
//http://localhost/myproject/service/store/emptyPosForPutin
// 参数:cids: 多个 cid
......@@ -87,7 +87,7 @@ namespace OnlineStore.DeviceLibrary
LineOperation serverResult = JsonHelper.DeserializeJsonToObject<LineOperation>(resultStr);
if (serverResult == null)
{
msg = deviceName + " 【" + codeStr + "】结果:没有收到服务器反馈,调用 cancelPutInTask ";
msg = deviceName + " 【" + codeStr + "】结果:没有收到服务器反馈,调用 cancelPutInTask ";
cancelPutInTask(deviceName, codeStr);
return msg;
}
......@@ -408,7 +408,7 @@ namespace OnlineStore.DeviceLibrary
if (data == null)
{
return msg = deviceName + "findTempRfid【 " + rfid + "】 没有收到服务器反馈";
return msg = deviceName + " findTempRfid【 " + rfid + "】 没有收到服务器反馈";
}
else if (data.code.Equals(0).Equals(false))
{
......@@ -448,7 +448,7 @@ namespace OnlineStore.DeviceLibrary
if (data == null)
{
return msg = deviceName + "cancelPutInTask【 " + barcode + "】 没有收到服务器反馈";
return msg = deviceName + " cancelPutInTask【 " + barcode + "】 没有收到服务器反馈";
}
else if (data.code.Equals(0).Equals(false))
{
......@@ -463,6 +463,144 @@ namespace OnlineStore.DeviceLibrary
}
return msg;
}
public static GetPosResult GetPosId(string deviceName, List<string> codeList, int height, int width, string rfid, int feedEquipId)
{
GetPosResult result = new GetPosResult();
try
{
string codeStr = "";
List<string> list = new List<string>();
foreach (string str in codeList)
{
if (list.Contains(str.Trim()) || String.IsNullOrEmpty(str.Trim()))
{
continue;
}
list.Add(str.Trim());
string code = "=" + width + "x" + height + "=" + str.Trim();
codeStr = codeStr + code + spiltStr;
}
codeStr = CodeManager.ReplaceCode(codeStr);
//http://localhost/myproject/service/store/emptyPosForPutin
// 参数:cids: 多个 cid
//code: 条码内容
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("cids", LineServer.GetAllCID(feedEquipId));
paramMap.Add("code", codeStr);
paramMap.Add(ParamDefine.rfid, rfid);
string server = GetAddr(Addr_PosForPutin, paramMap);
DateTime startTime = DateTime.Now;
LogUtil.info(deviceName + "【" + rfid + "】【 " + codeStr + "】 ,获取入库库位:");
string resultStr = HttpHelper.Post(server, "", Encoding.UTF8, 10000, out result.IsTimeOut);
LogUtil.info(deviceName + "CodeReceived " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
if (result.IsTimeOut)
{
return result;
}
//{"result":"0","msg":"","pos":"11#AC1_18_4_28","barcode":"R506072019102200414","cid":"line-ac-11"}
LineOperation serverResult = JsonHelper.DeserializeJsonToObject<LineOperation>(resultStr);
if (serverResult == null)
{
result.Msg = deviceName + " 【" + codeStr + "】结果:没有收到服务器反馈,调用 cancelPutInTask ";
cancelPutInTask(deviceName, codeStr);
result.Param = new InOutParam(0, codeStr, "", height, width, true);
result.Param.rfid = rfid;
result.Param.InStoreNg = true;
result.Param.NgMsg = "没有收到服务器反馈";
return result;
}
else if ((!string.IsNullOrEmpty(serverResult.msg)) || serverResult.result.Equals(0).Equals(false))
{
result.Result = serverResult.result;
result.Msg = deviceName + " 【" + codeStr + "】结果:" + serverResult.msg;
result.Param = new InOutParam(0, codeStr, "", height, width, true);
result.Param.rfid = rfid;
result.Param.InStoreNg = true;
result.Param.NgMsg = "" + serverResult.msg;
return result;
}
result.Result = serverResult.result;
if (!serverResult.pos.Equals(""))
{
// 仓位命名: 4D01020304
//第1和第2位表示楼层(4D)
//第3和第4位表示料仓(01) 01 - 18为流水线料仓, 19 - 24为包装料仓
//第5和第6位表示列(02)
//第7和第8位表示行(03)
//第9和第10位表示隔板位置(04)
//例如: 4D12010124 表示4楼12号料仓第1列第1行架子上的第24个隔板位置
//4D19050208 表示4楼19号料仓(包装料仓)第5列第2行架子上的第8个隔板位置
string posId = serverResult.pos;
//根据库位号查找移栽
// 判断PosID是否已经在入库或者在排队列表中,如果已经存在,加入列表失败
result.Param = new InOutParam(0, serverResult.barcode, posId, height, width);
result.Param.rfid = rfid;
int storeId = result.Param.GetStoreId();
MoveEquip moveEquip = LineManager.Line.MoveEquipMap[storeId];
if (LineManager.Line.IsReviceInPosId(moveEquip, posId))
{
result.Param.InStoreNg = true;
result.Param.NgMsg = "入库库位重复";
result.Msg = deviceName + ("收到服务器入库命令 " + "入库库位重复: " + result.Param.ToStr() + " ,入库失败!");
return result;
}
LogUtil.info(deviceName + "收到入库命令: " + result.Param.ToStr() + " ");
}
}
catch (Exception ex)
{
LogUtil.error(deviceName + " ", ex);
}
return result;
}
public static void SendPosToStoreCheck(string deviceName, InOutParam param)
{
if (param == null || param.InStoreNg)
{
return;
}
int storeId = param.GetStoreId();
MoveEquip moveEquip = LineManager.Line.MoveEquipMap[storeId];
if (LineServer.BoxCanInStore(moveEquip.DeviceID))
{
LineServer.CheckInStorePos(storeId, param);
}
else
{
//等待3秒后重发验证
Task.Factory.StartNew(delegate
{
LogUtil.error(deviceName + "[" + moveEquip.Name + " ]入库命令: " + param.ToStr() + " 给料仓发送验证失败,等待3秒后重发 ");
Thread.Sleep(3000);
LineServer.CheckInStorePos(storeId, param);
});
}
lock (moveEquip.waitInListLock)
{
//如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil.info(deviceName + "[" + moveEquip.Name + " ]入库命令: " + param.ToStr() + "加入等待列表中!");
moveEquip.waitInStoreList.Add(param);
}
}
}
public class GetPosResult
{
public string Msg = "";
/// <summary>
/// 99:暂时不能入库,需要重新获取库位。100:服务器需要更新,需要重新获取库位
/// </summary>
public int Result = 0;
/// <summary>
/// 获取超时,需要重新获取库位
/// </summary>
public bool IsTimeOut = false;
public InOutParam Param = null;
}
public class RfidData
{
......
......@@ -60,7 +60,7 @@ namespace OnlineStore.DeviceLibrary
/// 是否是入库NG的料盘
/// </summary>
public bool InStoreNg = false;
public string NgMsg = "";
public string ToStr()
{
return " [" + TrayNumber + "] [" + WareCode + "] [" + PosId + "] [" + PlateW + "x" + PlateH + "],InStoreNg [" + InStoreNg +
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!