Commit 262366e5 张东亮

增加盘点功能

1 个父辈 41b47a48

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2024
# Visual Studio Version 16
VisualStudioVersion = 16.0.29519.87
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACServoDriveTest", "source\ACServoDriveTest\ACServoDriveTest.csproj", "{7FA84E1E-BCDE-49F6-BE42-0BC397AF65B8}"
EndProject
......
......@@ -99,6 +99,7 @@ namespace OnlineStore.ACSingleStore
if (ktkPosition != null)
{
txtMiddleP2.Text = ktkPosition.MiddleAxis_Position_P2.ToString();
txtMiddleP3.Text = ktkPosition.MiddleAxis_Position_P3.ToString();
txtUpDownP3.Text = ktkPosition.UpDownAxis_IHPosition_P3.ToString();
txtUpDownP4.Text = ktkPosition.UpDownAxis_ILPosition_P4.ToString();
txtUpDownP5.Text = ktkPosition.UpDownAxis_OLPosition_P5.ToString();
......@@ -262,14 +263,15 @@ namespace OnlineStore.ACSingleStore
{
string msg = store.autoMsg;
lblMsg.Text = msg;
if (btnStartAuTo.Text.Equals("开始自动出入库"))
{
btnStartAuTo.Text = "停止自动出入库";
}
//if (btnStartAuTo.Text.Equals("开始自动出入库"))
//{
// btnStartAuTo.Text = "停止自动出入库";
//}
try
{
msg = msg.Replace("自动出库:", "");
msg = msg.Replace("自动入库:", "");
msg = msg.Replace("自动盘点:", "");
int index = store.PositionNumList.IndexOf(msg);
if (index >= 0 && (!msg.Equals("")))
{
......@@ -405,6 +407,7 @@ namespace OnlineStore.ACSingleStore
ktk.InOut_P3 = FormUtil.GetIntValue(txtInOutP3);
ktk.Middle_P1 = FormUtil.GetIntValue(txtMiddleP1);
ktk.Middle_P2 = FormUtil.GetIntValue(txtMiddleP2);
ktk.Middle_P3 = FormUtil.GetIntValue(txtMiddleP3);
ktk.UpDown_P1 = FormUtil.GetIntValue(txtUpDownP1);
ktk.UpDown_P2 = FormUtil.GetIntValue(txtUpDownP2);
......@@ -436,6 +439,7 @@ namespace OnlineStore.ACSingleStore
if (ktkPosition != null)
{
txtMiddleP2.Text = ktkPosition.MiddleAxis_Position_P2.ToString();
txtMiddleP3.Text = ktkPosition.MiddleAxis_Position_P3.ToString();
txtUpDownP3.Text = ktkPosition.UpDownAxis_IHPosition_P3.ToString();
txtUpDownP4.Text = ktkPosition.UpDownAxis_ILPosition_P4.ToString();
txtUpDownP5.Text = ktkPosition.UpDownAxis_OLPosition_P5.ToString();
......@@ -604,6 +608,7 @@ namespace OnlineStore.ACSingleStore
if (ktkPosition != null)
{
ktkPosition.MiddleAxis_Position_P2 = FormUtil.GetIntValue(txtMiddleP2);
ktkPosition.MiddleAxis_Position_P3 = FormUtil.GetIntValue(txtMiddleP3);
ktkPosition.UpDownAxis_IHPosition_P3 = FormUtil.GetIntValue(txtUpDownP3);
ktkPosition.UpDownAxis_ILPosition_P4 = FormUtil.GetIntValue(txtUpDownP4);
......@@ -817,6 +822,15 @@ namespace OnlineStore.ACSingleStore
}
}
private void btnMiddleP3_Click(object sender, EventArgs e)
{
if (InOutIsIsP1())
{
int value = FormUtil.GetIntValue(txtMiddleP3);
AxisABSMove(store.Config.Middle_Axis, value, store.Config.MiddleAxis_P2_Speed);
}
}
private void btnInOutP1_Click(object sender, EventArgs e)
{
if (store.InOutAxisCanMove().Equals(false))
......@@ -1390,5 +1404,67 @@ namespace OnlineStore.ACSingleStore
{
LogUtil.UpdateLogbox();
}
/// <summary>
/// 盘点测试
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnCheckPos_Click(object sender, EventArgs e)
{
if (store.storeRunStatus >= StoreRunStatus.HomeMoving)
{
string selectPositionNum = cmbPosition.Text;
LineMoveP ktk = LoadPostion();
store.StartInventoryMove(new InOutParam(new InOutPosInfo("", selectPositionNum), ktk));
}
else
{
MessageBox.Show("请先启动料仓!");
}
}
/// <summary>
/// 启动自动盘点
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click_1(object sender, EventArgs e)
{
if (store.storeRunStatus >= StoreRunStatus.HomeMoving)
{
if (store.autoNext)
{
store.autoNext = false;
btnStartAutoCheck.Text = "开始自动盘点";
}
else
{
DialogResult res = MessageBox.Show("确定开始自动盘点?", "提示", MessageBoxButtons.YesNo);
if (res.Equals(DialogResult.Yes))
{
store.autoNext = true;
int jiange = FormUtil.GetIntValue(txtJiange);
store.autoJiange = jiange;
if (cmbPosition.SelectedIndex >= 0)
{
int currIndex = cmbPosition.SelectedIndex;
store.autoPositionIndex = currIndex;
store.AutoStartIndex = currIndex;
string poText = cmbPosition.Text;
store.autoMsg = "自动盘点:" + poText;
LogUtil.info(LOGGER, store.StoreName + "开启自动盘点模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",盘点开始!");
//store.StartOutStoreMove(new InOutStoreParam("", poText));
store.StartInventoryMove(new InOutParam(new InOutPosInfo("AUTOINOUT", poText)));
}
btnStartAutoCheck.Text = "停止自动盘点";
}
}
}
else
{
MessageBox.Show("请先启动料仓!");
}
}
}
}
......@@ -225,4 +225,5 @@ namespace OnlineStore.Common
public static string barcode = "barcode";
}
}
......@@ -18,7 +18,7 @@ namespace OnlineStore.Common
{
public class HttpHelper
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static string Post(string url, string paramData)
{
return Post(url, paramData, Encoding.UTF8);
......@@ -109,7 +109,7 @@ namespace OnlineStore.Common
}
return null;
}
private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
public static string Post(string url, string paramData, Encoding encoding)
{
//if (PingURLIP(url, 100).Equals(false))
......@@ -157,6 +157,7 @@ namespace OnlineStore.Common
return result;
}
public static string Get(string url)
{
return Get(url, Encoding.UTF8);
......@@ -182,5 +183,14 @@ namespace OnlineStore.Common
}
return "";
}
public class ResponseMsg
{
//{"code":0,"msg":"ok","data":""}
public int code { get; set; }
public string msg { get; set; }
public string data { get; set; }
}
}
}
\ No newline at end of file
......@@ -52,6 +52,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......@@ -60,6 +61,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="acSingleStore\AC_SA_BoxBean.cs" />
<Compile Include="acSingleStore\AC_SA_BoxBean_Inventory.cs" />
<Compile Include="acSingleStore\AC_SA_BoxBean_Partial.cs" />
<Compile Include="acSingleStore\StoreManager.cs" />
<Compile Include="IO\AIOBOX\AIOBOXManager.cs" />
......
......@@ -6,7 +6,7 @@ PRO,IO模块IP,PRO_AOI_IP_1,192.168.202.21,,,,,,,,,,,
,,,,,,,,,,
DI,急停,SuddenStop_BTN,0,PRO_AOI_IP_1,0,急停,X01,DI-01,0,
DI,复位,Reset_BTN,1,PRO_AOI_IP_1,0,复位,X02,DI-02,0,
DI,门禁,DoorLimit,2,PRO_AOI_IP_1,0,门禁,X03,DI-03,0,
DI,盘点,CheckPos,2,PRO_AOI_IP_1,0,盘点,X03,DI-03,0,
DI,料盘检测1(进料口),TrayCheck_Door,3,PRO_AOI_IP_1,0,料盘检测1(进料口),X04,DI-04,0,
DI,料盘检测2(料叉),TrayCheck_Fixture,4,PRO_AOI_IP_1,0,料盘检测2(料叉),X05,DI-05,0,
DI,气压检测,Airpressure_Check,5,PRO_AOI_IP_1,0,气压检测,X06,DI-06,0,
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
namespace OnlineStore.DeviceLibrary
{
public partial class AC_SA_BoxBean
{
//进出轴到P1
//InOutBackToP1(StoreMove.MoveParam.MoveP.InOut_P1);
protected override void InventoryProcess()
{
LineMoveP moveP = StoreMove.MoveParam.MoveP;
bool IsExist = false;
if (StoreMove.IsInWait)
{
CheckWait();
}
if (StoreMove.IsInWait)
{
return;
}
if (StoreMove.MoveStep == StoreMoveStep.SC_01_InOutAxisHome)
{
StoreMove.NextMoveStep(StoreMoveStep.SC_02_MoveToBag);
CheckPositionLog("盘点定位:SC_02_MoveToBag,旋转轴 至P3(料叉背向库位点)升降轴到P6(库位高点) ");
ACAxisMove(Config.Middle_Axis, moveP.Middle_P3, Config.MiddleAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P6, Config.UpDownAxis_P6_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SC_02_MoveToBag)
{
StoreMove.NextMoveStep(StoreMoveStep.SC_03_Inventory);
IsExist = IOManager.IOValue(IO_Type.CheckPos).Equals(IO_VALUE.HIGH);
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("cid", CID);//cid = 料仓CID
paramMap.Add("pos", StoreMove.MoveParam.PosInfo.PosId); // 库位
paramMap.Add("hasReel", IsExist.ToString()); // 是否有料
string server =StoreManager.GetAddr(StoreManager.Addr_posReelCheck, paramMap);
string resultStr = HttpHelper.Post(server, "");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1000));
CheckPositionLog("盘点仓位:SC_03_Inventory [CID="+CID+"] [" + StoreMove.MoveParam.PosInfo.PosId + "] [IO_Type.CheckPos=" + IsExist.ToString() + "] [resultStr=" + resultStr + "]");
}
else if (StoreMove.MoveStep == StoreMoveStep.SC_03_Inventory)
{
StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing;
//设备连接,盘点后,BOX恢复原始状态
storeStatus = StoreStatus.StoreOnline;
InventoryEndProcess(StoreMoveType.CheckPosition);
}
}
/// <summary>
/// 自动盘点是否结束
/// </summary>
/// <param name="storeMoveType"></param>
private void InventoryEndProcess(StoreMoveType storeMoveType)
{
try
{
CurrInOutCount++;
CurrInOutACount++;
//是否自动状态
if (!autoNext)
{
return;
}
if (storeMoveType.Equals(StoreMoveType.CheckPosition))
{
int newIndex = autoPositionIndex - 1;
if (newIndex < 0)
{
if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count)
{
newIndex = AutoStartIndex;
LogUtil.info(LOGGER, StoreName + "下一个索引不存在,重新开始自动盘点,索引【" + AutoStartIndex + "】");
}
else
{
autoNext = false;
autoMsg = "自动盘点结束!";
LogUtil.info(LOGGER, StoreName + "下一个索引不存在,自动盘点结束!");
//回待机位
MoveToP1();
}
}
else
{
autoPositionIndex = newIndex;
string posid = PositionNumList[autoPositionIndex];
InOutPosInfo inoutinfo = new InOutPosInfo(autoInoutCode, posid);
//判断是否需要重置
if (CurrInOutACount >= Config.Box_ResetACount)
{
LogUtil.info(LOGGER, StoreName + "自动进入下一个仓位:posid=" + posid + ",当时已经盘点" + CurrInOutACount + "次,需要重置BOX");//,先把盘点信息存入排队列表中
Reset(false);
autoMsg = "自动盘点:" + posid;
AddWaitOutInfo(inoutinfo);
}
else if (CurrInOutCount >= Config.Box_ResetMCount)
{
LogUtil.info(LOGGER, StoreName + "自动进入下一个仓位:posid=" + posid + ",当时已经出盘点" + CurrInOutCount + "次,需要重置BOX旋转轴");
//ResetMiddleAxis(false);
autoMsg = "自动盘点:" + posid;
AddWaitOutInfo(inoutinfo);
}
else
{
LogUtil.info(LOGGER, StoreName + "自动进入下一个仓位:posid=" + posid);
autoMsg = "自动盘点:" + posid;
StartInventoryMove(new InOutParam(inoutinfo));
}
}
}
}
catch (Exception ex)
{
LogUtil.error(LOGGER, ex.ToString());
}
}
/// <summary>
/// 开始库位盘点
/// </summary>
public void StartInventoryMove(InOutParam param)
{
startInStoreTime = DateTime.Now;
string posId = param != null ? param.PosInfo.PosId : "";
if (storeRunStatus == StoreRunStatus.Runing)
{
if (!LoadParamPosition(param))
{
LogUtil.error(LOGGER, StoreName + " 启动盘点库位【" + posId + "】出错,找不到库位信息");
return;
}
LogUtil.info(LOGGER, StoreName + " 启动盘点库位【" + posId + "】", storeMoveColor);
storeRunStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.CheckPosMove;
StoreMove.NewMove(StoreMoveType.CheckPosition, param);
SC_01_Move(param.MoveP);
}
else
{
LogUtil.error(LOGGER, StoreName + " 启动盘点库位【" + posId + "】出错,当前状态,storeStatus=" + storeRunStatus);
}
}
private void SC_01_Move(LineMoveP moveP)
{
StoreMove.NextMoveStep(StoreMoveStep.SC_01_InOutAxisHome);
CheckPositionLog("盘点:SC_01_InOutAxisHome 进出轴(叉子)动作至P1");
InOutBackToP1(moveP.InOut_P1);
}
private void CheckPositionLog(string msg)
{
string posId = StoreMove.MoveParam != null ? "【" + StoreMove.MoveParam.PosInfo.PosId + "】" : " ";
LogUtil.info(LOGGER, posId + StoreMove.MoveStep + " " + msg, storeMoveColor);
}
}
}
......@@ -17,7 +17,8 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public List<string> PositionNumList = new List<string>();
/// <summary>
/// 入库完成后自动出库,出库完成后自动入库
/// 入库完成后自动出库,出库完成后自动入库 或者
/// 上一个盘点完,自动盘点下一个
/// </summary>
public bool autoNext = false;
/// <summary>
......@@ -67,6 +68,7 @@ namespace OnlineStore.DeviceLibrary
p.ComPress_P3 = position.CompressAxis_CPosition_P3;
p.InOut_P3 = position.InOutAxis_Position_P3;
p.Middle_P2 = position.MiddleAxis_Position_P2;
p.Middle_P3 = position.MiddleAxis_Position_P3;
p.UpDown_P3 = position.UpDownAxis_IHPosition_P3;
p.UpDown_P4 = position.UpDownAxis_ILPosition_P4;
p.UpDown_P5 = position.UpDownAxis_OLPosition_P5;
......
......@@ -165,5 +165,40 @@ namespace OnlineStore.DeviceLibrary
}
return host + api_nextFeeder;
}
public static string Addr_posReelCheck = "/rest/api/qisda/device/posReelCheck";
public static string GetPosReelCheckApi(string host)
{
if (host == "")
{
host = ConfigAppSettings.GetValue(Setting_Init.http_server);
}
if (!host.StartsWith("http://"))
{
host = "http://" + host;
}
if (!host.EndsWith("/"))
{
host = host + "/";
}
return host + Addr_posReelCheck;
}
public static string GetAddr(string addr, Dictionary<string, string> paramsMap)
{
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
if (server.EndsWith("/"))
{
server = server.Substring(0, server.Length - 1);
}
string path = server + addr.Trim() + "?";
foreach (string paramName in paramsMap.Keys)
{
string par = System.Web.HttpUtility.UrlEncode(paramsMap[paramName], System.Text.Encoding.UTF8);
path += paramName + "=" + par + "&";
}
path = path.Substring(0, path.Length - 1);
return path;
}
}
}
......@@ -161,6 +161,10 @@ namespace OnlineStore.DeviceLibrary
ResetProcess();
isInPro = false;
break;
case StoreMoveType.CheckPosition:
InventoryProcess();
isInPro = false;
break;
default: break;
}
}
......@@ -239,6 +243,10 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
protected abstract void ResetProcess();
/// <summary>
/// 盘点处理
/// </summary>
protected abstract void InventoryProcess();
/// <summary>
/// 原点返回处理
/// </summary>
protected abstract void ReturnHomeProcess();
......
......@@ -53,7 +53,10 @@ namespace OnlineStore.DeviceLibrary
/// 轴1旋转轴 库位点 P2
/// </summary>
public int Middle_P2 { get; set; }
/// <summary>
/// 轴1旋转轴 库位点 P3(料叉背面指向的库位位置)
/// </summary>
public int Middle_P3 { get; set; }
/// <summary>
/// 轴3进出轴 待机原位点P1
/// </summary>
......
......@@ -103,7 +103,11 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 重置中(原点返回和重置都发此状态)
/// </summary>
ResetMove=13,
ResetMove=13,
/// <summary>
/// 库位盘点中
/// </summary>
CheckPosMove,
}
/// <summary>
......@@ -331,7 +335,20 @@ namespace OnlineStore.DeviceLibrary
#endregion
#region 料仓库位盘点
/// <summary>
/// 盘点 料叉回原点P1
/// </summary>
SC_01_InOutAxisHome,
/// <summary>
/// 料叉背面移动到库位
/// </summary>
SC_02_MoveToBag,
/// <summary>
/// 盘点仓位
/// </summary>
SC_03_Inventory,
#endregion
}
......
......@@ -363,5 +363,9 @@ namespace OnlineStore.DeviceLibrary
///// 移栽检测托盘
///// </summary>
//CheckFixture=6,
/// <summary>
/// 盘点
/// </summary>
CheckPosition,
}
}
......@@ -19,7 +19,11 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
[CSVAttribute("中轴位置P2")]
public int MiddleAxis_Position_P2 { get; set; }
/// <summary>
/// 中轴位置(旋转轴料叉背面库位点)P3
/// </summary>
[CSVAttribute("中轴位置P3")]
public int MiddleAxis_Position_P3 { get; set; }
/// <summary>
/// 升降轴(库位出料前点)P5
/// </summary>
......
......@@ -35,9 +35,13 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
public static string Reset_BTN = "Reset_BTN";
/// <summary>
/// DI,盘点,CheckPos,2,PRO_AOI_IP_1,0,盘点,X03,DI-03,0,
/// </summary>
public static string CheckPos = "CheckPos";
/// <summary>
///DI 自动运行 AutoRun_Signal
/// </summary>
// public static string AutoRun_Signal = "AutoRun_Signal";
// public static string AutoRun_Signal = "AutoRun_Signal";
/// <summary>
/// 料仓DI。气压检测(料仓) Airpressure_Check
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!