Commit e8dd2942 张东亮

更新包装仓入库逻辑(针对料盘尺寸与料仓不匹配情况)

1 个父辈 3e714c06
此文件的差异太大,无法显示。
......@@ -24,7 +24,7 @@ namespace OnlineStore.ACPackingStore
{
public AC_BOX_Bean BoxBean = null;
// public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public FrmBox()
{
Control.CheckForIllegalCrossThreadCalls = false;
......@@ -49,7 +49,7 @@ namespace OnlineStore.ACPackingStore
{
if (BoxBean == null)
{
LogUtil.error( "找不到对应的料仓");
LogUtil.error("找不到对应的料仓");
this.Close();
return;
}
......@@ -99,18 +99,19 @@ namespace OnlineStore.ACPackingStore
txtInoutP11.Text = BoxBean.Config.InOutAxis_P11_Position.ToString();
//txtInOutP2.Text = BoxBean.Config.InOutAxis_DoorPosition_P2.ToString();
txtUpDownP1.Text = BoxBean.Config.UpDownAxis_P1.ToString();
LoadPData(ktkPosition);
LoadPData(ktkPosition);
chbDebug.Checked = BoxBean.IsDebug;
this.ShowInTaskbar = true;
try
{
int num =Convert.ToInt32( BoxBean.CID.Substring(BoxBean.CID.Length - 2, 2));
int num = Convert.ToInt32(BoxBean.CID.Substring(BoxBean.CID.Length - 2, 2));
if (num >= 18 && num <= 24)
{
numericUpDown1.Value = num;
}
}catch(Exception ex)
}
catch (Exception ex)
{
}
......@@ -152,14 +153,14 @@ namespace OnlineStore.ACPackingStore
LoadOk = true;
}
lblTemp.Text = BoxBean.humBean.currTempStr;
lblWarnMsg.Text = BoxBean.GetWarnMsg();
lblMoveInfo.Text = BoxBean.GetMoveStr();
if ( BoxBean.MoveInfo.MoveType.Equals(StoreMoveType.InStore))
{
if (BoxBean.MoveInfo.MoveType.Equals(StoreMoveType.InStore))
{
lblMoveEquipInfo.Text = "入库:" + BoxBean.MoveInfo.MoveParam.ToShortStr();
}
else if (BoxBean.MoveInfo.MoveType.Equals(StoreMoveType.OutStore) )
else if (BoxBean.MoveInfo.MoveType.Equals(StoreMoveType.OutStore))
{
lblMoveEquipInfo.Text = "出库:" + BoxBean.MoveInfo.MoveParam.ToShortStr();
}
......@@ -241,6 +242,14 @@ namespace OnlineStore.ACPackingStore
// lblWarnMsg.Text = "";
btnStartAuTo.Text = "开始自动出入库";
}
if(BoxBean.CompressSigTimeOut)
{
btnClearcurState.Visible = true;
}
else
{
btnClearcurState.Visible = false;
}
}
private void btnOutStore_Click(object sender, EventArgs e)
......@@ -250,7 +259,7 @@ namespace OnlineStore.ACPackingStore
string selectPositionNum = cmbPosition.Text;
string sleShelfNum = cmbShelfPosition.Text;
LineMoveP ktk = LoadPostion();
InOutParam param = new InOutParam("", selectPositionNum,sleShelfNum, ktk);
InOutParam param = new InOutParam("", selectPositionNum, sleShelfNum, ktk);
BoxBean.StartOutStoreMove(param);
}
else
......@@ -312,7 +321,7 @@ namespace OnlineStore.ACPackingStore
if (cmbPosition.SelectedIndex >= 0)
{
string selectPositionNum = cmbPosition.Text;
ACBoxPosition ktkPosition = CSVPositionReader<ACBoxPosition>.GetPositon(selectPositionNum);
ACBoxPosition ktkPosition = CSVPositionReader<ACBoxPosition>.GetPositon(selectPositionNum);
LoadPData(ktkPosition);
}
......@@ -360,10 +369,10 @@ namespace OnlineStore.ACPackingStore
ktkPosition.UpdownAxis_IL_P4 = FormUtil.GetIntValue(txtUpDownP4);
ktkPosition.InoutAxis_P3 = FormUtil.GetIntValue(txtInOutP3);
// ktkPosition.ComAxis_P3 = FormUtil.GetIntValue(txtComP3);
// ktkPosition.ComAxis_P3 = FormUtil.GetIntValue(txtComP3);
ktkPosition.UpdownAxis_OH_P5 = FormUtil.GetIntValue(txtUpDownP5);
ktkPosition.UpdownAxis_OL_P6 = FormUtil.GetIntValue(txtUpDownP6);
// ktkPosition.ComAxis_P2 = FormUtil.GetIntValue(txtComP2);
// ktkPosition.ComAxis_P2 = FormUtil.GetIntValue(txtComP2);
//ktkPosition.InOutAxis_P11 = FormUtil.GetIntValue(txtInoutP11);
//ktkPosition.UpDownAxis_P2 = FormUtil.GetIntValue(txtUpDownP2);
//ktkPosition.UpDownAxis_DoorOBPosition_P7 = FormUtil.GetIntValue(txtUpDownP7);
......@@ -614,7 +623,7 @@ namespace OnlineStore.ACPackingStore
string poText = cmbPosition.Text;
BoxBean.AutoInout.autoMsg = "自动出库:" + poText;
LogUtil.info( BoxBean.Name + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
LogUtil.info(BoxBean.Name + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
//BoxBean.StartOutStoreMove(new InOutStoreParam("", poText));
BoxBean.StartInStoreMove(new InOutParam("", poText, cmbShelfPosition.Text));
......@@ -661,7 +670,7 @@ namespace OnlineStore.ACPackingStore
}
catch (Exception ex)
{
LogUtil.error( "出错:" + ex.StackTrace);
LogUtil.error("出错:" + ex.StackTrace);
}
}
......@@ -806,8 +815,8 @@ namespace OnlineStore.ACPackingStore
private void btnScanTest_Click(object sender, EventArgs e)
{
BoxBean. IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
List<string> codes = CodeManager.CameraScan(BoxBean.Config.GetCameraList(),BoxBean.Name);
BoxBean.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
List<string> codes = CodeManager.CameraScan(BoxBean.Config.GetCameraList(), BoxBean.Name);
BoxBean.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
string result = "";
if (codes.Count > 0)
......@@ -822,7 +831,7 @@ namespace OnlineStore.ACPackingStore
else
{
MessageBox.Show("未扫到二维码" );
MessageBox.Show("未扫到二维码");
}
}
......@@ -886,7 +895,7 @@ namespace OnlineStore.ACPackingStore
ioIndex = BoxBean.Config.DIList[IO_Type.Compress_Check].GetIOAddr();
}
FrmPositionTool frm = new FrmPositionTool(PortName, slvAddr, ioIP, ioIndex, Text, BoxBean.DeviceID);
frm.ShowDialog();
frm.ShowDialog();
}
private void btnSaveCom_Click(object sender, EventArgs e)
......@@ -970,7 +979,7 @@ namespace OnlineStore.ACPackingStore
private void btnComP4_Click(object sender, EventArgs e)
{
int value = FormUtil.GetIntValue(txtComP4 );
int value = FormUtil.GetIntValue(txtComP4);
AxisABSMove(BoxBean.Config.Comp_Axis, value, BoxBean.Config.CompAxis_P4_Speed);
}
......@@ -1005,7 +1014,7 @@ namespace OnlineStore.ACPackingStore
{
return;
}
DialogResult result = MessageBox.Show("确定将库位改为【4D" + num.ToString().PadLeft(2,'0') + "XXXXXX】的格式?", "", MessageBoxButtons.YesNo);
DialogResult result = MessageBox.Show("确定将库位改为【4D" + num.ToString().PadLeft(2, '0') + "XXXXXX】的格式?", "", MessageBoxButtons.YesNo);
if (result.Equals(DialogResult.Yes))
{
string appPath = Application.StartupPath;
......@@ -1015,7 +1024,7 @@ namespace OnlineStore.ACPackingStore
{
string nameStr = BoxBean.DeviceID.ToString();
positionConfigFile = positionConfigFile.Replace(".csv", "_" + nameStr + ".csv");
}
}
if (!CSVPositionReader<ACBoxPosition>.UpdatePostion(positionConfigFile, num))
{
MessageBox.Show("更新文件【" + positionConfigFile + "】失败!");
......@@ -1060,7 +1069,21 @@ namespace OnlineStore.ACPackingStore
{
int value = FormUtil.GetIntValue(txtInoutP101);
AxisABSMove(BoxBean.Config.InOut_Axis, value, BoxBean.Config.InOutAxis_P101_Speed );
AxisABSMove(BoxBean.Config.InOut_Axis, value, BoxBean.Config.InOutAxis_P101_Speed);
}
/// <summary>
/// 忽略料叉信号,使出库继续运行
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnClearcurState_Click(object sender, EventArgs e)
{
if (BoxBean.MoveInfo.MoveStep.Equals(StoreMoveStep.SO_07_CheckComSig))
{
BoxBean.IsIgnoreComSig = true;
BoxBean.MoveInfo.EndStepWait();
}
}
}
}
......@@ -15,6 +15,7 @@ namespace OnlineStore.DeviceLibrary
{
#region 出入库结果验证
public bool CompressSigTimeOut = false;
private void CheckWait()
{
List<WaitResultInfo> list = MoveInfo.WaitList;
......@@ -81,6 +82,10 @@ namespace OnlineStore.DeviceLibrary
isOk = false;
break;
}
if(wait.IoType.Equals(IO_Type.Compress_Check) && MoveInfo.MoveStep.Equals(StoreMoveStep.SO_07_CheckComSig))
{
CompressSigTimeOut = true;
}
}
}
else if (wait.WaitType.Equals(WaitEnum.W003_Time))
......@@ -351,6 +356,13 @@ namespace OnlineStore.DeviceLibrary
ACAxisMove(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P11, Config.MiddleAxis_P1_Speed);
}
private void StartMoveTrayBack(string str = "料盘不属于该仓库")
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_08_ToShelfPosition);
InOutStoreLog("送出料盘 " + MoveInfo.SLog + ":" + str + ",走到料架位置,旋转轴至P101,升降轴至P102");
ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_HP102, Config.UpDownAxis_P102_Speed);
ACAxisMove(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P101, Config.MiddleAxis_P101_Speed);
}
protected override void InStoreProcess()
{
LineMoveP moveP = MoveInfo.MoveParam.MoveP;
......@@ -363,24 +375,46 @@ namespace OnlineStore.DeviceLibrary
return;
}
#region 料架取料盘扫码获取POSID
if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_10_StartGetTray))
{
if (MoveInfo.NextShelfPos())
if(MoveInfo.IsShelfLocked)
{
//新的料架库位
startInStoreTime = DateTime.Now;
MoveInfo.NextMoveStep(StoreMoveStep.BI_11_InoutToP1);
InOutStoreLog("料架取料 " + MoveInfo.SLog + ":叉子后退到待机点P1, 重置盘信息");
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
ClearLastTrayInfo();
if (MoveInfo.NextLockedShelfPos())
{
//新的料架库位
startInStoreTime = DateTime.Now;
MoveInfo.SingleInstore = false;
MoveInfo.NextMoveStep(StoreMoveStep.BI_11_InoutToP1);
InOutStoreLog("料架取料 " + MoveInfo.SLog + ":叉子后退到待机点P1, 重置盘信息");
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
ClearLastTrayInfo();
}
else
{
//所有料盘已取料完成,送出料架
StartShelfOut();
}
}
else
{
//所有料盘已取料完成,送出料架
StartShelfOut();
if (MoveInfo.NextShelfPos())
{
//新的料架库位
startInStoreTime = DateTime.Now;
MoveInfo.SingleInstore = false;
MoveInfo.NextMoveStep(StoreMoveStep.BI_11_InoutToP1);
InOutStoreLog("料架取料 " + MoveInfo.SLog + ":叉子后退到待机点P1, 重置盘信息");
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
ClearLastTrayInfo();
}
else
{
//所有料盘已取料完成,送出料架
StartShelfOut();
}
}
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_11_InoutToP1))
{
......@@ -443,9 +477,9 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_17_InoutBack))
{
if (MoveInfo.SingleInstore)
if (MoveInfo.SingleInstore || MoveInfo.IsShelfLocked)
{
//单盘入库,不需要扫码
//单盘入库或者该料架已锁定库位,不需要扫码
StartMoveToBag();
}
else
......@@ -553,11 +587,19 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StoreMoveStep.BI_30_SetInstoreParam);
InOutStoreLog("扫码 " + MoveInfo.SLog + ": 获取库位号");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
bool result = GetPosIdByCode();
if (!result)
bool result = GetPosIdByCode(MoveInfo.currShelfIndex,out CodeResultType codeResult);
if (!result)//获取库位失败
{
MoveInfo.MoveParam.PosID = "";
StartSendTray("获取入库库位失败");
if(codeResult == CodeResultType.NotFoundPos)//库位不在该料仓,将该料盘放回料架
{
//MoveInfo.MoveParam.PosID = "";
StartMoveTrayBack("此料盘不属于该仓库,放回料架");
}
else//无法获取库位信息
{
MoveInfo.MoveParam.PosID = "";
StartSendTray("获取入库库位失败");
}
}
else
{
......@@ -678,6 +720,38 @@ namespace OnlineStore.DeviceLibrary
}
#endregion
#region 把料盘送回料架逻辑
else if (MoveInfo.MoveStep == StoreMoveStep.SO_08_ToShelfPosition)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_11_ToShelf);
InOutStoreLog("送出料盘 " + MoveInfo.SLog + ":叉子进出料口,进出轴至P101");
ACAxisMove(Config.InOut_Axis, moveP.InOut_P101, Config.InOutAxis_P101_Speed);
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_11_ToShelf)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_12_PutReel);
InOutStoreLog("送出料盘 " + MoveInfo.SLog + ":放下物品,压紧轴到P1,升降轴至P101,清空 taskData=null ");
ACAxisMove(Config.Comp_Axis, moveP.ComPress_P1, Config.CompAxis_P1_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_LP101, Config.UpDownAxis_P101_Speed);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_12_PutReel)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_13_InoutBack);
InOutStoreLog("送出料盘 " + MoveInfo.SLog + ":叉子从出料口返回, 进出轴到P1 ");
InOutBackToP1(moveP.InOut_P1);
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_13_InoutBack)
{
MoveInfo.NextMoveStep(StoreMoveStep.BI_10_StartGetTray);
InOutStoreLog("送出料盘结束 " + MoveInfo.SLog + ": 升降轴返回,升降轴到P1,顶升下降,继续循环料架取料盘");
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
}
#endregion
//料架进入逻辑
else if (MoveInfo.MoveStep < StoreMoveStep.BI_10_StartGetTray)
{
......@@ -747,7 +821,7 @@ namespace OnlineStore.DeviceLibrary
#region 出库
private DateTime startOutStoreTime = DateTime.Now;
public bool IsIgnoreComSig = false; //忽略料叉压紧信号
private void StartExecuctOut(InOutParam param)
{
......@@ -910,19 +984,22 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_06_InoutBack)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_08_ToShelfPosition);
InOutStoreLog("出库 " + MoveInfo.SLog + ":走到料架位置,旋转轴至P101,升降轴至P102, ");
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_HP102, Config.UpDownAxis_P102_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P101, Config.MiddleAxis_P101_Speed);
MoveInfo.NextMoveStep(StoreMoveStep.SO_07_CheckComSig);
InOutStoreLog("出库 " + MoveInfo.SLog + ":等待料叉压紧信号 ");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Compress_Check, IO_VALUE.HIGH));
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_07_LocationUp)
else if (MoveInfo.MoveStep == StoreMoveStep.SO_07_CheckComSig)
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_08_ToShelfPosition);
InOutStoreLog("出库 " + MoveInfo.SLog + ":走到料架位置,旋转轴至P101,升降轴至P102 ");
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_HP102, Config.UpDownAxis_P102_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P101, Config.MiddleAxis_P101_Speed);
if(IOValue(IO_Type.Compress_Check).Equals(IO_VALUE.HIGH) || IsIgnoreComSig)
{
IsIgnoreComSig = false;
CompressSigTimeOut = false;
MoveInfo.NextMoveStep(StoreMoveStep.SO_08_ToShelfPosition);
InOutStoreLog("出库 " + MoveInfo.SLog + ":走到料架位置,旋转轴至P101,升降轴至P102 ");
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_HP102, Config.UpDownAxis_P102_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P101, Config.MiddleAxis_P101_Speed);
}
}
else if (MoveInfo.MoveStep == StoreMoveStep.SO_08_ToShelfPosition)
{
......
......@@ -18,7 +18,7 @@ namespace OnlineStore.DeviceLibrary
private void BI_04_WaitTakeSingle(string moveName)
{
MoveInfo.NextMoveStep(StoreMoveStep.BI_04_WaitTakeSingle);
MoveInfo.NextMoveStep(StoreMoveStep.BI_04_WaitTakeSingle);
InOutStoreLog(moveName + MoveInfo.SLog + " 线体正转,等待LineIn_Check=Low, 信号LineTake_Check=High");
LineRun();
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineIn_Check, IO_VALUE.LOW));
......@@ -53,7 +53,7 @@ namespace OnlineStore.DeviceLibrary
}
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_01_DoorOpen))
{
{
MoveInfo.NextMoveStep(StoreMoveStep.BI_03_LineRun);
InOutStoreLog(moveName + MoveInfo.SLog + "调用AgvClient.MayEnter,线体正转,等待LineIn_Check 或LineTake_Check 信号");
AgvClient.SetStatus(Config.AgvNodeName, mark, "", ClientAction.MayEnter, ClientLevel.High, true);
......@@ -70,7 +70,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_04_WaitTakeSingle))
{
MoveInfo.NextMoveStep(StoreMoveStep.BI_05_LineStop);
InOutStoreLog(moveName + MoveInfo.SLog + "调用Agv "+ Config.AgvNodeName + " FinishEnter,取料位检测到信号,停止线体正转");
InOutStoreLog(moveName + MoveInfo.SLog + "调用Agv " + Config.AgvNodeName + " FinishEnter,取料位检测到信号,停止线体正转");
LineStop();
AgvClient.SetStatus(Config.AgvNodeName, mark, "", ClientAction.FinishEnter, ClientLevel.High, true);
......@@ -80,8 +80,8 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.MoveParam.UpdateShelfPosId(ShelfPosList[0]);
InOutStoreLog("出库 " + MoveInfo.SLog + ": ShelfPosID未设置,默认ShelfPosID=" + MoveInfo.MoveParam.ShelfPosID);
}
}
}
}
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_05_LineStop))
{
......@@ -117,12 +117,12 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.MoveParam.rfid = CurrShelfID;
//送出料架,并且记录出库信息,等会重新出库
StartShelfOut();
StartShelfOut();
return;
}
MoveInfo.NextMoveStep(StoreMoveStep.BI_08_LocationUp);
InOutStoreLog(moveName + MoveInfo.SLog + "停止线体,读取料架"+CurrShelfID+",设置"+ Config.AgvNodeName + "=None");
InOutStoreLog(moveName + MoveInfo.SLog + "停止线体,读取料架" + CurrShelfID + ",设置" + Config.AgvNodeName + "=None");
AgvClient.SetStatus(Config.AgvNodeName);
// CylinderMove(MoveInfo, IO_Type.LocationCylinder_Down, IO_Type.LocationCylinder_Up);
......@@ -147,7 +147,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_08_LocationUp))
{
MoveInfo.NextMoveStep(StoreMoveStep.BI_09_TopCylinderUp);
InOutStoreLog(moveName + MoveInfo.SLog + ""+CurrShelfID+"顶升上升");
InOutStoreLog(moveName + MoveInfo.SLog + "" + CurrShelfID + "顶升上升");
CylinderMove(MoveInfo, IO_Type.TopCylinder_Down, IO_Type.TopCylinder_Up);
if (!instoreShelf)
......@@ -162,7 +162,21 @@ namespace OnlineStore.DeviceLibrary
if (instoreShelf)
{
MoveInfo.NextMoveStep(StoreMoveStep.BI_10_StartGetTray);
InOutStoreLog(moveName + MoveInfo.SLog + "开始循环料架取料盘 ");
//获取料架的锁定状态
bool lockState = StoreManager.GetShelfLockInfo(Name,CID, CurrShelfID, out MoveInfo.shelfLockDatas);
if (lockState && MoveInfo.shelfLockDatas != null)
{
MoveInfo.IsShelfLocked = true;
InOutStoreLog(moveName + MoveInfo.SLog + "开始到料架指定位置取料盘 ");
}
else
{
MoveInfo.IsShelfLocked = false;
InOutStoreLog(moveName + MoveInfo.SLog + "开始循环料架取料盘 ");
}
}
else
{
......@@ -185,13 +199,13 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveType.Equals(StoreMoveType.OutStore))
{
string mark = GetMarkInfo();
InOutStoreLog("送出[" + CurrShelfID + "][" + mark+"]:顶升下降,调用 NeedLeave[" + mark + "][" + CurrShelfID + "] ");
InOutStoreLog("送出[" + CurrShelfID + "][" + mark + "]:顶升下降,调用 NeedLeave[" + mark + "][" + CurrShelfID + "] ");
AgvClient.NeedLeave(Config.AgvNodeName, mark, CurrShelfID);
}
else
{
InOutStoreLog("送出空料架["+CurrShelfID+"]:顶升下降,调用 NeedLeave[0][" + CurrShelfID + "],clearPutInRfid[" + CurrShelfID + "]");
AgvClient.NeedLeave(Config.AgvNodeName,"0", CurrShelfID);
InOutStoreLog("送出空料架[" + CurrShelfID + "]:顶升下降,调用 NeedLeave[0][" + CurrShelfID + "],clearPutInRfid[" + CurrShelfID + "]");
AgvClient.NeedLeave(Config.AgvNodeName, "0", CurrShelfID);
StoreManager.clearPutInRfid(Name, CurrShelfID);
}
CylinderMove(MoveInfo, IO_Type.TopCylinder_Up, IO_Type.TopCylinder_Down);
......@@ -199,7 +213,7 @@ namespace OnlineStore.DeviceLibrary
private string GetMarkInfo(string defualtMark = "0")
{
string mark = defualtMark;
//如果料架号是空,需要送到VMI线
if (MoveInfo.MoveType.Equals(StoreMoveType.OutStore))
{
......@@ -229,17 +243,17 @@ namespace OnlineStore.DeviceLibrary
}
return mark;
}
private void ShelfOutProcess()
{
string mark = GetMarkInfo();
string moveName = "送出空料架["+CurrShelfID+"]";
string moveName = "送出空料架[" + CurrShelfID + "]";
if (MoveInfo.MoveType.Equals(StoreMoveType.OutStore))
{
{
moveName = "送出[" + CurrShelfID + "][" + mark + "]";
}
// LogCPU();
// LogCPU();
if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_01_TopDown))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_02_LocatinDown);
......@@ -249,16 +263,16 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_02_LocatinDown))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_03_WaitEmptyAgv);
MoveInfo.TimeOutSeconds = 600;
MoveInfo.TimeOutSeconds = 600;
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
//等待agv到达
MoveInfo.WaitList.Add(WaitResultInfo.WaitAgvAction((int)ClientAction.Arrive));
InOutStoreLog(moveName + MoveInfo.SLog + ":再次调用 NeedLeave["+mark+"][" + CurrShelfID + "],等待Agv " + Config.AgvNodeName + " Arrive ,最多等待1200秒");
InOutStoreLog(moveName + MoveInfo.SLog + ":再次调用 NeedLeave[" + mark + "][" + CurrShelfID + "],等待Agv " + Config.AgvNodeName + " Arrive ,最多等待1200秒");
AgvClient.SetStatus(Config.AgvNodeName, mark, CurrShelfID, ClientAction.NeedLeave, ClientLevel.High, true);
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_03_WaitEmptyAgv))
{
//agv到达
if (AgvClient.GetAction(Config.AgvNodeName).Equals(ClientAction.Arrive))
{
......@@ -266,7 +280,7 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog(moveName + MoveInfo.SLog + ":agv到达,打开入料口移门");
DoorBean.StartOpen(MoveInfo);
}
else
else
{
//如果料架已被拉出,也算结束
if (IOValue(IO_Type.LineIn_Check).Equals(IO_VALUE.LOW) && IOValue(IO_Type.LineTake_Check).Equals(IO_VALUE.LOW))
......@@ -276,12 +290,12 @@ namespace OnlineStore.DeviceLibrary
//如果agv未到达,直接结束
MoveEndToRuningStatus();
//EmprtShelfList = new ConcurrentQueue<string>();
InOutStoreLog(moveName + MoveInfo.SLog + ":等待Agv " + Config.AgvNodeName + " Arrive超时,检测不到料架信号,认为料架已离开,出库结束,设置"+ Config.AgvNodeName + "=None");
InOutStoreLog(moveName + MoveInfo.SLog + ":等待Agv " + Config.AgvNodeName + " Arrive超时,检测不到料架信号,认为料架已离开,出库结束,设置" + Config.AgvNodeName + "=None");
}
else
{
TimeSpan span = DateTime.Now - MoveInfo.LastSetpTime;
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime((int)span.TotalMilliseconds+ 30000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime((int)span.TotalMilliseconds + 30000));
InOutStoreLog(moveName + MoveInfo.SLog + ":等待Agv " + Config.AgvNodeName + " Arrive超时,再等待30秒");
}
}
......@@ -308,8 +322,9 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StoreMoveStep.BS_07_WaitShelfOut);
InOutStoreLog(moveName + MoveInfo.SLog + ":等待取料工位无信号 ");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineTake_Check, IO_VALUE.LOW));
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineIn_Check, IO_VALUE.HIGH));
}else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_07_WaitShelfOut))
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineIn_Check, IO_VALUE.HIGH));
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_07_WaitShelfOut))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_08_WaitLineIn);
InOutStoreLog(moveName + MoveInfo.SLog + ":等待 入料口有信号,最多等待30秒");
......@@ -324,7 +339,7 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog(moveName + MoveInfo.SLog + ":再转动1000 , 等待入料口无信号,清理RFID");
RFIDManager.ReadRFID(Config.RFID_IP, true);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineIn_Check, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineIn_Check, IO_VALUE.LOW));
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_09_WaitTime))
{
......@@ -352,7 +367,7 @@ namespace OnlineStore.DeviceLibrary
MoveEndToRuningStatus();
AgvClient.SetStatus(Config.AgvNodeName);
//EmprtShelfList = new ConcurrentQueue<string>();
InOutStoreLog(moveName + MoveInfo.SLog + ":料架"+ CurrShelfID + "已离开 ,设置"+ Config.AgvNodeName + "=None,清理rfid");
InOutStoreLog(moveName + MoveInfo.SLog + ":料架" + CurrShelfID + "已离开 ,设置" + Config.AgvNodeName + "=None,清理rfid");
RFIDManager.ReadRFID(Config.RFID_IP, true);
CurrShelfID = "";
LastOutParam = new InOutParam();
......@@ -428,7 +443,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(Name + logN + " ,["+MoveInfo.MoveType+"]["+ MoveInfo.MoveStep + "]未找到相关处理");
LogUtil.error(Name + logN + " ,[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]未找到相关处理");
}
return false;
......@@ -553,7 +568,7 @@ namespace OnlineStore.DeviceLibrary
if (humBean.NeedGetTem())
{
lineOperation.op = 5;
LogUtil.error(Name+ "没有湿度预警范围,需要从服务器获取,发送OP=" + lineOperation.op,DeviceID+105);
LogUtil.error(Name + "没有湿度预警范围,需要从服务器获取,发送OP=" + lineOperation.op, DeviceID + 105);
}
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), lineOperation, false);
......@@ -607,8 +622,8 @@ namespace OnlineStore.DeviceLibrary
int rfidLoc = FormUtil.GetIntData(data, ParamDefine.rfidLoc);
string barcode = data.ContainsKey(ParamDefine.barcode) ? data[ParamDefine.barcode] : "";
string realRfid = data.ContainsKey(ParamDefine.realRfid) ? data[ParamDefine.realRfid] : "";
int taskCount = FormUtil.GetIntData(data,ParamDefine.taskCount,0);
int taskCount = FormUtil.GetIntData(data, ParamDefine.taskCount, 0);
//urgentReel: true 表示紧急料,需要出到料串上
//cutReel: true 表示分盘料,需要出到料串上
//smallReel: true 小料(7x8),放置到小料架上
......@@ -624,9 +639,9 @@ namespace OnlineStore.DeviceLibrary
index++;
string plateW = plateWArray[index];
string plateH = plateHArray[index];
string shelfPosID = StoreManager.GetShelfIDByLoc(rfidLoc, ShelfPosList);
string shelfPosID = StoreManager.GetShelfIDByLoc(rfidLoc, ShelfPosList);
InOutParam inoutParam = new InOutParam(barcode, posId, shelfPosID, plateW, plateH, urgentReel, cutReel, smallReel, rfid, rfidLoc, taskCount, realRfid);
//根据发送的posId获取位置列表
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(posId);
if (position == null)
......@@ -704,6 +719,124 @@ namespace OnlineStore.DeviceLibrary
//发送扫码内容到服务器进行入库操作
Operation operation = getLineBoxStatus();
operation.op = 1;
operation.data = new Dictionary<string, string>() { { "code", message }, { "boxId", 1.ToString() }, { ParamDefine.rfid, CurrShelfID }, { "cids", Config.All_CIDs.Replace('#', ',') } };
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false);
if (resultOperation == null)
{
CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
LogInfo("二维码【 " + message + "】没有收到服务器反馈!");
return false;
}
else if (!string.IsNullOrEmpty(resultOperation.msg))
{
//如果有提示消息,直接显示提示
LogInfo("二维码【 " + message + "】 :" + resultOperation.msg);
return false;
}
if (resultOperation.op.Equals(1))
{
Dictionary<string, string> data = resultOperation.data;
if (data != null && data.ContainsKey(ParamDefine.posId) && data.ContainsKey(ParamDefine.plateH) && data.ContainsKey(ParamDefine.plateW))
{
//服务器返回时有:posId库位编号,plateW:料盘宽度,plateH:料盘高度,
//postId格式BoxId#位置
string posId = data[ParamDefine.posId];
string plateW = data[ParamDefine.plateW];
string plateH = data[ParamDefine.plateH];
int storeId = InOutParam.GetPosStoreId(posId);
//根据发送的posId获取位置列表
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(posId);
if (position == null)
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 ";
LogUtil.error(Name + "收到服务器入库命令:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
return false;
}
LogInfo(" 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】设置入库参数 , 开始入库!");
int p3 = ComTargetPosition + Config.GetCom_P3_P2(plateW);
MoveInfo.MoveParam.UpdatePosId(message, posId, plateW, plateH, ComTargetPosition, p3);
return true;
}
}
else if (resultOperation.op.Equals(2))
{
ReviceOutStoreProcess(resultOperation);
}
else if (resultOperation.op.Equals(5))
{
humBean.ProcessHumidityCMD(resultOperation);
}
else
{
LogUtil.error("收到服务器命令:op=" + resultOperation.op + ",未找到对应处理");
}
}
catch (Exception ex)
{
LogUtil.error(Name + "GetPosIdByCode" + ex.StackTrace);
}
return false;
}
/// <summary>
/// 扫码结果类型
/// </summary>
enum CodeResultType
{
NoCode,
DeviceNotOpen,
NotResponseFromServer,
WarnMsg,
NotFoundPos,
Error,
Success
}
/// <summary>
/// 扫码枪数据接收
/// </summary>
/// <param name="codeResultType">扫码结果</param>
/// <returns></returns>
private bool GetPosIdByCode(int rfidLoc, out CodeResultType codeResultType)
{
try
{
if (LastWidth <= 0)
{
LastWidth = 7;
}
string message = StoreManager.ProcessCode(LastWidth, LastHeight, LastScanCodes);
if (message.Equals("") || string.IsNullOrEmpty(message))
{
CodeMsg = "未扫到二维码";
LogInfo("未扫到二维码");
codeResultType = CodeResultType.NoCode;
return false;
}
if (storeRunStatus.Equals(StoreRunStatus.Wait))
{
LogInfo("二维码【 " + message + "】,设备未启动,不需要发送服务器");
codeResultType = CodeResultType.DeviceNotOpen;
return false;
}
// CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
LogUtil.info(Name + "二维码【 " + message + "】,发送给服务器获取入库PosID");
//查询该料盘所在料仓以及仓位
bool checkRelationship = StoreManager.GetPosForPutIn(Name, Config, message, CurrShelfID, rfidLoc);
if (!checkRelationship)
{
codeResultType = CodeResultType.NotFoundPos;
return false;
}
//发送扫码内容到服务器进行入库操作
Operation operation = getLineBoxStatus();
operation.op = 1;
operation.data = new Dictionary<string, string>() { { "code", message }, { "boxId", 1.ToString() }, { ParamDefine.rfid, CurrShelfID } };
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false);
......@@ -711,12 +844,14 @@ namespace OnlineStore.DeviceLibrary
{
CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
LogInfo("二维码【 " + message + "】没有收到服务器反馈!");
codeResultType = CodeResultType.NotResponseFromServer;
return false;
}
else if (!string.IsNullOrEmpty(resultOperation.msg))
{
//如果有提示消息,直接显示提示
LogInfo("二维码【 " + message + "】 :" + resultOperation.msg);
codeResultType = CodeResultType.WarnMsg;
return false;
}
......@@ -738,11 +873,13 @@ namespace OnlineStore.DeviceLibrary
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 ";
LogUtil.error(Name + "收到服务器入库命令:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
codeResultType = CodeResultType.NotFoundPos;
return false;
}
LogInfo(" 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】设置入库参数 , 开始入库!");
int p3 = ComTargetPosition + Config.GetCom_P3_P2(plateW);
MoveInfo.MoveParam.UpdatePosId(message, posId, plateW, plateH, ComTargetPosition, p3);
codeResultType = CodeResultType.Success;
return true;
}
}
......@@ -763,6 +900,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(Name + "GetPosIdByCode" + ex.StackTrace);
}
codeResultType = CodeResultType.Error;
return false;
}
......
......@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.IO;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Text;
using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary
......@@ -18,7 +18,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public static int CurrInOutType = 0;
// public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static PackingStoreBean Store = null;
public static Store_Config Config = null;
public static Dictionary<int, BaseConfig> AllConfigMap = null;
......@@ -71,7 +71,7 @@ namespace OnlineStore.DeviceLibrary
isInit = true;
string storeType = ConfigAppSettings.GetValue(Setting_Init.Store_Type);
int count = ConfigAppSettings.GetIntValue(Setting_Init.store_count);
LogUtil.info( "配置的料仓 类型=" + storeType + ",开始加载料仓配置");
LogUtil.info("配置的料仓 类型=" + storeType + ",开始加载料仓配置");
string appPath = Application.StartupPath;
string CID = ConfigAppSettings.GetValue(Setting_Init.Store_CID);
Dictionary<int, AC_BOX_Config> storeConfig = new Dictionary<int, AC_BOX_Config>();
......@@ -107,7 +107,7 @@ namespace OnlineStore.DeviceLibrary
{
CSVPositionReader<ACBoxPosition>.AddCSVFile(positionConfigFile);
}
LogUtil.info( "加载料仓完成!");
LogUtil.info("加载料仓完成!");
}
......@@ -134,7 +134,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error("出错:"+ ex.ToString());
LogUtil.error("出错:" + ex.ToString());
MessageBox.Show(ex.ToString(), "加载配置错误(请检查配置)");
Application.Exit();
}
......@@ -170,7 +170,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error("出错:"+ ex.ToString());
LogUtil.error("出错:" + ex.ToString());
}
return false;
}
......@@ -242,7 +242,7 @@ namespace OnlineStore.DeviceLibrary
p.UpDown_P6 = position.UpdownAxis_OL_P6;
param.MoveP = p;
return true;
}
return true;
......@@ -368,7 +368,7 @@ namespace OnlineStore.DeviceLibrary
}
}
}
else
else
{
// code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = deviceName + " UpdateTrayLoc【 " + barcode + "】【" + "INSHELF" + "】【" + locInfo + "】 :" + "[" + serverResult.code + "]" + serverResult.msg + ",taskCount=" + taskCount;
......@@ -413,14 +413,14 @@ namespace OnlineStore.DeviceLibrary
{
int loc = -1;
if (shelfPosList.Contains(shelfId))
{
{
loc = shelfPosList.IndexOf(shelfId) + 1;
}
else
else
{
try
{
loc = int.Parse(shelfId);
{
loc = int.Parse(shelfId);
}
catch (Exception ex)
{
......@@ -430,7 +430,7 @@ namespace OnlineStore.DeviceLibrary
}
internal static string GetShelfIDByLoc(int rfidLoc, List<string> shelfPosList)
{
string shelfId = "";
string shelfId = "";
if (rfidLoc.Equals(-1))
{
shelfId = shelfPosList[0];
......@@ -560,6 +560,128 @@ namespace OnlineStore.DeviceLibrary
return msg;
}
private static string Addr_getShelfLockInfo = "/rest/api/qisda/device/getShelfLockInfo"; //包装仓获取料架锁定状态地址
public static bool GetShelfLockInfo(string deviceName, string cid,string rfid,out List<ShelfLockData> shelfLockDatas)
{
string msg = "";
shelfLockDatas = null;
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add(ParamDefine.rfid, rfid);
string server = GetAddr(Addr_getShelfLockInfo, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
LogUtil.info(deviceName + "料架锁定状态 " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
ShelfLockInfo serverResult = JsonHelper.DeserializeJsonToObject<ShelfLockInfo>(resultStr);
if (serverResult == null)
{
msg = deviceName + " 没有收到服务器反馈";
LogUtil.info(msg);
return false;
}
if (serverResult.data.Count ==0) //该料架未锁定
{
msg = deviceName + " 料架【"+rfid+"】 没有锁定库位的料";
LogUtil.info(msg);
return false;
}
else //该料架存在锁定库位的料
{
shelfLockDatas = new List<ShelfLockData>();
string plates = "";
foreach (ShelfLockData item in serverResult.data)
{
LogUtil.info("锁定的CID="+item.cid+";当前CID="+cid);
if(item.cid.Equals(cid))//该料盘属于此料仓
{
shelfLockDatas.Add(item);
plates += "["+item.lockPos+"]# ";
}
}
msg = deviceName + " 料架【" + rfid + "】 在该料仓锁定库位的料:【"+plates+"】";
LogUtil.info(msg);
return true;
}
}
catch (Exception ex)
{
LogUtil.error(deviceName + " ", ex);
}
return false;
}
private static string Addr_PosForPutin = "/service/store/emptyPosForPutin"; //获取当前料盘属于的料仓编号
public static bool GetPosForPutIn(string deviceName,AC_BOX_Config boxConfig,string barcode,string rfid,int rfidLoc)
{
string msg = "";
try
{
// http://localhost/myproject/service/store/emptyPosForPutin
// 参数:cids: 多个 cid
//code: 条码内容
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("cids",boxConfig.All_CIDs.Replace('#',','));
paramMap.Add("code", barcode);
paramMap.Add(ParamDefine.rfid, rfid);
paramMap.Add("rfidLoc", rfidLoc.ToString());
string server = GetAddr(Addr_PosForPutin, paramMap);
DateTime startTime = DateTime.Now;
LogUtil.info(deviceName + " 条码【 " + barcode + "】料串【" + rfid + "】,获取入库库位:");
string resultStr = HttpHelper.Post(server, "");
LogUtil.info(deviceName + "CodeReceived " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
//{"result":"0","msg":"","pos":"11#AC1_18_4_28","barcode":"R506072019102200414","cid":"line-ac-11"}
LineOperation serverResult = JsonHelper.DeserializeJsonToObject<LineOperation>(resultStr);
if (serverResult == null)
{
msg = deviceName + " 【" + barcode + "】结果:没有收到服务器反馈 ";
LogUtil.info(msg);
return false;
}
else if ((!string.IsNullOrEmpty(serverResult.msg)) || serverResult.result.Equals(0).Equals(false))
{
msg = deviceName + " 【" + barcode + "】结果:" + serverResult.msg;
LogUtil.info(msg);
return false;
}
if (serverResult.cid.Equals(boxConfig.CID)) //该料盘在此料仓
{
// 仓位命名: 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个隔板位置
msg = deviceName + " 料盘【" + barcode + "】属于该料仓【"+boxConfig.CID+"】";
LogUtil.info(msg);
return true;
}
else
{
msg = deviceName + " 料盘【" + barcode + "】不属于该料仓【" + boxConfig.CID + "】";
LogUtil.info(msg);
return false;
}
}
catch (Exception ex)
{
LogUtil.error(deviceName + " ", ex);
}
return false;
}
}
public class AfterPutData
{
......@@ -671,5 +793,62 @@ namespace OnlineStore.DeviceLibrary
// smallTask: 还有多少盘小料任务(放置到双层线的D料架上)
// bigTask: 还有多少盘大料任务(放置到C料架上)
}
public class ShelfLockInfo
{
//返回: {"code":0,"msg":"ok","data":
//[{"barcode":"S20052301213","cid":"packing-20","rfid":"A12","rfidLoc":"3","lockPos":"4D2001AA0006","lockPosId":"1231"}]}
/// <summary>
/// 返回码,0为正常,其他为异常
/// </summary>
public int code { get; set; }
/// <summary>
/// 消息
/// </summary>
public string msg { get; set; }
public List<ShelfLockData> data { get; set; }
}
public class ShelfLockData
{
/// <summary>
/// 库位中料盘的条码
/// </summary>
public string barcode { get; set; }
/// <summary>
/// 库位中料盘的锁定库位对应的料仓编
/// </summary>
public string cid { get; set; }
/// <summary>
/// 料架RFID
/// </summary>
public string rfid { get; set; }
/// <summary>
/// 料架的库位
/// </summary>
public int rfidLoc { get; set; }
/// <summary>
/// 库位中料盘的锁定库位
/// </summary>
public string lockPos { get; set; }
}
public class LineOperation
{
// //{"result":"0","msg":"","pos":"11#AC1_18_4_28","barcode":"R506072019102200414","cid":"line-ac-11"}
// 返回: {"code": 0, "msg":"ok", data:7}
/// <summary>
/// 0=成功
/// </summary>
public int result;
public string cid;
public string msg = "";
public string pos = "";
public string barcode = "";
}
}
......@@ -50,7 +50,7 @@
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<HintPath>..\..\..\RC32-SZBOSCH-ACSingleStore\dll\halcondotnet.dll</HintPath>
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
</Reference>
<Reference Include="HFReader9CSharp">
<HintPath>..\..\dll\RFID\HFReader9CSharp.dll</HintPath>
......
......@@ -141,3 +141,4 @@ PRO,温湿度端口号,Humiture_Port,COM5,,,,,,,
PRO,扫码的相机名称(多个用#分隔),CameraNameList,GigE:MV-CE200-10GC (00D76546875),,,,,,,
PRO,RFID读卡器IP,RFID_IP,192.168.104.101,,,,,,,
PRO,是否是调试状态,IsInDebug,0,,,,,,,
PRO,所有料仓的CID(用#号分隔),All_CIDs,packing-1#packing-2#packing-3#packing-4#packing-5#packing-6#packing-7#packing-8,,,,,,,
......@@ -141,3 +141,4 @@ PRO,温湿度端口号,Humiture_Port,COM5,,,,,,,
PRO,扫码的相机名称(多个用#分隔),CameraNameList,GigE:MV-CE200-10GC (00D76546940),,,,,,,
PRO,RFID读卡器IP,RFID_IP,192.168.104.102,,,,,,,
PRO,是否是调试状态,IsInDebug,0,,,,,,,
PRO,所有料仓的CID(用#号分隔),All_CIDs,packing-2#packing-3#packing-4#packing-5#packing-6#packing-7#packing-8#packing-1,,,,,,,
\ No newline at end of file
......@@ -192,6 +192,41 @@ namespace OnlineStore.DeviceLibrary
MoveP.UpDown_P5 = position.UpdownAxis_OH_P5;
MoveP.UpDown_P6 = position.UpdownAxis_OL_P6;
}
internal void UpdatePosIdAndShelfId(string wareNo,string rfid,string posId, string ShelfPosID)
{
WareCode = wareNo;
this.ShelfPosID = ShelfPosID;
this.rfid = rfid;
ShelfPosition sp = CSVPositionReader<ShelfPosition>.GetPositon(ShelfPosID);
if (sp == null)
{
LogUtil.error("GetPositon[" + ShelfPosID + "]=null,没有库位不能执行出入库");
}
MoveP.InOut_P101 = sp.InoutAxis_P101;
MoveP.UpDown_LP101 = sp.UpDownAxis_LP101;
MoveP.UpDown_HP102 = sp.UpDownAxis_HP102;
MoveP.Middle_P101 = sp.MiddleAxis_P101;
PosID = posId;
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(posId);
if (position == null)
{
LogUtil.error("GetPositon[" + posId + "] =null,没有库位不能执行出入库");
}
//MoveP.ComPress_P2 = comP2;
//MoveP.ComPress_P3 = comP3;
MoveP.InOut_P3 = position.InoutAxis_P3;
MoveP.Middle_P2 = position.MiddleAxis_P2;
MoveP.UpDown_P3 = position.UpdownAxis_IH_P3;
MoveP.UpDown_P4 = position.UpdownAxis_IL_P4;
MoveP.UpDown_P5 = position.UpdownAxis_OH_P5;
MoveP.UpDown_P6 = position.UpdownAxis_OL_P6;
}
}
}
......@@ -240,9 +240,9 @@ namespace OnlineStore.DeviceLibrary
SO_06_InoutBack = 2006,
/// <summary>
/// 料仓出库,定位气缸伸出(有压紧轴的不需要此步骤 )
/// 料仓出库,等待压紧信号确认
/// </summary>
SO_07_LocationUp = 2007,
SO_07_CheckComSig = 2007,
/// <summary>
/// 料仓出库,走到料架位置,旋转轴至P20,升降轴至P102,
......
......@@ -6,7 +6,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
......@@ -22,15 +22,15 @@ namespace OnlineStore.DeviceLibrary
public StoreMoveInfo(int storeId)
{
moveType = StoreMoveType.None;
MoveParam = new InOutParam();
this.storeId = storeId;
this.moveStep = StoreMoveStep.Wait;
IsInWait = false;
// MoveNum = 0;
// MoveNum = 0;
}
// public int MoveNum { get; set; }
// public int MoveNum { get; set; }
public DateTime LastSetpTime { get; set; }
......@@ -44,7 +44,7 @@ namespace OnlineStore.DeviceLibrary
get { return " " + MoveStep + " "; }
}
/// <summary>
/// 操作类型
/// </summary>
......@@ -67,7 +67,7 @@ namespace OnlineStore.DeviceLibrary
/// 是否再当前步骤等待中
/// </summary>
public bool IsInWait { get; set; }
/// <summary>
/// 当前执行到的步骤
/// </summary>
......@@ -85,12 +85,12 @@ namespace OnlineStore.DeviceLibrary
}
public bool SingleInstore = false;
public void NextMoveStep(StoreMoveStep step)
{
// PreMoveStep = moveStep;
// PreMoveStep = moveStep;
moveStep = step;
LastSetpTime = DateTime.Now;
LastSetpTime = DateTime.Now;
IsInWait = true;
WaitList = new List<WaitResultInfo>();
OneWaitCanEndStep = false;
......@@ -122,7 +122,7 @@ namespace OnlineStore.DeviceLibrary
param = new InOutParam();
}
this.MoveParam = param;
LastSetpTime = DateTime.Now;
LastSetpTime = DateTime.Now;
WaitList = new List<WaitResultInfo>();
currShelfIndex = -1;
SingleInstore = false;
......@@ -130,7 +130,7 @@ namespace OnlineStore.DeviceLibrary
public void EndMove()
{
this.moveType = StoreMoveType.None;
this.MoveParam = null;
this.MoveParam = null;
moveStep = StoreMoveStep.Wait;
LastSetpTime = DateTime.Now;
IsInWait = false;
......@@ -149,7 +149,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public List<string> ShelfPositionList = new List<string>();
private string currShelfPosId = "";
private int currShelfIndex = -1;
public int currShelfIndex = -1;
public bool NextShelfPos()
{
......@@ -164,6 +164,33 @@ namespace OnlineStore.DeviceLibrary
MoveParam.UpdateShelfPosId(currShelfPosId);
return true;
}
/// <summary>
/// 入库时,料架已锁定库位的位置,无需扫码
/// </summary>
public bool IsShelfLocked = false;//料架是否锁定
/// <summary>
/// 料架锁定位置的料
/// </summary>
public List<ShelfLockData> shelfLockDatas =null;
public bool NextLockedShelfPos()
{
currShelfIndex++;
if (currShelfIndex >= shelfLockDatas.Count)
{
shelfLockDatas = null;
return false;
}
currShelfPosId = ShelfPositionList[shelfLockDatas[currShelfIndex].rfidLoc];
//设置取料位置
MoveParam.UpdatePosIdAndShelfId(shelfLockDatas[currShelfIndex].barcode,
shelfLockDatas[currShelfIndex].rfid,
shelfLockDatas[currShelfIndex].lockPos, currShelfPosId);
return true;
}
}
public class WaitResultInfo
......@@ -174,30 +201,30 @@ namespace OnlineStore.DeviceLibrary
CanWhileMoveCount = 0;
}
public static WaitResultInfo WaitIO(string ioType, IO_VALUE ioValue)
public static WaitResultInfo WaitIO(string ioType, IO_VALUE ioValue)
{
WaitResultInfo wait = new WaitResultInfo();
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W002_IOValue;
wait.IoType = ioType;
wait.IoValue = ioValue;
wait.IoValue = ioValue;
return wait;
}
public static WaitResultInfo WaitAxis(ConfigMoveAxis axis,int targetPosition,int targetSpeed )
public static WaitResultInfo WaitAxis(ConfigMoveAxis axis, int targetPosition, int targetSpeed)
{
WaitResultInfo wait = new WaitResultInfo();
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W001_AxisMove;
wait.AxisInfo = axis;
wait.IsHomeMove = false;
wait.TargetPosition = targetPosition;
wait.TargetSpeed = targetSpeed;
wait.TargetSpeed = targetSpeed;
return wait;
}
public static WaitResultInfo WaitAxis(ConfigMoveAxis axis, bool isHomeMove)
{
WaitResultInfo wait = new WaitResultInfo();
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W001_AxisMove;
wait.AxisInfo = axis;
wait.IsHomeMove = true;
wait.IsHomeMove = true;
return wait;
}
//public static WaitResultInfo WaitStell(byte slvAddr, int targetPosition, int speed)
......@@ -222,16 +249,16 @@ namespace OnlineStore.DeviceLibrary
// wait.TargetSpeed = speed;
// return wait;
//}
//public static WaitResultInfo WaitShuoKe(int slvAddr, int targetPosition, bool isHome)
//{
// WaitResultInfo wait = new WaitResultInfo();
// wait.CanWhileMoveCount = 0;
// wait.WaitType = WaitEnum.W005_ShuoKe;
// wait.SlvAddr =(byte) slvAddr;
// wait.TargetPosition = targetPosition;
// wait.IsHomeMove = isHome;
// return wait;
//}
//public static WaitResultInfo WaitShuoKe(int slvAddr, int targetPosition, bool isHome)
//{
// WaitResultInfo wait = new WaitResultInfo();
// wait.CanWhileMoveCount = 0;
// wait.WaitType = WaitEnum.W005_ShuoKe;
// wait.SlvAddr =(byte) slvAddr;
// wait.TargetPosition = targetPosition;
// wait.IsHomeMove = isHome;
// return wait;
//}
public static WaitResultInfo WaitTime(int MScends)
{
WaitResultInfo wait = new WaitResultInfo();
......@@ -241,9 +268,9 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = false;
return wait;
}
public static WaitResultInfo WaitAxisOrg(ConfigMoveAxis axis,IO_VALUE value )
public static WaitResultInfo WaitAxisOrg(ConfigMoveAxis axis, IO_VALUE value)
{
WaitResultInfo wait = new WaitResultInfo();
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W006_AxisOrg;
wait.AxisInfo = axis;
wait.IsHomeMove = true;
......@@ -251,35 +278,35 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = false;
return wait;
}
public static WaitResultInfo WaitComAxis(ConfigMoveAxis axis, int targetPosition, int targetSpeed)
public static WaitResultInfo WaitComAxis(ConfigMoveAxis axis, int targetPosition, int targetSpeed)
{
WaitResultInfo wait = new WaitResultInfo();
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W008_Compress;
wait.AxisInfo = axis;
wait.IsHomeMove = false;
wait.TargetPosition = targetPosition;
wait.TargetSpeed = targetSpeed;
wait.TargetSpeed = targetSpeed;
return wait;
}
internal static WaitResultInfo WaitCode()
{
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W009_ScanCode;
wait.IsHomeMove = false;
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W009_ScanCode;
wait.IsHomeMove = false;
return wait;
}
public static WaitResultInfo WaitAgvAction(int arrive)
{
WaitResultInfo wait = new WaitResultInfo();
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W010_AgvStatus;
wait.AgvAction = arrive;
wait.AgvAction = arrive;
return wait;
}
public static WaitResultInfo WaitDoorClose()
{
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W011_DoorCloseEvent;
wait.WaitType = WaitEnum.W011_DoorCloseEvent;
return wait;
}
public string ToStr()
......@@ -320,19 +347,22 @@ namespace OnlineStore.DeviceLibrary
return "料盘高度【" + TargetPosition + "】 ";
}
else if (WaitType.Equals(WaitEnum.W008_Compress))
{
{
return "压紧轴压紧到位";
}else if (WaitType.Equals(WaitEnum.W009_ScanCode))
}
else if (WaitType.Equals(WaitEnum.W009_ScanCode))
{
return "扫码完成";
}else if (WaitType.Equals(WaitEnum.W010_AgvStatus))
}
else if (WaitType.Equals(WaitEnum.W010_AgvStatus))
{
return " Agv_" + (ClientAction)AgvAction+" ";
}else if (WaitType.Equals(WaitEnum.W011_DoorCloseEvent))
{
return "Agv_DoorClose事件" ;
return " Agv_" + (ClientAction)AgvAction + " ";
}
else
else if (WaitType.Equals(WaitEnum.W011_DoorCloseEvent))
{
return "Agv_DoorClose事件";
}
else
{
return "Wait位置类型:WaitType=【" + WaitType + "】";
}
......@@ -356,11 +386,11 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// IO类型
/// </summary>
public String IoType { get; set; }
public String IoType { get; set; }
/// <summary>
/// IO值
/// </summary>
public IO_VALUE IoValue { get; set; }
public IO_VALUE IoValue { get; set; }
/// <summary>
/// 等待的毫秒
/// </summary>
......@@ -381,11 +411,11 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 是否已经结束
/// </summary>
public bool IsEnd{ get; set; }
public bool IsEnd { get; set; }
public int AgvAction = 0;
}
internal class WaitEnum
{
......@@ -420,7 +450,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 压紧轴压紧到位
/// </summary>
internal static int W008_Compress= 8;
internal static int W008_Compress = 8;
/// <summary>
/// 扫码完成
/// </summary>
......
......@@ -556,6 +556,12 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
[ConfigProAttribute("CompAxis_Max_P3")]
public int CompAxis_Max_P3 { get; set; }
/// <summary>
/// PRO 所有料仓的CID(用#号分隔) All_CIDs packing-1#packing-2#packing-3#packing-4#packing-5#packing-6#packing-7#packing-8
/// </summary>
[ConfigProAttribute("All_CIDs")]
public string All_CIDs { get; set; }
private List< ComP2Info> ComP2List = null;
public ComP2Info GetComP2(int plateh)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!