Commit 5db702d1 几米阳光

增加自动出库功能。扫码增加日志。

1 个父辈 7a963e86
...@@ -897,12 +897,21 @@ namespace OnlineStore.ACSingleStore ...@@ -897,12 +897,21 @@ namespace OnlineStore.ACSingleStore
} }
else else
{ {
DialogResult res = MessageBox.Show("确定开始自动出入库?", "提示", MessageBoxButtons.YesNo); DialogResult res;
if (chbOnlyOut.Checked)
{
res = MessageBox.Show("确定开始自动出库?", "提示", MessageBoxButtons.YesNo);
}
else
{
res = MessageBox.Show("确定开始自动出入库?", "提示", MessageBoxButtons.YesNo);
}
if (res.Equals(DialogResult.Yes)) if (res.Equals(DialogResult.Yes))
{ {
store.autoNext = true; store.autoNext = true;
int jiange = FormUtil.GetIntValue(txtJiange); int jiange = FormUtil.GetIntValue(txtJiange);
store.autoJiange = jiange; store.autoJiange = jiange;
store.AutoOnlyOut = chbOnlyOut.Checked;
if (cmbPosition.SelectedIndex >= 0) if (cmbPosition.SelectedIndex >= 0)
{ {
int currIndex = cmbPosition.SelectedIndex; int currIndex = cmbPosition.SelectedIndex;
...@@ -910,10 +919,19 @@ namespace OnlineStore.ACSingleStore ...@@ -910,10 +919,19 @@ namespace OnlineStore.ACSingleStore
store.AutoStartIndex = currIndex; store.AutoStartIndex = currIndex;
string poText = cmbPosition.Text; string poText = cmbPosition.Text;
store.autoMsg = "自动出库:" + poText; store.autoMsg = "自动出库:" + poText;
LogUtil.info(LOGGER, store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!"); LogUtil.info(LOGGER, store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + ")(间隔=" + jiange + ")(" +
(store.AutoOnlyOut ? "出库" : "出入库") + "),开始!");
//store.StartOutStoreMove(new InOutStoreParam("", poText)); //store.StartOutStoreMove(new InOutStoreParam("", poText));
if (store.AutoOnlyOut)
{
store.StartOutStoreMove(new InOutStoreParam("", poText));
}
else
{
store.StartInStoreMove(new InOutStoreParam("", poText)); store.StartInStoreMove(new InOutStoreParam("", poText));
} }
}
btnStartAuTo.Text = "停止自动出入库"; btnStartAuTo.Text = "停止自动出入库";
} }
} }
......
...@@ -1453,7 +1453,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1453,7 +1453,7 @@ namespace OnlineStore.DeviceLibrary
private void scanTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private void scanTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
int height = GetHeight(); int height = GetHeight();
LogUtil.info("高度【"+height+"】开始扫码"); // LogUtil.info("高度【"+height+"】开始扫码");
DateTime date = DateTime.Now; DateTime date = DateTime.Now;
//scanTimer.Enabled = false; //scanTimer.Enabled = false;
KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.HIGH); KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.HIGH);
......
...@@ -20,6 +20,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -20,6 +20,10 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public bool autoNext = false; public bool autoNext = false;
/// <summary> /// <summary>
/// 自动出入库只出库不入库
/// </summary>
public bool AutoOnlyOut = false;
/// <summary>
/// 自动出入库间隔 /// 自动出入库间隔
/// </summary> /// </summary>
public int autoJiange = 3; public int autoJiange = 3;
...@@ -821,11 +825,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -821,11 +825,7 @@ namespace OnlineStore.DeviceLibrary
} }
if (storeMoveType.Equals(StoreMoveType.InStore)) if (storeMoveType.Equals(StoreMoveType.InStore))
{ {
int newIndex = autoPositionIndex - 1; int newIndex = autoPositionIndex;
//if (autoJiange == 0)
//{
// newIndex = autoPositionIndex;
//}
if (newIndex < 0) if (newIndex < 0)
{ {
if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count) if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count)
...@@ -844,36 +844,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -844,36 +844,16 @@ namespace OnlineStore.DeviceLibrary
{ {
autoPositionIndex = newIndex; autoPositionIndex = newIndex;
string posid = PositionNumList[autoPositionIndex]; string posid = PositionNumList[autoPositionIndex];
StartNewOut(posid);
//判断是否需要重置
if (CurrInOutACount >= Config.Box_ResetACount)
{
LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把出库信息存入排队列表中");
Reset(false);
autoMsg = "自动出库:" + posid;
AddWaitOutInfo(new FixtureCodeInfo(0, "", posid));
}
else if (CurrInOutCount >= Config.Box_ResetMCount)
{
LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中");
//ResetMiddleAxis(false);
autoMsg = "自动出库:" + posid;
AddWaitOutInfo(new FixtureCodeInfo(0, "", posid));
}
else
{
LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid);
autoMsg = "自动出库:" + posid;
StartOutStoreMove(new InOutStoreParam("", posid));
}
} }
} }
else if (storeMoveType.Equals(StoreMoveType.OutStore)) else if (storeMoveType.Equals(StoreMoveType.OutStore))
{ {
int newIndex = autoPositionIndex - autoJiange; int newIndex = autoPositionIndex - autoJiange;
if (newIndex < 0) if (newIndex < 0)
{ {
if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count) if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count && AutoOnlyOut.Equals(false))
{ {
newIndex = AutoStartIndex; newIndex = AutoStartIndex;
LogUtil.info(LOGGER, StoreName + "下一个索引不存在,重新开始自动出入库,索引【" + AutoStartIndex + "】"); LogUtil.info(LOGGER, StoreName + "下一个索引不存在,重新开始自动出入库,索引【" + AutoStartIndex + "】");
...@@ -888,33 +868,72 @@ namespace OnlineStore.DeviceLibrary ...@@ -888,33 +868,72 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
string posid = PositionNumList[newIndex]; string posid = PositionNumList[newIndex];
if (AutoOnlyOut)
{
StartNewOut(posid);
}else
{
LogUtil.info(LOGGER, StoreName + "自动入库:posid=" + posid);
autoMsg = "自动入库:" + posid;
StartInStoreMove(new InOutStoreParam("AAAA", posid));
}
}
}
}
catch (Exception ex)
{
LogUtil.error(LOGGER, ex.ToString());
}
}
private void StartNewIn(string posid)
{
//判断是否需要重置 //判断是否需要重置
if (CurrInOutACount >= Config.Box_ResetACount) if (CurrInOutACount >= Config.Box_ResetACount)
{ {
LogUtil.info(LOGGER, StoreName + "自动进入下一个入库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把入库信息存入排队列表中"); LogUtil.info(LOGGER, StoreName + "自动入库:【" + posid + "】已经出入库" + CurrInOutACount + "次,需要重置BOX,先把入库信息存放到列表中");
Reset(false); Reset(false);
autoMsg = "自动入库:" + posid; autoMsg = "自动入库:" + posid;
AddWaitOutInfo(new FixtureCodeInfo(0, "AAAA", posid)); AddWaitOutInfo(new FixtureCodeInfo(0, "AAAA", posid));
} }
else if (CurrInOutCount >= Config.Box_ResetMCount) else if (CurrInOutCount >= Config.Box_ResetMCount)
{ {
LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中"); LogUtil.info(LOGGER, StoreName + "自动入库:【" + posid + "】已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把入库信息存放到列表中");
//ResetMiddleAxis(false); //ResetMiddleAxis(false);
autoMsg = "自动入库:" + posid; autoMsg = "自动入库:" + posid;
AddWaitOutInfo(new FixtureCodeInfo(0, "AAAA", posid)); AddWaitOutInfo(new FixtureCodeInfo(0, "AAAA", posid));
} }
else else
{ {
LogUtil.info(LOGGER, StoreName + "自动进入下一个入库:posid=" + posid); LogUtil.info(LOGGER, StoreName + "自动入库:posid=" + posid);
autoMsg = "自动入库:" + posid; autoMsg = "自动入库:" + posid;
StartInStoreMove(new InOutStoreParam("AAAA", posid)); StartInStoreMove(new InOutStoreParam("AAAA", posid));
} }
} }
private void StartNewOut(string posid)
{
//判断是否需要重置
if (CurrInOutACount >= Config.Box_ResetACount)
{
LogUtil.info(LOGGER, StoreName + "自动入库:【" + posid + "】已经出入库" + CurrInOutACount + "次,需要重置BOX,先把出库信息存入排队列表中");
Reset(false);
autoMsg = "自动出库:" + posid;
AddWaitOutInfo(new FixtureCodeInfo(0, "", posid));
} }
else if (CurrInOutCount >= Config.Box_ResetMCount)
{
LogUtil.info(LOGGER, StoreName + "自动入库:【" + posid + "】已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中");
//ResetMiddleAxis(false);
autoMsg = "自动出库:" + posid;
AddWaitOutInfo(new FixtureCodeInfo(0, "", posid));
} }
catch (Exception ex) else
{ {
LogUtil.error(LOGGER, ex.ToString()); LogUtil.info(LOGGER, StoreName + "自动出库:posid=" + posid);
autoMsg = "自动出库:" + posid;
StartOutStoreMove(new InOutStoreParam("", posid));
} }
} }
......
...@@ -70,23 +70,44 @@ namespace OnlineStore.DeviceLibrary ...@@ -70,23 +70,44 @@ namespace OnlineStore.DeviceLibrary
public static Bitmap GetCamerImage(string cameraName) public static Bitmap GetCamerImage(string cameraName)
{ {
Bitmap bitm = null; Bitmap bitm = null;
try
{
if (balserNameList.Contains(cameraName)) if (balserNameList.Contains(cameraName))
{ {
BaslerCamera.Instance.Open(cameraName); bool result = BaslerCamera.Instance.Open(cameraName);
if (result)
{
BaslerCamera.Instance.GrabOne(); BaslerCamera.Instance.GrabOne();
bitm = BaslerCamera.Instance.Image; bitm = BaslerCamera.Instance.Image;
BaslerCamera.Instance.Close(); BaslerCamera.Instance.Close();
} }
else if(hikNameList.Contains(cameraName)) else
{
LogUtil.error("相机【" + cameraName + "】打开失败:" + BaslerCamera.Instance.ErrInfo);
}
}
else if (hikNameList.Contains(cameraName))
{
bool result = HIKCamera.Instance.Open(cameraName);
if (result)
{ {
HIKCamera.Instance.Open(cameraName);
HIKCamera.Instance.GrabOne(); HIKCamera.Instance.GrabOne();
bitm = HIKCamera.Instance.Image; bitm = HIKCamera.Instance.Image;
HIKCamera.Instance.Close(); HIKCamera.Instance.Close();
} }
else else
{ {
LogUtil.info("未找到摄像机【"+cameraName+"】无法获取图片"); LogUtil.error("相机【" + cameraName + "】打开失败:" + HIKCamera.Instance.ErrInfo);
}
}
else
{
LogUtil.info("未找到相机【" + cameraName + "】无法获取图片");
}
}
catch (Exception ex)
{
LogUtil.error("从相机【" + cameraName + "】获取图片出错:" + ex.ToString());
} }
return bitm; return bitm;
} }
...@@ -107,6 +128,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -107,6 +128,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.info(" 摄像机【" + cameraName + "】获取图片完成,开始扫码");
HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bitmap); HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bitmap);
List<CodeInfo> cc = new List<CodeInfo>(); List<CodeInfo> cc = new List<CodeInfo>();
foreach (string codeType in codeTypeList) foreach (string codeType in codeTypeList)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!