Commit 67ccc046 LN

1

1 个父辈 0bcf605c
......@@ -94,6 +94,7 @@
this.chbMoveStop = new System.Windows.Forms.CheckBox();
this.lblName = new System.Windows.Forms.Label();
this.btnScan = new System.Windows.Forms.Button();
this.lblwidth = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
......@@ -581,7 +582,7 @@
this.lblThisSta.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblThisSta.ForeColor = System.Drawing.Color.Red;
this.lblThisSta.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblThisSta.Location = new System.Drawing.Point(406, 65);
this.lblThisSta.Location = new System.Drawing.Point(406, 110);
this.lblThisSta.Name = "lblThisSta";
this.lblThisSta.Size = new System.Drawing.Size(720, 109);
this.lblThisSta.TabIndex = 246;
......@@ -696,6 +697,7 @@
this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6.Controls.Add(this.lblwidth);
this.groupBox6.Controls.Add(this.lblMoveInfo);
this.groupBox6.Controls.Add(this.lblAgvInfo);
this.groupBox6.Controls.Add(this.lblInstoreList);
......@@ -736,7 +738,7 @@
this.lblInstoreList.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblInstoreList.ForeColor = System.Drawing.Color.Green;
this.lblInstoreList.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblInstoreList.Location = new System.Drawing.Point(406, 175);
this.lblInstoreList.Location = new System.Drawing.Point(406, 220);
this.lblInstoreList.Name = "lblInstoreList";
this.lblInstoreList.Size = new System.Drawing.Size(720, 109);
this.lblInstoreList.TabIndex = 277;
......@@ -1150,6 +1152,17 @@
this.btnScan.UseVisualStyleBackColor = false;
this.btnScan.Click += new System.EventHandler(this.btnScan_Click);
//
// lblwidth
//
this.lblwidth.AutoSize = true;
this.lblwidth.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblwidth.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblwidth.Location = new System.Drawing.Point(248, 78);
this.lblwidth.Name = "lblwidth";
this.lblwidth.Size = new System.Drawing.Size(92, 17);
this.lblwidth.TabIndex = 279;
this.lblwidth.Text = "当前料盘宽度:";
//
// FrmFeedingEquip
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
......@@ -1267,6 +1280,7 @@
private System.Windows.Forms.CheckBox chbMoveStop;
private System.Windows.Forms.Button btnOLine;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.Label lblwidth;
}
}
......@@ -133,6 +133,7 @@ namespace OnlineStore.AssemblyLine
lblInstoreList.Text = text;
}
lblMoveInfo.Text = equipBean.GetMoveStr();
lblwidth.Text = " ";
}
catch (Exception ex)
{
......
......@@ -718,5 +718,16 @@ namespace OnlineStore.AssemblyLine
FrmIOMsg frm = new FrmIOMsg();
frm.ShowDialog();
}
private void btnTrayInfo_Click(object sender, EventArgs e)
{
List<TrayInfo> tray = TrayManager.getTrayList();
LogUtil.info("-------------------开始打印托盘信息:");
foreach(TrayInfo t in tray)
{
LogUtil.info(t.ToStr());
}
LogUtil.info("-------------------结束打印托盘信息");
}
}
}
......@@ -17,8 +17,10 @@ namespace OnlineStore.Common
public string cids = "";
public string code = "";
}
public class LineOperation
{
// //{"result":"0","msg":"","pos":"11#AC1_18_4_28","barcode":"R506072019102200414","cid":"line-ac-11"}
/// <summary>
/// 0=成功
/// </summary>
......
......@@ -482,7 +482,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.debug(Name + msg);
}
protected void InStoreLog(string msg)
protected void InLog(string msg)
{
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : "";
if (String.IsNullOrEmpty( posId))
......@@ -494,7 +494,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(Name + " " + "[" + posId + "]" + msg);
}
}
protected void OutStoreLog(string msg)
protected void OutLog(string msg)
{
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : "";
if (String.IsNullOrEmpty(posId))
......@@ -506,7 +506,30 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(Name + " " + "[" + posId + "] " + msg);
}
}
protected void SInLog(string msg)
{
string posId = SecondMoveInfo.MoveParam != null ? SecondMoveInfo.MoveParam.PosId : "";
if (String.IsNullOrEmpty(posId))
{
LogUtil.info(Name + " " + msg);
}
else
{
LogUtil.info(Name + " " + "[" + posId + "]" + msg);
}
}
protected void SOutLog(string msg)
{
string posId = SecondMoveInfo.MoveParam != null ? SecondMoveInfo.MoveParam.PosId : "";
if (String.IsNullOrEmpty(posId))
{
LogUtil.info(Name + " " + msg);
}
else
{
LogUtil.info(Name + " " + "[" + posId + "] " + msg);
}
}
public string GetMoveStr()
{
string msg = "";
......
......@@ -410,6 +410,7 @@ namespace OnlineStore.DeviceLibrary
private IO_VALUE TargetIoValue = IO_VALUE.HIGH;
private bool BatchAxisStartCheck(string targetIo = "", IO_VALUE value = IO_VALUE.HIGH)
{
isOk = false;
if (String.IsNullOrEmpty(targetIo))
{
targetIo = IO_Type.SL_AxisLocationCheck;
......@@ -430,6 +431,7 @@ namespace OnlineStore.DeviceLibrary
private bool BatchAxisStopCheck()
{
isOk = false;
if (!(axisCheckTimer == null))
{
axisCheckTimer.Stop();
......@@ -437,15 +439,34 @@ namespace OnlineStore.DeviceLibrary
return true;
}
private bool IsInProcess = false;
private bool isOk = false;
private DateTime lastOkTime = DateTime.Now;
private void CheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (IsInProcess) { return; }
IsInProcess = true;
if (IOValue(TargetIoType).Equals(TargetIoValue))
{
LogUtil.info(Name + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",可以停止运动");
BatchAxis.SuddenStop();
BatchAxisStopCheck();
if (!isOk)
{
isOk = true;
lastOkTime = DateTime.Now;
}
else
{
TimeSpan span = DateTime.Now - lastOkTime;
if (span.TotalMilliseconds > 200)
{
LogUtil.info(Name + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",可以停止运动");
BatchAxis.SuddenStop();
BatchAxisStopCheck();
}
}
}
else
{
isOk = false;
}
IsInProcess = false;
}
......
......@@ -74,16 +74,9 @@ namespace OnlineStore.DeviceLibrary
ProvidingEquipMap = new Dictionary<int, ProvidingEquip>();
DisLineMap = new Dictionary<int, DischargeLine>();
List<string> ioList = new List<string>();
ioList = new List<string>(DeviceConfig.ProIOIpMap.Values);
AddDeviceName(ioList, Config.IOIPList);
foreach (MoveEquip_Config config in configList.Values)
{
MoveEquip equip = new MoveEquip(lineConfig.CID, config);
AddDeviceName(ioList, config.IOIPList);
MoveEquipMap.Add(config.Id, equip);
AllEquipMap.Add(config.Id, equip);
}
foreach (FeedingEquip_Config config in feedMap.Values)
{
FeedingEquip equip = new FeedingEquip(lineConfig.CID, config);
......@@ -95,6 +88,14 @@ namespace OnlineStore.DeviceLibrary
FeedingEquipMap.Add(config.Id, equip);
AllEquipMap.Add(config.Id, equip);
}
foreach (MoveEquip_Config config in configList.Values)
{
MoveEquip equip = new MoveEquip(lineConfig.CID, config);
AddDeviceName(ioList, config.IOIPList);
MoveEquipMap.Add(config.Id, equip);
AllEquipMap.Add(config.Id, equip);
}
foreach (ProvidingEquip_Config config in providMap.Values)
{
ProvidingEquip equip = new ProvidingEquip(lineConfig.CID, config);
......@@ -127,7 +128,7 @@ namespace OnlineStore.DeviceLibrary
string[] testDeviceIdList = ids.Split(',');
foreach (string str in testDeviceIdList)
{
{
int id = Convert.ToInt32(str);
if (FeedingEquipMap.ContainsKey(id))
{
......@@ -922,7 +923,7 @@ namespace OnlineStore.DeviceLibrary
public string GetMoveStr()
{
string msg = "";
int tLength = 20;
// int tLength = 20;
//msg += "preTrayNum:".PadRight(tLength, ' ') + preTrayNum + "\n";
//msg += "currTrayNum:".PadRight(tLength, ' ') + currTrayNum + "\n";
......
......@@ -62,7 +62,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.EndMove();
SecondMoveInfo.EndMove();
runStatus = LineRunStatus.HomeMoving;
LogInfo("开始原点返回: (上下气缸回原点,阻挡1气缸上升 )开始");
LogInfo("开始原点返回: 上下气缸回原点,阻挡1气缸上升 ");
MoveInfo.NewMove(LineMoveType.ReturnHome);
StartReset();
if ( isDebug)
......@@ -80,7 +80,7 @@ namespace OnlineStore.DeviceLibrary
{
return false;
}
LogInfo("开始重置:清空托盘号,(上下气缸回原点,阻挡1气缸上升 )开始;");
LogInfo("开始重置: 上下气缸回原点,阻挡1气缸上升 ");
runStatus = LineRunStatus.Reset;
SecondMoveInfo.EndMove();
......@@ -130,13 +130,13 @@ namespace OnlineStore.DeviceLibrary
{
case LineMoveStep.MH_UpDownHomeMove:
MoveInfo.NextMoveStep(LineMoveStep.MH_UpDownCylinder_Up);
LogInfo(MoveInfo.MoveType+ " : (上下轴原点返回完成,上下轴走到待机点 )开始");
DebugInfo(MoveInfo.MoveType+ " : (上下轴原点返回完成,上下轴走到待机点 )开始");
UpdownUpMove();
break;
case LineMoveStep.MH_UpDownCylinder_Up:
MoveInfo.NextMoveStep(LineMoveStep.MH_OtherCylinder_Back);
LogInfo(MoveInfo.MoveType + " : (上升到位,顶升气缸下降,前后气缸回退 )开始");
DebugInfo(MoveInfo.MoveType + " : (上升到位,顶升气缸下降,前后气缸回退 )开始");
CylinderMove(MoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Slack, IO_Type.ClampCylinder_Tighten);
......@@ -144,7 +144,7 @@ namespace OnlineStore.DeviceLibrary
case LineMoveStep.MH_OtherCylinder_Back:
LogInfo(MoveInfo.MoveType + " 完成!");
LogInfo(MoveInfo.MoveType + " 完成!");
runStatus = LineRunStatus.Runing;
MoveInfo.EndMove();
SecondMoveInfo.EndMove();
......@@ -170,7 +170,7 @@ namespace OnlineStore.DeviceLibrary
//如果正在出库中,需要减去托盘号
if (MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
LogInfo("停止运动时出库执行中,减去托盘数;");
DebugInfo("停止运动时出库执行中,减去托盘数;");
//减去需要的盘数
TrayManager.DelNeedEmptyTrayNum();
MoveInfo.EndMove();
......@@ -178,7 +178,7 @@ namespace OnlineStore.DeviceLibrary
runStatus = LineRunStatus.Busy;
SecondMoveInfo.EndMove();
LogInfo("停止运动:(上下气缸上升端,阻挡气缸输入=0 )开始 ");
LogInfo("停止运动:上下气缸上升端,阻挡气缸上升 ,开始 ");
UpdownUpMove();
CylinderMove(MoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
......@@ -238,12 +238,12 @@ namespace OnlineStore.DeviceLibrary
if (ok)
{
LogUtil.info(Name + "开始 执行排队中的出库【" + waitOutParma.ToStr() + "】");
LogUtil.info(Name + "执行排队中的出库【" + waitOutParma.ToStr() + "】");
//出库
bool result = StartOutStoreMove(waitOutParma);
if (!result)
{
LogUtil.info(Name + " 执行排队中的出库【" + waitOutParma.ToStr() + "】失败,重新加入等待队列");
LogUtil.info(Name + " 执行出库【" + waitOutParma.ToStr() + "】失败,重新加入等待队列");
AddWaitOutInfo(waitOutParma);
}
}
......
......@@ -256,20 +256,20 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_01_UpDownCylinderDown))
{
MoveInfo.NextMoveStep(LineMoveStep.PO_02_UpDownCylinderDownWait);
OutStoreLog("出库 "+MoveInfo.SLog+" : 上下气缸1下降后等待0.3秒再夹紧");
OutLog("出库 "+MoveInfo.SLog+" : 上下气缸1下降后等待0.3秒再夹紧");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
}
//只有当BOX可以进行出出料时,移栽物品,防止卡住
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_02_UpDownCylinderDownWait))
{
MoveInfo.NextMoveStep(LineMoveStep.PO_03_ClampCylinderSlack);
OutStoreLog("出库 " + MoveInfo.SLog + " : 夹料气缸夹紧)");
OutLog("出库 " + MoveInfo.SLog + " : 夹料气缸夹紧)");
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Tighten, IO_Type.ClampCylinder_Slack);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_03_ClampCylinderSlack))
{
MoveInfo.NextMoveStep(LineMoveStep.PO_04_UpDownCylinderUp);
OutStoreLog("出库 " + MoveInfo.SLog + " : 上下气缸上升)");
OutLog("出库 " + MoveInfo.SLog + " : 上下气缸上升)");
// CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
UpdownUpMove();
}
......@@ -283,7 +283,7 @@ namespace OnlineStore.DeviceLibrary
//阻挡气缸移动
SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
InStoreLog("放托盘(放开阻挡)"+SecondMoveInfo.SLog+" 物品已移走,顶升气缸1下降)");
OutLog("放托盘(放开阻挡)"+ MoveInfo.SLog+" 物品已移走,顶升气缸1下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopCylinder_Down);
if (Config.SidesWayNum <= 0)
{
......@@ -293,33 +293,33 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_05_WaitBox))
{
MoveInfo.NextMoveStep(LineMoveStep.PO_06_BeforeAfterCylinderBefore);
OutStoreLog("出库:PO_06_BeforeAfterCylinderBefore,前后气缸前进)");
OutLog("出库:" + MoveInfo.SLog + " ,前后气缸前进)");
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_06_BeforeAfterCylinderBefore))
{
MoveInfo.NextMoveStep(LineMoveStep.PO_07_UpDownCylinderDown);
OutStoreLog("出库:" + SecondMoveInfo.SLog + " ,上下气缸下降)");
OutLog("出库:" + MoveInfo.SLog + " ,上下气缸下降)");
// CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Up, IO_Type.UpDownCylinder_Down);
UpdownDownP3Move(MoveInfo.MoveParam.PlateH);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_07_UpDownCylinderDown))
{
MoveInfo.NextMoveStep(LineMoveStep.PO_08_ClampCylinderTighten);
InStoreLog("出料:" + SecondMoveInfo.SLog + ",夹料气缸放松)");
OutLog("出料:" + MoveInfo.SLog + ",夹料气缸放松)");
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Slack, IO_Type.ClampCylinder_Tighten);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_08_ClampCylinderTighten))
{
MoveInfo.NextMoveStep(LineMoveStep.PO_09_UpdownCylinderUp);
OutStoreLog("出库:" + SecondMoveInfo.SLog + ",上下气缸上升)");
OutLog("出库:" + MoveInfo.SLog + ",上下气缸上升)");
// CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
UpdownUpMove();
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_09_UpdownCylinderUp))
{
MoveInfo.NextMoveStep(LineMoveStep.PO_10_BeforeAfterCylinderAfter);
OutStoreLog("出库:" + SecondMoveInfo.SLog + ",前后气缸后退,等待4000 )");
OutLog("出库:" + MoveInfo.SLog + ",前后气缸后退,等待4000 )");
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(4000));
......
......@@ -30,7 +30,7 @@ namespace OnlineStore.DeviceLibrary
}
if (String.IsNullOrEmpty(codeStr))
{
return msg = deviceName + "托盘【" + trayNum + "】 没有扫码到条码";
return msg = deviceName + "未扫到条码";
}
//if (LineManager.Line.runStatus.Equals(LineRunStatus.Wait))
......@@ -43,17 +43,19 @@ namespace OnlineStore.DeviceLibrary
//code: 条码内容
string server = ConfigAppSettings.GetValue(Setting_Init.http_server) + "?cids=" + LineServer.GetAllCID() + "&code=%3D" + codeStr;
LogUtil.info(deviceName + "托盘【" + trayNum + "】 收到条码<< " + codeStr + ",获取入库PosID:" + server);
LogUtil.info(deviceName + "托盘【" + trayNum + "】 条码<< " + codeStr + ",获取入库PosID:" + server);
string resultStr = HttpHelper.Post(server, "");
LogUtil.info("HttpHelper.Post结果:"+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)
{
return msg = deviceName + "托盘【" + trayNum + "】 条码【" + codeStr + "】没有收到服务器反馈";
return msg = deviceName + " 条码【" + codeStr + "】没有收到服务器反馈";
}
else if ((!string.IsNullOrEmpty(serverResult.msg)) || serverResult.result.Equals(0).Equals(false))
{
return msg = deviceName + "托盘【" + trayNum + "】 条码【" + codeStr + "】 :" + serverResult.msg;
return msg = deviceName + " 条码【" + codeStr + "】 :" + serverResult.msg;
}
if (!serverResult.pos.Equals(""))
......@@ -64,7 +66,7 @@ namespace OnlineStore.DeviceLibrary
string[] posArray = posId.Split('#');
if (!(posArray.Length == 2))
{
return msg = deviceName + "托盘【" + trayNum + "】 入库库位格式错误:条码【" + codeStr + "】库位【" + posId + "】";
return msg = deviceName + " 入库库位格式错误:条码【" + codeStr + "】库位【" + posId + "】";
}
int storeId = int.Parse(posArray[0]);
string wareNum = serverResult.barcode;
......@@ -78,7 +80,7 @@ namespace OnlineStore.DeviceLibrary
moveEquip.SetWarnMsg( "入库库位重复: " + param.ToStr() + " ,入库失败!");
return msg = ("收到服务器入库命令 " + "入库库位重复: " + param.ToStr() + " ,入库失败!");
}
LogUtil.info("更新盘空满信息,托盘号【" + trayNum + "】,是否有料盘【" + true + "】,出库入库【" + 1 + "】");
LogUtil.info("收到入库命令: " + param.ToStr() + " ,更新盘空满信息,托盘号【" + trayNum + "】,有料," + ReelType.InStore + "");
TrayManager.UpdateTrayInfo(trayNum, true, ReelType.InStore, wareNum, posId, plateH, plateW);
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
......@@ -86,6 +88,12 @@ namespace OnlineStore.DeviceLibrary
{
LineServer.CheckInStorePos(storeId, param);
}
lock (moveEquip.waitInListLock)
{
//如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil.info(moveEquip.Name + " 入库命令: " + " + param.ToStr() + "+ "加入等待列表中!");
moveEquip.waitInStoreList.Add(param);
}
}
}
catch (Exception ex)
......
......@@ -18,7 +18,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 放在公共地方,方便存取,夹料编码盘列表,key=编码(1-6),value=是否有物品,true=有物品
/// </summary>
private static ConcurrentDictionary<int, TrayInfo> fixtureCodeFullMap = new ConcurrentDictionary<int, TrayInfo>();
private static ConcurrentDictionary<int, TrayInfo> TrayInfoMap = new ConcurrentDictionary<int, TrayInfo>();
/// <summary>
/// 流水线需要的空盘数量
......@@ -42,6 +42,10 @@ namespace OnlineStore.DeviceLibrary
{
LineRunTest = ConfigAppSettings.GetIntValue(Setting_Init.LineRunTest).Equals(1);
}
public static List<TrayInfo> getTrayList()
{
return new List<TrayInfo>(TrayInfoMap.Values);
}
internal static void AddNeedEmptyTrayNum()
{
Interlocked.Increment(ref LineNeedEmptyTrayNum);
......@@ -58,18 +62,18 @@ namespace OnlineStore.DeviceLibrary
/// <returns>盘上是否有料盘</returns>
internal static bool TrayIsFull(int trayNum)
{
if (fixtureCodeFullMap.ContainsKey(trayNum))
if (TrayInfoMap.ContainsKey(trayNum))
{
return fixtureCodeFullMap[trayNum].IsFull;
return TrayInfoMap[trayNum].IsFull;
}
return false;
}
internal static TrayInfo GetTrayInfo(int trayNum)
{
if (fixtureCodeFullMap.ContainsKey(trayNum))
if (TrayInfoMap.ContainsKey(trayNum))
{
return fixtureCodeFullMap[trayNum];
return TrayInfoMap[trayNum];
}
TrayInfo tray = new TrayInfo(trayNum,false,0);
......@@ -79,56 +83,42 @@ namespace OnlineStore.DeviceLibrary
internal static void UpdateTrayInfo(int trayNum, bool isFull = false, int inOrOut = 0, string wareCode = "", string posId = "", int plateH = 0, int plateW = 0)
{
if (fixtureCodeFullMap.ContainsKey(trayNum))
if (TrayInfoMap.ContainsKey(trayNum))
{
fixtureCodeFullMap[trayNum].IsFull = isFull;
fixtureCodeFullMap[trayNum].InOrOutStore = inOrOut;
TrayInfoMap[trayNum].IsFull = isFull;
TrayInfoMap[trayNum].InOrOutStore = inOrOut;
fixtureCodeFullMap[trayNum].WareCode = wareCode;
fixtureCodeFullMap[trayNum].PosId = posId;
fixtureCodeFullMap[trayNum].PlateH = plateH;
fixtureCodeFullMap[trayNum].PlateW = plateW;
TrayInfoMap[trayNum].WareCode = wareCode;
TrayInfoMap[trayNum].PosId = posId;
TrayInfoMap[trayNum].PlateH = plateH;
TrayInfoMap[trayNum].PlateW = plateW;
}
else
{
TrayInfo fixture = new TrayInfo(trayNum, isFull, inOrOut, wareCode, posId, plateH, plateW);
fixtureCodeFullMap.TryAdd(trayNum, fixture);
}
}
internal static void UpdateTrayCode(int trayNum, string wareCode = "")
{
LogUtil.info("更新托盘【" + trayNum + "】的条码为【" + wareCode + "】");
if (fixtureCodeFullMap.ContainsKey(trayNum))
{
fixtureCodeFullMap[trayNum].WareCode = wareCode;
TrayInfoMap.TryAdd(trayNum, fixture);
}
}
internal static void UpdateInStoreNG(int trayNum, bool isNg = false)
internal static void UpdateInStoreNG(int trayNum, bool isNg ,string msg)
{
LogUtil.info("更新托盘【" + trayNum + "】InStoreNG=【" + isNg + "】");
if (fixtureCodeFullMap.ContainsKey(trayNum))
LogUtil.info("更新托盘【" + trayNum + "】InStoreNG=【" + isNg + "】NgMsg=【" + msg + "】");
if (TrayInfoMap.ContainsKey(trayNum))
{
fixtureCodeFullMap[trayNum].InStoreNG = isNg;
TrayInfoMap[trayNum].InStoreNG = isNg;
TrayInfoMap[trayNum].NgMsg = msg;
}
}
internal static void UpdateTrayPosId(int trayNum, string PosId = "")
{
if (fixtureCodeFullMap.ContainsKey(trayNum))
{
fixtureCodeFullMap[trayNum].PosId = PosId;
}
}
/// <summary>
/// 是否还有有料仓的盘
/// </summary>
internal static bool IsHasFullTray()
{
foreach (int key in fixtureCodeFullMap.Keys)
foreach (int key in TrayInfoMap.Keys)
{
if (fixtureCodeFullMap[key].IsFull)
if (TrayInfoMap[key].IsFull)
{
return true;
}
......@@ -140,9 +130,9 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
internal static bool IsHasFullOutFixture()
{
foreach (int key in fixtureCodeFullMap.Keys)
foreach (int key in TrayInfoMap.Keys)
{
if (fixtureCodeFullMap[key].IsFull && fixtureCodeFullMap[key].InOrOutStore.Equals(2))
if (TrayInfoMap[key].IsFull && TrayInfoMap[key].InOrOutStore.Equals(2))
{
return true;
}
......@@ -258,7 +248,7 @@ namespace OnlineStore.DeviceLibrary
if (equip.IsDebug || equip.runStatus <= LineRunStatus.Wait)
{
return true;
}
}
}
}
foreach (ProvidingEquip equip in LineManager.Line.ProvidingEquipMap.Values)
......
......@@ -131,7 +131,7 @@ namespace OnlineStore.DeviceLibrary
{
// Create new modbus master and add event functions
aioBox = new AIOBOX();
aioBox.LogPath( Application.StartupPath+@"\logs\aio\");
// aioBox.LogPath( Application.StartupPath+@"\logs\aio\");
aioBox.IP = ioIp;
// bool rtn = aioBox.AutoIP(ioIp);
......
......@@ -357,7 +357,10 @@ namespace OnlineStore.DeviceLibrary
{
return IOManager.IOValue(IoType, baseConfig.Id);
}
public void DebugInfo(string logInfo)
{
LogUtil.debug(Name + logInfo);
}
public void LogInfo(string logInfo)
{
LogUtil.info(Name + logInfo);
......
......@@ -9,16 +9,16 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 托盘信息
/// </summary>
public class TrayInfo
{
public class TrayInfo
{
public TrayInfo(int trayNum, bool isFull=false, int inOrOut=0 )
{
this.TrayCode = trayNum;
this.IsFull = isFull;
this.InOrOutStore = inOrOut;
}
public TrayInfo (int trayNum, bool isFull , int inOrOut ,string wareCode,string posId,int plateH,int plateW)
public TrayInfo(int trayNum, bool isFull = false, int inOrOut = 0)
{
this.TrayCode = trayNum;
this.IsFull = isFull;
this.InOrOutStore = inOrOut;
}
public TrayInfo(int trayNum, bool isFull, int inOrOut, string wareCode, string posId, int plateH, int plateW)
{
this.TrayCode = trayNum;
this.IsFull = isFull;
......@@ -27,19 +27,34 @@ namespace OnlineStore.DeviceLibrary
this.PosId = posId;
this.PlateH = plateH;
this.PlateW = plateW;
InStoreNG = false;
NgMsg = "";
}
public string ToStr()
{
string type = "无操作";
if (InOrOutStore.Equals(1))
{
type = "入库";
}
else
{
type = "出库";
}
return "托盘【" + TrayCode + "】" + (IsFull ? "有料," : "空,") + type + "," + WareCode + "," + PosId + "," + PlateH + "," + PlateW + "," + InStoreNG + "," + NgMsg;
}
/// <summary>
/// 夹具编码值(1-32?)
/// </summary>
public int TrayCode { get; set; }
/// <summary>
/// 是否有料盘,true=有料盘
/// </summary>
public bool IsFull { get; set; }
/// <summary>
/// 出库还是入库(有料盘时才有此操作)0=无操作,1=入库,2=出库
/// </summary>
public int InOrOutStore { get; set; }
/// <summary>
/// 夹具编码值(1-32?)
/// </summary>
public int TrayCode { get; set; }
/// <summary>
/// 是否有料盘,true=有料盘
/// </summary>
public bool IsFull { get; set; }
/// <summary>
/// 出库还是入库(有料盘时才有此操作)0=无操作,1=入库,2=出库
/// </summary>
public int InOrOutStore { get; set; }
/// <summary>
/// 物品二维码信息
......@@ -48,7 +63,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 位置名(对应配置表的位置)
/// </summary>
public string PosId { get; set; }
public string PosId { get; set; }
/// <summary>
/// 料盘高度
/// </summary>
......@@ -61,6 +76,7 @@ namespace OnlineStore.DeviceLibrary
/// 入库失败料盘,未扫到码或获取库位号失败
/// </summary>
public bool InStoreNG = false;
public string NgMsg = "";
public bool EmergencyOut = false;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!