二楼细节完善 bug处理

This commit is contained in:
2024-07-03 17:06:02 +08:00
parent 7fa009d599
commit 1b564293d1
16 changed files with 194 additions and 104 deletions

View File

@@ -26,6 +26,7 @@ using Microsoft.Extensions.Logging;
using NetTaste;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Npgsql;
using Org.BouncyCastle.Asn1.X509;
using Org.BouncyCastle.Asn1.X509.Qualified;
using Qiniu.Util;
@@ -91,16 +92,16 @@ namespace Tnb.ProductionMgr
private readonly IPrdInstockService _prdInstockService;
private readonly ISqlSugarRepository<RedisReadConfig> _repository;
private ISqlSugarClient db_Scantimer;
private readonly ISqlSugarClient db_CheckGettimer;
private readonly ISqlSugarClient db_SSXcodetimer;
private readonly ISqlSugarClient db_BGWCarrySupplementtimer;
private readonly ISqlSugarClient db_YCLGLDPJInstocktimer;
private readonly ISqlSugarClient db_YCLWXDPJInstocktimer;
private ISqlSugarClient db_CheckGettimer;
private ISqlSugarClient db_SSXcodetimer;
private ISqlSugarClient db_BGWCarrySupplementtimer;
private ISqlSugarClient db_YCLGLDPJInstocktimer;
private ISqlSugarClient db_YCLWXDPJInstocktimer;
private ISqlSugarClient db_Floor2UpMachinecodetimer;
private readonly ISqlSugarClient db_Floor2timer送空托到上升降区;
private readonly ISqlSugarClient db_Floor2timer送满托到下升降区;
private readonly ISqlSugarClient db_Floor2timer移走上升降区未生成预任务且满托的料架;
private readonly ISqlSugarClient db_Floor2timer移走下升降区未生成预任务且空托的料架;
private ISqlSugarClient db_Floor2timer送空托到上升降区;
private ISqlSugarClient db_Floor2timer送满托到下升降区;
private ISqlSugarClient db_Floor2timer移走上升降区未生成预任务且满托的料架;
private ISqlSugarClient db_Floor2timer移走下升降区未生成预任务且空托的料架;
private readonly IWmsPDAScanInStockService _wmsPDAScanInStock;
private readonly IUserManager _userManager;
private readonly IBillRullService _billRullService;
@@ -111,6 +112,14 @@ namespace Tnb.ProductionMgr
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
#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)
{
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.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)
{
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
{
@@ -980,13 +994,21 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
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();
}
}
catch (Exception ex)
{
// 测试代码 无问题后期删
if (ex.Message.Contains("Connection is busy") || ex.Message.Contains("Exception while reading from stream"))
if (ex.Message.Contains("Exception while reading from stream"))
{
LoggerFloor2UpDownMachine.LogError("【测试】重置连接");
db_Floor2UpMachinecodetimer.Close();
@@ -1195,6 +1217,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
return;
}
await db_Floor2timer送满托到下升降区.Ado.BeginTranAsync();
// 料架区
foreach (WmsMechanicalArmH wmsMechanicalArmH in WmsMechanicalArmHs)
@@ -1216,7 +1239,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
var item = r.FirstOrDefault();
// 空载具入库: 前面通过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();
}
@@ -1277,11 +1300,6 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
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送满托到下升降区);
if (!result)
{
@@ -1482,13 +1500,20 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
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.carry_id = wmsMechanicalArmH.rackid;
carryBindInput.carry_code = wmsMechanicalArmH.rackcode;
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)
{
throw new Exception(unbindResult.msg);
@@ -1668,6 +1693,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
#endregion
#endregion
public Task StartAsync(CancellationToken cancellationToken)
@@ -1694,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));
return Task.CompletedTask;
}

View File

@@ -16,7 +16,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
/// <summary>
/// 单据状态
/// </summary>
public string? biil_status { get; set; }
public string? bill_status { get; set; }
/// <summary>
/// 入库单创建日期

View File

@@ -38,6 +38,14 @@
/// 载具
/// </summary>
public List<String> carryIds { get; set; }
/// <summary>
/// 任务执行单号
/// </summary>
public string bill_code { get; set; }
/// <summary>
/// 任务执行区域
/// </summary>
public string area_code { get; set; }

View File

@@ -140,9 +140,4 @@ public partial class WmsCarryH : BaseEntity<string>
/// </summary>
public string? work_station { get; set; }
/// <summary>
/// 需要退料
/// </summary>
public int need_return { get; set; }
}

View File

@@ -10,5 +10,6 @@
= 3,
= 4,
= 5,
退 = 6,
}
}

View File

