Commit 150c5755 LN

出库逻辑修改

1 个父辈 b76e97b6
...@@ -200,5 +200,29 @@ namespace OnlineStore.Common ...@@ -200,5 +200,29 @@ 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,36 @@ namespace OnlineStore.Common ...@@ -91,5 +91,36 @@ namespace OnlineStore.Common
} }
return span.Hours.ToString().PadLeft(2, '0') + ":" + span.Minutes.ToString().PadLeft(2, '0') + ":" + seconds; 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;
}
} }
} }
...@@ -43,6 +43,7 @@ namespace OnlineStore.Common ...@@ -43,6 +43,7 @@ namespace OnlineStore.Common
{ {
if (sb.openPort()) if (sb.openPort())
{ {
serialBeanMap.Add(port, sb);
return true; return true;
} }
else else
......
...@@ -26,7 +26,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -26,7 +26,13 @@ namespace OnlineStore.DeviceLibrary
public string lastPosId = ""; public string lastPosId = "";
public StoreStatus lastPosIdStatus = StoreStatus.StoreOnline; public StoreStatus lastPosIdStatus = StoreStatus.StoreOnline;
public List<ConfigMoveAxis> moveAxisList = new List<ConfigMoveAxis>(); public List<ConfigMoveAxis> moveAxisList = new List<ConfigMoveAxis>();
/// <summary>
/// 所有料仓库位列表
/// </summary>
public List<string> PositionNumList = new List<string>(); public List<string> PositionNumList = new List<string>();
/// <summary>
/// 所有料架库位列表
/// </summary>
public List<string> ShelfPosList = new List<string>(); public List<string> ShelfPosList = new List<string>();
/// <summary> /// <summary>
/// 料架未放料盘的位置列表 /// 料架未放料盘的位置列表
...@@ -55,7 +61,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -55,7 +61,7 @@ namespace OnlineStore.DeviceLibrary
//添加调试 //添加调试
IsDebug = config.IsInDebug.Equals(1); IsDebug = config.IsInDebug.Equals(1);
Name = ("料仓BOX_" + config.DeviceID + " ").ToUpper(); Name = ("料仓BOX_" + config.DeviceID + " ").ToUpper();
this.DeviceID = config.DeviceID; this.DeviceID = config.DeviceID;;
this.Config = config; this.Config = config;
DoorBean = new EnteryDoorBean(DeviceID); DoorBean = new EnteryDoorBean(DeviceID);
//温湿度 //温湿度
...@@ -885,14 +891,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -885,14 +891,6 @@ namespace OnlineStore.DeviceLibrary
boxStatus.msg = CodeMsg; boxStatus.msg = CodeMsg;
lineOperation.msg = CodeMsg; lineOperation.msg = CodeMsg;
} }
//if (CodeMsg.Equals(""))
//{
// if (storeRunStatus.Equals(StoreRunStatus.Runing) && IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
// {
// boxStatus.msg = "叉子料盘检测有料,请检查";
// lineOperation.msg = "叉子料盘检测有料,请检查";
// }
//}
CodeMsg = ""; CodeMsg = "";
//WarnMsg = ""; //WarnMsg = "";
//状态 //状态
...@@ -976,6 +974,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -976,6 +974,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
private void ReviceOutStoreProcess(Operation resultOperation) private void ReviceOutStoreProcess(Operation resultOperation)
{ {
DateTime time = DateTime.Now; DateTime time = DateTime.Now;
...@@ -983,15 +982,26 @@ namespace OnlineStore.DeviceLibrary ...@@ -983,15 +982,26 @@ namespace OnlineStore.DeviceLibrary
if (data != null && data.ContainsKey(ParamDefine.posId) if (data != null && data.ContainsKey(ParamDefine.posId)
&& data.ContainsKey(ParamDefine.plateH) && data.ContainsKey(ParamDefine.plateW)) && 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("收到服务器出库消息:poaIs=" + posIdStr + ",platew=" + plateWStr + ",plateh=" + plateHStr);
char splitChar = '|'; char splitChar = '|';
string[] posIdArray = posIdStr.Split(splitChar); string[] posIdArray = data[ParamDefine.posId].Split(splitChar);
string[] plateWArray = plateWStr.Split(splitChar); string[] plateWArray = data[ParamDefine.plateW].Split(splitChar);
string[] plateHArray = plateHStr.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("收到服务器出库消息:【" + dataStr + "】");
int index = -1; int index = -1;
foreach (string posId in posIdArray) foreach (string posId in posIdArray)
{ {
...@@ -999,52 +1009,55 @@ namespace OnlineStore.DeviceLibrary ...@@ -999,52 +1009,55 @@ namespace OnlineStore.DeviceLibrary
string plateW = plateWArray[index]; string plateW = plateWArray[index];
string plateH = plateHArray[index]; string plateH = plateHArray[index];
string[] posArray = posId.Split('#'); string[] posArray = posId.Split('#');
if (posArray.Length != 2) //if (posArray.Length != 2)
{ //{
WarnMsg = Name + "出库格式错误:库位号【" + posId + "】"; // WarnMsg = Name + "出库格式错误:库位号【" + posId + "】";
LogUtil.error(Name + "收到服务器出库命令:库位号【" + posId + "】格式错误"); // LogUtil.error(Name + "收到服务器出库命令:库位号【" + posId + "】格式错误");
continue; // continue;
} //}
int storeId = int.Parse(posArray[0]); InOutParam inoutParam = new InOutParam(barcode, posId, "", plateW, plateH, urgentReel, cutReel, smallReel, rfid, rfidLoc);
//根据发送的posId获取位置列表 //根据发送的posId获取位置列表
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(posId); ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(posId);
if (position == null) if (position == null)
{ {
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因 //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = Name + "出库未找库位:【" + posId + "】"; WarnMsg = Name + "未找到库位:【" + inoutParam.ToStr() + "】";
LogUtil.error(Name + "收到服务器出库命令:未找到【" + posId + "】的库位信息"); LogUtil.error(WarnMsg);
continue; continue;
} }
else
{
InOutParam inoutParam = new InOutParam("", posId, plateW, plateH, "");
try try
{ {
//判断是否接收过此库位的出库信息 //判断是否接收过此库位的出库信息
if (MoveInfo.MoveType.Equals(StoreMoveType.OutStore) && MoveInfo.MoveParam.PosID.Equals(posId)) if (MoveInfo.MoveType.Equals(StoreMoveType.OutStore) && MoveInfo.MoveParam.PosID.Equals(posId))
{ {
LogInfo(" 收到出库【" + inoutParam.ToStr() + "】重复,当前已在【" + posId + "】出库中"); LogUtil.error(Name + " 出库命令【" + inoutParam.ToStr() + "】重复,正在【" + posId + "】出库中");
continue; continue;
} }
else
{
//判断排队列表中是否已存在 //判断排队列表中是否已存在
List<InOutParam> reviceList = new List<InOutParam>(waitOutStoreList); List<InOutParam> reviceList = new List<InOutParam>(waitOutStoreList);
reviceList = (from m in reviceList where m.PosID.Equals(posId) select m).ToList<InOutParam>(); reviceList = (from m in reviceList where m.PosID.Equals(posId) select m).ToList<InOutParam>();
if (reviceList.Count > 0) if (reviceList.Count > 0)
{ {
LogInfo(" 收到出库【" + inoutParam.ToStr() + "】重复,排队列表中已存在【" + reviceList[0].ToStr() + "】"); LogUtil.error(Name + " 出库命令【" + inoutParam.ToStr() + "】重复,排队列表中已存在【" + reviceList[0].ToStr() + "】");
continue; continue;
} }
}
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("验证出库【" + inoutParam.ToStr() + "】是否重复出错:" + ex.ToString()); LogUtil.error(Name + "验证出库【" + inoutParam.ToStr() + "】是否重复出错:" + ex.ToString());
} }
string shelfPosID = ""; string shelfPosID = "";
if (inoutParam.rfidLoc > 0 && ShelfPosList.Count >= inoutParam.rfidLoc)
{
shelfPosID = ShelfPosList[inoutParam.rfidLoc - 1];
inoutParam.NeedEnterShelf = false;
inoutParam.NeedOutShelf = false;
inoutParam.ShelfPosID = shelfPosID;
}
else
{
bool hasShelf = EmprtShelfList.TryDequeue(out shelfPosID); bool hasShelf = EmprtShelfList.TryDequeue(out shelfPosID);
if (hasShelf) if (hasShelf)
{ {
...@@ -1056,15 +1069,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -1056,15 +1069,16 @@ namespace OnlineStore.DeviceLibrary
{ {
inoutParam.NeedEnterShelf = true; inoutParam.NeedEnterShelf = true;
inoutParam.NeedOutShelf = false; inoutParam.NeedOutShelf = false;
LogUtil.error(Name + "执行出库【" + inoutParam.ToStr() + "】,么有空料架,需要使用新料架"); LogInfo(Name + "执行出库【" + inoutParam.ToStr() + "】,没有空料架,需要使用新料架");
} }
StartExecuctOut(inoutParam);
} }
StartExecuctOut(inoutParam);
} }
TimeSpan span = DateTime.Now - time; TimeSpan span = DateTime.Now - time;
if (span.TotalMilliseconds > 10) if (span.TotalMilliseconds > 10)
{ {
LogUtil.info(Name + "执行TimerProcess 共处理了【" + span.TotalMilliseconds + "】毫秒"); LogInfo(Name + "执行 ReviceOutStoreProcess 共处理了【" + span.TotalMilliseconds + "】毫秒");
} }
} }
} }
......
...@@ -21,28 +21,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -21,28 +21,19 @@ namespace OnlineStore.DeviceLibrary
this.WareCode = ""; this.WareCode = "";
MoveP = null; MoveP = null;
} }
/// <summary> public InOutParam(string wareNo, string posId, string ShelfPosID, string platew = "", string plateh = "", bool urgentReel = false, bool cutReel = false, bool smallReel = false, string rfid = "", int rfidLoc = 0)
/// 新建一个对象
/// </summary>
/// <param name="wareNo">物品二维码</param>
/// <param name="position">仓位号</param>
public InOutParam(string wareNo, string posId,string ShelfPosID)
{ {
this.ShelfPosID = ShelfPosID; this.ShelfPosID = ShelfPosID;
WareCode = wareNo; WareCode = wareNo;
PosID = posId; PosID = posId;
MoveP = null; MoveP = null;
IsSolderPaste = false; this.PlateW = platew;
} this.PlateH = plateh;
public InOutParam(string wareNo, string posId,string plateH,string plateW, string ShelfPosID ) this.urgentReel = urgentReel;
{ this.cutReel = cutReel;
this.ShelfPosID = ShelfPosID; this.smallReel = smallReel;
WareCode = wareNo; this.rfid = rfid;
PosID = posId; this.rfidLoc = rfidLoc;
MoveP = null;
this.PlateW = plateW;
this.PlateH = plateH;
IsSolderPaste = false;
} }
public InOutParam(string wareNo, string posId, string ShelfPosID,LineMoveP linePosition ) public InOutParam(string wareNo, string posId, string ShelfPosID,LineMoveP linePosition )
{ {
...@@ -50,9 +41,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -50,9 +41,13 @@ namespace OnlineStore.DeviceLibrary
this.ShelfPosID = ShelfPosID; this.ShelfPosID = ShelfPosID;
PosID = posId; PosID = posId;
MoveP = linePosition; MoveP = linePosition;
IsSolderPaste = false;
NeedEnterShelf = false; NeedEnterShelf = false;
NeedOutShelf = false; NeedOutShelf = false;
this.urgentReel = false ;
this.cutReel = false ;
this.smallReel = false ;
this.rfid = "";
this.rfidLoc = 0;
} }
/// <summary> /// <summary>
/// 物品二维码信息 /// 物品二维码信息
...@@ -75,10 +70,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -75,10 +70,7 @@ namespace OnlineStore.DeviceLibrary
/// 料盘宽度 /// 料盘宽度
/// </summary> /// </summary>
public string PlateW { get; set; } public string PlateW { get; set; }
/// <summary>
/// 是否是放入锡膏(在线料仓才需要此字段)
/// </summary>
public bool IsSolderPaste { get; set; }
/// <summary> /// <summary>
/// 出入库时需要进入新料架 /// 出入库时需要进入新料架
...@@ -88,6 +80,31 @@ namespace OnlineStore.DeviceLibrary ...@@ -88,6 +80,31 @@ namespace OnlineStore.DeviceLibrary
/// 出入库结束后需要将料架送出 /// 出入库结束后需要将料架送出
/// </summary> /// </summary>
public bool NeedOutShelf = true; public bool NeedOutShelf = true;
/// <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; }
/// <summary> /// <summary>
/// 根据PosId获取对应的料仓ID,若PosId=="",返回-1 /// 根据PosId获取对应的料仓ID,若PosId=="",返回-1
...@@ -114,7 +131,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -114,7 +131,9 @@ namespace OnlineStore.DeviceLibrary
} }
public string ToStr() public string ToStr()
{ {
return " ShelfPosID=["+ ShelfPosID + "],WareCode=【" + WareCode + "】,PosID=【" + PosID + "】,PlateW=【" + PlateW + "】,PlateH=【" + PlateH + "】"; return " ShelfPosID=[" + ShelfPosID + "],WareCode [" + WareCode + "],PosID [" + PosID + "],PlateW [" + PlateW + "],PlateH [" + PlateH + "]" +
"NeedEnterShelf【" + NeedEnterShelf + "】NeedOutShelf【" + NeedOutShelf + "】"+
"urgentReel [" + urgentReel + "],cutReel [" + cutReel + "],smallReel [" + smallReel + "],rfid [" + rfid + "],rfidLoc [" + rfidLoc + "]";
} }
internal void UpdateShelfPosId(string pId) internal void UpdateShelfPosId(string pId)
......
...@@ -170,29 +170,33 @@ namespace OnlineStore.DeviceLibrary ...@@ -170,29 +170,33 @@ namespace OnlineStore.DeviceLibrary
BI_02_DoorOpen = 1002, BI_02_DoorOpen = 1002,
/// <summary> /// <summary>
/// 料架入库:线体正转 /// 料架入库:线体正转,等待入料口检测到信号
/// </summary> /// </summary>
BI_03_LineRun = 1003, BI_03_LineRun = 1003,
/// <summary> /// <summary>
/// 等待取料位检测到信号
/// </summary>
BI_04_WaitTakeSingle=1004,
/// <summary>
/// 料架入库:取料位检测到信号,停止线体正转 /// 料架入库:取料位检测到信号,停止线体正转
/// </summary> /// </summary>
BI_04_LineStop = 1004, BI_05_LineStop = 1005,
/// <summary> /// <summary>
/// 料架入库:入料口移门关闭,等待1000 /// 料架入库:入料口移门关闭,等待1000
/// </summary> /// </summary>
BI_05_DoorClose = 1005, BI_06_DoorClose = 1006,
/// <summary> /// <summary>
/// 线体再正转1秒 /// 线体再正转1秒
/// </summary> /// </summary>
BI_06_LineRun=1006, BI_07_LineRun=1007,
/// <summary> /// <summary>
/// 料架入库:定位装置上升 /// 料架入库:定位装置上升
/// </summary> /// </summary>
BI_07_LocationUp = 1007, BI_08_LocationUp = 1008,
/// <summary> /// <summary>
/// 料架入库:顶升装置上升 /// 料架入库:顶升装置上升
/// </summary> /// </summary>
BI_08_TopCylinderUp = 1008, BI_09_TopCylinderUp = 1009,
#endregion #endregion
...@@ -273,7 +277,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -273,7 +277,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 料架入库:开始循环从第一个空位逐个取料盘,扫码入库 /// 料架入库:开始循环从第一个空位逐个取料盘,扫码入库
/// </summary> /// </summary>
BI_08_StartGetTray = 20008, BI_10_StartGetTray = 3010,
/// <summary> /// <summary>
/// 料架取料:叉子后退到待机点P1 /// 料架取料:叉子后退到待机点P1
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!