Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -90,7 +90,7 @@ namespace Tnb.ProductionMgr
|
||||
private StackExRedisHelper _redisData;
|
||||
private readonly IPrdInstockService _prdInstockService;
|
||||
private readonly ISqlSugarRepository<RedisReadConfig> _repository;
|
||||
private readonly ISqlSugarClient db_Scantimer;
|
||||
private ISqlSugarClient db_Scantimer;
|
||||
private readonly ISqlSugarClient db_CheckGettimer;
|
||||
private readonly ISqlSugarClient db_SSXcodetimer;
|
||||
private readonly ISqlSugarClient db_BGWCarrySupplementtimer;
|
||||
@@ -188,23 +188,23 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Logger.LogInformation($@"【定时任务CheckGet】 成功取到{strs[2]}值:{coderesult}");
|
||||
LoggerSSX.LogInformation($@"【定时任务CheckGet】 成功取到{strs[2]}值:{coderesult}");
|
||||
//using (var _db = _repository.AsSugarClient().CopyNew())
|
||||
//{
|
||||
var DistaskH = db_CheckGettimer.Queryable<WmsDistaskH>().Where(p => p.carry_code == coderesult && p.status == WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID && string.IsNullOrEmpty(p.extras)).First();
|
||||
|
||||
if (DistaskH != null)
|
||||
{
|
||||
Logger.LogInformation($@"【定时任务CheckGet】 成功找到载具:{coderesult} 对应的任务执行单{DistaskH.bill_code}");
|
||||
LoggerSSX.LogInformation($@"【定时任务CheckGet】 成功找到载具:{coderesult} 对应的任务执行单{DistaskH.bill_code}");
|
||||
dynamic reqBody = new ExpandoObject();
|
||||
reqBody.taskCode = DistaskH.bill_code;
|
||||
reqBody.slotCode = key;
|
||||
reqBody.containerCode = coderesult;
|
||||
CancellationTokenSource Ctu = new();
|
||||
Logger.LogInformation($"【定时任务CheckGet】 开始发送请求到 http://192.168.11.104:1880/wcs/notify/cargo 载具:{coderesult}");
|
||||
LoggerSSX.LogInformation($"【定时任务CheckGet】 开始发送请求到 http://192.168.11.104:1880/wcs/notify/cargo 载具:{coderesult}");
|
||||
dynamic respBody = HttpClientHelper.PostStreamAsync("http://192.168.11.104:1880/wcs/notify/cargo", reqBody, Ctu.Token).Result;
|
||||
|
||||
Logger.LogInformation($"【定时任务CheckGet】 接收请求 http://192.168.11.104:1880/wcs/notify/cargo 结果 {respBody} ");
|
||||
LoggerSSX.LogInformation($"【定时任务CheckGet】 接收请求 http://192.168.11.104:1880/wcs/notify/cargo 结果 {respBody} ");
|
||||
DistaskH.extras = respBody;
|
||||
db_CheckGettimer.Updateable(DistaskH).ExecuteCommand();
|
||||
Ctu.Dispose();
|
||||
@@ -351,7 +351,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
if (result)
|
||||
{
|
||||
Logger.LogInformation($"【ScanInStock】 八工位 {key} {strs[1]}采集到 {result}");
|
||||
LoggerBGWCarrySupplement.LogInformation($"【ScanInStock】 八工位 {key} {strs[1]}采集到 {result}");
|
||||
|
||||
Dictionary<string, string> dicCommand = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
@@ -360,23 +360,23 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
["TagName"] = strs[3],
|
||||
["Value"] = strs[4],
|
||||
};
|
||||
Logger.LogInformation($"【ScanInStock】 八工位 {key} 发送PutDoneEmptyBox指令 {_eleCtlCfg.WriteTagUrl} {JsonConvert.SerializeObject(dicCommand)}");
|
||||
LoggerBGWCarrySupplement.LogInformation($"【ScanInStock】 八工位 {key} 发送PutDoneEmptyBox指令 {_eleCtlCfg.WriteTagUrl} {JsonConvert.SerializeObject(dicCommand)}");
|
||||
HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand).Wait();
|
||||
|
||||
|
||||
string coderesult = await GetStringTag(strs[0], strs[2]);
|
||||
|
||||
Logger.LogInformation($"【ScanInStock】 八工位 {key} 获取到扫码信息: {coderesult}");
|
||||
LoggerBGWCarrySupplement.LogInformation($"【ScanInStock】 八工位 {key} 获取到扫码信息: {coderesult}");
|
||||
|
||||
//using (var _db = _repository.AsSugarClient().CopyNew())
|
||||
{
|
||||
WmsCarryH? carry = db_Scantimer.Queryable<WmsCarryH>().Single(it => it.carry_code == coderesult);
|
||||
Logger.LogInformation($"【ScanInStock】 八工位 {key} 查找{coderesult}绑定的托盘: {JsonConvert.SerializeObject(carry)}");
|
||||
LoggerBGWCarrySupplement.LogInformation($"【ScanInStock】 八工位 {key} 查找{coderesult}绑定的托盘: {JsonConvert.SerializeObject(carry)}");
|
||||
if (carry != null)
|
||||
{
|
||||
if (db_Scantimer.Queryable<WmsDistaskH>().Where(p => p.carry_id == carry.id && p.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID).Any())
|
||||
if (db_Scantimer.Queryable<WmsDistaskH>().Where(p => p.carry_id == carry.id && p.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID && p.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID).Any())
|
||||
{
|
||||
Logger.LogInformation($"【ScanInStock】 八工位 {key} 托盘 {carry.carry_code} 对应的执行任务状态(status)不是26126860808229(已完成),此时不能执行入库");
|
||||
LoggerBGWCarrySupplement.LogInformation($"【ScanInStock】 八工位 {key} 托盘 {carry.carry_code} 找到了执行任务状态(status)既不是26126860808229(已完成)或26126863175461(已取消)的历史任务,此时不能执行入库");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -385,7 +385,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
if (WmsCarryCode != null)
|
||||
{
|
||||
Logger.LogInformation($"【ScanInStock】 八工位 {key} 查找到托盘{carry.carry_code}在WmsCarryCode中存在");
|
||||
LoggerBGWCarrySupplement.LogInformation($"【ScanInStock】 八工位 {key} 查找到托盘{carry.carry_code}在WmsCarryCode中存在");
|
||||
|
||||
VisualDevModelDataCrInput input = new VisualDevModelDataCrInput();
|
||||
input.data = new Dictionary<string, object>();
|
||||
@@ -404,7 +404,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogInformation($"【ScanInStock】 八工位 {key} 托盘 {carry.carry_code} 未绑定物料条码!");
|
||||
LoggerBGWCarrySupplement.LogInformation($"【ScanInStock】 八工位 {key} 托盘 {carry.carry_code} 未绑定物料条码!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -414,7 +414,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("【ScanInStock】" + ex.Message);
|
||||
Logger.LogInformation($"【ScanInStock】 八工位扫到码发送入库请求发生异常:{ex}");
|
||||
LoggerBGWCarrySupplement.LogInformation($"【ScanInStock】 八工位扫到码发送入库请求发生异常:{ex}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -751,7 +751,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
var DistaskH = db_SSXcodetimer.Queryable<WmsDistaskH>().Where(p => p.carry_code == result && p.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID).OrderByDescending(p => p.create_time).First();
|
||||
if (DistaskH != null)
|
||||
{
|
||||
Logger.LogInformation($"【定时任务SSXcode】DistaskH != null putdic.Keys.Contains(DistaskH.startlocation_code):{putdic.Keys.Contains(DistaskH.startlocation_code)} {result}");
|
||||
LoggerSSX.LogInformation($"【定时任务SSXcode】DistaskH != null putdic.Keys.Contains(DistaskH.startlocation_code):{putdic.Keys.Contains(DistaskH.startlocation_code)} {result}");
|
||||
|
||||
Dictionary<string, string> dicCommand2 = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
@@ -772,7 +772,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogInformation($"【定时任务SSXcode】DistaskH == null ");
|
||||
LoggerSSX.LogInformation($"【定时任务SSXcode】DistaskH == null ");
|
||||
Dictionary<string, string> dicCommand2 = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["DevName"] = key,
|
||||
@@ -796,7 +796,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("【SSXcode】" + ex.Message);
|
||||
Logger.LogInformation($"【定时任务SSXcode】发生异常 {ex}");
|
||||
LoggerSSX.LogInformation($"【定时任务SSXcode】发生异常 {ex}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -861,7 +861,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
if (WmsMaterialTransfers.Count() == 0)
|
||||
{
|
||||
LoggerFloor2UpDownMachine.LogWarning($@"【上升降机】未找到条码{barcode}的输送线为9、10的转库单");
|
||||
LoggerFloor2UpDownMachine.LogWarning($@"【上升降机】未找到条码{barcode}的输送线为9、10的转库单,可能是出入仓库选择有误或者此载具在中储仓发生了错乱");
|
||||
return;
|
||||
}
|
||||
// 转库单
|
||||
@@ -1050,7 +1050,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
db_Floor2timer送空托到上升降区.Queryable<BasLocation>()
|
||||
.InnerJoin<WmsCarryH>((a, b) => a.id == b.location_id)
|
||||
.LeftJoin<WmsCarryD>((a, b, c) => b.id == c.carry_id)
|
||||
.Where((a, b, c) => a.wh_id == "33780009364245" && a.is_use == "1" && a.is_lock == 0 && string.IsNullOrEmpty(c.id)
|
||||
.Where((a, b, c) => a.wh_id == "33780009364245" && a.is_use == "1" && a.is_lock == 0 && a.is_type == "0" && string.IsNullOrEmpty(c.id)
|
||||
&& b.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID).OrderBy(a => a.id).Take(1);
|
||||
|
||||
if (rackStartLocations.Count() == 0)
|
||||
@@ -1174,7 +1174,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
.InnerJoin<WmsCarryH>((a, b) => a.id == b.location_id)
|
||||
.LeftJoin<WmsCarryD>((a, b, c) => b.id == c.carry_id) // 有料箱
|
||||
.LeftJoin<WmsCarryCode>((a, b, c, d) => c.membercarry_id == d.carry_id)
|
||||
.Where((a, b, c, d) => a.wh_id == "33780009364245" && a.is_use == "1" && a.is_lock == 0 && !string.IsNullOrEmpty(c.id)
|
||||
.Where((a, b, c, d) => a.wh_id == "33780009364245" && a.is_use == "1" && a.is_lock == 0 && a.is_type == "0" && !string.IsNullOrEmpty(c.id)
|
||||
&& b.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID).OrderBy((a, b, c, d) => d.id).Select((a, b, c, d) => new // 关联载具物料明细表
|
||||
{
|
||||
basLocation = a,
|
||||
@@ -1200,7 +1200,16 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
if (rackStartLocations.Count() == 0)
|
||||
{
|
||||
//LoggerFloor2RackDelivery.LogWarning($"【送满托到下升降区】 暂存仓中没有可用的满料架 {rackStartLocations.ToSqlString()}");
|
||||
//LoggerFloor2RackDelivery.LogWarning($"【送满托到下升降区】 暂存仓中没有可用的满料架 {db_Floor2timer送满托到下升降区.Queryable<BasLocation>()
|
||||
//.InnerJoin<WmsCarryH>((a, b) => a.id == b.location_id)
|
||||
//.LeftJoin<WmsCarryD>((a, b, c) => b.id == c.carry_id) // 有料箱
|
||||
//.LeftJoin<WmsCarryCode>((a, b, c, d) => c.membercarry_id == d.carry_id)
|
||||
//.Where((a, b, c, d) => a.wh_id == "33780009364245" && a.is_use == "1" && a.is_lock == 0 && a.is_type == "0" && !string.IsNullOrEmpty(c.id)
|
||||
//&& b.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID).OrderBy((a, b, c, d) => d.id).Select((a, b, c, d) => new // 关联载具物料明细表
|
||||
//{
|
||||
// basLocation = a,
|
||||
// WmsCarryCode_id = d.id
|
||||
//}).ToSqlString()}");
|
||||
continue;
|
||||
}
|
||||
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 即将补充料架区{wmsMechanicalArmH.name}");
|
||||
@@ -1317,7 +1326,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
// 找到未占用且未锁定的库位
|
||||
ISugarQueryable<BasLocation> rackEndLocations =
|
||||
db_Floor2timer移走上升降区未生成预任务且满托的料架.Queryable<BasLocation>()
|
||||
.Where(r => r.wh_id == "33780009364245" && r.is_use == "0" && r.is_lock == 0).OrderBy(a => a.id).Take(1);
|
||||
.Where(r => r.wh_id == "33780009364245" && r.is_use == "0" && r.is_lock == 0 && r.is_type == "0").OrderBy(a => a.id).Take(1);
|
||||
|
||||
if (rackEndLocations.Count() == 0)
|
||||
{
|
||||
@@ -1419,7 +1428,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
// 找到未占用且未锁定的库位
|
||||
ISugarQueryable<BasLocation> rackEndLocations =
|
||||
db_Floor2timer移走下升降区未生成预任务且空托的料架.Queryable<BasLocation>()
|
||||
.Where(r => r.wh_id == "33780009364245" && r.is_use == "0" && r.is_lock == 0).OrderBy(a => a.id).Take(1);
|
||||
.Where(r => r.wh_id == "33780009364245" && r.is_use == "0" && r.is_lock == 0 && r.is_type == "0").OrderBy(a => a.id).Take(1);
|
||||
|
||||
if (rackEndLocations.Count() == 0)
|
||||
{
|
||||
@@ -1673,41 +1682,6 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
[LogLevel.Error] = "ERR",
|
||||
};
|
||||
|
||||
protected string _LoggerFileName = "";
|
||||
protected ILogger _Logger;
|
||||
protected ILogger Logger
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/custom{DateTime.Now:yyyyMMdd}.log";
|
||||
if (_LoggerFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
{
|
||||
|
||||
//cfgOpts.DateFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
cfgOpts.MessageFormat = (logMsg) =>
|
||||
{
|
||||
var logLevel = s_logLevelMap[logMsg.LogLevel];
|
||||
var sb = new StringBuilder();
|
||||
_ = sb.Append($"[{logLevel}] ");
|
||||
_ = sb.Append($"{logMsg.LogName} ");
|
||||
_ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ");
|
||||
_ = sb.Append($"#{logMsg.EventId.Id} ");
|
||||
_ = sb.Append(logMsg.Message + " ");
|
||||
_ = sb.Append(logMsg.Exception?.ToString());
|
||||
return sb.ToString();
|
||||
};
|
||||
|
||||
}));
|
||||
_Logger = loggerFactory.CreateLogger(this.GetType());
|
||||
_LoggerFileName = newFileName;
|
||||
}
|
||||
return _Logger;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected string _LoggerBGWFileName = "";
|
||||
protected ILogger _LoggerBGW;
|
||||
protected ILogger LoggerBGW
|
||||
@@ -1715,7 +1689,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customBGW{DateTime.Now:yyyyMMdd}.log";
|
||||
if (_LoggerFileName != newFileName)
|
||||
if (_LoggerBGWFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
{
|
||||
@@ -1736,7 +1710,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
}));
|
||||
_LoggerBGW = loggerFactory.CreateLogger(this.GetType());
|
||||
_LoggerFileName = newFileName;
|
||||
_LoggerBGWFileName = newFileName;
|
||||
}
|
||||
return _LoggerBGW;
|
||||
}
|
||||
@@ -1750,7 +1724,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customSSX{DateTime.Now:yyyyMMdd}.log";
|
||||
if (_LoggerFileName != newFileName)
|
||||
if (_LoggerSSXFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
{
|
||||
@@ -1771,7 +1745,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
}));
|
||||
_LoggerSSX = loggerFactory.CreateLogger(this.GetType());
|
||||
_LoggerFileName = newFileName;
|
||||
_LoggerSSXFileName = newFileName;
|
||||
}
|
||||
return _LoggerSSX;
|
||||
}
|
||||
@@ -1785,7 +1759,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customFloor2UpDownMachine{DateTime.Now:yyyyMMdd}.log";
|
||||
if (_LoggerFileName != newFileName)
|
||||
if (_LoggerFloor2UpDownMachineFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
{
|
||||
@@ -1806,7 +1780,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
}));
|
||||
_LoggerFloor2UpDownMachine = loggerFactory.CreateLogger(this.GetType());
|
||||
_LoggerFileName = newFileName;
|
||||
_LoggerFloor2UpDownMachineFileName = newFileName;
|
||||
}
|
||||
return _LoggerFloor2UpDownMachine;
|
||||
}
|
||||
@@ -1820,7 +1794,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customFloor2RackDelivery{DateTime.Now:yyyyMMdd}.log";
|
||||
if (_LoggerFileName != newFileName)
|
||||
if (_LoggerFloor2RackDeliveryFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
{
|
||||
@@ -1841,7 +1815,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
}));
|
||||
_LoggerFloor2RackDelivery = loggerFactory.CreateLogger(this.GetType());
|
||||
_LoggerFileName = newFileName;
|
||||
_LoggerFloor2RackDeliveryFileName = newFileName;
|
||||
}
|
||||
return _LoggerFloor2RackDelivery;
|
||||
}
|
||||
@@ -1855,7 +1829,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customBGWCarrySupplement{DateTime.Now:yyyyMMdd}.log";
|
||||
if (_LoggerFileName != newFileName)
|
||||
if (_LoggerBGWCarrySupplementFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
{
|
||||
@@ -1876,49 +1850,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
}));
|
||||
_LoggerBGWCarrySupplement = loggerFactory.CreateLogger(this.GetType());
|
||||
_LoggerFileName = newFileName;
|
||||
_LoggerBGWCarrySupplementFileName = newFileName;
|
||||
}
|
||||
return _LoggerBGWCarrySupplement;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected string _LoggerSSX7SupplementtimerFileName = "";
|
||||
protected ILogger _LoggerSSX7Supplementtimer;
|
||||
protected ILogger LoggerSSX7Supplementtimer
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customSSX7Supplementtimer{DateTime.Now:yyyyMMdd}.log";
|
||||
if (_LoggerFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
{
|
||||
|
||||
//cfgOpts.DateFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
cfgOpts.MessageFormat = (logMsg) =>
|
||||
{
|
||||
var logLevel = s_logLevelMap[logMsg.LogLevel];
|
||||
var sb = new StringBuilder();
|
||||
_ = sb.Append($"[{logLevel}] ");
|
||||
_ = sb.Append($"{logMsg.LogName} ");
|
||||
_ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ");
|
||||
_ = sb.Append($"#{logMsg.EventId.Id} ");
|
||||
_ = sb.Append(logMsg.Message + " ");
|
||||
_ = sb.Append(logMsg.Exception?.ToString());
|
||||
return sb.ToString();
|
||||
};
|
||||
|
||||
}));
|
||||
_LoggerSSX7Supplementtimer = loggerFactory.CreateLogger(this.GetType());
|
||||
_LoggerFileName = newFileName;
|
||||
}
|
||||
return _LoggerSSX7Supplementtimer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected string _LoggerYCLGLDPJInstockFileName = "";
|
||||
protected ILogger _LoggerYCLGLDPJInstock;
|
||||
protected ILogger LoggerYCLGLDPJInstock
|
||||
@@ -1926,7 +1863,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customYCLGLDPJInstock{DateTime.Now:yyyyMMdd}.log";
|
||||
if (_LoggerFileName != newFileName)
|
||||
if (_LoggerYCLGLDPJInstockFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
{
|
||||
@@ -1947,7 +1884,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
|
||||
}));
|
||||
_LoggerYCLGLDPJInstock = loggerFactory.CreateLogger(this.GetType());
|
||||
_LoggerFileName = newFileName;
|
||||
_LoggerYCLGLDPJInstockFileName = newFileName;
|
||||
}
|
||||
return _LoggerYCLGLDPJInstock;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
/// </summary>
|
||||
public const string PRETASK_BILL_STATUS_COMPLE_ID = "26126838773285";
|
||||
/// <summary>
|
||||
/// 预任务单据状态-已完成Id
|
||||
/// 预任务单据状态-已取消Id
|
||||
/// </summary>
|
||||
public const string PRETASK_BILL_STATUS_CANCEL_ID = "26126842129701";
|
||||
|
||||
@@ -341,7 +341,11 @@
|
||||
/// <summary>
|
||||
/// 一楼供料三工位库位
|
||||
/// </summary>
|
||||
public const string Floor1GLSGWOutstockStation4 = "30773146852480";
|
||||
public const string Floor1GLSGWOutstockStation4 = "30773146852481";
|
||||
/// <summary>
|
||||
/// 一楼供料三工位库位
|
||||
/// </summary>
|
||||
public const string Floor1GLSGWOutstockStation5 = "34863907485461";
|
||||
/// <summary>
|
||||
/// todo 一楼外协三工位库位
|
||||
/// </summary>
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
{
|
||||
@@ -21,9 +22,13 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
public string biz_type { get; set; }
|
||||
|
||||
public string task_type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源业务单据id
|
||||
/// </summary>
|
||||
public string require_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源业务单据code
|
||||
/// </summary>
|
||||
public string require_code { get; set; }
|
||||
|
||||
public string moduleConsts { get; set; }
|
||||
@@ -43,6 +48,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
/// </summary>
|
||||
public bool isChangeCarryLoc2StartLoc { get; set; } = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -185,5 +185,9 @@ public partial class WmsPretaskH : BaseEntity<string>
|
||||
/// 任务属性
|
||||
/// </summary>
|
||||
public string chain_type { get; set; } = "3";
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string note { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
@@ -32,6 +33,14 @@ namespace Tnb.WarehouseMgr.Interfaces
|
||||
/// <returns></returns>
|
||||
/// <exception cref="AppFriendlyException"></exception>
|
||||
Task<List<WmsCarryH>> OutStockStrategyYCL([FromQuery] OutStockStrategyQuery input);
|
||||
/// <summary>
|
||||
/// 中储仓到二楼出库策略
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="AppFriendlyException"></exception>
|
||||
Task<List<WmsCarryH>> OutStockStrategyZCC2Floor2([FromQuery] OutStockStrategyQuery input);
|
||||
|
||||
/// <summary>
|
||||
/// 出库策略-销售出库下发
|
||||
/// </summary>
|
||||
@@ -72,13 +81,13 @@ namespace Tnb.WarehouseMgr.Interfaces
|
||||
/// </summary>
|
||||
/// <param name="preTasks"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> GenPreTask(List<WmsPretaskH> preTasks, List<WmsPretaskCode> preTaskCodes);
|
||||
Task<bool> GenPreTask(List<WmsPretaskH> preTasks, List<WmsPretaskCode> preTaskCodes, ISqlSugarClient dbConn = null);
|
||||
/// <summary>
|
||||
/// 生成预任务成功后操作
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task GenInStockTaskHandleAfter(GenPreTaskUpInput input, Expression<Func<WmsCarryH, WmsCarryH>> setCarryColumnsExp, Expression<Func<BasLocation, BasLocation>> setLocaionColumbExp);
|
||||
Task GenInStockTaskHandleAfter(GenPreTaskUpInput input, Expression<Func<WmsCarryH, WmsCarryH>> setCarryColumnsExp, Expression<Func<BasLocation, BasLocation>> setLocaionColumbExp, ISqlSugarClient dbConn = null);
|
||||
/// <summary>
|
||||
/// 生成任务执行
|
||||
/// </summary>
|
||||
@@ -132,7 +141,7 @@ namespace Tnb.WarehouseMgr.Interfaces
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> CommonCreatePretask(CommonCreatePretaskInput input);
|
||||
Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> CommonCreatePretask(CommonCreatePretaskInput input, ISqlSugarClient db = null);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
protected IEventPublisher? EventPublisher { set; get; }
|
||||
|
||||
protected string _LoggerFileName = "";
|
||||
protected ILogger _Logger;
|
||||
protected static string _LoggerFileName = "";
|
||||
protected static ILogger _Logger;
|
||||
protected ILogger Logger
|
||||
{
|
||||
get
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Aliyun.OSS;
|
||||
using System.Drawing.Drawing2D;
|
||||
using Aliyun.OSS;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF;
|
||||
using JNPF.Common.Core.Manager;
|
||||
@@ -15,6 +16,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Org.BouncyCastle.Crypto.Agreement;
|
||||
using Senparc.CO2NET.Cache;
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Extension;
|
||||
@@ -148,7 +150,7 @@ namespace Tnb.WarehouseMgr
|
||||
var tags = _eleCtlCfg.tags;
|
||||
await Task.Delay(1000);
|
||||
(int sysStatus, int runStatus, int floorNo, int doorStatus, int agvStatus) = await _elevatorControlService.GetElevatorStatus(devName, tags, CancellationToken.None);
|
||||
Logger.Information($"【LoadConfirm】 电梯当前状态->系统状态:{sysStatus.ToEnum<EnumSysStatus>()},运行状态:{runStatus.ToEnum<EnumRunStatus>()},Agv状态:{agvStatus.ToEnum<EnumAgvStatus>()},当前楼层:{floorNo},电梯占用状态{s_eleUseStatusDic[elevator.device_id]}");
|
||||
Logger.Information($"【LoadConfirm】 电梯当前状态->系统状态:{sysStatus.ToEnum<EnumSysStatus>()},运行状态:{runStatus.ToEnum<EnumRunStatus>()},门状态:{doorStatus},Agv状态:{agvStatus.ToEnum<EnumAgvStatus>()},当前楼层:{floorNo},电梯占用状态{s_eleUseStatusDic[elevator.device_id]}");
|
||||
{
|
||||
var curFloor = await GetRealFloor(elevator.end_floor);
|
||||
/* Logger.Information($"目标楼层:{curFloor},电梯当前楼层:{floorNo}");
|
||||
@@ -162,10 +164,12 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
if (curFloor != floorNo)
|
||||
{
|
||||
Logger.Information($"【LoadConfirm】 电梯还未开门,请重试!curFloor != floorNo");
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "【LoadConfirm】 电梯还未开门,请重试!");
|
||||
}
|
||||
if (doorStatus.ToEnum<EnumDoorStatus>() != EnumDoorStatus.开门到位保持 && runStatus.ToEnum<EnumRunStatus>() == EnumRunStatus.停梯 && floorNo == curFloor) //判断电梯楼层与当前放货在同一楼层在允许放货
|
||||
{
|
||||
Logger.Information($"【LoadConfirm】 发送电梯{devName}前门开门指令");
|
||||
_ = await _elevatorControlService.SendOpenCloseCmd(devName, 3); //发送电梯前门开门指令
|
||||
}
|
||||
//if (doorStatus == (int)EnumDoorStatus.开门到位保持 && s_eleUseStatusDic[elevator.device_id] == (int)EnumElevatorUseStatus.占用)
|
||||
@@ -177,6 +181,7 @@ namespace Tnb.WarehouseMgr
|
||||
if (sysStatus.ToEnum<EnumSysStatus>() == EnumSysStatus.正常状态 && runStatus.ToEnum<EnumRunStatus>() == EnumRunStatus.停梯
|
||||
&& doorStatus == (int)EnumDoorStatus.开门到位保持)
|
||||
{
|
||||
Logger.Information($"【LoadConfirm】 {devName}取货成功");
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
}
|
||||
@@ -329,13 +334,14 @@ namespace Tnb.WarehouseMgr
|
||||
//电梯到达目标楼层后,判断当前电梯门状态是否为开门到位保持状态
|
||||
if (doorStatus != (int)EnumDoorStatus.开门到位保持 && s_eleUseStatusDic[elevator.device_id] == (int)EnumElevatorUseStatus.空闲 && curFloor == floorNo) //判断目标楼层与电梯所在楼层在同一层才可开门放货
|
||||
{
|
||||
Logger.Information($"【UnloadConfirm】 发送电梯{devName}前门开门指令");
|
||||
_ = await _elevatorControlService.SendOpenCloseCmd(devName, 3); //发送电梯前门开门指令
|
||||
}
|
||||
|
||||
if (sysStatus == (int)EnumSysStatus.正常状态 && runStatus == (int)EnumRunStatus.停梯
|
||||
&& doorStatus == (int)EnumDoorStatus.开门到位保持 && s_eleUseStatusDic[elevator.device_id] == (int)EnumElevatorUseStatus.空闲)
|
||||
{
|
||||
Logger.Information($"【UnloadConfirm】 成功 {devName} 变更为占用");
|
||||
Logger.Information($"【UnloadConfirm】 {devName}放货成功 状态变更为占用");
|
||||
await _db.Updateable<WmsElevatorH>().SetColumns(r => r.is_use == (int)EnumElevatorUseStatus.占用).Where(r => r.elevator_id == elevator.device_id).ExecuteCommandAsync();
|
||||
s_eleUseStatusDic[elevator.device_id] = (int)EnumElevatorUseStatus.占用;
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
@@ -389,9 +395,72 @@ namespace Tnb.WarehouseMgr
|
||||
await _wareHouseService.TaskExecute(taskExecuteUpInput);
|
||||
}
|
||||
break;
|
||||
case "CANCELLED": break;
|
||||
case "CANCELLED":
|
||||
{
|
||||
Logger.Information("开始处理WCS上传的取消任务");
|
||||
|
||||
|
||||
|
||||
int row = await _db.Updateable<WmsDistaskH>().SetColumns(r => new WmsDistaskH
|
||||
{
|
||||
agreement = "WCS上传取消(CANCELLED)信号 取消时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
status = WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID
|
||||
}).Where(P => P.bill_code.Contains(input.taskChainCode)).ExecuteCommandAsync();
|
||||
if (row > 0)
|
||||
{
|
||||
List<WmsDistaskH> wmsDistaskHs = _db.Queryable<WmsDistaskH>().Where(P => P.bill_code.Contains(input.taskChainCode)).ToList();
|
||||
List<string> wmsDistaskHCodes = wmsDistaskHs.Select(r => r.pretask_code).ToList();
|
||||
|
||||
foreach (WmsDistaskH wmsDistaskH in wmsDistaskHs)
|
||||
{
|
||||
if (wmsDistaskH.startlocation_code.Contains("DT") || wmsDistaskH.endlocation_code.Contains("DT"))
|
||||
{
|
||||
WmsElevatorUnlockInput wmsElevatorUnlockInput = new ();
|
||||
wmsElevatorUnlockInput.elevator_id = wmsDistaskH.device_id;
|
||||
await WmsElevatorUnlock(wmsElevatorUnlockInput);
|
||||
Logger.Information($"WCS取消任务{wmsDistaskH.bill_code},自动解占用电梯{wmsDistaskH.device_id}");
|
||||
}
|
||||
}
|
||||
|
||||
await _db.Updateable<WmsPretaskH>().SetColumns(r => new WmsPretaskH
|
||||
{
|
||||
note = "WCS上传取消(CANCELLED)信号 取消时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
status = WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID
|
||||
}).Where(P => wmsDistaskHCodes.Contains(P.bill_code)).ExecuteCommandAsync();
|
||||
Logger.Information("成功处理WCS上传的取消任务");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Information("未处理WCS上传的取消任务");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "SUCCEED": break;
|
||||
case "FAILURE": break;
|
||||
case "FAILURE":
|
||||
{
|
||||
Logger.Information("开始处理WCS上传的失败任务");
|
||||
int row = await _db.Updateable<WmsDistaskH>().SetColumns(r => new WmsDistaskH
|
||||
{
|
||||
agreement = "WCS上传失败(FAILURE)信号 失败时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
status = WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID
|
||||
}).Where(P => P.bill_code.Contains(input.taskChainCode)).ExecuteCommandAsync();
|
||||
if (row > 0)
|
||||
{
|
||||
List<string> wmsDistaskHCodes = _db.Queryable<WmsDistaskH>().Where(P => P.bill_code.Contains(input.taskChainCode)).Select(r => r.pretask_code).ToList();
|
||||
|
||||
await _db.Updateable<WmsPretaskH>().SetColumns(r => new WmsPretaskH
|
||||
{
|
||||
note = "WCS上传失败(FAILURE)信号 取消时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
status = WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID
|
||||
}).Where(P => wmsDistaskHCodes.Contains(P.bill_code)).ExecuteCommandAsync();
|
||||
Logger.Information("成功处理WCS上传的失败任务");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Information("未处理WCS上传的失败任务");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "FINISHED":
|
||||
|
||||
break;
|
||||
|
||||
@@ -5,7 +5,9 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.ErpInputs;
|
||||
using Tnb.WarehouseMgr.Entities.Entity;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
@@ -278,5 +280,59 @@ namespace Tnb.WarehouseMgr
|
||||
await db.Insertable(WmsInstockH).ExecuteCommandAsync();
|
||||
await db.Insertable(WmsInstockDs).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 转库单
|
||||
/// </summary>
|
||||
public async Task MaterialTransfer(MaterialTransferInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
WmsMaterialTransfer wmsMaterialTransfer = new WmsMaterialTransfer();
|
||||
string Code = await _billRuleService.GetBillNumber("MaterialTransfer");
|
||||
wmsMaterialTransfer.bill_code = Code;
|
||||
wmsMaterialTransfer.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
||||
wmsMaterialTransfer.bill_date = input.bill_date;
|
||||
wmsMaterialTransfer.warehouse_outstock = input.warehouse_outstock;
|
||||
wmsMaterialTransfer.warehouse_instock = input.warehouse_instock;
|
||||
wmsMaterialTransfer.biller_out = input.biller_out;
|
||||
wmsMaterialTransfer.depart_out = input.depart_out;
|
||||
wmsMaterialTransfer.biller_in = input.biller_in;
|
||||
wmsMaterialTransfer.depart_in = input.depart_in;
|
||||
wmsMaterialTransfer.deliver_date = input.deliver_date;
|
||||
wmsMaterialTransfer.arrival_date = input.arrival_date;
|
||||
wmsMaterialTransfer.create_id = "";
|
||||
wmsMaterialTransfer.create_time = DateTime.Now;
|
||||
wmsMaterialTransfer.org_id = WmsWareHouseConst.AdministratorOrgId;
|
||||
|
||||
await db.Insertable(wmsMaterialTransfer).ExecuteCommandAsync();
|
||||
|
||||
|
||||
List<WmsMaterialTransferD> wmsMaterialTransferDs = new List<WmsMaterialTransferD>();
|
||||
foreach (var detail in input.details)
|
||||
{
|
||||
WmsMaterialTransferD wmsMaterialTransferD = new WmsMaterialTransferD();
|
||||
wmsMaterialTransferD.lineno = detail.lineno;
|
||||
wmsMaterialTransferD.material_code = detail.material_code;
|
||||
wmsMaterialTransferD.material_specification = detail.material_specification;
|
||||
wmsMaterialTransferD.unit_code = detail.unit_code;
|
||||
wmsMaterialTransferD.code_batch = detail.code_batch;
|
||||
wmsMaterialTransferD.station_code = detail.station_code;
|
||||
wmsMaterialTransferD.qty = detail.qty;
|
||||
wmsMaterialTransferD.bill_id = "";
|
||||
wmsMaterialTransferD.material_specification = detail.material_ex;
|
||||
|
||||
var material = await db.Queryable<BasMaterial>().Where(p => p.code == detail.material_code).FirstAsync();
|
||||
if (material != null)
|
||||
{
|
||||
//wmsPurchased.material_id = material.id;
|
||||
//// wmsPurchased.material_name = material.name;
|
||||
//wmsPurchased.unit_id = material.unit_id;
|
||||
}
|
||||
wmsMaterialTransferDs.Add(wmsMaterialTransferD);
|
||||
}
|
||||
|
||||
await db.Insertable(wmsMaterialTransferDs).ExecuteCommandAsync();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
public static SemaphoreSlim s_floor2CreatePretask = new(1);
|
||||
public SemaphoreSlim s_taskCommonCreatePretask = new(1);
|
||||
public SemaphoreSlim s_taskGenPreTask = new(1);
|
||||
|
||||
public Func<string, int, Task> AddUnExecuteTask { get; set; }
|
||||
|
||||
@@ -248,8 +249,8 @@ namespace Tnb.WarehouseMgr
|
||||
/// <returns></returns>
|
||||
public string[] GetFloor1GLSGWOutstockLocation()
|
||||
{
|
||||
return new string[4] { WmsWareHouseConst.Floor1GLSGWOutstockStation1 , WmsWareHouseConst.Floor1GLSGWOutstockStation2
|
||||
, WmsWareHouseConst.Floor1GLSGWOutstockStation3, WmsWareHouseConst.Floor1GLSGWOutstockStation4 };
|
||||
return new string[5] { WmsWareHouseConst.Floor1GLSGWOutstockStation1 , WmsWareHouseConst.Floor1GLSGWOutstockStation2
|
||||
, WmsWareHouseConst.Floor1GLSGWOutstockStation3, WmsWareHouseConst.Floor1GLSGWOutstockStation4, WmsWareHouseConst.Floor1GLSGWOutstockStation5 };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -409,6 +410,51 @@ namespace Tnb.WarehouseMgr
|
||||
return input.Size > 0 ? items.Take(input.Size).ToList() : items;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 1->2出库策略
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="AppFriendlyException"></exception>
|
||||
public async Task<List<WmsCarryH>> OutStockStrategyZCC2Floor2([FromQuery] OutStockStrategyQuery input)
|
||||
{
|
||||
Expressionable<WmsCarryH, WmsCarryCode, BasLocation> whereExprable = Expressionable.Create<WmsCarryH, WmsCarryCode, BasLocation>()
|
||||
.And((a, b, c) => a.is_lock == 0 && c.is_lock == 0)
|
||||
.And((a, b, c) => !string.IsNullOrEmpty(a.location_id))
|
||||
.And((a, b, c) => c.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
.And((a, b, c) => a.out_status == "0")
|
||||
.And((a, b, c) => c.wh_id == input.warehouse_id)
|
||||
.AndIF(!string.IsNullOrEmpty(input.material_id), (a, b, c) => b.material_id == input.material_id)
|
||||
.AndIF(!string.IsNullOrEmpty(input.code_batch), (a, b, c) => b.code_batch == input.code_batch)
|
||||
.AndIF(!string.IsNullOrEmpty(input.material_specification), (a, b, c) => b.material_specification == input.material_specification)
|
||||
.AndIF(!string.IsNullOrEmpty(input.container_no), (a, b, c) => b.container_no == input.container_no)
|
||||
.AndIF(!string.IsNullOrEmpty(input.carrystd_id), (a, b, c) => a.carrystd_id == input.carrystd_id);
|
||||
Expression<Func<WmsCarryH, WmsCarryCode, BasLocation, bool>> carryStatusFilterExp = !input.material_id.IsNullOrWhiteSpace()
|
||||
? (a, b, c) => a.carry_status == ((int)EnumCarryStatus.占用).ToString()
|
||||
: (a, b, c) => a.carry_status == ((int)EnumCarryStatus.空闲).ToString();
|
||||
_ = whereExprable.And(carryStatusFilterExp);
|
||||
Expression<Func<WmsCarryH, WmsCarryCode, BasLocation, bool>> whereExpr = whereExprable.ToExpression();
|
||||
|
||||
SqlSugarClient cyDb = _db.CopyNew();
|
||||
WmsInstockPolicies policy = await cyDb.Queryable<WmsInstockPolicies>().Where(it => it.status == 1).FirstAsync();
|
||||
if (policy == null)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用策略", 500);
|
||||
}
|
||||
|
||||
List<WmsCarryH> items = await cyDb.Queryable<WmsCarryH>().LeftJoin<WmsCarryCode>((a, b) => a.id == b.carry_id)
|
||||
.LeftJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
||||
.Where(whereExpr)
|
||||
//.OrderByIF((a,b,c)=>SqlFunc.IsNullOrEmpty())
|
||||
.OrderBy(policy.policy)
|
||||
|
||||
.Select<WmsCarryH>()
|
||||
.ToListAsync();
|
||||
|
||||
items = items.Distinct().ToList();
|
||||
return input.Size > 0 ? items.Take(input.Size).ToList() : items;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断CTU是否可以放货
|
||||
/// </summary>
|
||||
@@ -733,14 +779,13 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
Logger.Information($"【二楼机械臂Floor2MechanicalComplete】收到到货完成信号 传入参数: {disTask.bill_code} {action}");
|
||||
SqlSugarClient db = _db.CopyNew();
|
||||
|
||||
if (action == "UNLOAD")
|
||||
{
|
||||
// 去料架区放货
|
||||
if (rackAreaPointsUp.Contains(disTask.endlocation_code) || rackAreaPointsDown.Contains(disTask.endlocation_code))
|
||||
{
|
||||
ISugarQueryable<WmsMechanicalArmH> WmsMechanicalArmHs = db.Queryable<WmsMechanicalArmH>().Where(r => r.location_code == disTask.endlocation_code);
|
||||
ISugarQueryable<WmsMechanicalArmH> WmsMechanicalArmHs = _db.Queryable<WmsMechanicalArmH>().Where(r => r.location_code == disTask.endlocation_code);
|
||||
if (WmsMechanicalArmHs.Count() == 0)
|
||||
{
|
||||
Logger.Information($"【二楼机械臂Floor2MechanicalComplete】 任务执行终点{disTask.endpoint_code} 与料架区的点位不匹配");
|
||||
@@ -749,7 +794,7 @@ namespace Tnb.WarehouseMgr
|
||||
WmsMechanicalArmH target = WmsMechanicalArmHs.First();
|
||||
|
||||
// 回写料架和AGV确认
|
||||
await db.Updateable<WmsMechanicalArmH>().SetColumns(r => new WmsMechanicalArmH
|
||||
await _db.Updateable<WmsMechanicalArmH>().SetColumns(r => new WmsMechanicalArmH
|
||||
{
|
||||
agvconfirm = 1,
|
||||
rackid = disTask.carry_id,
|
||||
@@ -760,7 +805,7 @@ namespace Tnb.WarehouseMgr
|
||||
// 下升降机写满托数量和送到信号
|
||||
if (rackAreaPointsDown.Contains(disTask.endlocation_code))
|
||||
{
|
||||
int LXCount = db.Queryable<WmsCarryD>().Where(a => a.carry_id == disTask.carry_id).Count();
|
||||
int LXCount = _db.Queryable<WmsCarryD>().Where(a => a.carry_id == disTask.carry_id).Count();
|
||||
|
||||
bool result = await Floor2UpDownMachinecode_SetTag($"下升降机满托{target.stackingposition}数量", LXCount.ToString());
|
||||
Logger.LogInformation($@"【送满托到下升降区】设定下升降机满托{target.stackingposition}满托数量为 {LXCount} 结果为 {result}");
|
||||
@@ -778,7 +823,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
// 绑定料架
|
||||
await db.Updateable<WmsMechanicalArmH>().SetColumns(r => new WmsMechanicalArmH
|
||||
await _db.Updateable<WmsMechanicalArmH>().SetColumns(r => new WmsMechanicalArmH
|
||||
{
|
||||
mechanicalconfirm = 1,
|
||||
maxnum = LXCount
|
||||
@@ -800,7 +845,7 @@ namespace Tnb.WarehouseMgr
|
||||
else // 去暂存仓放货
|
||||
{
|
||||
// 回写料架料箱绑定表的库位
|
||||
ISugarQueryable<WmsCarryCode> WmsCarryCodes = db.Queryable<WmsCarryCode>()
|
||||
ISugarQueryable<WmsCarryCode> WmsCarryCodes = _db.Queryable<WmsCarryCode>()
|
||||
.InnerJoin<WmsCarryD>((a, b) => b.membercarry_id == a.carry_id)
|
||||
.Where((a, b) => b.carry_id == disTask.carry_id);
|
||||
var WmsCarryCodeList = WmsCarryCodes.ToList();
|
||||
@@ -809,7 +854,7 @@ namespace Tnb.WarehouseMgr
|
||||
r.location_id = disTask.endlocation_id;
|
||||
r.location_code = disTask.endlocation_code;
|
||||
});
|
||||
await db.Updateable(WmsCarryCodeList).ExecuteCommandAsync();
|
||||
await _db.Updateable(WmsCarryCodeList).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -822,7 +867,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
else // 去料架区取货
|
||||
{
|
||||
ISugarQueryable<WmsMechanicalArmH> WmsMechanicalArmHs = db.Queryable<WmsMechanicalArmH>().Where(r => r.location_code == disTask.startlocation_code);
|
||||
ISugarQueryable<WmsMechanicalArmH> WmsMechanicalArmHs = _db.Queryable<WmsMechanicalArmH>().Where(r => r.location_code == disTask.startlocation_code);
|
||||
if (WmsMechanicalArmHs.Count() == 0)
|
||||
{
|
||||
Logger.Information($"【二楼机械臂Floor2MechanicalComplete】 任务执行起点{disTask.endpoint_code} 与料架区的点位不匹配");
|
||||
@@ -843,7 +888,7 @@ namespace Tnb.WarehouseMgr
|
||||
// todo erp工位字段取数位置未确定
|
||||
string targetWorkstation = "003-01-01-01";
|
||||
Logger.LogInformation($@"【上升降机】更新料架 {target.rackcode} 在二楼配送的目标工位 {targetWorkstation}");
|
||||
await db.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
|
||||
{
|
||||
work_station = targetWorkstation
|
||||
}).Where(r => r.id == target.rackid).ExecuteCommandAsync();
|
||||
@@ -859,7 +904,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
// 重置料架区
|
||||
await db.Updateable<WmsMechanicalArmH>().SetColumns(r => new WmsMechanicalArmH
|
||||
await _db.Updateable<WmsMechanicalArmH>().SetColumns(r => new WmsMechanicalArmH
|
||||
{
|
||||
stackingcount = 0,
|
||||
barcodes = "",
|
||||
@@ -1185,7 +1230,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error("【GenTaskExecute】生成预任务执行时出现错误", ex);
|
||||
Logger.Error("【GenTaskExecute】任务执行时出现错误", ex);
|
||||
Logger.Error(ex.StackTrace!);
|
||||
await db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
@@ -1195,7 +1240,7 @@ namespace Tnb.WarehouseMgr
|
||||
_ = s_taskExecuteSemaphore.Release();
|
||||
agvCts.Dispose();
|
||||
sw.Stop();
|
||||
Logger.Error($"【GenTaskExecute】 任务执行耗时{sw.ElapsedMilliseconds}毫秒");
|
||||
Logger.Information($"【GenTaskExecute】 任务执行耗时{sw.ElapsedMilliseconds}毫秒");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1716,12 +1761,14 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
int floor = await GetRealFloor(disTask.end_floor);
|
||||
|
||||
Logger.Information($"目标楼层:{floor}");
|
||||
|
||||
//发送到目标楼的指令
|
||||
dynamic reuslt = await _elevatorControlService.WriteTagAsync(devName, ElevatorConsts.FloorExecute, floor);
|
||||
//电梯任务手动执行任务状态上报
|
||||
(int sysStatus, int runStatus, int floorNo, int doorStatus, int agvStatus) tuple = (-1, -1, -1, -1, -1);
|
||||
tuple = await _elevatorControlService.GetElevatorStatus(devName, tags, CancellationToken.None);
|
||||
Logger.Information($"目标楼层:{floor} 当前楼层:{tuple.floorNo}");
|
||||
|
||||
Logger.Information($"开始呼梯 {devName}到{floor}");
|
||||
//发送到目标楼的指令
|
||||
dynamic reuslt = await _elevatorControlService.WriteTagAsync(devName, ElevatorConsts.FloorExecute, floor);
|
||||
|
||||
do
|
||||
{
|
||||
@@ -1800,10 +1847,18 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
var typeflag = false;
|
||||
var dis = disTasks.Where(p => p.groups == k).First();
|
||||
if (kiva.Contains(dis.startlocation_code) || kiva.Contains(dis.endlocation_code) || floor2.Contains(dis.startlocation_code) || floor2.Contains(dis.endlocation_code))
|
||||
if (kiva.Contains(dis.startlocation_code) || kiva.Contains(dis.endlocation_code)
|
||||
|| floor2.Contains(dis.startlocation_code) || floor2.Contains(dis.endlocation_code))
|
||||
{
|
||||
typeflag = true;
|
||||
}
|
||||
|
||||
// 如果管理区是E(二楼暂存仓和二楼缓存仓) 统一发KIVA
|
||||
if (dis.area_code == "E")
|
||||
{
|
||||
typeflag = true;
|
||||
}
|
||||
|
||||
dynamic reqBody = new ExpandoObject();
|
||||
reqBody.taskChainCode = k;
|
||||
reqBody.type = typeflag ? (int)EnumTaskChainType.KIVA : (int)EnumTaskChainType.AGV;
|
||||
@@ -1907,11 +1962,14 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.Information($"【TaskComplate】 开始执行TaskComplate");
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
//更新任务执行表,单据状态为 完成
|
||||
_ = await _db.Updateable<WmsDistaskH>().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID, act_end_date = DateTime.Now }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
List<WmsDistaskH> disTasks = await _db.Queryable<WmsDistaskH>().InnerJoin<WmsCarryH>((a, b) => a.carry_id == b.id).Where(a => input.disTaskIds.Contains(a.id)).Select((a, b) => new WmsDistaskH { carry_status = b.carry_status }, true).ToListAsync();
|
||||
|
||||
Logger.Information($"【TaskComplate】 disTasks 值 {JsonConvert.SerializeObject(disTasks)}");
|
||||
if (disTasks?.Count > 0)
|
||||
{
|
||||
// 更新预任务申请表,单据状态为 已完成
|
||||
@@ -1933,6 +1991,8 @@ namespace Tnb.WarehouseMgr
|
||||
List<WmsCarryH> carryIts = new();
|
||||
List<WmsCarryCode> carryCodeIts = new();
|
||||
List<BasLocation> locIts = new();
|
||||
|
||||
Logger.Information($"【TaskComplate】 multiList 值 {JsonConvert.SerializeObject(multiList)}");
|
||||
for (int i = 0, cnt = multiList.Count; i < cnt; i++)
|
||||
{
|
||||
WmsCarryH carry = new()
|
||||
@@ -1972,6 +2032,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
_ = await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync();
|
||||
Logger.Information($"【TaskComplate】 更新载具 {JsonConvert.SerializeObject(carryIts)}");
|
||||
//更新条码的库位和仓库信息
|
||||
_ = await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync();
|
||||
//更新库位信息,使用状态为 使用,锁定状态为未锁定
|
||||
@@ -2078,88 +2139,110 @@ namespace Tnb.WarehouseMgr
|
||||
/// <param name="preTasks">预任务集合</param>
|
||||
/// <param name="preTaskCodes">预任务编码集合</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> GenPreTask(List<WmsPretaskH> preTasks, List<WmsPretaskCode> preTaskCodes)
|
||||
public async Task<bool> GenPreTask(List<WmsPretaskH> preTasks, List<WmsPretaskCode> preTaskCodes, ISqlSugarClient dbConn = null)
|
||||
{
|
||||
//如果预任务出现起终库位相同,则删除对应预任务
|
||||
//modifiy by ly on 20230922 将当前预任务操作者设为四场管理员
|
||||
preTasks.ForEach(pt =>
|
||||
try
|
||||
{
|
||||
pt.org_id = WmsWareHouseConst.AdministratorOrgId;
|
||||
pt.create_id = WmsWareHouseConst.AdministratorUserId;
|
||||
});
|
||||
if (preTasks.FindAll(it => it.startlocation_id == it.endlocation_id)?.Count > 0)
|
||||
{
|
||||
_ = preTasks.RemoveAll(it => it.startlocation_id == it.endlocation_id);
|
||||
}
|
||||
List<IGrouping<string, WmsPretaskH>> grpList = preTasks.OrderBy(o => o.bill_code).GroupBy(g => g.carry_id).ToList();
|
||||
if (grpList?.Count > 0)
|
||||
{
|
||||
foreach (IGrouping<string, WmsPretaskH>? grp in grpList)
|
||||
await s_taskGenPreTask.WaitAsync();
|
||||
|
||||
var db = _db;
|
||||
if (dbConn != null)
|
||||
db = dbConn;
|
||||
|
||||
//如果预任务出现起终库位相同,则删除对应预任务
|
||||
//modifiy by ly on 20230922 将当前预任务操作者设为四场管理员
|
||||
preTasks.ForEach(pt =>
|
||||
{
|
||||
WmsPretaskH[] arr = grp.ToArray();
|
||||
if (arr.Length > 1)
|
||||
pt.org_id = WmsWareHouseConst.AdministratorOrgId;
|
||||
pt.create_id = WmsWareHouseConst.AdministratorUserId;
|
||||
});
|
||||
if (preTasks.FindAll(it => it.startlocation_id == it.endlocation_id)?.Count > 0)
|
||||
{
|
||||
_ = preTasks.RemoveAll(it => it.startlocation_id == it.endlocation_id);
|
||||
}
|
||||
List<IGrouping<string, WmsPretaskH>> grpList = preTasks.OrderBy(o => o.bill_code).GroupBy(g => g.carry_id).ToList();
|
||||
if (grpList?.Count > 0)
|
||||
{
|
||||
foreach (IGrouping<string, WmsPretaskH>? grp in grpList)
|
||||
{
|
||||
WmsPretaskH[] subArr = arr[..^1];
|
||||
System.Array.ForEach(subArr, a => a.chain_type = "1");
|
||||
WmsPretaskH[] arr = grp.ToArray();
|
||||
if (arr.Length > 1)
|
||||
{
|
||||
WmsPretaskH[] subArr = arr[..^1];
|
||||
System.Array.ForEach(subArr, a => a.chain_type = "1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int row = await _db.Insertable(preTasks).ExecuteCommandAsync();
|
||||
if (preTaskCodes?.Count > 0)
|
||||
{
|
||||
row = await _db.Insertable(preTaskCodes).ExecuteCommandAsync();
|
||||
}
|
||||
var eleP = preTasks.Find(x => x.area_code.Contains("ELE"));
|
||||
if (eleP != null)
|
||||
{
|
||||
row = await _db.Updateable<WmsElevatorH>().SetColumns(it => it.task_nums == it.task_nums + 1).Where(it => it.area_code == eleP.area_code).ExecuteCommandAsync();
|
||||
}
|
||||
int row = await db.Insertable(preTasks).ExecuteCommandAsync();
|
||||
if (preTaskCodes?.Count > 0)
|
||||
{
|
||||
row = await db.Insertable(preTaskCodes).ExecuteCommandAsync();
|
||||
}
|
||||
var eleP = preTasks.Find(x => x.area_code.Contains("ELE"));
|
||||
if (eleP != null)
|
||||
{
|
||||
row = await db.Updateable<WmsElevatorH>().SetColumns(it => it.task_nums == it.task_nums + 1).Where(it => it.area_code == eleP.area_code).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
// 累加终点库位任务数
|
||||
row = await _db.Updateable<BasLocation>().SetColumns(it => it.task_nums == it.task_nums + 1)
|
||||
.Where(it => preTasks.Select(r => r.endlocation_id).Contains(it.id)).ExecuteCommandAsync();
|
||||
// 累加终点库位任务数
|
||||
row = await db.Updateable<BasLocation>().SetColumns(it => it.task_nums == it.task_nums + 1)
|
||||
.Where(it => preTasks.Select(r => r.endlocation_id).Contains(it.id)).ExecuteCommandAsync();
|
||||
|
||||
return row > 0;
|
||||
return row > 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
s_taskGenPreTask.Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成预任务后续处理
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[NonAction]
|
||||
public async Task GenInStockTaskHandleAfter(GenPreTaskUpInput input, Expression<Func<WmsCarryH, WmsCarryH>> setCarryColumnsExp, Expression<Func<BasLocation, BasLocation>> setLocaionColumbExp)
|
||||
public async Task GenInStockTaskHandleAfter(GenPreTaskUpInput input, Expression<Func<WmsCarryH, WmsCarryH>> setCarryColumnsExp, Expression<Func<BasLocation, BasLocation>> setLocaionColumbExp, ISqlSugarClient dbConn = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
var db = _db;
|
||||
if (dbConn != null)
|
||||
db = dbConn;
|
||||
|
||||
//根据生成的预任务,插入预任务操作记录
|
||||
if (input.PreTaskRecord != null)
|
||||
{
|
||||
_ = await _db.Insertable(input.PreTaskRecord).ExecuteCommandAsync();
|
||||
_ = await db.Insertable(input.PreTaskRecord).ExecuteCommandAsync();
|
||||
}
|
||||
if (input.PreTaskHandleCodes.Count > 0)
|
||||
{
|
||||
_ = await _db.Insertable(input.PreTaskHandleCodes).ExecuteCommandAsync();
|
||||
_ = await db.Insertable(input.PreTaskHandleCodes).ExecuteCommandAsync();
|
||||
}
|
||||
//根据载具ID,更新是否锁定和赋值起始库位
|
||||
if (setCarryColumnsExp != null)
|
||||
{
|
||||
Expression<Func<WmsCarryH, bool>> whereExp = input.CarryIds?.Count > 0 ? it => input.CarryIds.Contains(it.id) : it => it.id == input.CarryId;
|
||||
_ = await _db.Updateable<WmsCarryH>().SetColumns(setCarryColumnsExp).Where(whereExp).ExecuteCommandAsync();
|
||||
_ = await db.Updateable<WmsCarryH>().SetColumns(setCarryColumnsExp).Where(whereExp).ExecuteCommandAsync();
|
||||
}
|
||||
if (input.CarryStartLocationId.IsNullOrWhiteSpace() == false)
|
||||
{
|
||||
_ = await _db.Updateable<BasLocation>().SetColumns(setLocaionColumbExp).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
_ = await db.Updateable<BasLocation>().SetColumns(setLocaionColumbExp).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
}
|
||||
//根据所有库位更新库位的锁定状态为“锁定”
|
||||
if (setLocaionColumbExp != null && input.LocationIds?.Count > 0)
|
||||
{
|
||||
_ = await _db.Updateable<BasLocation>().SetColumns(setLocaionColumbExp).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
_ = await db.Updateable<BasLocation>().SetColumns(setLocaionColumbExp).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
Logger.LogError("【GenInStockTaskHandleAfter】" + ex.Message);
|
||||
Logger.LogError("【GenInStockTaskHandleAfter】" + ex.StackTrace);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@@ -2638,9 +2721,12 @@ namespace Tnb.WarehouseMgr
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> CommonCreatePretask(CommonCreatePretaskInput input)
|
||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> CommonCreatePretask(CommonCreatePretaskInput input, ISqlSugarClient dbConn = null)
|
||||
{
|
||||
//using (var db = _db.CopyNew())
|
||||
var db = _db;
|
||||
if (dbConn != null)
|
||||
db = dbConn;
|
||||
|
||||
{
|
||||
await s_taskCommonCreatePretask.WaitAsync();
|
||||
Logger.LogInformation($"【createPretask】 接收到请求 参数:{JsonConvert.SerializeObject(input)}");
|
||||
@@ -2652,11 +2738,11 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
if (!string.IsNullOrEmpty(input.startlocation_id))
|
||||
{
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.startlocation_id);
|
||||
sPoint = await db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.startlocation_id);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(input.endlocation_id))
|
||||
{
|
||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.endlocation_id);
|
||||
ePoint = await db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.endlocation_id);
|
||||
}
|
||||
|
||||
if (sPoint == null)
|
||||
@@ -2675,7 +2761,7 @@ namespace Tnb.WarehouseMgr
|
||||
points = await PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2701,14 +2787,14 @@ namespace Tnb.WarehouseMgr
|
||||
// 如果指定了carry_id
|
||||
else if (!string.IsNullOrEmpty(input.carry_id))
|
||||
{
|
||||
wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.id == input.carry_id).First();
|
||||
wmsCarryH = db.Queryable<WmsCarryH>().Where(r => r.id == input.carry_id).First();
|
||||
carry_id = wmsCarryH.id;
|
||||
carry_code = wmsCarryH.carry_code;
|
||||
}
|
||||
// carry_code
|
||||
else if (!string.IsNullOrEmpty(input.carry_code))
|
||||
{
|
||||
wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).First();
|
||||
wmsCarryH = db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).First();
|
||||
carry_id = wmsCarryH.id;
|
||||
carry_code = wmsCarryH.carry_code;
|
||||
}
|
||||
@@ -2763,7 +2849,8 @@ namespace Tnb.WarehouseMgr
|
||||
//赋值签收状态
|
||||
|
||||
Logger.LogInformation($"【CommonCreatePretask】 开始执行 GenPreTask {JsonConvert.SerializeObject(preTasks)}");
|
||||
bool result = await GenPreTask(preTasks, null!);
|
||||
|
||||
bool result = await GenPreTask(preTasks, null!, db);
|
||||
Logger.LogInformation($"【CommonCreatePretask】 GenPreTask 结果 {result}");
|
||||
if (result)
|
||||
{
|
||||
@@ -2777,7 +2864,7 @@ namespace Tnb.WarehouseMgr
|
||||
};
|
||||
|
||||
//根据载具移入Id,回更单据状态
|
||||
_ = await _db.Updateable<WmsMoveInstock>().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||
_ = await db.Updateable<WmsMoveInstock>().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||
|
||||
|
||||
Expression<Func<WmsCarryH, WmsCarryH>> wmsCarryHChangeExp = a => new WmsCarryH { is_lock = 1 };
|
||||
@@ -2789,7 +2876,7 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
await GenInStockTaskHandleAfter(preTaskUpInput,
|
||||
wmsCarryHChangeExp,
|
||||
it => new BasLocation { is_lock = 1 });
|
||||
it => new BasLocation { is_lock = 1 }, db);
|
||||
Logger.LogInformation($"【CommonCreatePretask】 成功生成预任务:{preTasks.First().bill_code}");
|
||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.OK, "成功");
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace Tnb.WarehouseMgr
|
||||
WmsCarryCode.id = SnowflakeIdHelper.NextId();
|
||||
WmsCarryCode.carry_id = carry.id;
|
||||
WmsCarryCode.is_out = 0;
|
||||
WmsCarryCode.id = input.create_id;
|
||||
WmsCarryCode.create_id = input.create_id;
|
||||
WmsCarryCode.create_time = DateTime.Now;
|
||||
WmsCarryCodes.Add(WmsCarryCode);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
|
||||
@@ -306,7 +306,7 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 载具绑定物料(MES用)
|
||||
/// 载具绑定物料
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
if (points?.Count > 0)
|
||||
@@ -499,7 +499,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
/* var genPreTask = BuildPreTaskHelper.GenPretaskCurried<WmsCheckstockH>(null, WmsWareHouseConst.BIZTYPE_CARRYMOVEINSTOCK_ID, WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID);
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Tnb.WarehouseMgr
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace Tnb.WarehouseMgr
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -420,7 +420,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace Tnb.WarehouseMgr
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -272,7 +272,28 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException($@"当前实际托盘数量为{input.palletCount} 实际库存数量为{qty},与前台数据不一致,请重新获取库存", HttpStatusCode.InternalServerError);
|
||||
}
|
||||
|
||||
foreach(var wmsCarryH in items)
|
||||
List<BasLocation> endLocations = new List<BasLocation>();
|
||||
// 集中供料区三工位
|
||||
if (wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_JZGL_ID)
|
||||
{
|
||||
// 根据三工位任务数平均分配任务 暂定
|
||||
endLocations = _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1GLSGWOutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0")
|
||||
.OrderBy("is_lock, task_nums, location_code").ToList();
|
||||
}
|
||||
// 中储仓三工位
|
||||
else if (wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
// 根据三工位任务数平均分配任务 暂定
|
||||
endLocations = _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1WXSGWOutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0")
|
||||
.OrderBy("is_lock, task_nums, location_code").ToList();
|
||||
}
|
||||
|
||||
if (endLocations.Count() < input.palletCount)
|
||||
{
|
||||
throw new AppFriendlyException($@"可用的终点库位数量为{endLocations.Count()}个 下发数量为{input.palletCount}个 请检查终点库位的锁定和占用状态", 500);
|
||||
}
|
||||
|
||||
foreach (var wmsCarryH in items)
|
||||
{
|
||||
WmsCarryCode wmsCarryCode = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsCarryH.id).FirstAsync();
|
||||
BasLocation startLocation = await _db.Queryable<BasLocation>().Where(r => r.location_code == wmsCarryH.location_code).FirstAsync();
|
||||
@@ -282,13 +303,18 @@ namespace Tnb.WarehouseMgr
|
||||
if (wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_JZGL_ID)
|
||||
{
|
||||
// 根据三工位任务数平均分配任务 暂定
|
||||
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1GLSGWOutstockLocation().Contains(r.id)).OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1GLSGWOutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
}
|
||||
// 中储仓三工位
|
||||
else if(wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
// 根据三工位任务数平均分配任务 暂定
|
||||
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1WXSGWOutstockLocation().Contains(r.id)).OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1WXSGWOutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
}
|
||||
|
||||
if (endLocation == null)
|
||||
{
|
||||
throw new AppFriendlyException($@"没有可用的终点库位!请检查终点库位的锁定和占用状态", 500);
|
||||
}
|
||||
|
||||
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
|
||||
@@ -299,6 +325,7 @@ namespace Tnb.WarehouseMgr
|
||||
commonCreatePretaskInput.require_id = input.source_id;
|
||||
commonCreatePretaskInput.carry_id = wmsCarryH.id;
|
||||
commonCreatePretaskInput.carry_code = wmsCarryH.carry_code;
|
||||
commonCreatePretaskInput.isExcuteMission = false;
|
||||
|
||||
Entities.Dto.Outputs.Result res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput);
|
||||
|
||||
@@ -317,6 +344,8 @@ namespace Tnb.WarehouseMgr
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
Logger.LogError("【Distribute】" + ex.Message);
|
||||
Logger.LogError("【Distribute】" + ex.StackTrace);
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
finally
|
||||
@@ -334,14 +363,14 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
throw new ArgumentNullException(nameof(input));
|
||||
}
|
||||
WmsCarryCode wmsCarryCode = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == input.carryIds[0]).SingleAsync();
|
||||
if (wmsCarryCode == null)
|
||||
List<WmsCarryCode> wmsCarryCodes = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == input.carryIds[0]).ToListAsync();
|
||||
if (wmsCarryCodes.Count == 0)
|
||||
{
|
||||
Logger.LogWarning($"【ModifyAsync】载具{input.carryIds[0]}没有绑定物料条码");
|
||||
return;
|
||||
}
|
||||
// 更新已转数量
|
||||
bool isOk = await _db.Updateable<WmsMaterialTransferD>().SetColumns(it => new WmsMaterialTransferD { yzqty = it.yzqty + wmsCarryCode.codeqty })
|
||||
bool isOk = await _db.Updateable<WmsMaterialTransferD>().SetColumns(it => new WmsMaterialTransferD { yzqty = it.yzqty + wmsCarryCodes.Sum(r => r.codeqty)})
|
||||
.Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
|
||||
// 如果所有明细已完成 更新主表状态为完成
|
||||
@@ -401,7 +430,7 @@ namespace Tnb.WarehouseMgr
|
||||
material_id = wmsMaterialTransferD.material_id,
|
||||
code_batch = wmsMaterialTransferD.code_batch
|
||||
};
|
||||
List<WmsCarryH>? carrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput);
|
||||
List<WmsCarryH>? carrys = await _wareHouseService.OutStockStrategyZCC2Floor2(OutStockStrategyInput);
|
||||
|
||||
// 需要转库数量
|
||||
decimal? needOut = wmsMaterialTransferD.qty;
|
||||
@@ -412,8 +441,16 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
break;
|
||||
}
|
||||
WmsCarryCode wmsCarryCode = _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsCarryH.id).First();
|
||||
needOut -= wmsCarryCode.codeqty;
|
||||
|
||||
List<WmsCarryCode> wmsCarryCodes = _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsCarryH.id).ToList();
|
||||
|
||||
WmsCarryCode wmsCarryCode = wmsCarryCodes.First();
|
||||
|
||||
// 目前只支持一个料箱只有一个物料
|
||||
foreach (WmsCarryCode _wmsCarryCode in wmsCarryCodes)
|
||||
{
|
||||
needOut -= wmsCarryCode.codeqty;
|
||||
}
|
||||
|
||||
BasLocation endlocation_ssx = await _db.Queryable<BasLocation>().Where(r => new string[2] { "32609229889045", "32609238573589" }.Contains(r.id)).OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
await _db.Updateable<BasLocation>().SetColumns(it => it.task_nums == it.task_nums + 1).Where(it => endlocation_ssx.id == it.id).ExecuteCommandAsync();
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
List<WmsPretaskH> curPreTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
@@ -714,7 +714,7 @@ namespace Tnb.WarehouseMgr
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -243,7 +243,7 @@ namespace Tnb.WarehouseMgr
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace Tnb.WarehouseMgr
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Tnb.WarehouseMgr
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Tnb.WarehouseMgr
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Tnb.WarehouseMgr
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
private const string BizTypeId = "26191496816421";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private ISqlSugarClient _dbScanInStockByRedis;
|
||||
private readonly IDictionaryDataService _dictionaryDataService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IWareHouseService _wareHouseService;
|
||||
@@ -47,6 +48,7 @@ namespace Tnb.WarehouseMgr
|
||||
)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_dbScanInStockByRedis = repository.AsSugarClient();
|
||||
_dictionaryDataService = dictionaryDataService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
@@ -213,7 +215,7 @@ namespace Tnb.WarehouseMgr
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -353,7 +355,7 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.LogInformation($"【ScanInStockByRedis】执行入库 {JsonConvert.SerializeObject(input)}");
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
await _dbScanInStockByRedis.Ado.BeginTranAsync();
|
||||
WmsInstockCode? item = null;
|
||||
BasMaterial? mat = null;
|
||||
WmsCarryH? carry = null;
|
||||
@@ -369,19 +371,19 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException("请输入入库数量", 500);
|
||||
}
|
||||
carryCode = item.barcode;
|
||||
carry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.carry_code == carryCode);
|
||||
carry = await _dbScanInStockByRedis.Queryable<WmsCarryH>().FirstAsync(it => it.carry_code == carryCode);
|
||||
if (carry == null)
|
||||
{
|
||||
throw new AppFriendlyException("载具有误", 500);
|
||||
}
|
||||
|
||||
mat = await _db.Queryable<BasMaterial>().FirstAsync(it => it.code == item.material_code);
|
||||
mat = await _dbScanInStockByRedis.Queryable<BasMaterial>().FirstAsync(it => it.code == item.material_code);
|
||||
if (mat == null)
|
||||
{
|
||||
throw new AppFriendlyException("物料有误", 500);
|
||||
}
|
||||
|
||||
loc = await _db.Queryable<BasLocation>().FirstAsync(it => it.location_code == item.extras);
|
||||
loc = await _dbScanInStockByRedis.Queryable<BasLocation>().FirstAsync(it => it.location_code == item.extras);
|
||||
if (loc == null)
|
||||
{
|
||||
throw new AppFriendlyException("库位有误", 500);
|
||||
@@ -472,13 +474,13 @@ namespace Tnb.WarehouseMgr
|
||||
};
|
||||
}
|
||||
|
||||
_ = await _db.Insertable(instock).ExecuteCommandAsync();
|
||||
_ = await _dbScanInStockByRedis.Insertable(instock).ExecuteCommandAsync();
|
||||
Logger.LogInformation($"【ScanInStockByRedis】插入WmsInstockH {JsonConvert.SerializeObject(instock)}");
|
||||
_ = await _db.Insertable(instockDs).ExecuteCommandAsync();
|
||||
_ = await _dbScanInStockByRedis.Insertable(instockDs).ExecuteCommandAsync();
|
||||
Logger.LogInformation($"【ScanInStockByRedis】插入WmsInstockD {JsonConvert.SerializeObject(instockDs)}");
|
||||
if (instockCode != null)
|
||||
{
|
||||
_ = await _db.Insertable(instockCode).ExecuteCommandAsync();
|
||||
_ = await _dbScanInStockByRedis.Insertable(instockCode).ExecuteCommandAsync();
|
||||
Logger.LogInformation($"【ScanInStockByRedis】插入WmsInstockCode {JsonConvert.SerializeObject(instockCode)}");
|
||||
}
|
||||
|
||||
@@ -488,16 +490,16 @@ namespace Tnb.WarehouseMgr
|
||||
WmsPointH ePoint = new();
|
||||
if (endLocations?.Count > 0)
|
||||
{
|
||||
BasLocation eloc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == endLocations[0].id);
|
||||
BasLocation eloc = await _dbScanInStockByRedis.Queryable<BasLocation>().SingleAsync(it => it.id == endLocations[0].id);
|
||||
bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, eloc);
|
||||
if (!isMatch)
|
||||
{
|
||||
throw new AppFriendlyException("库位与载具规格不匹配", 500);
|
||||
}
|
||||
|
||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == endLocations[0].id);
|
||||
ePoint = await _dbScanInStockByRedis.Queryable<WmsPointH>().FirstAsync(it => it.location_id == endLocations[0].id);
|
||||
}
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == loc.id);
|
||||
sPoint = await _dbScanInStockByRedis.Queryable<WmsPointH>().FirstAsync(it => it.location_id == loc.id);
|
||||
|
||||
Logger.LogInformation($"【ScanInStockByRedis】sPoint:{JsonConvert.SerializeObject(sPoint)} ePoint:{JsonConvert.SerializeObject(ePoint)}");
|
||||
if (sPoint != null && ePoint != null)
|
||||
@@ -509,7 +511,7 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.LogInformation($"【ScanInStockByRedis】 路径点数量为:{points.Count}");
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -615,22 +617,28 @@ namespace Tnb.WarehouseMgr
|
||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||
it => new WmsCarryH { carry_code = instock!.carry_code!, is_lock = 1, carry_status = ((int)EnumCarryStatus.占用).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||
it => new BasLocation { is_lock = 1 });
|
||||
_ = await _db.Updateable<WmsInstockD>().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCode.bill_d_id == it.id).ExecuteCommandAsync();
|
||||
_ = await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == instock!.id).ExecuteCommandAsync();
|
||||
_ = await _dbScanInStockByRedis.Updateable<WmsInstockD>().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCode.bill_d_id == it.id).ExecuteCommandAsync();
|
||||
_ = await _dbScanInStockByRedis.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == instock!.id).ExecuteCommandAsync();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
await _dbScanInStockByRedis.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (AggregateException ex)
|
||||
{
|
||||
Console.WriteLine("【ScanInStockByRedis】 AggregateException" + ex.Message);
|
||||
_dbScanInStockByRedis = _dbScanInStockByRedis.CopyNew();
|
||||
await _dbScanInStockByRedis.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
await _dbScanInStockByRedis.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
_ = InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Tnb.WarehouseMgr
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace Tnb.WarehouseMgr
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
if (points?.Count > 0)
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace Tnb.WarehouseMgr
|
||||
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -301,7 +301,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
List<WmsPretaskH> curPreTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace Tnb.WarehouseMgr
|
||||
List<WmsPointH> points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||
}
|
||||
|
||||
if (points?.Count > 0)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"Cache": {
|
||||
"CacheType": "RedisCache", //MemoryCache
|
||||
"ip": "192.168.11.109",
|
||||
"ip": "127.0.0.1",
|
||||
"port": 6379,
|
||||
"password": "05jWEoJa8v",
|
||||
"RedisConnectionString": "{0}:{1},password={2}, poolsize=500,ssl=false,defaultDatabase=0"
|
||||
},
|
||||
"Redis": {
|
||||
"ip": "192.168.11.109",
|
||||
"ip": "127.0.0.1",
|
||||
"port": 6379,
|
||||
"password": "05jWEoJa8v",
|
||||
"RedisConnectionString": "{0}:{1},password={2}, poolsize=500,ssl=false,defaultDatabase=0"
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"ConnectionStrings": {
|
||||
"ConfigId": "default",
|
||||
"DBType": "PostgreSQL", //MySql;SqlServer;Oracle;PostgreSQL;Dm;Kdbndp;Sqlite;
|
||||
"Host": "192.168.11.109",
|
||||
//"Host": "127.0.0.1",
|
||||
//"Host": "192.168.11.109",
|
||||
"Host": "127.0.0.1",
|
||||
"Port": "5432",
|
||||
//"DBName": "tianyi_db",
|
||||
//"UserName": "postgres",
|
||||
|
||||
Reference in New Issue
Block a user