Commit 89760d0b LN

出库接口修改,增加料架参数

1 个父辈 ffd71118
......@@ -31,7 +31,7 @@
<add key="HumitureControllerType" value="0" />
<add key="UseAIOBOX" value="1" />
<!--流水线地址和端口配置-->
<add key="LineServerIp" value="192.168.104.88" />
<add key="LineServerIp" value="192.168.8.108" />
<add key="LineServerPort" value="5246" />
<!--是否调试状态-->
<add key="IsInDebug" value="1" />
......
......@@ -372,7 +372,7 @@ namespace OnlineStore.ACSingleStore
{
string selectPositionNum = cmbPosition.Text;
LineMoveP ktk = LoadPostion();
store.StartOutStoreMove(new InOutStoreParam("", selectPositionNum, ktk));
store.StartOutStoreMove(new InOutParam(new InOutPosInfo( "", selectPositionNum), ktk));
}
else
{
......@@ -386,7 +386,7 @@ namespace OnlineStore.ACSingleStore
{
string selectPositionNum = cmbPosition.Text;
LineMoveP ktk = LoadPostion();
store.StartInStoreMove(new InOutStoreParam("", selectPositionNum, ktk));
store.StartInStoreMove(new InOutParam(new InOutPosInfo( "", selectPositionNum), ktk));
}
else
{
......@@ -904,7 +904,7 @@ namespace OnlineStore.ACSingleStore
store.autoMsg = "自动出库:" + poText;
LogUtil.info(LOGGER, store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
//store.StartOutStoreMove(new InOutStoreParam("", poText));
store.StartInStoreMove(new InOutStoreParam("", poText));
store.StartInStoreMove(new InOutParam(new InOutPosInfo("AUTOINOUT", poText)));
}
btnStartAuTo.Text = "停止自动出入库";
}
......@@ -1300,6 +1300,15 @@ namespace OnlineStore.ACSingleStore
ss = StoreStatus.Debugging;
}
StoreSendBean bean = new StoreSendBean(StoreManager.Config.Id, StoreManager.Config.CID, (int)ss, (int)StoreRunStatus.Runing, hasTray, (int)StoreAlarmType.None);
//bean.data.Add(ParamDefine.posId, cmbPosition.Text);
//bean.data.Add(ParamDefine.plateH, "8");
//bean.data.Add(ParamDefine.plateW, "7");
//bean.data.Add(ParamDefine.cutReel, false.ToString());
//bean.data.Add(ParamDefine.smallReel, true.ToString());
//bean.data.Add(ParamDefine.urgentReel, false.ToString());
//bean.data.Add(ParamDefine.rfid, "E99");
//bean.data.Add(ParamDefine.rfidLoc, 72.ToString());
//bean.data.Add(ParamDefine.barcode, "code");
LineConnect.SendHeart(bean);
}
}
......
......@@ -9,4 +9,11 @@
//机器设备故障(非温湿度)报警 亮 灭 闪
在RC1246-ACSingleStore 项目基础上,
新建分支RC1250-ACSingleStore,作为佳世达流水线单台料仓软件
\ No newline at end of file
新建分支RC1250-ACSingleStore,作为佳世达流水线单台料仓软件
5 出库时根据StatusBean返回data中的参数决定料盘流转到哪里

