Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -37,4 +37,10 @@
|
||||
public string result { get; set; }
|
||||
|
||||
}
|
||||
public class MaintainItemResult
|
||||
{
|
||||
public string item_name { get; set; }
|
||||
public string group_name { get; set; }
|
||||
public string result { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,5 +16,6 @@
|
||||
public string plan_start_time { get; set; }
|
||||
public string starttime { get; set; }
|
||||
|
||||
public string finishtime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,33 +196,35 @@ namespace Tnb.EquipMgr
|
||||
else
|
||||
{
|
||||
input.sidx = "b." + input.sidx;
|
||||
input.sort = "desc";
|
||||
}
|
||||
List<string> records = await _db.Queryable<ToolMoldMaintainItemRecord>().Select(p => p.plan_id + p.mold_id).ToListAsync();
|
||||
SqlSugarPagedList<PadMainListOutput> result = await _db.Queryable<ToolMoldMaintainPlanRelation>()
|
||||
.LeftJoin<ToolMoldMaintainPlan>((a, b) => a.maintain_plan_id == b.id)
|
||||
.LeftJoin<ToolMolds>((a, b, c) => a.mold_id == c.id)
|
||||
.LeftJoin<ToolMoldMaintainRunRecord>((a, b, c, d) => b.plan_code == d.plan_code && c.mold_code == d.mold_code)
|
||||
.LeftJoin<ToolMoldMaintainItemRecord>((a, b, c, d, e) => e.plan_id == b.id && e.mold_id == c.id)
|
||||
.LeftJoin<UserEntity>((a, b, c, d, e, f) => b.create_id == f.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f, g) => c.mold_status == g.Id)
|
||||
// .LeftJoin<ToolMoldMaintainItemRecord>((a, b, c, d, e) => e.plan_id == b.id && e.mold_id == c.id)
|
||||
.LeftJoin<UserEntity>((a, b, c, d, e) => b.create_id == e.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f) => c.mold_status == f.Id)
|
||||
.Where((a, b, c, d, e, f) => b.create_time != null)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.maintain_info), (a, b, c, d, e, f, g) => c.mold_code!.Contains(input.maintain_info) || c.mold_name!.Contains(input.maintain_info))
|
||||
.WhereIF(start_time != null, (a, b, c, d, e, f, g) => b.create_time != null && b.create_time >= start_time)
|
||||
.WhereIF(end_time != null, (a, b, c, d, e, f, g) => b.create_time != null && b.create_time <= end_time)
|
||||
.WhereIF(input.status == "待保养", (a, b, c, d, e, f, g) => !records.Contains(a.maintain_plan_id + a.mold_id))
|
||||
.WhereIF(input.status == "已完成", (a, b, c, d, e, f, g) => records.Contains(a.maintain_plan_id + a.mold_id))
|
||||
.Select((a, b, c, d, e, f, g) => new PadMainListOutput
|
||||
.WhereIF(!string.IsNullOrEmpty(input.maintain_info), (a, b, c, d, e, f) => c.mold_code!.Contains(input.maintain_info) || c.mold_name!.Contains(input.maintain_info))
|
||||
.WhereIF(start_time != null, (a, b, c, d, e, f) => b.create_time != null && b.create_time >= start_time)
|
||||
.WhereIF(end_time != null, (a, b, c, d, e, f) => b.create_time != null && b.create_time <= end_time)
|
||||
.WhereIF(input.status == "待保养", (a, b, c, d, e, f) => !records.Contains(a.maintain_plan_id + a.mold_id))
|
||||
.WhereIF(input.status == "已完成", (a, b, c, d, e, f) => records.Contains(a.maintain_plan_id + a.mold_id))
|
||||
.Select((a, b, c, d, e, f) => new PadMainListOutput
|
||||
{
|
||||
plan_id = b.id,
|
||||
mold_id = c.id,
|
||||
mold_code = c.mold_code!,
|
||||
mold_name = c.mold_name!,
|
||||
mold_status = g.FullName!,
|
||||
mold_status = f.FullName!,
|
||||
status = input.status,
|
||||
createuser = f.RealName,
|
||||
createuser = e.RealName,
|
||||
createtime = b.create_time == null ? "" : b.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
plan_start_time = b.plan_start_date == null ? "" : b.plan_start_date.Value.ToString(DbTimeFormat.SS),
|
||||
starttime = d.plan_start_time == null ? "" : d.plan_start_time.Value.ToString(DbTimeFormat.SS),
|
||||
finishtime= d.plan_end_time == null ? "" : d.plan_end_time.Value.ToString(DbTimeFormat.SS),
|
||||
}).OrderBy($"{input.sidx} {input.sort}").ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50);
|
||||
return PageResult<PadMainListOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
@@ -303,7 +305,23 @@ namespace Tnb.EquipMgr
|
||||
return items;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetMaintainItem(MoldMaintainRunUpInput input)
|
||||
{
|
||||
var data = await _db.Queryable<ToolMoldMaintainItemRecord>()
|
||||
.LeftJoin<ToolMoldMaintainItem>((a, b) => a.item_id == b.id)
|
||||
.LeftJoin<ToolMoldMaintainGroup>((a, b, c) => a.item_group_id == c.id)
|
||||
.Where((a, b, c) => a.plan_id == input.plan_id && a.mold_id == input.mold_id)
|
||||
.Select((a, b, c) => new MaintainItemResult
|
||||
{
|
||||
group_name = c.name!,
|
||||
item_name = b.name!,
|
||||
result = a.result,
|
||||
|
||||
})
|
||||
.ToListAsync();
|
||||
return data;
|
||||
}
|
||||
/// <summary>
|
||||
/// 模具保养计划执行-开始模具保养
|
||||
/// </summary>
|
||||
@@ -447,6 +465,11 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
throw new ArgumentException($"parameter {nameof(input.items)} not be null or empty");
|
||||
}
|
||||
var plan_code = _db.Queryable<ToolMoldMaintainPlan>().Where(p => p.id == input.plan_id).Select(p=>p.plan_code).First();
|
||||
var mold_code = _db.Queryable<ToolMolds>().Where(p => p.id == input.mold_id).Select(p => p.mold_code).First();
|
||||
if (!string.IsNullOrEmpty(plan_code)&& !string.IsNullOrEmpty(mold_code)) {
|
||||
_ = await _db.Updateable<ToolMoldMaintainRunRecord>().SetColumns(it => new ToolMoldMaintainRunRecord { plan_end_time = DateTime.Now }).Where(it => it.plan_code == plan_code && it.mold_code== mold_code).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
List<ToolMoldMaintainItemRecord> records = new();
|
||||
foreach (MaintainItemInfo item in input.items)
|
||||
@@ -505,6 +528,11 @@ namespace Tnb.EquipMgr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 模具保养计划执行-保养完成
|
||||
/// </summary>
|
||||
|
||||
@@ -15,6 +15,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
/// <summary>
|
||||
/// 打印份数
|
||||
/// </summary>
|
||||
public int copies { get; set; } = 2;
|
||||
public int copies { get; set; } = 1;
|
||||
}
|
||||
}
|
||||
|
||||
57
WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStkTemp.cs
Normal file
57
WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStkTemp.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 在库物料导入
|
||||
/// </summary>
|
||||
[SugarTable("wms_stk_temp")]
|
||||
public partial class WmsStkTemp : BaseEntity<string>
|
||||
{
|
||||
public WmsStkTemp()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 库位
|
||||
/// </summary>
|
||||
public string? location_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料
|
||||
/// </summary>
|
||||
public string? material_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规格型号
|
||||
/// </summary>
|
||||
public string? material_specification { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批次
|
||||
/// </summary>
|
||||
public string? code_batch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 箱号
|
||||
/// </summary>
|
||||
public string? container_no { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public decimal codeqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具编号
|
||||
/// </summary>
|
||||
public string? carry_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具ID
|
||||
/// </summary>
|
||||
public string? carry_id { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 在库物料导入
|
||||
/// </summary>
|
||||
|
||||
public partial class WmsStkTemp
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string material_id { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 库位ID
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string location_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
|
||||
public string unit_id { get; set; } = string.Empty;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -82,11 +82,17 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Result> LoadConfirm(ConfirmInput input)
|
||||
{
|
||||
Log.Information("取货确认..................");
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
Logger.Information("取货确认..................");
|
||||
var whereExp = Expressionable.Create<WmsElevatorH, WmsElevatorD, WmsDistaskH>()
|
||||
.And((a, b, c) => c.bill_code == input.taskCode)
|
||||
.AndIF(SqlFunc.Contains("DT-R", input.sourceName), (a, b, c) => c.startpoint_code == input.sourceName)
|
||||
.AndIF(SqlFunc.Contains("DT-C", input.sourceName), (a, b, c) => c.endlocation_code == input.sourceName)
|
||||
.ToExpression();
|
||||
|
||||
WmsElevatorH elevator = await _db.Queryable<WmsElevatorH>().LeftJoin<WmsElevatorD>((a, b) => a.id == b.bill_id)
|
||||
.LeftJoin<WmsDistaskH>((a, b, c) => b.location_id == c.startlocation_id)
|
||||
.Where((a, b, c) => c.endpoint_code == input.sourceName && input.taskCode == input.taskCode)
|
||||
WmsElevatorH elevator = await _db.Queryable<WmsElevatorH>().InnerJoin<WmsElevatorD>((a, b) => a.id == b.bill_id)
|
||||
.InnerJoin<WmsDistaskH>((a, b, c) => b.location_id == c.startlocation_id)
|
||||
.Where(whereExp)
|
||||
.Select((a, b, c) => new WmsElevatorH
|
||||
{
|
||||
distask_id = c.id,
|
||||
@@ -132,6 +138,7 @@ namespace Tnb.WarehouseMgr
|
||||
throw;
|
||||
}
|
||||
return await ToApiResult(HttpStatusCode.OK, "未启用");
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -142,14 +149,21 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Result> UnloadConfirm(ConfirmInput input)//
|
||||
{
|
||||
Logger.Information($"输入参数:{JsonConvert.SerializeObject(input)}");
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
Logger.Information("放货确认..................");
|
||||
Logger.Information($"输入参数:{JsonConvert.SerializeObject(input)}");
|
||||
try
|
||||
{
|
||||
var whereExp = Expressionable.Create<WmsElevatorH, WmsElevatorD, WmsDistaskH>()
|
||||
.And((a, b, c) => c.bill_code == input.taskCode)
|
||||
.AndIF(SqlFunc.Contains("DT-R", input.sourceName), (a, b, c) => c.startpoint_code == input.sourceName)
|
||||
.AndIF(SqlFunc.Contains("DT-C", input.sourceName), (a, b, c) => c.endlocation_code == input.sourceName)
|
||||
.ToExpression();
|
||||
|
||||
//根据Agv传递的参数获取,对应的电梯
|
||||
WmsElevatorH elevator = await _db.Queryable<WmsElevatorH>().LeftJoin<WmsElevatorD>((a, b) => a.id == b.bill_id)
|
||||
.LeftJoin<WmsDistaskH>((a, b, c) => b.location_id == c.endlocation_id)
|
||||
.Where((a, b, c) => c.endpoint_code == input.targetName && (c.bill_code == input.taskCode || c.bill_code == input.taskChainCode))
|
||||
.Where(whereExp)
|
||||
.Select((a, b, c) => new WmsElevatorH
|
||||
{
|
||||
end_floor = SqlFunc.ToInt32(c.end_floor),
|
||||
@@ -201,7 +215,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "电梯还未开门,请重试!");
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -209,6 +223,7 @@ namespace Tnb.WarehouseMgr
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "电梯还未开门,请重试!");
|
||||
throw;
|
||||
}
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -218,6 +233,8 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Result> TaskChainCallBack(TaskChainCallBackInput input)
|
||||
{
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
|
||||
try
|
||||
{
|
||||
Logger.Information($"任务链上报->任务链编号:{input.taskChainCode},状态:{input.status},设备ID:{input.deviceID}");
|
||||
@@ -254,7 +271,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*ConnectionConfigOptions opts = App.GetOptions<ConnectionConfigOptions>();
|
||||
@@ -281,7 +298,10 @@ namespace Tnb.WarehouseMgr
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!");
|
||||
throw;
|
||||
}
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -292,7 +312,9 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Result> TaskCallback(TaskCallBackInput input)
|
||||
{
|
||||
Log.Information($"任务状态上报->接收参数:{JsonConvert.SerializeObject(input)}");
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
|
||||
Logger.Information($"任务状态上报->接收参数:{JsonConvert.SerializeObject(input)}");
|
||||
try
|
||||
{
|
||||
|
||||
@@ -305,6 +327,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
disTaskIds = disTasks.Select(x => x.id).ToList()
|
||||
};
|
||||
|
||||
Logger.Information($"设备取返回输入参数:{JsonConvert.SerializeObject(taskExecuteAfterUpInput)}");
|
||||
await _wareHouseService.TaskExecuteAfter(taskExecuteAfterUpInput);
|
||||
Logger.Information($"Agv取货完成,任务Id:{string.Join(",", disTasks.Select(x => x.id))}");
|
||||
@@ -312,8 +335,11 @@ namespace Tnb.WarehouseMgr
|
||||
if (elevatorQueueItem != null)
|
||||
{
|
||||
Logger.Information("开始进入关门流程");
|
||||
var disTask = disTasks.Find(x => x.id == elevatorQueueItem.distask_id);
|
||||
int doorStatus = await _elevatorControlService.GetTagAsync(elevatorQueueItem.elevator_code, ElevatorConsts.DoorStatus);
|
||||
if (doorStatus.ToEnum<EnumDoorStatus>() != EnumDoorStatus.关门到位保持)
|
||||
if (doorStatus.ToEnum<EnumDoorStatus>() != EnumDoorStatus.关门到位保持
|
||||
&& !disTask.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase)
|
||||
)
|
||||
{
|
||||
_ = await _elevatorControlService.SendOpenCloseCmd(elevatorQueueItem.elevator_code, 4); //向电梯发送前门关门指令
|
||||
_ = await _db.Deleteable(elevatorQueueItem).ExecuteCommandAsync();
|
||||
@@ -347,7 +373,9 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
_ = InvokeGenPretaskExcute();
|
||||
}
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -303,8 +303,10 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
var tasks = tags.Select(tag => GetTag(tag));
|
||||
var results = await Task.WhenAll(tasks.Select(task => task));
|
||||
Logger.Information($"状态结果:{string.Join(",",results)}");
|
||||
var jos = results.Select(r => JObject.Parse(r)).ToArray();
|
||||
var (sysStatus, runStatus, floorNo, doorStatus, agvStatus) = (0, 0, 0, 0, 0);
|
||||
|
||||
var propertyMap = new Dictionary<string, Action<int>>()
|
||||
{
|
||||
{ ElevatorConsts.SysStatus, v => sysStatus = v },
|
||||
@@ -425,7 +427,7 @@ namespace Tnb.WarehouseMgr
|
||||
throw new ArgumentNullException(nameof(input.devNames));
|
||||
}
|
||||
var tasks = ParallelWriteTagAsync(input);
|
||||
await Task.WhenAll(tasks);
|
||||
var writeRes = await Task.WhenAll(tasks);
|
||||
var timedTaskSvc = _backgudSvc as TimedTaskBackgroundService;
|
||||
if (timedTaskSvc != null)
|
||||
{
|
||||
|
||||
@@ -250,7 +250,7 @@ namespace Tnb.WarehouseMgr
|
||||
floor = b.floor
|
||||
|
||||
}, true).ToListAsync();
|
||||
Logger.Information($"可用电梯信息:{elevatorList.Select(e => e.elevator_code)}");
|
||||
Logger.Information($"可用电梯信息:{string.Join(",", elevatorList.Select(e => e.elevator_code).Distinct())}");
|
||||
|
||||
|
||||
//获取所有未下发的预任务申请
|
||||
@@ -265,6 +265,8 @@ namespace Tnb.WarehouseMgr
|
||||
third_eqp_type = c.third_eqp_type,
|
||||
}, true)
|
||||
.ToListAsync();
|
||||
Logger.Information("获取未下发的预任务列表完成的......");
|
||||
|
||||
List<WmsPretaskH> agvElevatorTasks = preTasks
|
||||
.Where(it => it.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase) &&
|
||||
!it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -392,7 +394,6 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
//disTasks.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
||||
|
||||
|
||||
int row = await db.Insertable(disTasks).ExecuteCommandAsync();
|
||||
@@ -408,6 +409,8 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
await db.Ado.CommitTranAsync();
|
||||
|
||||
Logger.Information("预任务执行完成");
|
||||
|
||||
if (string.Equals(_eleCtlCfg.Environment, ElevatorConsts.EnvironmentName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
//呼梯操作
|
||||
@@ -418,7 +421,7 @@ namespace Tnb.WarehouseMgr
|
||||
foreach (var at in agvDTTasks)
|
||||
{
|
||||
var ele = elevatorList.Find(x => x.location_code == at.endlocation_code);
|
||||
Logger.Information($"ele.elevator_id:{ele?.elevator_id},elevator_code:{ele.elevator_code}");
|
||||
Logger.Information($"ele.elevator_id:{ele?.elevator_id},elevator_code:{ele?.elevator_code}");
|
||||
if (ele != null)
|
||||
{
|
||||
at.device_id = ele.elevator_id;
|
||||
@@ -429,6 +432,7 @@ namespace Tnb.WarehouseMgr
|
||||
.Select(it => (it.endlocation_code, it.device_id, it.id, it.start_floor)).ToList();
|
||||
if (endLocCodes?.Count > 0)
|
||||
{
|
||||
Logger.Information("呼梯操作");
|
||||
await CallingLanding(endLocCodes);
|
||||
}
|
||||
//执行电梯任务
|
||||
@@ -437,9 +441,6 @@ namespace Tnb.WarehouseMgr
|
||||
if (elevatorTasks?.Count > 0)
|
||||
{
|
||||
Logger.Information($"当前电梯任务数:{elevatorTasks?.Count ?? 0}");
|
||||
Logger.Information("准备执行电梯任务");
|
||||
Logger.Information("执行电梯任务");
|
||||
|
||||
foreach (WmsDistaskH? elevatorTask in elevatorTasks)
|
||||
{
|
||||
await ExecuteTargetFloorTask(elevatorTask);
|
||||
@@ -463,6 +464,7 @@ namespace Tnb.WarehouseMgr
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error("生成预任务执行时出现错误", ex);
|
||||
Logger.Error(ex.StackTrace!);
|
||||
await db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
@@ -479,6 +481,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// <returns></returns>
|
||||
private async Task CallingLanding(List<(string endlocation_code, string device_id, string id, int floorNO)> endLocCodes)
|
||||
{
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
Logger.Information($" 开始呼梯操作.............");
|
||||
Logger.Information($"电梯信息:{JsonConvert.SerializeObject(s_elevatorMap)}");
|
||||
try
|
||||
@@ -546,6 +549,8 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
//如果当前电梯有任务在做,将当前呼梯任务放入待执行队列
|
||||
_ = await _db.Insertable(elevatorQueueItem).ExecuteCommandAsync();
|
||||
|
||||
Logger.Information("呼梯任务执行完成");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -554,6 +559,7 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.Error($"呼梯操作错误堆栈跟踪:{Environment.NewLine}{ex.StackTrace}");
|
||||
throw;
|
||||
}
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -563,6 +569,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// <returns></returns>
|
||||
private async Task ExecuteTargetFloorTask(WmsDistaskH disTask)
|
||||
{
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
//收到放货确认通知,向电梯发送到3楼的指令
|
||||
Logger.Information($"开始执行电梯任务,任务ID:{disTask.id}");
|
||||
try
|
||||
@@ -631,6 +638,8 @@ namespace Tnb.WarehouseMgr
|
||||
disTaskIds = disTaskIds,
|
||||
};
|
||||
await TaskComplate(tcUpInput);
|
||||
|
||||
Logger.Information("电梯任务执行完成");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -639,6 +648,7 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.Error("执行到目标楼层电梯任务失败", ex);
|
||||
throw;
|
||||
}
|
||||
Logger.Information("--------------------------------------------------------");
|
||||
}
|
||||
/// <summary>
|
||||
/// Agv调度
|
||||
@@ -780,7 +790,6 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Updateable(eles).ReSetValue(it => it.task_nums--).ExecuteCommandAsync();
|
||||
|
||||
//更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位
|
||||
Logger.Information("更新载具及库位准备中.....");
|
||||
|
||||
List<(string carry_id, string carry_status, string endlocation_id, string endlocation_code)> multiList = disTasks.Select(it => (it.carry_id, it.carry_status, it.endlocation_id, it.endlocation_code)).ToList();
|
||||
Dictionary<string, object> locWhIdMap = await _db.Queryable<BasLocation>().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.wh_id);
|
||||
@@ -819,7 +828,6 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
locIts.Add(loc);
|
||||
}
|
||||
Logger.Information("更新载具及库位开始.....");
|
||||
_ = await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync();
|
||||
//更新条码的库位和仓库信息
|
||||
_ = await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync();
|
||||
@@ -830,7 +838,6 @@ namespace Tnb.WarehouseMgr
|
||||
*/ //更新业务主表的单据状态
|
||||
foreach (WmsDistaskH? dt in disTasks)
|
||||
{
|
||||
Logger.Information("开始业务回更");
|
||||
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!, distaskCodes = disTaskCodes, carryIds = disTasks.Select(x => x.carry_id).ToList() };
|
||||
|
||||
@@ -845,12 +852,13 @@ namespace Tnb.WarehouseMgr
|
||||
upInput.loginType = "web";//(!string.IsNullOrEmpty(_userManager?.LoginType) ? "app" : "web") ?? "web";
|
||||
if (dt.is_sign == 1 && dt.chain_type == "3")
|
||||
{
|
||||
Logger.Information("执行业务回更操作.....");
|
||||
await DoUpdate(upInput);
|
||||
}
|
||||
}
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
|
||||
Logger.Information("任务操作完成");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -993,7 +1001,6 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (points?.FindAll(x => x.location_code != null && x.location_code.Contains("dt", StringComparison.OrdinalIgnoreCase))?.Count > 0)
|
||||
{
|
||||
Logger.Information("包含电梯Agv任务");
|
||||
//查询当前电梯点
|
||||
List<WmsElevatorD> curEleDs = await _db.Queryable<WmsElevatorD>().InnerJoin<WmsElevatorH>((a, b) => a.bill_id == b.id).Where((a, b) => points.Select(x => x.id).Contains(a.point_id)).ToListAsync();
|
||||
Logger.Information($"curEleDs==null :{curEleDs == null},curEleDs:{string.Join(",", curEleDs.Select(x => x.bill_id))}");
|
||||
@@ -1002,7 +1009,6 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
//当前电梯
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id);
|
||||
Logger.Information($"curEle==null :{curEle == null}");
|
||||
|
||||
//同电梯组电梯
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enabled == 1).ToListAsync();
|
||||
|
||||
103
WarehouseMgr/Tnb.WarehouseMgr/WmsInternalTempTestService.cs
Normal file
103
WarehouseMgr/Tnb.WarehouseMgr/WmsInternalTempTestService.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Extension;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Entity;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
public class WmsInternalTempTestService : BaseWareHouseService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
public WmsInternalTempTestService(ISqlSugarRepository<BasLocation> repo)
|
||||
{
|
||||
_db = repo.AsSugarClient();
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改列
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task UpdateColAsync()
|
||||
{
|
||||
List<BasLocation> list = await _db.Queryable<BasLocation>().Where(it => it.location_code.StartsWith("CP-B", StringComparison.OrdinalIgnoreCase)).OrderBy(i => i.location_code).ToListAsync();
|
||||
foreach (var loc in list)
|
||||
{
|
||||
var input = loc.location_code.Substring(loc.location_code.Length - 2);
|
||||
int num = input.Match(@"\d+").ParseToInt();
|
||||
await _db.Updateable<BasLocation>().SetColumns(it => it.loc_column == num).Where(it => it.id == loc.id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 在库物料维护
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task UpdateStkMinsync()
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
List<WmsStkTemp> list = await _db.Queryable<WmsStkTemp>().InnerJoin<BasMaterial>((a, b) => a.material_code==b.code)
|
||||
.InnerJoin<BasLocation>((a, b, c) => a.location_code == c.location_code)
|
||||
.Select((a, b, c) => new WmsStkTemp
|
||||
{
|
||||
material_id = b.id,
|
||||
location_id = c.id,
|
||||
unit_id = b.unit_id
|
||||
|
||||
}, true).ToListAsync();
|
||||
foreach (var carrycode in list)
|
||||
{
|
||||
//更新载具条码及状态
|
||||
WmsCarryCode wmsCarryCode = new();
|
||||
|
||||
|
||||
wmsCarryCode.org_id = "24755469898005";
|
||||
wmsCarryCode.barcode = carrycode.carry_code;
|
||||
wmsCarryCode.carry_id = carrycode.carry_id;
|
||||
wmsCarryCode.material_id = carrycode.material_id;
|
||||
wmsCarryCode.material_code = carrycode.material_code;
|
||||
wmsCarryCode.code_batch = carrycode.code_batch;
|
||||
wmsCarryCode.codeqty = carrycode.codeqty;
|
||||
wmsCarryCode.is_out = 0;
|
||||
wmsCarryCode.location_id = carrycode.location_id;
|
||||
wmsCarryCode.location_code = carrycode.location_code;
|
||||
wmsCarryCode.unit_id = carrycode.unit_id;
|
||||
wmsCarryCode.warehouse_id = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
||||
wmsCarryCode.create_id = "25241349546773";
|
||||
wmsCarryCode.material_specification = carrycode.material_specification;
|
||||
wmsCarryCode.container_no = carrycode.container_no;
|
||||
wmsCarryCode.create_time = DateTime.Now;
|
||||
|
||||
if (wmsCarryCode.carry_id != null && wmsCarryCode.location_id != null)
|
||||
{
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.占用).ToString(), location_id = wmsCarryCode.location_id, location_code = wmsCarryCode.location_code }).Where(it => it.id == wmsCarryCode.carry_id).ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.占用).ToString() }).Where(it => it.id == wmsCarryCode.carry_id).ExecuteCommandAsync();
|
||||
}
|
||||
await _db.Insertable(wmsCarryCode).ExecuteCommandAsync();
|
||||
//更新库位数据
|
||||
if (wmsCarryCode.location_id != null)
|
||||
{
|
||||
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_use = ((int)EnumCarryStatus.占用).ToString() }).Where(it => it.id == wmsCarryCode.location_id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -609,6 +609,8 @@ namespace Tnb.WarehouseMgr
|
||||
.And((a, b, c) => a.status == (int)EnumCarryStatus.占用)
|
||||
.And((a, b, c) => c.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
.And((a, b, c) => b.material_id == os.material_id)
|
||||
.AndIF(!string.IsNullOrEmpty(os.material_specification), (a, b, c) => b.material_specification == os.material_specification)
|
||||
.AndIF(!string.IsNullOrEmpty(os.container_no), (a, b, c) => b.container_no == os.container_no)
|
||||
.AndIF(!string.IsNullOrEmpty(os.code_batch), (a, b, c) => b.code_batch == os.code_batch);
|
||||
|
||||
List<WmsCarryCode> carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
||||
|
||||
Reference in New Issue
Block a user