Commit 15e8b795 LN

bug修改

1 个父辈 c39c78d8
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
this.lblAddr.AutoSize = true; this.lblAddr.AutoSize = true;
this.lblAddr.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblAddr.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblAddr.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.lblAddr.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblAddr.Location = new System.Drawing.Point(326, 27); this.lblAddr.Location = new System.Drawing.Point(364, 27);
this.lblAddr.Name = "lblAddr"; this.lblAddr.Name = "lblAddr";
this.lblAddr.Size = new System.Drawing.Size(46, 17); this.lblAddr.Size = new System.Drawing.Size(46, 17);
this.lblAddr.TabIndex = 258; this.lblAddr.TabIndex = 258;
...@@ -257,9 +257,9 @@ ...@@ -257,9 +257,9 @@
this.cmbWriteIO.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cmbWriteIO.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cmbWriteIO.FormattingEnabled = true; this.cmbWriteIO.FormattingEnabled = true;
this.cmbWriteIO.ItemHeight = 22; this.cmbWriteIO.ItemHeight = 22;
this.cmbWriteIO.Location = new System.Drawing.Point(29, 21); this.cmbWriteIO.Location = new System.Drawing.Point(17, 21);
this.cmbWriteIO.Name = "cmbWriteIO"; this.cmbWriteIO.Name = "cmbWriteIO";
this.cmbWriteIO.Size = new System.Drawing.Size(284, 28); this.cmbWriteIO.Size = new System.Drawing.Size(341, 28);
this.cmbWriteIO.TabIndex = 234; this.cmbWriteIO.TabIndex = 234;
this.cmbWriteIO.ValueMember = "ProName"; this.cmbWriteIO.ValueMember = "ProName";
this.cmbWriteIO.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.cmbWriteIO_DrawItem); this.cmbWriteIO.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.cmbWriteIO_DrawItem);
......
...@@ -99,7 +99,14 @@ namespace OnlineStore.AssemblyLine ...@@ -99,7 +99,14 @@ namespace OnlineStore.AssemblyLine
} }
private void Control_Click(object sender, EventArgs e) private void Control_Click(object sender, EventArgs e)
{ {
IOTextControl control = (IOTextControl)sender;
string name = control.Name.Substring(3, control.Name.Length - 3);
List<string> keyList = new List<string>(DOControlList.Keys);
int index = keyList.IndexOf(name);
if (index >= 0)
{
cmbWriteIO.SelectedIndex = index;
}
} }
private void timer1_Tick(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e)
{ {
......
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
<Compile Include="assemblyLine\FeedingEquip.cs" /> <Compile Include="assemblyLine\FeedingEquip.cs" />
<Compile Include="assemblymanager\RFIDManagercs.cs" /> <Compile Include="assemblymanager\RFIDManagercs.cs" />
<Compile Include="assemblymanager\SServerManager.cs" /> <Compile Include="assemblymanager\SServerManager.cs" />
<Compile Include="assemblymanager\EDataManager.cs" />
<Compile Include="assemblymanager\TrayManager.cs" /> <Compile Include="assemblymanager\TrayManager.cs" />
<Compile Include="baan\AxisBean.cs" /> <Compile Include="baan\AxisBean.cs" />
<Compile Include="baan\ClampJawBean.cs" /> <Compile Include="baan\ClampJawBean.cs" />
......
...@@ -561,7 +561,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -561,7 +561,7 @@ namespace OnlineStore.DeviceLibrary
else if (wait.WaitType.Equals(WaitEnum.W009_BoxCanInstore)) else if (wait.WaitType.Equals(WaitEnum.W009_BoxCanInstore))
{ {
int storeId = moveInfo.MoveParam.GetStoreId(); int storeId = moveInfo.MoveParam.GetStoreId();
wait.IsEnd = LineServer.BoxCanReviceTray(storeId); wait.IsEnd = LineServer.BoxCanReviceTray(storeId,out NotOkMsg);
} }
else else
{ {
......
...@@ -144,7 +144,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -144,7 +144,7 @@ namespace OnlineStore.DeviceLibrary
else if (wait.WaitType.Equals(WaitEnum.W009_BoxCanInstore)) else if (wait.WaitType.Equals(WaitEnum.W009_BoxCanInstore))
{ {
int storeId = checkWaitInfo.MoveParam.GetStoreId(); int storeId = checkWaitInfo.MoveParam.GetStoreId();
wait.IsEnd = LineServer.BoxCanReviceTray(storeId); wait.IsEnd = LineServer.BoxCanReviceTray(storeId,out NotOkMsg);
} }
//else if (wait.WaitType.Equals(WaitEnum.W010_SWCanTopUp)) //else if (wait.WaitType.Equals(WaitEnum.W010_SWCanTopUp))
//{ //{
......
...@@ -289,10 +289,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -289,10 +289,12 @@ namespace OnlineStore.DeviceLibrary
OutLog("出库 " + MoveInfo.SLog + ": 夹料气缸夹紧,更新料盘位置【" + MoveInfo.MoveParam.WareCode + "】【MOVING】【" + DeviceID + "】"); OutLog("出库 " + MoveInfo.SLog + ": 夹料气缸夹紧,更新料盘位置【" + MoveInfo.MoveParam.WareCode + "】【MOVING】【" + DeviceID + "】");
//CylinderMove(MoveInfo, IO_Type.ClampCylinder_Relax, IO_Type.ClampCylinder_Work); //CylinderMove(MoveInfo, IO_Type.ClampCylinder_Relax, IO_Type.ClampCylinder_Work);
ClampJwa.Push(MoveInfo ); ClampJwa.Push(MoveInfo);
//更新料盘位置 //更新料盘位置
SServerManager.UpdateTrayLoc(Name, MoveInfo.MoveParam.WareCode, LocStatus.MOVING, DeviceID.ToString()); SServerManager.UpdateTrayLoc(Name, MoveInfo.MoveParam.WareCode, LocStatus.MOVING, DeviceID.ToString());
EDataManager.UpdateParam(DeviceID, 2, MoveInfo.MoveParam);
} }
else if (MoveInfo.IsStep(LineMoveStep.MO_54_CylinderOpen)) else if (MoveInfo.IsStep(LineMoveStep.MO_54_CylinderOpen))
{ {
...@@ -329,7 +331,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -329,7 +331,7 @@ namespace OnlineStore.DeviceLibrary
if (UpdownIsUp()) if (UpdownIsUp())
{ {
//if (IOValue(IO_Type.ClampCylinder_Check).Equals(IO_VALUE.HIGH)) //if (IOValue(IO_Type.ClampCylinder_Check).Equals(IO_VALUE.HIGH))
if(ClampJwa.HasReel()) if (ClampJwa.HasReel())
{ {
if (IsBigStore()) if (IsBigStore())
{ {
...@@ -382,7 +384,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -382,7 +384,7 @@ namespace OnlineStore.DeviceLibrary
int trayNum = SecondMoveInfo.MoveParam.TrayNumber; int trayNum = SecondMoveInfo.MoveParam.TrayNumber;
//去掉直接丢盘处理 //去掉直接丢盘处理
MoveInfo.NextMoveStep(LineMoveStep.MO_60_CylinderDown); MoveInfo.NextMoveStep(LineMoveStep.MO_60_CylinderDown);
OutLog("出库 " + MoveInfo.SLog + ": 夹具检测编码完成, 上下气缸下降 ,更新料盘位置【" + MoveInfo.MoveParam.WareCode + "】【INLINE】【" + trayNum + "】,顶升气缸上升"); OutLog("出库 " + MoveInfo.SLog + ": 拦截到空托盘【" + trayNum + "】, 上下气缸下降 ,顶升气缸上升");
if (MoveInfo.MoveParam != null) if (MoveInfo.MoveParam != null)
{ {
MoveInfo.MoveParam.TrayNumber = trayNum; MoveInfo.MoveParam.TrayNumber = trayNum;
...@@ -392,8 +394,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -392,8 +394,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.MoveParam = SecondMoveInfo.MoveParam; MoveInfo.MoveParam = SecondMoveInfo.MoveParam;
} }
//更新料盘位置
SServerManager.UpdateTrayLoc(Name, MoveInfo.MoveParam.WareCode, LocStatus.INLINE, "E" + trayNum.ToString().PadLeft(2, '0'));
UpdownDownP2Move(MoveInfo.MoveParam.PlateH, MoveInfo.MoveParam.PlateW); UpdownDownP2Move(MoveInfo.MoveParam.PlateH, MoveInfo.MoveParam.PlateW);
CylinderMove(MoveInfo, IO_Type.TopCylinder_Down, IO_Type.TopCylinder_Up); CylinderMove(MoveInfo, IO_Type.TopCylinder_Down, IO_Type.TopCylinder_Up);
} }
...@@ -402,14 +403,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -402,14 +403,18 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(LineMoveStep.MO_60_CylinderDown)) else if (MoveInfo.IsStep(LineMoveStep.MO_60_CylinderDown))
{ {
OutLog("出库 " + MoveInfo.SLog + ": 夹料气缸放松,更新托盘【" + MoveInfo.MoveParam.TrayNumber + "】,有料盘,OutStore,【" + MoveInfo.MoveParam.ToStr() + "】"); OutLog("出库 " + MoveInfo.SLog + ": 夹料气缸放松,更新托盘【" + MoveInfo.MoveParam.TrayNumber + "】,有料盘,OutStore,【" + MoveInfo.MoveParam.ToStr() + "】");
//更新料盘位置
TrayManager.UpdateTrayInfo(MoveInfo.MoveParam.TrayNumber, true, ReelType.OutStore, MoveInfo.MoveParam.Clone()); int trayNum = MoveInfo.MoveParam.TrayNumber;
TrayInfo tray = TrayManager.GetTrayInfo(MoveInfo.MoveParam.TrayNumber); SServerManager.UpdateTrayLoc(Name, MoveInfo.MoveParam.WareCode, LocStatus.INLINE, "E" + trayNum.ToString().PadLeft(2, '0'));
LogInfo("出库 " + MoveInfo.SLog + ": 夹料气缸放松,更新托盘信息 " + tray.ToStr() + ""); TrayManager.UpdateTrayInfo(trayNum, true, ReelType.OutStore, MoveInfo.MoveParam.Clone());
TrayInfo tray = TrayManager.GetTrayInfo(trayNum);
LogInfo("出库 " + MoveInfo.SLog + ": ,更新料盘位置【" + MoveInfo.MoveParam.WareCode + "】【INLINE】更新托盘【" + trayNum + "】 " + tray.ToStr() + "");
//出库全部完成 //出库全部完成
MoveInfo.NextMoveStep(LineMoveStep.MO_61_CylinderRelax); MoveInfo.NextMoveStep(LineMoveStep.MO_61_CylinderRelax);
//CylinderMove(MoveInfo, IO_Type.ClampCylinder_Work, IO_Type.ClampCylinder_Relax); //CylinderMove(MoveInfo, IO_Type.ClampCylinder_Work, IO_Type.ClampCylinder_Relax);
ClampJwa.Relax(MoveInfo); ClampJwa.Relax(MoveInfo);
EDataManager.UpdateParam(DeviceID);
} }
else if (MoveInfo.IsStep(LineMoveStep.MO_61_CylinderRelax)) else if (MoveInfo.IsStep(LineMoveStep.MO_61_CylinderRelax))
{ {
...@@ -534,6 +539,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -534,6 +539,7 @@ namespace OnlineStore.DeviceLibrary
InLog("入库 " + MoveInfo.SLog + ": 夹料气缸夹紧"); InLog("入库 " + MoveInfo.SLog + ": 夹料气缸夹紧");
//CylinderMove(MoveInfo, IO_Type.ClampCylinder_Relax, IO_Type.ClampCylinder_Work); //CylinderMove(MoveInfo, IO_Type.ClampCylinder_Relax, IO_Type.ClampCylinder_Work);
ClampJwa.Push(MoveInfo); ClampJwa.Push(MoveInfo);
EDataManager.UpdateParam(DeviceID, 1, MoveInfo.MoveParam);
} }
else if (MoveInfo.IsStep(LineMoveStep.MI_05_CylinderOpen)) else if (MoveInfo.IsStep(LineMoveStep.MI_05_CylinderOpen))
{ {
...@@ -597,6 +603,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -597,6 +603,7 @@ namespace OnlineStore.DeviceLibrary
InLog("入库 " + MoveInfo.SLog + ",夹料气缸放松"); InLog("入库 " + MoveInfo.SLog + ",夹料气缸放松");
//CylinderMove(MoveInfo, IO_Type.ClampCylinder_Work, IO_Type.ClampCylinder_Relax); //CylinderMove(MoveInfo, IO_Type.ClampCylinder_Work, IO_Type.ClampCylinder_Relax);
ClampJwa.Relax(MoveInfo); ClampJwa.Relax(MoveInfo);
EDataManager.UpdateParam(DeviceID );
} }
else if (MoveInfo.IsStep(LineMoveStep.MI_12_CylinderRelax)) else if (MoveInfo.IsStep(LineMoveStep.MI_12_CylinderRelax))
{ {
......
using Asa;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary
{
public class EDataManager
{
/// <summary>
/// key=设备DeviceId,value=料盘信息
/// </summary>
private static ConcurrentDictionary<int, EquipDataInfo> dataMap = new ConcurrentDictionary<int, EquipDataInfo>();
static EDataManager()
{
}
public static List<EquipDataInfo> getDataList()
{
return new List<EquipDataInfo>(dataMap.Values);
}
public static EquipDataInfo GetEuipParam(int deviceId)
{
if (dataMap.ContainsKey(deviceId))
{
return dataMap[deviceId];
}
return null;
}
public static void UpdateParam(int deviceId, int reelType = 0, InOutParam param = null)
{
if (reelType.Equals(0) || param == null)
{
EquipDataInfo data = null;
dataMap.TryRemove(deviceId, out data);
}
else
{
EquipDataInfo data = new EquipDataInfo(deviceId, reelType, param);
if (dataMap.ContainsKey(deviceId))
{
dataMap[deviceId] = data;
}
else
{
dataMap.TryAdd(deviceId, data);
}
}
SaveMapToFile();
}
//public static void ClearInOutParam()
//{
// LogUtil.info("-------------------点击:清空托盘。清空前打印托盘信息:");
// List<EquipDataInfo> tray = new List<EquipDataInfo> (paramdataMap.Values);
// foreach (EquipDataInfo t in tray)
// {
// LogUtil.info(t.ToStr());
// }
// paramdataMap = new ConcurrentDictionary<int, EquipDataInfo>();
// SaveMapToFile();
// LogUtil.info("-------------------点击:清空托盘。托盘内容已清空");
//}
private static string FilePath = "";
public static void InitFileData()
{
dataMap = new ConcurrentDictionary<int, EquipDataInfo>();
FilePath = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.ConfigPath_TrayList);
if (File.Exists(FilePath))
{
LogUtil.info("开始加载文件设备料盘信息:" + FilePath);
string[] lines = FileEncoding.GetFileLines(FilePath);
foreach (string line in lines)
{
EquipDataInfo data = JsonHelper.DeserializeJsonToObject<EquipDataInfo>(line);
if (data != null && (data.inouParam != null) && (data.inouParam.WareCode != "") && data.ReelType > 0)
{
LogUtil.info("加载到设备料盘信息:" + data.ToStr());
dataMap.TryAdd(data.DeviceId, data);
}
}
LogUtil.info("设备料盘加载完成");
}
}
public static void SaveMapToFile()
{
try
{
List<EquipDataInfo> trayList = new List<EquipDataInfo>(dataMap.Values);
List<string> lineList = new List<string>();
foreach (EquipDataInfo tray in trayList)
{
string line = JsonHelper.SerializeObject(tray);
if (!string.IsNullOrEmpty(line))
{
lineList.Add(line);
}
}
FileEncoding.WritteFile(FilePath, lineList.ToArray());
}
catch (Exception ex)
{
LogUtil.error("SaveTrayToFile出错:" + ex.ToString());
}
}
}
public class EquipDataInfo
{
public EquipDataInfo()
{
this.DeviceId = 0;
this.inouParam = null;
this.ReelType = 0;
}
public EquipDataInfo(int id, int reelType, InOutParam param)
{
this.ReelType = reelType;
this.DeviceId = id;
this.inouParam = param;
}
public int DeviceId { get; set; }
public InOutParam inouParam { get; set; }
/// <summary>
/// 1=入库,2=出库
/// </summary>
public int ReelType { get; set; }
public string ToStr()
{
if (inouParam == null)
{
return "设备[" + DeviceId + "]=null";
}
return "设备[" + DeviceId + "]=" + inouParam.ToStr();
}
}
}
...@@ -129,13 +129,30 @@ namespace OnlineStore.DeviceLibrary ...@@ -129,13 +129,30 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
public static bool BoxCanReviceTray(int id) public static bool BoxCanReviceTray(int id, out string NotOkMsg)
{ {
NotOkMsg = " [料仓" + id + "可以入库:离线] ";
BoxInfo box = GetBoxInfo(id); BoxInfo box = GetBoxInfo(id);
if (box != null) if (box != null)
{ {
LineRunStatus runs = (LineRunStatus)box.SRunStatus; LineRunStatus runs = (LineRunStatus)box.SRunStatus;
TimeSpan span = DateTime.Now - box.LastMsgTime; TimeSpan span = DateTime.Now - box.LastMsgTime;
if (span.TotalSeconds > ClientKeepSecond)
{
NotOkMsg = " [料仓" + id + "可以入库:离线] ";
return false;
}
else if (!box.HasTray.Equals(0))
{
NotOkMsg = " [料仓" + id + "可以入库:仓门口有料] ";
return false;
}
else if (!box.SAlarmType.Equals(LineAlarmType.None))
{
NotOkMsg = " [料仓" + id + "可以入库:报警中] ";
return false;
}
if (span.TotalSeconds < ClientKeepSecond && box.HasTray.Equals(0) && box.SAlarmType.Equals(LineAlarmType.None)) if (span.TotalSeconds < ClientKeepSecond && box.HasTray.Equals(0) && box.SAlarmType.Equals(LineAlarmType.None))
{ {
if (id.Equals(7)) if (id.Equals(7))
...@@ -144,14 +161,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -144,14 +161,21 @@ namespace OnlineStore.DeviceLibrary
{ {
return true; return true;
} }
else
{
NotOkMsg = " [料仓" + id + "可以入库:忙碌中] ";
}
} }
else else
{ {
if (runs.Equals(LineRunStatus.Runing)) if (runs.Equals(LineRunStatus.Runing))
{ {
return true; return true;
} }
else
{
NotOkMsg = " [料仓" + id + "可以入库:忙碌中] ";
}
} }
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!