报表、电梯优化......

This commit is contained in:
2024-08-27 22:44:42 +08:00
parent be5bdc46e3
commit ab2f4c5b9b
9 changed files with 262 additions and 40 deletions

View File

@@ -1,4 +1,5 @@
using System.Drawing.Drawing2D;
using System.Dynamic;
using Aliyun.OSS;
using Aop.Api.Domain;
using JNPF;
@@ -23,6 +24,7 @@ using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.Common.Extension;
using Tnb.EquipMgr.Entities;
using Tnb.QcMgr.Entities;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Configs;
using Tnb.WarehouseMgr.Entities.Consts;
@@ -395,17 +397,30 @@ namespace Tnb.WarehouseMgr
_ = await _elevatorControlService.SendOpenCloseCmd(devName, 3); //发送电梯前门开门指令
}
// 3 4号梯要电梯是当前楼层开门状态就能进
// 3 4号梯要电梯是当前楼层开门状态就能进
bool canEnter = false;
if (devName == "Elevator3" || devName == "Elevator4")
{
string sno = devName.Match(@"\d+");
// 如果判定好了几托下,则不允许开门放货
List<WmsDistaskH> elevatorTasks = _db.Queryable<WmsDistaskH>()
.Where(r => r.startlocation_code == $"DT-3-{sno}" && r.endlocation_code == $"DT-1-{sno}" && r.act_start_date != null && r.act_end_date == null
&& r.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID && r.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID).ToList();
if (elevatorTasks.Count >= 0)
{
Logger.LogInformation($"电梯{devName}内已有货,且已判定为一托下!");
return await ToApiResult(HttpStatusCode.InternalServerError, $"电梯内{devName}已有货,且已判定为一托下!");
}
// 如果还未判定几托下,判断是否放了两托货
elevatorTasks = _db.Queryable<WmsDistaskH>()
.Where(r => r.startlocation_code == $"DT-3-{sno}" && r.endlocation_code == $"DT-1-{sno}" && r.act_start_date == null && r.act_end_date == null
&& r.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID && r.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID).ToList();
if (elevatorTasks.Count >= 2)
{
return await ToApiResult(HttpStatusCode.InternalServerError, "电梯内已有两托货!");
Logger.LogInformation($"电梯内{devName}已有两托货!");
return await ToApiResult(HttpStatusCode.InternalServerError, $"电梯内{devName}已有两托货!");
}
canEnter = true;
}
@@ -1064,5 +1079,37 @@ namespace Tnb.WarehouseMgr
}
return ToApiResult(HttpStatusCode.OK, data);
}
///// <summary>
///// 电梯有货无货状态(给三四号梯发货用)
///// </summary>
///// <param name="input"></param>
///// <returns></returns>
//[HttpPost]
//public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> ElevatorStatus(ElevatorStatusInput input)
//{
// try
// {
// //List<WmsDistaskH> elevatorTasks = _db.Queryable<WmsDistaskH>()
// // .Where(r => r.area_code == input.ElevatorName && r.act_start_date == null && r.act_end_date == null && r.start_floor == 3 && r.end_floor == 1
// // && r.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID && r.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID).ToList();
// WmsElevatorH wmsElevatorH = await _db.Queryable<WmsElevatorH>().Where(r => r.area_code == input.ElevatorName).FirstAsync();
// dynamic data = new ExpandoObject();
// data.ElevatorName = input.ElevatorName;
// data.status = wmsElevatorH.isneedwcsreset == 1;
// Logger.Information($"获取电梯{input.ElevatorName} 是否需要重置WCS深浅位 {wmsElevatorH.isneedwcsreset == 1}");
// return await ToApiResult(HttpStatusCode.OK, data);
// }
// catch (Exception ex)
// {
// Logger.Error($"获取电梯{input.ElevatorName}是否需要重置WCS深浅位失败", ex.Message);
// Logger.Error($"获取电梯{input.ElevatorName}是否需要重置WCS深浅位失败", ex.StackTrace);
// return await ToApiResult(HttpStatusCode.InternalServerError, $"获取电梯{input.ElevatorName}是否需要重置WCS深浅位失败");
// }
//}
}
}