Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2024-07-05 15:17:25 +08:00
4 changed files with 129 additions and 50 deletions

View File

@@ -432,7 +432,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
catch (Exception ex)
{
Console.WriteLine("【ScanInStock】" + ex.Message);
LoggerBGWCarrySupplement.LogInformation($"【ScanInStock】 八工位扫到码发送入库请求发生异常:{ex}");
LoggerBGWCarrySupplement.LogError($"【ScanInStock】 八工位扫到码发送入库请求发生异常:{ex}");
}
finally
{
@@ -547,11 +547,19 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
await db_BGWCarrySupplementtimer.Ado.CommitTranAsync();
}
catch (ObjectDisposedException ex)
{
LoggerBGWCarrySupplement.LogError($"【BGWCarrySupplementtimer】 数据库连接异常:{ex.Message}");
LoggerBGWCarrySupplement.LogError($"【BGWCarrySupplementtimer】 数据库连接异常:{ex.StackTrace}");
if (ex.Source == "Npgsql")
db_BGWCarrySupplementtimer = _repository.AsSugarClient().CopyNew();
}
catch (Exception ex)
{
Console.WriteLine("【BGWCarrySupplement】" + ex.Message);
LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】 八工位空托盘补充发生异常:{ex}");
await db_BGWCarrySupplementtimer.Ado.RollbackTranAsync();
LoggerBGWCarrySupplement.LogError($"【BGWCarrySupplementtimer】 数据库连接异常:{ex}");
// 数据库连接断开时会报错
try { await db_BGWCarrySupplementtimer.Ado.RollbackTranAsync(); } catch { };
}
finally
{
@@ -637,11 +645,19 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
await db_YCLGLDPJInstocktimer.Ado.CommitTranAsync();
}
catch (ObjectDisposedException ex)
{
LoggerYCLGLDPJInstock.LogError($"【YCLGLDPJInstock】 数据库连接异常:{ex.Message}");
LoggerYCLGLDPJInstock.LogError($"【YCLGLDPJInstock】 数据库连接异常:{ex.StackTrace}");
if (ex.Source == "Npgsql")
db_YCLGLDPJInstocktimer = _repository.AsSugarClient().CopyNew();
}
catch (Exception ex)
{
Console.WriteLine("【YCLGLDPJInstock】" + ex.Message);
LoggerYCLGLDPJInstock.LogInformation($"【YCLGLDPJInstock】 三工位叠盘机空托入库发生异常:{ex}");
await db_YCLGLDPJInstocktimer.Ado.RollbackTranAsync();
LoggerYCLGLDPJInstock.LogError($"【YCLGLDPJInstock】 数据库连接异常:{ex}");
// 数据库连接断开时会报错
try { await db_YCLGLDPJInstocktimer.Ado.RollbackTranAsync(); } catch { };
}
finally
{
@@ -724,10 +740,19 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
await db_YCLWXDPJInstocktimer.Ado.CommitTranAsync();
}
catch (ObjectDisposedException ex)
{
LoggerYCLGLDPJInstock.LogError($"【YCLWXDPJInstock】 数据库连接异常:{ex.Message}");
LoggerYCLGLDPJInstock.LogError($"【YCLWXDPJInstock】 数据库连接异常:{ex.StackTrace}");
if (ex.Source == "Npgsql")
db_YCLWXDPJInstocktimer = _repository.AsSugarClient().CopyNew();
}
catch (Exception ex)
{
LoggerYCLGLDPJInstock.LogInformation($"【YCLWXDPJInstock】 外协叠盘机空托入库发生异常:{ex}");
await db_YCLWXDPJInstocktimer.Ado.RollbackTranAsync();
Console.WriteLine("【YCLGLDPJInstock】" + ex.Message);
LoggerYCLGLDPJInstock.LogError($"【YCLWXDPJInstock】 数据库连接异常:{ex}");
// 数据库连接断开时会报错
try { await db_YCLWXDPJInstocktimer.Ado.RollbackTranAsync(); } catch { };
}
finally
{
@@ -1005,25 +1030,25 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
await db_Floor2UpMachinecodetimer.Ado.CommitTranAsync();
}
}
catch (ObjectDisposedException ex)
{
LoggerFloor2UpDownMachine.LogError($"【上升降机】 数据库连接异常:{ex.Message}");
LoggerFloor2UpDownMachine.LogError($"【上升降机】 数据库连接异常:{ex.StackTrace}");
if (ex.Source == "Npgsql")
db_Floor2UpMachinecodetimer = _repository.AsSugarClient().CopyNew();
}
catch (Exception ex)
{
// 测试代码 无问题后期删
if (ex.Message.Contains("Exception while reading from stream"))
{
LoggerFloor2UpDownMachine.LogError("【测试】重置连接");
db_Floor2UpMachinecodetimer.Close();
db_Floor2UpMachinecodetimer = _repository.CopyNew();
}
LoggerFloor2UpDownMachine.LogError(ex.ToString());
LoggerFloor2UpDownMachine.LogError(ex.StackTrace);
await db_Floor2UpMachinecodetimer.Ado.RollbackTranAsync();
Console.WriteLine("【上升降机】" + ex.Message);
LoggerFloor2UpDownMachine.LogError($"【上升降机】 数据库连接异常:{ex}");
// 数据库连接断开时会报错
try { await db_Floor2UpMachinecodetimer.Ado.RollbackTranAsync(); } catch { };
}
finally
{
s_taskExecuteFloor2UpMachinecodetimer.Release();
if (!db_Floor2UpMachinecodetimer.Ado.Transaction.IsNull())
await db_Floor2UpMachinecodetimer.Ado.CommitTranAsync();
try { await db_Floor2UpMachinecodetimer.Ado.CommitTranAsync(); } catch { };
stopwatch.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行Floor2UpMachinecode {stopwatch.ElapsedMilliseconds} ms");
@@ -1150,17 +1175,25 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
await db_Floor2timer送空托到上升降区.Ado.CommitTranAsync();
}
}
catch (ObjectDisposedException ex)
{
LoggerFloor2RackDelivery.LogError($"【送空托到上升降区】 数据库连接异常:{ex.Message}");
LoggerFloor2RackDelivery.LogError($"【送空托到上升降区】 数据库连接异常:{ex.StackTrace}");
if (ex.Source == "Npgsql")
db_Floor2timer送空托到上升降区 = _repository.AsSugarClient().CopyNew();
}
catch (Exception ex)
{
LoggerFloor2RackDelivery.LogInformation($"【送空托到上升降区】 {ex.Message}");
LoggerFloor2RackDelivery.LogInformation($"【送空托到上升降区】 {ex.StackTrace}");
await db_Floor2timer送空托到上升降区.Ado.RollbackTranAsync();
Console.WriteLine("【上升降机】" + ex.Message);
LoggerFloor2RackDelivery.LogError($"【送空托到上升降区】 数据库连接异常:{ex}");
// 数据库连接断开时会报错
try { await db_Floor2timer送空托到上升降区.Ado.RollbackTranAsync(); } catch { };
}
finally
{
s_task送空托到上升降区.Release();
if (!db_Floor2timer送空托到上升降区.Ado.Transaction.IsNull())
await db_Floor2timer送空托到上升降区.Ado.CommitTranAsync();
try { await db_Floor2timer送空托到上升降区.Ado.CommitTranAsync(); } catch { };
_wareHouseService.GenTaskExecute();
stopwatch.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行送空托到上升降区 {stopwatch.ElapsedMilliseconds} ms");
@@ -1310,17 +1343,25 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
await db_Floor2timer送满托到下升降区.Ado.CommitTranAsync();
}
}
catch (ObjectDisposedException ex)
{
LoggerFloor2RackDelivery.LogError($"【送满托到下升降区】 数据库连接异常:{ex.Message}");
LoggerFloor2RackDelivery.LogError($"【送满托到下升降区】 数据库连接异常:{ex.StackTrace}");
if (ex.Source == "Npgsql")
db_Floor2timer送满托到下升降区 = _repository.AsSugarClient().CopyNew();
}
catch (Exception ex)
{
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 {ex.Message}");
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 {ex.StackTrace}");
await db_Floor2timer送满托到下升降区.Ado.RollbackTranAsync();
Console.WriteLine("【上升降机】" + ex.Message);
LoggerFloor2RackDelivery.LogError($"【送满托到下升降区】 数据库连接异常:{ex}");
// 数据库连接断开时会报错
try { await db_Floor2timer送满托到下升降区.Ado.RollbackTranAsync(); } catch { };
}
finally
{
s_task送满托到下升降区.Release();
if (!db_Floor2timer送满托到下升降区.Ado.Transaction.IsNull())
await db_Floor2timer送满托到下升降区.Ado.CommitTranAsync();
try { await db_Floor2timer送满托到下升降区.Ado.CommitTranAsync(); } catch { };
_wareHouseService.GenTaskExecute();
stopwatch.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行送满托到下升降区 {stopwatch.ElapsedMilliseconds} ms");
@@ -1416,17 +1457,26 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
await db_Floor2timer移走上升降区未生成预任务且满托的料架.Ado.CommitTranAsync();
}
}
catch (ObjectDisposedException ex)
{
LoggerFloor2RackDelivery.LogError($"【移走上升降区未生成预任务且满托的料架】 数据库连接异常:{ex.Message}");
LoggerFloor2RackDelivery.LogError($"【移走上升降区未生成预任务且满托的料架】 数据库连接异常:{ex.StackTrace}");
if (ex.Source == "Npgsql")
db_Floor2timer移走上升降区未生成预任务且满托的料架 = _repository.AsSugarClient().CopyNew();
}
catch (Exception ex)
{
LoggerFloor2RackDelivery.LogInformation($"【移走上升降区未生成预任务且满托的料架】 {ex.Message}");
LoggerFloor2RackDelivery.LogInformation($"【移走上升降区未生成预任务且满托的料架】 {ex.StackTrace}");
await db_Floor2timer移走上升降区未生成预任务且满托的料架.Ado.RollbackTranAsync();
Console.WriteLine("【上升降机】" + ex.Message);
LoggerFloor2RackDelivery.LogError($"【移走上升降区未生成预任务且满托的料架】 数据库连接异常:{ex}");
// 数据库连接断开时会报错
try { await db_Floor2timer移走上升降区未生成预任务且满托的料架.Ado.RollbackTranAsync(); } catch { };
}
finally
{
s_task移走上升降区未生成预任务且满托的料架.Release();
if (!db_Floor2timer移走上升降区未生成预任务且满托的料架.Ado.Transaction.IsNull())
await db_Floor2timer移走上升降区未生成预任务且满托的料架.Ado.CommitTranAsync();
// 数据库连接断开时会报错
try { await db_Floor2timer移走上升降区未生成预任务且满托的料架.Ado.CommitTranAsync(); } catch { };
_wareHouseService.GenTaskExecute();
stopwatch.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行移走上升降区未生成预任务且满托的料架 {stopwatch.ElapsedMilliseconds} ms");
@@ -1537,17 +1587,25 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
}
}
catch (ObjectDisposedException ex)
{
LoggerFloor2RackDelivery.LogError($"【移走下升降区空托的料架】 数据库连接异常:{ex.Message}");
LoggerFloor2RackDelivery.LogError($"【移走下升降区空托的料架】 数据库连接异常:{ex.StackTrace}");
if (ex.Source == "Npgsql")
db_Floor2timer移走下升降区未生成预任务且空托的料架 = _repository.AsSugarClient().CopyNew();
}
catch (Exception ex)
{
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 {ex.Message}");
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 {ex.StackTrace}");
await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.RollbackTranAsync();
Console.WriteLine("【上升降机】" + ex.Message);
LoggerFloor2RackDelivery.LogError($"【移走下升降区空托的料架】 数据库连接异常:{ex}");
// 数据库连接断开时会报错
try { await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.RollbackTranAsync(); } catch { };
}
finally
{
s_task移走下升降区未生成预任务且空托的料架.Release();
if (!db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.Transaction.IsNull())
await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.CommitTranAsync();
try { await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.CommitTranAsync(); } catch { };
_wareHouseService.GenTaskExecute();
stopwatch.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行移走下升降区未生成预任务且空托的料架 {stopwatch.ElapsedMilliseconds} ms");
@@ -1720,7 +1778,6 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
Floor2timer移走上升降区未生成预任务且满托的料架 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
Floor2timer移走下升降区未生成预任务且空托的料架 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
return Task.CompletedTask;
}