@@ -133,7 +133,7 @@ namespace Tnb.WarehouseMgr.Interfaces
/// // 二楼机械臂
/// </summary>
/// <returns></returns>
Task Floor2MechanicalComplete(WmsDistaskH disTask, string action);
Task Floor2MechanicalConfirm(WmsDistaskH disTask, string action);
/// <summary>
/// 二楼kiva把料架送到下升降机后生成中储仓入库任务

View File

@@ -1,4 +1,5 @@
using JNPF.Common.Dtos.VisualDev;
using SqlSugar;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
@@ -11,6 +12,6 @@ namespace Tnb.WarehouseMgr.Interfaces
{
Task<dynamic> CarryBind(VisualDevModelDataCrInput input);
Task<Result> CarryBind(CarryBindInput input);
Task<Result> CarryBind(CarryBindInput input, ISqlSugarClient dbConn = null);
}
}

View File

@@ -1,4 +1,5 @@
using JNPF.Common.Dtos.VisualDev;
using SqlSugar;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
@@ -9,7 +10,7 @@ namespace Tnb.WarehouseMgr.Interfaces
/// </summary>
public interface IWmsCarryUnbindService
{
Task<Result> CarryUnbind(CarryBindInput input);
Task<Result> CarryUnbind(CarryBindInput input, ISqlSugarClient dbConn = null);
Task<Result> CarryCodeUnbind(CarryCodeUnbindInput input);
}
}

View File

