This commit is contained in:
qianjiawei
2023-11-06 17:52:20 +08:00
parent 904135fdec
commit 55eba2d422
3 changed files with 100 additions and 31 deletions

View 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
}
}

View File

@@ -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