Commit 517829cb 张东亮

添加与服务器交互功能

1 个父辈 22bccea6
文件属性发生变化
文件属性发生变化
......@@ -20,7 +20,8 @@
<add key="ConfigPath_TrayList" value="\LineConfig\TrayList.data" />
<add key="ImagePath" value="\Images\" />
<add key="UseBuzzer" value="0" />
<add key="Line_CID" value="01" />
<!--获取库位的料仓cid列表;多个用,分割-->
<add key="Line_CID" value="01,02,03,04,05,06" />
<!--end one store config-->
<!--二维码类型列表配置,用#分割,一维码=Barcode 二维码: QR Code#Data Matrix ECC 200#Micro QR Code-->
<add key="CodeType" value="Data Matrix ECC 200#QR Code" />
......@@ -63,6 +64,8 @@
<add key="TrayInRobotInfo" value="" />
<!--出料口上的料盘信息-->
<add key="TrayInOutletInfo" value="" />
<!--入料口上的料盘信息-->
<add key="TrayInInletInfo" value="" />
<!--夹爪夹紧时忽略的料号列表,多个用#分割-->
<add key="PNList" value="3402021720#3402021721#3402021100#3402021101#3402021102#3402021103#3402021104#3402021105#3402021106#3402021107#3402021108#3402021109#3402021112#3402021122" />
</appSettings>
......
......@@ -36,9 +36,12 @@
this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.robotDataControl = new OnlineStore.XLRStore.ReelDataControl();
this.robotControl = new OnlineStore.XLRStore.EquipControl();
this.inletControl = new OnlineStore.XLRStore.EquipControl();
this.outletControl = new OnlineStore.XLRStore.EquipControl();
this.outletDataControl = new OnlineStore.XLRStore.ReelDataControl();
this.inletDataControl = new OnlineStore.XLRStore.ReelDataControl();
this.ngboxDataControl = new OnlineStore.XLRStore.ReelDataControl();
this.lblStatus = new System.Windows.Forms.Label();
this.lblWarnMsg = new System.Windows.Forms.Label();
......@@ -154,20 +157,37 @@
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.robotDataControl, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.robotControl, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.inletControl, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.outletControl, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.ngboxDataControl, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.outletDataControl, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.inletDataControl, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.ngboxDataControl, 1, 3);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 3;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.RowCount = 4;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(988, 605);
this.tableLayoutPanel1.TabIndex = 0;
//
// robotDataControl
//
this.robotDataControl.BackColor = System.Drawing.Color.White;
this.robotDataControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.robotDataControl.ColorStatus = System.Drawing.Color.White;
this.robotDataControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.robotDataControl.Location = new System.Drawing.Point(3, 456);
this.robotDataControl.Name = "robotDataControl";
this.robotDataControl.ReelText = "机器人夹爪物料信息";
this.robotDataControl.Size = new System.Drawing.Size(488, 146);
this.robotDataControl.TabIndex = 8;
//
// robotControl
//
this.robotControl.BackColor = System.Drawing.Color.White;
......@@ -179,7 +199,7 @@
this.robotControl.Location = new System.Drawing.Point(3, 3);
this.robotControl.MoveInfo = "暂无出入库";
this.robotControl.Name = "robotControl";
this.robotControl.Size = new System.Drawing.Size(982, 195);
this.robotControl.Size = new System.Drawing.Size(982, 145);
this.robotControl.TabIndex = 0;
this.robotControl.WorkStatus = "暂未启动";
//
......@@ -190,10 +210,10 @@
this.inletControl.ColorStatus = System.Drawing.Color.White;
this.inletControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.inletControl.EquipText = "入料口";
this.inletControl.Location = new System.Drawing.Point(3, 204);
this.inletControl.Location = new System.Drawing.Point(3, 154);
this.inletControl.MoveInfo = "暂无出入库";
this.inletControl.Name = "inletControl";
this.inletControl.Size = new System.Drawing.Size(488, 195);
this.inletControl.Size = new System.Drawing.Size(488, 145);
this.inletControl.TabIndex = 1;
this.inletControl.WorkStatus = "暂未启动";
//
......@@ -204,24 +224,48 @@
this.outletControl.ColorStatus = System.Drawing.Color.White;
this.outletControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.outletControl.EquipText = "出料口";
this.outletControl.Location = new System.Drawing.Point(497, 204);
this.outletControl.Location = new System.Drawing.Point(497, 154);
this.outletControl.MoveInfo = "暂无出入库";
this.outletControl.Name = "outletControl";
this.outletControl.Size = new System.Drawing.Size(488, 195);
this.outletControl.Size = new System.Drawing.Size(488, 145);
this.outletControl.TabIndex = 2;
this.outletControl.WorkStatus = "暂未启动";
//
// outletDataControl
//
this.outletDataControl.BackColor = System.Drawing.Color.White;
this.outletDataControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.outletDataControl.ColorStatus = System.Drawing.Color.White;
this.outletDataControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.outletDataControl.Location = new System.Drawing.Point(497, 305);
this.outletDataControl.Name = "outletDataControl";
this.outletDataControl.ReelText = "出料口物料信息";
this.outletDataControl.Size = new System.Drawing.Size(488, 145);
this.outletDataControl.TabIndex = 5;
//
// inletDataControl
//
this.inletDataControl.BackColor = System.Drawing.Color.White;
this.inletDataControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.inletDataControl.ColorStatus = System.Drawing.Color.White;
this.inletDataControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.inletDataControl.Location = new System.Drawing.Point(3, 305);
this.inletDataControl.Name = "inletDataControl";
this.inletDataControl.ReelText = "入料口物料信息";
this.inletDataControl.Size = new System.Drawing.Size(488, 145);
this.inletDataControl.TabIndex = 7;
//
// ngboxDataControl
//
this.ngboxDataControl.BackColor = System.Drawing.Color.White;
this.ngboxDataControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ngboxDataControl.ColorStatus = System.Drawing.Color.White;
this.ngboxDataControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.ngboxDataControl.Location = new System.Drawing.Point(3, 405);
this.ngboxDataControl.Location = new System.Drawing.Point(497, 456);
this.ngboxDataControl.Name = "ngboxDataControl";
this.ngboxDataControl.ReelText = "NG箱物料信息";
this.ngboxDataControl.Size = new System.Drawing.Size(488, 197);
this.ngboxDataControl.TabIndex = 3;
this.ngboxDataControl.Size = new System.Drawing.Size(488, 146);
this.ngboxDataControl.TabIndex = 6;
//
// lblStatus
//
......@@ -618,6 +662,9 @@
private EquipControl robotControl;
private EquipControl inletControl;
private EquipControl outletControl;
private ReelDataControl robotDataControl;
private ReelDataControl outletDataControl;
private ReelDataControl inletDataControl;
private ReelDataControl ngboxDataControl;
}
}
......
......@@ -122,6 +122,9 @@ namespace OnlineStore.XLRStore
ShowNGState();
ngboxDataControl.linkClear.Click += LinkClear_ClickA1;
inletDataControl.linkClear.Click += LinkClear_Click;
outletDataControl.linkClear.Click += LinkClear_Click1;
robotDataControl.linkClear.Click += LinkClear_Click2;
robotControl.InitData(StoreManager.Client.robotEquip.Name);
inletControl.InitData(StoreManager.Client.inletEquip.Name);
outletControl.InitData(StoreManager.Client.outletEquip.Name);
......@@ -131,7 +134,63 @@ namespace OnlineStore.XLRStore
outletControl.DoubleClick += OutletControl_DoubleClick;
LoadOk = true;
}
/// <summary>
/// 机器人夹爪清除料盘按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <exception cref="NotImplementedException"></exception>
private void LinkClear_Click2(object sender, EventArgs e)
{
if (BufferDataManager.TrayInRobotInfo == null)
{
return;
}
DialogResult result = MessageBox.Show("确定清除机器人夹爪上的物料缓存?", "", MessageBoxButtons.OKCancel);
if (result.Equals(DialogResult.OK))
{
BufferDataManager.TrayInRobotInfo = null;
LogUtil.info(Name + "清除机器人夹爪上的物料缓存");
}
}
/// <summary>
/// 出料口清除料盘按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <exception cref="NotImplementedException"></exception>
private void LinkClear_Click1(object sender, EventArgs e)
{
if (BufferDataManager.TrayInOutletInfo == null)
{
return;
}
DialogResult result = MessageBox.Show("确定清除出料口的物料缓存?", "", MessageBoxButtons.OKCancel);
if (result.Equals(DialogResult.OK))
{
BufferDataManager.TrayInOutletInfo = null;
LogUtil.info(Name + "清除出料口的物料缓存");
}
}
/// <summary>
/// 入料口清除料盘按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <exception cref="NotImplementedException"></exception>
private void LinkClear_Click(object sender, EventArgs e)
{
if (BufferDataManager.TrayInInletInfo == null)
{
return;
}
DialogResult result = MessageBox.Show("确定清除入料口的物料缓存?", "", MessageBoxButtons.OKCancel);
if (result.Equals(DialogResult.OK))
{
BufferDataManager.TrayInInletInfo = null;
LogUtil.info(Name + "清除入料口的物料缓存");
}
}
private void ShowNGState()
{
......@@ -143,7 +202,32 @@ namespace OnlineStore.XLRStore
{
ngboxDataControl.ShowData("NG箱物料信息", BufferDataManager.TraysInNGBoxInfo, IO_VALUE.HIGH);
}
if (BufferDataManager.TrayInInletInfo == null)
{
ngboxDataControl.ShowData("入料口物料信息", BufferDataManager.TrayInInletInfo, IO_VALUE.LOW);
}
else
{
ngboxDataControl.ShowData("入料口物料信息", BufferDataManager.TrayInInletInfo, IO_VALUE.HIGH);
}
if (BufferDataManager.TrayInOutletInfo == null)
{
ngboxDataControl.ShowData("出料口物料信息", BufferDataManager.TrayInOutletInfo, IO_VALUE.LOW);
}
else
{
ngboxDataControl.ShowData("出料口物料信息", BufferDataManager.TrayInOutletInfo, IO_VALUE.HIGH);
}
if (BufferDataManager.TrayInRobotInfo == null)
{
ngboxDataControl.ShowData("机器人夹爪物料信息", BufferDataManager.TrayInRobotInfo, IO_VALUE.LOW);
}
else
{
ngboxDataControl.ShowData("机器人夹爪物料信息", BufferDataManager.TrayInRobotInfo, IO_VALUE.HIGH);
}
}
private void OutletControl_DoubleClick(object sender, EventArgs e)
{
tabControl1.SelectedIndex = 3;
......
......@@ -80,6 +80,7 @@
this.lblStoreStatus = new System.Windows.Forms.Label();
this.btnStart = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
this.lblrobotTaskInfo = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
......@@ -328,6 +329,7 @@
//
// groupBox6
//
this.groupBox6.Controls.Add(this.lblrobotTaskInfo);
this.groupBox6.Controls.Add(this.lblInoutInfo);
this.groupBox6.Controls.Add(this.lblMoveInfo);
this.groupBox6.Controls.Add(this.lblInstoreList);
......@@ -870,6 +872,17 @@
this.btnStop.UseVisualStyleBackColor = false;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// lblrobotTaskInfo
//
this.lblrobotTaskInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblrobotTaskInfo.ForeColor = System.Drawing.Color.Black;
this.lblrobotTaskInfo.Location = new System.Drawing.Point(2, 394);
this.lblrobotTaskInfo.Name = "lblrobotTaskInfo";
this.lblrobotTaskInfo.Size = new System.Drawing.Size(977, 109);
this.lblrobotTaskInfo.TabIndex = 282;
this.lblrobotTaskInfo.Text = "机器人获取任务";
//
// FrmRobotEquip
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
......@@ -973,6 +986,7 @@
private System.Windows.Forms.Label lblValue;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ComboBox cmbBoxAd;
private System.Windows.Forms.Label lblrobotTaskInfo;
}
}
......@@ -241,6 +241,7 @@ namespace OnlineStore.XLRStore
{
lblInoutInfo.Text = "";
}
lblrobotTaskInfo.Text = SServerManager.RobotTaskInfo;
lblMoveInfo.Text = robotEquip.GetMoveStr();//+ "料仓类型:" + (boxBean.Config.IsBigTray.Equals(1) ? "大料盘" : "小料盘");
//string canOut = boxBean.CanOutStore(boxBean.DeviceID) ? "可出库" : "不可出库";
lblStoreStatus.Text = DeviceBase.GetRunStr(robotEquip.runStatus);// + "(" + canOut + ")";
......
......@@ -103,6 +103,7 @@ namespace OnlineStore.Common
public static string TrayInRobotInfo = "TrayInRobotInfo";
public static string TrayInOutletInfo = "TrayInOutletInfo";
public static string TrayInInletInfo = "TrayInInletInfo";
public static string TraysInNGBoxInfo = "TraysInNGBoxInfo";
/// <summary>
/// 禁用光栅
......
......@@ -273,5 +273,7 @@ namespace OnlineStore.Common
public static string executeTime = "executeTime ";
public static string code = "code";
public static string type = "type";
public static string cid = "cid";
}
}
......@@ -9,7 +9,7 @@ PRO,0,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,,,,
PRO,0,机器人IP,Robot_IP,192.168.102.21,,,,,,,,,,,,,,
PRO,0,料盘高度转换系数,Coeff_Height,0.5,,,,,,,,,,,,,,
PRO,0,料盘宽度转换系数,Coeff_Width,0.5,,,,,,,,,,,,,,
PRO,0,扫码的相机名称(多个用#分隔),ScanCodeCamera,GigE:MV-CE200-10GC (00E70964538),,,,,,,,,,,,,,
PRO,0,扫码的相机名称(多个用#分隔),ScanCodeCamera,GigE:MV-CE200-10GC (00E70964538)#GigE:MV-CE200-10GC (00E70964539),,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,0,行走机构_待机点,MoveAxis_P1,0,,,,,,,,,,,,
PRO,0,行走机构_入料口,MoveAxis_P2_Inlet,0,,,,,,,,,,,,
......@@ -76,5 +76,6 @@ DO,1,13寸料盘顶升下降,Inlet_13InchJackDown,9,HC,Y09,,,,,,,,,,,,
DO,2,出料线体顶升上升,Outlet_JackUp,10,HC,Y10,,,,,,,,,,,,
DO,2,出料线体顶升下降,Outlet_JackDown,11,HC,Y11,,,,,,,,,,,,
DO,1,入料线体送料允许,Inlet_AllowFeed,12,HC,Y12,,,,,,,,,,,,
DO,1,入料线体相机光源,Inlet_CamLed,13,HC,Y13,,,,,,,,,,,,
......@@ -196,7 +196,7 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveType.Equals(MoveType.None) && NoErrorAlarm())
{
if(TrayIsInPosition())
if (!TrayIsInPosition() && BufferDataManager.TrayInInletInfo == null)
{
StartInstore(new InOutParam());
}
......
......@@ -154,7 +154,8 @@ namespace OnlineStore.DeviceLibrary
// MoveLog(" " + MoveInfo.SLog + " 原有料盘尺寸:【" + oldPos.PlateW + "X" + oldPos.PlateH + "】服务器返回尺寸【" + LastPosInfo.PlateW + "X" + LastPosInfo.PlateH + "】 ");
//}
MoveInfo.MoveParam.PosInfo = lastPosInfo;
NextMoveStep(StepEnum.Inlet_08_WaitTrayLeave, "获取目标仓位成功,等待料盘离开");
NextMoveStep(StepEnum.Inlet_08_WaitTrayLeave, $"获取目标仓位成功【{MoveInfo.MoveParam.PosInfo.ToStr()}】,等待料盘离开");
BufferDataManager.TrayInInletInfo = MoveInfo.MoveParam.PosInfo.ToCopy();
AddWaitTrayInPosition(false);
SetCurCmd(RobotEquip.GetCmd_InletUp());
}
......@@ -166,7 +167,6 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.Inlet_08_WaitTrayLeave))
{
NextMoveStep(StepEnum.Inlet_09_WaitRobotInSafe, "料盘离开入料口,等待机器人到安全位置");
BufferDataManager.TrayInRobotInfo = MoveInfo.MoveParam.PosInfo;
SetCurCmd(RobotEquip.GetCmd_Standby());
AddWaitTime(10000);
MoveInfo.OneWaitCanEndStep=true;
......@@ -203,16 +203,22 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(6000));
try
{
IOMove(IO_Type.Inlet_CamLed, IO_VALUE.HIGH);
LastCodeList = CodeManager.CameraScan(Config.ScanCodeCamera, Name);
if (LastCodeList.Count <= 0)
{
LastCodeList = CodeManager.CameraScan(Config.ScanCodeCamera, Name);
}
}
catch (Exception ex)
{
LogUtil.error("扫码出错", ex);
}
finally
{
IOMove(IO_Type.Inlet_CamLed, IO_VALUE.LOW);
}
}
string code = CodeManager.ProcessCode(LastCodeList);
......@@ -288,7 +294,7 @@ namespace OnlineStore.DeviceLibrary
Thread.Sleep(ms);
LogUtil.error(Name + "【" + pos.barcode + "】第[" + count + "]次 " + MoveInfo.SLog + " 结果【" + result.Result + "】,等待" + ms + "后重新获取");
}
else if (!result.Msg.Equals(""))
else if (!result.Result.Equals(0))
{
lastPosInfo = result.Param;
LogUtil.error(Name + "【" + pos.barcode + "】第[" + count + "]次 " + MoveInfo.SLog + " 入库NG:" + result.Msg);
......
......@@ -87,7 +87,8 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StepEnum.Outlet_04_WaitTrayLeave))
{
NextMoveStep(StepEnum.Outlet_05_JackUp, "料盘离开完成,链条停止,顶升抬起");
NextMoveStep(StepEnum.Outlet_05_JackUp, "料盘离开完成,清除出料口缓存,链条停止,顶升抬起");
BufferDataManager.TrayInOutletInfo = null;
OutletRun(false);
JackUp(true);
AddWaitTrayCheck2(false);
......
......@@ -255,6 +255,14 @@ namespace OnlineStore.DeviceLibrary
if (!runStatus.Equals(RunStatus.Runing))
return;
}
private void CheckInStoreProcess()
{
if (StoreManager.Client.inletEquip.TrayIsInPosition() && BufferDataManager.TrayInInletInfo != null)
{
LogInfo("机器人执行入库【" + BufferDataManager.TrayInInletInfo.ToStr() + "】");
StartExecuctOut(new InOutParam(BufferDataManager.TrayInInletInfo));
}
}
private void ExecuteOutListProcess()
{
try
......@@ -289,6 +297,10 @@ namespace OnlineStore.DeviceLibrary
{
ExecuteOutListProcess();
}
if (runStatus.Equals(RunStatus.Runing))
{
CheckInStoreProcess();
}
BusyMoveProcess();
IOTimeOutProcess();
if (NoErrorAlarm())
......@@ -427,7 +439,7 @@ namespace OnlineStore.DeviceLibrary
{
preNgSig = curNgSig;
curNgSig = IOValue(IO_Type.NGBox_TrayCheck).Equals(IO_VALUE.HIGH);
if(curNgSig==true && preNgSig==false)
if (curNgSig == true && preNgSig == false)
{
BufferDataManager.AddTrayInNGBox(new InOutPosInfo());
}
......
......@@ -35,39 +35,39 @@ namespace OnlineStore.DeviceLibrary
private DateTime lastConTime = DateTime.Now;
public void server_connect_timer_Tick(object sender, EventArgs e)
{
//if (isInProcess)
//{
// TimeSpan span = DateTime.Now - lastConTime;
// if (span.TotalSeconds < 60)
// {
// return;
// }
//}
//isInProcess = true;
//lastConTime = DateTime.Now;
//try
//{
// //humBean.HumidityProcess(this);
// if (IsDebug)
// {
if (isInProcess)
{
TimeSpan span = DateTime.Now - lastConTime;
if (span.TotalSeconds < 60)
{
return;
}
}
isInProcess = true;
lastConTime = DateTime.Now;
try
{
//humBean.HumidityProcess(this);
if (IsDebug)
{
// }
// else
// {
// if (StoreManager.IsConnectServer)
// {
// SendLineStatus();
// }
// }
//}
//catch (Exception ex)
//{
// LogUtil.error(Name + "定时SendLineStatus出错:" + ex.ToString());
//}
//finally
//{
// isInProcess = false;
//}
}
else
{
if (StoreManager.IsConnectServer)
{
GetRobotTask();
}
}
}
catch (Exception ex)
{
LogUtil.error(Name + "定时SendLineStatus出错:" + ex.ToString());
}
finally
{
isInProcess = false;
}
}
/// <summary>
/// 获取整个料仓的状态
......@@ -199,6 +199,36 @@ namespace OnlineStore.DeviceLibrary
// }
//}
public void GetRobotTask()
{
DateTime time = DateTime.Now;
//获取出库任务
TaskData taskData = SServerManager.GetRobotTask();
//发送状态信息到服务器
if (taskData == null || (taskData.code <0))
{
//判断服务端是否返回出库操作
return;
}
if (taskData.code.Equals(1))
{
//上个任务还未结束
return;
}
else if (taskData.code.Equals(0))
{
ReviceOutStoreProcess(taskData);
}
else
{
LogUtil.error("收到服务器命令:op=" + taskData.code + ",未找到对应处理");
}
TimeSpan span = DateTime.Now - time;
if (span.TotalMilliseconds > 10)
{
LogUtil.info(Name + "执行TimerProcess 共处理了【" + span.TotalMilliseconds + "】毫秒");
}
}
//public bool ReviceInStoreCMD(string posId, int plateH, int plateW, string message)
//{
// string logName = "入库库位验证【 " + message + "】【" + posId + "】:";
......@@ -256,97 +286,83 @@ namespace OnlineStore.DeviceLibrary
// return false;
//}
//public string LastVisualRfid = "";
//private void ReviceOutStoreProcess(Operation resultOperation)
//{
// DateTime time = DateTime.Now;
// Dictionary<string, string> data = resultOperation.data;
// if (data != null && data.ContainsKey(ParamDefine.posId)
// && data.ContainsKey(ParamDefine.plateH) && data.ContainsKey(ParamDefine.plateW))
// {
// char splitChar = '|';
// string[] posIdArray = data[ParamDefine.posId].Split(splitChar);
// string[] plateWArray = data[ParamDefine.plateW].Split(splitChar);
// string[] plateHArray = data[ParamDefine.plateH].Split(splitChar);
// //if (string.IsNullOrEmpty(StoreManager.LastVisualRfid))
// //{
// // StoreManager.LastVisualRfid = data[ParamDefine.rfid];
// //}
// //else if (StoreManager.LastVisualRfid != data[ParamDefine.rfid])
// //{
// // LogUtil.error(Name + $" 上一个工单还未结束LastVisualRfid={StoreManager.LastVisualRfid}, CurrentVisualRfid={data[ParamDefine.rfid]}");
// // return;
// //}
// bool urgentReel = FormUtil.GetBoolData(data, ParamDefine.urgentReel);
// //bool cutReel = FormUtil.GetBoolData(data, ParamDefine.cutReel);
// //bool smallReel = FormUtil.GetBoolData(data, ParamDefine.smallReel);
// //string rfid = data.ContainsKey(ParamDefine.rfid) ? data[ParamDefine.rfid] : "";
// //int rfidLoc = FormUtil.GetIntData(data, ParamDefine.rfidLoc);
// string barcode = data.ContainsKey(ParamDefine.barcode) ? data[ParamDefine.barcode] : "";
// //string realRfid = data.ContainsKey(ParamDefine.realRfid) ? data[ParamDefine.realRfid] : "";
// //int taskCount = FormUtil.GetIntData(data, ParamDefine.taskCount, 0);
// //urgentReel: true 表示紧急料,需要出到料串上
// //cutReel: true 表示分盘料,需要出到料串上
// //smallReel: true 小料(7x8),放置到小料架上
// //rfid: 分配的料架RFID
// //rfidLoc: 料架的架位,值为 - 1时,可以自由分配皮带线, 小料时,架位为1 - 46优先走1 / 2号皮带线,47 - 92优先走3 / 4号皮带线, 70,71,72时只能分配到3 / 4号皮带线; 大料时,架位1 - 6优先走1 / 2号皮带线, 7 - 12优先走3 / 4号皮带线
// string dataStr = JsonHelper.SerializeObject(data);
// LogUtil.info("收到服务器出库消息:【" + dataStr + "】");
private void ReviceOutStoreProcess(TaskData resultOperation)
{
DateTime time = DateTime.Now;
Dictionary<string, string> data = resultOperation.data;
if (data != null && data.ContainsKey(ParamDefine.posId)
&& data.ContainsKey(ParamDefine.plateH) && data.ContainsKey(ParamDefine.plateW)&&
data.ContainsKey(ParamDefine.type)&& data.ContainsKey(ParamDefine.cid))
{
char splitChar = '|';
string[] cids= data[ParamDefine.cid].Split(splitChar);
string[] posIdArray = data[ParamDefine.posId].Split(splitChar);
string[] plateWArray = data[ParamDefine.plateW].Split(splitChar);
string[] plateHArray = data[ParamDefine.plateH].Split(splitChar);
// int index = -1;
// foreach (string posId in posIdArray)
// {
// index++;
// int plateW = Convert.ToInt32(plateWArray[index]);
// int plateH = Convert.ToInt32(plateHArray[index]);
string barcode = data.ContainsKey(ParamDefine.barcode) ? data[ParamDefine.barcode] : "";
string dataStr = JsonHelper.SerializeObject(data);
int type = int.Parse(data[ParamDefine.type]);
if (type == 1)
{
LogUtil.error($"收到服务器出库消息类型异常;{dataStr}");
return;
}
LogUtil.info("收到服务器出库消息:【" + dataStr + "】");
// InOutParam inoutParam = new InOutParam(new InOutPosInfo(barcode, posId, plateW, plateH, urgentReel));
// //根据发送的posId获取位置列表
// BoxPosition position = CSVPositionReader<BoxPosition>.GetPositon(posId);
// if (position == null)
// {
// //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
// WarnMsg = Name + "未找到库位:【" + inoutParam.PosInfo.ToStr() + "】";
// LogUtil.error(WarnMsg);
// continue;
// }
// try
// {
// //判断是否接收过此库位的出库信息
// if (MoveInfo.MoveType.Equals(MoveType.OutStore) && (MoveInfo.MoveParam.PosInfo.PosId.Equals(posId)||
// (MoveInfo.MoveParam.PosInfoBack !=null && MoveInfo.MoveParam.PosInfoBack.PosId.Equals(posId))))
// {
// LogUtil.error(Name + " 出库命令【" + inoutParam.PosInfo.ToStr() + "】重复,正在【" + posId + "】出库中");
// continue;
// }
int index = -1;
foreach (string cid in cids)
{
index++;
int plateW = Convert.ToInt32(plateWArray[index]);
int plateH = Convert.ToInt32(plateHArray[index]);
string posId = posIdArray[index];
InOutParam inoutParam = new InOutParam(new InOutPosInfo(barcode, posId, plateW, plateH));
inoutParam.PosInfo.Cid = cid;
//根据发送的cid
string[] existCids = ConfigAppSettings.GetValue(Setting_Init.Line_CID).Split(',');
bool hasCid = existCids.Contains(cid);
if (!hasCid)
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = Name + "未找到料仓:【" + inoutParam.PosInfo.ToStr() + "】";
LogUtil.error(WarnMsg);
continue;
}
try
{
//判断是否接收过此料仓的出库信息
if (MoveInfo.MoveType.Equals(MoveType.OutStore) && (MoveInfo.MoveParam.PosInfo.Cid.Equals(cid)))
{
LogUtil.error(Name + " 出库命令【" + inoutParam.PosInfo.ToStr() + "】重复,正在【" + cid + "】出库中");
continue;
}
// //判断排队列表中是否已存在
// List<InOutParam> reviceList = new List<InOutParam>();
// reviceList.AddRange(waitAOutStoreList);
// reviceList.AddRange(waitBOutStoreList);
// reviceList = (from m in reviceList where m.PosInfo.PosId.Equals(posId) select m).ToList<InOutParam>();
// if (reviceList.Count > 0)
// {
// LogUtil.error(Name + " 出库命令【" + inoutParam.PosInfo.ToStr() + "】重复,排队列表中已存在【" + reviceList[0].PosInfo.ToStr() + "】");
// continue;
// }
//判断排队列表中是否已存在
List<InOutParam> reviceList = new List<InOutParam>();
reviceList.AddRange(waitOutStoreList);
reviceList = (from m in reviceList where m.PosInfo.Cid.Equals(cid) select m).ToList<InOutParam>();
if (reviceList.Count > 0)
{
LogUtil.error(Name + " 出库命令【" + inoutParam.PosInfo.ToStr() + "】重复,排队列表中已存在【" + reviceList[0].PosInfo.ToStr() + "】");
continue;
}
// }
// catch (Exception ex)
// {
// LogUtil.error(Name + "验证出库【" + inoutParam.PosInfo.ToStr() + "】是否重复出错:" + ex.ToString());
// }
// StartExecuctOut(inoutParam);
// }
}
catch (Exception ex)
{
LogUtil.error(Name + "验证出库【" + inoutParam.PosInfo.ToStr() + "】是否重复出错:" + ex.ToString());
}
StartExecuctOut(inoutParam);
}
// TimeSpan span = DateTime.Now - time;
// if (span.TotalMilliseconds > 10)
// {
// LogInfo(Name + "执行 ReviceOutStoreProcess 共处理了【" + span.TotalMilliseconds + "】毫秒");
// }
// }
//}
TimeSpan span = DateTime.Now - time;
if (span.TotalMilliseconds > 10)
{
LogInfo(Name + "执行 ReviceOutStoreProcess 共处理了【" + span.TotalMilliseconds + "】毫秒");
}
}
}
#endregion
}
......
......@@ -45,7 +45,7 @@ namespace OnlineStore.DeviceLibrary
InStore_06_CompressTray();
break;
case StepEnum.InStore_06_CompressTray:
NextMoveStep(StepEnum.InStore_07_ArmBackToP1, "在入料口取料完成,机械臂回待机点");
NextMoveStep(StepEnum.InStore_07_ArmBackToP1, "在入料口取料完成,清除入料口缓存,机械臂回待机点");
InStore_07_ArmBackToP1();
break;
case StepEnum.InStore_07_ArmBackToP1:
......@@ -75,7 +75,10 @@ namespace OnlineStore.DeviceLibrary
InStore_11_ReleaseTray();
break;
case StepEnum.InStore_11_ReleaseTray:
NextMoveStep(StepEnum.InStore_16_ArmBackToP1, "在仓门口放料完成,机械臂回待机点");
NextMoveStep(StepEnum.InStore_16_ArmBackToP1, "在仓门口放料完成,清除机器人料叉缓存,机械臂回待机点");
//在料仓口口放料完成
BufferDataManager.TrayInRobotInfo = null;
UpdateLocInfo(MoveInfo.MoveParam.PosInfo.barcode, TaskStatus.BOXDOOR);
InStore_16_ArmBackToP1();
break;
#region NG
......@@ -99,7 +102,10 @@ namespace OnlineStore.DeviceLibrary
InStore_15_ReleaseTray();
break;
case StepEnum.InStore_15_ReleaseTray:
NextMoveStep(StepEnum.InStore_16_ArmBackToP1, "在NG箱放料完成,机械臂回待机点");
NextMoveStep(StepEnum.InStore_16_ArmBackToP1, "在NG箱放料完成,清除机器人料叉缓存,机械臂回待机点");
//在料仓口口放料完成
BufferDataManager.TrayInRobotInfo = null;
// UpdateLocInfo(MoveInfo.MoveParam.PosInfo.barcode, TaskStatus.BOXDOOR);
InStore_16_ArmBackToP1();
break;
#endregion
......@@ -146,6 +152,10 @@ namespace OnlineStore.DeviceLibrary
}
private void InStore_07_ArmBackToP1()
{
//在入料口取料完成
BufferDataManager.TrayInInletInfo = null;
BufferDataManager.TrayInRobotInfo = MoveInfo.MoveParam.PosInfo.ToCopy();
UpdateLocInfo(MoveInfo.MoveParam.PosInfo.barcode, TaskStatus.INROBOT);
SendCmd(GetCmd_Standby());
}
private void InStore_08_MoveAxisToStore()
......@@ -197,6 +207,18 @@ namespace OnlineStore.DeviceLibrary
targetIndex = 0;
}
#endregion
/// <summary>
/// 机器人更新任务状态
/// </summary>
/// <param name="barcode"></param>
/// <param name="status"></param>
private void UpdateLocInfo(string barcode,string status)
{
string result=SServerManager.UpdateTrayLoc(barcode, status);
if(!result.Equals(""))
{
SServerManager.UpdateTrayLoc(barcode, status);
}
}
}
}
......@@ -45,7 +45,7 @@ namespace OnlineStore.DeviceLibrary
OutStore_06_CompressTray();
break;
case StepEnum.OutStore_06_CompressTray:
NextMoveStep(StepEnum.OutStore_07_ArmBackToP1, "在仓门口取料完成,机械臂回待机点");
NextMoveStep(StepEnum.OutStore_07_ArmBackToP1, "在仓门口取料完成,添加机器人缓存,机械臂回待机点");
OutStore_07_ArmBackToP1();
break;
case StepEnum.OutStore_07_ArmBackToP1:
......@@ -67,7 +67,7 @@ namespace OnlineStore.DeviceLibrary
OutStore_11_ReleaseTray();
break;
case StepEnum.OutStore_11_ReleaseTray:
NextMoveStep(StepEnum.OutStore_12_ArmBackToP1, "在出料口放料完成,机械臂回待机点");
NextMoveStep(StepEnum.OutStore_12_ArmBackToP1, "在出料口放料完成,清除机器人缓存,机械臂回待机点");
OutStore_12_ArmBackToP1();
break;
case StepEnum.OutStore_12_ArmBackToP1:
......@@ -101,6 +101,9 @@ namespace OnlineStore.DeviceLibrary
}
private void OutStore_07_ArmBackToP1()
{
//添加机器人缓存,并上报任务状态
BufferDataManager.TrayInRobotInfo = MoveInfo.MoveParam.PosInfo.ToCopy();
UpdateLocInfo(MoveInfo.MoveParam.PosInfo.barcode, TaskStatus.INROBOT);
SendCmd(GetCmd_Standby());
}
......@@ -127,6 +130,10 @@ namespace OnlineStore.DeviceLibrary
}
private void OutStore_12_ArmBackToP1()
{
//上报任务状态
BufferDataManager.TrayInRobotInfo = null;
BufferDataManager.TrayInOutletInfo = MoveInfo.MoveParam.PosInfo.ToCopy();
UpdateLocInfo(MoveInfo.MoveParam.PosInfo.barcode, TaskStatus.FINISHED);
SendCmd(GetCmd_Standby());
}
#endregion
......
......@@ -109,8 +109,11 @@ namespace OnlineStore.DeviceLibrary
string[] recv = bean.RobotData.RecvMsg.Split(',');
if (recv != null && recv.Length == 2 &&
recv[1].Equals(rtn_done))
{
LogUtil.info($"RobotMoveEnd:[{recv[0]},{recv[1]}]");
return true;
}
}
catch (Exception ex)
{
LogUtil.error($"RobotMoveEnd:{bean.RobotData.RecvMsg}", ex);
......@@ -272,7 +275,7 @@ namespace OnlineStore.DeviceLibrary
int targetIndex = 0;
private void MoveAxisToStore()
{
switch (MoveInfo.MoveParam.PosInfo.PosId.Substring(0, 2))
switch (MoveInfo.MoveParam.PosInfo.Cid)
{
case "01":
targetIndex = 1;
......@@ -345,7 +348,7 @@ namespace OnlineStore.DeviceLibrary
startInStoreTime = DateTime.Now;
LogInfo(" 启动入库【" + param.PosInfo.ToStr() + "】 ");
param.MoveP = new LineMoveP(Config, param.PosInfo.PosId);
LogInfo("LoadInoutParam:" + JsonHelper.SerializeObject(param.MoveP));
//LogInfo("LoadInoutParam:" + JsonHelper.SerializeObject(param.MoveP));
MoveInfo.NewMove(MoveType.InStore, param);
SetBoxStatus(DeviceStatus.InStoreExecute, RunStatus.Busy, param.PosInfo);
MoveInfo.NextMoveStep(StepEnum.InStore_01_Wait);
......@@ -376,15 +379,15 @@ namespace OnlineStore.DeviceLibrary
{
lock (outStoreObject)
{
if (MoveInfo.MoveType.Equals(MoveType.OutStore) && MoveInfo.MoveParam.PosInfo.PosId.Equals(param.PosInfo.PosId))
if (MoveInfo.MoveType.Equals(MoveType.OutStore) && MoveInfo.MoveParam.PosInfo.Cid.Equals(param.PosInfo.Cid))
{
LogUtil.error(Name + " 出库命令【" + param.PosInfo.ToStr() + "】重复,【" + MoveInfo.MoveParam.PosInfo.PosId + "】出库执行中");
LogUtil.error(Name + " 出库命令【" + param.PosInfo.ToStr() + "】重复,【" + MoveInfo.MoveParam.PosInfo.Cid + "】出库执行中");
return;
}
List<InOutParam> reviceList = new List<InOutParam>();
reviceList.AddRange(waitOutStoreList);
reviceList = (from m in reviceList where m.PosInfo.PosId.Equals(param.PosInfo.PosId) select m).ToList<InOutParam>();
reviceList = (from m in reviceList where m.PosInfo.Cid.Equals(param.PosInfo.Cid) select m).ToList<InOutParam>();
if (reviceList.Count == 0)
{
LogInfo(" 执行出库【" + param.PosInfo.ToStr() + "】失败,加入等待队列");
......@@ -418,7 +421,7 @@ namespace OnlineStore.DeviceLibrary
SetBoxStatus(DeviceStatus.OutStoreExecute, RunStatus.Busy, param.PosInfo);
MoveInfo.NewMove(MoveType.OutStore, param);
LogInfo("启动出库【" + param.PosInfo.ToStr() + "】 ");
LogInfo("LoadInoutParam:" + JsonHelper.SerializeObject(param.MoveP));
//LogInfo("LoadInoutParam:" + JsonHelper.SerializeObject(param.MoveP));
MoveInfo.NextMoveStep(StepEnum.OutStore_01_Wait);
return true;
......
......@@ -102,7 +102,7 @@ namespace OnlineStore.DeviceLibrary
}
public static List<string> CameraScan(string cameraName, string deviceName, bool findRightCodeBreak = false, int timeOut = 1500)
{
List<string> nameList = new List<string>() { cameraName };
List<string> nameList = cameraName.Split('#').ToList();//new List<string>() { cameraName };
return CameraScan(nameList, deviceName, findRightCodeBreak, timeOut);
}
private static int ScanCount = 0;
......
......@@ -11,6 +11,7 @@ namespace OnlineStore.DeviceLibrary
{
private static InOutPosInfo trayInRobotInfo = null;
private static InOutPosInfo trayInOutletInfo = null;
private static InOutPosInfo trayInInletInfo = null;
private static List<InOutPosInfo> traysInNGBoxInfo = null;
/// <summary>
///机器人夹爪上的料盘信息,null时无料
......@@ -33,6 +34,15 @@ namespace OnlineStore.DeviceLibrary
SaveData(Setting_Init.TrayInOutletInfo, value);
}
}
public static InOutPosInfo TrayInInletInfo
{
get { return trayInInletInfo; }
set
{
trayInInletInfo = value;
SaveData(Setting_Init.TrayInInletInfo, value);
}
}
/// <summary>
/// NG箱里的料盘信息
/// </summary>
......@@ -58,6 +68,7 @@ namespace OnlineStore.DeviceLibrary
TrayInRobotInfo = LoadInoutPosInfo(Setting_Init.TrayInRobotInfo);
TraysInNGBoxInfo = LoadNGBoxPosInfos(Setting_Init.TraysInNGBoxInfo);
TrayInOutletInfo = LoadInoutPosInfo(Setting_Init.TrayInOutletInfo);
TrayInInletInfo = LoadInoutPosInfo(Setting_Init.TrayInInletInfo);
}
private static InOutPosInfo LoadInoutPosInfo(string configStr)
{
......
......@@ -46,23 +46,7 @@ namespace OnlineStore.DeviceLibrary
}
#endregion
//http://localhost/myproject/service/store/emptyPosForPutin
private static string Addr_PosForPutin = "/service/store/emptyPosForPutin";
/// <summary>
/// 1 皮带线扫码后调用,用于获取尺寸后升起气缸
/// 地址: /rest/api/qisda/device/getSize
/// </summary>
private static string Addr_getSize = "/rest/api/qisda/device/getSize";
/// <summary>
/// 2 料盘流转位置信息更新
/// 地址: /rest/api/qisda/device/updateLocInfo
/// </summary>
private static string Addr_updateLocInfo = "/rest/api/qisda/device/updateLocInfo";
///// <summary>
///// 3 放入料架(A,B,C,D)后调用,根据返回值决定当前料架是否放满,以及后续是否还有任务
//// 地址: /rest/api/qisda/device/putShelfFinished
///// </summary>
//private static string Addr_putShelfFinished = "/rest/api/qisda/device/putShelfFinished";
private static string Addr_PosForPutin = "/service/store/robotBox/emptyPosForPutin";
private static string serverAddr = ConfigAppSettings.GetValue(Setting_Init.http_server);
private static string GetAddr(string addr, Dictionary<string, string> paramsMap)
......@@ -98,344 +82,16 @@ 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)
{
string msg = "";
try
{
if (String.IsNullOrEmpty(barcode))
{
return msg;
}
if (string.IsNullOrEmpty(serverAddr))
{
LogUtil.error(deviceName + "UpdateTrayLoc [" + barcode + "] [" + status + "] :未找到服务器地址");
return msg;
}
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("barcode", barcode);//barcode = 料盘的条码
paramMap.Add("status", status); // status = 状态信息, 移栽 = MOVING, 流水线 = INLINE, 皮带线 = INBELT
paramMap.Add("locInfo", locInfo); // locInfo = 位置信息,移栽时为移栽编号,流水线时为托盘号,皮带线时为皮带线编号,机器人时为机器人编号
string server = GetAddr(Addr_updateLocInfo, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
LogUtil.info("UpdateTrayLoc " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
// 返回: { "code": 0, "msg":"ok", "data":""}
ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr);
if (serverResult == null)
{
msg = deviceName + "UpdateTrayLoc【 " + barcode + "】【" + status + "】【" + locInfo + "】没有收到服务器反馈";
}
else if (serverResult.code.Equals(0).Equals(false))
{
// code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = deviceName + " UpdateTrayLoc【 " + barcode + "】【" + status + "】【" + locInfo + "】 :" + "[" + serverResult.code + "]" + serverResult.msg;
}
if (!msg.Equals(""))
{
LogUtil.error(msg);
}
}
catch (Exception ex)
{
LogUtil.error(deviceName + " ", ex);
}
return msg;
}
private static string Addr_clearPutInRfid = "/service/store/qisda/clearPutInRfid";
public static string clearPutInRfid(string deviceName, string rfid)
{
string msg = "";
try
{
if (String.IsNullOrEmpty(rfid))
{
return msg;
}
if (string.IsNullOrEmpty(serverAddr))
{
LogUtil.error(deviceName + "clearPutInRfid [" + rfid + "] :未找到服务器地址");
return msg;
}
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("rfid", rfid);//rfid
string server = GetAddr(Addr_clearPutInRfid, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
LogUtil.info(deviceName + "clearPutInRfid " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
}
catch (Exception ex)
{
LogUtil.error(deviceName + " " + ex.ToString());
}
return msg;
}
//皮带线获取尺寸后,料盘到达机器人取料位置进调用,如果未扫到码,或者没等到取料位置信号亮,可以不用调用
//> 地址:
//>>/rest/api/qisda/device/arrive3fRobotLocation
//>
//> 参数:
//>> - robotIndex=机器人编号,IP为51的机器人为1, 52的机器人为2, 53的机器人为3
//>
//> 返回:
//>>``
private static string Addr_arrive3fRobotLocation = "/rest/api/qisda/device/arrive3fRobotLocation";
public static string arrive3fRobotLocation(string deviceName, int robotIndex, string barcode)
{
string msg = "";
if (string.IsNullOrEmpty(serverAddr))
{
LogUtil.error(deviceName + "arrive3fRobotLocation [" + robotIndex + "][" + barcode + "] :未找到服务器地址");
return msg;
}
try
{
if (robotIndex <= 0)
{
return "robotIndex="+robotIndex;
}
DateTime startTime = DateTime.Now;
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("robotIndex", robotIndex.ToString());//rfid
paramMap.Add("barcode", barcode);
string server = GetAddr(Addr_arrive3fRobotLocation, paramMap);
string resultStr = HttpHelper.Post(server, "");
LogUtil.info(deviceName + "arrive3fRobotLocation " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
}
catch (Exception ex)
{
msg = deviceName + " " + ex.ToString();
LogUtil.error(deviceName + " " + ex.ToString());
}
return msg;
}
// 分盘料/紧急料放上料串或料架时调用 /rest/api/qisda/device/afterPutCut
private static string Addr_afterPutCut = "/rest/api/qisda/device/afterPutCut";
public static string afterPutCut(string deviceName, string rfid, string barcode, string cid, int rfidLoc, out TaskData afterData)
{
afterData = null;
string msg = "";
if (string.IsNullOrEmpty(serverAddr))
{
LogUtil.error(deviceName + "afterPutCut [" + rfid + "][" + barcode + "][" + cid + "][" + rfidLoc + "] :未找到服务器地址");
return msg;
}
try
{
//参数:
//cid: 料仓cid,流水线可传入空
//barcode : 条码
//rfid : RFID
//rfidLoc: 料架位置,流水线可传-1
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("barcode", barcode); // 参数: barcode=料盘的条码
paramMap.Add("rfid", rfid); // rfid = 料架的RFID信息
paramMap.Add("rfidLoc", rfidLoc.ToString()); // rfidLoc=料架的架位信息
paramMap.Add("cid", cid); // 料仓cid,流水线可传入空
string server = GetAddr(Addr_afterPutCut, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
if (barcode != "")
{
LogUtil.info(deviceName + "afterPutCut " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
}
else
{
LogUtil.debug(deviceName + "afterPutCut " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
}
//> 返回:
//>>` {"code": 0, "msg":"ok", "data":{"cutPackageTask":"0","urgentPackageTask":"20","cutTask":"21","urgentTask":"22"}} `
//>>
//>> - code: 0为正常,其他为异常,
//>> - msg:消息,
//>> - data:为包装料仓的空闲仓位数(key为与客户端一致的料仓标识, value为空闲仓位)
//>> - cutPackageTask: 表示当前包装仓的分盘任务数
//>> - urgentPackageTask: 表示当前包装仓的紧急料任务数
//>> - cutTask: 表示流水线分盘任务数
//>> - urgentTask: 表示流水线紧急料任务数
AfterPutData serverResult = JsonHelper.DeserializeJsonToObject<AfterPutData>(resultStr);
if (serverResult == null)
{
return msg = deviceName + "afterPutCut【 " + barcode + "】【" + rfid + "】【" + rfidLoc + "】没有收到服务器反馈";
}
else if (serverResult.code.Equals(0).Equals(false))
{
return msg = deviceName + " afterPutCut【 " + barcode + "】【" + rfid + "】【" + rfidLoc + "】 :" + serverResult.msg;
}
afterData = serverResult.data;
return "";
}
catch (Exception ex)
{
LogUtil.error(deviceName + " " + ex.ToString());
}
return msg;
}
// 分盘料/紧急料启动时获取料架的虚拟RFID调用 地址: /rest/api/qisda/device/findTempRfid
private static string Addr_findTempRfid = "/rest/api/qisda/device/findTempRfid";
public static string findTempRfid(string deviceName, string rfid, out string tempRfid)
{
tempRfid = "";
string msg = "";
if (string.IsNullOrEmpty(serverAddr))
{
LogUtil.error(deviceName + "findTempRfid [" + rfid + "] :未找到服务器地址");
return msg;
}
try
{
// 参数: rfid: RFID
// 返回: "code": 0, "msg":"ok", "data":{ "tempRfid":""}
// code: 0为正常,其他为异常,
//msg: 消息,
//data: tempRfid: 表示当前料架(料串)对应的虚拟RFID
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("rfid", rfid); // rfid: RFID
string server = GetAddr(Addr_findTempRfid, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
LogUtil.info(deviceName + "findTempRfid " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
RfidData data = JsonHelper.DeserializeJsonToObject<RfidData>(resultStr);
if (data == null)
{
return msg = deviceName + " findTempRfid【 " + rfid + "】 没有收到服务器反馈";
}
else if (data.code.Equals(0).Equals(false))
{
return msg = deviceName + " findTempRfid【 " + rfid + "】 :" + data.msg;
}
if (data.data != null && data.data.ContainsKey("tempRfid"))
{
tempRfid = data.data["tempRfid"];
}
return "";
}
catch (Exception ex)
{
LogUtil.error(deviceName + " " + ex.ToString());
}
return msg;
}
// 取消任务地址: /cancelPutInTask //参数: barcode
private static string Addr_cancelPutInTask = "/rest/api/qisda/device/cancelPutInTask";
public static string cancelPutInTask(string deviceName, string barcode)
{
string msg = "";
try
{
if (string.IsNullOrEmpty(serverAddr))
{
LogUtil.error(deviceName + "cancelPutInTask [" + barcode + "] :未找到服务器地址");
return msg;
}
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("barcode", barcode);
string server = GetAddr(Addr_cancelPutInTask, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
LogUtil.info(deviceName + "cancelPutInTask " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
CancelData data = JsonHelper.DeserializeJsonToObject<CancelData>(resultStr);
if (data == null)
{
return msg = deviceName + " cancelPutInTask【 " + barcode + "】 没有收到服务器反馈";
}
else if (data.code.Equals(0).Equals(false))
{
return msg = deviceName + " cancelPutInTask【 " + barcode + "】 :" + data.msg;
}
return "";
}
catch (Exception ex)
{
LogUtil.error(deviceName + " " + ex.ToString());
}
return msg;
}
/// <summary>
/// 获取库位号
/// </summary>
/// <param name="deviceName"></param>
/// <param name="codeList"></param>
/// <param name="height"></param>
/// <param name="width"></param>
/// <param name="rfid"></param>
/// <param name="lastPosId"></param>
/// <returns></returns>
public static GetPosResult GetPosId(string deviceName, List<string> codeList, int height, int width, string rfid, string lastPosId)
{
GetPosResult result = new GetPosResult();
......@@ -470,8 +126,8 @@ namespace OnlineStore.DeviceLibrary
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("cids", StoreManager.Config.CID);
paramMap.Add("code", codeStr);
paramMap.Add(ParamDefine.rfid, rfid);
paramMap.Add(ParamDefine.lastPosId, lastPosId);
//paramMap.Add(ParamDefine.rfid, rfid);
//paramMap.Add(ParamDefine.lastPosId, lastPosId);
string server = GetAddr(Addr_PosForPutin, paramMap);
DateTime startTime = DateTime.Now;
......@@ -489,14 +145,14 @@ namespace OnlineStore.DeviceLibrary
if (serverResult == null)
{
result.Msg = deviceName + " 【" + codeStr + "】结果:没有收到服务器反馈,调用 cancelPutInTask ";
cancelPutInTask(deviceName, codeStr);
result.Msg = deviceName + " 【" + codeStr + "】结果:没有收到服务器反馈 ";
//cancelPutInTask(deviceName, codeStr);
result.Param = InOutPosInfo.NewNgPos(codeStr, "", height, width, "没有收到服务器反馈");
result.Param.rfid = rfid;
result.Param.IsNG = true;
return result;
}
else if ((!string.IsNullOrEmpty(serverResult.msg)) && serverResult.result.Equals(98))
else if (serverResult.result.Equals(98))
{
result.Result = serverResult.result;
result.Msg = "";
......@@ -506,58 +162,42 @@ namespace OnlineStore.DeviceLibrary
int rfidloc = FormUtil.GetIntValue(serverResult.rfidLoc);
int pH = FormUtil.GetIntValue(serverResult.plateH);
int pW = FormUtil.GetIntValue(serverResult.plateW);
result.Param = new InOutPosInfo(serverResult.barcode, serverResult.posId, pW, pH, urgentReel, cutReel, smallReel, serverResult.rfid, rfidloc);
result.Param = new InOutPosInfo(serverResult.barcode, serverResult.pos, pW, pH, urgentReel, cutReel, smallReel, serverResult.rfid, rfidloc);
LogUtil.error(deviceName + " 【" + codeStr + "】结果入库NG:收到出库信息: " + result.Param.ToStr() + " ");
LogUtil.error(deviceName + " 【" + codeStr + "】结果入库NG:已有出库信息: " + result.Param.ToStr() + " ");
result.Msg ="收到出库信息["+ serverResult.barcode + "][" + serverResult.posId + "] ";
cancelPutInTask(deviceName, codeStr);
result.Param = InOutPosInfo.NewNgPos(codeStr, "", height, width, "收到出库信息[" + serverResult.barcode + "][" + serverResult.posId + "]");
result.Msg = "已有出库信息["+ serverResult.barcode + "][" + serverResult.pos + "] ";
result.Param = InOutPosInfo.NewNgPos(codeStr, "", height, width, "已有出库信息[" + serverResult.barcode + "][" + serverResult.pos + "]");
result.Param.rfid = rfid;
result.Param.IsNG = true;
return result;
}
else if ((!string.IsNullOrEmpty(serverResult.msg)) || serverResult.result.Equals(0).Equals(false))
else if (serverResult.result.Equals(105))
{
result.Result = serverResult.result;
//result.Msg = deviceName + " 【" + codeStr + "】结果:" + serverResult.msg;
result.Msg = serverResult.msg;
result.Msg = "查找空库位失败";
result.Param = InOutPosInfo.NewNgPos(codeStr, "", height, width, serverResult.msg);
result.Param.rfid = rfid;
return result;
}
result.Result = serverResult.result;
if (!serverResult.pos.Equals(""))
{
// 库位号格式:
//例:05AA03040102
//05:第1和第2位表示料仓编号,01 - 08
//AA:第3和第4位存储机构A面或B面,AA或者BB
//03:第5和第6位表示抽屉在第几行
//04:第7和第8位表示抽屉在第几列
//01:第9和第10位表示在抽屉中的第几行
//02:第11和第12位表示在抽屉中的第几列
string posId = serverResult.pos;
//根据库位号查找移栽
// 判断PosID是否已经在入库或者在排队列表中,如果已经存在,加入列表失败
result.Param = new InOutPosInfo(serverResult.barcode, posId, width, height);
result.Param.rfid = rfid;
BoxPosition position = CSVPositionReader<BoxPosition>.GetPositon(posId);
if (position == null)
else if (serverResult.result.Equals(0))
{
result.Param.IsNG = true;
result.Param.NgMsg = "未找到库位[" + position + "]";
result.Msg = "未找到库位: " + result.Param.ToStr() + " ,入库失败";
LogUtil.error( deviceName + ("收到服务器入库命令 " + ",未找到库位: " + result.Param.ToStr() + " ,入库失败!"));
result.Result = serverResult.result;
//result.Msg = deviceName + " 【" + codeStr + "】结果:" + serverResult.msg;
result.Msg = serverResult.msg;
result.Param = new InOutPosInfo(codeStr,serverResult.pos,width,height);
result.Param.Cid = serverResult.cid;
return result;
}
else
else if(serverResult.result.Equals(99).Equals(false)&& serverResult.result.Equals(100).Equals(false))
{
LogUtil.info(deviceName + "收到入库命令: " + result.Param.ToStr() + " ");
result.Result = serverResult.result;
//result.Msg = deviceName + " 【" + codeStr + "】结果:" + serverResult.msg;
result.Msg = serverResult.msg;
result.Param = InOutPosInfo.NewNgPos(codeStr, "", height, width, serverResult.msg);
return result;
}
}
result.Result = serverResult.result;
}
catch (Exception ex)
{
......@@ -565,180 +205,175 @@ namespace OnlineStore.DeviceLibrary
}
return result;
}
public static void SendPosToStoreCheck(string deviceName, InOutParam param)
private static string Addr_getRobotTask = "/service/store/robotBox/getRobotTask";
public static string RobotTaskInfo = "";
/// <summary>
/// 机器人定时获取出库任务
/// </summary>
/// <returns></returns>
public static TaskData GetRobotTask()
{
//if (param == null || param.IsNG)
//{
// return;
//}
//int storeId = param.GetStoreId();
//MoveEquip moveEquip = StoreManager.XLRStore.MoveEquipMap[storeId];
//if (LineServer.BoxCanInStore(moveEquip.DeviceID))
//{
// LineServer.CheckInStorePos(storeId, param);
//}
//else
//{
// //等待3秒后重发验证
// Task.Factory.StartNew(delegate
// {
// LogUtil.error(deviceName + "[" + moveEquip.Name + " ]入库命令: " + param.ToStr() + " 给料仓发送验证失败,等待3秒后重发 ");
// Thread.Sleep(3000);
// LineServer.CheckInStorePos(storeId, param);
// });
//}
//lock (moveEquip.waitInListLock)
//{
// //如果当前正在出入库中,需要记录下来,等待空闲时执行
// LogUtil.info(deviceName + "[" + moveEquip.Name + " ]入库命令: " + param.ToStr() + "加入等待列表中!");
// moveEquip.waitInStoreList.Add(param);
//}
string msg = "";
TaskData serverResult=null;
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
string server = GetAddr(Addr_getRobotTask, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
// 返回: {"code":0,"data":{"type":"2","posId":"004-07-200","plateH":"1","barcode":"RI12313","cid":"4","plateW":"1"},
// "msg":"ok","msgKey":"smfcore.ok","okResult":true,"params":[]}
serverResult = JsonHelper.DeserializeJsonToObject<TaskData>(resultStr);
RobotTaskInfo = $"【{server}】【{resultStr}】";
if (serverResult == null)
{
msg = "GetRobotTask 没有收到服务器反馈";
}
else if (serverResult.code.Equals(0).Equals(false))
{
// code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = "GetRobotTask" + " :" + "[" + serverResult.code + "]" + serverResult.msg;
}
if (!msg.Equals(""))
{
LogUtil.error(msg);
}
}
catch (Exception ex)
{
LogUtil.error("GetRobotTask", ex);
}
return serverResult;
}
private static string Addr_updateLocInfo = "/service/store/robotBox/updateLocInfo";
//14.异常看板
// > 地址:
//>>/ rest / api / qisda / device / updateDeviceAlarmMsg
// >
// > 参数:
//>> deviceAlarmList : 异常列表Json字符串 `[{"name":"移栽5", "msgKey":"line.move5.timeOut", "msgValue":"运动超时"},{"name":"移栽4", "msgKey":"line.move4.timeOut", "msgValue":"误差过大"}]`
//>>>name : 异常位置名称
//>>>msgKey : 异常信息唯一标识
//>>>msgValue : 异常信息
//>
//> 返回:
//>>` {"code":0,"msg":"ok","data":""}`
//>>
//>> - code: 0为正常,其他为异常,
// >> - msg:消息,
// >> - data:
private static string Addr_updateDeviceAlarmMsg = "/rest/api/qisda/device/updateDeviceAlarmMsg";
public static string updateDeviceAlarmMsg(List<AlarmMsg> msgList)
/// <summary>
/// 更新任务状态
/// </summary>
/// <param name="barcode">料盘条码</param>
/// <param name="status">任务状态</param>
/// <param name="locInfo">位置信息</param>
/// <returns></returns>
public static string UpdateTrayLoc( string barcode, string status, string locInfo="")
{
string msg = "";
try
{
if (String.IsNullOrEmpty(barcode))
{
return msg;
}
if (string.IsNullOrEmpty(serverAddr))
{
LogUtil.error("UpdateTrayLoc [" + barcode + "] [" + status + "] :未找到服务器地址");
return msg;
}
Dictionary<string, string> paramMap = new Dictionary<string, string>();
string msgListStr = JsonHelper.SerializeObject(msgList);
paramMap.Add("deviceAlarmList", msgListStr);
string server = GetAddr(Addr_updateDeviceAlarmMsg, paramMap);
paramMap.Add("barcode", barcode);//barcode = 料盘的条码
paramMap.Add("status", status); // status = 状态信息, 移栽 = MOVING, 流水线 = INLINE, 皮带线 = INBELT
paramMap.Add("locInfo", locInfo); // locInfo = 位置信息,移栽时为移栽编号,流水线时为托盘号,皮带线时为皮带线编号,机器人时为机器人编号
string server = GetAddr(Addr_updateLocInfo, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "",5000);
LogUtil.debug("updateDeviceAlarmMsg " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
RfidData data = JsonHelper.DeserializeJsonToObject<RfidData>(resultStr);
if (data == null)
string resultStr = HttpHelper.Post(server, "");
LogUtil.info("UpdateTrayLoc " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
// 返回: { "code": 0, "msg":"ok", "data":""}
ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr);
if (serverResult == null)
{
return msg = " updateDeviceAlarmMsg 没有收到服务器反馈";
msg = "UpdateTrayLoc【 " + barcode + "】【" + status + "】【" + locInfo + "】没有收到服务器反馈";
}
else if (data.code.Equals(0).Equals(false))
else if (serverResult.code.Equals(0).Equals(false))
{
return msg = " updateDeviceAlarmMsg 【" + server + "】【" + resultStr + "】" + data.msg;
// code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = " UpdateTrayLoc【 " + barcode + "】【" + status + "】【" + locInfo + "】 :" + "[" + serverResult.code + "]" + serverResult.msg;
}
if (!msg.Equals(""))
{
LogUtil.error(msg);
}
return "";
}
catch (Exception ex)
{
LogUtil.error(" updateDeviceAlarmMsg Error: " + ex.ToString());
LogUtil.error("UpdateTrayLoc ", ex);
}
return msg;
}
private static string Addr_ShelfFinish = "/rest/api/qisda/device/putShelfFinished";
public static ShelfTaskInfo ShelfFinish(string rfid, string barcode = "", string rfidLoc = "0", string robotIndex = "1")
{
LogUtil.info($"ShelfFinish rifd【{rfid}】barcode【{barcode}】rfidLoc【{rfidLoc}】robotIndex【{robotIndex}】");
//14.异常看板
ShelfTaskInfo task = new ShelfTaskInfo();
task.rfid = rfid;
return task;
// DateTime startTime = DateTime.Now;
// > 地址:
//>>/ rest / api / qisda / device / updateDeviceAlarmMsg
// >
// > 参数:
//>> deviceAlarmList : 异常列表Json字符串 `[{"name":"移栽5", "msgKey":"line.move5.timeOut", "msgValue":"运动超时"},{"name":"移栽4", "msgKey":"line.move4.timeOut", "msgValue":"误差过大"}]`
//>>>name : 异常位置名称
//>>>msgKey : 异常信息唯一标识
//>>>msgValue : 异常信息
//>
//> 返回:
//>>` {"code":0,"msg":"ok","data":""}`
//>>
//>> - code: 0为正常,其他为异常,
// >> - msg:消息,
// >> - data:
//private static string Addr_updateDeviceAlarmMsg = "/rest/api/qisda/device/updateDeviceAlarmMsg";
//public static string updateDeviceAlarmMsg(List<AlarmMsg> msgList)
//{
// string msg = "";
// try
// {
// string api = Addr_ShelfFinish;
// Dictionary<string, string> paramMap = new Dictionary<string, string>();
// paramMap.Add("barcode", barcode);
// paramMap.Add("rfid", rfid);
// paramMap.Add("rfidLoc", rfidLoc);
// paramMap.Add("robotIndex", robotIndex);
// //string url = httpAddr + api + "?barcode=" + barcode + "&rfid=" + rfid + "&rfidLoc=" + rfidLoc + "&robotIndex=" + robotIndex;
// string url = GetAddr(api, paramMap);
// LogUtil.debug("http :URL:" + url);
// string json = HttpHelper.Post(url, "", 10000);
// if (barcode != "")
// {
// LogUtil.info("http :URL:" + url + " :Response:" + json + " 耗时[" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "]");
// }
// else
// if (string.IsNullOrEmpty(serverAddr))
// {
// LogUtil.debug("http :URL:" + url + " :Response:" + json);
// return msg;
// }
// if (string.IsNullOrWhiteSpace(json)) return task;
// //行 2234: [2021 - 04 - 07 15:09:31,412][9]INFO - http :URL:
// //http://192.168.100.14/myproject/rest/api/qisda/device/putShelfFinished?barcode=640253A*34005600000309*QG00006*5000*23C4&rfid=F103&rfidLoc=8&robotIndex=1 :
// //Response:{"code":0,"msg":"ok","data":{"smallTask":"0","cutPackageTask":"0","packageTask":"0","bigTask":"0","smallEmpty":"0","bigEmpty":"5","packageEmpty":"0","rfid":"F103","usedRfidList":"F106,F105,F103","barcode":"640253A*34005600000309*QG00006*5000*23C4","cutTask":"0"}} 耗时[00:00:00.1]
// JavaScriptSerializer serializer = new JavaScriptSerializer();
// Dictionary<string, object> obj = (Dictionary<string, object>)serializer.DeserializeObject(json);
// if (!obj.TryGetValue("code", out object value)) return task;
// if (value.ToString() != "0")
// Dictionary<string, string> paramMap = new Dictionary<string, string>();
// string msgListStr = JsonHelper.SerializeObject(msgList);
// paramMap.Add("deviceAlarmList", msgListStr);
// string server = GetAddr(Addr_updateDeviceAlarmMsg, paramMap);
// DateTime startTime = DateTime.Now;
// string resultStr = HttpHelper.Post(server, "",5000);
// LogUtil.debug("updateDeviceAlarmMsg " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
// RfidData data = JsonHelper.DeserializeJsonToObject<RfidData>(resultStr);
// if (data == null)
// {
// if (obj.TryGetValue("msg", out value))
// LogUtil.error("http" + api + ": " + value.ToString());
// return task;
// return msg = " updateDeviceAlarmMsg 没有收到服务器反馈";
// }
// if (!obj.TryGetValue("data", out value)) return task;
// Dictionary<string, object> dict = (Dictionary<string, object>)value;
// if (dict == null)
// else if (data.code.Equals(0).Equals(false))
// {
// LogUtil.info("http" + api + ": data=null");
// return task;
// return msg = " updateDeviceAlarmMsg 【" + server + "】【" + resultStr + "】" + data.msg;
// }
// if (dict.TryGetValue("bigEmpty", out value))
// int.TryParse(value.ToString(), out task.bigEmpty);
// if (dict.TryGetValue("smallEmpty", out value))
// int.TryParse(value.ToString(), out task.smallEmpty);
// if (dict.TryGetValue("usedRfidList", out value))
// task.usedRfidList = value.ToString();
// return "";
// }
// catch (Exception ex)
// {
// LogUtil.error("http error : " + ex.ToString());
// LogUtil.error(" updateDeviceAlarmMsg Error: " + ex.ToString());
// }
// return task;
}
}
public class ShelfTaskInfo
{
public string rfid = "";
public int bigEmpty = -1;
public int smallEmpty = -1;
//public int packageEmpty = -1;
public string usedRfidList = "";
public bool IsValid()
{
if (bigEmpty != -1 && smallEmpty != -1)
{
return true;
}
return false;
// return msg;
//}
}
public string ToStr()
/// <summary>
/// 任务状态
/// </summary>
public class TaskStatus
{
return " " + rfid + "剩余位置: 小料=" + smallEmpty + ",大料=" + bigEmpty + ",已使用料架=" + usedRfidList + " ";
}
/// <summary>
/// 机器人把料盘拿走之后,更新任务状态为:INROBOT
/// </summary>
public const string INROBOT = "INROBOT";
/// <summary>
/// 机器人把料放入料仓门口后,更新任务状态为:BOXDOOR
/// </summary>
public const string BOXDOOR = "BOXDOOR";
/// <summary>
/// 机器人把出库料盘放到出口后,更新任务状态为:FINISHED
/// </summary>
public const string FINISHED = "FINISHED";
}
public class AlarmMsg
{
......@@ -759,15 +394,21 @@ namespace OnlineStore.DeviceLibrary
}
public class GetPosResult
{
public string Msg = "";
/// <summary>
/// 0=成功,98=此盘为出库盘。99:暂时不能入库,需要重新获取库位。100:服务器需要更新,需要重新获取库位
/// 消息字符串
/// </summary>
public string Msg="";
/// <summary>
/// 0=获取库位成功,98=此盘为出库盘。99:暂时不能入库,需要重新获取库位。
/// 100:服务器需要更新,需要重新获取库位
/// 105:查找空库位失败,NG
/// </summary>
public int Result = 0;
public int Result;
/// <summary>
/// 获取超时,需要重新获取库位
/// </summary>
public bool IsTimeOut = false;
public InOutPosInfo Param = null;
}
public class RfidData
......@@ -779,6 +420,16 @@ namespace OnlineStore.DeviceLibrary
public Dictionary<string, string> data { get; set; }
}
public class TaskData
{
//{"code":0,"data":{"type":"2","posId":"004-07-200","plateH":"1","barcode":"RI12313","cid":"4","plateW":"1"},
//"msg":"ok","msgKey":"smfcore.ok","okResult":true,"params":[]}
public int code { get; set; }
public Dictionary<string, string> data { get; set; }
public string msg { get; set; }
public string msgKey { get; set; }
public bool okResult { get; set; }
}
public class CancelData
{
//{"code":0,"msg":"ok","data":"7"}
......@@ -788,21 +439,7 @@ namespace OnlineStore.DeviceLibrary
public object data { get; set; }
}
public class LocStatus
{
/// <summary>
/// 料盘位置:移栽 = MOVING
/// </summary>
public static string MOVING = "MOVING";
/// <summary>
/// 料盘位置:流水线 = INLINE
/// </summary>
public static string INLINE = "INLINE";
/// <summary>
/// 料盘位置:皮带线 = INBELT
/// </summary>
public static string INBELT = "INBELT";
}
public class ServerData
{
//{"code":0,"msg":"ok","data":"7"}
......@@ -812,48 +449,6 @@ namespace OnlineStore.DeviceLibrary
public string data { get; set; }
}
public class AfterPutData
{
//>>` {"code": 0, "msg":"ok", "data":{"cutPackageTask":"0","urgentPackageTask":"20","cutTask":"21","urgentTask":"22"}} `
//>>
//>> - code: 0为正常,其他为异常,
//>> - msg:消息,
//>> - data:为包装料仓的空闲仓位数(key为与客户端一致的料仓标识, value为空闲仓位)
//>> - cutPackageTask: 表示当前包装仓的分盘任务数
//>> - urgentPackageTask: 表示当前包装仓的紧急料任务数
//>> - cutTask: 表示流水线分盘任务数
//>> - urgentTask: 表示流水线紧急料任务数
public int code { get; set; }
public string msg { get; set; }
public TaskData data { get; set; }
}
public class TaskData
{
/// <summary>
/// urgentPackageTask: 表示当前包装仓的紧急料任务数
/// </summary>
public int urgentPackageTask { get; set; }
/// <summary>
/// cutPackageTask: 表示当前包装仓的分盘任务数
/// </summary>
public int cutPackageTask { get; set; }
/// <summary>
/// cutTask: 表示流水线分盘任务数
/// </summary>
public int cutTask { get; set; }
/// <summary>
/// urgentTask: 表示流水线紧急料任务数
/// </summary>
public int urgentTask { get; set; }
public string ToStr()
{
return "[分盘料=" + cutTask + "][紧急料=" + urgentTask+"]";
}
}
}
......@@ -48,10 +48,6 @@ namespace OnlineStore.DeviceLibrary
}
public InOutPosInfo PosInfo { get; set; }
/// <summary>
/// 料叉已取料的信息
/// </summary>
public InOutPosInfo PosInfoBack { get; set; } = null;
public LineMoveP MoveP { get; set; }
/// <summary>
/// 入料机构从哪个料串取料,或出库放到哪个料串
......@@ -88,10 +84,11 @@ namespace OnlineStore.DeviceLibrary
inOut.CreateTime = DateTime.Now;
return inOut;
}
public string Cid { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; private set; }
public DateTime CreateTime { get; set; }
/// <summary>
/// 物品二维码
/// </summary>
......@@ -134,8 +131,7 @@ namespace OnlineStore.DeviceLibrary
public bool singleOut = false;
public string ToStr()
{
return " [" + barcode + "] [" + PosId + "] [" + PlateW + "x" + PlateH + "],urgentReel [" + urgentReel
+ "],cutReel [" + cutReel + "],smallReel [" + smallReel + "],rfid [" + rfid + "],rfidLoc [" + rfidLoc + "],singleOut[" + singleOut + "]";
return " [" + barcode + "] [" + PosId + "] [" + PlateW + "x" + PlateH + "],[cid="+Cid+"]";
}
public bool IsNG { get; set; } = false;
......@@ -191,11 +187,11 @@ namespace OnlineStore.DeviceLibrary
/// <param name="posId"></param>
public void UpdatePosById(string posId)
{
BoxPosition position = CSVPositionReader<BoxPosition>.GetPositon(posId);
if (position == null)
{
LogUtil.error("GetPositon[" + posId + "] =null,没有库位不能执行出入库");
}
//BoxPosition position = CSVPositionReader<BoxPosition>.GetPositon(posId);
//if (position == null)
//{
// LogUtil.error("GetPositon[" + posId + "] =null,没有库位不能执行出入库");
//}
}
/// <summary>
......
......@@ -154,6 +154,10 @@ namespace OnlineStore.LoadCSVLibrary
/// DO,1,入料线体送料允许,Inlet_AllowFeed,12,HC,Y12,,,,,,,,,,,,
/// </summary>
public static string Inlet_AllowFeed = "Inlet_AllowFeed";
/// <summary>
/// DO,1,入料线体相机光源,Inlet_CamLed,13,HC,Y13,,,,,,,,,,,,
/// </summary>
public static string Inlet_CamLed = "Inlet_CamLed";
}
public enum IO_VALUE
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!