Commit 20ca437b 张东亮

1、入料机构机器人取完料等待问题。2、fr331和fr336兼容问题。3、存储机构入库时移栽x轴动作不同步

1 个父辈 6563da7e
正在显示 34 个修改的文件 包含 966 行增加599 行删除
......@@ -12,6 +12,7 @@
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......
......@@ -135,5 +135,6 @@ namespace OnlineStore.Common
public const string LabelInImgAngle_CamA = "LabelInImgAngle_CamA";
public const string LabelInImgAngle_CamB = "LabelInImgAngle_CamB";
public const string UseLabelCheck = "UseLabelCheck";
public const string UseFR336P = "UseFR336P";
}
}
{
"CodeOrder": "HalconOnly",
"Halcon": {
"CodeType": "All",
"Zoom1DCode": 1.5,
"Zoom2DCode": 1.5
},
"EyemLib": {
"CodeType": "All",
"BlockSize": 11,
"RangeC": 5,
"SymbolMin": 128,
"SymbolMax": 215
},
"Region": {
"monitor": {
"Aplan": [{
"RegionName": "one",
"X": 133,
"Y": 167,
"Width": 396,
"Height": 456,
"Ratio": 0.5
}, {
"RegionName": "two",
"X": 555,
"Y": 170,
"Width": 390,
"Height": 450,
"Ratio": 0.6
}],
"Bplan": [{
"RegionName": "one",
"X": 927,
"Y": 278,
"Width": 396,
"Height": 456,
"Ratio": 0.5
}, {
"RegionName": "two",
"X": 1353,
"Y": 276,
"Width": 396,
"Height": 456,
"Ratio": 0.5
}],
"C计划": [{
"RegionName": "name1",
"X": 940,
"Y": 320,
"Width": 410,
"Height": 410,
"Ratio": 0.4
}]
},
"monitor2": {
"key1": [{
"RegionName": "one",
"X": 967,
"Y": 288,
"Width": 396,
"Height": 456,
"Ratio": 0.5
}]
}
},
"HIKIPCamera": [
{
"Name": "box_A",
"IP": "192.168.120.122",
"User": "admin",
"Password": "Acc123456",
"Port": 8000
},
{
"Name": "box_B",
"IP": "192.168.108.22",
"User": "admin",
"Password": "Acc123456",
"Port": 8000
}
]
}
\ No newline at end of file
......@@ -5,7 +5,7 @@ PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,0,,,,,,,,,
PRO,0,是否使用夹爪(1=使用夹爪,0=用吸盘),UseClampJaw,0,,,,,,,,,,,,
PRO,0,上料口扫码的相机名称(多个用#分隔),CameraNameList_Shelf,GigE:MV-CE200-10GC (00E70964538),,,,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,0,周转箱-RFID-IP,PRO_RFIP_001,192.168.101.103#192.168.101.104,,,,,,,,,,,,
PRO,0,周转箱-RFID-IP,PRO_RFIP_001,192.168.107.7#192.168.101.104,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,0,AGV小车站号名称_靠近电器板侧,AgvName_A,2#A-1-2,,,,,,,,,,,,
PRO,0,AGV小车站号名称_靠近墙侧,AgvName_B,1#A-1-1,,,,,,,,,,,,
......
......@@ -38,6 +38,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Asa.Camera.VisionLib">
<HintPath>..\..\dll\Asa.Camera.VisionLib.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
......@@ -66,6 +69,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<None Include="Config\Camera.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Config\slidePos.data">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
......
......@@ -12,7 +12,7 @@
<item key="LabelName" ver="10" value="lizhen" />
<item key="AngleChange " ver="10" value="83" />
<!--二维码类型列表配置,用#分割,一维码=Barcode 二维码: QR Code#Data Matrix ECC 200#Micro QR Code-->
<item key="CodeType" value="Data Matrix ECC 200#QR Code"/>
<item key="CodeType" value="Data Matrix ECC 200"/>
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<item key="CodeParamPath" value="\CodeParam\"/>
<!--有效码数量-->
......
......@@ -85,7 +85,7 @@ namespace OnlineStore.DeviceLibrary
}
return new List<string>();
}
static bool useFR336P = ConfigAppSettings.GetBoolValue(Setting_Init.UseFR336P, false);
public static RFIDData ReadRFID(string ip)
{
try
......@@ -99,7 +99,12 @@ namespace OnlineStore.DeviceLibrary
RFIDData data;
if (rtn)
{
val = Encoding.UTF8.GetString(new byte[] { outValue[0], outValue[1], outValue[2], outValue[3], outValue[8], outValue[9], outValue[10] })?.Trim() ?? "";
if (useFR336P)
{
val = Encoding.UTF8.GetString(new byte[] { outValue[0], outValue[1], outValue[2], outValue[3], outValue[4], outValue[5], outValue[6] })?.Trim() ?? "";
}
else
val = Encoding.UTF8.GetString(new byte[] { outValue[0], outValue[1], outValue[2], outValue[3], outValue[8], outValue[9], outValue[10] })?.Trim() ?? "";
data = new RFIDData(val);
data.ReadResult = rtn ? RfidResult.读取成功 : RfidResult.读取失败;
return data;
......
......@@ -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)
{
......@@ -181,7 +181,7 @@ namespace OnlineStore.DeviceLibrary
try
{
List<CodeInfo> cc = new List<CodeInfo>();
eyemNoCode = true;
// eyemNoCode = true;
RemoteDecodeHelper.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper.RemoteDecodeParam
{
......@@ -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,21 @@ namespace OnlineStore.DeviceLibrary
public string ToStr()
{
return $"二维码:{barcode},需求单:{hSerial},料号:{pn},机台:{station},面别:{side},线别:{line}";
return $"二维码:{barcode},需求单:{hSerial},料号:{pn},机台:{station},面别:{side},线别:{line},站位:{slot},点位:{subslot}";
}
/// <summary>
/// 拷贝一个新的实例
/// </summary>
/// <returns></returns>
public Label_LZ ToCopy()
{
Label_LZ posInfo = new Label_LZ();
System.Reflection.PropertyInfo[] info1 = posInfo.GetType().GetProperties();
System.Reflection.PropertyInfo[] info2 = this.GetType().GetProperties();
for (int i = 0; i < info1.Length; i++)
info1[i].SetValue(posInfo, info2[i].GetValue(this));
return posInfo;
}
}
}
......@@ -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<BoxTaskInfo> 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 outlet="",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("outlet", outlet);
map.Add("boxSide", boxSide);
string server = GetAddr(Addr_UploadLocInfo, map);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Get(server);
......@@ -969,9 +1018,9 @@ namespace OnlineStore.DeviceLibrary
//private static string Addr_ShelfFinish = "/rest/api/qisda/device/putShelfFinished";
public static BoxTaskInfo ShelfFinish(string rfid, string barcode = "", BoxTaskInfo boxTaskInfo = null)
public static BoxTaskInfo ShelfFinish(string rfid, string barcode = "", Label_LZ label_LZ = null,string outlet="",string boxside="",int remainTaskCount=-1)
{
LogUtil.info($"BoxFinish rifd【{rfid}】barcode【{barcode}】hSerial【{boxTaskInfo?.hSerial ?? ""}】remainTaskCount【{boxTaskInfo?.remainTaskCount ?? -1}】");
LogUtil.info($"BoxFinish rifd【{rfid}】barcode【{barcode}】outlet【{outlet}】boxside【{boxside}】 hSerial【{label_LZ?.hSerial ?? ""}】remainTaskCount【{remainTaskCount}】");
BoxTaskInfo task = new BoxTaskInfo();
//task.boxLoc = rfid;
......@@ -1091,26 +1140,69 @@ 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;
/// <summary>
/// 料箱rfid
/// </summary>
public string rfid { get; set; }
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 +1299,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<BoxTaskInfo> data { get; set; }
}
public class AfterPutData
{
//>>` {"code": 0, "msg":"ok", "data":{"cutPackageTask":"0","urgentPackageTask":"20","cutTask":"21","urgentTask":"22"}} `
......
......@@ -63,6 +63,7 @@ namespace OnlineStore.DeviceLibrary
/// 3=B侧周转箱内侧,4=B侧周转箱外
/// </summary>
public int ShelfType { get; set; } = 1;
public Label_LZ Label_LZ { get; set; }
}
/// <summary>
/// 出入库料盘信息
......
......@@ -17,7 +17,6 @@ namespace OnlineStore.DeviceLibrary
{
public bool IsDebug = false;
public bool MoveStop = false;
protected int TimerMaxSeconds = 3;
public bool AxisAlarmFlag = false;//轴报警异常标识
protected void SetAllTimer(bool open)
......@@ -152,10 +151,10 @@ namespace OnlineStore.DeviceLibrary
}
BaseTimerProcess();
if (TimerMaxSeconds > 3 && runStatus >= RunStatus.Runing)
{
TimerMaxSeconds = 3;
}
//if (TimerMaxSeconds > 3 && runStatus >= RunStatus.Runing)
//{
// TimerMaxSeconds = 3;
//}
}
catch (Exception ex)
{
......
......@@ -263,8 +263,7 @@ namespace OnlineStore.DeviceLibrary
return false;
}
bool rtn = false;
Task task = Task.Factory.StartNew(new Action(() => { rtn = OpenAllAxis(); }));
task.Wait();
rtn = OpenAllAxis();
if (!rtn)
{
CloseAllAxis();
......@@ -287,8 +286,7 @@ namespace OnlineStore.DeviceLibrary
{
StopMove();
bool rtn = false;
Task task = Task.Factory.StartNew(new Action(() => { rtn = OpenAllAxis(); }));
task.Wait();
rtn = OpenAllAxis();
if (!rtn)
{
CloseAllAxis();
......@@ -318,6 +316,7 @@ namespace OnlineStore.DeviceLibrary
private void StartReset()
{
if (!CanReset())
{
if (System.Windows.Forms.MessageBox.Show("检测到可能的撞机风险,抽屉没有挂在进出轴上才能复位,是否继续?", "警告",
System.Windows.Forms.MessageBoxButtons.YesNo).Equals(System.Windows.Forms.DialogResult.No))
{
......@@ -326,6 +325,8 @@ namespace OnlineStore.DeviceLibrary
LogInfo($"复位 {MoveInfo.SLog} :确认取消");
return;
}
}
if (!CheckTrayState(out string msg))
{
System.Windows.Forms.MessageBox.Show($"{msg},不允许启动/复位", "警告",
......@@ -343,8 +344,6 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.BOX_H001_Wait);
AutoInout.StopAuto();
LogInfo($"复位 {MoveInfo.SLog} :存储机构轴开始复位");
//停止记录
StopRecord();
isInPro = false;
}
......@@ -760,7 +759,7 @@ namespace OnlineStore.DeviceLibrary
bool result = waitAOutStoreList.TryDequeue(out param);
if (result && param != null)
{
LogInfo("执行A面排队的出库【" + param.PosInfo.ToStr() + "】");
//LogInfo("执行A面排队的出库【" + param.PosInfo.ToStr() + "】");
StartExecuctOut(param);
return;
}
......@@ -771,7 +770,7 @@ namespace OnlineStore.DeviceLibrary
bool result = waitAOutStoreList.TryDequeue(out param);
if (result && param != null)
{
LogInfo("执行A面排队的出库【" + param.PosInfo.ToStr() + "】");
//LogInfo("执行A面排队的出库【" + param.PosInfo.ToStr() + "】");
StartExecuctOut(param);
return;
}
......@@ -789,7 +788,7 @@ namespace OnlineStore.DeviceLibrary
bool result = waitBOutStoreList.TryDequeue(out param);
if (result && param != null)
{
LogInfo("执行B面排队的出库【" + param.PosInfo.ToStr() + "】");
//LogInfo("执行B面排队的出库【" + param.PosInfo.ToStr() + "】");
StartExecuctOut(param);
return;
}
......@@ -800,7 +799,7 @@ namespace OnlineStore.DeviceLibrary
bool result = waitBOutStoreList.TryDequeue(out param);
if (result && param != null)
{
LogInfo("执行B面排队的出库【" + param.PosInfo.ToStr() + "】");
//LogInfo("执行B面排队的出库【" + param.PosInfo.ToStr() + "】");
StartExecuctOut(param);
return;
}
......@@ -888,7 +887,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo("启动完成,A皮带线有料盘,启动线体处理");
StartLineARun(new InOutParam(BufferDataManager.ALineStoreInfo));
}
else if (BufferDataManager.BLineStoreInfo != null)
if (BufferDataManager.BLineStoreInfo != null)
{
LogInfo("启动完成,B皮带线有料盘,启动线体处理");
StartLineBRun(new InOutParam(BufferDataManager.BLineStoreInfo));
......@@ -959,8 +958,6 @@ namespace OnlineStore.DeviceLibrary
ComAxis_A.SuddenStop();
CloseAllAxis();
//停止记录
StopRecord();
}
......@@ -1031,7 +1028,7 @@ namespace OnlineStore.DeviceLibrary
string outMsg = "";
if (!axis.Open(true, out outMsg))
{
LogUtil.error(outMsg);
SetWarnMsg(Name + outMsg);
return false;
}
}
......
......@@ -16,45 +16,141 @@ namespace OnlineStore.DeviceLibrary
{
partial class BoxEquip
{
public const string boxACamName = "box_A";
public const string boxBCamName = "box_B";
public const string boxACamName = "box_A";
public const string boxBCamName = "box_B";
Thread[] camerathread;
bool IsOpen = false;
Asa.Camera.VisionLib camera;
bool loadCameraState = false;
public delegate void CameraAcqEventHandler(CameraArgs cameraArgs);
public event CameraAcqEventHandler camera_event;
public void RegisterCameraGrabImage(CameraAcqEventHandler grabbedEventHandler)
{
camera_event += grabbedEventHandler;
}
void LoadCameraConfig(string id = "")
{
if (loadCameraState)
return;
string path = Application.StartupPath+@"\Config\IPCamera.json";
if (!File.Exists(path))
Task.Factory.StartNew(new Action(() =>
{
LogUtil.error(Name + "找不到监控相机配置文件:" + path);
}
if (loadCameraState)
return;
string path = @".\Config\Camera.json";
if (!File.Exists(path))
{
LogUtil.error(Name + "找不到监控相机配置文件" + path);
}
camera = new Asa.Camera.VisionLib(path);
camerathread = new Thread[2];
//pictureBox1.Image = bmp;
StartCamera();
loadCameraState = true;
}));
IPCameraManager.LoadConfig(path);
loadCameraState = true;
}
public void RegisterCameraAGrabImage(ImageGrabbedEventHandler grabbedEventHandler)
void StartCamera()
{
IPCameraManager.GetCamera(boxACamName).ImageGrabbed += grabbedEventHandler;
IPCameraManager.GetCamera(boxACamName).StartLive();
camera.Open(boxACamName);
camera.Open(boxBCamName);
IsOpen = true;
camerathread[0] = new Thread(new ParameterizedThreadStart(startMonitor));
camerathread[0].IsBackground = true;
camerathread[0].Start(boxACamName);
camerathread[1] = new Thread(new ParameterizedThreadStart(startMonitor));
camerathread[1].IsBackground = true;
camerathread[1].Start(boxBCamName);
}
void startMonitor(object obj)
{
if (!loadCameraState)
{
LogUtil.error(obj + " 监控相机初始化失败,无法开启");
return;
}
string name = (string)obj;
try
{
while (IsOpen)
{
Bitmap bmp = AcqImage(name);
if (bmp != null)
camera_event?.Invoke(new CameraArgs(name, bmp));
Thread.Sleep(300);
}
}
catch
{ }
}
public void RegisterCameraBGrabImage(ImageGrabbedEventHandler grabbedEventHandler)
void StopCamera()
{
IPCameraManager.GetCamera(boxBCamName).ImageGrabbed += grabbedEventHandler;
IPCameraManager.GetCamera(boxBCamName).StartLive();
IsOpen = false;
camera.Close();
camera.Dispose();
}
public void UnRegisterCameraAGrabImage(ImageGrabbedEventHandler grabbedEventHandler)
public Bitmap AcqImage(string camName)
{
IPCameraManager.GetCamera(boxACamName).ImageGrabbed -= grabbedEventHandler;
IPCameraManager.GetCamera(boxACamName).StopLive();
Bitmap bitmap = camera.GetImage(camName);
return bitmap;
}
public void UnRegisterCameraBGrabImage(ImageGrabbedEventHandler grabbedEventHandler)
}
public class CameraArgs : EventArgs
{
/// <summary>
/// 相机名
/// </summary>
public string CamName { get; set; }
/// <summary>
/// 相机采集的图片
/// </summary>
public Bitmap Image { get; set; }
public CameraArgs(string name, Bitmap img)
{
IPCameraManager.GetCamera(boxBCamName).ImageGrabbed -= grabbedEventHandler;
IPCameraManager.GetCamera(boxBCamName).StopLive();
CamName = name;
Image = img;
}
void StartRecord() { }
void StopRecord() { }
}
//partial class BoxEquip
//{
// public const string boxACamName = "box_A";
// public const string boxBCamName = "box_B";
// bool loadCameraState = false;
// void LoadCameraConfig(string id = "")
// {
// if (loadCameraState)
// return;
// string path = Application.StartupPath+@"\Config\IPCamera.json";
// if (!File.Exists(path))
// {
// LogUtil.error(Name + "找不到监控相机配置文件:" + path);
// }
// IPCameraManager.LoadConfig(path);
// loadCameraState = true;
// }
// public void RegisterCameraAGrabImage(ImageGrabbedEventHandler grabbedEventHandler)
// {
// IPCameraManager.GetCamera(boxACamName).ImageGrabbed += grabbedEventHandler;
// IPCameraManager.GetCamera(boxACamName).StartLive();
// }
// public void RegisterCameraBGrabImage(ImageGrabbedEventHandler grabbedEventHandler)
// {
// IPCameraManager.GetCamera(boxBCamName).ImageGrabbed += grabbedEventHandler;
// IPCameraManager.GetCamera(boxBCamName).StartLive();
// }
// public void UnRegisterCameraAGrabImage(ImageGrabbedEventHandler grabbedEventHandler)
// {
// IPCameraManager.GetCamera(boxACamName).ImageGrabbed -= grabbedEventHandler;
// IPCameraManager.GetCamera(boxACamName).StopLive();
// }
// public void UnRegisterCameraBGrabImage(ImageGrabbedEventHandler grabbedEventHandler)
// {
// IPCameraManager.GetCamera(boxBCamName).ImageGrabbed -= grabbedEventHandler;
// IPCameraManager.GetCamera(boxBCamName).StopLive();
// }
// void StartRecord() { }
// void StopRecord() { }
//}
}
......@@ -444,15 +444,14 @@ namespace OnlineStore.DeviceLibrary
MoveAxisToP1();
PullAxis_UpdownToP1();
UpdownAxisTo_P3_P9();
XAxis_To_P1();
//XAxis_To_P1();
BothXAxis_To_P1();
}
else
{
SetBoxStatus(DeviceStatus.StoreOnline, RunStatus.Runing);
LogInfo($"入库 {MoveInfo.SLog}:入库结束[{MoveInfo.MoveParam.PosInfo.PosId}][耗时:{(DateTime.Now - startTime).TotalSeconds.ToString("f2")}秒][{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
MoveInfo.EndMove();
//停止记录
StopRecord();
AutoInout.InOutEndProcess(this, MoveType.InStore);
}
......@@ -472,8 +471,6 @@ namespace OnlineStore.DeviceLibrary
SetBoxStatus(DeviceStatus.StoreOnline, RunStatus.Runing);
LogInfo($"入库 {MoveInfo.SLog}:入库结束[{MoveInfo.MoveParam.PosInfo.PosId}][耗时:{(DateTime.Now - startTime).TotalSeconds.ToString("f2")}秒][{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
MoveInfo.EndMove();
//停止记录
StopRecord();
AutoInout.InOutEndProcess(this, MoveType.InStore);
break;
}
......
......@@ -161,13 +161,10 @@ namespace OnlineStore.DeviceLibrary
LogInfo($"出库 {MoveInfoLineA.SLog}:料盘到达线体末端,出库完成[{MoveInfoLineA.MoveParam.PosInfo.GetPosSide()}面]");
break;
case StepEnum.Line_08_Finish:
SetBoxStatus(DeviceStatus.StoreOnline, RunStatus.Runing);
MoveInfoLineA.EndMove();
break;
default:
LogUtil.error($"MoveInfoLineA 未找到处理:{MoveInfoLineA.SLog}");
SetBoxStatus(DeviceStatus.StoreOnline, RunStatus.Runing);
MoveInfoLineA.EndMove();
break;
}
......
......@@ -156,12 +156,10 @@ namespace OnlineStore.DeviceLibrary
LogInfo($"出库 {MoveInfoLineB.SLog}:料盘到达线体末端,出库完成[{MoveInfoLineB.MoveParam.PosInfo.GetPosSide()}面]");
break;
case StepEnum.Line_08_Finish:
SetBoxStatus(DeviceStatus.StoreOnline, RunStatus.Runing);
MoveInfoLineB.EndMove();
break;
default:
LogUtil.error($"MoveInfoLineB 未找到处理:{MoveInfoLineB.SLog}");
SetBoxStatus(DeviceStatus.StoreOnline, RunStatus.Runing);
MoveInfoLineB.EndMove();
break;
}
......
......@@ -302,6 +302,7 @@ namespace OnlineStore.DeviceLibrary
//if (MoveInfo.MoveParam.PosInfoBack == null)
{
MoveInfo.NextMoveStep(StepEnum.SO_20_Finish);
BothXAxis_To_P1();
LogInfo($"出库 {MoveInfo.SLog}:出库结束[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");//另一面料叉无料,
}
//else
......@@ -320,8 +321,6 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.SO_20_Finish:
SetBoxStatus(DeviceStatus.StoreOnline, RunStatus.Runing);
MoveInfo.EndMove();
//停止记录
StopRecord();
AutoInout.InOutEndProcess(this, MoveType.OutStore);
break;
}
......
......@@ -752,6 +752,11 @@ namespace OnlineStore.DeviceLibrary
msg += $"B侧拉取机构拉钩检测信号亮,";
hookB = true;
}
if(hookA || hookB)
{
return false;
}
bool atBside = false;
bool atAside = false;
for (int i = 1; i <= trayBColumns.Length; i++)
......@@ -949,7 +954,7 @@ namespace OnlineStore.DeviceLibrary
break;
}
if (res == 0)
LogInfo($"列{res}信号已屏蔽");
LogInfo($"列{name}信号已屏蔽");
return res == 0 ? true : false;
}
#endregion
......@@ -1043,8 +1048,6 @@ namespace OnlineStore.DeviceLibrary
param.MoveP = new LineMoveP(Config, param.PosInfo.PosId);
// LogInfo("LoadInoutParam:" + JsonHelper.SerializeObject(param.MoveP));
MoveInfo.NewMove(MoveType.InStore, param);
///开始记录
StartRecord();
SetBoxStatus(DeviceStatus.InStoreExecute, RunStatus.Busy, param.PosInfo.PosId, param.PosInfo.barcode);
if (param.PosInfoBack != null)
MoveInfo.NextMoveStep(StepEnum.SIB_00_StartInstore);
......@@ -1244,7 +1247,7 @@ namespace OnlineStore.DeviceLibrary
reviceList = (from m in reviceList where m.PosInfo.PosId.Equals(param.PosInfo.PosId) select m).ToList<InOutParam>();
if (reviceList.Count == 0)
{
LogInfo(" 执行出库【" + param.PosInfo.ToStr() + "】失败,加入等待队列");
//LogInfo(" 执行出库【" + param.PosInfo.ToStr() + "】失败,加入等待队列");
if (param.PosInfo.GetPosSide().Equals("A"))
{
waitAOutStoreList.Enqueue(param);
......@@ -1292,8 +1295,6 @@ namespace OnlineStore.DeviceLibrary
SetBoxStatus(DeviceStatus.OutStoreExecute, RunStatus.Busy, param.PosInfo.PosId, param.PosInfo.barcode);
MoveInfo.NewMove(MoveType.OutStore, param);
LogInfo("启动出库【" + param.PosInfo.ToStr() + "】 ");
///开始记录
StartRecord();
//LogInfo("LoadInoutParam:" + JsonHelper.SerializeObject(param.MoveP));
MoveInfo.NextMoveStep(StepEnum.SO_00_StartOutstore);
AxisAlarmFlag = false;
......
......@@ -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;
}
......@@ -300,7 +302,7 @@ namespace OnlineStore.DeviceLibrary
{
}
PrintLabel.PrinteLabelProcess();
// PrintLabel.PrinteLabelProcess();
if (MoveInfo.MoveType.Equals(MoveType.None) && NoErrorAlarm())
{
if (IsDebug) return;
......@@ -632,11 +634,11 @@ namespace OnlineStore.DeviceLibrary
private void SecurityAccessReset()
{
if (!baseConfig.DIList.ContainsKey(IO_Type.NGDoor_Limit))
if (!baseConfig.DIList.ContainsKey(IO_Type.Shelf_SafetyRasterSignal))
{
return;
}
if (!baseConfig.DIList.ContainsKey(IO_Type.FrontDoor_Limit))
if (!baseConfig.DIList.ContainsKey(IO_Type.TurnoverBox_SafetyRasterSignal))
{
return;
}
......
......@@ -82,7 +82,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.II64_UpdownToP11);
MoveLog($"入料->A侧");
}
#region 入库
private DateTime startInTime = DateTime.Now;
public override bool StartInstore(InOutParam param)
......@@ -102,7 +102,7 @@ namespace OnlineStore.DeviceLibrary
runStatus = RunStatus.Busy;
MoveInfo.NewMove(MoveType.InStore, param);
startInTime = DateTime.Now;
if(IsInSafePos())
if (IsInSafePos())
{
MoveInfo.NextMoveStep(StepEnum.II00_ToShelfArea);
To入料口();
......@@ -165,7 +165,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.II06_WaitHeight))
{
BatchMoveBean moveBean = BatchMove;
if (moveBean.LastHeight > 0)
//if (moveBean.LastHeight > 0)
{
ClearTimeoutAlarm("获取料盘高度完成超时");
int Height = 8;//moveBean.LastHeight;
......@@ -180,10 +180,10 @@ namespace OnlineStore.DeviceLibrary
MoveLog($"入库取料{shelf}{MoveInfo.SLog}: 料盘尺寸{width}X{Height}");
II13_GetPosId();
}
else if (MoveInfo.IsTimeOut(60))
{
MoveTimeOut(MoveInfo, "" + moveBean.Name + "获取料盘高度完成");
}
//else if (MoveInfo.IsTimeOut(60))
//{
// MoveTimeOut(MoveInfo, "" + moveBean.Name + "获取料盘高度完成");
//}
}
else if (MoveInfo.IsStep(StepEnum.II08_GetPosId))
{
......@@ -223,7 +223,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if(CheckOutStore())
if (CheckOutStore())
{
MoveInfo.NextMoveStep(StepEnum.II81_ToNgArea);
ToNG();
......@@ -346,7 +346,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StepEnum.II85_BackToP1))
{
// if (shelf.Equals(1))
// if (shelf.Equals(1))
{
MoveLog($" 入料->NG箱放料结束");
MoveInfo.EndMove();
......@@ -360,7 +360,7 @@ namespace OnlineStore.DeviceLibrary
///
/// </summary>
/// <returns></returns>
bool CheckLineEnd(InOutPosInfo posInfo,string ioType)
bool CheckLineEnd(InOutPosInfo posInfo, string ioType)
{
return (posInfo != null && IOValue(ioType).Equals(IO_VALUE.HIGH));
}
......@@ -411,7 +411,7 @@ namespace OnlineStore.DeviceLibrary
//判断是A还是B
if (lastPosInfo.IsNG)
{
if(NGBox.CanPutIn(out string msg))
if (NGBox.CanPutIn(out string msg))
{
MoveInfo.NextMoveStep(StepEnum.II81_ToNgArea);
ClearSpecifiedAlarm("无法放料");
......@@ -537,16 +537,16 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.II05_WaitAxisCheck);
MoveLog($"入库取料, 等待定位料盘信号消失,通知料串料盘已离开");
if (IOValue(IO_Type.Shelf_ReelCheck).Equals(IO_VALUE.LOW))
{
MoveInfo.NextMoveStep(StepEnum.II06_WaitHeight);
BatchMove.GetTrayOK();
}
else
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Shelf_ReelCheck, IO_VALUE.LOW));
}
if (IOValue(IO_Type.Shelf_ReelCheck).Equals(IO_VALUE.LOW))
{
MoveInfo.NextMoveStep(StepEnum.II06_WaitHeight);
BatchMove.GetTrayOK();
}
else
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Shelf_ReelCheck, IO_VALUE.LOW));
}
}
#endregion
}
......
......@@ -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,222 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveType.Equals(MoveType.None))
{
outstoreNG = false;
if (ReadBoxAId())
BoxA.BoxTaskInfo = SServerManager.GetBoxStatusInfo(Config.CID, BoxAId);
if (ReadBoxBId())
//获取料仓两个出料口信息
List<BoxTaskInfo> 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;
PrintLabel.LabelInfo = SServerManager.GetFeederInfo(BufferDataManager.LabelInfo.barcode);
if (PrintLabel.LabelInfo != null)
if (!outstoreNG)//有贴标信息
{
if (BoxA.BoxTaskInfo != null)
if (PrintLabel.LabelInfo != null)
{
string msgA = "";
if (!BoxA.CanPutIn(out string warnB))
{
msgA = warnB;
}
else if (!string.IsNullOrEmpty(BoxA.BoxTaskInfo.hSerial))
param.Label_LZ = PrintLabel?.LabelInfo.ToCopy();
}
else
{
param.Label_LZ = SServerManager.GetFeederInfo(BufferDataManager.LabelInfo.barcode);
}
if (param.Label_LZ != null)
{
if (boxInfos.Count == 0)//无料箱绑定,读取到哪个箱子就放哪个箱子
{
if (!BoxA.BoxTaskInfo.hSerial.Equals(PrintLabel.LabelInfo.hSerial))
if(ReadBoxAId())
{
msgA = ($"料盘与料箱需求单不匹配,出库失败。料盘【{PrintLabel.LabelInfo.hSerial}】料箱【{BoxA.BoxTaskInfo.hSerial}】:" + param.PosInfo.ToStr());
BoxA.NeedLeave();
}
else
{
if (PrintLabel.LabelInfo.side.Equals("T"))
if (param.Label_LZ.side.Equals("T"))
{
param.ShelfType = 1;
boxTaskInfo = BoxA.BoxTaskInfo;
canOutstore = true;
}
else if (PrintLabel.LabelInfo.side.Equals("B"))
else if (param.Label_LZ.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"))
{
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 = ($"料盘的面别信息有误:{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();
LogUtil.info($"两出料口无料箱绑定,使用A周转箱:{(param.Label_LZ.hSerial ?? "")}");
}
else
else if(ReadBoxBId())
{
if (PrintLabel.LabelInfo.side.Equals("T"))
if (param.Label_LZ.side.Equals("T"))
{
param.ShelfType = 3;
boxTaskInfo = BoxB.BoxTaskInfo;
canOutstore = true;
}
else if (PrintLabel.LabelInfo.side.Equals("B"))
else if (param.Label_LZ.side.Equals("B"))
{
param.ShelfType = 4;
boxTaskInfo = BoxB.BoxTaskInfo;
canOutstore = true;
}
else
{
//msg1 = ($"料盘的面别信息有误:{PrintLabel.LabelInfo.side}。出库失败:" + param.PosInfo.ToStr());
outstoreNG = true;
}
LogUtil.info($"两出料口无料箱绑定,使用B周转箱:{(param.Label_LZ.hSerial ?? "")}");
}
else
{
SetWarnMsg("两出料口均未读到RFID,无法工单出库");
}
}
else
{
if (PrintLabel.LabelInfo.side.Equals("T"))
var box = boxInfos.Find(s => param.Label_LZ.hSerial.Equals(s.hSerial) && (s.boxBCount < maxCnt && s.boxTCount < maxCnt));
StringBuilder sb = new StringBuilder();
if (box != null)//相同工单且有空位
{
param.ShelfType = 3;
boxTaskInfo = BoxB.BoxTaskInfo;
canOutstore = true;
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 (param.Label_LZ.side.Equals("T"))
{
param.ShelfType = 1;
canOutstore = true;
}
else if (param.Label_LZ.side.Equals("B"))
{
param.ShelfType = 2;
canOutstore = true;
}
}
else
{
if (param.Label_LZ.side.Equals("T"))
{
param.ShelfType = 3;
canOutstore = true;
}
else if (param.Label_LZ.side.Equals("B"))
{
param.ShelfType = 4;
canOutstore = true;
}
}
LogUtil.info($"相同工单且有空位,使用{turnoverBox.Name}:{(param.Label_LZ.hSerial ?? "")}");
}
else
{
SetWarnMsg($"工单{box.hSerial}已有料在{turnoverBox.Name}放入{box.rfid}中,无法放入其他料箱{turnoverBox.BoxId}");
}
}
else
{
SetWarnMsg($"未读到RFID,工单{box.hSerial}已有料在{turnoverBox.Name}放入{box.rfid}中");
return false;
}
}
else if (PrintLabel.LabelInfo.side.Equals("B"))
else //工单不同或者格口已满
{
param.ShelfType = 4;
boxTaskInfo = BoxB.BoxTaskInfo;
canOutstore = true;
if (BoxA.ReadBoxId())
{
var boxTmp = boxInfos.Find(s => BoxA.outLet.Equals(s.outlet));
if (boxTmp != null)//有A周转信息
{
if (!BoxA.BoxId.Equals(boxTmp.rfid))
{
if (param.Label_LZ.side.Equals("T"))
{
param.ShelfType = 1;
canOutstore = true;
}
else if (param.Label_LZ.side.Equals("B"))
{
param.ShelfType = 2;
canOutstore = true;
}
LogUtil.info($"工单不同或者上一料箱格口已满,当前料箱{BoxA.BoxId}与上一料箱{boxTmp.rfid}不同,工单{param.Label_LZ.hSerial}使用料箱{BoxA.BoxId}");
}
else
{
sb.Append($"{BoxA.Name}内工单{boxTmp.hSerial}与待出库工单{param.Label_LZ.hSerial}不符,无法出库");
}
}
else//无A周转信息
{
if (param.Label_LZ.side.Equals("T"))
{
param.ShelfType = 1;
canOutstore = true;
}
else if (param.Label_LZ.side.Equals("B"))
{
param.ShelfType = 2;
canOutstore = true;
}
LogUtil.info($"工单不同或者上一料箱格口已满,出料口无信息,工单{param.Label_LZ.hSerial}使用料箱{BoxA.BoxId}");
}
}
if (!canOutstore)
{
if (BoxB.ReadBoxId())
{
var boxTmp1 = boxInfos.Find(s => BoxB.outLet.Equals(s.outlet));
if (boxTmp1 != null)
{
if (!BoxB.BoxId.Equals(boxTmp1.rfid))
{
if (param.Label_LZ.side.Equals("T"))
{
param.ShelfType = 3;
canOutstore = true;
}
else if (param.Label_LZ.side.Equals("B"))
{
param.ShelfType = 4;
canOutstore = true;
}
LogUtil.info($"工单不同或者上一料箱格口已满,当前料箱{BoxB.BoxId}与上一料箱{boxTmp1.rfid}不同,工单{param.Label_LZ.hSerial}使用料箱{BoxB.BoxId}");
}
else
{
sb.Append($"{BoxB.Name}内工单{boxTmp1.hSerial}与待出库工单{param.Label_LZ.hSerial}不符,无法出库");
}
}
else//无B周转信息
{
if (param.Label_LZ.side.Equals("T"))
{
param.ShelfType = 3;
canOutstore = true;
}
else if (param.Label_LZ.side.Equals("B"))
{
param.ShelfType = 4;
canOutstore = true;
}
LogUtil.info($"工单不同或者上一料箱格口已满,出料口无信息,工单{param.Label_LZ.hSerial}使用料箱{BoxB.BoxId}");
}
}
else
{
SetWarnMsg("周转箱线体上无可用料箱");
}
}
}
else
if (!string.IsNullOrEmpty(sb.ToString()))
{
//msg1 = ($"料盘的面别信息有误:{PrintLabel.LabelInfo.side}。出库失败:" + param.PosInfo.ToStr());
outstoreNG = true;
SetWarnMsg(sb.ToString());
}
}
BoxB.WarnMsg = msg1;
SetWarnMsg(msg1);
}
else
outstoreNG = true;
}
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 +269,12 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NewMove(MoveType.OutStore, param);
startOutTime = DateTime.Now;
MoveInfo.NextMoveStep(StepEnum.IO01_ReelCheck);
//Label_CylinderBack(MoveInfo);
SetWarnMsg("");
LogUtil.info($"工单出库:barcode【{param?.PosInfo?.barcode ?? ""}】hSerial【{param?.Label_LZ?.hSerial ?? ""}】box【{getSideName(param.ShelfType)}】【{BoxA.BoxId}】【{BoxB.BoxId}】");
return true;
}
return false;
}
private void TrayHasLeave()
{
......@@ -555,7 +602,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IO42_UploadReelInfo))
{
MoveInfo.NextMoveStep(StepEnum.IO43_BackToP1);
// NGBox.PutIn(MoveInfo.MoveParam);
// NGBox.PutIn(MoveInfo.MoveParam);
SServerManager.UploadLocInfo(MoveInfo.MoveParam.PosInfo.barcode, LocStatus.FINISHED);
IO43_BackToP1(shelf);
}
......@@ -570,15 +617,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, MoveInfo.MoveParam?.Label_LZ?.hSerial ?? "", BoxA.outLet, boxSide);
SServerManager.ShelfFinish(BoxAId, MoveInfo.MoveParam.PosInfo.barcode, MoveInfo.MoveParam.Label_LZ, BoxA.outLet, boxSide, BoxA?.BoxTaskInfo?.remainTaskCount ?? -1);
}
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, MoveInfo.MoveParam?.Label_LZ?.hSerial ?? "", BoxB.outLet, boxSide);
SServerManager.ShelfFinish(BoxBId, MoveInfo.MoveParam.PosInfo.barcode, MoveInfo.MoveParam?.Label_LZ, BoxB.outLet, boxSide, BoxB?.BoxTaskInfo?.remainTaskCount ?? -1);
}
}
......@@ -611,15 +665,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)
......
......@@ -12,8 +12,9 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
partial class InputEquip
{
public TurnoverBox BoxA;
public TurnoverBox BoxB;
public TurnoverBox BoxA;
public TurnoverBox BoxB;
public List<TurnoverBox> turnoverBoxes;
/// <summary>
/// 周转箱A的编号
/// </summary>
......
......@@ -23,6 +23,8 @@ namespace OnlineStore.DeviceLibrary
public DeviceMoveInfo MoveInfo;
public string WarnMsg = "";
public string Name = "打标机";
protected System.Timers.Timer mainTimer;
public PrintLabelBean(InputEquip equip)
{
this.Robot = equip;
......@@ -30,7 +32,19 @@ namespace OnlineStore.DeviceLibrary
MoveInfo = new DeviceMoveInfo(Name);
if (BufferDataManager.LabelInfo != null)
LabelInfo = SServerManager.GetFeederInfo(BufferDataManager.LabelInfo.barcode);
mainTimer = new System.Timers.Timer();
mainTimer.Enabled = false;
mainTimer.Interval = 500;
mainTimer.Elapsed += MainTimer_Elapsed;
mainTimer.AutoReset = true;
mainTimer.Enabled = true;
}
object locObject = new object();
private void MainTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
PrinteLabelProcess();
}
public string GetMoveStr()
{
return "【" + (LabelInfo?.ToStr() ?? "") + "】【"
......@@ -73,13 +87,14 @@ namespace OnlineStore.DeviceLibrary
{
param.PosInfo.outstoreNG = true;
BufferDataManager.LabelInfo = param.PosInfo.ToCopy();
LogUtil.info($"贴标信息为null,紧急料出库:{param.PosInfo.ToCopy()}");
return;
//warnMsg = ("无法获取料盘贴标信息。出库失败:" + param.PosInfo.ToStr());
}
else if (string.IsNullOrEmpty(LabelInfo.line))
{
param.PosInfo.outstoreNG = true;
BufferDataManager.LabelInfo = param.PosInfo.ToCopy();
LogUtil.info($"贴标无线体信息,紧急料出库:{param.PosInfo.ToCopy()}");
return;
//warnMsg = ("料盘贴标无线体信息,出库NG:" + param.PosInfo.ToStr());
}
......@@ -87,6 +102,7 @@ namespace OnlineStore.DeviceLibrary
{
param.PosInfo.outstoreNG = true;
BufferDataManager.LabelInfo = param.PosInfo.ToCopy();
LogUtil.info($"贴标无工单信息,紧急料出库:{param.PosInfo.ToCopy()}");
return;
//warnMsg = ("料盘贴标无需求单信息,出库NG:" + param.PosInfo.ToStr());
}
......@@ -176,164 +192,171 @@ namespace OnlineStore.DeviceLibrary
}
public void PrinteLabelProcess()
{
try
if(Monitor.TryEnter(locObject))
{
if (MoveInfo.IsInWait)
{
CheckWait(MoveInfo);
}
if (MoveInfo.IsInWait)
{
return;
}
if (MoveInfo.IsStep(StepEnum.Label00_ScanCode))
try
{
MoveInfo.NextMoveStep(StepEnum.Label01_ConnectPrinter);
if (Printer.Connect(out string msg))
if (MoveInfo.IsInWait)
{
MoveLog($"打标:连接打印机");
CheckWait(MoveInfo);
}
else
if (MoveInfo.IsInWait)
{
MoveLog($"打标:连接打印机:{msg}");
return;
}
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (MoveInfo.IsStep(StepEnum.Label01_ConnectPrinter))
{
if (Printer.IsReadyPrint(out string msg))
if (MoveInfo.IsStep(StepEnum.Label00_ScanCode))
{
MoveInfo.NextMoveStep(StepEnum.Label02_CheckState);
SetWarnMsg();
MoveLog($"打标:打印机准备就绪");
Thread.Sleep(1000);
MoveInfo.NextMoveStep(StepEnum.Label01_ConnectPrinter);
if (Printer.Connect(out string msg))
{
MoveLog($"打标:连接打印机");
}
else
{
MoveLog($"打标:连接打印机:{msg}");
}
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else
else if (MoveInfo.IsStep(StepEnum.Label01_ConnectPrinter))
{
SetWarnMsg($"打印机状态异常:{msg}");
Thread.Sleep(2000);
if (Printer.IsReadyPrint(out string msg))
{
MoveInfo.NextMoveStep(StepEnum.Label02_CheckState);
SetWarnMsg();
MoveLog($"打标:打印机准备就绪");
Thread.Sleep(1000);
}
else
{
SetWarnMsg($"打印机状态异常:{msg}");
Thread.Sleep(2000);
}
}
}
else if (MoveInfo.IsStep(StepEnum.Label02_CheckState))
{
else if (MoveInfo.IsStep(StepEnum.Label02_CheckState))
{
if (!Printer.IsLabelOnPeeler())
if (!CheckLabel())
{
MoveInfo.NextMoveStep(StepEnum.Label03_HasLabelAtDoor);
MoveLog($"打标:剥纸器上无标签");
}
else
{
SetWarnMsg($"剥纸器上有标签,无法打印");
Thread.Sleep(2000);
}
}
else if (MoveInfo.IsStep(StepEnum.Label03_HasLabelAtDoor))
{
MoveInfo.NextMoveStep(StepEnum.Label03_HasLabelAtDoor);
MoveLog($"打标:剥纸器上无标签");
MoveInfo.NextMoveStep(StepEnum.Label04_PrintLabel);
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));
}
else
else if (MoveInfo.IsStep(StepEnum.Label04_PrintLabel))
{
SetWarnMsg($"剥纸器上有标签,无法打印");
Thread.Sleep(2000);
if (CheckLabel())
{
MoveInfo.NextMoveStep(StepEnum.Label05_WaitPrintOK);
MoveLog($"打标:出标完成");
}
else if (MoveInfo.IsTimeOut(5))
{
MoveInfo.NextMoveStep(StepEnum.Label05_WaitPrintOK);
MoveLog($"打标:5秒超时,认为出标完成");
}
//else if (MoveInfo.IsTimeOut(15))
//{
// MoveInfo.NextMoveStep(StepEnum.Label03_HasLabelAtDoor);
// MoveLog($"打标:出标超时15秒,重新发送打印任务");
//}
Thread.Sleep(1000);
}
}
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);
MoveLog($"打标:开始打印标签【{msg}】:{LabelInfo.ToStr()}");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (MoveInfo.IsStep(StepEnum.Label04_PrintLabel))
{
if (CheckLabel())
else if (MoveInfo.IsStep(StepEnum.Label05_WaitPrintOK))
{
MoveInfo.NextMoveStep(StepEnum.Label05_WaitPrintOK);
MoveLog($"打标:出标完成");
MoveInfo.NextMoveStep(StepEnum.Label06_LabelFwd);
MoveLog($"打标:标签平台前进");
Label_CylinderFwd(MoveInfo);
}
else if (MoveInfo.IsTimeOut(5))
else if (MoveInfo.IsStep(StepEnum.Label06_LabelFwd))
{
MoveInfo.NextMoveStep(StepEnum.Label05_WaitPrintOK);
MoveLog($"打标:5秒超时,认为出标完成");
if (checkLabelInPos())
{
MoveInfo.NextMoveStep(StepEnum.Label07_CheckLabelInPos);
CloseSuckLabel();
MoveLog($"打标:标签在平台上");
}
else
{
MoveInfo.NextMoveStep(StepEnum.Label01_ConnectPrinter);
MoveLog($"打标:未检测到标签在平台上,标签平台后退,准备重新打印");
Label_CylinderBack(MoveInfo);
}
}
//else if (MoveInfo.IsTimeOut(15))
//{
// MoveInfo.NextMoveStep(StepEnum.Label03_HasLabelAtDoor);
// MoveLog($"打标:出标超时15秒,重新发送打印任务");
//}
Thread.Sleep(1000);
}
else if (MoveInfo.IsStep(StepEnum.Label05_WaitPrintOK))
{
MoveInfo.NextMoveStep(StepEnum.Label06_LabelFwd);
MoveLog($"打标:标签平台前进");
Label_CylinderFwd(MoveInfo);
}
else if (MoveInfo.IsStep(StepEnum.Label06_LabelFwd))
{
if (checkLabelInPos())
else if (MoveInfo.IsStep(StepEnum.Label07_CheckLabelInPos))
{
MoveInfo.NextMoveStep(StepEnum.Label07_CheckLabelInPos);
CloseSuckLabel();
MoveLog($"打标:标签在平台上");
MoveInfo.NextMoveStep(StepEnum.Label08_CloseConnect);
MoveLog($"打标:关闭打印机连接");
Printer.Close();
}
else
else if (MoveInfo.IsStep(StepEnum.Label08_CloseConnect))
{
MoveInfo.NextMoveStep(StepEnum.Label01_ConnectPrinter);
MoveLog($"打标:未检测到标签在平台上,标签平台后退,准备重新打印");
Label_CylinderBack(MoveInfo);
if (scanCode == null || (scanCode.IsCompleted))
{
MoveInfo.NextMoveStep(StepEnum.Label09_WaitLabelLeave);
MoveInfo.MoveParam.PosInfo.relativeAngle = LabelManager.CalcLabelAngle(MoveInfo?.MoveParam?.PosInfo?.LabelParam);
int startp = MoveInfo.MoveParam.PosInfo.GetPosType();
if (startp.Equals(1))
{
if (BufferDataManager.AOutStoreInfo != null)
BufferDataManager.AOutStoreInfo.Labeled = true;
}
else
{
if (BufferDataManager.BOutStoreInfo != null)
BufferDataManager.BOutStoreInfo.Labeled = true;
}
MoveLog($"打标:{MoveInfo.MoveParam.PosInfo.barcode}标记为打标,计算的贴标旋转角度:{MoveInfo.MoveParam.PosInfo.relativeAngle}°");
SetWarnMsg();
BufferDataManager.LabelInfo = MoveInfo.MoveParam.PosInfo.ToCopy();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else if (MoveInfo.IsTimeOut(15))
{
SetWarnMsg("等待相机解析旋转角度超时");
}
}
}
else if (MoveInfo.IsStep(StepEnum.Label07_CheckLabelInPos))
{
MoveInfo.NextMoveStep(StepEnum.Label08_CloseConnect);
MoveLog($"打标:关闭打印机连接");
Printer.Close();
}
else if (MoveInfo.IsStep(StepEnum.Label08_CloseConnect))
{
if (scanCode == null || (scanCode.IsCompleted))
else if (MoveInfo.IsStep(StepEnum.Label09_WaitLabelLeave))
{
MoveInfo.NextMoveStep(StepEnum.Label09_WaitLabelLeave);
MoveInfo.MoveParam.PosInfo.relativeAngle = LabelManager.CalcLabelAngle(MoveInfo?.MoveParam?.PosInfo?.LabelParam);
int startp = MoveInfo.MoveParam.PosInfo.GetPosType();
if (startp.Equals(1))
if (BufferDataManager.LabelInfo == null)
{
if (BufferDataManager.AOutStoreInfo != null)
BufferDataManager.AOutStoreInfo.Labeled = true;
MoveInfo.NextMoveStep(StepEnum.Label10_Finish);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
SetWarnMsg();
Label_CylinderBack(MoveInfo);
MoveLog($"打标:标签被取走,流程结束");
}
else
else if (MoveInfo.IsTimeOut())
{
if (BufferDataManager.BOutStoreInfo != null)
BufferDataManager.BOutStoreInfo.Labeled = true;
SetWarnMsg("等待标签被取走超时");
}
MoveLog($"打标:{MoveInfo.MoveParam.PosInfo.barcode}标记为打标,计算的贴标旋转角度:{MoveInfo.MoveParam.PosInfo.relativeAngle}°");
SetWarnMsg();
BufferDataManager.LabelInfo = MoveInfo.MoveParam.PosInfo.ToCopy();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (MoveInfo.IsTimeOut(15))
else if (MoveInfo.IsStep(StepEnum.Label10_Finish))
{
SetWarnMsg("等待相机解析旋转角度超时");
MoveInfo.EndMove();
}
}
else if (MoveInfo.IsStep(StepEnum.Label09_WaitLabelLeave))
catch (Exception ex)
{
if (BufferDataManager.LabelInfo == null)
{
MoveInfo.NextMoveStep(StepEnum.Label10_Finish);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
SetWarnMsg();
Label_CylinderBack(MoveInfo);
MoveLog($"打标:标签被取走,流程结束");
}
else if (MoveInfo.IsTimeOut())
{
SetWarnMsg("等待标签被取走超时");
}
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
LogUtil.error("printlabelprocess", ex);
}
else if (MoveInfo.IsStep(StepEnum.Label10_Finish))
finally
{
MoveInfo.EndMove();
Monitor.Exit(locObject);
}
}
catch (Exception ex)
{
LogUtil.error("printlabelprocess", ex);
}
}
/// <summary>
......@@ -342,7 +365,7 @@ namespace OnlineStore.DeviceLibrary
/// <returns></returns>
bool CheckLabel()
{
bool useLabelCheck = ConfigAppSettings.GetBoolValue(Setting_Init.UseLabelCheck, true);
bool useLabelCheck = ConfigAppSettings.GetBoolValue(Setting_Init.UseLabelCheck, false);
if (useLabelCheck)
return IOValue(IO_Type.Printer_LabelCheck).Equals(IO_VALUE.HIGH);
else
......
......@@ -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,20 +68,17 @@ namespace OnlineStore.DeviceLibrary
}
public string GetMoveStr()
{
return $"料箱:{BoxId} " + $"【格口最大数量:{MaxCntOnSide}】" + BoxTaskInfo?.ToStr() ?? "";
return $"料箱:{BoxId} " + $"【格口最大数量:{MaxCntOnSide}】【" + (BoxTaskInfo?.ToStr() ?? "") + "】";
}
public void StartReset()
{
WarnMsg = "";
bool needLeave = false;
if (ReadBoxId())
BoxTaskInfo = SServerManager.GetBoxStatusInfo(config.CID, BoxId);
resetCnt();
ReadBoxId();
GetBoxTaskInfo();
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);
needLeave = (BoxTaskInfo.boxTCount >= MaxCntOnSide || BoxTaskInfo.boxBCount >= MaxCntOnSide || BoxTaskInfo.remainTaskCount <= 0);
}
ProcessShelfOut = false;
ProcessShelfEnter = false;
......@@ -94,16 +93,12 @@ namespace OnlineStore.DeviceLibrary
if (needLeave)
{
NeedLeave();
LogUtil.info($"复位 {Name}已满/无剩余任务,需要离开。{BoxTaskInfo?.ToStr()??""}");
}
});
}
void resetCnt()
{
CntInSideA = 0;
CntInSideB = 0;
}
public void LineRun(DeviceMoveInfo moveInfo = null)
{
IOManager.IOMove(DO_LineBackRun, IO_VALUE.LOW, config.Id);
......@@ -187,7 +182,7 @@ namespace OnlineStore.DeviceLibrary
}
//再转动8000
//Thread.Sleep(8000);
// Complete();
while (!AgvNode.status.Equals(NodeStatus.Complete))
{
......@@ -279,17 +274,17 @@ namespace OnlineStore.DeviceLibrary
FinishEnter();
//等待200毫秒后停止转动
//Thread.Sleep(3000);
resetCnt();
LogUtil.info(logName + "等待3000后,停止链条转动");
LineStopRun();
GetBoxTaskInfo();
//if (ReadBoxId())
//{
// //SServerManager.BoxTakeAway(BoxId);
// //Thread.Sleep(1000);
// // BoxTaskInfo = SServerManager.GetBoxStatusInfo(config.CID, BoxId);
//}
if (ReadBoxId())
{
SServerManager.BoxTakeAway(BoxId);
Thread.Sleep(1000);
BoxTaskInfo = SServerManager.GetBoxStatusInfo(config.CID, BoxId);
}
ProcessShelfEnter = false;
LogUtil.info(logName + " 结束");
}
......@@ -321,34 +316,34 @@ namespace OnlineStore.DeviceLibrary
}
public Node AgvNode { get; set; }
/// <summary>
/// A侧数量
/// 是否有空位置
/// </summary>
public int CntInSideA { get; set; }
/// <summary>
/// B侧数量
/// </summary>
public int CntInSideB { get; set; }
public bool CanPutIn(out string msg)
/// <returns></returns>
public bool HasEmptyPos(int boxT, int boxB)
{
msg = "";
if (InHandlingAGVSig())
{
msg = Name + " 正在进出料,不允许放料";
return false;
}
if (!BoxId.StartsWith("CN"))
{
msg = Name + " 未读到rfid,不允许放料";
return false;
}
bool rtn = CntInSideA < MaxCntOnSide && CntInSideB < MaxCntOnSide;
if (!rtn)
{
msg = Name + $" 格口数量已满,不允许放料。当前数量:【内侧={CntInSideA}】【外侧={CntInSideB}】";
NeedLeave();
}
return rtn;
return boxT < MaxCntOnSide && boxB < MaxCntOnSide;
}
//public bool CanPutIn(out string msg)
//{
// msg = "";
// if (InHandlingAGVSig())
// {
// msg = Name + " 正在进出料,不允许放料";
// return false;
// }
// if (!BoxId.StartsWith("CN"))
// {
// msg = Name + " 未读到rfid,不允许放料";
// return false;
// }
// bool rtn = CntInSideT < MaxCntOnSide && CntInSideB < MaxCntOnSide;
// if (!rtn)
// {
// msg = Name + $" 格口数量已满,不允许放料。当前数量:【内侧={CntInSideT}】【外侧={CntInSideB}】";
// NeedLeave();
// }
// return rtn;
//}
//public bool CheckState(Label_LZ labelInfo, InOutParam param, out BoxTaskInfo boxTaskInfo, out string warnMsg)
//{
// boxTaskInfo = BoxTaskInfo;
......@@ -485,19 +480,12 @@ namespace OnlineStore.DeviceLibrary
public void PutReelIn(int side)
{
WarnMsg = "";
if (side % 2 != 0)
{
CntInSideA++;
}
else
{
CntInSideB++;
}
bool rtn = CntInSideA >= MaxCntOnSide || CntInSideB >= MaxCntOnSide;
BoxTaskInfo = SServerManager.GetBoxStatusInfo(config.CID, BoxId);
bool rtn = false;
//BoxTaskInfo = SServerManager.GetBoxStatusInfo(config.CID, BoxId);
bool hasRemain = true;
if (BoxTaskInfo != null)
{
rtn = BoxTaskInfo.boxBCount >= MaxCntOnSide || BoxTaskInfo.boxTCount >= MaxCntOnSide;
hasRemain = (BoxTaskInfo.remainTaskCount > 0 ? true : false);
}
if (AutoClearBoxBind)
......@@ -512,16 +500,25 @@ namespace OnlineStore.DeviceLibrary
else if (rtn || !hasRemain)
{
NeedLeave();
LogUtil.info($"{Name}已满/无剩余任务,需要离开。{BoxTaskInfo?.ToStr()??""}");
}
}
public void GetBoxTaskInfo()
{
if (ReadBoxId())
BoxTaskInfo = SServerManager.GetBoxStatusInfo(config.CID, BoxId);
{
List<BoxTaskInfo> boxInfos = SServerManager.GetOutStateInfo();
UpdateBoxInfo(boxInfos);
}
}
public void UpdateBoxInfo(List<BoxTaskInfo> boxInfos)
{
if (boxInfos == null) return;
BoxTaskInfo = boxInfos.Find(s => outLet.Equals(s.outlet));
}
/// <summary>
/// 箱子任务信息
/// 任务信息
/// </summary>
public BoxTaskInfo BoxTaskInfo { get; set; }
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/main/XLR-SO1131.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<file value="logs/main/XLR-SO1131.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="TheRFID" type="log4net.Appender.RollingFileAppender">
<file value="logs/rfid/TheRFID-line.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<file value="logs/rfid/TheRFID-line.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="jaka" type="log4net.Appender.RollingFileAppender">
......@@ -55,12 +55,12 @@
</layout>
</appender>
<logger name="RollingLogFileAppender">
<level value="all" />
<appender-ref ref="RollingLogFileAppender" />
<level value="all"/>
<appender-ref ref="RollingLogFileAppender"/>
</logger>
<logger name="TheRFID">
<level value="all" />
<appender-ref ref="TheRFID" />
<level value="all"/>
<appender-ref ref="TheRFID"/>
</logger>
<logger name="jaka">
<level value="info"/>
......@@ -76,20 +76,20 @@
</logger>
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0" />
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0"/>
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
</configuration>
......@@ -117,9 +117,9 @@
// tabPage1
//
this.tabPage1.Controls.Add(this.logBox);
this.tabPage1.Location = new System.Drawing.Point(4, 29);
this.tabPage1.Location = new System.Drawing.Point(4, 32);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(988, 605);
this.tabPage1.Size = new System.Drawing.Size(988, 602);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = " 运行日志 ";
this.tabPage1.UseVisualStyleBackColor = true;
......@@ -132,7 +132,7 @@
this.logBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.logBox.Location = new System.Drawing.Point(5, 3);
this.logBox.Name = "logBox";
this.logBox.Size = new System.Drawing.Size(977, 594);
this.logBox.Size = new System.Drawing.Size(977, 591);
this.logBox.TabIndex = 106;
this.logBox.Text = "";
this.logBox.VisibleChanged += new System.EventHandler(this.logBox_VisibleChanged);
......@@ -140,9 +140,9 @@
// tabPage2
//
this.tabPage2.Controls.Add(this.panel1);
this.tabPage2.Location = new System.Drawing.Point(4, 29);
this.tabPage2.Location = new System.Drawing.Point(4, 32);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(192, 67);
this.tabPage2.Size = new System.Drawing.Size(192, 64);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = " 设备状态 ";
this.tabPage2.UseVisualStyleBackColor = true;
......@@ -153,7 +153,7 @@
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(192, 67);
this.panel1.Size = new System.Drawing.Size(192, 64);
this.panel1.TabIndex = 1;
//
// tableLayoutPanel1
......@@ -178,7 +178,7 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 19.04762F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 19.04762F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(192, 67);
this.tableLayoutPanel1.Size = new System.Drawing.Size(192, 64);
this.tableLayoutPanel1.TabIndex = 0;
//
// InputControl
......@@ -189,8 +189,8 @@
this.tableLayoutPanel1.SetColumnSpan(this.InputControl, 2);
this.InputControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.InputControl.EquipText = "上料机构";
this.InputControl.Location = new System.Drawing.Point(4, 44);
this.InputControl.Margin = new System.Windows.Forms.Padding(4);
this.InputControl.Location = new System.Drawing.Point(4, 43);
this.InputControl.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.InputControl.MoveInfo = "暂无出入库";
this.InputControl.Name = "InputControl";
this.InputControl.Size = new System.Drawing.Size(184, 4);
......@@ -203,8 +203,8 @@
this.ReelControlA1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ReelControlA1.ColorStatus = System.Drawing.Color.White;
this.ReelControlA1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ReelControlA1.Location = new System.Drawing.Point(4, 26);
this.ReelControlA1.Margin = new System.Windows.Forms.Padding(4);
this.ReelControlA1.Location = new System.Drawing.Point(4, 25);
this.ReelControlA1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.ReelControlA1.Name = "ReelControlA1";
this.ReelControlA1.ReelText = "暂存区物料";
this.ReelControlA1.Size = new System.Drawing.Size(88, 1);
......@@ -216,8 +216,8 @@
this.ReelControlA2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ReelControlA2.ColorStatus = System.Drawing.Color.White;
this.ReelControlA2.Dock = System.Windows.Forms.DockStyle.Fill;
this.ReelControlA2.Location = new System.Drawing.Point(4, 35);
this.ReelControlA2.Margin = new System.Windows.Forms.Padding(4);
this.ReelControlA2.Location = new System.Drawing.Point(4, 34);
this.ReelControlA2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.ReelControlA2.Name = "ReelControlA2";
this.ReelControlA2.ReelText = "暂存区物料";
this.ReelControlA2.Size = new System.Drawing.Size(88, 1);
......@@ -229,8 +229,8 @@
this.ReelControlB1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ReelControlB1.ColorStatus = System.Drawing.Color.White;
this.ReelControlB1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ReelControlB1.Location = new System.Drawing.Point(100, 26);
this.ReelControlB1.Margin = new System.Windows.Forms.Padding(4);
this.ReelControlB1.Location = new System.Drawing.Point(100, 25);
this.ReelControlB1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.ReelControlB1.Name = "ReelControlB1";
this.ReelControlB1.ReelText = "暂存区物料";
this.ReelControlB1.Size = new System.Drawing.Size(88, 1);
......@@ -245,10 +245,10 @@
this.BoxControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.BoxControl.EquipText = "存储机构";
this.BoxControl.Location = new System.Drawing.Point(4, 4);
this.BoxControl.Margin = new System.Windows.Forms.Padding(4);
this.BoxControl.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.BoxControl.MoveInfo = "暂无出入库";
this.BoxControl.Name = "BoxControl";
this.BoxControl.Size = new System.Drawing.Size(184, 14);
this.BoxControl.Size = new System.Drawing.Size(184, 13);
this.BoxControl.TabIndex = 4;
this.BoxControl.WorkStatus = "暂未启动";
//
......@@ -259,11 +259,11 @@
this.ShelfAControl.ColorStatus = System.Drawing.Color.White;
this.ShelfAControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.ShelfAControl.EquipText = "A料口";
this.ShelfAControl.Location = new System.Drawing.Point(4, 56);
this.ShelfAControl.Margin = new System.Windows.Forms.Padding(4);
this.ShelfAControl.Location = new System.Drawing.Point(4, 55);
this.ShelfAControl.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.ShelfAControl.MoveInfo = "暂无出入库";
this.ShelfAControl.Name = "ShelfAControl";
this.ShelfAControl.Size = new System.Drawing.Size(88, 7);
this.ShelfAControl.Size = new System.Drawing.Size(88, 5);
this.ShelfAControl.TabIndex = 6;
this.ShelfAControl.WorkStatus = "暂未启动";
//
......@@ -274,11 +274,11 @@
this.ShelfBControl.ColorStatus = System.Drawing.Color.White;
this.ShelfBControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.ShelfBControl.EquipText = "B料口";
this.ShelfBControl.Location = new System.Drawing.Point(100, 56);
this.ShelfBControl.Margin = new System.Windows.Forms.Padding(4);
this.ShelfBControl.Location = new System.Drawing.Point(100, 55);
this.ShelfBControl.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.ShelfBControl.MoveInfo = "暂无出入库";
this.ShelfBControl.Name = "ShelfBControl";
this.ShelfBControl.Size = new System.Drawing.Size(88, 7);
this.ShelfBControl.Size = new System.Drawing.Size(88, 5);
this.ShelfBControl.TabIndex = 7;
this.ShelfBControl.Visible = false;
this.ShelfBControl.WorkStatus = "暂未启动";
......@@ -289,8 +289,8 @@
this.ReelControlB2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ReelControlB2.ColorStatus = System.Drawing.Color.White;
this.ReelControlB2.Dock = System.Windows.Forms.DockStyle.Fill;
this.ReelControlB2.Location = new System.Drawing.Point(100, 35);
this.ReelControlB2.Margin = new System.Windows.Forms.Padding(4);
this.ReelControlB2.Location = new System.Drawing.Point(100, 34);
this.ReelControlB2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.ReelControlB2.Name = "ReelControlB2";
this.ReelControlB2.ReelText = "暂存区物料";
this.ReelControlB2.Size = new System.Drawing.Size(88, 1);
......@@ -303,7 +303,7 @@
this.lblStatus.ForeColor = System.Drawing.Color.Green;
this.lblStatus.Location = new System.Drawing.Point(29, 46);
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(65, 20);
this.lblStatus.Size = new System.Drawing.Size(82, 24);
this.lblStatus.TabIndex = 92;
this.lblStatus.Text = "等待启动";
//
......@@ -337,24 +337,24 @@
this.toolStripSeparator8,
this.toolStripMenuItem1});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(113, 62);
this.contextMenuStrip1.Size = new System.Drawing.Size(125, 74);
//
// 显示ToolStripMenuItem
//
this.显示ToolStripMenuItem.Name = "显示ToolStripMenuItem";
this.显示ToolStripMenuItem.Size = new System.Drawing.Size(112, 26);
this.显示ToolStripMenuItem.Size = new System.Drawing.Size(124, 32);
this.显示ToolStripMenuItem.Text = "显示";
this.显示ToolStripMenuItem.Click += new System.EventHandler(this.显示ToolStripMenuItem_Click);
//
// toolStripSeparator8
//
this.toolStripSeparator8.Name = "toolStripSeparator8";
this.toolStripSeparator8.Size = new System.Drawing.Size(109, 6);
this.toolStripSeparator8.Size = new System.Drawing.Size(121, 6);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(112, 26);
this.toolStripMenuItem1.Size = new System.Drawing.Size(124, 32);
this.toolStripMenuItem1.Text = "退出";
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
//
......@@ -376,60 +376,60 @@
this.toolStripSeparator2,
this.退出ToolStripMenuItem});
this.操作ToolStripMenuItem.Name = "操作ToolStripMenuItem";
this.操作ToolStripMenuItem.Size = new System.Drawing.Size(96, 25);
this.操作ToolStripMenuItem.Size = new System.Drawing.Size(118, 31);
this.操作ToolStripMenuItem.Text = " 设备操作 ";
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(114, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(141, 6);
//
// 启动AToolStripMenuItem
//
this.启动AToolStripMenuItem.Name = "启动AToolStripMenuItem";
this.启动AToolStripMenuItem.Size = new System.Drawing.Size(117, 26);
this.启动AToolStripMenuItem.Size = new System.Drawing.Size(144, 32);
this.启动AToolStripMenuItem.Text = "启动 ";
this.启动AToolStripMenuItem.Click += new System.EventHandler(this.启动所有料仓AToolStripMenuItem_Click);
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(114, 6);
this.toolStripSeparator4.Size = new System.Drawing.Size(141, 6);
//
// 复位RToolStripMenuItem
//
this.复位RToolStripMenuItem.Name = "复位RToolStripMenuItem";
this.复位RToolStripMenuItem.Size = new System.Drawing.Size(117, 26);
this.复位RToolStripMenuItem.Size = new System.Drawing.Size(144, 32);
this.复位RToolStripMenuItem.Text = "复位";
this.复位RToolStripMenuItem.Click += new System.EventHandler(this.复位RToolStripMenuItem_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(114, 6);
this.toolStripSeparator3.Size = new System.Drawing.Size(141, 6);
//
// 停止TToolStripMenuItem
//
this.停止TToolStripMenuItem.Name = "停止TToolStripMenuItem";
this.停止TToolStripMenuItem.Size = new System.Drawing.Size(117, 26);
this.停止TToolStripMenuItem.Size = new System.Drawing.Size(144, 32);
this.停止TToolStripMenuItem.Text = "停止";
this.停止TToolStripMenuItem.Click += new System.EventHandler(this.停止所有料仓TToolStripMenuItem_Click);
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(114, 6);
this.toolStripSeparator5.Size = new System.Drawing.Size(141, 6);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(114, 6);
this.toolStripSeparator2.Size = new System.Drawing.Size(141, 6);
this.toolStripSeparator2.Visible = false;
//
// 退出ToolStripMenuItem
//
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(117, 26);
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(144, 32);
this.退出ToolStripMenuItem.Text = "退出";
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click_1);
//
......@@ -446,64 +446,64 @@
this.机器人调试ToolStripMenuItem,
this.贴标调试ToolStripMenuItem});
this.设置TToolStripMenuItem.Name = "设置TToolStripMenuItem";
this.设置TToolStripMenuItem.Size = new System.Drawing.Size(91, 25);
this.设置TToolStripMenuItem.Size = new System.Drawing.Size(112, 31);
this.设置TToolStripMenuItem.Text = "设备调试 ";
//
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(173, 6);
this.toolStripSeparator6.Size = new System.Drawing.Size(215, 6);
this.toolStripSeparator6.Visible = false;
//
// 二维码学习ToolStripMenuItem
//
this.二维码学习ToolStripMenuItem.Name = "二维码学习ToolStripMenuItem";
this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(218, 32);
this.二维码学习ToolStripMenuItem.Text = "二维码学习";
this.二维码学习ToolStripMenuItem.Click += new System.EventHandler(this.二维码学习ToolStripMenuItem_Click);
//
// toolStripSeparator7
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(173, 6);
this.toolStripSeparator7.Size = new System.Drawing.Size(215, 6);
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(176, 26);
this.toolStripMenuItem3.Size = new System.Drawing.Size(218, 32);
this.toolStripMenuItem3.Text = "脆盘料号配置";
this.toolStripMenuItem3.Click += new System.EventHandler(this.toolStripMenuItem3_Click);
//
// toolStripSeparator16
//
this.toolStripSeparator16.Name = "toolStripSeparator16";
this.toolStripSeparator16.Size = new System.Drawing.Size(173, 6);
this.toolStripSeparator16.Size = new System.Drawing.Size(215, 6);
//
// RFIDReadWrite
//
this.RFIDReadWrite.Name = "RFIDReadWrite";
this.RFIDReadWrite.Size = new System.Drawing.Size(176, 26);
this.RFIDReadWrite.Size = new System.Drawing.Size(218, 32);
this.RFIDReadWrite.Text = "RFID读写";
this.RFIDReadWrite.Click += new System.EventHandler(this.RFIDReadWrite_Click);
//
// 打印机调试ToolStripMenuItem
//
this.打印机调试ToolStripMenuItem.Name = "打印机调试ToolStripMenuItem";
this.打印机调试ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.打印机调试ToolStripMenuItem.Size = new System.Drawing.Size(218, 32);
this.打印机调试ToolStripMenuItem.Text = "打印机调试";
this.打印机调试ToolStripMenuItem.Click += new System.EventHandler(this.打印机调试ToolStripMenuItem_Click);
//
// 机器人调试ToolStripMenuItem
//
this.机器人调试ToolStripMenuItem.Name = "机器人调试ToolStripMenuItem";
this.机器人调试ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.机器人调试ToolStripMenuItem.Size = new System.Drawing.Size(218, 32);
this.机器人调试ToolStripMenuItem.Text = "机器人调试";
this.机器人调试ToolStripMenuItem.Click += new System.EventHandler(this.机器人调试ToolStripMenuItem_Click);
//
// 贴标调试ToolStripMenuItem
//
this.贴标调试ToolStripMenuItem.Name = "贴标调试ToolStripMenuItem";
this.贴标调试ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.贴标调试ToolStripMenuItem.Size = new System.Drawing.Size(218, 32);
this.贴标调试ToolStripMenuItem.Text = "贴标调试";
this.贴标调试ToolStripMenuItem.Click += new System.EventHandler(this.贴标调试ToolStripMenuItem_Click);
//
......@@ -516,37 +516,37 @@
this.toolStripSeparator11,
this.版本号ToolStripMenuItem});
this.帮助ToolStripMenuItem.Name = "帮助ToolStripMenuItem";
this.帮助ToolStripMenuItem.Size = new System.Drawing.Size(69, 25);
this.帮助ToolStripMenuItem.Size = new System.Drawing.Size(84, 31);
this.帮助ToolStripMenuItem.Text = " 系统 ";
//
// 清空日志ToolStripMenuItem
//
this.清空日志ToolStripMenuItem.Name = "清空日志ToolStripMenuItem";
this.清空日志ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.清空日志ToolStripMenuItem.Size = new System.Drawing.Size(178, 32);
this.清空日志ToolStripMenuItem.Text = "清空日志";
this.清空日志ToolStripMenuItem.Click += new System.EventHandler(this.清空日志ToolStripMenuItem_Click);
//
// toolStripSeparator10
//
this.toolStripSeparator10.Name = "toolStripSeparator10";
this.toolStripSeparator10.Size = new System.Drawing.Size(141, 6);
this.toolStripSeparator10.Size = new System.Drawing.Size(175, 6);
//
// 复制日志ToolStripMenuItem
//
this.复制日志ToolStripMenuItem.Name = "复制日志ToolStripMenuItem";
this.复制日志ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.复制日志ToolStripMenuItem.Size = new System.Drawing.Size(178, 32);
this.复制日志ToolStripMenuItem.Text = "复制日志";
this.复制日志ToolStripMenuItem.Click += new System.EventHandler(this.复制日志ToolStripMenuItem_Click);
//
// toolStripSeparator11
//
this.toolStripSeparator11.Name = "toolStripSeparator11";
this.toolStripSeparator11.Size = new System.Drawing.Size(141, 6);
this.toolStripSeparator11.Size = new System.Drawing.Size(175, 6);
//
// 版本号ToolStripMenuItem
//
this.版本号ToolStripMenuItem.Name = "版本号ToolStripMenuItem";
this.版本号ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
this.版本号ToolStripMenuItem.Size = new System.Drawing.Size(178, 32);
this.版本号ToolStripMenuItem.Text = "关于软件";
this.版本号ToolStripMenuItem.Click += new System.EventHandler(this.版本号ToolStripMenuItem_Click);
//
......@@ -562,7 +562,7 @@
this.帮助ToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1004, 29);
this.menuStrip1.Size = new System.Drawing.Size(1004, 35);
this.menuStrip1.TabIndex = 4;
this.menuStrip1.Text = "menuStrip1";
//
......@@ -578,57 +578,57 @@
this.禁用安全光栅ToolStripMenuItem,
this.启用门禁ToolStripMenuItem});
this.运行参数ToolStripMenuItem.Name = "运行参数ToolStripMenuItem";
this.运行参数ToolStripMenuItem.Size = new System.Drawing.Size(86, 25);
this.运行参数ToolStripMenuItem.Size = new System.Drawing.Size(106, 31);
this.运行参数ToolStripMenuItem.Text = "运行参数";
//
// 开机自动启动ToolStripMenuItem
//
this.开机自动启动ToolStripMenuItem.Name = "开机自动启动ToolStripMenuItem";
this.开机自动启动ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.开机自动启动ToolStripMenuItem.Size = new System.Drawing.Size(221, 32);
this.开机自动启动ToolStripMenuItem.Text = "开机自动启动";
this.开机自动启动ToolStripMenuItem.Click += new System.EventHandler(this.开机自动启动ToolStripMenuItem_Click);
//
// toolStripSeparator15
//
this.toolStripSeparator15.Name = "toolStripSeparator15";
this.toolStripSeparator15.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator15.Size = new System.Drawing.Size(218, 6);
//
// 启用蜂鸣器ToolStripMenuItem
//
this.启用蜂鸣器ToolStripMenuItem.Name = "启用蜂鸣器ToolStripMenuItem";
this.启用蜂鸣器ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.启用蜂鸣器ToolStripMenuItem.Size = new System.Drawing.Size(221, 32);
this.启用蜂鸣器ToolStripMenuItem.Text = "启用蜂鸣器";
this.启用蜂鸣器ToolStripMenuItem.Click += new System.EventHandler(this.启用蜂鸣器ToolStripMenuItem_Click);
//
// toolStripSeparator25
//
this.toolStripSeparator25.Name = "toolStripSeparator25";
this.toolStripSeparator25.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator25.Size = new System.Drawing.Size(218, 6);
//
// aGVCancelStateToolStripMenuItem
//
this.aGVCancelStateToolStripMenuItem.Name = "aGVCancelStateToolStripMenuItem";
this.aGVCancelStateToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.aGVCancelStateToolStripMenuItem.Size = new System.Drawing.Size(221, 32);
this.aGVCancelStateToolStripMenuItem.Text = "AGV信号屏蔽";
this.aGVCancelStateToolStripMenuItem.Click += new System.EventHandler(this.aGVCancelStateToolStripMenuItem_Click);
//
// toolStripSeparator17
//
this.toolStripSeparator17.Name = "toolStripSeparator17";
this.toolStripSeparator17.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator17.Size = new System.Drawing.Size(218, 6);
this.toolStripSeparator17.Visible = false;
//
// 禁用安全光栅ToolStripMenuItem
//
this.禁用安全光栅ToolStripMenuItem.Name = "禁用安全光栅ToolStripMenuItem";
this.禁用安全光栅ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.禁用安全光栅ToolStripMenuItem.Size = new System.Drawing.Size(221, 32);
this.禁用安全光栅ToolStripMenuItem.Text = "启用安全光栅";
this.禁用安全光栅ToolStripMenuItem.Click += new System.EventHandler(this.启用安全光栅ToolStripMenuItem_Click);
//
// 启用门禁ToolStripMenuItem
//
this.启用门禁ToolStripMenuItem.Name = "启用门禁ToolStripMenuItem";
this.启用门禁ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.启用门禁ToolStripMenuItem.Size = new System.Drawing.Size(221, 32);
this.启用门禁ToolStripMenuItem.Text = "启用门禁";
this.启用门禁ToolStripMenuItem.Click += new System.EventHandler(this.启用门禁ToolStripMenuItem_Click);
//
......
......@@ -46,14 +46,7 @@ namespace OnlineStore.XLRStore
Application.Exit();
return;
}
LoadStoreData();
this.Opacity = 100;
this.Visible = true;
this.notifyIcon1.Visible = false;
this.ShowInTaskbar = true;
this.Cursor = Cursors.Default;
if (StoreManager.DisSecurityAccess)
{
禁用安全光栅ToolStripMenuItem.Text = gouStr + "禁用安全光栅";
......@@ -72,6 +65,11 @@ namespace OnlineStore.XLRStore
}
//tabControl1.TabPages.Remove(tabPage5);
timer1.Start();
this.Opacity = 100;
this.Visible = true;
this.notifyIcon1.Visible = false;
this.ShowInTaskbar = true;
this.Cursor = Cursors.Default;
}
private FrmInputEquip inputEquip = null;
private FrmBoxEquip box = null;
......@@ -544,7 +542,7 @@ namespace OnlineStore.XLRStore
}
catch (Exception ex)
{
LogUtil.error("XLRStore timer",ex);
LogUtil.error("XLRStore timer", ex);
}
}
......
......@@ -11,6 +11,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using OnlineStore.DeviceLibrary;
using System.Runtime.ExceptionServices;
using System.ComponentModel;
namespace OnlineStore.XLRStore
{
......@@ -56,6 +57,8 @@ namespace OnlineStore.XLRStore
[HandleProcessCorruptedStateExceptions]
static void Main(string[] Args)
{
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
......@@ -105,7 +108,6 @@ namespace OnlineStore.XLRStore
Application.Run(new FrmXLRStore());
}
}
private static void CurrentDomain_FirstChanceException(object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e)
{
// LogUnhandledException("CurrentDomain_FirstChanceException", e);
......
......@@ -12,7 +12,7 @@ namespace OnlineStore.XLRStore.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
......@@ -43,48 +43,52 @@ namespace OnlineStore.XLRStore
chbDebug.Checked = boxBean.IsDebug;
FrmPosDebug frmPosDebug = new FrmPosDebug();
AddForm(tabControl1, " 库位调试 ", frmPosDebug);
boxBean.RegisterCameraAGrabImage(BoxBean_camera_A_event);
boxBean.RegisterCameraBGrabImage(BoxBean_camera_B_event);
boxBean.RegisterCameraGrabImage(BoxBean_camera_event);
IsLoad = true;
}
/// <summary>
/// 监控相机A采集图像事件
/// </summary>
/// <param name="cameraArgs"></param>
private void BoxBean_camera_A_event(IPCameraEventArgs cameraArgs)
private void BoxBean_camera_event(CameraArgs cameraArgs)
{
if (!this.IsHandleCreated) return;
try
{
this.Invoke(new Action(() =>
{
if (!groupBox2.Text.Contains("-"))
groupBox2.Text = $"A相机-{cameraArgs.IP}-ch{cameraArgs.ChannelNum}";
//if (!groupBox2.Text.Contains("-"))
// groupBox2.Text = $"A相机-{cameraArgs.IP}-ch{cameraArgs.ChannelNum}";
//pictureBox1.Image = null;
pictureBox1.Image = (Image)cameraArgs.Image.Clone();
if (BoxEquip.boxACamName.Equals(cameraArgs.CamName))
pictureBox1.Image = (Image)cameraArgs.Image.Clone();
else
{
pictureBox2.Image = (Image)cameraArgs.Image.Clone();
}
}));
}
catch
{
}
}
private void BoxBean_camera_B_event(IPCameraEventArgs cameraArgs)
{
if (!this.IsHandleCreated) return;
try
{
this.Invoke(new Action(() =>
{
if (!groupBox5.Text.Contains("-"))
groupBox5.Text = $"B相机-{cameraArgs.IP}-ch{cameraArgs.ChannelNum}";
//pictureBox2.Image = null;
pictureBox2.Image = (Image)cameraArgs.Image.Clone();
}));
}
catch { }
}
//private void BoxBean_camera_B_event(IPCameraEventArgs cameraArgs)
//{
// if (!this.IsHandleCreated) return;
// try
// {
// this.Invoke(new Action(() =>
// {
// if (!groupBox5.Text.Contains("-"))
// groupBox5.Text = $"B相机-{cameraArgs.IP}-ch{cameraArgs.ChannelNum}";
// //pictureBox2.Image = null;
// pictureBox2.Image = (Image)cameraArgs.Image.Clone();
// }));
// }
// catch { }
//}
protected Dictionary<string, IOTextControl> DIControlList = new Dictionary<string, IOTextControl>();
protected Dictionary<string, IOTextControl> DOControlList = new Dictionary<string, IOTextControl>();
protected void ReadIOList()
......
......@@ -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!