1
This commit is contained in:
@@ -97,8 +97,16 @@ namespace Tnb.WarehouseMgr
|
||||
var dis = _db.Queryable<WmsDistaskH>().Where(P => P.bill_code == input.taskCode).First();
|
||||
if (dis.area_code == "ZSCJ001")
|
||||
{
|
||||
await _wareHouseService.SsxControl(dis, "LOAD");
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
var flag = await _wareHouseService.Check(dis.startlocation_code, "LOAD");
|
||||
if (flag)
|
||||
{
|
||||
await _wareHouseService.SsxControl(dis, "LOAD");
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "失败");
|
||||
}
|
||||
}
|
||||
/*var whereExp = Expressionable.Create<WmsElevatorH, WmsElevatorD, WmsDistaskH>()
|
||||
.And((a, b, c) => c.bill_code == input.taskCode)
|
||||
@@ -190,8 +198,16 @@ namespace Tnb.WarehouseMgr
|
||||
var dis = _db.Queryable<WmsDistaskH>().Where(P => P.bill_code == input.taskCode).First();
|
||||
if (dis.area_code == "ZSCJ001")
|
||||
{
|
||||
await _wareHouseService.SsxControl(dis, "UNLOAD");
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
var flag = await _wareHouseService.Check(dis.startlocation_code, "UNLOAD");
|
||||
if (flag)
|
||||
{
|
||||
await _wareHouseService.SsxControl(dis, "UNLOAD");
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "失败");
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
@@ -280,7 +296,7 @@ namespace Tnb.WarehouseMgr
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 任务链状态上报
|
||||
/// </summary>
|
||||
|
||||
@@ -5,11 +5,15 @@ using JNPF.FriendlyException;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDev;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.Common.Redis;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
@@ -21,11 +25,13 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
public LocationDefinitionService(ISqlSugarRepository<BasLocation> repository, IUserManager userManager)
|
||||
private readonly RedisData _redisData;
|
||||
public LocationDefinitionService(ISqlSugarRepository<BasLocation> repository, IUserManager userManager, RedisData redisData)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_userManager = userManager;
|
||||
OverideFuncs.ImportDataAsync = DataImport;
|
||||
_redisData=redisData;
|
||||
}
|
||||
|
||||
private async Task<dynamic> DataImport(VisualDevImportDataInput input)
|
||||
@@ -162,5 +168,168 @@ namespace Tnb.WarehouseMgr
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
public async Task<dynamic> GetYCLlocation()
|
||||
{
|
||||
List<List<LocationOutput>> LocationOutputss=new List<List<LocationOutput>>();
|
||||
var list =await _db.Queryable<BasLocation>().Where(p=> p.wh_id == "1" && p.region_id== "26125793924133"&& p.is_type == "0" && p.location_code.Length==9).OrderBy(p=>p.location_code).ToListAsync();
|
||||
var carrys=await _db.Queryable<WmsCarryH>().ToListAsync();
|
||||
var carrycodes=await _db.Queryable<WmsCarryCode>().ToListAsync();
|
||||
var lastdata=string.Empty;
|
||||
List<LocationOutput> LocationOutputs = new List<LocationOutput>();
|
||||
foreach (var data in list)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(lastdata)&& data.location_code.Substring(4,1)!= lastdata.Substring(4, 1))
|
||||
{
|
||||
LocationOutputss.Add(LocationOutputs);
|
||||
LocationOutputs = new List<LocationOutput>();
|
||||
}
|
||||
LocationOutput locationOutput = new LocationOutput();
|
||||
locationOutput.location_code = data.location_code;
|
||||
locationOutput.layers = data.layers;
|
||||
locationOutput.type = 0;
|
||||
if (carrys.Where(p => p.location_id == data.id).Any())
|
||||
{
|
||||
var carry= carrys.Where(p => p.location_id == data.id).First();
|
||||
locationOutput.carry_code = carry.carry_code;
|
||||
locationOutput.type = 1;
|
||||
if (carrycodes.Where(p => p.carry_id == carry.id).Any())
|
||||
{
|
||||
var carrycode = carrycodes.Where(p => p.carry_id == carry.id).First();
|
||||
locationOutput.type = 2;
|
||||
locationOutput.material_code = carrycode.material_code;
|
||||
locationOutput.num = carrycode.codeqty;
|
||||
}
|
||||
}
|
||||
lastdata = data.location_code;
|
||||
LocationOutputs.Add(locationOutput);
|
||||
}
|
||||
return LocationOutputss;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
public async Task<dynamic> GetCTUlocation()
|
||||
{
|
||||
List<List<LocationOutput>> LocationOutputss = new List<List<LocationOutput>>();
|
||||
var list = await _db.Queryable<BasLocation>().Where(p => p.wh_id == "2" && p.region_id == "27010227520021" && p.is_type == "0" && p.location_code.Length == 13).OrderBy(p =>new { p.loc_column, p.location_code } ).ToListAsync();
|
||||
var carrys = await _db.Queryable<WmsCarryH>().ToListAsync();
|
||||
var carrycodes = await _db.Queryable<WmsCarryCode>().ToListAsync();
|
||||
int loc_column = 0;
|
||||
List<LocationOutput> LocationOutputs = new List<LocationOutput>();
|
||||
foreach (var data in list)
|
||||
{
|
||||
if (loc_column!=0&& data.loc_column!=loc_column)
|
||||
{
|
||||
LocationOutputss.Add(LocationOutputs);
|
||||
LocationOutputs = new List<LocationOutput>();
|
||||
}
|
||||
LocationOutput locationOutput = new LocationOutput();
|
||||
locationOutput.location_code = data.location_code;
|
||||
locationOutput.layers = data.layers;
|
||||
locationOutput.type = 0;
|
||||
if (carrys.Where(p => p.location_id == data.id).Any())
|
||||
{
|
||||
var carry = carrys.Where(p => p.location_id == data.id).First();
|
||||
locationOutput.carry_code = carry.carry_code;
|
||||
locationOutput.type = 1;
|
||||
if (carrycodes.Where(p => p.carry_id == carry.id).Any())
|
||||
{
|
||||
var carrycode = carrycodes.Where(p => p.carry_id == carry.id).First();
|
||||
locationOutput.type = 2;
|
||||
locationOutput.material_code = carrycode.material_code;
|
||||
locationOutput.num = carrycode.codeqty;
|
||||
}
|
||||
}
|
||||
loc_column = data.loc_column;
|
||||
LocationOutputs.Add(locationOutput);
|
||||
}
|
||||
return LocationOutputss;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
public async Task<dynamic> GetCPlocation()
|
||||
{
|
||||
List<List<LocationOutput>> LocationOutputss = new List<List<LocationOutput>>();
|
||||
var list = await _db.Queryable<BasLocation>().Where(p => p.wh_id == "26103372441637" && p.region_id == "28598002137877" && p.is_type == "0" && p.location_code.Length == 9).OrderBy(p => p.location_code).ToListAsync();
|
||||
var carrys = await _db.Queryable<WmsCarryH>().ToListAsync();
|
||||
var carrycodes = await _db.Queryable<WmsCarryCode>().ToListAsync();
|
||||
var lastdata = string.Empty;
|
||||
List<LocationOutput> LocationOutputs = new List<LocationOutput>();
|
||||
foreach (var data in list)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(lastdata) && data.location_code.Substring(3, 3) != lastdata.Substring(3, 3))
|
||||
{
|
||||
LocationOutputss.Add(LocationOutputs);
|
||||
LocationOutputs = new List<LocationOutput>();
|
||||
}
|
||||
LocationOutput locationOutput = new LocationOutput();
|
||||
locationOutput.location_code = data.location_code;
|
||||
locationOutput.layers = data.layers;
|
||||
locationOutput.type = 0;
|
||||
if (carrys.Where(p => p.location_id == data.id).Any())
|
||||
{
|
||||
var carry = carrys.Where(p => p.location_id == data.id).First();
|
||||
locationOutput.carry_code = carry.carry_code;
|
||||
locationOutput.type = 1;
|
||||
if (carrycodes.Where(p => p.carry_id == carry.id).Any())
|
||||
{
|
||||
var carrycode = carrycodes.Where(p => p.carry_id == carry.id).First();
|
||||
locationOutput.type = 2;
|
||||
locationOutput.material_code = carrycode.material_code;
|
||||
locationOutput.num = carrycode.codeqty;
|
||||
}
|
||||
}
|
||||
lastdata = data.location_code;
|
||||
LocationOutputs.Add(locationOutput);
|
||||
}
|
||||
return LocationOutputss;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
public async Task<dynamic> GetZSJData()
|
||||
{
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
dic.Add("device_state", "事件");
|
||||
dic.Add("temp1", "前部[゚C]");
|
||||
dic.Add("temp3", "后部1[゚C]");
|
||||
dic.Add("temp5", "落下口[゚C]");
|
||||
dic.Add("zsspeed", "V1[mm/s]");
|
||||
dic.Add("sjspeed", "V2[mm/s]");
|
||||
dic.Add("cxtime", "周期时间[s]");
|
||||
var keys = _redisData.GetAllKeys().Where(p => p.Contains("TYSC-ZSJ")).ToList();
|
||||
List<ZsjOutput> datas = new List<ZsjOutput>();
|
||||
foreach (var key in keys)
|
||||
{
|
||||
var data = datas.Where(p => p.device_code == key.Substring(0, 12)).FirstOrDefault();
|
||||
if (data != null)
|
||||
{
|
||||
foreach (var d in dic)
|
||||
{
|
||||
bool flag = await _redisData.HashExist(key, d.Value);
|
||||
if (flag)
|
||||
data.GetType().GetProperty(d.Key)!.SetValue(data,_redisData.GetHash(key, d.Value).Result);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ZsjOutput zsjOutput = new ZsjOutput();
|
||||
zsjOutput.device_code = key.Substring(0, 12);
|
||||
foreach (var d in dic)
|
||||
{
|
||||
bool flag = await _redisData.HashExist(key, d.Value);
|
||||
if (flag)
|
||||
zsjOutput.GetType().GetProperty(d.Key)!.SetValue(zsjOutput, _redisData.GetHash(key, d.Value).Result);
|
||||
}
|
||||
datas.Add(zsjOutput);
|
||||
}
|
||||
}
|
||||
return datas;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,12 +250,15 @@ namespace Tnb.WarehouseMgr
|
||||
Dictionary<string, string[]> putdic = new Dictionary<string, string[]>();
|
||||
|
||||
putdic.Add("SSX-011-006", new string[] { "YTCS", "AllowEmptyIn_CS06" });
|
||||
putdic.Add("SSX-021-007", new string[] { "东面提升机输送线", "出库输送线7允许入箱" });
|
||||
putdic.Add("SSX-121-009", new string[] { "东面提升机输送线", "上升降机9允许入箱" });
|
||||
putdic.Add("SSX-121-010", new string[] { "东面提升机输送线", "上升降机10允许入箱" });
|
||||
putdic.Add("SSX-021-003", new string[] { "YTCS", "AllowCtuEmptyIn_CS03" });
|
||||
putdic.Add("SSX-021-001", new string[] { "YTCS", "AllowCtuEmptyIn_CS01" });
|
||||
putdic.Add("ZSSSXCTU02", new string[] { "YTCS", "AllowAgvFullIn_CS04", });
|
||||
putdic.Add("ZSSSXCTU01", new string[] { "YTCS", "AllowAgvFullIn_CS02", });
|
||||
var strs = new string[] { };
|
||||
|
||||
|
||||
if (!putdic.ContainsKey(input.targetName))
|
||||
throw new AppFriendlyException("点位" + input.targetName + "不存在", 500);
|
||||
strs = putdic.Where(p => p.Key == input.targetName).First().Value;
|
||||
@@ -277,27 +280,98 @@ namespace Tnb.WarehouseMgr
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
public async Task<bool> Check(string code, string action)
|
||||
{
|
||||
Dictionary<string, string[]> putdic = new Dictionary<string, string[]>();
|
||||
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||
putdic.Add("ZS-C01-1", new string[] { "hxjC", "A2允许入空箱", });
|
||||
getdic.Add("ZS-C01-2", new string[] { "hxjC", "A2允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-C02-1", new string[] { "hxjC", "A3允许入空箱", });
|
||||
getdic.Add("ZS-C02-2", new string[] { "hxjC", "A3允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-C03-1", new string[] { "hxjC", "A4允许入空箱", });
|
||||
getdic.Add("ZS-C03-2", new string[] { "hxjC", "A4允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-C04-1", new string[] { "hxjC", "A5允许入空箱", });
|
||||
getdic.Add("ZS-C04-2", new string[] { "hxjC", "A5允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-C05-1", new string[] { "hxjC", "A6允许入空箱", });
|
||||
getdic.Add("ZS-C05-2", new string[] { "hxjC", "A6允许取满箱" });
|
||||
|
||||
putdic.Add("ZS-C06-1", new string[] { "hxjC", "A7允许入空箱", });
|
||||
getdic.Add("ZS-C06-2", new string[] { "hxjC", "A7允许取满箱" });
|
||||
var strs = new string[] { };
|
||||
if (action == "LOAD")//取货
|
||||
{
|
||||
if (!getdic.ContainsKey(code))
|
||||
return false;
|
||||
strs = getdic.Where(p => p.Key == code).First().Value;
|
||||
|
||||
bool flag = _redisData.HashExist(strs[0], strs[1]).Result;
|
||||
if (!flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
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)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
else if (action == "UNLOAD")//放货
|
||||
{
|
||||
if (!putdic.ContainsKey(code))
|
||||
return false;
|
||||
strs = putdic.Where(p => p.Key == code).First().Value;
|
||||
|
||||
bool flag = _redisData.HashExist(strs[0], strs[1]).Result;
|
||||
if (!flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
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)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public async Task SsxControl(WmsDistaskH disTask, string action)
|
||||
{
|
||||
Dictionary<string, string[]> putdic = new Dictionary<string, string[]>();
|
||||
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||
getdic.Add("SSX-021-005", new string[] { "YTCS", "FullOut_CS05Done", "true" });
|
||||
|
||||
getdic.Add("SSX-111-011", new string[] { "东面提升机输送线", "下升降机11出箱完毕", "true" });
|
||||
getdic.Add("SSX-111-012", new string[] { "东面提升机输送线", "下升降机12出箱完毕", "true" });
|
||||
getdic.Add("ZSSSXCTU02", new string[] { "YTCS", "AgvEmptyOut_CS03Done", "true" });
|
||||
getdic.Add("ZSSSXCTU01", new string[] { "YTCS", "AgvEmptyOut_CS01Done", "true" });
|
||||
getdic.Add("SSX-011-008", new string[] { "东面提升机输送线", "入库输送线8出箱完毕", "true" });
|
||||
getdic.Add("ZS-C01-2", new string[] { "hxjC", "A2AGV允许入满箱", "true" });
|
||||
getdic.Add("ZS-C02-2", new string[] { "hxjC", "A3AGV允许入满箱", "true" });
|
||||
getdic.Add("ZS-C03-2", new string[] { "hxjC", "A4AGV允许入满箱", "true" });
|
||||
getdic.Add("ZS-C04-2", new string[] { "hxjC", "A5AGV允许入满箱", "true" });
|
||||
getdic.Add("ZS-C05-2", new string[] { "hxjC", "A6AGV允许入满箱", "true" });
|
||||
getdic.Add("ZS-C06-2", new string[] { "hxjC", "A7AGV允许入满箱", "true" });
|
||||
|
||||
putdic.Add("SSX-021-007", new string[] { "东面提升机输送线", "出库输送线7入箱完毕", "true" });
|
||||
putdic.Add("SSX-011-006", new string[] { "YTCS", "EmptyIn_CS06Done", "true" });
|
||||
putdic.Add("SSX-021-003", new string[] { "YTCS", "AgvFullIn_CS03Done", "true" });
|
||||
putdic.Add("SSX-021-001", new string[] { "YTCS", "CtuEmptyIn_CS01Done", "true" });
|
||||
|
||||
putdic.Add("ZSSSXCTU02", new string[] { "YTCS", "AgvFullIn_CS04Done", "true" });
|
||||
putdic.Add("ZSSSXCTU01", new string[] { "YTCS", "AgvFullIn_CS02Done", "true" });
|
||||
putdic.Add("SSX-121-009", new string[] { "东面提升机输送线", "上升降机9入箱完毕", "true" });
|
||||
putdic.Add("SSX-121-010", new string[] { "东面提升机输送线", "上升降机10入箱完毕", "true" });
|
||||
putdic.Add("YCLCKBGW", new string[] { "CP8", "PutDoneEmptyBox", "true" });
|
||||
putdic.Add("ZS-C01-1", new string[] { "hxjC", "A2AGV允许出空箱", "true" });
|
||||
putdic.Add("ZS-C02-1", new string[] { "hxjC", "A3AGV允许出空箱", "true" });
|
||||
putdic.Add("ZS-C03-1", new string[] { "hxjC", "A4AGV允许出空箱", "true" });
|
||||
putdic.Add("ZS-C04-1", new string[] { "hxjC", "A5AGV允许出空箱", "true" });
|
||||
putdic.Add("ZS-C05-1", new string[] { "hxjC", "A6AGV允许出空箱", "true" });
|
||||
putdic.Add("ZS-C06-1", new string[] { "hxjC", "A7AGV允许出空箱", "true" });
|
||||
if (action == "LOAD")//取货
|
||||
{
|
||||
if (getdic.Keys.Contains(disTask.startlocation_code))
|
||||
|
||||
Reference in New Issue
Block a user