Commit 7477cfe3 张东亮

1

1 个父辈 a6da74b6
using Common;
using DeviceLibrary;
using DeviceLibrary.Context;
using LoadCSVLibrary;
using System;
using System.Collections.Generic;
......@@ -22,6 +23,10 @@ namespace LiftController
InitializeComponent();
groupBox4.Enabled = false;
LoadIOList(config);
string[] lifts = Common.AppConfigHelper.GetValue(Common.SettingString.Lift_Ids).Split(',');
comboBox1.Items.AddRange(lifts);
if (comboBox1.Items.Count > 0)
comboBox1.SelectedIndex = 0;
}
Dictionary<string, IOTextControl> DIControlList = new Dictionary<string, IOTextControl>();
Dictionary<string, IOTextControl> DOControlList = new Dictionary<string, IOTextControl>();
......@@ -209,5 +214,19 @@ namespace LiftController
{
timer1.Start();
}
private void button2_Click(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex > -1)
{
string liftId = comboBox1.SelectedItem.ToString();
DialogResult dialogResult = MessageBox.Show($"确定删除电梯{liftId}的缓存信息?", "提示", MessageBoxButtons.YesNo);
if (dialogResult.Equals(DialogResult.Yes))
{
LiftContext.Clear(comboBox1.SelectedItem.ToString());
LogUtil.info($"手动清除电梯{liftId}缓存");
}
}
}
}
}
......@@ -37,8 +37,11 @@ namespace LogisticsIntelligence
this.label1 = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.lblRequestResponse = new System.Windows.Forms.ToolStripStatusLabel();
this.tableLayoutPanel1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
......@@ -49,22 +52,24 @@ namespace LogisticsIntelligence
this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 39.32806F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 60.67194F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1216, 470);
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1621, 636);
this.tableLayoutPanel1.TabIndex = 1;
//
// tabControl1
//
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabControl1.Location = new System.Drawing.Point(3, 187);
this.tabControl1.Location = new System.Drawing.Point(4, 254);
this.tabControl1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1210, 280);
this.tabControl1.Size = new System.Drawing.Size(1613, 378);
this.tabControl1.TabIndex = 0;
//
// groupBox1
......@@ -72,9 +77,11 @@ namespace LogisticsIntelligence
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(3, 3);
this.groupBox1.Location = new System.Drawing.Point(4, 4);
this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(1210, 178);
this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.groupBox1.Size = new System.Drawing.Size(1613, 242);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "电梯状态";
......@@ -83,9 +90,10 @@ namespace LogisticsIntelligence
//
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(3, 19);
this.label1.Location = new System.Drawing.Point(4, 24);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(1204, 156);
this.label1.Size = new System.Drawing.Size(1605, 214);
this.label1.TabIndex = 2;
this.label1.Text = "label1";
//
......@@ -94,13 +102,33 @@ namespace LogisticsIntelligence
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// statusStrip1
//
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.lblRequestResponse});
this.statusStrip1.Location = new System.Drawing.Point(0, 610);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 19, 0);
this.statusStrip1.Size = new System.Drawing.Size(1621, 26);
this.statusStrip1.TabIndex = 2;
this.statusStrip1.Text = "statusStrip1";
//
// lblRequestResponse
//
this.lblRequestResponse.Name = "lblRequestResponse";
this.lblRequestResponse.Size = new System.Drawing.Size(27, 20);
this.lblRequestResponse.Text = "ok";
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1216, 470);
this.ClientSize = new System.Drawing.Size(1621, 636);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.tableLayoutPanel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.MaximizeBox = false;
this.Name = "FrmMain";
this.Text = "LiftController";
......@@ -108,7 +136,10 @@ namespace LogisticsIntelligence
this.Load += new System.EventHandler(this.FrmMain_Load);
this.tableLayoutPanel1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
......@@ -119,6 +150,8 @@ namespace LogisticsIntelligence
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label1;
private System.ComponentModel.BackgroundWorker backgroundWorker1;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel lblRequestResponse;
}
}
using DeviceLibrary;
using Common;
using DeviceLibrary;
using DeviceLibrary.Context;
using LiftController;
using System;
using System.Collections.Generic;
......@@ -18,7 +20,6 @@ namespace LogisticsIntelligence
{
InitializeComponent();
appContext.Init();
}
DeviceLibrary.Context.Context appContext = new DeviceLibrary.Context.Context();
private void FrmMain_Load(object sender, EventArgs e)
......@@ -31,9 +32,16 @@ namespace LogisticsIntelligence
}
private void UpdateLift()
{
this.Invoke(new Action(()=> {
label1.Text = DeviceLibrary.Context.LiftContext.ToListInfos();
}));
try
{
this.Invoke(new Action(() =>
{
label1.Text = DeviceLibrary.Context.LiftContext.ToListInfos();
lblRequestResponse.Text = $"请求反馈信息:{DeviceLibrary.Context.LiftContext.RequestMsg}";
}));
}
catch { }
}
private void timer1_Tick(object sender, EventArgs e)
......@@ -68,8 +76,8 @@ namespace LogisticsIntelligence
linePan.Controls.Add(form);
form.Dock = DockStyle.Fill;
form.AutoScroll = true;
// linePan.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left)));
// form.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left)));
// linePan.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left)));
// form.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left)));
form.Show();
// tabPageList.Add(lineTabPage);
tabControl1.Controls.Add(lineTabPage);
......
......@@ -123,6 +123,9 @@
<metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>281, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
......
......@@ -34,7 +34,8 @@ namespace Common
/// DI,D2-到达4F,_AtFourth
/// </summary>
public static string _AtFourth = "_AtFourth";
public static string _HasEmptyFinished = "_HasEmptyFinished";
public static string _HasFullFinished = "_HasFullFinished";
/// <summary>
/// DI,D2-门已开,_DoorOpen
/// </summary>
......
类型,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义,SlaveID
PRO,IO模块对应的DI数量,IO_DILength,10.85.199.29#8;192.168.103.22#8,,,,,,
PRO,模块对应的DO数量,IO_DOLength,10.85.199.29#8;192.168.103.22#8,,,,,,
PRO,IO模块对应的DI数量,IO_DILength,10.85.199.29#16;172.16.31.151#8,,,,,,
PRO,模块对应的DO数量,IO_DOLength,10.85.199.29#16;172.16.31.151#8,,,,,,
PRO,IO模块IP,PRO_AOI_IP_1,10.85.199.29,,,,,,
PRO,IO模块IP,PRO_AOI_IP_2,172.16.31.151,,,,,,
,,,,,,,,,
DI,D2-任务应答,LIFT_D2_Response,0,PRO_AOI_IP_1,0,D2-任务应答,X21,X21,0
DI,D2-到达1F,LIFT_D2_AtFirst,1,PRO_AOI_IP_1,0,D2-到达1F,X22,X22,0
......@@ -10,6 +11,7 @@ DI,D2-到达4F,LIFT_D2_AtFourth,3,PRO_AOI_IP_1,0,D2-到达4F,X24,X24,0
DI,D2-门已开,LIFT_D2_DoorOpen,4,PRO_AOI_IP_1,0,D2-门已开,X25,X25,0
DI,D2-故障中,LIFT_D2_InFault,5,PRO_AOI_IP_1,0,D2-故障中,X26,X26,0
DI,D2-运行中,LIFT_D2_InRun,6,PRO_AOI_IP_1,0,D2-运行中,X27,X27,0
DI,D2-回收空成品料架,LIFT_D2_HasEmptyFinished,7,PRO_AOI_IP_1,0,D2-回收空成品料架,X28,X28,0
,,,,,,,,,
DO,D2-AGV请求,LIFT_D2_AGVRequest,0,PRO_AOI_IP_1,0,D2-AGV请求,Y21,Y21,0
DO,D2-AGV离开,LIFT_D2_AGVLeave,1,PRO_AOI_IP_1,0,D2-AGV离开,Y22,Y22,0
......@@ -19,6 +21,7 @@ DO,D2-AGV呼叫4F,LIFT_D2_FourthCall,4,PRO_AOI_IP_1,0,D2-AGV呼叫4F,Y25,Y25,0
DO,D2-送料信号1F,LIFT_D2_RunToFirst,5,PRO_AOI_IP_1,0,D2-送料信号1F,Y26,Y26,0
DO,D2-送料信号3F,LIFT_D2_RunToThird,6,PRO_AOI_IP_1,0,D2-送料信号3F,Y27,Y27,0
DO,D2-送料信号4F,LIFT_D2_RunToFourth,7,PRO_AOI_IP_1,0,D2-送料信号4F,Y28,Y28,0
DO,D2-送满成品料架,LIFT_D2_HasFullFinished,8,PRO_AOI_IP_1,0,D2-送满成品料架,Y29,Y29,0
,,,,,,,,,
DI,C1-任务应答,LIFT_C1_Response,0,PRO_AOI_IP_2,0,C1-任务应答,X31,X31,0
DI,C1-到达1F,LIFT_C1_AtFirst,1,PRO_AOI_IP_2,0,C1-到达1F,X32,X32,0
......
......@@ -55,6 +55,20 @@ namespace DeviceLibrary.Context
}
}
/// <summary>
/// 清空缓存
/// </summary>
/// <param name="liftId"></param>
public static void Clear(string liftId)
{
LiftInfo info = elevatorInfos.Find(s => s.liftId.Equals(liftId));
if (info != null)
{
elevatorInfos.Remove(info);
elevatorInfos.Add(new LiftInfo(liftId));
SaveLiftInfo();
}
}
public static string ToListInfos()
{
StringBuilder sb = new StringBuilder();
......@@ -94,6 +108,7 @@ namespace DeviceLibrary.Context
Common.LogUtil.error($"SaveLiftInfo Fail:{Common.JsonHelper.SerializeObject(elevatorInfos)}");
}
}
public static string RequestMsg = "";
/// <summary>
/// 请求电梯
/// </summary>
......@@ -115,6 +130,7 @@ namespace DeviceLibrary.Context
}
bool rtn = elevatorInfo.RequestUse(lift, out msg);
SaveLiftInfo();
RequestMsg = $"【{lift}】【{msg}】";
return rtn;
}
......@@ -140,6 +156,27 @@ namespace DeviceLibrary.Context
elevatorInfo.UpdateClient(clientStatus);
}
public static void UpdateFinishedInfo(FinishedInfo finished, out string msg)
{
msg = "ok";
if (elevatorInfos.Count == 0)
{
msg = "系统未添加电梯信息";
return;
}
LiftInfo elevatorInfo = elevatorInfos.Find(s => s.liftId.Equals(finished.liftId));
if (elevatorInfo == null)
{
msg = $"系统不存在该电梯标识:{finished.liftId}";
return;
}
if (finished.HasFullFinishedShelf)
elevatorInfo.OpenFinishedFullSig();
else
{
elevatorInfo.CloseFinishedFullSig();
}
}
/// <summary>
/// 获取电梯状态
/// </summary>
......
......@@ -72,6 +72,7 @@
<Compile Include="Models\ClientInfo.cs" />
<Compile Include="Models\LiftInfo.cs" />
<Compile Include="Models\Service\Request\DoorInfo.cs" />
<Compile Include="Models\Service\Request\FinishedInfo.cs" />
<Compile Include="Models\Service\Request\SendInInfo.cs" />
<Compile Include="Models\Service\Request\ClientStatus.cs" />
<Compile Include="Models\Service\Response\Status.cs" />
......
......@@ -15,7 +15,6 @@ namespace DeviceLibrary
{
public class AIOBOXManager : IOManager
{
public readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public Dictionary<string, AIOBOX> AIOMap = new Dictionary<string, AIOBOX>();
public Dictionary<string, List<Box_Sta>> DIValueMap = new Dictionary<string, List<Box_Sta>>();
......@@ -105,7 +104,7 @@ namespace DeviceLibrary
}
catch (Exception error)
{
LogUtil.error(LOGGER, "连接IO模块 " + logName + " 出错:" + error.ToString());
LogUtil.error("连接IO模块 " + logName + " 出错:" + error.ToString());
}
}
......@@ -269,12 +268,12 @@ namespace DeviceLibrary
}
else
{
LogUtil.error(LOGGER, "WriteSingleDO出错 没有连接IO模块:" + ioIp);
LogUtil.error( "WriteSingleDO出错 没有连接IO模块:" + ioIp);
}
}
catch (Exception ex)
{
LOGGER.Error("AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错啦:", ex);
LogUtil.error("AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错啦:", ex);
}
}
public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff, int mSeconds)
......@@ -294,11 +293,11 @@ namespace DeviceLibrary
try
{
aioBox.WriteDO(StartAddress, aioBox.ReverseStatus(currBox_Sta));
LogUtil.debug(LOGGER, "**********定时回写入 IO [" + ioIp + "] [" + StartAddress + "]值" + aioBox.ReverseStatus(currBox_Sta) + "】:");
LogUtil.debug("**********定时回写入 IO [" + ioIp + "] [" + StartAddress + "]值" + aioBox.ReverseStatus(currBox_Sta) + "】:");
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "**********定时回写入 出错:", ex);
LogUtil.error("**********定时回写入 出错:", ex);
}
};
mytimer.AutoReset = false;//设置是否自动重启,即自动执行多次;
......@@ -307,7 +306,7 @@ namespace DeviceLibrary
}
else
{
LogUtil.error(LOGGER, "AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错 没有连接IO模块:" + ioIp);
LogUtil.error( "AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错 没有连接IO模块:" + ioIp);
}
}
catch (Exception ex)
......@@ -435,7 +434,7 @@ namespace DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(LOGGER, " GetIOValue [" + configIO.IO_IP + "] [" + configIO.GetIOAddr() + "] 获取数据出错:", ex);
LogUtil.error(" GetIOValue [" + configIO.IO_IP + "] [" + configIO.GetIOAddr() + "] 获取数据出错:", ex);
}
return value;
}
......
......@@ -23,9 +23,16 @@ namespace DeviceLibrary
{
ConfigIO configIo = LineManager.Config.DOList[ioType];
instance.WriteSingleDO(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr(), ioValue);
Thread.Sleep(60);
if(!IOValue(ioType).Equals(ioValue))
instance.WriteSingleDO(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr(), ioValue);
// Thread.Sleep(60);
Task task = Task.Factory.StartNew(delegate
{
while (!IOValue(ioType).Equals(ioValue))
{
instance.WriteSingleDO(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr(), ioValue);
Thread.Sleep(1000);
}
});
task.Wait();
}
else
{
......
......@@ -26,7 +26,7 @@ namespace DeviceLibrary.Models
public bool Online { get
{
double upInterval = (DateTime.Now - lastUpdateTime).TotalSeconds;
if (upInterval > 5)
if (upInterval > 10)
return false;
return true;
} }
......
......@@ -154,6 +154,12 @@ namespace DeviceLibrary.Models
/// <returns>true:请求成功</returns>
public bool RequestUse(SendInInfo lift, out string msg)
{
msg = "ok";
if (lift.updateInfo)
{
Status.Set(lift);
return true;
}
if (IsIdle(out msg))
{
ClientInfo clientInfo = Clients.Find(s => s.sourceClient.Equals(lift.destinationClient));
......@@ -168,10 +174,25 @@ namespace DeviceLibrary.Models
return false;
}
if (!clientInfo.sourceClient.Equals("NEOTEL-1F")&& !clientInfo.hasIdleAgv)
//if (!clientInfo.sourceClient.Equals("NEOTEL-1F") && !clientInfo.hasIdleAgv)
//{
// msg = $"目标AGV系统无可用Agv:{lift.destinationClient}";
// return false;
//}
if (liftId.Equals("LIFT_D2"))
{
msg = $"目标AGV系统无可用Agv:{lift.destinationClient}";
return false;
if (IOManager.IOValue($"{liftId}{SettingString._HasEmptyFinished}").Equals(IO_VALUE.HIGH))
{
msg = $"{liftId}有移远成品空料架,暂不允许请求使用";
if (IOManager.IOValue($"{liftId}{SettingString._Response}").Equals(IO_VALUE.HIGH))
{
CloseCallFloor();
Status.Clear();
SetState(LiftState.Idle);
OpenAGVRequest(false);
}
return false;
}
}
if (IOManager.IOValue($"{liftId}{SettingString._AGVRequest}").Equals(IO_VALUE.HIGH))
{
......@@ -205,7 +226,7 @@ namespace DeviceLibrary.Models
{
SetState(LiftState.Busy);
Status.Set(lift);
OpenAGVLeave(5);
//OpenAGVLeave(5);
msg = "ok";
return true;
}
......@@ -229,6 +250,25 @@ namespace DeviceLibrary.Models
/// <returns></returns>
public bool AGVLeave(DoorInfo doorInfo)
{
if (doorInfo.force)
{
Task.Factory.StartNew(delegate
{
OpenAGVLeave(true);
Thread.Sleep(10000);
OpenAGVLeave(false);
//关闭送料信号
CloseSendFloor(doorInfo);
//关闭呼叫信号
CloseCallFloor();
OpenAGVRequest(false);
Status.Clear();
SetState(LiftState.Idle);
LogUtil.info($"AGV离开,【{doorInfo}】取出电梯内的成品料");
});
return true;
}
if (CanControl(doorInfo))
{
......@@ -241,7 +281,7 @@ namespace DeviceLibrary.Models
Status.Clear();
SetState(LiftState.Idle);
//是否继续使用电梯
OpenAGVRequest(doorInfo.continueUse);
OpenAGVRequest(false);
LogUtil.info($"AGV离开,【{doorInfo}】取出电梯内的产品,清除电梯占用");
}
......@@ -251,16 +291,51 @@ namespace DeviceLibrary.Models
CloseCallFloor(doorInfo);
//AGV离开信号,使得门关
CloseDoor();
if (!Status.destinationFloor.Equals(-1))
if (doorInfo.continueUse)
{
RunToFloor(Status.destinationFloor, doorInfo);
LogUtil.info($"AGV离开,【{doorInfo}】将产品送入电梯");
if (!Status.destinationFloor.Equals(-1))
{
RunToFloor(Status.destinationFloor, doorInfo);
LogUtil.info($"AGV离开,【{doorInfo}】将产品送入电梯");
}
}
else
{
Status.Clear();
SetState(LiftState.Idle);
CloseFinishedFullSig();
//是否继续使用电梯
OpenAGVRequest(false);
LogUtil.info($"AGV离开,【{doorInfo}】不继续使用电梯,清除电梯占用");
}
}
return true;
}
return false;
}
public bool OpenFinishedFullSig()
{
if (!liftId.Contains("D2"))
{
LogUtil.info($"{liftId}无送满料成品信号");
return false;
}
IOManager.IOMove($"{liftId}{SettingString._HasFullFinished}", IO_VALUE.HIGH);
LogUtil.info($"{liftId}打开送满料成品信号");
return true;
}
public bool CloseFinishedFullSig()
{
if (!liftId.Contains("D2"))
{
LogUtil.info($"{liftId}无送满料成品信号");
return false;
}
IOManager.IOMove($"{liftId}{SettingString._HasFullFinished}", IO_VALUE.LOW);
LogUtil.info($"{liftId}关闭送满料成品信号");
return true;
}
/// <summary>
/// 运行到指定楼层(送料信号)
/// </summary>
......@@ -391,9 +466,16 @@ namespace DeviceLibrary.Models
{
floor = 4;
}
if (liftId.Contains("D2"))
{
if (IOManager.IOValue($"{liftId}{SettingString._HasEmptyFinished}").Equals(IO_VALUE.HIGH))
Status.HasEmptyFinishedShelf = true;
else
Status.HasEmptyFinishedShelf = false;
}
Status.floor = floor;
if (IOManager.IOValue($"{liftId}{SettingString._DoorOpen}").Equals(IO_VALUE.HIGH))
if (IOManager.IOValue($"{liftId}{SettingString._DoorOpen}").Equals(IO_VALUE.HIGH))// && IOManager.IOValue($"{liftId}{SettingString._Response}").Equals(IO_VALUE.HIGH)
{
Status.door = "opened";
RunState = LiftRunState.DoorOpen;
......
......@@ -26,7 +26,8 @@ namespace DeviceLibrary.Models.Service.Request
/// <summary>
/// 继续使用电梯
/// </summary>
public bool continueUse {get;set;}=false;
public bool continueUse {get;set;}=true;
public bool force { get; set; } = false;
public override string ToString()
{
return $"{sourceClient}[{sourceFloor}][continue={continueUse}]:{liftId}";
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.Models.Service.Request
{
public class FinishedInfo
{
/// <summary>
/// 电梯标识
/// </summary>
public string liftId { get; set; } = "";
public bool HasFullFinishedShelf { get; set; } = false;
}
}
......@@ -11,6 +11,7 @@ namespace DeviceLibrary.Models.Service.Request
/// </summary>
public class SendInInfo
{
/// <summary>
/// 电梯标识
/// </summary>
......@@ -39,7 +40,10 @@ namespace DeviceLibrary.Models.Service.Request
/// 目的地点位
/// </summary>
public string destinationPoint { get; set; }
/// <summary>
/// 更新电梯信息
/// </summary>
public bool updateInfo { get; set; } = false;
public override string ToString()
{
return $"请求使用电梯[{liftId}]:[{sourceClient}][{sourceFloor}][{sourcePoint}]-->" +
......
......@@ -42,6 +42,10 @@ namespace DeviceLibrary.Models.Service.Response
/// 目的地点位
/// </summary>
public string destinationPoint { get; set; } = "";
/// <summary>
/// 成品空架子标识
/// </summary>
public bool HasEmptyFinishedShelf { get; set; } = false;
[JsonIgnore]
public bool Occupied { get { return !string.IsNullOrEmpty(sourceClient); } }
......
......@@ -35,6 +35,9 @@ namespace DeviceLibrary.Service
[OperationContract]
[WebInvoke(UriTemplate = "/lift/status", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
StatusResult status(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "/lift/finishedProdcut", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result finishedProdcut(Stream stream);
}
[DataContract]
internal class Result
......
......@@ -118,6 +118,27 @@ namespace DeviceLibrary.Service
}
return result;
}
public Result finishedProdcut(Stream stream)
{
Result result = new Result();
StreamReader sr = new StreamReader(stream);
string s = sr.ReadToEnd();
FinishedInfo info = JsonHelper.DeserializeJsonToObject<FinishedInfo>(s);
if (info == null)
{
result.code = -1;
result.msg = $"解析异常:{s}";
Log.Error($"sendIn 解析异常:{s}");
}
else
{
Context.LiftContext.UpdateFinishedInfo(info, out string msg);
LogInfo($"成品入库状态接口被调用:{info},[{msg}]");
result.msg = msg;
}
return result;
}
}
public class LiftService
......
......@@ -63,7 +63,11 @@ namespace LoadCSVLibrary
/// </summary>
[ConfigProAttribute("LIFT_D2_InRun", false)]
public string LIFT_D2_InRun { get; set; }
/// <summary>
/// DI,D2-运行中,D2_InRun,6,PRO_AOI_IP_1,0,D2-运行中,X27,X27,0
/// </summary>
[ConfigProAttribute("LIFT_D2__HasEmptyFinished", false)]
public string LIFT_D2__HasEmptyFinished { get; set; }
/// <summary>
/// DO,D2-AGV请求,D2_AGVRequest,0,PRO_AOI_IP_1,0,D2-AGV请求,Y21,Y21,0
......@@ -105,7 +109,11 @@ namespace LoadCSVLibrary
/// </summary>
[ConfigProAttribute("LIFT_D2_RunToFourth", false)]
public string LIFT_D2_RunToFourth { get; set; }
/// <summary>
/// DO,D2-送料信号4F,D2_RunToFourth,7,PRO_AOI_IP_1,0,D2-送料信号4F,Y27,Y27,0
/// </summary>
[ConfigProAttribute("LIFT_D2__HasFullFinished", false)]
public string LIFT_D2__HasFullFinished { get; set; }
/// <summary>
/// DI,C1-任务应答,LIFT_C1_Response,0,PRO_AOI_IP_2,0,C1-任务应答,X31,X31,0
/// </summary>
......
......@@ -56,6 +56,10 @@ namespace LoadCSVLibrary
/// </summary>
public static string LIFT_D2_InRun = "LIFT_D2_InRun";
/// <summary>
/// DI,D2-回收空成品料架,LIFT_D2__HasEmptyFinished,7,PRO_AOI_IP_1,0,D2-回收空成品料架,X28,X28,0
/// </summary>
public static string LIFT_D2_HasEmptyFinished = "LIFT_D2_HasEmptyFinished";
/// <summary>
/// DO,D2-AGV请求,D2_AGVRequest,0,PRO_AOI_IP_1,0,D2-AGV请求,Y21,Y21,0
/// </summary>
public static string LIFT_D2_AGVRequest = "LIFT_D2_AGVRequest";
......@@ -89,6 +93,10 @@ namespace LoadCSVLibrary
///DO,D2-送料信号4F,D2_RunToFourth,7,PRO_AOI_IP_1,0,D2-送料信号4F,Y27,Y27,0
/// </summary>
public static string LIFT_D2_RunToFourth = "LIFT_D2_RunToFourth";
/// <summary>
/// DO,D2-送满成品料架,LIFT_D2__HasFullFinished,8,PRO_AOI_IP_1,0,D2-送满成品料架,Y29,Y29,0
/// </summary>
public static string LIFT_D2_HasFullFinished = "LIFT_D2_HasFullFinished";
#endregion
#region C1电梯
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!