Commit 67ccc046 LN

1

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