View File

@@ -5,6 +5,7 @@ using JNPF.DynamicApiController;
using JNPF.FriendlyException;
using JNPF.Systems.Interfaces.System;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
@@ -365,7 +366,7 @@ namespace Tnb.WarehouseMgr
string Code = await _billRuleService.GetBillNumber("MaterialTransfer");
wmsMaterialTransfer.bill_code = Code;
wmsMaterialTransfer.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;
wmsMaterialTransfer.bill_date = input.bill_date;
wmsMaterialTransfer.bill_date = DateTime.Now;
wmsMaterialTransfer.warehouse_outstock = warehouse_outstock.id;
wmsMaterialTransfer.warehouse_instock = warehouse_instock.id;
wmsMaterialTransfer.biller_out = input.biller_out;

View File

@@ -2157,11 +2157,13 @@ namespace Tnb.WarehouseMgr
is_lock = 0,
is_use = string.IsNullOrEmpty(multiList[i].carry_status) ? ((int)EnumCarryStatus.).ToString() : multiList[i].carry_status
};
if (!string.IsNullOrEmpty(multiList[i].carry_status) && multiList[i].carry_status.ToEnum<EnumCarryStatus>() == EnumCarryStatus.)
if (!string.IsNullOrEmpty(multiList[i].carry_status))
{
loc.is_use = ((int)EnumCarryStatus.).ToString();
}
// 如果是出入库位 完成后解除占用
string? is_type = locTypeMap.ContainsKey(endLocId) ? locTypeMap[endLocId].ToString() : "";
if (is_type == ((int)EnumLocationType.).ToString())

