Commit 7390aa08 张东亮

入料机构放完料上报

1 个父辈 2b367d0c
......@@ -735,74 +735,69 @@ namespace OnlineStore.DeviceLibrary
}
return msg;
}
static string Addr_UploadLocInfo = "/service/store/updateLocInfo";
/// <summary>
/// A 出库更新任务状态 -OK
/// </summary>
/// <param name="barcode">料盘条码</param>
/// <param name="status"></param>
/// <returns></returns>
public static bool UpdateLocInfo(string barcode, string status, string loc = "")
{
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);
string server = GetAddr(Addr_UploadLocInfo, map);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Get(server);
ServerData1 serverResult = JsonHelper.DeserializeJsonToObject<ServerData1>(resultStr);
if (serverResult == null)
{
msg = $"UpdateLocInfo【{barcode}】【{status}】" + "没有收到服务器反馈";
}
else if (serverResult.code.Equals(0).Equals(false))
{
// code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = $"UpdateLocInfo 【{barcode}】【{status}】【{JsonHelper.SerializeObject(serverResult)}】";
LogUtil.error(msg);
return false;
}
else
{
msg = $"UpdateLocInfo 【{barcode}】【{status}】【{JsonHelper.SerializeObject(serverResult)}】";
LogUtil.info(msg);
return true;
}
}
catch (Exception ex)
{
LogUtil.error("UpdateLocInfo", ex);
}
return false;
}
private static string Addr_ShelfFinish = "/rest/api/qisda/device/putShelfFinished";
public static ShelfTaskInfo ShelfFinish(string rfid, string barcode = "", string rfidLoc = "0", string robotIndex = "1")
{
UpdateLocInfo(barcode, "END", rfid);
LogUtil.info($"ShelfFinish rifd【{rfid}】barcode【{barcode}】rfidLoc【{rfidLoc}】robotIndex【{robotIndex}】");
ShelfTaskInfo task = new ShelfTaskInfo();
task.rfid = rfid;
return task;
// 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;
// }
return null;
}
}
public class ServerData1
{
public int code { get; set; }
// 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);
public string msg { get; set; }
// if (dict.TryGetValue("usedRfidList", out value))
// task.usedRfidList = value.ToString();
// }
// catch (Exception ex)
// {
// LogUtil.error("http error : " + ex.ToString());
// }
// return task;
}
public Dictionary<string,string> data { get; set; }
}
public class ShelfTaskInfo
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!