Commit 52e9a7f9 张东亮

两盘料库位调试

1 个父辈 fc6eba39
......@@ -164,6 +164,10 @@ namespace OnlineStore.ACPackingStore
{
lblMoveEquipInfo.Text = "出库:" + BoxBean.MoveInfo.MoveParam.ToShortStr();
}
else if (BoxBean.MoveInfo.MoveType.Equals(StoreMoveType.CheckPos))
{
lblMoveEquipInfo.Text = "库位调试:" + BoxBean.MoveInfo.MoveParam.ToShortStr();
}
else
{
lblMoveEquipInfo.Text = "";
......@@ -206,43 +210,50 @@ namespace OnlineStore.ACPackingStore
}
}
}
if (BoxBean.AutoInout.autoNext)
if (!BoxBean.PosDebugInfo.AutoInOutPosTest)
{
string msg = BoxBean.AutoInout.autoMsg;
lblMsg.Text = msg;
if (btnStartAuTo.Text.Equals("开始自动出入库"))
{
btnStartAuTo.Text = "停止自动出入库";
}
try
{
msg = msg.Replace("自动出库:", "");
msg = msg.Replace("自动入库:", "");
int index = BoxBean.PositionNumList.IndexOf(msg);
if (index >= 0 && (!msg.Equals("")))
{
cmbPosition.SelectedIndex = index;
}
}
catch (Exception ex) { }
btnStartAuTo.Text = "开始自动库位调试";
}
else
{
// lblMsg.Text = "没有开启自动出入库";
if (btnStartAuTo.Text.Equals("停止自动出入库"))
{
btnStartAuTo.Text = "开始自动出入库";
}
btnStartAuTo.Text = "停止自动库位调试";
}
//if (BoxBean.AutoInout.autoNext)
//{
// string msg = BoxBean.AutoInout.autoMsg;
// lblMsg.Text = msg;
// if (btnStartAuTo.Text.Equals("开始自动出入库"))
// {
// btnStartAuTo.Text = "停止自动出入库";
// }
// try
// {
// msg = msg.Replace("自动出库:", "");
// msg = msg.Replace("自动入库:", "");
// int index = BoxBean.PositionNumList.IndexOf(msg);
// if (index >= 0 && (!msg.Equals("")))
// {
// cmbPosition.SelectedIndex = index;
// }
// }
// catch (Exception ex) { }
//}
//else
//{
// // lblMsg.Text = "没有开启自动出入库";
// if (btnStartAuTo.Text.Equals("停止自动出入库"))
// {
// btnStartAuTo.Text = "开始自动出入库";
// }
//}
}
else
{
lblThisSta.Text = "等待启动";
// lblWarnMsg.Text = "";
btnStartAuTo.Text = "开始自动出入库";
//btnStartAuTo.Text = "开始自动出入库";
}
if(BoxBean.CompressSigTimeOut)
if (BoxBean.CompressSigTimeOut)
{
btnClearcurState.Visible = true;
}
......@@ -607,27 +618,24 @@ namespace OnlineStore.ACPackingStore
{
if (BoxBean.storeRunStatus >= StoreRunStatus.HomeMoving)
{
if (BoxBean.AutoInout.autoNext)
if (BoxBean.PosDebugInfo.AutoInOutPosTest)
{
BoxBean.AutoInout.StopAuto();
btnStartAuTo.Text = "开始自动出入库";
BoxBean.PosDebugInfo.StopAutoInOutTest();
btnStartAuTo.Text = "开始自动库位调试";
}
else
{
DialogResult res = MessageBox.Show("确定开始自动出入库?", "提示", MessageBoxButtons.YesNo);
DialogResult res = MessageBox.Show("确定开始自动库位调试?", "提示", MessageBoxButtons.YesNo);
if (res.Equals(DialogResult.Yes) && cmbPosition.SelectedIndex >= 0)
{
int jiange = FormUtil.GetIntValue(txtJiange);
int currIndex = cmbPosition.SelectedIndex;
BoxBean.AutoInout.StartAuto(jiange, currIndex, cmbShelfPosition.Text);
string poText = cmbPosition.Text;
BoxBean.AutoInout.autoMsg = "自动出库:" + poText;
LogUtil.info(BoxBean.Name + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
//BoxBean.StartOutStoreMove(new InOutStoreParam("", poText));
BoxBean.StartInStoreMove(new InOutParam("", poText, cmbShelfPosition.Text));
btnStartAuTo.Text = "停止自动出入库";
LogUtil.info(BoxBean.Name + "开启自动库位调试,开始位置【" + poText + "】");
if (BoxBean.PosDebugInfo.StartAutoInOutTest(poText, out string msg))
btnStartAuTo.Text = "停止自动库位调试";
else
{
MessageBox.Show("启动自动库位调试失败:" + msg, "提示");
}
}
}
}
......
......@@ -72,6 +72,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="PackingStore\AC_BOX_Bean_AutoInOutTest.cs" />
<Compile Include="PackingStore\AC_BOX_Bean_server_connect.cs" />
<Compile Include="PackingStore\AC_BOX_Bean.cs" />
<Compile Include="PackingStore\AC_BOX_Bean_OutStore.cs" />
......
......@@ -89,6 +89,7 @@ namespace OnlineStore.DeviceLibrary
}
List<ShelfPosition> sPlist = CSVPositionReader<ShelfPosition>.getPositionList();
ShelfPosList = new List<string>();
PosDebugInfo = new PosDebugInfo(this);
foreach (ShelfPosition p in sPlist)
{
if (p.StoreId.Equals(DeviceID))
......@@ -252,7 +253,6 @@ namespace OnlineStore.DeviceLibrary
return;
}
InoutStartReset();
isInPro = false;
}
private void InoutStartReset()
{
......@@ -852,7 +852,6 @@ namespace OnlineStore.DeviceLibrary
ACServerManager.SuddenStop(Config.Comp_Axis.DeviceName, Config.Comp_Axis.GetAxisValue());
CloseAllAxis();
LogInfo("StopMove");
isInPro = false;
}
private void MoveEndToRuningStatus()
......
......@@ -518,6 +518,11 @@ namespace OnlineStore.DeviceLibrary
}
}
protected override void InOuTestProcess()
{
throw new NotImplementedException();
}
#endregion
}
......
......@@ -246,6 +246,12 @@ namespace OnlineStore.DeviceLibrary
return true;
}
public static bool LoadSameSizePos(string posId, out List<ACBoxPosition> boxPositions)
{
boxPositions = CSVPositionReader<ACBoxPosition>.GetSameSizePositons(posId);
if (boxPositions == null || boxPositions.Count < 3) return false;
return true;
}
#endregion
......
......@@ -18,7 +18,7 @@ namespace OnlineStore.DeviceLibrary
//public static uint DefaultDICount = 16;
//public static uint DefaultDOCount = 16;
// public readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// public readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public Dictionary<string, AIOBOX> AIOMap = new Dictionary<string, AIOBOX>();
public Dictionary<string, List<Box_Sta>> DIValueMap = new Dictionary<string, List<Box_Sta>>();
......@@ -122,7 +122,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error("关闭Io模块【" + ioIp + "】出错:"+ ex.ToString());
LogUtil.error("关闭Io模块【" + ioIp + "】出错:" + ex.ToString());
}
AIOMap.Remove(ioIp);
}
......@@ -134,12 +134,12 @@ namespace OnlineStore.DeviceLibrary
{
DOValueMap.Remove(ioIp);
}
int DIMS = ConfigAppSettings.GetIntValue("DIMS",60);
int DIMS = ConfigAppSettings.GetIntValue("DIMS", 60);
if (DIMS < 20)
{
DIMS = 20;
}
int DOMS = ConfigAppSettings.GetIntValue("DOMS",300);
int DOMS = ConfigAppSettings.GetIntValue("DOMS", 300);
if (DOMS < 200)
{
DOMS = 200;
......@@ -201,7 +201,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception error)
{
LogUtil.error( "连接IO模块 " + logName + " 出错:" + error.ToString());
LogUtil.error("连接IO模块 " + logName + " 出错:" + error.ToString());
}
}
......@@ -390,7 +390,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error( "WriteSingleDO出错 没有连接IO模块:" + ioIp);
LogUtil.error("WriteSingleDO出错 没有连接IO模块:" + ioIp);
}
}
catch (Exception ex)
......@@ -415,11 +415,11 @@ namespace OnlineStore.DeviceLibrary
try
{
aioBox.WriteDO(StartAddress, aioBox.ReverseStatus(currBox_Sta));
LogUtil.debug( "**********定时回写入 IO [" + ioIp + "] [" + StartAddress + "]值" + aioBox.ReverseStatus(currBox_Sta) + "】:");
LogUtil.debug("**********定时回写入 IO [" + ioIp + "] [" + StartAddress + "]值" + aioBox.ReverseStatus(currBox_Sta) + "】:");
}
catch (Exception ex)
{
LogUtil.error( "**********定时回写入 出错:" + ex.StackTrace);
LogUtil.error("**********定时回写入 出错:" + ex.StackTrace);
}
};
mytimer.AutoReset = false;//设置是否自动重启,即自动执行多次;
......@@ -428,7 +428,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error( "AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错 没有连接IO模块:" + ioIp);
LogUtil.error("AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错 没有连接IO模块:" + ioIp);
}
}
catch (Exception ex)
......@@ -508,9 +508,16 @@ namespace OnlineStore.DeviceLibrary
Box_Sta sta = Box_Sta.Off;
// Box_Addr addr = GetAddr(StartAddress);
int index = StartAddress;
if (DIValueMap.ContainsKey(ioIP) && DIValueMap[ioIP].Count > index)
if (Monitor.IsEntered(DILock))
{
sta = DIValueMap[ioIP][index];
if (DIValueMap.ContainsKey(ioIP) && DIValueMap[ioIP].Count > index)
{
sta = DIValueMap[ioIP][index];
}
else
{
sta = aioBox.ReadDI(StartAddress);
}
}
else
{
......@@ -544,7 +551,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error( " GetIOValue [" + configIO.IO_IP + "] [" + configIO.GetIOAddr() + "] 获取数据出错:" + ex.ToString());
LogUtil.error(" GetIOValue [" + configIO.IO_IP + "] [" + configIO.GetIOAddr() + "] 获取数据出错:" + ex.ToString());
}
return value;
}
......
......@@ -167,7 +167,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error( "GetPositon[" + CurShelfPosID + "]=null,没有库位不能执行出入库");
}
if (MoveP == null) MoveP = new LineMoveP();
MoveP.InOut_P101 = sp.InoutAxis_P101;
MoveP.UpDown_LP101 = sp.UpDownAxis_LP101;
MoveP.UpDown_HP102 = sp.UpDownAxis_HP102;
......
......@@ -121,42 +121,45 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 运动处理
/// </summary>
protected bool isInPro = false;
protected object isInPro = new object();
protected virtual void BusyMoveProcess()
{
//if (isInPro)
//{
// return;
//}
isInPro = true;
try
if(Monitor.TryEnter(isInPro))
{
switch (MoveInfo.MoveType)
try
{
case StoreMoveType.InStore:
InStoreProcess();
isInPro = false;
break;
case StoreMoveType.OutStore:
OutStoreProcess();
isInPro = false;
break;
case StoreMoveType.ReturnHome:
ResetProcess();
isInPro = false;
break;
case StoreMoveType.StoreReset:
ResetProcess();
isInPro = false;
break;
default: break;
switch (MoveInfo.MoveType)
{
case StoreMoveType.InStore:
InStoreProcess();
break;
case StoreMoveType.OutStore:
OutStoreProcess();
break;
case StoreMoveType.ReturnHome:
ResetProcess();
break;
case StoreMoveType.StoreReset:
ResetProcess();
break;
case StoreMoveType.CheckPos:
InOuTestProcess();
break;
default: break;
}
}
catch (Exception ex)
{
LogUtil.error("BusyMoveProcess出错:" + ex.ToString());
}finally
{
Monitor.Exit(isInPro);
}
}
catch (Exception ex)
{
LogUtil.error("BusyMoveProcess出错:" + ex.ToString());
}
isInPro = false;
}
protected void SaveAlarmInfo(StoreAlarmType alarmType, string alarmDetial, string alarmMsg, StoreMoveType storeMoveType)
{
......@@ -227,7 +230,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
protected abstract void ResetProcess();
protected abstract void InOuTestProcess();
/// <summary>
/// 松下伺服轴原点返回运动,等待收到反馈后才会返回
/// </summary>
......
......@@ -590,6 +590,140 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
SO_21_UrgentLineRun,
#endregion
BT_01_StartGetTray,
BT_02_InOutToP1,
/// <summary>
/// 料架取料:升降轴移动到P101低点,旋转轴移动到P101点,压紧轴到压紧前点
/// </summary>
BT_03_MoveToShelf,
/// <summary>
/// 料架取料:叉子前进到P101点
/// </summary>
BT_04_InoutToP101,
/// <summary>
/// 料架取料:升降轴上升到P102点
/// </summary>
BT_05_UpdownToP102,
/// <summary>
/// 料架取料:压紧轴开始缓慢压紧
/// </summary>
BT_06_StartCompress,
/// <summary>
/// 料架取料:检测到料叉压紧确认信号,再次向下压紧指定的值
/// </summary>
BT_06_ComDownMove,
/// <summary>
/// 料架取料:记录压紧高度,叉子后退到P1
/// </summary>
BT_07_InoutBack,
/// <summary>
/// 料架取料: 获取库位号完成,设置位置参数, 准备入库
/// </summary>
//BT_08_SetInstoreParam,
/// <summary>
/// 入库。。移动到库位点,旋转轴至P2( 库位点)轴2(上下) 至P3(库位入库前点)
/// </summary>
BT_09_MoveToBag,
/// <summary>
/// 入库。。叉子进入库位中,进出轴到库位P3
/// </summary>
BT_10_DeviceToBag,
/// <summary>
/// 入库。。放下物品,升降轴到库位缓冲点P4,压紧轴到P3
/// </summary>
BT_11_PutWareToBag,
/// <summary>
/// 入库。。叉子从库位中返回,进出轴到P1
/// </summary>
BT_12_DeviceBackFromBag,
BT_14_StartInOutTest,
/// <summary>
/// 料仓出库,,所有轴运行到库位,压紧轴到压紧前点P3 ,旋转轴到库位点P2,轴2(上下) 至P5(库位出库前点)
/// </summary>
BT_15_ToPosition,
/// <summary>
/// 料仓出库,,叉子进入库位中, 进出轴到库位P3
/// </summary>
BT_16_ToPos,
/// <summary>
///料仓出库,, 库位的物品放入叉子上,轴2( 上下) 至P6( 库位出料缓冲点),轴4( 压紧) 至P2(压紧点)
/// </summary>
BT_17_GetReel,
/// <summary>
///料仓出库,,叉子从 库位返回,轴3( 叉子) 至P1( 待机点)
/// </summary>
BT_18_InoutBack,
/// <summary>
/// 料仓出库,等待压紧信号确认
/// </summary>
BT_19_CheckComSig,
/// <summary>
/// 料架取料: 获取库位号完成,设置位置参数, 准备入库
/// </summary>
BT_20_SetInstoreParam,
/// <summary>
/// 入库。。移动到库位点,旋转轴至P2( 库位点)轴2(上下) 至P3(库位入库前点)
/// </summary>
BT_21_MoveToBag,
/// <summary>
/// 入库。。叉子进入库位中,进出轴到库位P3
/// </summary>
BT_22_DeviceToBag,
/// <summary>
/// 入库。。放下物品,升降轴到库位缓冲点P4,压紧轴到P3
/// </summary>
BT_23_PutWareToBag,
/// <summary>
/// 入库。。叉子从库位中返回,进出轴到P1
/// </summary>
BT_24_DeviceBackFromBag,
BT_25_StartPutTray,
/// <summary>
/// 料仓出库,,所有轴运行到库位,压紧轴到压紧前点P3 ,旋转轴到库位点P2,轴2(上下) 至P5(库位出库前点)
/// </summary>
BT_26_ToPosition,
/// <summary>
/// 料仓出库,,叉子进入库位中, 进出轴到库位P3
/// </summary>
BT_27_ToPos,
/// <summary>
///料仓出库,, 库位的物品放入叉子上,轴2( 上下) 至P6( 库位出料缓冲点),轴4( 压紧) 至P2(压紧点)
/// </summary>
BT_28_GetReel,
/// <summary>
///料仓出库,,叉子从 库位返回,轴3( 叉子) 至P1( 待机点)
/// </summary>
BT_29_InoutBack,
/// <summary>
/// 料仓出库,走到料架位置,旋转轴至P20,升降轴至P102,
/// </summary>
BT_30_ToShelfPosition,
/// <summary>
/// 料仓出库,叉子到料架,进出轴至P20
/// /// </summary>
BT_31_ToShelf,
/// <summary>
/// 料仓出库,,把物品放下,压紧轴到P1,升降轴至P20
/// </summary>
BT_32_PutReel,
/// <summary>
/// 料仓出库,,叉子从出料口返回,,进出轴到P1
/// </summary>
BT_33_InoutBack,
/// <summary>
///返回待机点,轴2/轴1/轴4动作至P1( 待机点))开始
/// </summary>
BT_30_GoBack,
}
public enum StoreAlarmType
......
......@@ -493,9 +493,9 @@ namespace OnlineStore.DeviceLibrary
///// 移栽装置的停止,需要先远点返回,然后停止
///// </summary>
//StopMove=5,
///// <summary>
///// 移栽检测托盘
///// </summary>
//CheckFixture=6,
/// <summary>
/// 移栽检测托盘
/// </summary>
CheckPos = 6,
}
}
......@@ -8,17 +8,17 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace OnlineStore.LoadCSVLibrary
{
public class CSVPositionReader<T> : CSVReaderBase where T : PostionBase
public class CSVPositionReader<T> : CSVReaderBase where T : PostionBase
{
/// <summary>
/// 所有的位置集合,key=位置
/// </summary>
public static Dictionary<string, Dictionary<string, T>> AllPositionMap = new Dictionary<string, Dictionary<string, T>>();
private static List<string> hasReadFileList = new List<string>();
......@@ -33,7 +33,7 @@ namespace OnlineStore.LoadCSVLibrary
AllPositionMap = new Dictionary<string, Dictionary<string, T>>();
hasReadFileList = new List<string>();
return AddCSVFile(filePath);
return AddCSVFile(filePath);
}
private static string GetTName()
{
......@@ -41,7 +41,7 @@ namespace OnlineStore.LoadCSVLibrary
return type.Name;
}
public static List<T> getPositionList()
{
{
string name = GetTName();
if (AllPositionMap.ContainsKey(name))
{
......@@ -55,7 +55,7 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
/// <param name="filePath">cvs文件路径+文件名</param>
/// <returns></returns>
public static Dictionary<String, T> AddCSVFile(string filePath,int storeId=0)
public static Dictionary<String, T> AddCSVFile(string filePath, int storeId = 0)
{
if (hasReadFileList.Contains(filePath))
{
......@@ -74,7 +74,7 @@ namespace OnlineStore.LoadCSVLibrary
Dictionary<String, T> result = new Dictionary<String, T>();
string[] lines =ReadCSVFile(filePath);
string[] lines = ReadCSVFile(filePath);
int index = 0;
Dictionary<string, int> titleIndex = new Dictionary<string, int>();
foreach (var line in lines)
......@@ -82,7 +82,7 @@ namespace OnlineStore.LoadCSVLibrary
var array = line.Split(Spilt_Char);
if (index == 0)
{
titleIndex = GetTitleIndex(filePath, line, cvsTitleList);
titleIndex = GetTitleIndex(filePath, line, cvsTitleList);
}
else
{
......@@ -129,17 +129,17 @@ namespace OnlineStore.LoadCSVLibrary
{
throw new PositionAlreadyExistingExection("仓位:" + PositionNum + "已存在!");
}
AllPositionMap[tname].Add(PositionNum, (T)bllIns);
}
else
{
LogUtil.error("读取"+ filePath + ",index=" + index + ",数据格式不匹配!,line=" + line);
LogUtil.error("读取" + filePath + ",index=" + index + ",数据格式不匹配!,line=" + line);
}
}
catch (Exception ex)
{
LogUtil.debug ( "CSV 读取行【" + line + "】行转换失败");
LogUtil.debug("CSV 读取行【" + line + "】行转换失败");
}
}
index++;
......@@ -169,7 +169,31 @@ namespace OnlineStore.LoadCSVLibrary
return null;
}
/// <summary>
/// 获取同尺寸库位的所有位置信息
/// </summary>
/// <param name="positionNum"></param>
/// <returns></returns>
public static List<T> GetSameSizePositons(string positionNum)
{
if (positionNum == null)
{
return null;
}
string tname = GetTName();
if (AllPositionMap.ContainsKey(tname))
{
if (AllPositionMap[tname].ContainsKey(positionNum))
{
var result = AllPositionMap[tname][positionNum];
if (result == null) return null;
var allPos = AllPositionMap[tname].Values.ToList().FindAll(s => s.BagWidth == result.BagWidth && s.BagHigh == result.BagHigh);
return allPos;
}
}
return null;
}
public static bool SavePostion(string filePath, T position)
{
Type type = typeof(T);
......@@ -205,7 +229,7 @@ namespace OnlineStore.LoadCSVLibrary
string value = array[csvIndex];
if (value.Equals(position.PositionNum))
{
if (AllPositionMap.ContainsKey(tName))
{
//更新缓存
......@@ -221,7 +245,7 @@ namespace OnlineStore.LoadCSVLibrary
index++;
}
return true;
}
}
private static string PostionToString(PostionBase position, Dictionary<string, int> titleIndex, Dictionary<string, string> proTitleMap)
{
......@@ -243,14 +267,14 @@ namespace OnlineStore.LoadCSVLibrary
string newStr = "";
foreach (string str in array)
{
{
if (newStr.Equals(""))
{
newStr = str;
}
else
{
newStr = newStr+Spilt_Char + str;
newStr = newStr + Spilt_Char + str;
}
}
return newStr;
......@@ -321,7 +345,7 @@ namespace OnlineStore.LoadCSVLibrary
lie = Convert.ToInt32(hengStr[1]);
hang = Convert.ToInt32(hengStr[2]);
p = Convert.ToInt32(hengStr[3]);
}
}
string hangStr = "AA";
if (hang.Equals(1))
{
......@@ -353,9 +377,9 @@ namespace OnlineStore.LoadCSVLibrary
else
{
newPosId = louceng + storeId + oldPosId.Substring(4, oldPosId.Length - 4);
}
}
position.PositionNum = newPosId;
// position.StoreId = storeIndex;
// position.StoreId = storeIndex;
string newValue = PostionToString(position, titleIndex, proTitleMap);
lines[index] = newValue;
}
......@@ -363,7 +387,7 @@ namespace OnlineStore.LoadCSVLibrary
{
LogUtil.error("更新【" + filePath + "】位置出错【" + line + "】" + ex.ToString());
}
}
}
}
}
index++;
......@@ -373,5 +397,5 @@ namespace OnlineStore.LoadCSVLibrary
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!