urgentReel: true 表示紧急料,需要出到料串上
cutReel: true 表示分盘料,需要出到料串上
smallReel: true 小料(7x8),放置到小料架上
rfid: 分配的料架RFID
rfidLoc: 料架的架位,值为-1时,可以自由分配皮带线, 小料时,架位为1-46优先走1/2号皮带线,47-92优先走3/4号皮带线, 70,71,72时只能分配到3/4号皮带线;大料时,架位1-6优先走1/2号皮带线, 7-12优先走3/4号皮带线
\ No newline at end of file
......@@ -199,6 +199,30 @@ namespace OnlineStore.Common
/// <summary>
/// 温度报警值
/// </summary>
public static string maxTemperature = "temp";
public static string maxTemperature = "temp";
/// <summary>
/// urgentReel: true 表示紧急料,需要出到料串上
/// </summary>
public static string urgentReel = "urgentReel";
/// <summary>
/// cutReel: true 表示分盘料,需要出到料串上
/// </summary>
public static string cutReel = "cutReel";
/// <summary>
/// smallReel: true 小料(7x8),放置到小料架上
/// </summary>
public static string smallReel = "smallReel";
/// <summary>
/// rfid: 分配的料架RFID
/// </summary>
public static string rfid = "rfid";
/// <summary>
/// rfidLoc: 料架的架位,值为 - 1时,可以自由分配皮带线, 小料时,架位为1 - 46优先走1 / 2号皮带线,47 - 92优先走3 / 4号皮带线,
/// 70,71,72时只能分配到3 / 4号皮带线; 大料时,架位1 - 6优先走1 / 2号皮带线, 7 - 12优先走3 / 4号皮带线
/// </summary>
public static string rfidLoc = "rfidLoc";
public static string barcode = "barcode";
}
}
......@@ -91,5 +91,35 @@ namespace OnlineStore.Common
}
return span.Hours.ToString().PadLeft(2, '0') + ":" + span.Minutes.ToString().PadLeft(2, '0') + ":" + seconds;
}
public static bool GetBoolData(Dictionary<string, string> data, string key, bool defaultValue=false)
{
if (data.ContainsKey(key))
{
try
{
return Convert.ToBoolean(data[key]);
}
catch (Exception ex)
{
}
}
return defaultValue;
}
public static int GetIntData(Dictionary<string, string> data, string key, int defaultValue = 0)
{
if (data.ContainsKey(key))
{
try
{
return Convert.ToInt32(data[key]);
}
catch (Exception ex)
{
}
}
return defaultValue;
}
}
}
......@@ -76,8 +76,7 @@
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="store\model\AxisAlarmInfo.cs" />
<Compile Include="store\model\FixtureCodeInfo.cs" />
<Compile Include="store\InOrOutStoreParam.cs">
<Compile Include="store\InOutParam.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="store\model\StoreMoveInfo.cs">
......
......@@ -1038,7 +1038,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (LineConnect.CanStartOut() || IsDebug)
{
FixtureCodeInfo currInOutFixture = null;
InOutPosInfo currInOutFixture = null;
lock (waitOutListLock)
{
if (waitOutStoreList.Count > 0 && CanStarInOut())
......@@ -1051,7 +1051,8 @@ namespace OnlineStore.DeviceLibrary
{ //出库
LogUtil.info(LOGGER, StoreName + "开始执行排队中的出库【" + currInOutFixture.ToStr() + "】");
bool result = StartOutStoreMove(new InOutStoreParam("", currInOutFixture.PosId, currInOutFixture.plateH, currInOutFixture.plateW));
bool result = StartOutStoreMove(new InOutParam(currInOutFixture));
//bool result = StartOutStoreMove(new InOutParam("", currInOutFixture.PosId, currInOutFixture.plateH, currInOutFixture.plateW));
if (!result)
{
LogUtil.info(LOGGER, StoreName + " 执行排队中的出库【" + currInOutFixture.ToStr() + "】失败,重新加入等待队列");
......@@ -1194,11 +1195,12 @@ namespace OnlineStore.DeviceLibrary
string plateW = data[ParamDefine.plateW];
string plateH = data[ParamDefine.plateH];
string[] posArray = posId.Split('#');
InOutPosInfo inoutInfo = new InOutPosInfo(message, posId, plateH, plateW);
if (!(posArray.Length == 2))
{
WarnMsg = StoreName + "入库库位格式错误:二维码【" + message + "】库位【" + posId + "】";
LogUtil.error(LOGGER, "服务器反馈 入库库位格式错误:二维码【" + message + "】库位【" + posId + "】");
LogUtil.info(LOGGER, "服务器反馈 入库库位格式错误:二维码【" + message + "】库位【" + posId + "】");
WarnMsg = StoreName + "入库库位格式错误: 【" + inoutInfo.ToStr() + "】";
LogUtil.error(LOGGER, "服务器反馈 入库库位格式错误:【" + inoutInfo.ToStr() + "】");
LogUtil.info(LOGGER, "服务器反馈 入库库位格式错误:【" + inoutInfo.ToStr() + "】");
return;
}
......@@ -1207,22 +1209,22 @@ namespace OnlineStore.DeviceLibrary
ACStorePosition position = CSVPositionReader<ACStorePosition>.GetPositon(posId);
if (position == null)
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 ";
LogUtil.error(LOGGER, "收到服务器入库命令:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
LogUtil.info(LOGGER, "收到服务器入库命令:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
WarnMsg = "入库未找到库位:【" + inoutInfo.ToStr() + "】 ";
LogUtil.error(LOGGER, "收到服务器入库命令:入库未找到库位:【" + inoutInfo.ToStr() + "】");
LogUtil.info(LOGGER, "收到服务器入库命令:入库未找到库位:【" + inoutInfo.ToStr() + "】");
return;
}
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
if (CanStarInOut())
{
InOutStoreParam param = new InOutStoreParam(message, posId, plateH, plateW);
InOutParam param = new InOutParam(inoutInfo);
StartInStoreMove(param);
//如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】 开始入库!");
LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:【" + inoutInfo.ToStr() + "】开始入库!");
}
else
{
LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】 正在忙碌中,无法入库!");
LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:【" + inoutInfo.ToStr() + "】 正在忙碌中,无法入库!");
}
}
......@@ -1301,7 +1303,7 @@ namespace OnlineStore.DeviceLibrary
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
if (CanStarInOut())
{
InOutStoreParam param = new InOutStoreParam(message, posId, plateH, plateW);
InOutParam param = new InOutParam(new InOutPosInfo( message, posId, plateH, plateW));
LogUtil.info(logName + " 开始入库!");
StartInStoreMove(param);
//如果当前正在出入库中,需要记录下来,等待空闲时执行
......@@ -1647,90 +1649,101 @@ namespace OnlineStore.DeviceLibrary
}
}
}
private void ReviceOutStoreProcess(Operation resultOperation) {
DateTime time = DateTime.Now;
Dictionary<string, string> data = resultOperation.data;
if (data != null && data.ContainsKey(ParamDefine.posId)
&& data.ContainsKey(ParamDefine.plateH) && data.ContainsKey(ParamDefine.plateW))
{
string posIdStr = data[ParamDefine.posId];
string plateWStr = data[ParamDefine.plateW];
string plateHStr = data[ParamDefine.plateH];
LogUtil.info(LOGGER, "收到服务器出库消息:poaIs=" + posIdStr + ",platew=" + plateWStr + ",plateh=" + plateHStr);
char splitChar = '|';
string[] posIdArray = posIdStr.Split(splitChar);
string[] plateWArray = plateWStr.Split(splitChar);
string[] plateHArray = plateHStr.Split(splitChar);
string[] posIdArray = data[ParamDefine.posId].Split(splitChar);
string[] plateWArray = data[ParamDefine.plateW].Split(splitChar);
string[] plateHArray = data[ParamDefine.plateH].Split(splitChar);
bool urgentReel =FormUtil. GetBoolData( data,ParamDefine.urgentReel);
bool cutReel= FormUtil.GetBoolData(data, ParamDefine.cutReel);
bool smallReel = FormUtil.GetBoolData(data, ParamDefine.smallReel);
string rfid = data.ContainsKey(ParamDefine.rfid) ? data[ParamDefine.rfid] : "";
int rfidLoc = FormUtil.GetIntData(data, ParamDefine.rfidLoc);
string barcode = data.ContainsKey(ParamDefine.barcode) ? data[ParamDefine.barcode] : "";
//urgentReel: true 表示紧急料,需要出到料串上
//cutReel: true 表示分盘料,需要出到料串上
//smallReel: true 小料(7x8),放置到小料架上
//rfid: 分配的料架RFID
//rfidLoc: 料架的架位,值为 - 1时,可以自由分配皮带线, 小料时,架位为1 - 46优先走1 / 2号皮带线,47 - 92优先走3 / 4号皮带线, 70,71,72时只能分配到3 / 4号皮带线; 大料时,架位1 - 6优先走1 / 2号皮带线, 7 - 12优先走3 / 4号皮带线
string dataStr = JsonHelper.SerializeObject(data);
LogUtil.info(LOGGER, "收到服务器出库消息:【" + dataStr+"】");
int index = -1;
foreach (string posId in posIdArray)
{
index++;
string plateW = plateWArray[index];
string plateH = plateHArray[index];
InOutPosInfo intouInfo = new InOutPosInfo(barcode, posId, plateW, plateH, urgentReel, cutReel, smallReel, rfid, rfidLoc);
string[] posArray = posId.Split('#');
if (posArray.Length != 2)
{
WarnMsg = StoreName + "出库格式错误:库位号【" + posId + "】";
LogUtil.error(LOGGER, "收到服务器出库命令:库位号【" + posId + "】格式错误");
WarnMsg = StoreName + "库位号格式错误: 【" + intouInfo.ToStr() + "】";
LogUtil.error(LOGGER, WarnMsg);
continue;
}
int storeId = int.Parse(posArray[0]);
// int storeId = int.Parse(posArray[0]);
//根据发送的posId获取位置列表
ACStorePosition position = CSVPositionReader<ACStorePosition>.GetPositon(posId);
if (position == null)
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = StoreName + "出库未找库位:【" + posId + "】";
LogUtil.error(LOGGER, "收到服务器出库命令:未找到【" + posId + "】的库位信息");
WarnMsg = StoreName + "未找到库位:【" + intouInfo.ToStr() + "】";
LogUtil.error(LOGGER, WarnMsg);
continue;
}
else
{
FixtureCodeInfo currInOutFixture = new FixtureCodeInfo(0, "", posId, plateW, plateH);
try
{
//判断是否接收过此库位的出库信息
if (StoreMove.MoveType.Equals(StoreMoveType.OutStore) && StoreMove.MoveParam.PositionNum.Equals(posId))
{
LogUtil.info(LOGGER, StoreName + " 收到出库【" + currInOutFixture.ToStr() + "】重复,当前已在【" + posId + "】出库中");
continue;
}
else
{
//判断排队列表中是否已存在
List<FixtureCodeInfo> reviceList = new List<FixtureCodeInfo>(waitOutStoreList);
reviceList = (from m in reviceList where m.PosId.Equals(posId) select m).ToList<FixtureCodeInfo>();
if (reviceList.Count > 0)
{
LogUtil.info(LOGGER, StoreName + " 收到出库【" + currInOutFixture.ToStr() + "】重复,排队列表中已存在【" + reviceList[0].ToStr() + "】");
continue;
}
}
}catch(Exception ex)
try
{
//判断是否接收过此库位的出库信息
if (StoreMove.MoveType.Equals(StoreMoveType.OutStore) && StoreMove.MoveParam.PosInfo.PosId.Equals(posId))
{
LogUtil.error("验证出库【" + currInOutFixture.ToStr() + "】是否重复出错:"+ex.ToString());
LogUtil.info(LOGGER, StoreName + " 出库命令【" + intouInfo.ToStr() + "】重复,正在【" + posId + "】出库中");
continue;
}
if (CanStarInOut() &&( LineConnect.CanStartOut()||IsDebug))
else
{
bool result = StartOutStoreMove(new InOutStoreParam("", posId, plateW,plateH));
if (!result)
//判断排队列表中是否已存在
List<InOutPosInfo> reviceList = new List<InOutPosInfo>(waitOutStoreList);
reviceList = (from m in reviceList where m.PosId.Equals(posId) select m).ToList<InOutPosInfo>();
if (reviceList.Count > 0)
{
LogUtil.info(LOGGER, StoreName + " 执行出库【" + currInOutFixture.ToStr() + "】失败,加入等待队列");
AddWaitOutInfo(currInOutFixture);
LogUtil.debug(LOGGER, StoreName + " 出库命令【" + intouInfo.ToStr() + "】重复,排队列表中已存在【" + reviceList[0].ToStr() + "】");
continue;
}
}
else
}
catch (Exception ex)
{
LogUtil.error("验证出库【" + intouInfo.ToStr() + "】是否重复出错:" + ex.ToString());
}
if (CanStarInOut() && (LineConnect.CanStartOut() || IsDebug))
{
bool result = StartOutStoreMove(new InOutParam(intouInfo));
if (!result)
{
LogUtil.error(LOGGER, "执行出库【" + currInOutFixture.ToStr() + "】失败,当前在忙碌中,加入等待队列");
AddWaitOutInfo(currInOutFixture);
LogUtil.info(LOGGER, StoreName + " 执行出库【" + intouInfo.ToStr() + "】失败,加入等待队列");
AddWaitOutInfo(intouInfo);
}
}
else
{
LogUtil.error(LOGGER, "执行出库【" + intouInfo.ToStr() + "】失败,当前在忙碌中,加入等待队列");
AddWaitOutInfo(intouInfo);
}
}
TimeSpan span = DateTime.Now - time;
if (span.TotalMilliseconds > 10)
......@@ -1741,7 +1754,7 @@ namespace OnlineStore.DeviceLibrary
}
#endregion
}
}
\ No newline at end of file
......@@ -36,7 +36,7 @@ namespace OnlineStore.DeviceLibrary
private int CurrInOutCount = 0;
private int CurrInOutACount = 0;
private bool LoadParamPosition(InOutStoreParam param)
private bool LoadParamPosition(InOutParam param)
{
if (param == null)
{
......@@ -57,7 +57,7 @@ namespace OnlineStore.DeviceLibrary
p.InOut_P1 = Config.InOutAxis_P1_Position;
p.Middle_P1 = Config.MiddleAxis_P1_Position;
p.InOut_P2 = position.InOutAxis_DoorPosition_P2;
p.InOut_P2 = position.InOutAxis_DoorPosition_P2;
p.UpDown_P1 = Config.UpDownAxis_DoorOPosition_P1;
p.UpDown_P8 = Config.UpDownAxis_DoorIBPosition_P8;
p.UpDown_P2 = Config.UpDownAxis_DoorIPosition_P2;
......@@ -73,13 +73,30 @@ namespace OnlineStore.DeviceLibrary
p.UpDown_P6 = position.UpDownAxis_OLPosition_P6;
param.MoveP = p;
if (String.IsNullOrEmpty(param.PlateH))
if (String.IsNullOrEmpty(param.PosInfo.PlateH))
{
param.PlateH = position.BagHigh.ToString();
param.PosInfo.PlateH = position.BagHigh.ToString();
}
if (string.IsNullOrEmpty(param.PlateW))
if (string.IsNullOrEmpty(param.PosInfo.PlateW))
{
param.PlateW = position.BagWidth.ToString();
param.PosInfo.PlateW = position.BagWidth.ToString();
}
return true;
} else if (String.IsNullOrEmpty(param.PosInfo.PlateH)|| string.IsNullOrEmpty(param.PosInfo.PlateW))
{
ACStorePosition position = param.GetACPosition();
if (position == null)
{
LogUtil.error(LOGGER, StoreName + "出入库时发现param中取到的Position=null,没有库位不能执行出入库");
return false;
}
if (String.IsNullOrEmpty(param.PosInfo.PlateH))
{
param.PosInfo.PlateH = position.BagHigh.ToString();
}
if (string.IsNullOrEmpty(param.PosInfo.PlateW))
{
param.PosInfo.PlateW = position.BagWidth.ToString();
}
return true;
}
......@@ -245,10 +262,10 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始入库移动移动
/// </summary>
public void StartInStoreMove(InOutStoreParam param, bool isNeedCheckIO)
public void StartInStoreMove(InOutParam param, bool isNeedCheckIO)
{
startInStoreTime = DateTime.Now;
string posId = param != null ? param.PositionNum : "";
string posId = param != null ? param.PosInfo.PosId : "";
if (storeRunStatus == StoreRunStatus.Runing)
{
if (!LoadParamPosition(param))
......@@ -295,7 +312,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始入库移动移动
/// </summary>
public override void StartInStoreMove(InOutStoreParam param)
public override void StartInStoreMove(InOutParam param)
{
StartInStoreMove(param, false);
}
......@@ -450,7 +467,7 @@ namespace OnlineStore.DeviceLibrary
{
InStoreLog("入库:SI_12 放下物品,升降轴至P4(库位入料缓冲点),压紧轴至P3(压紧前点) ");
// 5= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
lastPosId = posId;
lastPosIdStatus = StoreStatus.InStoreEnd;
storeStatus = StoreStatus.InStoreEnd;
......@@ -481,7 +498,7 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep == StoreMoveStep.SI_14_GoBack)
{
TimeSpan span = DateTime.Now - startInStoreTime;
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 整个入库流程结束,耗时【" + FormUtil.GetSpanStr(span) + "】!", storeMoveColor);
StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing;
......@@ -504,10 +521,10 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始出库运动
/// </summary>
public override bool StartOutStoreMove(InOutStoreParam param)
public override bool StartOutStoreMove(InOutParam param)
{
startOutStoreTime = DateTime.Now;
string posId = param != null ? param.PositionNum : "";
string posId = param != null ? param.PosInfo.PosId : "";
if (storeRunStatus == StoreRunStatus.Runing)
{
if (!LoadParamPosition(param))
......@@ -593,7 +610,7 @@ namespace OnlineStore.DeviceLibrary
//ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed);
InOutBackToP1(moveP.InOut_P1);
//把库位的物品放到取到叉子上之后是出仓完成
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
lastPosId = posId;
lastPosIdStatus = StoreStatus.OutStoreBoxEnd;
storeStatus = StoreStatus.OutStoreBoxEnd;
......@@ -603,7 +620,7 @@ namespace OnlineStore.DeviceLibrary
{
if (IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.LOW))
{
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
CodeMsg = "出库[" + posId + "]叉子从库位退出后,未检测到料盘有料";
LogUtil.error(CodeMsg);
}
......@@ -704,7 +721,7 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep == StoreMoveStep.SO_14_WaitTake)
{
TimeSpan span = DateTime.Now - startOutStoreTime;
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
storeStatus = StoreStatus.StoreOnline;
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 整个出库流程结束,耗时【" + FormUtil.GetSpanStr(span) + "】!", storeMoveColor);
......@@ -728,9 +745,22 @@ namespace OnlineStore.DeviceLibrary
ss = (int)StoreStatus.Debugging;
}
StoreSendBean store = new StoreSendBean(Config.Id, Config.CID, (int)storeStatus, (int)storeRunStatus, hasTray, (int)alarmType);
store.PosId = StoreMove.MoveParam.PositionNum;
store.PlateH = StoreMove.MoveParam.PlateH;
store.PlateW = StoreMove.MoveParam.PlateW;
store.data.Add(ParamDefine.posId,StoreMove.MoveParam.PosInfo.PosId);
store.data.Add(ParamDefine.plateH, StoreMove.MoveParam.PosInfo.PlateH);
store.data.Add(ParamDefine.plateW, StoreMove.MoveParam.PosInfo.PlateW);
store.data.Add(ParamDefine.cutReel, StoreMove.MoveParam.PosInfo.cutReel.ToString());
store.data.Add(ParamDefine.smallReel, StoreMove.MoveParam.PosInfo.smallReel.ToString());
store.data.Add(ParamDefine.urgentReel, StoreMove.MoveParam.PosInfo.urgentReel.ToString());
store.data.Add(ParamDefine.rfid, StoreMove.MoveParam.PosInfo.rfid);
store.data.Add(ParamDefine.rfidLoc, StoreMove.MoveParam.PosInfo.rfidLoc.ToString());
store.data.Add(ParamDefine.barcode, StoreMove.MoveParam.PosInfo.barcode);
//store.PlateH = StoreMove.MoveParam.PosInfo.PlateH;
//store.PlateW = StoreMove.MoveParam.PosInfo.PlateW;
//store.cutReel = storeMove.MoveParam.PosInfo.cutReel;
//store.smallReel = storeMove.MoveParam.PosInfo.smallReel;
//store.urgentReel = storeMove.MoveParam.PosInfo.urgentReel;
//store.rfid = storeMove.MoveParam.PosInfo.rfid;
//store.rfidLoc = storeMove.MoveParam.PosInfo.rfidLoc;
LineConnect.OutStoreEnd(store);
}
......@@ -794,17 +824,18 @@ namespace OnlineStore.DeviceLibrary
}
}
#endregion
public List<FixtureCodeInfo> waitOutStoreList = new List<FixtureCodeInfo>();
public List<InOutPosInfo> waitOutStoreList = new List<InOutPosInfo>();
public object waitOutListLock = "";
public void AddWaitOutInfo(FixtureCodeInfo code)
public void AddWaitOutInfo(InOutPosInfo code)
{
lock (waitOutListLock)
{
waitOutStoreList.Add(code);
}
}
private string autoInoutCode = "AUTOINOUT";
private void InOutEndProcess(StoreMoveType storeMoveType)
{
try
......@@ -837,27 +868,27 @@ namespace OnlineStore.DeviceLibrary
{
autoPositionIndex = newIndex;
string posid = PositionNumList[autoPositionIndex];
InOutPosInfo inoutinfo = new InOutPosInfo(autoInoutCode, posid);
//判断是否需要重置
if (CurrInOutACount >= Config.Box_ResetACount)
{
LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把出库信息存入排队列表中");
Reset(false);
autoMsg = "自动出库:" + posid;
AddWaitOutInfo(new FixtureCodeInfo(0, "", posid));
AddWaitOutInfo(inoutinfo);
}
else if (CurrInOutCount >= Config.Box_ResetMCount)
{
LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中");
//ResetMiddleAxis(false);
autoMsg = "自动出库:" + posid;
AddWaitOutInfo(new FixtureCodeInfo(0, "", posid));
AddWaitOutInfo(inoutinfo);
}
else
{
LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid);
autoMsg = "自动出库:" + posid;
StartOutStoreMove(new InOutStoreParam("", posid));
StartOutStoreMove(new InOutParam(inoutinfo));
}
}
}
......@@ -881,26 +912,27 @@ namespace OnlineStore.DeviceLibrary
else
{
string posid = PositionNumList[newIndex];
InOutPosInfo inoutinfo = new InOutPosInfo(autoInoutCode, posid);
//判断是否需要重置
if (CurrInOutACount >= Config.Box_ResetACount)
{
LogUtil.info(LOGGER, StoreName + "自动进入下一个入库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把入库信息存入排队列表中");
Reset(false);
autoMsg = "自动入库:" + posid;
AddWaitOutInfo(new FixtureCodeInfo(0, "AAAA", posid));
AddWaitOutInfo(inoutinfo);
}
else if (CurrInOutCount >= Config.Box_ResetMCount)
{
LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中");
//ResetMiddleAxis(false);
autoMsg = "自动入库:" + posid;
AddWaitOutInfo(new FixtureCodeInfo(0, "AAAA", posid));
AddWaitOutInfo(inoutinfo);
}
else
{
LogUtil.info(LOGGER, StoreName + "自动进入下一个入库:posid=" + posid);
autoMsg = "自动入库:" + posid;
StartInStoreMove(new InOutStoreParam("AAAA", posid));
StartInStoreMove(new InOutParam(inoutinfo));
}
}
}
......@@ -913,12 +945,12 @@ namespace OnlineStore.DeviceLibrary
private void InStoreLog(string msg)
{
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
LogUtil.info(LOGGER, "【" + posId + "】" + msg, storeMoveColor);
}
private void OutStoreLog(string msg)
{
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
LogUtil.info(LOGGER, "【" + posId + "】" + msg, storeMoveColor);
}
}
......
......@@ -91,16 +91,7 @@ namespace OnlineStore.DeviceLibrary
{
return JsonHelper.SerializeObject(store)+"\r";
}
//private static string ToParamStr(List<object> paramList)
//{
// string result = "";
// foreach (object str in paramList)
// {
// result += str + cmd_spilt.ToString();
// }
// return result + "\r";
//}
private static void HandlerMsg(string message)
{
try
......@@ -153,7 +144,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error("处理流水线消息【"+ message +"】出错:" +ex.ToString() );
}
}
}
public static char cmd_spilt = ';';
public static string cmd_heart = "heart";
private static string cmd_outend = "outend";
......@@ -220,6 +211,7 @@ namespace OnlineStore.DeviceLibrary
this.AlarmType = alarmType;
this.Seq = LineConnect.nextSeq();
this.WaitInStoreList = new List<string>(LineConnect.WaitInStoreList);
this.data = new Dictionary<string, string>();
// WaitInStoreList.Add("1#AC1_1_1");
}
......@@ -231,10 +223,37 @@ namespace OnlineStore.DeviceLibrary
public int SRunStatus = 0;
public int DoorHasTray = 0;
public int AlarmType = 0;
public string PosId = "";
public string PlateH = "0";
public string PlateW = "0";
public List<string> WaitInStoreList = new List<string>();
public Dictionary<string, string> data = new Dictionary<string, string>();
//public string PosId = "";
//public string PlateH = "0";
//public string PlateW = "0";
///// <summary>
///// urgentReel: true 表示紧急料,需要出到料串上
///// </summary>
//public bool urgentReel = false;
///// <summary>
///// cutReel: true 表示分盘料,需要出到料串上
///// </summary>
//public bool cutReel = false;
///// <summary>
///// smallReel: true 小料(7x8),放置到小料架上
///// </summary>
//public bool smallReel = false;
///// <summary>
///// rfid: 分配的料架RFID
///// </summary>
//public string rfid = "";
///// <summary>
///// rfidLoc: 料架的架位,值为 - 1时,可以自由分配皮带线,
///// 小料时,架位为1 - 46优先走1 / 2号皮带线,47 - 92优先走3 / 4号皮带线,
///// 70,71,72时只能分配到3 / 4号皮带线;
///// 大料时,架位1 - 6优先走1 / 2号皮带线, 7 - 12优先走3/ 4号皮带线
///// </summary>
//public int rfidLoc = 0;
}
}
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 出入仓参数(出入库操作时传入的参数类)
/// </summary>
public class InOutStoreParam
{
public static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public InOutStoreParam()
{
ACStoreP = null;
this.WareNumber = "";
MoveP = null;
}
/// <summary>
/// 新建一个对象
/// </summary>
/// <param name="wareNo">物品二维码</param>
/// <param name="position">仓位号</param>
public InOutStoreParam(string wareNo, string posId)
{
ACStoreP = null;
WareNumber = wareNo;
PositionNum = posId;
MoveP = null;
IsSolderPaste = false;
}
public InOutStoreParam(string wareNo, string posId,string plateH,string plateW)
{
ACStoreP = null;
WareNumber = wareNo;
PositionNum = posId;
MoveP = null;
this.PlateW = plateW;
this.PlateH = plateH;
IsSolderPaste = false;
}
public InOutStoreParam(string wareNo, string posId, LineMoveP linePosition)
{
ACStoreP = null;
WareNumber = wareNo;
PositionNum = posId;
MoveP = linePosition;
IsSolderPaste = false;
ACStorePosition p = GetACPosition();
if (p != null)
{
PlateH = p.BagHigh.ToString();
PlateW = p.BagWidth.ToString();
}
}
//public InOutStoreParam(string wareNo, string posId, ACStorePosition movep)
//{
// ACStoreP = movep;
// WareNumber = wareNo;
// PositionNum = posId;
// MoveP = null;
// IsSolderPaste = false;
//}
private ACStorePosition ACStoreP = null;
public ACStorePosition GetACPosition()
{
try
{
if (ACStoreP == null)
{
ACStoreP = CSVPositionReader<ACStorePosition>.GetPositon(PositionNum);
}
}
catch (Exception ex)
{
LogUtil.error(log, "出入库获取库位信息GetKTKPosition出错:" + ex.ToString());
}
return ACStoreP;
}
/// <summary>
/// 物品二维码信息
/// </summary>
public string WareNumber { get; set; }
/// <summary>
/// 位置坐标名(对应配置表的位置)
/// </summary>
public string PositionNum { get; set; }
public LineMoveP MoveP { get; set; }
/// <summary>
/// 料盘高度
/// </summary>
public string PlateH { get; set; }
/// <summary>
/// 料盘宽度
/// </summary>
public string PlateW { get; set; }
/// <summary>
/// 是否是放入锡膏(在线料仓才需要此字段)
/// </summary>
public bool IsSolderPaste { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
}
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 出入仓参数(出入库操作时传入的参数类)
/// </summary>
public class InOutParam
{
public static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public InOutParam()
{
ACStoreP = null;
this.PosInfo = new InOutPosInfo("", "");
MoveP = null;
}
public InOutParam(InOutPosInfo inoutInfo, LineMoveP linePosition = null)
{
ACStoreP = null; ;
MoveP = linePosition;
//WareNumber = wareNo;
//PositionNum = posId;
//this.PlateW = plateW;
//this.PlateH = plateH
this.PosInfo = inoutInfo;
}
//public InOutParam(inoup, LineMoveP linePosition=null)
//{
// ACStoreP = null;
// WareNumber = wareNo;
// PositionNum = posId;
// MoveP = linePosition;
// ACStorePosition p = GetACPosition();
// if (p != null)
// {
// PlateH = p.BagHigh.ToString();
// PlateW = p.BagWidth.ToString();
// }
//}
//public InOutStoreParam(string wareNo, string posId, ACStorePosition movep)
//{
// ACStoreP = movep;
// WareNumber = wareNo;
// PositionNum = posId;
// MoveP = null;
// IsSolderPaste = false;
//}
private ACStorePosition ACStoreP = null;
public ACStorePosition GetACPosition()
{
try
{
if (ACStoreP == null)
{
string posId = PosInfo != null ? PosInfo.PosId : "";
ACStoreP = CSVPositionReader<ACStorePosition>.GetPositon(posId);
}
}
catch (Exception ex)
{
LogUtil.error(log, "出入库获取库位信息GetKTKPosition出错:" + ex.ToString());
}
return ACStoreP;
}
///// <summary>
///// 物品二维码信息
///// </summary>
//public string WareNumber { get; set; }
///// <summary>
///// 位置坐标名(对应配置表的位置)
///// </summary>
//public string PositionNum { get; set; }
public InOutPosInfo PosInfo { get; set; }
public LineMoveP MoveP { get; set; }
///// <summary>
///// 料盘高度
///// </summary>
//public string PlateH { get; set; }
///// <summary>
///// 料盘宽度
///// </summary>
//public string PlateW { get; set; }
} /// <summary>
/// 夹具编码信息(保存夹具检测到的IO数值,和对应的料仓位置)
/// </summary>
public class InOutPosInfo
{
public InOutPosInfo(string barcode, string posId, string platew = "", string plateh = "", bool urgentReel = false , bool cutReel = false, bool smallReel = false, string rfid = "", int rfidLoc = 0)
{
this.barcode = barcode;
this.PosId = posId;
this.PlateW = platew;
this.PlateH = plateh;
this.urgentReel = urgentReel;
this.cutReel = cutReel;
this.smallReel = smallReel;
this.rfid = rfid;
this.rfidLoc = rfidLoc;
}
/// <summary>
/// 物品二维码
/// </summary>
public string barcode { get; set; }
/// <summary>
/// 库位号编码
/// </summary>
public string PosId { get; set; }
/// <summary>
/// 料盘宽
/// </summary>
public string PlateW { get; set; }
/// <summary>
/// 料盘高
/// </summary>
public string PlateH { get; set; }
/// <summary>
/// urgentReel: true 表示紧急料,需要出到料串上
/// </summary>
public bool urgentReel { get; set; }
/// <summary>
/// cutReel: true 表示分盘料,需要出到料串上
/// </summary>
public bool cutReel { get; set; }
/// <summary>
/// smallReel: true 小料(7x8),放置到小料架上
/// </summary>
public bool smallReel { get; set; }
/// <summary>
/// rfid: 分配的料架RFID
/// </summary>
public string rfid { get; set; }
/// <summary>
/// rfidLoc: 料架的架位,值为 - 1时,可以自由分配皮带线,
/// 小料时,架位为1 - 46优先走1 / 2号皮带线,47 - 92优先走3 / 4号皮带线,
/// 70,71,72时只能分配到3 / 4号皮带线;
/// 大料时,架位1 - 6优先走1 / 2号皮带线, 7 - 12优先走3/ 4号皮带线
/// </summary>
public int rfidLoc { get; set; }
public string ToStr()
{
return " barcode[" + barcode + "],PosId [" + PosId + "],plateW [" + PlateW + "],plateH [" + PlateH + "],urgentReel [" + urgentReel
+ "],cutReel [" + cutReel + "],smallReel [" + smallReel + "],rfid [" + rfid + "],rfidLoc [" + rfidLoc + "]";
}
}
}
......@@ -388,7 +388,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始出库运动
/// </summary>
public abstract bool StartOutStoreMove(InOutStoreParam param);
public abstract bool StartOutStoreMove(InOutParam param);
protected abstract void OutStoreProcess();
#endregion
......@@ -396,7 +396,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始入库移动移动
/// </summary>
public abstract void StartInStoreMove(InOutStoreParam param);
public abstract void StartInStoreMove(InOutParam param);
protected abstract void InStoreProcess();
#endregion
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 夹具编码信息(保存夹具检测到的IO数值,和对应的料仓位置)
/// </summary>
public class FixtureCodeInfo
{
public FixtureCodeInfo(int trayCode, string wareNum, string posId)
{
this.TrayCode = trayCode;
this.WareNum = wareNum;
this.PosId = posId;
this.plateH = "";
this.plateW = "";
}
public FixtureCodeInfo(int trayCode, string wareNum, string posId,string platew,string plateh)
{
this.TrayCode = trayCode;
this.WareNum = wareNum;
this.PosId = posId;
this.plateW = platew;
this.plateH = plateh;
}
/// <summary>
/// 夹具编码值(1-6)
/// </summary>
public int TrayCode { get; set; }
/// <summary>
/// 物品二维码
/// </summary>
public string WareNum { get; set; }
/// <summary>
/// 库位号编码
/// </summary>
public string PosId { get; set; }
/// <summary>
/// 料盘宽
/// </summary>
public string plateW { get; set; }
/// <summary>
/// 料盘高
/// </summary>
public string plateH { get; set; }
public string ToStr()
{
return "TrayCode【" + TrayCode + "】,WareNum=【" + WareNum + "】,PosId=【" + PosId + "】,plateW=【" + plateW + "】,plateH=【" + plateH + "】";
}
/// <summary>
/// 根据PosId获取对应的料仓ID,若PosId=="",返回-1
/// </summary>
/// <returns></returns>
public int GetStoreId()
{
if (!PosId.Equals(""))
{
string[] arr = PosId.Split('#');
if (arr.Length >= 2)
{
try
{
return int.Parse(arr[0]);
}
catch (Exception ex)
{
}
}
}
return -1;
}
}
}
......@@ -22,7 +22,7 @@ namespace OnlineStore.DeviceLibrary
{
moveType = StoreMoveType.None;
MoveParam = new InOutStoreParam();
MoveParam = new InOutParam();
this.storeId = storeId;
this.moveStep = StoreMoveStep.Wait;
IsInWait = false;
......@@ -50,7 +50,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
///出入库参数
/// </summary>
public InOutStoreParam MoveParam { get; set; }
public InOutParam MoveParam { get; set; }
/// <summary>
/// 当前运动是哪个料仓
/// </summary>
......@@ -107,7 +107,7 @@ namespace OnlineStore.DeviceLibrary
WaitList = new List<WaitResultInfo>();
MoveNum++;
}
public void NewMove(StoreMoveType type, InOutStoreParam param)
public void NewMove(StoreMoveType type, InOutParam param)
{
moveStep = StoreMoveStep.Wait;
this.moveType = type;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!