Commit 0e77d8b8 刘韬

接入agv信号

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