@@ -106,6 +106,20 @@ namespace Tnb.WarehouseMgr
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)
{
@@ -255,20 +269,49 @@ namespace Tnb.WarehouseMgr
{
Logger.Information("【UnloadConfirm】 接收到WCS放货确认信号..................");
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");
if (flag)
var dis = _db.Queryable<WmsDistaskH>().Where(P => P.bill_code == input.taskCode).First();
if (dis.area_code == "ZSCJ001")
{
await _wareHouseService.SsxControl(dis, "UNLOAD");
return await ToApiResult(HttpStatusCode.OK, "成功");
var flag = await _wareHouseService.Check(dis.endlocation_code, "UNLOAD");
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
{
/*var whereExp = Expressionable.Create<WmsElevatorH, WmsElevatorD, WmsDistaskH>()
@@ -598,8 +641,6 @@ namespace Tnb.WarehouseMgr
else
{
await _wareHouseService.SsxControl(disTask, "LOAD");
// 二楼机械臂
await _wareHouseService.Floor2MechanicalComplete(disTask, "LOAD");
}
}
else if (input.action == "UNLOAD")
@@ -612,8 +653,6 @@ namespace Tnb.WarehouseMgr
Logger.Information($"taskCompleUpInput json parameter:{JsonConvert.SerializeObject(taskCompleUpInput)}");
await _wareHouseService.TaskComplate(taskCompleUpInput);
await _wareHouseService.SsxControl(disTask, "UNLOAD");
// 二楼机械臂
await _wareHouseService.Floor2MechanicalComplete(disTask, "UNLOAD");
Logger.Information($"【TaskCallback】 Agv放货完成,任务编号:{string.Join(",", disTasks.Select(x => x.bill_code))}");
}

View File

@@ -867,7 +867,7 @@ namespace Tnb.WarehouseMgr
/// 二楼机械臂
/// </summary>
/// <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> rackAreaPointsDown = new List<string>();
@@ -2221,7 +2221,9 @@ namespace Tnb.WarehouseMgr
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!
, 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)
{

View File

@@ -199,10 +199,14 @@ namespace Tnb.WarehouseMgr
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="AppFriendlyException"></exception>
[NonAction]
public async Task<Result> CarryBind(CarryBindInput input)
public async Task<Result> CarryBind(CarryBindInput input, ISqlSugarClient dbConn = null)
{
bool isOk = false;
var db = _db;
if (dbConn != null)
db = dbConn;
try
{
if (input == null)
@@ -210,24 +214,24 @@ namespace Tnb.WarehouseMgr
throw new ArgumentNullException(nameof(input));
}
await _db.Ado.BeginTranAsync();
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);
await db.Ado.BeginTranAsync();
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);
if (carry != null && subCarry != null)
{
// 插入子载具绑定记录
VisualDevModelDataCrInput visualDevModelCrInput = new() { data = new Dictionary<string, object>() };
visualDevModelCrInput.data[nameof(WmsCarrybindH.carry_id)] = input.carry_id;
visualDevModelCrInput.data[nameof(WmsCarrybindH.carry_code)] = input.carry_code;
visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_id)] = input.membercarry_id;
visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_code)] = input.membercarry_code;
visualDevModelCrInput.data[nameof(WmsCarrybindH.type)] = 0;
visualDevModelCrInput.data[nameof(WmsCarrybindH.carrystd_id)] = carry.carrystd_id;
//visualDevModelCrInput.data[nameof(WmsCarrybindH.create_id)] = input.create_id;
visualDevModelCrInput.data[nameof(WmsCarrybindH.create_time)] = DateTime.Now;
visualDevModelCrInput.data[nameof(WmsCarrybindH.loc)] = 1;
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYBIND_ID, true);
await _runService.Create(templateEntity, visualDevModelCrInput);
//VisualDevModelDataCrInput visualDevModelCrInput = new() { data = new Dictionary<string, object>() };
//visualDevModelCrInput.data[nameof(WmsCarrybindH.carry_id)] = input.carry_id;
//visualDevModelCrInput.data[nameof(WmsCarrybindH.carry_code)] = input.carry_code;
//visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_id)] = input.membercarry_id;
//visualDevModelCrInput.data[nameof(WmsCarrybindH.membercarry_code)] = input.membercarry_code;
//visualDevModelCrInput.data[nameof(WmsCarrybindH.type)] = 0;
//visualDevModelCrInput.data[nameof(WmsCarrybindH.carrystd_id)] = carry.carrystd_id;
////visualDevModelCrInput.data[nameof(WmsCarrybindH.create_id)] = input.create_id;
//visualDevModelCrInput.data[nameof(WmsCarrybindH.create_time)] = DateTime.Now;
//visualDevModelCrInput.data[nameof(WmsCarrybindH.loc)] = 1;
//VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYBIND_ID, true);
//await _runService.Create(templateEntity, visualDevModelCrInput);
WmsCarryD wmsCarryD = new()
{
@@ -237,14 +241,14 @@ namespace Tnb.WarehouseMgr
loc = 1,
create_time = DateTime.Now
};
int row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync();
int row = await db.Insertable(wmsCarryD).ExecuteCommandAsync();
isOk = row > 0;
if (!isOk)
{
throw Oops.Oh(ErrorCode.COM1001);
}
await _db.Ado.CommitTranAsync();
await db.Ado.CommitTranAsync();
Logger.LogError($"【CarryBind】 {input.membercarry_code}成功绑定到{input.carry_code}");
}
else
@@ -259,7 +263,7 @@ namespace Tnb.WarehouseMgr
{
Logger.LogError($"【CarryBind】 {ex.Message}");
Logger.LogError($"【CarryBind】 {ex.StackTrace}");
await _db.Ado.RollbackTranAsync();
await db.Ado.RollbackTranAsync();
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
}

View File

@@ -129,9 +129,14 @@ namespace Tnb.WarehouseMgr
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="AppFriendlyException"></exception>
[NonAction]
public async Task<Result> CarryUnbind(CarryBindInput input)
public async Task<Result> CarryUnbind(CarryBindInput input, ISqlSugarClient dbConn = null)
{
bool isOk = false;
var db = _db;
if (dbConn != null)
db = dbConn;
try
{
if (input == null)
@@ -139,7 +144,7 @@ namespace Tnb.WarehouseMgr
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)
{
@@ -160,7 +165,7 @@ namespace Tnb.WarehouseMgr
//await _runService.Create(templateEntity, visualDevModelCrInput);
int row = await _db.Deleteable<WmsCarryD>().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync();
int row = await db.Deleteable<WmsCarryD>().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync();
//isOk = row > 0;
//if (!isOk)
@@ -170,7 +175,7 @@ namespace Tnb.WarehouseMgr
Logger.LogInformation($"【CarryUnbind】料架{carry.carry_code}已解绑,解绑条数{row}");
await _db.Ado.CommitTranAsync();
await db.Ado.CommitTranAsync();
}
else
{
@@ -184,7 +189,7 @@ namespace Tnb.WarehouseMgr
{
Logger.LogError($"【CarryUnbind】 {ex.Message}");
Logger.LogError($"【CarryUnbind】 {ex.StackTrace}");
await _db.Ado.RollbackTranAsync();
await db.Ado.RollbackTranAsync();
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
}

View File

@@ -196,10 +196,10 @@ namespace Tnb.WarehouseMgr
//更新页面
//赋值签收状态
Logger.Information($"空载具出库生成的预任务数量:{preTasks.Count}");
if (loc.is_sign == 0)
{
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
}
//if (loc.is_sign == 0)
//{
// preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
//}
isOk = await _wareHouseService.GenPreTask(preTasks, null!);
if (isOk)

View File

@@ -594,6 +594,7 @@ namespace Tnb.WarehouseMgr
return;
}
await _db.Ado.BeginTranAsync();
// 更新已转数量
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();
@@ -616,13 +617,16 @@ namespace Tnb.WarehouseMgr
{
throw Oops.Oh(ErrorCode.COM1001);
}
await sign(input);
if (input.area_code == "E")
await sign(input);
await _db.Ado.CommitTranAsync();
}
catch(Exception ex)
{
Logger.LogError("【WmsPrdReturnService ModifyAsync】" + ex.Message);
Logger.LogError("【WmsPrdReturnService ModifyAsync】" + ex.StackTrace);
Logger.LogError("【WmsMaterialTransferService ModifyAsync】" + ex.Message);
Logger.LogError("【WmsMaterialTransferService ModifyAsync】" + ex.StackTrace);
await _db.Ado.RollbackTranAsync();
}
}
@@ -709,7 +713,7 @@ namespace Tnb.WarehouseMgr
Logger.LogInformation($"【DistributeToZCC】更新转库单{wmsMaterialTransfer.bill_code}主表的数据");
await _db.Insertable(wmsMaterialTransferCarrys).ExecuteCommandAsync();
Logger.LogInformation($"【DistributeToZCC插入转库单{wmsMaterialTransfer.bill_code}载具表的数据");
Logger.LogInformation($"【DistributeToZCC插入转库单{wmsMaterialTransfer.bill_code}载具表的数据");
foreach (WmsMaterialTransferCarry wmsMaterialTransferCarry in wmsMaterialTransferCarrys)
{
@@ -831,7 +835,7 @@ namespace Tnb.WarehouseMgr
//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)
{
Logger.LogWarning($"【CallRackToProductionLine】此料架{wmsCarryH.carry_code}存在未完成的预任务{wmsPretaskH.bill_code}");
@@ -878,7 +882,8 @@ namespace Tnb.WarehouseMgr
{
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))
{
Logger.LogWarning($"【RackAndMatByWorkstation】工位不能为空");
@@ -1038,7 +1043,7 @@ namespace Tnb.WarehouseMgr
_carryBindInput.membercarry_id = membercarry.id;
_carryBindInput.membercarry_code = membercarry.carry_code;
_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)
{
throw new AppFriendlyException($"绑定料箱到料架失败 载具 {input.carry_code}", 500);

View File

@@ -25,9 +25,6 @@ using Tnb.WarehouseMgr.Interfaces;
namespace Tnb.WarehouseMgr
{
/// <summary>
/// 载具解绑
/// </summary>
[OverideVisualDev(ModuleConsts.MODULE_WMSPRDRETURN_ID)]
[ServiceModule(BizTypeId)]
public class WmsPrdReturnService : BaseWareHouseService, IWmsPrdReturnService
@@ -169,19 +166,24 @@ namespace Tnb.WarehouseMgr
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)
{
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);
}
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();
foreach (WmsCarryH membercarry in membercarrys)
@@ -193,7 +195,7 @@ namespace Tnb.WarehouseMgr
_carryBindInput.membercarry_id = membercarry.id;
_carryBindInput.membercarry_code = membercarry.carry_code;
_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)
{
throw new AppFriendlyException($"绑定料箱到料架失败 载具 {input.carry_code}", 500);
@@ -292,18 +294,23 @@ namespace Tnb.WarehouseMgr
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)
{
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);
}
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.startlocation_id = startlocation.id;
commonCreatePretaskInput.endlocation_id = endlocation.id;

View File

@@ -67,7 +67,6 @@ public class BillRuleService : IBillRullService, IDynamicApiController, ITransie
_fileManager = fileManager;
}
public SemaphoreSlim s_getBillNumber = new(1);
#region Get
@@ -278,8 +277,6 @@ public class BillRuleService : IBillRullService, IDynamicApiController, ITransie
{
try
{
s_getBillNumber.WaitAsync();
string cacheKey = string.Format("{0}{1}_{2}", CommonConst.CACHEKEYBILLRULE, _userManager.TenantId, _userManager.UserId + enCode);
string strNumber = string.Empty;
if (isCache)
@@ -308,10 +305,6 @@ public class BillRuleService : IBillRullService, IDynamicApiController, ITransie
Logging.Log.Error("【GetBillNumber】" + ex.StackTrace);
throw;
}
finally
{
s_getBillNumber.Release();
}
}
#endregion
@@ -325,8 +318,10 @@ public class BillRuleService : IBillRullService, IDynamicApiController, ITransie
/// <returns></returns>
private async Task<string> GetNumber(string enCode)
{
ISqlSugarClient db = _repository.CopyNew();
StringBuilder strNumber = new StringBuilder();
var entity = await _repository.GetFirstAsync(m => m.EnCode == enCode && m.DeleteMark == 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)
{
// 处理隔天流水号归0
@@ -359,7 +354,7 @@ public class BillRuleService : IBillRullService, IDynamicApiController, ITransie
entity.OutputNumber = strNumber.ToString();
var str = strNumber.ToString();
// 更新流水号
await _repository.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).CallEntityMethod(m => m.LastModify()).ExecuteCommandHasChangeAsync();
await db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).CallEntityMethod(m => m.LastModify()).ExecuteCommandHasChangeAsync();
}
else
{