Commit a8152993 LN

放料到料串完成发送putfinish

1 个父辈 201a4cf0
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
......
...@@ -6,6 +6,7 @@ using System.Linq; ...@@ -6,6 +6,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Script.Serialization;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
...@@ -641,6 +642,93 @@ namespace OnlineStore.DeviceLibrary ...@@ -641,6 +642,93 @@ namespace OnlineStore.DeviceLibrary
} }
return msg; return msg;
} }
private static string Addr_ShelfFinish = "/rest/api/qisda/device/putShelfFinished";
public static ShelfTaskInfo ShelfFinish(string rfid, string barcode = "", string rfidLoc = "", string robotIndex = "1")
{
ShelfTaskInfo task = new ShelfTaskInfo();
task.rfid = rfid;
DateTime startTime = DateTime.Now;
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
{
LogUtil.debug("http :URL:" + url + " :Response:" + json);
}
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")
{
if (obj.TryGetValue("msg", out value))
LogUtil.error("http" + api + ": " + value.ToString());
return task;
}
if (!obj.TryGetValue("data", out value)) return task;
Dictionary<string, object> dict = (Dictionary<string, object>)value;
if (dict == null)
{
LogUtil.info("http" + api + ": data=null");
return task;
}
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();
}
catch (Exception ex)
{
LogUtil.error("http 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;
}
public string ToStr()
{
return " " + rfid + "剩余位置: 小料=" + smallEmpty + ",大料=" + bigEmpty + ",已使用料架=" + usedRfidList + " ";
}
} }
public class AlarmMsg public class AlarmMsg
{ {
......
...@@ -138,7 +138,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -138,7 +138,6 @@ namespace OnlineStore.DeviceLibrary
//取新的Io状态 //取新的Io状态
IO_VALUE fuweiValue = IOValue(IO_Type.Reset_BTN); IO_VALUE fuweiValue = IOValue(IO_Type.Reset_BTN);
IO_VALUE lastFuwei = DILastValueMap[IO_Type.Reset_BTN]; IO_VALUE lastFuwei = DILastValueMap[IO_Type.Reset_BTN];
addLastDI(IO_Type.Reset_BTN, fuweiValue);
bool isAutoStart = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun) == 1; bool isAutoStart = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun) == 1;
//收到复位信号后启动 //收到复位信号后启动
...@@ -152,6 +151,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -152,6 +151,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("启动失败,等待下次启动"); LogUtil.error("启动失败,等待下次启动");
} }
} }
addLastDI(IO_Type.Reset_BTN, fuweiValue);
return; return;
} }
} }
......
...@@ -845,14 +845,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -845,14 +845,17 @@ namespace OnlineStore.DeviceLibrary
if (shelf.Equals(1)) if (shelf.Equals(1))
{ {
BatchMove_A.ReelPutOk(); BatchMove_A.ReelPutOk();
SServerManager.ShelfFinish(BatchMove_A.CurrShelf.ShelfRfid,MoveInfo.MoveParam.PosInfo.barcode);
} }
else else
{ {
BatchMove_B.ReelPutOk(); BatchMove_B.ReelPutOk();
SServerManager.ShelfFinish(BatchMove_B.CurrShelf.ShelfRfid, MoveInfo.MoveParam.PosInfo.barcode);
} }
MoveInfo.NextMoveStep(StepEnum.IO32_UpdownToP1); MoveInfo.NextMoveStep(StepEnum.IO32_UpdownToP1);
MoveLog($"出库->料串 {MoveInfo.SLog}: 升降轴到P1(待机点){Config.Updown_P1}"); MoveLog($"出库->料串 {MoveInfo.SLog}: 升降轴到P1(待机点){Config.Updown_P1}");
UpdownAxis.AbsMove(MoveInfo, Config.Updown_P1, Config.Updown_P1_Speed); UpdownAxis.AbsMove(MoveInfo, Config.Updown_P1, Config.Updown_P1_Speed);
} }
else if (MoveInfo.IsStep(StepEnum.IO32_UpdownToP1)) else if (MoveInfo.IsStep(StepEnum.IO32_UpdownToP1))
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!