Commit ae723b5b 张东亮

优化

1 个父辈 66be7140
...@@ -629,7 +629,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -629,7 +629,7 @@ namespace OnlineStore.DeviceLibrary
try try
{ {
Dictionary<string, string> paramMap = new Dictionary<string, string>(); Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("cids", StoreManager.Config.CID); paramMap.Add("cid", StoreManager.Config.CID);
paramMap.Add("hSerial", hSerial); paramMap.Add("hSerial", hSerial);
string server = GetAddr("/service/store/outTaskCount", paramMap); string server = GetAddr("/service/store/outTaskCount", paramMap);
......
...@@ -76,8 +76,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -76,8 +76,12 @@ namespace OnlineStore.DeviceLibrary
public void SendStoreState(string posid, DeviceStatus storeStatus) public void SendStoreState(string posid, DeviceStatus storeStatus)
{ {
Operation operation = getLineBoxStatus(); Operation operation = getLineBoxStatus();
if (!string.IsNullOrEmpty(posid)) if (!string.IsNullOrEmpty(posid) && !operation.boxStatus[1].data.ContainsKey(ParamDefine.posId))
operation.boxStatus[1].data.Add(ParamDefine.posId, posid); operation.boxStatus[1].data.Add(ParamDefine.posId, posid);
else if (!string.IsNullOrEmpty(posid) && operation.boxStatus[1].data.ContainsKey(ParamDefine.posId))
{
operation.boxStatus[1].data[ParamDefine.posId] = posid;
}
LogUtil.info($"SendStoreState,posid:{posid}, storeStatus:{storeStatus}"); LogUtil.info($"SendStoreState,posid:{posid}, storeStatus:{storeStatus}");
operation.boxStatus[1].status = (int)storeStatus; operation.boxStatus[1].status = (int)storeStatus;
...@@ -127,26 +131,26 @@ namespace OnlineStore.DeviceLibrary ...@@ -127,26 +131,26 @@ namespace OnlineStore.DeviceLibrary
else if (runStatus.Equals(DeviceStatus.OutStoreBoxEnd) || runStatus.Equals(DeviceStatus.InStoreEnd)) else if (runStatus.Equals(DeviceStatus.OutStoreBoxEnd) || runStatus.Equals(DeviceStatus.InStoreEnd))
{ {
boxStatus.data.Add(ParamDefine.posId, lastPosId); boxStatus.data.Add(ParamDefine.posId, lastPosId);
boxStatus.data.Add(ParamDefine.barcode,lastBarcode); boxStatus.data.Add(ParamDefine.barcode, lastBarcode);
boxStatus.data.Add(ParamDefine.executeTime, executeTime); boxStatus.data.Add(ParamDefine.executeTime, executeTime);
} }
else if (!lastPosId.Equals("")) else if (!lastPosId.Equals(""))
{ {
boxStatus.data.Add(ParamDefine.posId, lastPosId); boxStatus.data.Add(ParamDefine.posId, lastPosId);
boxStatus.data.Add(ParamDefine.barcode, lastBarcode); boxStatus.data.Add(ParamDefine.barcode, lastBarcode);
boxStatus.data.Add(ParamDefine.executeTime,executeTime); boxStatus.data.Add(ParamDefine.executeTime, executeTime);
boxStatus.status = (int)deviceStatus; boxStatus.status = (int)deviceStatus;
if (lastPosId != "") if (lastPosId != "")
{ {
LogUtil.info("给服务器发送出入库消息:" + Name + ",status【" + deviceStatus + "】posId【" + lastPosId + "】barcode【"+lastBarcode+"】"); LogUtil.info("给服务器发送出入库消息:" + Name + ",status【" + deviceStatus + "】posId【" + lastPosId + "】barcode【" + lastBarcode + "】");
} }
lastPosId = ""; lastPosId = "";
lastBarcode = ""; lastBarcode = "";
} }
if (MoveInfo.MoveType.Equals(MoveType.InStore)||MoveInfo.MoveType.Equals(MoveType.OutStore)) if (MoveInfo.MoveType.Equals(MoveType.InStore) || MoveInfo.MoveType.Equals(MoveType.OutStore))
{ {
if ((MoveInfo.MoveParam != null)&&( MoveInfo.MoveParam.PosInfo!=null)) if ((MoveInfo.MoveParam != null) && (MoveInfo.MoveParam.PosInfo != null))
{ {
if (!boxStatus.data.ContainsKey(ParamDefine.posId)) if (!boxStatus.data.ContainsKey(ParamDefine.posId))
{ {
...@@ -191,9 +195,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -191,9 +195,9 @@ namespace OnlineStore.DeviceLibrary
//LogUtil.info($"上报温湿度数据【{JsonHelper.SerializeObject(valuePairs)}】【{JsonHelper.SerializeObject(boxStatus.data)}】"); //LogUtil.info($"上报温湿度数据【{JsonHelper.SerializeObject(valuePairs)}】【{JsonHelper.SerializeObject(boxStatus.data)}】");
} }
} }
catch(Exception ex) catch (Exception ex)
{ {
LogUtil.error("上报温湿度数据异常",ex); LogUtil.error("上报温湿度数据异常", ex);
} }
return lineOperation; return lineOperation;
} }
...@@ -278,7 +282,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -278,7 +282,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (resultOperation.op.Equals(1)) else if (resultOperation.op.Equals(1))
{ {
LogUtil.info(logName + " 成功"+$"【{JsonHelper.SerializeObject(resultOperation)}】"); LogUtil.info(logName + " 成功" + $"【{JsonHelper.SerializeObject(resultOperation)}】");
return true; return true;
} }
else else
...@@ -360,8 +364,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -360,8 +364,8 @@ namespace OnlineStore.DeviceLibrary
try try
{ {
//判断是否接收过此库位的出库信息 //判断是否接收过此库位的出库信息
if (MoveInfo.MoveType.Equals(MoveType.OutStore) && (MoveInfo.MoveParam.PosInfo.PosId.Equals(posId)|| if (MoveInfo.MoveType.Equals(MoveType.OutStore) && (MoveInfo.MoveParam.PosInfo.PosId.Equals(posId) ||
(MoveInfo.MoveParam.PosInfoBack !=null && MoveInfo.MoveParam.PosInfoBack.PosId.Equals(posId)))) (MoveInfo.MoveParam.PosInfoBack != null && MoveInfo.MoveParam.PosInfoBack.PosId.Equals(posId))))
{ {
LogUtil.error(Name + " 出库命令【" + inoutParam.PosInfo.ToStr() + "】重复,正在【" + posId + "】出库中"); LogUtil.error(Name + " 出库命令【" + inoutParam.PosInfo.ToStr() + "】重复,正在【" + posId + "】出库中");
continue; continue;
......
...@@ -59,12 +59,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -59,12 +59,12 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
else if (Robot.IOValue(Config.IO_LineIn_Check).Equals(IO_VALUE.HIGH) ) else if (Robot.IOValue(Config.IO_LineIn_Check).Equals(IO_VALUE.HIGH))
{ {
MoveInfo.NewMove(MoveType.InStore,new InOutParam()); MoveInfo.NewMove(MoveType.InStore, new InOutParam());
IB03_LineStart(); IB03_LineStart();
} }
else if(Robot.IOValue(Config.IO_LineEnd_Check).Equals(IO_VALUE.HIGH)) else if (Robot.IOValue(Config.IO_LineEnd_Check).Equals(IO_VALUE.HIGH))
{ {
MoveInfo.NewMove(MoveType.InStore, new InOutParam()); MoveInfo.NewMove(MoveType.InStore, new InOutParam());
IB04_LineWait(); IB04_LineWait();
...@@ -222,7 +222,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -222,7 +222,8 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IB07_AxisUpMove)) else if (MoveInfo.IsStep(StepEnum.IB07_AxisUpMove))
{ {
CheckHasTray(); CheckHasTray();
}else if (MoveInfo.IsStep(StepEnum.IB08_BatchAxisToP4)) }
else if (MoveInfo.IsStep(StepEnum.IB08_BatchAxisToP4))
{ {
if (Robot.AxisIsInShelfUp(ShelfType)) if (Robot.AxisIsInShelfUp(ShelfType))
{ {
...@@ -276,7 +277,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -276,7 +277,8 @@ namespace OnlineStore.DeviceLibrary
WorkLog("料串入料 :扫码结束【" + code + "】,等待取料机构来取料," + MoveInfo.MoveParam.PosInfo.ToStr()); WorkLog("料串入料 :扫码结束【" + code + "】,等待取料机构来取料," + MoveInfo.MoveParam.PosInfo.ToStr());
} }
}else if (MoveInfo.IsStep(StepEnum.IB12_BatchAxisToReelPosition)) }
else if (MoveInfo.IsStep(StepEnum.IB12_BatchAxisToReelPosition))
{ {
string code = CodeManager.ProcessCode(LastCodeList); string code = CodeManager.ProcessCode(LastCodeList);
MoveInfo.NextMoveStep(StepEnum.IB13_ScanOK); MoveInfo.NextMoveStep(StepEnum.IB13_ScanOK);
...@@ -446,18 +448,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -446,18 +448,18 @@ namespace OnlineStore.DeviceLibrary
//判断扫码点是否可用,可用,运动到扫码点 //判断扫码点是否可用,可用,运动到扫码点
int currP = BatchAxis.GetAclPosition(); int currP = BatchAxis.GetAclPosition();
int targetPosition = currP + Config.BatchAxisP4; int targetPosition = currP + Config.BatchAxisP4;
if (Config.BatchAxisP4 > 0 &&(targetPosition<Config.BatchAxisP2 )) if (Config.BatchAxisP4 > 0 && (targetPosition < Config.BatchAxisP2))
{ {
batchAxisReelPosition = currP; batchAxisReelPosition = currP;
toBatchP4 = true; toBatchP4 = true;
MoveInfo.NextMoveStep(StepEnum.IB08_BatchAxisToP4); MoveInfo.NextMoveStep(StepEnum.IB08_BatchAxisToP4);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
BatchAxis.AbsMove(MoveInfo, targetPosition, Robot.Config.BatchAxis_P4Speed); BatchAxis.AbsMove(MoveInfo, targetPosition, Robot.Config.BatchAxis_P4Speed);
WorkLog("料盘已到位,批量轴当前位置【"+currP+ "】,扫码上升高度P4【" + Config.BatchAxisP4+"】可用,批量轴走到扫码点【"+ targetPosition + "】"); WorkLog("料盘已到位,批量轴当前位置【" + currP + "】,扫码上升高度P4【" + Config.BatchAxisP4 + "】可用,批量轴走到扫码点【" + targetPosition + "】");
} }
else else
{ {
LogUtil.info(Name + "料盘已到位,批量轴当前位置【" + currP + "】扫码上升高度P4【" + Config.BatchAxisP4 + "】扫码点【" + targetPosition + "】P2【"+ Config.BatchAxisP2 + "】,可直接扫码"); LogUtil.info(Name + "料盘已到位,批量轴当前位置【" + currP + "】扫码上升高度P4【" + Config.BatchAxisP4 + "】扫码点【" + targetPosition + "】P2【" + Config.BatchAxisP2 + "】,可直接扫码");
if (Robot.AxisIsInShelfUp(ShelfType)) if (Robot.AxisIsInShelfUp(ShelfType))
{ {
MoveInfo.NextMoveStep(StepEnum.IB09_WaitCanScan); MoveInfo.NextMoveStep(StepEnum.IB09_WaitCanScan);
...@@ -493,7 +495,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -493,7 +495,7 @@ namespace OnlineStore.DeviceLibrary
} }
private void SendInShelfLeave(string msg = "") private void SendInShelfLeave(string msg = "")
{ {
WorkLog(" SendInShelfLeave :" + msg+",清空条码"); WorkLog(" SendInShelfLeave :" + msg + ",清空条码");
LastCodeList = new List<string>(); LastCodeList = new List<string>();
preCodeList = new List<string>(); preCodeList = new List<string>();
bool needLeave = true; bool needLeave = true;
...@@ -636,11 +638,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -636,11 +638,18 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
//if (SServerManager.GetOutTaskCount(MoveInfo.MoveParam.PosInfo.hSerial) == 0)
//{
// SendOutShelfLeave("检测到工单已结束:" + MoveInfo.MoveParam.PosInfo.hSerial);
//}
//else
{
doorInfo.status = doorStatusE.outStore; 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));
} }
} }
}
else if (MoveInfo.IsStep(StepEnum.IS12_AxisDown)) else if (MoveInfo.IsStep(StepEnum.IS12_AxisDown))
{ {
MoveInfo.NextMoveStep(StepEnum.IS13_WaitReel); MoveInfo.NextMoveStep(StepEnum.IS13_WaitReel);
...@@ -684,12 +693,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -684,12 +693,16 @@ namespace OnlineStore.DeviceLibrary
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(60000)); //MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(60000));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Config.IO_LineIn_Check, IO_VALUE.LOW)); //MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Config.IO_LineIn_Check, IO_VALUE.LOW));
} }
else if (MoveInfo.IsStep(StepEnum.IS23_WaitAgv)) { else if (MoveInfo.IsStep(StepEnum.IS23_WaitAgv))
if (Robot.IOValue(Config.IO_AGV_RequestOut).Equals(IO_VALUE.HIGH)) { {
if (Robot.IOValue(Config.IO_AGV_RequestOut).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(StepEnum.IS24_ShelfOut); MoveInfo.NextMoveStep(StepEnum.IS24_ShelfOut);
WorkLog("收到AGV抵达信号"); WorkLog("收到AGV抵达信号");
ShelfOutProcess("", CurrShelf.ShelfRfid); ShelfOutProcess("", CurrShelf.ShelfRfid);
}else if (Robot.IOValue(Config.IO_LineEnd_Check).Equals(IO_VALUE.LOW)) { }
else if (Robot.IOValue(Config.IO_LineEnd_Check).Equals(IO_VALUE.LOW))
{
MoveInfo.NextMoveStep(StepEnum.IS24_ShelfOut); MoveInfo.NextMoveStep(StepEnum.IS24_ShelfOut);
WorkLog("料串已离开"); WorkLog("料串已离开");
} }
...@@ -748,7 +761,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -748,7 +761,8 @@ namespace OnlineStore.DeviceLibrary
{ {
SendOutShelfLeave("工单已结束:" + MoveInfo.MoveParam.PosInfo.hSerial); SendOutShelfLeave("工单已结束:" + MoveInfo.MoveParam.PosInfo.hSerial);
}else }
else
CheckShelfIsFull(); CheckShelfIsFull();
} }
else else
...@@ -851,11 +865,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -851,11 +865,11 @@ namespace OnlineStore.DeviceLibrary
if (!result) if (!result)
{ {
LogUtil.error(logName + $" 等待{ Config.IO_LineIn_Check}=High 超时, 等待 {Config.IO_LineEnd_Check } 信号"); LogUtil.error(logName + $" 等待{Config.IO_LineIn_Check}=High 超时, 等待 {Config.IO_LineEnd_Check} 信号");
} }
else else
{ {
LogUtil.info(logName + $"已收到 {Config.IO_LineIn_Check}=High , 等待 { Config.IO_LineEnd_Check} 信号"); LogUtil.info(logName + $"已收到 {Config.IO_LineIn_Check}=High , 等待 {Config.IO_LineEnd_Check} 信号");
} }
result = Robot.WaitIo(Config.IO_LineEnd_Check, IO_VALUE.HIGH, 60000); result = Robot.WaitIo(Config.IO_LineEnd_Check, IO_VALUE.HIGH, 60000);
...@@ -926,7 +940,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -926,7 +940,7 @@ namespace OnlineStore.DeviceLibrary
bool result = Robot.WaitIo(Config.IO_LineIn_Check, IO_VALUE.LOW, 60000); bool result = Robot.WaitIo(Config.IO_LineIn_Check, IO_VALUE.LOW, 60000);
if (!result) if (!result)
{ {
LogUtil.error(logName + $" 等待 { Config.IO_LineIn_Check}=LOW超时,等待8000后停止转动,发送FinishLeave"); LogUtil.error(logName + $" 等待 {Config.IO_LineIn_Check}=LOW超时,等待8000后停止转动,发送FinishLeave");
} }
else else
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!