Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -1,14 +1,24 @@
|
|||||||
using Aop.Api.Domain;
|
using System;
|
||||||
|
using System.Dynamic;
|
||||||
|
using System.Security.Policy;
|
||||||
|
using Aop.Api.Domain;
|
||||||
|
using JNPF;
|
||||||
using JNPF.Common.Cache;
|
using JNPF.Common.Cache;
|
||||||
|
using JNPF.FriendlyException;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using NetTaste;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Qiniu.Util;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.Common.Redis;
|
using Tnb.Common.Redis;
|
||||||
|
using Tnb.Common.Utils;
|
||||||
using Tnb.ProductionMgr.Entities;
|
using Tnb.ProductionMgr.Entities;
|
||||||
using Tnb.ProductionMgr.Entities.Dto;
|
using Tnb.ProductionMgr.Entities.Dto;
|
||||||
using Tnb.ProductionMgr.Entities.Enums;
|
using Tnb.ProductionMgr.Entities.Enums;
|
||||||
using Tnb.ProductionMgr.Interfaces;
|
using Tnb.ProductionMgr.Interfaces;
|
||||||
|
using Tnb.WarehouseMgr.Entities;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
|
|
||||||
namespace Tnb.ProductionMgr
|
namespace Tnb.ProductionMgr
|
||||||
{
|
{
|
||||||
@@ -16,6 +26,7 @@ namespace Tnb.ProductionMgr
|
|||||||
public class RedisBackGround : IHostedService, IDisposable
|
public class RedisBackGround : IHostedService, IDisposable
|
||||||
{
|
{
|
||||||
private Timer? Readtimer;
|
private Timer? Readtimer;
|
||||||
|
private Timer? CheckGettimer;
|
||||||
private readonly RedisData _redisData;
|
private readonly RedisData _redisData;
|
||||||
private readonly IPrdInstockService _prdInstockService;
|
private readonly IPrdInstockService _prdInstockService;
|
||||||
private readonly ISqlSugarRepository<RedisReadConfig> _repository;
|
private readonly ISqlSugarRepository<RedisReadConfig> _repository;
|
||||||
@@ -101,7 +112,45 @@ namespace Tnb.ProductionMgr
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//获取注塑装箱状态
|
//ctu取货
|
||||||
|
private void CheckGet(object state)
|
||||||
|
{
|
||||||
|
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||||
|
getdic.Add("SSX-021-005", new string[] { "CS05", "FullBoxAllowGet", "Code" });
|
||||||
|
getdic.Add("SSX-021-006", new string[] { "CS06", "FullBoxAllowGet", "Code" });
|
||||||
|
foreach (var key in getdic.Keys)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var strs = getdic.Where(p => p.Key == key).First().Value;
|
||||||
|
bool flag = _redisData.HashExist(strs[0], strs[1]).Result;
|
||||||
|
string data = _redisData.GetHash(strs[0], strs[1]).Result;
|
||||||
|
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
|
||||||
|
bool result = res != null && res["Value"] != null ? res.Value<bool>("Value") : false;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
string codedata = _redisData.GetHash(strs[0], strs[2]).Result;
|
||||||
|
JObject? coderes = JsonConvert.DeserializeObject<JObject>(codedata);
|
||||||
|
string coderesult = coderes != null && coderes["Value"] != null ? coderes.Value<string>("Value")! : "";
|
||||||
|
var DistaskH= _repository.AsSugarClient().Queryable<WmsDistaskH>().Where(p => p.carry_code == coderesult && p.status == WmsWareHouseConst.TASK_BILL_STATUS_RUNING_ID).First();
|
||||||
|
dynamic reqBody = new ExpandoObject();
|
||||||
|
reqBody.taskCode = DistaskH.bill_code;
|
||||||
|
reqBody.slotCode = key;
|
||||||
|
reqBody.containerCode = coderesult;
|
||||||
|
CancellationTokenSource Ctu = new();
|
||||||
|
//{"code":500,"msg":"成功!"}
|
||||||
|
dynamic respBody = HttpClientHelper.PostStreamAsync("http://192.168.11.104:1880/wcs/notify/cargo", reqBody, Ctu.Token).Result;
|
||||||
|
Ctu.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取注塑装箱状态
|
||||||
private void GetZSPackStatus(object state)
|
private void GetZSPackStatus(object state)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -217,10 +266,12 @@ namespace Tnb.ProductionMgr
|
|||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Readtimer?.Dispose();
|
Readtimer?.Dispose();
|
||||||
|
CheckGettimer?.Dispose();
|
||||||
}
|
}
|
||||||
public Task StartAsync(CancellationToken cancellationToken)
|
public Task StartAsync(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Readtimer = new Timer(GetRedisData, null, TimeSpan.Zero, TimeSpan.FromSeconds(300));
|
// Readtimer = new Timer(GetRedisData, null, TimeSpan.Zero, TimeSpan.FromSeconds(300));
|
||||||
|
CheckGettimer = new Timer(CheckGet, null, TimeSpan.Zero, TimeSpan.FromSeconds(300));
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
public Task StopAsync(CancellationToken cancellationToken)
|
public Task StopAsync(CancellationToken cancellationToken)
|
||||||
|
|||||||
@@ -9,12 +9,26 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
|||||||
{
|
{
|
||||||
public class CheckPutInput
|
public class CheckPutInput
|
||||||
{
|
{
|
||||||
public string point_code { get; set; }
|
/// <summary>
|
||||||
public int type { get; set; }
|
/// 任务链编号
|
||||||
}
|
/// </summary>
|
||||||
public enum exectype
|
public string taskChainCode { get; set; }
|
||||||
{
|
/// <summary>
|
||||||
放 = 0,
|
/// 子任务编号
|
||||||
取 = 1
|
/// </summary>
|
||||||
|
public string taskCode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 起点编号
|
||||||
|
/// </summary>
|
||||||
|
public string sourceName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 终点编号
|
||||||
|
/// </summary>
|
||||||
|
public string targetName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 料箱code
|
||||||
|
/// </summary>
|
||||||
|
public string containerCode { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using JNPF.Common.Security;
|
|||||||
using JNPF.FriendlyException;
|
using JNPF.FriendlyException;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
using Microsoft.CodeAnalysis;
|
using Microsoft.CodeAnalysis;
|
||||||
@@ -241,37 +242,31 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
[AllowAnonymous]
|
||||||
public async Task CheckPut(CheckPutInput input)
|
public async Task CheckPut(CheckPutInput input)
|
||||||
{
|
{
|
||||||
Dictionary<string, string[]> putdic = new Dictionary<string, string[]>();
|
Dictionary<string, string[]> putdic = new Dictionary<string, string[]>();
|
||||||
putdic.Add("SSX-021-005", new string[] { "CS05", "ConveyorAllowPutEmptyBox" });
|
putdic.Add("SSX-021-005", new string[] { "CS05", "ConveyorAllowPutEmptyBox" });
|
||||||
putdic.Add("SSX-021-006", new string[] { "CS06", "ConveyorAllowPutEmptyBox" });
|
putdic.Add("SSX-021-006", new string[] { "CS06", "ConveyorAllowPutEmptyBox" });
|
||||||
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
// Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||||
getdic.Add("SSX-021-005", new string[] { "CS05", "FullBoxAllowGet" });
|
// getdic.Add("SSX-021-005", new string[] { "CS05", "FullBoxAllowGet" });
|
||||||
getdic.Add("SSX-021-006", new string[] { "CS06", "FullBoxAllowGet" });
|
// getdic.Add("SSX-021-006", new string[] { "CS06", "FullBoxAllowGet" });
|
||||||
var strs = new string[] { };
|
var strs = new string[] { };
|
||||||
if (input.type == (int)exectype.放)
|
|
||||||
{
|
if (!putdic.ContainsKey(input.targetName))
|
||||||
if (!putdic.ContainsKey(input.point_code))
|
throw new AppFriendlyException("点位" + input.targetName + "不存在", 500);
|
||||||
throw new AppFriendlyException("点位" + input.point_code + "不存在", 500);
|
strs = putdic.Where(p => p.Key == input.targetName).First().Value;
|
||||||
strs = putdic.Where(p => p.Key == input.point_code).First().Value;
|
|
||||||
}
|
|
||||||
else if (input.type == (int)exectype.取)
|
|
||||||
{
|
|
||||||
if (!getdic.ContainsKey(input.point_code))
|
|
||||||
throw new AppFriendlyException("点位" + input.point_code + "不存在", 500);
|
|
||||||
strs = getdic.Where(p => p.Key == input.point_code).First().Value;
|
|
||||||
}
|
|
||||||
bool flag = await _redisData.HashExist(strs[0], strs[1]);
|
bool flag = await _redisData.HashExist(strs[0], strs[1]);
|
||||||
if (!flag)
|
if (!flag)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("点位" + input.point_code + "不存在", 500);
|
throw new AppFriendlyException("点位" + input.targetName + "不存在", 500);
|
||||||
}
|
}
|
||||||
string data = await _redisData.GetHash(strs[0], strs[1]);
|
string data = await _redisData.GetHash(strs[0], strs[1]);
|
||||||
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
|
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
|
||||||
bool result = res != null && res["Value"] != null ? res.Value<bool>("Value") : false;
|
bool result = res != null && res["Value"] != null ? res.Value<bool>("Value") : false;
|
||||||
if (!result)
|
if (!result)
|
||||||
throw new AppFriendlyException("点位" + input.point_code + "不可放", 500);
|
throw new AppFriendlyException("点位" + input.targetName + "不可放", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user