Commit 1356d079 张东亮

20221128

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