Commit 5db702d1 几米阳光

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

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