Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -26,6 +26,7 @@ using Microsoft.Extensions.Logging;
|
|||||||
using NetTaste;
|
using NetTaste;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Npgsql;
|
||||||
using Org.BouncyCastle.Asn1.X509;
|
using Org.BouncyCastle.Asn1.X509;
|
||||||
using Org.BouncyCastle.Asn1.X509.Qualified;
|
using Org.BouncyCastle.Asn1.X509.Qualified;
|
||||||
using Qiniu.Util;
|
using Qiniu.Util;
|
||||||
@@ -91,16 +92,16 @@ namespace Tnb.ProductionMgr
|
|||||||
private readonly IPrdInstockService _prdInstockService;
|
private readonly IPrdInstockService _prdInstockService;
|
||||||
private readonly ISqlSugarRepository<RedisReadConfig> _repository;
|
private readonly ISqlSugarRepository<RedisReadConfig> _repository;
|
||||||
private ISqlSugarClient db_Scantimer;
|
private ISqlSugarClient db_Scantimer;
|
||||||
private readonly ISqlSugarClient db_CheckGettimer;
|
private ISqlSugarClient db_CheckGettimer;
|
||||||
private readonly ISqlSugarClient db_SSXcodetimer;
|
private ISqlSugarClient db_SSXcodetimer;
|
||||||
private readonly ISqlSugarClient db_BGWCarrySupplementtimer;
|
private ISqlSugarClient db_BGWCarrySupplementtimer;
|
||||||
private readonly ISqlSugarClient db_YCLGLDPJInstocktimer;
|
private ISqlSugarClient db_YCLGLDPJInstocktimer;
|
||||||
private readonly ISqlSugarClient db_YCLWXDPJInstocktimer;
|
private ISqlSugarClient db_YCLWXDPJInstocktimer;
|
||||||
private ISqlSugarClient db_Floor2UpMachinecodetimer;
|
private ISqlSugarClient db_Floor2UpMachinecodetimer;
|
||||||
private readonly ISqlSugarClient db_Floor2timer送空托到上升降区;
|
private ISqlSugarClient db_Floor2timer送空托到上升降区;
|
||||||
private readonly ISqlSugarClient db_Floor2timer送满托到下升降区;
|
private ISqlSugarClient db_Floor2timer送满托到下升降区;
|
||||||
private readonly ISqlSugarClient db_Floor2timer移走上升降区未生成预任务且满托的料架;
|
private ISqlSugarClient db_Floor2timer移走上升降区未生成预任务且满托的料架;
|
||||||
private readonly ISqlSugarClient db_Floor2timer移走下升降区未生成预任务且空托的料架;
|
private ISqlSugarClient db_Floor2timer移走下升降区未生成预任务且空托的料架;
|
||||||
private readonly IWmsPDAScanInStockService _wmsPDAScanInStock;
|
private readonly IWmsPDAScanInStockService _wmsPDAScanInStock;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
private readonly IBillRullService _billRullService;
|
private readonly IBillRullService _billRullService;
|
||||||
@@ -111,6 +112,14 @@ namespace Tnb.ProductionMgr
|
|||||||
|
|
||||||
private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
|
private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
|
||||||
|
|
||||||
|
static ConnectionStringsOptions connectionOpts = App.GetConfig<ConnectionStringsOptions>("ConnectionStrings", true);
|
||||||
|
static ConnectionConfig cfg = new()
|
||||||
|
{
|
||||||
|
ConfigId = connectionOpts.ConfigId,
|
||||||
|
ConnectionString = connectionOpts.ConnectString,
|
||||||
|
DbType = SqlSugar.DbType.PostgreSQL,
|
||||||
|
IsAutoCloseConnection = true,
|
||||||
|
};
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 构造函数
|
#region 构造函数
|
||||||
@@ -226,6 +235,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch(NpgsqlException ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("【CheckGet】" + ex.Message);
|
||||||
|
LoggerSSX.LogError(ex.ToString());
|
||||||
|
//db_CheckGettimer = new SqlSugarClient(cfg);
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine("【CheckGet】" + ex.Message);
|
Console.WriteLine("【CheckGet】" + ex.Message);
|
||||||
@@ -950,19 +965,18 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
carryBindInput.carrystd_id = rack.carrystd_id;
|
carryBindInput.carrystd_id = rack.carrystd_id;
|
||||||
carryBindInput.source_code = target.outbill;
|
carryBindInput.source_code = target.outbill;
|
||||||
|
|
||||||
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result bindResult = await _wmsCarryBindService.CarryBind(carryBindInput);
|
int row = await db_Floor2UpMachinecodetimer.Updateable<WmsCarryH>().SetColumns(r => r.carry_status == ((int)(EnumCarryStatus.齐套)).ToString()).Where(r => r.id == target.rackid).ExecuteCommandAsync();
|
||||||
|
if (row == 0)
|
||||||
|
{
|
||||||
|
throw new Exception($"【上升降机】料架{target.rackcode}状态回写失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
WarehouseMgr.Entities.Dto.Outputs.Result bindResult = await _wmsCarryBindService.CarryBind(carryBindInput, db_Floor2UpMachinecodetimer);
|
||||||
if (bindResult.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
if (bindResult.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
throw new Exception(bindResult.msg);
|
throw new Exception(bindResult.msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 开始码垛
|
|
||||||
bool result_开始码垛 = await Floor2UpDownMachinecode_SetTag(MechanicalArmConsts.上升降机当前码垛位, target.stackingposition.ToString());
|
|
||||||
LoggerFloor2UpDownMachine.LogInformation($@"【上升降机】码垛结果 {result_开始码垛}");
|
|
||||||
if (!result_开始码垛)
|
|
||||||
{
|
|
||||||
throw new Exception($@"【上升降机】码垛结果 {result_开始码垛}");
|
|
||||||
}
|
|
||||||
// 回写料箱条码、码垛计数
|
// 回写料箱条码、码垛计数
|
||||||
await db_Floor2UpMachinecodetimer.Updateable<WmsMechanicalArmH>().SetColumns(r => new WmsMechanicalArmH
|
await db_Floor2UpMachinecodetimer.Updateable<WmsMechanicalArmH>().SetColumns(r => new WmsMechanicalArmH
|
||||||
{
|
{
|
||||||
@@ -980,15 +994,25 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
LoggerFloor2UpDownMachine.LogInformation($@"【上升降机】回写转库单的剩余可绑定料架数量");
|
LoggerFloor2UpDownMachine.LogInformation($@"【上升降机】回写转库单的剩余可绑定料架数量");
|
||||||
|
|
||||||
|
|
||||||
|
// 开始码垛
|
||||||
|
bool result_开始码垛 = await Floor2UpDownMachinecode_SetTag(MechanicalArmConsts.上升降机当前码垛位, target.stackingposition.ToString());
|
||||||
|
LoggerFloor2UpDownMachine.LogInformation($@"【上升降机】码垛结果 {result_开始码垛}");
|
||||||
|
if (!result_开始码垛)
|
||||||
|
{
|
||||||
|
throw new Exception($@"【上升降机】码垛结果 {result_开始码垛}");
|
||||||
|
}
|
||||||
|
|
||||||
await db_Floor2UpMachinecodetimer.Ado.CommitTranAsync();
|
await db_Floor2UpMachinecodetimer.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// 测试代码 无问题后期删
|
// 测试代码 无问题后期删
|
||||||
if (ex.Message.Contains("Connection is busy"))
|
if (ex.Message.Contains("Exception while reading from stream"))
|
||||||
{
|
{
|
||||||
db_Floor2UpMachinecodetimer = db_Floor2UpMachinecodetimer.CopyNew();
|
LoggerFloor2UpDownMachine.LogError("【测试】重置连接");
|
||||||
|
db_Floor2UpMachinecodetimer.Close();
|
||||||
|
db_Floor2UpMachinecodetimer = _repository.CopyNew();
|
||||||
}
|
}
|
||||||
|
|
||||||
LoggerFloor2UpDownMachine.LogError(ex.ToString());
|
LoggerFloor2UpDownMachine.LogError(ex.ToString());
|
||||||
@@ -1039,12 +1063,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
List<string> configs_upMachine = new List<string>();
|
List<string> configs_upMachine = new List<string>();
|
||||||
if (await GetBoolTag("东面提升机输送线", $"上升降机请求送空托1"))
|
if (await GetBoolTag("东面提升机输送线", $"上升降机请求送空托1"))
|
||||||
{
|
{
|
||||||
LoggerFloor2RackDelivery.LogError($"【送空托到上升降区】上升降机请求送空托1 true");
|
LoggerFloor2RackDelivery.LogInformation($"【送空托到上升降区】上升降机请求送空托1 true");
|
||||||
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求送空托1"]);
|
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求送空托1"]);
|
||||||
}
|
}
|
||||||
if (await GetBoolTag("东面提升机输送线", $"上升降机请求送空托2"))
|
if (await GetBoolTag("东面提升机输送线", $"上升降机请求送空托2"))
|
||||||
{
|
{
|
||||||
LoggerFloor2RackDelivery.LogError($"【送空托到上升降区】上升降机请求送空托2 true");
|
LoggerFloor2RackDelivery.LogInformation($"【送空托到上升降区】上升降机请求送空托2 true");
|
||||||
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求送空托2"]);
|
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求送空托2"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1164,12 +1188,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
List<string> configs_upMachine = new List<string>();
|
List<string> configs_upMachine = new List<string>();
|
||||||
if (await GetBoolTag("东面提升机输送线", $"下升降机请求送满托1"))
|
if (await GetBoolTag("东面提升机输送线", $"下升降机请求送满托1"))
|
||||||
{
|
{
|
||||||
LoggerFloor2RackDelivery.LogError($"【送满托到下升降区】下升降机请求送满托1 true");
|
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】下升降机请求送满托1 true");
|
||||||
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求送满托1"]);
|
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求送满托1"]);
|
||||||
}
|
}
|
||||||
if (await GetBoolTag("东面提升机输送线", $"下升降机请求送满托2"))
|
if (await GetBoolTag("东面提升机输送线", $"下升降机请求送满托2"))
|
||||||
{
|
{
|
||||||
LoggerFloor2RackDelivery.LogError($"【送满托到下升降区】下升降机请求送满托2 true");
|
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】下升降机请求送满托2 true");
|
||||||
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求送满托2"]);
|
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求送满托2"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1193,6 +1217,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
await db_Floor2timer送满托到下升降区.Ado.BeginTranAsync();
|
await db_Floor2timer送满托到下升降区.Ado.BeginTranAsync();
|
||||||
// 料架区
|
// 料架区
|
||||||
foreach (WmsMechanicalArmH wmsMechanicalArmH in WmsMechanicalArmHs)
|
foreach (WmsMechanicalArmH wmsMechanicalArmH in WmsMechanicalArmHs)
|
||||||
@@ -1214,7 +1239,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
var item = r.FirstOrDefault();
|
var item = r.FirstOrDefault();
|
||||||
// 空载具入库: 前面通过OrderBy(d => d.id)对WmsCarryCode_id进行了排序 那么如果第一行有数据则说明存在非空料箱
|
// 空载具入库: 前面通过OrderBy(d => d.id)对WmsCarryCode_id进行了排序 那么如果第一行有数据则说明存在非空料箱
|
||||||
// 没有物料且没有退料标记的不满足出库条件
|
// 没有物料且没有退料标记的不满足出库条件
|
||||||
if (!string.IsNullOrEmpty(item.WmsCarryCode_id) && (item.wmsCarryH.need_return == 0 || item.wmsCarryH.need_return == null))
|
if (!string.IsNullOrEmpty(item.WmsCarryCode_id) && item.wmsCarryH.carry_status != ((int)(EnumCarryStatus.退料)).ToString())
|
||||||
{
|
{
|
||||||
return new BasLocation();
|
return new BasLocation();
|
||||||
}
|
}
|
||||||
@@ -1275,11 +1300,6 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
|
|
||||||
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 开始生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}");
|
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 开始生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}");
|
||||||
|
|
||||||
await db_Floor2timer送满托到下升降区.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
|
|
||||||
{
|
|
||||||
need_return = 0
|
|
||||||
}).Where(r => r.id == targetCarry.id).ExecuteCommandAsync();
|
|
||||||
|
|
||||||
bool result = await createPretask(startLocation.id, wmsMechanicalArmH.location_id, targetCarry.id, targetCarry.carry_code, LoggerFloor2RackDelivery, db_Floor2timer送满托到下升降区);
|
bool result = await createPretask(startLocation.id, wmsMechanicalArmH.location_id, targetCarry.id, targetCarry.carry_code, LoggerFloor2RackDelivery, db_Floor2timer送满托到下升降区);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
@@ -1329,12 +1349,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
List<string> configs_upMachine = new List<string>();
|
List<string> configs_upMachine = new List<string>();
|
||||||
if (await GetBoolTag("东面提升机输送线", $"上升降机请求取满托1"))
|
if (await GetBoolTag("东面提升机输送线", $"上升降机请求取满托1"))
|
||||||
{
|
{
|
||||||
LoggerFloor2RackDelivery.LogError($"【移走上升降区未生成预任务且满托的料架】上升降机请求取满托1 true");
|
LoggerFloor2RackDelivery.LogInformation($"【移走上升降区未生成预任务且满托的料架】上升降机请求取满托1 true");
|
||||||
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求取满托1"]);
|
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求取满托1"]);
|
||||||
}
|
}
|
||||||
if (await GetBoolTag("东面提升机输送线", $"上升降机请求取满托2"))
|
if (await GetBoolTag("东面提升机输送线", $"上升降机请求取满托2"))
|
||||||
{
|
{
|
||||||
LoggerFloor2RackDelivery.LogError($"【移走上升降区未生成预任务且满托的料架】上升降机请求取满托2 true");
|
LoggerFloor2RackDelivery.LogInformation($"【移走上升降区未生成预任务且满托的料架】上升降机请求取满托2 true");
|
||||||
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求取满托2"]);
|
configs_upMachine.Add(floor2mechanicalAtmDic["上升降机请求取满托2"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1435,13 +1455,13 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
List<string> configs_upMachine = new List<string>();
|
List<string> configs_upMachine = new List<string>();
|
||||||
if (await GetBoolTag("东面提升机输送线", $"下升降机请求取空托1"))
|
if (await GetBoolTag("东面提升机输送线", $"下升降机请求取空托1"))
|
||||||
{
|
{
|
||||||
LoggerFloor2RackDelivery.LogError($"【移走下升降区空托的料架】下升降机请求取空托1 true");
|
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】下升降机请求取空托1 true");
|
||||||
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求取空托1"]);
|
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求取空托1"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (await GetBoolTag("东面提升机输送线", $"下升降机请求取空托2"))
|
if (await GetBoolTag("东面提升机输送线", $"下升降机请求取空托2"))
|
||||||
{
|
{
|
||||||
LoggerFloor2RackDelivery.LogError($"【移走下升降区空托的料架】下升降机请求取空托2 true");
|
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】下升降机请求取空托2 true");
|
||||||
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求取空托2"]);
|
configs_upMachine.Add(floor2mechanicalAtmDic["下升降机请求取空托2"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1455,13 +1475,13 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
//await db.BeginTranAsync();
|
//await db.BeginTranAsync();
|
||||||
// 读取下升降机的左右料架区配置
|
// 读取下升降机的左右料架区配置
|
||||||
|
|
||||||
await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.BeginTranAsync();
|
|
||||||
List<WmsMechanicalArmH> WmsMechanicalArmHs = db_Floor2timer移走下升降区未生成预任务且空托的料架.Queryable<WmsMechanicalArmH>().Where(r => !string.IsNullOrEmpty(r.rackcode) && r.iscreatepretask == 0 && configs_upMachine.Contains(r.name)).ToList();
|
List<WmsMechanicalArmH> WmsMechanicalArmHs = db_Floor2timer移走下升降区未生成预任务且空托的料架.Queryable<WmsMechanicalArmH>().Where(r => !string.IsNullOrEmpty(r.rackcode) && r.iscreatepretask == 0 && configs_upMachine.Contains(r.name)).ToList();
|
||||||
|
|
||||||
foreach (WmsMechanicalArmH wmsMechanicalArmH in WmsMechanicalArmHs)
|
foreach (WmsMechanicalArmH wmsMechanicalArmH in WmsMechanicalArmHs)
|
||||||
{
|
{
|
||||||
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 开始执行预任务生成 {wmsMechanicalArmH.location_code} {wmsMechanicalArmH.outbill} {wmsMechanicalArmH.barcodes}");
|
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 开始执行预任务生成 {wmsMechanicalArmH.location_code} {wmsMechanicalArmH.outbill} {wmsMechanicalArmH.barcodes}");
|
||||||
|
|
||||||
|
await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.BeginTranAsync();
|
||||||
await db_Floor2timer移走下升降区未生成预任务且空托的料架.Updateable<WmsMechanicalArmH>().SetColumns(r => new WmsMechanicalArmH
|
await db_Floor2timer移走下升降区未生成预任务且空托的料架.Updateable<WmsMechanicalArmH>().SetColumns(r => new WmsMechanicalArmH
|
||||||
{
|
{
|
||||||
iscreatepretask = 1
|
iscreatepretask = 1
|
||||||
@@ -1480,13 +1500,20 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
|
|
||||||
BasLocation endLocation = rackEndLocations.First();
|
BasLocation endLocation = rackEndLocations.First();
|
||||||
|
|
||||||
|
int row = await db_Floor2timer移走下升降区未生成预任务且空托的料架.Updateable<WmsCarryH>().SetColumns(r => r.carry_status == "0").Where(r => r.id == wmsMechanicalArmH.rackid).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
if (row == 0)
|
||||||
|
{
|
||||||
|
throw new Exception($"【移走下升降区空托的料架】料架{wmsMechanicalArmH.rackcode}状态回写失败");
|
||||||
|
}
|
||||||
|
|
||||||
// 解除绑定料箱到料架
|
// 解除绑定料箱到料架
|
||||||
CarryBindInput carryBindInput = new() { };
|
CarryBindInput carryBindInput = new() { };
|
||||||
carryBindInput.carry_id = wmsMechanicalArmH.rackid;
|
carryBindInput.carry_id = wmsMechanicalArmH.rackid;
|
||||||
carryBindInput.carry_code = wmsMechanicalArmH.rackcode;
|
carryBindInput.carry_code = wmsMechanicalArmH.rackcode;
|
||||||
carryBindInput.source_code = wmsMechanicalArmH.outbill;
|
carryBindInput.source_code = wmsMechanicalArmH.outbill;
|
||||||
|
|
||||||
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result unbindResult = await _wmsCarryUnbindService.CarryUnbind(carryBindInput);
|
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result unbindResult = await _wmsCarryUnbindService.CarryUnbind(carryBindInput, db_Floor2timer移走下升降区未生成预任务且空托的料架);
|
||||||
if (unbindResult.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
if (unbindResult.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
throw new Exception(unbindResult.msg);
|
throw new Exception(unbindResult.msg);
|
||||||
@@ -1506,8 +1533,8 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}");
|
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}");
|
||||||
throw new Exception($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}");
|
throw new Exception($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}");
|
||||||
}
|
}
|
||||||
|
await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.CommitTranAsync();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -1666,6 +1693,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public Task StartAsync(CancellationToken cancellationToken)
|
public Task StartAsync(CancellationToken cancellationToken)
|
||||||
@@ -1692,6 +1720,7 @@ 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));
|
||||||
Floor2timer移走下升降区未生成预任务且空托的料架 = new Timer(移走下升降区未生成预任务且空托的料架, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
|
Floor2timer移走下升降区未生成预任务且空托的料架 = new Timer(移走下升降区未生成预任务且空托的料架, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
|
||||||
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,16 @@
|
|||||||
/// 成品仓库ID
|
/// 成品仓库ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string WAREHOUSE_CP_ID = "26103372441637";
|
public const string WAREHOUSE_CP_ID = "26103372441637";
|
||||||
|
/// <summary>
|
||||||
|
/// 成品出入库仓库ID
|
||||||
|
/// </summary>
|
||||||
|
public const string WAREHOUSE_CPCRK_ID = "35302142874901";
|
||||||
|
/// <summary>
|
||||||
|
/// 暂存仓仓库ID
|
||||||
|
/// </summary>
|
||||||
|
public const string WAREHOUSE_ZCC_ID = "33780009364245";
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 四楼解析库
|
/// 四楼解析库
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -31,6 +41,22 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const string WAREHOUSE_ZZXBK_ID = "26257716248101";
|
public const string WAREHOUSE_ZZXBK_ID = "26257716248101";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 长管出库
|
||||||
|
/// </summary>
|
||||||
|
public const string MATERIALTRANSFER_CGCK_CODE = "longWarehouse";
|
||||||
|
/// <summary>
|
||||||
|
/// 外协调拨入库
|
||||||
|
/// </summary>
|
||||||
|
public const string MATERIALTRANSFER_WXDBRK_CODE = "wxdbWarehouse";
|
||||||
|
/// <summary>
|
||||||
|
/// 集中供料入库
|
||||||
|
/// </summary>
|
||||||
|
public const string MATERIALTRANSFER_JZGLRK_CODE = "materielWarehouse";
|
||||||
|
/// <summary>
|
||||||
|
/// 齐套出入库
|
||||||
|
/// </summary>
|
||||||
|
public const string MATERIALTRANSFER_QTCRK_CODE = "assortWarehouse";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 出入库单据状态TypeID
|
/// 出入库单据状态TypeID
|
||||||
@@ -326,6 +352,10 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const string AdministratorOrgId = "25193668006933";
|
public const string AdministratorOrgId = "25193668006933";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// ERPId(天益4厂)
|
||||||
|
/// </summary>
|
||||||
|
public const string ErpUserId = "34995305856535";
|
||||||
|
/// <summary>
|
||||||
/// 盘点任务计算状态-未结算
|
/// 盘点任务计算状态-未结算
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string CLOSINGSTATUS_WJS_ID = "27674058079509";
|
public const string CLOSINGSTATUS_WJS_ID = "27674058079509";
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单据状态
|
/// 单据状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? biil_status { get; set; }
|
public string? bill_status { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 入库单创建日期
|
/// 入库单创建日期
|
||||||
@@ -63,6 +63,11 @@ namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime arrival_date { get; set; }
|
public DateTime arrival_date { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 主表主键
|
||||||
|
/// </summary>
|
||||||
|
public string erp_pk { get; set; }
|
||||||
|
|
||||||
public List<MaterialTransferDetail> details { get; set; }
|
public List<MaterialTransferDetail> details { get; set; }
|
||||||
}
|
}
|
||||||
public class MaterialTransferDetail
|
public class MaterialTransferDetail
|
||||||
@@ -77,11 +82,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? material_code { get; set; }
|
public string? material_code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 规格型号
|
|
||||||
/// </summary>
|
|
||||||
public string material_specification { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单位代码
|
/// 单位代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -103,8 +103,8 @@ namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
|
|||||||
public decimal? qty { get; set; }
|
public decimal? qty { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 物料描述
|
/// 子表主键
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? material_ex { get; set; }
|
public string erp_line_pk { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
public class FinishproductOutstockSignInput
|
public class FinishproductOutstockSignInput
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 起点
|
/// 载具编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? location_id { get; set; }
|
public string? carry_code { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,14 @@
|
|||||||
/// 载具
|
/// 载具
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<String> carryIds { get; set; }
|
public List<String> carryIds { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 任务执行单号
|
||||||
|
/// </summary>
|
||||||
|
public string bill_code { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 任务执行区域
|
||||||
|
/// </summary>
|
||||||
|
public string area_code { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
namespace Tnb.WarehouseMgr.Entities.Dto
|
||||||
|
{
|
||||||
|
public class OutStockStrategyZCC2Floor2Query
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 仓库Id
|
||||||
|
/// </summary>
|
||||||
|
public string warehouse_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 载具Id
|
||||||
|
/// </summary>
|
||||||
|
public string carry_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 载具规格Id
|
||||||
|
/// </summary>
|
||||||
|
public string carrystd_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料Id
|
||||||
|
/// </summary>
|
||||||
|
public string material_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 批次
|
||||||
|
/// </summary>
|
||||||
|
public string code_batch { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 业务类型s
|
||||||
|
/// </summary>
|
||||||
|
public int BllType { get; set; }
|
||||||
|
|
||||||
|
public int Size { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数量
|
||||||
|
/// </summary>
|
||||||
|
public decimal qty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 规格型号
|
||||||
|
/// </summary>
|
||||||
|
public string? material_specification { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 箱号
|
||||||
|
/// </summary>
|
||||||
|
public string? container_no { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public decimal? needOut { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string? material_code { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -139,10 +139,5 @@ public partial class WmsCarryH : BaseEntity<string>
|
|||||||
/// 配送工位
|
/// 配送工位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? work_station { get; set; }
|
public string? work_station { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 需要退料
|
|
||||||
/// </summary>
|
|
||||||
public int need_return { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,4 +124,18 @@ public partial class WmsMaterialTransfer : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int? remainbindracknum { get; set; }
|
public int? remainbindracknum { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// erp转库单号
|
||||||
|
/// </summary>
|
||||||
|
public string? erp_bill_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 转库类型
|
||||||
|
/// </summary>
|
||||||
|
public string? transfer_type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 主表主键
|
||||||
|
/// </summary>
|
||||||
|
public string erp_pk { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,5 +92,8 @@ public partial class WmsMaterialTransferD : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? material_ex { get; set; }
|
public string? material_ex { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 子表主键
|
||||||
|
/// </summary>
|
||||||
|
public string erp_line_pk { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,6 @@
|
|||||||
齐套 = 3,
|
齐套 = 3,
|
||||||
寄存 = 4,
|
寄存 = 4,
|
||||||
齐套分拣 = 5,
|
齐套分拣 = 5,
|
||||||
|
退料 = 6,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Tnb.WarehouseMgr.Interfaces
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="AppFriendlyException"></exception>
|
/// <exception cref="AppFriendlyException"></exception>
|
||||||
Task<List<WmsCarryH>> OutStockStrategyZCC2Floor2([FromQuery] OutStockStrategyQuery input);
|
Task<List<Tuple<WmsCarryH, decimal, BasLocation>>> OutStockStrategyZCC2Floor2([FromQuery] OutStockStrategyZCC2Floor2Query input);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 出库策略-销售出库下发
|
/// 出库策略-销售出库下发
|
||||||
@@ -133,7 +133,7 @@ namespace Tnb.WarehouseMgr.Interfaces
|
|||||||
/// // 二楼机械臂
|
/// // 二楼机械臂
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task Floor2MechanicalComplete(WmsDistaskH disTask, string action);
|
Task Floor2MechanicalConfirm(WmsDistaskH disTask, string action);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 二楼kiva把料架送到下升降机后生成中储仓入库任务
|
/// 二楼kiva把料架送到下升降机后生成中储仓入库任务
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using JNPF.Common.Dtos.VisualDev;
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
|
using SqlSugar;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||||
|
|
||||||
@@ -11,6 +12,6 @@ namespace Tnb.WarehouseMgr.Interfaces
|
|||||||
{
|
{
|
||||||
Task<dynamic> CarryBind(VisualDevModelDataCrInput input);
|
Task<dynamic> CarryBind(VisualDevModelDataCrInput input);
|
||||||
|
|
||||||
Task<Result> CarryBind(CarryBindInput input);
|
Task<Result> CarryBind(CarryBindInput input, ISqlSugarClient dbConn = null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using JNPF.Common.Dtos.VisualDev;
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
|
using SqlSugar;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||||
|
|
||||||
@@ -9,7 +10,7 @@ namespace Tnb.WarehouseMgr.Interfaces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IWmsCarryUnbindService
|
public interface IWmsCarryUnbindService
|
||||||
{
|
{
|
||||||
Task<Result> CarryUnbind(CarryBindInput input);
|
Task<Result> CarryUnbind(CarryBindInput input, ISqlSugarClient dbConn = null);
|
||||||
Task<Result> CarryCodeUnbind(CarryCodeUnbindInput input);
|
Task<Result> CarryCodeUnbind(CarryCodeUnbindInput input, ISqlSugarClient dbConn = null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,20 @@ namespace Tnb.WarehouseMgr
|
|||||||
return await ToApiResult(HttpStatusCode.InternalServerError, "失败");
|
return await ToApiResult(HttpStatusCode.InternalServerError, "失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 机械臂边取货确认
|
||||||
|
else if (dis.area_code == "E")
|
||||||
|
{
|
||||||
|
if (dis.startlocation_code.Contains("AS") || dis.startlocation_code.Contains("AX"))
|
||||||
|
{
|
||||||
|
// 二楼机械臂
|
||||||
|
await _wareHouseService.Floor2MechanicalConfirm(dis, "LOAD");
|
||||||
|
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -255,20 +269,49 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
Logger.Information("【UnloadConfirm】 接收到WCS放货确认信号..................");
|
Logger.Information("【UnloadConfirm】 接收到WCS放货确认信号..................");
|
||||||
Logger.Information($"【UnloadConfirm】 当前放货,任务编号:{input.taskCode}");
|
Logger.Information($"【UnloadConfirm】 当前放货,任务编号:{input.taskCode}");
|
||||||
var dis = _db.Queryable<WmsDistaskH>().Where(P => P.bill_code == input.taskCode).First();
|
|
||||||
if (dis.area_code == "ZSCJ001")
|
try
|
||||||
{
|
{
|
||||||
var flag = await _wareHouseService.Check(dis.endlocation_code, "UNLOAD");
|
var dis = _db.Queryable<WmsDistaskH>().Where(P => P.bill_code == input.taskCode).First();
|
||||||
if (flag)
|
if (dis.area_code == "ZSCJ001")
|
||||||
{
|
{
|
||||||
await _wareHouseService.SsxControl(dis, "UNLOAD");
|
var flag = await _wareHouseService.Check(dis.endlocation_code, "UNLOAD");
|
||||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
if (flag)
|
||||||
|
{
|
||||||
|
await _wareHouseService.SsxControl(dis, "UNLOAD");
|
||||||
|
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return await ToApiResult(HttpStatusCode.InternalServerError, "失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
// 机械臂边放货确认
|
||||||
|
else if (dis.area_code == "E")
|
||||||
{
|
{
|
||||||
return await ToApiResult(HttpStatusCode.InternalServerError, "失败");
|
if (dis.endlocation_code.Contains("AS") || dis.endlocation_code.Contains("AX"))
|
||||||
|
{
|
||||||
|
// 二楼机械臂
|
||||||
|
await _wareHouseService.Floor2MechanicalConfirm(dis, "UNLOAD");
|
||||||
|
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogError(ex.Message);
|
||||||
|
Logger.LogError(ex.StackTrace);
|
||||||
|
return await ToApiResult(HttpStatusCode.InternalServerError, $"放货确认..................失败 原因是{ex.Message}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
/*var whereExp = Expressionable.Create<WmsElevatorH, WmsElevatorD, WmsDistaskH>()
|
/*var whereExp = Expressionable.Create<WmsElevatorH, WmsElevatorD, WmsDistaskH>()
|
||||||
@@ -598,8 +641,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
await _wareHouseService.SsxControl(disTask, "LOAD");
|
await _wareHouseService.SsxControl(disTask, "LOAD");
|
||||||
// 二楼机械臂
|
|
||||||
await _wareHouseService.Floor2MechanicalComplete(disTask, "LOAD");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (input.action == "UNLOAD")
|
else if (input.action == "UNLOAD")
|
||||||
@@ -612,8 +653,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
Logger.Information($"taskCompleUpInput json parameter:{JsonConvert.SerializeObject(taskCompleUpInput)}");
|
Logger.Information($"taskCompleUpInput json parameter:{JsonConvert.SerializeObject(taskCompleUpInput)}");
|
||||||
await _wareHouseService.TaskComplate(taskCompleUpInput);
|
await _wareHouseService.TaskComplate(taskCompleUpInput);
|
||||||
await _wareHouseService.SsxControl(disTask, "UNLOAD");
|
await _wareHouseService.SsxControl(disTask, "UNLOAD");
|
||||||
// 二楼机械臂
|
|
||||||
await _wareHouseService.Floor2MechanicalComplete(disTask, "UNLOAD");
|
|
||||||
Logger.Information($"【TaskCallback】 Agv放货完成,任务编号:{string.Join(",", disTasks.Select(x => x.bill_code))}");
|
Logger.Information($"【TaskCallback】 Agv放货完成,任务编号:{string.Join(",", disTasks.Select(x => x.bill_code))}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,21 @@
|
|||||||
using JNPF.DependencyInjection;
|
using System.Text;
|
||||||
|
using JNPF.Common.Enums;
|
||||||
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.FriendlyException;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto.ErpInputs;
|
using Tnb.WarehouseMgr.Entities.Dto.ErpInputs;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||||
using Tnb.WarehouseMgr.Entities.Entity;
|
using Tnb.WarehouseMgr.Entities.Entity;
|
||||||
|
using Top.Api;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
{
|
{
|
||||||
@@ -284,55 +292,193 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 转库单
|
/// 转库单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task MaterialTransfer(MaterialTransferInput input)
|
[HttpPost, NonUnify, AllowAnonymous]
|
||||||
|
public async Task<Result> MaterialTransfer(MaterialTransferInput input)
|
||||||
{
|
{
|
||||||
|
LoggerErp2Mes.LogInformation($"【MaterialTransfer】ERP传入数据:{JsonConvert.SerializeObject(input)}");
|
||||||
var db = _repository.AsSugarClient();
|
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();
|
BasWarehouse warehouse_outstock = await db.Queryable<BasWarehouse>().Where(r => r.whcode == input.warehouse_outstock).FirstAsync();
|
||||||
|
BasWarehouse warehouse_instock = await db.Queryable<BasWarehouse>().Where(r => r.whcode == input.warehouse_instock).FirstAsync();
|
||||||
|
if (warehouse_outstock == null)
|
||||||
List<WmsMaterialTransferD> wmsMaterialTransferDs = new List<WmsMaterialTransferD>();
|
|
||||||
foreach (var detail in input.details)
|
|
||||||
{
|
{
|
||||||
WmsMaterialTransferD wmsMaterialTransferD = new WmsMaterialTransferD();
|
_LoggerErp2Mes.LogWarning($"【MaterialTransfer】无法查询到出库仓库{input.warehouse_outstock}的档案记录!");
|
||||||
wmsMaterialTransferD.lineno = detail.lineno;
|
return await ToApiResult(HttpStatusCode.InternalServerError, $"无法查询到出库仓库{input.warehouse_outstock}的档案记录!");
|
||||||
wmsMaterialTransferD.material_code = detail.material_code;
|
}
|
||||||
wmsMaterialTransferD.material_specification = detail.material_specification;
|
if (warehouse_instock == null)
|
||||||
wmsMaterialTransferD.unit_code = detail.unit_code;
|
{
|
||||||
wmsMaterialTransferD.code_batch = detail.code_batch;
|
_LoggerErp2Mes.LogWarning($"【MaterialTransfer】无法查询到入库仓库{input.warehouse_instock}的档案记录!");
|
||||||
wmsMaterialTransferD.station_code = detail.station_code;
|
return await ToApiResult(HttpStatusCode.InternalServerError, $"无法查询到入库仓库{input.warehouse_instock}的档案记录!");
|
||||||
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();
|
if (string.IsNullOrEmpty(input.erp_pk))
|
||||||
|
{
|
||||||
|
_LoggerErp2Mes.LogWarning($"【MaterialTransfer】主表主键不能为空!");
|
||||||
|
return await ToApiResult(HttpStatusCode.InternalServerError, $"主表主键不能为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
int count_erp_line_pk = input.details.Where(r => string.IsNullOrEmpty(r.erp_line_pk)).Count();
|
||||||
|
if (count_erp_line_pk > 0)
|
||||||
|
{
|
||||||
|
_LoggerErp2Mes.LogWarning($@"【MaterialTransfer】子表主键不能为空!");
|
||||||
|
throw new AppFriendlyException($@"子表主键不能为空!", 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
string transfer_type = "";
|
||||||
|
// 中储仓到暂存仓
|
||||||
|
if (warehouse_outstock.id == WmsWareHouseConst.WAREHOUSE_ZC_ID && warehouse_instock.id == WmsWareHouseConst.WAREHOUSE_ZCC_ID)
|
||||||
|
{
|
||||||
|
int count = input.details.Where(r => string.IsNullOrEmpty(r.station_code)).Count();
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
_LoggerErp2Mes.LogWarning($@"表体存在未填写工位的明细!");
|
||||||
|
throw new AppFriendlyException($@"表体存在未填写工位的明细!", 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
transfer_type = WmsWareHouseConst.MATERIALTRANSFER_CGCK_CODE;
|
||||||
|
}
|
||||||
|
else if (warehouse_outstock.id == WmsWareHouseConst.WAREHOUSE_CPCRK_ID && warehouse_instock.id == WmsWareHouseConst.WAREHOUSE_CP_ID)
|
||||||
|
{
|
||||||
|
transfer_type = WmsWareHouseConst.MATERIALTRANSFER_WXDBRK_CODE;
|
||||||
|
}
|
||||||
|
else if (warehouse_outstock.id == WmsWareHouseConst.WAREHOUSE_YCL_ID && warehouse_instock.id == WmsWareHouseConst.WAREHOUSE_JZGL_ID)
|
||||||
|
{
|
||||||
|
transfer_type = WmsWareHouseConst.MATERIALTRANSFER_JZGLRK_CODE;
|
||||||
|
}
|
||||||
|
// 暂时其他情况都算齐套出入库类型(未定)
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int count = input.details.Where(r => string.IsNullOrEmpty(r.station_code)).Count();
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
_LoggerErp2Mes.LogWarning($@"表体存在未填写工位的明细!");
|
||||||
|
throw new AppFriendlyException($@"表体存在未填写工位的明细!", 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
transfer_type = WmsWareHouseConst.MATERIALTRANSFER_QTCRK_CODE;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await db.Ado.BeginTranAsync();
|
||||||
|
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 = warehouse_outstock.id;
|
||||||
|
wmsMaterialTransfer.warehouse_instock = warehouse_instock.id;
|
||||||
|
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 = WmsWareHouseConst.ErpUserId;
|
||||||
|
wmsMaterialTransfer.create_time = DateTime.Now;
|
||||||
|
wmsMaterialTransfer.org_id = WmsWareHouseConst.AdministratorOrgId;
|
||||||
|
wmsMaterialTransfer.erp_bill_code = input.bill_code;
|
||||||
|
wmsMaterialTransfer.transfer_type = transfer_type;
|
||||||
|
wmsMaterialTransfer.erp_pk = input.erp_pk;
|
||||||
|
|
||||||
|
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.unit_code = detail.unit_code;
|
||||||
|
wmsMaterialTransferD.code_batch = detail.code_batch;
|
||||||
|
wmsMaterialTransferD.station_code = detail.station_code;
|
||||||
|
wmsMaterialTransferD.qty = detail.qty;
|
||||||
|
wmsMaterialTransferD.bill_id = wmsMaterialTransfer.id;
|
||||||
|
|
||||||
|
wmsMaterialTransferD.yxfqty = 0;
|
||||||
|
wmsMaterialTransferD.yzqty = 0;
|
||||||
|
wmsMaterialTransferD.erp_line_pk = detail.erp_line_pk;
|
||||||
|
|
||||||
|
var material = await db.Queryable<BasMaterial>().Where(p => p.code == detail.material_code).FirstAsync();
|
||||||
|
if (material != null)
|
||||||
|
{
|
||||||
|
wmsMaterialTransferD.material_id = material.id;
|
||||||
|
wmsMaterialTransferD.material_specification = material.material_specification;
|
||||||
|
wmsMaterialTransferD.unit_id = detail.unit_code;
|
||||||
|
}
|
||||||
|
wmsMaterialTransferDs.Add(wmsMaterialTransferD);
|
||||||
|
}
|
||||||
|
|
||||||
|
await db.Insertable(wmsMaterialTransferDs).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
await db.Ado.CommitTranAsync();
|
||||||
|
|
||||||
|
LoggerErp2Mes.LogInformation($"【MaterialTransfer】成功生成单据:{Code}");
|
||||||
|
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LoggerErp2Mes.LogError($"【MaterialTransfer】{ex.Message}");
|
||||||
|
LoggerErp2Mes.LogError($"【MaterialTransfer】{ex.StackTrace}");
|
||||||
|
await db.Ado.RollbackTranAsync();
|
||||||
|
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Task<Result> ToApiResult(HttpStatusCode statusCode, string msg)
|
||||||
|
{
|
||||||
|
Result result = new()
|
||||||
|
{
|
||||||
|
code = statusCode,
|
||||||
|
msg = msg
|
||||||
|
};
|
||||||
|
return Task.FromResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly Dictionary<LogLevel, string> s_logLevelMap = new()
|
||||||
|
{
|
||||||
|
[LogLevel.Debug] = "DBG",
|
||||||
|
[LogLevel.Information] = "INF",
|
||||||
|
[LogLevel.Warning] = "WRN",
|
||||||
|
[LogLevel.Error] = "ERR",
|
||||||
|
};
|
||||||
|
|
||||||
|
protected string _LoggerErp2MesFileName = "";
|
||||||
|
protected ILogger _LoggerErp2Mes;
|
||||||
|
protected ILogger LoggerErp2Mes
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string newFileName = $"{AppContext.BaseDirectory}/logs/Erp2Mes{DateTime.Now:yyyyMMdd}.log";
|
||||||
|
if (_LoggerErp2MesFileName != 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();
|
||||||
|
};
|
||||||
|
|
||||||
|
}));
|
||||||
|
_LoggerErp2Mes = loggerFactory.CreateLogger(this.GetType());
|
||||||
|
_LoggerErp2MesFileName = newFileName;
|
||||||
|
}
|
||||||
|
return _LoggerErp2Mes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -456,6 +456,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
.Select<WmsCarryH>()
|
.Select<WmsCarryH>()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
items = items.Distinct().ToList();
|
items = items.Distinct().ToList();
|
||||||
return input.Size > 0 ? items.Take(input.Size).ToList() : items;
|
return input.Size > 0 ? items.Take(input.Size).ToList() : items;
|
||||||
}
|
}
|
||||||
@@ -466,7 +467,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="AppFriendlyException"></exception>
|
/// <exception cref="AppFriendlyException"></exception>
|
||||||
public async Task<List<WmsCarryH>> OutStockStrategyZCC2Floor2([FromQuery] OutStockStrategyQuery input)
|
public async Task<List<Tuple<WmsCarryH, decimal, BasLocation>>> OutStockStrategyZCC2Floor2([FromQuery] OutStockStrategyZCC2Floor2Query input)
|
||||||
{
|
{
|
||||||
Expressionable<WmsCarryH, WmsCarryCode, BasLocation> whereExprable = Expressionable.Create<WmsCarryH, WmsCarryCode, BasLocation>()
|
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) => a.is_lock == 0 && c.is_lock == 0)
|
||||||
@@ -492,17 +493,72 @@ namespace Tnb.WarehouseMgr
|
|||||||
throw new AppFriendlyException("没有可用策略", 500);
|
throw new AppFriendlyException("没有可用策略", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<WmsCarryH> items = await cyDb.Queryable<WmsCarryH>().LeftJoin<WmsCarryCode>((a, b) => a.id == b.carry_id)
|
#region 只解决少数情况(比如只有60 59 60 60四个料箱,下发180,要取60 60 60) 其它情况不考虑
|
||||||
|
var itemsASC = await cyDb.Queryable<WmsCarryH>().LeftJoin<WmsCarryCode>((a, b) => a.id == b.carry_id)
|
||||||
.LeftJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
.LeftJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
||||||
.Where(whereExpr)
|
.Where(whereExpr)
|
||||||
//.OrderByIF((a,b,c)=>SqlFunc.IsNullOrEmpty())
|
//.OrderByIF((a,b,c)=>SqlFunc.IsNullOrEmpty())
|
||||||
.OrderBy(policy.policy)
|
//.OrderBy(policy.policy)
|
||||||
|
.OrderBy("codeqty desc,a.location_code,layers,loc_line,loc_column")
|
||||||
|
|
||||||
.Select<WmsCarryH>()
|
.Select((a, b) => new { wmsCarryH = a, wmsCarryCode = b })
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
//items = itemsASC.Count < itemsDESC.Count ? itemsASC : itemsDESC;
|
||||||
|
|
||||||
items = items.Distinct().ToList();
|
itemsASC = itemsASC.Distinct().ToList();
|
||||||
return input.Size > 0 ? items.Take(input.Size).ToList() : items;
|
|
||||||
|
List<Tuple<WmsCarryH, decimal, BasLocation>>? carrys = new List<Tuple<WmsCarryH, decimal, BasLocation>>();
|
||||||
|
|
||||||
|
for (int i = 0; i < itemsASC.Count; i++)
|
||||||
|
{
|
||||||
|
WmsCarryH wmsCarryH = itemsASC[i].wmsCarryH;
|
||||||
|
WmsCarryCode wmsCarryCode = itemsASC[i].wmsCarryCode;
|
||||||
|
|
||||||
|
if (input.needOut <= 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 查找是否有一个料箱可以正好满足剩余需求数量(目前只做这个额外判断,其它情形不考虑)
|
||||||
|
bool isFind = false;
|
||||||
|
for (int j = i + 1; j < itemsASC.Count; j++)
|
||||||
|
{
|
||||||
|
WmsCarryCode _wmsCarryCode = itemsASC[j].wmsCarryCode;
|
||||||
|
if (_wmsCarryCode.codeqty == input.needOut)
|
||||||
|
{
|
||||||
|
WmsCarryH _wmsCarryH = itemsASC[j].wmsCarryH;
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
carrys.Add(new Tuple<WmsCarryH, decimal, BasLocation>(_wmsCarryH, _wmsCarryCode.codeqty, _endlocation_ssx));
|
||||||
|
|
||||||
|
isFind = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (isFind)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// 目前只支持一个料箱只有一个物料
|
||||||
|
input.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();
|
||||||
|
|
||||||
|
carrys.Add(new Tuple<WmsCarryH, decimal, BasLocation>(wmsCarryH, wmsCarryCode.codeqty, endlocation_ssx));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
if (input.needOut > 0)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException($"物料{input.material_code}没有足够的库存!,缺失数量为{input.needOut}", 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return carrys;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -811,7 +867,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// 二楼机械臂
|
/// 二楼机械臂
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task Floor2MechanicalComplete(WmsDistaskH disTask, string action)
|
public async Task Floor2MechanicalConfirm(WmsDistaskH disTask, string action)
|
||||||
{
|
{
|
||||||
List<string> rackAreaPointsUp = new List<string>();
|
List<string> rackAreaPointsUp = new List<string>();
|
||||||
List<string> rackAreaPointsDown = new List<string>();
|
List<string> rackAreaPointsDown = new List<string>();
|
||||||
@@ -2138,7 +2194,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
CarryCodeUnbindInput carryCodeUnbindInput = new CarryCodeUnbindInput();
|
CarryCodeUnbindInput carryCodeUnbindInput = new CarryCodeUnbindInput();
|
||||||
carryCodeUnbindInput.carry_id = dt.carry_id;
|
carryCodeUnbindInput.carry_id = dt.carry_id;
|
||||||
await _wmsCarryUnbindService.CarryCodeUnbind(carryCodeUnbindInput);
|
await _wmsCarryUnbindService.CarryCodeUnbind(carryCodeUnbindInput, _db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 成品调拨入库
|
// 成品调拨入库
|
||||||
@@ -2165,7 +2221,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
List<WmsDistaskCode> disTaskCodes = await _db.Queryable<WmsDistaskCode>().Where(it => it.bill_id == dt.id).ToListAsync();
|
List<WmsDistaskCode> disTaskCodes = await _db.Queryable<WmsDistaskCode>().Where(it => it.bill_id == dt.id).ToListAsync();
|
||||||
WareHouseUpInput upInput = new() { bizTypeId = dt.biz_type, requireId = dt.require_id!, require_code = dt.require_code!, source_id = dt.source_id!
|
WareHouseUpInput upInput = new() { bizTypeId = dt.biz_type, requireId = dt.require_id!, require_code = dt.require_code!, source_id = dt.source_id!
|
||||||
, source_code = dt.source_code!, distaskCodes = disTaskCodes, carryIds = disTasks.Select(x => x.carry_id).ToList() };
|
, source_code = dt.source_code!, distaskCodes = disTaskCodes, carryIds = disTasks.Select(x => x.carry_id).ToList(),
|
||||||
|
bill_code = dt.bill_code!,area_code= dt.area_code!
|
||||||
|
};
|
||||||
|
|
||||||
/*if (!_userManager?.LoginType.IsNullOrEmpty() ?? false)
|
/*if (!_userManager?.LoginType.IsNullOrEmpty() ?? false)
|
||||||
{
|
{
|
||||||
@@ -2982,6 +3040,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
Logger.LogInformation($"【CommonCreatePretask】 {ex.Message}");
|
Logger.LogInformation($"【CommonCreatePretask】 {ex.Message}");
|
||||||
Logger.LogInformation($"【CommonCreatePretask】 {ex.StackTrace}");
|
Logger.LogInformation($"【CommonCreatePretask】 {ex.StackTrace}");
|
||||||
|
if (!db.Ado.Transaction.IsNull())
|
||||||
|
await db.Ado.CommitTranAsync();
|
||||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -199,10 +199,14 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <exception cref="ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
/// <exception cref="AppFriendlyException"></exception>
|
/// <exception cref="AppFriendlyException"></exception>
|
||||||
[NonAction]
|
[NonAction]
|
||||||
public async Task<Result> CarryBind(CarryBindInput input)
|
public async Task<Result> CarryBind(CarryBindInput input, ISqlSugarClient dbConn = null)
|
||||||
{
|
{
|
||||||
bool isOk = false;
|
bool isOk = false;
|
||||||
|
|
||||||
|
var db = _db;
|
||||||
|
if (dbConn != null)
|
||||||
|
db = dbConn;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (input == null)
|
if (input == null)
|
||||||
@@ -210,24 +214,24 @@ namespace Tnb.WarehouseMgr
|
|||||||
throw new ArgumentNullException(nameof(input));
|
throw new ArgumentNullException(nameof(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
await _db.Ado.BeginTranAsync();
|
await db.Ado.BeginTranAsync();
|
||||||
WmsCarryH? carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
|
WmsCarryH? carry = await db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
|
||||||
WmsCarryH? subCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.membercarry_id);
|
WmsCarryH? subCarry = await db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.membercarry_id);
|
||||||
if (carry != null && subCarry != null)
|
if (carry != null && subCarry != null)
|
||||||
{
|
{
|
||||||
// 插入子载具绑定记录
|
// 插入子载具绑定记录
|
||||||
VisualDevModelDataCrInput visualDevModelCrInput = new() { data = new Dictionary<string, object>() };
|
//VisualDevModelDataCrInput visualDevModelCrInput = new() { data = new Dictionary<string, object>() };
|
||||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.carry_id)] = input.carry_id;
|
//visualDevModelCrInput.data[nameof(WmsCarrybindH.carry_id)] = input.carry_id;
|
||||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.carry_code)] = input.carry_code;
|
//visualDevModelCrInput.data[nameof(WmsCarrybindH.carry_code)] = input.carry_code;
|
||||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_id)] = input.membercarry_id;
|
//visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_id)] = input.membercarry_id;
|
||||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_code)] = input.membercarry_code;
|
//visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_code)] = input.membercarry_code;
|
||||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.type)] = 0;
|
//visualDevModelCrInput.data[nameof(WmsCarrybindH.type)] = 0;
|
||||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.carrystd_id)] = carry.carrystd_id;
|
//visualDevModelCrInput.data[nameof(WmsCarrybindH.carrystd_id)] = carry.carrystd_id;
|
||||||
//visualDevModelCrInput.data[nameof(WmsCarrybindH.create_id)] = input.create_id;
|
////visualDevModelCrInput.data[nameof(WmsCarrybindH.create_id)] = input.create_id;
|
||||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.create_time)] = DateTime.Now;
|
//visualDevModelCrInput.data[nameof(WmsCarrybindH.create_time)] = DateTime.Now;
|
||||||
visualDevModelCrInput.data[nameof(WmsCarrybindH.loc)] = 1;
|
//visualDevModelCrInput.data[nameof(WmsCarrybindH.loc)] = 1;
|
||||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYBIND_ID, true);
|
//VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYBIND_ID, true);
|
||||||
await _runService.Create(templateEntity, visualDevModelCrInput);
|
//await _runService.Create(templateEntity, visualDevModelCrInput);
|
||||||
|
|
||||||
WmsCarryD wmsCarryD = new()
|
WmsCarryD wmsCarryD = new()
|
||||||
{
|
{
|
||||||
@@ -237,14 +241,14 @@ namespace Tnb.WarehouseMgr
|
|||||||
loc = 1,
|
loc = 1,
|
||||||
create_time = DateTime.Now
|
create_time = DateTime.Now
|
||||||
};
|
};
|
||||||
int row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync();
|
int row = await db.Insertable(wmsCarryD).ExecuteCommandAsync();
|
||||||
isOk = row > 0;
|
isOk = row > 0;
|
||||||
if (!isOk)
|
if (!isOk)
|
||||||
{
|
{
|
||||||
throw Oops.Oh(ErrorCode.COM1001);
|
throw Oops.Oh(ErrorCode.COM1001);
|
||||||
}
|
}
|
||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
await db.Ado.CommitTranAsync();
|
||||||
Logger.LogError($"【CarryBind】 {input.membercarry_code}成功绑定到{input.carry_code}");
|
Logger.LogError($"【CarryBind】 {input.membercarry_code}成功绑定到{input.carry_code}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -259,7 +263,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
Logger.LogError($"【CarryBind】 {ex.Message}");
|
Logger.LogError($"【CarryBind】 {ex.Message}");
|
||||||
Logger.LogError($"【CarryBind】 {ex.StackTrace}");
|
Logger.LogError($"【CarryBind】 {ex.StackTrace}");
|
||||||
await _db.Ado.RollbackTranAsync();
|
await db.Ado.RollbackTranAsync();
|
||||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,9 +129,14 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <exception cref="ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
/// <exception cref="AppFriendlyException"></exception>
|
/// <exception cref="AppFriendlyException"></exception>
|
||||||
[NonAction]
|
[NonAction]
|
||||||
public async Task<Result> CarryUnbind(CarryBindInput input)
|
public async Task<Result> CarryUnbind(CarryBindInput input, ISqlSugarClient dbConn = null)
|
||||||
{
|
{
|
||||||
bool isOk = false;
|
bool isOk = false;
|
||||||
|
|
||||||
|
var db = _db;
|
||||||
|
if (dbConn != null)
|
||||||
|
db = dbConn;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (input == null)
|
if (input == null)
|
||||||
@@ -139,17 +144,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
throw new ArgumentNullException(nameof(input));
|
throw new ArgumentNullException(nameof(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
WmsCarryH? carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
|
WmsCarryH? carry = await db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
|
||||||
if (carry != null)
|
if (carry != null)
|
||||||
{
|
{
|
||||||
int row = await _db.Deleteable<WmsCarryD>().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync();
|
|
||||||
isOk = row > 0;
|
|
||||||
|
|
||||||
if (!isOk)
|
|
||||||
{
|
|
||||||
throw new Exception($"料架id{input.carry_id}载具解绑失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 插入子载具绑定记录
|
// 插入子载具绑定记录
|
||||||
//VisualDevModelDataCrInput visualDevModelCrInput = new() { data = new Dictionary<string, object>() };
|
//VisualDevModelDataCrInput visualDevModelCrInput = new() { data = new Dictionary<string, object>() };
|
||||||
@@ -167,7 +164,18 @@ namespace Tnb.WarehouseMgr
|
|||||||
//VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYUNBIND_ID, true);
|
//VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYUNBIND_ID, true);
|
||||||
//await _runService.Create(templateEntity, visualDevModelCrInput);
|
//await _runService.Create(templateEntity, visualDevModelCrInput);
|
||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
|
||||||
|
int row = await db.Deleteable<WmsCarryD>().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync();
|
||||||
|
//isOk = row > 0;
|
||||||
|
|
||||||
|
//if (!isOk)
|
||||||
|
//{
|
||||||
|
// throw new Exception($"料架id{input.carry_id}载具解绑失败");
|
||||||
|
//}
|
||||||
|
Logger.LogInformation($"【CarryUnbind】料架{carry.carry_code}已解绑,解绑条数{row}");
|
||||||
|
|
||||||
|
|
||||||
|
await db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -181,7 +189,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
Logger.LogError($"【CarryUnbind】 {ex.Message}");
|
Logger.LogError($"【CarryUnbind】 {ex.Message}");
|
||||||
Logger.LogError($"【CarryUnbind】 {ex.StackTrace}");
|
Logger.LogError($"【CarryUnbind】 {ex.StackTrace}");
|
||||||
await _db.Ado.RollbackTranAsync();
|
await db.Ado.RollbackTranAsync();
|
||||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,9 +204,14 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <exception cref="ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
/// <exception cref="AppFriendlyException"></exception>
|
/// <exception cref="AppFriendlyException"></exception>
|
||||||
[NonAction]
|
[NonAction]
|
||||||
public async Task<Result> CarryCodeUnbind(CarryCodeUnbindInput input)
|
public async Task<Result> CarryCodeUnbind(CarryCodeUnbindInput input, ISqlSugarClient dbConn = null)
|
||||||
{
|
{
|
||||||
bool isOk = false;
|
bool isOk = false;
|
||||||
|
|
||||||
|
var db = _db;
|
||||||
|
if (dbConn != null)
|
||||||
|
db = dbConn;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (input == null)
|
if (input == null)
|
||||||
@@ -206,16 +219,17 @@ namespace Tnb.WarehouseMgr
|
|||||||
throw new ArgumentNullException(nameof(input));
|
throw new ArgumentNullException(nameof(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
WmsCarryH? carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
|
WmsCarryH? carry = await db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
|
||||||
if (carry != null)
|
if (carry != null)
|
||||||
{
|
{
|
||||||
int row = await _db.Deleteable<WmsCarryCode>().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync();
|
int row = await db.Deleteable<WmsCarryCode>().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync();
|
||||||
isOk = row > 0;
|
isOk = row > 0;
|
||||||
|
|
||||||
if (!isOk)
|
Logger.LogInformation($"【CarryCodeUnbind】载具{carry.carry_code}已解绑,解绑条数{row}");
|
||||||
{
|
//if (!isOk)
|
||||||
throw Oops.Oh(ErrorCode.COM1001);
|
//{
|
||||||
}
|
// throw Oops.Oh(ErrorCode.COM1001);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -196,10 +196,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
//更新页面
|
//更新页面
|
||||||
//赋值签收状态
|
//赋值签收状态
|
||||||
Logger.Information($"空载具出库生成的预任务数量:{preTasks.Count}");
|
Logger.Information($"空载具出库生成的预任务数量:{preTasks.Count}");
|
||||||
if (loc.is_sign == 0)
|
//if (loc.is_sign == 0)
|
||||||
{
|
//{
|
||||||
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
// preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
||||||
}
|
//}
|
||||||
isOk = await _wareHouseService.GenPreTask(preTasks, null!);
|
isOk = await _wareHouseService.GenPreTask(preTasks, null!);
|
||||||
|
|
||||||
if (isOk)
|
if (isOk)
|
||||||
|
|||||||
@@ -594,6 +594,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
// 更新已转数量
|
// 更新已转数量
|
||||||
bool isOk = await _db.Updateable<WmsMaterialTransferD>().SetColumns(it => new WmsMaterialTransferD { yzqty = it.yzqty + wmsCarryCodes.Sum(r => r.codeqty) })
|
bool isOk = await _db.Updateable<WmsMaterialTransferD>().SetColumns(it => new WmsMaterialTransferD { yzqty = it.yzqty + wmsCarryCodes.Sum(r => r.codeqty) })
|
||||||
.Where(it => it.id == input.source_id).ExecuteCommandHasChangeAsync();
|
.Where(it => it.id == input.source_id).ExecuteCommandHasChangeAsync();
|
||||||
@@ -616,13 +617,16 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
throw Oops.Oh(ErrorCode.COM1001);
|
throw Oops.Oh(ErrorCode.COM1001);
|
||||||
}
|
}
|
||||||
await sign(input);
|
|
||||||
|
if (input.area_code == "E")
|
||||||
|
await sign(input);
|
||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
Logger.LogError("【WmsPrdReturnService ModifyAsync】" + ex.Message);
|
Logger.LogError("【WmsMaterialTransferService ModifyAsync】" + ex.Message);
|
||||||
Logger.LogError("【WmsPrdReturnService ModifyAsync】" + ex.StackTrace);
|
Logger.LogError("【WmsMaterialTransferService ModifyAsync】" + ex.StackTrace);
|
||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -654,42 +658,39 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
List<WmsMaterialTransferD> wmsMaterialTransferds = _db.Queryable<WmsMaterialTransferD>().Where(r => r.bill_id == input.source_id).ToList();
|
List<WmsMaterialTransferD> wmsMaterialTransferds = _db.Queryable<WmsMaterialTransferD>().Where(r => r.bill_id == input.source_id).ToList();
|
||||||
|
|
||||||
|
int count = wmsMaterialTransferds.Where(r => string.IsNullOrEmpty(r.station_code)).Count();
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
Logger.LogWarning($@"转库单{wmsMaterialTransfer.bill_code}表体存在未填写工位的明细!");
|
||||||
|
throw new AppFriendlyException($@"转库单{wmsMaterialTransfer.bill_code}表体存在未填写工位的明细!", 500);
|
||||||
|
}
|
||||||
|
|
||||||
// 转库单载具子表
|
// 转库单载具子表
|
||||||
List<WmsMaterialTransferCarry> wmsMaterialTransferCarrys = new List<WmsMaterialTransferCarry>();
|
List<WmsMaterialTransferCarry> wmsMaterialTransferCarrys = new List<WmsMaterialTransferCarry>();
|
||||||
|
|
||||||
foreach (WmsMaterialTransferD wmsMaterialTransferD in wmsMaterialTransferds)
|
foreach (WmsMaterialTransferD wmsMaterialTransferD in wmsMaterialTransferds)
|
||||||
{
|
{
|
||||||
//出库取起点,获取所有符合输入的载具规格的载具
|
|
||||||
OutStockStrategyQuery OutStockStrategyInput = new()
|
|
||||||
{
|
|
||||||
warehouse_id = "2",
|
|
||||||
material_id = wmsMaterialTransferD.material_id,
|
|
||||||
code_batch = wmsMaterialTransferD.code_batch
|
|
||||||
};
|
|
||||||
List<WmsCarryH>? carrys = await _wareHouseService.OutStockStrategyZCC2Floor2(OutStockStrategyInput);
|
|
||||||
|
|
||||||
// 需要转库数量
|
// 需要转库数量
|
||||||
decimal? needOut = wmsMaterialTransferD.qty;
|
decimal? needOut = wmsMaterialTransferD.qty;
|
||||||
|
|
||||||
foreach (WmsCarryH wmsCarryH in carrys)
|
//出库取起点,获取所有符合输入的载具规格的载具
|
||||||
|
OutStockStrategyZCC2Floor2Query OutStockStrategyInput = new()
|
||||||
{
|
{
|
||||||
if (needOut <= 0)
|
warehouse_id = "2",
|
||||||
{
|
material_id = wmsMaterialTransferD.material_id,
|
||||||
break;
|
code_batch = wmsMaterialTransferD.code_batch,
|
||||||
}
|
needOut = needOut,
|
||||||
|
material_code = wmsMaterialTransferD.material_code
|
||||||
|
|
||||||
List<WmsCarryCode> wmsCarryCodes = _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsCarryH.id).ToList();
|
};
|
||||||
|
List<Tuple<WmsCarryH, decimal, BasLocation>>? carrys = await _wareHouseService.OutStockStrategyZCC2Floor2(OutStockStrategyInput);
|
||||||
|
|
||||||
WmsCarryCode wmsCarryCode = wmsCarryCodes.First();
|
|
||||||
|
|
||||||
// 目前只支持一个料箱只有一个物料
|
foreach (var item in carrys)
|
||||||
foreach (WmsCarryCode _wmsCarryCode in wmsCarryCodes)
|
{
|
||||||
{
|
WmsCarryH wmsCarryH = item.Item1;
|
||||||
needOut -= wmsCarryCode.codeqty;
|
decimal codeqty = item.Item2;
|
||||||
}
|
BasLocation endlocation_ssx = item.Item3;
|
||||||
|
|
||||||
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();
|
|
||||||
|
|
||||||
// 转库单载具子表
|
// 转库单载具子表
|
||||||
WmsMaterialTransferCarry wmsMaterialTransferCarry = new WmsMaterialTransferCarry();
|
WmsMaterialTransferCarry wmsMaterialTransferCarry = new WmsMaterialTransferCarry();
|
||||||
@@ -703,14 +704,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
wmsMaterialTransferCarry.startlocation_id = wmsCarryH.location_id;
|
wmsMaterialTransferCarry.startlocation_id = wmsCarryH.location_id;
|
||||||
wmsMaterialTransferCarry.startlocation_code = wmsCarryH.location_code;
|
wmsMaterialTransferCarry.startlocation_code = wmsCarryH.location_code;
|
||||||
wmsMaterialTransferCarry.mat_bill_id = wmsMaterialTransferD.id;
|
wmsMaterialTransferCarry.mat_bill_id = wmsMaterialTransferD.id;
|
||||||
wmsMaterialTransferCarry.qty = wmsCarryCode.codeqty;
|
wmsMaterialTransferCarry.qty = codeqty;
|
||||||
wmsMaterialTransferCarrys.Add(wmsMaterialTransferCarry);
|
wmsMaterialTransferCarrys.Add(wmsMaterialTransferCarry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needOut > 0)
|
|
||||||
{
|
|
||||||
throw new AppFriendlyException($"物料{wmsMaterialTransferD.material_code}没有足够的库存!,缺失数量为{needOut}", 500);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
@@ -724,7 +720,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
Logger.LogInformation($"【DistributeToZCC】更新转库单{wmsMaterialTransfer.bill_code}主表的数据");
|
Logger.LogInformation($"【DistributeToZCC】更新转库单{wmsMaterialTransfer.bill_code}主表的数据");
|
||||||
|
|
||||||
await _db.Insertable(wmsMaterialTransferCarrys).ExecuteCommandAsync();
|
await _db.Insertable(wmsMaterialTransferCarrys).ExecuteCommandAsync();
|
||||||
Logger.LogInformation($"【DistributeToZCC插入转库单{wmsMaterialTransfer.bill_code}载具表的数据");
|
Logger.LogInformation($"【DistributeToZCC】插入转库单{wmsMaterialTransfer.bill_code}载具表的数据");
|
||||||
|
|
||||||
foreach (WmsMaterialTransferCarry wmsMaterialTransferCarry in wmsMaterialTransferCarrys)
|
foreach (WmsMaterialTransferCarry wmsMaterialTransferCarry in wmsMaterialTransferCarrys)
|
||||||
{
|
{
|
||||||
@@ -846,7 +842,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
//BasLocation endlocation = _db.Queryable<BasLocation>().Where(r => r.location_code == wmsCarryH.work_station).First();
|
//BasLocation endlocation = _db.Queryable<BasLocation>().Where(r => r.location_code == wmsCarryH.work_station).First();
|
||||||
|
|
||||||
WmsPretaskH wmsPretaskH = _db.Queryable<WmsPretaskH>().Where(r => r.carry_code == wmsCarryH.carry_code && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID).First();
|
WmsPretaskH wmsPretaskH = _db.Queryable<WmsPretaskH>().Where(r => r.carry_code == wmsCarryH.carry_code && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID).First();
|
||||||
if (wmsPretaskH != null)
|
if (wmsPretaskH != null)
|
||||||
{
|
{
|
||||||
Logger.LogWarning($"【CallRackToProductionLine】此料架{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!");
|
Logger.LogWarning($"【CallRackToProductionLine】此料架{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!");
|
||||||
@@ -893,7 +889,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<WmsCarryH> wmsCarryHs = _db.Queryable<WmsCarryH>().Where(r => r.work_station == input.work_station).ToList();
|
List<WmsCarryH> wmsCarryHs = _db.Queryable<WmsCarryH>().Where(r => r.work_station == input.work_station && r.is_lock == 0
|
||||||
|
&& (r.carry_status == ((int)(EnumCarryStatus.占用)).ToString() || r.carry_status == ((int)(EnumCarryStatus.齐套)).ToString())).ToList();
|
||||||
if (string.IsNullOrEmpty(input.work_station))
|
if (string.IsNullOrEmpty(input.work_station))
|
||||||
{
|
{
|
||||||
Logger.LogWarning($"【RackAndMatByWorkstation】工位不能为空!");
|
Logger.LogWarning($"【RackAndMatByWorkstation】工位不能为空!");
|
||||||
@@ -1053,7 +1050,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
_carryBindInput.membercarry_id = membercarry.id;
|
_carryBindInput.membercarry_id = membercarry.id;
|
||||||
_carryBindInput.membercarry_code = membercarry.carry_code;
|
_carryBindInput.membercarry_code = membercarry.carry_code;
|
||||||
_carryBindInput.carrystd_id = wmsCarryH.carrystd_id;
|
_carryBindInput.carrystd_id = wmsCarryH.carrystd_id;
|
||||||
var resCarrybind = await _wmsCarryBindService.CarryBind(_carryBindInput);
|
var resCarrybind = await _wmsCarryBindService.CarryBind(_carryBindInput, _db);
|
||||||
if (resCarrybind.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
if (resCarrybind.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException($"绑定料箱到料架失败 载具 {input.carry_code}", 500);
|
throw new AppFriendlyException($"绑定料箱到料架失败 载具 {input.carry_code}", 500);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using JNPF.Common.Core.Manager;
|
using Aop.Api.Domain;
|
||||||
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Dtos.VisualDev;
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
using JNPF.Common.Enums;
|
using JNPF.Common.Enums;
|
||||||
using JNPF.Common.Extension;
|
using JNPF.Common.Extension;
|
||||||
@@ -10,6 +11,7 @@ using JNPF.VisualDev.Entitys;
|
|||||||
using JNPF.VisualDev.Interfaces;
|
using JNPF.VisualDev.Interfaces;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
@@ -377,9 +379,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
[HttpPost, NonUnify, AllowAnonymous]
|
[HttpPost, NonUnify, AllowAnonymous]
|
||||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> FinishproductOutstockSign(FinishproductOutstockSignInput input)
|
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> FinishproductOutstockSign(FinishproductOutstockSignInput input)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(input.location_id))
|
Logger.LogInformation($"【FinishproductOutstockSign】载具签收 {input.carry_code}");
|
||||||
|
if (string.IsNullOrEmpty(input.carry_code))
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("起点id不可为空", 500);
|
throw new AppFriendlyException("请扫描载具", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (!_wareHouseService.GetFloor1OutstockLocation().Contains(input.location_id))
|
//if (!_wareHouseService.GetFloor1OutstockLocation().Contains(input.location_id))
|
||||||
@@ -390,26 +393,51 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
WmsCarryH wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).First();
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(wmsCarryH.location_id))
|
||||||
|
{
|
||||||
|
Logger.Error($"【FinishproductOutstockSign】载具 {input.carry_code}没有当前库位 不能签收!");
|
||||||
|
throw new AppFriendlyException("FinishproductOutstockSign】载具 {input.carry_code}没有当前库位 不能签收!", 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
await _db.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
|
||||||
|
{
|
||||||
|
is_lock = 0,
|
||||||
|
carry_status = "0"
|
||||||
|
}).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
|
||||||
|
|
||||||
await _db.Updateable<BasLocation>().SetColumns(r => new BasLocation
|
await _db.Updateable<BasLocation>().SetColumns(r => new BasLocation
|
||||||
{
|
{
|
||||||
is_lock = 0,
|
is_lock = 0,
|
||||||
is_use = "0"
|
is_use = "0"
|
||||||
}).Where(r => r.id == input.location_id).ExecuteCommandAsync();
|
}).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))
|
||||||
|
{
|
||||||
|
Logger.Error($"【FinishproductOutstockSign】库位id {wmsCarryH.location_id}没有对应的库位基础资料!");
|
||||||
|
throw new AppFriendlyException("【FinishproductOutstockSign】库位id {wmsCarryH.location_id}没有对应的库位基础资料!", 500);
|
||||||
|
}
|
||||||
await _db.Updateable<WmsPointH>().SetColumns(r => new WmsPointH
|
await _db.Updateable<WmsPointH>().SetColumns(r => new WmsPointH
|
||||||
{
|
{
|
||||||
is_lock = 0
|
is_lock = 0
|
||||||
}).Where(r => r.location_id == input.location_id).ExecuteCommandAsync();
|
}).Where(r => r.location_id == location.id).ExecuteCommandAsync();
|
||||||
|
|
||||||
WmsCarryH wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.location_id == input.location_id).First();
|
|
||||||
CarryCodeUnbindInput carryCodeUnbindInput = new CarryCodeUnbindInput();
|
CarryCodeUnbindInput carryCodeUnbindInput = new CarryCodeUnbindInput();
|
||||||
carryCodeUnbindInput.carry_id = wmsCarryH.id;
|
carryCodeUnbindInput.carry_id = wmsCarryH.id;
|
||||||
await _wmsCarryUnbindService.CarryCodeUnbind(carryCodeUnbindInput);
|
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result = await _wmsCarryUnbindService.CarryCodeUnbind(carryCodeUnbindInput, _db);
|
||||||
|
if (result.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
Logger.Error($"【FinishproductOutstockSign】载具 {input.carry_code}解绑失败!");
|
||||||
|
throw new AppFriendlyException("【FinishproductOutstockSign】载具 {input.carry_code}解绑失败!", 500);
|
||||||
|
}
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Logger.Error($"【FinishproductOutstockSign】 {ex.Message}");
|
||||||
|
Logger.Error($"【FinishproductOutstockSign】 {ex.StackTrace}");
|
||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
ptc.code_batch = instockCode.code_batch;
|
ptc.code_batch = instockCode.code_batch;
|
||||||
pretaskCodes.Add(ptc);
|
pretaskCodes.Add(ptc);
|
||||||
}
|
}
|
||||||
bool isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
bool isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes, _dbScanInStockByRedis);
|
||||||
if (isOk)
|
if (isOk)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -616,7 +616,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
//回更状态
|
//回更状态
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
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 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 });
|
it => new BasLocation { is_lock = 1 }, _dbScanInStockByRedis);
|
||||||
_ = 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<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 _dbScanInStockByRedis.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == instock!.id).ExecuteCommandAsync();
|
||||||
|
|
||||||
@@ -625,6 +625,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
await _dbScanInStockByRedis.Ado.CommitTranAsync();
|
await _dbScanInStockByRedis.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
|
// 测试代码 后期删
|
||||||
catch (AggregateException ex)
|
catch (AggregateException ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine("【ScanInStockByRedis】 AggregateException" + ex.Message);
|
Console.WriteLine("【ScanInStockByRedis】 AggregateException" + ex.Message);
|
||||||
@@ -637,7 +638,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
Logger.LogInformation($"【ScanInStockByRedis】 八工位扫到码发送入库请求发生异常:{ex.Message}");
|
Logger.LogInformation($"【ScanInStockByRedis】 八工位扫到码发送入库请求发生异常:{ex.Message}");
|
||||||
|
|
||||||
// 测试代码
|
// 测试代码 后期删
|
||||||
if (ex.Message.Contains("Connection is busy"))
|
if (ex.Message.Contains("Connection is busy"))
|
||||||
_dbScanInStockByRedis = _dbScanInStockByRedis.CopyNew();
|
_dbScanInStockByRedis = _dbScanInStockByRedis.CopyNew();
|
||||||
|
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ using Tnb.WarehouseMgr.Interfaces;
|
|||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 载具解绑
|
|
||||||
/// </summary>
|
|
||||||
[OverideVisualDev(ModuleConsts.MODULE_WMSPRDRETURN_ID)]
|
[OverideVisualDev(ModuleConsts.MODULE_WMSPRDRETURN_ID)]
|
||||||
[ServiceModule(BizTypeId)]
|
[ServiceModule(BizTypeId)]
|
||||||
public class WmsPrdReturnService : BaseWareHouseService, IWmsPrdReturnService
|
public class WmsPrdReturnService : BaseWareHouseService, IWmsPrdReturnService
|
||||||
@@ -169,19 +166,24 @@ namespace Tnb.WarehouseMgr
|
|||||||
throw new AppFriendlyException($"【PrdReturn】存在装有与生产退料单明细不匹配物料的料箱,请检查!{msg.Trim(',')}", 500);
|
throw new AppFriendlyException($"【PrdReturn】存在装有与生产退料单明细不匹配物料的料箱,请检查!{msg.Trim(',')}", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
WmsPretaskH wmsPretaskH = _db.Queryable<WmsPretaskH>().Where(r => r.carry_code == wmsCarryH.carry_code && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID).First();
|
WmsPretaskH wmsPretaskH = _db.Queryable<WmsPretaskH>().Where(r => r.carry_code == wmsCarryH.carry_code && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID).First();
|
||||||
if (wmsPretaskH != null)
|
if (wmsPretaskH != null)
|
||||||
{
|
{
|
||||||
Logger.LogWarning($"【CallRackToProductionLine】此料架{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!");
|
Logger.LogWarning($"【PrdReturn】此料架{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!");
|
||||||
throw new AppFriendlyException($"此料架{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!", 500);
|
throw new AppFriendlyException($"此料架{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
// 标记为退料
|
// 标记为退料
|
||||||
await _db.Updateable<WmsCarryH>().SetColumns(r => r.need_return == 1).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
|
int row2= await _db.Updateable<WmsCarryH>().SetColumns(r => r.carry_status == ((int)(EnumCarryStatus.退料)).ToString()).Where(r => r.carry_code == wmsCarryH.carry_code).ExecuteCommandAsync();
|
||||||
|
if (row2 == 0)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException($"【PrdReturn】 料架 {wmsCarryH.carry_code} 退料状态回写失败", 500);
|
||||||
|
}
|
||||||
|
Logger.LogInformation($"【PrdReturn】料架 {wmsCarryH.carry_code} 退料状态回写成功!");
|
||||||
|
|
||||||
Logger.LogWarning($"【RackEmptyInstock】绑定料箱到料架");
|
Logger.LogInformation($"【PrdReturn】绑定料箱到料架");
|
||||||
|
|
||||||
List<WmsCarryH> membercarrys = _db.Queryable<WmsCarryH>().Where(r => input.details.Select(r => r.carry_code).Contains(r.carry_code)).ToList();
|
List<WmsCarryH> membercarrys = _db.Queryable<WmsCarryH>().Where(r => input.details.Select(r => r.carry_code).Contains(r.carry_code)).ToList();
|
||||||
foreach (WmsCarryH membercarry in membercarrys)
|
foreach (WmsCarryH membercarry in membercarrys)
|
||||||
@@ -193,7 +195,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
_carryBindInput.membercarry_id = membercarry.id;
|
_carryBindInput.membercarry_id = membercarry.id;
|
||||||
_carryBindInput.membercarry_code = membercarry.carry_code;
|
_carryBindInput.membercarry_code = membercarry.carry_code;
|
||||||
_carryBindInput.carrystd_id = wmsCarryH.carrystd_id;
|
_carryBindInput.carrystd_id = wmsCarryH.carrystd_id;
|
||||||
var resCarrybind = await _wmsCarryBindService.CarryBind(_carryBindInput);
|
var resCarrybind = await _wmsCarryBindService.CarryBind(_carryBindInput, _db);
|
||||||
if (resCarrybind.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
if (resCarrybind.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException($"绑定料箱到料架失败 载具 {input.carry_code}", 500);
|
throw new AppFriendlyException($"绑定料箱到料架失败 载具 {input.carry_code}", 500);
|
||||||
@@ -292,18 +294,23 @@ namespace Tnb.WarehouseMgr
|
|||||||
throw new AppFriendlyException($"【PrdReturn】存在装有与生产退料单明细不匹配物料的料架/载运小车,请检查!{msg.Trim(',')}", 500);
|
throw new AppFriendlyException($"【PrdReturn】存在装有与生产退料单明细不匹配物料的料架/载运小车,请检查!{msg.Trim(',')}", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
WmsPretaskH wmsPretaskH = _db.Queryable<WmsPretaskH>().Where(r => r.carry_code == wmsCarryH.carry_code && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID).First();
|
WmsPretaskH wmsPretaskH = _db.Queryable<WmsPretaskH>().Where(r => r.carry_code == wmsCarryH.carry_code && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID).First();
|
||||||
if (wmsPretaskH != null)
|
if (wmsPretaskH != null)
|
||||||
{
|
{
|
||||||
Logger.LogWarning($"【CallRackToProductionLine】此料架/载运小车{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!");
|
Logger.LogWarning($"【PrdReturn】此料架/载运小车{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!");
|
||||||
throw new AppFriendlyException($"此料架/载运小车{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!", 500);
|
throw new AppFriendlyException($"此料架/载运小车{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}!", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
// 标记为退料
|
// 标记为退料
|
||||||
await _db.Updateable<WmsCarryH>().SetColumns(r => r.need_return == 1).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
|
int row2 =await _db.Updateable<WmsCarryH>().SetColumns(r => r.carry_status == ((int)(EnumCarryStatus.退料)).ToString()).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
|
||||||
|
if (row2 == 0)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException($"【PrdReturn】 料架 {wmsCarryH.carry_code} 退料状态回写失败", 500);
|
||||||
|
}
|
||||||
|
Logger.LogInformation($"【PrdReturn】料架 {wmsCarryH.carry_code} 退料状态回写成功!");
|
||||||
|
|
||||||
Logger.LogWarning($"【PrdReturn】开始生成预任务");
|
Logger.LogInformation($"【PrdReturn】开始生成预任务");
|
||||||
CommonCreatePretaskInput commonCreatePretaskInput = new();
|
CommonCreatePretaskInput commonCreatePretaskInput = new();
|
||||||
commonCreatePretaskInput.startlocation_id = startlocation.id;
|
commonCreatePretaskInput.startlocation_id = startlocation.id;
|
||||||
commonCreatePretaskInput.endlocation_id = endlocation.id;
|
commonCreatePretaskInput.endlocation_id = endlocation.id;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
//Oracle
|
//Oracle
|
||||||
//"DefaultConnection": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1}))(CONNECT_DATA=(SERVER = DEDICATED)(SERVICE_NAME={2})));User Id={3};Password={4}"
|
//"DefaultConnection": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1}))(CONNECT_DATA=(SERVER = DEDICATED)(SERVICE_NAME={2})));User Id={3};Password={4}"
|
||||||
//PostgreSQL
|
//PostgreSQL
|
||||||
"DefaultConnection": "server={0};port={1};database={2};uid={3};pwd={4};pooling=true;"
|
"DefaultConnection": "server={0};port={1};database={2};uid={3};pwd={4};pooling=true;KeepAlive=60;ConnectionLifetime=300"
|
||||||
//MySql
|
//MySql
|
||||||
//"DefaultConnection": "server={0};port={1};database={2};uid={3};pwd={4};sslmode=none;pooling=true;charset=utf8mb4;allowLoadLocalInfile=true;allowPublicKeyRetrieval=true"
|
//"DefaultConnection": "server={0};port={1};database={2};uid={3};pwd={4};sslmode=none;pooling=true;charset=utf8mb4;allowLoadLocalInfile=true;allowPublicKeyRetrieval=true"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ public class BillRuleService : IBillRullService, IDynamicApiController, ITransie
|
|||||||
_fileManager = fileManager;
|
_fileManager = fileManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SemaphoreSlim s_getBillNumber = new(1);
|
|
||||||
|
|
||||||
#region Get
|
#region Get
|
||||||
|
|
||||||
@@ -278,8 +277,6 @@ public class BillRuleService : IBillRullService, IDynamicApiController, ITransie
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
s_getBillNumber.WaitAsync();
|
|
||||||
|
|
||||||
string cacheKey = string.Format("{0}{1}_{2}", CommonConst.CACHEKEYBILLRULE, _userManager.TenantId, _userManager.UserId + enCode);
|
string cacheKey = string.Format("{0}{1}_{2}", CommonConst.CACHEKEYBILLRULE, _userManager.TenantId, _userManager.UserId + enCode);
|
||||||
string strNumber = string.Empty;
|
string strNumber = string.Empty;
|
||||||
if (isCache)
|
if (isCache)
|
||||||
@@ -308,10 +305,6 @@ public class BillRuleService : IBillRullService, IDynamicApiController, ITransie
|
|||||||
Logging.Log.Error("【GetBillNumber】" + ex.StackTrace);
|
Logging.Log.Error("【GetBillNumber】" + ex.StackTrace);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
s_getBillNumber.Release();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -325,48 +318,52 @@ public class BillRuleService : IBillRullService, IDynamicApiController, ITransie
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<string> GetNumber(string enCode)
|
private async Task<string> GetNumber(string enCode)
|
||||||
{
|
{
|
||||||
StringBuilder strNumber = new StringBuilder();
|
using (ISqlSugarClient db = _repository.CopyNew())
|
||||||
var entity = await _repository.GetFirstAsync(m => m.EnCode == enCode && m.DeleteMark == null);
|
|
||||||
if (entity != null)
|
|
||||||
{
|
{
|
||||||
// 处理隔天流水号归0
|
StringBuilder strNumber = new StringBuilder();
|
||||||
if (entity.OutputNumber != null)
|
var entity = db.Queryable<BillRuleEntity>().Where(m => m.EnCode == enCode && m.DeleteMark == null).ToList()[0];
|
||||||
|
//var entity = await _repository.GetFirstAsync(m => m.EnCode == enCode && m.DeleteMark == null);
|
||||||
|
if (entity != null)
|
||||||
{
|
{
|
||||||
var serialDate = entity.OutputNumber.Remove(entity.OutputNumber.Length - (int)entity.Digit).Replace(entity.Prefix, string.Empty);
|
// 处理隔天流水号归0
|
||||||
var thisDate = entity.DateFormat == "no" ? string.Empty : DateTime.Now.ToString(entity.DateFormat);
|
if (entity.OutputNumber != null)
|
||||||
if (serialDate != thisDate)
|
|
||||||
{
|
{
|
||||||
entity.ThisNumber = 0;
|
var serialDate = entity.OutputNumber.Remove(entity.OutputNumber.Length - (int)entity.Digit).Replace(entity.Prefix, string.Empty);
|
||||||
|
var thisDate = entity.DateFormat == "no" ? string.Empty : DateTime.Now.ToString(entity.DateFormat);
|
||||||
|
if (serialDate != thisDate)
|
||||||
|
{
|
||||||
|
entity.ThisNumber = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entity.ThisNumber++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
entity.ThisNumber++;
|
entity.ThisNumber = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 拼接单据编码
|
||||||
|
// 前缀
|
||||||
|
strNumber.Append(entity.Prefix);
|
||||||
|
if (entity.DateFormat != "no")
|
||||||
|
strNumber.Append(DateTime.Now.ToString(entity.DateFormat)); // 日期格式
|
||||||
|
|
||||||
|
var number = int.Parse(entity.StartNumber) + entity.ThisNumber;
|
||||||
|
strNumber.Append(number.ToString().PadLeft((int)entity.Digit, '0')); // 流水号
|
||||||
|
entity.OutputNumber = strNumber.ToString();
|
||||||
|
var str = strNumber.ToString();
|
||||||
|
// 更新流水号
|
||||||
|
await db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).CallEntityMethod(m => m.LastModify()).ExecuteCommandHasChangeAsync();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
entity.ThisNumber = 0;
|
strNumber.Append("单据规则不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拼接单据编码
|
return strNumber.ToString();
|
||||||
// 前缀
|
|
||||||
strNumber.Append(entity.Prefix);
|
|
||||||
if (entity.DateFormat != "no")
|
|
||||||
strNumber.Append(DateTime.Now.ToString(entity.DateFormat)); // 日期格式
|
|
||||||
|
|
||||||
var number = int.Parse(entity.StartNumber) + entity.ThisNumber;
|
|
||||||
strNumber.Append(number.ToString().PadLeft((int)entity.Digit, '0')); // 流水号
|
|
||||||
entity.OutputNumber = strNumber.ToString();
|
|
||||||
var str = strNumber.ToString();
|
|
||||||
// 更新流水号
|
|
||||||
await _repository.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).CallEntityMethod(m => m.LastModify()).ExecuteCommandHasChangeAsync();
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
strNumber.Append("单据规则不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
return strNumber.ToString();
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user