Commit c25d1b3f LN

上料装置移栽料盘后需要扫码

1 个父辈 e6215305
正在显示 30 个修改的文件 包含 299 行增加272 行删除
......@@ -211,7 +211,7 @@ namespace OnlineStore.AssemblyLine
portName = equipBean.Config.Batch_Axis.DeviceName;
SlvAddr = equipBean.Config.Batch_Axis.GetAxisValue();
txtAxisDeviceName.Text = portName;
txtSlaveId.Text = SlvAddr.ToString();
// txtSlaveId.Text = SlvAddr.ToString();
txtAxisValue.Text = SlvAddr.ToString();
comboBox1.Items.Clear();
comboBox1.Items.Add(equipBean.Config.Batch_Axis.Explain);
......@@ -596,20 +596,20 @@ namespace OnlineStore.AssemblyLine
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex.Equals(1))
if (comboBox1.SelectedIndex.Equals(0))
{
portName = equipBean.Config.UpDown_Axis.DeviceName;
SlvAddr = equipBean.Config.UpDown_Axis.GetAxisValue();
portName = equipBean.Config.Batch_Axis.DeviceName;
SlvAddr = equipBean.Config.Batch_Axis.GetAxisValue();
txtAxisDeviceName.Text = portName;
txtSlaveId.Text = SlvAddr.ToString();
// txtSlaveId.Text = SlvAddr.ToString();
txtAxisValue.Text = SlvAddr.ToString();
}
else if (comboBox1.SelectedIndex.Equals(1))
{
portName = equipBean.Config.Batch_Axis.DeviceName;
SlvAddr = equipBean.Config.Batch_Axis.GetAxisValue();
portName = equipBean.Config.UpDown_Axis.DeviceName;
SlvAddr = equipBean.Config.UpDown_Axis.GetAxisValue();
txtAxisDeviceName.Text = portName;
txtSlaveId.Text = SlvAddr.ToString();
// txtSlaveId.Text = SlvAddr.ToString();
txtAxisValue.Text = SlvAddr.ToString();
}
......
......@@ -199,12 +199,11 @@ namespace OnlineStore.AssemblyLine
portName = equipBean.Config.UpDown_Axis.DeviceName;
SlvAddr = equipBean.Config.UpDown_Axis.GetAxisValue();
txtAxisDeviceName.Text = portName;
txtSlaveId.Text = SlvAddr.ToString();
txtAxisValue.Text = SlvAddr.ToString();
comboBox1.Items.Clear();
comboBox1.Items.Add(equipBean.Config.UpDown_Axis.Explain);
comboBox1.SelectedIndex = 0;
txtAxisValue.Text = SlvAddr.ToString();
btnUpDownUp.Visible = false;
}
else
......
......@@ -68,7 +68,6 @@
<Compile Include="util\NetTCPServer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="util\ScanCodeManager.cs" />
<Compile Include="util\TcpClient.cs" />
<Compile Include="util\TcpServer.cs" />
<Compile Include="util\UdpServer.cs" />
......
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace OnlineStore.Common
{
/// <summary>
/// 扫码枪管理类
/// </summary>
public class ScanCodeManager
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// 处理接收后的二维码
/// </summary>
/// <param name="message"></param>
/// <returns></returns>
public static string ReplaceCode(string message)
{
message = message.Trim();
message = message.Replace("\r", "");
message = message.Replace("\n", "");
char a = (char)02;
message = message.Replace(a.ToString(), "");
message = message.Trim();
System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
byte[] bytes = asciiEncoding.GetBytes(message);
List<byte> newBytes =new List<byte> ();
foreach (byte by in bytes)
{
if (!by.Equals(24))
{
newBytes.Add(by);
}
}
message = asciiEncoding.GetString(newBytes.ToArray());
//if (message.Length == 1)
//{
// try
// {
// int intAsciiCode = (int)asciiEncoding.GetBytes(message)[0];
// if (intAsciiCode.Equals(24))
// {
// return "";
// }
// }
// catch (Exception ex)
// {
// LOGGER.Error(ex);
// }
//}
return message;
}
}
}
......@@ -62,14 +62,15 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="assemblyLine\ALineManager.cs" />
<Compile Include="assemblymanager\ALineManager.cs" />
<Compile Include="assemblyLine\DischargeLine.cs" />
<Compile Include="assemblyLine\DischargeLine_Partial.cs" />
<Compile Include="assemblyLine\ProvidingEquip_Partial.cs" />
<Compile Include="assemblyLine\FeedingEquip_Partial.cs" />
<Compile Include="assemblyLine\ProvidingEquip.cs" />
<Compile Include="assemblyLine\FeedingEquip.cs" />
<Compile Include="assemblyLine\TrayManager.cs" />
<Compile Include="assemblymanager\StoreServerManager.cs" />
<Compile Include="assemblymanager\TrayManager.cs" />
<Compile Include="deviceLibrary\halcon\CodeManager.cs" />
<Compile Include="deviceLibrary\IO\AIOBOX\AIOBOXManager.cs" />
<Compile Include="deviceLibrary\IO\IOManager.cs" />
......
......@@ -5,7 +5,7 @@ PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,对应的横移模块,SidesWayNum,1,,,,,
PRO,0,是否是用来出料,IsCanOut,0,,,,,
,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,2,COM1,1,,,
AXIS,0,提升上料轴,Batch_Axis,1,COM1,0,,,
PRO,0,提升上料轴原位待机点 P1,BatchAxisP1,1000,,,,,
PRO,0,提升上料轴下降位置P2,BatchAxisP2,10000,,,,,
PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,500,,,,,
......@@ -20,7 +20,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,400,,,,,
PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,50,,,,,
PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,5000,,,,,
,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,1,COM1,2,,,
AXIS,0,移栽上下轴,UpDown_Axis,2,COM1,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,20000,,,,,
PRO,0,移栽上下轴在移栽上下降的位置P2集合,UpDownPositionsP2,0=180000;,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
......
......@@ -5,7 +5,7 @@ PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,对应的横移模块,SidesWayNum,0,,,,,
PRO,0,是否是用来出料,IsCanOut,0,,,,,
,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,2,COM1,3,,,
AXIS,0,提升上料轴,Batch_Axis,3,COM1,0,,,
PRO,0,提升上料轴原位待机点 P1,BatchAxisP1,1000,,,,,
PRO,0,提升上料轴下降位置P2,BatchAxisP2,10000,,,,,
PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,500,,,,,
......@@ -20,7 +20,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,400,,,,,
PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,50,,,,,
PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,5000,,,,,
,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,1,COM1,4,,,
AXIS,0,移栽上下轴,UpDown_Axis,4,COM1,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,20000,,,,,
PRO,0,移栽上下轴在移栽上下降的位置P2集合,UpDownPositionsP2,0=180000;,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
......
......@@ -5,7 +5,7 @@ PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,对应的横移模块,SidesWayNum,2,,,,,
PRO,0,是否是用来出料,IsCanOut,0,,,,,
,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,2,COM1,5,,,
AXIS,0,提升上料轴,Batch_Axis,5,COM1,0,,,
PRO,0,提升上料轴原位待机点 P1,BatchAxisP1,1000,,,,,
PRO,0,提升上料轴下降位置P2,BatchAxisP2,10000,,,,,
PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,500,,,,,
......@@ -20,7 +20,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,400,,,,,
PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,50,,,,,
PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,5000,,,,,
,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,1,COM1,6,,,
AXIS,0,移栽上下轴,UpDown_Axis,6,COM1,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,20000,,,,,
PRO,0,移栽上下轴在移栽上下降的位置P2集合,UpDownPositionsP2,0=180000;,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
......
......@@ -5,7 +5,7 @@ PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,对应的横移模块,SidesWayNum,3,,,,,
PRO,0,是否是用来出料,IsCanOut,1,,,,,
,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,2,COM1,7,,,
AXIS,0,提升上料轴,Batch_Axis,7,COM1,0,,,
PRO,0,提升上料轴原位待机点 P1,BatchAxisP1,1000,,,,,
PRO,0,提升上料轴下降位置P2,BatchAxisP2,10000,,,,,
PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,500,,,,,
......@@ -20,7 +20,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,400,,,,,
PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,50,,,,,
PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,5000,,,,,
,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,1,COM1,8,,,
AXIS,0,移栽上下轴,UpDown_Axis,8,COM1,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,20000,,,,,
PRO,0,移栽上下轴在移栽上下降的位置P2集合,UpDownPositionsP2,0=180000;,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
......
......@@ -4,7 +4,7 @@ PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,移栽上下轴在移栽上下降的位置,UpDownPositions,0=180000;,,,,,,
PRO,0,移栽上下轴在料仓门口下降的位置,UpDownBoxPositions,0=116000;,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,2,COM2,2,,,
AXIS,0,移栽上下轴,UpDown_Axis,2,COM2,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,20000,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
PRO,0,移栽上下轴加速度,UpdownAxis_AddSpeed,400,,,,,
......
......@@ -4,7 +4,7 @@ PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,移栽上下轴在移栽上下降的位置,UpDownPositions,0=180000;,,,,,
PRO,0,移栽上下轴在料仓门口下降的位置,UpDownBoxPositions,0=116000;,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,3,COM2,3,,,
AXIS,0,移栽上下轴,UpDown_Axis,3,COM2,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,20000,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
PRO,0,移栽上下轴加速度,UpdownAxis_AddSpeed,400,,,,,
......
......@@ -4,7 +4,7 @@ PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,移栽上下轴在移栽上下降的位置,UpDownPositions,0=180000;,,,,,,
PRO,0,移栽上下轴在料仓门口下降的位置,UpDownBoxPositions,0=116000;,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,4,COM2,4,,,
AXIS,0,移栽上下轴,UpDown_Axis,4,COM2,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,20000,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
PRO,0,移栽上下轴加速度,UpdownAxis_AddSpeed,400,,,,,
......
......@@ -4,7 +4,7 @@ PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,移栽上下轴在移栽上下降的位置,UpDownPositions,0=180000;,,,,,
PRO,0,移栽上下轴在料仓门口下降的位置,UpDownBoxPositions,0=116000;,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,5,COM2,5,,,
AXIS,0,移栽上下轴,UpDown_Axis,5,COM2,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,20000,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
PRO,0,移栽上下轴加速度,UpdownAxis_AddSpeed,400,,,,,
......
......@@ -4,7 +4,7 @@ PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,移栽上下轴在移栽上下降的位置,UpDownPositions,0=180000;,,,,,,
PRO,0,移栽上下轴在料仓门口下降的位置,UpDownBoxPositions,0=116000;,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,6,COM2,6,,,
AXIS,0,移栽上下轴,UpDown_Axis,6,COM2,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,20000,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
PRO,0,移栽上下轴加速度,UpdownAxis_AddSpeed,400,,,,,
......
......@@ -4,7 +4,7 @@ PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,移栽上下轴在移栽上下降的位置,UpDownPositions,0=180000;,,,,,
PRO,0,移栽上下轴在料仓门口下降的位置,UpDownBoxPositions,0=116000;,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,7,COM2,7,,,
AXIS,0,移栽上下轴,UpDown_Axis,7,COM2,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,20000,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
PRO,0,移栽上下轴加速度,UpdownAxis_AddSpeed,400,,,,,
......
......@@ -4,7 +4,7 @@ PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,移栽上下轴在移栽上下降的位置,UpDownPositions,0=180000;,,,,,,
PRO,0,移栽上下轴在料仓门口下降的位置,UpDownBoxPositions,0=116000;,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,8,COM2,8,,,
AXIS,0,移栽上下轴,UpDown_Axis,8,COM2,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,20000,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
PRO,0,移栽上下轴加速度,UpdownAxis_AddSpeed,400,,,,,
......
......@@ -4,7 +4,7 @@ PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,移栽上下轴在移栽上下降的位置,UpDownPositions,0=180000;,,,,,
PRO,0,移栽上下轴在料仓门口下降的位置,UpDownBoxPositions,0=116000;,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,9,COM2,9,,,
AXIS,0,移栽上下轴,UpDown_Axis,9,COM2,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,20000,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
PRO,0,移栽上下轴加速度,UpdownAxis_AddSpeed,400,,,,,
......
......@@ -4,7 +4,7 @@ PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
PRO,0,移栽上下轴在移栽上下降的位置,UpDownPositions,0=180000;,,,,,,
PRO,0,移栽上下轴在料仓门口下降的位置,UpDownBoxPositions,0=116000;,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,10,COM2,10,,,
AXIS,0,移栽上下轴,UpDown_Axis,10,COM2,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,20000,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
PRO,0,移栽上下轴加速度,UpdownAxis_AddSpeed,400,,,,,
......
......@@ -29,6 +29,13 @@ namespace OnlineStore.DeviceLibrary
return result;
}
}
else if (wait.WaitType.Equals(WaitEnum.W102_FeedScanCode))
{
if (LastCodeList.Count > 0)
{
return true;
}
}
return false;
}
#region 托盘检测
......@@ -143,7 +150,7 @@ namespace OnlineStore.DeviceLibrary
{
LogInfo(SecondMoveInfo.MoveNum + "***************上个托盘号【" + preTrayNum + "】,当前" + (isFull ? "有料托盘" : "空托盘") + "【" + currMoveTrayNum + "】没有出入料任务,放盘通过~");
CheckLog("托盘放行 SecondStoreMove:(MO_14_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_WaitCanGo);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
}
}
else
......@@ -191,8 +198,8 @@ namespace OnlineStore.DeviceLibrary
}
else
{
CheckLog("托盘检测 SecondStoreMove:(MO_12_LoactionCylinder_Down ,托盘号【" + currMoveTrayNum + "】,直接放盘通过,定位气缸下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_12_LoactionCylinder_Down);
CheckLog("托盘检测 SecondStoreMove:(MO_13_LoactionCylinder_Down ,托盘号【" + currMoveTrayNum + "】,直接放盘通过,定位气缸下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_13_LoactionCylinder_Down);
CylinderMove(SecondMoveInfo, IO_Type.SW_LocationCylinder_Up, IO_Type.SW_LocationCylinder_Down);
}
......@@ -206,10 +213,23 @@ namespace OnlineStore.DeviceLibrary
#endregion
#region 不需要出出料,直接放行
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_12_LoactionCylinder_Down))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_12_MoveOk))
{
//更新托盘条码信息
string code = CodeManager.ProcessCode(LastCodeList);
TrayManager.UpdateTrayCode(currMoveTrayNum, code);
//从服务器获取库位号
string result = StoreServerManager.CodeReceived(Name, currMoveTrayNum, code, LastHeight, LastWidth);
if (!result.Equals("")) { LogUtil.error(result); }
InStoreLog(" SecondStoreMove=MO_12_LoactionCylinder_Down 上料横移机构上升,托盘开始放行,定位气缸下降");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_13_LoactionCylinder_Down);
CylinderMove(SecondMoveInfo, IO_Type.SW_LocationCylinder_Up, IO_Type.SW_LocationCylinder_Down);
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_13_LoactionCylinder_Down))
{
CheckLog("托盘检测 SecondStoreMove:(MO_13_TopCylinder_Down ,托盘号【" + currMoveTrayNum + "】,直接放盘通过,顶升气缸下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_13_TopCylinder_Down);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopCylinder_Down);
if (Config.SidesWayNum > 0)
{
CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Up, IO_Type.SW_TopCylinder_Down);
......@@ -219,7 +239,7 @@ namespace OnlineStore.DeviceLibrary
CylinderMove(SecondMoveInfo, IO_Type.FL_TopCylinder_Up, IO_Type.FL_TopCylinder_Down);
}
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_13_TopCylinder_Down))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_14_TopCylinder_Down))
{
if (Config.SidesWayNum > 0)
{
......@@ -232,32 +252,32 @@ namespace OnlineStore.DeviceLibrary
else
{
CheckLog("托盘放行 SecondStoreMove:(MO_14_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_WaitCanGo);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
}
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_14_WaitCanGo))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_15_WaitCanGo))
{
CheckLog("托盘放行 SecondStoreMove:(MO_15_StopCylinder2_Down ,阻挡气缸1-2下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_StopCylinder2_Down);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_16_StopCylinder2_Down);
IOMove(IO_Type.FL_StopCylinder_Down2, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_StopCylinder_Down2, IO_VALUE.HIGH));
// SecondMoveInfo.EndStepWait();
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_15_StopCylinder2_Down))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_16_StopCylinder2_Down))
{
CheckLog("托盘放行 SecondStoreMove:(MO_16_Tray_Check , 阻挡2托盘检测=0), 延时2秒)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_16_Tray_Check);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_17_Tray_Check);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.LOW));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_16_Tray_Check))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_17_Tray_Check))
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_17_StopCylinder_Back);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_18_StopCylinder_Back);
CheckLog("托盘放行 SecondStoreMove:(MO_17_StopCylinder_Back ,FL阻挡2上升 )");
IOMove(IO_Type.FL_StopCylinder_Down2, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_StopCylinder_Down2, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_17_StopCylinder_Back))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_18_StopCylinder_Back))
{
preTrayNum = currMoveTrayNum;
CheckLog("托盘放行 SecondStoreMove:(托盘放行结束) ");
......@@ -550,12 +570,24 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_21_UpDownAxisToP1))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_22_MoveCylinder_Up);
InStoreLog(" FI_22_MoveCylinder_Up 料盘移栽:上料横移机构上升,托盘开始放行,");
InStoreLog(" FI_22_MoveCylinder_Up 料盘移栽:上料横移机构上升,记录托盘尺寸, 开始放行,");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Down, IO_Type.SL_MoveCylinder_Up);
InStoreLog(" SecondStoreMove=MO_12_LoactionCylinder_Down 上料横移机构上升,托盘开始放行,定位气缸下降");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_12_LoactionCylinder_Down);
CylinderMove(SecondMoveInfo, IO_Type.SW_LocationCylinder_Up, IO_Type.SW_LocationCylinder_Down);
TrayManager.UpdateTrayInfo(currMoveTrayNum, true, 1, "", "", LastHeight, LastWidth);
LastCodeList = new List<string>();
InStoreLog(" SecondStoreMove=MO_12_MoveOk 开始扫码");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_12_MoveOk);
MoveInfo.WaitList.Add(WaitResultInfo.WaitFeedScanCode());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000));
Task.Factory.StartNew(delegate
{
LastCodeList = CodeManager.CameraScan(Config.GetCameraList());
if (LastCodeList.Count <= 0)
{
LastCodeList = CodeManager.CameraScan(Config.GetCameraList());
}
});
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_22_MoveCylinder_Up))
{
......@@ -601,15 +633,17 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.HIGH);
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO( IO_Type.SL_Out_Check, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SL_Out_Check, IO_VALUE.HIGH));
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_36_SideWayLineRun))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_37_LineStop);
InStoreLog(" FI_37_LineStop 上料完成, 料架到达出口,线体横移电机停止");
InStoreLog(" FI_37_LineStop 上料完成, 料架到达出口,线体横移电机停止 ");
IOMove(IO_Type.SL_LocationSideWay_Run, IO_VALUE.LOW);
IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_37_LineStop))
{
......@@ -664,6 +698,7 @@ namespace OnlineStore.DeviceLibrary
private int EndMovePosition = 0;
private int LastHeight = 0;
private int LastWidth = 0;
private List<string> LastCodeList = new List<string>();
private int GetHeight()
{
int AxisChangeValue = Config.Height_ChangeValue;
......
......@@ -824,105 +824,12 @@ namespace OnlineStore.DeviceLibrary
}
return true;
}
private void onCodeReceived(string message,int height,int width)
{
try
{
message = ScanCodeManager.ReplaceCode(message);
if (String.IsNullOrEmpty(message))
{
isNotScanCode = true;
LogUtil.info( Name + "没有收到二维码信息,请重新放入料盘");
return;
}
isNotScanCode = false;
if (runStatus.Equals(LineRunStatus.Wait))
{
LogUtil.info( Name + "收到二维码<< " + message + ",暂未开启,不需要发送服务器");
return;
}
//http://localhost/myproject/service/store/emptyPosForPutin
// 参数:cids: 多个 cid
//code: 条码内容
string server = ConfigAppSettings.GetValue(Setting_Init.http_server) + "?cids=" + LineServer.GetAllCID() + "&code=%3D" + message;
LogUtil.info( Name + "收到二维码<< " + message + ",获取入库PosID:"+server);
//发送扫码内容到服务器进行入库操作
// Operation operation =LineServer.GetInStoreOperation(message);
// LineGetPosOp op = new LineGetPosOp(LineServer.GetAllCID(), message);
string resultStr = HttpHelper.Post(server, "");
LineOperation serverResult = JsonHelper.DeserializeJsonToObject<LineOperation>(resultStr);
if (serverResult == null)
{
LogUtil.info( Name + "二维码【" + message + "】没有收到服务器反馈!");
return;
}
else if ((!string.IsNullOrEmpty(serverResult.msg)) || serverResult.result.Equals(0).Equals(false))
{
//如果有提示消息,直接显示提示
LogUtil.error( "服务器反馈 二维码【" + message + "】 :" + serverResult.msg);
return;
}
if (!serverResult.pos.Equals(""))
{
string posId = serverResult.pos;
int plateW = width;
int plateH =height;
string[] posArray = posId.Split('#');
if (!(posArray.Length == 2))
{
WarnMsg = Name + "入库库位格式错误:二维码【" + message + "】库位【" + posId + "】";
LogUtil.error( "服务器反馈 入库库位格式错误:二维码【" + message + "】库位【" + posId + "】");
return;
}
//判断盘是否过高(7*8的盘需要判断,如果盘过高,不让盘通过,直接显示报警信息)
int storeId = int.Parse(posArray[0]);
//根据库位号查找移栽
MoveEquip moveEquip = MoveEquipMap[storeId];
//取盘号
string wareNum = serverResult.barcode ;
int trayCode = TrayManager.GetTrayNum(0);
LogUtil.info( "更新盘空满信息,托盘号【" + trayCode + "】,是否有料盘【" + true + "】,出库入库【" + 1 + "】");
TrayManager.UpdateFixtureValue(trayCode, true, ReelType.InStore,wareNum,posId,plateH,plateW);
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
if (LineServer.BoxCanInStore(moveEquip.DeviceID))
{
InOutParam param = new InOutParam(trayCode, wareNum, posId, plateH, plateW);
// 判断PosID是否已经在入库或者在排队列表中,如果已经存在,加入列表失败
if (IsReviceInPosId(moveEquip, posId))
{
WarnMsg = moveEquip.Name + "入库库位重复: " + param.ToStr() + " ,入库失败!";
moveEquip.WarnMsg = WarnMsg;
LogUtil.info( "收到服务器入库命令 " + WarnMsg);
return;
}
LineServer.CheckInStorePos(storeId, param);
StartInStoreMove(param);
}
}
}
catch (Exception ex)
{
LogUtil.error(Name +" "+ ex.ToString());
}
}
/// <summary>
///是否已经接收到过出库信息
///</summary>
private bool IsReviceInPosId(MoveEquip moveEquip, string posId)
public bool IsReviceInPosId(MoveEquip moveEquip, string posId)
{
bool isReviceInfo = false;
if (moveEquip.MoveInfo.MoveType.Equals(LineMoveType.InStore) && moveEquip.MoveInfo.MoveParam != null && moveEquip.MoveInfo.MoveParam.PosId.Equals(posId))
......
......@@ -547,6 +547,7 @@ namespace OnlineStore.DeviceLibrary
//}
}
#endregion
#region IO操作
......@@ -624,23 +625,6 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.SW4_MotorRun, IO_VALUE.LOW);
}
///// <summary>
///// 判断横移轨道23是否有托盘
///// </summary>
///// <returns></returns>
//public bool SideWay23HasTray()
//{
// //正在横移中,且托盘顶升气缸未下降
// if (SW23_MoveInfo.MoveType.Equals(LineMoveType.None).Equals(false) && SW23_MoveInfo.MoveStep <= LineMoveStep.SW07_TopCylinderDown)
// {
// return true;
// }
// if (IOValue(IO_Type.SW2_TrayCheck).Equals(IO_VALUE.HIGH)&&IOValue(IO_Type.SW3_TrayCheck).Equals(IO_VALUE.LOW))
// {
// return true;
// }
// return false;
//}
private DateTime SideWay41Ntime = DateTime.Now;
private bool SideWay41IsWait = false;
private DateTime SideWay23Ntime = DateTime.Now;
......
......@@ -143,7 +143,7 @@ namespace OnlineStore.DeviceLibrary
int bagWidth = MoveInfo.MoveParam.PlateW;
LogInfo("【" + posId + "】出库时,更新盘空满信息 托盘号【" + MoveInfo.MoveParam.TrayNumber + "】,是否有料盘【" + true + "】,出库入库【" + 2 + "】");
TrayManager.UpdateFixtureValue(MoveInfo.MoveParam.TrayNumber, true, ReelType.OutStore, MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PosId, MoveInfo.MoveParam.PlateH, bagWidth);
TrayManager.UpdateTrayInfo(MoveInfo.MoveParam.TrayNumber, true, ReelType.OutStore, MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PosId, MoveInfo.MoveParam.PlateH, bagWidth);
//出库全部完成
lineStatus = LineStatus.StoreOnline;
......@@ -162,7 +162,7 @@ namespace OnlineStore.DeviceLibrary
TrayManager.DelNeedEmptyTrayNum();
OutStoreLog("出库 SecondMove:移栽完成,放行托盘");
SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_13_TopCylinder_Down);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopCylinder_Down);
CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
LogInfo("【" + posId + "】出库处理结束,!");
......@@ -249,12 +249,12 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(LineMoveStep.MI_10_WaitBox);
LogInfo("入库【" + posId + "】处理(等待移栽):(判断box门口没有盘, 且可以入库),更新盘号【" + num + "】为空盘");
MoveInfo.WaitList.Add(WaitResultInfo.WaitBoxCanReviceTray());
TrayManager.UpdateFixtureValue(num );
TrayManager.UpdateTrayInfo(num );
//阻挡气缸移动
InStoreLog("放托盘(放开阻挡):SecondMove=MO_13_TopCylinder_Down 物品已移走,顶升气缸1下降)");
SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_13_TopCylinder_Down);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopCylinder_Down);
CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_10_WaitBox))
......@@ -530,7 +530,7 @@ namespace OnlineStore.DeviceLibrary
TrayManager.UpdateTrayNumError(-1, "");
}
CheckLog("托盘放行 SecondMove:(MO_14_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_WaitCanGo);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
if (DeviceID.Equals(2))
{
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
......@@ -587,7 +587,7 @@ namespace OnlineStore.DeviceLibrary
TrayManager.UpdateTrayNumError(-1, "");
}
CheckLog("托盘检测 SecondMove:(MO_13_TopCylinder_Down ,托盘号【" + currMoveTrayNum + "】,直接放盘通过,顶升气缸下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_13_TopCylinder_Down);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopCylinder_Down);
CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
}
......@@ -601,10 +601,10 @@ namespace OnlineStore.DeviceLibrary
#endregion
#region 不需要出入库,直接放行
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_13_TopCylinder_Down))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_14_TopCylinder_Down))
{
CheckLog("托盘放行 SecondMove:(MO_14_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_WaitCanGo);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
if (DeviceID.Equals(2))
{
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
......@@ -613,29 +613,29 @@ namespace OnlineStore.DeviceLibrary
}
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_14_WaitCanGo))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_15_WaitCanGo))
{
CheckLog("托盘放行 SecondMove:(MO_15_StopCylinder2_Down ,阻挡气缸1-2下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_StopCylinder2_Down);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_16_StopCylinder2_Down);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH));
// SecondMoveInfo.EndStepWait();
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_15_StopCylinder2_Down))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_16_StopCylinder2_Down))
{
CheckLog("托盘放行 SecondMove:(MO_16_Tray_Check , 阻挡2托盘检测=0), 延时2秒)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_16_Tray_Check);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_17_Tray_Check);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.LOW));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_16_Tray_Check))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_17_Tray_Check))
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_17_StopCylinder_Back);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_18_StopCylinder_Back);
CheckLog("托盘放行 SecondMove:(MO_17_StopCylinder_Back , 阻挡气缸1-2上升 )");
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_17_StopCylinder_Back))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_18_StopCylinder_Back))
{
preTrayNum = currMoveTrayNum;
CheckLog("托盘放行 SecondMove:(托盘放行结束) ");
......
......@@ -129,7 +129,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo(SecondMoveInfo.MoveNum + "***************上个托盘号【" + preTrayNum + "】,当前" + (isFull ? "有料托盘" : "空托盘") + "【" + currMoveTrayNum + "】没有出入料任务,放盘通过~");
CheckLog("托盘放行 SecondMove:(MO_14_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_WaitCanGo);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
}
}
else
......@@ -166,37 +166,37 @@ namespace OnlineStore.DeviceLibrary
#endregion
#region 不需要出出料,直接放行
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_13_TopCylinder_Down))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_14_TopCylinder_Down))
{
CheckLog("托盘放行 SecondMove:(MO_14_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_WaitCanGo);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
//更新横移托盘已处理完成
TrayManager.UpdateSWState(Config.SidesWayNum, 1);
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_14_WaitCanGo))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_15_WaitCanGo))
{
CheckLog("托盘放行 SecondMove:(MO_15_StopCylinder2_Down ,阻挡气缸1-2下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_StopCylinder2_Down);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_16_StopCylinder2_Down);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH));
// SecondMoveInfo.EndStepWait();
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_15_StopCylinder2_Down))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_16_StopCylinder2_Down))
{
CheckLog("托盘放行 SecondMove:(MO_16_Tray_Check , 阻挡2托盘检测=0), 延时2秒)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_16_Tray_Check);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_17_Tray_Check);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.LOW));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_16_Tray_Check))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_17_Tray_Check))
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_17_StopCylinder_Back);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_18_StopCylinder_Back);
CheckLog("托盘放行 SecondMove:(MO_17_StopCylinder_Back , 阻挡气缸1-2上升 )");
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_17_StopCylinder_Back))
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_18_StopCylinder_Back))
{
preTrayNum = currMoveTrayNum;
CheckLog("托盘放行 SecondMove:(托盘放行结束) ");
......@@ -277,12 +277,12 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(LineMoveStep.PO_05_WaitBox);
LogInfo("出料PO_05_WaitBox【" + posId + "】处理(等待可以移栽) 更新盘号【" + num + "】为空盘");
MoveInfo.WaitList.Add(WaitResultInfo.WaitBoxCanReviceTray());
TrayManager.UpdateFixtureValue(num );
TrayManager.UpdateTrayInfo(num );
//阻挡气缸移动
InStoreLog("放托盘(放开阻挡):SecondMoveInfo=MO_13_TopCylinder_Down 物品已移走,顶升气缸1下降)");
SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_13_TopCylinder_Down);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopCylinder_Down);
if (Config.SidesWayNum <= 0)
{
CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
......
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class StoreServerManager
{
public static string CodeReceived(string deviceName, int trayNum, string codeStr, int height, int width)
{
string msg = "";
try
{
if (String.IsNullOrEmpty(codeStr))
{
return msg = deviceName + "托盘【" + trayNum + "】 没有扫码到条码";
}
if (LineManager.Line.runStatus.Equals(LineRunStatus.Wait))
{
return msg = deviceName + "托盘【" + trayNum + "】 收到条码<< " + codeStr + ",暂未开启,不需要发送服务器";
}
//http://localhost/myproject/service/store/emptyPosForPutin
// 参数:cids: 多个 cid
//code: 条码内容
string server = ConfigAppSettings.GetValue(Setting_Init.http_server) + "?cids=" + LineServer.GetAllCID() + "&code=%3D" + codeStr;
LogUtil.info(deviceName + "托盘【" + trayNum + "】 收到条码<< " + codeStr + ",获取入库PosID:" + server);
//发送扫码内容到服务器进行入库操作
// Operation operation =LineServer.GetInStoreOperation(codeStr);
// LineGetPosOp op = new LineGetPosOp(LineServer.GetAllCID(), codeStr);
string resultStr = HttpHelper.Post(server, "");
LineOperation serverResult = JsonHelper.DeserializeJsonToObject<LineOperation>(resultStr);
if (serverResult == null)
{
return msg = deviceName + "托盘【" + trayNum + "】 条码【" + codeStr + "】没有收到服务器反馈";
}
else if ((!string.IsNullOrEmpty(serverResult.msg)) || serverResult.result.Equals(0).Equals(false))
{
return msg = deviceName + "托盘【" + trayNum + "】 条码【" + codeStr + "】 :" + serverResult.msg;
}
if (!serverResult.pos.Equals(""))
{
string posId = serverResult.pos;
int plateW = width;
int plateH = height;
string[] posArray = posId.Split('#');
if (!(posArray.Length == 2))
{
return msg = deviceName + "托盘【" + trayNum + "】 入库库位格式错误:条码【" + codeStr + "】库位【" + posId + "】";
}
//判断盘是否过高(7*8的盘需要判断,如果盘过高,不让盘通过,直接显示报警信息)
int storeId = int.Parse(posArray[0]);
//根据库位号查找移栽
MoveEquip moveEquip =LineManager.Line.MoveEquipMap[storeId];
//取盘号
string wareNum = serverResult.barcode;
int trayCode = TrayManager.GetTrayNum(0);
LogUtil.info("更新盘空满信息,托盘号【" + trayCode + "】,是否有料盘【" + true + "】,出库入库【" + 1 + "】");
TrayManager.UpdateTrayInfo(trayCode, true, ReelType.InStore, wareNum, posId, plateH, plateW);
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
if (LineServer.BoxCanInStore(moveEquip.DeviceID))
{
InOutParam param = new InOutParam(trayCode, wareNum, posId, plateH, plateW);
// 判断PosID是否已经在入库或者在排队列表中,如果已经存在,加入列表失败
if (LineManager.Line.IsReviceInPosId(moveEquip, posId))
{
LineManager.Line. WarnMsg = "入库库位重复: " + param.ToStr() + " ,入库失败!";
moveEquip.WarnMsg = "入库库位重复: " + param.ToStr() + " ,入库失败!";
return msg=("收到服务器入库命令 " + "入库库位重复: " + param.ToStr() + " ,入库失败!" );
}
LineServer.CheckInStorePos(storeId, param);
//StartInStoreMove(param);
TrayManager.UpdateTrayInfo(trayCode,true,1, codeStr,posId,plateH,plateW);
}
}
}
catch (Exception ex)
{
LogUtil.error(deviceName + " " + ex.ToString());
}
return "";
}
}
}
......@@ -41,14 +41,6 @@ namespace OnlineStore.DeviceLibrary
{
LineRunTest = ConfigAppSettings.GetIntValue(Setting_Init.LineRunTest).Equals(1);
}
//public static bool isNeedEmptyTray()
//{
// if (LineRunTest)
// {
// return true;
// }
// return LineNeedEmptyTrayNum > 0;
//}
internal static void AddNeedEmptyTrayNum()
{
Interlocked.Increment(ref LineNeedEmptyTrayNum);
......@@ -89,13 +81,8 @@ namespace OnlineStore.DeviceLibrary
return null;
}
/// <summary>
/// 更新对应的盘号(1-6)是否有料盘
/// </summary>
/// <param name="trayNum"></param>
/// <param name="isFull"></param>
/// <param name="inOrOut">0=无操作,1=入库,2=出库</param>
internal static void UpdateFixtureValue(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)
{
lock (fixtureMapLock)
{
......@@ -117,6 +104,28 @@ namespace OnlineStore.DeviceLibrary
}
}
}
internal static void UpdateTrayCode(int trayNum, string wareCode = "")
{
LogUtil.info( "更新托盘【" + trayNum + "】的条码为【" + wareCode + "】");
lock (fixtureMapLock)
{
if (fixtureCodeFullMap.ContainsKey(trayNum))
{
fixtureCodeFullMap[trayNum].WareCode = wareCode;
}
}
}
internal static void UpdateTrayPosId(int trayNum, string PosId = "")
{
lock (fixtureMapLock)
{
if (fixtureCodeFullMap.ContainsKey(trayNum))
{
fixtureCodeFullMap[trayNum].PosId = PosId;
}
}
}
/// <summary>
/// 是否还有有料仓的盘
/// </summary>
......
......@@ -243,6 +243,44 @@ namespace OnlineStore.DeviceLibrary
return "";
}
}
/// <summary>
/// 处理接收后的二维码
/// </summary>
/// <param name="message"></param>
/// <returns></returns>
private static string ReplaceCode(string message)
{
message = message.Trim();
message = message.Replace("\r", "");
message = message.Replace("\n", "");
char a = (char)02;
message = message.Replace(a.ToString(), "");
message = message.Trim();
System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
byte[] bytes = asciiEncoding.GetBytes(message);
List<byte> newBytes = new List<byte>();
foreach (byte by in bytes)
{
if (!by.Equals(24))
{
newBytes.Add(by);
}
}
message = asciiEncoding.GetString(newBytes.ToArray());
return message;
}
public static string ProcessCode(List<string> codeList)
{
string code = "";
foreach (string cc in codeList)
{
if (string.IsNullOrEmpty(cc))
{
continue;
}
code += cc + "##";
}
return ReplaceCode(code);
}
}
}
......@@ -309,6 +309,12 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = false;
return wait;
}
public static WaitResultInfo WaitFeedScanCode()
{
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W102_FeedScanCode;
return wait;
}
public string ToStr()
{
if (WaitType.Equals(WaitEnum.W001_AxisMove))
......@@ -359,6 +365,10 @@ namespace OnlineStore.DeviceLibrary
{
return "上料轴缓慢上升";
}
else if (WaitType.Equals(WaitEnum.W102_FeedScanCode))
{
return "入料模块扫码";
}
else if (WaitType.Equals(WaitEnum.W201_ProvidingCanOut))
{
return "移栽模块可移栽出库";
......@@ -470,6 +480,10 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
internal static int W101_BatchAxisMove = 101;
/// <summary>
/// 入料模块扫码
/// </summary>
internal static int W102_FeedScanCode = 102;
/// <summary>
/// 移栽模块可移栽出库
/// </summary>
internal static int W201_ProvidingCanOut = 201;
......
......@@ -307,29 +307,33 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
MO_11_CodeRember = 3101,
/// <summary>
/// 移栽处理已完成,开始扫码或继续托盘处理流程
/// </summary>
MO_12_MoveOk=3102,
/// <summary>
/// 移载(流水线)定位气缸下降
/// </summary>
MO_12_LoactionCylinder_Down = 3102,
MO_13_LoactionCylinder_Down = 3103,
/// <summary>
/// 移载(流水线)装置出库处理 ,顶升气缸1下降
/// </summary>
MO_13_TopCylinder_Down = 3103,
MO_14_TopCylinder_Down = 3104,
/// <summary>
/// 如果是移栽2需要等待托盘是否可以走
/// </summary>
MO_14_WaitCanGo=3104,
MO_15_WaitCanGo=3105,
/// <summary>
/// 移载(流水线)装置出库处理, 阻挡气缸1-2下降
/// </summary>
MO_15_StopCylinder2_Down = 3105,
MO_16_StopCylinder2_Down = 3106,
/// <summary>
/// 移载(流水线)装置出库处理, 阻挡2托盘检测=0,
/// </summary>
MO_16_Tray_Check = 3106,
MO_17_Tray_Check = 3107,
/// <summary>
/// 移载(流水线)装置出库处理, 阻挡气缸1-1下降 阻挡气缸1-2上升
/// </summary>
MO_17_StopCylinder_Back = 3107,
MO_18_StopCylinder_Back = 3108,
/// <summary>
/// 移栽装置出库处理,开始出库
......
......@@ -29,7 +29,7 @@ namespace OnlineStore.DeviceLibrary
this.PlateW = plateW;
}
/// <summary>
/// 夹具编码值(1-6
/// 夹具编码值(1-32?
/// </summary>
public int TrayCode { get; set; }
/// <summary>
......@@ -46,7 +46,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public string WareCode { get; set; }
/// <summary>
/// 位置坐标名(对应配置表的位置)
/// 位置名(对应配置表的位置)
/// </summary>
public string PosId { get; set; }
/// <summary>
......@@ -57,6 +57,8 @@ namespace OnlineStore.DeviceLibrary
/// 料盘宽度
/// </summary>
public int PlateW { get; set; }
}
/// <summary>
/// 托盘上的物料的类型
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!