Commit 3262408c 张东亮

出库时入库问题修复

1 个父辈 25e078b6
......@@ -88,6 +88,7 @@ namespace DeviceLibrary
if (RobotManage.InoutDebugMode)
return;
lock (serverclock)
{
var code = ProcessCode(codelist, 0, 0);
......@@ -371,14 +372,14 @@ namespace DeviceLibrary
SendStoreState("", StoreStatus.InStoreError);
}
}
else if (inOutDevice.MoveInfo.MoveStep == MoveStep.InWaitServerCallback)
{
string msg = resultOperation.msg;
SendStoreState("", StoreStatus.InStoreError);
//RobotManage.mainMachine.ClampMoveInfo.NextMoveStep(MoveStep.NGOUT_01);
LogUtil.info("服务器没有正确返回库位.");
inOutDevice.Rescan();
}
//else if (inOutDevice.MoveInfo.MoveStep == MoveStep.InWaitServerCallback)
//{
// //string msg = resultOperation.msg;
// //SendStoreState("", StoreStatus.InStoreError);
// //RobotManage.mainMachine.ClampMoveInfo.NextMoveStep(MoveStep.NGOUT_01);
// //LogUtil.info("服务器没有正确返回库位.");
// //inOutDevice.Rescan();
//}
else
{
LogUtil.info("扫码时状态错误.");
......@@ -529,6 +530,64 @@ namespace DeviceLibrary
HttpHelper.Post<DoorInfo>(GetPostApi("/api/xlc/updateDoorInfo"), dev.Value.DoorInfo, false);
}
}
private static string Addr_PosForPutin = "/service/store/robotBox/emptyPosForPutin";
/// <summary>
/// 获取库位号
/// </summary>
/// <param name="deviceName"></param>
/// <param name="codeList"></param>
/// <param name="height"></param>
/// <param name="width"></param>
/// <param name="rfid"></param>
/// <param name="lastPosId"></param>
/// <returns></returns>
public void GetPosId(string[] codelist, InOutDevice inOutDevice, double weight = 0.0)
{
try
{
string codeStr = "";
List<string> list = new List<string>();
var code = ProcessCode(codelist, 0, 0);
codeStr = code + spiltStr + weight;
// 参数:cids: 多个 cid
//code: 条码内容
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("cids", CID);
paramMap.Add("code", codeStr);
string server = GetAddr(Addr_PosForPutin, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "", Encoding.UTF8, 10000);
LogUtil.info($"GetPosId 【{server}】【{resultStr}】");
//{"result":"0","msg":"","pos":"11#AC1_18_4_28","barcode":"R506072019102200414","cid":"line-ac-11"}
ForPutinData serverResult = JsonHelper.DeserializeJsonToObject<ForPutinData>(resultStr);
if (serverResult == null)
{
Thread.Sleep(500);
GetPosId(codelist, inOutDevice, weight);
return;
}
else if (serverResult.result.Equals(100).Equals(true))
{
Thread.Sleep(500);
GetPosId(codelist, inOutDevice, weight);
return;
}
if(serverResult.realRfid.Equals(0))
{
SendInStoreRequest(codelist, inOutDevice, true, weight);
return;
}
}
catch (Exception ex)
{
LogUtil.error("GetPosId ", ex);
}
GetPosId(codelist, inOutDevice, weight);
}
}
public class ResultData
{
......@@ -604,7 +663,49 @@ namespace DeviceLibrary
/// </summary>
InStoreError = 14,
}
public class GetPosResult
{
/// <summary>
/// 消息字符串
/// </summary>
public string Msg = "";
/// <summary>
/// 0=获取库位成功,98=此盘为出库盘。99:暂时不能入库,需要重新获取库位。
/// 100:服务器需要更新,需要重新获取库位
/// 105:查找空库位失败,NG
/// </summary>
public int Result;
/// <summary>
/// 获取超时,需要重新获取库位
/// </summary>
public bool IsTimeOut = false;
}
public class ForPutinData
{
// //{"result":"0","msg":"","pos":"11#AC1_18_4_28","barcode":"R506072019102200414","cid":"line-ac-11"}
// 返回: {"code": 0, "msg":"ok", data:7}
/// <summary>
/// 0=成功,98=此盘为出库盘。99:暂时不能入库,需要重新获取库位。100:服务器需要更新,需要重新获取库位
/// </summary>
public int result;
public string cid;
public string msg = "";
public string pos = "";
public string barcode = "";
public string taskId = "";
//以下为出库参数
public string posId = "";
public string plateW = "";
public string plateH = "";
public string singleOut = "";
public string urgentReel = "";
public string cutReel = "";
public string rfid = "";
public string realRfid = "";
public string rfidLoc = "";
public string smallReel = "";
}
public class DoorInfo
{
public DoorInfo()
......
......@@ -193,7 +193,7 @@ namespace DeviceLibrary
MoveInfo.MoveParam.IsNg = false;
MoveInfo.MoveParam.codeInfos = x;
var cc = x.Select((a) => a.CodeStr);
mainMachine.ServerCM.SendInStoreRequest(cc.ToArray(), this, true,weight);
mainMachine.ServerCM.GetPosId(cc.ToArray(), this,weight);
}
}
else//超重
......@@ -222,7 +222,7 @@ namespace DeviceLibrary
Msg.add("等待服务器返回库位", MsgLevel.info);
else if (MoveInfo.IsTimeOut(15))
{
MoveInfo.NextMoveStep(MoveStep.Wait);
//MoveInfo.NextMoveStep(MoveStep.Wait);
MoveInfo.log($"等待服务器返回库位超时");
}
break;
......
......@@ -40,7 +40,7 @@ namespace DeviceLibrary
StoreMoveInfo.log($"{CurrentSide}:入库周转箱已准备好");
}
//判断有没有出库任务, 需要入库空闲, 出口空闲
else if (boxTransport.IsComplateOrFree) {
else if (boxTransport.IsComplateOrFree && ServerCM.storeStatus.Equals(StoreStatus.StoreOnline)) {
if (InOutDevice.GetOutStoreFreeSide(out InOutSideE inOutSide2, out InOutDevice iod2) && OutStoreJobList.Dequeue(out JobInfo jobInfo))
{
StoreMoveInfo.log("检测到出库空闲侧:" + inOutSide2);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!