Commit 1356d079 张东亮

20221128

1 个父辈 6563da7e
...@@ -149,30 +149,30 @@ namespace OnlineStore.DeviceLibrary ...@@ -149,30 +149,30 @@ namespace OnlineStore.DeviceLibrary
string r = ""; string r = "";
bool eyemNoCode = false; bool eyemNoCode = false;
Task eyemtask = Task.Factory.StartNew(delegate { //Task eyemtask = Task.Factory.StartNew(delegate {
List<CodeInfo> tlci = EyemDecode.ModelDecoder(ref bmp); // List<CodeInfo> tlci = EyemDecode.ModelDecoder(ref bmp);
foreach (CodeInfo code in tlci) // foreach (CodeInfo code in tlci)
{ // {
//LogUtil.info(deviceName + " 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr); // //LogUtil.info(deviceName + " 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
string str = CodeManager.ReplaceCode(code.CodeStr); // string str = CodeManager.ReplaceCode(code.CodeStr);
if (!codeList.Contains(str)) // if (!codeList.Contains(str))
{ // {
codeList.Add(str); // codeList.Add(str);
r = r + "##eyem|" + code.CodeType + "|" + str; // r = r + "##eyem|" + code.CodeType + "|" + str;
if (!findRightCode) // if (!findRightCode)
{ // {
findRightCode = HasRightCode(str); // findRightCode = HasRightCode(str);
} // }
} // }
} // }
}); //});
//最多等待60秒 ////最多等待60秒
bool taskResult = eyemtask.Wait(60000); //bool taskResult = eyemtask.Wait(60000);
if (!taskResult) //if (!taskResult)
{ //{
LogUtil.error(deviceName + " 【" + cameraName + "】eyem扫码超时"); // LogUtil.error(deviceName + " 【" + cameraName + "】eyem扫码超时");
eyemNoCode = true; // eyemNoCode = true;
} //}
if (!isPreScan) if (!isPreScan)
{ {
...@@ -255,10 +255,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -255,10 +255,10 @@ namespace OnlineStore.DeviceLibrary
nameStr = "eyem"; nameStr = "eyem";
} }
if (!taskResult) //if (!taskResult)
{ //{
nameStr = "eyemTimeOut"; // nameStr = "eyemTimeOut";
} //}
SaveImageToFile(deviceName, cameraName + nameStr, bmp); SaveImageToFile(deviceName, cameraName + nameStr, bmp);
} }
......
...@@ -11,12 +11,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -11,12 +11,13 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public class Label_LZ public class Label_LZ
{ {
public Label_LZ(string liaohao, string mianbie, string jitai,string line) public Label_LZ(string liaohao, string mianbie, string jitai,string line,string slot="slot",string subslot="subslot")
{ {
this.pn = $"料 号:{liaohao}"; this.pn = $"料 号:{liaohao}";
this.side = $"{mianbie}"; this.side = $"{mianbie}";
this.line = $"线 别:{line} /{this.side}"; this.line = $"线 别:{line} /{this.side}";
this.station = $"机 台:{jitai}"; this.station = $"机 台:{jitai}";
this.slot = $"站 别:{slot}{subslot}";
this.shijian = $"时 间:{DateTime.Now.ToString()}"; this.shijian = $"时 间:{DateTime.Now.ToString()}";
} }
public Label_LZ() { } public Label_LZ() { }
...@@ -24,6 +25,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -24,6 +25,14 @@ namespace OnlineStore.DeviceLibrary
public string pn { get; set; } = ""; public string pn { get; set; } = "";
public string line { get; set; } = ""; public string line { get; set; } = "";
/// <summary> /// <summary>
/// 站位
/// </summary>
public string slot { get; set; }
/// <summary>
/// 点位
/// </summary>
public string subslot { get; set; }
/// <summary>
/// 线别 /// 线别
/// </summary> /// </summary>
public string side { get; set; } = ""; public string side { get; set; } = "";
...@@ -42,7 +51,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -42,7 +51,7 @@ namespace OnlineStore.DeviceLibrary
public string ToStr() public string ToStr()
{ {
return $"二维码:{barcode},需求单:{hSerial},料号:{pn},机台:{station},面别:{side},线别:{line}"; return $"二维码:{barcode},需求单:{hSerial},料号:{pn},机台:{station},面别:{side},线别:{line},站位:{slot},点位:{subslot}";
} }
} }
} }
...@@ -73,6 +73,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -73,6 +73,7 @@ namespace OnlineStore.DeviceLibrary
text.Add("jt", content.station); text.Add("jt", content.station);
text.Add("sj", content.shijian); text.Add("sj", content.shijian);
text.Add("xb", content.line); text.Add("xb", content.line);
text.Add("zb", content.slot);
return print.PrintPreview(text); return print.PrintPreview(text);
} }
public bool IsReadyPrint(out string msg) public bool IsReadyPrint(out string msg)
......
...@@ -16,6 +16,51 @@ namespace OnlineStore.DeviceLibrary ...@@ -16,6 +16,51 @@ namespace OnlineStore.DeviceLibrary
public class SServerManager public class SServerManager
{ {
#region 立臻料仓接口 #region 立臻料仓接口
static string Addr_getOutStateInfo = "/service/store/innerBox/getOutStateInfo";
/// <summary>
/// 根据料仓编号获取料仓两个出料口料箱信息
/// </summary>
/// <param name="cid">料仓cid</param>
/// <returns></returns>
public static List<BoxInfo> GetOutStateInfo()
{
try
{
string msg = "";
Dictionary<string, string> map = new Dictionary<string, string>();
map.Add("cid", StoreManager.XLRStore.Config.CID);
string server = GetAddr(Addr_getOutStateInfo, map);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Get(server);
ServerData4 serverResult = JsonHelper.DeserializeJsonToObject<ServerData4>(resultStr);
if (serverResult == null)
{
msg = $"GetOutStateInfo" + "没有收到服务器反馈";
}
else if (serverResult.code.Equals(0).Equals(false))
{
// code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = $" GetOutStateInfo【{JsonHelper.SerializeObject(serverResult)}】";
if (!msg.Equals(""))
{
LogUtil.error(msg);
return null;
}
}
else
{
msg = $" GetOutStateInfo【{JsonHelper.SerializeObject(serverResult)}】";
LogUtil.debug(msg);
return serverResult.data;
}
}
catch (Exception ex)
{
LogUtil.error("GetOutStateInfo", ex);
}
return null;
}
static string Addr_UploadLocInfo = "/service/store/innerBox/updateLocInfo"; static string Addr_UploadLocInfo = "/service/store/innerBox/updateLocInfo";
/// <summary> /// <summary>
/// A 出库更新任务状态 -OK /// A 出库更新任务状态 -OK
...@@ -23,15 +68,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -23,15 +68,19 @@ namespace OnlineStore.DeviceLibrary
/// <param name="barcode">料盘条码</param> /// <param name="barcode">料盘条码</param>
/// <param name="status"></param> /// <param name="status"></param>
/// <returns></returns> /// <returns></returns>
public static BoxTaskInfo UploadLocInfo(string barcode, string status, string loc = "") public static BoxTaskInfo UploadLocInfo(string barcode, string status, string loc = "",string hSerial="",string outle="",string boxSide="")
{ {
try try
{ {
string msg = ""; string msg = "";
Dictionary<string, string> map = new Dictionary<string, string>(); Dictionary<string, string> map = new Dictionary<string, string>();
map.Add("cid", StoreManager.XLRStore.Config.CID);
map.Add("barcode", barcode); map.Add("barcode", barcode);
map.Add("status", status); map.Add("status", status);
map.Add("loc", loc); map.Add("loc", loc);
map.Add("hSerial", hSerial);
map.Add("outle", outle);
map.Add("boxSide", boxSide);
string server = GetAddr(Addr_UploadLocInfo, map); string server = GetAddr(Addr_UploadLocInfo, map);
DateTime startTime = DateTime.Now; DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Get(server); string resultStr = HttpHelper.Get(server);
...@@ -1091,26 +1140,66 @@ namespace OnlineStore.DeviceLibrary ...@@ -1091,26 +1140,66 @@ namespace OnlineStore.DeviceLibrary
/// 目的地 /// 目的地
/// </summary> /// </summary>
public string line { get; set; } = ""; public string line { get; set; } = "";
public string cid { get; set; }
/// <summary> /// <summary>
/// 当前料箱隔口内侧已放入 /// 出口位置,A或者B
/// </summary> /// </summary>
public int inCount { get; set; } = -1; public string outlet { get; set; }
public int outCount { get; set; } = -1; /// <summary>
//public bool IsValid() /// 当前料箱隔口内侧T
//{ /// </summary>
// if (bigEmpty != -1 && smallEmpty != -1) public int boxTCount { get; set; } = -1;
// { /// <summary>
// return true; /// 当前料箱隔口外侧B
// } /// </summary>
// return false; public int boxBCount { get; set; } = -1;
//}
public string ToStr() public string ToStr()
{ {
return $"内侧格口已有数量:{inCount},外侧格口已有数量;{outCount}; 需求单:{hSerial},剩余任务数={remainTaskCount}," + return $"内侧T已有数量:{boxTCount},外侧B已有数量;{boxBCount}; 需求单:{hSerial},剩余任务数={remainTaskCount}," +
$"剩余料架数:{rackTaskCount},目的地:{line}"; $"剩余料架数:{rackTaskCount},目的地:{line}";
} }
} }
/// <summary>
/// 出口料箱信息
/// </summary>
public class BoxInfo
{
/// <summary>
/// 出口位置,A或者B
/// </summary>
public string outlet { get; set; }
/// <summary>
/// 料仓cid
/// </summary>
public string cid { get; set; }
/// <summary>
/// 料箱rfid
/// </summary>
public string rfid { get; set; }
/// <summary>
/// 需求单号
/// </summary>
public string hSerial { get; set; } = "";
/// <summary>
/// 目的线体
/// </summary>
public string line { get; set; } = "";
/// <summary>
/// 当前料箱隔口内侧T
/// </summary>
public int boxTCount { get; set; } = -1;
/// <summary>
/// 当前料箱隔口外侧B
/// </summary>
public int boxBCount { get; set; } = -1;
public string ToStr()
{
return $"出口位置:{outlet},箱号:{rfid},需求单:{hSerial},内侧T已有数量:{boxTCount},外侧B已有数量;{boxBCount}," +
$"目的地:{line}";
}
}
public class AlarmMsg public class AlarmMsg
{ {
...@@ -1207,6 +1296,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -1207,6 +1296,14 @@ namespace OnlineStore.DeviceLibrary
public List<Label_LZ> data { get; set; } public List<Label_LZ> data { get; set; }
} }
public class ServerData4
{
public int code { get; set; }
public string msg { get; set; }
public List<BoxInfo> data { get; set; }
}
public class AfterPutData public class AfterPutData
{ {
//>>` {"code": 0, "msg":"ok", "data":{"cutPackageTask":"0","urgentPackageTask":"20","cutTask":"21","urgentTask":"22"}} ` //>>` {"code": 0, "msg":"ok", "data":{"cutPackageTask":"0","urgentPackageTask":"20","cutTask":"21","urgentTask":"22"}} `
......
...@@ -66,6 +66,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -66,6 +66,9 @@ namespace OnlineStore.DeviceLibrary
//加载周转箱 //加载周转箱
BoxA = new TurnoverBox("周转箱A", RFIDIP[0], config); BoxA = new TurnoverBox("周转箱A", RFIDIP[0], config);
BoxB = new TurnoverBox("周转箱B", RFIDIP[1], config); BoxB = new TurnoverBox("周转箱B", RFIDIP[1], config);
turnoverBoxes = new List<TurnoverBox>();
turnoverBoxes.Add(BoxA);
turnoverBoxes.Add(BoxB);
initRobot(); initRobot();
MoveInfo = new DeviceMoveInfo(Name); MoveInfo = new DeviceMoveInfo(Name);
BatchMove = new BatchMoveBean(Config, BatchAxis, 1); BatchMove = new BatchMoveBean(Config, BatchAxis, 1);
...@@ -274,7 +277,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -274,7 +277,6 @@ namespace OnlineStore.DeviceLibrary
msg += "MoveT:" + MoveInfo.MoveType + "\n"; msg += "MoveT:" + MoveInfo.MoveType + "\n";
msg += "MoveS:" + MoveInfo.MoveStep + "\n"; msg += "MoveS:" + MoveInfo.MoveStep + "\n";
msg += "StepMsg:" + StepMsg + "\n"; msg += "StepMsg:" + StepMsg + "\n";
msg += "BoxInfo:" + boxTaskInfo?.ToStr() + "\n";
msg += "ReelInfo:" + PrintLabel?.LabelInfo?.ToStr() + "\n"; msg += "ReelInfo:" + PrintLabel?.LabelInfo?.ToStr() + "\n";
return msg; return msg;
} }
......
...@@ -6,10 +6,12 @@ using System; ...@@ -6,10 +6,12 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Configuration;
using System.Web.Routing; using System.Web.Routing;
using System.Windows.Forms; using System.Windows.Forms;
...@@ -19,8 +21,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -19,8 +21,8 @@ namespace OnlineStore.DeviceLibrary
{ {
#region 出库 #region 出库
private DateTime startOutTime = DateTime.Now; private DateTime startOutTime = DateTime.Now;
BoxTaskInfo boxTaskInfo;
bool outstoreNG = false; bool outstoreNG = false;
int maxCnt = ConfigAppSettings.GetIntValue(Setting_Init.MaxCntInBox, 15);
public override bool StartOutstore(InOutParam param) public override bool StartOutstore(InOutParam param)
{ {
if (!NoAlarm()) if (!NoAlarm())
...@@ -37,177 +39,275 @@ namespace OnlineStore.DeviceLibrary ...@@ -37,177 +39,275 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveType.Equals(MoveType.None)) if (MoveInfo.MoveType.Equals(MoveType.None))
{ {
outstoreNG = false; outstoreNG = false;
if (ReadBoxAId()) //获取料仓两个出料口信息
BoxA.BoxTaskInfo = SServerManager.GetBoxStatusInfo(Config.CID, BoxAId); List<BoxInfo> boxInfos = SServerManager.GetOutStateInfo();
if (ReadBoxBId()) if (boxInfos == null)
{ {
BoxB.BoxTaskInfo = SServerManager.GetBoxStatusInfo(Config.CID, BoxBId); SetWarnMsg("无法获取出料口信息,无法开始出库:" + param.PosInfo.ToStr());
return false;
} }
BoxA.UpdateBoxInfo(boxInfos);
BoxB.UpdateBoxInfo(boxInfos);
bool canOutstore = false; bool canOutstore = false;
string warnMsg = "";
//if (BoxA.BoxTaskInfo == null && BoxB.BoxTaskInfo == null)
//{
// SetWarnMsg("无法获取周转箱信息。出库失败:" + param.PosInfo.ToStr());
// return false;
//}
//else
//if (labelInfo == null)
//{
// outstoreNG = true;
// //warnMsg = ("无法获取料盘贴标信息。出库失败:" + param.PosInfo.ToStr());
//}
//else if (string.IsNullOrEmpty(labelInfo.line))
//{
// outstoreNG = true;
// //warnMsg = ("料盘贴标无线体信息,出库NG:" + param.PosInfo.ToStr());
//}
//else if (string.IsNullOrEmpty(labelInfo.hSerial))
//{
// outstoreNG = true;
// //warnMsg = ("料盘贴标无需求单信息,出库NG:" + param.PosInfo.ToStr());
//}
if (BufferDataManager.LabelInfo != null) if (BufferDataManager.LabelInfo != null)
{ {
outstoreNG = BufferDataManager.LabelInfo.outstoreNG; outstoreNG = BufferDataManager.LabelInfo.outstoreNG;
PrintLabel.LabelInfo = SServerManager.GetFeederInfo(BufferDataManager.LabelInfo.barcode); if (!outstoreNG)//有贴标信息
if (PrintLabel.LabelInfo != null)
{ {
if (BoxA.BoxTaskInfo != null) PrintLabel.LabelInfo = SServerManager.GetFeederInfo(BufferDataManager.LabelInfo.barcode);
if (PrintLabel.LabelInfo != null)
{ {
string msgA = ""; if (boxInfos.Count == 0)//无料箱绑定,默认A周转箱
if (!BoxA.CanPutIn(out string warnB))
{
msgA = warnB;
}
else if (!string.IsNullOrEmpty(BoxA.BoxTaskInfo.hSerial))
{
if (!BoxA.BoxTaskInfo.hSerial.Equals(PrintLabel.LabelInfo.hSerial))
{
msgA = ($"料盘与料箱需求单不匹配,出库失败。料盘【{PrintLabel.LabelInfo.hSerial}】料箱【{BoxA.BoxTaskInfo.hSerial}】:" + param.PosInfo.ToStr());
BoxA.NeedLeave();
}
else
{
if (PrintLabel.LabelInfo.side.Equals("T"))
{
param.ShelfType = 1;
boxTaskInfo = BoxA.BoxTaskInfo;
canOutstore = true;
}
else if (PrintLabel.LabelInfo.side.Equals("B"))
{
param.ShelfType = 2;
boxTaskInfo = BoxA.BoxTaskInfo;
canOutstore = true;
}
else
{
//msgA = ($"紧急料出库:" + param.PosInfo.ToStr());
outstoreNG=true;
}
}
}
else//空箱子
{ {
if (PrintLabel.LabelInfo.side.Equals("T")) if (PrintLabel.LabelInfo.side.Equals("T"))
{ {
param.ShelfType = 1; param.ShelfType = 1;
boxTaskInfo = BoxA.BoxTaskInfo;
canOutstore = true; canOutstore = true;
} }
else if (PrintLabel.LabelInfo.side.Equals("B")) else if (PrintLabel.LabelInfo.side.Equals("B"))
{ {
param.ShelfType = 2; param.ShelfType = 2;
boxTaskInfo = BoxA.BoxTaskInfo;
canOutstore = true; canOutstore = true;
} }
else
{
// msgA = ($"料盘的面别信息有误:{PrintLabel.LabelInfo.side}。出库失败:" + param.PosInfo.ToStr());
outstoreNG = true;
}
}
BoxA.WarnMsg = msgA;
SetWarnMsg(msgA);
}
if (!canOutstore && BoxB.BoxTaskInfo != null)
{
string msg1 = "";
if (!BoxB.CanPutIn(out string warnA))
{
msg1 = warnA;
} }
else if (!string.IsNullOrEmpty(BoxB.BoxTaskInfo.hSerial)) else
{ {
if (!BoxB.BoxTaskInfo.hSerial.Equals(PrintLabel.LabelInfo.hSerial)) var box = boxInfos.Find(s => PrintLabel.LabelInfo.hSerial.Equals(s.hSerial) && (s.boxBCount < maxCnt && s.boxTCount < maxCnt));
if (box != null)//相同工单且有空位
{ {
msg1 = ($"料盘与料箱需求单不匹配,出库失败。料盘【{PrintLabel.LabelInfo.hSerial}】料箱【{BoxB.BoxTaskInfo.hSerial}】:" + param.PosInfo.ToStr()); TurnoverBox turnoverBox = turnoverBoxes.Find(s => s.outLet.Equals(box.outlet));
BoxB.NeedLeave(); if (turnoverBox.ReadBoxId())
}
else
{
if (PrintLabel.LabelInfo.side.Equals("T"))
{ {
param.ShelfType = 3; if (turnoverBox.BoxId.Equals(box.rfid))
boxTaskInfo = BoxB.BoxTaskInfo; {
canOutstore = true; if (turnoverBox.outLet.Equals("A"))
} {
else if (PrintLabel.LabelInfo.side.Equals("B")) if (PrintLabel.LabelInfo.side.Equals("T"))
{ {
param.ShelfType = 4; param.ShelfType = 1;
boxTaskInfo = BoxB.BoxTaskInfo; canOutstore = true;
canOutstore = true; }
else if (PrintLabel.LabelInfo.side.Equals("B"))
{
param.ShelfType = 2;
canOutstore = true;
}
}
else
{
if (PrintLabel.LabelInfo.side.Equals("T"))
{
param.ShelfType = 3;
canOutstore = true;
}
else if (PrintLabel.LabelInfo.side.Equals("B"))
{
param.ShelfType = 4;
canOutstore = true;
}
}
}
else
{
SetWarnMsg($"工单{box.hSerial}已有料在{turnoverBox.Name}放入{box.rfid}中,无法放入其他料箱{turnoverBox.BoxId}");
}
} }
else else
{ {
//msg1 = ($"料盘的面别信息有误:{PrintLabel.LabelInfo.side}。出库失败:" + param.PosInfo.ToStr()); SetWarnMsg($"未读到RFID,工单{box.hSerial}已有料在{turnoverBox.Name}放入{box.rfid}中");
outstoreNG = true; return false;
} }
} }
} else //工单不同或者格口已满
else
{
if (PrintLabel.LabelInfo.side.Equals("T"))
{ {
param.ShelfType = 3; if(BoxA.ReadBoxId())
boxTaskInfo = BoxB.BoxTaskInfo; {
canOutstore = true; var boxTmp = boxInfos.Find(s => !BoxA.BoxId.Equals(s.rfid));
} if (boxTmp != null)
else if (PrintLabel.LabelInfo.side.Equals("B")) {
{ if (PrintLabel.LabelInfo.side.Equals("T"))
param.ShelfType = 4; {
boxTaskInfo = BoxB.BoxTaskInfo; param.ShelfType = 1;
canOutstore = true; canOutstore = true;
} }
else else if (PrintLabel.LabelInfo.side.Equals("B"))
{ {
//msg1 = ($"料盘的面别信息有误:{PrintLabel.LabelInfo.side}。出库失败:" + param.PosInfo.ToStr()); param.ShelfType = 2;
outstoreNG = true; canOutstore = true;
}
LogUtil.info($"工单不同或者上一料箱格口已满,{PrintLabel.LabelInfo.hSerial}切换料箱为{BoxA.BoxId}");
}
else
{
if(BoxB.ReadBoxId())
{
var boxTmp1 = boxInfos.Find(s => !BoxB.BoxId.Equals(s.rfid));
if (boxTmp1 != null)
{
if (PrintLabel.LabelInfo.side.Equals("T"))
{
param.ShelfType = 3;
canOutstore = true;
}
else if (PrintLabel.LabelInfo.side.Equals("B"))
{
param.ShelfType = 4;
canOutstore = true;
}
LogUtil.info($"工单不同或者上一料箱格口已满,{PrintLabel.LabelInfo.hSerial}切换料箱为{BoxB.BoxId}");
}
}
else
{
SetWarnMsg("周转箱线体上无可用料箱");
}
}
}
else
{
if (BoxB.ReadBoxId())
{
var boxTmp1 = boxInfos.Find(s => !BoxB.BoxId.Equals(s.rfid));
if (boxTmp1 != null)
{
if (PrintLabel.LabelInfo.side.Equals("T"))
{
param.ShelfType = 3;
canOutstore = true;
}
else if (PrintLabel.LabelInfo.side.Equals("B"))
{
param.ShelfType = 4;
canOutstore = true;
}
LogUtil.info($"工单不同或者上一料箱格口已满,{PrintLabel.LabelInfo.hSerial}切换料箱为{BoxB.BoxId}");
}
}
else
{
SetWarnMsg("周转箱线体上无可用料箱");
}
}
} }
} }
BoxB.WarnMsg = msg1; //if (BoxA.BoxTaskInfo != null)
SetWarnMsg(msg1); //{
// string msgA = "";
// if (!BoxA.CanPutIn(out string warnB))
// {
// msgA = warnB;
// }
// else if (!string.IsNullOrEmpty(BoxA.BoxTaskInfo.hSerial))
// {
// if (!BoxA.BoxTaskInfo.hSerial.Equals(PrintLabel.LabelInfo.hSerial))
// {
// msgA = ($"料盘与料箱需求单不匹配,出库失败。料盘【{PrintLabel.LabelInfo.hSerial}】料箱【{BoxA.BoxTaskInfo.hSerial}】:" + param.PosInfo.ToStr());
// BoxA.NeedLeave();
// }
// else
// {
// if (PrintLabel.LabelInfo.side.Equals("T"))
// {
// param.ShelfType = 1;
// canOutstore = true;
// }
// else if (PrintLabel.LabelInfo.side.Equals("B"))
// {
// param.ShelfType = 2;
// canOutstore = true;
// }
// else
// {
// //msgA = ($"紧急料出库:" + param.PosInfo.ToStr());
// outstoreNG = true;
// }
// }
// }
// else//空箱子
// {
// if (PrintLabel.LabelInfo.side.Equals("T"))
// {
// param.ShelfType = 1;
// canOutstore = true;
// }
// else if (PrintLabel.LabelInfo.side.Equals("B"))
// {
// param.ShelfType = 2;
// canOutstore = true;
// }
// else
// {
// // msgA = ($"料盘的面别信息有误:{PrintLabel.LabelInfo.side}。出库失败:" + param.PosInfo.ToStr());
// outstoreNG = true;
// }
// }
// BoxA.WarnMsg = msgA;
// SetWarnMsg(msgA);
//}
//if (!canOutstore && BoxB.BoxTaskInfo != null)
//{
// string msg1 = "";
// if (!BoxB.CanPutIn(out string warnA))
// {
// msg1 = warnA;
// }
// else if (!string.IsNullOrEmpty(BoxB.BoxTaskInfo.hSerial))
// {
// if (!BoxB.BoxTaskInfo.hSerial.Equals(PrintLabel.LabelInfo.hSerial))
// {
// msg1 = ($"料盘与料箱需求单不匹配,出库失败。料盘【{PrintLabel.LabelInfo.hSerial}】料箱【{BoxB.BoxTaskInfo.hSerial}】:" + param.PosInfo.ToStr());
// BoxB.NeedLeave();
// }
// else
// {
// if (PrintLabel.LabelInfo.side.Equals("T"))
// {
// param.ShelfType = 3;
// canOutstore = true;
// }
// else if (PrintLabel.LabelInfo.side.Equals("B"))
// {
// param.ShelfType = 4;
// canOutstore = true;
// }
// else
// {
// //msg1 = ($"料盘的面别信息有误:{PrintLabel.LabelInfo.side}。出库失败:" + param.PosInfo.ToStr());
// outstoreNG = true;
// }
// }
// }
// else
// {
// if (PrintLabel.LabelInfo.side.Equals("T"))
// {
// param.ShelfType = 3;
// canOutstore = true;
// }
// else if (PrintLabel.LabelInfo.side.Equals("B"))
// {
// param.ShelfType = 4;
// canOutstore = true;
// }
// else
// {
// //msg1 = ($"料盘的面别信息有误:{PrintLabel.LabelInfo.side}。出库失败:" + param.PosInfo.ToStr());
// outstoreNG = true;
// }
// }
// BoxB.WarnMsg = msg1;
// SetWarnMsg(msg1);
//}
} }
else
outstoreNG = true;
} }
else
outstoreNG = true;
} }
else if (PrintLabel.LabelInfo == null) else if (PrintLabel.LabelInfo == null)
{ {
outstoreNG = true; outstoreNG = true;
} }
//Printer.Connect();
//if (!Printer.IsReadyPrint(out string msg))
//{
// warnMsg = ($"打印机异常:{msg}。出库失败:" + param.PosInfo.ToStr());
//}
//Printer.Close();
//SetWarnMsg(warnMsg);
if (!outstoreNG)//正常出库 if (!outstoreNG)//正常出库
{ {
...@@ -222,12 +322,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -222,12 +322,11 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NewMove(MoveType.OutStore, param); MoveInfo.NewMove(MoveType.OutStore, param);
startOutTime = DateTime.Now; startOutTime = DateTime.Now;
MoveInfo.NextMoveStep(StepEnum.IO01_ReelCheck); MoveInfo.NextMoveStep(StepEnum.IO01_ReelCheck);
//Label_CylinderBack(MoveInfo);
SetWarnMsg("");
return true; return true;
} }
return false; return false;
} }
private void TrayHasLeave() private void TrayHasLeave()
{ {
...@@ -555,7 +654,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -555,7 +654,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IO42_UploadReelInfo)) else if (MoveInfo.IsStep(StepEnum.IO42_UploadReelInfo))
{ {
MoveInfo.NextMoveStep(StepEnum.IO43_BackToP1); MoveInfo.NextMoveStep(StepEnum.IO43_BackToP1);
// NGBox.PutIn(MoveInfo.MoveParam); // NGBox.PutIn(MoveInfo.MoveParam);
SServerManager.UploadLocInfo(MoveInfo.MoveParam.PosInfo.barcode, LocStatus.FINISHED); SServerManager.UploadLocInfo(MoveInfo.MoveParam.PosInfo.barcode, LocStatus.FINISHED);
IO43_BackToP1(shelf); IO43_BackToP1(shelf);
} }
...@@ -570,15 +669,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -570,15 +669,22 @@ namespace OnlineStore.DeviceLibrary
} }
void UploadLocInfo(int shelf) void UploadLocInfo(int shelf)
{ {
string boxSide = "B";
if (shelf == 1 || shelf==3)
{
boxSide = "T";
}
if (shelf.Equals(1) || shelf.Equals(2)) if (shelf.Equals(1) || shelf.Equals(2))
{ {
//料盘在机器人上,准备放入周转箱 //料盘在机器人上,准备放入周转箱
SServerManager.UploadLocInfo(MoveInfo.MoveParam.PosInfo.barcode, LocStatus.FINISHED, BoxAId); BoxA.BoxTaskInfo= SServerManager.UploadLocInfo(MoveInfo.MoveParam.PosInfo.barcode, LocStatus.FINISHED, BoxAId,BoxA.BoxInfo.hSerial,BoxA.outLet, boxSide);
SServerManager.ShelfFinish(BoxAId, MoveInfo.MoveParam.PosInfo.barcode, BoxA.BoxTaskInfo);
} }
else if (shelf.Equals(3) || shelf.Equals(4)) else if (shelf.Equals(3) || shelf.Equals(4))
{ {
//料盘在机器人上,准备放入周转箱 //料盘在机器人上,准备放入周转箱
SServerManager.UploadLocInfo(MoveInfo.MoveParam.PosInfo.barcode, LocStatus.FINISHED, BoxBId); BoxB.BoxTaskInfo= SServerManager.UploadLocInfo(MoveInfo.MoveParam.PosInfo.barcode, LocStatus.FINISHED, BoxBId,BoxB.BoxInfo.hSerial,BoxB.outLet, boxSide);
SServerManager.ShelfFinish(BoxBId, MoveInfo.MoveParam.PosInfo.barcode, BoxB.BoxTaskInfo);
} }
} }
...@@ -611,15 +717,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -611,15 +717,13 @@ namespace OnlineStore.DeviceLibrary
{ {
if (shelf.Equals(1) || shelf.Equals(2)) if (shelf.Equals(1) || shelf.Equals(2))
{ {
ReadBoxAId(); //ReadBoxAId();
BoxA.PutReelIn(shelf); BoxA.PutReelIn(shelf);
SServerManager.ShelfFinish(BoxAId, MoveInfo.MoveParam.PosInfo.barcode, BoxA.BoxTaskInfo);
} }
if (shelf.Equals(3) || shelf.Equals(4)) if (shelf.Equals(3) || shelf.Equals(4))
{ {
ReadBoxBId(); //ReadBoxBId();
BoxB.PutReelIn(shelf); BoxB.PutReelIn(shelf);
SServerManager.ShelfFinish(BoxBId, MoveInfo.MoveParam.PosInfo.barcode, BoxB.BoxTaskInfo);
} }
} }
void IO26_BackToP1(int shelf) void IO26_BackToP1(int shelf)
......
...@@ -14,6 +14,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -14,6 +14,7 @@ namespace OnlineStore.DeviceLibrary
{ {
public TurnoverBox BoxA; public TurnoverBox BoxA;
public TurnoverBox BoxB; public TurnoverBox BoxB;
public List<TurnoverBox> turnoverBoxes;
/// <summary> /// <summary>
/// 周转箱A的编号 /// 周转箱A的编号
/// </summary> /// </summary>
......
...@@ -232,7 +232,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -232,7 +232,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.Label03_HasLabelAtDoor)) else if (MoveInfo.IsStep(StepEnum.Label03_HasLabelAtDoor))
{ {
MoveInfo.NextMoveStep(StepEnum.Label04_PrintLabel); MoveInfo.NextMoveStep(StepEnum.Label04_PrintLabel);
Printer.Print(new Label_LZ(LabelInfo?.pn, LabelInfo?.side, LabelInfo?.station, LabelInfo?.line), out string msg); Printer.Print(new Label_LZ(LabelInfo?.pn, LabelInfo?.side, LabelInfo?.station, LabelInfo?.line,LabelInfo?.slot,LabelInfo?.subslot), out string msg);
MoveLog($"打标:开始打印标签【{msg}】:{LabelInfo.ToStr()}"); MoveLog($"打标:开始打印标签【{msg}】:{LabelInfo.ToStr()}");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
} }
......
...@@ -48,11 +48,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -48,11 +48,13 @@ namespace OnlineStore.DeviceLibrary
/// 周转箱线体反转 /// 周转箱线体反转
/// </summary> /// </summary>
string DO_LineBackRun = "TurnoverBoxA_LineBackRun"; string DO_LineBackRun = "TurnoverBoxA_LineBackRun";
public string outLet = "A";
public TurnoverBox(string name, string rfidIp, InputEquip_Config inputEquip_Config) public TurnoverBox(string name, string rfidIp, InputEquip_Config inputEquip_Config)
{ {
Name = name; Name = name;
if (name.Contains("B")) if (name.Contains("B"))
{ {
outLet = "B";
DI_SafetyRasterSignal = "TurnoverBoxB_SafetyRasterSignal"; DI_SafetyRasterSignal = "TurnoverBoxB_SafetyRasterSignal";
DI_FrontCheck = "TurnoverBoxB_FrontCheck"; DI_FrontCheck = "TurnoverBoxB_FrontCheck";
DI_InPlaceCheck = "TurnoverBoxB_InPlaceCheck"; DI_InPlaceCheck = "TurnoverBoxB_InPlaceCheck";
...@@ -66,21 +68,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -66,21 +68,18 @@ namespace OnlineStore.DeviceLibrary
} }
public string GetMoveStr() public string GetMoveStr()
{ {
return $"料箱:{BoxId} " + $"【格口最大数量:{MaxCntOnSide}】" + BoxTaskInfo?.ToStr() ?? ""; return $"料箱:{BoxId} " + $"【格口最大数量:{MaxCntOnSide}】【"+(BoxInfo?.ToStr()??"")+"】【" + (BoxTaskInfo?.ToStr() ?? "")+"】";
} }
public void StartReset() public void StartReset()
{ {
WarnMsg = ""; WarnMsg = "";
bool needLeave = false; //bool needLeave = false;
if (ReadBoxId()) ReadBoxId();
BoxTaskInfo = SServerManager.GetBoxStatusInfo(config.CID, BoxId);
resetCnt(); resetCnt();
if (BoxTaskInfo != null) //if (BoxTaskInfo != null)
{ //{
CntInSideA = BoxTaskInfo.inCount > 0 ? BoxTaskInfo.inCount : 0; // needLeave = CntInSideT >= MaxCntOnSide || CntInSideB >= MaxCntOnSide || (!string.IsNullOrEmpty(BoxTaskInfo.hSerial) && BoxTaskInfo.remainTaskCount == 0);
CntInSideB = BoxTaskInfo.outCount > 0 ? BoxTaskInfo.outCount : 0; //}
needLeave = CntInSideA >= MaxCntOnSide || CntInSideB >= MaxCntOnSide || (!string.IsNullOrEmpty(BoxTaskInfo.hSerial) && BoxTaskInfo.remainTaskCount == 0);
}
ProcessShelfOut = false; ProcessShelfOut = false;
ProcessShelfEnter = false; ProcessShelfEnter = false;
recvAGVSig = false; recvAGVSig = false;
...@@ -91,17 +90,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -91,17 +90,17 @@ namespace OnlineStore.DeviceLibrary
Thread.Sleep(10000); Thread.Sleep(10000);
LineStopRun(); LineStopRun();
if (needLeave) //if (needLeave)
{ //{
NeedLeave(); // NeedLeave();
} //}
}); });
} }
void resetCnt() void resetCnt()
{ {
CntInSideA = 0; CntInSideT = 0;
CntInSideB = 0; CntInSideB = 0;
} }
public void LineRun(DeviceMoveInfo moveInfo = null) public void LineRun(DeviceMoveInfo moveInfo = null)
...@@ -187,7 +186,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -187,7 +186,7 @@ namespace OnlineStore.DeviceLibrary
} }
//再转动8000 //再转动8000
//Thread.Sleep(8000); //Thread.Sleep(8000);
// Complete(); // Complete();
while (!AgvNode.status.Equals(NodeStatus.Complete)) while (!AgvNode.status.Equals(NodeStatus.Complete))
{ {
...@@ -289,7 +288,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -289,7 +288,7 @@ namespace OnlineStore.DeviceLibrary
Thread.Sleep(1000); Thread.Sleep(1000);
BoxTaskInfo = SServerManager.GetBoxStatusInfo(config.CID, BoxId); BoxTaskInfo = SServerManager.GetBoxStatusInfo(config.CID, BoxId);
} }
ProcessShelfEnter = false; ProcessShelfEnter = false;
LogUtil.info(logName + " 结束"); LogUtil.info(logName + " 结束");
} }
...@@ -321,13 +320,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -321,13 +320,21 @@ namespace OnlineStore.DeviceLibrary
} }
public Node AgvNode { get; set; } public Node AgvNode { get; set; }
/// <summary> /// <summary>
/// A侧数量 /// T侧数量
/// </summary> /// </summary>
public int CntInSideA { get; set; } public int CntInSideT { get; set; }
/// <summary> /// <summary>
/// B侧数量 /// B侧数量
/// </summary> /// </summary>
public int CntInSideB { get; set; } public int CntInSideB { get; set; }
/// <summary>
/// 是否有空位置
/// </summary>
/// <returns></returns>
public bool HasEmptyPos(int boxT, int boxB)
{
return boxT < MaxCntOnSide && boxB < MaxCntOnSide;
}
public bool CanPutIn(out string msg) public bool CanPutIn(out string msg)
{ {
msg = ""; msg = "";
...@@ -341,10 +348,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -341,10 +348,10 @@ namespace OnlineStore.DeviceLibrary
msg = Name + " 未读到rfid,不允许放料"; msg = Name + " 未读到rfid,不允许放料";
return false; return false;
} }
bool rtn = CntInSideA < MaxCntOnSide && CntInSideB < MaxCntOnSide; bool rtn = CntInSideT < MaxCntOnSide && CntInSideB < MaxCntOnSide;
if (!rtn) if (!rtn)
{ {
msg = Name + $" 格口数量已满,不允许放料。当前数量:【内侧={CntInSideA}】【外侧={CntInSideB}】"; msg = Name + $" 格口数量已满,不允许放料。当前数量:【内侧={CntInSideT}】【外侧={CntInSideB}】";
NeedLeave(); NeedLeave();
} }
return rtn; return rtn;
...@@ -487,14 +494,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -487,14 +494,14 @@ namespace OnlineStore.DeviceLibrary
WarnMsg = ""; WarnMsg = "";
if (side % 2 != 0) if (side % 2 != 0)
{ {
CntInSideA++; CntInSideT++;
} }
else else
{ {
CntInSideB++; CntInSideB++;
} }
bool rtn = CntInSideA >= MaxCntOnSide || CntInSideB >= MaxCntOnSide; bool rtn = CntInSideT >= MaxCntOnSide || CntInSideB >= MaxCntOnSide;
BoxTaskInfo = SServerManager.GetBoxStatusInfo(config.CID, BoxId); //BoxTaskInfo = SServerManager.GetBoxStatusInfo(config.CID, BoxId);
bool hasRemain = true; bool hasRemain = true;
if (BoxTaskInfo != null) if (BoxTaskInfo != null)
{ {
...@@ -518,12 +525,24 @@ namespace OnlineStore.DeviceLibrary ...@@ -518,12 +525,24 @@ namespace OnlineStore.DeviceLibrary
public void GetBoxTaskInfo() public void GetBoxTaskInfo()
{ {
if (ReadBoxId()) if (ReadBoxId())
BoxTaskInfo = SServerManager.GetBoxStatusInfo(config.CID, BoxId); {
List<BoxInfo> boxInfos = SServerManager.GetOutStateInfo();
UpdateBoxInfo(boxInfos);
}
}
public void UpdateBoxInfo(List<BoxInfo> boxInfos)
{
if (boxInfos == null) return;
BoxInfo = boxInfos.Find(s => outLet.Equals(s.outlet));
} }
/// <summary> /// <summary>
/// 箱子任务信息 /// 任务信息
/// </summary> /// </summary>
public BoxTaskInfo BoxTaskInfo { get; set; } public BoxTaskInfo BoxTaskInfo { get; set; }
/// <summary>
/// 箱子信息
/// </summary>
public BoxInfo BoxInfo { get; set; }
public void ClearBoxInfo(bool manual = false) public void ClearBoxInfo(bool manual = false)
{ {
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
this.panBase = new System.Windows.Forms.Panel(); this.panBase = new System.Windows.Forms.Panel();
this.chbMoveStop = new System.Windows.Forms.CheckBox(); this.chbMoveStop = new System.Windows.Forms.CheckBox();
this.lblWarnMsg = new System.Windows.Forms.Label(); this.lblWarnMsg = new System.Windows.Forms.Label();
this.btnResetShelf = new System.Windows.Forms.Button();
this.chbDebug = new System.Windows.Forms.CheckBox(); this.chbDebug = new System.Windows.Forms.CheckBox();
this.lblAgvInfo = new System.Windows.Forms.Label(); this.lblAgvInfo = new System.Windows.Forms.Label();
this.btnShelfOut = new System.Windows.Forms.Button(); this.btnShelfOut = new System.Windows.Forms.Button();
...@@ -238,7 +237,6 @@ ...@@ -238,7 +237,6 @@
this.panBase.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panBase.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panBase.Controls.Add(this.chbMoveStop); this.panBase.Controls.Add(this.chbMoveStop);
this.panBase.Controls.Add(this.lblWarnMsg); this.panBase.Controls.Add(this.lblWarnMsg);
this.panBase.Controls.Add(this.btnResetShelf);
this.panBase.Controls.Add(this.chbDebug); this.panBase.Controls.Add(this.chbDebug);
this.panBase.Controls.Add(this.lblAgvInfo); this.panBase.Controls.Add(this.lblAgvInfo);
this.panBase.Controls.Add(this.btnShelfOut); this.panBase.Controls.Add(this.btnShelfOut);
...@@ -277,20 +275,6 @@ ...@@ -277,20 +275,6 @@
this.lblWarnMsg.Text = "等待启动"; this.lblWarnMsg.Text = "等待启动";
this.lblWarnMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblWarnMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// btnResetShelf
//
this.btnResetShelf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnResetShelf.BackColor = System.Drawing.Color.White;
this.btnResetShelf.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnResetShelf.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnResetShelf.Location = new System.Drawing.Point(680, 251);
this.btnResetShelf.Name = "btnResetShelf";
this.btnResetShelf.Size = new System.Drawing.Size(128, 40);
this.btnResetShelf.TabIndex = 326;
this.btnResetShelf.Text = "重置料箱信息";
this.btnResetShelf.UseVisualStyleBackColor = false;
this.btnResetShelf.Click += new System.EventHandler(this.btnResetShelf_Click);
//
// chbDebug // chbDebug
// //
this.chbDebug.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.chbDebug.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
...@@ -395,7 +379,6 @@ ...@@ -395,7 +379,6 @@
private System.Windows.Forms.Button LineBack_A; private System.Windows.Forms.Button LineBack_A;
private System.Windows.Forms.Button LineStart_A; private System.Windows.Forms.Button LineStart_A;
protected System.Windows.Forms.CheckBox chbDebug; protected System.Windows.Forms.CheckBox chbDebug;
protected System.Windows.Forms.Button btnResetShelf;
protected System.Windows.Forms.CheckBox chbMoveStop; protected System.Windows.Forms.CheckBox chbMoveStop;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
......
...@@ -143,11 +143,11 @@ namespace OnlineStore.XLRStore ...@@ -143,11 +143,11 @@ namespace OnlineStore.XLRStore
} }
private void btnResetShelf_Click(object sender, EventArgs e) //private void btnResetShelf_Click(object sender, EventArgs e)
{ //{
moveBean.ClearBoxInfo(true); // moveBean.ClearBoxInfo(true);
LogUtil.info(moveBean.Name + "点击:" + btnResetShelf.Text + ";【" + moveBean.BoxId + "】"); // LogUtil.info(moveBean.Name + "点击:" + btnResetShelf.Text + ";【" + moveBean.BoxId + "】");
} //}
private void chbMoveStop_CheckedChanged(object sender, EventArgs e) private void chbMoveStop_CheckedChanged(object sender, EventArgs e)
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!