View File

@@ -393,19 +393,34 @@ namespace Tnb.WarehouseMgr
await _db.Ado.BeginTranAsync();
try
{
WmsCarryH wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).First();
if (wmsCarryH == null)
{
Logger.Error($"【FinishproductOutstockSign】请扫描正确的载具条码");
throw new AppFriendlyException($"请扫描正确的载具条码", 500);
}
if (string.IsNullOrEmpty(wmsCarryH.location_id))
{
Logger.Error($"【FinishproductOutstockSign】载具 {input.carry_code}没有当前库位 不能签收!");
throw new AppFriendlyException("FinishproductOutstockSign】载具 {input.carry_code}没有当前库位 不能签收!", 500);
Logger.Error($"【FinishproductOutstockSign】载具 {input.carry_code}没有当前库位 不能签收!可能是重复签收");
throw new AppFriendlyException($"载具 {input.carry_code}没有当前库位 不能签收!可能是重复签收", 500);
}
await _db.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
BasLocation location = _db.Queryable<BasLocation>().Where(r => r.id == wmsCarryH.location_id).First();
if (string.IsNullOrEmpty(location.location_code))
{
is_lock = 0,
carry_status = "0"
}).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
Logger.Error($"【FinishproductOutstockSign】库位id {wmsCarryH.location_id}没有对应的库位基础资料!");
throw new AppFriendlyException($"库位id {wmsCarryH.location_id}没有对应的库位基础资料!", 500);
}
WmsDistaskH wmsDistaskH = _db.Queryable<WmsDistaskH>().Where(r => r.carry_code == input.carry_code && r.endlocation_id == location.id
&& r.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID && r.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID).First();
if (wmsDistaskH != null)
{
Logger.Error($"【FinishproductOutstockSign】载具 {input.carry_code} 库位 {location.location_code}有正在执行的任务,不允许签收!");
throw new AppFriendlyException($"载具 {input.carry_code} 库位 {location.location_code}有正在执行的任务,不允许签收!", 500);
}
await _db.Updateable<BasLocation>().SetColumns(r => new BasLocation
{
@@ -413,12 +428,15 @@ namespace Tnb.WarehouseMgr
is_use = "0"
}).Where(r => r.id == wmsCarryH.location_id).ExecuteCommandAsync();
BasLocation location = _db.Queryable<BasLocation>().Where(r => r.id == wmsCarryH.location_id).First();
if (string.IsNullOrEmpty(location.location_code))
await _db.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
{
Logger.Error($"【FinishproductOutstockSign】库位id {wmsCarryH.location_id}没有对应的库位基础资料!");
throw new AppFriendlyException("【FinishproductOutstockSign】库位id {wmsCarryH.location_id}没有对应的库位基础资料!", 500);
}
location_id = "",
location_code = "",
is_lock = 0,
carry_status = "0"
}).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
await _db.Updateable<WmsPointH>().SetColumns(r => new WmsPointH
{
is_lock = 0
@@ -430,9 +448,10 @@ namespace Tnb.WarehouseMgr
if (result.code != JNPF.Common.Enums.HttpStatusCode.OK)
{
Logger.Error($"【FinishproductOutstockSign】载具 {input.carry_code}解绑失败!");
throw new AppFriendlyException("【FinishproductOutstockSign】载具 {input.carry_code}解绑失败!", 500);
throw new AppFriendlyException($"载具 {input.carry_code}解绑失败!", 500);
}
await _db.Ado.CommitTranAsync();
Logger.LogInformation($"【FinishproductOutstockSign】载具签收成功 载具:{input.carry_code} 库位:{location.location_code}");
}
catch (Exception ex)
{