Commit 0d1fe10f LN

出库料放到托盘上时先调用GetLocation判断是否可放

1 个父辈 45eb003b
......@@ -315,11 +315,11 @@ namespace OnlineStore.DeviceLibrary
//前进后退气缸后退以后才可以出库
else if (move.runStatus.Equals(LineRunStatus.Busy) && move.MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
if (move.MoveInfo.MoveStep >= (LineMoveStep.MO_60_CylinderDown))
if (move.MoveInfo.MoveStep >= (LineMoveStep.MO_64_CylinderDown))
{
return true;
}
else if (move.MoveInfo.IsStep(LineMoveStep.MO_59_CylinderAfter) && move.MoveInfo.IsInWait.Equals(false)
else if (move.MoveInfo.IsStep(LineMoveStep.MO_63_CylinderAfter) && move.MoveInfo.IsInWait.Equals(false)
&& move.CylinderIsOk(IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After))
{
return true;
......
......@@ -63,64 +63,6 @@ namespace OnlineStore.DeviceLibrary
}
return codeStr;
}
//public static string GetTraySize(string deviceName, int robotIndex, string codeStr, out int outSize, out bool isNg)
//{
// outSize = 0;
// isNg = false;
// string msg = "";
// try
// {
// if (String.IsNullOrEmpty(codeStr))
// {
// return msg = deviceName + "未扫到条码";
// }
// string logName = $"GetTraySize [{robotIndex }] [{codeStr}] :";
// if (string.IsNullOrEmpty(serverAddr))
// {
// LogUtil.error(deviceName + $"{logName}未找到服务器地址");
// return msg;
// }
// Dictionary<string, string> paramMap = new Dictionary<string, string>();
// paramMap.Add("robotIndex", robotIndex.ToString());// 参数: robotIndex = 机器人编号,IP为51的机器人为1, 52的机器人为2, 53的机器人为3
// paramMap.Add("barcode", codeStr);// barcode = 扫到的条码
// string server = GetAddr(Addr_getSize, paramMap);
// DateTime startTime = DateTime.Now;
// bool isTimeOut = false;
// string resultStr = HttpHelper.Post(server, "", Encoding.UTF8, 5000, out isTimeOut);
// LogUtil.info("GetTraySize " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
// if (isTimeOut)
// {
// return msg = "获取尺寸超时";
// }
// //返回: { "code": 0, "msg":"ok", data: 7}
// ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr);
// if (serverResult == null)
// {
// return msg = "没有收到服务器反馈";
// }
// else if (serverResult.code.Equals(0).Equals(false))
// {
// // code: 0为正常,其他为异常,
// //code不是0,直接NG
// isNg = true;
// return msg = $" [{ serverResult.code}]:" + serverResult.msg;
// }
// if (!serverResult.data.Equals(""))
// {
// // data:料盘直径,= 7时升起气缸
// outSize = Convert.ToInt32(serverResult.data);
// LogUtil.info(deviceName + $"{ logName} 获得尺寸:" + outSize);
// }
// }
// catch (Exception ex)
// {
// LogUtil.error(deviceName + " ", ex);
// }
// return "";
//}
public static string UpdateTrayLoc(string deviceName, string barcode, string status, string locInfo)
......@@ -563,6 +505,52 @@ namespace OnlineStore.DeviceLibrary
}
}
private static string Addr_getLocation = "/rest/api/qisda/device/getLocation";
public static bool GetLocation(string barcode )
{
//加参数: onMoving=true 如果返回的code是99,则停留在横移上,下个可放托盘继续判断
//getLocation这个接口传入barcode和rfid列表会分配料架
try
{
string currRFID = "";
BoxInfo box = LineServer.GetBoxInfo(7);
if (box != null && LineServer.BoxConnected(7))
{
currRFID = box.GetRfids();
}
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("barcode", barcode);
paramMap.Add("rfid", currRFID);
paramMap.Add("onMoving", true.ToString());
string url = GetAddr(Addr_getLocation, paramMap);
string logName = "http :URL:" + url;
DateTime startTime = DateTime.Now;
string json = HttpHelper.Post(url, "", 10000);
LogUtil.info(logName + ": Response:" + json + ",耗时【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】");
RfidData data = JsonHelper.DeserializeJsonToObject<RfidData>(json);
if (data == null)
{
return false;
}
else if (data.code.Equals(99))
{
return false;
}
else
{
return true;
}
}
catch (Exception ex)
{
LogUtil.error("http error : " + ex.ToString());
}
return false ;
}
//14.异常看板
// > 地址:
......@@ -650,7 +638,7 @@ namespace OnlineStore.DeviceLibrary
public InOutParam Param = null;
}
public class RfidData
{
{ //Response:{"code":0,"msg":"ok","data":{"w":"7","realRfid":"","h":"8","rfid":"1-2F","usedRfidList":"F102","rfidLoc":"11","barcode":"985022*35030377*0822*3000*08220350"}}
//{"code":0,"msg":"ok","data":"7"}
public int code { get; set; }
......
......@@ -323,50 +323,55 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 移栽装置出库处理。上下气缸1下降
/// </summary>
MO_52_CylinderDown,
MO_53_CylinderDown,
/// <summary>
/// 移栽装置出库处理。上下气缸1下降后,等待0.3秒再夹紧,防止没有下降到位就夹紧操作
/// </summary>
MO_53_DownWait,
MO_54_DownWait,
/// <summary>
/// 移栽装置出库处理。 夹料气缸1夹紧
/// </summary>
MO_54_CylinderOpen,
MO_55_CylinderOpen,
/// <summary>
/// 移栽装置出库处理。 上下气缸1上升
/// </summary>
MO_55_CylinderUp,
MO_56_CylinderUp,
/// <summary>
/// 移栽出库:开始重抓一次
/// </summary>
MO_56_ResetClamp,
MO_57_ResetClamp,
/// <summary>
/// 移栽出库。 等待夹爪有料
/// </summary>
MO_57_WaitHasReel,
MO_58_WaitHasReel,
/// <summary>
/// 移栽出库:判断料盘能否放到托盘
/// </summary>
MO_61_WaitCanPut,
/// <summary>
/// 移栽出库:开始等待托盘
/// </summary>
MO_58_WaitTray,
MO_62_WaitTray,
/// <summary>
/// 移栽装置出库处理。 前后气缸1后退
/// </summary>
MO_59_CylinderAfter,
MO_63_CylinderAfter,
/// <summary>
/// 移载(流水线)装置出库处理,上下气缸1下降
/// </summary>
MO_60_CylinderDown,
MO_64_CylinderDown,
/// <summary>
/// 移载(流水线)装置出库处理,夹料气缸1放松
/// </summary>
MO_61_CylinderRelax,
MO_65_CylinderRelax,
/// <summary>
/// 移载(流水线)装置出库处理,上下气缸1上升
/// </summary>
MO_62_CylinderUp,
MO_66_CylinderUp,
#region 入料模块,紧急出料移栽处理
......
using System;
using System.Collections.Generic;
using System.Linq;
namespace OnlineStore.DeviceLibrary
{
......@@ -85,5 +86,110 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public string rfids = "";
private char rfidSpilt = ';';
public string GetRfids()
{
string str = "";
string[] array = rfids.Split(rfidSpilt);
if (array != null && array.Length > 0)
{
foreach (string obj in array)
{
string realRfid = obj;
string xuniRfid = "";
if (obj.Contains(","))
{
string[] rarray = obj.Split(',');
if (rarray.Length == 2)
{
realRfid = rarray[0];
xuniRfid = rarray[1];
}
}
str += realRfid + rfidSpilt;
}
}
str = str.Substring(0, str.Length - 1);
return str;
}
//internal bool HasRightRFID(OutWareInfo wareInfo, out string TargetRfid)
//{
// TargetRfid = "";
// string[] rfidArray = rfids.Split(rfidSpilt);
// if (rfidArray == null || rfidArray.Length <= 0)
// {
// return false;
// }
// foreach (string obj in rfidArray)
// {
// string realRfid = obj;
// string xuniRfid = "";
// if (obj.Contains(","))
// {
// string[] rarray = obj.Split(',');
// if (rarray.Length == 2)
// {
// realRfid = rarray[0];
// xuniRfid = rarray[1];
// }
// }
// if (realRfid.Equals(wareInfo.realRFID))
// {
// TargetRfid = obj;
// return true;
// }
// else if (String.IsNullOrEmpty(wareInfo.realRFID))
// {
// if ((!xuniRfid.Equals("")) && xuniRfid.Equals(wareInfo.rfid))
// {
// TargetRfid = obj;
// return true;
// }
// if (!String.IsNullOrEmpty(wareInfo.usedRfidList))
// {
// string[] array = wareInfo.usedRfidList.Split(',');
// //若料架已使用过,直接返回false
// if (array.Contains(realRfid))
// {
// return false;
// }
// }
// if (xuniRfid.Equals(""))
// {
// TargetRfid = obj;
// return true;
// }
// }
// }
// return false;
//}
//public Dictionary<string, string> GetRfidMap()
//{
// Dictionary<string, string> map = new Dictionary<string, string>();
// string[] array = rfids.Split(rfidSpilt);
// if (array != null && array.Length > 0)
// {
// foreach (string obj in array)
// {
// string realRfid = obj;
// string xuniRfid = "";
// if (obj.Contains("-"))
// {
// string[] rarray = obj.Split('-');
// if (rarray.Length == 2)
// {
// realRfid = rarray[0];
// xuniRfid = rarray[1];
// }
// }
// map.Add(realRfid, xuniRfid);
// }
// }
// return map;
//}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!