Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -7,11 +7,13 @@ using JNPF.Common.Cache;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.FriendlyException;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NetTaste;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Qiniu.Util;
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Extension;
|
||||
using Tnb.Common.Redis;
|
||||
using Tnb.Common.Utils;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
@@ -19,6 +21,7 @@ using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Entities.Enums;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Configs;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
@@ -34,6 +37,7 @@ namespace Tnb.ProductionMgr
|
||||
private readonly IPrdInstockService _prdInstockService;
|
||||
private readonly ISqlSugarRepository<RedisReadConfig> _repository;
|
||||
private readonly IWmsPDAScanInStockService _wmsPDAScanInStock;
|
||||
private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
|
||||
public RedisBackGround(RedisData redisData, IPrdInstockService prdInstockService, ISqlSugarRepository<RedisReadConfig> repository, IWmsPDAScanInStockService wmsPDAScanInStock)
|
||||
{
|
||||
_redisData = redisData;
|
||||
@@ -121,8 +125,7 @@ namespace Tnb.ProductionMgr
|
||||
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" });
|
||||
getdic.Add("SSX-021-005", new string[] { "YTCS", "AllowFullOut_CS05", "LiftCode" });
|
||||
foreach (var key in getdic.Keys)
|
||||
{
|
||||
try
|
||||
@@ -137,15 +140,18 @@ namespace Tnb.ProductionMgr
|
||||
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();
|
||||
coderesult = coderesult.Replace("\r", "");
|
||||
var DistaskH = _repository.AsSugarClient().Queryable<WmsDistaskH>().Where(p => p.carry_code == coderesult && p.status == WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID).First();
|
||||
if (DistaskH != null)
|
||||
{
|
||||
dynamic reqBody = new ExpandoObject();
|
||||
reqBody.taskCode = DistaskH.bill_code;
|
||||
reqBody.slotCode = key;
|
||||
reqBody.containerCode = coderesult;
|
||||
CancellationTokenSource Ctu = new();
|
||||
dynamic respBody = HttpClientHelper.PostStreamAsync("http://192.168.11.104:1880/wcs/notify/cargo", reqBody, Ctu.Token).Result;
|
||||
Ctu.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -157,27 +163,66 @@ namespace Tnb.ProductionMgr
|
||||
//扫码入库
|
||||
private void ScanInStock(object state)
|
||||
{
|
||||
var carry_code = "TestLX0001";//从数采读取载具
|
||||
WmsCarryH? carry = _repository.AsSugarClient().Queryable<WmsCarryH>().Single(it => it.carry_code == carry_code);
|
||||
if (carry != null)
|
||||
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||
getdic.Add("BGWRKYCL02", new string[] { "CP8", "AllowGetFullBox1", "code1", "PutDoneEmptyBox","false" });
|
||||
foreach (var key in getdic.Keys)
|
||||
{
|
||||
var WmsCarryCode = _repository.AsSugarClient().Queryable<WmsCarryCode>().Single(it => it.carry_id == carry.id);
|
||||
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)
|
||||
{
|
||||
Dictionary<string, string> dicCommand = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["DevName"] = strs[0],
|
||||
["token"] = _eleCtlCfg.token,
|
||||
["TagName"] = strs[3],
|
||||
["Value"] = strs[4],
|
||||
};
|
||||
HttpClientHelper.GetAsync(_eleCtlCfg.WriteTagUrl, new Dictionary<string, string>(), dicCommand).Wait();
|
||||
|
||||
VisualDevModelDataCrInput input = new VisualDevModelDataCrInput();
|
||||
input.data = new Dictionary<string, object>();
|
||||
input.data.Add("barcode", carry_code);
|
||||
input.data.Add("codeqty", WmsCarryCode.codeqty);//条码数量
|
||||
input.data.Add("material_code", WmsCarryCode.material_code);
|
||||
input.data.Add("extras", carry.location_code!);//location_code
|
||||
input.data.Add("warehouse_id", WmsCarryCode.warehouse_id!);
|
||||
input.data.Add("bill_code", "");//采购收货单号
|
||||
input.data.Add("code_batch", WmsCarryCode.code_batch!);//批次
|
||||
input.data.Add("material_specification", WmsCarryCode.material_specification!);//规格型号
|
||||
input.data.Add("container_no", WmsCarryCode.container_no!);//箱号
|
||||
input.data.Add("material_id", WmsCarryCode.material_id);
|
||||
input.data.Add("id", null);
|
||||
_wmsPDAScanInStock.ScanInStockByRedis(input);
|
||||
|
||||
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")! : "";
|
||||
WmsCarryH? carry = _repository.AsSugarClient().Queryable<WmsCarryH>().Single(it => it.carry_code == coderesult);
|
||||
if (carry != null)
|
||||
{
|
||||
if (_repository.AsSugarClient().Queryable<WmsDistaskH>().Where(p => p.carry_id == carry.id && (p.status == WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID || p.status == WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID || p.status == WmsWareHouseConst.TASK_BILL_STATUS_RUNING_ID)).Any())
|
||||
continue;
|
||||
var WmsCarryCode = _repository.AsSugarClient().Queryable<WmsCarryCode>().Single(it => it.carry_id == carry.id);
|
||||
if (WmsCarryCode != null)
|
||||
{
|
||||
VisualDevModelDataCrInput input = new VisualDevModelDataCrInput();
|
||||
input.data = new Dictionary<string, object>();
|
||||
input.data.Add("barcode", coderesult);
|
||||
input.data.Add("codeqty", WmsCarryCode.codeqty);//条码数量
|
||||
input.data.Add("material_code", WmsCarryCode.material_code);
|
||||
input.data.Add("extras", key);//location_code
|
||||
input.data.Add("warehouse_id", "1");//TEST
|
||||
input.data.Add("bill_code", "");//采购收货单号
|
||||
input.data.Add("code_batch", WmsCarryCode.code_batch!);//批次
|
||||
input.data.Add("material_specification", WmsCarryCode.material_specification!);//规格型号
|
||||
input.data.Add("container_no", WmsCarryCode.container_no!);//箱号
|
||||
input.data.Add("material_id", WmsCarryCode.material_id);
|
||||
input.data.Add("id", null);
|
||||
_wmsPDAScanInStock.ScanInStockByRedis(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -186,12 +231,13 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
Readtimer?.Dispose();
|
||||
CheckGettimer?.Dispose();
|
||||
Scantimer?.Dispose();
|
||||
}
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
// Readtimer = new Timer(GetRedisData, null, TimeSpan.Zero, TimeSpan.FromSeconds(300));
|
||||
// CheckGettimer = new Timer(CheckGet, null, TimeSpan.Zero, TimeSpan.FromSeconds(300));
|
||||
// Scantimer = new Timer(ScanInStock, null, TimeSpan.Zero, TimeSpan.FromSeconds(300));
|
||||
CheckGettimer = new Timer(CheckGet, null, TimeSpan.Zero, TimeSpan.FromSeconds(10));
|
||||
Scantimer = new Timer(ScanInStock, null, TimeSpan.Zero, TimeSpan.FromSeconds(20));
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
|
||||
@@ -17,7 +17,7 @@ public partial class WmsEmptyOutstockD : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 行号
|
||||
/// </summary>
|
||||
public int? no { get; set; }
|
||||
public string? no { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属组织ID
|
||||
|
||||
@@ -74,6 +74,7 @@ namespace Tnb.WarehouseMgr.Interfaces
|
||||
/// <param name="ele"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<WmsPointH>> PathAlgorithmsEle(string pStartId, string pEndId, int ele);
|
||||
Task SsxControl(WmsDistaskH disTask, string action);
|
||||
Func<string, int, Task> AddUnExecuteTask { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
_ = await _db.Deleteable(elevatorQueueItem).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
await _wareHouseService.SsxControl(disTask, "LOAD");
|
||||
}
|
||||
else if (input.action == "UNLOAD")
|
||||
{
|
||||
@@ -414,7 +414,7 @@ namespace Tnb.WarehouseMgr
|
||||
};
|
||||
Logger.Information($"taskCompleUpInput json parameter:{JsonConvert.SerializeObject(taskCompleUpInput)}");
|
||||
await _wareHouseService.TaskComplate(taskCompleUpInput);
|
||||
|
||||
await _wareHouseService.SsxControl(disTask, "UNLOAD");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace Tnb.WarehouseMgr
|
||||
private static Dictionary<string, object> locMap = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly RedisData _redisData;
|
||||
|
||||
public Func<string, int, Task> AddUnExecuteTask { get; set; }
|
||||
|
||||
|
||||
@@ -247,11 +248,9 @@ namespace Tnb.WarehouseMgr
|
||||
public async Task CheckPut(CheckPutInput input)
|
||||
{
|
||||
Dictionary<string, string[]> putdic = new Dictionary<string, string[]>();
|
||||
putdic.Add("SSX-021-005", new string[] { "CS05", "ConveyorAllowPutEmptyBox" });
|
||||
putdic.Add("SSX-021-006", new string[] { "CS06", "ConveyorAllowPutEmptyBox" });
|
||||
// Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||
// getdic.Add("SSX-021-005", new string[] { "CS05", "FullBoxAllowGet" });
|
||||
// getdic.Add("SSX-021-006", new string[] { "CS06", "FullBoxAllowGet" });
|
||||
|
||||
putdic.Add("SSX-011-006", new string[] { "YTCS", "AllowEmptyIn_CS06" });
|
||||
|
||||
var strs = new string[] { };
|
||||
|
||||
if (!putdic.ContainsKey(input.targetName))
|
||||
@@ -270,6 +269,63 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException("点位" + input.targetName + "不可放", 500);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断CTU是否可以取货
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task Test()
|
||||
{
|
||||
var a = _db.Queryable<WmsDistaskH>().Where(p => p.id == "31900194166806").First();
|
||||
await SsxControl(a, "UNLOAD");
|
||||
}
|
||||
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" });
|
||||
putdic.Add("SSX-011-006", new string[] { "YTCS", "EmptyIn_CS06Done", "true" });
|
||||
putdic.Add("YCLCKBGW", new string[] { "CP8", "PutDoneEmptyBox", "true" });
|
||||
if (action == "LOAD")//取货
|
||||
{
|
||||
if (getdic.Keys.Contains(disTask.startlocation_code))
|
||||
{
|
||||
var strarr = getdic.Where(p => p.Key == disTask.startlocation_code).First().Value;
|
||||
Dictionary<string, string> dicCommand = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["DevName"] = strarr[0],
|
||||
["token"] = _eleCtlCfg.token,
|
||||
["TagName"] = strarr[1],
|
||||
["Value"] = strarr[2],
|
||||
};
|
||||
Logger.Information($"SsxControlLOAD:{dicCommand}");
|
||||
var str= await HttpClientHelper.GetAsync(_eleCtlCfg.WriteTagUrl, new Dictionary<string, string>(), dicCommand);
|
||||
Logger.Information($"SsxControlLOAD:{str}");
|
||||
}
|
||||
}
|
||||
else if (action == "UNLOAD")//放货
|
||||
{
|
||||
if (putdic.Keys.Contains(disTask.endlocation_code))
|
||||
{
|
||||
var strarr = putdic.Where(p => p.Key == disTask.endlocation_code).First().Value;
|
||||
Dictionary<string, string> dicCommand = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["DevName"] = strarr[0],
|
||||
["token"] = _eleCtlCfg.token,
|
||||
["TagName"] = strarr[1],
|
||||
["Value"] = strarr[2],
|
||||
};
|
||||
Logger.Information($"SsxControlUNLOAD:{dicCommand}");
|
||||
var str = await HttpClientHelper.GetAsync(_eleCtlCfg.WriteTagUrl, new Dictionary<string, string>(), dicCommand);
|
||||
Logger.Information($"SsxControlUNLOAD:{str}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成任务执行
|
||||
/// </summary>
|
||||
@@ -1058,6 +1114,8 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -71,8 +71,13 @@ namespace Tnb.WarehouseMgr
|
||||
carryOutPut.carryMats = await _db.Queryable<WmsCarryMat>().Where(it => it.carry_id == carryId).ToListAsync();
|
||||
return carryOutPut;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public async Task<dynamic> GetCarryInfoByCode([FromRoute] string carrycode)
|
||||
{
|
||||
var carryOutPut = await _db.Queryable<WmsCarryH>().Where(it => it.carry_code == carrycode).FirstAsync();
|
||||
|
||||
return carryOutPut;
|
||||
}
|
||||
/// <summary>
|
||||
/// 更换载具
|
||||
/// </summary>
|
||||
|
||||
@@ -65,19 +65,23 @@ namespace Tnb.WarehouseMgr
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
var Location = await _db.Queryable<BasLocation>().FirstAsync(it => it.location_code == input.data["location_code"].ToString());
|
||||
input.data.Add("warehouse_id", Location.wh_id);
|
||||
input.data.Add("location_id", Location.id);
|
||||
input.data.Add("status", "25065138925589");
|
||||
//入库取终点 //出库起点
|
||||
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 };
|
||||
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||
WmsPointH? sPoint = null;
|
||||
WmsPointH? ePoint = null;
|
||||
if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
|
||||
if (input.data.ContainsKey("location_code"))
|
||||
{
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_code == input.data["location_code"].ToString());
|
||||
}
|
||||
if (endLocations?.Count > 0)
|
||||
{
|
||||
WmsCarryH carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString());
|
||||
WmsCarryH carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.data["carry_code"].ToString());
|
||||
input.data.Add("carry_id", carry.id);
|
||||
BasLocation loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == endLocations[0].id);
|
||||
bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc);
|
||||
if (!isMatch)
|
||||
@@ -93,10 +97,19 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
if (sPoint != null && ePoint != null)
|
||||
{
|
||||
List<WmsPointH> points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
List<WmsPointH> points = new List<WmsPointH>();
|
||||
if (sPoint.area_code != ePoint.area_code)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points.Add(sPoint);
|
||||
points.Add(ePoint);
|
||||
}
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points?.Count > 0)
|
||||
@@ -132,8 +145,8 @@ namespace Tnb.WarehouseMgr
|
||||
preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
|
||||
preTask.create_id = _userManager.UserId;
|
||||
preTask.create_time = DateTime.Now;
|
||||
preTask.source_id = input.data[nameof(WmsKittingInstock.source_id)].ToString();
|
||||
preTask.source_code = input.data[nameof(WmsKittingInstock.source_code)].ToString();
|
||||
preTask.source_id = "";
|
||||
preTask.source_code = "";
|
||||
return preTask;
|
||||
}).ToList();
|
||||
List<WmsCarryCode> carryCodes = new();
|
||||
@@ -211,8 +224,8 @@ namespace Tnb.WarehouseMgr
|
||||
location_id = preTaskUpInput.CarryStartLocationId,
|
||||
location_code = preTaskUpInput.CarryStartLocationCode,
|
||||
carry_status = ((int)EnumCarryStatus.齐套).ToString(),
|
||||
collocation_scheme_id = input.data[nameof(WmsKittingInstock.collocation_scheme_id)].ToString(),
|
||||
collocation_scheme_code = input.data[nameof(WmsKittingInstock.collocation_scheme_code)].ToString()
|
||||
// collocation_scheme_id = input.data[nameof(WmsKittingInstock.collocation_scheme_id)].ToString(),
|
||||
// collocation_scheme_code = input.data[nameof(WmsKittingInstock.collocation_scheme_code)].ToString()
|
||||
},
|
||||
it => new BasLocation { is_lock = 1 });
|
||||
}
|
||||
|
||||
@@ -198,7 +198,8 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return await Task.FromResult(false);
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -98,11 +98,19 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
if (sPoint != null && ePoint != null)
|
||||
{
|
||||
List<WmsPointH>? points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points?.Count <= 2)
|
||||
List<WmsPointH> points = new List<WmsPointH>();
|
||||
if (sPoint.area_code != ePoint.area_code)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points.Add(sPoint);
|
||||
points.Add(ePoint);
|
||||
}
|
||||
|
||||
if (points?.Count > 0)
|
||||
|
||||
@@ -88,16 +88,22 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
if (sPoint != null && ePoint != null)
|
||||
{
|
||||
List<WmsPointH> points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points?.Count > 0)
|
||||
List<WmsPointH> points = new List<WmsPointH>();
|
||||
if (sPoint.area_code != ePoint.area_code)
|
||||
{
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points.Add(sPoint);
|
||||
points.Add(ePoint);
|
||||
}
|
||||
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
{
|
||||
WmsPointH? sPoint = it.FirstOrDefault();
|
||||
WmsPointH? ePoint = it.LastOrDefault();
|
||||
@@ -167,8 +173,6 @@ namespace Tnb.WarehouseMgr
|
||||
//((int)EnumCarryStatus.寄存).ToString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
@@ -60,11 +60,12 @@ namespace Tnb.WarehouseMgr
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSOUTBALEPDA_ID, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
//出库取起点
|
||||
WmsCarryH carry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == input.data[nameof(WmsOutbale.carry_id)].ToString());
|
||||
if (carry == null)
|
||||
{
|
||||
throw new AppFriendlyException("请选择载具", 500);
|
||||
}
|
||||
WmsPointH? sPoint = null;
|
||||
WmsPointH? ePoint = null;
|
||||
if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
|
||||
@@ -75,19 +76,26 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
||||
}
|
||||
|
||||
|
||||
if (sPoint != null && ePoint != null)
|
||||
{
|
||||
List<WmsPointH> points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points?.Count > 0)
|
||||
var points=new List<WmsPointH>();
|
||||
if (sPoint.area_code != ePoint.area_code)
|
||||
{
|
||||
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
points.Add(sPoint);
|
||||
points.Add(ePoint);
|
||||
}
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points?.Count > 0)
|
||||
{
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
{
|
||||
WmsPointH? sPoint = it.FirstOrDefault();
|
||||
@@ -150,7 +158,8 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSOUTBALEPDA_ID, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
@@ -79,14 +79,24 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
if (sPoint != null && ePoint != null)
|
||||
{
|
||||
List<WmsPointH> points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points?.Count > 0)
|
||||
List<WmsPointH> points = new List<WmsPointH>();
|
||||
if (sPoint.area_code != ePoint.area_code)
|
||||
{
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points.Add(sPoint);
|
||||
points.Add(ePoint);
|
||||
}
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points?.Count > 0)
|
||||
{
|
||||
|
||||
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
{
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
"ConnectionStrings": {
|
||||
"ConfigId": "default",
|
||||
"DBType": "PostgreSQL", //MySql;SqlServer;Oracle;PostgreSQL;Dm;Kdbndp;Sqlite;
|
||||
"Host": "localhost",
|
||||
"Host": "192.168.11.109",
|
||||
"Port": "5432",
|
||||
//"DBName": "tianyi_db",
|
||||
//"UserName": "postgres",
|
||||
//"Password": "pass@word123",
|
||||
"DBName": "tianyi_bas",
|
||||
"UserName": "totong",
|
||||
"Password": "IPANyxGSKxIXg0dBM",
|
||||
"DBName": "tianyi",
|
||||
"UserName": "postgres",
|
||||
"Password": "pass@word123",
|
||||
//SqlServer
|
||||
//"DefaultConnection": "server={0},{1};database={2};uid={3};pwd={4};MultipleActiveResultSets=true"
|
||||
//Kdbndp
|
||||
|
||||
@@ -57,12 +57,13 @@ public class Startup : AppStartup
|
||||
services.AddOverideVisualDev();
|
||||
|
||||
//定时任务
|
||||
SnowflakeIdHelper.InitYitIdWorker();
|
||||
|
||||
services.AddHostedService<TimedTaskBackgroundService>();
|
||||
services.AddSingleton<BackgroundService, TimedTaskBackgroundService>(sp => new TimedTaskBackgroundService());
|
||||
//var bgSvc = App.GetRequiredService<BackgroundService>();
|
||||
//bgSvc.StartAsync(CancellationToken.None);
|
||||
//services.AddHostedService<RedisBackGround>();
|
||||
// services.AddHostedService<RedisBackGround>();
|
||||
|
||||
}
|
||||
|
||||
@@ -112,7 +113,6 @@ public class Startup : AppStartup
|
||||
endpoints.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
|
||||
SnowflakeIdHelper.InitYitIdWorker();
|
||||
|
||||
bool isStartTimeJob = App.GetConfig<bool>("IsStartTimeJob");
|
||||
if (isStartTimeJob)
|
||||
|
||||
Reference in New Issue
Block a user