REDIS
This commit is contained in:
17
ProductionMgr/Tnb.ProductionMgr.Entities/Enums/Eagvmode.cs
Normal file
17
ProductionMgr/Tnb.ProductionMgr.Entities/Enums/Eagvmode.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entities.Enums
|
||||
{
|
||||
public enum Eagvmode
|
||||
{
|
||||
无请求=0,
|
||||
空框请求=1,
|
||||
满框请求=2,
|
||||
空满框请求=3,
|
||||
收到请求=4
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ using Newtonsoft.Json;
|
||||
using UAParser;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
using JNPF.ClayObject.Extensions;
|
||||
using Tnb.ProductionMgr.Entities.Enums;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
@@ -25,37 +27,84 @@ namespace Tnb.ProductionMgr
|
||||
_redisCache = redisCache;
|
||||
_prdInstockService = prdInstockService;
|
||||
}
|
||||
//获取装箱状态
|
||||
private void GetPackStatus(object state)
|
||||
//获取注塑装箱状态
|
||||
private void GetZSPackStatus(object state)
|
||||
{
|
||||
Console.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
Console.WriteLine($"获取装箱状态");
|
||||
/*
|
||||
var data = _redisCache.GetHash("TY4C-JICHU", "weight_4").Result;
|
||||
var res = JsonConvert.DeserializeObject<JObject>(data);
|
||||
if (res != null && res["Value"] != null)
|
||||
// Console.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
// Console.WriteLine($"获取注塑装箱状态");
|
||||
string[] strs = new string[1] { "TY4C-ZHUSU1" };
|
||||
string sign = "agvMode";
|
||||
foreach (string s in strs)
|
||||
{
|
||||
InstockInput instockInput = new InstockInput();
|
||||
instockInput.equip_code = res["Value"]!.ToString();
|
||||
_prdInstockService.InstockTypeOne(instockInput);
|
||||
Console.WriteLine(decimal.Parse(res["Value"]!.ToString()));
|
||||
}*/
|
||||
var dic = _redisCache.HGetAll(s).Result;
|
||||
foreach (var kv in dic)
|
||||
{
|
||||
if (!kv.Key.Contains(sign))
|
||||
continue;
|
||||
var res = JsonConvert.DeserializeObject<JObject>(kv.Value);
|
||||
if (res != null && res["Value"] != null)
|
||||
{
|
||||
if (int.Parse(res["Value"]!.ToString()) != (int)Eagvmode.无请求 || int.Parse(res["Value"]!.ToString()) != (int)Eagvmode.收到请求)
|
||||
{
|
||||
InstockInput instockInput = new InstockInput();
|
||||
instockInput.equip_code = res["TagName"]!.ToString();
|
||||
_prdInstockService.InstockTypeOne(instockInput);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//获取挤出装箱状态
|
||||
private void GetJCPackStatus(object state)
|
||||
{
|
||||
// Console.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
// Console.WriteLine($"获取挤出装箱状态");
|
||||
string[] strs = new string[1] { "TY4C-SHUSONG-JC" };
|
||||
string sign = "AGVFullCall";
|
||||
foreach (string s in strs)
|
||||
{
|
||||
var dic = _redisCache.HGetAll(s).Result;
|
||||
foreach (var kv in dic)
|
||||
{
|
||||
if (!kv.Key.Contains(sign))
|
||||
continue;
|
||||
var res = JsonConvert.DeserializeObject<JObject>(kv.Value);
|
||||
if (res != null && res["Value"] != null)
|
||||
{
|
||||
if (res.Value<bool>("Value"))
|
||||
{
|
||||
InstockInput instockInput = new InstockInput();
|
||||
instockInput.equip_code = res["TagName"]!.ToString();
|
||||
_prdInstockService.InstockTypeOne(instockInput);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//获取限位状态
|
||||
private void GetLimitStatus(object state)
|
||||
{
|
||||
Console.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
Console.WriteLine($"获取限位状态");
|
||||
/*
|
||||
var data = _redisCache.GetHash("TY4C-JICHU", "weight_4").Result;
|
||||
var res = JsonConvert.DeserializeObject<JObject>(data);
|
||||
if (res != null && res["Value"] != null)
|
||||
// Console.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
// Console.WriteLine($"获取限位状态");
|
||||
string[] strs = new string[1] { "TY4C-WAIBAO" };
|
||||
string sign = "AGVCall";
|
||||
foreach (string s in strs)
|
||||
{
|
||||
InstockInput instockInput = new InstockInput();
|
||||
instockInput.equip_code = res["Value"]!.ToString();
|
||||
_prdInstockService.InstockTypeOne(instockInput);
|
||||
Console.WriteLine(decimal.Parse(res["Value"]!.ToString()));
|
||||
}*/
|
||||
var dic = _redisCache.HGetAll(s).Result;
|
||||
foreach (var kv in dic)
|
||||
{
|
||||
if (!kv.Key.Contains(sign))
|
||||
continue;
|
||||
var res = JsonConvert.DeserializeObject<JObject>(kv.Value);
|
||||
if (res != null && res["Value"] != null)
|
||||
{
|
||||
if (res.Value<bool>("Value"))
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user