Commit 0e77d8b8 刘韬

接入agv信号

1 个父辈 823a4b52
......@@ -159,18 +159,20 @@ namespace OnlineStore.Common
{
try
{
//lock (lockpost)
{
string json = JsonConvert.SerializeObject(operation);
string result = Post(url, json, 2000);
T op = JsonConvert.DeserializeObject<T>(result);
string json = JsonHelper.SerializeObject(operation);
var wc = new MyWebClient(5000);
if (string.IsNullOrEmpty(wc.Headers["Content-Type"]))
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
wc.Encoding = Encoding.UTF8;
if (printlog)
{
LogUtil.info("Send [" + json + "] Revice [" + result + "]");
}
return op;
string result = wc.UploadString(url, "POST", json);
T op = JsonConvert.DeserializeObject<T>(result);
if (printlog)
{
LogUtil.info("Send [" + json + "] Revice [" + result + "]");
}
return op;
}
catch (Exception ex)
......@@ -212,7 +214,7 @@ namespace OnlineStore.Common
using (var wc = new MyWebClient(timeOut))
{
if (string.IsNullOrEmpty(wc.Headers["Content-Type"]))
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
wc.Encoding = encoding;
result = wc.UploadString(url, "POST", paramData);
......
......@@ -623,6 +623,36 @@ namespace OnlineStore.DeviceLibrary
}
return result;
}
public static int GetOutTaskCount(string hSerial)
{
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("cids", StoreManager.Config.CID);
paramMap.Add("hSerial", hSerial);
string server = GetAddr("/service/store/outTaskCount", paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "", Encoding.UTF8, 10000, out bool IsTimeOut);
LogUtil.info("GetoutTaskCount " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
if (IsTimeOut)
{
return 998;
}
if (int.TryParse(resultStr, out int r))
return r;
}
catch (Exception ex)
{
LogUtil.error("GetoutTaskCount error ", ex);
return 997;
}
return 999;
}
public static void SendPosToStoreCheck(string deviceName, InOutParam param)
{
//if (param == null || param.IsNG)
......
......@@ -21,8 +21,8 @@ public enum doorIndexE
//LeftIn = 2,
//LeftOut = 1,
XLR_1 = 4,
XLR_2 = 3,
XLR_1 = 3,
XLR_2 = 4,
}
public enum doorStatusE
......
......@@ -51,10 +51,16 @@ namespace OnlineStore.DeviceLibrary
/// <returns></returns>
private bool PreInStoreCheck(InOutParam param)
{
if (!AutoInout.autoNext && !InDoorCheck(param))
{
if (param == null || param.PosInfo == null)
return false;
if (param.PosInfo.barcode.StartsWith("Test"))
return true;
SetWarnMsg(Name + $" 启动入库出错,入口料盘无入库信息[barcode={param.PosInfo.barcode},PosSide={param.PosInfo.GetPosSide()}], 任务取消");
SServerManager.cancelPutInTask(Name, param.PosInfo.barcode);
return false;
......@@ -72,6 +78,8 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if (param.PosInfo.barcode.StartsWith("Test"))
return true;
if (!ReviceInStoreCMD(param.PosInfo.PosId, param.PosInfo.PlateH, param.PosInfo.PlateW, param.PosInfo.barcode))
{
LogUtil.error($" 入库验证失败:{param.PosInfo.ToStr()}");
......@@ -107,6 +115,8 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if (posinfo.barcode.StartsWith("Test"))
return true;
if (!ReviceInStoreCMD(posinfo.PosId, posinfo.PlateH, posinfo.PlateW, posinfo.barcode))
{
SetWarnMsg($" 入库验证失败:{posinfo.ToStr()}");
......
......@@ -516,6 +516,7 @@ namespace OnlineStore.DeviceLibrary
/// <param name="hasTray">true:有抽屉</param>
private void AddHookCheck(bool hasTray)
{
return;//暂时屏蔽
if (CheckASide())
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Hook_A_Check,hasTray? IO_VALUE.HIGH:IO_VALUE.LOW));
......@@ -527,6 +528,7 @@ namespace OnlineStore.DeviceLibrary
}
private void AddReelCheck(bool hasReel)
{
return;//暂时屏蔽
if (CheckASide())
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ForkA_Tray_Check, hasReel ? IO_VALUE.HIGH : IO_VALUE.LOW));
......
......@@ -434,6 +434,9 @@ namespace OnlineStore.DeviceLibrary
public void NextGrid()
{
PosDebugResultManager.SaveResult();
Common.LogUtil.info($"CurColInDrawer:{CurColInDrawer},PreColInDrawer:{PreColInDrawer}; CurRowInDrawer:{CurRowInDrawer},PreRowInDrawer:{PreRowInDrawer}");
Common.LogUtil.info($"CurRowInDrawer:{CurRowInDrawer},PreRowInDrawer:{PreRowInDrawer}; CurColInDrawer:{CurColInDrawer},PreColInDrawer:{PreColInDrawer}");
if ((CurColInDrawer == PreColInDrawer && CurRowInDrawer == PreRowInDrawer) || //第一个料格结束
(CurRowInDrawer == PreRowInDrawer && CurColInDrawer > PreColInDrawer))//同一层下一个,正向走
{
......
......@@ -119,7 +119,7 @@ namespace OnlineStore.DeviceLibrary
{
//doorInfo.hSerial = MoveInfo.MoveParam.hSerial;
doorInfo.status = doorStatusE.needBox;
doorInfo.status = doorStatusE.free;
doorInfo.hasContainer = false;
WorkLog($"无料串,:通知agv来送料串 ShelfType:{ShelfType},{doorInfo.doorIndex},hasContainer:{doorInfo.hasContainer}");
//Asa.ClientAction action= AgvClient.GetAction(Config.AgvName);
......@@ -135,8 +135,8 @@ namespace OnlineStore.DeviceLibrary
{
shelfWatch.Stop();
doorInfo.status = doorStatusE.free;
doorInfo.hasContainer = false;
//doorInfo.status = doorStatusE.inStore;
//doorInfo.hasContainer = true;
//AgvClient.SetToNone(Config.AgvName);
}
}
......
......@@ -53,8 +53,8 @@ namespace OnlineStore.DeviceLibrary
//LogUtil.info(Name + "StartInstore 失败,料串" + CurrShelf.ToStr() + "需要离开,NeedLeave:" + Config.AgvName + "," + CurrShelf.ShelfRfid + ",agvcallresult:" + agvcallresult.ToString());
//doorInfo.hSerial = MoveInfo.MoveParam.hSerial;
doorInfo.status = doorStatusE.fullBoxNeedLeave;
doorInfo.hasContainer = false;
doorInfo.status = doorStatusE.free;
doorInfo.hasContainer = true;
WorkLog($"有料串,:通知agv来取料串 ShelfType:{ShelfType},{doorInfo.doorIndex},hasContainer:{doorInfo.hasContainer}");
return false;
......@@ -126,7 +126,8 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.ShelfNoTray = false;
AgvClient.SetToNone(Config.AgvName);
MoveInfo.NextMoveStep(StepEnum.IB07_AxisUpMove);
doorInfo.status = doorStatusE.inStore;
doorInfo.hasContainer = true;
WorkLog("料串入料 :上料轴开始慢速上升到P2点,等待检测到料盘");
preCodeList = new List<string>(LastCodeList);
LastCodeList = new List<string>();
......@@ -322,8 +323,8 @@ namespace OnlineStore.DeviceLibrary
//WorkLog("送出出库料串 :通知agv来取料串,等待料串离开Config.AgvName:" + Config.AgvName + ",CurrShelfId:" + CurrShelf.ShelfRfid + ",agvcallresult:" + agvcallresult.ToString());
//doorInfo.hSerial = MoveInfo.MoveParam.hSerial;
doorInfo.status = doorStatusE.fullBoxNeedLeave;
doorInfo.hasContainer = false;
doorInfo.status = doorStatusE.free;
doorInfo.hasContainer = true;
WorkLog($"有料串,:通知agv来取料串 ShelfType:{ShelfType},{doorInfo.doorIndex},hasContainer:{doorInfo.hasContainer}");
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(60000));
......@@ -514,10 +515,10 @@ namespace OnlineStore.DeviceLibrary
{
needLeave = false;
}
if (needLeave)
//入库料串强制转出库
if (true || needLeave)
{
UpdateShelf(3);
UpdateShelf(2);
MoveInfo.NextMoveStep(StepEnum.IB21_BatchToP1);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
WorkLog("送出料串 :" + msg + ",提升伺服到P1点");
......@@ -597,6 +598,7 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveType.Equals(MoveType.InStore) && MoveInfo.IsStep(StepEnum.IB20_InStoreEnd))
{
MoveInfo.NewMove(MoveType.OutStore);
doorInfo.status = doorStatusE.outStore;
//如果已经在P2位置 或者伺服检测信号亮,直接开始
if (BatchAxis.IsInPosition(Config.BatchAxisP2) || Robot.IOValue(Config.IO_ReelCheck).Equals(IO_VALUE.HIGH))
{
......@@ -634,6 +636,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
doorInfo.status = doorStatusE.outStore;
MoveInfo.NextMoveStep(StepEnum.IS11_ShelfReady);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
......@@ -740,7 +743,13 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StepEnum.IS14_ReelOK);
WorkLog($"出库{MoveInfo.SLog} 放料完成");
CheckShelfIsFull();
if (SServerManager.GetOutTaskCount(MoveInfo.MoveParam.PosInfo.hSerial) == 0)
{
SendOutShelfLeave("工单已结束:" + MoveInfo.MoveParam.PosInfo.hSerial);
}else
CheckShelfIsFull();
}
else
{
......@@ -749,7 +758,9 @@ namespace OnlineStore.DeviceLibrary
}
private void CheckShelfIsFull()
{
{
int currPositon = BatchAxis.GetAclPosition();
int nextP = currPositon - Robot.Config.Height_ChangeValue * (8 + 20);
if (nextP <= Config.BatchAxisP1)
......@@ -1070,7 +1081,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (ShelfState.Equals(2))
{
return "料串:" + ShelfRfid + "_出库中";
return "料串:" + ShelfRfid + "_待机/出库中";
}
else if (ShelfState.Equals(3))
{
......
......@@ -513,26 +513,36 @@ namespace OnlineStore.DeviceLibrary
}
private bool CheckStartOutPos(string posType, InOutPosInfo posInfo, String ioType, List<BatchMoveBean> BatchMoveList, bool shelfAutoLeave = false)
{
DoorInfo doorinfo =null;
if (posInfo != null && IOValue(ioType).Equals(IO_VALUE.HIGH))
{
foreach (BatchMoveBean moveBean in BatchMoveList)
{
var curhSerial = moveBean.MoveInfo.MoveParam.PosInfo.hSerial;
var curhSerial = moveBean.MoveInfo.MoveParam?.PosInfo?.hSerial;
if (!string.IsNullOrEmpty(curhSerial) && curhSerial != posInfo.hSerial) {
LogInfo($"{posType}当前料串的 hSerial:{curhSerial},与准备出库到料串 hSerial:{posInfo.hSerial} 不符");
moveBean.ShelfNeedLeave = true;
return false;
}
else
if (moveBean.ShelfReadyOut(posInfo, shelfAutoLeave))
else if (moveBean.MoveInfo.MoveType== MoveType.InStore && moveBean.MoveInfo.MoveStep== StepEnum.IS23_WaitAgv) {
moveBean.MoveInfo.NextMoveStep(StepEnum.IB20_InStoreEnd);
moveBean.StartOutstore();
return true;
}
else if (moveBean.ShelfReadyOut(posInfo, shelfAutoLeave))
{
InOutParam param = new InOutParam(posInfo.ToCopy());
param.ShelfType = moveBean.ShelfType;
LogInfo($"{posType}物料{param.PosInfo.ToStr()},准备出库到料串{param.ShelfType}");
StartOutstore(param);
return true;
break;
}
if (moveBean.MoveInfo.MoveType == MoveType.None) {
doorinfo = moveBean.doorInfo;
}
}
if (doorinfo != null) {
doorinfo.status = doorStatusE.needBox;
doorinfo.hasContainer = false;
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!